From 32d4f1b40029f3afa4f31d4c34f0aee6be8260a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 14:52:59 +0000 Subject: [PATCH 1/3] Initial plan From 55e28bc02cde9bfb3d341fafaa5327ff1e760b97 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 15:00:58 +0000 Subject: [PATCH 2/3] feat: add uZoomRanger() function for interactive range selector below uPlot charts Agent-Logs-Url: https://github.com/dreamRs/uPlot-r/sessions/8221e34a-37a8-4b6a-b979-d80fd9a01ce0 Co-authored-by: pvictor <4415580+pvictor@users.noreply.github.com> --- NAMESPACE | 1 + R/zoom_ranger.R | 37 +++++ examples/ex-uZoomRanger.R | 15 ++ inst/htmlwidgets/uPlot.js | 2 +- man/uZoomRanger.Rd | 53 +++++++ srcjs/modules/zoomRangerPlugin.js | 249 ++++++++++++++++++++++++++++++ srcjs/widgets/uPlot.js | 27 +++- 7 files changed, 381 insertions(+), 3 deletions(-) create mode 100644 R/zoom_ranger.R create mode 100644 examples/ex-uZoomRanger.R create mode 100644 man/uZoomRanger.Rd create mode 100644 srcjs/modules/zoomRangerPlugin.js diff --git a/NAMESPACE b/NAMESPACE index dde3283..6a4cca3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,6 +24,7 @@ export(uSeries) export(uSetData) export(uSetScale) export(uSetSeries) +export(uZoomRanger) importFrom(grDevices,palette) importFrom(htmlwidgets,JS) importFrom(htmlwidgets,createWidget) diff --git a/R/zoom_ranger.R b/R/zoom_ranger.R new file mode 100644 index 0000000..f6390ca --- /dev/null +++ b/R/zoom_ranger.R @@ -0,0 +1,37 @@ + +#' Add a zoom ranger (range selector) below a uPlot chart +#' +#' Adds an interactive range-selector chart below the main uPlot chart. +#' The ranger allows the user to: +#' - drag the selection area to pan the main chart, +#' - drag the left/right grip handles to resize the selection, +#' - zoom the main chart by dragging directly on the ranger. +#' When the main chart's X scale changes (e.g. via cursor drag-zoom), the +#' ranger selection updates automatically. +#' +#' @param uplot Chart created with [uPlot()]. +#' @param height Height of the ranger chart in pixels. Default is `80`. +#' @param stroke Stroke color for the series drawn in the ranger. +#' Defaults to the stroke color(s) already set on the chart series. +#' @param grip_color Color of the left and right resize grip handles. +#' Default is `"#4a90d9"`. +#' @param grip_width Width (in pixels) of the grip handles. Default is `8`. +#' +#' @return An `htmlwidget` object of class `"uPlot"`. +#' @export +#' +#' @example examples/ex-uZoomRanger.R +uZoomRanger <- function(uplot, + height = 80, + stroke = NULL, + grip_color = "#4a90d9", + grip_width = 8) { + check_uplot(uplot) + uplot$x$config$zoomRanger <- drop_nulls(list( + height = height, + stroke = stroke, + gripColor = grip_color, + gripWidth = grip_width + )) + return(uplot) +} diff --git a/examples/ex-uZoomRanger.R b/examples/ex-uZoomRanger.R new file mode 100644 index 0000000..678868a --- /dev/null +++ b/examples/ex-uZoomRanger.R @@ -0,0 +1,15 @@ +library(uPlot) + +# Basic zoom ranger: select a window on the X axis, +# drag to pan, use grips to resize the selection. +uPlot( + data = eco2mix[, c("datetime", "consumption")], + options = list( + title = "Electricity consumption in France", + series = list( + list(label = "Time"), + list(label = "Consumption (MW)", stroke = "#0174DF") + ) + ) +) %>% + uZoomRanger() diff --git a/inst/htmlwidgets/uPlot.js b/inst/htmlwidgets/uPlot.js index ab3fffe..e3a8f95 100644 --- a/inst/htmlwidgets/uPlot.js +++ b/inst/htmlwidgets/uPlot.js @@ -1 +1 @@ -(()=>{var t={350:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(81),s=n.n(i),r=n(645),l=n.n(r)()(s());l.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=l},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var l={};if(i)for(var a=0;a0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},484:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",i="second",s="minute",r="hour",l="day",a="week",o="month",u="quarter",c="year",h="date",d="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+m(i,2,"0")+":"+m(s,2,"0")},m:function t(e,n){if(e.date()1)return t(l[0])}else{var a=e.name;b[a]=e,s=a}return!i&&s&&(w=s),s||!i&&w},k=function(t,e){if(x(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},z=g;z.l=y,z.i=x,z.w=function(t,e){return k(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function _(t){this.$L=y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[v]=!0}var m=_.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(z.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(f);if(i){var s=i[2]-1||0,r=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)):new Date(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return z},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(t,e){var n=k(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return k(t)=0&&(r[h]=parseInt(c,10))}var d=r[3],f=24===d?0:d,p=r[0]+"-"+r[1]+"-"+r[2]+" "+f+":"+r[4]+":"+r[5]+":000",_=+e;return(s.utc(p).valueOf()-(_-=_%1e3))/6e4},o=i.prototype;o.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),l=this.toDate(),a=l.toLocaleString("en-US",{timeZone:t}),o=Math.round((l-new Date(a))/1e3/60),u=15*-Math.round(l.getTimezoneOffset()/15)-o;if(Number(u)){if(n=s(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),e){var c=n.utcOffset();n=n.add(i-c,"minute")}}else n=this.utcOffset(0,e);return n.$x.$timezone=t,n},o.offsetName=function(t){var e=this.$x.$timezone||s.tz.guess(),n=l(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var u=o.startOf;o.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return u.call(this,t,e);var n=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(n,t,e).tz(this.$x.$timezone,!0)},s.tz=function(t,e,n){var i=n&&e,l=n||e||r,o=a(+s(),l);if("string"!=typeof t)return s(t).tz(l);var u=function(t,e,n){var i=t-60*e*1e3,s=a(i,n);if(e===s)return[i,e];var r=a(i-=60*(s-e)*1e3,n);return s===r?[i,s]:[t-60*Math.min(s,r)*1e3,Math.max(s,r)]}(s.utc(t,i).valueOf(),o,l),c=u[0],h=u[1],d=s(c).utcOffset(h);return d.$x.$timezone=l,d},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(t){r=t}}}()},178:function(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,s,r){var l=s.prototype;r.utc=function(t){return new s({date:t,utc:!0,args:arguments})},l.utc=function(e){var n=r(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},l.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var a=l.parse;l.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var o=l.init;l.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var u=l.utcOffset;l.utcOffset=function(i,s){var r=this.$utils().u;if(r(i))return this.$u?0:r(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var s=(""+i[0]).match(n)||["-",0,0],r=s[0],l=60*+s[1]+ +s[2];return 0===l?0:"+"===r?l:-l}(i),null===i))return this;var l=Math.abs(i)<=16?60*i:i,a=this;if(s)return a.$offset=l,a.$u=0===i,a;if(0!==i){var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(l+o,t)).$offset=l,a.$x.$localOffset=o}else a=this.utc();return a};var c=l.format;l.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},l.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var h=l.toDate;l.toDate=function(t){return"s"===t&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():h.call(this)};var d=l.diff;l.diff=function(t,e,n){if(t&&this.$u===t.$u)return d.call(this,t,e,n);var i=this.local(),s=r(t).local();return d.call(i,s,e,n)}}}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i{"use strict";var e={};t.exports=function(t,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";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)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";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(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.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 i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";n.r(i),n.d(i,{candlestickPlugin:()=>zi,columnHighlightPlugin:()=>wi,dayjs:()=>Wl,drawHLine:()=>vi,drawHRect:()=>ki,drawPoints:()=>bi,drawVLine:()=>xi,drawVRect:()=>yi,legendAsTooltipPlugin:()=>mi,tooltipPlugin:()=>_i,uPlot:()=>Xn,wheelZoomPlugin:()=>gi}),window.HTMLWidgets;const t="u-off",e="u-label",s="width",r="height",l="top",a="bottom",o="left",u="right",c="#000",h="#0000",d="mousemove",f="mousedown",p="mouseup",_="mouseenter",m="mouseleave",g="dblclick",w="change",b="dppxchange",v="--",x="undefined"!=typeof window,y=x?document:null,k=x?window:null,z=x?navigator:null;let S,M;function T(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function D(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function E(t,e,n){t.style[e]=n+"px"}function A(t,e,n,i){let s=y.createElement(t);return null!=e&&T(s,e),null!=n&&n.insertBefore(s,i),s}function $(t,e){return A("div",t,e)}const O=new WeakMap;function R(e,n,i,s,r){let l="translate("+n+"px,"+i+"px)";l!=O.get(e)&&(e.style.transform=l,O.set(e,l),n<0||i<0||n>s||i>r?T(e,t):D(e,t))}const C=new WeakMap;function P(t,e,n){let i=e+n;i!=C.get(t)&&(C.set(t,i),t.style.background=e,t.style.borderColor=n)}const U=new WeakMap;function Z(t,e,n,i){let s=e+""+n;s!=U.get(t)&&(U.set(t,s),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=i?-e/2+"px":0,t.style.marginTop=i?-n/2+"px":0)}const L={passive:!0},H={...L,capture:!0};function I(t,e,n,i){e.addEventListener(t,n,i?H:L)}function F(t,e,n,i){e.removeEventListener(t,n,L)}function N(t,e,n,i){let s;n=n||0;let r=(i=i||e.length-1)<=2147483647;for(;i-n>1;)s=r?n+i>>1:it((n+i)/2),e[s]=e&&s<=n;s+=i)if(null!=t[s])return s;return-1}function B(t,e,n,i){let s=ut(t),r=ut(e);t==e&&(-1==s?(t*=n,e/=n):(t/=n,e*=n));let l=10==n?ct:ht,a=1==r?rt:it,o=(1==s?it:rt)(l(nt(t))),u=a(l(nt(e))),c=ot(n,o),h=ot(n,u);return 10==n&&(o<0&&(c=Tt(c,-o)),u<0&&(h=Tt(h,-u))),i||2==n?(t=c*s,e=h*r):(t=Mt(t,c),e=St(e,h)),[t,e]}function W(t,e,n,i){let s=B(t,e,n,i);return 0==t&&(s[0]=0),0==e&&(s[1]=0),s}x&&function t(){let e=devicePixelRatio;S!=e&&(S=e,M&&F(w,M,t),M=matchMedia(`(min-resolution: ${S-.001}dppx) and (max-resolution: ${S+.001}dppx)`),I(w,M,t),k.dispatchEvent(new CustomEvent(b)))}();const j={mode:3,pad:.1},G={pad:0,soft:null,mode:0},V={min:G,max:G};function K(t,e,n,i){return Zt(n)?J(t,e,n):(G.pad=n,G.soft=i?0:null,G.mode=i?3:0,J(t,e,V))}function q(t,e){return null==t?e:t}function J(t,e,n){let i=n.min,s=n.max,r=q(i.pad,0),l=q(s.pad,0),a=q(i.hard,-ft),o=q(s.hard,ft),u=q(i.soft,ft),c=q(s.soft,-ft),h=q(i.mode,0),d=q(s.mode,0),f=e-t,p=ct(f),_=at(nt(t),nt(e)),m=ct(_),g=nt(m-p);(f<1e-24||g>10)&&(f=0,0!=t&&0!=e||(f=1e-24,2==h&&u!=ft&&(r=0),2==d&&c!=-ft&&(l=0)));let w=f||_||1e3,b=ct(w),v=ot(10,it(b)),x=Tt(Mt(t-w*(0==f?0==t?.1:1:r),v/10),24),y=t>=u&&(1==h||3==h&&x<=u||2==h&&x>=u)?u:ft,k=at(a,x=y?y:lt(y,x)),z=Tt(St(e+w*(0==f?0==e?.1:1:l),v/10),24),S=e<=c&&(1==d||3==d&&z>=c||2==d&&z<=c)?c:-ft,M=lt(o,z>S&&e<=S?S:at(S,z));return k==M&&0==k&&(M=100),[k,M]}const X=new Intl.NumberFormat(x?z.language:"en-US"),Q=t=>X.format(t),tt=Math,et=tt.PI,nt=tt.abs,it=tt.floor,st=tt.round,rt=tt.ceil,lt=tt.min,at=tt.max,ot=tt.pow,ut=tt.sign,ct=tt.log10,ht=tt.log2,dt=(t,e=1)=>tt.asinh(t/e),ft=1/0;function pt(t){return 1+(0|ct((t^t>>31)-(t>>31)))}function _t(t,e,n){return lt(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,yt=/\.\d*?(?=9{6,}|0{6,})/gm,kt=t=>{if(Pt(t)||Dt.has(t))return t;const e=`${t}`,n=e.match(yt);if(null==n)return t;let i=n[0].length-1;if(-1!=e.indexOf("e-")){let[t,n]=e.split("e");return+`${kt(t)}e${n}`}return Tt(t,i)};function zt(t,e){return kt(Tt(kt(t/e))*e)}function St(t,e){return kt(rt(kt(t/e))*e)}function Mt(t,e){return kt(it(kt(t/e))*e)}function Tt(t,e=0){if(Pt(t))return t;let n=10**e,i=t*n*(1+Number.EPSILON);return st(i)/n}const Dt=new Map;function Et(t){return((""+t).split(".")[1]||"").length}function At(t,e,n,i){let s=[],r=i.map(Et);for(let l=e;l=0?0:e)+(l>=r[a]?0:r[a]),c=10==t?o:Tt(o,u);s.push(c),Dt.set(c,u)}}return s}const $t={},Ot=[],Rt=[null,null],Ct=Array.isArray,Pt=Number.isInteger;function Ut(t){return"string"==typeof t}function Zt(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Lt(t){return null!=t&&"object"==typeof t}const Ht=Object.getPrototypeOf(Uint8Array),It="__proto__";function Ft(t,e=Zt){let n;if(Ct(t)){let i=t.find((t=>null!=t));if(Ct(i)||e(i)){n=Array(t.length);for(let i=0;ir){for(i=l-1;i>=0&&null==t[i];)t[i--]=null;for(i=l+1;iPromise.resolve().then(t):queueMicrotask,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],jt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Gt(t){return t.slice(0,3)}const Vt=jt.map(Gt),Kt=Wt.map(Gt),qt={MMMM:Wt,MMM:Kt,WWWW:jt,WWW:Vt};function Jt(t){return(t<10?"0":"")+t}const Xt={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=>Jt(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Jt(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Jt(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=>Jt(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Jt(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>{return((e=t.getMilliseconds())<10?"00":e<100?"0":"")+e;var e}};function Qt(t,e){e=e||qt;let n,i=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(t);)i.push("{"==n[0][0]?Xt[n[1]]:n[0]);return t=>{let n="";for(let s=0;st%1==0,ne=[1,2,2.5,5],ie=At(10,-32,0,ne),se=At(10,0,32,ne),re=se.filter(ee),le=ie.concat(se),ae="{YYYY}",oe="\n"+ae,ue="{M}/{D}",ce="\n"+ue,he=ce+"/{YY}",de="{aa}",fe="{h}:{mm}"+de,pe="\n"+fe,_e=":{ss}",me=null;function ge(t){let e=1e3*t,n=60*e,i=60*n,s=24*i,r=30*s,l=365*s;return[(1==t?At(10,0,3,ne).filter(ee):At(10,-3,0,ne)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,i,2*i,3*i,4*i,6*i,8*i,12*i,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,l,2*l,5*l,10*l,25*l,50*l,100*l]),[[l,ae,me,me,me,me,me,me,1],[28*s,"{MMM}",oe,me,me,me,me,me,1],[s,ue,oe,me,me,me,me,me,1],[i,"{h}"+de,he,me,ce,me,me,me,1],[n,fe,he,me,ce,me,me,me,1],[e,_e,he+" "+fe,me,ce+" "+fe,me,pe,me,1],[t,_e+".{fff}",he+" "+fe,me,ce+" "+fe,me,pe,me,1]],function(e){return(a,o,u,c,h,d)=>{let f=[],p=h>=l,_=h>=r&&h=s?s:h,l=b+(it(u)-it(g))+St(g-b,r);f.push(l);let p=e(l),_=p.getHours()+p.getMinutes()/n+p.getSeconds()/i,m=h/i,w=d/a.axes[o]._space;for(;l=Tt(l+h,1==t?0:3),!(l>c);)if(m>1){let t=it(Tt(_+m,6))%24,n=e(l).getHours()-t;n>1&&(n=-1),l-=n*i,_=(_+m)%24,Tt((l-f[f.length-1])/h,3)*w>=.7&&f.push(l)}else f.push(l)}return f}}]}const[we,be,ve]=ge(1),[xe,ye,ke]=ge(.001);function ze(t,e){return t.map((t=>t.map(((n,i)=>0==i||8==i||null==n?n:e(1==i||0==t[8]?n:t[1]+n)))))}function Se(t,e){return(n,i,s,r,l)=>{let a,o,u,c,h,d,f=e.find((t=>l>=t[0]))||e[e.length-1];return i.map((e=>{let n=t(e),i=n.getFullYear(),s=n.getMonth(),r=n.getDate(),l=n.getHours(),p=n.getMinutes(),_=n.getSeconds(),m=i!=a&&f[2]||s!=o&&f[3]||r!=u&&f[4]||l!=c&&f[5]||p!=h&&f[6]||_!=d&&f[7]||f[1];return a=i,o=s,u=r,c=l,h=p,d=_,m(n)}))}}function Me(t,e,n){return new Date(t,e,n)}function Te(t,e){return e(t)}function De(t,e){return(n,i,s,r)=>null==r?v:e(t(i))}At(2,-53,53,[1]);const Ee={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:[]},Ae=[0,0];function $e(t,e,n,i=!0){return t=>{0==t.button&&(!i||t.target==e)&&n(t)}}function Oe(t,e,n,i=!0){return t=>{(!i||t.target==e)&&n(t)}}const Re={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Ae[0]=e,Ae[1]=n,Ae},points:{one:!1,show:function(t,e){let n=t.cursor.points,i=$(),l=n.size(t,e);E(i,s,l),E(i,r,l);let a=l/-2;E(i,"marginLeft",a),E(i,"marginTop",a);let o=n.width(t,e,l);return o&&E(i,"borderWidth",o),i},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:$e,mouseup:$e,click:$e,dblclick:$e,mousemove:Oe,mouseleave:Oe,mouseenter:Oe},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,i,s)=>i-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ce={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Pe=Nt({},Ce,{filter:wt}),Ue=Nt({},Pe,{size:10}),Ze=Nt({},Ce,{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"',He="bold "+Le,Ie={show:!0,scale:"x",stroke:c,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:He,side:2,grid:Pe,ticks:Ue,border:Ze,font:Le,lineGap:1.5,rotate:0},Fe={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function Ne(t,e,n,i,s){return e.map((t=>null==t?"":Q(t)))}function Ye(t,e,n,i,s,r,l){let a=[],o=Dt.get(s)||0;for(let t=n=l?n:Tt(St(n,s),o);t<=i;t=Tt(t+s,o))a.push(Object.is(t,-0)?0:t);return a}function Be(t,e,n,i,s,r,l){const a=[],o=t.scales[t.axes[e].scale].log,u=it((10==o?ct:ht)(n));s=ot(o,u),10==o&&(s=le[N(s,le)]);let c=n,h=s*o;10==o&&(h=le[N(h,le)]);do{a.push(c),c+=s,10!=o||Dt.has(c)||(c=Tt(c,Dt.get(s))),c>=h&&(h=(s=c)*o,10==o&&(h=le[N(h,le)]))}while(c<=i);return a}function We(t,e,n,i,s,r,l){let a=t.scales[t.axes[e].scale].asinh,o=i>a?Be(t,e,at(a,n),i,s):[a],u=i>=0&&n<=0?[0]:[];return(n<-a?Be(t,e,at(a,-i),-n,s):[a]).reverse().map((t=>-t)).concat(u,o)}const je=/./,Ge=/[12357]/,Ve=/[125]/,Ke=/1/,qe=(t,e,n,i)=>t.map(((t,s)=>4==e&&0==t||s%i==0&&n.test(t.toExponential()[t<0?1:0])?t:null));function Je(t,e,n,i,s){let r=t.axes[n],l=r.scale,a=t.scales[l],o=t.valToPos,u=r._space,c=o(10,l),h=o(9,l)-c>=u?je:o(7,l)-c>=u?Ge:o(5,l)-c>=u?Ve:Ke;if(h==Ke){let t=nt(o(1,l)-c);if(ts,sn={show:!0,auto:!0,sorted:0,gaps:nn,alpha:1,facets:[Nt({},en,{scale:"x"}),Nt({},en,{scale:"y"})]},rn={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:nn,alpha:1,points:{show:function(t,e){let{scale:n,idxs:i}=t.series[0],s=t._data[0],r=t.valToPos(s[i[0]],n,!0),l=t.valToPos(s[i[1]],n,!0),a=nt(l-r)/(t.series[e].points.space*S);return i[1]-i[0]<=a},filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function ln(t,e,n,i,s){return n/10}const an={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},on=Nt({},an,{time:!1,ori:1}),un={};function cn(t,e){let n=un[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,i,s,r,l,a){for(let o=0;o{let _=t.pxRound;const m=a.dir*(0==a.ori?1:-1),g=0==a.ori?xn:yn;let w,b;1==m?(w=n,b=i):(w=i,b=n);let v=_(u(e[w],a,f,h)),x=_(c(l[w],o,p,d)),y=_(u(e[b],a,f,h)),k=_(c(1==r?o.max:o.min,o,p,d)),z=new Path2D(s);return g(z,y,k),g(z,v,k),g(z,v,x),z}))}function _n(t,e,n,i,s,r){let l=null;if(t.length>0){l=new Path2D;const a=0==e?kn:zn;let o=n;for(let e=0;en[0]){let t=n[0]-o;t>0&&a(l,o,i,t,i+r),o=n[1]}}let u=n+s-o,c=10;u>0&&a(l,o,i-c/2,u,i+r+c)}return l}function mn(t,e,n,i,s,r,l){let a=[],o=t.length;for(let u=1==s?n:i;u>=n&&u<=i;u+=s)if(null===e[u]){let c=u,h=u;if(1==s)for(;++u<=i&&null===e[u];)h=u;else for(;--u>=n&&null===e[u];)h=u;let d=r(t[c]),f=h==c?d:r(t[h]),p=c-s;d=l<=0&&p>=0&&p=0&&_>=0&&_=d&&a.push([d,f])}return a}function gn(t){return 0==t?gt:1==t?st:e=>zt(e,t)}function wn(t){let e=0==t?bn:vn,n=0==t?(t,e,n,i,s,r)=>{t.arcTo(e,n,i,s,r)}:(t,e,n,i,s,r)=>{t.arcTo(n,e,s,i,r)},i=0==t?(t,e,n,i,s)=>{t.rect(e,n,i,s)}:(t,e,n,i,s)=>{t.rect(n,e,s,i)};return(t,s,r,l,a,o=0,u=0)=>{0==o&&0==u?i(t,s,r,l,a):(o=lt(o,l/2,a/2),u=lt(u,l/2,a/2),e(t,s+o,r),n(t,s+l,r,s+l,r+a,o),n(t,s+l,r+a,s,r+a,u),n(t,s,r+a,s,r,u),n(t,s,r,s+l,r,o),t.closePath())}}const bn=(t,e,n)=>{t.moveTo(e,n)},vn=(t,e,n)=>{t.moveTo(n,e)},xn=(t,e,n)=>{t.lineTo(e,n)},yn=(t,e,n)=>{t.lineTo(n,e)},kn=wn(0),zn=wn(1),Sn=(t,e,n,i,s,r)=>{t.arc(e,n,i,s,r)},Mn=(t,e,n,i,s,r)=>{t.arc(n,e,i,s,r)},Tn=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(e,n,i,s,r,l)},Dn=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(n,e,s,i,l,r)};function En(t){return(t,e,n,i,s)=>hn(t,e,((e,r,l,a,o,u,c,h,d,f,p)=>{let _,m,{pxRound:g,points:w}=e;0==a.ori?(_=bn,m=Sn):(_=vn,m=Mn);const b=Tt(w.width*S,3);let v=(w.size-w.width)/2*S,x=Tt(2*v,3),y=new Path2D,k=new Path2D,{left:z,top:M,width:T,height:D}=t.bbox;kn(k,z-x,M-x,T+2*x,D+2*x);const E=t=>{if(null!=l[t]){let e=g(u(r[t],a,f,h)),n=g(c(l[t],o,p,d));_(y,e+v,n),m(y,e,n,v,0,2*et)}};if(s)s.forEach(E);else for(let t=n;t<=i;t++)E(t);return{stroke:b>0?y:null,fill:y,clip:k,flags:3}}))}function An(t){return(e,n,i,s,r,l)=>{i!=s&&(r!=i&&l!=i&&t(e,n,i),r!=s&&l!=s&&t(e,n,s),t(e,n,l))}}const $n=An(xn),On=An(yn);function Rn(t){const e=q(t?.alignGaps,0);return(t,n,i,s)=>hn(t,n,((r,l,a,o,u,c,h,d,f,p,_)=>{let m,g,w=r.pxRound,b=t=>w(c(t,o,p,d)),v=t=>w(h(t,u,_,f));0==o.ori?(m=xn,g=$n):(m=yn,g=On);const x=o.dir*(0==o.ori?1:-1),y={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=y.stroke;let z,S,M,T=ft,D=-ft,E=b(l[1==x?i:s]),A=Y(a,i,s,1*x),$=Y(a,i,s,-1*x),O=b(l[A]),R=b(l[$]),C=!1;for(let t=1==x?i:s;t>=i&&t<=s;t+=x){let e=b(l[t]),n=a[t];e==E?null!=n?(S=v(n),T==ft&&(m(k,e,S),z=S),T=lt(S,T),D=at(S,D)):null===n&&(C=!0):(T!=ft&&(g(k,E,T,D,z,S),M=E),null!=n?(S=v(n),m(k,e,S),T=D=z=S):(T=ft,D=-ft,null===n&&(C=!0)),E=e)}T!=ft&&T!=D&&M!=E&&g(k,E,T,D,z,S);let[P,U]=dn(t,n);if(null!=r.fill||0!=P){let e=y.fill=new Path2D(k),i=v(r.fillTo(t,n,r.min,r.max,P));m(e,R,i),m(e,O,i)}if(!r.spanGaps){let u=[];C&&u.push(...mn(l,a,i,s,x,b,e)),y.gaps=u=r.gaps(t,n,i,s,u),y.clip=_n(u,o.ori,d,f,p,_)}return 0!=U&&(y.band=2==U?[pn(t,n,i,s,k,-1),pn(t,n,i,s,k,1)]:pn(t,n,i,s,k,U)),y}))}function Cn(t,e,n,i,s,r,l=ft){if(t.length>1){let a=null;for(let o=0,u=1/0;o0!=i[t]>0?n[t]=0:(n[t]=3*(o[t-1]+o[t])/((2*o[t]+o[t-1])/i[t-1]+(o[t]+2*o[t-1])/i[t]),isFinite(n[t])||(n[t]=0));n[l-1]=i[l-2];for(let i=0;i{Xn.pxRatio=S})));const Ln=Rn(),Hn=En();function In(t,e,n,i){return(i?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map(((t,i)=>Fn(t,i,e,n)))}function Fn(t,e,n,i){return Nt({},0==e?n:i,t)}function Nn(t,e,n){return null==e?Rt:[e,n]}const Yn=Nn;function Bn(t,e,n){return null==e?Rt:K(e,n,.1,!0)}function Wn(t,e,n,i){return null==e?Rt:B(e,n,t.scales[i].log,!1)}const jn=Wn;function Gn(t,e,n,i){return null==e?Rt:W(e,n,t.scales[i].log,!1)}const Vn=Gn;function Kn(t,e,n,i,s){let r=at(pt(t),pt(e)),l=e-t,a=N(s/i*l,n);do{let t=n[a],e=i*t/l;if(e>=s&&r+(t<5?Dt.get(t):0)<=17)return[t,e]}while(++a(e=st((n=+i)*S))+"px")),e,n]}function Jn(t){t.show&&[t.font,t.labelFont].forEach((t=>{let e=Tt(t[2]*S,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e}))}function Xn(n,i,c){const w={mode:q(n.mode,1)},x=w.mode;function z(t,e){return((3==e.distr?ct(t>0?t:e.clamp(w,t,e.min,e.max,e.key)):4==e.distr?dt(t,e.asinh):100==e.distr?e.fwd(t):t)-e._min)/(e._max-e._min)}function M(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?1-s:s)}function O(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?s:1-s)}function C(t,e,n,i){return 0==e.ori?M(t,e,n,i):O(t,e,n,i)}w.valToPosH=M,w.valToPosV=O;let U=!1;w.status=0;const L=w.root=$("uplot");null!=n.id&&(L.id=n.id),T(L,n.class),n.title&&($("u-title",L).textContent=n.title);const H=A("canvas"),Y=w.ctx=H.getContext("2d"),G=$("u-wrap",L);I("click",G,(t=>{t.target===J&&(Pi!=$i||Ui!=Oi)&&Wi.click(w,t)}),!0);const V=w.under=$("u-under",G);G.appendChild(H);const J=w.over=$("u-over",G),X=+q((n=Ft(n)).pxAlign,1),Q=gn(X);(n.plugins||[]).forEach((t=>{t.opts&&(n=t.opts(w,n)||n)}));const it=n.ms||.001,ut=w.series=1==x?In(n.series||[],Fe,rn,!1):(ht=n.series||[null],pt=sn,ht.map(((t,e)=>0==e?{}:Nt({},pt,t))));var ht,pt;const gt=w.axes=In(n.axes||[],Ie,tn,!0),yt=w.scales={},kt=w.bands=n.bands||[];kt.forEach((t=>{t.fill=mt(t.fill||null),t.dir=q(t.dir,-1)}));const St=2==x?ut[1].facets[0].scale:ut[0].scale,Mt={axes:function(){for(let t=0;toi[t])):b,x=2==p.distr?oi[b[1]]-oi[b[0]]:d,y=e.ticks,k=e.border,z=y.show?st(y.size*S):0,M=e._rotate*-et/180,T=Q(e._pos*S),D=T+(z+g)*h;i=0==r?D:0,n=1==r?D:0,fi(e.font[0],c,1==e.align?o:2==e.align?u:M>0?o:M<0?u:0==r?"center":3==s?u:o,M||1==r?"middle":2==s?l:a);let E=e.font[1]*e.lineGap,A=b.map((t=>Q(C(t,p,_,m)))),$=e._values;for(let t=0;t<$.length;t++){let e=$[t];if(null!=e){0==r?n=A[t]:i=A[t],e=""+e;let s=-1==e.indexOf("\n")?[e]:e.split(/\n/gm);for(let t=0;t0&&(ut.forEach(((t,e)=>{if(e>0&&t.show&&(mi(e,!1),mi(e,!0),null==t._paths)){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha);let n=2==x?[0,i[e][0].length-1]:function(t){let e=_t(Cn-1,0,Rn-1),n=_t(Pn+1,0,Rn-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n{if(e>0&&t.show){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha),null!=t._paths&&gi(e,!1);{let n=null!=t._paths?t._paths.gaps:null,i=t.points.show(w,e,Cn,Pn,n),s=t.points.filter(w,e,i,n);(i||s)&&(t.points._paths=t.points.paths(w,e,Cn,Pn,s),gi(e,!0))}1!=ai&&(Y.globalAlpha=ai=1),Ts("drawSeries",e)}})))}},At=(n.drawOrder||["axes","series"]).map((t=>Mt[t]));function Pt(t){let e=yt[t];if(null==e){let i=(n.scales||$t)[t]||$t;if(null!=i.from)Pt(i.from),yt[t]=Nt({},yt[i.from],i,{key:t});else{e=yt[t]=Nt({},t==St?an:on,i),e.key=t;let n=e.time,s=e.range,r=Ct(s);if((t!=St||2==x&&!n)&&(!r||null!=s[0]&&null!=s[1]||(s={min:null==s[0]?j:{mode:1,hard:s[0],soft:s[0]},max:null==s[1]?j:{mode:1,hard:s[1],soft:s[1]}},r=!1),!r&&Zt(s))){let t=s;s=(e,n,i)=>null==n?Rt:K(n,i,t)}e.range=mt(s||(n?Yn:t==St?3==e.distr?jn:4==e.distr?Vn:Nn:3==e.distr?Wn:4==e.distr?Gn:Bn)),e.auto=mt(!r&&e.auto),e.clamp=mt(e.clamp||ln),e._min=e._max=null}}}Pt("x"),Pt("y"),1==x&&ut.forEach((t=>{Pt(t.scale)})),gt.forEach((t=>{Pt(t.scale)}));for(let t in n.scales)Pt(t);const Ht=yt[St],It=Ht.distr;let Yt,Wt;0==Ht.ori?(T(L,"u-hz"),Yt=M,Wt=O):(T(L,"u-vt"),Yt=O,Wt=M);const jt={};for(let t in yt){let e=yt[t];null==e.min&&null==e.max||(jt[t]={min:e.min,max:e.max},e.min=e.max=null)}const Gt=n.tzDate||(t=>new Date(st(t/it))),Vt=n.fmtDate||Qt,Kt=1==it?ve(Gt):ke(Gt),qt=Se(Gt,ze(1==it?be:ye,Vt)),Jt=De(Gt,Te("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Vt)),Xt=[],te=w.legend=Nt({},Ee,n.legend),ee=te.show,ne=te.markers;let ie,se,ae;te.idxs=Xt,ne.width=mt(ne.width),ne.dash=mt(ne.dash),ne.stroke=mt(ne.stroke),ne.fill=mt(ne.fill);let oe,ue=[],ce=[],he=!1,de={};if(te.live){const t=ut[1]?ut[1].values:null;he=null!=t,oe=he?t(w,1,0):{_:0};for(let t in oe)de[t]=v}if(ee)if(ie=A("table","u-legend",L),ae=A("tbody",null,ie),te.mount(w,ie),he){se=A("thead",null,ie,ae);let t=A("tr",null,se);for(var fe in A("th",null,t),oe)A("th",e,t).textContent=fe}else T(ie,"u-inline"),te.live&&T(ie,"u-live");const pe={show:!0},_e={show:!1},me=new Map;function ge(t,e,n,i=!0){const s=me.get(e)||{},r=wn.bind[t](w,e,n,i);r&&(I(t,e,s[t]=r),me.set(e,s))}function Me(t,e,n){const i=me.get(e)||{};for(let n in i)null!=t&&n!=t||(F(n,e,i[n]),delete i[n]);null==t&&me.delete(e)}let Ae=0,$e=0,Oe=0,Ce=0,Pe=0,Ue=0,Ze=Pe,Le=Ue,He=Oe,je=Ce,Ge=0,Ve=0,Ke=0,qe=0;w.bbox={};let en=!1,nn=!1,un=!1,hn=!1,dn=!1,pn=!1;function _n(t,e,n){(n||t!=w.width||e!=w.height)&&mn(t,e),zi(!1),un=!0,nn=!0,Fi()}function mn(t,e){w.width=Ae=Oe=t,w.height=$e=Ce=e,Pe=Ue=0,function(){let t=!1,e=!1,n=!1,i=!1;gt.forEach(((s,r)=>{if(s.show&&s._show){let{side:r,_size:l}=s,a=r%2,o=l+(null!=s.label?s.labelSize:0);o>0&&(a?(Oe-=o,3==r?(Pe+=o,i=!0):n=!0):(Ce-=o,0==r?(Ue+=o,t=!0):e=!0))}})),En[0]=t,En[1]=n,En[2]=e,En[3]=i,Oe-=On[1]+On[3],Pe+=On[3],Ce-=On[2]+On[0],Ue+=On[0]}(),function(){let t=Pe+Oe,e=Ue+Ce,n=Pe,i=Ue;function s(s,r){switch(s){case 1:return t+=r,t-r;case 2:return e+=r,e-r;case 3:return n-=r,n+r;case 0:return i-=r,i+r}}gt.forEach(((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=s(e,t._size),null!=t.label&&(t._lpos=s(e,t.labelSize))}}))}();let n=w.bbox;Ge=n.left=zt(Pe*S,.5),Ve=n.top=zt(Ue*S,.5),Ke=n.width=zt(Oe*S,.5),qe=n.height=zt(Ce*S,.5)}w.setSize=function({width:t,height:e}){_n(t,e)};const wn=w.cursor=Nt({},Re,{drag:{y:2==x}},n.cursor);if(null==wn.dataIdx){let t=wn.hover,e=t.skip=new Set(t.skip??[]);e.add(void 0);let n=t.prox=mt(t.prox),s=t.bias??=0;wn.dataIdx=(t,r,l,a)=>{if(0==r)return l;let o=l,u=n(t,r,l,a)??ft,c=u>=0&&u0;)e.has(p[t])||(n=t);if(0==s||1==s)for(t=l;null==i&&t++u&&(o=null);return o}}const bn=t=>{wn.event=t};wn.idxs=Xt,wn._lock=!1;let vn=wn.points;vn.show=mt(vn.show),vn.size=mt(vn.size),vn.stroke=mt(vn.stroke),vn.width=mt(vn.width),vn.fill=mt(vn.fill);const xn=w.focus=Nt({},n.focus||{alpha:.3},wn.focus),yn=xn.prox>=0,kn=yn&&vn.one;let zn=[],Sn=[],Mn=[];function Tn(t,e){let n=vn.show(w,e);if(n)return T(n,"u-cursor-pt"),T(n,t.class),R(n,-10,-10,Oe,Ce),J.insertBefore(n,zn[e]),n}function Dn(n,i){if(1==x||i>0){let t=1==x&&yt[n.scale].time,e=n.value;n.value=t?Ut(e)?De(Gt,Te(e,Vt)):e||Jt:e||Qe,n.label=n.label||(t?"Time":"Value")}if(kn||i>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Ln||bt,n.fillTo=mt(n.fillTo||fn),n.pxAlign=+q(n.pxAlign,X),n.pxRound=gn(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=Tt(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:Hn,_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(ee){let s=function(n,i){if(0==i&&(he||!te.live||2==x))return Rt;let s=[],r=A("tr","u-series",ae,ae.childNodes[i]);T(r,n.class),n.show||T(r,t);let l=A("th",null,r);if(ne.show){let t=$("u-marker",l);if(i>0){let e=ne.width(w,i);e&&(t.style.border=e+"px "+ne.dash(w,i)+" "+ne.stroke(w,i)),t.style.background=ne.fill(w,i)}}let a=$(e,l);for(var o in a.textContent=n.label,i>0&&(ne.show||(a.style.color=n.width>0?ne.stroke(w,i):ne.fill(w,i)),ge("click",l,(t=>{if(wn._lock)return;bn(t);let e=ut.indexOf(n);if((t.ctrlKey||t.metaKey)!=te.isolate){let t=ut.some(((t,n)=>n>0&&n!=e&&t.show));ut.forEach(((n,i)=>{i>0&&Xi(i,t?i==e?pe:_e:pe,!0,Es.setSeries)}))}else Xi(e,{show:!n.show},!0,Es.setSeries)}),!1),yn&&ge(_,l,(t=>{wn._lock||(bn(t),Xi(ut.indexOf(n),ns,!0,Es.setSeries))}),!1)),oe){let t=A("td","u-value",r);t.textContent="--",s.push(t)}return[r,s]}(n,i);ue.splice(i,0,s[0]),ce.splice(i,0,s[1]),te.values.push(null)}if(wn.show){Xt.splice(i,0,null);let t=null;kn?0==i&&(t=Tn(n,i)):i>0&&(t=Tn(n,i)),zn.splice(i,0,t),Sn.splice(i,0,0),Mn.splice(i,0,0)}Ts("addSeries",i)}w.addSeries=function(t,e){e=null==e?ut.length:e,t=1==x?Fn(t,e,Fe,rn):Fn(t,e,{},sn),ut.splice(e,0,t),Dn(ut[e],e)},w.delSeries=function(t){if(ut.splice(t,1),ee){te.values.splice(t,1),ce.splice(t,1);let e=ue.splice(t,1)[0];Me(null,e.firstChild),e.remove()}wn.show&&(Xt.splice(t,1),zn.splice(t,1)[0].remove(),Sn.splice(t,1),Mn.splice(t,1)),Ts("delSeries",t)};const En=[!1,!1,!1,!1];function An(t,e,n,i){let[s,r,l,a]=n,o=e%2,u=0;return 0==o&&(a||r)&&(u=0==e&&!s||2==e&&!l?st(Ie.size/3):0),1==o&&(s||l)&&(u=1==e&&!r||3==e&&!a?st(tn.size/2):0),u}const $n=w.padding=(n.padding||[An,An,An,An]).map((t=>mt(q(t,An)))),On=w._padding=$n.map(((t,e)=>t(w,e,En,0)));let Rn,Cn=null,Pn=null;const Zn=1==x?ut[0].idxs:null;let Xn,Qn,ti,ei,ni,ii,si,ri,li,ai,oi=null,ui=!1;function ci(t,e){if(i=null==t?[]:t,w.data=w._data=i,2==x){Rn=0;for(let t=1;t=0,pn=!0,Fi()}}function hi(){let t,e;ui=!0,1==x&&(Rn>0?(Cn=Zn[0]=0,Pn=Zn[1]=Rn-1,t=i[0][Cn],e=i[0][Pn],2==It?(t=Cn,e=Pn):t==e&&(3==It?[t,e]=B(t,t,Ht.log,!1):4==It?[t,e]=W(t,t,Ht.log,!1):Ht.time?e=t+st(86400/it):[t,e]=K(t,e,.1,!0))):(Cn=Zn[0]=t=null,Pn=Zn[1]=e=null)),Ji(St,t,e)}function di(t,e,n,i,s,r){t??=h,n??=Ot,i??="butt",s??=h,r??="round",t!=Xn&&(Y.strokeStyle=Xn=t),s!=Qn&&(Y.fillStyle=Qn=s),e!=ti&&(Y.lineWidth=ti=e),r!=ni&&(Y.lineJoin=ni=r),i!=ii&&(Y.lineCap=ii=i),n!=ei&&Y.setLineDash(ei=n)}function fi(t,e,n,i){e!=Qn&&(Y.fillStyle=Qn=e),t!=si&&(Y.font=si=t),n!=ri&&(Y.textAlign=ri=n),i!=li&&(Y.textBaseline=li=i)}function pi(t,e,n,i,s=0){if(i.length>0&&t.auto(w,ui)&&(null==e||null==e.min)){let e=q(Cn,0),r=q(Pn,i.length-1),l=null==n.min?3==t.distr?function(t,e,n){let i=ft,s=-ft;for(let r=e;r<=n;r++){let e=t[r];null!=e&&e>0&&(es&&(s=e))}return[i,s]}(i,e,r):function(t,e,n,i){let s=ft,r=-ft;if(1==i)s=t[e],r=t[n];else if(-1==i)s=t[n],r=t[e];else for(let i=e;i<=n;i++){let e=t[i];null!=e&&(er&&(r=e))}return[s,r]}(i,e,r,s):[n.min,n.max];t.min=lt(t.min,n.min=l[0]),t.max=at(t.max,n.max=l[1])}}w.setData=ci;const _i={min:null,max:null};function mi(t,e){let n=e?ut[t].points:ut[t];n._stroke=n.stroke(w,t),n._fill=n.fill(w,t)}function gi(t,e){let n=e?ut[t].points:ut[t],{stroke:s,fill:r,clip:l,flags:a,_stroke:o=n._stroke,_fill:u=n._fill,_width:c=n.width}=n._paths;c=Tt(c*S,3);let h=null,d=c%2/2;e&&null==u&&(u=c>0?"#fff":o);let f=1==n.pxAlign&&d>0;if(f&&Y.translate(d,d),!e){let t=Ge-c/2,e=Ve-c/2,n=Ke+c,i=qe+c;h=new Path2D,h.rect(t,e,n,i)}e?wi(o,c,n.dash,n.cap,u,s,r,a,l):function(t,e,n,s,r,l,a,o,u,c,h){let d=!1;0!=u&&kt.forEach(((f,p)=>{if(f.series[0]==t){let t,_=ut[f.series[1]],m=i[f.series[1]],g=(_._paths||$t).band;Ct(g)&&(g=1==f.dir?g[0]:g[1]);let b=null;_.show&&g&&function(t,e,n){for(e=q(e,0),n=q(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(m,Cn,Pn)?(b=f.fill(w,p)||l,t=_._paths.clip):g=null,wi(e,n,s,r,b,a,o,u,c,h,t,g),d=!0}})),d||wi(e,n,s,r,l,a,o,u,c,h)}(t,o,c,n.dash,n.cap,u,s,r,a,h,l),f&&Y.translate(-d,-d)}function wi(t,e,n,i,s,r,l,a,o,u,c,h){di(t,e,n,i,s),(o||u||h)&&(Y.save(),o&&Y.clip(o),u&&Y.clip(u)),h?3==(3&a)?(Y.clip(h),c&&Y.clip(c),vi(s,l),bi(t,r,e)):2&a?(vi(s,l),Y.clip(h),bi(t,r,e)):1&a&&(Y.save(),Y.clip(h),c&&Y.clip(c),vi(s,l),Y.restore(),bi(t,r,e)):(vi(s,l),bi(t,r,e)),(o||u||h)&&Y.restore()}function bi(t,e,n){n>0&&(e instanceof Map?e.forEach(((t,e)=>{Y.strokeStyle=Xn=e,Y.stroke(t)})):null!=e&&t&&Y.stroke(e))}function vi(t,e){e instanceof Map?e.forEach(((t,e)=>{Y.fillStyle=Qn=e,Y.fill(t)})):null!=e&&t&&Y.fill(e)}function xi(t,e,n,i,s,r,l,a,o,u){let c=l%2/2;1==X&&Y.translate(c,c),di(a,l,o,u,a),Y.beginPath();let h,d,f,p,_=s+(0==i||3==i?-r:r);0==n?(d=s,p=_):(h=s,f=_);for(let i=0;i{if(!n.show)return;let s=yt[n.scale];if(null==s.min)return void(n._show&&(e=!1,n._show=!1,zi(!1)));n._show||(e=!1,n._show=!0,zi(!1));let r=n.side,l=r%2,{min:a,max:o}=s,[u,c]=function(t,e,n,i){let s,r=gt[t];if(i<=0)s=[0,0];else{let l=r._space=r.space(w,t,e,n,i);s=Kn(e,n,r._incrs=r.incrs(w,t,e,n,i,l),i,l)}return r._found=s}(i,a,o,0==l?Oe:Ce);if(0==c)return;let h=2==s.distr,d=n._splits=n.splits(w,i,a,o,u,c,h),f=2==s.distr?d.map((t=>oi[t])):d,p=2==s.distr?oi[d[1]]-oi[d[0]]:u,_=n._values=n.values(w,n.filter(w,f,i,c,p),i,c,p);n._rotate=2==r?n.rotate(w,_,i,c):0;let m=n._size;n._size=rt(n.size(w,_,i,t)),null!=m&&n._size!=m&&(e=!1)})),e}function ki(t){let e=!0;return $n.forEach(((n,i)=>{let s=n(w,i,En,t);s!=On[i]&&(e=!1),On[i]=s})),e}function zi(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 Si,Mi,Ti,Di,Ei,Ai,$i,Oi,Ri,Ci,Pi,Ui,Zi=!1,Li=!1,Hi=[];function Ii(){Li=!1;for(let t=0;t0){ut.forEach(((e,n)=>{if(1==x){let s=e.scale,r=jt[s];if(null==r)return;let l=t[s];if(0==n){let t=l.range(w,l.min,l.max,s);l.min=t[0],l.max=t[1],Cn=N(l.min,i[0]),Pn=N(l.max,i[0]),Pn-Cn>1&&(i[0][Cn]l.max&&Pn--),e.min=oi[Cn],e.max=oi[Pn]}else e.show&&e.auto&&pi(l,r,e,i[n],e.sorted);e.idxs[0]=Cn,e.idxs[1]=Pn}else if(n>0&&e.show&&e.auto){let[s,r]=e.facets,l=s.scale,a=r.scale,[o,u]=i[n],c=t[l],h=t[a];null!=c&&pi(c,jt[l],s,o,s.sorted),null!=h&&pi(h,jt[a],r,u,r.sorted),e.min=r.min,e.max=r.max}}));for(let e in t){let n=t[e],i=jt[e];if(null==n.from&&(null==i||null==i.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 i=t[n.from];if(null==i.min)n.min=n.max=null;else{let t=n.range(w,i.min,i.max,e);n.min=t[0],n.max=t[1]}}}let e={},n=!1;for(let i in t){let s=t[i],r=yt[i];if(r.min!=s.min||r.max!=s.max){r.min=s.min,r.max=s.max;let t=r.distr;r._min=3==t?ct(r.min):4==t?dt(r.min,r.asinh):100==t?r.fwd(r.min):r.min,r._max=3==t?ct(r.max):4==t?dt(r.max,r.asinh):100==t?r.fwd(r.max):r.max,e[i]=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)un=!0,Ts("setScale",t);wn.show&&wn.left>=0&&(hn=pn=!0)}for(let t in jt)jt[t]=null}(),en=!1),un&&(function(){let t=!1,e=0;for(;!t;){e++;let n=yi(e),i=ki(e);t=3==e||n&&i,t||(mn(w.width,w.height),nn=!0)}}(),un=!1),nn){if(E(V,o,Pe),E(V,l,Ue),E(V,s,Oe),E(V,r,Ce),E(J,o,Pe),E(J,l,Ue),E(J,s,Oe),E(J,r,Ce),E(G,s,Ae),E(G,r,$e),H.width=st(Ae*S),H.height=st($e*S),gt.forEach((({_el:e,_show:n,_size:i,_pos:s,side:r})=>{if(null!=e)if(n){let n=r%2==1;E(e,n?"left":"top",s-(3===r||0===r?i:0)),E(e,n?"width":"height",i),E(e,n?"top":"left",n?Ue:Pe),E(e,n?"height":"width",n?Ce:Oe),D(e,t)}else T(e,t)})),Xn=Qn=ti=ni=ii=si=ri=li=ei=null,ai=1,ds(!0),Pe!=Ze||Ue!=Le||Oe!=He||Ce!=je){zi(!1);let t=Oe/He,e=Ce/je;if(wn.show&&!hn&&wn.left>=0){wn.left*=t,wn.top*=e,Ti&&R(Ti,st(wn.left),0,Oe,Ce),Di&&R(Di,0,st(wn.top),Oe,Ce);for(let n=0;n=0&&Vi.width>0){Vi.left*=t,Vi.width*=t,Vi.top*=e,Vi.height*=e;for(let t in _s)E(Ki,t,Vi[t])}Ze=Pe,Le=Ue,He=Oe,je=Ce}Ts("setSize"),nn=!1}Ae>0&&$e>0&&(Y.clearRect(0,0,H.width,H.height),Ts("drawClear"),At.forEach((t=>t())),Ts("draw")),Vi.show&&dn&&(qi(Vi),dn=!1),wn.show&&hn&&(cs(null,!0,!1),hn=!1),te.show&&te.live&&pn&&(os(),pn=!1),U||(U=!0,w.status=1,Ts("ready")),ui=!1,Zi=!1}function Yi(t,e){let n=yt[t];if(null==n.from){if(0==Rn){let i=n.range(w,e.min,e.max,t);e.min=i[0],e.max=i[1]}if(e.min>e.max){let t=e.min;e.min=e.max,e.max=t}if(Rn>1&&null!=e.min&&null!=e.max&&e.max-e.min<1e-16)return;t==St&&2==n.distr&&Rn>0&&(e.min=N(e.min,i[0]),e.max=N(e.max,i[0]),e.min==e.max&&e.max++),jt[t]=e,en=!0,Fi()}}w.batch=function(t,e=!1){Zi=!0,Li=e,t(w),Ni(),e&&Hi.length>0&&queueMicrotask(Ii)},w.redraw=(t,e)=>{un=e||!1,!1!==t?Ji(St,Ht.min,Ht.max):Fi()},w.setScale=Yi;let Bi=!1;const Wi=wn.drag;let ji=Wi.x,Gi=Wi.y;wn.show&&(wn.x&&(Si=$("u-cursor-x",J)),wn.y&&(Mi=$("u-cursor-y",J)),0==Ht.ori?(Ti=Si,Di=Mi):(Ti=Mi,Di=Si),Pi=wn.left,Ui=wn.top);const Vi=w.select=Nt({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Ki=Vi.show?$("u-select",Vi.over?J:V):null;function qi(t,e){if(Vi.show){for(let e in t)Vi[e]=t[e],e in _s&&E(Ki,e,t[e]);!1!==e&&Ts("setSelect")}}function Ji(t,e,n){Yi(t,{min:e,max:n})}function Xi(e,n,i,s){null!=n.focus&&function(t){if(t!=es){let e=null==t,n=1!=xn.alpha;ut.forEach(((i,s)=>{if(1==x||s>0){let r=e||0==s||s==t;i._focus=e?null:r,n&&function(t,e){ut[t].alpha=e,wn.show&&zn[t]&&(zn[t].style.opacity=e),ee&&ue[t]&&(ue[t].style.opacity=e)}(s,r?1:xn.alpha)}})),es=t,n&&Fi()}}(e),null!=n.show&&ut.forEach(((i,s)=>{s>0&&(e==s||null==e)&&(i.show=n.show,function(e,n){let i=ut[e],s=ee?ue[e]:null;i.show?s&&D(s,t):(s&&T(s,t),R(kn?zn[0]:zn[e],-10,-10,Oe,Ce))}(s,n.show),2==x?(Ji(i.facets[0].scale,null,null),Ji(i.facets[1].scale,null,null)):Ji(i.scale,null,null),Fi())})),!1!==i&&Ts("setSeries",e,n),s&&Os("setSeries",w,e,n)}let Qi,ts,es;w.setSelect=qi,w.setSeries=Xi,w.addBand=function(t,e){t.fill=mt(t.fill||null),t.dir=q(t.dir,-1),e=null==e?kt.length:e,kt.splice(e,0,t)},w.setBand=function(t,e){Nt(kt[t],e)},w.delBand=function(t){null==t?kt.length=0:kt.splice(t,1)};const ns={focus:!0};function is(t,e,n){let i=yt[e];n&&(t=t/S-(1==i.ori?Ue:Pe));let s=Oe;1==i.ori&&(s=Ce,t=s-t),-1==i.dir&&(t=s-t);let r=i._min,l=r+(i._max-r)*(t/s),a=i.distr;return 3==a?ot(10,l):4==a?((t,e=1)=>tt.sinh(t)*e)(l,i.asinh):100==a?i.bwd(l):l}function ss(t,e){E(Ki,o,Vi.left=t),E(Ki,s,Vi.width=e)}function rs(t,e){E(Ki,l,Vi.top=t),E(Ki,r,Vi.height=e)}ee&&yn&&ge(m,ie,(t=>{wn._lock||(bn(t),null!=es&&Xi(null,ns,!0,Es.setSeries))})),w.valToIdx=t=>N(t,i[0]),w.posToIdx=function(t,e){return N(is(t,St,e),i[0],Cn,Pn)},w.posToVal=is,w.valToPos=(t,e,n)=>0==yt[e].ori?M(t,yt[e],n?Ke:Oe,n?Ge:0):O(t,yt[e],n?qe:Ce,n?Ve:0),w.setCursor=(t,e,n)=>{Pi=t.left,Ui=t.top,cs(null,e,n)};let ls=0==Ht.ori?ss:rs,as=1==Ht.ori?ss:rs;function os(t,e){if(null!=t&&(t.idxs?t.idxs.forEach(((t,e)=>{Xt[e]=t})):void 0!==t.idx&&Xt.fill(t.idx),te.idx=Xt[0]),ee&&te.live){for(let t=0;t0||1==x&&!he)&&us(t,Xt[t]);!function(){if(ee&&te.live)for(let t=2==x?1:0;tPn;Qi=ft,ts=null;let l=0==Ht.ori?Oe:Ce,a=1==Ht.ori?Oe:Ce;if(Pi<0||0==Rn||r){s=wn.idx=null;for(let t=0;t0&&p.show){let e=null==b?-10:Wt(b,1==x?yt[p.scale]:yt[p.facets[1].scale],a,0);if(yn&&null!=b){let n=1==Ht.ori?Pi:Ui,i=nt(xn.dist(w,t,g,e,n));if(i=0?1:-1;r==(b>=0?1:-1)&&(1==r?1==e?b>=s:b<=s:1==e?b<=s:b>=s)&&(Qi=i,ts=t)}else Qi=i,ts=t}}if(pn||kn){let n,i;0==Ht.ori?(n=v,i=e):(n=e,i=v);let s,l,a,p,_,m,g=!0,b=vn.bbox;if(null!=b){g=!1;let e=b(w,t);a=e.left,p=e.top,s=e.width,l=e.height}else a=n,p=i,s=l=vn.size(w,t);if(m=vn.fill(w,t),_=vn.stroke(w,t),kn)t==ts&&Qi<=xn.prox&&(r=a,o=p,u=s,c=l,h=g,d=m,f=_);else{let e=zn[t];null!=e&&(Sn[t]=a,Mn[t]=p,Z(e,s,l,g),P(e,m,_),R(e,rt(a),rt(p),Oe,Ce))}}}}if(kn){let t=xn.prox,e=null==es?Qi<=t:Qi>t||ts!=es;if(pn||e){let t=zn[0];Sn[0]=r,Mn[0]=o,Z(t,u,c,h),P(t,d,f),R(t,rt(r),rt(o),Oe,Ce)}}}if(Vi.show&&Bi)if(null!=t){let[e,n]=Es.scales,[i,s]=Es.match,[r,o]=t.cursor.sync.scales,u=t.cursor.drag;if(ji=u._x,Gi=u._y,ji||Gi){let u,c,h,d,f,{left:p,top:_,width:m,height:g}=t.select,w=t.scales[r].ori,b=t.posToVal,v=null!=e&&i(e,r),x=null!=n&&s(n,o);v&&ji?(0==w?(u=p,c=m):(u=_,c=g),h=yt[e],d=Yt(b(u,r),h,l,0),f=Yt(b(u+c,r),h,l,0),ls(lt(d,f),nt(f-d))):ls(0,l),x&&Gi?(1==w?(u=p,c=m):(u=_,c=g),h=yt[n],d=Wt(b(u,o),h,a,0),f=Wt(b(u+c,o),h,a,0),as(lt(d,f),nt(f-d))):as(0,a)}else ms()}else{let t=nt(Ri-Ei),e=nt(Ci-Ai);if(1==Ht.ori){let n=t;t=e,e=n}ji=Wi.x&&t>=Wi.dist,Gi=Wi.y&&e>=Wi.dist;let n,i,s=Wi.uni;null!=s?ji&&Gi&&(ji=t>=s,Gi=e>=s,ji||Gi||(e>t?Gi=!0:ji=!0)):Wi.x&&Wi.y&&(ji||Gi)&&(ji=Gi=!0),ji&&(0==Ht.ori?(n=$i,i=Pi):(n=Oi,i=Ui),ls(lt(n,i),nt(i-n)),Gi||as(0,a)),Gi&&(1==Ht.ori?(n=$i,i=Pi):(n=Oi,i=Ui),as(lt(n,i),nt(i-n)),ji||ls(0,l)),ji||Gi||(ls(0,0),as(0,0))}if(Wi._x=ji,Wi._y=Gi,null==t){if(n){if(null!=As){let[t,e]=Es.scales;Es.values[0]=null!=t?is(0==Ht.ori?Pi:Ui,t):null,Es.values[1]=null!=e?is(1==Ht.ori?Pi:Ui,e):null}Os(d,w,Pi,Ui,Oe,Ce,s)}if(yn){let t=n&&Es.setSeries,e=xn.prox;null==es?Qi<=e&&Xi(ts,ns,!0,t):Qi>e?Xi(null,ns,!0,t):ts!=es&&Xi(ts,ns,!0,t)}}pn&&(te.idx=s,os()),!1!==e&&Ts("setCursor")}w.setLegend=os;let hs=null;function ds(t=!1){t?hs=null:(hs=J.getBoundingClientRect(),Ts("syncRect",hs))}function fs(t,e,n,i,s,r,l){wn._lock||Bi&&null!=t&&0==t.movementX&&0==t.movementY||(ps(t,e,n,i,s,r,0,!1,null!=t),null!=t?cs(null,!0,!0):cs(e,!0,!1))}function ps(t,e,n,i,s,r,l,a,o){if(null==hs&&ds(!1),bn(t),null!=t)n=t.clientX-hs.left,i=t.clientY-hs.top;else{if(n<0||i<0)return Pi=-10,void(Ui=-10);let[t,l]=Es.scales,a=e.cursor.sync,[o,u]=a.values,[c,h]=a.scales,[d,f]=Es.match,p=e.axes[0].side%2==1,_=0==Ht.ori?Oe:Ce,m=1==Ht.ori?Oe:Ce,g=p?r:s,w=p?s:r,b=p?i:n,v=p?n:i;if(n=null!=c?d(t,c)?C(o,yt[t],_,0):-10:_*(b/g),i=null!=h?f(l,h)?C(u,yt[l],m,0):-10:m*(v/w),1==Ht.ori){let t=n;n=i,i=t}}o&&((n<=1||n>=Oe-1)&&(n=zt(n,Oe)),(i<=1||i>=Ce-1)&&(i=zt(i,Ce))),a?(Ei=n,Ai=i,[$i,Oi]=wn.move(w,n,i)):(Pi=n,Ui=i)}Object.defineProperty(w,"rect",{get:()=>(null==hs&&ds(!1),hs)});const _s={width:0,height:0,left:0,top:0};function ms(){qi(_s,!1)}let gs,ws,bs,vs;function xs(t,e,n,i,s,r,l){Bi=!0,ji=Gi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!0,!1),null!=t&&(ge(p,y,ys,!1),Os(f,w,$i,Oi,Oe,Ce,null));let{left:a,top:o,width:u,height:c}=Vi;gs=a,ws=o,bs=u,vs=c,ms()}function ys(t,e,n,i,s,r,l){Bi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!1,!0);let{left:a,top:o,width:u,height:c}=Vi,h=u>0||c>0,d=gs!=a||ws!=o||bs!=u||vs!=c;if(h&&d&&qi(Vi),Wi.setScale&&h&&d){let t=a,e=u,n=o,i=c;if(1==Ht.ori&&(t=o,e=c,n=a,i=u),ji&&Ji(St,is(t,St),is(t+e,St)),Gi)for(let t in yt){let e=yt[t];t!=St&&null==e.from&&e.min!=ft&&Ji(t,is(n+i,t),is(n,t))}ms()}else wn.lock&&(wn._lock=!wn._lock,cs(null,!0,!1));null!=t&&(Me(p,y),Os(p,w,Pi,Ui,Oe,Ce,null))}function ks(t,e,n,i,s,r,l){wn._lock||(bn(t),hi(),ms(),null!=t&&Os(g,w,Pi,Ui,Oe,Ce,null))}function zs(){gt.forEach(Jn),_n(w.width,w.height,!0)}I(b,k,zs);const Ss={};Ss.mousedown=xs,Ss.mousemove=fs,Ss.mouseup=ys,Ss.dblclick=ks,Ss.setSeries=(t,e,n,i)=>{-1!=(n=(0,Es.match[2])(w,e,n))&&Xi(n,i,!0,!1)},wn.show&&(ge(f,J,xs),ge(d,J,fs),ge(_,J,(t=>{bn(t),ds(!1)})),ge(m,J,(function(t,e,n,i,s,r,l){if(wn._lock)return;bn(t);let a=Bi;if(Bi){let t,e,n=!0,i=!0,s=10;0==Ht.ori?(t=ji,e=Gi):(t=Gi,e=ji),t&&e&&(n=Pi<=s||Pi>=Oe-s,i=Ui<=s||Ui>=Ce-s),t&&n&&(Pi=Pi<$i?0:Oe),e&&i&&(Ui=Ui{t.call(null,w,e,n)}))}(n.plugins||[]).forEach((t=>{for(let e in t.hooks)Ms[e]=(Ms[e]||[]).concat(t.hooks[e])}));const Ds=(t,e,n)=>n,Es=Nt({key:null,setSeries:!1,filters:{pub:vt,sub:vt},scales:[St,ut[1]?ut[1].scale:null],match:[xt,xt,Ds],values:[null,null]},wn.sync);2==Es.match.length&&Es.match.push(Ds),wn.sync=Es;const As=Es.key,$s=cn(As);function Os(t,e,n,i,s,r,l){Es.filters.pub(t,e,n,i,s,r,l)&&$s.pub(t,e,n,i,s,r,l)}function Rs(){Ts("init",n,i),ci(i||n.data,!1),jt[St]?Yi(St,jt[St]):hi(),dn=Vi.show&&(Vi.width>0||Vi.height>0),hn=pn=!0,_n(n.width,n.height)}return $s.sub(w),w.pub=function(t,e,n,i,s,r,l){Es.filters.sub(t,e,n,i,s,r,l)&&Ss[t](null,e,n,i,s,r,l)},w.destroy=function(){$s.unsub(w),Un.delete(w),me.clear(),F(b,k,zs),L.remove(),ie?.remove(),Ts("destroy")},ut.forEach(Dn),gt.forEach((function(t,e){if(t._show=t.show,t.show){let n=t.side%2,i=yt[t.scale];null==i&&(t.scale=n?ut[1].scale:St,i=yt[t.scale]);let s=i.time;t.size=mt(t.size),t.space=mt(t.space),t.rotate=mt(t.rotate),Ct(t.incrs)&&t.incrs.forEach((t=>{!Dt.has(t)&&Dt.set(t,Et(t))})),t.incrs=mt(t.incrs||(2==i.distr?re:s?1==it?we:xe:le)),t.splits=mt(t.splits||(s&&1==i.distr?Kt:3==i.distr?Be:4==i.distr?We:Ye)),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 r=t.values;t.values=Ct(r)&&!Ct(r[0])?mt(r):s?Ct(r)?Se(Gt,ze(r,Vt)):Ut(r)?function(t,e){let n=Qt(e);return(e,i,s,r,l)=>i.map((e=>n(t(e))))}(Gt,r):r||qt:r||Ne,t.filter=mt(t.filter||(i.distr>=3&&10==i.log?Je:3==i.distr&&2==i.log?Xe:wt)),t.font=qn(t.font),t.labelFont=qn(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&&(En[e]=!0,t._el=$("u-axis",G))}})),c?c instanceof HTMLElement?(c.appendChild(L),Rs()):c(w,Rs):Rs(),w}Xn.assign=Nt,Xn.fmtNum=Q,Xn.rangeNum=K,Xn.rangeLog=B,Xn.rangeAsinh=W,Xn.orient=hn,Xn.pxRatio=S,Xn.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let i=1;i=i&&null==t[s];)s--;if(s<=i)return!0;const r=at(1,it((s-i+1)/e));for(let e=t[i],n=i+r;n<=s;n+=r){const i=t[n];if(null!=i){if(i<=e)return!1;e=i}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,i=Array(n);for(let t=0;te[t]-e[n]));let s=[];for(let e=0;et-e))],s=i[0].length,r=new Map;for(let t=0;thn(t,r,((o,u,c,h,d,f,p,_,m,g,w)=>{let b=o.pxRound,{left:v,width:x}=t.bbox,y=t=>b(f(t,h,g,_)),k=t=>b(p(t,d,w,m)),z=0==h.ori?xn:yn;const M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},T=M.stroke,D=h.dir*(0==h.ori?1:-1);l=Y(c,l,a,1),a=Y(c,l,a,-1);let E=k(c[1==D?l:a]),A=y(u[1==D?l:a]),$=A,O=A;s&&-1==e&&(O=v,z(T,O,E)),z(T,A,E);for(let t=1==D?l:a;t>=l&&t<=a;t+=D){let n=c[t];if(null==n)continue;let i=y(u[t]),s=k(n);1==e?z(T,i,E):z(T,$,s),z(T,i,s),E=s,$=i}let R=$;s&&1==e&&(R=v+x,z(T,R,E));let[C,P]=dn(t,r);if(null!=o.fill||0!=C){let e=M.fill=new Path2D(T),n=k(o.fillTo(t,r,o.min,o.max,C));z(e,R,n),z(e,O,n)}if(!o.spanGaps){let s=[];s.push(...mn(u,c,l,a,D,y,i));let d=o.width*S/2,f=n||1==e?d:-d,p=n||-1==e?-d:d;s.forEach((t=>{t[0]+=f,t[1]+=p})),M.gaps=s=o.gaps(t,r,l,a,s),M.clip=_n(s,h.ori,_,m,g,w)}return 0!=P&&(M.band=2==P?[pn(t,r,l,a,T,-1),pn(t,r,l,a,T,1)]:pn(t,r,l,a,T,P)),M}))},t.bars=function(t){const e=q((t=t||$t).size,[.6,ft,1]),n=t.align||0,i=t.gap||0;let s=t.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=mt(s),l=1-e[0],a=q(e[1],ft),o=q(e[2],1),u=q(t.disp,$t),c=q(t.each,(t=>{})),{fill:h,stroke:d}=u;return(t,e,s,f)=>hn(t,e,((p,_,m,g,w,b,v,x,y,k,z)=>{let M,T,D=p.pxRound,E=n,A=i*S,$=a*S,O=o*S;0==g.ori?[M,T]=r(t,e):[T,M]=r(t,e);const R=g.dir*(0==g.ori?1:-1);let C,P,U,Z=0==g.ori?kn:zn,L=0==g.ori?c:(t,e,n,i,s,r,l)=>{c(t,e,n,s,i,l,r)},H=q(t.bands,Ot).find((t=>t.series[0]==e)),I=null!=H?H.dir:0,F=p.fillTo(t,e,p.min,p.max,I),N=D(v(F,w,z,y)),Y=k,B=D(p.width*S),W=!1,j=null,G=null,V=null,K=null;null==h||0!=B&&null==d||(W=!0,j=h.values(t,e,s,f),G=new Map,new Set(j).forEach((t=>{null!=t&&G.set(t,new Path2D)})),B>0&&(V=d.values(t,e,s,f),K=new Map,new Set(V).forEach((t=>{null!=t&&K.set(t,new Path2D)}))));let{x0:J,size:X}=u;if(null!=J&&null!=X){E=1,_=J.values(t,e,s,f),2==J.unit&&(_=_.map((e=>t.posToVal(x+e*k,g.key,!0))));let n=X.values(t,e,s,f);P=2==X.unit?n[0]*k:b(n[0],g,k,x)-b(0,g,k,x),Y=Cn(_,m,b,g,k,x,Y),U=Y-P+A}else Y=Cn(_,m,b,g,k,x,Y),U=Y*l+A,P=Y-U;U<1&&(U=0),B>=P/2&&(B=0),U<5&&(D=gt);let Q=U>0;P=D(_t(Y-U-(Q?B:0),O,$)),C=(0==E?P/2:E==R?0:P)-E*R*((0==E?A/2:0)+(Q?B/2:0));const tt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},et=W?null:new Path2D;let nt=null;if(null!=H)nt=t.data[H.series[1]];else{let{y0:n,y1:i}=u;null!=n&&null!=i&&(m=i.values(t,e,s,f),nt=n.values(t,e,s,f))}let st=M*P,rt=T*P;for(let n=1==R?s:f;n>=s&&n<=f;n+=R){let i=m[n];if(null==i)continue;if(null!=nt){let t=nt[n]??0;if(i-t==0)continue;N=v(t,w,z,y)}let s=b(2!=g.distr||null!=u?_[n]:n,g,k,x),r=v(q(i,F),w,z,y),l=D(s-C),a=D(at(r,N)),o=D(lt(r,N)),c=a-o;if(null!=i){let s=i<0?rt:st,r=i<0?st:rt;W?(B>0&&null!=V[n]&&Z(K.get(V[n]),l,o+it(B/2),P,at(0,c-B),s,r),null!=j[n]&&Z(G.get(j[n]),l,o+it(B/2),P,at(0,c-B),s,r)):Z(et,l,o+it(B/2),P,at(0,c-B),s,r),L(t,e,n,l-B/2,o,P+B,c)}}return B>0?tt.stroke=W?K:et:W||(tt._fill=0==p.width?p._fill:p._stroke??p._fill,tt.width=0),tt.fill=W?G:et,tt}))},t.spline=function(t){return function(t,e){const n=q(e?.alignGaps,0);return(e,i,s,r)=>hn(e,i,((l,a,o,u,c,h,d,f,p,_,m)=>{let g,w,b,v=l.pxRound,x=t=>v(h(t,u,_,f)),y=t=>v(d(t,c,m,p));0==u.ori?(g=bn,b=xn,w=Tn):(g=vn,b=yn,w=Dn);const k=u.dir*(0==u.ori?1:-1);s=Y(o,s,r,1),r=Y(o,s,r,-1);let z=x(a[1==k?s:r]),S=z,M=[],T=[];for(let t=1==k?s:r;t>=s&&t<=r;t+=k)if(null!=o[t]){let e=x(a[t]);M.push(S=e),T.push(y(o[t]))}const D={stroke:t(M,T,g,b,w,v),fill:null,clip:null,band:null,gaps:null,flags:1},E=D.stroke;let[A,$]=dn(e,i);if(null!=l.fill||0!=A){let t=D.fill=new Path2D(E),n=y(l.fillTo(e,i,l.min,l.max,A));b(t,S,n),b(t,z,n)}if(!l.spanGaps){let t=[];t.push(...mn(a,o,s,r,k,x,n)),D.gaps=t=l.gaps(e,i,s,r,t),D.clip=_n(t,u.ori,f,p,_,m)}return 0!=$&&(D.band=2==$?[pn(e,i,s,r,E,-1),pn(e,i,s,r,E,1)]:pn(e,i,s,r,E,$)),D}))}(Pn,t)}}var Qn=n(379),ti=n.n(Qn),ei=n(795),ni=n.n(ei),ii=n(569),si=n.n(ii),ri=n(565),li=n.n(ri),ai=n(216),oi=n.n(ai),ui=n(589),ci=n.n(ui),hi=n(350),di={};function fi(t){var e,n=HTMLWidgets.find("#"+t);return void 0!==n&&(e=n.getWidget()),e}function pi(t,e){let n=[],i=[],s=t[0].length,r=Array(s);for(let t=0;tr[e]+=+t)));for(let n=1;ni>n&&!e(i))),n]});return i=i.filter((t=>t.series[1]>-1)),{data:[t[0]].concat(n),bands:i}}di.styleTagTransform=ci(),di.setAttributes=li(),di.insert=si().bind(null,"head"),di.domAPI=ni(),di.insertStyleElement=oi(),ti()(hi.Z,di),hi.Z&&hi.Z.locals&&hi.Z.locals;const _i=(t="{YYYY}/{MM}/{DD} {HH}:{mm}:{ss}",e=" - ",n=10,i=10)=>{let s=0,r=0;const l=document.createElement("div");l.className="u-tooltip",l.style.position="absolute",l.style.display="none",l.style.padding="4px",l.style.border="2px solid black",l.style.background="#FFF";let a=null,o=null;const u=uPlot.fmtDate(t);let c,h=!1;function d(t){console.log(t),h||(l.style.display="block",c.style.cursor="crosshair",h=!0);let d=t.valToPos(t.data[a][o],"y"),f=t.valToPos(t.data[0][o],"x");l.style.top=r+d+n+"px",l.style.left=s+f+i+"px";let p=t.series[a]._stroke;l.style.borderColor=p;let _=t.series[a].value;l.textContent=u(new Date(1e3*t.data[0][o]))+e+_(t,t.data[a][o],a,o)}return{hooks:{ready:[t=>{c=t.over,s=parseFloat(c.style.left),r=parseFloat(c.style.top),t.root.querySelector(".u-wrap").appendChild(l)}],setCursor:[t=>{let e=t.cursor;o!=e.idx&&(o=e.idx,null!=a&&d(t))}],setSeries:[(t,e)=>{a!=e&&(a=e,null==e?h&&(l.style.display="none",c.style.cursor=null,h=!1):null!=o&&d(t))}],drawAxes:[t=>{let{ctx:e}=t,{left:n,top:i,width:s,height:r}=t.bbox;e.save(),e.strokeStyle="#fcb0f17a",e.beginPath();let[l,a]=t.series[0].idxs;e.closePath(),e.stroke(),e.restore()}]}}},mi=({className:t,style:e={backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#424242"}}={})=>{let n;return{hooks:{init:function(i,s){n=i.root.querySelector(".u-legend"),n.classList.remove("u-inline"),t&&n.classList.add(t),uPlot.assign(n.style,{textAlign:"left",pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,zIndex:100,boxShadow:"2px 2px 10px rgba(0,0,0,0.5)",...e});const r=n.querySelectorAll(".u-marker");for(let t=0;t{n.style.display=null})),l.addEventListener("mouseleave",(()=>{n.style.display="none"}))},setCursor:function(t){const{left:e,top:i}=t.cursor;n.style.transform="translate("+e+"px, "+i+"px)"}}}},gi=t=>{let e,n,i,s,r,l,a=t.factor||.75;function o(t,e,n,i,s,r){return t>i?(e=s,n=r):er&&(n=r,e=r-t),[e,n]}return{hooks:{ready:t=>{e=t.scales.x.min,n=t.scales.x.max,i=t.scales.y.min,s=t.scales.y.max,r=n-e,l=s-i;let u=t.over,c=u.getBoundingClientRect();u.addEventListener("mousedown",(e=>{if(1==e.button){e.preventDefault();let n=e.clientX,i=t.scales.x.min,s=t.scales.x.max,r=t.posToVal(1,"x")-t.posToVal(0,"x");function l(e){e.preventDefault();let l=e.clientX,a=r*(l-n);t.setScale("x",{min:i-a,max:s-a})}function a(t){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}})),u.addEventListener("wheel",(u=>{u.preventDefault();let{left:h,top:d}=t.cursor,f=h/c.width,p=1-d/c.height,_=t.posToVal(h,"x"),m=t.posToVal(d,"y"),g=t.scales.x.max-t.scales.x.min,w=t.scales.y.max-t.scales.y.min,b=u.deltaY<0?g*a:g/a,v=_-f*b,x=v+b;[v,x]=o(b,v,x,r,e,n);let y=u.deltaY<0?w*a:w/a,k=m-p*y,z=k+y;[k,z]=o(y,k,z,l,i,s),t.batch((()=>{t.setScale("x",{min:v,max:x}),t.setScale("y",{min:k,max:z})}))}))}}}},wi=({className:t,style:e={backgroundColor:"rgba(51,204,255,0.3)"}}={})=>{let n,i,s,r;return{opts:(t,e)=>{uPlot.assign(e,{cursor:{x:!1,y:!1}})},hooks:{init:function(r){n=r.under,i=r.over,s=document.createElement("div"),t&&s.classList.add(t),uPlot.assign(s.style,{pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,height:"100%",...e}),n.appendChild(s),i.addEventListener("mouseenter",(()=>{s.style.display=null})),i.addEventListener("mouseleave",(()=>{s.style.display="none"}))},setCursor:function(t){if(r!==t.cursor.idx){r=t.cursor.idx;let[e,n]=t.series[0].idxs;const i=n-e,l=t.bbox.width/i/devicePixelRatio,a=2==t.scales.x.distr?r:t.data[0][r],o=t.valToPos(a,"x")-l/2;s.style.transform="translateX("+Math.round(o)+"px)",s.style.width=Math.round(l)+"px"}}}}},bi=(t,e,n,i)=>{const s=5*devicePixelRatio;return uPlot.orient(t,e,((n,i,r,l,a,o,u,c,h,d,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=l.min&&e<=l.max&&n>=a.min&&n<=a.max){let t=o(e,l,d,c),i=u(n,a,f,h);v.moveTo(t+s/2,i),g(v,t,i,s/2,0,b)}}console.timeEnd("points"),t.ctx.fill(v)})),null},vi=t=>{let e=t.yintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(t.scales.x.min,"x",!0),a=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(l,r),t.ctx.lineTo(a,r),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},xi=t=>{let e=t.xintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"x",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(t.scales.y.max,"y",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(r,a),t.ctx.lineTo(r,l),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},yi=t=>{let e=t.xmin||0,n=t.xmax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(t.scales.y.max,"y",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(e,"x",!0),o=t.valToPos(n,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,r,o-a,l-r),t.ctx.restore()}},ki=t=>{let e=t.ymin||0,n=t.ymax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(n,"y",!0),a=t.valToPos(t.scales.x.min,"x",!0),o=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,l,o-a,r-l),t.ctx.restore()}},zi=({gap:t=2,shadowColor:e="#000000",bearishColor:n="#e54245",bullishColor:i="#4ab650",bodyMaxWidth:s=20,shadowWidth:r=2,bodyOutline:l=1}={})=>({opts:(t,e)=>{uPlot.assign(e,{cursor:{points:{show:!1}}}),e.series.forEach((t=>{t.paths=()=>null,t.points={show:!1}}))},hooks:{draw:function(a){a.ctx.save();const o=r%2/2;a.ctx.translate(o,o);let[u,c]=a.series[0].idxs;for(let o=u;o<=c;o++){let h=2==a.scales.x.distr?o:a.data[0][o],d=a.data[1][o],f=a.data[2][o],p=a.data[3][o],_=a.data[4][o],m=a.valToPos(h,"x",!0),g=a.valToPos(p,"y",!0),w=a.valToPos(f,"y",!0),b=a.valToPos(d,"y",!0),v=a.valToPos(_,"y",!0),x=Math.max(w,g)-Math.min(w,g),y=m-r/2,k=Math.min(w,g);a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(y),Math.round(k),Math.round(r),Math.round(x));let z=a.bbox.width/(c-u),S=Math.min(s,z-t),M=Math.max(v,b)-Math.min(v,b),T=m-S/2,D=Math.min(v,b),E=d>_?n:i;a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(T),Math.round(D),Math.round(S),Math.round(M)),a.ctx.fillStyle=E,a.ctx.fillRect(Math.round(T+l),Math.round(D+l),Math.round(S-2*l),Math.round(M-2*l))}a.ctx.translate(-o,-o),a.ctx.restore()}}});function Si(t){let e=t.length;for(;--e>=0;)t[e]=0}const Mi=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]),Ti=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]),Di=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ei=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ai=new Array(576);Si(Ai);const $i=new Array(60);Si($i);const Oi=new Array(512);Si(Oi);const Ri=new Array(256);Si(Ri);const Ci=new Array(29);Si(Ci);const Pi=new Array(30);function Ui(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}let Zi,Li,Hi;function Ii(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}Si(Pi);const Fi=t=>t<256?Oi[t]:Oi[256+(t>>>7)],Ni=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Yi=(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<{Yi(t,n[2*e],n[2*e+1])},Wi=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},ji=(t,e,n)=>{const i=new Array(16);let s,r,l=0;for(s=1;s<=15;s++)l=l+n[s-1]<<1,i[s]=l;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=Wi(i[e]++,e))}},Gi=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},Vi=t=>{t.bi_valid>8?Ni(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ki=(t,e,n,i)=>{const s=2*e,r=2*n;return t[s]{const i=t.heap[n];let s=n<<1;for(;s<=t.heap_len&&(s{let i,s,r,l,a=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+a++],i+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===i?Bi(t,s,e):(r=Ri[s],Bi(t,r+256+1,e),l=Mi[r],0!==l&&(s-=Ci[r],Yi(t,s,l)),i--,r=Fi(i),Bi(t,r,n),l=Ti[r],0!==l&&(i-=Pi[r],Yi(t,i,l)))}while(a{const n=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,a,o,u=-1;for(t.heap_len=0,t.heap_max=573,l=0;l>1;l>=1;l--)qi(t,n,l);o=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],qi(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=a,n[2*o]=n[2*l]+n[2*a],t.depth[o]=(t.depth[l]>=t.depth[a]?t.depth[l]:t.depth[a])+1,n[2*l+1]=n[2*a+1]=o,t.heap[1]=o++,qi(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let u,c,h,d,f,p,_=0;for(d=0;d<=15;d++)t.bl_count[d]=0;for(n[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)c=t.heap[u],d=n[2*n[2*c+1]+1]+1,d>o&&(d=o,_++),n[2*c+1]=d,c>i||(t.bl_count[d]++,f=0,c>=a&&(f=l[c-a]),p=n[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==_){do{for(d=o-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[o]--,_-=2}while(_>0);for(d=o;0!==d;d--)for(c=t.bl_count[d];0!==c;)h=t.heap[--u],h>i||(n[2*h+1]!==d&&(t.opt_len+=(d-n[2*h+1])*n[2*h],n[2*h+1]=d),c--)}})(t,e),ji(n,u,t.bl_count)},Qi=(t,e,n)=>{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=l,l=e[2*(i+1)+1],++a{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),i=0;i<=n;i++)if(s=l,l=e[2*(i+1)+1],!(++a{Yi(t,0+(i?1:0),3),Vi(t),Ni(t,n),Ni(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var is={_tr_init:t=>{es||((()=>{let t,e,n,i,s;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Ci[i]=n,t=0;t<1<>=7;i<30;i++)for(Pi[i]=s<<7,t=0;t<1<{let s,r,l=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)),Xi(t,t.l_desc),Xi(t,t.d_desc),l=(t=>{let e;for(Qi(t,t.dyn_ltree,t.l_desc.max_code),Qi(t,t.dyn_dtree,t.d_desc.max_code),Xi(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Ei[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&-1!==e?ns(t,e,n,i):4===t.strategy||r===s?(Yi(t,2+(i?1:0),3),Ji(t,Ai,$i)):(Yi(t,4+(i?1:0),3),((t,e,n,i)=>{let s;for(Yi(t,e-257,5),Yi(t,n-1,5),Yi(t,i-4,4),s=0;s(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*(Ri[n]+256+1)]++,t.dyn_dtree[2*Fi(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Yi(t,2,3),Bi(t,256,Ai),(t=>{16===t.bi_valid?(Ni(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)}},ss=(t,e,n,i)=>{let s=65535&t|0,r=t>>>16&65535|0,l=0;for(;0!==n;){l=n>2e3?2e3:n,n-=l;do{s=s+e[i++]|0,r=r+s|0}while(--l);s%=65521,r%=65521}return s|r<<16|0};const rs=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var ls=(t,e,n,i)=>{const s=rs,r=i+n;t^=-1;for(let n=i;n>>8^s[255&(t^e[n])];return-1^t},as={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"},os={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:us,_tr_stored_block:cs,_tr_flush_block:hs,_tr_tally:ds,_tr_align:fs}=is,{Z_NO_FLUSH:ps,Z_PARTIAL_FLUSH:_s,Z_FULL_FLUSH:ms,Z_FINISH:gs,Z_BLOCK:ws,Z_OK:bs,Z_STREAM_END:vs,Z_STREAM_ERROR:xs,Z_DATA_ERROR:ys,Z_BUF_ERROR:ks,Z_DEFAULT_COMPRESSION:zs,Z_FILTERED:Ss,Z_HUFFMAN_ONLY:Ms,Z_RLE:Ts,Z_FIXED:Ds,Z_DEFAULT_STRATEGY:Es,Z_UNKNOWN:As,Z_DEFLATED:$s}=os,Os=258,Rs=262,Cs=42,Ps=113,Us=666,Zs=(t,e)=>(t.msg=as[e],e),Ls=t=>2*t-(t>4?9:0),Hs=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Is=t=>{let e,n,i,s=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=s?n-s:0}while(--e);e=s,i=e;do{n=t.prev[--i],t.prev[i]=n>=s?n-s:0}while(--e)};let Fs=(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))},Ys=(t,e)=>{hs(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ns(t.strm)},Bs=(t,e)=>{t.pending_buf[t.pending++]=e},Ws=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},js=(t,e,n,i)=>{let s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),n),1===t.state.wrap?t.adler=ss(t.adler,e,s,n):2===t.state.wrap&&(t.adler=ls(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)},Gs=(t,e)=>{let n,i,s=t.max_chain_length,r=t.strstart,l=t.prev_length,a=t.nice_match;const o=t.strstart>t.w_size-Rs?t.strstart-(t.w_size-Rs):0,u=t.window,c=t.w_mask,h=t.prev,d=t.strstart+Os;let f=u[r+l-1],p=u[r+l];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,u[n+l]===p&&u[n+l-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&rl){if(t.match_start=e,l=i,i>=a)break;f=u[r+l-1],p=u[r+l]}}}while((e=h[e&c])>o&&0!=--s);return l<=t.lookahead?l:t.lookahead},Vs=t=>{const e=t.w_size;let n,i,s;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rs)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Is(t),i+=e),0===t.strm.avail_in)break;if(n=js(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Fs(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Fs(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,i,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,l=0,a=t.strm.avail_in;do{if(n=65535,s=t.bi_valid+42>>3,t.strm.avail_outi+t.strm.avail_in&&(n=i+t.strm.avail_in),n>s&&(n=s),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ns(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(js(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===l);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_waters&&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++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(js(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,i=t.strstart-t.block_start,(i>=r||(i||e===gs)&&e!==ps&&0===t.strm.avail_in&&i<=s)&&(n=i>s?s:i,l=e===gs&&0===t.strm.avail_in&&n===i?1:0,cs(t,t.block_start,n,l),t.block_start+=n,Ns(t.strm)),l?3:1)},qs=(t,e)=>{let n,i;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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-Rs&&(t.match_length=Gs(t,n)),t.match_length>=3)if(i=ds(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=Fs(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=Fs(t,t.ins_h,t.window[t.strstart+1]);else i=ds(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Ys(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===gs?(Ys(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Ys(t,!1),0===t.strm.avail_out)?1:2},Js=(t,e)=>{let n,i,s;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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){s=t.strstart+t.lookahead-3,i=ds(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Fs(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++,i&&(Ys(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=ds(t,0,t.window[t.strstart-1]),i&&Ys(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&&(i=ds(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===gs?(Ys(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Ys(t,!1),0===t.strm.avail_out)?1:2};function Xs(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}const Qs=[new Xs(0,0,0,0,Ks),new Xs(4,4,8,4,qs),new Xs(4,5,16,8,qs),new Xs(4,6,32,32,qs),new Xs(4,4,16,16,Js),new Xs(8,16,32,32,Js),new Xs(8,16,128,128,Js),new Xs(8,32,128,256,Js),new Xs(32,128,258,1024,Js),new Xs(32,258,258,4096,Js)];function tr(){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=$s,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),Hs(this.dyn_ltree),Hs(this.dyn_dtree),Hs(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),Hs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Hs(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 er=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Cs&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ps&&e.status!==Us?1:0},nr=t=>{if(er(t))return Zs(t,xs);t.total_in=t.total_out=0,t.data_type=As;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?Cs:Ps,t.adler=2===e.wrap?0:1,e.last_flush=-2,us(e),bs},ir=t=>{const e=nr(t);var n;return e===bs&&((n=t.state).window_size=2*n.w_size,Hs(n.head),n.max_lazy_match=Qs[n.level].max_lazy,n.good_match=Qs[n.level].good_length,n.nice_match=Qs[n.level].nice_length,n.max_chain_length=Qs[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},sr=(t,e,n,i,s,r)=>{if(!t)return xs;let l=1;if(e===zs&&(e=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),s<1||s>9||n!==$s||i<8||i>15||e<0||e>9||r<0||r>Ds||8===i&&1!==l)return Zs(t,xs);8===i&&(i=9);const a=new tr;return t.state=a,a.strm=t,a.status=Cs,a.wrap=l,a.gzhead=null,a.w_bits=i,a.w_size=1<er(t)||2!==t.state.wrap?xs:(t.state.gzhead=e,bs),ar=(t,e)=>{if(er(t)||e>ws||e<0)return t?Zs(t,xs):xs;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Us&&e!==gs)return Zs(t,0===t.avail_out?ks:xs);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ns(t),0===t.avail_out)return n.last_flush=-1,bs}else if(0===t.avail_in&&Ls(e)<=Ls(i)&&e!==gs)return Zs(t,ks);if(n.status===Us&&0!==t.avail_in)return Zs(t,ks);if(n.status===Cs&&0===n.wrap&&(n.status=Ps),n.status===Cs){let e=$s+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=Ms||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,Ws(n,e),0!==n.strstart&&(Ws(n,t.adler>>>16),Ws(n,65535&t.adler)),t.adler=1,n.status=Ps,Ns(t),0!==n.pending)return n.last_flush=-1,bs}if(57===n.status)if(t.adler=0,Bs(n,31),Bs(n,139),Bs(n,8),n.gzhead)Bs(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)),Bs(n,255&n.gzhead.time),Bs(n,n.gzhead.time>>8&255),Bs(n,n.gzhead.time>>16&255),Bs(n,n.gzhead.time>>24&255),Bs(n,9===n.level?2:n.strategy>=Ms||n.level<2?4:0),Bs(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Bs(n,255&n.gzhead.extra.length),Bs(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=ls(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Bs(n,0),Bs(n,0),Bs(n,0),Bs(n,0),Bs(n,0),Bs(n,9===n.level?2:n.strategy>=Ms||n.level<2?4:0),Bs(n,3),n.status=Ps,Ns(t),0!==n.pending)return n.last_flush=-1,bs;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=ls(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=s,Ns(t),0!==n.pending)return n.last_flush=-1,bs;e=0,i-=s}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=ls(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,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=ls(t.adler,n.pending_buf,n.pending-i,i)),Ns(t),0!==n.pending)return n.last_flush=-1,bs;i=0}e=n.gzindexi&&(t.adler=ls(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=ls(t.adler,n.pending_buf,n.pending-i,i)),Ns(t),0!==n.pending)return n.last_flush=-1,bs;i=0}e=n.gzindexi&&(t.adler=ls(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ns(t),0!==n.pending))return n.last_flush=-1,bs;Bs(n,255&t.adler),Bs(n,t.adler>>8&255),t.adler=0}if(n.status=Ps,Ns(t),0!==n.pending)return n.last_flush=-1,bs}if(0!==t.avail_in||0!==n.lookahead||e!==ps&&n.status!==Us){let i=0===n.level?Ks(n,e):n.strategy===Ms?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Vs(t),0===t.lookahead)){if(e===ps)return 1;break}if(t.match_length=0,n=ds(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Ys(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===gs?(Ys(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Ys(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===Ts?((t,e)=>{let n,i,s,r;const l=t.window;for(;;){if(t.lookahead<=Os){if(Vs(t),t.lookahead<=Os&&e===ps)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,i=l[s],i===l[++s]&&i===l[++s]&&i===l[++s])){r=t.strstart+Os;do{}while(i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=ds(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=ds(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Ys(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===gs?(Ys(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Ys(t,!1),0===t.strm.avail_out)?1:2})(n,e):Qs[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Us),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),bs;if(2===i&&(e===_s?fs(n):e!==ws&&(cs(n,0,0,!1),e===ms&&(Hs(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ns(t),0===t.avail_out))return n.last_flush=-1,bs}return e!==gs?bs:n.wrap<=0?vs:(2===n.wrap?(Bs(n,255&t.adler),Bs(n,t.adler>>8&255),Bs(n,t.adler>>16&255),Bs(n,t.adler>>24&255),Bs(n,255&t.total_in),Bs(n,t.total_in>>8&255),Bs(n,t.total_in>>16&255),Bs(n,t.total_in>>24&255)):(Ws(n,t.adler>>>16),Ws(n,65535&t.adler)),Ns(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?bs:vs)},or=t=>{if(er(t))return xs;const e=t.state.status;return t.state=null,e===Ps?Zs(t,ys):bs},ur=(t,e)=>{let n=e.length;if(er(t))return xs;const i=t.state,s=i.wrap;if(2===s||1===s&&i.status!==Cs||i.lookahead)return xs;if(1===s&&(t.adler=ss(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===s&&(Hs(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const r=t.avail_in,l=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Vs(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Fs(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Vs(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=l,t.input=a,t.avail_in=r,i.wrap=s,bs};const cr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var hr=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)cr(n,e)&&(t[e]=n[e])}}return t},dr=t=>{let e=0;for(let n=0,i=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;pr[254]=pr[254]=1;var _r=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,s,r,l=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&n):n<65536?(e[r++]=224|n>>>12,e[r++]=128|n>>>6&63,e[r++]=128|63&n):(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63,e[r++]=128|n>>>6&63,e[r++]=128|63&n);return e},mr=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,s;const r=new Array(2*n);for(s=0,i=0;i4)r[s++]=65533,i+=l-1;else{for(e&=2===l?31:3===l?15:7;l>1&&i1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&fr)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i{(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+pr[t[n]]>e?n:e},wr=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 br=Object.prototype.toString,{Z_NO_FLUSH:vr,Z_SYNC_FLUSH:xr,Z_FULL_FLUSH:yr,Z_FINISH:kr,Z_OK:zr,Z_STREAM_END:Sr,Z_DEFAULT_COMPRESSION:Mr,Z_DEFAULT_STRATEGY:Tr,Z_DEFLATED:Dr}=os;function Er(t){this.options=hr({level:Mr,method:Dr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Tr},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 wr,this.strm.avail_out=0;let n=rr(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==zr)throw new Error(as[n]);if(e.header&&lr(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?_r(e.dictionary):"[object ArrayBuffer]"===br.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=ur(this.strm,t),n!==zr)throw new Error(as[n]);this._dict_set=!0}}function Ar(t,e){const n=new Er(e);if(n.push(t,!0),n.err)throw n.msg||as[n.err];return n.result}Er.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?kr:vr,"string"==typeof t?n.input=_r(t):"[object ArrayBuffer]"===br.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(i),n.next_out=0,n.avail_out=i),(r===xr||r===yr)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(s=ar(n,r),s===Sr)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=or(this.strm),this.onEnd(s),this.ended=!0,s===zr;if(0!==n.avail_out){if(r>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},Er.prototype.onData=function(t){this.chunks.push(t)},Er.prototype.onEnd=function(t){t===zr&&(this.result=dr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var $r={Deflate:Er,deflate:Ar,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Ar(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Ar(t,e)},constants:os};const Or=16209;var Rr=function(t,e){let n,i,s,r,l,a,o,u,c,h,d,f,p,_,m,g,w,b,v,x,y,k,z,S;const M=t.state;n=t.next_in,z=t.input,i=n+(t.avail_in-5),s=t.next_out,S=t.output,r=s-(e-t.avail_out),l=s+(t.avail_out-257),a=M.dmax,o=M.wsize,u=M.whave,c=M.wnext,h=M.window,d=M.hold,f=M.bits,p=M.lencode,_=M.distcode,m=(1<>>24,d>>>=b,f-=b,b=w>>>16&255,0===b)S[s++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=p[(65535&w)+(d&(1<>>=b,f-=b),f<15&&(d+=z[n++]<>>24,d>>>=b,f-=b,b=w>>>16&255,!(16&b)){if(0==(64&b)){w=_[(65535&w)+(d&(1<a){t.msg="invalid distance too far back",M.mode=Or;break t}if(d>>>=b,f-=b,b=s-r,x>b){if(b=x-b,b>u&&M.sane){t.msg="invalid distance too far back",M.mode=Or;break t}if(y=0,k=h,0===c){if(y+=o-b,b2;)S[s++]=k[y++],S[s++]=k[y++],S[s++]=k[y++],v-=3;v&&(S[s++]=k[y++],v>1&&(S[s++]=k[y++]))}else{y=s-x;do{S[s++]=S[y++],S[s++]=S[y++],S[s++]=S[y++],v-=3}while(v>2);v&&(S[s++]=S[y++],v>1&&(S[s++]=S[y++]))}break}}break}}while(n>3,n-=v,f-=v<<3,d&=(1<{const o=a.bits;let u,c,h,d,f,p,_=0,m=0,g=0,w=0,b=0,v=0,x=0,y=0,k=0,z=0,S=null;const M=new Uint16Array(16),T=new Uint16Array(16);let D,E,A,$=null;for(_=0;_<=15;_++)M[_]=0;for(m=0;m=1&&0===M[w];w--);if(b>w&&(b=w),0===w)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(g=1;g0&&(0===t||1!==w))return-1;for(T[1]=0,_=1;_<15;_++)T[_+1]=T[_]+M[_];for(m=0;m852||2===t&&k>592)return 1;for(;;){D=_-x,l[m]+1=p?(E=$[l[m]-p],A=S[l[m]-p]):(E=96,A=0),u=1<<_-x,c=1<>x)+c]=D<<24|E<<16|A|0}while(0!==c);for(u=1<<_-1;z&u;)u>>=1;if(0!==u?(z&=u-1,z+=u):z=0,m++,0==--M[_]){if(_===w)break;_=e[n+l[m]]}if(_>b&&(z&d)!==h){for(0===x&&(x=b),f+=g,v=_-x,y=1<852||2===t&&k>592)return 1;h=z&d,s[h]=b<<24|v<<16|f-r|0}}return 0!==z&&(s[f+z]=_-x<<24|64<<16|0),a.bits=b,0};const{Z_FINISH:Hr,Z_BLOCK:Ir,Z_TREES:Fr,Z_OK:Nr,Z_STREAM_END:Yr,Z_NEED_DICT:Br,Z_STREAM_ERROR:Wr,Z_DATA_ERROR:jr,Z_MEM_ERROR:Gr,Z_BUF_ERROR:Vr,Z_DEFLATED:Kr}=os,qr=16180,Jr=16190,Xr=16191,Qr=16192,tl=16194,el=16199,nl=16200,il=16206,sl=16209,rl=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function ll(){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 al=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},ol=t=>{if(al(t))return Wr;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=qr,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,Nr},ul=t=>{if(al(t))return Wr;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ol(t)},cl=(t,e)=>{let n;if(al(t))return Wr;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Wr:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,ul(t))},hl=(t,e)=>{if(!t)return Wr;const n=new ll;t.state=n,n.strm=t,n.window=null,n.mode=qr;const i=cl(t,e);return i!==Nr&&(t.state=null),i};let dl,fl,pl=!0;const _l=t=>{if(pl){dl=new Int32Array(512),fl=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(Lr(1,t.lens,0,288,dl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Lr(2,t.lens,0,32,fl,0,t.work,{bits:5}),pl=!1}t.lencode=dl,t.lenbits=9,t.distcode=fl,t.distbits=5},ml=(t,e,n,i)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(n-i,n-i+s),r.wnext),(i-=s)?(r.window.set(e.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave{let n,i,s,r,l,a,o,u,c,h,d,f,p,_,m,g,w,b,v,x,y,k,z=0;const S=new Uint8Array(4);let M,T;const D=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(al(t)||!t.output||!t.input&&0!==t.avail_in)return Wr;n=t.state,n.mode===Xr&&(n.mode=Qr),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,h=a,d=o,k=Nr;t:for(;;)switch(n.mode){case qr:if(0===n.wrap){n.mode=Qr;break}for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=ls(n.check,S,2,0),u=0,c=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=sl;break}if((15&u)!==Kr){t.msg="unknown compression method",n.mode=sl;break}if(u>>>=4,c-=4,y=8+(15&u),0===n.wbits&&(n.wbits=y),y>15||y>n.wbits){t.msg="invalid window size",n.mode=sl;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=ls(n.check,S,2,0)),u=0,c=0,n.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>8&255,S[2]=u>>>16&255,S[3]=u>>>24&255,n.check=ls(n.check,S,4,0)),u=0,c=0,n.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=ls(n.check,S,2,0)),u=0,c=0,n.mode=16184;case 16184:if(1024&n.flags){for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=ls(n.check,S,2,0)),u=0,c=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&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+f),y)),512&n.flags&&4&n.wrap&&(n.check=ls(n.check,i,f,r)),a-=f,r+=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{y=i[r+f++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y))}while(y&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Xr;break;case 16189:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>=7&c,c-=7&c,n.mode=il;break}for(;c<3;){if(0===a)break t;a--,u+=i[r++]<>>=1,c-=1,3&u){case 0:n.mode=16193;break;case 1:if(_l(n),n.mode=el,e===Fr){u>>>=2,c-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=sl}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,u+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=sl;break}if(n.length=65535&u,u=0,c=0,n.mode=tl,e===Fr)break t;case tl:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>o&&(f=o),0===f)break t;s.set(i.subarray(r,r+f),l),a-=f,r+=f,o-=f,l+=f,n.length-=f;break}n.mode=Xr;break;case 16196:for(;c<14;){if(0===a)break t;a--,u+=i[r++]<>>=5,c-=5,n.ndist=1+(31&u),u>>>=5,c-=5,n.ncode=4+(15&u),u>>>=4,c-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=sl;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},k=Lr(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid code lengths set",n.mode=sl;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=z>>>16&255,w=65535&z,!(m<=c);){if(0===a)break t;a--,u+=i[r++]<>>=m,c-=m,n.lens[n.have++]=w;else{if(16===w){for(T=m+2;c>>=m,c-=m,0===n.have){t.msg="invalid bit length repeat",n.mode=sl;break}y=n.lens[n.have-1],f=3+(3&u),u>>>=2,c-=2}else if(17===w){for(T=m+3;c>>=m,c-=m,y=0,f=3+(7&u),u>>>=3,c-=3}else{for(T=m+7;c>>=m,c-=m,y=0,f=11+(127&u),u>>>=7,c-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=sl;break}for(;f--;)n.lens[n.have++]=y}}if(n.mode===sl)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=sl;break}if(n.lenbits=9,M={bits:n.lenbits},k=Lr(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid literal/lengths set",n.mode=sl;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},k=Lr(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,k){t.msg="invalid distances set",n.mode=sl;break}if(n.mode=el,e===Fr)break t;case el:n.mode=nl;case nl:if(a>=6&&o>=258){t.next_out=l,t.avail_out=o,t.next_in=r,t.avail_in=a,n.hold=u,n.bits=c,Rr(t,d),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,n.mode===Xr&&(n.back=-1);break}for(n.back=0;z=n.lencode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(m<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],m=z>>>24,g=z>>>16&255,w=65535&z,!(b+m<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=m,c-=m,n.back+=m,n.length=w,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Xr;break}if(64&g){t.msg="invalid literal/length code",n.mode=sl;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;c>>=n.extra,c-=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<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],m=z>>>24,g=z>>>16&255,w=65535&z,!(b+m<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=m,c-=m,n.back+=m,64&g){t.msg="invalid distance code",n.mode=sl;break}n.offset=w,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=sl;break}n.mode=16204;case 16204:if(0===o)break t;if(f=d-o,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=sl;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),_=n.window}else _=s,p=l-n.offset,f=n.length;f>o&&(f=o),o-=f,n.length-=f;do{s[l++]=_[p++]}while(--f);0===n.length&&(n.mode=nl);break;case 16205:if(0===o)break t;s[l++]=n.length,o--,n.mode=nl;break;case il:if(n.wrap){for(;c<32;){if(0===a)break t;a--,u|=i[r++]<{if(al(t))return Wr;let e=t.state;return e.window&&(e.window=null),t.state=null,Nr},xl=(t,e)=>{if(al(t))return Wr;const n=t.state;return 0==(2&n.wrap)?Wr:(n.head=e,e.done=!1,Nr)},yl=(t,e)=>{const n=e.length;let i,s,r;return al(t)?Wr:(i=t.state,0!==i.wrap&&i.mode!==Jr?Wr:i.mode===Jr&&(s=1,s=ss(s,e,n,0),s!==i.check)?jr:(r=ml(t,e,n,n),r?(i.mode=16210,Gr):(i.havedict=1,Nr)))},kl=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 zl=Object.prototype.toString,{Z_NO_FLUSH:Sl,Z_FINISH:Ml,Z_OK:Tl,Z_STREAM_END:Dl,Z_NEED_DICT:El,Z_STREAM_ERROR:Al,Z_DATA_ERROR:$l,Z_MEM_ERROR:Ol}=os;function Rl(t){this.options=hr({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 wr,this.strm.avail_out=0;let n=wl(this.strm,e.windowBits);if(n!==Tl)throw new Error(as[n]);if(this.header=new kl,xl(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=_r(e.dictionary):"[object ArrayBuffer]"===zl.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=yl(this.strm,e.dictionary),n!==Tl)))throw new Error(as[n])}function Cl(t,e){const n=new Rl(e);if(n.push(t),n.err)throw n.msg||as[n.err];return n.result}Rl.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,l,a;if(this.ended)return!1;for(l=e===~~e?e:!0===e?Ml:Sl,"[object ArrayBuffer]"===zl.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(i),n.next_out=0,n.avail_out=i),r=bl(n,l),r===El&&s&&(r=yl(n,s),r===Tl?r=bl(n,l):r===$l&&(r=El));n.avail_in>0&&r===Dl&&n.state.wrap>0&&0!==t[n.next_in];)gl(n),r=bl(n,l);switch(r){case Al:case $l:case El:case Ol:return this.onEnd(r),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||r===Dl))if("string"===this.options.to){let t=gr(n.output,n.next_out),e=n.next_out-t,s=mr(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(s)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Tl||0!==a){if(r===Dl)return r=vl(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Rl.prototype.onData=function(t){this.chunks.push(t)},Rl.prototype.onEnd=function(t){t===Tl&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=dr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Pl={Inflate:Rl,inflate:Cl,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Cl(t,e)},ungzip:Cl,constants:os};const{Deflate:Ul,deflate:Zl,deflateRaw:Ll,gzip:Hl}=$r,{Inflate:Il,inflate:Fl,inflateRaw:Nl,ungzip:Yl}=Pl;var Bl=Yl,Wl=n(484),jl=n(178),Gl=n.n(jl),Vl=n(387),Kl=n.n(Vl);Wl.extend(Gl()),Wl.extend(Kl());const ql=t=>(e,n)=>{new ResizeObserver((t=>{for(let n of t){let t=n.contentRect.height,i=n.contentRect.width;const s=e.root.querySelectorAll(".u-legend, .u-title");for(let e of s)t-=Math.floor(e.offsetHeight);e.setSize({width:i,height:t})}})).observe(t),t.appendChild(e.root),n()};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(t,e,n){var i,s,r;return{renderValue:function(l){if(void 0!==i&&i.destroy(),(s=l.config.options).width=e,s.height=n,r=l.config.data,l.use_gzipped_json){const t=atob(r),e=Uint8Array.from(t,(t=>t.charCodeAt(0))),n=Bl(e),i=(new TextDecoder).decode(n);r=JSON.parse(i)}l.stacked?(s.hooks||(s.hooks={}),s.hooks.init=[t=>{[...t.root.querySelectorAll(".u-legend .u-series")].forEach(((e,n)=>{t.series[n]._hide&&(e.style.display="none")}))}],i=function(t,e,n,i,s,r,l,a){let{opts:o,data:u}=function(t,e,n,i){let s=function(t,e){return{scales:{x:{time:!0}},series:e}}(0,e),r=pi(i?i(n):n,(t=>!1));return s.bands=r.bands,s.cursor=s.cursor||{},s.cursor.dataIdx=(t,e,i,s)=>null===n[e][i]?null:i,s.series.forEach((t=>{t.value=(t,e,i,s)=>n[i][s],t.points=t.points||{},t.points.filter=(t,e,i,s)=>{if(i){let t=[];return n[e].forEach(((e,n)=>{null!==e&&t.push(n)})),t}}})),s.scales.y={range:(t,e,n)=>{let i=uPlot.rangeNum(e,n,.1,!0);return[i[0],i[1]]}},s.hooks={setSeries:[(t,e)=>{let i=pi(n,(e=>!t.series[e].show));t.delBand(null),i.bands.forEach((e=>t.addBand(e))),t.setData(i.data)}]},{opts:s,data:r.data}}(0,e,n,i);return o.title=t,o.width=s,o.height=r,o.hooks=Object.assign(o.hooks,l),console.log(o),new uPlot(o,u,a)}(s.title,s.series,r,null,e,n,s.hooks,ql(t))):i=new Xn(s,r,ql(t))},getWidget:function(){return i},resize:function(t,e){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(t){var e=fi(t.id);void 0!==e&&e[t.name].apply(null,t.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(t){var e=fi(t.id);void 0!==e&&e.setData(t.data)})),Shiny.addCustomMessageHandler("uplot-setSeries",(function(t){var e=fi(t.id);void 0!==e&&e.setSeries(t.seriesIdx,t.options)})),Shiny.addCustomMessageHandler("uplot-addSeries",(function(t){var e=fi(t.id);void 0!==e&&e.addSeries(t.options,t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-delSeries",(function(t){var e=fi(t.id);void 0!==e&&e.delSeries(t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-setScale",(function(t){var e=fi(t.id);void 0!==e&&e.setScale(t.scaleKey,t.limits)})),Shiny.addCustomMessageHandler("uplot-redraw",(function(t){var e=fi(t.id);void 0!==e&&e.redraw(t.rebuildPaths,t.recalcAxes)})))})();var s=window;for(var r in i)s[r]=i[r];i.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{var t={350:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(81),s=n.n(i),r=n(645),l=n.n(r)()(s());l.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=l},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var l={};if(i)for(var a=0;a0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},484:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",i="second",s="minute",r="hour",l="day",a="week",o="month",u="quarter",c="year",d="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},_=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},g={s:_,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+_(i,2,"0")+":"+_(s,2,"0")},m:function t(e,n){if(e.date()1)return t(l[0])}else{var a=e.name;b[a]=e,s=a}return!i&&s&&(w=s),s||!i&&w},k=function(t,e){if(x(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},z=g;z.l=y,z.i=x,z.w=function(t,e){return k(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function m(t){this.$L=y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[v]=!0}var _=m.prototype;return _.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(z.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(f);if(i){var s=i[2]-1||0,r=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)):new Date(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)}}return new Date(e)}(t),this.init()},_.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},_.$utils=function(){return z},_.isValid=function(){return!(this.$d.toString()===h)},_.isSame=function(t,e){var n=k(t);return this.startOf(e)<=n&&n<=this.endOf(e)},_.isAfter=function(t,e){return k(t)=0&&(r[d]=parseInt(c,10))}var h=r[3],f=24===h?0:h,p=r[0]+"-"+r[1]+"-"+r[2]+" "+f+":"+r[4]+":"+r[5]+":000",m=+e;return(s.utc(p).valueOf()-(m-=m%1e3))/6e4},o=i.prototype;o.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),l=this.toDate(),a=l.toLocaleString("en-US",{timeZone:t}),o=Math.round((l-new Date(a))/1e3/60),u=15*-Math.round(l.getTimezoneOffset()/15)-o;if(Number(u)){if(n=s(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),e){var c=n.utcOffset();n=n.add(i-c,"minute")}}else n=this.utcOffset(0,e);return n.$x.$timezone=t,n},o.offsetName=function(t){var e=this.$x.$timezone||s.tz.guess(),n=l(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var u=o.startOf;o.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return u.call(this,t,e);var n=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(n,t,e).tz(this.$x.$timezone,!0)},s.tz=function(t,e,n){var i=n&&e,l=n||e||r,o=a(+s(),l);if("string"!=typeof t)return s(t).tz(l);var u=function(t,e,n){var i=t-60*e*1e3,s=a(i,n);if(e===s)return[i,e];var r=a(i-=60*(s-e)*1e3,n);return s===r?[i,s]:[t-60*Math.min(s,r)*1e3,Math.max(s,r)]}(s.utc(t,i).valueOf(),o,l),c=u[0],d=u[1],h=s(c).utcOffset(d);return h.$x.$timezone=l,h},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(t){r=t}}}()},178:function(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,s,r){var l=s.prototype;r.utc=function(t){return new s({date:t,utc:!0,args:arguments})},l.utc=function(e){var n=r(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},l.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var a=l.parse;l.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var o=l.init;l.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var u=l.utcOffset;l.utcOffset=function(i,s){var r=this.$utils().u;if(r(i))return this.$u?0:r(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var s=(""+i[0]).match(n)||["-",0,0],r=s[0],l=60*+s[1]+ +s[2];return 0===l?0:"+"===r?l:-l}(i),null===i))return this;var l=Math.abs(i)<=16?60*i:i,a=this;if(s)return a.$offset=l,a.$u=0===i,a;if(0!==i){var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(l+o,t)).$offset=l,a.$x.$localOffset=o}else a=this.utc();return a};var c=l.format;l.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},l.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var d=l.toDate;l.toDate=function(t){return"s"===t&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var h=l.diff;l.diff=function(t,e,n){if(t&&this.$u===t.$u)return h.call(this,t,e,n);var i=this.local(),s=r(t).local();return h.call(i,s,e,n)}}}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i{"use strict";var e={};t.exports=function(t,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";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)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";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(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.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 i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";n.r(i),n.d(i,{candlestickPlugin:()=>zi,columnHighlightPlugin:()=>wi,createZoomRanger:()=>Si,dayjs:()=>jl,drawHLine:()=>vi,drawHRect:()=>ki,drawPoints:()=>bi,drawVLine:()=>xi,drawVRect:()=>yi,legendAsTooltipPlugin:()=>_i,tooltipPlugin:()=>mi,uPlot:()=>Jn,wheelZoomPlugin:()=>gi}),window.HTMLWidgets;const t="u-off",e="u-label",s="width",r="height",l="top",a="bottom",o="left",u="right",c="#000",d="#0000",h="mousemove",f="mousedown",p="mouseup",m="mouseenter",_="mouseleave",g="dblclick",w="change",b="dppxchange",v="--",x="undefined"!=typeof window,y=x?document:null,k=x?window:null,z=x?navigator:null;let S,M;function E(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function T(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function D(t,e,n){t.style[e]=n+"px"}function A(t,e,n,i){let s=y.createElement(t);return null!=e&&E(s,e),null!=n&&n.insertBefore(s,i),s}function $(t,e){return A("div",t,e)}const O=new WeakMap;function R(e,n,i,s,r){let l="translate("+n+"px,"+i+"px)";l!=O.get(e)&&(e.style.transform=l,O.set(e,l),n<0||i<0||n>s||i>r?E(e,t):T(e,t))}const C=new WeakMap;function P(t,e,n){let i=e+n;i!=C.get(t)&&(C.set(t,i),t.style.background=e,t.style.borderColor=n)}const L=new WeakMap;function U(t,e,n,i){let s=e+""+n;s!=L.get(t)&&(L.set(t,s),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=i?-e/2+"px":0,t.style.marginTop=i?-n/2+"px":0)}const Z={passive:!0},N={...Z,capture:!0};function H(t,e,n,i){e.addEventListener(t,n,i?N:Z)}function I(t,e,n,i){e.removeEventListener(t,n,Z)}function F(t,e,n,i){let s;n=n||0;let r=(i=i||e.length-1)<=2147483647;for(;i-n>1;)s=r?n+i>>1:it((n+i)/2),e[s]=e&&s<=n;s+=i)if(null!=t[s])return s;return-1}function B(t,e,n,i){let s=ut(t),r=ut(e);t==e&&(-1==s?(t*=n,e/=n):(t/=n,e*=n));let l=10==n?ct:dt,a=1==r?rt:it,o=(1==s?it:rt)(l(nt(t))),u=a(l(nt(e))),c=ot(n,o),d=ot(n,u);return 10==n&&(o<0&&(c=Et(c,-o)),u<0&&(d=Et(d,-u))),i||2==n?(t=c*s,e=d*r):(t=Mt(t,c),e=St(e,d)),[t,e]}function W(t,e,n,i){let s=B(t,e,n,i);return 0==t&&(s[0]=0),0==e&&(s[1]=0),s}x&&function t(){let e=devicePixelRatio;S!=e&&(S=e,M&&I(w,M,t),M=matchMedia(`(min-resolution: ${S-.001}dppx) and (max-resolution: ${S+.001}dppx)`),H(w,M,t),k.dispatchEvent(new CustomEvent(b)))}();const j={mode:3,pad:.1},V={pad:0,soft:null,mode:0},G={min:V,max:V};function K(t,e,n,i){return Ut(n)?q(t,e,n):(V.pad=n,V.soft=i?0:null,V.mode=i?3:0,q(t,e,G))}function X(t,e){return null==t?e:t}function q(t,e,n){let i=n.min,s=n.max,r=X(i.pad,0),l=X(s.pad,0),a=X(i.hard,-ft),o=X(s.hard,ft),u=X(i.soft,ft),c=X(s.soft,-ft),d=X(i.mode,0),h=X(s.mode,0),f=e-t,p=ct(f),m=at(nt(t),nt(e)),_=ct(m),g=nt(_-p);(f<1e-24||g>10)&&(f=0,0!=t&&0!=e||(f=1e-24,2==d&&u!=ft&&(r=0),2==h&&c!=-ft&&(l=0)));let w=f||m||1e3,b=ct(w),v=ot(10,it(b)),x=Et(Mt(t-w*(0==f?0==t?.1:1:r),v/10),24),y=t>=u&&(1==d||3==d&&x<=u||2==d&&x>=u)?u:ft,k=at(a,x=y?y:lt(y,x)),z=Et(St(e+w*(0==f?0==e?.1:1:l),v/10),24),S=e<=c&&(1==h||3==h&&z>=c||2==h&&z<=c)?c:-ft,M=lt(o,z>S&&e<=S?S:at(S,z));return k==M&&0==k&&(M=100),[k,M]}const J=new Intl.NumberFormat(x?z.language:"en-US"),Q=t=>J.format(t),tt=Math,et=tt.PI,nt=tt.abs,it=tt.floor,st=tt.round,rt=tt.ceil,lt=tt.min,at=tt.max,ot=tt.pow,ut=tt.sign,ct=tt.log10,dt=tt.log2,ht=(t,e=1)=>tt.asinh(t/e),ft=1/0;function pt(t){return 1+(0|ct((t^t>>31)-(t>>31)))}function mt(t,e,n){return lt(at(t,e),n)}function _t(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,yt=/\.\d*?(?=9{6,}|0{6,})/gm,kt=t=>{if(Pt(t)||Tt.has(t))return t;const e=`${t}`,n=e.match(yt);if(null==n)return t;let i=n[0].length-1;if(-1!=e.indexOf("e-")){let[t,n]=e.split("e");return+`${kt(t)}e${n}`}return Et(t,i)};function zt(t,e){return kt(Et(kt(t/e))*e)}function St(t,e){return kt(rt(kt(t/e))*e)}function Mt(t,e){return kt(it(kt(t/e))*e)}function Et(t,e=0){if(Pt(t))return t;let n=10**e,i=t*n*(1+Number.EPSILON);return st(i)/n}const Tt=new Map;function Dt(t){return((""+t).split(".")[1]||"").length}function At(t,e,n,i){let s=[],r=i.map(Dt);for(let l=e;l=0?0:e)+(l>=r[a]?0:r[a]),c=10==t?o:Et(o,u);s.push(c),Tt.set(c,u)}}return s}const $t={},Ot=[],Rt=[null,null],Ct=Array.isArray,Pt=Number.isInteger;function Lt(t){return"string"==typeof t}function Ut(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Zt(t){return null!=t&&"object"==typeof t}const Nt=Object.getPrototypeOf(Uint8Array),Ht="__proto__";function It(t,e=Ut){let n;if(Ct(t)){let i=t.find((t=>null!=t));if(Ct(i)||e(i)){n=Array(t.length);for(let i=0;ir){for(i=l-1;i>=0&&null==t[i];)t[i--]=null;for(i=l+1;iPromise.resolve().then(t):queueMicrotask,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],jt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Vt(t){return t.slice(0,3)}const Gt=jt.map(Vt),Kt=Wt.map(Vt),Xt={MMMM:Wt,MMM:Kt,WWWW:jt,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 Qt(t,e){e=e||Xt;let n,i=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(t);)i.push("{"==n[0][0]?Jt[n[1]]:n[0]);return t=>{let n="";for(let s=0;st%1==0,ne=[1,2,2.5,5],ie=At(10,-32,0,ne),se=At(10,0,32,ne),re=se.filter(ee),le=ie.concat(se),ae="{YYYY}",oe="\n"+ae,ue="{M}/{D}",ce="\n"+ue,de=ce+"/{YY}",he="{aa}",fe="{h}:{mm}"+he,pe="\n"+fe,me=":{ss}",_e=null;function ge(t){let e=1e3*t,n=60*e,i=60*n,s=24*i,r=30*s,l=365*s;return[(1==t?At(10,0,3,ne).filter(ee):At(10,-3,0,ne)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,i,2*i,3*i,4*i,6*i,8*i,12*i,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,l,2*l,5*l,10*l,25*l,50*l,100*l]),[[l,ae,_e,_e,_e,_e,_e,_e,1],[28*s,"{MMM}",oe,_e,_e,_e,_e,_e,1],[s,ue,oe,_e,_e,_e,_e,_e,1],[i,"{h}"+he,de,_e,ce,_e,_e,_e,1],[n,fe,de,_e,ce,_e,_e,_e,1],[e,me,de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1],[t,me+".{fff}",de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1]],function(e){return(a,o,u,c,d,h)=>{let f=[],p=d>=l,m=d>=r&&d=s?s:d,l=b+(it(u)-it(g))+St(g-b,r);f.push(l);let p=e(l),m=p.getHours()+p.getMinutes()/n+p.getSeconds()/i,_=d/i,w=h/a.axes[o]._space;for(;l=Et(l+d,1==t?0:3),!(l>c);)if(_>1){let t=it(Et(m+_,6))%24,n=e(l).getHours()-t;n>1&&(n=-1),l-=n*i,m=(m+_)%24,Et((l-f[f.length-1])/d,3)*w>=.7&&f.push(l)}else f.push(l)}return f}}]}const[we,be,ve]=ge(1),[xe,ye,ke]=ge(.001);function ze(t,e){return t.map((t=>t.map(((n,i)=>0==i||8==i||null==n?n:e(1==i||0==t[8]?n:t[1]+n)))))}function Se(t,e){return(n,i,s,r,l)=>{let a,o,u,c,d,h,f=e.find((t=>l>=t[0]))||e[e.length-1];return i.map((e=>{let n=t(e),i=n.getFullYear(),s=n.getMonth(),r=n.getDate(),l=n.getHours(),p=n.getMinutes(),m=n.getSeconds(),_=i!=a&&f[2]||s!=o&&f[3]||r!=u&&f[4]||l!=c&&f[5]||p!=d&&f[6]||m!=h&&f[7]||f[1];return a=i,o=s,u=r,c=l,d=p,h=m,_(n)}))}}function Me(t,e,n){return new Date(t,e,n)}function Ee(t,e){return e(t)}function Te(t,e){return(n,i,s,r)=>null==r?v:e(t(i))}At(2,-53,53,[1]);const De={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:[]},Ae=[0,0];function $e(t,e,n,i=!0){return t=>{0==t.button&&(!i||t.target==e)&&n(t)}}function Oe(t,e,n,i=!0){return t=>{(!i||t.target==e)&&n(t)}}const Re={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Ae[0]=e,Ae[1]=n,Ae},points:{one:!1,show:function(t,e){let n=t.cursor.points,i=$(),l=n.size(t,e);D(i,s,l),D(i,r,l);let a=l/-2;D(i,"marginLeft",a),D(i,"marginTop",a);let o=n.width(t,e,l);return o&&D(i,"borderWidth",o),i},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:$e,mouseup:$e,click:$e,dblclick:$e,mousemove:Oe,mouseleave:Oe,mouseenter:Oe},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,i,s)=>i-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ce={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Pe=Ft({},Ce,{filter:wt}),Le=Ft({},Pe,{size:10}),Ue=Ft({},Ce,{show:!1}),Ze='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"',Ne="bold "+Ze,He={show:!0,scale:"x",stroke:c,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Ne,side:2,grid:Pe,ticks:Le,border:Ue,font:Ze,lineGap:1.5,rotate:0},Ie={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function Fe(t,e,n,i,s){return e.map((t=>null==t?"":Q(t)))}function Ye(t,e,n,i,s,r,l){let a=[],o=Tt.get(s)||0;for(let t=n=l?n:Et(St(n,s),o);t<=i;t=Et(t+s,o))a.push(Object.is(t,-0)?0:t);return a}function Be(t,e,n,i,s,r,l){const a=[],o=t.scales[t.axes[e].scale].log,u=it((10==o?ct:dt)(n));s=ot(o,u),10==o&&(s=le[F(s,le)]);let c=n,d=s*o;10==o&&(d=le[F(d,le)]);do{a.push(c),c+=s,10!=o||Tt.has(c)||(c=Et(c,Tt.get(s))),c>=d&&(d=(s=c)*o,10==o&&(d=le[F(d,le)]))}while(c<=i);return a}function We(t,e,n,i,s,r,l){let a=t.scales[t.axes[e].scale].asinh,o=i>a?Be(t,e,at(a,n),i,s):[a],u=i>=0&&n<=0?[0]:[];return(n<-a?Be(t,e,at(a,-i),-n,s):[a]).reverse().map((t=>-t)).concat(u,o)}const je=/./,Ve=/[12357]/,Ge=/[125]/,Ke=/1/,Xe=(t,e,n,i)=>t.map(((t,s)=>4==e&&0==t||s%i==0&&n.test(t.toExponential()[t<0?1:0])?t:null));function qe(t,e,n,i,s){let r=t.axes[n],l=r.scale,a=t.scales[l],o=t.valToPos,u=r._space,c=o(10,l),d=o(9,l)-c>=u?je:o(7,l)-c>=u?Ve:o(5,l)-c>=u?Ge:Ke;if(d==Ke){let t=nt(o(1,l)-c);if(ts,sn={show:!0,auto:!0,sorted:0,gaps:nn,alpha:1,facets:[Ft({},en,{scale:"x"}),Ft({},en,{scale:"y"})]},rn={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:nn,alpha:1,points:{show:function(t,e){let{scale:n,idxs:i}=t.series[0],s=t._data[0],r=t.valToPos(s[i[0]],n,!0),l=t.valToPos(s[i[1]],n,!0),a=nt(l-r)/(t.series[e].points.space*S);return i[1]-i[0]<=a},filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function ln(t,e,n,i,s){return n/10}const an={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},on=Ft({},an,{time:!1,ori:1}),un={};function cn(t,e){let n=un[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,i,s,r,l,a){for(let o=0;o{let m=t.pxRound;const _=a.dir*(0==a.ori?1:-1),g=0==a.ori?xn:yn;let w,b;1==_?(w=n,b=i):(w=i,b=n);let v=m(u(e[w],a,f,d)),x=m(c(l[w],o,p,h)),y=m(u(e[b],a,f,d)),k=m(c(1==r?o.max:o.min,o,p,h)),z=new Path2D(s);return g(z,y,k),g(z,v,k),g(z,v,x),z}))}function mn(t,e,n,i,s,r){let l=null;if(t.length>0){l=new Path2D;const a=0==e?kn:zn;let o=n;for(let e=0;en[0]){let t=n[0]-o;t>0&&a(l,o,i,t,i+r),o=n[1]}}let u=n+s-o,c=10;u>0&&a(l,o,i-c/2,u,i+r+c)}return l}function _n(t,e,n,i,s,r,l){let a=[],o=t.length;for(let u=1==s?n:i;u>=n&&u<=i;u+=s)if(null===e[u]){let c=u,d=u;if(1==s)for(;++u<=i&&null===e[u];)d=u;else for(;--u>=n&&null===e[u];)d=u;let h=r(t[c]),f=d==c?h:r(t[d]),p=c-s;h=l<=0&&p>=0&&p=0&&m>=0&&m=h&&a.push([h,f])}return a}function gn(t){return 0==t?gt:1==t?st:e=>zt(e,t)}function wn(t){let e=0==t?bn:vn,n=0==t?(t,e,n,i,s,r)=>{t.arcTo(e,n,i,s,r)}:(t,e,n,i,s,r)=>{t.arcTo(n,e,s,i,r)},i=0==t?(t,e,n,i,s)=>{t.rect(e,n,i,s)}:(t,e,n,i,s)=>{t.rect(n,e,s,i)};return(t,s,r,l,a,o=0,u=0)=>{0==o&&0==u?i(t,s,r,l,a):(o=lt(o,l/2,a/2),u=lt(u,l/2,a/2),e(t,s+o,r),n(t,s+l,r,s+l,r+a,o),n(t,s+l,r+a,s,r+a,u),n(t,s,r+a,s,r,u),n(t,s,r,s+l,r,o),t.closePath())}}const bn=(t,e,n)=>{t.moveTo(e,n)},vn=(t,e,n)=>{t.moveTo(n,e)},xn=(t,e,n)=>{t.lineTo(e,n)},yn=(t,e,n)=>{t.lineTo(n,e)},kn=wn(0),zn=wn(1),Sn=(t,e,n,i,s,r)=>{t.arc(e,n,i,s,r)},Mn=(t,e,n,i,s,r)=>{t.arc(n,e,i,s,r)},En=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(e,n,i,s,r,l)},Tn=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(n,e,s,i,l,r)};function Dn(t){return(t,e,n,i,s)=>dn(t,e,((e,r,l,a,o,u,c,d,h,f,p)=>{let m,_,{pxRound:g,points:w}=e;0==a.ori?(m=bn,_=Sn):(m=vn,_=Mn);const b=Et(w.width*S,3);let v=(w.size-w.width)/2*S,x=Et(2*v,3),y=new Path2D,k=new Path2D,{left:z,top:M,width:E,height:T}=t.bbox;kn(k,z-x,M-x,E+2*x,T+2*x);const D=t=>{if(null!=l[t]){let e=g(u(r[t],a,f,d)),n=g(c(l[t],o,p,h));m(y,e+v,n),_(y,e,n,v,0,2*et)}};if(s)s.forEach(D);else for(let t=n;t<=i;t++)D(t);return{stroke:b>0?y:null,fill:y,clip:k,flags:3}}))}function An(t){return(e,n,i,s,r,l)=>{i!=s&&(r!=i&&l!=i&&t(e,n,i),r!=s&&l!=s&&t(e,n,s),t(e,n,l))}}const $n=An(xn),On=An(yn);function Rn(t){const e=X(t?.alignGaps,0);return(t,n,i,s)=>dn(t,n,((r,l,a,o,u,c,d,h,f,p,m)=>{let _,g,w=r.pxRound,b=t=>w(c(t,o,p,h)),v=t=>w(d(t,u,m,f));0==o.ori?(_=xn,g=$n):(_=yn,g=On);const x=o.dir*(0==o.ori?1:-1),y={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=y.stroke;let z,S,M,E=ft,T=-ft,D=b(l[1==x?i:s]),A=Y(a,i,s,1*x),$=Y(a,i,s,-1*x),O=b(l[A]),R=b(l[$]),C=!1;for(let t=1==x?i:s;t>=i&&t<=s;t+=x){let e=b(l[t]),n=a[t];e==D?null!=n?(S=v(n),E==ft&&(_(k,e,S),z=S),E=lt(S,E),T=at(S,T)):null===n&&(C=!0):(E!=ft&&(g(k,D,E,T,z,S),M=D),null!=n?(S=v(n),_(k,e,S),E=T=z=S):(E=ft,T=-ft,null===n&&(C=!0)),D=e)}E!=ft&&E!=T&&M!=D&&g(k,D,E,T,z,S);let[P,L]=hn(t,n);if(null!=r.fill||0!=P){let e=y.fill=new Path2D(k),i=v(r.fillTo(t,n,r.min,r.max,P));_(e,R,i),_(e,O,i)}if(!r.spanGaps){let u=[];C&&u.push(..._n(l,a,i,s,x,b,e)),y.gaps=u=r.gaps(t,n,i,s,u),y.clip=mn(u,o.ori,h,f,p,m)}return 0!=L&&(y.band=2==L?[pn(t,n,i,s,k,-1),pn(t,n,i,s,k,1)]:pn(t,n,i,s,k,L)),y}))}function Cn(t,e,n,i,s,r,l=ft){if(t.length>1){let a=null;for(let o=0,u=1/0;o0!=i[t]>0?n[t]=0:(n[t]=3*(o[t-1]+o[t])/((2*o[t]+o[t-1])/i[t-1]+(o[t]+2*o[t-1])/i[t]),isFinite(n[t])||(n[t]=0));n[l-1]=i[l-2];for(let i=0;i{Jn.pxRatio=S})));const Zn=Rn(),Nn=Dn();function Hn(t,e,n,i){return(i?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map(((t,i)=>In(t,i,e,n)))}function In(t,e,n,i){return Ft({},0==e?n:i,t)}function Fn(t,e,n){return null==e?Rt:[e,n]}const Yn=Fn;function Bn(t,e,n){return null==e?Rt:K(e,n,.1,!0)}function Wn(t,e,n,i){return null==e?Rt:B(e,n,t.scales[i].log,!1)}const jn=Wn;function Vn(t,e,n,i){return null==e?Rt:W(e,n,t.scales[i].log,!1)}const Gn=Vn;function Kn(t,e,n,i,s){let r=at(pt(t),pt(e)),l=e-t,a=F(s/i*l,n);do{let t=n[a],e=i*t/l;if(e>=s&&r+(t<5?Tt.get(t):0)<=17)return[t,e]}while(++a(e=st((n=+i)*S))+"px")),e,n]}function qn(t){t.show&&[t.font,t.labelFont].forEach((t=>{let e=Et(t[2]*S,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e}))}function Jn(n,i,c){const w={mode:X(n.mode,1)},x=w.mode;function z(t,e){return((3==e.distr?ct(t>0?t:e.clamp(w,t,e.min,e.max,e.key)):4==e.distr?ht(t,e.asinh):100==e.distr?e.fwd(t):t)-e._min)/(e._max-e._min)}function M(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?1-s:s)}function O(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?s:1-s)}function C(t,e,n,i){return 0==e.ori?M(t,e,n,i):O(t,e,n,i)}w.valToPosH=M,w.valToPosV=O;let L=!1;w.status=0;const Z=w.root=$("uplot");null!=n.id&&(Z.id=n.id),E(Z,n.class),n.title&&($("u-title",Z).textContent=n.title);const N=A("canvas"),Y=w.ctx=N.getContext("2d"),V=$("u-wrap",Z);H("click",V,(t=>{t.target===q&&(Pi!=$i||Li!=Oi)&&Wi.click(w,t)}),!0);const G=w.under=$("u-under",V);V.appendChild(N);const q=w.over=$("u-over",V),J=+X((n=It(n)).pxAlign,1),Q=gn(J);(n.plugins||[]).forEach((t=>{t.opts&&(n=t.opts(w,n)||n)}));const it=n.ms||.001,ut=w.series=1==x?Hn(n.series||[],Ie,rn,!1):(dt=n.series||[null],pt=sn,dt.map(((t,e)=>0==e?{}:Ft({},pt,t))));var dt,pt;const gt=w.axes=Hn(n.axes||[],He,tn,!0),yt=w.scales={},kt=w.bands=n.bands||[];kt.forEach((t=>{t.fill=_t(t.fill||null),t.dir=X(t.dir,-1)}));const St=2==x?ut[1].facets[0].scale:ut[0].scale,Mt={axes:function(){for(let t=0;toi[t])):b,x=2==p.distr?oi[b[1]]-oi[b[0]]:h,y=e.ticks,k=e.border,z=y.show?st(y.size*S):0,M=e._rotate*-et/180,E=Q(e._pos*S),T=E+(z+g)*d;i=0==r?T:0,n=1==r?T:0,fi(e.font[0],c,1==e.align?o:2==e.align?u:M>0?o:M<0?u:0==r?"center":3==s?u:o,M||1==r?"middle":2==s?l:a);let D=e.font[1]*e.lineGap,A=b.map((t=>Q(C(t,p,m,_)))),$=e._values;for(let t=0;t<$.length;t++){let e=$[t];if(null!=e){0==r?n=A[t]:i=A[t],e=""+e;let s=-1==e.indexOf("\n")?[e]:e.split(/\n/gm);for(let t=0;t0&&(ut.forEach(((t,e)=>{if(e>0&&t.show&&(_i(e,!1),_i(e,!0),null==t._paths)){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha);let n=2==x?[0,i[e][0].length-1]:function(t){let e=mt(Cn-1,0,Rn-1),n=mt(Pn+1,0,Rn-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n{if(e>0&&t.show){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha),null!=t._paths&&gi(e,!1);{let n=null!=t._paths?t._paths.gaps:null,i=t.points.show(w,e,Cn,Pn,n),s=t.points.filter(w,e,i,n);(i||s)&&(t.points._paths=t.points.paths(w,e,Cn,Pn,s),gi(e,!0))}1!=ai&&(Y.globalAlpha=ai=1),Es("drawSeries",e)}})))}},At=(n.drawOrder||["axes","series"]).map((t=>Mt[t]));function Pt(t){let e=yt[t];if(null==e){let i=(n.scales||$t)[t]||$t;if(null!=i.from)Pt(i.from),yt[t]=Ft({},yt[i.from],i,{key:t});else{e=yt[t]=Ft({},t==St?an:on,i),e.key=t;let n=e.time,s=e.range,r=Ct(s);if((t!=St||2==x&&!n)&&(!r||null!=s[0]&&null!=s[1]||(s={min:null==s[0]?j:{mode:1,hard:s[0],soft:s[0]},max:null==s[1]?j:{mode:1,hard:s[1],soft:s[1]}},r=!1),!r&&Ut(s))){let t=s;s=(e,n,i)=>null==n?Rt:K(n,i,t)}e.range=_t(s||(n?Yn:t==St?3==e.distr?jn:4==e.distr?Gn:Fn:3==e.distr?Wn:4==e.distr?Vn:Bn)),e.auto=_t(!r&&e.auto),e.clamp=_t(e.clamp||ln),e._min=e._max=null}}}Pt("x"),Pt("y"),1==x&&ut.forEach((t=>{Pt(t.scale)})),gt.forEach((t=>{Pt(t.scale)}));for(let t in n.scales)Pt(t);const Nt=yt[St],Ht=Nt.distr;let Yt,Wt;0==Nt.ori?(E(Z,"u-hz"),Yt=M,Wt=O):(E(Z,"u-vt"),Yt=O,Wt=M);const jt={};for(let t in yt){let e=yt[t];null==e.min&&null==e.max||(jt[t]={min:e.min,max:e.max},e.min=e.max=null)}const Vt=n.tzDate||(t=>new Date(st(t/it))),Gt=n.fmtDate||Qt,Kt=1==it?ve(Vt):ke(Vt),Xt=Se(Vt,ze(1==it?be:ye,Gt)),qt=Te(Vt,Ee("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Gt)),Jt=[],te=w.legend=Ft({},De,n.legend),ee=te.show,ne=te.markers;let ie,se,ae;te.idxs=Jt,ne.width=_t(ne.width),ne.dash=_t(ne.dash),ne.stroke=_t(ne.stroke),ne.fill=_t(ne.fill);let oe,ue=[],ce=[],de=!1,he={};if(te.live){const t=ut[1]?ut[1].values:null;de=null!=t,oe=de?t(w,1,0):{_:0};for(let t in oe)he[t]=v}if(ee)if(ie=A("table","u-legend",Z),ae=A("tbody",null,ie),te.mount(w,ie),de){se=A("thead",null,ie,ae);let t=A("tr",null,se);for(var fe in A("th",null,t),oe)A("th",e,t).textContent=fe}else E(ie,"u-inline"),te.live&&E(ie,"u-live");const pe={show:!0},me={show:!1},_e=new Map;function ge(t,e,n,i=!0){const s=_e.get(e)||{},r=wn.bind[t](w,e,n,i);r&&(H(t,e,s[t]=r),_e.set(e,s))}function Me(t,e,n){const i=_e.get(e)||{};for(let n in i)null!=t&&n!=t||(I(n,e,i[n]),delete i[n]);null==t&&_e.delete(e)}let Ae=0,$e=0,Oe=0,Ce=0,Pe=0,Le=0,Ue=Pe,Ze=Le,Ne=Oe,je=Ce,Ve=0,Ge=0,Ke=0,Xe=0;w.bbox={};let en=!1,nn=!1,un=!1,dn=!1,hn=!1,pn=!1;function mn(t,e,n){(n||t!=w.width||e!=w.height)&&_n(t,e),zi(!1),un=!0,nn=!0,Ii()}function _n(t,e){w.width=Ae=Oe=t,w.height=$e=Ce=e,Pe=Le=0,function(){let t=!1,e=!1,n=!1,i=!1;gt.forEach(((s,r)=>{if(s.show&&s._show){let{side:r,_size:l}=s,a=r%2,o=l+(null!=s.label?s.labelSize:0);o>0&&(a?(Oe-=o,3==r?(Pe+=o,i=!0):n=!0):(Ce-=o,0==r?(Le+=o,t=!0):e=!0))}})),Dn[0]=t,Dn[1]=n,Dn[2]=e,Dn[3]=i,Oe-=On[1]+On[3],Pe+=On[3],Ce-=On[2]+On[0],Le+=On[0]}(),function(){let t=Pe+Oe,e=Le+Ce,n=Pe,i=Le;function s(s,r){switch(s){case 1:return t+=r,t-r;case 2:return e+=r,e-r;case 3:return n-=r,n+r;case 0:return i-=r,i+r}}gt.forEach(((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=s(e,t._size),null!=t.label&&(t._lpos=s(e,t.labelSize))}}))}();let n=w.bbox;Ve=n.left=zt(Pe*S,.5),Ge=n.top=zt(Le*S,.5),Ke=n.width=zt(Oe*S,.5),Xe=n.height=zt(Ce*S,.5)}w.setSize=function({width:t,height:e}){mn(t,e)};const wn=w.cursor=Ft({},Re,{drag:{y:2==x}},n.cursor);if(null==wn.dataIdx){let t=wn.hover,e=t.skip=new Set(t.skip??[]);e.add(void 0);let n=t.prox=_t(t.prox),s=t.bias??=0;wn.dataIdx=(t,r,l,a)=>{if(0==r)return l;let o=l,u=n(t,r,l,a)??ft,c=u>=0&&u0;)e.has(p[t])||(n=t);if(0==s||1==s)for(t=l;null==i&&t++u&&(o=null);return o}}const bn=t=>{wn.event=t};wn.idxs=Jt,wn._lock=!1;let vn=wn.points;vn.show=_t(vn.show),vn.size=_t(vn.size),vn.stroke=_t(vn.stroke),vn.width=_t(vn.width),vn.fill=_t(vn.fill);const xn=w.focus=Ft({},n.focus||{alpha:.3},wn.focus),yn=xn.prox>=0,kn=yn&&vn.one;let zn=[],Sn=[],Mn=[];function En(t,e){let n=vn.show(w,e);if(n)return E(n,"u-cursor-pt"),E(n,t.class),R(n,-10,-10,Oe,Ce),q.insertBefore(n,zn[e]),n}function Tn(n,i){if(1==x||i>0){let t=1==x&&yt[n.scale].time,e=n.value;n.value=t?Lt(e)?Te(Vt,Ee(e,Gt)):e||qt:e||Qe,n.label=n.label||(t?"Time":"Value")}if(kn||i>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Zn||bt,n.fillTo=_t(n.fillTo||fn),n.pxAlign=+X(n.pxAlign,J),n.pxRound=gn(n.pxAlign),n.stroke=_t(n.stroke||null),n.fill=_t(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;let t=Et(1*(3+2*(at(1,n.width)||1)),3),e=n.points=Ft({},{size:t,width:at(1,.2*t),stroke:n.stroke,space:2*t,paths:Nn,_stroke:null,_fill:null},n.points);e.show=_t(e.show),e.filter=_t(e.filter),e.fill=_t(e.fill),e.stroke=_t(e.stroke),e.paths=_t(e.paths),e.pxAlign=n.pxAlign}if(ee){let s=function(n,i){if(0==i&&(de||!te.live||2==x))return Rt;let s=[],r=A("tr","u-series",ae,ae.childNodes[i]);E(r,n.class),n.show||E(r,t);let l=A("th",null,r);if(ne.show){let t=$("u-marker",l);if(i>0){let e=ne.width(w,i);e&&(t.style.border=e+"px "+ne.dash(w,i)+" "+ne.stroke(w,i)),t.style.background=ne.fill(w,i)}}let a=$(e,l);for(var o in a.textContent=n.label,i>0&&(ne.show||(a.style.color=n.width>0?ne.stroke(w,i):ne.fill(w,i)),ge("click",l,(t=>{if(wn._lock)return;bn(t);let e=ut.indexOf(n);if((t.ctrlKey||t.metaKey)!=te.isolate){let t=ut.some(((t,n)=>n>0&&n!=e&&t.show));ut.forEach(((n,i)=>{i>0&&Ji(i,t?i==e?pe:me:pe,!0,Ds.setSeries)}))}else Ji(e,{show:!n.show},!0,Ds.setSeries)}),!1),yn&&ge(m,l,(t=>{wn._lock||(bn(t),Ji(ut.indexOf(n),ns,!0,Ds.setSeries))}),!1)),oe){let t=A("td","u-value",r);t.textContent="--",s.push(t)}return[r,s]}(n,i);ue.splice(i,0,s[0]),ce.splice(i,0,s[1]),te.values.push(null)}if(wn.show){Jt.splice(i,0,null);let t=null;kn?0==i&&(t=En(n,i)):i>0&&(t=En(n,i)),zn.splice(i,0,t),Sn.splice(i,0,0),Mn.splice(i,0,0)}Es("addSeries",i)}w.addSeries=function(t,e){e=null==e?ut.length:e,t=1==x?In(t,e,Ie,rn):In(t,e,{},sn),ut.splice(e,0,t),Tn(ut[e],e)},w.delSeries=function(t){if(ut.splice(t,1),ee){te.values.splice(t,1),ce.splice(t,1);let e=ue.splice(t,1)[0];Me(null,e.firstChild),e.remove()}wn.show&&(Jt.splice(t,1),zn.splice(t,1)[0].remove(),Sn.splice(t,1),Mn.splice(t,1)),Es("delSeries",t)};const Dn=[!1,!1,!1,!1];function An(t,e,n,i){let[s,r,l,a]=n,o=e%2,u=0;return 0==o&&(a||r)&&(u=0==e&&!s||2==e&&!l?st(He.size/3):0),1==o&&(s||l)&&(u=1==e&&!r||3==e&&!a?st(tn.size/2):0),u}const $n=w.padding=(n.padding||[An,An,An,An]).map((t=>_t(X(t,An)))),On=w._padding=$n.map(((t,e)=>t(w,e,Dn,0)));let Rn,Cn=null,Pn=null;const Un=1==x?ut[0].idxs:null;let Jn,Qn,ti,ei,ni,ii,si,ri,li,ai,oi=null,ui=!1;function ci(t,e){if(i=null==t?[]:t,w.data=w._data=i,2==x){Rn=0;for(let t=1;t=0,pn=!0,Ii()}}function di(){let t,e;ui=!0,1==x&&(Rn>0?(Cn=Un[0]=0,Pn=Un[1]=Rn-1,t=i[0][Cn],e=i[0][Pn],2==Ht?(t=Cn,e=Pn):t==e&&(3==Ht?[t,e]=B(t,t,Nt.log,!1):4==Ht?[t,e]=W(t,t,Nt.log,!1):Nt.time?e=t+st(86400/it):[t,e]=K(t,e,.1,!0))):(Cn=Un[0]=t=null,Pn=Un[1]=e=null)),qi(St,t,e)}function hi(t,e,n,i,s,r){t??=d,n??=Ot,i??="butt",s??=d,r??="round",t!=Jn&&(Y.strokeStyle=Jn=t),s!=Qn&&(Y.fillStyle=Qn=s),e!=ti&&(Y.lineWidth=ti=e),r!=ni&&(Y.lineJoin=ni=r),i!=ii&&(Y.lineCap=ii=i),n!=ei&&Y.setLineDash(ei=n)}function fi(t,e,n,i){e!=Qn&&(Y.fillStyle=Qn=e),t!=si&&(Y.font=si=t),n!=ri&&(Y.textAlign=ri=n),i!=li&&(Y.textBaseline=li=i)}function pi(t,e,n,i,s=0){if(i.length>0&&t.auto(w,ui)&&(null==e||null==e.min)){let e=X(Cn,0),r=X(Pn,i.length-1),l=null==n.min?3==t.distr?function(t,e,n){let i=ft,s=-ft;for(let r=e;r<=n;r++){let e=t[r];null!=e&&e>0&&(es&&(s=e))}return[i,s]}(i,e,r):function(t,e,n,i){let s=ft,r=-ft;if(1==i)s=t[e],r=t[n];else if(-1==i)s=t[n],r=t[e];else for(let i=e;i<=n;i++){let e=t[i];null!=e&&(er&&(r=e))}return[s,r]}(i,e,r,s):[n.min,n.max];t.min=lt(t.min,n.min=l[0]),t.max=at(t.max,n.max=l[1])}}w.setData=ci;const mi={min:null,max:null};function _i(t,e){let n=e?ut[t].points:ut[t];n._stroke=n.stroke(w,t),n._fill=n.fill(w,t)}function gi(t,e){let n=e?ut[t].points:ut[t],{stroke:s,fill:r,clip:l,flags:a,_stroke:o=n._stroke,_fill:u=n._fill,_width:c=n.width}=n._paths;c=Et(c*S,3);let d=null,h=c%2/2;e&&null==u&&(u=c>0?"#fff":o);let f=1==n.pxAlign&&h>0;if(f&&Y.translate(h,h),!e){let t=Ve-c/2,e=Ge-c/2,n=Ke+c,i=Xe+c;d=new Path2D,d.rect(t,e,n,i)}e?wi(o,c,n.dash,n.cap,u,s,r,a,l):function(t,e,n,s,r,l,a,o,u,c,d){let h=!1;0!=u&&kt.forEach(((f,p)=>{if(f.series[0]==t){let t,m=ut[f.series[1]],_=i[f.series[1]],g=(m._paths||$t).band;Ct(g)&&(g=1==f.dir?g[0]:g[1]);let b=null;m.show&&g&&function(t,e,n){for(e=X(e,0),n=X(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(_,Cn,Pn)?(b=f.fill(w,p)||l,t=m._paths.clip):g=null,wi(e,n,s,r,b,a,o,u,c,d,t,g),h=!0}})),h||wi(e,n,s,r,l,a,o,u,c,d)}(t,o,c,n.dash,n.cap,u,s,r,a,d,l),f&&Y.translate(-h,-h)}function wi(t,e,n,i,s,r,l,a,o,u,c,d){hi(t,e,n,i,s),(o||u||d)&&(Y.save(),o&&Y.clip(o),u&&Y.clip(u)),d?3==(3&a)?(Y.clip(d),c&&Y.clip(c),vi(s,l),bi(t,r,e)):2&a?(vi(s,l),Y.clip(d),bi(t,r,e)):1&a&&(Y.save(),Y.clip(d),c&&Y.clip(c),vi(s,l),Y.restore(),bi(t,r,e)):(vi(s,l),bi(t,r,e)),(o||u||d)&&Y.restore()}function bi(t,e,n){n>0&&(e instanceof Map?e.forEach(((t,e)=>{Y.strokeStyle=Jn=e,Y.stroke(t)})):null!=e&&t&&Y.stroke(e))}function vi(t,e){e instanceof Map?e.forEach(((t,e)=>{Y.fillStyle=Qn=e,Y.fill(t)})):null!=e&&t&&Y.fill(e)}function xi(t,e,n,i,s,r,l,a,o,u){let c=l%2/2;1==J&&Y.translate(c,c),hi(a,l,o,u,a),Y.beginPath();let d,h,f,p,m=s+(0==i||3==i?-r:r);0==n?(h=s,p=m):(d=s,f=m);for(let i=0;i{if(!n.show)return;let s=yt[n.scale];if(null==s.min)return void(n._show&&(e=!1,n._show=!1,zi(!1)));n._show||(e=!1,n._show=!0,zi(!1));let r=n.side,l=r%2,{min:a,max:o}=s,[u,c]=function(t,e,n,i){let s,r=gt[t];if(i<=0)s=[0,0];else{let l=r._space=r.space(w,t,e,n,i);s=Kn(e,n,r._incrs=r.incrs(w,t,e,n,i,l),i,l)}return r._found=s}(i,a,o,0==l?Oe:Ce);if(0==c)return;let d=2==s.distr,h=n._splits=n.splits(w,i,a,o,u,c,d),f=2==s.distr?h.map((t=>oi[t])):h,p=2==s.distr?oi[h[1]]-oi[h[0]]:u,m=n._values=n.values(w,n.filter(w,f,i,c,p),i,c,p);n._rotate=2==r?n.rotate(w,m,i,c):0;let _=n._size;n._size=rt(n.size(w,m,i,t)),null!=_&&n._size!=_&&(e=!1)})),e}function ki(t){let e=!0;return $n.forEach(((n,i)=>{let s=n(w,i,Dn,t);s!=On[i]&&(e=!1),On[i]=s})),e}function zi(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 Si,Mi,Ei,Ti,Di,Ai,$i,Oi,Ri,Ci,Pi,Li,Ui=!1,Zi=!1,Ni=[];function Hi(){Zi=!1;for(let t=0;t0){ut.forEach(((e,n)=>{if(1==x){let s=e.scale,r=jt[s];if(null==r)return;let l=t[s];if(0==n){let t=l.range(w,l.min,l.max,s);l.min=t[0],l.max=t[1],Cn=F(l.min,i[0]),Pn=F(l.max,i[0]),Pn-Cn>1&&(i[0][Cn]l.max&&Pn--),e.min=oi[Cn],e.max=oi[Pn]}else e.show&&e.auto&&pi(l,r,e,i[n],e.sorted);e.idxs[0]=Cn,e.idxs[1]=Pn}else if(n>0&&e.show&&e.auto){let[s,r]=e.facets,l=s.scale,a=r.scale,[o,u]=i[n],c=t[l],d=t[a];null!=c&&pi(c,jt[l],s,o,s.sorted),null!=d&&pi(d,jt[a],r,u,r.sorted),e.min=r.min,e.max=r.max}}));for(let e in t){let n=t[e],i=jt[e];if(null==n.from&&(null==i||null==i.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 i=t[n.from];if(null==i.min)n.min=n.max=null;else{let t=n.range(w,i.min,i.max,e);n.min=t[0],n.max=t[1]}}}let e={},n=!1;for(let i in t){let s=t[i],r=yt[i];if(r.min!=s.min||r.max!=s.max){r.min=s.min,r.max=s.max;let t=r.distr;r._min=3==t?ct(r.min):4==t?ht(r.min,r.asinh):100==t?r.fwd(r.min):r.min,r._max=3==t?ct(r.max):4==t?ht(r.max,r.asinh):100==t?r.fwd(r.max):r.max,e[i]=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)un=!0,Es("setScale",t);wn.show&&wn.left>=0&&(dn=pn=!0)}for(let t in jt)jt[t]=null}(),en=!1),un&&(function(){let t=!1,e=0;for(;!t;){e++;let n=yi(e),i=ki(e);t=3==e||n&&i,t||(_n(w.width,w.height),nn=!0)}}(),un=!1),nn){if(D(G,o,Pe),D(G,l,Le),D(G,s,Oe),D(G,r,Ce),D(q,o,Pe),D(q,l,Le),D(q,s,Oe),D(q,r,Ce),D(V,s,Ae),D(V,r,$e),N.width=st(Ae*S),N.height=st($e*S),gt.forEach((({_el:e,_show:n,_size:i,_pos:s,side:r})=>{if(null!=e)if(n){let n=r%2==1;D(e,n?"left":"top",s-(3===r||0===r?i:0)),D(e,n?"width":"height",i),D(e,n?"top":"left",n?Le:Pe),D(e,n?"height":"width",n?Ce:Oe),T(e,t)}else E(e,t)})),Jn=Qn=ti=ni=ii=si=ri=li=ei=null,ai=1,hs(!0),Pe!=Ue||Le!=Ze||Oe!=Ne||Ce!=je){zi(!1);let t=Oe/Ne,e=Ce/je;if(wn.show&&!dn&&wn.left>=0){wn.left*=t,wn.top*=e,Ei&&R(Ei,st(wn.left),0,Oe,Ce),Ti&&R(Ti,0,st(wn.top),Oe,Ce);for(let n=0;n=0&&Gi.width>0){Gi.left*=t,Gi.width*=t,Gi.top*=e,Gi.height*=e;for(let t in ms)D(Ki,t,Gi[t])}Ue=Pe,Ze=Le,Ne=Oe,je=Ce}Es("setSize"),nn=!1}Ae>0&&$e>0&&(Y.clearRect(0,0,N.width,N.height),Es("drawClear"),At.forEach((t=>t())),Es("draw")),Gi.show&&hn&&(Xi(Gi),hn=!1),wn.show&&dn&&(cs(null,!0,!1),dn=!1),te.show&&te.live&&pn&&(os(),pn=!1),L||(L=!0,w.status=1,Es("ready")),ui=!1,Ui=!1}function Yi(t,e){let n=yt[t];if(null==n.from){if(0==Rn){let i=n.range(w,e.min,e.max,t);e.min=i[0],e.max=i[1]}if(e.min>e.max){let t=e.min;e.min=e.max,e.max=t}if(Rn>1&&null!=e.min&&null!=e.max&&e.max-e.min<1e-16)return;t==St&&2==n.distr&&Rn>0&&(e.min=F(e.min,i[0]),e.max=F(e.max,i[0]),e.min==e.max&&e.max++),jt[t]=e,en=!0,Ii()}}w.batch=function(t,e=!1){Ui=!0,Zi=e,t(w),Fi(),e&&Ni.length>0&&queueMicrotask(Hi)},w.redraw=(t,e)=>{un=e||!1,!1!==t?qi(St,Nt.min,Nt.max):Ii()},w.setScale=Yi;let Bi=!1;const Wi=wn.drag;let ji=Wi.x,Vi=Wi.y;wn.show&&(wn.x&&(Si=$("u-cursor-x",q)),wn.y&&(Mi=$("u-cursor-y",q)),0==Nt.ori?(Ei=Si,Ti=Mi):(Ei=Mi,Ti=Si),Pi=wn.left,Li=wn.top);const Gi=w.select=Ft({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Ki=Gi.show?$("u-select",Gi.over?q:G):null;function Xi(t,e){if(Gi.show){for(let e in t)Gi[e]=t[e],e in ms&&D(Ki,e,t[e]);!1!==e&&Es("setSelect")}}function qi(t,e,n){Yi(t,{min:e,max:n})}function Ji(e,n,i,s){null!=n.focus&&function(t){if(t!=es){let e=null==t,n=1!=xn.alpha;ut.forEach(((i,s)=>{if(1==x||s>0){let r=e||0==s||s==t;i._focus=e?null:r,n&&function(t,e){ut[t].alpha=e,wn.show&&zn[t]&&(zn[t].style.opacity=e),ee&&ue[t]&&(ue[t].style.opacity=e)}(s,r?1:xn.alpha)}})),es=t,n&&Ii()}}(e),null!=n.show&&ut.forEach(((i,s)=>{s>0&&(e==s||null==e)&&(i.show=n.show,function(e,n){let i=ut[e],s=ee?ue[e]:null;i.show?s&&T(s,t):(s&&E(s,t),R(kn?zn[0]:zn[e],-10,-10,Oe,Ce))}(s,n.show),2==x?(qi(i.facets[0].scale,null,null),qi(i.facets[1].scale,null,null)):qi(i.scale,null,null),Ii())})),!1!==i&&Es("setSeries",e,n),s&&Os("setSeries",w,e,n)}let Qi,ts,es;w.setSelect=Xi,w.setSeries=Ji,w.addBand=function(t,e){t.fill=_t(t.fill||null),t.dir=X(t.dir,-1),e=null==e?kt.length:e,kt.splice(e,0,t)},w.setBand=function(t,e){Ft(kt[t],e)},w.delBand=function(t){null==t?kt.length=0:kt.splice(t,1)};const ns={focus:!0};function is(t,e,n){let i=yt[e];n&&(t=t/S-(1==i.ori?Le:Pe));let s=Oe;1==i.ori&&(s=Ce,t=s-t),-1==i.dir&&(t=s-t);let r=i._min,l=r+(i._max-r)*(t/s),a=i.distr;return 3==a?ot(10,l):4==a?((t,e=1)=>tt.sinh(t)*e)(l,i.asinh):100==a?i.bwd(l):l}function ss(t,e){D(Ki,o,Gi.left=t),D(Ki,s,Gi.width=e)}function rs(t,e){D(Ki,l,Gi.top=t),D(Ki,r,Gi.height=e)}ee&&yn&&ge(_,ie,(t=>{wn._lock||(bn(t),null!=es&&Ji(null,ns,!0,Ds.setSeries))})),w.valToIdx=t=>F(t,i[0]),w.posToIdx=function(t,e){return F(is(t,St,e),i[0],Cn,Pn)},w.posToVal=is,w.valToPos=(t,e,n)=>0==yt[e].ori?M(t,yt[e],n?Ke:Oe,n?Ve:0):O(t,yt[e],n?Xe:Ce,n?Ge:0),w.setCursor=(t,e,n)=>{Pi=t.left,Li=t.top,cs(null,e,n)};let ls=0==Nt.ori?ss:rs,as=1==Nt.ori?ss:rs;function os(t,e){if(null!=t&&(t.idxs?t.idxs.forEach(((t,e)=>{Jt[e]=t})):void 0!==t.idx&&Jt.fill(t.idx),te.idx=Jt[0]),ee&&te.live){for(let t=0;t0||1==x&&!de)&&us(t,Jt[t]);!function(){if(ee&&te.live)for(let t=2==x?1:0;tPn;Qi=ft,ts=null;let l=0==Nt.ori?Oe:Ce,a=1==Nt.ori?Oe:Ce;if(Pi<0||0==Rn||r){s=wn.idx=null;for(let t=0;t0&&p.show){let e=null==b?-10:Wt(b,1==x?yt[p.scale]:yt[p.facets[1].scale],a,0);if(yn&&null!=b){let n=1==Nt.ori?Pi:Li,i=nt(xn.dist(w,t,g,e,n));if(i=0?1:-1;r==(b>=0?1:-1)&&(1==r?1==e?b>=s:b<=s:1==e?b<=s:b>=s)&&(Qi=i,ts=t)}else Qi=i,ts=t}}if(pn||kn){let n,i;0==Nt.ori?(n=v,i=e):(n=e,i=v);let s,l,a,p,m,_,g=!0,b=vn.bbox;if(null!=b){g=!1;let e=b(w,t);a=e.left,p=e.top,s=e.width,l=e.height}else a=n,p=i,s=l=vn.size(w,t);if(_=vn.fill(w,t),m=vn.stroke(w,t),kn)t==ts&&Qi<=xn.prox&&(r=a,o=p,u=s,c=l,d=g,h=_,f=m);else{let e=zn[t];null!=e&&(Sn[t]=a,Mn[t]=p,U(e,s,l,g),P(e,_,m),R(e,rt(a),rt(p),Oe,Ce))}}}}if(kn){let t=xn.prox,e=null==es?Qi<=t:Qi>t||ts!=es;if(pn||e){let t=zn[0];Sn[0]=r,Mn[0]=o,U(t,u,c,d),P(t,h,f),R(t,rt(r),rt(o),Oe,Ce)}}}if(Gi.show&&Bi)if(null!=t){let[e,n]=Ds.scales,[i,s]=Ds.match,[r,o]=t.cursor.sync.scales,u=t.cursor.drag;if(ji=u._x,Vi=u._y,ji||Vi){let u,c,d,h,f,{left:p,top:m,width:_,height:g}=t.select,w=t.scales[r].ori,b=t.posToVal,v=null!=e&&i(e,r),x=null!=n&&s(n,o);v&&ji?(0==w?(u=p,c=_):(u=m,c=g),d=yt[e],h=Yt(b(u,r),d,l,0),f=Yt(b(u+c,r),d,l,0),ls(lt(h,f),nt(f-h))):ls(0,l),x&&Vi?(1==w?(u=p,c=_):(u=m,c=g),d=yt[n],h=Wt(b(u,o),d,a,0),f=Wt(b(u+c,o),d,a,0),as(lt(h,f),nt(f-h))):as(0,a)}else _s()}else{let t=nt(Ri-Di),e=nt(Ci-Ai);if(1==Nt.ori){let n=t;t=e,e=n}ji=Wi.x&&t>=Wi.dist,Vi=Wi.y&&e>=Wi.dist;let n,i,s=Wi.uni;null!=s?ji&&Vi&&(ji=t>=s,Vi=e>=s,ji||Vi||(e>t?Vi=!0:ji=!0)):Wi.x&&Wi.y&&(ji||Vi)&&(ji=Vi=!0),ji&&(0==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),ls(lt(n,i),nt(i-n)),Vi||as(0,a)),Vi&&(1==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),as(lt(n,i),nt(i-n)),ji||ls(0,l)),ji||Vi||(ls(0,0),as(0,0))}if(Wi._x=ji,Wi._y=Vi,null==t){if(n){if(null!=As){let[t,e]=Ds.scales;Ds.values[0]=null!=t?is(0==Nt.ori?Pi:Li,t):null,Ds.values[1]=null!=e?is(1==Nt.ori?Pi:Li,e):null}Os(h,w,Pi,Li,Oe,Ce,s)}if(yn){let t=n&&Ds.setSeries,e=xn.prox;null==es?Qi<=e&&Ji(ts,ns,!0,t):Qi>e?Ji(null,ns,!0,t):ts!=es&&Ji(ts,ns,!0,t)}}pn&&(te.idx=s,os()),!1!==e&&Es("setCursor")}w.setLegend=os;let ds=null;function hs(t=!1){t?ds=null:(ds=q.getBoundingClientRect(),Es("syncRect",ds))}function fs(t,e,n,i,s,r,l){wn._lock||Bi&&null!=t&&0==t.movementX&&0==t.movementY||(ps(t,e,n,i,s,r,0,!1,null!=t),null!=t?cs(null,!0,!0):cs(e,!0,!1))}function ps(t,e,n,i,s,r,l,a,o){if(null==ds&&hs(!1),bn(t),null!=t)n=t.clientX-ds.left,i=t.clientY-ds.top;else{if(n<0||i<0)return Pi=-10,void(Li=-10);let[t,l]=Ds.scales,a=e.cursor.sync,[o,u]=a.values,[c,d]=a.scales,[h,f]=Ds.match,p=e.axes[0].side%2==1,m=0==Nt.ori?Oe:Ce,_=1==Nt.ori?Oe:Ce,g=p?r:s,w=p?s:r,b=p?i:n,v=p?n:i;if(n=null!=c?h(t,c)?C(o,yt[t],m,0):-10:m*(b/g),i=null!=d?f(l,d)?C(u,yt[l],_,0):-10:_*(v/w),1==Nt.ori){let t=n;n=i,i=t}}o&&((n<=1||n>=Oe-1)&&(n=zt(n,Oe)),(i<=1||i>=Ce-1)&&(i=zt(i,Ce))),a?(Di=n,Ai=i,[$i,Oi]=wn.move(w,n,i)):(Pi=n,Li=i)}Object.defineProperty(w,"rect",{get:()=>(null==ds&&hs(!1),ds)});const ms={width:0,height:0,left:0,top:0};function _s(){Xi(ms,!1)}let gs,ws,bs,vs;function xs(t,e,n,i,s,r,l){Bi=!0,ji=Vi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!0,!1),null!=t&&(ge(p,y,ys,!1),Os(f,w,$i,Oi,Oe,Ce,null));let{left:a,top:o,width:u,height:c}=Gi;gs=a,ws=o,bs=u,vs=c,_s()}function ys(t,e,n,i,s,r,l){Bi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!1,!0);let{left:a,top:o,width:u,height:c}=Gi,d=u>0||c>0,h=gs!=a||ws!=o||bs!=u||vs!=c;if(d&&h&&Xi(Gi),Wi.setScale&&d&&h){let t=a,e=u,n=o,i=c;if(1==Nt.ori&&(t=o,e=c,n=a,i=u),ji&&qi(St,is(t,St),is(t+e,St)),Vi)for(let t in yt){let e=yt[t];t!=St&&null==e.from&&e.min!=ft&&qi(t,is(n+i,t),is(n,t))}_s()}else wn.lock&&(wn._lock=!wn._lock,cs(null,!0,!1));null!=t&&(Me(p,y),Os(p,w,Pi,Li,Oe,Ce,null))}function ks(t,e,n,i,s,r,l){wn._lock||(bn(t),di(),_s(),null!=t&&Os(g,w,Pi,Li,Oe,Ce,null))}function zs(){gt.forEach(qn),mn(w.width,w.height,!0)}H(b,k,zs);const Ss={};Ss.mousedown=xs,Ss.mousemove=fs,Ss.mouseup=ys,Ss.dblclick=ks,Ss.setSeries=(t,e,n,i)=>{-1!=(n=(0,Ds.match[2])(w,e,n))&&Ji(n,i,!0,!1)},wn.show&&(ge(f,q,xs),ge(h,q,fs),ge(m,q,(t=>{bn(t),hs(!1)})),ge(_,q,(function(t,e,n,i,s,r,l){if(wn._lock)return;bn(t);let a=Bi;if(Bi){let t,e,n=!0,i=!0,s=10;0==Nt.ori?(t=ji,e=Vi):(t=Vi,e=ji),t&&e&&(n=Pi<=s||Pi>=Oe-s,i=Li<=s||Li>=Ce-s),t&&n&&(Pi=Pi<$i?0:Oe),e&&i&&(Li=Li{t.call(null,w,e,n)}))}(n.plugins||[]).forEach((t=>{for(let e in t.hooks)Ms[e]=(Ms[e]||[]).concat(t.hooks[e])}));const Ts=(t,e,n)=>n,Ds=Ft({key:null,setSeries:!1,filters:{pub:vt,sub:vt},scales:[St,ut[1]?ut[1].scale:null],match:[xt,xt,Ts],values:[null,null]},wn.sync);2==Ds.match.length&&Ds.match.push(Ts),wn.sync=Ds;const As=Ds.key,$s=cn(As);function Os(t,e,n,i,s,r,l){Ds.filters.pub(t,e,n,i,s,r,l)&&$s.pub(t,e,n,i,s,r,l)}function Rs(){Es("init",n,i),ci(i||n.data,!1),jt[St]?Yi(St,jt[St]):di(),hn=Gi.show&&(Gi.width>0||Gi.height>0),dn=pn=!0,mn(n.width,n.height)}return $s.sub(w),w.pub=function(t,e,n,i,s,r,l){Ds.filters.sub(t,e,n,i,s,r,l)&&Ss[t](null,e,n,i,s,r,l)},w.destroy=function(){$s.unsub(w),Ln.delete(w),_e.clear(),I(b,k,zs),Z.remove(),ie?.remove(),Es("destroy")},ut.forEach(Tn),gt.forEach((function(t,e){if(t._show=t.show,t.show){let n=t.side%2,i=yt[t.scale];null==i&&(t.scale=n?ut[1].scale:St,i=yt[t.scale]);let s=i.time;t.size=_t(t.size),t.space=_t(t.space),t.rotate=_t(t.rotate),Ct(t.incrs)&&t.incrs.forEach((t=>{!Tt.has(t)&&Tt.set(t,Dt(t))})),t.incrs=_t(t.incrs||(2==i.distr?re:s?1==it?we:xe:le)),t.splits=_t(t.splits||(s&&1==i.distr?Kt:3==i.distr?Be:4==i.distr?We:Ye)),t.stroke=_t(t.stroke),t.grid.stroke=_t(t.grid.stroke),t.ticks.stroke=_t(t.ticks.stroke),t.border.stroke=_t(t.border.stroke);let r=t.values;t.values=Ct(r)&&!Ct(r[0])?_t(r):s?Ct(r)?Se(Vt,ze(r,Gt)):Lt(r)?function(t,e){let n=Qt(e);return(e,i,s,r,l)=>i.map((e=>n(t(e))))}(Vt,r):r||Xt:r||Fe,t.filter=_t(t.filter||(i.distr>=3&&10==i.log?qe:3==i.distr&&2==i.log?Je:wt)),t.font=Xn(t.font),t.labelFont=Xn(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&&(Dn[e]=!0,t._el=$("u-axis",V))}})),c?c instanceof HTMLElement?(c.appendChild(Z),Rs()):c(w,Rs):Rs(),w}Jn.assign=Ft,Jn.fmtNum=Q,Jn.rangeNum=K,Jn.rangeLog=B,Jn.rangeAsinh=W,Jn.orient=dn,Jn.pxRatio=S,Jn.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let i=1;i=i&&null==t[s];)s--;if(s<=i)return!0;const r=at(1,it((s-i+1)/e));for(let e=t[i],n=i+r;n<=s;n+=r){const i=t[n];if(null!=i){if(i<=e)return!1;e=i}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,i=Array(n);for(let t=0;te[t]-e[n]));let s=[];for(let e=0;et-e))],s=i[0].length,r=new Map;for(let t=0;tdn(t,r,((o,u,c,d,h,f,p,m,_,g,w)=>{let b=o.pxRound,{left:v,width:x}=t.bbox,y=t=>b(f(t,d,g,m)),k=t=>b(p(t,h,w,_)),z=0==d.ori?xn:yn;const M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=M.stroke,T=d.dir*(0==d.ori?1:-1);l=Y(c,l,a,1),a=Y(c,l,a,-1);let D=k(c[1==T?l:a]),A=y(u[1==T?l:a]),$=A,O=A;s&&-1==e&&(O=v,z(E,O,D)),z(E,A,D);for(let t=1==T?l:a;t>=l&&t<=a;t+=T){let n=c[t];if(null==n)continue;let i=y(u[t]),s=k(n);1==e?z(E,i,D):z(E,$,s),z(E,i,s),D=s,$=i}let R=$;s&&1==e&&(R=v+x,z(E,R,D));let[C,P]=hn(t,r);if(null!=o.fill||0!=C){let e=M.fill=new Path2D(E),n=k(o.fillTo(t,r,o.min,o.max,C));z(e,R,n),z(e,O,n)}if(!o.spanGaps){let s=[];s.push(..._n(u,c,l,a,T,y,i));let h=o.width*S/2,f=n||1==e?h:-h,p=n||-1==e?-h:h;s.forEach((t=>{t[0]+=f,t[1]+=p})),M.gaps=s=o.gaps(t,r,l,a,s),M.clip=mn(s,d.ori,m,_,g,w)}return 0!=P&&(M.band=2==P?[pn(t,r,l,a,E,-1),pn(t,r,l,a,E,1)]:pn(t,r,l,a,E,P)),M}))},t.bars=function(t){const e=X((t=t||$t).size,[.6,ft,1]),n=t.align||0,i=t.gap||0;let s=t.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=_t(s),l=1-e[0],a=X(e[1],ft),o=X(e[2],1),u=X(t.disp,$t),c=X(t.each,(t=>{})),{fill:d,stroke:h}=u;return(t,e,s,f)=>dn(t,e,((p,m,_,g,w,b,v,x,y,k,z)=>{let M,E,T=p.pxRound,D=n,A=i*S,$=a*S,O=o*S;0==g.ori?[M,E]=r(t,e):[E,M]=r(t,e);const R=g.dir*(0==g.ori?1:-1);let C,P,L,U=0==g.ori?kn:zn,Z=0==g.ori?c:(t,e,n,i,s,r,l)=>{c(t,e,n,s,i,l,r)},N=X(t.bands,Ot).find((t=>t.series[0]==e)),H=null!=N?N.dir:0,I=p.fillTo(t,e,p.min,p.max,H),F=T(v(I,w,z,y)),Y=k,B=T(p.width*S),W=!1,j=null,V=null,G=null,K=null;null==d||0!=B&&null==h||(W=!0,j=d.values(t,e,s,f),V=new Map,new Set(j).forEach((t=>{null!=t&&V.set(t,new Path2D)})),B>0&&(G=h.values(t,e,s,f),K=new Map,new Set(G).forEach((t=>{null!=t&&K.set(t,new Path2D)}))));let{x0:q,size:J}=u;if(null!=q&&null!=J){D=1,m=q.values(t,e,s,f),2==q.unit&&(m=m.map((e=>t.posToVal(x+e*k,g.key,!0))));let n=J.values(t,e,s,f);P=2==J.unit?n[0]*k:b(n[0],g,k,x)-b(0,g,k,x),Y=Cn(m,_,b,g,k,x,Y),L=Y-P+A}else Y=Cn(m,_,b,g,k,x,Y),L=Y*l+A,P=Y-L;L<1&&(L=0),B>=P/2&&(B=0),L<5&&(T=gt);let Q=L>0;P=T(mt(Y-L-(Q?B:0),O,$)),C=(0==D?P/2:D==R?0:P)-D*R*((0==D?A/2:0)+(Q?B/2:0));const tt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},et=W?null:new Path2D;let nt=null;if(null!=N)nt=t.data[N.series[1]];else{let{y0:n,y1:i}=u;null!=n&&null!=i&&(_=i.values(t,e,s,f),nt=n.values(t,e,s,f))}let st=M*P,rt=E*P;for(let n=1==R?s:f;n>=s&&n<=f;n+=R){let i=_[n];if(null==i)continue;if(null!=nt){let t=nt[n]??0;if(i-t==0)continue;F=v(t,w,z,y)}let s=b(2!=g.distr||null!=u?m[n]:n,g,k,x),r=v(X(i,I),w,z,y),l=T(s-C),a=T(at(r,F)),o=T(lt(r,F)),c=a-o;if(null!=i){let s=i<0?rt:st,r=i<0?st:rt;W?(B>0&&null!=G[n]&&U(K.get(G[n]),l,o+it(B/2),P,at(0,c-B),s,r),null!=j[n]&&U(V.get(j[n]),l,o+it(B/2),P,at(0,c-B),s,r)):U(et,l,o+it(B/2),P,at(0,c-B),s,r),Z(t,e,n,l-B/2,o,P+B,c)}}return B>0?tt.stroke=W?K:et:W||(tt._fill=0==p.width?p._fill:p._stroke??p._fill,tt.width=0),tt.fill=W?V:et,tt}))},t.spline=function(t){return function(t,e){const n=X(e?.alignGaps,0);return(e,i,s,r)=>dn(e,i,((l,a,o,u,c,d,h,f,p,m,_)=>{let g,w,b,v=l.pxRound,x=t=>v(d(t,u,m,f)),y=t=>v(h(t,c,_,p));0==u.ori?(g=bn,b=xn,w=En):(g=vn,b=yn,w=Tn);const k=u.dir*(0==u.ori?1:-1);s=Y(o,s,r,1),r=Y(o,s,r,-1);let z=x(a[1==k?s:r]),S=z,M=[],E=[];for(let t=1==k?s:r;t>=s&&t<=r;t+=k)if(null!=o[t]){let e=x(a[t]);M.push(S=e),E.push(y(o[t]))}const T={stroke:t(M,E,g,b,w,v),fill:null,clip:null,band:null,gaps:null,flags:1},D=T.stroke;let[A,$]=hn(e,i);if(null!=l.fill||0!=A){let t=T.fill=new Path2D(D),n=y(l.fillTo(e,i,l.min,l.max,A));b(t,S,n),b(t,z,n)}if(!l.spanGaps){let t=[];t.push(..._n(a,o,s,r,k,x,n)),T.gaps=t=l.gaps(e,i,s,r,t),T.clip=mn(t,u.ori,f,p,m,_)}return 0!=$&&(T.band=2==$?[pn(e,i,s,r,D,-1),pn(e,i,s,r,D,1)]:pn(e,i,s,r,D,$)),T}))}(Pn,t)}}var Qn=n(379),ti=n.n(Qn),ei=n(795),ni=n.n(ei),ii=n(569),si=n.n(ii),ri=n(565),li=n.n(ri),ai=n(216),oi=n.n(ai),ui=n(589),ci=n.n(ui),di=n(350),hi={};function fi(t){var e,n=HTMLWidgets.find("#"+t);return void 0!==n&&(e=n.getWidget()),e}function pi(t,e){let n=[],i=[],s=t[0].length,r=Array(s);for(let t=0;tr[e]+=+t)));for(let n=1;ni>n&&!e(i))),n]});return i=i.filter((t=>t.series[1]>-1)),{data:[t[0]].concat(n),bands:i}}hi.styleTagTransform=ci(),hi.setAttributes=li(),hi.insert=si().bind(null,"head"),hi.domAPI=ni(),hi.insertStyleElement=oi(),ti()(di.Z,hi),di.Z&&di.Z.locals&&di.Z.locals;const mi=(t="{YYYY}/{MM}/{DD} {HH}:{mm}:{ss}",e=" - ",n=10,i=10)=>{let s=0,r=0;const l=document.createElement("div");l.className="u-tooltip",l.style.position="absolute",l.style.display="none",l.style.padding="4px",l.style.border="2px solid black",l.style.background="#FFF";let a=null,o=null;const u=uPlot.fmtDate(t);let c,d=!1;function h(t){console.log(t),d||(l.style.display="block",c.style.cursor="crosshair",d=!0);let h=t.valToPos(t.data[a][o],"y"),f=t.valToPos(t.data[0][o],"x");l.style.top=r+h+n+"px",l.style.left=s+f+i+"px";let p=t.series[a]._stroke;l.style.borderColor=p;let m=t.series[a].value;l.textContent=u(new Date(1e3*t.data[0][o]))+e+m(t,t.data[a][o],a,o)}return{hooks:{ready:[t=>{c=t.over,s=parseFloat(c.style.left),r=parseFloat(c.style.top),t.root.querySelector(".u-wrap").appendChild(l)}],setCursor:[t=>{let e=t.cursor;o!=e.idx&&(o=e.idx,null!=a&&h(t))}],setSeries:[(t,e)=>{a!=e&&(a=e,null==e?d&&(l.style.display="none",c.style.cursor=null,d=!1):null!=o&&h(t))}],drawAxes:[t=>{let{ctx:e}=t,{left:n,top:i,width:s,height:r}=t.bbox;e.save(),e.strokeStyle="#fcb0f17a",e.beginPath();let[l,a]=t.series[0].idxs;e.closePath(),e.stroke(),e.restore()}]}}},_i=({className:t,style:e={backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#424242"}}={})=>{let n;return{hooks:{init:function(i,s){n=i.root.querySelector(".u-legend"),n.classList.remove("u-inline"),t&&n.classList.add(t),uPlot.assign(n.style,{textAlign:"left",pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,zIndex:100,boxShadow:"2px 2px 10px rgba(0,0,0,0.5)",...e});const r=n.querySelectorAll(".u-marker");for(let t=0;t{n.style.display=null})),l.addEventListener("mouseleave",(()=>{n.style.display="none"}))},setCursor:function(t){const{left:e,top:i}=t.cursor;n.style.transform="translate("+e+"px, "+i+"px)"}}}},gi=t=>{let e,n,i,s,r,l,a=t.factor||.75;function o(t,e,n,i,s,r){return t>i?(e=s,n=r):er&&(n=r,e=r-t),[e,n]}return{hooks:{ready:t=>{e=t.scales.x.min,n=t.scales.x.max,i=t.scales.y.min,s=t.scales.y.max,r=n-e,l=s-i;let u=t.over,c=u.getBoundingClientRect();u.addEventListener("mousedown",(e=>{if(1==e.button){e.preventDefault();let n=e.clientX,i=t.scales.x.min,s=t.scales.x.max,r=t.posToVal(1,"x")-t.posToVal(0,"x");function l(e){e.preventDefault();let l=e.clientX,a=r*(l-n);t.setScale("x",{min:i-a,max:s-a})}function a(t){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}})),u.addEventListener("wheel",(u=>{u.preventDefault();let{left:d,top:h}=t.cursor,f=d/c.width,p=1-h/c.height,m=t.posToVal(d,"x"),_=t.posToVal(h,"y"),g=t.scales.x.max-t.scales.x.min,w=t.scales.y.max-t.scales.y.min,b=u.deltaY<0?g*a:g/a,v=m-f*b,x=v+b;[v,x]=o(b,v,x,r,e,n);let y=u.deltaY<0?w*a:w/a,k=_-p*y,z=k+y;[k,z]=o(y,k,z,l,i,s),t.batch((()=>{t.setScale("x",{min:v,max:x}),t.setScale("y",{min:k,max:z})}))}))}}}},wi=({className:t,style:e={backgroundColor:"rgba(51,204,255,0.3)"}}={})=>{let n,i,s,r;return{opts:(t,e)=>{uPlot.assign(e,{cursor:{x:!1,y:!1}})},hooks:{init:function(r){n=r.under,i=r.over,s=document.createElement("div"),t&&s.classList.add(t),uPlot.assign(s.style,{pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,height:"100%",...e}),n.appendChild(s),i.addEventListener("mouseenter",(()=>{s.style.display=null})),i.addEventListener("mouseleave",(()=>{s.style.display="none"}))},setCursor:function(t){if(r!==t.cursor.idx){r=t.cursor.idx;let[e,n]=t.series[0].idxs;const i=n-e,l=t.bbox.width/i/devicePixelRatio,a=2==t.scales.x.distr?r:t.data[0][r],o=t.valToPos(a,"x")-l/2;s.style.transform="translateX("+Math.round(o)+"px)",s.style.width=Math.round(l)+"px"}}}}},bi=(t,e,n,i)=>{const s=5*devicePixelRatio;return uPlot.orient(t,e,((n,i,r,l,a,o,u,c,d,h,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=l.min&&e<=l.max&&n>=a.min&&n<=a.max){let t=o(e,l,h,c),i=u(n,a,f,d);v.moveTo(t+s/2,i),g(v,t,i,s/2,0,b)}}console.timeEnd("points"),t.ctx.fill(v)})),null},vi=t=>{let e=t.yintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(t.scales.x.min,"x",!0),a=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(l,r),t.ctx.lineTo(a,r),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},xi=t=>{let e=t.xintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"x",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(t.scales.y.max,"y",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(r,a),t.ctx.lineTo(r,l),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},yi=t=>{let e=t.xmin||0,n=t.xmax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(t.scales.y.max,"y",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(e,"x",!0),o=t.valToPos(n,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,r,o-a,l-r),t.ctx.restore()}},ki=t=>{let e=t.ymin||0,n=t.ymax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(n,"y",!0),a=t.valToPos(t.scales.x.min,"x",!0),o=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,l,o-a,r-l),t.ctx.restore()}},zi=({gap:t=2,shadowColor:e="#000000",bearishColor:n="#e54245",bullishColor:i="#4ab650",bodyMaxWidth:s=20,shadowWidth:r=2,bodyOutline:l=1}={})=>({opts:(t,e)=>{uPlot.assign(e,{cursor:{points:{show:!1}}}),e.series.forEach((t=>{t.paths=()=>null,t.points={show:!1}}))},hooks:{draw:function(a){a.ctx.save();const o=r%2/2;a.ctx.translate(o,o);let[u,c]=a.series[0].idxs;for(let o=u;o<=c;o++){let d=2==a.scales.x.distr?o:a.data[0][o],h=a.data[1][o],f=a.data[2][o],p=a.data[3][o],m=a.data[4][o],_=a.valToPos(d,"x",!0),g=a.valToPos(p,"y",!0),w=a.valToPos(f,"y",!0),b=a.valToPos(h,"y",!0),v=a.valToPos(m,"y",!0),x=Math.max(w,g)-Math.min(w,g),y=_-r/2,k=Math.min(w,g);a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(y),Math.round(k),Math.round(r),Math.round(x));let z=a.bbox.width/(c-u),S=Math.min(s,z-t),M=Math.max(v,b)-Math.min(v,b),E=_-S/2,T=Math.min(v,b),D=h>m?n:i;a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(E),Math.round(T),Math.round(S),Math.round(M)),a.ctx.fillStyle=D,a.ctx.fillRect(Math.round(E+l),Math.round(T+l),Math.round(S-2*l),Math.round(M-2*l))}a.ctx.translate(-o,-o),a.ctx.restore()}}});function Si(t,e,n,i,s,r,l){const a=r.height||80,o=r.gripColor||"#4a90d9",u=r.gripWidth||8,c="u-zoom-ranger-styles";if(!document.getElementById(c)){const t=document.createElement("style");t.id=c,t.textContent=[".u-zoom-ranger-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; }",".u-zoom-ranger-wrap .u-zoom-ranger-main { flex: 1 1 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav { flex: 0 0 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select { pointer-events: all; cursor: grab; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select:active { cursor: grabbing; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-axis { pointer-events: none; }",".u-grip-l, .u-grip-r {"," position: absolute; top: 0; width: "+u+"px; height: 100%;"," background: "+o+"; opacity: 0.8; cursor: ew-resize; border-radius: 2px;","}",".u-grip-l { left: "+-Math.ceil(u/2)+"px; }",".u-grip-r { right: "+-Math.ceil(u/2)+"px; }"].join("\n"),document.head.appendChild(t)}const d=document.createElement("div");d.className="u-zoom-ranger-wrap";const h=document.createElement("div");h.className="u-zoom-ranger-main";const f=document.createElement("div");let p,m,_;f.className="u-zoom-ranger-nav",d.appendChild(h),d.appendChild(f),t.appendChild(d);const g={left:null,width:null},w={min:null,max:null};let b,v;function x(t,e){const n=document.createElement("div");return n.classList.add(e),t.appendChild(n),n}function y(t,e){w.min=v.posToVal(t,"x"),w.max=v.posToVal(t+e,"x"),b.setScale("x",w)}function k(t,e,n){const i=v.bbox.width/z();if(2===n){const n=e-t;e>i?t=(e=i)-n:t<0&&(e=(t=0)+n)}else t>e&&(0===n?t=e:1===n&&(e=t)),t=Math.max(0,t),e=Math.min(e,i);y(t,e-t)}function z(){return l.pxRatio||window.devicePixelRatio||1}function S(t,e){p=t.clientX,m=v.select.left,_=m+v.select.width;const n=function(t){let e;return(...n)=>{e||(e=requestAnimationFrame((()=>{t(...n),e=null})))}}(e);document.addEventListener("mousemove",n),document.addEventListener("mouseup",(function t(){document.removeEventListener("mouseup",t),document.removeEventListener("mousemove",n)})),t.stopPropagation()}const M=s.series?s.series.map(((t,e)=>0===e?{}:{stroke:r.stroke||t.stroke||"#999"})):[{}],E={width:e,height:a,cursor:{x:!1,y:!1,points:{show:!1},drag:{setScale:!1,setSelect:!0,x:!0,y:!1}},legend:{show:!1},scales:s.scales?JSON.parse(JSON.stringify(s.scales)):{},axes:[{},{show:!1,grid:{show:!1},ticks:{show:!1}}],series:M,hooks:{ready:[t=>{const e=t.bbox.width/z(),n=t.bbox.height/z();t.setSelect({left:0,width:e,height:n},!1);const i=t.root.querySelector(".u-select");i.addEventListener("mousedown",(t=>{S(t,(t=>k(m+(t.clientX-p),_+(t.clientX-p),2)))})),x(i,"u-grip-l").addEventListener("mousedown",(t=>{S(t,(t=>k(m+(t.clientX-p),_,0)))})),x(i,"u-grip-r").addEventListener("mousedown",(t=>{S(t,(t=>k(m,_+(t.clientX-p),1)))}))}],setSelect:[t=>{y(t.select.left,t.select.width)}]}},T=s.hooks||{},D=Array.isArray(T.setScale)?T.setScale:T.setScale?[T.setScale]:[],A=Object.assign({},s,{width:e,height:n,select:{over:!1},hooks:Object.assign({},T,{setScale:[...D,t=>{if(!v)return;const e=Math.round(v.valToPos(t.scales.x.min,"x"));var n,i;n=e,i=Math.round(v.valToPos(t.scales.x.max,"x"))-e,g.left=n,g.width=i,v.setSelect(g,!1)}]})});return v=new l(E,i,f),b=new l(A,i,h),new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width,n=e.contentRect.height,i=Math.max(50,n-a-4);v.setSize({width:t,height:a}),b.setSize({width:t,height:i})}})).observe(t),{zoomed:b,ranger:v,wrap:d}}function Mi(t){let e=t.length;for(;--e>=0;)t[e]=0}const Ei=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]),Ti=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]),Di=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ai=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$i=new Array(576);Mi($i);const Oi=new Array(60);Mi(Oi);const Ri=new Array(512);Mi(Ri);const Ci=new Array(256);Mi(Ci);const Pi=new Array(29);Mi(Pi);const Li=new Array(30);function Ui(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}let Zi,Ni,Hi;function Ii(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}Mi(Li);const Fi=t=>t<256?Ri[t]:Ri[256+(t>>>7)],Yi=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Bi=(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<{Bi(t,n[2*e],n[2*e+1])},ji=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Vi=(t,e,n)=>{const i=new Array(16);let s,r,l=0;for(s=1;s<=15;s++)l=l+n[s-1]<<1,i[s]=l;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=ji(i[e]++,e))}},Gi=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},Ki=t=>{t.bi_valid>8?Yi(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Xi=(t,e,n,i)=>{const s=2*e,r=2*n;return t[s]{const i=t.heap[n];let s=n<<1;for(;s<=t.heap_len&&(s{let i,s,r,l,a=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+a++],i+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===i?Wi(t,s,e):(r=Ci[s],Wi(t,r+256+1,e),l=Ei[r],0!==l&&(s-=Pi[r],Bi(t,s,l)),i--,r=Fi(i),Wi(t,r,n),l=Ti[r],0!==l&&(i-=Li[r],Bi(t,i,l)))}while(a{const n=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,a,o,u=-1;for(t.heap_len=0,t.heap_max=573,l=0;l>1;l>=1;l--)qi(t,n,l);o=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],qi(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=a,n[2*o]=n[2*l]+n[2*a],t.depth[o]=(t.depth[l]>=t.depth[a]?t.depth[l]:t.depth[a])+1,n[2*l+1]=n[2*a+1]=o,t.heap[1]=o++,qi(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let u,c,d,h,f,p,m=0;for(h=0;h<=15;h++)t.bl_count[h]=0;for(n[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)c=t.heap[u],h=n[2*n[2*c+1]+1]+1,h>o&&(h=o,m++),n[2*c+1]=h,c>i||(t.bl_count[h]++,f=0,c>=a&&(f=l[c-a]),p=n[2*c],t.opt_len+=p*(h+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==m){do{for(h=o-1;0===t.bl_count[h];)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[o]--,m-=2}while(m>0);for(h=o;0!==h;h--)for(c=t.bl_count[h];0!==c;)d=t.heap[--u],d>i||(n[2*d+1]!==h&&(t.opt_len+=(h-n[2*d+1])*n[2*d],n[2*d+1]=h),c--)}})(t,e),Vi(n,u,t.bl_count)},ts=(t,e,n)=>{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=l,l=e[2*(i+1)+1],++a{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),i=0;i<=n;i++)if(s=l,l=e[2*(i+1)+1],!(++a{Bi(t,0+(i?1:0),3),Ki(t),Yi(t,n),Yi(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var ss={_tr_init:t=>{ns||((()=>{let t,e,n,i,s;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Pi[i]=n,t=0;t<1<>=7;i<30;i++)for(Li[i]=s<<7,t=0;t<1<{let s,r,l=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)),Qi(t,t.l_desc),Qi(t,t.d_desc),l=(t=>{let e;for(ts(t,t.dyn_ltree,t.l_desc.max_code),ts(t,t.dyn_dtree,t.d_desc.max_code),Qi(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Ai[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&-1!==e?is(t,e,n,i):4===t.strategy||r===s?(Bi(t,2+(i?1:0),3),Ji(t,$i,Oi)):(Bi(t,4+(i?1:0),3),((t,e,n,i)=>{let s;for(Bi(t,e-257,5),Bi(t,n-1,5),Bi(t,i-4,4),s=0;s(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*(Ci[n]+256+1)]++,t.dyn_dtree[2*Fi(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Bi(t,2,3),Wi(t,256,$i),(t=>{16===t.bi_valid?(Yi(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)}},rs=(t,e,n,i)=>{let s=65535&t|0,r=t>>>16&65535|0,l=0;for(;0!==n;){l=n>2e3?2e3:n,n-=l;do{s=s+e[i++]|0,r=r+s|0}while(--l);s%=65521,r%=65521}return s|r<<16|0};const ls=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var as=(t,e,n,i)=>{const s=ls,r=i+n;t^=-1;for(let n=i;n>>8^s[255&(t^e[n])];return-1^t},os={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"},us={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:cs,_tr_stored_block:ds,_tr_flush_block:hs,_tr_tally:fs,_tr_align:ps}=ss,{Z_NO_FLUSH:ms,Z_PARTIAL_FLUSH:_s,Z_FULL_FLUSH:gs,Z_FINISH:ws,Z_BLOCK:bs,Z_OK:vs,Z_STREAM_END:xs,Z_STREAM_ERROR:ys,Z_DATA_ERROR:ks,Z_BUF_ERROR:zs,Z_DEFAULT_COMPRESSION:Ss,Z_FILTERED:Ms,Z_HUFFMAN_ONLY:Es,Z_RLE:Ts,Z_FIXED:Ds,Z_DEFAULT_STRATEGY:As,Z_UNKNOWN:$s,Z_DEFLATED:Os}=us,Rs=258,Cs=262,Ps=42,Ls=113,Us=666,Zs=(t,e)=>(t.msg=os[e],e),Ns=t=>2*t-(t>4?9:0),Hs=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Is=t=>{let e,n,i,s=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=s?n-s:0}while(--e);e=s,i=e;do{n=t.prev[--i],t.prev[i]=n>=s?n-s:0}while(--e)};let Fs=(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))},Bs=(t,e)=>{hs(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ys(t.strm)},Ws=(t,e)=>{t.pending_buf[t.pending++]=e},js=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Vs=(t,e,n,i)=>{let s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),n),1===t.state.wrap?t.adler=rs(t.adler,e,s,n):2===t.state.wrap&&(t.adler=as(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)},Gs=(t,e)=>{let n,i,s=t.max_chain_length,r=t.strstart,l=t.prev_length,a=t.nice_match;const o=t.strstart>t.w_size-Cs?t.strstart-(t.w_size-Cs):0,u=t.window,c=t.w_mask,d=t.prev,h=t.strstart+Rs;let f=u[r+l-1],p=u[r+l];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,u[n+l]===p&&u[n+l-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&rl){if(t.match_start=e,l=i,i>=a)break;f=u[r+l-1],p=u[r+l]}}}while((e=d[e&c])>o&&0!=--s);return l<=t.lookahead?l:t.lookahead},Ks=t=>{const e=t.w_size;let n,i,s;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Cs)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Is(t),i+=e),0===t.strm.avail_in)break;if(n=Vs(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Fs(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Fs(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,i,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,l=0,a=t.strm.avail_in;do{if(n=65535,s=t.bi_valid+42>>3,t.strm.avail_outi+t.strm.avail_in&&(n=i+t.strm.avail_in),n>s&&(n=s),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ys(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vs(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===l);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_waters&&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++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(Vs(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,i=t.strstart-t.block_start,(i>=r||(i||e===ws)&&e!==ms&&0===t.strm.avail_in&&i<=s)&&(n=i>s?s:i,l=e===ws&&0===t.strm.avail_in&&n===i?1:0,ds(t,t.block_start,n,l),t.block_start+=n,Ys(t.strm)),l?3:1)},qs=(t,e)=>{let n,i;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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-Cs&&(t.match_length=Gs(t,n)),t.match_length>=3)if(i=fs(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=Fs(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=Fs(t,t.ins_h,t.window[t.strstart+1]);else i=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2},Js=(t,e)=>{let n,i,s;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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){s=t.strstart+t.lookahead-3,i=fs(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Fs(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++,i&&(Bs(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=fs(t,0,t.window[t.strstart-1]),i&&Bs(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&&(i=fs(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2};function Qs(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}const tr=[new Qs(0,0,0,0,Xs),new Qs(4,4,8,4,qs),new Qs(4,5,16,8,qs),new Qs(4,6,32,32,qs),new Qs(4,4,16,16,Js),new Qs(8,16,32,32,Js),new Qs(8,16,128,128,Js),new Qs(8,32,128,256,Js),new Qs(32,128,258,1024,Js),new Qs(32,258,258,4096,Js)];function er(){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=Os,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),Hs(this.dyn_ltree),Hs(this.dyn_dtree),Hs(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),Hs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Hs(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 nr=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ps&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ls&&e.status!==Us?1:0},ir=t=>{if(nr(t))return Zs(t,ys);t.total_in=t.total_out=0,t.data_type=$s;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?Ps:Ls,t.adler=2===e.wrap?0:1,e.last_flush=-2,cs(e),vs},sr=t=>{const e=ir(t);var n;return e===vs&&((n=t.state).window_size=2*n.w_size,Hs(n.head),n.max_lazy_match=tr[n.level].max_lazy,n.good_match=tr[n.level].good_length,n.nice_match=tr[n.level].nice_length,n.max_chain_length=tr[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},rr=(t,e,n,i,s,r)=>{if(!t)return ys;let l=1;if(e===Ss&&(e=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),s<1||s>9||n!==Os||i<8||i>15||e<0||e>9||r<0||r>Ds||8===i&&1!==l)return Zs(t,ys);8===i&&(i=9);const a=new er;return t.state=a,a.strm=t,a.status=Ps,a.wrap=l,a.gzhead=null,a.w_bits=i,a.w_size=1<nr(t)||2!==t.state.wrap?ys:(t.state.gzhead=e,vs),or=(t,e)=>{if(nr(t)||e>bs||e<0)return t?Zs(t,ys):ys;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Us&&e!==ws)return Zs(t,0===t.avail_out?zs:ys);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ys(t),0===t.avail_out)return n.last_flush=-1,vs}else if(0===t.avail_in&&Ns(e)<=Ns(i)&&e!==ws)return Zs(t,zs);if(n.status===Us&&0!==t.avail_in)return Zs(t,zs);if(n.status===Ps&&0===n.wrap&&(n.status=Ls),n.status===Ps){let e=Os+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=Es||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,js(n,e),0!==n.strstart&&(js(n,t.adler>>>16),js(n,65535&t.adler)),t.adler=1,n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(57===n.status)if(t.adler=0,Ws(n,31),Ws(n,139),Ws(n,8),n.gzhead)Ws(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)),Ws(n,255&n.gzhead.time),Ws(n,n.gzhead.time>>8&255),Ws(n,n.gzhead.time>>16&255),Ws(n,n.gzhead.time>>24&255),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ws(n,255&n.gzhead.extra.length),Ws(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=as(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,3),n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=s,Ys(t),0!==n.pending)return n.last_flush=-1,vs;e=0,i-=s}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(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,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ys(t),0!==n.pending))return n.last_flush=-1,vs;Ws(n,255&t.adler),Ws(n,t.adler>>8&255),t.adler=0}if(n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(0!==t.avail_in||0!==n.lookahead||e!==ms&&n.status!==Us){let i=0===n.level?Xs(n,e):n.strategy===Es?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Ks(t),0===t.lookahead)){if(e===ms)return 1;break}if(t.match_length=0,n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===Ts?((t,e)=>{let n,i,s,r;const l=t.window;for(;;){if(t.lookahead<=Rs){if(Ks(t),t.lookahead<=Rs&&e===ms)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,i=l[s],i===l[++s]&&i===l[++s]&&i===l[++s])){r=t.strstart+Rs;do{}while(i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=fs(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):tr[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Us),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),vs;if(2===i&&(e===_s?ps(n):e!==bs&&(ds(n,0,0,!1),e===gs&&(Hs(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ys(t),0===t.avail_out))return n.last_flush=-1,vs}return e!==ws?vs:n.wrap<=0?xs:(2===n.wrap?(Ws(n,255&t.adler),Ws(n,t.adler>>8&255),Ws(n,t.adler>>16&255),Ws(n,t.adler>>24&255),Ws(n,255&t.total_in),Ws(n,t.total_in>>8&255),Ws(n,t.total_in>>16&255),Ws(n,t.total_in>>24&255)):(js(n,t.adler>>>16),js(n,65535&t.adler)),Ys(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vs:xs)},ur=t=>{if(nr(t))return ys;const e=t.state.status;return t.state=null,e===Ls?Zs(t,ks):vs},cr=(t,e)=>{let n=e.length;if(nr(t))return ys;const i=t.state,s=i.wrap;if(2===s||1===s&&i.status!==Ps||i.lookahead)return ys;if(1===s&&(t.adler=rs(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===s&&(Hs(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const r=t.avail_in,l=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Ks(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Fs(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Ks(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=l,t.input=a,t.avail_in=r,i.wrap=s,vs};const dr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var hr=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)dr(n,e)&&(t[e]=n[e])}}return t},fr=t=>{let e=0;for(let n=0,i=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;mr[254]=mr[254]=1;var _r=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,s,r,l=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&n):n<65536?(e[r++]=224|n>>>12,e[r++]=128|n>>>6&63,e[r++]=128|63&n):(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63,e[r++]=128|n>>>6&63,e[r++]=128|63&n);return e},gr=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,s;const r=new Array(2*n);for(s=0,i=0;i4)r[s++]=65533,i+=l-1;else{for(e&=2===l?31:3===l?15:7;l>1&&i1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&pr)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i{(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+mr[t[n]]>e?n:e},br=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 vr=Object.prototype.toString,{Z_NO_FLUSH:xr,Z_SYNC_FLUSH:yr,Z_FULL_FLUSH:kr,Z_FINISH:zr,Z_OK:Sr,Z_STREAM_END:Mr,Z_DEFAULT_COMPRESSION:Er,Z_DEFAULT_STRATEGY:Tr,Z_DEFLATED:Dr}=us;function Ar(t){this.options=hr({level:Er,method:Dr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Tr},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 br,this.strm.avail_out=0;let n=lr(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==Sr)throw new Error(os[n]);if(e.header&&ar(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?_r(e.dictionary):"[object ArrayBuffer]"===vr.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=cr(this.strm,t),n!==Sr)throw new Error(os[n]);this._dict_set=!0}}function $r(t,e){const n=new Ar(e);if(n.push(t,!0),n.err)throw n.msg||os[n.err];return n.result}Ar.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?zr:xr,"string"==typeof t?n.input=_r(t):"[object ArrayBuffer]"===vr.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(i),n.next_out=0,n.avail_out=i),(r===yr||r===kr)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(s=or(n,r),s===Mr)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=ur(this.strm),this.onEnd(s),this.ended=!0,s===Sr;if(0!==n.avail_out){if(r>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},Ar.prototype.onData=function(t){this.chunks.push(t)},Ar.prototype.onEnd=function(t){t===Sr&&(this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Or={Deflate:Ar,deflate:$r,deflateRaw:function(t,e){return(e=e||{}).raw=!0,$r(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,$r(t,e)},constants:us};const Rr=16209;var Cr=function(t,e){let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z,S;const M=t.state;n=t.next_in,z=t.input,i=n+(t.avail_in-5),s=t.next_out,S=t.output,r=s-(e-t.avail_out),l=s+(t.avail_out-257),a=M.dmax,o=M.wsize,u=M.whave,c=M.wnext,d=M.window,h=M.hold,f=M.bits,p=M.lencode,m=M.distcode,_=(1<>>24,h>>>=b,f-=b,b=w>>>16&255,0===b)S[s++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=p[(65535&w)+(h&(1<>>=b,f-=b),f<15&&(h+=z[n++]<>>24,h>>>=b,f-=b,b=w>>>16&255,!(16&b)){if(0==(64&b)){w=m[(65535&w)+(h&(1<a){t.msg="invalid distance too far back",M.mode=Rr;break t}if(h>>>=b,f-=b,b=s-r,x>b){if(b=x-b,b>u&&M.sane){t.msg="invalid distance too far back",M.mode=Rr;break t}if(y=0,k=d,0===c){if(y+=o-b,b2;)S[s++]=k[y++],S[s++]=k[y++],S[s++]=k[y++],v-=3;v&&(S[s++]=k[y++],v>1&&(S[s++]=k[y++]))}else{y=s-x;do{S[s++]=S[y++],S[s++]=S[y++],S[s++]=S[y++],v-=3}while(v>2);v&&(S[s++]=S[y++],v>1&&(S[s++]=S[y++]))}break}}break}}while(n>3,n-=v,f-=v<<3,h&=(1<{const o=a.bits;let u,c,d,h,f,p,m=0,_=0,g=0,w=0,b=0,v=0,x=0,y=0,k=0,z=0,S=null;const M=new Uint16Array(16),E=new Uint16Array(16);let T,D,A,$=null;for(m=0;m<=15;m++)M[m]=0;for(_=0;_=1&&0===M[w];w--);if(b>w&&(b=w),0===w)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(g=1;g0&&(0===t||1!==w))return-1;for(E[1]=0,m=1;m<15;m++)E[m+1]=E[m]+M[m];for(_=0;_852||2===t&&k>592)return 1;for(;;){T=m-x,l[_]+1=p?(D=$[l[_]-p],A=S[l[_]-p]):(D=96,A=0),u=1<>x)+c]=T<<24|D<<16|A|0}while(0!==c);for(u=1<>=1;if(0!==u?(z&=u-1,z+=u):z=0,_++,0==--M[m]){if(m===w)break;m=e[n+l[_]]}if(m>b&&(z&h)!==d){for(0===x&&(x=b),f+=g,v=m-x,y=1<852||2===t&&k>592)return 1;d=z&h,s[d]=b<<24|v<<16|f-r|0}}return 0!==z&&(s[f+z]=m-x<<24|64<<16|0),a.bits=b,0};const{Z_FINISH:Hr,Z_BLOCK:Ir,Z_TREES:Fr,Z_OK:Yr,Z_STREAM_END:Br,Z_NEED_DICT:Wr,Z_STREAM_ERROR:jr,Z_DATA_ERROR:Vr,Z_MEM_ERROR:Gr,Z_BUF_ERROR:Kr,Z_DEFLATED:Xr}=us,qr=16180,Jr=16190,Qr=16191,tl=16192,el=16194,nl=16199,il=16200,sl=16206,rl=16209,ll=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function al(){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 ol=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},ul=t=>{if(ol(t))return jr;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=qr,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,Yr},cl=t=>{if(ol(t))return jr;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ul(t)},dl=(t,e)=>{let n;if(ol(t))return jr;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?jr:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,cl(t))},hl=(t,e)=>{if(!t)return jr;const n=new al;t.state=n,n.strm=t,n.window=null,n.mode=qr;const i=dl(t,e);return i!==Yr&&(t.state=null),i};let fl,pl,ml=!0;const _l=t=>{if(ml){fl=new Int32Array(512),pl=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(Nr(1,t.lens,0,288,fl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Nr(2,t.lens,0,32,pl,0,t.work,{bits:5}),ml=!1}t.lencode=fl,t.lenbits=9,t.distcode=pl,t.distbits=5},gl=(t,e,n,i)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(n-i,n-i+s),r.wnext),(i-=s)?(r.window.set(e.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave{let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z=0;const S=new Uint8Array(4);let M,E;const T=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ol(t)||!t.output||!t.input&&0!==t.avail_in)return jr;n=t.state,n.mode===Qr&&(n.mode=tl),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,d=a,h=o,k=Yr;t:for(;;)switch(n.mode){case qr:if(0===n.wrap){n.mode=tl;break}for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0),u=0,c=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=rl;break}if((15&u)!==Xr){t.msg="unknown compression method",n.mode=rl;break}if(u>>>=4,c-=4,y=8+(15&u),0===n.wbits&&(n.wbits=y),y>15||y>n.wbits){t.msg="invalid window size",n.mode=rl;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>8&255,S[2]=u>>>16&255,S[3]=u>>>24&255,n.check=as(n.check,S,4,0)),u=0,c=0,n.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16184;case 16184:if(1024&n.flags){for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0)),u=0,c=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&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+f),y)),512&n.flags&&4&n.wrap&&(n.check=as(n.check,i,f,r)),a-=f,r+=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{y=i[r+f++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y))}while(y&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Qr;break;case 16189:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>=7&c,c-=7&c,n.mode=sl;break}for(;c<3;){if(0===a)break t;a--,u+=i[r++]<>>=1,c-=1,3&u){case 0:n.mode=16193;break;case 1:if(_l(n),n.mode=nl,e===Fr){u>>>=2,c-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=rl}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,u+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=rl;break}if(n.length=65535&u,u=0,c=0,n.mode=el,e===Fr)break t;case el:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>o&&(f=o),0===f)break t;s.set(i.subarray(r,r+f),l),a-=f,r+=f,o-=f,l+=f,n.length-=f;break}n.mode=Qr;break;case 16196:for(;c<14;){if(0===a)break t;a--,u+=i[r++]<>>=5,c-=5,n.ndist=1+(31&u),u>>>=5,c-=5,n.ncode=4+(15&u),u>>>=4,c-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=rl;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[T[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},k=Nr(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid code lengths set",n.mode=rl;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=_,c-=_,n.lens[n.have++]=w;else{if(16===w){for(E=_+2;c>>=_,c-=_,0===n.have){t.msg="invalid bit length repeat",n.mode=rl;break}y=n.lens[n.have-1],f=3+(3&u),u>>>=2,c-=2}else if(17===w){for(E=_+3;c>>=_,c-=_,y=0,f=3+(7&u),u>>>=3,c-=3}else{for(E=_+7;c>>=_,c-=_,y=0,f=11+(127&u),u>>>=7,c-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=rl;break}for(;f--;)n.lens[n.have++]=y}}if(n.mode===rl)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=rl;break}if(n.lenbits=9,M={bits:n.lenbits},k=Nr(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid literal/lengths set",n.mode=rl;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},k=Nr(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,k){t.msg="invalid distances set",n.mode=rl;break}if(n.mode=nl,e===Fr)break t;case nl:n.mode=il;case il:if(a>=6&&o>=258){t.next_out=l,t.avail_out=o,t.next_in=r,t.avail_in=a,n.hold=u,n.bits=c,Cr(t,h),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,n.mode===Qr&&(n.back=-1);break}for(n.back=0;z=n.lencode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,n.length=w,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Qr;break}if(64&g){t.msg="invalid literal/length code",n.mode=rl;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(E=n.extra;c>>=n.extra,c-=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,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,64&g){t.msg="invalid distance code",n.mode=rl;break}n.offset=w,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(E=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=rl;break}n.mode=16204;case 16204:if(0===o)break t;if(f=h-o,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=rl;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=s,p=l-n.offset,f=n.length;f>o&&(f=o),o-=f,n.length-=f;do{s[l++]=m[p++]}while(--f);0===n.length&&(n.mode=il);break;case 16205:if(0===o)break t;s[l++]=n.length,o--,n.mode=il;break;case sl:if(n.wrap){for(;c<32;){if(0===a)break t;a--,u|=i[r++]<{if(ol(t))return jr;let e=t.state;return e.window&&(e.window=null),t.state=null,Yr},yl=(t,e)=>{if(ol(t))return jr;const n=t.state;return 0==(2&n.wrap)?jr:(n.head=e,e.done=!1,Yr)},kl=(t,e)=>{const n=e.length;let i,s,r;return ol(t)?jr:(i=t.state,0!==i.wrap&&i.mode!==Jr?jr:i.mode===Jr&&(s=1,s=rs(s,e,n,0),s!==i.check)?Vr:(r=gl(t,e,n,n),r?(i.mode=16210,Gr):(i.havedict=1,Yr)))},zl=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 Sl=Object.prototype.toString,{Z_NO_FLUSH:Ml,Z_FINISH:El,Z_OK:Tl,Z_STREAM_END:Dl,Z_NEED_DICT:Al,Z_STREAM_ERROR:$l,Z_DATA_ERROR:Ol,Z_MEM_ERROR:Rl}=us;function Cl(t){this.options=hr({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 br,this.strm.avail_out=0;let n=bl(this.strm,e.windowBits);if(n!==Tl)throw new Error(os[n]);if(this.header=new zl,yl(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=_r(e.dictionary):"[object ArrayBuffer]"===Sl.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=kl(this.strm,e.dictionary),n!==Tl)))throw new Error(os[n])}function Pl(t,e){const n=new Cl(e);if(n.push(t),n.err)throw n.msg||os[n.err];return n.result}Cl.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,l,a;if(this.ended)return!1;for(l=e===~~e?e:!0===e?El:Ml,"[object ArrayBuffer]"===Sl.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(i),n.next_out=0,n.avail_out=i),r=vl(n,l),r===Al&&s&&(r=kl(n,s),r===Tl?r=vl(n,l):r===Ol&&(r=Al));n.avail_in>0&&r===Dl&&n.state.wrap>0&&0!==t[n.next_in];)wl(n),r=vl(n,l);switch(r){case $l:case Ol:case Al:case Rl:return this.onEnd(r),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||r===Dl))if("string"===this.options.to){let t=wr(n.output,n.next_out),e=n.next_out-t,s=gr(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(s)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Tl||0!==a){if(r===Dl)return r=xl(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Cl.prototype.onData=function(t){this.chunks.push(t)},Cl.prototype.onEnd=function(t){t===Tl&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ll={Inflate:Cl,inflate:Pl,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Pl(t,e)},ungzip:Pl,constants:us};const{Deflate:Ul,deflate:Zl,deflateRaw:Nl,gzip:Hl}=Or,{Inflate:Il,inflate:Fl,inflateRaw:Yl,ungzip:Bl}=Ll;var Wl=Bl,jl=n(484),Vl=n(178),Gl=n.n(Vl),Kl=n(387),Xl=n.n(Kl);jl.extend(Gl()),jl.extend(Xl());const ql=t=>(e,n)=>{new ResizeObserver((t=>{for(let n of t){let t=n.contentRect.height,i=n.contentRect.width;const s=e.root.querySelectorAll(".u-legend, .u-title");for(let e of s)t-=Math.floor(e.offsetHeight);e.setSize({width:i,height:t})}})).observe(t),t.appendChild(e.root),n()};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(t,e,n){var i,s,r,l,a;return{renderValue:function(o){if(void 0!==i&&i.destroy(),void 0!==s&&(s.destroy(),s=void 0),void 0!==r&&(t.removeChild(r),r=void 0),(l=o.config.options).width=e,l.height=n,a=o.config.data,o.use_gzipped_json){const t=atob(a),e=Uint8Array.from(t,(t=>t.charCodeAt(0))),n=Wl(e),i=(new TextDecoder).decode(n);a=JSON.parse(i)}if(o.config.zoomRanger){const u=o.config.zoomRanger,c=Math.max(50,n-(u.height||80)-4),d=Si(t,e,c,a,l,u,Jn);i=d.zoomed,s=d.ranger,r=d.wrap}else o.stacked?(l.hooks||(l.hooks={}),l.hooks.init=[t=>{[...t.root.querySelectorAll(".u-legend .u-series")].forEach(((e,n)=>{t.series[n]._hide&&(e.style.display="none")}))}],i=function(t,e,n,i,s,r,l,a){let{opts:o,data:u}=function(t,e,n,i){let s=function(t,e){return{scales:{x:{time:!0}},series:e}}(0,e),r=pi(i?i(n):n,(t=>!1));return s.bands=r.bands,s.cursor=s.cursor||{},s.cursor.dataIdx=(t,e,i,s)=>null===n[e][i]?null:i,s.series.forEach((t=>{t.value=(t,e,i,s)=>n[i][s],t.points=t.points||{},t.points.filter=(t,e,i,s)=>{if(i){let t=[];return n[e].forEach(((e,n)=>{null!==e&&t.push(n)})),t}}})),s.scales.y={range:(t,e,n)=>{let i=uPlot.rangeNum(e,n,.1,!0);return[i[0],i[1]]}},s.hooks={setSeries:[(t,e)=>{let i=pi(n,(e=>!t.series[e].show));t.delBand(null),i.bands.forEach((e=>t.addBand(e))),t.setData(i.data)}]},{opts:s,data:r.data}}(0,e,n,i);return o.title=t,o.width=s,o.height=r,o.hooks=Object.assign(o.hooks,l),console.log(o),new uPlot(o,u,a)}(l.title,l.series,a,null,e,n,l.hooks,ql(t))):i=new Jn(l,a,ql(t))},getWidget:function(){return i},resize:function(t,e){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(t){var e=fi(t.id);void 0!==e&&e[t.name].apply(null,t.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(t){var e=fi(t.id);void 0!==e&&e.setData(t.data)})),Shiny.addCustomMessageHandler("uplot-setSeries",(function(t){var e=fi(t.id);void 0!==e&&e.setSeries(t.seriesIdx,t.options)})),Shiny.addCustomMessageHandler("uplot-addSeries",(function(t){var e=fi(t.id);void 0!==e&&e.addSeries(t.options,t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-delSeries",(function(t){var e=fi(t.id);void 0!==e&&e.delSeries(t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-setScale",(function(t){var e=fi(t.id);void 0!==e&&e.setScale(t.scaleKey,t.limits)})),Shiny.addCustomMessageHandler("uplot-redraw",(function(t){var e=fi(t.id);void 0!==e&&e.redraw(t.rebuildPaths,t.recalcAxes)})))})();var s=window;for(var r in i)s[r]=i[r];i.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/man/uZoomRanger.Rd b/man/uZoomRanger.Rd new file mode 100644 index 0000000..a66fa9f --- /dev/null +++ b/man/uZoomRanger.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/zoom_ranger.R +\name{uZoomRanger} +\alias{uZoomRanger} +\title{Add a zoom ranger (range selector) below a uPlot chart} +\usage{ +uZoomRanger(uplot, height = 80, stroke = NULL, grip_color = "#4a90d9", + grip_width = 8) +} +\arguments{ +\item{uplot}{Chart created with \code{\link[=uPlot]{uPlot()}}.} + +\item{height}{Height of the ranger chart in pixels. Default is \code{80}.} + +\item{stroke}{Stroke color for the series drawn in the ranger. +Defaults to the stroke color(s) already set on the chart series.} + +\item{grip_color}{Color of the left and right resize grip handles. +Default is \code{"#4a90d9"}.} + +\item{grip_width}{Width (in pixels) of the grip handles. Default is \code{8}.} +} +\value{ +An \code{htmlwidget} object of class \code{"uPlot"}. +} +\description{ +Adds an interactive range-selector chart below the main uPlot chart. +The ranger allows the user to: +\itemize{ +\item drag the selection area to pan the main chart, +\item drag the left/right grip handles to resize the selection, +\item zoom the main chart by dragging directly on the ranger. +} +When the main chart's X scale changes (e.g. via cursor drag-zoom), the +ranger selection updates automatically. +} +\examples{ +library(uPlot) + +# Basic zoom ranger: select a window on the X axis, +# drag to pan, use grips to resize the selection. +uPlot( + data = eco2mix[, c("datetime", "consumption")], + options = list( + title = "Electricity consumption in France", + series = list( + list(label = "Time"), + list(label = "Consumption (MW)", stroke = "#0174DF") + ) + ) +) \%>\% + uZoomRanger() +} diff --git a/srcjs/modules/zoomRangerPlugin.js b/srcjs/modules/zoomRangerPlugin.js new file mode 100644 index 0000000..a66c71f --- /dev/null +++ b/srcjs/modules/zoomRangerPlugin.js @@ -0,0 +1,249 @@ +/** + * zoomRangerPlugin + * + * Creates an interactive range-selector (ranger) chart below the main uPlot + * chart. The two charts are kept in sync: + * - Dragging / resizing the ranger selection updates the main chart X scale. + * - Zooming / panning the main chart updates the ranger selection. + * + * @param {HTMLElement} el - The widget container element. + * @param {number} width - Initial width (px). + * @param {number} mainHeight - Height of the main (zoomed) chart (px). + * @param {Array} data - uPlot data array. + * @param {Object} opts - Options for the main chart. + * @param {Object} cfg - Ranger-specific configuration from R. + * @param {typeof uPlot} UPlot - The uPlot constructor. + * @returns {{ zoomed: uPlot, ranger: uPlot }} + */ +function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { + const rangerHeight = cfg.height || 80; + const gripColor = cfg.gripColor || "#4a90d9"; + const gripWidth = cfg.gripWidth || 8; + + // ── Inject CSS once per document ────────────────────────────────────────── + const CSS_ID = "u-zoom-ranger-styles"; + if (!document.getElementById(CSS_ID)) { + const style = document.createElement("style"); + style.id = CSS_ID; + style.textContent = [ + ".u-zoom-ranger-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; }", + ".u-zoom-ranger-wrap .u-zoom-ranger-main { flex: 1 1 auto; overflow: hidden; }", + ".u-zoom-ranger-wrap .u-zoom-ranger-nav { flex: 0 0 auto; overflow: hidden; }", + ".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select { pointer-events: all; cursor: grab; }", + ".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select:active { cursor: grabbing; }", + ".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-axis { pointer-events: none; }", + ".u-grip-l, .u-grip-r {", + " position: absolute; top: 0; width: " + gripWidth + "px; height: 100%;", + " background: " + gripColor + "; opacity: 0.8; cursor: ew-resize; border-radius: 2px;", + "}", + ".u-grip-l { left: " + (-Math.ceil(gripWidth / 2)) + "px; }", + ".u-grip-r { right: " + (-Math.ceil(gripWidth / 2)) + "px; }", + ].join("\n"); + document.head.appendChild(style); + } + + // ── DOM structure ────────────────────────────────────────────────────────── + const wrap = document.createElement("div"); + wrap.className = "u-zoom-ranger-wrap"; + + const mainEl = document.createElement("div"); + mainEl.className = "u-zoom-ranger-main"; + + const navEl = document.createElement("div"); + navEl.className = "u-zoom-ranger-nav"; + + wrap.appendChild(mainEl); + wrap.appendChild(navEl); + el.appendChild(wrap); + + // ── Shared state ─────────────────────────────────────────────────────────── + let x0, lft0, rgt0; + const lftWid = { left: null, width: null }; + const minMax = { min: null, max: null }; + + const BOUNDARY_LEFT = 0; + const BOUNDARY_RIGHT = 1; + const BOUNDARY_BOTH = 2; + + // Forward-declared so hooks can close over them safely. + let uZoomed, uRanger; + + // ── Helpers ──────────────────────────────────────────────────────────────── + function debounce(fn) { + let raf; + return (...args) => { + if (raf) return; + raf = requestAnimationFrame(() => { fn(...args); raf = null; }); + }; + } + + function placeDiv(parent, cls) { + const d = document.createElement("div"); + d.classList.add(cls); + parent.appendChild(d); + return d; + } + + function selectRanger(newLft, newWid) { + lftWid.left = newLft; + lftWid.width = newWid; + uRanger.setSelect(lftWid, false); + } + + function zoomMain(newLft, newWid) { + minMax.min = uRanger.posToVal(newLft, "x"); + minMax.max = uRanger.posToVal(newLft + newWid, "x"); + uZoomed.setScale("x", minMax); + } + + function update(newLft, newRgt, movedBoundary) { + const maxRgt = uRanger.bbox.width / uPlotPxRatio(); + + if (movedBoundary === BOUNDARY_BOTH) { + const initWidth = newRgt - newLft; + if (newRgt > maxRgt) { newRgt = maxRgt; newLft = newRgt - initWidth; } + else if (newLft < 0) { newLft = 0; newRgt = newLft + initWidth; } + } else { + if (newLft > newRgt) { + if (movedBoundary === BOUNDARY_LEFT) newLft = newRgt; + else if (movedBoundary === BOUNDARY_RIGHT) newRgt = newLft; + } + newLft = Math.max(0, newLft); + newRgt = Math.min(newRgt, maxRgt); + } + zoomMain(newLft, newRgt - newLft); + } + + function uPlotPxRatio() { + // uPlot.pxRatio is a static property on the constructor + return UPlot.pxRatio || window.devicePixelRatio || 1; + } + + function bindMove(e, onMove) { + x0 = e.clientX; + lft0 = uRanger.select.left; + rgt0 = lft0 + uRanger.select.width; + + const _onMove = debounce(onMove); + document.addEventListener("mousemove", _onMove); + + function _onUp() { + document.removeEventListener("mouseup", _onUp); + document.removeEventListener("mousemove", _onMove); + } + document.addEventListener("mouseup", _onUp); + e.stopPropagation(); + } + + // ── Ranger series options ───────────────────────────────────────────────── + const rangerSeries = opts.series + ? opts.series.map((s, i) => { + if (i === 0) return {}; + return { stroke: cfg.stroke || s.stroke || "#999" }; + }) + : [{}]; + + // ── Ranger (navigator) chart options ────────────────────────────────────── + const rangerOpts = { + width: width, + height: rangerHeight, + cursor: { + x: false, + y: false, + points: { show: false }, + drag: { setScale: false, setSelect: true, x: true, y: false }, + }, + legend: { show: false }, + scales: opts.scales ? JSON.parse(JSON.stringify(opts.scales)) : {}, + axes: [ + {}, + { show: false, grid: { show: false }, ticks: { show: false } }, + ], + series: rangerSeries, + hooks: { + ready: [ + (u) => { + // Full selection initially (shows all data) + const selLeft = 0; + const selWidth = u.bbox.width / uPlotPxRatio(); + const selHeight = u.bbox.height / uPlotPxRatio(); + u.setSelect({ left: selLeft, width: selWidth, height: selHeight }, false); + + const sel = u.root.querySelector(".u-select"); + + sel.addEventListener("mousedown", (e) => { + bindMove(e, (ev) => + update(lft0 + (ev.clientX - x0), rgt0 + (ev.clientX - x0), BOUNDARY_BOTH) + ); + }); + + placeDiv(sel, "u-grip-l").addEventListener("mousedown", (e) => { + bindMove(e, (ev) => + update(lft0 + (ev.clientX - x0), rgt0, BOUNDARY_LEFT) + ); + }); + + placeDiv(sel, "u-grip-r").addEventListener("mousedown", (e) => { + bindMove(e, (ev) => + update(lft0, rgt0 + (ev.clientX - x0), BOUNDARY_RIGHT) + ); + }); + }, + ], + setSelect: [ + (u) => { + // Ranger drag/select → zoom main chart + zoomMain(u.select.left, u.select.width); + }, + ], + }, + }; + + // ── Main (zoomed) chart options ──────────────────────────────────────────── + // Merge original hooks with our setScale sync hook. + const origHooks = opts.hooks || {}; + const origSetScale = Array.isArray(origHooks.setScale) + ? origHooks.setScale + : origHooks.setScale + ? [origHooks.setScale] + : []; + + const zoomedOpts = Object.assign({}, opts, { + width: width, + height: mainHeight, + select: { over: false }, + hooks: Object.assign({}, origHooks, { + setScale: [ + ...origSetScale, + (u) => { + // Main chart X scale changed → update ranger selection + if (!uRanger) return; + const left = Math.round(uRanger.valToPos(u.scales.x.min, "x")); + const right = Math.round(uRanger.valToPos(u.scales.x.max, "x")); + selectRanger(left, right - left); + }, + ], + }), + }); + + // ── Create charts ────────────────────────────────────────────────────────── + // Ranger first so that uRanger is defined before uZoomed's setScale fires. + uRanger = new UPlot(rangerOpts, data, navEl); + uZoomed = new UPlot(zoomedOpts, data, mainEl); + + // ── Resize observer ──────────────────────────────────────────────────────── + const resizeObserver = new ResizeObserver((entries) => { + for (const entry of entries) { + const newWidth = entry.contentRect.width; + const newTotalHeight = entry.contentRect.height; + const newMainHeight = Math.max(50, newTotalHeight - rangerHeight - 4); + uRanger.setSize({ width: newWidth, height: rangerHeight }); + uZoomed.setSize({ width: newWidth, height: newMainHeight }); + } + }); + resizeObserver.observe(el); + + return { zoomed: uZoomed, ranger: uRanger, wrap: wrap }; +} + +export { createZoomRanger }; diff --git a/srcjs/widgets/uPlot.js b/srcjs/widgets/uPlot.js index 7f98240..b5c3a25 100644 --- a/srcjs/widgets/uPlot.js +++ b/srcjs/widgets/uPlot.js @@ -10,6 +10,7 @@ import { columnHighlightPlugin } from "../modules/columnHighlightPlugin"; import { drawPoints } from "../modules/drawPoints"; import { drawHLine, drawVLine, drawVRect, drawHRect } from "../modules/draw"; import { candlestickPlugin } from "../modules/candlestickPlugin"; +import { createZoomRanger } from "../modules/zoomRangerPlugin"; import { ungzip } from "pako"; import * as dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; @@ -43,13 +44,21 @@ HTMLWidgets.widget({ type: "output", factory: function (el, width, height) { - var plot, options, data; + var plot, rangerPlot, rangerWrap, options, data; return { renderValue: function (x) { if (typeof plot !== "undefined") { plot.destroy(); } + if (typeof rangerPlot !== "undefined") { + rangerPlot.destroy(); + rangerPlot = undefined; + } + if (typeof rangerWrap !== "undefined") { + el.removeChild(rangerWrap); + rangerWrap = undefined; + } options = x.config.options; options.width = width; options.height = height; @@ -64,7 +73,20 @@ HTMLWidgets.widget({ data = JSON.parse(decodedData); } //console.log(data); - if (x.stacked) { + if (x.config.zoomRanger) { + // Zoom ranger mode: render a navigator below the main chart. + const rangerCfg = x.config.zoomRanger; + const mainHeight = Math.max( + 50, + height - (rangerCfg.height || 80) - 4 + ); + const charts = createZoomRanger( + el, width, mainHeight, data, options, rangerCfg, uPlot + ); + plot = charts.zoomed; + rangerPlot = charts.ranger; + rangerWrap = charts.wrap; + } else if (x.stacked) { if (!options.hooks) options.hooks = {}; options.hooks.init = [ (u) => { @@ -156,5 +178,6 @@ export { legendAsTooltipPlugin, columnHighlightPlugin, candlestickPlugin, + createZoomRanger, dayjs, }; From 7177ef6a8616bf612993accb8032851075bbab83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 May 2026 15:06:15 +0000 Subject: [PATCH 3/3] refactor: improve grip styling to use inline styles for per-widget customization Agent-Logs-Url: https://github.com/dreamRs/uPlot-r/sessions/8221e34a-37a8-4b6a-b979-d80fd9a01ce0 Co-authored-by: pvictor <4415580+pvictor@users.noreply.github.com> --- inst/htmlwidgets/uPlot.js | 2 +- srcjs/modules/zoomRangerPlugin.js | 91 +++++++++++++++++-------------- srcjs/widgets/uPlot.js | 10 ++-- 3 files changed, 57 insertions(+), 46 deletions(-) diff --git a/inst/htmlwidgets/uPlot.js b/inst/htmlwidgets/uPlot.js index e3a8f95..6326e42 100644 --- a/inst/htmlwidgets/uPlot.js +++ b/inst/htmlwidgets/uPlot.js @@ -1 +1 @@ -(()=>{var t={350:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(81),s=n.n(i),r=n(645),l=n.n(r)()(s());l.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=l},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var l={};if(i)for(var a=0;a0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},484:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",i="second",s="minute",r="hour",l="day",a="week",o="month",u="quarter",c="year",d="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},_=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},g={s:_,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+_(i,2,"0")+":"+_(s,2,"0")},m:function t(e,n){if(e.date()1)return t(l[0])}else{var a=e.name;b[a]=e,s=a}return!i&&s&&(w=s),s||!i&&w},k=function(t,e){if(x(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},z=g;z.l=y,z.i=x,z.w=function(t,e){return k(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function m(t){this.$L=y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[v]=!0}var _=m.prototype;return _.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(z.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(f);if(i){var s=i[2]-1||0,r=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)):new Date(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)}}return new Date(e)}(t),this.init()},_.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},_.$utils=function(){return z},_.isValid=function(){return!(this.$d.toString()===h)},_.isSame=function(t,e){var n=k(t);return this.startOf(e)<=n&&n<=this.endOf(e)},_.isAfter=function(t,e){return k(t)=0&&(r[d]=parseInt(c,10))}var h=r[3],f=24===h?0:h,p=r[0]+"-"+r[1]+"-"+r[2]+" "+f+":"+r[4]+":"+r[5]+":000",m=+e;return(s.utc(p).valueOf()-(m-=m%1e3))/6e4},o=i.prototype;o.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),l=this.toDate(),a=l.toLocaleString("en-US",{timeZone:t}),o=Math.round((l-new Date(a))/1e3/60),u=15*-Math.round(l.getTimezoneOffset()/15)-o;if(Number(u)){if(n=s(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),e){var c=n.utcOffset();n=n.add(i-c,"minute")}}else n=this.utcOffset(0,e);return n.$x.$timezone=t,n},o.offsetName=function(t){var e=this.$x.$timezone||s.tz.guess(),n=l(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var u=o.startOf;o.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return u.call(this,t,e);var n=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(n,t,e).tz(this.$x.$timezone,!0)},s.tz=function(t,e,n){var i=n&&e,l=n||e||r,o=a(+s(),l);if("string"!=typeof t)return s(t).tz(l);var u=function(t,e,n){var i=t-60*e*1e3,s=a(i,n);if(e===s)return[i,e];var r=a(i-=60*(s-e)*1e3,n);return s===r?[i,s]:[t-60*Math.min(s,r)*1e3,Math.max(s,r)]}(s.utc(t,i).valueOf(),o,l),c=u[0],d=u[1],h=s(c).utcOffset(d);return h.$x.$timezone=l,h},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(t){r=t}}}()},178:function(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,s,r){var l=s.prototype;r.utc=function(t){return new s({date:t,utc:!0,args:arguments})},l.utc=function(e){var n=r(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},l.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var a=l.parse;l.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var o=l.init;l.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var u=l.utcOffset;l.utcOffset=function(i,s){var r=this.$utils().u;if(r(i))return this.$u?0:r(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var s=(""+i[0]).match(n)||["-",0,0],r=s[0],l=60*+s[1]+ +s[2];return 0===l?0:"+"===r?l:-l}(i),null===i))return this;var l=Math.abs(i)<=16?60*i:i,a=this;if(s)return a.$offset=l,a.$u=0===i,a;if(0!==i){var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(l+o,t)).$offset=l,a.$x.$localOffset=o}else a=this.utc();return a};var c=l.format;l.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},l.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var d=l.toDate;l.toDate=function(t){return"s"===t&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var h=l.diff;l.diff=function(t,e,n){if(t&&this.$u===t.$u)return h.call(this,t,e,n);var i=this.local(),s=r(t).local();return h.call(i,s,e,n)}}}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i{"use strict";var e={};t.exports=function(t,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";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)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";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(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.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 i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";n.r(i),n.d(i,{candlestickPlugin:()=>zi,columnHighlightPlugin:()=>wi,createZoomRanger:()=>Si,dayjs:()=>jl,drawHLine:()=>vi,drawHRect:()=>ki,drawPoints:()=>bi,drawVLine:()=>xi,drawVRect:()=>yi,legendAsTooltipPlugin:()=>_i,tooltipPlugin:()=>mi,uPlot:()=>Jn,wheelZoomPlugin:()=>gi}),window.HTMLWidgets;const t="u-off",e="u-label",s="width",r="height",l="top",a="bottom",o="left",u="right",c="#000",d="#0000",h="mousemove",f="mousedown",p="mouseup",m="mouseenter",_="mouseleave",g="dblclick",w="change",b="dppxchange",v="--",x="undefined"!=typeof window,y=x?document:null,k=x?window:null,z=x?navigator:null;let S,M;function E(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function T(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function D(t,e,n){t.style[e]=n+"px"}function A(t,e,n,i){let s=y.createElement(t);return null!=e&&E(s,e),null!=n&&n.insertBefore(s,i),s}function $(t,e){return A("div",t,e)}const O=new WeakMap;function R(e,n,i,s,r){let l="translate("+n+"px,"+i+"px)";l!=O.get(e)&&(e.style.transform=l,O.set(e,l),n<0||i<0||n>s||i>r?E(e,t):T(e,t))}const C=new WeakMap;function P(t,e,n){let i=e+n;i!=C.get(t)&&(C.set(t,i),t.style.background=e,t.style.borderColor=n)}const L=new WeakMap;function U(t,e,n,i){let s=e+""+n;s!=L.get(t)&&(L.set(t,s),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=i?-e/2+"px":0,t.style.marginTop=i?-n/2+"px":0)}const Z={passive:!0},N={...Z,capture:!0};function H(t,e,n,i){e.addEventListener(t,n,i?N:Z)}function I(t,e,n,i){e.removeEventListener(t,n,Z)}function F(t,e,n,i){let s;n=n||0;let r=(i=i||e.length-1)<=2147483647;for(;i-n>1;)s=r?n+i>>1:it((n+i)/2),e[s]=e&&s<=n;s+=i)if(null!=t[s])return s;return-1}function B(t,e,n,i){let s=ut(t),r=ut(e);t==e&&(-1==s?(t*=n,e/=n):(t/=n,e*=n));let l=10==n?ct:dt,a=1==r?rt:it,o=(1==s?it:rt)(l(nt(t))),u=a(l(nt(e))),c=ot(n,o),d=ot(n,u);return 10==n&&(o<0&&(c=Et(c,-o)),u<0&&(d=Et(d,-u))),i||2==n?(t=c*s,e=d*r):(t=Mt(t,c),e=St(e,d)),[t,e]}function W(t,e,n,i){let s=B(t,e,n,i);return 0==t&&(s[0]=0),0==e&&(s[1]=0),s}x&&function t(){let e=devicePixelRatio;S!=e&&(S=e,M&&I(w,M,t),M=matchMedia(`(min-resolution: ${S-.001}dppx) and (max-resolution: ${S+.001}dppx)`),H(w,M,t),k.dispatchEvent(new CustomEvent(b)))}();const j={mode:3,pad:.1},V={pad:0,soft:null,mode:0},G={min:V,max:V};function K(t,e,n,i){return Ut(n)?q(t,e,n):(V.pad=n,V.soft=i?0:null,V.mode=i?3:0,q(t,e,G))}function X(t,e){return null==t?e:t}function q(t,e,n){let i=n.min,s=n.max,r=X(i.pad,0),l=X(s.pad,0),a=X(i.hard,-ft),o=X(s.hard,ft),u=X(i.soft,ft),c=X(s.soft,-ft),d=X(i.mode,0),h=X(s.mode,0),f=e-t,p=ct(f),m=at(nt(t),nt(e)),_=ct(m),g=nt(_-p);(f<1e-24||g>10)&&(f=0,0!=t&&0!=e||(f=1e-24,2==d&&u!=ft&&(r=0),2==h&&c!=-ft&&(l=0)));let w=f||m||1e3,b=ct(w),v=ot(10,it(b)),x=Et(Mt(t-w*(0==f?0==t?.1:1:r),v/10),24),y=t>=u&&(1==d||3==d&&x<=u||2==d&&x>=u)?u:ft,k=at(a,x=y?y:lt(y,x)),z=Et(St(e+w*(0==f?0==e?.1:1:l),v/10),24),S=e<=c&&(1==h||3==h&&z>=c||2==h&&z<=c)?c:-ft,M=lt(o,z>S&&e<=S?S:at(S,z));return k==M&&0==k&&(M=100),[k,M]}const J=new Intl.NumberFormat(x?z.language:"en-US"),Q=t=>J.format(t),tt=Math,et=tt.PI,nt=tt.abs,it=tt.floor,st=tt.round,rt=tt.ceil,lt=tt.min,at=tt.max,ot=tt.pow,ut=tt.sign,ct=tt.log10,dt=tt.log2,ht=(t,e=1)=>tt.asinh(t/e),ft=1/0;function pt(t){return 1+(0|ct((t^t>>31)-(t>>31)))}function mt(t,e,n){return lt(at(t,e),n)}function _t(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,yt=/\.\d*?(?=9{6,}|0{6,})/gm,kt=t=>{if(Pt(t)||Tt.has(t))return t;const e=`${t}`,n=e.match(yt);if(null==n)return t;let i=n[0].length-1;if(-1!=e.indexOf("e-")){let[t,n]=e.split("e");return+`${kt(t)}e${n}`}return Et(t,i)};function zt(t,e){return kt(Et(kt(t/e))*e)}function St(t,e){return kt(rt(kt(t/e))*e)}function Mt(t,e){return kt(it(kt(t/e))*e)}function Et(t,e=0){if(Pt(t))return t;let n=10**e,i=t*n*(1+Number.EPSILON);return st(i)/n}const Tt=new Map;function Dt(t){return((""+t).split(".")[1]||"").length}function At(t,e,n,i){let s=[],r=i.map(Dt);for(let l=e;l=0?0:e)+(l>=r[a]?0:r[a]),c=10==t?o:Et(o,u);s.push(c),Tt.set(c,u)}}return s}const $t={},Ot=[],Rt=[null,null],Ct=Array.isArray,Pt=Number.isInteger;function Lt(t){return"string"==typeof t}function Ut(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Zt(t){return null!=t&&"object"==typeof t}const Nt=Object.getPrototypeOf(Uint8Array),Ht="__proto__";function It(t,e=Ut){let n;if(Ct(t)){let i=t.find((t=>null!=t));if(Ct(i)||e(i)){n=Array(t.length);for(let i=0;ir){for(i=l-1;i>=0&&null==t[i];)t[i--]=null;for(i=l+1;iPromise.resolve().then(t):queueMicrotask,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],jt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Vt(t){return t.slice(0,3)}const Gt=jt.map(Vt),Kt=Wt.map(Vt),Xt={MMMM:Wt,MMM:Kt,WWWW:jt,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 Qt(t,e){e=e||Xt;let n,i=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(t);)i.push("{"==n[0][0]?Jt[n[1]]:n[0]);return t=>{let n="";for(let s=0;st%1==0,ne=[1,2,2.5,5],ie=At(10,-32,0,ne),se=At(10,0,32,ne),re=se.filter(ee),le=ie.concat(se),ae="{YYYY}",oe="\n"+ae,ue="{M}/{D}",ce="\n"+ue,de=ce+"/{YY}",he="{aa}",fe="{h}:{mm}"+he,pe="\n"+fe,me=":{ss}",_e=null;function ge(t){let e=1e3*t,n=60*e,i=60*n,s=24*i,r=30*s,l=365*s;return[(1==t?At(10,0,3,ne).filter(ee):At(10,-3,0,ne)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,i,2*i,3*i,4*i,6*i,8*i,12*i,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,l,2*l,5*l,10*l,25*l,50*l,100*l]),[[l,ae,_e,_e,_e,_e,_e,_e,1],[28*s,"{MMM}",oe,_e,_e,_e,_e,_e,1],[s,ue,oe,_e,_e,_e,_e,_e,1],[i,"{h}"+he,de,_e,ce,_e,_e,_e,1],[n,fe,de,_e,ce,_e,_e,_e,1],[e,me,de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1],[t,me+".{fff}",de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1]],function(e){return(a,o,u,c,d,h)=>{let f=[],p=d>=l,m=d>=r&&d=s?s:d,l=b+(it(u)-it(g))+St(g-b,r);f.push(l);let p=e(l),m=p.getHours()+p.getMinutes()/n+p.getSeconds()/i,_=d/i,w=h/a.axes[o]._space;for(;l=Et(l+d,1==t?0:3),!(l>c);)if(_>1){let t=it(Et(m+_,6))%24,n=e(l).getHours()-t;n>1&&(n=-1),l-=n*i,m=(m+_)%24,Et((l-f[f.length-1])/d,3)*w>=.7&&f.push(l)}else f.push(l)}return f}}]}const[we,be,ve]=ge(1),[xe,ye,ke]=ge(.001);function ze(t,e){return t.map((t=>t.map(((n,i)=>0==i||8==i||null==n?n:e(1==i||0==t[8]?n:t[1]+n)))))}function Se(t,e){return(n,i,s,r,l)=>{let a,o,u,c,d,h,f=e.find((t=>l>=t[0]))||e[e.length-1];return i.map((e=>{let n=t(e),i=n.getFullYear(),s=n.getMonth(),r=n.getDate(),l=n.getHours(),p=n.getMinutes(),m=n.getSeconds(),_=i!=a&&f[2]||s!=o&&f[3]||r!=u&&f[4]||l!=c&&f[5]||p!=d&&f[6]||m!=h&&f[7]||f[1];return a=i,o=s,u=r,c=l,d=p,h=m,_(n)}))}}function Me(t,e,n){return new Date(t,e,n)}function Ee(t,e){return e(t)}function Te(t,e){return(n,i,s,r)=>null==r?v:e(t(i))}At(2,-53,53,[1]);const De={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:[]},Ae=[0,0];function $e(t,e,n,i=!0){return t=>{0==t.button&&(!i||t.target==e)&&n(t)}}function Oe(t,e,n,i=!0){return t=>{(!i||t.target==e)&&n(t)}}const Re={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Ae[0]=e,Ae[1]=n,Ae},points:{one:!1,show:function(t,e){let n=t.cursor.points,i=$(),l=n.size(t,e);D(i,s,l),D(i,r,l);let a=l/-2;D(i,"marginLeft",a),D(i,"marginTop",a);let o=n.width(t,e,l);return o&&D(i,"borderWidth",o),i},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:$e,mouseup:$e,click:$e,dblclick:$e,mousemove:Oe,mouseleave:Oe,mouseenter:Oe},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,i,s)=>i-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ce={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Pe=Ft({},Ce,{filter:wt}),Le=Ft({},Pe,{size:10}),Ue=Ft({},Ce,{show:!1}),Ze='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"',Ne="bold "+Ze,He={show:!0,scale:"x",stroke:c,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Ne,side:2,grid:Pe,ticks:Le,border:Ue,font:Ze,lineGap:1.5,rotate:0},Ie={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function Fe(t,e,n,i,s){return e.map((t=>null==t?"":Q(t)))}function Ye(t,e,n,i,s,r,l){let a=[],o=Tt.get(s)||0;for(let t=n=l?n:Et(St(n,s),o);t<=i;t=Et(t+s,o))a.push(Object.is(t,-0)?0:t);return a}function Be(t,e,n,i,s,r,l){const a=[],o=t.scales[t.axes[e].scale].log,u=it((10==o?ct:dt)(n));s=ot(o,u),10==o&&(s=le[F(s,le)]);let c=n,d=s*o;10==o&&(d=le[F(d,le)]);do{a.push(c),c+=s,10!=o||Tt.has(c)||(c=Et(c,Tt.get(s))),c>=d&&(d=(s=c)*o,10==o&&(d=le[F(d,le)]))}while(c<=i);return a}function We(t,e,n,i,s,r,l){let a=t.scales[t.axes[e].scale].asinh,o=i>a?Be(t,e,at(a,n),i,s):[a],u=i>=0&&n<=0?[0]:[];return(n<-a?Be(t,e,at(a,-i),-n,s):[a]).reverse().map((t=>-t)).concat(u,o)}const je=/./,Ve=/[12357]/,Ge=/[125]/,Ke=/1/,Xe=(t,e,n,i)=>t.map(((t,s)=>4==e&&0==t||s%i==0&&n.test(t.toExponential()[t<0?1:0])?t:null));function qe(t,e,n,i,s){let r=t.axes[n],l=r.scale,a=t.scales[l],o=t.valToPos,u=r._space,c=o(10,l),d=o(9,l)-c>=u?je:o(7,l)-c>=u?Ve:o(5,l)-c>=u?Ge:Ke;if(d==Ke){let t=nt(o(1,l)-c);if(ts,sn={show:!0,auto:!0,sorted:0,gaps:nn,alpha:1,facets:[Ft({},en,{scale:"x"}),Ft({},en,{scale:"y"})]},rn={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:nn,alpha:1,points:{show:function(t,e){let{scale:n,idxs:i}=t.series[0],s=t._data[0],r=t.valToPos(s[i[0]],n,!0),l=t.valToPos(s[i[1]],n,!0),a=nt(l-r)/(t.series[e].points.space*S);return i[1]-i[0]<=a},filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function ln(t,e,n,i,s){return n/10}const an={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},on=Ft({},an,{time:!1,ori:1}),un={};function cn(t,e){let n=un[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,i,s,r,l,a){for(let o=0;o{let m=t.pxRound;const _=a.dir*(0==a.ori?1:-1),g=0==a.ori?xn:yn;let w,b;1==_?(w=n,b=i):(w=i,b=n);let v=m(u(e[w],a,f,d)),x=m(c(l[w],o,p,h)),y=m(u(e[b],a,f,d)),k=m(c(1==r?o.max:o.min,o,p,h)),z=new Path2D(s);return g(z,y,k),g(z,v,k),g(z,v,x),z}))}function mn(t,e,n,i,s,r){let l=null;if(t.length>0){l=new Path2D;const a=0==e?kn:zn;let o=n;for(let e=0;en[0]){let t=n[0]-o;t>0&&a(l,o,i,t,i+r),o=n[1]}}let u=n+s-o,c=10;u>0&&a(l,o,i-c/2,u,i+r+c)}return l}function _n(t,e,n,i,s,r,l){let a=[],o=t.length;for(let u=1==s?n:i;u>=n&&u<=i;u+=s)if(null===e[u]){let c=u,d=u;if(1==s)for(;++u<=i&&null===e[u];)d=u;else for(;--u>=n&&null===e[u];)d=u;let h=r(t[c]),f=d==c?h:r(t[d]),p=c-s;h=l<=0&&p>=0&&p=0&&m>=0&&m=h&&a.push([h,f])}return a}function gn(t){return 0==t?gt:1==t?st:e=>zt(e,t)}function wn(t){let e=0==t?bn:vn,n=0==t?(t,e,n,i,s,r)=>{t.arcTo(e,n,i,s,r)}:(t,e,n,i,s,r)=>{t.arcTo(n,e,s,i,r)},i=0==t?(t,e,n,i,s)=>{t.rect(e,n,i,s)}:(t,e,n,i,s)=>{t.rect(n,e,s,i)};return(t,s,r,l,a,o=0,u=0)=>{0==o&&0==u?i(t,s,r,l,a):(o=lt(o,l/2,a/2),u=lt(u,l/2,a/2),e(t,s+o,r),n(t,s+l,r,s+l,r+a,o),n(t,s+l,r+a,s,r+a,u),n(t,s,r+a,s,r,u),n(t,s,r,s+l,r,o),t.closePath())}}const bn=(t,e,n)=>{t.moveTo(e,n)},vn=(t,e,n)=>{t.moveTo(n,e)},xn=(t,e,n)=>{t.lineTo(e,n)},yn=(t,e,n)=>{t.lineTo(n,e)},kn=wn(0),zn=wn(1),Sn=(t,e,n,i,s,r)=>{t.arc(e,n,i,s,r)},Mn=(t,e,n,i,s,r)=>{t.arc(n,e,i,s,r)},En=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(e,n,i,s,r,l)},Tn=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(n,e,s,i,l,r)};function Dn(t){return(t,e,n,i,s)=>dn(t,e,((e,r,l,a,o,u,c,d,h,f,p)=>{let m,_,{pxRound:g,points:w}=e;0==a.ori?(m=bn,_=Sn):(m=vn,_=Mn);const b=Et(w.width*S,3);let v=(w.size-w.width)/2*S,x=Et(2*v,3),y=new Path2D,k=new Path2D,{left:z,top:M,width:E,height:T}=t.bbox;kn(k,z-x,M-x,E+2*x,T+2*x);const D=t=>{if(null!=l[t]){let e=g(u(r[t],a,f,d)),n=g(c(l[t],o,p,h));m(y,e+v,n),_(y,e,n,v,0,2*et)}};if(s)s.forEach(D);else for(let t=n;t<=i;t++)D(t);return{stroke:b>0?y:null,fill:y,clip:k,flags:3}}))}function An(t){return(e,n,i,s,r,l)=>{i!=s&&(r!=i&&l!=i&&t(e,n,i),r!=s&&l!=s&&t(e,n,s),t(e,n,l))}}const $n=An(xn),On=An(yn);function Rn(t){const e=X(t?.alignGaps,0);return(t,n,i,s)=>dn(t,n,((r,l,a,o,u,c,d,h,f,p,m)=>{let _,g,w=r.pxRound,b=t=>w(c(t,o,p,h)),v=t=>w(d(t,u,m,f));0==o.ori?(_=xn,g=$n):(_=yn,g=On);const x=o.dir*(0==o.ori?1:-1),y={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=y.stroke;let z,S,M,E=ft,T=-ft,D=b(l[1==x?i:s]),A=Y(a,i,s,1*x),$=Y(a,i,s,-1*x),O=b(l[A]),R=b(l[$]),C=!1;for(let t=1==x?i:s;t>=i&&t<=s;t+=x){let e=b(l[t]),n=a[t];e==D?null!=n?(S=v(n),E==ft&&(_(k,e,S),z=S),E=lt(S,E),T=at(S,T)):null===n&&(C=!0):(E!=ft&&(g(k,D,E,T,z,S),M=D),null!=n?(S=v(n),_(k,e,S),E=T=z=S):(E=ft,T=-ft,null===n&&(C=!0)),D=e)}E!=ft&&E!=T&&M!=D&&g(k,D,E,T,z,S);let[P,L]=hn(t,n);if(null!=r.fill||0!=P){let e=y.fill=new Path2D(k),i=v(r.fillTo(t,n,r.min,r.max,P));_(e,R,i),_(e,O,i)}if(!r.spanGaps){let u=[];C&&u.push(..._n(l,a,i,s,x,b,e)),y.gaps=u=r.gaps(t,n,i,s,u),y.clip=mn(u,o.ori,h,f,p,m)}return 0!=L&&(y.band=2==L?[pn(t,n,i,s,k,-1),pn(t,n,i,s,k,1)]:pn(t,n,i,s,k,L)),y}))}function Cn(t,e,n,i,s,r,l=ft){if(t.length>1){let a=null;for(let o=0,u=1/0;o0!=i[t]>0?n[t]=0:(n[t]=3*(o[t-1]+o[t])/((2*o[t]+o[t-1])/i[t-1]+(o[t]+2*o[t-1])/i[t]),isFinite(n[t])||(n[t]=0));n[l-1]=i[l-2];for(let i=0;i{Jn.pxRatio=S})));const Zn=Rn(),Nn=Dn();function Hn(t,e,n,i){return(i?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map(((t,i)=>In(t,i,e,n)))}function In(t,e,n,i){return Ft({},0==e?n:i,t)}function Fn(t,e,n){return null==e?Rt:[e,n]}const Yn=Fn;function Bn(t,e,n){return null==e?Rt:K(e,n,.1,!0)}function Wn(t,e,n,i){return null==e?Rt:B(e,n,t.scales[i].log,!1)}const jn=Wn;function Vn(t,e,n,i){return null==e?Rt:W(e,n,t.scales[i].log,!1)}const Gn=Vn;function Kn(t,e,n,i,s){let r=at(pt(t),pt(e)),l=e-t,a=F(s/i*l,n);do{let t=n[a],e=i*t/l;if(e>=s&&r+(t<5?Tt.get(t):0)<=17)return[t,e]}while(++a(e=st((n=+i)*S))+"px")),e,n]}function qn(t){t.show&&[t.font,t.labelFont].forEach((t=>{let e=Et(t[2]*S,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e}))}function Jn(n,i,c){const w={mode:X(n.mode,1)},x=w.mode;function z(t,e){return((3==e.distr?ct(t>0?t:e.clamp(w,t,e.min,e.max,e.key)):4==e.distr?ht(t,e.asinh):100==e.distr?e.fwd(t):t)-e._min)/(e._max-e._min)}function M(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?1-s:s)}function O(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?s:1-s)}function C(t,e,n,i){return 0==e.ori?M(t,e,n,i):O(t,e,n,i)}w.valToPosH=M,w.valToPosV=O;let L=!1;w.status=0;const Z=w.root=$("uplot");null!=n.id&&(Z.id=n.id),E(Z,n.class),n.title&&($("u-title",Z).textContent=n.title);const N=A("canvas"),Y=w.ctx=N.getContext("2d"),V=$("u-wrap",Z);H("click",V,(t=>{t.target===q&&(Pi!=$i||Li!=Oi)&&Wi.click(w,t)}),!0);const G=w.under=$("u-under",V);V.appendChild(N);const q=w.over=$("u-over",V),J=+X((n=It(n)).pxAlign,1),Q=gn(J);(n.plugins||[]).forEach((t=>{t.opts&&(n=t.opts(w,n)||n)}));const it=n.ms||.001,ut=w.series=1==x?Hn(n.series||[],Ie,rn,!1):(dt=n.series||[null],pt=sn,dt.map(((t,e)=>0==e?{}:Ft({},pt,t))));var dt,pt;const gt=w.axes=Hn(n.axes||[],He,tn,!0),yt=w.scales={},kt=w.bands=n.bands||[];kt.forEach((t=>{t.fill=_t(t.fill||null),t.dir=X(t.dir,-1)}));const St=2==x?ut[1].facets[0].scale:ut[0].scale,Mt={axes:function(){for(let t=0;toi[t])):b,x=2==p.distr?oi[b[1]]-oi[b[0]]:h,y=e.ticks,k=e.border,z=y.show?st(y.size*S):0,M=e._rotate*-et/180,E=Q(e._pos*S),T=E+(z+g)*d;i=0==r?T:0,n=1==r?T:0,fi(e.font[0],c,1==e.align?o:2==e.align?u:M>0?o:M<0?u:0==r?"center":3==s?u:o,M||1==r?"middle":2==s?l:a);let D=e.font[1]*e.lineGap,A=b.map((t=>Q(C(t,p,m,_)))),$=e._values;for(let t=0;t<$.length;t++){let e=$[t];if(null!=e){0==r?n=A[t]:i=A[t],e=""+e;let s=-1==e.indexOf("\n")?[e]:e.split(/\n/gm);for(let t=0;t0&&(ut.forEach(((t,e)=>{if(e>0&&t.show&&(_i(e,!1),_i(e,!0),null==t._paths)){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha);let n=2==x?[0,i[e][0].length-1]:function(t){let e=mt(Cn-1,0,Rn-1),n=mt(Pn+1,0,Rn-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n{if(e>0&&t.show){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha),null!=t._paths&&gi(e,!1);{let n=null!=t._paths?t._paths.gaps:null,i=t.points.show(w,e,Cn,Pn,n),s=t.points.filter(w,e,i,n);(i||s)&&(t.points._paths=t.points.paths(w,e,Cn,Pn,s),gi(e,!0))}1!=ai&&(Y.globalAlpha=ai=1),Es("drawSeries",e)}})))}},At=(n.drawOrder||["axes","series"]).map((t=>Mt[t]));function Pt(t){let e=yt[t];if(null==e){let i=(n.scales||$t)[t]||$t;if(null!=i.from)Pt(i.from),yt[t]=Ft({},yt[i.from],i,{key:t});else{e=yt[t]=Ft({},t==St?an:on,i),e.key=t;let n=e.time,s=e.range,r=Ct(s);if((t!=St||2==x&&!n)&&(!r||null!=s[0]&&null!=s[1]||(s={min:null==s[0]?j:{mode:1,hard:s[0],soft:s[0]},max:null==s[1]?j:{mode:1,hard:s[1],soft:s[1]}},r=!1),!r&&Ut(s))){let t=s;s=(e,n,i)=>null==n?Rt:K(n,i,t)}e.range=_t(s||(n?Yn:t==St?3==e.distr?jn:4==e.distr?Gn:Fn:3==e.distr?Wn:4==e.distr?Vn:Bn)),e.auto=_t(!r&&e.auto),e.clamp=_t(e.clamp||ln),e._min=e._max=null}}}Pt("x"),Pt("y"),1==x&&ut.forEach((t=>{Pt(t.scale)})),gt.forEach((t=>{Pt(t.scale)}));for(let t in n.scales)Pt(t);const Nt=yt[St],Ht=Nt.distr;let Yt,Wt;0==Nt.ori?(E(Z,"u-hz"),Yt=M,Wt=O):(E(Z,"u-vt"),Yt=O,Wt=M);const jt={};for(let t in yt){let e=yt[t];null==e.min&&null==e.max||(jt[t]={min:e.min,max:e.max},e.min=e.max=null)}const Vt=n.tzDate||(t=>new Date(st(t/it))),Gt=n.fmtDate||Qt,Kt=1==it?ve(Vt):ke(Vt),Xt=Se(Vt,ze(1==it?be:ye,Gt)),qt=Te(Vt,Ee("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Gt)),Jt=[],te=w.legend=Ft({},De,n.legend),ee=te.show,ne=te.markers;let ie,se,ae;te.idxs=Jt,ne.width=_t(ne.width),ne.dash=_t(ne.dash),ne.stroke=_t(ne.stroke),ne.fill=_t(ne.fill);let oe,ue=[],ce=[],de=!1,he={};if(te.live){const t=ut[1]?ut[1].values:null;de=null!=t,oe=de?t(w,1,0):{_:0};for(let t in oe)he[t]=v}if(ee)if(ie=A("table","u-legend",Z),ae=A("tbody",null,ie),te.mount(w,ie),de){se=A("thead",null,ie,ae);let t=A("tr",null,se);for(var fe in A("th",null,t),oe)A("th",e,t).textContent=fe}else E(ie,"u-inline"),te.live&&E(ie,"u-live");const pe={show:!0},me={show:!1},_e=new Map;function ge(t,e,n,i=!0){const s=_e.get(e)||{},r=wn.bind[t](w,e,n,i);r&&(H(t,e,s[t]=r),_e.set(e,s))}function Me(t,e,n){const i=_e.get(e)||{};for(let n in i)null!=t&&n!=t||(I(n,e,i[n]),delete i[n]);null==t&&_e.delete(e)}let Ae=0,$e=0,Oe=0,Ce=0,Pe=0,Le=0,Ue=Pe,Ze=Le,Ne=Oe,je=Ce,Ve=0,Ge=0,Ke=0,Xe=0;w.bbox={};let en=!1,nn=!1,un=!1,dn=!1,hn=!1,pn=!1;function mn(t,e,n){(n||t!=w.width||e!=w.height)&&_n(t,e),zi(!1),un=!0,nn=!0,Ii()}function _n(t,e){w.width=Ae=Oe=t,w.height=$e=Ce=e,Pe=Le=0,function(){let t=!1,e=!1,n=!1,i=!1;gt.forEach(((s,r)=>{if(s.show&&s._show){let{side:r,_size:l}=s,a=r%2,o=l+(null!=s.label?s.labelSize:0);o>0&&(a?(Oe-=o,3==r?(Pe+=o,i=!0):n=!0):(Ce-=o,0==r?(Le+=o,t=!0):e=!0))}})),Dn[0]=t,Dn[1]=n,Dn[2]=e,Dn[3]=i,Oe-=On[1]+On[3],Pe+=On[3],Ce-=On[2]+On[0],Le+=On[0]}(),function(){let t=Pe+Oe,e=Le+Ce,n=Pe,i=Le;function s(s,r){switch(s){case 1:return t+=r,t-r;case 2:return e+=r,e-r;case 3:return n-=r,n+r;case 0:return i-=r,i+r}}gt.forEach(((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=s(e,t._size),null!=t.label&&(t._lpos=s(e,t.labelSize))}}))}();let n=w.bbox;Ve=n.left=zt(Pe*S,.5),Ge=n.top=zt(Le*S,.5),Ke=n.width=zt(Oe*S,.5),Xe=n.height=zt(Ce*S,.5)}w.setSize=function({width:t,height:e}){mn(t,e)};const wn=w.cursor=Ft({},Re,{drag:{y:2==x}},n.cursor);if(null==wn.dataIdx){let t=wn.hover,e=t.skip=new Set(t.skip??[]);e.add(void 0);let n=t.prox=_t(t.prox),s=t.bias??=0;wn.dataIdx=(t,r,l,a)=>{if(0==r)return l;let o=l,u=n(t,r,l,a)??ft,c=u>=0&&u0;)e.has(p[t])||(n=t);if(0==s||1==s)for(t=l;null==i&&t++u&&(o=null);return o}}const bn=t=>{wn.event=t};wn.idxs=Jt,wn._lock=!1;let vn=wn.points;vn.show=_t(vn.show),vn.size=_t(vn.size),vn.stroke=_t(vn.stroke),vn.width=_t(vn.width),vn.fill=_t(vn.fill);const xn=w.focus=Ft({},n.focus||{alpha:.3},wn.focus),yn=xn.prox>=0,kn=yn&&vn.one;let zn=[],Sn=[],Mn=[];function En(t,e){let n=vn.show(w,e);if(n)return E(n,"u-cursor-pt"),E(n,t.class),R(n,-10,-10,Oe,Ce),q.insertBefore(n,zn[e]),n}function Tn(n,i){if(1==x||i>0){let t=1==x&&yt[n.scale].time,e=n.value;n.value=t?Lt(e)?Te(Vt,Ee(e,Gt)):e||qt:e||Qe,n.label=n.label||(t?"Time":"Value")}if(kn||i>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Zn||bt,n.fillTo=_t(n.fillTo||fn),n.pxAlign=+X(n.pxAlign,J),n.pxRound=gn(n.pxAlign),n.stroke=_t(n.stroke||null),n.fill=_t(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;let t=Et(1*(3+2*(at(1,n.width)||1)),3),e=n.points=Ft({},{size:t,width:at(1,.2*t),stroke:n.stroke,space:2*t,paths:Nn,_stroke:null,_fill:null},n.points);e.show=_t(e.show),e.filter=_t(e.filter),e.fill=_t(e.fill),e.stroke=_t(e.stroke),e.paths=_t(e.paths),e.pxAlign=n.pxAlign}if(ee){let s=function(n,i){if(0==i&&(de||!te.live||2==x))return Rt;let s=[],r=A("tr","u-series",ae,ae.childNodes[i]);E(r,n.class),n.show||E(r,t);let l=A("th",null,r);if(ne.show){let t=$("u-marker",l);if(i>0){let e=ne.width(w,i);e&&(t.style.border=e+"px "+ne.dash(w,i)+" "+ne.stroke(w,i)),t.style.background=ne.fill(w,i)}}let a=$(e,l);for(var o in a.textContent=n.label,i>0&&(ne.show||(a.style.color=n.width>0?ne.stroke(w,i):ne.fill(w,i)),ge("click",l,(t=>{if(wn._lock)return;bn(t);let e=ut.indexOf(n);if((t.ctrlKey||t.metaKey)!=te.isolate){let t=ut.some(((t,n)=>n>0&&n!=e&&t.show));ut.forEach(((n,i)=>{i>0&&Ji(i,t?i==e?pe:me:pe,!0,Ds.setSeries)}))}else Ji(e,{show:!n.show},!0,Ds.setSeries)}),!1),yn&&ge(m,l,(t=>{wn._lock||(bn(t),Ji(ut.indexOf(n),ns,!0,Ds.setSeries))}),!1)),oe){let t=A("td","u-value",r);t.textContent="--",s.push(t)}return[r,s]}(n,i);ue.splice(i,0,s[0]),ce.splice(i,0,s[1]),te.values.push(null)}if(wn.show){Jt.splice(i,0,null);let t=null;kn?0==i&&(t=En(n,i)):i>0&&(t=En(n,i)),zn.splice(i,0,t),Sn.splice(i,0,0),Mn.splice(i,0,0)}Es("addSeries",i)}w.addSeries=function(t,e){e=null==e?ut.length:e,t=1==x?In(t,e,Ie,rn):In(t,e,{},sn),ut.splice(e,0,t),Tn(ut[e],e)},w.delSeries=function(t){if(ut.splice(t,1),ee){te.values.splice(t,1),ce.splice(t,1);let e=ue.splice(t,1)[0];Me(null,e.firstChild),e.remove()}wn.show&&(Jt.splice(t,1),zn.splice(t,1)[0].remove(),Sn.splice(t,1),Mn.splice(t,1)),Es("delSeries",t)};const Dn=[!1,!1,!1,!1];function An(t,e,n,i){let[s,r,l,a]=n,o=e%2,u=0;return 0==o&&(a||r)&&(u=0==e&&!s||2==e&&!l?st(He.size/3):0),1==o&&(s||l)&&(u=1==e&&!r||3==e&&!a?st(tn.size/2):0),u}const $n=w.padding=(n.padding||[An,An,An,An]).map((t=>_t(X(t,An)))),On=w._padding=$n.map(((t,e)=>t(w,e,Dn,0)));let Rn,Cn=null,Pn=null;const Un=1==x?ut[0].idxs:null;let Jn,Qn,ti,ei,ni,ii,si,ri,li,ai,oi=null,ui=!1;function ci(t,e){if(i=null==t?[]:t,w.data=w._data=i,2==x){Rn=0;for(let t=1;t=0,pn=!0,Ii()}}function di(){let t,e;ui=!0,1==x&&(Rn>0?(Cn=Un[0]=0,Pn=Un[1]=Rn-1,t=i[0][Cn],e=i[0][Pn],2==Ht?(t=Cn,e=Pn):t==e&&(3==Ht?[t,e]=B(t,t,Nt.log,!1):4==Ht?[t,e]=W(t,t,Nt.log,!1):Nt.time?e=t+st(86400/it):[t,e]=K(t,e,.1,!0))):(Cn=Un[0]=t=null,Pn=Un[1]=e=null)),qi(St,t,e)}function hi(t,e,n,i,s,r){t??=d,n??=Ot,i??="butt",s??=d,r??="round",t!=Jn&&(Y.strokeStyle=Jn=t),s!=Qn&&(Y.fillStyle=Qn=s),e!=ti&&(Y.lineWidth=ti=e),r!=ni&&(Y.lineJoin=ni=r),i!=ii&&(Y.lineCap=ii=i),n!=ei&&Y.setLineDash(ei=n)}function fi(t,e,n,i){e!=Qn&&(Y.fillStyle=Qn=e),t!=si&&(Y.font=si=t),n!=ri&&(Y.textAlign=ri=n),i!=li&&(Y.textBaseline=li=i)}function pi(t,e,n,i,s=0){if(i.length>0&&t.auto(w,ui)&&(null==e||null==e.min)){let e=X(Cn,0),r=X(Pn,i.length-1),l=null==n.min?3==t.distr?function(t,e,n){let i=ft,s=-ft;for(let r=e;r<=n;r++){let e=t[r];null!=e&&e>0&&(es&&(s=e))}return[i,s]}(i,e,r):function(t,e,n,i){let s=ft,r=-ft;if(1==i)s=t[e],r=t[n];else if(-1==i)s=t[n],r=t[e];else for(let i=e;i<=n;i++){let e=t[i];null!=e&&(er&&(r=e))}return[s,r]}(i,e,r,s):[n.min,n.max];t.min=lt(t.min,n.min=l[0]),t.max=at(t.max,n.max=l[1])}}w.setData=ci;const mi={min:null,max:null};function _i(t,e){let n=e?ut[t].points:ut[t];n._stroke=n.stroke(w,t),n._fill=n.fill(w,t)}function gi(t,e){let n=e?ut[t].points:ut[t],{stroke:s,fill:r,clip:l,flags:a,_stroke:o=n._stroke,_fill:u=n._fill,_width:c=n.width}=n._paths;c=Et(c*S,3);let d=null,h=c%2/2;e&&null==u&&(u=c>0?"#fff":o);let f=1==n.pxAlign&&h>0;if(f&&Y.translate(h,h),!e){let t=Ve-c/2,e=Ge-c/2,n=Ke+c,i=Xe+c;d=new Path2D,d.rect(t,e,n,i)}e?wi(o,c,n.dash,n.cap,u,s,r,a,l):function(t,e,n,s,r,l,a,o,u,c,d){let h=!1;0!=u&&kt.forEach(((f,p)=>{if(f.series[0]==t){let t,m=ut[f.series[1]],_=i[f.series[1]],g=(m._paths||$t).band;Ct(g)&&(g=1==f.dir?g[0]:g[1]);let b=null;m.show&&g&&function(t,e,n){for(e=X(e,0),n=X(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(_,Cn,Pn)?(b=f.fill(w,p)||l,t=m._paths.clip):g=null,wi(e,n,s,r,b,a,o,u,c,d,t,g),h=!0}})),h||wi(e,n,s,r,l,a,o,u,c,d)}(t,o,c,n.dash,n.cap,u,s,r,a,d,l),f&&Y.translate(-h,-h)}function wi(t,e,n,i,s,r,l,a,o,u,c,d){hi(t,e,n,i,s),(o||u||d)&&(Y.save(),o&&Y.clip(o),u&&Y.clip(u)),d?3==(3&a)?(Y.clip(d),c&&Y.clip(c),vi(s,l),bi(t,r,e)):2&a?(vi(s,l),Y.clip(d),bi(t,r,e)):1&a&&(Y.save(),Y.clip(d),c&&Y.clip(c),vi(s,l),Y.restore(),bi(t,r,e)):(vi(s,l),bi(t,r,e)),(o||u||d)&&Y.restore()}function bi(t,e,n){n>0&&(e instanceof Map?e.forEach(((t,e)=>{Y.strokeStyle=Jn=e,Y.stroke(t)})):null!=e&&t&&Y.stroke(e))}function vi(t,e){e instanceof Map?e.forEach(((t,e)=>{Y.fillStyle=Qn=e,Y.fill(t)})):null!=e&&t&&Y.fill(e)}function xi(t,e,n,i,s,r,l,a,o,u){let c=l%2/2;1==J&&Y.translate(c,c),hi(a,l,o,u,a),Y.beginPath();let d,h,f,p,m=s+(0==i||3==i?-r:r);0==n?(h=s,p=m):(d=s,f=m);for(let i=0;i{if(!n.show)return;let s=yt[n.scale];if(null==s.min)return void(n._show&&(e=!1,n._show=!1,zi(!1)));n._show||(e=!1,n._show=!0,zi(!1));let r=n.side,l=r%2,{min:a,max:o}=s,[u,c]=function(t,e,n,i){let s,r=gt[t];if(i<=0)s=[0,0];else{let l=r._space=r.space(w,t,e,n,i);s=Kn(e,n,r._incrs=r.incrs(w,t,e,n,i,l),i,l)}return r._found=s}(i,a,o,0==l?Oe:Ce);if(0==c)return;let d=2==s.distr,h=n._splits=n.splits(w,i,a,o,u,c,d),f=2==s.distr?h.map((t=>oi[t])):h,p=2==s.distr?oi[h[1]]-oi[h[0]]:u,m=n._values=n.values(w,n.filter(w,f,i,c,p),i,c,p);n._rotate=2==r?n.rotate(w,m,i,c):0;let _=n._size;n._size=rt(n.size(w,m,i,t)),null!=_&&n._size!=_&&(e=!1)})),e}function ki(t){let e=!0;return $n.forEach(((n,i)=>{let s=n(w,i,Dn,t);s!=On[i]&&(e=!1),On[i]=s})),e}function zi(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 Si,Mi,Ei,Ti,Di,Ai,$i,Oi,Ri,Ci,Pi,Li,Ui=!1,Zi=!1,Ni=[];function Hi(){Zi=!1;for(let t=0;t0){ut.forEach(((e,n)=>{if(1==x){let s=e.scale,r=jt[s];if(null==r)return;let l=t[s];if(0==n){let t=l.range(w,l.min,l.max,s);l.min=t[0],l.max=t[1],Cn=F(l.min,i[0]),Pn=F(l.max,i[0]),Pn-Cn>1&&(i[0][Cn]l.max&&Pn--),e.min=oi[Cn],e.max=oi[Pn]}else e.show&&e.auto&&pi(l,r,e,i[n],e.sorted);e.idxs[0]=Cn,e.idxs[1]=Pn}else if(n>0&&e.show&&e.auto){let[s,r]=e.facets,l=s.scale,a=r.scale,[o,u]=i[n],c=t[l],d=t[a];null!=c&&pi(c,jt[l],s,o,s.sorted),null!=d&&pi(d,jt[a],r,u,r.sorted),e.min=r.min,e.max=r.max}}));for(let e in t){let n=t[e],i=jt[e];if(null==n.from&&(null==i||null==i.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 i=t[n.from];if(null==i.min)n.min=n.max=null;else{let t=n.range(w,i.min,i.max,e);n.min=t[0],n.max=t[1]}}}let e={},n=!1;for(let i in t){let s=t[i],r=yt[i];if(r.min!=s.min||r.max!=s.max){r.min=s.min,r.max=s.max;let t=r.distr;r._min=3==t?ct(r.min):4==t?ht(r.min,r.asinh):100==t?r.fwd(r.min):r.min,r._max=3==t?ct(r.max):4==t?ht(r.max,r.asinh):100==t?r.fwd(r.max):r.max,e[i]=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)un=!0,Es("setScale",t);wn.show&&wn.left>=0&&(dn=pn=!0)}for(let t in jt)jt[t]=null}(),en=!1),un&&(function(){let t=!1,e=0;for(;!t;){e++;let n=yi(e),i=ki(e);t=3==e||n&&i,t||(_n(w.width,w.height),nn=!0)}}(),un=!1),nn){if(D(G,o,Pe),D(G,l,Le),D(G,s,Oe),D(G,r,Ce),D(q,o,Pe),D(q,l,Le),D(q,s,Oe),D(q,r,Ce),D(V,s,Ae),D(V,r,$e),N.width=st(Ae*S),N.height=st($e*S),gt.forEach((({_el:e,_show:n,_size:i,_pos:s,side:r})=>{if(null!=e)if(n){let n=r%2==1;D(e,n?"left":"top",s-(3===r||0===r?i:0)),D(e,n?"width":"height",i),D(e,n?"top":"left",n?Le:Pe),D(e,n?"height":"width",n?Ce:Oe),T(e,t)}else E(e,t)})),Jn=Qn=ti=ni=ii=si=ri=li=ei=null,ai=1,hs(!0),Pe!=Ue||Le!=Ze||Oe!=Ne||Ce!=je){zi(!1);let t=Oe/Ne,e=Ce/je;if(wn.show&&!dn&&wn.left>=0){wn.left*=t,wn.top*=e,Ei&&R(Ei,st(wn.left),0,Oe,Ce),Ti&&R(Ti,0,st(wn.top),Oe,Ce);for(let n=0;n=0&&Gi.width>0){Gi.left*=t,Gi.width*=t,Gi.top*=e,Gi.height*=e;for(let t in ms)D(Ki,t,Gi[t])}Ue=Pe,Ze=Le,Ne=Oe,je=Ce}Es("setSize"),nn=!1}Ae>0&&$e>0&&(Y.clearRect(0,0,N.width,N.height),Es("drawClear"),At.forEach((t=>t())),Es("draw")),Gi.show&&hn&&(Xi(Gi),hn=!1),wn.show&&dn&&(cs(null,!0,!1),dn=!1),te.show&&te.live&&pn&&(os(),pn=!1),L||(L=!0,w.status=1,Es("ready")),ui=!1,Ui=!1}function Yi(t,e){let n=yt[t];if(null==n.from){if(0==Rn){let i=n.range(w,e.min,e.max,t);e.min=i[0],e.max=i[1]}if(e.min>e.max){let t=e.min;e.min=e.max,e.max=t}if(Rn>1&&null!=e.min&&null!=e.max&&e.max-e.min<1e-16)return;t==St&&2==n.distr&&Rn>0&&(e.min=F(e.min,i[0]),e.max=F(e.max,i[0]),e.min==e.max&&e.max++),jt[t]=e,en=!0,Ii()}}w.batch=function(t,e=!1){Ui=!0,Zi=e,t(w),Fi(),e&&Ni.length>0&&queueMicrotask(Hi)},w.redraw=(t,e)=>{un=e||!1,!1!==t?qi(St,Nt.min,Nt.max):Ii()},w.setScale=Yi;let Bi=!1;const Wi=wn.drag;let ji=Wi.x,Vi=Wi.y;wn.show&&(wn.x&&(Si=$("u-cursor-x",q)),wn.y&&(Mi=$("u-cursor-y",q)),0==Nt.ori?(Ei=Si,Ti=Mi):(Ei=Mi,Ti=Si),Pi=wn.left,Li=wn.top);const Gi=w.select=Ft({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Ki=Gi.show?$("u-select",Gi.over?q:G):null;function Xi(t,e){if(Gi.show){for(let e in t)Gi[e]=t[e],e in ms&&D(Ki,e,t[e]);!1!==e&&Es("setSelect")}}function qi(t,e,n){Yi(t,{min:e,max:n})}function Ji(e,n,i,s){null!=n.focus&&function(t){if(t!=es){let e=null==t,n=1!=xn.alpha;ut.forEach(((i,s)=>{if(1==x||s>0){let r=e||0==s||s==t;i._focus=e?null:r,n&&function(t,e){ut[t].alpha=e,wn.show&&zn[t]&&(zn[t].style.opacity=e),ee&&ue[t]&&(ue[t].style.opacity=e)}(s,r?1:xn.alpha)}})),es=t,n&&Ii()}}(e),null!=n.show&&ut.forEach(((i,s)=>{s>0&&(e==s||null==e)&&(i.show=n.show,function(e,n){let i=ut[e],s=ee?ue[e]:null;i.show?s&&T(s,t):(s&&E(s,t),R(kn?zn[0]:zn[e],-10,-10,Oe,Ce))}(s,n.show),2==x?(qi(i.facets[0].scale,null,null),qi(i.facets[1].scale,null,null)):qi(i.scale,null,null),Ii())})),!1!==i&&Es("setSeries",e,n),s&&Os("setSeries",w,e,n)}let Qi,ts,es;w.setSelect=Xi,w.setSeries=Ji,w.addBand=function(t,e){t.fill=_t(t.fill||null),t.dir=X(t.dir,-1),e=null==e?kt.length:e,kt.splice(e,0,t)},w.setBand=function(t,e){Ft(kt[t],e)},w.delBand=function(t){null==t?kt.length=0:kt.splice(t,1)};const ns={focus:!0};function is(t,e,n){let i=yt[e];n&&(t=t/S-(1==i.ori?Le:Pe));let s=Oe;1==i.ori&&(s=Ce,t=s-t),-1==i.dir&&(t=s-t);let r=i._min,l=r+(i._max-r)*(t/s),a=i.distr;return 3==a?ot(10,l):4==a?((t,e=1)=>tt.sinh(t)*e)(l,i.asinh):100==a?i.bwd(l):l}function ss(t,e){D(Ki,o,Gi.left=t),D(Ki,s,Gi.width=e)}function rs(t,e){D(Ki,l,Gi.top=t),D(Ki,r,Gi.height=e)}ee&&yn&&ge(_,ie,(t=>{wn._lock||(bn(t),null!=es&&Ji(null,ns,!0,Ds.setSeries))})),w.valToIdx=t=>F(t,i[0]),w.posToIdx=function(t,e){return F(is(t,St,e),i[0],Cn,Pn)},w.posToVal=is,w.valToPos=(t,e,n)=>0==yt[e].ori?M(t,yt[e],n?Ke:Oe,n?Ve:0):O(t,yt[e],n?Xe:Ce,n?Ge:0),w.setCursor=(t,e,n)=>{Pi=t.left,Li=t.top,cs(null,e,n)};let ls=0==Nt.ori?ss:rs,as=1==Nt.ori?ss:rs;function os(t,e){if(null!=t&&(t.idxs?t.idxs.forEach(((t,e)=>{Jt[e]=t})):void 0!==t.idx&&Jt.fill(t.idx),te.idx=Jt[0]),ee&&te.live){for(let t=0;t0||1==x&&!de)&&us(t,Jt[t]);!function(){if(ee&&te.live)for(let t=2==x?1:0;tPn;Qi=ft,ts=null;let l=0==Nt.ori?Oe:Ce,a=1==Nt.ori?Oe:Ce;if(Pi<0||0==Rn||r){s=wn.idx=null;for(let t=0;t0&&p.show){let e=null==b?-10:Wt(b,1==x?yt[p.scale]:yt[p.facets[1].scale],a,0);if(yn&&null!=b){let n=1==Nt.ori?Pi:Li,i=nt(xn.dist(w,t,g,e,n));if(i=0?1:-1;r==(b>=0?1:-1)&&(1==r?1==e?b>=s:b<=s:1==e?b<=s:b>=s)&&(Qi=i,ts=t)}else Qi=i,ts=t}}if(pn||kn){let n,i;0==Nt.ori?(n=v,i=e):(n=e,i=v);let s,l,a,p,m,_,g=!0,b=vn.bbox;if(null!=b){g=!1;let e=b(w,t);a=e.left,p=e.top,s=e.width,l=e.height}else a=n,p=i,s=l=vn.size(w,t);if(_=vn.fill(w,t),m=vn.stroke(w,t),kn)t==ts&&Qi<=xn.prox&&(r=a,o=p,u=s,c=l,d=g,h=_,f=m);else{let e=zn[t];null!=e&&(Sn[t]=a,Mn[t]=p,U(e,s,l,g),P(e,_,m),R(e,rt(a),rt(p),Oe,Ce))}}}}if(kn){let t=xn.prox,e=null==es?Qi<=t:Qi>t||ts!=es;if(pn||e){let t=zn[0];Sn[0]=r,Mn[0]=o,U(t,u,c,d),P(t,h,f),R(t,rt(r),rt(o),Oe,Ce)}}}if(Gi.show&&Bi)if(null!=t){let[e,n]=Ds.scales,[i,s]=Ds.match,[r,o]=t.cursor.sync.scales,u=t.cursor.drag;if(ji=u._x,Vi=u._y,ji||Vi){let u,c,d,h,f,{left:p,top:m,width:_,height:g}=t.select,w=t.scales[r].ori,b=t.posToVal,v=null!=e&&i(e,r),x=null!=n&&s(n,o);v&&ji?(0==w?(u=p,c=_):(u=m,c=g),d=yt[e],h=Yt(b(u,r),d,l,0),f=Yt(b(u+c,r),d,l,0),ls(lt(h,f),nt(f-h))):ls(0,l),x&&Vi?(1==w?(u=p,c=_):(u=m,c=g),d=yt[n],h=Wt(b(u,o),d,a,0),f=Wt(b(u+c,o),d,a,0),as(lt(h,f),nt(f-h))):as(0,a)}else _s()}else{let t=nt(Ri-Di),e=nt(Ci-Ai);if(1==Nt.ori){let n=t;t=e,e=n}ji=Wi.x&&t>=Wi.dist,Vi=Wi.y&&e>=Wi.dist;let n,i,s=Wi.uni;null!=s?ji&&Vi&&(ji=t>=s,Vi=e>=s,ji||Vi||(e>t?Vi=!0:ji=!0)):Wi.x&&Wi.y&&(ji||Vi)&&(ji=Vi=!0),ji&&(0==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),ls(lt(n,i),nt(i-n)),Vi||as(0,a)),Vi&&(1==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),as(lt(n,i),nt(i-n)),ji||ls(0,l)),ji||Vi||(ls(0,0),as(0,0))}if(Wi._x=ji,Wi._y=Vi,null==t){if(n){if(null!=As){let[t,e]=Ds.scales;Ds.values[0]=null!=t?is(0==Nt.ori?Pi:Li,t):null,Ds.values[1]=null!=e?is(1==Nt.ori?Pi:Li,e):null}Os(h,w,Pi,Li,Oe,Ce,s)}if(yn){let t=n&&Ds.setSeries,e=xn.prox;null==es?Qi<=e&&Ji(ts,ns,!0,t):Qi>e?Ji(null,ns,!0,t):ts!=es&&Ji(ts,ns,!0,t)}}pn&&(te.idx=s,os()),!1!==e&&Es("setCursor")}w.setLegend=os;let ds=null;function hs(t=!1){t?ds=null:(ds=q.getBoundingClientRect(),Es("syncRect",ds))}function fs(t,e,n,i,s,r,l){wn._lock||Bi&&null!=t&&0==t.movementX&&0==t.movementY||(ps(t,e,n,i,s,r,0,!1,null!=t),null!=t?cs(null,!0,!0):cs(e,!0,!1))}function ps(t,e,n,i,s,r,l,a,o){if(null==ds&&hs(!1),bn(t),null!=t)n=t.clientX-ds.left,i=t.clientY-ds.top;else{if(n<0||i<0)return Pi=-10,void(Li=-10);let[t,l]=Ds.scales,a=e.cursor.sync,[o,u]=a.values,[c,d]=a.scales,[h,f]=Ds.match,p=e.axes[0].side%2==1,m=0==Nt.ori?Oe:Ce,_=1==Nt.ori?Oe:Ce,g=p?r:s,w=p?s:r,b=p?i:n,v=p?n:i;if(n=null!=c?h(t,c)?C(o,yt[t],m,0):-10:m*(b/g),i=null!=d?f(l,d)?C(u,yt[l],_,0):-10:_*(v/w),1==Nt.ori){let t=n;n=i,i=t}}o&&((n<=1||n>=Oe-1)&&(n=zt(n,Oe)),(i<=1||i>=Ce-1)&&(i=zt(i,Ce))),a?(Di=n,Ai=i,[$i,Oi]=wn.move(w,n,i)):(Pi=n,Li=i)}Object.defineProperty(w,"rect",{get:()=>(null==ds&&hs(!1),ds)});const ms={width:0,height:0,left:0,top:0};function _s(){Xi(ms,!1)}let gs,ws,bs,vs;function xs(t,e,n,i,s,r,l){Bi=!0,ji=Vi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!0,!1),null!=t&&(ge(p,y,ys,!1),Os(f,w,$i,Oi,Oe,Ce,null));let{left:a,top:o,width:u,height:c}=Gi;gs=a,ws=o,bs=u,vs=c,_s()}function ys(t,e,n,i,s,r,l){Bi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!1,!0);let{left:a,top:o,width:u,height:c}=Gi,d=u>0||c>0,h=gs!=a||ws!=o||bs!=u||vs!=c;if(d&&h&&Xi(Gi),Wi.setScale&&d&&h){let t=a,e=u,n=o,i=c;if(1==Nt.ori&&(t=o,e=c,n=a,i=u),ji&&qi(St,is(t,St),is(t+e,St)),Vi)for(let t in yt){let e=yt[t];t!=St&&null==e.from&&e.min!=ft&&qi(t,is(n+i,t),is(n,t))}_s()}else wn.lock&&(wn._lock=!wn._lock,cs(null,!0,!1));null!=t&&(Me(p,y),Os(p,w,Pi,Li,Oe,Ce,null))}function ks(t,e,n,i,s,r,l){wn._lock||(bn(t),di(),_s(),null!=t&&Os(g,w,Pi,Li,Oe,Ce,null))}function zs(){gt.forEach(qn),mn(w.width,w.height,!0)}H(b,k,zs);const Ss={};Ss.mousedown=xs,Ss.mousemove=fs,Ss.mouseup=ys,Ss.dblclick=ks,Ss.setSeries=(t,e,n,i)=>{-1!=(n=(0,Ds.match[2])(w,e,n))&&Ji(n,i,!0,!1)},wn.show&&(ge(f,q,xs),ge(h,q,fs),ge(m,q,(t=>{bn(t),hs(!1)})),ge(_,q,(function(t,e,n,i,s,r,l){if(wn._lock)return;bn(t);let a=Bi;if(Bi){let t,e,n=!0,i=!0,s=10;0==Nt.ori?(t=ji,e=Vi):(t=Vi,e=ji),t&&e&&(n=Pi<=s||Pi>=Oe-s,i=Li<=s||Li>=Ce-s),t&&n&&(Pi=Pi<$i?0:Oe),e&&i&&(Li=Li{t.call(null,w,e,n)}))}(n.plugins||[]).forEach((t=>{for(let e in t.hooks)Ms[e]=(Ms[e]||[]).concat(t.hooks[e])}));const Ts=(t,e,n)=>n,Ds=Ft({key:null,setSeries:!1,filters:{pub:vt,sub:vt},scales:[St,ut[1]?ut[1].scale:null],match:[xt,xt,Ts],values:[null,null]},wn.sync);2==Ds.match.length&&Ds.match.push(Ts),wn.sync=Ds;const As=Ds.key,$s=cn(As);function Os(t,e,n,i,s,r,l){Ds.filters.pub(t,e,n,i,s,r,l)&&$s.pub(t,e,n,i,s,r,l)}function Rs(){Es("init",n,i),ci(i||n.data,!1),jt[St]?Yi(St,jt[St]):di(),hn=Gi.show&&(Gi.width>0||Gi.height>0),dn=pn=!0,mn(n.width,n.height)}return $s.sub(w),w.pub=function(t,e,n,i,s,r,l){Ds.filters.sub(t,e,n,i,s,r,l)&&Ss[t](null,e,n,i,s,r,l)},w.destroy=function(){$s.unsub(w),Ln.delete(w),_e.clear(),I(b,k,zs),Z.remove(),ie?.remove(),Es("destroy")},ut.forEach(Tn),gt.forEach((function(t,e){if(t._show=t.show,t.show){let n=t.side%2,i=yt[t.scale];null==i&&(t.scale=n?ut[1].scale:St,i=yt[t.scale]);let s=i.time;t.size=_t(t.size),t.space=_t(t.space),t.rotate=_t(t.rotate),Ct(t.incrs)&&t.incrs.forEach((t=>{!Tt.has(t)&&Tt.set(t,Dt(t))})),t.incrs=_t(t.incrs||(2==i.distr?re:s?1==it?we:xe:le)),t.splits=_t(t.splits||(s&&1==i.distr?Kt:3==i.distr?Be:4==i.distr?We:Ye)),t.stroke=_t(t.stroke),t.grid.stroke=_t(t.grid.stroke),t.ticks.stroke=_t(t.ticks.stroke),t.border.stroke=_t(t.border.stroke);let r=t.values;t.values=Ct(r)&&!Ct(r[0])?_t(r):s?Ct(r)?Se(Vt,ze(r,Gt)):Lt(r)?function(t,e){let n=Qt(e);return(e,i,s,r,l)=>i.map((e=>n(t(e))))}(Vt,r):r||Xt:r||Fe,t.filter=_t(t.filter||(i.distr>=3&&10==i.log?qe:3==i.distr&&2==i.log?Je:wt)),t.font=Xn(t.font),t.labelFont=Xn(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&&(Dn[e]=!0,t._el=$("u-axis",V))}})),c?c instanceof HTMLElement?(c.appendChild(Z),Rs()):c(w,Rs):Rs(),w}Jn.assign=Ft,Jn.fmtNum=Q,Jn.rangeNum=K,Jn.rangeLog=B,Jn.rangeAsinh=W,Jn.orient=dn,Jn.pxRatio=S,Jn.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let i=1;i=i&&null==t[s];)s--;if(s<=i)return!0;const r=at(1,it((s-i+1)/e));for(let e=t[i],n=i+r;n<=s;n+=r){const i=t[n];if(null!=i){if(i<=e)return!1;e=i}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,i=Array(n);for(let t=0;te[t]-e[n]));let s=[];for(let e=0;et-e))],s=i[0].length,r=new Map;for(let t=0;tdn(t,r,((o,u,c,d,h,f,p,m,_,g,w)=>{let b=o.pxRound,{left:v,width:x}=t.bbox,y=t=>b(f(t,d,g,m)),k=t=>b(p(t,h,w,_)),z=0==d.ori?xn:yn;const M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=M.stroke,T=d.dir*(0==d.ori?1:-1);l=Y(c,l,a,1),a=Y(c,l,a,-1);let D=k(c[1==T?l:a]),A=y(u[1==T?l:a]),$=A,O=A;s&&-1==e&&(O=v,z(E,O,D)),z(E,A,D);for(let t=1==T?l:a;t>=l&&t<=a;t+=T){let n=c[t];if(null==n)continue;let i=y(u[t]),s=k(n);1==e?z(E,i,D):z(E,$,s),z(E,i,s),D=s,$=i}let R=$;s&&1==e&&(R=v+x,z(E,R,D));let[C,P]=hn(t,r);if(null!=o.fill||0!=C){let e=M.fill=new Path2D(E),n=k(o.fillTo(t,r,o.min,o.max,C));z(e,R,n),z(e,O,n)}if(!o.spanGaps){let s=[];s.push(..._n(u,c,l,a,T,y,i));let h=o.width*S/2,f=n||1==e?h:-h,p=n||-1==e?-h:h;s.forEach((t=>{t[0]+=f,t[1]+=p})),M.gaps=s=o.gaps(t,r,l,a,s),M.clip=mn(s,d.ori,m,_,g,w)}return 0!=P&&(M.band=2==P?[pn(t,r,l,a,E,-1),pn(t,r,l,a,E,1)]:pn(t,r,l,a,E,P)),M}))},t.bars=function(t){const e=X((t=t||$t).size,[.6,ft,1]),n=t.align||0,i=t.gap||0;let s=t.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=_t(s),l=1-e[0],a=X(e[1],ft),o=X(e[2],1),u=X(t.disp,$t),c=X(t.each,(t=>{})),{fill:d,stroke:h}=u;return(t,e,s,f)=>dn(t,e,((p,m,_,g,w,b,v,x,y,k,z)=>{let M,E,T=p.pxRound,D=n,A=i*S,$=a*S,O=o*S;0==g.ori?[M,E]=r(t,e):[E,M]=r(t,e);const R=g.dir*(0==g.ori?1:-1);let C,P,L,U=0==g.ori?kn:zn,Z=0==g.ori?c:(t,e,n,i,s,r,l)=>{c(t,e,n,s,i,l,r)},N=X(t.bands,Ot).find((t=>t.series[0]==e)),H=null!=N?N.dir:0,I=p.fillTo(t,e,p.min,p.max,H),F=T(v(I,w,z,y)),Y=k,B=T(p.width*S),W=!1,j=null,V=null,G=null,K=null;null==d||0!=B&&null==h||(W=!0,j=d.values(t,e,s,f),V=new Map,new Set(j).forEach((t=>{null!=t&&V.set(t,new Path2D)})),B>0&&(G=h.values(t,e,s,f),K=new Map,new Set(G).forEach((t=>{null!=t&&K.set(t,new Path2D)}))));let{x0:q,size:J}=u;if(null!=q&&null!=J){D=1,m=q.values(t,e,s,f),2==q.unit&&(m=m.map((e=>t.posToVal(x+e*k,g.key,!0))));let n=J.values(t,e,s,f);P=2==J.unit?n[0]*k:b(n[0],g,k,x)-b(0,g,k,x),Y=Cn(m,_,b,g,k,x,Y),L=Y-P+A}else Y=Cn(m,_,b,g,k,x,Y),L=Y*l+A,P=Y-L;L<1&&(L=0),B>=P/2&&(B=0),L<5&&(T=gt);let Q=L>0;P=T(mt(Y-L-(Q?B:0),O,$)),C=(0==D?P/2:D==R?0:P)-D*R*((0==D?A/2:0)+(Q?B/2:0));const tt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},et=W?null:new Path2D;let nt=null;if(null!=N)nt=t.data[N.series[1]];else{let{y0:n,y1:i}=u;null!=n&&null!=i&&(_=i.values(t,e,s,f),nt=n.values(t,e,s,f))}let st=M*P,rt=E*P;for(let n=1==R?s:f;n>=s&&n<=f;n+=R){let i=_[n];if(null==i)continue;if(null!=nt){let t=nt[n]??0;if(i-t==0)continue;F=v(t,w,z,y)}let s=b(2!=g.distr||null!=u?m[n]:n,g,k,x),r=v(X(i,I),w,z,y),l=T(s-C),a=T(at(r,F)),o=T(lt(r,F)),c=a-o;if(null!=i){let s=i<0?rt:st,r=i<0?st:rt;W?(B>0&&null!=G[n]&&U(K.get(G[n]),l,o+it(B/2),P,at(0,c-B),s,r),null!=j[n]&&U(V.get(j[n]),l,o+it(B/2),P,at(0,c-B),s,r)):U(et,l,o+it(B/2),P,at(0,c-B),s,r),Z(t,e,n,l-B/2,o,P+B,c)}}return B>0?tt.stroke=W?K:et:W||(tt._fill=0==p.width?p._fill:p._stroke??p._fill,tt.width=0),tt.fill=W?V:et,tt}))},t.spline=function(t){return function(t,e){const n=X(e?.alignGaps,0);return(e,i,s,r)=>dn(e,i,((l,a,o,u,c,d,h,f,p,m,_)=>{let g,w,b,v=l.pxRound,x=t=>v(d(t,u,m,f)),y=t=>v(h(t,c,_,p));0==u.ori?(g=bn,b=xn,w=En):(g=vn,b=yn,w=Tn);const k=u.dir*(0==u.ori?1:-1);s=Y(o,s,r,1),r=Y(o,s,r,-1);let z=x(a[1==k?s:r]),S=z,M=[],E=[];for(let t=1==k?s:r;t>=s&&t<=r;t+=k)if(null!=o[t]){let e=x(a[t]);M.push(S=e),E.push(y(o[t]))}const T={stroke:t(M,E,g,b,w,v),fill:null,clip:null,band:null,gaps:null,flags:1},D=T.stroke;let[A,$]=hn(e,i);if(null!=l.fill||0!=A){let t=T.fill=new Path2D(D),n=y(l.fillTo(e,i,l.min,l.max,A));b(t,S,n),b(t,z,n)}if(!l.spanGaps){let t=[];t.push(..._n(a,o,s,r,k,x,n)),T.gaps=t=l.gaps(e,i,s,r,t),T.clip=mn(t,u.ori,f,p,m,_)}return 0!=$&&(T.band=2==$?[pn(e,i,s,r,D,-1),pn(e,i,s,r,D,1)]:pn(e,i,s,r,D,$)),T}))}(Pn,t)}}var Qn=n(379),ti=n.n(Qn),ei=n(795),ni=n.n(ei),ii=n(569),si=n.n(ii),ri=n(565),li=n.n(ri),ai=n(216),oi=n.n(ai),ui=n(589),ci=n.n(ui),di=n(350),hi={};function fi(t){var e,n=HTMLWidgets.find("#"+t);return void 0!==n&&(e=n.getWidget()),e}function pi(t,e){let n=[],i=[],s=t[0].length,r=Array(s);for(let t=0;tr[e]+=+t)));for(let n=1;ni>n&&!e(i))),n]});return i=i.filter((t=>t.series[1]>-1)),{data:[t[0]].concat(n),bands:i}}hi.styleTagTransform=ci(),hi.setAttributes=li(),hi.insert=si().bind(null,"head"),hi.domAPI=ni(),hi.insertStyleElement=oi(),ti()(di.Z,hi),di.Z&&di.Z.locals&&di.Z.locals;const mi=(t="{YYYY}/{MM}/{DD} {HH}:{mm}:{ss}",e=" - ",n=10,i=10)=>{let s=0,r=0;const l=document.createElement("div");l.className="u-tooltip",l.style.position="absolute",l.style.display="none",l.style.padding="4px",l.style.border="2px solid black",l.style.background="#FFF";let a=null,o=null;const u=uPlot.fmtDate(t);let c,d=!1;function h(t){console.log(t),d||(l.style.display="block",c.style.cursor="crosshair",d=!0);let h=t.valToPos(t.data[a][o],"y"),f=t.valToPos(t.data[0][o],"x");l.style.top=r+h+n+"px",l.style.left=s+f+i+"px";let p=t.series[a]._stroke;l.style.borderColor=p;let m=t.series[a].value;l.textContent=u(new Date(1e3*t.data[0][o]))+e+m(t,t.data[a][o],a,o)}return{hooks:{ready:[t=>{c=t.over,s=parseFloat(c.style.left),r=parseFloat(c.style.top),t.root.querySelector(".u-wrap").appendChild(l)}],setCursor:[t=>{let e=t.cursor;o!=e.idx&&(o=e.idx,null!=a&&h(t))}],setSeries:[(t,e)=>{a!=e&&(a=e,null==e?d&&(l.style.display="none",c.style.cursor=null,d=!1):null!=o&&h(t))}],drawAxes:[t=>{let{ctx:e}=t,{left:n,top:i,width:s,height:r}=t.bbox;e.save(),e.strokeStyle="#fcb0f17a",e.beginPath();let[l,a]=t.series[0].idxs;e.closePath(),e.stroke(),e.restore()}]}}},_i=({className:t,style:e={backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#424242"}}={})=>{let n;return{hooks:{init:function(i,s){n=i.root.querySelector(".u-legend"),n.classList.remove("u-inline"),t&&n.classList.add(t),uPlot.assign(n.style,{textAlign:"left",pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,zIndex:100,boxShadow:"2px 2px 10px rgba(0,0,0,0.5)",...e});const r=n.querySelectorAll(".u-marker");for(let t=0;t{n.style.display=null})),l.addEventListener("mouseleave",(()=>{n.style.display="none"}))},setCursor:function(t){const{left:e,top:i}=t.cursor;n.style.transform="translate("+e+"px, "+i+"px)"}}}},gi=t=>{let e,n,i,s,r,l,a=t.factor||.75;function o(t,e,n,i,s,r){return t>i?(e=s,n=r):er&&(n=r,e=r-t),[e,n]}return{hooks:{ready:t=>{e=t.scales.x.min,n=t.scales.x.max,i=t.scales.y.min,s=t.scales.y.max,r=n-e,l=s-i;let u=t.over,c=u.getBoundingClientRect();u.addEventListener("mousedown",(e=>{if(1==e.button){e.preventDefault();let n=e.clientX,i=t.scales.x.min,s=t.scales.x.max,r=t.posToVal(1,"x")-t.posToVal(0,"x");function l(e){e.preventDefault();let l=e.clientX,a=r*(l-n);t.setScale("x",{min:i-a,max:s-a})}function a(t){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}})),u.addEventListener("wheel",(u=>{u.preventDefault();let{left:d,top:h}=t.cursor,f=d/c.width,p=1-h/c.height,m=t.posToVal(d,"x"),_=t.posToVal(h,"y"),g=t.scales.x.max-t.scales.x.min,w=t.scales.y.max-t.scales.y.min,b=u.deltaY<0?g*a:g/a,v=m-f*b,x=v+b;[v,x]=o(b,v,x,r,e,n);let y=u.deltaY<0?w*a:w/a,k=_-p*y,z=k+y;[k,z]=o(y,k,z,l,i,s),t.batch((()=>{t.setScale("x",{min:v,max:x}),t.setScale("y",{min:k,max:z})}))}))}}}},wi=({className:t,style:e={backgroundColor:"rgba(51,204,255,0.3)"}}={})=>{let n,i,s,r;return{opts:(t,e)=>{uPlot.assign(e,{cursor:{x:!1,y:!1}})},hooks:{init:function(r){n=r.under,i=r.over,s=document.createElement("div"),t&&s.classList.add(t),uPlot.assign(s.style,{pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,height:"100%",...e}),n.appendChild(s),i.addEventListener("mouseenter",(()=>{s.style.display=null})),i.addEventListener("mouseleave",(()=>{s.style.display="none"}))},setCursor:function(t){if(r!==t.cursor.idx){r=t.cursor.idx;let[e,n]=t.series[0].idxs;const i=n-e,l=t.bbox.width/i/devicePixelRatio,a=2==t.scales.x.distr?r:t.data[0][r],o=t.valToPos(a,"x")-l/2;s.style.transform="translateX("+Math.round(o)+"px)",s.style.width=Math.round(l)+"px"}}}}},bi=(t,e,n,i)=>{const s=5*devicePixelRatio;return uPlot.orient(t,e,((n,i,r,l,a,o,u,c,d,h,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=l.min&&e<=l.max&&n>=a.min&&n<=a.max){let t=o(e,l,h,c),i=u(n,a,f,d);v.moveTo(t+s/2,i),g(v,t,i,s/2,0,b)}}console.timeEnd("points"),t.ctx.fill(v)})),null},vi=t=>{let e=t.yintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(t.scales.x.min,"x",!0),a=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(l,r),t.ctx.lineTo(a,r),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},xi=t=>{let e=t.xintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"x",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(t.scales.y.max,"y",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(r,a),t.ctx.lineTo(r,l),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},yi=t=>{let e=t.xmin||0,n=t.xmax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(t.scales.y.max,"y",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(e,"x",!0),o=t.valToPos(n,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,r,o-a,l-r),t.ctx.restore()}},ki=t=>{let e=t.ymin||0,n=t.ymax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(n,"y",!0),a=t.valToPos(t.scales.x.min,"x",!0),o=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,l,o-a,r-l),t.ctx.restore()}},zi=({gap:t=2,shadowColor:e="#000000",bearishColor:n="#e54245",bullishColor:i="#4ab650",bodyMaxWidth:s=20,shadowWidth:r=2,bodyOutline:l=1}={})=>({opts:(t,e)=>{uPlot.assign(e,{cursor:{points:{show:!1}}}),e.series.forEach((t=>{t.paths=()=>null,t.points={show:!1}}))},hooks:{draw:function(a){a.ctx.save();const o=r%2/2;a.ctx.translate(o,o);let[u,c]=a.series[0].idxs;for(let o=u;o<=c;o++){let d=2==a.scales.x.distr?o:a.data[0][o],h=a.data[1][o],f=a.data[2][o],p=a.data[3][o],m=a.data[4][o],_=a.valToPos(d,"x",!0),g=a.valToPos(p,"y",!0),w=a.valToPos(f,"y",!0),b=a.valToPos(h,"y",!0),v=a.valToPos(m,"y",!0),x=Math.max(w,g)-Math.min(w,g),y=_-r/2,k=Math.min(w,g);a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(y),Math.round(k),Math.round(r),Math.round(x));let z=a.bbox.width/(c-u),S=Math.min(s,z-t),M=Math.max(v,b)-Math.min(v,b),E=_-S/2,T=Math.min(v,b),D=h>m?n:i;a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(E),Math.round(T),Math.round(S),Math.round(M)),a.ctx.fillStyle=D,a.ctx.fillRect(Math.round(E+l),Math.round(T+l),Math.round(S-2*l),Math.round(M-2*l))}a.ctx.translate(-o,-o),a.ctx.restore()}}});function Si(t,e,n,i,s,r,l){const a=r.height||80,o=r.gripColor||"#4a90d9",u=r.gripWidth||8,c="u-zoom-ranger-styles";if(!document.getElementById(c)){const t=document.createElement("style");t.id=c,t.textContent=[".u-zoom-ranger-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; }",".u-zoom-ranger-wrap .u-zoom-ranger-main { flex: 1 1 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav { flex: 0 0 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select { pointer-events: all; cursor: grab; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select:active { cursor: grabbing; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-axis { pointer-events: none; }",".u-grip-l, .u-grip-r {"," position: absolute; top: 0; width: "+u+"px; height: 100%;"," background: "+o+"; opacity: 0.8; cursor: ew-resize; border-radius: 2px;","}",".u-grip-l { left: "+-Math.ceil(u/2)+"px; }",".u-grip-r { right: "+-Math.ceil(u/2)+"px; }"].join("\n"),document.head.appendChild(t)}const d=document.createElement("div");d.className="u-zoom-ranger-wrap";const h=document.createElement("div");h.className="u-zoom-ranger-main";const f=document.createElement("div");let p,m,_;f.className="u-zoom-ranger-nav",d.appendChild(h),d.appendChild(f),t.appendChild(d);const g={left:null,width:null},w={min:null,max:null};let b,v;function x(t,e){const n=document.createElement("div");return n.classList.add(e),t.appendChild(n),n}function y(t,e){w.min=v.posToVal(t,"x"),w.max=v.posToVal(t+e,"x"),b.setScale("x",w)}function k(t,e,n){const i=v.bbox.width/z();if(2===n){const n=e-t;e>i?t=(e=i)-n:t<0&&(e=(t=0)+n)}else t>e&&(0===n?t=e:1===n&&(e=t)),t=Math.max(0,t),e=Math.min(e,i);y(t,e-t)}function z(){return l.pxRatio||window.devicePixelRatio||1}function S(t,e){p=t.clientX,m=v.select.left,_=m+v.select.width;const n=function(t){let e;return(...n)=>{e||(e=requestAnimationFrame((()=>{t(...n),e=null})))}}(e);document.addEventListener("mousemove",n),document.addEventListener("mouseup",(function t(){document.removeEventListener("mouseup",t),document.removeEventListener("mousemove",n)})),t.stopPropagation()}const M=s.series?s.series.map(((t,e)=>0===e?{}:{stroke:r.stroke||t.stroke||"#999"})):[{}],E={width:e,height:a,cursor:{x:!1,y:!1,points:{show:!1},drag:{setScale:!1,setSelect:!0,x:!0,y:!1}},legend:{show:!1},scales:s.scales?JSON.parse(JSON.stringify(s.scales)):{},axes:[{},{show:!1,grid:{show:!1},ticks:{show:!1}}],series:M,hooks:{ready:[t=>{const e=t.bbox.width/z(),n=t.bbox.height/z();t.setSelect({left:0,width:e,height:n},!1);const i=t.root.querySelector(".u-select");i.addEventListener("mousedown",(t=>{S(t,(t=>k(m+(t.clientX-p),_+(t.clientX-p),2)))})),x(i,"u-grip-l").addEventListener("mousedown",(t=>{S(t,(t=>k(m+(t.clientX-p),_,0)))})),x(i,"u-grip-r").addEventListener("mousedown",(t=>{S(t,(t=>k(m,_+(t.clientX-p),1)))}))}],setSelect:[t=>{y(t.select.left,t.select.width)}]}},T=s.hooks||{},D=Array.isArray(T.setScale)?T.setScale:T.setScale?[T.setScale]:[],A=Object.assign({},s,{width:e,height:n,select:{over:!1},hooks:Object.assign({},T,{setScale:[...D,t=>{if(!v)return;const e=Math.round(v.valToPos(t.scales.x.min,"x"));var n,i;n=e,i=Math.round(v.valToPos(t.scales.x.max,"x"))-e,g.left=n,g.width=i,v.setSelect(g,!1)}]})});return v=new l(E,i,f),b=new l(A,i,h),new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width,n=e.contentRect.height,i=Math.max(50,n-a-4);v.setSize({width:t,height:a}),b.setSize({width:t,height:i})}})).observe(t),{zoomed:b,ranger:v,wrap:d}}function Mi(t){let e=t.length;for(;--e>=0;)t[e]=0}const Ei=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]),Ti=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]),Di=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ai=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$i=new Array(576);Mi($i);const Oi=new Array(60);Mi(Oi);const Ri=new Array(512);Mi(Ri);const Ci=new Array(256);Mi(Ci);const Pi=new Array(29);Mi(Pi);const Li=new Array(30);function Ui(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}let Zi,Ni,Hi;function Ii(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}Mi(Li);const Fi=t=>t<256?Ri[t]:Ri[256+(t>>>7)],Yi=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Bi=(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<{Bi(t,n[2*e],n[2*e+1])},ji=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Vi=(t,e,n)=>{const i=new Array(16);let s,r,l=0;for(s=1;s<=15;s++)l=l+n[s-1]<<1,i[s]=l;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=ji(i[e]++,e))}},Gi=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},Ki=t=>{t.bi_valid>8?Yi(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Xi=(t,e,n,i)=>{const s=2*e,r=2*n;return t[s]{const i=t.heap[n];let s=n<<1;for(;s<=t.heap_len&&(s{let i,s,r,l,a=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+a++],i+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===i?Wi(t,s,e):(r=Ci[s],Wi(t,r+256+1,e),l=Ei[r],0!==l&&(s-=Pi[r],Bi(t,s,l)),i--,r=Fi(i),Wi(t,r,n),l=Ti[r],0!==l&&(i-=Li[r],Bi(t,i,l)))}while(a{const n=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,a,o,u=-1;for(t.heap_len=0,t.heap_max=573,l=0;l>1;l>=1;l--)qi(t,n,l);o=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],qi(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=a,n[2*o]=n[2*l]+n[2*a],t.depth[o]=(t.depth[l]>=t.depth[a]?t.depth[l]:t.depth[a])+1,n[2*l+1]=n[2*a+1]=o,t.heap[1]=o++,qi(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let u,c,d,h,f,p,m=0;for(h=0;h<=15;h++)t.bl_count[h]=0;for(n[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)c=t.heap[u],h=n[2*n[2*c+1]+1]+1,h>o&&(h=o,m++),n[2*c+1]=h,c>i||(t.bl_count[h]++,f=0,c>=a&&(f=l[c-a]),p=n[2*c],t.opt_len+=p*(h+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==m){do{for(h=o-1;0===t.bl_count[h];)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[o]--,m-=2}while(m>0);for(h=o;0!==h;h--)for(c=t.bl_count[h];0!==c;)d=t.heap[--u],d>i||(n[2*d+1]!==h&&(t.opt_len+=(h-n[2*d+1])*n[2*d],n[2*d+1]=h),c--)}})(t,e),Vi(n,u,t.bl_count)},ts=(t,e,n)=>{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=l,l=e[2*(i+1)+1],++a{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),i=0;i<=n;i++)if(s=l,l=e[2*(i+1)+1],!(++a{Bi(t,0+(i?1:0),3),Ki(t),Yi(t,n),Yi(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var ss={_tr_init:t=>{ns||((()=>{let t,e,n,i,s;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Pi[i]=n,t=0;t<1<>=7;i<30;i++)for(Li[i]=s<<7,t=0;t<1<{let s,r,l=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)),Qi(t,t.l_desc),Qi(t,t.d_desc),l=(t=>{let e;for(ts(t,t.dyn_ltree,t.l_desc.max_code),ts(t,t.dyn_dtree,t.d_desc.max_code),Qi(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Ai[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&-1!==e?is(t,e,n,i):4===t.strategy||r===s?(Bi(t,2+(i?1:0),3),Ji(t,$i,Oi)):(Bi(t,4+(i?1:0),3),((t,e,n,i)=>{let s;for(Bi(t,e-257,5),Bi(t,n-1,5),Bi(t,i-4,4),s=0;s(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*(Ci[n]+256+1)]++,t.dyn_dtree[2*Fi(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Bi(t,2,3),Wi(t,256,$i),(t=>{16===t.bi_valid?(Yi(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)}},rs=(t,e,n,i)=>{let s=65535&t|0,r=t>>>16&65535|0,l=0;for(;0!==n;){l=n>2e3?2e3:n,n-=l;do{s=s+e[i++]|0,r=r+s|0}while(--l);s%=65521,r%=65521}return s|r<<16|0};const ls=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var as=(t,e,n,i)=>{const s=ls,r=i+n;t^=-1;for(let n=i;n>>8^s[255&(t^e[n])];return-1^t},os={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"},us={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:cs,_tr_stored_block:ds,_tr_flush_block:hs,_tr_tally:fs,_tr_align:ps}=ss,{Z_NO_FLUSH:ms,Z_PARTIAL_FLUSH:_s,Z_FULL_FLUSH:gs,Z_FINISH:ws,Z_BLOCK:bs,Z_OK:vs,Z_STREAM_END:xs,Z_STREAM_ERROR:ys,Z_DATA_ERROR:ks,Z_BUF_ERROR:zs,Z_DEFAULT_COMPRESSION:Ss,Z_FILTERED:Ms,Z_HUFFMAN_ONLY:Es,Z_RLE:Ts,Z_FIXED:Ds,Z_DEFAULT_STRATEGY:As,Z_UNKNOWN:$s,Z_DEFLATED:Os}=us,Rs=258,Cs=262,Ps=42,Ls=113,Us=666,Zs=(t,e)=>(t.msg=os[e],e),Ns=t=>2*t-(t>4?9:0),Hs=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Is=t=>{let e,n,i,s=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=s?n-s:0}while(--e);e=s,i=e;do{n=t.prev[--i],t.prev[i]=n>=s?n-s:0}while(--e)};let Fs=(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))},Bs=(t,e)=>{hs(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ys(t.strm)},Ws=(t,e)=>{t.pending_buf[t.pending++]=e},js=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Vs=(t,e,n,i)=>{let s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),n),1===t.state.wrap?t.adler=rs(t.adler,e,s,n):2===t.state.wrap&&(t.adler=as(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)},Gs=(t,e)=>{let n,i,s=t.max_chain_length,r=t.strstart,l=t.prev_length,a=t.nice_match;const o=t.strstart>t.w_size-Cs?t.strstart-(t.w_size-Cs):0,u=t.window,c=t.w_mask,d=t.prev,h=t.strstart+Rs;let f=u[r+l-1],p=u[r+l];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,u[n+l]===p&&u[n+l-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&rl){if(t.match_start=e,l=i,i>=a)break;f=u[r+l-1],p=u[r+l]}}}while((e=d[e&c])>o&&0!=--s);return l<=t.lookahead?l:t.lookahead},Ks=t=>{const e=t.w_size;let n,i,s;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Cs)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Is(t),i+=e),0===t.strm.avail_in)break;if(n=Vs(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Fs(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Fs(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,i,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,l=0,a=t.strm.avail_in;do{if(n=65535,s=t.bi_valid+42>>3,t.strm.avail_outi+t.strm.avail_in&&(n=i+t.strm.avail_in),n>s&&(n=s),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ys(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vs(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===l);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_waters&&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++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(Vs(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,i=t.strstart-t.block_start,(i>=r||(i||e===ws)&&e!==ms&&0===t.strm.avail_in&&i<=s)&&(n=i>s?s:i,l=e===ws&&0===t.strm.avail_in&&n===i?1:0,ds(t,t.block_start,n,l),t.block_start+=n,Ys(t.strm)),l?3:1)},qs=(t,e)=>{let n,i;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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-Cs&&(t.match_length=Gs(t,n)),t.match_length>=3)if(i=fs(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=Fs(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=Fs(t,t.ins_h,t.window[t.strstart+1]);else i=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2},Js=(t,e)=>{let n,i,s;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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){s=t.strstart+t.lookahead-3,i=fs(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Fs(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++,i&&(Bs(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=fs(t,0,t.window[t.strstart-1]),i&&Bs(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&&(i=fs(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2};function Qs(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}const tr=[new Qs(0,0,0,0,Xs),new Qs(4,4,8,4,qs),new Qs(4,5,16,8,qs),new Qs(4,6,32,32,qs),new Qs(4,4,16,16,Js),new Qs(8,16,32,32,Js),new Qs(8,16,128,128,Js),new Qs(8,32,128,256,Js),new Qs(32,128,258,1024,Js),new Qs(32,258,258,4096,Js)];function er(){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=Os,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),Hs(this.dyn_ltree),Hs(this.dyn_dtree),Hs(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),Hs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Hs(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 nr=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ps&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ls&&e.status!==Us?1:0},ir=t=>{if(nr(t))return Zs(t,ys);t.total_in=t.total_out=0,t.data_type=$s;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?Ps:Ls,t.adler=2===e.wrap?0:1,e.last_flush=-2,cs(e),vs},sr=t=>{const e=ir(t);var n;return e===vs&&((n=t.state).window_size=2*n.w_size,Hs(n.head),n.max_lazy_match=tr[n.level].max_lazy,n.good_match=tr[n.level].good_length,n.nice_match=tr[n.level].nice_length,n.max_chain_length=tr[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},rr=(t,e,n,i,s,r)=>{if(!t)return ys;let l=1;if(e===Ss&&(e=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),s<1||s>9||n!==Os||i<8||i>15||e<0||e>9||r<0||r>Ds||8===i&&1!==l)return Zs(t,ys);8===i&&(i=9);const a=new er;return t.state=a,a.strm=t,a.status=Ps,a.wrap=l,a.gzhead=null,a.w_bits=i,a.w_size=1<nr(t)||2!==t.state.wrap?ys:(t.state.gzhead=e,vs),or=(t,e)=>{if(nr(t)||e>bs||e<0)return t?Zs(t,ys):ys;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Us&&e!==ws)return Zs(t,0===t.avail_out?zs:ys);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ys(t),0===t.avail_out)return n.last_flush=-1,vs}else if(0===t.avail_in&&Ns(e)<=Ns(i)&&e!==ws)return Zs(t,zs);if(n.status===Us&&0!==t.avail_in)return Zs(t,zs);if(n.status===Ps&&0===n.wrap&&(n.status=Ls),n.status===Ps){let e=Os+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=Es||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,js(n,e),0!==n.strstart&&(js(n,t.adler>>>16),js(n,65535&t.adler)),t.adler=1,n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(57===n.status)if(t.adler=0,Ws(n,31),Ws(n,139),Ws(n,8),n.gzhead)Ws(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)),Ws(n,255&n.gzhead.time),Ws(n,n.gzhead.time>>8&255),Ws(n,n.gzhead.time>>16&255),Ws(n,n.gzhead.time>>24&255),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ws(n,255&n.gzhead.extra.length),Ws(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=as(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,3),n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=s,Ys(t),0!==n.pending)return n.last_flush=-1,vs;e=0,i-=s}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(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,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ys(t),0!==n.pending))return n.last_flush=-1,vs;Ws(n,255&t.adler),Ws(n,t.adler>>8&255),t.adler=0}if(n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(0!==t.avail_in||0!==n.lookahead||e!==ms&&n.status!==Us){let i=0===n.level?Xs(n,e):n.strategy===Es?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Ks(t),0===t.lookahead)){if(e===ms)return 1;break}if(t.match_length=0,n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===Ts?((t,e)=>{let n,i,s,r;const l=t.window;for(;;){if(t.lookahead<=Rs){if(Ks(t),t.lookahead<=Rs&&e===ms)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,i=l[s],i===l[++s]&&i===l[++s]&&i===l[++s])){r=t.strstart+Rs;do{}while(i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=fs(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):tr[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Us),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),vs;if(2===i&&(e===_s?ps(n):e!==bs&&(ds(n,0,0,!1),e===gs&&(Hs(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ys(t),0===t.avail_out))return n.last_flush=-1,vs}return e!==ws?vs:n.wrap<=0?xs:(2===n.wrap?(Ws(n,255&t.adler),Ws(n,t.adler>>8&255),Ws(n,t.adler>>16&255),Ws(n,t.adler>>24&255),Ws(n,255&t.total_in),Ws(n,t.total_in>>8&255),Ws(n,t.total_in>>16&255),Ws(n,t.total_in>>24&255)):(js(n,t.adler>>>16),js(n,65535&t.adler)),Ys(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vs:xs)},ur=t=>{if(nr(t))return ys;const e=t.state.status;return t.state=null,e===Ls?Zs(t,ks):vs},cr=(t,e)=>{let n=e.length;if(nr(t))return ys;const i=t.state,s=i.wrap;if(2===s||1===s&&i.status!==Ps||i.lookahead)return ys;if(1===s&&(t.adler=rs(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===s&&(Hs(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const r=t.avail_in,l=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Ks(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Fs(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Ks(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=l,t.input=a,t.avail_in=r,i.wrap=s,vs};const dr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var hr=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)dr(n,e)&&(t[e]=n[e])}}return t},fr=t=>{let e=0;for(let n=0,i=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;mr[254]=mr[254]=1;var _r=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,s,r,l=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&n):n<65536?(e[r++]=224|n>>>12,e[r++]=128|n>>>6&63,e[r++]=128|63&n):(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63,e[r++]=128|n>>>6&63,e[r++]=128|63&n);return e},gr=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,s;const r=new Array(2*n);for(s=0,i=0;i4)r[s++]=65533,i+=l-1;else{for(e&=2===l?31:3===l?15:7;l>1&&i1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&pr)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i{(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+mr[t[n]]>e?n:e},br=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 vr=Object.prototype.toString,{Z_NO_FLUSH:xr,Z_SYNC_FLUSH:yr,Z_FULL_FLUSH:kr,Z_FINISH:zr,Z_OK:Sr,Z_STREAM_END:Mr,Z_DEFAULT_COMPRESSION:Er,Z_DEFAULT_STRATEGY:Tr,Z_DEFLATED:Dr}=us;function Ar(t){this.options=hr({level:Er,method:Dr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Tr},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 br,this.strm.avail_out=0;let n=lr(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==Sr)throw new Error(os[n]);if(e.header&&ar(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?_r(e.dictionary):"[object ArrayBuffer]"===vr.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=cr(this.strm,t),n!==Sr)throw new Error(os[n]);this._dict_set=!0}}function $r(t,e){const n=new Ar(e);if(n.push(t,!0),n.err)throw n.msg||os[n.err];return n.result}Ar.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?zr:xr,"string"==typeof t?n.input=_r(t):"[object ArrayBuffer]"===vr.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(i),n.next_out=0,n.avail_out=i),(r===yr||r===kr)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(s=or(n,r),s===Mr)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=ur(this.strm),this.onEnd(s),this.ended=!0,s===Sr;if(0!==n.avail_out){if(r>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},Ar.prototype.onData=function(t){this.chunks.push(t)},Ar.prototype.onEnd=function(t){t===Sr&&(this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Or={Deflate:Ar,deflate:$r,deflateRaw:function(t,e){return(e=e||{}).raw=!0,$r(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,$r(t,e)},constants:us};const Rr=16209;var Cr=function(t,e){let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z,S;const M=t.state;n=t.next_in,z=t.input,i=n+(t.avail_in-5),s=t.next_out,S=t.output,r=s-(e-t.avail_out),l=s+(t.avail_out-257),a=M.dmax,o=M.wsize,u=M.whave,c=M.wnext,d=M.window,h=M.hold,f=M.bits,p=M.lencode,m=M.distcode,_=(1<>>24,h>>>=b,f-=b,b=w>>>16&255,0===b)S[s++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=p[(65535&w)+(h&(1<>>=b,f-=b),f<15&&(h+=z[n++]<>>24,h>>>=b,f-=b,b=w>>>16&255,!(16&b)){if(0==(64&b)){w=m[(65535&w)+(h&(1<a){t.msg="invalid distance too far back",M.mode=Rr;break t}if(h>>>=b,f-=b,b=s-r,x>b){if(b=x-b,b>u&&M.sane){t.msg="invalid distance too far back",M.mode=Rr;break t}if(y=0,k=d,0===c){if(y+=o-b,b2;)S[s++]=k[y++],S[s++]=k[y++],S[s++]=k[y++],v-=3;v&&(S[s++]=k[y++],v>1&&(S[s++]=k[y++]))}else{y=s-x;do{S[s++]=S[y++],S[s++]=S[y++],S[s++]=S[y++],v-=3}while(v>2);v&&(S[s++]=S[y++],v>1&&(S[s++]=S[y++]))}break}}break}}while(n>3,n-=v,f-=v<<3,h&=(1<{const o=a.bits;let u,c,d,h,f,p,m=0,_=0,g=0,w=0,b=0,v=0,x=0,y=0,k=0,z=0,S=null;const M=new Uint16Array(16),E=new Uint16Array(16);let T,D,A,$=null;for(m=0;m<=15;m++)M[m]=0;for(_=0;_=1&&0===M[w];w--);if(b>w&&(b=w),0===w)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(g=1;g0&&(0===t||1!==w))return-1;for(E[1]=0,m=1;m<15;m++)E[m+1]=E[m]+M[m];for(_=0;_852||2===t&&k>592)return 1;for(;;){T=m-x,l[_]+1=p?(D=$[l[_]-p],A=S[l[_]-p]):(D=96,A=0),u=1<>x)+c]=T<<24|D<<16|A|0}while(0!==c);for(u=1<>=1;if(0!==u?(z&=u-1,z+=u):z=0,_++,0==--M[m]){if(m===w)break;m=e[n+l[_]]}if(m>b&&(z&h)!==d){for(0===x&&(x=b),f+=g,v=m-x,y=1<852||2===t&&k>592)return 1;d=z&h,s[d]=b<<24|v<<16|f-r|0}}return 0!==z&&(s[f+z]=m-x<<24|64<<16|0),a.bits=b,0};const{Z_FINISH:Hr,Z_BLOCK:Ir,Z_TREES:Fr,Z_OK:Yr,Z_STREAM_END:Br,Z_NEED_DICT:Wr,Z_STREAM_ERROR:jr,Z_DATA_ERROR:Vr,Z_MEM_ERROR:Gr,Z_BUF_ERROR:Kr,Z_DEFLATED:Xr}=us,qr=16180,Jr=16190,Qr=16191,tl=16192,el=16194,nl=16199,il=16200,sl=16206,rl=16209,ll=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function al(){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 ol=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},ul=t=>{if(ol(t))return jr;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=qr,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,Yr},cl=t=>{if(ol(t))return jr;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ul(t)},dl=(t,e)=>{let n;if(ol(t))return jr;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?jr:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,cl(t))},hl=(t,e)=>{if(!t)return jr;const n=new al;t.state=n,n.strm=t,n.window=null,n.mode=qr;const i=dl(t,e);return i!==Yr&&(t.state=null),i};let fl,pl,ml=!0;const _l=t=>{if(ml){fl=new Int32Array(512),pl=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(Nr(1,t.lens,0,288,fl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Nr(2,t.lens,0,32,pl,0,t.work,{bits:5}),ml=!1}t.lencode=fl,t.lenbits=9,t.distcode=pl,t.distbits=5},gl=(t,e,n,i)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(n-i,n-i+s),r.wnext),(i-=s)?(r.window.set(e.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave{let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z=0;const S=new Uint8Array(4);let M,E;const T=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ol(t)||!t.output||!t.input&&0!==t.avail_in)return jr;n=t.state,n.mode===Qr&&(n.mode=tl),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,d=a,h=o,k=Yr;t:for(;;)switch(n.mode){case qr:if(0===n.wrap){n.mode=tl;break}for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0),u=0,c=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=rl;break}if((15&u)!==Xr){t.msg="unknown compression method",n.mode=rl;break}if(u>>>=4,c-=4,y=8+(15&u),0===n.wbits&&(n.wbits=y),y>15||y>n.wbits){t.msg="invalid window size",n.mode=rl;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>8&255,S[2]=u>>>16&255,S[3]=u>>>24&255,n.check=as(n.check,S,4,0)),u=0,c=0,n.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16184;case 16184:if(1024&n.flags){for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0)),u=0,c=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&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+f),y)),512&n.flags&&4&n.wrap&&(n.check=as(n.check,i,f,r)),a-=f,r+=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{y=i[r+f++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y))}while(y&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Qr;break;case 16189:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>=7&c,c-=7&c,n.mode=sl;break}for(;c<3;){if(0===a)break t;a--,u+=i[r++]<>>=1,c-=1,3&u){case 0:n.mode=16193;break;case 1:if(_l(n),n.mode=nl,e===Fr){u>>>=2,c-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=rl}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,u+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=rl;break}if(n.length=65535&u,u=0,c=0,n.mode=el,e===Fr)break t;case el:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>o&&(f=o),0===f)break t;s.set(i.subarray(r,r+f),l),a-=f,r+=f,o-=f,l+=f,n.length-=f;break}n.mode=Qr;break;case 16196:for(;c<14;){if(0===a)break t;a--,u+=i[r++]<>>=5,c-=5,n.ndist=1+(31&u),u>>>=5,c-=5,n.ncode=4+(15&u),u>>>=4,c-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=rl;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[T[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},k=Nr(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid code lengths set",n.mode=rl;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=_,c-=_,n.lens[n.have++]=w;else{if(16===w){for(E=_+2;c>>=_,c-=_,0===n.have){t.msg="invalid bit length repeat",n.mode=rl;break}y=n.lens[n.have-1],f=3+(3&u),u>>>=2,c-=2}else if(17===w){for(E=_+3;c>>=_,c-=_,y=0,f=3+(7&u),u>>>=3,c-=3}else{for(E=_+7;c>>=_,c-=_,y=0,f=11+(127&u),u>>>=7,c-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=rl;break}for(;f--;)n.lens[n.have++]=y}}if(n.mode===rl)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=rl;break}if(n.lenbits=9,M={bits:n.lenbits},k=Nr(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid literal/lengths set",n.mode=rl;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},k=Nr(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,k){t.msg="invalid distances set",n.mode=rl;break}if(n.mode=nl,e===Fr)break t;case nl:n.mode=il;case il:if(a>=6&&o>=258){t.next_out=l,t.avail_out=o,t.next_in=r,t.avail_in=a,n.hold=u,n.bits=c,Cr(t,h),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,n.mode===Qr&&(n.back=-1);break}for(n.back=0;z=n.lencode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,n.length=w,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Qr;break}if(64&g){t.msg="invalid literal/length code",n.mode=rl;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(E=n.extra;c>>=n.extra,c-=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,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,64&g){t.msg="invalid distance code",n.mode=rl;break}n.offset=w,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(E=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=rl;break}n.mode=16204;case 16204:if(0===o)break t;if(f=h-o,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=rl;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=s,p=l-n.offset,f=n.length;f>o&&(f=o),o-=f,n.length-=f;do{s[l++]=m[p++]}while(--f);0===n.length&&(n.mode=il);break;case 16205:if(0===o)break t;s[l++]=n.length,o--,n.mode=il;break;case sl:if(n.wrap){for(;c<32;){if(0===a)break t;a--,u|=i[r++]<{if(ol(t))return jr;let e=t.state;return e.window&&(e.window=null),t.state=null,Yr},yl=(t,e)=>{if(ol(t))return jr;const n=t.state;return 0==(2&n.wrap)?jr:(n.head=e,e.done=!1,Yr)},kl=(t,e)=>{const n=e.length;let i,s,r;return ol(t)?jr:(i=t.state,0!==i.wrap&&i.mode!==Jr?jr:i.mode===Jr&&(s=1,s=rs(s,e,n,0),s!==i.check)?Vr:(r=gl(t,e,n,n),r?(i.mode=16210,Gr):(i.havedict=1,Yr)))},zl=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 Sl=Object.prototype.toString,{Z_NO_FLUSH:Ml,Z_FINISH:El,Z_OK:Tl,Z_STREAM_END:Dl,Z_NEED_DICT:Al,Z_STREAM_ERROR:$l,Z_DATA_ERROR:Ol,Z_MEM_ERROR:Rl}=us;function Cl(t){this.options=hr({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 br,this.strm.avail_out=0;let n=bl(this.strm,e.windowBits);if(n!==Tl)throw new Error(os[n]);if(this.header=new zl,yl(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=_r(e.dictionary):"[object ArrayBuffer]"===Sl.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=kl(this.strm,e.dictionary),n!==Tl)))throw new Error(os[n])}function Pl(t,e){const n=new Cl(e);if(n.push(t),n.err)throw n.msg||os[n.err];return n.result}Cl.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,l,a;if(this.ended)return!1;for(l=e===~~e?e:!0===e?El:Ml,"[object ArrayBuffer]"===Sl.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(i),n.next_out=0,n.avail_out=i),r=vl(n,l),r===Al&&s&&(r=kl(n,s),r===Tl?r=vl(n,l):r===Ol&&(r=Al));n.avail_in>0&&r===Dl&&n.state.wrap>0&&0!==t[n.next_in];)wl(n),r=vl(n,l);switch(r){case $l:case Ol:case Al:case Rl:return this.onEnd(r),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||r===Dl))if("string"===this.options.to){let t=wr(n.output,n.next_out),e=n.next_out-t,s=gr(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(s)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Tl||0!==a){if(r===Dl)return r=xl(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Cl.prototype.onData=function(t){this.chunks.push(t)},Cl.prototype.onEnd=function(t){t===Tl&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ll={Inflate:Cl,inflate:Pl,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Pl(t,e)},ungzip:Pl,constants:us};const{Deflate:Ul,deflate:Zl,deflateRaw:Nl,gzip:Hl}=Or,{Inflate:Il,inflate:Fl,inflateRaw:Yl,ungzip:Bl}=Ll;var Wl=Bl,jl=n(484),Vl=n(178),Gl=n.n(Vl),Kl=n(387),Xl=n.n(Kl);jl.extend(Gl()),jl.extend(Xl());const ql=t=>(e,n)=>{new ResizeObserver((t=>{for(let n of t){let t=n.contentRect.height,i=n.contentRect.width;const s=e.root.querySelectorAll(".u-legend, .u-title");for(let e of s)t-=Math.floor(e.offsetHeight);e.setSize({width:i,height:t})}})).observe(t),t.appendChild(e.root),n()};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(t,e,n){var i,s,r,l,a;return{renderValue:function(o){if(void 0!==i&&i.destroy(),void 0!==s&&(s.destroy(),s=void 0),void 0!==r&&(t.removeChild(r),r=void 0),(l=o.config.options).width=e,l.height=n,a=o.config.data,o.use_gzipped_json){const t=atob(a),e=Uint8Array.from(t,(t=>t.charCodeAt(0))),n=Wl(e),i=(new TextDecoder).decode(n);a=JSON.parse(i)}if(o.config.zoomRanger){const u=o.config.zoomRanger,c=Math.max(50,n-(u.height||80)-4),d=Si(t,e,c,a,l,u,Jn);i=d.zoomed,s=d.ranger,r=d.wrap}else o.stacked?(l.hooks||(l.hooks={}),l.hooks.init=[t=>{[...t.root.querySelectorAll(".u-legend .u-series")].forEach(((e,n)=>{t.series[n]._hide&&(e.style.display="none")}))}],i=function(t,e,n,i,s,r,l,a){let{opts:o,data:u}=function(t,e,n,i){let s=function(t,e){return{scales:{x:{time:!0}},series:e}}(0,e),r=pi(i?i(n):n,(t=>!1));return s.bands=r.bands,s.cursor=s.cursor||{},s.cursor.dataIdx=(t,e,i,s)=>null===n[e][i]?null:i,s.series.forEach((t=>{t.value=(t,e,i,s)=>n[i][s],t.points=t.points||{},t.points.filter=(t,e,i,s)=>{if(i){let t=[];return n[e].forEach(((e,n)=>{null!==e&&t.push(n)})),t}}})),s.scales.y={range:(t,e,n)=>{let i=uPlot.rangeNum(e,n,.1,!0);return[i[0],i[1]]}},s.hooks={setSeries:[(t,e)=>{let i=pi(n,(e=>!t.series[e].show));t.delBand(null),i.bands.forEach((e=>t.addBand(e))),t.setData(i.data)}]},{opts:s,data:r.data}}(0,e,n,i);return o.title=t,o.width=s,o.height=r,o.hooks=Object.assign(o.hooks,l),console.log(o),new uPlot(o,u,a)}(l.title,l.series,a,null,e,n,l.hooks,ql(t))):i=new Jn(l,a,ql(t))},getWidget:function(){return i},resize:function(t,e){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(t){var e=fi(t.id);void 0!==e&&e[t.name].apply(null,t.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(t){var e=fi(t.id);void 0!==e&&e.setData(t.data)})),Shiny.addCustomMessageHandler("uplot-setSeries",(function(t){var e=fi(t.id);void 0!==e&&e.setSeries(t.seriesIdx,t.options)})),Shiny.addCustomMessageHandler("uplot-addSeries",(function(t){var e=fi(t.id);void 0!==e&&e.addSeries(t.options,t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-delSeries",(function(t){var e=fi(t.id);void 0!==e&&e.delSeries(t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-setScale",(function(t){var e=fi(t.id);void 0!==e&&e.setScale(t.scaleKey,t.limits)})),Shiny.addCustomMessageHandler("uplot-redraw",(function(t){var e=fi(t.id);void 0!==e&&e.redraw(t.rebuildPaths,t.recalcAxes)})))})();var s=window;for(var r in i)s[r]=i[r];i.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{var t={350:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(81),s=n.n(i),r=n(645),l=n.n(r)()(s());l.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=l},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var l={};if(i)for(var a=0;a0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},484:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",i="second",s="minute",r="hour",l="day",a="week",o="month",u="quarter",c="year",d="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},_=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},g={s:_,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+_(i,2,"0")+":"+_(s,2,"0")},m:function t(e,n){if(e.date()1)return t(l[0])}else{var a=e.name;b[a]=e,s=a}return!i&&s&&(w=s),s||!i&&w},k=function(t,e){if(x(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},z=g;z.l=y,z.i=x,z.w=function(t,e){return k(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function m(t){this.$L=y(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[v]=!0}var _=m.prototype;return _.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(z.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(f);if(i){var s=i[2]-1||0,r=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)):new Date(i[1],s,i[3]||1,i[4]||0,i[5]||0,i[6]||0,r)}}return new Date(e)}(t),this.init()},_.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},_.$utils=function(){return z},_.isValid=function(){return!(this.$d.toString()===h)},_.isSame=function(t,e){var n=k(t);return this.startOf(e)<=n&&n<=this.endOf(e)},_.isAfter=function(t,e){return k(t)=0&&(r[d]=parseInt(c,10))}var h=r[3],f=24===h?0:h,p=r[0]+"-"+r[1]+"-"+r[2]+" "+f+":"+r[4]+":"+r[5]+":000",m=+e;return(s.utc(p).valueOf()-(m-=m%1e3))/6e4},o=i.prototype;o.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),l=this.toDate(),a=l.toLocaleString("en-US",{timeZone:t}),o=Math.round((l-new Date(a))/1e3/60),u=15*-Math.round(l.getTimezoneOffset()/15)-o;if(Number(u)){if(n=s(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),e){var c=n.utcOffset();n=n.add(i-c,"minute")}}else n=this.utcOffset(0,e);return n.$x.$timezone=t,n},o.offsetName=function(t){var e=this.$x.$timezone||s.tz.guess(),n=l(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var u=o.startOf;o.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return u.call(this,t,e);var n=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return u.call(n,t,e).tz(this.$x.$timezone,!0)},s.tz=function(t,e,n){var i=n&&e,l=n||e||r,o=a(+s(),l);if("string"!=typeof t)return s(t).tz(l);var u=function(t,e,n){var i=t-60*e*1e3,s=a(i,n);if(e===s)return[i,e];var r=a(i-=60*(s-e)*1e3,n);return s===r?[i,s]:[t-60*Math.min(s,r)*1e3,Math.max(s,r)]}(s.utc(t,i).valueOf(),o,l),c=u[0],d=u[1],h=s(c).utcOffset(d);return h.$x.$timezone=l,h},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(t){r=t}}}()},178:function(t){t.exports=function(){"use strict";var t="minute",e=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(i,s,r){var l=s.prototype;r.utc=function(t){return new s({date:t,utc:!0,args:arguments})},l.utc=function(e){var n=r(this.toDate(),{locale:this.$L,utc:!0});return e?n.add(this.utcOffset(),t):n},l.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var a=l.parse;l.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),a.call(this,t)};var o=l.init;l.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var u=l.utcOffset;l.utcOffset=function(i,s){var r=this.$utils().u;if(r(i))return this.$u?0:r(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(t){void 0===t&&(t="");var i=t.match(e);if(!i)return null;var s=(""+i[0]).match(n)||["-",0,0],r=s[0],l=60*+s[1]+ +s[2];return 0===l?0:"+"===r?l:-l}(i),null===i))return this;var l=Math.abs(i)<=16?60*i:i,a=this;if(s)return a.$offset=l,a.$u=0===i,a;if(0!==i){var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(a=this.local().add(l+o,t)).$offset=l,a.$x.$localOffset=o}else a=this.utc();return a};var c=l.format;l.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},l.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var d=l.toDate;l.toDate=function(t){return"s"===t&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var h=l.diff;l.diff=function(t,e,n){if(t&&this.$u===t.$u)return h.call(this,t,e,n);var i=this.local(),s=r(t).local();return h.call(i,s,e,n)}}}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i{"use strict";var e={};t.exports=function(t,n){var i=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(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{"use strict";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)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";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(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.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 i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},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 i={};(()=>{"use strict";n.r(i),n.d(i,{candlestickPlugin:()=>zi,columnHighlightPlugin:()=>wi,createZoomRanger:()=>Si,dayjs:()=>jl,drawHLine:()=>vi,drawHRect:()=>ki,drawPoints:()=>bi,drawVLine:()=>xi,drawVRect:()=>yi,legendAsTooltipPlugin:()=>_i,tooltipPlugin:()=>mi,uPlot:()=>Jn,wheelZoomPlugin:()=>gi}),window.HTMLWidgets;const t="u-off",e="u-label",s="width",r="height",l="top",a="bottom",o="left",u="right",c="#000",d="#0000",h="mousemove",f="mousedown",p="mouseup",m="mouseenter",_="mouseleave",g="dblclick",w="change",b="dppxchange",v="--",x="undefined"!=typeof window,y=x?document:null,k=x?window:null,z=x?navigator:null;let S,M;function E(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function T(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function D(t,e,n){t.style[e]=n+"px"}function A(t,e,n,i){let s=y.createElement(t);return null!=e&&E(s,e),null!=n&&n.insertBefore(s,i),s}function $(t,e){return A("div",t,e)}const O=new WeakMap;function R(e,n,i,s,r){let l="translate("+n+"px,"+i+"px)";l!=O.get(e)&&(e.style.transform=l,O.set(e,l),n<0||i<0||n>s||i>r?E(e,t):T(e,t))}const C=new WeakMap;function P(t,e,n){let i=e+n;i!=C.get(t)&&(C.set(t,i),t.style.background=e,t.style.borderColor=n)}const L=new WeakMap;function U(t,e,n,i){let s=e+""+n;s!=L.get(t)&&(L.set(t,s),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=i?-e/2+"px":0,t.style.marginTop=i?-n/2+"px":0)}const Z={passive:!0},N={...Z,capture:!0};function H(t,e,n,i){e.addEventListener(t,n,i?N:Z)}function I(t,e,n,i){e.removeEventListener(t,n,Z)}function F(t,e,n,i){let s;n=n||0;let r=(i=i||e.length-1)<=2147483647;for(;i-n>1;)s=r?n+i>>1:it((n+i)/2),e[s]=e&&s<=n;s+=i)if(null!=t[s])return s;return-1}function B(t,e,n,i){let s=ut(t),r=ut(e);t==e&&(-1==s?(t*=n,e/=n):(t/=n,e*=n));let l=10==n?ct:dt,a=1==r?rt:it,o=(1==s?it:rt)(l(nt(t))),u=a(l(nt(e))),c=ot(n,o),d=ot(n,u);return 10==n&&(o<0&&(c=Et(c,-o)),u<0&&(d=Et(d,-u))),i||2==n?(t=c*s,e=d*r):(t=Mt(t,c),e=St(e,d)),[t,e]}function W(t,e,n,i){let s=B(t,e,n,i);return 0==t&&(s[0]=0),0==e&&(s[1]=0),s}x&&function t(){let e=devicePixelRatio;S!=e&&(S=e,M&&I(w,M,t),M=matchMedia(`(min-resolution: ${S-.001}dppx) and (max-resolution: ${S+.001}dppx)`),H(w,M,t),k.dispatchEvent(new CustomEvent(b)))}();const j={mode:3,pad:.1},V={pad:0,soft:null,mode:0},G={min:V,max:V};function K(t,e,n,i){return Ut(n)?q(t,e,n):(V.pad=n,V.soft=i?0:null,V.mode=i?3:0,q(t,e,G))}function X(t,e){return null==t?e:t}function q(t,e,n){let i=n.min,s=n.max,r=X(i.pad,0),l=X(s.pad,0),a=X(i.hard,-ft),o=X(s.hard,ft),u=X(i.soft,ft),c=X(s.soft,-ft),d=X(i.mode,0),h=X(s.mode,0),f=e-t,p=ct(f),m=at(nt(t),nt(e)),_=ct(m),g=nt(_-p);(f<1e-24||g>10)&&(f=0,0!=t&&0!=e||(f=1e-24,2==d&&u!=ft&&(r=0),2==h&&c!=-ft&&(l=0)));let w=f||m||1e3,b=ct(w),v=ot(10,it(b)),x=Et(Mt(t-w*(0==f?0==t?.1:1:r),v/10),24),y=t>=u&&(1==d||3==d&&x<=u||2==d&&x>=u)?u:ft,k=at(a,x=y?y:lt(y,x)),z=Et(St(e+w*(0==f?0==e?.1:1:l),v/10),24),S=e<=c&&(1==h||3==h&&z>=c||2==h&&z<=c)?c:-ft,M=lt(o,z>S&&e<=S?S:at(S,z));return k==M&&0==k&&(M=100),[k,M]}const J=new Intl.NumberFormat(x?z.language:"en-US"),Q=t=>J.format(t),tt=Math,et=tt.PI,nt=tt.abs,it=tt.floor,st=tt.round,rt=tt.ceil,lt=tt.min,at=tt.max,ot=tt.pow,ut=tt.sign,ct=tt.log10,dt=tt.log2,ht=(t,e=1)=>tt.asinh(t/e),ft=1/0;function pt(t){return 1+(0|ct((t^t>>31)-(t>>31)))}function mt(t,e,n){return lt(at(t,e),n)}function _t(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,yt=/\.\d*?(?=9{6,}|0{6,})/gm,kt=t=>{if(Pt(t)||Tt.has(t))return t;const e=`${t}`,n=e.match(yt);if(null==n)return t;let i=n[0].length-1;if(-1!=e.indexOf("e-")){let[t,n]=e.split("e");return+`${kt(t)}e${n}`}return Et(t,i)};function zt(t,e){return kt(Et(kt(t/e))*e)}function St(t,e){return kt(rt(kt(t/e))*e)}function Mt(t,e){return kt(it(kt(t/e))*e)}function Et(t,e=0){if(Pt(t))return t;let n=10**e,i=t*n*(1+Number.EPSILON);return st(i)/n}const Tt=new Map;function Dt(t){return((""+t).split(".")[1]||"").length}function At(t,e,n,i){let s=[],r=i.map(Dt);for(let l=e;l=0?0:e)+(l>=r[a]?0:r[a]),c=10==t?o:Et(o,u);s.push(c),Tt.set(c,u)}}return s}const $t={},Ot=[],Rt=[null,null],Ct=Array.isArray,Pt=Number.isInteger;function Lt(t){return"string"==typeof t}function Ut(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Zt(t){return null!=t&&"object"==typeof t}const Nt=Object.getPrototypeOf(Uint8Array),Ht="__proto__";function It(t,e=Ut){let n;if(Ct(t)){let i=t.find((t=>null!=t));if(Ct(i)||e(i)){n=Array(t.length);for(let i=0;ir){for(i=l-1;i>=0&&null==t[i];)t[i--]=null;for(i=l+1;iPromise.resolve().then(t):queueMicrotask,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],jt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Vt(t){return t.slice(0,3)}const Gt=jt.map(Vt),Kt=Wt.map(Vt),Xt={MMMM:Wt,MMM:Kt,WWWW:jt,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 Qt(t,e){e=e||Xt;let n,i=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(t);)i.push("{"==n[0][0]?Jt[n[1]]:n[0]);return t=>{let n="";for(let s=0;st%1==0,ne=[1,2,2.5,5],ie=At(10,-32,0,ne),se=At(10,0,32,ne),re=se.filter(ee),le=ie.concat(se),ae="{YYYY}",oe="\n"+ae,ue="{M}/{D}",ce="\n"+ue,de=ce+"/{YY}",he="{aa}",fe="{h}:{mm}"+he,pe="\n"+fe,me=":{ss}",_e=null;function ge(t){let e=1e3*t,n=60*e,i=60*n,s=24*i,r=30*s,l=365*s;return[(1==t?At(10,0,3,ne).filter(ee):At(10,-3,0,ne)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,i,2*i,3*i,4*i,6*i,8*i,12*i,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,l,2*l,5*l,10*l,25*l,50*l,100*l]),[[l,ae,_e,_e,_e,_e,_e,_e,1],[28*s,"{MMM}",oe,_e,_e,_e,_e,_e,1],[s,ue,oe,_e,_e,_e,_e,_e,1],[i,"{h}"+he,de,_e,ce,_e,_e,_e,1],[n,fe,de,_e,ce,_e,_e,_e,1],[e,me,de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1],[t,me+".{fff}",de+" "+fe,_e,ce+" "+fe,_e,pe,_e,1]],function(e){return(a,o,u,c,d,h)=>{let f=[],p=d>=l,m=d>=r&&d=s?s:d,l=b+(it(u)-it(g))+St(g-b,r);f.push(l);let p=e(l),m=p.getHours()+p.getMinutes()/n+p.getSeconds()/i,_=d/i,w=h/a.axes[o]._space;for(;l=Et(l+d,1==t?0:3),!(l>c);)if(_>1){let t=it(Et(m+_,6))%24,n=e(l).getHours()-t;n>1&&(n=-1),l-=n*i,m=(m+_)%24,Et((l-f[f.length-1])/d,3)*w>=.7&&f.push(l)}else f.push(l)}return f}}]}const[we,be,ve]=ge(1),[xe,ye,ke]=ge(.001);function ze(t,e){return t.map((t=>t.map(((n,i)=>0==i||8==i||null==n?n:e(1==i||0==t[8]?n:t[1]+n)))))}function Se(t,e){return(n,i,s,r,l)=>{let a,o,u,c,d,h,f=e.find((t=>l>=t[0]))||e[e.length-1];return i.map((e=>{let n=t(e),i=n.getFullYear(),s=n.getMonth(),r=n.getDate(),l=n.getHours(),p=n.getMinutes(),m=n.getSeconds(),_=i!=a&&f[2]||s!=o&&f[3]||r!=u&&f[4]||l!=c&&f[5]||p!=d&&f[6]||m!=h&&f[7]||f[1];return a=i,o=s,u=r,c=l,d=p,h=m,_(n)}))}}function Me(t,e,n){return new Date(t,e,n)}function Ee(t,e){return e(t)}function Te(t,e){return(n,i,s,r)=>null==r?v:e(t(i))}At(2,-53,53,[1]);const De={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:[]},Ae=[0,0];function $e(t,e,n,i=!0){return t=>{0==t.button&&(!i||t.target==e)&&n(t)}}function Oe(t,e,n,i=!0){return t=>{(!i||t.target==e)&&n(t)}}const Re={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Ae[0]=e,Ae[1]=n,Ae},points:{one:!1,show:function(t,e){let n=t.cursor.points,i=$(),l=n.size(t,e);D(i,s,l),D(i,r,l);let a=l/-2;D(i,"marginLeft",a),D(i,"marginTop",a);let o=n.width(t,e,l);return o&&D(i,"borderWidth",o),i},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:$e,mouseup:$e,click:$e,dblclick:$e,mousemove:Oe,mouseleave:Oe,mouseenter:Oe},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,i,s)=>i-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Ce={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Pe=Ft({},Ce,{filter:wt}),Le=Ft({},Pe,{size:10}),Ue=Ft({},Ce,{show:!1}),Ze='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"',Ne="bold "+Ze,He={show:!0,scale:"x",stroke:c,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Ne,side:2,grid:Pe,ticks:Le,border:Ue,font:Ze,lineGap:1.5,rotate:0},Ie={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function Fe(t,e,n,i,s){return e.map((t=>null==t?"":Q(t)))}function Ye(t,e,n,i,s,r,l){let a=[],o=Tt.get(s)||0;for(let t=n=l?n:Et(St(n,s),o);t<=i;t=Et(t+s,o))a.push(Object.is(t,-0)?0:t);return a}function Be(t,e,n,i,s,r,l){const a=[],o=t.scales[t.axes[e].scale].log,u=it((10==o?ct:dt)(n));s=ot(o,u),10==o&&(s=le[F(s,le)]);let c=n,d=s*o;10==o&&(d=le[F(d,le)]);do{a.push(c),c+=s,10!=o||Tt.has(c)||(c=Et(c,Tt.get(s))),c>=d&&(d=(s=c)*o,10==o&&(d=le[F(d,le)]))}while(c<=i);return a}function We(t,e,n,i,s,r,l){let a=t.scales[t.axes[e].scale].asinh,o=i>a?Be(t,e,at(a,n),i,s):[a],u=i>=0&&n<=0?[0]:[];return(n<-a?Be(t,e,at(a,-i),-n,s):[a]).reverse().map((t=>-t)).concat(u,o)}const je=/./,Ve=/[12357]/,Ge=/[125]/,Ke=/1/,Xe=(t,e,n,i)=>t.map(((t,s)=>4==e&&0==t||s%i==0&&n.test(t.toExponential()[t<0?1:0])?t:null));function qe(t,e,n,i,s){let r=t.axes[n],l=r.scale,a=t.scales[l],o=t.valToPos,u=r._space,c=o(10,l),d=o(9,l)-c>=u?je:o(7,l)-c>=u?Ve:o(5,l)-c>=u?Ge:Ke;if(d==Ke){let t=nt(o(1,l)-c);if(ts,sn={show:!0,auto:!0,sorted:0,gaps:nn,alpha:1,facets:[Ft({},en,{scale:"x"}),Ft({},en,{scale:"y"})]},rn={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:nn,alpha:1,points:{show:function(t,e){let{scale:n,idxs:i}=t.series[0],s=t._data[0],r=t.valToPos(s[i[0]],n,!0),l=t.valToPos(s[i[1]],n,!0),a=nt(l-r)/(t.series[e].points.space*S);return i[1]-i[0]<=a},filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function ln(t,e,n,i,s){return n/10}const an={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},on=Ft({},an,{time:!1,ori:1}),un={};function cn(t,e){let n=un[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,i,s,r,l,a){for(let o=0;o{let m=t.pxRound;const _=a.dir*(0==a.ori?1:-1),g=0==a.ori?xn:yn;let w,b;1==_?(w=n,b=i):(w=i,b=n);let v=m(u(e[w],a,f,d)),x=m(c(l[w],o,p,h)),y=m(u(e[b],a,f,d)),k=m(c(1==r?o.max:o.min,o,p,h)),z=new Path2D(s);return g(z,y,k),g(z,v,k),g(z,v,x),z}))}function mn(t,e,n,i,s,r){let l=null;if(t.length>0){l=new Path2D;const a=0==e?kn:zn;let o=n;for(let e=0;en[0]){let t=n[0]-o;t>0&&a(l,o,i,t,i+r),o=n[1]}}let u=n+s-o,c=10;u>0&&a(l,o,i-c/2,u,i+r+c)}return l}function _n(t,e,n,i,s,r,l){let a=[],o=t.length;for(let u=1==s?n:i;u>=n&&u<=i;u+=s)if(null===e[u]){let c=u,d=u;if(1==s)for(;++u<=i&&null===e[u];)d=u;else for(;--u>=n&&null===e[u];)d=u;let h=r(t[c]),f=d==c?h:r(t[d]),p=c-s;h=l<=0&&p>=0&&p=0&&m>=0&&m=h&&a.push([h,f])}return a}function gn(t){return 0==t?gt:1==t?st:e=>zt(e,t)}function wn(t){let e=0==t?bn:vn,n=0==t?(t,e,n,i,s,r)=>{t.arcTo(e,n,i,s,r)}:(t,e,n,i,s,r)=>{t.arcTo(n,e,s,i,r)},i=0==t?(t,e,n,i,s)=>{t.rect(e,n,i,s)}:(t,e,n,i,s)=>{t.rect(n,e,s,i)};return(t,s,r,l,a,o=0,u=0)=>{0==o&&0==u?i(t,s,r,l,a):(o=lt(o,l/2,a/2),u=lt(u,l/2,a/2),e(t,s+o,r),n(t,s+l,r,s+l,r+a,o),n(t,s+l,r+a,s,r+a,u),n(t,s,r+a,s,r,u),n(t,s,r,s+l,r,o),t.closePath())}}const bn=(t,e,n)=>{t.moveTo(e,n)},vn=(t,e,n)=>{t.moveTo(n,e)},xn=(t,e,n)=>{t.lineTo(e,n)},yn=(t,e,n)=>{t.lineTo(n,e)},kn=wn(0),zn=wn(1),Sn=(t,e,n,i,s,r)=>{t.arc(e,n,i,s,r)},Mn=(t,e,n,i,s,r)=>{t.arc(n,e,i,s,r)},En=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(e,n,i,s,r,l)},Tn=(t,e,n,i,s,r,l)=>{t.bezierCurveTo(n,e,s,i,l,r)};function Dn(t){return(t,e,n,i,s)=>dn(t,e,((e,r,l,a,o,u,c,d,h,f,p)=>{let m,_,{pxRound:g,points:w}=e;0==a.ori?(m=bn,_=Sn):(m=vn,_=Mn);const b=Et(w.width*S,3);let v=(w.size-w.width)/2*S,x=Et(2*v,3),y=new Path2D,k=new Path2D,{left:z,top:M,width:E,height:T}=t.bbox;kn(k,z-x,M-x,E+2*x,T+2*x);const D=t=>{if(null!=l[t]){let e=g(u(r[t],a,f,d)),n=g(c(l[t],o,p,h));m(y,e+v,n),_(y,e,n,v,0,2*et)}};if(s)s.forEach(D);else for(let t=n;t<=i;t++)D(t);return{stroke:b>0?y:null,fill:y,clip:k,flags:3}}))}function An(t){return(e,n,i,s,r,l)=>{i!=s&&(r!=i&&l!=i&&t(e,n,i),r!=s&&l!=s&&t(e,n,s),t(e,n,l))}}const $n=An(xn),On=An(yn);function Rn(t){const e=X(t?.alignGaps,0);return(t,n,i,s)=>dn(t,n,((r,l,a,o,u,c,d,h,f,p,m)=>{let _,g,w=r.pxRound,b=t=>w(c(t,o,p,h)),v=t=>w(d(t,u,m,f));0==o.ori?(_=xn,g=$n):(_=yn,g=On);const x=o.dir*(0==o.ori?1:-1),y={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=y.stroke;let z,S,M,E=ft,T=-ft,D=b(l[1==x?i:s]),A=Y(a,i,s,1*x),$=Y(a,i,s,-1*x),O=b(l[A]),R=b(l[$]),C=!1;for(let t=1==x?i:s;t>=i&&t<=s;t+=x){let e=b(l[t]),n=a[t];e==D?null!=n?(S=v(n),E==ft&&(_(k,e,S),z=S),E=lt(S,E),T=at(S,T)):null===n&&(C=!0):(E!=ft&&(g(k,D,E,T,z,S),M=D),null!=n?(S=v(n),_(k,e,S),E=T=z=S):(E=ft,T=-ft,null===n&&(C=!0)),D=e)}E!=ft&&E!=T&&M!=D&&g(k,D,E,T,z,S);let[P,L]=hn(t,n);if(null!=r.fill||0!=P){let e=y.fill=new Path2D(k),i=v(r.fillTo(t,n,r.min,r.max,P));_(e,R,i),_(e,O,i)}if(!r.spanGaps){let u=[];C&&u.push(..._n(l,a,i,s,x,b,e)),y.gaps=u=r.gaps(t,n,i,s,u),y.clip=mn(u,o.ori,h,f,p,m)}return 0!=L&&(y.band=2==L?[pn(t,n,i,s,k,-1),pn(t,n,i,s,k,1)]:pn(t,n,i,s,k,L)),y}))}function Cn(t,e,n,i,s,r,l=ft){if(t.length>1){let a=null;for(let o=0,u=1/0;o0!=i[t]>0?n[t]=0:(n[t]=3*(o[t-1]+o[t])/((2*o[t]+o[t-1])/i[t-1]+(o[t]+2*o[t-1])/i[t]),isFinite(n[t])||(n[t]=0));n[l-1]=i[l-2];for(let i=0;i{Jn.pxRatio=S})));const Zn=Rn(),Nn=Dn();function Hn(t,e,n,i){return(i?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map(((t,i)=>In(t,i,e,n)))}function In(t,e,n,i){return Ft({},0==e?n:i,t)}function Fn(t,e,n){return null==e?Rt:[e,n]}const Yn=Fn;function Bn(t,e,n){return null==e?Rt:K(e,n,.1,!0)}function Wn(t,e,n,i){return null==e?Rt:B(e,n,t.scales[i].log,!1)}const jn=Wn;function Vn(t,e,n,i){return null==e?Rt:W(e,n,t.scales[i].log,!1)}const Gn=Vn;function Kn(t,e,n,i,s){let r=at(pt(t),pt(e)),l=e-t,a=F(s/i*l,n);do{let t=n[a],e=i*t/l;if(e>=s&&r+(t<5?Tt.get(t):0)<=17)return[t,e]}while(++a(e=st((n=+i)*S))+"px")),e,n]}function qn(t){t.show&&[t.font,t.labelFont].forEach((t=>{let e=Et(t[2]*S,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e}))}function Jn(n,i,c){const w={mode:X(n.mode,1)},x=w.mode;function z(t,e){return((3==e.distr?ct(t>0?t:e.clamp(w,t,e.min,e.max,e.key)):4==e.distr?ht(t,e.asinh):100==e.distr?e.fwd(t):t)-e._min)/(e._max-e._min)}function M(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?1-s:s)}function O(t,e,n,i){let s=z(t,e);return i+n*(-1==e.dir?s:1-s)}function C(t,e,n,i){return 0==e.ori?M(t,e,n,i):O(t,e,n,i)}w.valToPosH=M,w.valToPosV=O;let L=!1;w.status=0;const Z=w.root=$("uplot");null!=n.id&&(Z.id=n.id),E(Z,n.class),n.title&&($("u-title",Z).textContent=n.title);const N=A("canvas"),Y=w.ctx=N.getContext("2d"),V=$("u-wrap",Z);H("click",V,(t=>{t.target===q&&(Pi!=$i||Li!=Oi)&&Wi.click(w,t)}),!0);const G=w.under=$("u-under",V);V.appendChild(N);const q=w.over=$("u-over",V),J=+X((n=It(n)).pxAlign,1),Q=gn(J);(n.plugins||[]).forEach((t=>{t.opts&&(n=t.opts(w,n)||n)}));const it=n.ms||.001,ut=w.series=1==x?Hn(n.series||[],Ie,rn,!1):(dt=n.series||[null],pt=sn,dt.map(((t,e)=>0==e?{}:Ft({},pt,t))));var dt,pt;const gt=w.axes=Hn(n.axes||[],He,tn,!0),yt=w.scales={},kt=w.bands=n.bands||[];kt.forEach((t=>{t.fill=_t(t.fill||null),t.dir=X(t.dir,-1)}));const St=2==x?ut[1].facets[0].scale:ut[0].scale,Mt={axes:function(){for(let t=0;toi[t])):b,x=2==p.distr?oi[b[1]]-oi[b[0]]:h,y=e.ticks,k=e.border,z=y.show?st(y.size*S):0,M=e._rotate*-et/180,E=Q(e._pos*S),T=E+(z+g)*d;i=0==r?T:0,n=1==r?T:0,fi(e.font[0],c,1==e.align?o:2==e.align?u:M>0?o:M<0?u:0==r?"center":3==s?u:o,M||1==r?"middle":2==s?l:a);let D=e.font[1]*e.lineGap,A=b.map((t=>Q(C(t,p,m,_)))),$=e._values;for(let t=0;t<$.length;t++){let e=$[t];if(null!=e){0==r?n=A[t]:i=A[t],e=""+e;let s=-1==e.indexOf("\n")?[e]:e.split(/\n/gm);for(let t=0;t0&&(ut.forEach(((t,e)=>{if(e>0&&t.show&&(_i(e,!1),_i(e,!0),null==t._paths)){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha);let n=2==x?[0,i[e][0].length-1]:function(t){let e=mt(Cn-1,0,Rn-1),n=mt(Pn+1,0,Rn-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n{if(e>0&&t.show){ai!=t.alpha&&(Y.globalAlpha=ai=t.alpha),null!=t._paths&&gi(e,!1);{let n=null!=t._paths?t._paths.gaps:null,i=t.points.show(w,e,Cn,Pn,n),s=t.points.filter(w,e,i,n);(i||s)&&(t.points._paths=t.points.paths(w,e,Cn,Pn,s),gi(e,!0))}1!=ai&&(Y.globalAlpha=ai=1),Es("drawSeries",e)}})))}},At=(n.drawOrder||["axes","series"]).map((t=>Mt[t]));function Pt(t){let e=yt[t];if(null==e){let i=(n.scales||$t)[t]||$t;if(null!=i.from)Pt(i.from),yt[t]=Ft({},yt[i.from],i,{key:t});else{e=yt[t]=Ft({},t==St?an:on,i),e.key=t;let n=e.time,s=e.range,r=Ct(s);if((t!=St||2==x&&!n)&&(!r||null!=s[0]&&null!=s[1]||(s={min:null==s[0]?j:{mode:1,hard:s[0],soft:s[0]},max:null==s[1]?j:{mode:1,hard:s[1],soft:s[1]}},r=!1),!r&&Ut(s))){let t=s;s=(e,n,i)=>null==n?Rt:K(n,i,t)}e.range=_t(s||(n?Yn:t==St?3==e.distr?jn:4==e.distr?Gn:Fn:3==e.distr?Wn:4==e.distr?Vn:Bn)),e.auto=_t(!r&&e.auto),e.clamp=_t(e.clamp||ln),e._min=e._max=null}}}Pt("x"),Pt("y"),1==x&&ut.forEach((t=>{Pt(t.scale)})),gt.forEach((t=>{Pt(t.scale)}));for(let t in n.scales)Pt(t);const Nt=yt[St],Ht=Nt.distr;let Yt,Wt;0==Nt.ori?(E(Z,"u-hz"),Yt=M,Wt=O):(E(Z,"u-vt"),Yt=O,Wt=M);const jt={};for(let t in yt){let e=yt[t];null==e.min&&null==e.max||(jt[t]={min:e.min,max:e.max},e.min=e.max=null)}const Vt=n.tzDate||(t=>new Date(st(t/it))),Gt=n.fmtDate||Qt,Kt=1==it?ve(Vt):ke(Vt),Xt=Se(Vt,ze(1==it?be:ye,Gt)),qt=Te(Vt,Ee("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Gt)),Jt=[],te=w.legend=Ft({},De,n.legend),ee=te.show,ne=te.markers;let ie,se,ae;te.idxs=Jt,ne.width=_t(ne.width),ne.dash=_t(ne.dash),ne.stroke=_t(ne.stroke),ne.fill=_t(ne.fill);let oe,ue=[],ce=[],de=!1,he={};if(te.live){const t=ut[1]?ut[1].values:null;de=null!=t,oe=de?t(w,1,0):{_:0};for(let t in oe)he[t]=v}if(ee)if(ie=A("table","u-legend",Z),ae=A("tbody",null,ie),te.mount(w,ie),de){se=A("thead",null,ie,ae);let t=A("tr",null,se);for(var fe in A("th",null,t),oe)A("th",e,t).textContent=fe}else E(ie,"u-inline"),te.live&&E(ie,"u-live");const pe={show:!0},me={show:!1},_e=new Map;function ge(t,e,n,i=!0){const s=_e.get(e)||{},r=wn.bind[t](w,e,n,i);r&&(H(t,e,s[t]=r),_e.set(e,s))}function Me(t,e,n){const i=_e.get(e)||{};for(let n in i)null!=t&&n!=t||(I(n,e,i[n]),delete i[n]);null==t&&_e.delete(e)}let Ae=0,$e=0,Oe=0,Ce=0,Pe=0,Le=0,Ue=Pe,Ze=Le,Ne=Oe,je=Ce,Ve=0,Ge=0,Ke=0,Xe=0;w.bbox={};let en=!1,nn=!1,un=!1,dn=!1,hn=!1,pn=!1;function mn(t,e,n){(n||t!=w.width||e!=w.height)&&_n(t,e),zi(!1),un=!0,nn=!0,Ii()}function _n(t,e){w.width=Ae=Oe=t,w.height=$e=Ce=e,Pe=Le=0,function(){let t=!1,e=!1,n=!1,i=!1;gt.forEach(((s,r)=>{if(s.show&&s._show){let{side:r,_size:l}=s,a=r%2,o=l+(null!=s.label?s.labelSize:0);o>0&&(a?(Oe-=o,3==r?(Pe+=o,i=!0):n=!0):(Ce-=o,0==r?(Le+=o,t=!0):e=!0))}})),Dn[0]=t,Dn[1]=n,Dn[2]=e,Dn[3]=i,Oe-=On[1]+On[3],Pe+=On[3],Ce-=On[2]+On[0],Le+=On[0]}(),function(){let t=Pe+Oe,e=Le+Ce,n=Pe,i=Le;function s(s,r){switch(s){case 1:return t+=r,t-r;case 2:return e+=r,e-r;case 3:return n-=r,n+r;case 0:return i-=r,i+r}}gt.forEach(((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=s(e,t._size),null!=t.label&&(t._lpos=s(e,t.labelSize))}}))}();let n=w.bbox;Ve=n.left=zt(Pe*S,.5),Ge=n.top=zt(Le*S,.5),Ke=n.width=zt(Oe*S,.5),Xe=n.height=zt(Ce*S,.5)}w.setSize=function({width:t,height:e}){mn(t,e)};const wn=w.cursor=Ft({},Re,{drag:{y:2==x}},n.cursor);if(null==wn.dataIdx){let t=wn.hover,e=t.skip=new Set(t.skip??[]);e.add(void 0);let n=t.prox=_t(t.prox),s=t.bias??=0;wn.dataIdx=(t,r,l,a)=>{if(0==r)return l;let o=l,u=n(t,r,l,a)??ft,c=u>=0&&u0;)e.has(p[t])||(n=t);if(0==s||1==s)for(t=l;null==i&&t++u&&(o=null);return o}}const bn=t=>{wn.event=t};wn.idxs=Jt,wn._lock=!1;let vn=wn.points;vn.show=_t(vn.show),vn.size=_t(vn.size),vn.stroke=_t(vn.stroke),vn.width=_t(vn.width),vn.fill=_t(vn.fill);const xn=w.focus=Ft({},n.focus||{alpha:.3},wn.focus),yn=xn.prox>=0,kn=yn&&vn.one;let zn=[],Sn=[],Mn=[];function En(t,e){let n=vn.show(w,e);if(n)return E(n,"u-cursor-pt"),E(n,t.class),R(n,-10,-10,Oe,Ce),q.insertBefore(n,zn[e]),n}function Tn(n,i){if(1==x||i>0){let t=1==x&&yt[n.scale].time,e=n.value;n.value=t?Lt(e)?Te(Vt,Ee(e,Gt)):e||qt:e||Qe,n.label=n.label||(t?"Time":"Value")}if(kn||i>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Zn||bt,n.fillTo=_t(n.fillTo||fn),n.pxAlign=+X(n.pxAlign,J),n.pxRound=gn(n.pxAlign),n.stroke=_t(n.stroke||null),n.fill=_t(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;let t=Et(1*(3+2*(at(1,n.width)||1)),3),e=n.points=Ft({},{size:t,width:at(1,.2*t),stroke:n.stroke,space:2*t,paths:Nn,_stroke:null,_fill:null},n.points);e.show=_t(e.show),e.filter=_t(e.filter),e.fill=_t(e.fill),e.stroke=_t(e.stroke),e.paths=_t(e.paths),e.pxAlign=n.pxAlign}if(ee){let s=function(n,i){if(0==i&&(de||!te.live||2==x))return Rt;let s=[],r=A("tr","u-series",ae,ae.childNodes[i]);E(r,n.class),n.show||E(r,t);let l=A("th",null,r);if(ne.show){let t=$("u-marker",l);if(i>0){let e=ne.width(w,i);e&&(t.style.border=e+"px "+ne.dash(w,i)+" "+ne.stroke(w,i)),t.style.background=ne.fill(w,i)}}let a=$(e,l);for(var o in a.textContent=n.label,i>0&&(ne.show||(a.style.color=n.width>0?ne.stroke(w,i):ne.fill(w,i)),ge("click",l,(t=>{if(wn._lock)return;bn(t);let e=ut.indexOf(n);if((t.ctrlKey||t.metaKey)!=te.isolate){let t=ut.some(((t,n)=>n>0&&n!=e&&t.show));ut.forEach(((n,i)=>{i>0&&Ji(i,t?i==e?pe:me:pe,!0,Ds.setSeries)}))}else Ji(e,{show:!n.show},!0,Ds.setSeries)}),!1),yn&&ge(m,l,(t=>{wn._lock||(bn(t),Ji(ut.indexOf(n),ns,!0,Ds.setSeries))}),!1)),oe){let t=A("td","u-value",r);t.textContent="--",s.push(t)}return[r,s]}(n,i);ue.splice(i,0,s[0]),ce.splice(i,0,s[1]),te.values.push(null)}if(wn.show){Jt.splice(i,0,null);let t=null;kn?0==i&&(t=En(n,i)):i>0&&(t=En(n,i)),zn.splice(i,0,t),Sn.splice(i,0,0),Mn.splice(i,0,0)}Es("addSeries",i)}w.addSeries=function(t,e){e=null==e?ut.length:e,t=1==x?In(t,e,Ie,rn):In(t,e,{},sn),ut.splice(e,0,t),Tn(ut[e],e)},w.delSeries=function(t){if(ut.splice(t,1),ee){te.values.splice(t,1),ce.splice(t,1);let e=ue.splice(t,1)[0];Me(null,e.firstChild),e.remove()}wn.show&&(Jt.splice(t,1),zn.splice(t,1)[0].remove(),Sn.splice(t,1),Mn.splice(t,1)),Es("delSeries",t)};const Dn=[!1,!1,!1,!1];function An(t,e,n,i){let[s,r,l,a]=n,o=e%2,u=0;return 0==o&&(a||r)&&(u=0==e&&!s||2==e&&!l?st(He.size/3):0),1==o&&(s||l)&&(u=1==e&&!r||3==e&&!a?st(tn.size/2):0),u}const $n=w.padding=(n.padding||[An,An,An,An]).map((t=>_t(X(t,An)))),On=w._padding=$n.map(((t,e)=>t(w,e,Dn,0)));let Rn,Cn=null,Pn=null;const Un=1==x?ut[0].idxs:null;let Jn,Qn,ti,ei,ni,ii,si,ri,li,ai,oi=null,ui=!1;function ci(t,e){if(i=null==t?[]:t,w.data=w._data=i,2==x){Rn=0;for(let t=1;t=0,pn=!0,Ii()}}function di(){let t,e;ui=!0,1==x&&(Rn>0?(Cn=Un[0]=0,Pn=Un[1]=Rn-1,t=i[0][Cn],e=i[0][Pn],2==Ht?(t=Cn,e=Pn):t==e&&(3==Ht?[t,e]=B(t,t,Nt.log,!1):4==Ht?[t,e]=W(t,t,Nt.log,!1):Nt.time?e=t+st(86400/it):[t,e]=K(t,e,.1,!0))):(Cn=Un[0]=t=null,Pn=Un[1]=e=null)),qi(St,t,e)}function hi(t,e,n,i,s,r){t??=d,n??=Ot,i??="butt",s??=d,r??="round",t!=Jn&&(Y.strokeStyle=Jn=t),s!=Qn&&(Y.fillStyle=Qn=s),e!=ti&&(Y.lineWidth=ti=e),r!=ni&&(Y.lineJoin=ni=r),i!=ii&&(Y.lineCap=ii=i),n!=ei&&Y.setLineDash(ei=n)}function fi(t,e,n,i){e!=Qn&&(Y.fillStyle=Qn=e),t!=si&&(Y.font=si=t),n!=ri&&(Y.textAlign=ri=n),i!=li&&(Y.textBaseline=li=i)}function pi(t,e,n,i,s=0){if(i.length>0&&t.auto(w,ui)&&(null==e||null==e.min)){let e=X(Cn,0),r=X(Pn,i.length-1),l=null==n.min?3==t.distr?function(t,e,n){let i=ft,s=-ft;for(let r=e;r<=n;r++){let e=t[r];null!=e&&e>0&&(es&&(s=e))}return[i,s]}(i,e,r):function(t,e,n,i){let s=ft,r=-ft;if(1==i)s=t[e],r=t[n];else if(-1==i)s=t[n],r=t[e];else for(let i=e;i<=n;i++){let e=t[i];null!=e&&(er&&(r=e))}return[s,r]}(i,e,r,s):[n.min,n.max];t.min=lt(t.min,n.min=l[0]),t.max=at(t.max,n.max=l[1])}}w.setData=ci;const mi={min:null,max:null};function _i(t,e){let n=e?ut[t].points:ut[t];n._stroke=n.stroke(w,t),n._fill=n.fill(w,t)}function gi(t,e){let n=e?ut[t].points:ut[t],{stroke:s,fill:r,clip:l,flags:a,_stroke:o=n._stroke,_fill:u=n._fill,_width:c=n.width}=n._paths;c=Et(c*S,3);let d=null,h=c%2/2;e&&null==u&&(u=c>0?"#fff":o);let f=1==n.pxAlign&&h>0;if(f&&Y.translate(h,h),!e){let t=Ve-c/2,e=Ge-c/2,n=Ke+c,i=Xe+c;d=new Path2D,d.rect(t,e,n,i)}e?wi(o,c,n.dash,n.cap,u,s,r,a,l):function(t,e,n,s,r,l,a,o,u,c,d){let h=!1;0!=u&&kt.forEach(((f,p)=>{if(f.series[0]==t){let t,m=ut[f.series[1]],_=i[f.series[1]],g=(m._paths||$t).band;Ct(g)&&(g=1==f.dir?g[0]:g[1]);let b=null;m.show&&g&&function(t,e,n){for(e=X(e,0),n=X(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(_,Cn,Pn)?(b=f.fill(w,p)||l,t=m._paths.clip):g=null,wi(e,n,s,r,b,a,o,u,c,d,t,g),h=!0}})),h||wi(e,n,s,r,l,a,o,u,c,d)}(t,o,c,n.dash,n.cap,u,s,r,a,d,l),f&&Y.translate(-h,-h)}function wi(t,e,n,i,s,r,l,a,o,u,c,d){hi(t,e,n,i,s),(o||u||d)&&(Y.save(),o&&Y.clip(o),u&&Y.clip(u)),d?3==(3&a)?(Y.clip(d),c&&Y.clip(c),vi(s,l),bi(t,r,e)):2&a?(vi(s,l),Y.clip(d),bi(t,r,e)):1&a&&(Y.save(),Y.clip(d),c&&Y.clip(c),vi(s,l),Y.restore(),bi(t,r,e)):(vi(s,l),bi(t,r,e)),(o||u||d)&&Y.restore()}function bi(t,e,n){n>0&&(e instanceof Map?e.forEach(((t,e)=>{Y.strokeStyle=Jn=e,Y.stroke(t)})):null!=e&&t&&Y.stroke(e))}function vi(t,e){e instanceof Map?e.forEach(((t,e)=>{Y.fillStyle=Qn=e,Y.fill(t)})):null!=e&&t&&Y.fill(e)}function xi(t,e,n,i,s,r,l,a,o,u){let c=l%2/2;1==J&&Y.translate(c,c),hi(a,l,o,u,a),Y.beginPath();let d,h,f,p,m=s+(0==i||3==i?-r:r);0==n?(h=s,p=m):(d=s,f=m);for(let i=0;i{if(!n.show)return;let s=yt[n.scale];if(null==s.min)return void(n._show&&(e=!1,n._show=!1,zi(!1)));n._show||(e=!1,n._show=!0,zi(!1));let r=n.side,l=r%2,{min:a,max:o}=s,[u,c]=function(t,e,n,i){let s,r=gt[t];if(i<=0)s=[0,0];else{let l=r._space=r.space(w,t,e,n,i);s=Kn(e,n,r._incrs=r.incrs(w,t,e,n,i,l),i,l)}return r._found=s}(i,a,o,0==l?Oe:Ce);if(0==c)return;let d=2==s.distr,h=n._splits=n.splits(w,i,a,o,u,c,d),f=2==s.distr?h.map((t=>oi[t])):h,p=2==s.distr?oi[h[1]]-oi[h[0]]:u,m=n._values=n.values(w,n.filter(w,f,i,c,p),i,c,p);n._rotate=2==r?n.rotate(w,m,i,c):0;let _=n._size;n._size=rt(n.size(w,m,i,t)),null!=_&&n._size!=_&&(e=!1)})),e}function ki(t){let e=!0;return $n.forEach(((n,i)=>{let s=n(w,i,Dn,t);s!=On[i]&&(e=!1),On[i]=s})),e}function zi(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 Si,Mi,Ei,Ti,Di,Ai,$i,Oi,Ri,Ci,Pi,Li,Ui=!1,Zi=!1,Ni=[];function Hi(){Zi=!1;for(let t=0;t0){ut.forEach(((e,n)=>{if(1==x){let s=e.scale,r=jt[s];if(null==r)return;let l=t[s];if(0==n){let t=l.range(w,l.min,l.max,s);l.min=t[0],l.max=t[1],Cn=F(l.min,i[0]),Pn=F(l.max,i[0]),Pn-Cn>1&&(i[0][Cn]l.max&&Pn--),e.min=oi[Cn],e.max=oi[Pn]}else e.show&&e.auto&&pi(l,r,e,i[n],e.sorted);e.idxs[0]=Cn,e.idxs[1]=Pn}else if(n>0&&e.show&&e.auto){let[s,r]=e.facets,l=s.scale,a=r.scale,[o,u]=i[n],c=t[l],d=t[a];null!=c&&pi(c,jt[l],s,o,s.sorted),null!=d&&pi(d,jt[a],r,u,r.sorted),e.min=r.min,e.max=r.max}}));for(let e in t){let n=t[e],i=jt[e];if(null==n.from&&(null==i||null==i.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 i=t[n.from];if(null==i.min)n.min=n.max=null;else{let t=n.range(w,i.min,i.max,e);n.min=t[0],n.max=t[1]}}}let e={},n=!1;for(let i in t){let s=t[i],r=yt[i];if(r.min!=s.min||r.max!=s.max){r.min=s.min,r.max=s.max;let t=r.distr;r._min=3==t?ct(r.min):4==t?ht(r.min,r.asinh):100==t?r.fwd(r.min):r.min,r._max=3==t?ct(r.max):4==t?ht(r.max,r.asinh):100==t?r.fwd(r.max):r.max,e[i]=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)un=!0,Es("setScale",t);wn.show&&wn.left>=0&&(dn=pn=!0)}for(let t in jt)jt[t]=null}(),en=!1),un&&(function(){let t=!1,e=0;for(;!t;){e++;let n=yi(e),i=ki(e);t=3==e||n&&i,t||(_n(w.width,w.height),nn=!0)}}(),un=!1),nn){if(D(G,o,Pe),D(G,l,Le),D(G,s,Oe),D(G,r,Ce),D(q,o,Pe),D(q,l,Le),D(q,s,Oe),D(q,r,Ce),D(V,s,Ae),D(V,r,$e),N.width=st(Ae*S),N.height=st($e*S),gt.forEach((({_el:e,_show:n,_size:i,_pos:s,side:r})=>{if(null!=e)if(n){let n=r%2==1;D(e,n?"left":"top",s-(3===r||0===r?i:0)),D(e,n?"width":"height",i),D(e,n?"top":"left",n?Le:Pe),D(e,n?"height":"width",n?Ce:Oe),T(e,t)}else E(e,t)})),Jn=Qn=ti=ni=ii=si=ri=li=ei=null,ai=1,hs(!0),Pe!=Ue||Le!=Ze||Oe!=Ne||Ce!=je){zi(!1);let t=Oe/Ne,e=Ce/je;if(wn.show&&!dn&&wn.left>=0){wn.left*=t,wn.top*=e,Ei&&R(Ei,st(wn.left),0,Oe,Ce),Ti&&R(Ti,0,st(wn.top),Oe,Ce);for(let n=0;n=0&&Gi.width>0){Gi.left*=t,Gi.width*=t,Gi.top*=e,Gi.height*=e;for(let t in ms)D(Ki,t,Gi[t])}Ue=Pe,Ze=Le,Ne=Oe,je=Ce}Es("setSize"),nn=!1}Ae>0&&$e>0&&(Y.clearRect(0,0,N.width,N.height),Es("drawClear"),At.forEach((t=>t())),Es("draw")),Gi.show&&hn&&(Xi(Gi),hn=!1),wn.show&&dn&&(cs(null,!0,!1),dn=!1),te.show&&te.live&&pn&&(os(),pn=!1),L||(L=!0,w.status=1,Es("ready")),ui=!1,Ui=!1}function Yi(t,e){let n=yt[t];if(null==n.from){if(0==Rn){let i=n.range(w,e.min,e.max,t);e.min=i[0],e.max=i[1]}if(e.min>e.max){let t=e.min;e.min=e.max,e.max=t}if(Rn>1&&null!=e.min&&null!=e.max&&e.max-e.min<1e-16)return;t==St&&2==n.distr&&Rn>0&&(e.min=F(e.min,i[0]),e.max=F(e.max,i[0]),e.min==e.max&&e.max++),jt[t]=e,en=!0,Ii()}}w.batch=function(t,e=!1){Ui=!0,Zi=e,t(w),Fi(),e&&Ni.length>0&&queueMicrotask(Hi)},w.redraw=(t,e)=>{un=e||!1,!1!==t?qi(St,Nt.min,Nt.max):Ii()},w.setScale=Yi;let Bi=!1;const Wi=wn.drag;let ji=Wi.x,Vi=Wi.y;wn.show&&(wn.x&&(Si=$("u-cursor-x",q)),wn.y&&(Mi=$("u-cursor-y",q)),0==Nt.ori?(Ei=Si,Ti=Mi):(Ei=Mi,Ti=Si),Pi=wn.left,Li=wn.top);const Gi=w.select=Ft({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),Ki=Gi.show?$("u-select",Gi.over?q:G):null;function Xi(t,e){if(Gi.show){for(let e in t)Gi[e]=t[e],e in ms&&D(Ki,e,t[e]);!1!==e&&Es("setSelect")}}function qi(t,e,n){Yi(t,{min:e,max:n})}function Ji(e,n,i,s){null!=n.focus&&function(t){if(t!=es){let e=null==t,n=1!=xn.alpha;ut.forEach(((i,s)=>{if(1==x||s>0){let r=e||0==s||s==t;i._focus=e?null:r,n&&function(t,e){ut[t].alpha=e,wn.show&&zn[t]&&(zn[t].style.opacity=e),ee&&ue[t]&&(ue[t].style.opacity=e)}(s,r?1:xn.alpha)}})),es=t,n&&Ii()}}(e),null!=n.show&&ut.forEach(((i,s)=>{s>0&&(e==s||null==e)&&(i.show=n.show,function(e,n){let i=ut[e],s=ee?ue[e]:null;i.show?s&&T(s,t):(s&&E(s,t),R(kn?zn[0]:zn[e],-10,-10,Oe,Ce))}(s,n.show),2==x?(qi(i.facets[0].scale,null,null),qi(i.facets[1].scale,null,null)):qi(i.scale,null,null),Ii())})),!1!==i&&Es("setSeries",e,n),s&&Os("setSeries",w,e,n)}let Qi,ts,es;w.setSelect=Xi,w.setSeries=Ji,w.addBand=function(t,e){t.fill=_t(t.fill||null),t.dir=X(t.dir,-1),e=null==e?kt.length:e,kt.splice(e,0,t)},w.setBand=function(t,e){Ft(kt[t],e)},w.delBand=function(t){null==t?kt.length=0:kt.splice(t,1)};const ns={focus:!0};function is(t,e,n){let i=yt[e];n&&(t=t/S-(1==i.ori?Le:Pe));let s=Oe;1==i.ori&&(s=Ce,t=s-t),-1==i.dir&&(t=s-t);let r=i._min,l=r+(i._max-r)*(t/s),a=i.distr;return 3==a?ot(10,l):4==a?((t,e=1)=>tt.sinh(t)*e)(l,i.asinh):100==a?i.bwd(l):l}function ss(t,e){D(Ki,o,Gi.left=t),D(Ki,s,Gi.width=e)}function rs(t,e){D(Ki,l,Gi.top=t),D(Ki,r,Gi.height=e)}ee&&yn&&ge(_,ie,(t=>{wn._lock||(bn(t),null!=es&&Ji(null,ns,!0,Ds.setSeries))})),w.valToIdx=t=>F(t,i[0]),w.posToIdx=function(t,e){return F(is(t,St,e),i[0],Cn,Pn)},w.posToVal=is,w.valToPos=(t,e,n)=>0==yt[e].ori?M(t,yt[e],n?Ke:Oe,n?Ve:0):O(t,yt[e],n?Xe:Ce,n?Ge:0),w.setCursor=(t,e,n)=>{Pi=t.left,Li=t.top,cs(null,e,n)};let ls=0==Nt.ori?ss:rs,as=1==Nt.ori?ss:rs;function os(t,e){if(null!=t&&(t.idxs?t.idxs.forEach(((t,e)=>{Jt[e]=t})):void 0!==t.idx&&Jt.fill(t.idx),te.idx=Jt[0]),ee&&te.live){for(let t=0;t0||1==x&&!de)&&us(t,Jt[t]);!function(){if(ee&&te.live)for(let t=2==x?1:0;tPn;Qi=ft,ts=null;let l=0==Nt.ori?Oe:Ce,a=1==Nt.ori?Oe:Ce;if(Pi<0||0==Rn||r){s=wn.idx=null;for(let t=0;t0&&p.show){let e=null==b?-10:Wt(b,1==x?yt[p.scale]:yt[p.facets[1].scale],a,0);if(yn&&null!=b){let n=1==Nt.ori?Pi:Li,i=nt(xn.dist(w,t,g,e,n));if(i=0?1:-1;r==(b>=0?1:-1)&&(1==r?1==e?b>=s:b<=s:1==e?b<=s:b>=s)&&(Qi=i,ts=t)}else Qi=i,ts=t}}if(pn||kn){let n,i;0==Nt.ori?(n=v,i=e):(n=e,i=v);let s,l,a,p,m,_,g=!0,b=vn.bbox;if(null!=b){g=!1;let e=b(w,t);a=e.left,p=e.top,s=e.width,l=e.height}else a=n,p=i,s=l=vn.size(w,t);if(_=vn.fill(w,t),m=vn.stroke(w,t),kn)t==ts&&Qi<=xn.prox&&(r=a,o=p,u=s,c=l,d=g,h=_,f=m);else{let e=zn[t];null!=e&&(Sn[t]=a,Mn[t]=p,U(e,s,l,g),P(e,_,m),R(e,rt(a),rt(p),Oe,Ce))}}}}if(kn){let t=xn.prox,e=null==es?Qi<=t:Qi>t||ts!=es;if(pn||e){let t=zn[0];Sn[0]=r,Mn[0]=o,U(t,u,c,d),P(t,h,f),R(t,rt(r),rt(o),Oe,Ce)}}}if(Gi.show&&Bi)if(null!=t){let[e,n]=Ds.scales,[i,s]=Ds.match,[r,o]=t.cursor.sync.scales,u=t.cursor.drag;if(ji=u._x,Vi=u._y,ji||Vi){let u,c,d,h,f,{left:p,top:m,width:_,height:g}=t.select,w=t.scales[r].ori,b=t.posToVal,v=null!=e&&i(e,r),x=null!=n&&s(n,o);v&&ji?(0==w?(u=p,c=_):(u=m,c=g),d=yt[e],h=Yt(b(u,r),d,l,0),f=Yt(b(u+c,r),d,l,0),ls(lt(h,f),nt(f-h))):ls(0,l),x&&Vi?(1==w?(u=p,c=_):(u=m,c=g),d=yt[n],h=Wt(b(u,o),d,a,0),f=Wt(b(u+c,o),d,a,0),as(lt(h,f),nt(f-h))):as(0,a)}else _s()}else{let t=nt(Ri-Di),e=nt(Ci-Ai);if(1==Nt.ori){let n=t;t=e,e=n}ji=Wi.x&&t>=Wi.dist,Vi=Wi.y&&e>=Wi.dist;let n,i,s=Wi.uni;null!=s?ji&&Vi&&(ji=t>=s,Vi=e>=s,ji||Vi||(e>t?Vi=!0:ji=!0)):Wi.x&&Wi.y&&(ji||Vi)&&(ji=Vi=!0),ji&&(0==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),ls(lt(n,i),nt(i-n)),Vi||as(0,a)),Vi&&(1==Nt.ori?(n=$i,i=Pi):(n=Oi,i=Li),as(lt(n,i),nt(i-n)),ji||ls(0,l)),ji||Vi||(ls(0,0),as(0,0))}if(Wi._x=ji,Wi._y=Vi,null==t){if(n){if(null!=As){let[t,e]=Ds.scales;Ds.values[0]=null!=t?is(0==Nt.ori?Pi:Li,t):null,Ds.values[1]=null!=e?is(1==Nt.ori?Pi:Li,e):null}Os(h,w,Pi,Li,Oe,Ce,s)}if(yn){let t=n&&Ds.setSeries,e=xn.prox;null==es?Qi<=e&&Ji(ts,ns,!0,t):Qi>e?Ji(null,ns,!0,t):ts!=es&&Ji(ts,ns,!0,t)}}pn&&(te.idx=s,os()),!1!==e&&Es("setCursor")}w.setLegend=os;let ds=null;function hs(t=!1){t?ds=null:(ds=q.getBoundingClientRect(),Es("syncRect",ds))}function fs(t,e,n,i,s,r,l){wn._lock||Bi&&null!=t&&0==t.movementX&&0==t.movementY||(ps(t,e,n,i,s,r,0,!1,null!=t),null!=t?cs(null,!0,!0):cs(e,!0,!1))}function ps(t,e,n,i,s,r,l,a,o){if(null==ds&&hs(!1),bn(t),null!=t)n=t.clientX-ds.left,i=t.clientY-ds.top;else{if(n<0||i<0)return Pi=-10,void(Li=-10);let[t,l]=Ds.scales,a=e.cursor.sync,[o,u]=a.values,[c,d]=a.scales,[h,f]=Ds.match,p=e.axes[0].side%2==1,m=0==Nt.ori?Oe:Ce,_=1==Nt.ori?Oe:Ce,g=p?r:s,w=p?s:r,b=p?i:n,v=p?n:i;if(n=null!=c?h(t,c)?C(o,yt[t],m,0):-10:m*(b/g),i=null!=d?f(l,d)?C(u,yt[l],_,0):-10:_*(v/w),1==Nt.ori){let t=n;n=i,i=t}}o&&((n<=1||n>=Oe-1)&&(n=zt(n,Oe)),(i<=1||i>=Ce-1)&&(i=zt(i,Ce))),a?(Di=n,Ai=i,[$i,Oi]=wn.move(w,n,i)):(Pi=n,Li=i)}Object.defineProperty(w,"rect",{get:()=>(null==ds&&hs(!1),ds)});const ms={width:0,height:0,left:0,top:0};function _s(){Xi(ms,!1)}let gs,ws,bs,vs;function xs(t,e,n,i,s,r,l){Bi=!0,ji=Vi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!0,!1),null!=t&&(ge(p,y,ys,!1),Os(f,w,$i,Oi,Oe,Ce,null));let{left:a,top:o,width:u,height:c}=Gi;gs=a,ws=o,bs=u,vs=c,_s()}function ys(t,e,n,i,s,r,l){Bi=Wi._x=Wi._y=!1,ps(t,e,n,i,s,r,0,!1,!0);let{left:a,top:o,width:u,height:c}=Gi,d=u>0||c>0,h=gs!=a||ws!=o||bs!=u||vs!=c;if(d&&h&&Xi(Gi),Wi.setScale&&d&&h){let t=a,e=u,n=o,i=c;if(1==Nt.ori&&(t=o,e=c,n=a,i=u),ji&&qi(St,is(t,St),is(t+e,St)),Vi)for(let t in yt){let e=yt[t];t!=St&&null==e.from&&e.min!=ft&&qi(t,is(n+i,t),is(n,t))}_s()}else wn.lock&&(wn._lock=!wn._lock,cs(null,!0,!1));null!=t&&(Me(p,y),Os(p,w,Pi,Li,Oe,Ce,null))}function ks(t,e,n,i,s,r,l){wn._lock||(bn(t),di(),_s(),null!=t&&Os(g,w,Pi,Li,Oe,Ce,null))}function zs(){gt.forEach(qn),mn(w.width,w.height,!0)}H(b,k,zs);const Ss={};Ss.mousedown=xs,Ss.mousemove=fs,Ss.mouseup=ys,Ss.dblclick=ks,Ss.setSeries=(t,e,n,i)=>{-1!=(n=(0,Ds.match[2])(w,e,n))&&Ji(n,i,!0,!1)},wn.show&&(ge(f,q,xs),ge(h,q,fs),ge(m,q,(t=>{bn(t),hs(!1)})),ge(_,q,(function(t,e,n,i,s,r,l){if(wn._lock)return;bn(t);let a=Bi;if(Bi){let t,e,n=!0,i=!0,s=10;0==Nt.ori?(t=ji,e=Vi):(t=Vi,e=ji),t&&e&&(n=Pi<=s||Pi>=Oe-s,i=Li<=s||Li>=Ce-s),t&&n&&(Pi=Pi<$i?0:Oe),e&&i&&(Li=Li{t.call(null,w,e,n)}))}(n.plugins||[]).forEach((t=>{for(let e in t.hooks)Ms[e]=(Ms[e]||[]).concat(t.hooks[e])}));const Ts=(t,e,n)=>n,Ds=Ft({key:null,setSeries:!1,filters:{pub:vt,sub:vt},scales:[St,ut[1]?ut[1].scale:null],match:[xt,xt,Ts],values:[null,null]},wn.sync);2==Ds.match.length&&Ds.match.push(Ts),wn.sync=Ds;const As=Ds.key,$s=cn(As);function Os(t,e,n,i,s,r,l){Ds.filters.pub(t,e,n,i,s,r,l)&&$s.pub(t,e,n,i,s,r,l)}function Rs(){Es("init",n,i),ci(i||n.data,!1),jt[St]?Yi(St,jt[St]):di(),hn=Gi.show&&(Gi.width>0||Gi.height>0),dn=pn=!0,mn(n.width,n.height)}return $s.sub(w),w.pub=function(t,e,n,i,s,r,l){Ds.filters.sub(t,e,n,i,s,r,l)&&Ss[t](null,e,n,i,s,r,l)},w.destroy=function(){$s.unsub(w),Ln.delete(w),_e.clear(),I(b,k,zs),Z.remove(),ie?.remove(),Es("destroy")},ut.forEach(Tn),gt.forEach((function(t,e){if(t._show=t.show,t.show){let n=t.side%2,i=yt[t.scale];null==i&&(t.scale=n?ut[1].scale:St,i=yt[t.scale]);let s=i.time;t.size=_t(t.size),t.space=_t(t.space),t.rotate=_t(t.rotate),Ct(t.incrs)&&t.incrs.forEach((t=>{!Tt.has(t)&&Tt.set(t,Dt(t))})),t.incrs=_t(t.incrs||(2==i.distr?re:s?1==it?we:xe:le)),t.splits=_t(t.splits||(s&&1==i.distr?Kt:3==i.distr?Be:4==i.distr?We:Ye)),t.stroke=_t(t.stroke),t.grid.stroke=_t(t.grid.stroke),t.ticks.stroke=_t(t.ticks.stroke),t.border.stroke=_t(t.border.stroke);let r=t.values;t.values=Ct(r)&&!Ct(r[0])?_t(r):s?Ct(r)?Se(Vt,ze(r,Gt)):Lt(r)?function(t,e){let n=Qt(e);return(e,i,s,r,l)=>i.map((e=>n(t(e))))}(Vt,r):r||Xt:r||Fe,t.filter=_t(t.filter||(i.distr>=3&&10==i.log?qe:3==i.distr&&2==i.log?Je:wt)),t.font=Xn(t.font),t.labelFont=Xn(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&&(Dn[e]=!0,t._el=$("u-axis",V))}})),c?c instanceof HTMLElement?(c.appendChild(Z),Rs()):c(w,Rs):Rs(),w}Jn.assign=Ft,Jn.fmtNum=Q,Jn.rangeNum=K,Jn.rangeLog=B,Jn.rangeAsinh=W,Jn.orient=dn,Jn.pxRatio=S,Jn.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let i=1;i=i&&null==t[s];)s--;if(s<=i)return!0;const r=at(1,it((s-i+1)/e));for(let e=t[i],n=i+r;n<=s;n+=r){const i=t[n];if(null!=i){if(i<=e)return!1;e=i}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,i=Array(n);for(let t=0;te[t]-e[n]));let s=[];for(let e=0;et-e))],s=i[0].length,r=new Map;for(let t=0;tdn(t,r,((o,u,c,d,h,f,p,m,_,g,w)=>{let b=o.pxRound,{left:v,width:x}=t.bbox,y=t=>b(f(t,d,g,m)),k=t=>b(p(t,h,w,_)),z=0==d.ori?xn:yn;const M={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=M.stroke,T=d.dir*(0==d.ori?1:-1);l=Y(c,l,a,1),a=Y(c,l,a,-1);let D=k(c[1==T?l:a]),A=y(u[1==T?l:a]),$=A,O=A;s&&-1==e&&(O=v,z(E,O,D)),z(E,A,D);for(let t=1==T?l:a;t>=l&&t<=a;t+=T){let n=c[t];if(null==n)continue;let i=y(u[t]),s=k(n);1==e?z(E,i,D):z(E,$,s),z(E,i,s),D=s,$=i}let R=$;s&&1==e&&(R=v+x,z(E,R,D));let[C,P]=hn(t,r);if(null!=o.fill||0!=C){let e=M.fill=new Path2D(E),n=k(o.fillTo(t,r,o.min,o.max,C));z(e,R,n),z(e,O,n)}if(!o.spanGaps){let s=[];s.push(..._n(u,c,l,a,T,y,i));let h=o.width*S/2,f=n||1==e?h:-h,p=n||-1==e?-h:h;s.forEach((t=>{t[0]+=f,t[1]+=p})),M.gaps=s=o.gaps(t,r,l,a,s),M.clip=mn(s,d.ori,m,_,g,w)}return 0!=P&&(M.band=2==P?[pn(t,r,l,a,E,-1),pn(t,r,l,a,E,1)]:pn(t,r,l,a,E,P)),M}))},t.bars=function(t){const e=X((t=t||$t).size,[.6,ft,1]),n=t.align||0,i=t.gap||0;let s=t.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=_t(s),l=1-e[0],a=X(e[1],ft),o=X(e[2],1),u=X(t.disp,$t),c=X(t.each,(t=>{})),{fill:d,stroke:h}=u;return(t,e,s,f)=>dn(t,e,((p,m,_,g,w,b,v,x,y,k,z)=>{let M,E,T=p.pxRound,D=n,A=i*S,$=a*S,O=o*S;0==g.ori?[M,E]=r(t,e):[E,M]=r(t,e);const R=g.dir*(0==g.ori?1:-1);let C,P,L,U=0==g.ori?kn:zn,Z=0==g.ori?c:(t,e,n,i,s,r,l)=>{c(t,e,n,s,i,l,r)},N=X(t.bands,Ot).find((t=>t.series[0]==e)),H=null!=N?N.dir:0,I=p.fillTo(t,e,p.min,p.max,H),F=T(v(I,w,z,y)),Y=k,B=T(p.width*S),W=!1,j=null,V=null,G=null,K=null;null==d||0!=B&&null==h||(W=!0,j=d.values(t,e,s,f),V=new Map,new Set(j).forEach((t=>{null!=t&&V.set(t,new Path2D)})),B>0&&(G=h.values(t,e,s,f),K=new Map,new Set(G).forEach((t=>{null!=t&&K.set(t,new Path2D)}))));let{x0:q,size:J}=u;if(null!=q&&null!=J){D=1,m=q.values(t,e,s,f),2==q.unit&&(m=m.map((e=>t.posToVal(x+e*k,g.key,!0))));let n=J.values(t,e,s,f);P=2==J.unit?n[0]*k:b(n[0],g,k,x)-b(0,g,k,x),Y=Cn(m,_,b,g,k,x,Y),L=Y-P+A}else Y=Cn(m,_,b,g,k,x,Y),L=Y*l+A,P=Y-L;L<1&&(L=0),B>=P/2&&(B=0),L<5&&(T=gt);let Q=L>0;P=T(mt(Y-L-(Q?B:0),O,$)),C=(0==D?P/2:D==R?0:P)-D*R*((0==D?A/2:0)+(Q?B/2:0));const tt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},et=W?null:new Path2D;let nt=null;if(null!=N)nt=t.data[N.series[1]];else{let{y0:n,y1:i}=u;null!=n&&null!=i&&(_=i.values(t,e,s,f),nt=n.values(t,e,s,f))}let st=M*P,rt=E*P;for(let n=1==R?s:f;n>=s&&n<=f;n+=R){let i=_[n];if(null==i)continue;if(null!=nt){let t=nt[n]??0;if(i-t==0)continue;F=v(t,w,z,y)}let s=b(2!=g.distr||null!=u?m[n]:n,g,k,x),r=v(X(i,I),w,z,y),l=T(s-C),a=T(at(r,F)),o=T(lt(r,F)),c=a-o;if(null!=i){let s=i<0?rt:st,r=i<0?st:rt;W?(B>0&&null!=G[n]&&U(K.get(G[n]),l,o+it(B/2),P,at(0,c-B),s,r),null!=j[n]&&U(V.get(j[n]),l,o+it(B/2),P,at(0,c-B),s,r)):U(et,l,o+it(B/2),P,at(0,c-B),s,r),Z(t,e,n,l-B/2,o,P+B,c)}}return B>0?tt.stroke=W?K:et:W||(tt._fill=0==p.width?p._fill:p._stroke??p._fill,tt.width=0),tt.fill=W?V:et,tt}))},t.spline=function(t){return function(t,e){const n=X(e?.alignGaps,0);return(e,i,s,r)=>dn(e,i,((l,a,o,u,c,d,h,f,p,m,_)=>{let g,w,b,v=l.pxRound,x=t=>v(d(t,u,m,f)),y=t=>v(h(t,c,_,p));0==u.ori?(g=bn,b=xn,w=En):(g=vn,b=yn,w=Tn);const k=u.dir*(0==u.ori?1:-1);s=Y(o,s,r,1),r=Y(o,s,r,-1);let z=x(a[1==k?s:r]),S=z,M=[],E=[];for(let t=1==k?s:r;t>=s&&t<=r;t+=k)if(null!=o[t]){let e=x(a[t]);M.push(S=e),E.push(y(o[t]))}const T={stroke:t(M,E,g,b,w,v),fill:null,clip:null,band:null,gaps:null,flags:1},D=T.stroke;let[A,$]=hn(e,i);if(null!=l.fill||0!=A){let t=T.fill=new Path2D(D),n=y(l.fillTo(e,i,l.min,l.max,A));b(t,S,n),b(t,z,n)}if(!l.spanGaps){let t=[];t.push(..._n(a,o,s,r,k,x,n)),T.gaps=t=l.gaps(e,i,s,r,t),T.clip=mn(t,u.ori,f,p,m,_)}return 0!=$&&(T.band=2==$?[pn(e,i,s,r,D,-1),pn(e,i,s,r,D,1)]:pn(e,i,s,r,D,$)),T}))}(Pn,t)}}var Qn=n(379),ti=n.n(Qn),ei=n(795),ni=n.n(ei),ii=n(569),si=n.n(ii),ri=n(565),li=n.n(ri),ai=n(216),oi=n.n(ai),ui=n(589),ci=n.n(ui),di=n(350),hi={};function fi(t){var e,n=HTMLWidgets.find("#"+t);return void 0!==n&&(e=n.getWidget()),e}function pi(t,e){let n=[],i=[],s=t[0].length,r=Array(s);for(let t=0;tr[e]+=+t)));for(let n=1;ni>n&&!e(i))),n]});return i=i.filter((t=>t.series[1]>-1)),{data:[t[0]].concat(n),bands:i}}hi.styleTagTransform=ci(),hi.setAttributes=li(),hi.insert=si().bind(null,"head"),hi.domAPI=ni(),hi.insertStyleElement=oi(),ti()(di.Z,hi),di.Z&&di.Z.locals&&di.Z.locals;const mi=(t="{YYYY}/{MM}/{DD} {HH}:{mm}:{ss}",e=" - ",n=10,i=10)=>{let s=0,r=0;const l=document.createElement("div");l.className="u-tooltip",l.style.position="absolute",l.style.display="none",l.style.padding="4px",l.style.border="2px solid black",l.style.background="#FFF";let a=null,o=null;const u=uPlot.fmtDate(t);let c,d=!1;function h(t){console.log(t),d||(l.style.display="block",c.style.cursor="crosshair",d=!0);let h=t.valToPos(t.data[a][o],"y"),f=t.valToPos(t.data[0][o],"x");l.style.top=r+h+n+"px",l.style.left=s+f+i+"px";let p=t.series[a]._stroke;l.style.borderColor=p;let m=t.series[a].value;l.textContent=u(new Date(1e3*t.data[0][o]))+e+m(t,t.data[a][o],a,o)}return{hooks:{ready:[t=>{c=t.over,s=parseFloat(c.style.left),r=parseFloat(c.style.top),t.root.querySelector(".u-wrap").appendChild(l)}],setCursor:[t=>{let e=t.cursor;o!=e.idx&&(o=e.idx,null!=a&&h(t))}],setSeries:[(t,e)=>{a!=e&&(a=e,null==e?d&&(l.style.display="none",c.style.cursor=null,d=!1):null!=o&&h(t))}],drawAxes:[t=>{let{ctx:e}=t,{left:n,top:i,width:s,height:r}=t.bbox;e.save(),e.strokeStyle="#fcb0f17a",e.beginPath();let[l,a]=t.series[0].idxs;e.closePath(),e.stroke(),e.restore()}]}}},_i=({className:t,style:e={backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#424242"}}={})=>{let n;return{hooks:{init:function(i,s){n=i.root.querySelector(".u-legend"),n.classList.remove("u-inline"),t&&n.classList.add(t),uPlot.assign(n.style,{textAlign:"left",pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,zIndex:100,boxShadow:"2px 2px 10px rgba(0,0,0,0.5)",...e});const r=n.querySelectorAll(".u-marker");for(let t=0;t{n.style.display=null})),l.addEventListener("mouseleave",(()=>{n.style.display="none"}))},setCursor:function(t){const{left:e,top:i}=t.cursor;n.style.transform="translate("+e+"px, "+i+"px)"}}}},gi=t=>{let e,n,i,s,r,l,a=t.factor||.75;function o(t,e,n,i,s,r){return t>i?(e=s,n=r):er&&(n=r,e=r-t),[e,n]}return{hooks:{ready:t=>{e=t.scales.x.min,n=t.scales.x.max,i=t.scales.y.min,s=t.scales.y.max,r=n-e,l=s-i;let u=t.over,c=u.getBoundingClientRect();u.addEventListener("mousedown",(e=>{if(1==e.button){e.preventDefault();let n=e.clientX,i=t.scales.x.min,s=t.scales.x.max,r=t.posToVal(1,"x")-t.posToVal(0,"x");function l(e){e.preventDefault();let l=e.clientX,a=r*(l-n);t.setScale("x",{min:i-a,max:s-a})}function a(t){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)}})),u.addEventListener("wheel",(u=>{u.preventDefault();let{left:d,top:h}=t.cursor,f=d/c.width,p=1-h/c.height,m=t.posToVal(d,"x"),_=t.posToVal(h,"y"),g=t.scales.x.max-t.scales.x.min,w=t.scales.y.max-t.scales.y.min,b=u.deltaY<0?g*a:g/a,v=m-f*b,x=v+b;[v,x]=o(b,v,x,r,e,n);let y=u.deltaY<0?w*a:w/a,k=_-p*y,z=k+y;[k,z]=o(y,k,z,l,i,s),t.batch((()=>{t.setScale("x",{min:v,max:x}),t.setScale("y",{min:k,max:z})}))}))}}}},wi=({className:t,style:e={backgroundColor:"rgba(51,204,255,0.3)"}}={})=>{let n,i,s,r;return{opts:(t,e)=>{uPlot.assign(e,{cursor:{x:!1,y:!1}})},hooks:{init:function(r){n=r.under,i=r.over,s=document.createElement("div"),t&&s.classList.add(t),uPlot.assign(s.style,{pointerEvents:"none",display:"none",position:"absolute",left:0,top:0,height:"100%",...e}),n.appendChild(s),i.addEventListener("mouseenter",(()=>{s.style.display=null})),i.addEventListener("mouseleave",(()=>{s.style.display="none"}))},setCursor:function(t){if(r!==t.cursor.idx){r=t.cursor.idx;let[e,n]=t.series[0].idxs;const i=n-e,l=t.bbox.width/i/devicePixelRatio,a=2==t.scales.x.distr?r:t.data[0][r],o=t.valToPos(a,"x")-l/2;s.style.transform="translateX("+Math.round(o)+"px)",s.style.width=Math.round(l)+"px"}}}}},bi=(t,e,n,i)=>{const s=5*devicePixelRatio;return uPlot.orient(t,e,((n,i,r,l,a,o,u,c,d,h,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=l.min&&e<=l.max&&n>=a.min&&n<=a.max){let t=o(e,l,h,c),i=u(n,a,f,d);v.moveTo(t+s/2,i),g(v,t,i,s/2,0,b)}}console.timeEnd("points"),t.ctx.fill(v)})),null},vi=t=>{let e=t.yintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(t.scales.x.min,"x",!0),a=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(l,r),t.ctx.lineTo(a,r),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},xi=t=>{let e=t.xintercept||0,n=t.color||"#000",i=t.width||1,s=t.dash||[];return t=>{let r=t.valToPos(e,"x",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(t.scales.y.max,"y",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.moveTo(r,a),t.ctx.lineTo(r,l),t.ctx.strokeStyle=n,t.ctx.lineWidth=i,t.ctx.setLineDash(s),t.ctx.stroke(),t.ctx.restore()}},yi=t=>{let e=t.xmin||0,n=t.xmax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(t.scales.y.max,"y",!0),l=t.valToPos(t.scales.y.min,"y",!0),a=t.valToPos(e,"x",!0),o=t.valToPos(n,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,r,o-a,l-r),t.ctx.restore()}},ki=t=>{let e=t.ymin||0,n=t.ymax||0,i=t.fill||"#848484",s=t.alpha||.1;return t=>{let r=t.valToPos(e,"y",!0),l=t.valToPos(n,"y",!0),a=t.valToPos(t.scales.x.min,"x",!0),o=t.valToPos(t.scales.x.max,"x",!0);t.ctx.save(),t.ctx.beginPath(),t.ctx.fillStyle=i,t.ctx.globalAlpha=s,t.ctx.fillRect(a,l,o-a,r-l),t.ctx.restore()}},zi=({gap:t=2,shadowColor:e="#000000",bearishColor:n="#e54245",bullishColor:i="#4ab650",bodyMaxWidth:s=20,shadowWidth:r=2,bodyOutline:l=1}={})=>({opts:(t,e)=>{uPlot.assign(e,{cursor:{points:{show:!1}}}),e.series.forEach((t=>{t.paths=()=>null,t.points={show:!1}}))},hooks:{draw:function(a){a.ctx.save();const o=r%2/2;a.ctx.translate(o,o);let[u,c]=a.series[0].idxs;for(let o=u;o<=c;o++){let d=2==a.scales.x.distr?o:a.data[0][o],h=a.data[1][o],f=a.data[2][o],p=a.data[3][o],m=a.data[4][o],_=a.valToPos(d,"x",!0),g=a.valToPos(p,"y",!0),w=a.valToPos(f,"y",!0),b=a.valToPos(h,"y",!0),v=a.valToPos(m,"y",!0),x=Math.max(w,g)-Math.min(w,g),y=_-r/2,k=Math.min(w,g);a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(y),Math.round(k),Math.round(r),Math.round(x));let z=a.bbox.width/(c-u),S=Math.min(s,z-t),M=Math.max(v,b)-Math.min(v,b),E=_-S/2,T=Math.min(v,b),D=h>m?n:i;a.ctx.fillStyle=e,a.ctx.fillRect(Math.round(E),Math.round(T),Math.round(S),Math.round(M)),a.ctx.fillStyle=D,a.ctx.fillRect(Math.round(E+l),Math.round(T+l),Math.round(S-2*l),Math.round(M-2*l))}a.ctx.translate(-o,-o),a.ctx.restore()}}});function Si(t,e,n,i,s,r,l){const a=r.height||80,o=r.gripColor||"#4a90d9",u=r.gripWidth||8,c="u-zoom-ranger-styles";if(!document.getElementById(c)){const t=document.createElement("style");t.id=c,t.textContent=[".u-zoom-ranger-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; }",".u-zoom-ranger-wrap .u-zoom-ranger-main { flex: 1 1 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav { flex: 0 0 auto; overflow: hidden; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select { pointer-events: all; cursor: grab; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select:active { cursor: grabbing; }",".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-axis { pointer-events: none; }",".u-grip-l, .u-grip-r {"," position: absolute; top: 0; height: 100%;"," opacity: 0.8; cursor: ew-resize; border-radius: 2px;","}"].join("\n"),document.head.appendChild(t)}const d=document.createElement("div");d.className="u-zoom-ranger-wrap";const h=document.createElement("div");h.className="u-zoom-ranger-main";const f=document.createElement("div");let p,m,_;f.className="u-zoom-ranger-nav",d.appendChild(h),d.appendChild(f),t.appendChild(d);const g={left:null,width:null},w={min:null,max:null};let b,v;const x=l.pxRatio||window.devicePixelRatio||1;function y(t,e){const n=document.createElement("div");return n.classList.add(e),t.appendChild(n),n}function k(t,e){const n=-Math.ceil(u/2);t.style.width=u+"px",t.style.background=o,e?t.style.left=n+"px":t.style.right=n+"px"}function z(t,e){w.min=v.posToVal(t,"x"),w.max=v.posToVal(t+e,"x"),b.setScale("x",w)}function S(t,e,n){const i=v.bbox.width/x;if(2===n){const n=e-t;e>i?t=(e=i)-n:t<0&&(e=(t=0)+n)}else t>e&&(0===n?t=e:1===n&&(e=t)),t=Math.max(0,t),e=Math.min(e,i);z(t,e-t)}function M(t,e){p=t.clientX,m=v.select.left,_=m+v.select.width;const n=function(t){let e;return(...n)=>{e||(e=requestAnimationFrame((()=>{t(...n),e=null})))}}(e);document.addEventListener("mousemove",n),document.addEventListener("mouseup",(function t(){document.removeEventListener("mouseup",t),document.removeEventListener("mousemove",n)})),t.stopPropagation()}const E=s.series?s.series.map(((t,e)=>0===e?{}:{stroke:r.stroke||t.stroke||"#999"})):[{}],T={width:e,height:a,cursor:{x:!1,y:!1,points:{show:!1},drag:{setScale:!1,setSelect:!0,x:!0,y:!1}},legend:{show:!1},scales:s.scales?JSON.parse(JSON.stringify(s.scales)):{},axes:[{},{show:!1,grid:{show:!1},ticks:{show:!1}}],series:E,hooks:{ready:[t=>{const e=t.bbox.width/x,n=t.bbox.height/x;t.setSelect({left:0,width:e,height:n},!1);const i=t.root.querySelector(".u-select");i.addEventListener("mousedown",(t=>{M(t,(t=>S(m+(t.clientX-p),_+(t.clientX-p),2)))}));const s=y(i,"u-grip-l");k(s,!0),s.addEventListener("mousedown",(t=>{M(t,(t=>S(m+(t.clientX-p),_,0)))}));const r=y(i,"u-grip-r");k(r,!1),r.addEventListener("mousedown",(t=>{M(t,(t=>S(m,_+(t.clientX-p),1)))}))}],setSelect:[t=>{z(t.select.left,t.select.width)}]}},D=s.hooks||{},A=Array.isArray(D.setScale)?D.setScale:D.setScale?[D.setScale]:[],$=Object.assign({},s,{width:e,height:n,select:{over:!1},hooks:Object.assign({},D,{setScale:[...A,t=>{if(!v)return;const e=Math.round(v.valToPos(t.scales.x.min,"x"));var n,i;n=e,i=Math.round(v.valToPos(t.scales.x.max,"x"))-e,g.left=n,g.width=i,v.setSelect(g,!1)}]})});return v=new l(T,i,f),b=new l($,i,h),new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width,n=e.contentRect.height,i=Math.max(50,n-a-4);v.setSize({width:t,height:a}),b.setSize({width:t,height:i})}})).observe(t),{zoomed:b,ranger:v,wrap:d}}function Mi(t){let e=t.length;for(;--e>=0;)t[e]=0}const Ei=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]),Ti=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]),Di=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ai=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$i=new Array(576);Mi($i);const Oi=new Array(60);Mi(Oi);const Ri=new Array(512);Mi(Ri);const Ci=new Array(256);Mi(Ci);const Pi=new Array(29);Mi(Pi);const Li=new Array(30);function Ui(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}let Zi,Ni,Hi;function Ii(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}Mi(Li);const Fi=t=>t<256?Ri[t]:Ri[256+(t>>>7)],Yi=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Bi=(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<{Bi(t,n[2*e],n[2*e+1])},ji=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Vi=(t,e,n)=>{const i=new Array(16);let s,r,l=0;for(s=1;s<=15;s++)l=l+n[s-1]<<1,i[s]=l;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=ji(i[e]++,e))}},Gi=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},Ki=t=>{t.bi_valid>8?Yi(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Xi=(t,e,n,i)=>{const s=2*e,r=2*n;return t[s]{const i=t.heap[n];let s=n<<1;for(;s<=t.heap_len&&(s{let i,s,r,l,a=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+a++],i+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===i?Wi(t,s,e):(r=Ci[s],Wi(t,r+256+1,e),l=Ei[r],0!==l&&(s-=Pi[r],Bi(t,s,l)),i--,r=Fi(i),Wi(t,r,n),l=Ti[r],0!==l&&(i-=Li[r],Bi(t,i,l)))}while(a{const n=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,a,o,u=-1;for(t.heap_len=0,t.heap_max=573,l=0;l>1;l>=1;l--)qi(t,n,l);o=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],qi(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=a,n[2*o]=n[2*l]+n[2*a],t.depth[o]=(t.depth[l]>=t.depth[a]?t.depth[l]:t.depth[a])+1,n[2*l+1]=n[2*a+1]=o,t.heap[1]=o++,qi(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,o=e.stat_desc.max_length;let u,c,d,h,f,p,m=0;for(h=0;h<=15;h++)t.bl_count[h]=0;for(n[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)c=t.heap[u],h=n[2*n[2*c+1]+1]+1,h>o&&(h=o,m++),n[2*c+1]=h,c>i||(t.bl_count[h]++,f=0,c>=a&&(f=l[c-a]),p=n[2*c],t.opt_len+=p*(h+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==m){do{for(h=o-1;0===t.bl_count[h];)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[o]--,m-=2}while(m>0);for(h=o;0!==h;h--)for(c=t.bl_count[h];0!==c;)d=t.heap[--u],d>i||(n[2*d+1]!==h&&(t.opt_len+=(h-n[2*d+1])*n[2*d],n[2*d+1]=h),c--)}})(t,e),Vi(n,u,t.bl_count)},ts=(t,e,n)=>{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=l,l=e[2*(i+1)+1],++a{let i,s,r=-1,l=e[1],a=0,o=7,u=4;for(0===l&&(o=138,u=3),i=0;i<=n;i++)if(s=l,l=e[2*(i+1)+1],!(++a{Bi(t,0+(i?1:0),3),Ki(t),Yi(t,n),Yi(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var ss={_tr_init:t=>{ns||((()=>{let t,e,n,i,s;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Pi[i]=n,t=0;t<1<>=7;i<30;i++)for(Li[i]=s<<7,t=0;t<1<{let s,r,l=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)),Qi(t,t.l_desc),Qi(t,t.d_desc),l=(t=>{let e;for(ts(t,t.dyn_ltree,t.l_desc.max_code),ts(t,t.dyn_dtree,t.d_desc.max_code),Qi(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Ai[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&-1!==e?is(t,e,n,i):4===t.strategy||r===s?(Bi(t,2+(i?1:0),3),Ji(t,$i,Oi)):(Bi(t,4+(i?1:0),3),((t,e,n,i)=>{let s;for(Bi(t,e-257,5),Bi(t,n-1,5),Bi(t,i-4,4),s=0;s(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*(Ci[n]+256+1)]++,t.dyn_dtree[2*Fi(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Bi(t,2,3),Wi(t,256,$i),(t=>{16===t.bi_valid?(Yi(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)}},rs=(t,e,n,i)=>{let s=65535&t|0,r=t>>>16&65535|0,l=0;for(;0!==n;){l=n>2e3?2e3:n,n-=l;do{s=s+e[i++]|0,r=r+s|0}while(--l);s%=65521,r%=65521}return s|r<<16|0};const ls=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var as=(t,e,n,i)=>{const s=ls,r=i+n;t^=-1;for(let n=i;n>>8^s[255&(t^e[n])];return-1^t},os={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"},us={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:cs,_tr_stored_block:ds,_tr_flush_block:hs,_tr_tally:fs,_tr_align:ps}=ss,{Z_NO_FLUSH:ms,Z_PARTIAL_FLUSH:_s,Z_FULL_FLUSH:gs,Z_FINISH:ws,Z_BLOCK:bs,Z_OK:vs,Z_STREAM_END:xs,Z_STREAM_ERROR:ys,Z_DATA_ERROR:ks,Z_BUF_ERROR:zs,Z_DEFAULT_COMPRESSION:Ss,Z_FILTERED:Ms,Z_HUFFMAN_ONLY:Es,Z_RLE:Ts,Z_FIXED:Ds,Z_DEFAULT_STRATEGY:As,Z_UNKNOWN:$s,Z_DEFLATED:Os}=us,Rs=258,Cs=262,Ps=42,Ls=113,Us=666,Zs=(t,e)=>(t.msg=os[e],e),Ns=t=>2*t-(t>4?9:0),Hs=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Is=t=>{let e,n,i,s=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=s?n-s:0}while(--e);e=s,i=e;do{n=t.prev[--i],t.prev[i]=n>=s?n-s:0}while(--e)};let Fs=(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))},Bs=(t,e)=>{hs(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ys(t.strm)},Ws=(t,e)=>{t.pending_buf[t.pending++]=e},js=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Vs=(t,e,n,i)=>{let s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),n),1===t.state.wrap?t.adler=rs(t.adler,e,s,n):2===t.state.wrap&&(t.adler=as(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)},Gs=(t,e)=>{let n,i,s=t.max_chain_length,r=t.strstart,l=t.prev_length,a=t.nice_match;const o=t.strstart>t.w_size-Cs?t.strstart-(t.w_size-Cs):0,u=t.window,c=t.w_mask,d=t.prev,h=t.strstart+Rs;let f=u[r+l-1],p=u[r+l];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,u[n+l]===p&&u[n+l-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&rl){if(t.match_start=e,l=i,i>=a)break;f=u[r+l-1],p=u[r+l]}}}while((e=d[e&c])>o&&0!=--s);return l<=t.lookahead?l:t.lookahead},Ks=t=>{const e=t.w_size;let n,i,s;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Cs)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Is(t),i+=e),0===t.strm.avail_in)break;if(n=Vs(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Fs(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Fs(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let n,i,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,l=0,a=t.strm.avail_in;do{if(n=65535,s=t.bi_valid+42>>3,t.strm.avail_outi+t.strm.avail_in&&(n=i+t.strm.avail_in),n>s&&(n=s),n>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ys(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vs(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===l);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_waters&&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++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(Vs(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,i=t.strstart-t.block_start,(i>=r||(i||e===ws)&&e!==ms&&0===t.strm.avail_in&&i<=s)&&(n=i>s?s:i,l=e===ws&&0===t.strm.avail_in&&n===i?1:0,ds(t,t.block_start,n,l),t.block_start+=n,Ys(t.strm)),l?3:1)},qs=(t,e)=>{let n,i;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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-Cs&&(t.match_length=Gs(t,n)),t.match_length>=3)if(i=fs(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=Fs(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=Fs(t,t.ins_h,t.window[t.strstart+1]);else i=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2},Js=(t,e)=>{let n,i,s;for(;;){if(t.lookahead=3&&(t.ins_h=Fs(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){s=t.strstart+t.lookahead-3,i=fs(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Fs(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++,i&&(Bs(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=fs(t,0,t.window[t.strstart-1]),i&&Bs(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&&(i=fs(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2};function Qs(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}const tr=[new Qs(0,0,0,0,Xs),new Qs(4,4,8,4,qs),new Qs(4,5,16,8,qs),new Qs(4,6,32,32,qs),new Qs(4,4,16,16,Js),new Qs(8,16,32,32,Js),new Qs(8,16,128,128,Js),new Qs(8,32,128,256,Js),new Qs(32,128,258,1024,Js),new Qs(32,258,258,4096,Js)];function er(){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=Os,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),Hs(this.dyn_ltree),Hs(this.dyn_dtree),Hs(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),Hs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Hs(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 nr=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ps&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ls&&e.status!==Us?1:0},ir=t=>{if(nr(t))return Zs(t,ys);t.total_in=t.total_out=0,t.data_type=$s;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?Ps:Ls,t.adler=2===e.wrap?0:1,e.last_flush=-2,cs(e),vs},sr=t=>{const e=ir(t);var n;return e===vs&&((n=t.state).window_size=2*n.w_size,Hs(n.head),n.max_lazy_match=tr[n.level].max_lazy,n.good_match=tr[n.level].good_length,n.nice_match=tr[n.level].nice_length,n.max_chain_length=tr[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},rr=(t,e,n,i,s,r)=>{if(!t)return ys;let l=1;if(e===Ss&&(e=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),s<1||s>9||n!==Os||i<8||i>15||e<0||e>9||r<0||r>Ds||8===i&&1!==l)return Zs(t,ys);8===i&&(i=9);const a=new er;return t.state=a,a.strm=t,a.status=Ps,a.wrap=l,a.gzhead=null,a.w_bits=i,a.w_size=1<nr(t)||2!==t.state.wrap?ys:(t.state.gzhead=e,vs),or=(t,e)=>{if(nr(t)||e>bs||e<0)return t?Zs(t,ys):ys;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Us&&e!==ws)return Zs(t,0===t.avail_out?zs:ys);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ys(t),0===t.avail_out)return n.last_flush=-1,vs}else if(0===t.avail_in&&Ns(e)<=Ns(i)&&e!==ws)return Zs(t,zs);if(n.status===Us&&0!==t.avail_in)return Zs(t,zs);if(n.status===Ps&&0===n.wrap&&(n.status=Ls),n.status===Ps){let e=Os+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=Es||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,js(n,e),0!==n.strstart&&(js(n,t.adler>>>16),js(n,65535&t.adler)),t.adler=1,n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(57===n.status)if(t.adler=0,Ws(n,31),Ws(n,139),Ws(n,8),n.gzhead)Ws(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)),Ws(n,255&n.gzhead.time),Ws(n,n.gzhead.time>>8&255),Ws(n,n.gzhead.time>>16&255),Ws(n,n.gzhead.time>>24&255),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ws(n,255&n.gzhead.extra.length),Ws(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=as(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,0),Ws(n,9===n.level?2:n.strategy>=Es||n.level<2?4:0),Ws(n,3),n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=s,Ys(t),0!==n.pending)return n.last_flush=-1,vs;e=0,i-=s}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=as(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,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i)),Ys(t),0!==n.pending)return n.last_flush=-1,vs;i=0}e=n.gzindexi&&(t.adler=as(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ys(t),0!==n.pending))return n.last_flush=-1,vs;Ws(n,255&t.adler),Ws(n,t.adler>>8&255),t.adler=0}if(n.status=Ls,Ys(t),0!==n.pending)return n.last_flush=-1,vs}if(0!==t.avail_in||0!==n.lookahead||e!==ms&&n.status!==Us){let i=0===n.level?Xs(n,e):n.strategy===Es?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Ks(t),0===t.lookahead)){if(e===ms)return 1;break}if(t.match_length=0,n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===Ts?((t,e)=>{let n,i,s,r;const l=t.window;for(;;){if(t.lookahead<=Rs){if(Ks(t),t.lookahead<=Rs&&e===ms)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,i=l[s],i===l[++s]&&i===l[++s]&&i===l[++s])){r=t.strstart+Rs;do{}while(i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&i===l[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=fs(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=fs(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Bs(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===ws?(Bs(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Bs(t,!1),0===t.strm.avail_out)?1:2})(n,e):tr[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Us),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),vs;if(2===i&&(e===_s?ps(n):e!==bs&&(ds(n,0,0,!1),e===gs&&(Hs(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ys(t),0===t.avail_out))return n.last_flush=-1,vs}return e!==ws?vs:n.wrap<=0?xs:(2===n.wrap?(Ws(n,255&t.adler),Ws(n,t.adler>>8&255),Ws(n,t.adler>>16&255),Ws(n,t.adler>>24&255),Ws(n,255&t.total_in),Ws(n,t.total_in>>8&255),Ws(n,t.total_in>>16&255),Ws(n,t.total_in>>24&255)):(js(n,t.adler>>>16),js(n,65535&t.adler)),Ys(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vs:xs)},ur=t=>{if(nr(t))return ys;const e=t.state.status;return t.state=null,e===Ls?Zs(t,ks):vs},cr=(t,e)=>{let n=e.length;if(nr(t))return ys;const i=t.state,s=i.wrap;if(2===s||1===s&&i.status!==Ps||i.lookahead)return ys;if(1===s&&(t.adler=rs(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===s&&(Hs(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const r=t.avail_in,l=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Ks(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Fs(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Ks(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=l,t.input=a,t.avail_in=r,i.wrap=s,vs};const dr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var hr=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)dr(n,e)&&(t[e]=n[e])}}return t},fr=t=>{let e=0;for(let n=0,i=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;mr[254]=mr[254]=1;var _r=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,s,r,l=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&n):n<65536?(e[r++]=224|n>>>12,e[r++]=128|n>>>6&63,e[r++]=128|63&n):(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63,e[r++]=128|n>>>6&63,e[r++]=128|63&n);return e},gr=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,s;const r=new Array(2*n);for(s=0,i=0;i4)r[s++]=65533,i+=l-1;else{for(e&=2===l?31:3===l?15:7;l>1&&i1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&pr)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i{(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+mr[t[n]]>e?n:e},br=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 vr=Object.prototype.toString,{Z_NO_FLUSH:xr,Z_SYNC_FLUSH:yr,Z_FULL_FLUSH:kr,Z_FINISH:zr,Z_OK:Sr,Z_STREAM_END:Mr,Z_DEFAULT_COMPRESSION:Er,Z_DEFAULT_STRATEGY:Tr,Z_DEFLATED:Dr}=us;function Ar(t){this.options=hr({level:Er,method:Dr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Tr},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 br,this.strm.avail_out=0;let n=lr(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==Sr)throw new Error(os[n]);if(e.header&&ar(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?_r(e.dictionary):"[object ArrayBuffer]"===vr.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=cr(this.strm,t),n!==Sr)throw new Error(os[n]);this._dict_set=!0}}function $r(t,e){const n=new Ar(e);if(n.push(t,!0),n.err)throw n.msg||os[n.err];return n.result}Ar.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?zr:xr,"string"==typeof t?n.input=_r(t):"[object ArrayBuffer]"===vr.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(i),n.next_out=0,n.avail_out=i),(r===yr||r===kr)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(s=or(n,r),s===Mr)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=ur(this.strm),this.onEnd(s),this.ended=!0,s===Sr;if(0!==n.avail_out){if(r>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},Ar.prototype.onData=function(t){this.chunks.push(t)},Ar.prototype.onEnd=function(t){t===Sr&&(this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Or={Deflate:Ar,deflate:$r,deflateRaw:function(t,e){return(e=e||{}).raw=!0,$r(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,$r(t,e)},constants:us};const Rr=16209;var Cr=function(t,e){let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z,S;const M=t.state;n=t.next_in,z=t.input,i=n+(t.avail_in-5),s=t.next_out,S=t.output,r=s-(e-t.avail_out),l=s+(t.avail_out-257),a=M.dmax,o=M.wsize,u=M.whave,c=M.wnext,d=M.window,h=M.hold,f=M.bits,p=M.lencode,m=M.distcode,_=(1<>>24,h>>>=b,f-=b,b=w>>>16&255,0===b)S[s++]=65535&w;else{if(!(16&b)){if(0==(64&b)){w=p[(65535&w)+(h&(1<>>=b,f-=b),f<15&&(h+=z[n++]<>>24,h>>>=b,f-=b,b=w>>>16&255,!(16&b)){if(0==(64&b)){w=m[(65535&w)+(h&(1<a){t.msg="invalid distance too far back",M.mode=Rr;break t}if(h>>>=b,f-=b,b=s-r,x>b){if(b=x-b,b>u&&M.sane){t.msg="invalid distance too far back",M.mode=Rr;break t}if(y=0,k=d,0===c){if(y+=o-b,b2;)S[s++]=k[y++],S[s++]=k[y++],S[s++]=k[y++],v-=3;v&&(S[s++]=k[y++],v>1&&(S[s++]=k[y++]))}else{y=s-x;do{S[s++]=S[y++],S[s++]=S[y++],S[s++]=S[y++],v-=3}while(v>2);v&&(S[s++]=S[y++],v>1&&(S[s++]=S[y++]))}break}}break}}while(n>3,n-=v,f-=v<<3,h&=(1<{const o=a.bits;let u,c,d,h,f,p,m=0,_=0,g=0,w=0,b=0,v=0,x=0,y=0,k=0,z=0,S=null;const M=new Uint16Array(16),E=new Uint16Array(16);let T,D,A,$=null;for(m=0;m<=15;m++)M[m]=0;for(_=0;_=1&&0===M[w];w--);if(b>w&&(b=w),0===w)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(g=1;g0&&(0===t||1!==w))return-1;for(E[1]=0,m=1;m<15;m++)E[m+1]=E[m]+M[m];for(_=0;_852||2===t&&k>592)return 1;for(;;){T=m-x,l[_]+1=p?(D=$[l[_]-p],A=S[l[_]-p]):(D=96,A=0),u=1<>x)+c]=T<<24|D<<16|A|0}while(0!==c);for(u=1<>=1;if(0!==u?(z&=u-1,z+=u):z=0,_++,0==--M[m]){if(m===w)break;m=e[n+l[_]]}if(m>b&&(z&h)!==d){for(0===x&&(x=b),f+=g,v=m-x,y=1<852||2===t&&k>592)return 1;d=z&h,s[d]=b<<24|v<<16|f-r|0}}return 0!==z&&(s[f+z]=m-x<<24|64<<16|0),a.bits=b,0};const{Z_FINISH:Hr,Z_BLOCK:Ir,Z_TREES:Fr,Z_OK:Yr,Z_STREAM_END:Br,Z_NEED_DICT:Wr,Z_STREAM_ERROR:jr,Z_DATA_ERROR:Vr,Z_MEM_ERROR:Gr,Z_BUF_ERROR:Kr,Z_DEFLATED:Xr}=us,qr=16180,Jr=16190,Qr=16191,tl=16192,el=16194,nl=16199,il=16200,sl=16206,rl=16209,ll=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function al(){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 ol=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},ul=t=>{if(ol(t))return jr;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=qr,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,Yr},cl=t=>{if(ol(t))return jr;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ul(t)},dl=(t,e)=>{let n;if(ol(t))return jr;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?jr:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,cl(t))},hl=(t,e)=>{if(!t)return jr;const n=new al;t.state=n,n.strm=t,n.window=null,n.mode=qr;const i=dl(t,e);return i!==Yr&&(t.state=null),i};let fl,pl,ml=!0;const _l=t=>{if(ml){fl=new Int32Array(512),pl=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(Nr(1,t.lens,0,288,fl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Nr(2,t.lens,0,32,pl,0,t.work,{bits:5}),ml=!1}t.lencode=fl,t.lenbits=9,t.distcode=pl,t.distbits=5},gl=(t,e,n,i)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(n-i,n-i+s),r.wnext),(i-=s)?(r.window.set(e.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave{let n,i,s,r,l,a,o,u,c,d,h,f,p,m,_,g,w,b,v,x,y,k,z=0;const S=new Uint8Array(4);let M,E;const T=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ol(t)||!t.output||!t.input&&0!==t.avail_in)return jr;n=t.state,n.mode===Qr&&(n.mode=tl),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,d=a,h=o,k=Yr;t:for(;;)switch(n.mode){case qr:if(0===n.wrap){n.mode=tl;break}for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0),u=0,c=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=rl;break}if((15&u)!==Xr){t.msg="unknown compression method",n.mode=rl;break}if(u>>>=4,c-=4,y=8+(15&u),0===n.wbits&&(n.wbits=y),y>15||y>n.wbits){t.msg="invalid window size",n.mode=rl;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>8&255,S[2]=u>>>16&255,S[3]=u>>>24&255,n.check=as(n.check,S,4,0)),u=0,c=0,n.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>8),512&n.flags&&4&n.wrap&&(S[0]=255&u,S[1]=u>>>8&255,n.check=as(n.check,S,2,0)),u=0,c=0,n.mode=16184;case 16184:if(1024&n.flags){for(;c<16;){if(0===a)break t;a--,u+=i[r++]<>>8&255,n.check=as(n.check,S,2,0)),u=0,c=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&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+f),y)),512&n.flags&&4&n.wrap&&(n.check=as(n.check,i,f,r)),a-=f,r+=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{y=i[r+f++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y))}while(y&&f>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Qr;break;case 16189:for(;c<32;){if(0===a)break t;a--,u+=i[r++]<>>=7&c,c-=7&c,n.mode=sl;break}for(;c<3;){if(0===a)break t;a--,u+=i[r++]<>>=1,c-=1,3&u){case 0:n.mode=16193;break;case 1:if(_l(n),n.mode=nl,e===Fr){u>>>=2,c-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=rl}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,u+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=rl;break}if(n.length=65535&u,u=0,c=0,n.mode=el,e===Fr)break t;case el:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>o&&(f=o),0===f)break t;s.set(i.subarray(r,r+f),l),a-=f,r+=f,o-=f,l+=f,n.length-=f;break}n.mode=Qr;break;case 16196:for(;c<14;){if(0===a)break t;a--,u+=i[r++]<>>=5,c-=5,n.ndist=1+(31&u),u>>>=5,c-=5,n.ncode=4+(15&u),u>>>=4,c-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=rl;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[T[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},k=Nr(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid code lengths set",n.mode=rl;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=_,c-=_,n.lens[n.have++]=w;else{if(16===w){for(E=_+2;c>>=_,c-=_,0===n.have){t.msg="invalid bit length repeat",n.mode=rl;break}y=n.lens[n.have-1],f=3+(3&u),u>>>=2,c-=2}else if(17===w){for(E=_+3;c>>=_,c-=_,y=0,f=3+(7&u),u>>>=3,c-=3}else{for(E=_+7;c>>=_,c-=_,y=0,f=11+(127&u),u>>>=7,c-=7}if(n.have+f>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=rl;break}for(;f--;)n.lens[n.have++]=y}}if(n.mode===rl)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=rl;break}if(n.lenbits=9,M={bits:n.lenbits},k=Nr(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,k){t.msg="invalid literal/lengths set",n.mode=rl;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},k=Nr(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,k){t.msg="invalid distances set",n.mode=rl;break}if(n.mode=nl,e===Fr)break t;case nl:n.mode=il;case il:if(a>=6&&o>=258){t.next_out=l,t.avail_out=o,t.next_in=r,t.avail_in=a,n.hold=u,n.bits=c,Cr(t,h),l=t.next_out,s=t.output,o=t.avail_out,r=t.next_in,i=t.input,a=t.avail_in,u=n.hold,c=n.bits,n.mode===Qr&&(n.back=-1);break}for(n.back=0;z=n.lencode[u&(1<>>24,g=z>>>16&255,w=65535&z,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,n.length=w,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=Qr;break}if(64&g){t.msg="invalid literal/length code",n.mode=rl;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(E=n.extra;c>>=n.extra,c-=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,!(_<=c);){if(0===a)break t;a--,u+=i[r++]<>b)],_=z>>>24,g=z>>>16&255,w=65535&z,!(b+_<=c);){if(0===a)break t;a--,u+=i[r++]<>>=b,c-=b,n.back+=b}if(u>>>=_,c-=_,n.back+=_,64&g){t.msg="invalid distance code",n.mode=rl;break}n.offset=w,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(E=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=rl;break}n.mode=16204;case 16204:if(0===o)break t;if(f=h-o,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=rl;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),m=n.window}else m=s,p=l-n.offset,f=n.length;f>o&&(f=o),o-=f,n.length-=f;do{s[l++]=m[p++]}while(--f);0===n.length&&(n.mode=il);break;case 16205:if(0===o)break t;s[l++]=n.length,o--,n.mode=il;break;case sl:if(n.wrap){for(;c<32;){if(0===a)break t;a--,u|=i[r++]<{if(ol(t))return jr;let e=t.state;return e.window&&(e.window=null),t.state=null,Yr},yl=(t,e)=>{if(ol(t))return jr;const n=t.state;return 0==(2&n.wrap)?jr:(n.head=e,e.done=!1,Yr)},kl=(t,e)=>{const n=e.length;let i,s,r;return ol(t)?jr:(i=t.state,0!==i.wrap&&i.mode!==Jr?jr:i.mode===Jr&&(s=1,s=rs(s,e,n,0),s!==i.check)?Vr:(r=gl(t,e,n,n),r?(i.mode=16210,Gr):(i.havedict=1,Yr)))},zl=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 Sl=Object.prototype.toString,{Z_NO_FLUSH:Ml,Z_FINISH:El,Z_OK:Tl,Z_STREAM_END:Dl,Z_NEED_DICT:Al,Z_STREAM_ERROR:$l,Z_DATA_ERROR:Ol,Z_MEM_ERROR:Rl}=us;function Cl(t){this.options=hr({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 br,this.strm.avail_out=0;let n=bl(this.strm,e.windowBits);if(n!==Tl)throw new Error(os[n]);if(this.header=new zl,yl(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=_r(e.dictionary):"[object ArrayBuffer]"===Sl.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=kl(this.strm,e.dictionary),n!==Tl)))throw new Error(os[n])}function Pl(t,e){const n=new Cl(e);if(n.push(t),n.err)throw n.msg||os[n.err];return n.result}Cl.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,l,a;if(this.ended)return!1;for(l=e===~~e?e:!0===e?El:Ml,"[object ArrayBuffer]"===Sl.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(i),n.next_out=0,n.avail_out=i),r=vl(n,l),r===Al&&s&&(r=kl(n,s),r===Tl?r=vl(n,l):r===Ol&&(r=Al));n.avail_in>0&&r===Dl&&n.state.wrap>0&&0!==t[n.next_in];)wl(n),r=vl(n,l);switch(r){case $l:case Ol:case Al:case Rl:return this.onEnd(r),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||r===Dl))if("string"===this.options.to){let t=wr(n.output,n.next_out),e=n.next_out-t,s=gr(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(s)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Tl||0!==a){if(r===Dl)return r=xl(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Cl.prototype.onData=function(t){this.chunks.push(t)},Cl.prototype.onEnd=function(t){t===Tl&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=fr(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ll={Inflate:Cl,inflate:Pl,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Pl(t,e)},ungzip:Pl,constants:us};const{Deflate:Ul,deflate:Zl,deflateRaw:Nl,gzip:Hl}=Or,{Inflate:Il,inflate:Fl,inflateRaw:Yl,ungzip:Bl}=Ll;var Wl=Bl,jl=n(484),Vl=n(178),Gl=n.n(Vl),Kl=n(387),Xl=n.n(Kl);jl.extend(Gl()),jl.extend(Xl());const ql=t=>(e,n)=>{new ResizeObserver((t=>{for(let n of t){let t=n.contentRect.height,i=n.contentRect.width;const s=e.root.querySelectorAll(".u-legend, .u-title");for(let e of s)t-=Math.floor(e.offsetHeight);e.setSize({width:i,height:t})}})).observe(t),t.appendChild(e.root),n()};HTMLWidgets.widget({name:"uPlot",type:"output",factory:function(t,e,n){var i,s,r,l,a;return{renderValue:function(o){if(void 0!==i&&i.destroy(),void 0!==s&&(s.destroy(),s=void 0),void 0!==r&&(t.removeChild(r),r=void 0),(l=o.config.options).width=e,l.height=n,a=o.config.data,o.use_gzipped_json){const t=atob(a),e=Uint8Array.from(t,(t=>t.charCodeAt(0))),n=Wl(e),i=(new TextDecoder).decode(n);a=JSON.parse(i)}if(o.config.zoomRanger){const u=o.config.zoomRanger,c=Math.max(50,n-(u.height||80)-4),d=Si(t,e,c,a,l,u,Jn);i=d.zoomed,s=d.ranger,r=d.wrap}else o.stacked?(l.hooks||(l.hooks={}),l.hooks.init=[t=>{[...t.root.querySelectorAll(".u-legend .u-series")].forEach(((e,n)=>{t.series[n]._hide&&(e.style.display="none")}))}],i=function(t,e,n,i,s,r,l,a){let{opts:o,data:u}=function(t,e,n,i){let s=function(t,e){return{scales:{x:{time:!0}},series:e}}(0,e),r=pi(i?i(n):n,(t=>!1));return s.bands=r.bands,s.cursor=s.cursor||{},s.cursor.dataIdx=(t,e,i,s)=>null===n[e][i]?null:i,s.series.forEach((t=>{t.value=(t,e,i,s)=>n[i][s],t.points=t.points||{},t.points.filter=(t,e,i,s)=>{if(i){let t=[];return n[e].forEach(((e,n)=>{null!==e&&t.push(n)})),t}}})),s.scales.y={range:(t,e,n)=>{let i=uPlot.rangeNum(e,n,.1,!0);return[i[0],i[1]]}},s.hooks={setSeries:[(t,e)=>{let i=pi(n,(e=>!t.series[e].show));t.delBand(null),i.bands.forEach((e=>t.addBand(e))),t.setData(i.data)}]},{opts:s,data:r.data}}(0,e,n,i);return o.title=t,o.width=s,o.height=r,o.hooks=Object.assign(o.hooks,l),console.log(o),new uPlot(o,u,a)}(l.title,l.series,a,null,e,n,l.hooks,ql(t))):i=new Jn(l,a,ql(t))},getWidget:function(){return i},resize:function(t,e){}}}}),HTMLWidgets.shinyMode&&(Shiny.addCustomMessageHandler("uplot-api",(function(t){var e=fi(t.id);void 0!==e&&e[t.name].apply(null,t.args)})),Shiny.addCustomMessageHandler("uplot-setData",(function(t){var e=fi(t.id);void 0!==e&&e.setData(t.data)})),Shiny.addCustomMessageHandler("uplot-setSeries",(function(t){var e=fi(t.id);void 0!==e&&e.setSeries(t.seriesIdx,t.options)})),Shiny.addCustomMessageHandler("uplot-addSeries",(function(t){var e=fi(t.id);void 0!==e&&e.addSeries(t.options,t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-delSeries",(function(t){var e=fi(t.id);void 0!==e&&e.delSeries(t.seriesIdx)})),Shiny.addCustomMessageHandler("uplot-setScale",(function(t){var e=fi(t.id);void 0!==e&&e.setScale(t.scaleKey,t.limits)})),Shiny.addCustomMessageHandler("uplot-redraw",(function(t){var e=fi(t.id);void 0!==e&&e.redraw(t.rebuildPaths,t.recalcAxes)})))})();var s=window;for(var r in i)s[r]=i[r];i.__esModule&&Object.defineProperty(s,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/srcjs/modules/zoomRangerPlugin.js b/srcjs/modules/zoomRangerPlugin.js index a66c71f..86a9c64 100644 --- a/srcjs/modules/zoomRangerPlugin.js +++ b/srcjs/modules/zoomRangerPlugin.js @@ -33,11 +33,9 @@ function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { ".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-select:active { cursor: grabbing; }", ".u-zoom-ranger-wrap .u-zoom-ranger-nav .u-axis { pointer-events: none; }", ".u-grip-l, .u-grip-r {", - " position: absolute; top: 0; width: " + gripWidth + "px; height: 100%;", - " background: " + gripColor + "; opacity: 0.8; cursor: ew-resize; border-radius: 2px;", + " position: absolute; top: 0; height: 100%;", + " opacity: 0.8; cursor: ew-resize; border-radius: 2px;", "}", - ".u-grip-l { left: " + (-Math.ceil(gripWidth / 2)) + "px; }", - ".u-grip-r { right: " + (-Math.ceil(gripWidth / 2)) + "px; }", ].join("\n"); document.head.appendChild(style); } @@ -57,8 +55,8 @@ function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { el.appendChild(wrap); // ── Shared state ─────────────────────────────────────────────────────────── - let x0, lft0, rgt0; - const lftWid = { left: null, width: null }; + let x0, left0, right0; + const rangerSelection = { left: null, width: null }; const minMax = { min: null, max: null }; const BOUNDARY_LEFT = 0; @@ -68,6 +66,9 @@ function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { // Forward-declared so hooks can close over them safely. let uZoomed, uRanger; + // Pixel ratio — uPlot.pxRatio is a static property on the constructor. + const pxRatio = UPlot.pxRatio || window.devicePixelRatio || 1; + // ── Helpers ──────────────────────────────────────────────────────────────── function debounce(fn) { let raf; @@ -84,45 +85,51 @@ function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { return d; } - function selectRanger(newLft, newWid) { - lftWid.left = newLft; - lftWid.width = newWid; - uRanger.setSelect(lftWid, false); + function applyGripStyle(el, isLeft) { + const offset = -Math.ceil(gripWidth / 2); + el.style.width = gripWidth + "px"; + el.style.background = gripColor; + if (isLeft) { + el.style.left = offset + "px"; + } else { + el.style.right = offset + "px"; + } } - function zoomMain(newLft, newWid) { - minMax.min = uRanger.posToVal(newLft, "x"); - minMax.max = uRanger.posToVal(newLft + newWid, "x"); + function selectRanger(newLeft, newWidth) { + rangerSelection.left = newLeft; + rangerSelection.width = newWidth; + uRanger.setSelect(rangerSelection, false); + } + + function zoomMain(newLeft, newWidth) { + minMax.min = uRanger.posToVal(newLeft, "x"); + minMax.max = uRanger.posToVal(newLeft + newWidth, "x"); uZoomed.setScale("x", minMax); } - function update(newLft, newRgt, movedBoundary) { - const maxRgt = uRanger.bbox.width / uPlotPxRatio(); + function update(newLeft, newRight, movedBoundary) { + const maxRight = uRanger.bbox.width / pxRatio; if (movedBoundary === BOUNDARY_BOTH) { - const initWidth = newRgt - newLft; - if (newRgt > maxRgt) { newRgt = maxRgt; newLft = newRgt - initWidth; } - else if (newLft < 0) { newLft = 0; newRgt = newLft + initWidth; } + const initWidth = newRight - newLeft; + if (newRight > maxRight) { newRight = maxRight; newLeft = newRight - initWidth; } + else if (newLeft < 0) { newLeft = 0; newRight = newLeft + initWidth; } } else { - if (newLft > newRgt) { - if (movedBoundary === BOUNDARY_LEFT) newLft = newRgt; - else if (movedBoundary === BOUNDARY_RIGHT) newRgt = newLft; + if (newLeft > newRight) { + if (movedBoundary === BOUNDARY_LEFT) newLeft = newRight; + else if (movedBoundary === BOUNDARY_RIGHT) newRight = newLeft; } - newLft = Math.max(0, newLft); - newRgt = Math.min(newRgt, maxRgt); + newLeft = Math.max(0, newLeft); + newRight = Math.min(newRight, maxRight); } - zoomMain(newLft, newRgt - newLft); - } - - function uPlotPxRatio() { - // uPlot.pxRatio is a static property on the constructor - return UPlot.pxRatio || window.devicePixelRatio || 1; + zoomMain(newLeft, newRight - newLeft); } function bindMove(e, onMove) { - x0 = e.clientX; - lft0 = uRanger.select.left; - rgt0 = lft0 + uRanger.select.width; + x0 = e.clientX; + left0 = uRanger.select.left; + right0 = left0 + uRanger.select.width; const _onMove = debounce(onMove); document.addEventListener("mousemove", _onMove); @@ -164,28 +171,32 @@ function createZoomRanger(el, width, mainHeight, data, opts, cfg, UPlot) { ready: [ (u) => { // Full selection initially (shows all data) - const selLeft = 0; - const selWidth = u.bbox.width / uPlotPxRatio(); - const selHeight = u.bbox.height / uPlotPxRatio(); + const selLeft = 0; + const selWidth = u.bbox.width / pxRatio; + const selHeight = u.bbox.height / pxRatio; u.setSelect({ left: selLeft, width: selWidth, height: selHeight }, false); const sel = u.root.querySelector(".u-select"); sel.addEventListener("mousedown", (e) => { bindMove(e, (ev) => - update(lft0 + (ev.clientX - x0), rgt0 + (ev.clientX - x0), BOUNDARY_BOTH) + update(left0 + (ev.clientX - x0), right0 + (ev.clientX - x0), BOUNDARY_BOTH) ); }); - placeDiv(sel, "u-grip-l").addEventListener("mousedown", (e) => { + const gripL = placeDiv(sel, "u-grip-l"); + applyGripStyle(gripL, true); + gripL.addEventListener("mousedown", (e) => { bindMove(e, (ev) => - update(lft0 + (ev.clientX - x0), rgt0, BOUNDARY_LEFT) + update(left0 + (ev.clientX - x0), right0, BOUNDARY_LEFT) ); }); - placeDiv(sel, "u-grip-r").addEventListener("mousedown", (e) => { + const gripR = placeDiv(sel, "u-grip-r"); + applyGripStyle(gripR, false); + gripR.addEventListener("mousedown", (e) => { bindMove(e, (ev) => - update(lft0, rgt0 + (ev.clientX - x0), BOUNDARY_RIGHT) + update(left0, right0 + (ev.clientX - x0), BOUNDARY_RIGHT) ); }); }, diff --git a/srcjs/widgets/uPlot.js b/srcjs/widgets/uPlot.js index b5c3a25..e9d5bf6 100644 --- a/srcjs/widgets/uPlot.js +++ b/srcjs/widgets/uPlot.js @@ -44,7 +44,7 @@ HTMLWidgets.widget({ type: "output", factory: function (el, width, height) { - var plot, rangerPlot, rangerWrap, options, data; + var plot, rangerPlot, rangerWrapEl, options, data; return { renderValue: function (x) { @@ -55,9 +55,9 @@ HTMLWidgets.widget({ rangerPlot.destroy(); rangerPlot = undefined; } - if (typeof rangerWrap !== "undefined") { - el.removeChild(rangerWrap); - rangerWrap = undefined; + if (typeof rangerWrapEl !== "undefined") { + el.removeChild(rangerWrapEl); + rangerWrapEl = undefined; } options = x.config.options; options.width = width; @@ -85,7 +85,7 @@ HTMLWidgets.widget({ ); plot = charts.zoomed; rangerPlot = charts.ranger; - rangerWrap = charts.wrap; + rangerWrapEl = charts.wrap; } else if (x.stacked) { if (!options.hooks) options.hooks = {}; options.hooks.init = [