mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
14 lines
91 KiB
JavaScript
14 lines
91 KiB
JavaScript
import{g as ha,r as Gt,j as u,u as da,a as Kr,i as pa,b as ma,D as ga,c as xa,S as ya,t as wa,C as pt,L as Yr,d as _a,e as ba}from"./index-DFlKqFdJ.js";var dn={exports:{}};var va=dn.exports,sr;function Sa(){return sr||(sr=1,(function(e,n){((r,l)=>{e.exports=l()})(va,function r(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},i,f=!l.document&&!!l.postMessage,h=l.IS_PAPA_WORKER||!1,y={},g=0,c={};function v(d){return d.charCodeAt(0)===65279?d.slice(1):d}function _(d){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(p){var x=B(p);x.chunkSize=parseInt(x.chunkSize),p.step||p.chunk||(x.chunkSize=null),this._handle=new $(x),(this._handle.streamer=this)._config=x}).call(this,d),this.parseChunk=function(p,x){var E=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<E){let D=this._config.newline;D||(j=this._config.quoteChar||'"',D=this._handle.guessLineEndings(p,j)),p=[...p.split(D).slice(E)].join(D)}this.isFirstChunk&&H(this._config.beforeFirstChunk)&&(j=this._config.beforeFirstChunk(p))!==void 0&&(p=j),this.isFirstChunk=!1,this._halted=!1;var E=this._partialLine+p,j=(this._partialLine="",this._handle.parse(E,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(p=j.meta.cursor,E=(this._finished||(this._partialLine=E.substring(p-this._baseIndex),this._baseIndex=p),j&&j.data&&(this._rowCount+=j.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),h)l.postMessage({results:j,workerId:c.WORKER_ID,finished:E});else if(H(this._config.chunk)&&!x){if(this._config.chunk(j,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=j=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(j.data),this._completeResults.errors=this._completeResults.errors.concat(j.errors),this._completeResults.meta=j.meta),this._completed||!E||!H(this._config.complete)||j&&j.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),E||j&&j.meta.paused||this._nextChunk(),j}this._halted=!0},this._sendError=function(p){H(this._config.error)?this._config.error(p):h&&this._config.error&&l.postMessage({workerId:c.WORKER_ID,error:p,finished:!1})}}function S(d){var p;(d=d||{}).chunkSize||(d.chunkSize=c.RemoteChunkSize),_.call(this,d),this._nextChunk=f?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(x){this._input=x,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(p=new XMLHttpRequest,this._config.withCredentials&&(p.withCredentials=this._config.withCredentials),f||(p.onload=ie(this._chunkLoaded,this),p.onerror=ie(this._chunkError,this)),p.open(this._config.downloadRequestBody?"POST":"GET",this._input,!f),this._config.downloadRequestHeaders){var x,E=this._config.downloadRequestHeaders;for(x in E)p.setRequestHeader(x,E[x])}var j;this._config.chunkSize&&(j=this._start+this._config.chunkSize-1,p.setRequestHeader("Range","bytes="+this._start+"-"+j));try{p.send(this._config.downloadRequestBody)}catch(D){this._chunkError(D.message)}f&&p.status===0&&this._chunkError()}},this._chunkLoaded=function(){p.readyState===4&&(p.status<200||400<=p.status?this._chunkError():(this._start+=this._config.chunkSize||p.responseText.length,this._finished=!this._config.chunkSize||this._start>=(x=>(x=x.getResponseHeader("Content-Range"))!==null?parseInt(x.substring(x.lastIndexOf("/")+1)):-1)(p),this.parseChunk(p.responseText)))},this._chunkError=function(x){x=p.statusText||x,this._sendError(new Error(x))}}function W(d){(d=d||{}).chunkSize||(d.chunkSize=c.LocalChunkSize),_.call(this,d);var p,x,E=typeof FileReader<"u";this.stream=function(j){this._input=j,x=j.slice||j.webkitSlice||j.mozSlice,E?((p=new FileReader).onload=ie(this._chunkLoaded,this),p.onerror=ie(this._chunkError,this)):p=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var j=this._input,D=(this._config.chunkSize&&(D=Math.min(this._start+this._config.chunkSize,this._input.size),j=x.call(j,this._start,D)),p.readAsText(j,this._config.encoding));E||this._chunkLoaded({target:{result:D}})},this._chunkLoaded=function(j){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(j.target.result)},this._chunkError=function(){this._sendError(p.error)}}function z(d){var p;_.call(this,d=d||{}),this.stream=function(x){return p=x,this._nextChunk()},this._nextChunk=function(){var x,E;if(!this._finished)return x=this._config.chunkSize,p=x?(E=p.substring(0,x),p.substring(x)):(E=p,""),this._finished=!p,this.parseChunk(E)}}function w(d){_.call(this,d=d||{});var p=[],x=!0,E=!1;this.pause=function(){_.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){_.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(j){this._input=j,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){E&&p.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),p.length?this.parseChunk(p.shift()):x=!0},this._streamData=ie(function(j){try{p.push(typeof j=="string"?j:j.toString(this._config.encoding)),x&&(x=!1,this._checkIsFinished(),this.parseChunk(p.shift()))}catch(D){this._streamError(D)}},this),this._streamError=ie(function(j){this._streamCleanUp(),this._sendError(j)},this),this._streamEnd=ie(function(){this._streamCleanUp(),E=!0,this._streamData("")},this),this._streamCleanUp=ie(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function $(d){var p,x,E,j,D=Math.pow(2,53),P=-D,te=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,U=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,X=this,ae=0,O=0,ce=!1,L=!1,A=[],F={data:[],errors:[],meta:{}};function Ee(se){return d.skipEmptyLines==="greedy"?se.join("").trim()==="":se.length===1&&se[0].length===0}function le(){if(F&&E&&(Fe("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),E=!1),d.skipEmptyLines&&(F.data=F.data.filter(function(Z){return!Ee(Z)})),ee()){let Z=function(me,Ae){me=v(me),H(d.transformHeader)&&(me=d.transformHeader(me,Ae)),A.push(me)};if(F)if(Array.isArray(F.data[0])){for(var se=0;ee()&&se<F.data.length;se++)F.data[se].forEach(Z);F.data.splice(0,1)}else F.data.forEach(Z)}function q(Z,me){for(var Ae=d.header?{}:[],we=0;we<Z.length;we++){var be=we,he=Z[we],he=((rt,re)=>(de=>(d.dynamicTypingFunction&&d.dynamicTyping[de]===void 0&&(d.dynamicTyping[de]=d.dynamicTypingFunction(de)),(d.dynamicTyping[de]||d.dynamicTyping)===!0))(rt)?re==="true"||re==="TRUE"||re!=="false"&&re!=="FALSE"&&((de=>{if(te.test(de)&&(de=parseFloat(de),P<de&&de<D))return 1})(re)?parseFloat(re):U.test(re)?new Date(re):re===""?null:re):re)(be=d.header?we>=A.length?"__parsed_extra":A[we]:be,he=d.transform?d.transform(he,be):he);be==="__parsed_extra"?(Ae[be]=Ae[be]||[],Ae[be].push(he)):Ae[be]=he}return d.header&&(we>A.length?Fe("FieldMismatch","TooManyFields","Too many fields: expected "+A.length+" fields but parsed "+we,O+me):we<A.length&&Fe("FieldMismatch","TooFewFields","Too few fields: expected "+A.length+" fields but parsed "+we,O+me)),Ae}var _e;F&&(d.header||d.dynamicTyping||d.transform)&&(_e=1,!F.data.length||Array.isArray(F.data[0])?(F.data=F.data.map(q),_e=F.data.length):F.data=q(F.data,0),d.header&&F.meta&&(F.meta.fields=A),O+=_e)}function ee(){return d.header&&A.length===0}function Fe(se,q,_e,Z){se={type:se,code:q,message:_e},Z!==void 0&&(se.row=Z),F.errors.push(se)}H(d.step)&&(j=d.step,d.step=function(se){F=se,ee()?le():(le(),F.data.length!==0&&(ae+=se.data.length,d.preview&&ae>d.preview?x.abort():(F.data=F.data[0],j(F,X))))}),this.parse=function(se,q,_e){var Z=d.quoteChar||'"',Z=(d.newline||(d.newline=this.guessLineEndings(se,Z)),E=!1,d.delimiter?H(d.delimiter)&&(d.delimiter=d.delimiter(se),F.meta.delimiter=d.delimiter):((Z=((me,Ae,we,be,he)=>{var rt,re,de,ut;he=he||[","," ","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var it=0;it<he.length;it++){for(var Ye,oe=he[it],R=0,ge=0,pe=0,He=(de=void 0,new M({comments:be,delimiter:oe,newline:Ae,preview:10}).parse(me)),lt=0;lt<He.data.length;lt++)we&&Ee(He.data[lt])?pe++:(Ye=He.data[lt].length,ge+=Ye,de===void 0?de=Ye:0<Ye&&(R+=Math.abs(Ye-de),de=Ye));0<He.data.length&&(ge/=He.data.length-pe),(re===void 0||R<=re)&&(ut===void 0||ut<ge)&&1.99<ge&&(re=R,rt=oe,ut=ge)}return{successful:!!(d.delimiter=rt),bestDelimiter:rt}})(se,d.newline,d.skipEmptyLines,d.comments,d.delimitersToGuess)).successful?d.delimiter=Z.bestDelimiter:(E=!0,d.delimiter=c.DefaultDelimiter),F.meta.delimiter=d.delimiter),B(d));return d.preview&&d.header&&Z.preview++,p=se,x=new M(Z),F=x.parse(p,q,_e),le(),ce?{meta:{paused:!0}}:F||{meta:{paused:!1}}},this.paused=function(){return ce},this.pause=function(){ce=!0,x.abort(),p=H(d.chunk)?"":p.substring(x.getCharIndex())},this.resume=function(){X.streamer._halted?(ce=!1,X.streamer.parseChunk(p,!0)):setTimeout(X.resume,3)},this.aborted=function(){return L},this.abort=function(){L=!0,x.abort(),F.meta.aborted=!0,H(d.complete)&&d.complete(F),p=""},this.guessLineEndings=function(me,Z){me=me.substring(0,1048576);var Z=new RegExp(Q(Z)+"([^]*?)"+Q(Z),"gm"),_e=(me=me.replace(Z,"")).split("\r"),Z=me.split(`
|
||
`),me=1<Z.length&&Z[0].length<_e[0].length;if(_e.length===1||me)return`
|
||
`;for(var Ae=0,we=0;we<_e.length;we++)_e[we][0]===`
|
||
`&&Ae++;return Ae>=_e.length/2?`\r
|
||
`:"\r"}}function Q(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(d){var p=(d=d||{}).delimiter,x=d.newline,E=d.comments,j=d.step,D=d.preview,P=d.fastMode,te=null,U=!1,X=d.quoteChar==null?'"':d.quoteChar,ae=X;if(d.escapeChar!==void 0&&(ae=d.escapeChar),(typeof p!="string"||-1<c.BAD_DELIMITERS.indexOf(p))&&(p=","),E===p)throw new Error("Comment character same as delimiter");E===!0?E="#":(typeof E!="string"||-1<c.BAD_DELIMITERS.indexOf(E))&&(E=!1),x!==`
|
||
`&&x!=="\r"&&x!==`\r
|
||
`&&(x=`
|
||
`);var O=0,ce=!1;this.parse=function(L,A,F){if(typeof L!="string")throw new Error("Input must be a string");var Ee=L.length,le=p.length,ee=x.length,Fe=E.length,se=H(j),q=[],_e=[],Z=[],me=O=0;if(!L)return R();if(P||P!==!1&&L.indexOf(X)===-1){for(var Ae=L.split(x),we=0;we<Ae.length;we++){if(Z=Ae[we],O+=Z.length,we!==Ae.length-1)O+=x.length;else if(F)return R();if(!E||Z.substring(0,Fe)!==E){if(se){if(q=[],ut(Z.split(p)),ge(),ce)return R()}else ut(Z.split(p));if(D&&D<=we)return q=q.slice(0,D),R(!0)}}return R()}for(var be=L.indexOf(p,O),he=L.indexOf(x,O),rt=new RegExp(Q(ae)+Q(X),"g"),re=L.indexOf(X,O);;)if(L[O]===X)for(re=O,O++;;){if((re=L.indexOf(X,re+1))===-1)return F||_e.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:q.length,index:O}),Ye();if(re===Ee-1)return Ye(L.substring(O,re).replace(rt,X));if(X===ae&&L[re+1]===ae)re++;else if(X===ae||re===0||L[re-1]!==ae){be!==-1&&be<re+1&&(be=L.indexOf(p,re+1));var de=it((he=he!==-1&&he<re+1?L.indexOf(x,re+1):he)===-1?be:Math.min(be,he));if(L.substr(re+1+de,le)===p){Z.push(L.substring(O,re).replace(rt,X)),L[O=re+1+de+le]!==X&&(re=L.indexOf(X,O)),be=L.indexOf(p,O),he=L.indexOf(x,O);break}if(de=it(he),L.substring(re+1+de,re+1+de+ee)===x){if(Z.push(L.substring(O,re).replace(rt,X)),oe(re+1+de+ee),be=L.indexOf(p,O),re=L.indexOf(X,O),se&&(ge(),ce))return R();if(D&&q.length>=D)return R(!0);break}_e.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:q.length,index:O}),re++}}else if(E&&Z.length===0&&L.substring(O,O+Fe)===E){if(he===-1)return R();O=he+ee,he=L.indexOf(x,O),be=L.indexOf(p,O)}else if(be!==-1&&(be<he||he===-1))Z.push(L.substring(O,be)),O=be+le,be=L.indexOf(p,O);else{if(he===-1)break;if(Z.push(L.substring(O,he)),oe(he+ee),se&&(ge(),ce))return R();if(D&&q.length>=D)return R(!0)}return Ye();function ut(pe){q.push(pe),me=O}function it(pe){var He=0;return He=pe!==-1&&(pe=L.substring(re+1,pe))&&pe.trim()===""?pe.length:He}function Ye(pe){return F||(pe===void 0&&(pe=L.substring(O)),Z.push(pe),O=Ee,ut(Z),se&&ge()),R()}function oe(pe){O=pe,ut(Z),Z=[],he=L.indexOf(x,O)}function R(pe){if(d.header&&!A&&q.length&&!U){var He=q[0],lt=Object.create(null),gt=new Set(He);let It=!1;for(let We=0;We<He.length;We++){let Ie=v(He[We]);if(lt[Ie=H(d.transformHeader)?d.transformHeader(Ie,We):Ie]){let Be,xt=lt[Ie];for(;Be=Ie+"_"+xt,xt++,gt.has(Be););gt.add(Be),He[We]=Be,lt[Ie]++,It=!0,(te=te===null?{}:te)[Be]=Ie}else lt[Ie]=1,He[We]=Ie;gt.add(Ie)}It&&console.warn("Duplicate headers found and renamed."),U=!0}return{data:q,errors:_e,meta:{delimiter:p,linebreak:x,aborted:ce,truncated:!!pe,cursor:me+(A||0),renamedHeaders:te}}}function ge(){j(R()),q=[],_e=[]}},this.abort=function(){ce=!0},this.getCharIndex=function(){return O}}function J(d){var p=d.data,x=y[p.workerId],E=!1;if(p.error)x.userError(p.error,p.file);else if(p.results&&p.results.data){var j={abort:function(){E=!0,N(p.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:fe,resume:fe};if(H(x.userStep)){for(var D=0;D<p.results.data.length&&(x.userStep({data:p.results.data[D],errors:p.results.errors,meta:p.results.meta},j),!E);D++);delete p.results}else H(x.userChunk)&&(x.userChunk(p.results,j,p.file),delete p.results)}p.finished&&!E&&N(p.workerId,p.results)}function N(d,p){var x=y[d];H(x.userComplete)&&x.userComplete(p),x.terminate(),delete y[d]}function fe(){throw new Error("Not implemented.")}function B(d){if(typeof d!="object"||d===null)return d;var p,x=Array.isArray(d)?[]:{};for(p in d)x[p]=B(d[p]);return x}function ie(d,p){return function(){d.apply(p,arguments)}}function H(d){return typeof d=="function"}return c.parse=function(d,p){var x=(p=p||{}).dynamicTyping||!1;if(H(x)&&(p.dynamicTypingFunction=x,x={}),p.dynamicTyping=x,p.transform=!!H(p.transform)&&p.transform,!p.worker||!c.WORKERS_SUPPORTED)return x=null,c.NODE_STREAM_INPUT,typeof d=="string"?(d=v(d),x=new(p.download?S:z)(p)):d.readable===!0&&H(d.read)&&H(d.on)?x=new w(p):(l.File&&d instanceof File||d instanceof Object)&&(x=new W(p)),x.stream(d);(x=(()=>{var E;return!!c.WORKERS_SUPPORTED&&(E=(()=>{var j=l.URL||l.webkitURL||null,D=r.toString();return c.BLOB_URL||(c.BLOB_URL=j.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",D,")();"],{type:"text/javascript"})))})(),(E=new l.Worker(E)).onmessage=J,E.id=g++,y[E.id]=E)})()).userStep=p.step,x.userChunk=p.chunk,x.userComplete=p.complete,x.userError=p.error,p.step=H(p.step),p.chunk=H(p.chunk),p.complete=H(p.complete),p.error=H(p.error),delete p.worker,x.postMessage({input:d,config:p,workerId:x.id})},c.unparse=function(d,p){var x=!1,E=!0,j=",",D=`\r
|
||
`,P='"',te=P+P,U=!1,X=null,ae=!1,O=((()=>{if(typeof p=="object"){if(typeof p.delimiter!="string"||c.BAD_DELIMITERS.filter(function(A){return p.delimiter.indexOf(A)!==-1}).length||(j=p.delimiter),typeof p.quotes!="boolean"&&typeof p.quotes!="function"&&!Array.isArray(p.quotes)||(x=p.quotes),typeof p.skipEmptyLines!="boolean"&&typeof p.skipEmptyLines!="string"||(U=p.skipEmptyLines),typeof p.newline=="string"&&(D=p.newline),typeof p.quoteChar=="string"&&(P=p.quoteChar,te=P+P),typeof p.header=="boolean"&&(E=p.header),Array.isArray(p.columns)){if(p.columns.length===0)throw new Error("Option columns is empty");X=p.columns}p.escapeChar!==void 0&&(te=p.escapeChar+P),p.escapeFormulae instanceof RegExp?ae=p.escapeFormulae:typeof p.escapeFormulae=="boolean"&&p.escapeFormulae&&(ae=/^[=+\-@\t\r].*$/)}})(),new RegExp(Q(P),"g"));if(typeof d=="string"&&(d=JSON.parse(d)),Array.isArray(d)){if(!d.length||Array.isArray(d[0]))return ce(null,d,U);if(typeof d[0]=="object")return ce(X||Object.keys(d[0]),d,U)}else if(typeof d=="object")return typeof d.data=="string"&&(d.data=JSON.parse(d.data)),Array.isArray(d.data)&&(d.fields||(d.fields=d.meta&&d.meta.fields||X),d.fields||(d.fields=Array.isArray(d.data[0])?d.fields:typeof d.data[0]=="object"?Object.keys(d.data[0]):[]),Array.isArray(d.data[0])||typeof d.data[0]=="object"||(d.data=[d.data])),ce(d.fields||[],d.data||[],U);throw new Error("Unable to serialize unrecognized input");function ce(A,F,Ee){var le="",ee=(typeof A=="string"&&(A=JSON.parse(A)),typeof F=="string"&&(F=JSON.parse(F)),Array.isArray(A)&&0<A.length),Fe=!Array.isArray(F[0]);if(ee&&E){for(var se=0;se<A.length;se++)0<se&&(le+=j),le+=L(A[se],se);0<F.length&&(le+=D)}for(var q=0;q<F.length;q++){var _e=(ee?A:F[q]).length,Z=!1,me=ee?Object.keys(F[q]).length===0:F[q].length===0;if(Ee&&!ee&&(Z=Ee==="greedy"?F[q].join("").trim()==="":F[q].length===1&&F[q][0].length===0),Ee==="greedy"&&ee){for(var Ae=[],we=0;we<_e;we++){var be=Fe?A[we]:we;Ae.push(F[q][be])}Z=Ae.join("").trim()===""}if(!Z){for(var he=0;he<_e;he++){0<he&&!me&&(le+=j);var rt=ee&&Fe?A[he]:he;le+=L(F[q][rt],he)}q<F.length-1&&(!Ee||0<_e&&!me)&&(le+=D)}}return le}function L(A,F){var Ee,le,ee;return A==null?"":A.constructor===Date?JSON.stringify(A).slice(1,25):(ee=!1,ae&&typeof A=="string"&&ae.test(A)&&(A="'"+A,ee=!0),le=(Ee=A.toString()).replace(O,te),(ee=ee||x===!0||typeof x=="function"&&x(A,F)||Array.isArray(x)&&x[F]||((Fe,se)=>{for(var q=0;q<se.length;q++)if(-1<Fe.indexOf(se[q]))return!0;return!1})(le,c.BAD_DELIMITERS)||-1<le.indexOf(j)||-1<Ee.indexOf(P)||le.charAt(0)===" "||le.charAt(le.length-1)===" ")?P+le+P:le)}},c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
|
||
`,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!f&&!!l.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=M,c.ParserHandle=$,c.NetworkStreamer=S,c.FileStreamer=W,c.StringStreamer=z,c.ReadableStreamStreamer=w,l.jQuery&&((i=l.jQuery).fn.parse=function(d){var p=d.config||{},x=[];return this.each(function(D){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var P=0;P<this.files.length;P++)x.push({file:this.files[P],inputElem:this,instanceConfig:i.extend({},p)})}),E(),this;function E(){if(x.length===0)H(d.complete)&&d.complete();else{var D,P,te,U,X=x[0];if(H(d.before)){var ae=d.before(X.file,X.inputElem);if(typeof ae=="object"){if(ae.action==="abort")return D="AbortError",P=X.file,te=X.inputElem,U=ae.reason,void(H(d.error)&&d.error({name:D},P,te,U));if(ae.action==="skip")return void j();typeof ae.config=="object"&&(X.instanceConfig=i.extend(X.instanceConfig,ae.config))}else if(ae==="skip")return void j()}var O=X.instanceConfig.complete;X.instanceConfig.complete=function(ce){H(O)&&O(ce,X.file,X.inputElem),j()},c.parse(X.file,X.instanceConfig)}}function j(){x.splice(0,1),E()}}),h&&(l.onmessage=function(d){d=d.data,c.WORKER_ID===void 0&&d&&(c.WORKER_ID=d.workerId),typeof d.input=="string"?l.postMessage({workerId:c.WORKER_ID,results:c.parse(d.input,d.config),finished:!0}):(l.File&&d.input instanceof File||d.input instanceof Object)&&(d=c.parse(d.input,d.config))&&l.postMessage({workerId:c.WORKER_ID,results:d,finished:!0})}),(S.prototype=Object.create(_.prototype)).constructor=S,(W.prototype=Object.create(_.prototype)).constructor=W,(z.prototype=Object.create(z.prototype)).constructor=z,(w.prototype=Object.create(_.prototype)).constructor=w,c})})(dn)),dn.exports}var ja=Sa();const ka=ha(ja),Ca=!0,Ke="u-",Ea="uplot",Aa=Ke+"hz",Ma=Ke+"vt",Ta=Ke+"title",Ra=Ke+"wrap",Da=Ke+"under",Na=Ke+"over",La=Ke+"axis",ul=Ke+"off",Pa=Ke+"select",Oa=Ke+"cursor-x",Fa=Ke+"cursor-y",Ia=Ke+"cursor-pt",za=Ke+"legend",Va=Ke+"live",Ha=Ke+"inline",Wa=Ke+"series",Ba=Ke+"marker",rr=Ke+"label",Ua=Ke+"value",Kl="width",Yl="height",ql="top",ir="bottom",Ml="left",Yn="right",ps="#000",ar=ps+"0",Jn="mousemove",or="mousedown",Qn="mouseup",cr="mouseenter",ur="mouseleave",fr="dblclick",Ga="resize",qa="scroll",hr="change",mn="dppxchange",ms="--",Ol=typeof window<"u",ss=Ol?document:null,Rl=Ol?window:null,$a=Ol?navigator:null;let ke,un;function rs(){let e=devicePixelRatio;ke!=e&&(ke=e,un&&as(hr,un,rs),un=matchMedia(`(min-resolution: ${ke-.001}dppx) and (max-resolution: ${ke+.001}dppx)`),fl(hr,un,rs),Rl.dispatchEvent(new CustomEvent(mn)))}function vt(e,n){if(n!=null){let r=e.classList;!r.contains(n)&&r.add(n)}}function is(e,n){let r=e.classList;r.contains(n)&&r.remove(n)}function Pe(e,n,r){e.style[n]=r+"px"}function Pt(e,n,r,l){let i=ss.createElement(e);return n!=null&&vt(i,n),r?.insertBefore(i,l),i}function Mt(e,n){return Pt("div",e,n)}const dr=new WeakMap;function Ut(e,n,r,l,i){let f="translate("+n+"px,"+r+"px)",h=dr.get(e);f!=h&&(e.style.transform=f,dr.set(e,f),n<0||r<0||n>l||r>i?vt(e,ul):is(e,ul))}const pr=new WeakMap;function mr(e,n,r){let l=n+r,i=pr.get(e);l!=i&&(pr.set(e,l),e.style.background=n,e.style.borderColor=r)}const gr=new WeakMap;function xr(e,n,r,l){let i=n+""+r,f=gr.get(e);i!=f&&(gr.set(e,i),e.style.height=r+"px",e.style.width=n+"px",e.style.marginLeft=l?-n/2+"px":0,e.style.marginTop=l?-r/2+"px":0)}const gs={passive:!0},Ka={...gs,capture:!0};function fl(e,n,r,l){n.addEventListener(e,r,l?Ka:gs)}function as(e,n,r,l){n.removeEventListener(e,r,gs)}Ol&&rs();function Ot(e,n,r,l){let i;r=r||0,l=l||n.length-1;let f=l<=2147483647;for(;l-r>1;)i=f?r+l>>1:St((r+l)/2),n[i]<e?r=i:l=i;return e-n[r]<=n[l]-e?r:l}function Jr(e){return(r,l,i)=>{let f=-1,h=-1;for(let y=l;y<=i;y++)if(e(r[y])){f=y;break}for(let y=i;y>=l;y--)if(e(r[y])){h=y;break}return[f,h]}}const Qr=e=>e!=null,Zr=e=>e!=null&&e>0,yn=Jr(Qr),Ya=Jr(Zr);function Ja(e,n,r,l=0,i=!1){let f=i?Ya:yn,h=i?Zr:Qr;[n,r]=f(e,n,r);let y=e[n],g=e[n];if(n>-1)if(l==1)y=e[n],g=e[r];else if(l==-1)y=e[r],g=e[n];else for(let c=n;c<=r;c++){let v=e[c];h(v)&&(v<y?y=v:v>g&&(g=v))}return[y??Te,g??-Te]}function wn(e,n,r,l){let i=_r(e),f=_r(n);e==n&&(i==-1?(e*=r,n/=r):(e/=r,n*=r));let h=r==10?$t:Xr,y=i==1?St:Rt,g=f==1?Rt:St,c=y(h($e(e))),v=g(h($e(n))),_=Dl(r,c),S=Dl(r,v);return r==10&&(c<0&&(_=Re(_,-c)),v<0&&(S=Re(S,-v))),l||r==2?(e=_*i,n=S*f):(e=ni(e,_),n=_n(n,S)),[e,n]}function xs(e,n,r,l){let i=wn(e,n,r,l);return e==0&&(i[0]=0),n==0&&(i[1]=0),i}const ys=.1,yr={mode:3,pad:ys},Ql={pad:0,soft:null,mode:0},Qa={min:Ql,max:Ql};function gn(e,n,r,l){return bn(r)?wr(e,n,r):(Ql.pad=r,Ql.soft=l?0:null,Ql.mode=l?3:0,wr(e,n,Qa))}function Se(e,n){return e??n}function Za(e,n,r){for(n=Se(n,0),r=Se(r,e.length-1);n<=r;){if(e[n]!=null)return!0;n++}return!1}function wr(e,n,r){let l=r.min,i=r.max,f=Se(l.pad,0),h=Se(i.pad,0),y=Se(l.hard,-Te),g=Se(i.hard,Te),c=Se(l.soft,Te),v=Se(i.soft,-Te),_=Se(l.mode,0),S=Se(i.mode,0),W=n-e,z=$t(W),w=mt($e(e),$e(n)),$=$t(w),Q=$e($-z);(W<1e-24||Q>10)&&(W=0,(e==0||n==0)&&(W=1e-24,_==2&&c!=Te&&(f=0),S==2&&v!=-Te&&(h=0)));let M=W||w||1e3,J=$t(M),N=Dl(10,St(J)),fe=M*(W==0?e==0?.1:1:f),B=Re(ni(e-fe,N/10),24),ie=e>=c&&(_==1||_==3&&B<=c||_==2&&B>=c)?c:Te,H=mt(y,B<ie&&e>=ie?ie:Ft(ie,B)),d=M*(W==0?n==0?.1:1:h),p=Re(_n(n+d,N/10),24),x=n<=v&&(S==1||S==3&&p>=v||S==2&&p<=v)?v:-Te,E=Ft(g,p>x&&n<=x?x:mt(x,p));return H==E&&H==0&&(E=100),[H,E]}const Xa=new Intl.NumberFormat(Ol?$a.language:"en-US"),ws=e=>Xa.format(e),jt=Math,pn=jt.PI,$e=jt.abs,St=jt.floor,qe=jt.round,Rt=jt.ceil,Ft=jt.min,mt=jt.max,Dl=jt.pow,_r=jt.sign,$t=jt.log10,Xr=jt.log2,eo=(e,n=1)=>jt.sinh(e)*n,Zn=(e,n=1)=>jt.asinh(e/n),Te=1/0;function br(e){return($t((e^e>>31)-(e>>31))|0)+1}function os(e,n,r){return Ft(mt(e,n),r)}function ei(e){return typeof e=="function"}function ye(e){return ei(e)?e:()=>e}const to=()=>{},ti=e=>e,li=(e,n)=>n,lo=e=>null,vr=e=>!0,Sr=(e,n)=>e==n,no=/\.\d*?(?=9{6,}|0{6,})/gm,hl=e=>{if(ri(e)||tl.has(e))return e;const n=`${e}`,r=n.match(no);if(r==null)return e;let l=r[0].length-1;if(n.indexOf("e-")!=-1){let[i,f]=n.split("e");return+`${hl(i)}e${f}`}return Re(e,l)};function ol(e,n){return hl(Re(hl(e/n))*n)}function _n(e,n){return hl(Rt(hl(e/n))*n)}function ni(e,n){return hl(St(hl(e/n))*n)}function Re(e,n=0){if(ri(e))return e;let r=10**n,l=e*r*(1+Number.EPSILON);return qe(l)/r}const tl=new Map;function si(e){return((""+e).split(".")[1]||"").length}function Xl(e,n,r,l){let i=[],f=l.map(si);for(let h=n;h<r;h++){let y=$e(h),g=Re(Dl(e,h),y);for(let c=0;c<l.length;c++){let v=e==10?+`${l[c]}e${h}`:l[c]*g,_=(h>=0?0:y)+(h>=f[c]?0:f[c]),S=e==10?v:Re(v,_);i.push(S),tl.set(S,_)}}return i}const Zl={},_s=[],Nl=[null,null],el=Array.isArray,ri=Number.isInteger,so=e=>e===void 0;function jr(e){return typeof e=="string"}function bn(e){let n=!1;if(e!=null){let r=e.constructor;n=r==null||r==Object}return n}function ro(e){return e!=null&&typeof e=="object"}const io=Object.getPrototypeOf(Uint8Array),ii="__proto__";function Ll(e,n=bn){let r;if(el(e)){let l=e.find(i=>i!=null);if(el(l)||n(l)){r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=Ll(e[i],n)}else r=e.slice()}else if(e instanceof io)r=e.slice();else if(n(e)){r={};for(let l in e)l!=ii&&(r[l]=Ll(e[l],n))}else r=e;return r}function Ge(e){let n=arguments;for(let r=1;r<n.length;r++){let l=n[r];for(let i in l)i!=ii&&(bn(e[i])?Ge(e[i],Ll(l[i])):e[i]=Ll(l[i]))}return e}const ao=0,oo=1,co=2;function uo(e,n,r){for(let l=0,i,f=-1;l<n.length;l++){let h=n[l];if(h>f){for(i=h-1;i>=0&&e[i]==null;)e[i--]=null;for(i=h+1;i<r&&e[i]==null;)e[f=i++]=null}}}function fo(e,n){if(mo(e)){let h=e[0].slice();for(let y=1;y<e.length;y++)h.push(...e[y].slice(1));return go(h[0])||(h=po(h)),h}let r=new Set;for(let h=0;h<e.length;h++){let g=e[h][0],c=g.length;for(let v=0;v<c;v++)r.add(g[v])}let l=[Array.from(r).sort((h,y)=>h-y)],i=l[0].length,f=new Map;for(let h=0;h<i;h++)f.set(l[0][h],h);for(let h=0;h<e.length;h++){let y=e[h],g=y[0];for(let c=1;c<y.length;c++){let v=y[c],_=Array(i).fill(void 0),S=n?n[h][c]:oo,W=[];for(let z=0;z<v.length;z++){let w=v[z],$=f.get(g[z]);w===null?S!=ao&&(_[$]=w,S==co&&W.push($)):_[$]=w}uo(_,W,i),l.push(_)}}return l}const ho=typeof queueMicrotask>"u"?e=>Promise.resolve().then(e):queueMicrotask;function po(e){let n=e[0],r=n.length,l=Array(r);for(let f=0;f<l.length;f++)l[f]=f;l.sort((f,h)=>n[f]-n[h]);let i=[];for(let f=0;f<e.length;f++){let h=e[f],y=Array(r);for(let g=0;g<r;g++)y[g]=h[l[g]];i.push(y)}return i}function mo(e){let n=e[0][0],r=n.length;for(let l=1;l<e.length;l++){let i=e[l][0];if(i.length!=r)return!1;if(i!=n){for(let f=0;f<r;f++)if(i[f]!=n[f])return!1}}return!0}function go(e,n=100){const r=e.length;if(r<=1)return!0;let l=0,i=r-1;for(;l<=i&&e[l]==null;)l++;for(;i>=l&&e[i]==null;)i--;if(i<=l)return!0;const f=mt(1,St((i-l+1)/n));for(let h=e[l],y=l+f;y<=i;y+=f){const g=e[y];if(g!=null){if(g<=h)return!1;h=g}}return!0}const ai=["January","February","March","April","May","June","July","August","September","October","November","December"],oi=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ci(e){return e.slice(0,3)}const xo=oi.map(ci),yo=ai.map(ci),wo={MMMM:ai,MMM:yo,WWWW:oi,WWW:xo};function $l(e){return(e<10?"0":"")+e}function _o(e){return(e<10?"00":e<100?"0":"")+e}const bo={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,n)=>n.MMMM[e.getMonth()],MMM:(e,n)=>n.MMM[e.getMonth()],MM:e=>$l(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>$l(e.getDate()),D:e=>e.getDate(),WWWW:(e,n)=>n.WWWW[e.getDay()],WWW:(e,n)=>n.WWW[e.getDay()],HH:e=>$l(e.getHours()),H:e=>e.getHours(),h:e=>{let n=e.getHours();return n==0?12:n>12?n-12:n},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>$l(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>$l(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>_o(e.getMilliseconds())};function bs(e,n){n=n||wo;let r=[],l=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=l.exec(e);)r.push(i[0][0]=="{"?bo[i[1]]:i[0]);return f=>{let h="";for(let y=0;y<r.length;y++)h+=typeof r[y]=="string"?r[y]:r[y](f,n);return h}}const vo=new Intl.DateTimeFormat().resolvedOptions().timeZone;function So(e,n){let r;return n=="UTC"||n=="Etc/UTC"?r=new Date(+e+e.getTimezoneOffset()*6e4):n==vo?r=e:(r=new Date(e.toLocaleString("en-US",{timeZone:n})),r.setMilliseconds(e.getMilliseconds())),r}const ui=e=>e%1==0,xn=[1,2,2.5,5],jo=Xl(10,-32,0,xn),fi=Xl(10,0,32,xn),ko=fi.filter(ui),cl=jo.concat(fi),vs=`
|
||
`,hi="{YYYY}",kr=vs+hi,di="{M}/{D}",Jl=vs+di,fn=Jl+"/{YY}",pi="{aa}",Co="{h}:{mm}",Tl=Co+pi,Cr=vs+Tl,Er=":{ss}",Ce=null;function mi(e){let n=e*1e3,r=n*60,l=r*60,i=l*24,f=i*30,h=i*365,g=(e==1?Xl(10,0,3,xn).filter(ui):Xl(10,-3,0,xn)).concat([n,n*5,n*10,n*15,n*30,r,r*5,r*10,r*15,r*30,l,l*2,l*3,l*4,l*6,l*8,l*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,f,f*2,f*3,f*4,f*6,h,h*2,h*5,h*10,h*25,h*50,h*100]);const c=[[h,hi,Ce,Ce,Ce,Ce,Ce,Ce,1],[i*28,"{MMM}",kr,Ce,Ce,Ce,Ce,Ce,1],[i,di,kr,Ce,Ce,Ce,Ce,Ce,1],[l,"{h}"+pi,fn,Ce,Jl,Ce,Ce,Ce,1],[r,Tl,fn,Ce,Jl,Ce,Ce,Ce,1],[n,Er,fn+" "+Tl,Ce,Jl+" "+Tl,Ce,Cr,Ce,1],[e,Er+".{fff}",fn+" "+Tl,Ce,Jl+" "+Tl,Ce,Cr,Ce,1]];function v(_){return(S,W,z,w,$,Q)=>{let M=[],J=$>=h,N=$>=f&&$<h,fe=_(z),B=Re(fe*e,3),ie=Xn(fe.getFullYear(),J?0:fe.getMonth(),N||J?1:fe.getDate()),H=Re(ie*e,3);if(N||J){let d=N?$/f:0,p=J?$/h:0,x=B==H?B:Re(Xn(ie.getFullYear()+p,ie.getMonth()+d,1)*e,3),E=new Date(qe(x/e)),j=E.getFullYear(),D=E.getMonth();for(let P=0;x<=w;P++){let te=Xn(j+p*P,D+d*P,1),U=te-_(Re(te*e,3));x=Re((+te+U)*e,3),x<=w&&M.push(x)}}else{let d=$>=i?i:$,p=St(z)-St(B),x=H+p+_n(B-H,d);M.push(x);let E=_(x),j=E.getHours()+E.getMinutes()/r+E.getSeconds()/l,D=$/l,P=S.axes[W]._space,te=Q/P;for(;x=Re(x+$,e==1?0:3),!(x>w);)if(D>1){let U=St(Re(j+D,6))%24,O=_(x).getHours()-U;O>1&&(O=-1),x-=O*l,j=(j+D)%24;let ce=M[M.length-1];Re((x-ce)/$,3)*te>=.7&&M.push(x)}else M.push(x)}return M}}return[g,c,v]}const[Eo,Ao,Mo]=mi(1),[To,Ro,Do]=mi(.001);Xl(2,-53,53,[1]);function Ar(e,n){return e.map(r=>r.map((l,i)=>i==0||i==8||l==null?l:n(i==1||r[8]==0?l:r[1]+l)))}function Mr(e,n){return(r,l,i,f,h)=>{let y=n.find(z=>h>=z[0])||n[n.length-1],g,c,v,_,S,W;return l.map(z=>{let w=e(z),$=w.getFullYear(),Q=w.getMonth(),M=w.getDate(),J=w.getHours(),N=w.getMinutes(),fe=w.getSeconds(),B=$!=g&&y[2]||Q!=c&&y[3]||M!=v&&y[4]||J!=_&&y[5]||N!=S&&y[6]||fe!=W&&y[7]||y[1];return g=$,c=Q,v=M,_=J,S=N,W=fe,B(w)})}}function No(e,n){let r=bs(n);return(l,i,f,h,y)=>i.map(g=>r(e(g)))}function Xn(e,n,r){return new Date(e,n,r)}function Tr(e,n){return n(e)}const Lo="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Rr(e,n){return(r,l,i,f)=>f==null?ms:n(e(l))}function Po(e,n){let r=e.series[n];return r.width?r.stroke(e,n):r.points.width?r.points.stroke(e,n):null}function Oo(e,n){return e.series[n].fill(e,n)}const Fo={show:!0,live:!0,isolate:!1,mount:to,markers:{show:!0,width:2,stroke:Po,fill:Oo,dash:"solid"},idx:null,idxs:null,values:[]};function Io(e,n){let r=e.cursor.points,l=Mt(),i=r.size(e,n);Pe(l,Kl,i),Pe(l,Yl,i);let f=i/-2;Pe(l,"marginLeft",f),Pe(l,"marginTop",f);let h=r.width(e,n,i);return h&&Pe(l,"borderWidth",h),l}function zo(e,n){let r=e.series[n].points;return r._fill||r._stroke}function Vo(e,n){let r=e.series[n].points;return r._stroke||r._fill}function Ho(e,n){return e.series[n].points.size}const es=[0,0];function Wo(e,n,r){return es[0]=n,es[1]=r,es}function hn(e,n,r,l=!0){return i=>{i.button==0&&(!l||i.target==n)&&r(i)}}function ts(e,n,r,l=!0){return i=>{(!l||i.target==n)&&r(i)}}const Bo={show:!0,x:!0,y:!0,lock:!1,move:Wo,points:{one:!1,show:Io,size:Ho,width:0,stroke:Vo,fill:zo},bind:{mousedown:hn,mouseup:hn,click:hn,dblclick:hn,mousemove:ts,mouseleave:ts,mouseenter:ts},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,n)=>{n.stopPropagation(),n.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,n,r,l,i)=>l-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},gi={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Ss=Ge({},gi,{filter:li}),xi=Ge({},Ss,{size:10}),yi=Ge({},gi,{show:!1}),js='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"',wi="bold "+js,_i=1.5,Dr={show:!0,scale:"x",stroke:ps,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:wi,side:2,grid:Ss,ticks:xi,border:yi,font:js,lineGap:_i,rotate:0},Uo="Value",Go="Time",Nr={show:!0,scale:"x",auto:!1,sorted:1,min:Te,max:-Te,idxs:[]};function qo(e,n,r,l,i){return n.map(f=>f==null?"":ws(f))}function $o(e,n,r,l,i,f,h){let y=[],g=tl.get(i)||0;r=h?r:Re(_n(r,i),g);for(let c=r;c<=l;c=Re(c+i,g))y.push(Object.is(c,-0)?0:c);return y}function cs(e,n,r,l,i,f,h){const y=[],g=e.scales[e.axes[n].scale].log,c=g==10?$t:Xr,v=St(c(r));i=Dl(g,v),g==10&&(i=cl[Ot(i,cl)]);let _=r,S=i*g;g==10&&(S=cl[Ot(S,cl)]);do y.push(_),_=_+i,g==10&&!tl.has(_)&&(_=Re(_,tl.get(i))),_>=S&&(i=_,S=i*g,g==10&&(S=cl[Ot(S,cl)]));while(_<=l);return y}function Ko(e,n,r,l,i,f,h){let g=e.scales[e.axes[n].scale].asinh,c=l>g?cs(e,n,mt(g,r),l,i):[g],v=l>=0&&r<=0?[0]:[];return(r<-g?cs(e,n,mt(g,-l),-r,i):[g]).reverse().map(S=>-S).concat(v,c)}const bi=/./,Yo=/[12357]/,Jo=/[125]/,Lr=/1/,us=(e,n,r,l)=>e.map((i,f)=>n==4&&i==0||f%l==0&&r.test(i.toExponential()[i<0?1:0])?i:null);function Qo(e,n,r,l,i){let f=e.axes[r],h=f.scale,y=e.scales[h],g=e.valToPos,c=f._space,v=g(10,h),_=g(9,h)-v>=c?bi:g(7,h)-v>=c?Yo:g(5,h)-v>=c?Jo:Lr;if(_==Lr){let S=$e(g(1,h)-v);if(S<c)return us(n.slice().reverse(),y.distr,_,Rt(c/S)).reverse()}return us(n,y.distr,_,1)}function Zo(e,n,r,l,i){let f=e.axes[r],h=f.scale,y=f._space,g=e.valToPos,c=$e(g(1,h)-g(2,h));return c<y?us(n.slice().reverse(),3,bi,Rt(y/c)).reverse():n}function Xo(e,n,r,l){return l==null?ms:n==null?"":ws(n)}const Pr={show:!0,scale:"y",stroke:ps,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:wi,side:3,grid:Ss,ticks:xi,border:yi,font:js,lineGap:_i,rotate:0};function ec(e,n){let r=3+(e||1)*2;return Re(r*n,3)}function tc(e,n){let{scale:r,idxs:l}=e.series[0],i=e._data[0],f=e.valToPos(i[l[0]],r,!0),h=e.valToPos(i[l[1]],r,!0),y=$e(h-f),g=e.series[n],c=y/(g.points.space*ke);return l[1]-l[0]<=c}const Or={scale:null,auto:!0,sorted:0,min:Te,max:-Te},vi=(e,n,r,l,i)=>i,Fr={show:!0,auto:!0,sorted:0,gaps:vi,alpha:1,facets:[Ge({},Or,{scale:"x"}),Ge({},Or,{scale:"y"})]},Ir={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:vi,alpha:1,points:{show:tc,filter:null},values:null,min:Te,max:-Te,idxs:[],path:null,clip:null};function lc(e,n,r,l,i){return r/10}const Si={time:Ca,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},nc=Ge({},Si,{time:!1,ori:1}),zr={};function ji(e,n){let r=zr[e];return r||(r={key:e,plots:[],sub(l){r.plots.push(l)},unsub(l){r.plots=r.plots.filter(i=>i!=l)},pub(l,i,f,h,y,g,c){for(let v=0;v<r.plots.length;v++)r.plots[v]!=i&&r.plots[v].pub(l,i,f,h,y,g,c)}},e!=null&&(zr[e]=r)),r}const Pl=1,fs=2;function dl(e,n,r){const l=e.mode,i=e.series[n],f=l==2?e._data[n]:e._data,h=e.scales,y=e.bbox;let g=f[0],c=l==2?f[1]:f[n],v=l==2?h[i.facets[0].scale]:h[e.series[0].scale],_=l==2?h[i.facets[1].scale]:h[i.scale],S=y.left,W=y.top,z=y.width,w=y.height,$=e.valToPosH,Q=e.valToPosV;return v.ori==0?r(i,g,c,v,_,$,Q,S,W,z,w,Sn,Fl,kn,Ci,Ai):r(i,g,c,v,_,Q,$,W,S,w,z,jn,Il,Es,Ei,Mi)}function ks(e,n){let r=0,l=0,i=Se(e.bands,_s);for(let f=0;f<i.length;f++){let h=i[f];h.series[0]==n?r=h.dir:h.series[1]==n&&(h.dir==1?l|=1:l|=2)}return[r,l==1?-1:l==2?1:l==3?2:0]}function sc(e,n,r,l,i){let f=e.mode,h=e.series[n],y=f==2?h.facets[1].scale:h.scale,g=e.scales[y];return i==-1?g.min:i==1?g.max:g.distr==3?g.dir==1?g.min:g.max:0}function Kt(e,n,r,l,i,f){return dl(e,n,(h,y,g,c,v,_,S,W,z,w,$)=>{let Q=h.pxRound;const M=c.dir*(c.ori==0?1:-1),J=c.ori==0?Fl:Il;let N,fe;M==1?(N=r,fe=l):(N=l,fe=r);let B=Q(_(y[N],c,w,W)),ie=Q(S(g[N],v,$,z)),H=Q(_(y[fe],c,w,W)),d=Q(S(f==1?v.max:v.min,v,$,z)),p=new Path2D(i);return J(p,H,d),J(p,B,d),J(p,B,ie),p})}function vn(e,n,r,l,i,f){let h=null;if(e.length>0){h=new Path2D;const y=n==0?kn:Es;let g=r;for(let _=0;_<e.length;_++){let S=e[_];if(S[1]>S[0]){let W=S[0]-g;W>0&&y(h,g,l,W,l+f),g=S[1]}}let c=r+i-g,v=10;c>0&&y(h,g,l-v/2,c,l+f+v)}return h}function rc(e,n,r){let l=e[e.length-1];l&&l[0]==n?l[1]=r:e.push([n,r])}function Cs(e,n,r,l,i,f,h){let y=[],g=e.length;for(let c=i==1?r:l;c>=r&&c<=l;c+=i)if(n[c]===null){let _=c,S=c;if(i==1)for(;++c<=l&&n[c]===null;)S=c;else for(;--c>=r&&n[c]===null;)S=c;let W=f(e[_]),z=S==_?W:f(e[S]),w=_-i;W=h<=0&&w>=0&&w<g?f(e[w]):W;let Q=S+i;z=h>=0&&Q>=0&&Q<g?f(e[Q]):z,z>=W&&y.push([W,z])}return y}function Vr(e){return e==0?ti:e==1?qe:n=>ol(n,e)}function ki(e){let n=e==0?Sn:jn,r=e==0?(i,f,h,y,g,c)=>{i.arcTo(f,h,y,g,c)}:(i,f,h,y,g,c)=>{i.arcTo(h,f,g,y,c)},l=e==0?(i,f,h,y,g)=>{i.rect(f,h,y,g)}:(i,f,h,y,g)=>{i.rect(h,f,g,y)};return(i,f,h,y,g,c=0,v=0)=>{c==0&&v==0?l(i,f,h,y,g):(c=Ft(c,y/2,g/2),v=Ft(v,y/2,g/2),n(i,f+c,h),r(i,f+y,h,f+y,h+g,c),r(i,f+y,h+g,f,h+g,v),r(i,f,h+g,f,h,v),r(i,f,h,f+y,h,c),i.closePath())}}const Sn=(e,n,r)=>{e.moveTo(n,r)},jn=(e,n,r)=>{e.moveTo(r,n)},Fl=(e,n,r)=>{e.lineTo(n,r)},Il=(e,n,r)=>{e.lineTo(r,n)},kn=ki(0),Es=ki(1),Ci=(e,n,r,l,i,f)=>{e.arc(n,r,l,i,f)},Ei=(e,n,r,l,i,f)=>{e.arc(r,n,l,i,f)},Ai=(e,n,r,l,i,f,h)=>{e.bezierCurveTo(n,r,l,i,f,h)},Mi=(e,n,r,l,i,f,h)=>{e.bezierCurveTo(r,n,i,l,h,f)};function Ti(e){return(n,r,l,i,f)=>dl(n,r,(h,y,g,c,v,_,S,W,z,w,$)=>{let{pxRound:Q,points:M}=h,J,N;c.ori==0?(J=Sn,N=Ci):(J=jn,N=Ei);const fe=Re(M.width*ke,3);let B=(M.size-M.width)/2*ke,ie=Re(B*2,3),H=new Path2D,d=new Path2D,{left:p,top:x,width:E,height:j}=n.bbox;kn(d,p-ie,x-ie,E+ie*2,j+ie*2);const D=P=>{if(g[P]!=null){let te=Q(_(y[P],c,w,W)),U=Q(S(g[P],v,$,z));J(H,te+B,U),N(H,te,U,B,0,pn*2)}};if(f)f.forEach(D);else for(let P=l;P<=i;P++)D(P);return{stroke:fe>0?H:null,fill:H,clip:d,flags:Pl|fs}})}function Ri(e){return(n,r,l,i,f,h)=>{l!=i&&(f!=l&&h!=l&&e(n,r,l),f!=i&&h!=i&&e(n,r,i),e(n,r,h))}}const ic=Ri(Fl),ac=Ri(Il);function Di(e){const n=Se(e?.alignGaps,0);return(r,l,i,f)=>dl(r,l,(h,y,g,c,v,_,S,W,z,w,$)=>{[i,f]=yn(g,i,f);let Q=h.pxRound,M=j=>Q(_(j,c,w,W)),J=j=>Q(S(j,v,$,z)),N,fe;c.ori==0?(N=Fl,fe=ic):(N=Il,fe=ac);const B=c.dir*(c.ori==0?1:-1),ie={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Pl},H=ie.stroke;let d=!1;if(f-i>=w*4){let j=A=>r.posToVal(A,c.key,!0),D=null,P=null,te,U,X,ae=M(y[B==1?i:f]),O=M(y[i]),ce=M(y[f]),L=j(B==1?O+1:ce-1);for(let A=B==1?i:f;A>=i&&A<=f;A+=B){let F=y[A],le=(B==1?F<L:F>L)?ae:M(F),ee=g[A];le==ae?ee!=null?(U=ee,D==null?(N(H,le,J(U)),te=D=P=U):U<D?D=U:U>P&&(P=U)):ee===null&&(d=!0):(D!=null&&fe(H,ae,J(D),J(P),J(te),J(U)),ee!=null?(U=ee,N(H,le,J(U)),D=P=te=U):(D=P=null,ee===null&&(d=!0)),ae=le,L=j(ae+B))}D!=null&&D!=P&&X!=ae&&fe(H,ae,J(D),J(P),J(te),J(U))}else for(let j=B==1?i:f;j>=i&&j<=f;j+=B){let D=g[j];D===null?d=!0:D!=null&&N(H,M(y[j]),J(D))}let[x,E]=ks(r,l);if(h.fill!=null||x!=0){let j=ie.fill=new Path2D(H),D=h.fillTo(r,l,h.min,h.max,x),P=J(D),te=M(y[i]),U=M(y[f]);B==-1&&([U,te]=[te,U]),N(j,U,P),N(j,te,P)}if(!h.spanGaps){let j=[];d&&j.push(...Cs(y,g,i,f,B,M,n)),ie.gaps=j=h.gaps(r,l,i,f,j),ie.clip=vn(j,c.ori,W,z,w,$)}return E!=0&&(ie.band=E==2?[Kt(r,l,i,f,H,-1),Kt(r,l,i,f,H,1)]:Kt(r,l,i,f,H,E)),ie})}function oc(e){const n=Se(e.align,1),r=Se(e.ascDesc,!1),l=Se(e.alignGaps,0),i=Se(e.extend,!1);return(f,h,y,g)=>dl(f,h,(c,v,_,S,W,z,w,$,Q,M,J)=>{[y,g]=yn(_,y,g);let N=c.pxRound,{left:fe,width:B}=f.bbox,ie=O=>N(z(O,S,M,$)),H=O=>N(w(O,W,J,Q)),d=S.ori==0?Fl:Il;const p={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Pl},x=p.stroke,E=S.dir*(S.ori==0?1:-1);let j=H(_[E==1?y:g]),D=ie(v[E==1?y:g]),P=D,te=D;i&&n==-1&&(te=fe,d(x,te,j)),d(x,D,j);for(let O=E==1?y:g;O>=y&&O<=g;O+=E){let ce=_[O];if(ce==null)continue;let L=ie(v[O]),A=H(ce);n==1?d(x,L,j):d(x,P,A),d(x,L,A),j=A,P=L}let U=P;i&&n==1&&(U=fe+B,d(x,U,j));let[X,ae]=ks(f,h);if(c.fill!=null||X!=0){let O=p.fill=new Path2D(x),ce=c.fillTo(f,h,c.min,c.max,X),L=H(ce);d(O,U,L),d(O,te,L)}if(!c.spanGaps){let O=[];O.push(...Cs(v,_,y,g,E,ie,l));let ce=c.width*ke/2,L=r||n==1?ce:-ce,A=r||n==-1?-ce:ce;O.forEach(F=>{F[0]+=L,F[1]+=A}),p.gaps=O=c.gaps(f,h,y,g,O),p.clip=vn(O,S.ori,$,Q,M,J)}return ae!=0&&(p.band=ae==2?[Kt(f,h,y,g,x,-1),Kt(f,h,y,g,x,1)]:Kt(f,h,y,g,x,ae)),p})}function Hr(e,n,r,l,i,f,h=Te){if(e.length>1){let y=null;for(let g=0,c=1/0;g<e.length;g++)if(n[g]!==void 0){if(y!=null){let v=$e(e[g]-e[y]);v<c&&(c=v,h=$e(r(e[g],l,i,f)-r(e[y],l,i,f)))}y=g}}return h}function cc(e){e=e||Zl;const n=Se(e.size,[.6,Te,1]),r=e.align||0,l=e.gap||0;let i=e.radius;i=i==null?[0,0]:typeof i=="number"?[i,0]:i;const f=ye(i),h=1-n[0],y=Se(n[1],Te),g=Se(n[2],1),c=Se(e.disp,Zl),v=Se(e.each,W=>{}),{fill:_,stroke:S}=c;return(W,z,w,$)=>dl(W,z,(Q,M,J,N,fe,B,ie,H,d,p,x)=>{let E=Q.pxRound,j=r,D=l*ke,P=y*ke,te=g*ke,U,X;N.ori==0?[U,X]=f(W,z):[X,U]=f(W,z);const ae=N.dir*(N.ori==0?1:-1);let O=N.ori==0?kn:Es,ce=N.ori==0?v:(R,ge,pe,He,lt,gt,It)=>{v(R,ge,pe,lt,He,It,gt)},L=Se(W.bands,_s).find(R=>R.series[0]==z),A=L!=null?L.dir:0,F=Q.fillTo(W,z,Q.min,Q.max,A),Ee=E(ie(F,fe,x,d)),le,ee,Fe,se=p,q=E(Q.width*ke),_e=!1,Z=null,me=null,Ae=null,we=null;_!=null&&(q==0||S!=null)&&(_e=!0,Z=_.values(W,z,w,$),me=new Map,new Set(Z).forEach(R=>{R!=null&&me.set(R,new Path2D)}),q>0&&(Ae=S.values(W,z,w,$),we=new Map,new Set(Ae).forEach(R=>{R!=null&&we.set(R,new Path2D)})));let{x0:be,size:he}=c;if(be!=null&&he!=null){j=1,M=be.values(W,z,w,$),be.unit==2&&(M=M.map(pe=>W.posToVal(H+pe*p,N.key,!0)));let R=he.values(W,z,w,$);he.unit==2?ee=R[0]*p:ee=B(R[0],N,p,H)-B(0,N,p,H),se=Hr(M,J,B,N,p,H,se),Fe=se-ee+D}else se=Hr(M,J,B,N,p,H,se),Fe=se*h+D,ee=se-Fe;Fe<1&&(Fe=0),q>=ee/2&&(q=0),Fe<5&&(E=ti);let rt=Fe>0,re=se-Fe-(rt?q:0);ee=E(os(re,te,P)),le=(j==0?ee/2:j==ae?0:ee)-j*ae*((j==0?D/2:0)+(rt?q/2:0));const de={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},ut=_e?null:new Path2D;let it=null;if(L!=null)it=W.data[L.series[1]];else{let{y0:R,y1:ge}=c;R!=null&&ge!=null&&(J=ge.values(W,z,w,$),it=R.values(W,z,w,$))}let Ye=U*ee,oe=X*ee;for(let R=ae==1?w:$;R>=w&&R<=$;R+=ae){let ge=J[R];if(ge==null)continue;if(it!=null){let Be=it[R]??0;if(ge-Be==0)continue;Ee=ie(Be,fe,x,d)}let pe=N.distr!=2||c!=null?M[R]:R,He=B(pe,N,p,H),lt=ie(Se(ge,F),fe,x,d),gt=E(He-le),It=E(mt(lt,Ee)),We=E(Ft(lt,Ee)),Ie=It-We;if(ge!=null){let Be=ge<0?oe:Ye,xt=ge<0?Ye:oe;_e?(q>0&&Ae[R]!=null&&O(we.get(Ae[R]),gt,We+St(q/2),ee,mt(0,Ie-q),Be,xt),Z[R]!=null&&O(me.get(Z[R]),gt,We+St(q/2),ee,mt(0,Ie-q),Be,xt)):O(ut,gt,We+St(q/2),ee,mt(0,Ie-q),Be,xt),ce(W,z,R,gt-q/2,We,ee+q,Ie)}}return q>0?de.stroke=_e?we:ut:_e||(de._fill=Q.width==0?Q._fill:Q._stroke??Q._fill,de.width=0),de.fill=_e?me:ut,de})}function uc(e,n){const r=Se(n?.alignGaps,0);return(l,i,f,h)=>dl(l,i,(y,g,c,v,_,S,W,z,w,$,Q)=>{[f,h]=yn(c,f,h);let M=y.pxRound,J=U=>M(S(U,v,$,z)),N=U=>M(W(U,_,Q,w)),fe,B,ie;v.ori==0?(fe=Sn,ie=Fl,B=Ai):(fe=jn,ie=Il,B=Mi);const H=v.dir*(v.ori==0?1:-1);let d=J(g[H==1?f:h]),p=d,x=[],E=[];for(let U=H==1?f:h;U>=f&&U<=h;U+=H)if(c[U]!=null){let ae=g[U],O=J(ae);x.push(p=O),E.push(N(c[U]))}const j={stroke:e(x,E,fe,ie,B,M),fill:null,clip:null,band:null,gaps:null,flags:Pl},D=j.stroke;let[P,te]=ks(l,i);if(y.fill!=null||P!=0){let U=j.fill=new Path2D(D),X=y.fillTo(l,i,y.min,y.max,P),ae=N(X);ie(U,p,ae),ie(U,d,ae)}if(!y.spanGaps){let U=[];U.push(...Cs(g,c,f,h,H,J,r)),j.gaps=U=y.gaps(l,i,f,h,U),j.clip=vn(U,v.ori,z,w,$,Q)}return te!=0&&(j.band=te==2?[Kt(l,i,f,h,D,-1),Kt(l,i,f,h,D,1)]:Kt(l,i,f,h,D,te)),j})}function fc(e){return uc(hc,e)}function hc(e,n,r,l,i,f){const h=e.length;if(h<2)return null;const y=new Path2D;if(r(y,e[0],n[0]),h==2)l(y,e[1],n[1]);else{let g=Array(h),c=Array(h-1),v=Array(h-1),_=Array(h-1);for(let S=0;S<h-1;S++)v[S]=n[S+1]-n[S],_[S]=e[S+1]-e[S],c[S]=v[S]/_[S];g[0]=c[0];for(let S=1;S<h-1;S++)c[S]===0||c[S-1]===0||c[S-1]>0!=c[S]>0?g[S]=0:(g[S]=3*(_[S-1]+_[S])/((2*_[S]+_[S-1])/c[S-1]+(_[S]+2*_[S-1])/c[S]),isFinite(g[S])||(g[S]=0));g[h-1]=c[h-2];for(let S=0;S<h-1;S++)i(y,e[S]+_[S]/3,n[S]+g[S]*_[S]/3,e[S+1]-_[S]/3,n[S+1]-g[S+1]*_[S]/3,e[S+1],n[S+1])}return y}const hs=new Set;function Wr(){for(let e of hs)e.syncRect(!0)}Ol&&(fl(Ga,Rl,Wr),fl(qa,Rl,Wr,!0),fl(mn,Rl,()=>{ct.pxRatio=ke}));const dc=Di(),pc=Ti();function Br(e,n,r,l){return(l?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((f,h)=>ds(f,h,n,r))}function mc(e,n){return e.map((r,l)=>l==0?{}:Ge({},n,r))}function ds(e,n,r,l){return Ge({},n==0?r:l,e)}function Ni(e,n,r){return n==null?Nl:[n,r]}const gc=Ni;function xc(e,n,r){return n==null?Nl:gn(n,r,ys,!0)}function Li(e,n,r,l){return n==null?Nl:wn(n,r,e.scales[l].log,!1)}const yc=Li;function Pi(e,n,r,l){return n==null?Nl:xs(n,r,e.scales[l].log,!1)}const wc=Pi;function _c(e,n,r,l,i){let f=mt(br(e),br(n)),h=n-e,y=Ot(i/l*h,r);do{let g=r[y],c=l*g/h;if(c>=i&&f+(g<5?tl.get(g):0)<=17)return[g,c]}while(++y<r.length);return[0,0]}function Ur(e){let n,r;return e=e.replace(/(\d+)px/,(l,i)=>(n=qe((r=+i)*ke))+"px"),[e,n,r]}function bc(e){e.show&&[e.font,e.labelFont].forEach(n=>{let r=Re(n[2]*ke,1);n[0]=n[0].replace(/[0-9.]+px/,r+"px"),n[1]=r})}function ct(e,n,r){const l={mode:Se(e.mode,1)},i=l.mode;function f(t,s,a,o){let m=s.valToPct(t);return o+a*(s.dir==-1?1-m:m)}function h(t,s,a,o){let m=s.valToPct(t);return o+a*(s.dir==-1?m:1-m)}function y(t,s,a,o){return s.ori==0?f(t,s,a,o):h(t,s,a,o)}l.valToPosH=f,l.valToPosV=h;let g=!1;l.status=0;const c=l.root=Mt(Ea);if(e.id!=null&&(c.id=e.id),vt(c,e.class),e.title){let t=Mt(Ta,c);t.textContent=e.title}const v=Pt("canvas"),_=l.ctx=v.getContext("2d"),S=Mt(Ra,c);fl("click",S,t=>{t.target===z&&(De!=jl||Oe!=kl)&&st.click(l,t)},!0);const W=l.under=Mt(Da,S);S.appendChild(v);const z=l.over=Mt(Na,S);e=Ll(e);const w=+Se(e.pxAlign,1),$=Vr(w);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(l,e)||e)});const Q=e.ms||.001,M=l.series=i==1?Br(e.series||[],Nr,Ir,!1):mc(e.series||[null],Fr),J=l.axes=Br(e.axes||[],Dr,Pr,!0),N=l.scales={},fe=l.bands=e.bands||[];fe.forEach(t=>{t.fill=ye(t.fill||null),t.dir=Se(t.dir,-1)});const B=i==2?M[1].facets[0].scale:M[0].scale,ie={axes:Qi,series:qi},H=(e.drawOrder||["axes","series"]).map(t=>ie[t]);function d(t){const s=t.distr==3?a=>$t(a>0?a:t.clamp(l,a,t.min,t.max,t.key)):t.distr==4?a=>Zn(a,t.asinh):t.distr==100?a=>t.fwd(a):a=>a;return a=>{let o=s(a),{_min:m,_max:b}=t,k=b-m;return(o-m)/k}}function p(t){let s=N[t];if(s==null){let a=(e.scales||Zl)[t]||Zl;if(a.from!=null){p(a.from);let o=Ge({},N[a.from],a,{key:t});o.valToPct=d(o),N[t]=o}else{s=N[t]=Ge({},t==B?Si:nc,a),s.key=t;let o=s.time,m=s.range,b=el(m);if((t!=B||i==2&&!o)&&(b&&(m[0]==null||m[1]==null)&&(m={min:m[0]==null?yr:{mode:1,hard:m[0],soft:m[0]},max:m[1]==null?yr:{mode:1,hard:m[1],soft:m[1]}},b=!1),!b&&bn(m))){let k=m;m=(C,T,I)=>T==null?Nl:gn(T,I,k)}s.range=ye(m||(o?gc:t==B?s.distr==3?yc:s.distr==4?wc:Ni:s.distr==3?Li:s.distr==4?Pi:xc)),s.auto=ye(b?!1:s.auto),s.clamp=ye(s.clamp||lc),s._min=s._max=null,s.valToPct=d(s)}}}p("x"),p("y"),i==1&&M.forEach(t=>{p(t.scale)}),J.forEach(t=>{p(t.scale)});for(let t in e.scales)p(t);const x=N[B],E=x.distr;let j,D;x.ori==0?(vt(c,Aa),j=f,D=h):(vt(c,Ma),j=h,D=f);const P={};for(let t in N){let s=N[t];(s.min!=null||s.max!=null)&&(P[t]={min:s.min,max:s.max},s.min=s.max=null)}const te=e.tzDate||(t=>new Date(qe(t/Q))),U=e.fmtDate||bs,X=Q==1?Mo(te):Do(te),ae=Mr(te,Ar(Q==1?Ao:Ro,U)),O=Rr(te,Tr(Lo,U)),ce=[],L=l.legend=Ge({},Fo,e.legend),A=l.cursor=Ge({},Bo,{drag:{y:i==2}},e.cursor),F=L.show,Ee=A.show,le=L.markers;L.idxs=ce,le.width=ye(le.width),le.dash=ye(le.dash),le.stroke=ye(le.stroke),le.fill=ye(le.fill);let ee,Fe,se,q=[],_e=[],Z,me=!1,Ae={};if(L.live){const t=M[1]?M[1].values:null;me=t!=null,Z=me?t(l,1,0):{_:0};for(let s in Z)Ae[s]=ms}if(F)if(ee=Pt("table",za,c),se=Pt("tbody",null,ee),L.mount(l,ee),me){Fe=Pt("thead",null,ee,se);let t=Pt("tr",null,Fe);Pt("th",null,t);for(var we in Z)Pt("th",rr,t).textContent=we}else vt(ee,Ha),L.live&&vt(ee,Va);const be={show:!0},he={show:!1};function rt(t,s){if(s==0&&(me||!L.live||i==2))return Nl;let a=[],o=Pt("tr",Wa,se,se.childNodes[s]);vt(o,t.class),t.show||vt(o,ul);let m=Pt("th",null,o);if(le.show){let C=Mt(Ba,m);if(s>0){let T=le.width(l,s);T&&(C.style.border=T+"px "+le.dash(l,s)+" "+le.stroke(l,s)),C.style.background=le.fill(l,s)}}let b=Mt(rr,m);t.label instanceof HTMLElement?b.appendChild(t.label):b.textContent=t.label,s>0&&(le.show||(b.style.color=t.width>0?le.stroke(l,s):le.fill(l,s)),de("click",m,C=>{if(A._lock)return;nl(C);let T=M.indexOf(t);if((C.ctrlKey||C.metaKey)!=L.isolate){let I=M.some((V,G)=>G>0&&G!=T&&V.show);M.forEach((V,G)=>{G>0&&Vt(G,I?G==T?be:he:be,!0,Ue.setSeries)})}else Vt(T,{show:!t.show},!0,Ue.setSeries)},!1),ml&&de(cr,m,C=>{A._lock||(nl(C),Vt(M.indexOf(t),El,!0,Ue.setSeries))},!1));for(var k in Z){let C=Pt("td",Ua,o);C.textContent="--",a.push(C)}return[o,a]}const re=new Map;function de(t,s,a,o=!0){const m=re.get(s)||{},b=A.bind[t](l,s,a,o);b&&(fl(t,s,m[t]=b),re.set(s,m))}function ut(t,s,a){const o=re.get(s)||{};for(let m in o)(t==null||m==t)&&(as(m,s,o[m]),delete o[m]);t==null&&re.delete(s)}let it=0,Ye=0,oe=0,R=0,ge=0,pe=0,He=ge,lt=pe,gt=oe,It=R,We=0,Ie=0,Be=0,xt=0;l.bbox={};let Cn=!1,en=!1,pl=!1,ll=!1,tn=!1,kt=!1;function En(t,s,a){(a||t!=l.width||s!=l.height)&&As(t,s),_l(!1),pl=!0,en=!0,bl()}function As(t,s){l.width=it=oe=t,l.height=Ye=R=s,ge=pe=0,zi(),Vi();let a=l.bbox;We=a.left=ol(ge*ke,.5),Ie=a.top=ol(pe*ke,.5),Be=a.width=ol(oe*ke,.5),xt=a.height=ol(R*ke,.5)}const Oi=3;function Fi(){let t=!1,s=0;for(;!t;){s++;let a=Yi(s),o=Ji(s);t=s==Oi||a&&o,t||(As(l.width,l.height),en=!0)}}function Ii({width:t,height:s}){En(t,s)}l.setSize=Ii;function zi(){let t=!1,s=!1,a=!1,o=!1;J.forEach((m,b)=>{if(m.show&&m._show){let{side:k,_size:C}=m,T=k%2,I=m.label!=null?m.labelSize:0,V=C+I;V>0&&(T?(oe-=V,k==3?(ge+=V,o=!0):a=!0):(R-=V,k==0?(pe+=V,t=!0):s=!0))}}),sl[0]=t,sl[1]=a,sl[2]=s,sl[3]=o,oe-=Yt[1]+Yt[3],ge+=Yt[3],R-=Yt[2]+Yt[0],pe+=Yt[0]}function Vi(){let t=ge+oe,s=pe+R,a=ge,o=pe;function m(b,k){switch(b){case 1:return t+=k,t-k;case 2:return s+=k,s-k;case 3:return a-=k,a+k;case 0:return o-=k,o+k}}J.forEach((b,k)=>{if(b.show&&b._show){let C=b.side;b._pos=m(C,b._size),b.label!=null&&(b._lpos=m(C,b.labelSize))}})}if(A.dataIdx==null){let t=A.hover,s=t.skip=new Set(t.skip??[]);s.add(void 0);let a=t.prox=ye(t.prox),o=t.bias??=0;A.dataIdx=(m,b,k,C)=>{if(b==0)return k;let T=k,I=a(m,b,k,C)??Te,V=I>=0&&I<Te,G=x.ori==0?oe:R,ue=A.left,je=n[0],ve=n[b];if(s.has(ve[k])){T=null;let xe=null,ne=null,K;if(o==0||o==-1)for(K=k;xe==null&&K-- >0;)s.has(ve[K])||(xe=K);if(o==0||o==1)for(K=k;ne==null&&K++<ve.length;)s.has(ve[K])||(ne=K);if(xe!=null||ne!=null)if(V){let Le=xe==null?-1/0:j(je[xe],x,G,0),ze=ne==null?1/0:j(je[ne],x,G,0),tt=ue-Le,Me=ze-ue;tt<=Me?tt<=I&&(T=xe):Me<=I&&(T=ne)}else T=ne==null?xe:xe==null?ne:k-xe<=ne-k?xe:ne}else V&&$e(ue-j(je[k],x,G,0))>I&&(T=null);return T}}const nl=t=>{A.event=t};A.idxs=ce,A._lock=!1;let at=A.points;at.show=ye(at.show),at.size=ye(at.size),at.stroke=ye(at.stroke),at.width=ye(at.width),at.fill=ye(at.fill);const zt=l.focus=Ge({},e.focus||{alpha:.3},A.focus),ml=zt.prox>=0,gl=ml&&at.one;let Ct=[],xl=[],yl=[];function Ms(t,s){let a=at.show(l,s);if(a instanceof HTMLElement)return vt(a,Ia),vt(a,t.class),Ut(a,-10,-10,oe,R),z.insertBefore(a,Ct[s]),a}function Ts(t,s){if(i==1||s>0){let a=i==1&&N[t.scale].time,o=t.value;t.value=a?jr(o)?Rr(te,Tr(o,U)):o||O:o||Xo,t.label=t.label||(a?Go:Uo)}if(gl||s>0){t.width=t.width==null?1:t.width,t.paths=t.paths||dc||lo,t.fillTo=ye(t.fillTo||sc),t.pxAlign=+Se(t.pxAlign,w),t.pxRound=Vr(t.pxAlign),t.stroke=ye(t.stroke||null),t.fill=ye(t.fill||null),t._stroke=t._fill=t._paths=t._focus=null;let a=ec(mt(1,t.width),1),o=t.points=Ge({},{size:a,width:mt(1,a*.2),stroke:t.stroke,space:a*2,paths:pc,_stroke:null,_fill:null},t.points);o.show=ye(o.show),o.filter=ye(o.filter),o.fill=ye(o.fill),o.stroke=ye(o.stroke),o.paths=ye(o.paths),o.pxAlign=t.pxAlign}if(F){let a=rt(t,s);q.splice(s,0,a[0]),_e.splice(s,0,a[1]),L.values.push(null)}if(Ee){ce.splice(s,0,null);let a=null;gl?s==0&&(a=Ms(t,s)):s>0&&(a=Ms(t,s)),Ct.splice(s,0,a),xl.splice(s,0,0),yl.splice(s,0,0)}et("addSeries",s)}function Hi(t,s){s=s??M.length,t=i==1?ds(t,s,Nr,Ir):ds(t,s,{},Fr),M.splice(s,0,t),Ts(M[s],s)}l.addSeries=Hi;function Wi(t){if(M.splice(t,1),F){L.values.splice(t,1),_e.splice(t,1);let s=q.splice(t,1)[0];ut(null,s.firstChild),s.remove()}Ee&&(ce.splice(t,1),Ct.splice(t,1)[0].remove(),xl.splice(t,1),yl.splice(t,1)),et("delSeries",t)}l.delSeries=Wi;const sl=[!1,!1,!1,!1];function Bi(t,s){if(t._show=t.show,t.show){let a=t.side%2,o=N[t.scale];o==null&&(t.scale=a?M[1].scale:B,o=N[t.scale]);let m=o.time;t.size=ye(t.size),t.space=ye(t.space),t.rotate=ye(t.rotate),el(t.incrs)&&t.incrs.forEach(k=>{!tl.has(k)&&tl.set(k,si(k))}),t.incrs=ye(t.incrs||(o.distr==2?ko:m?Q==1?Eo:To:cl)),t.splits=ye(t.splits||(m&&o.distr==1?X:o.distr==3?cs:o.distr==4?Ko:$o)),t.stroke=ye(t.stroke),t.grid.stroke=ye(t.grid.stroke),t.ticks.stroke=ye(t.ticks.stroke),t.border.stroke=ye(t.border.stroke);let b=t.values;t.values=el(b)&&!el(b[0])?ye(b):m?el(b)?Mr(te,Ar(b,U)):jr(b)?No(te,b):b||ae:b||qo,t.filter=ye(t.filter||(o.distr>=3&&o.log==10?Qo:o.distr==3&&o.log==2?Zo:li)),t.font=Ur(t.font),t.labelFont=Ur(t.labelFont),t._size=t.size(l,null,s,0),t._space=t._rotate=t._incrs=t._found=t._splits=t._values=null,t._size>0&&(sl[s]=!0,t._el=Mt(La,S))}}function zl(t,s,a,o){let[m,b,k,C]=a,T=s%2,I=0;return T==0&&(C||b)&&(I=s==0&&!m||s==2&&!k?qe(Dr.size/3):0),T==1&&(m||k)&&(I=s==1&&!b||s==3&&!C?qe(Pr.size/2):0),I}const Rs=l.padding=(e.padding||[zl,zl,zl,zl]).map(t=>ye(Se(t,zl))),Yt=l._padding=Rs.map((t,s)=>t(l,s,sl,0));let nt,Je=null,Qe=null;const ln=i==1?M[0].idxs:null;let Dt=null,Vl=!1;function Ds(t,s){if(n=t??[],l.data=l._data=n,i==2){nt=0;for(let a=1;a<M.length;a++)nt+=n[a][0].length}else{n.length==0&&(l.data=l._data=n=[[]]),Dt=n[0],nt=Dt.length;let a=n;if(E==2){a=n.slice();let o=a[0]=Array(nt);for(let m=0;m<nt;m++)o[m]=m}l._data=n=a}if(_l(!0),et("setData"),E==2&&(pl=!0),s!==!1){let a=x;a.auto(l,Vl)?An():Qt(B,a.min,a.max),ll=ll||A.left>=0,kt=!0,bl()}}l.setData=Ds;function An(){Vl=!0;let t,s;i==1&&(nt>0?(Je=ln[0]=0,Qe=ln[1]=nt-1,t=n[0][Je],s=n[0][Qe],E==2?(t=Je,s=Qe):t==s&&(E==3?[t,s]=wn(t,t,x.log,!1):E==4?[t,s]=xs(t,t,x.log,!1):x.time?s=t+qe(86400/Q):[t,s]=gn(t,s,ys,!0))):(Je=ln[0]=t=null,Qe=ln[1]=s=null)),Qt(B,t,s)}let nn,wl,Mn,Tn,Rn,Dn,Nn,Ln,Pn,yt;function Ns(t,s,a,o,m,b){t??=ar,a??=_s,o??="butt",m??=ar,b??="round",t!=nn&&(_.strokeStyle=nn=t),m!=wl&&(_.fillStyle=wl=m),s!=Mn&&(_.lineWidth=Mn=s),b!=Rn&&(_.lineJoin=Rn=b),o!=Dn&&(_.lineCap=Dn=o),a!=Tn&&_.setLineDash(Tn=a)}function Ls(t,s,a,o){s!=wl&&(_.fillStyle=wl=s),t!=Nn&&(_.font=Nn=t),a!=Ln&&(_.textAlign=Ln=a),o!=Pn&&(_.textBaseline=Pn=o)}function On(t,s,a,o,m=0){if(o.length>0&&t.auto(l,Vl)&&(s==null||s.min==null)){let b=Se(Je,0),k=Se(Qe,o.length-1),C=a.min==null?Ja(o,b,k,m,t.distr==3):[a.min,a.max];t.min=Ft(t.min,a.min=C[0]),t.max=mt(t.max,a.max=C[1])}}const Ps={min:null,max:null};function Ui(){for(let o in N){let m=N[o];P[o]==null&&(m.min==null||P[B]!=null&&m.auto(l,Vl))&&(P[o]=Ps)}for(let o in N){let m=N[o];P[o]==null&&m.from!=null&&P[m.from]!=null&&(P[o]=Ps)}P[B]!=null&&_l(!0);let t={};for(let o in P){let m=P[o];if(m!=null){let b=t[o]=Ll(N[o],ro);if(m.min!=null)Ge(b,m);else if(o!=B||i==2)if(nt==0&&b.from==null){let k=b.range(l,null,null,o);b.min=k[0],b.max=k[1]}else b.min=Te,b.max=-Te}}if(nt>0){M.forEach((o,m)=>{if(i==1){let b=o.scale,k=P[b];if(k==null)return;let C=t[b];if(m==0){let T=C.range(l,C.min,C.max,b);C.min=T[0],C.max=T[1],Je=Ot(C.min,n[0]),Qe=Ot(C.max,n[0]),Qe-Je>1&&(n[0][Je]<C.min&&Je++,n[0][Qe]>C.max&&Qe--),o.min=Dt[Je],o.max=Dt[Qe]}else o.show&&o.auto&&On(C,k,o,n[m],o.sorted);o.idxs[0]=Je,o.idxs[1]=Qe}else if(m>0&&o.show&&o.auto){let[b,k]=o.facets,C=b.scale,T=k.scale,[I,V]=n[m],G=t[C],ue=t[T];G!=null&&On(G,P[C],b,I,b.sorted),ue!=null&&On(ue,P[T],k,V,k.sorted),o.min=k.min,o.max=k.max}});for(let o in t){let m=t[o],b=P[o];if(m.from==null&&(b==null||b.min==null)){let k=m.range(l,m.min==Te?null:m.min,m.max==-Te?null:m.max,o);m.min=k[0],m.max=k[1]}}}for(let o in t){let m=t[o];if(m.from!=null){let b=t[m.from];if(b.min==null)m.min=m.max=null;else{let k=m.range(l,b.min,b.max,o);m.min=k[0],m.max=k[1]}}}let s={},a=!1;for(let o in t){let m=t[o],b=N[o];if(b.min!=m.min||b.max!=m.max){b.min=m.min,b.max=m.max;let k=b.distr;b._min=k==3?$t(b.min):k==4?Zn(b.min,b.asinh):k==100?b.fwd(b.min):b.min,b._max=k==3?$t(b.max):k==4?Zn(b.max,b.asinh):k==100?b.fwd(b.max):b.max,s[o]=a=!0}}if(a){M.forEach((o,m)=>{i==2?m>0&&s.y&&(o._paths=null):s[o.scale]&&(o._paths=null)});for(let o in s)pl=!0,et("setScale",o);Ee&&A.left>=0&&(ll=kt=!0)}for(let o in P)P[o]=null}function Gi(t){let s=os(Je-1,0,nt-1),a=os(Qe+1,0,nt-1);for(;t[s]==null&&s>0;)s--;for(;t[a]==null&&a<nt-1;)a++;return[s,a]}function qi(){if(nt>0){let t=M.some(s=>s._focus)&&yt!=zt.alpha;t&&(_.globalAlpha=yt=zt.alpha),M.forEach((s,a)=>{if(a>0&&s.show&&(Os(a,!1),Os(a,!0),s._paths==null)){let o=yt;yt!=s.alpha&&(_.globalAlpha=yt=s.alpha);let m=i==2?[0,n[a][0].length-1]:Gi(n[a]);s._paths=s.paths(l,a,m[0],m[1]),yt!=o&&(_.globalAlpha=yt=o)}}),M.forEach((s,a)=>{if(a>0&&s.show){let o=yt;yt!=s.alpha&&(_.globalAlpha=yt=s.alpha),s._paths!=null&&Fs(a,!1);{let m=s._paths!=null?s._paths.gaps:null,b=s.points.show(l,a,Je,Qe,m),k=s.points.filter(l,a,b,m);(b||k)&&(s.points._paths=s.points.paths(l,a,Je,Qe,k),Fs(a,!0))}yt!=o&&(_.globalAlpha=yt=o),et("drawSeries",a)}}),t&&(_.globalAlpha=yt=1)}}function Os(t,s){let a=s?M[t].points:M[t];a._stroke=a.stroke(l,t),a._fill=a.fill(l,t)}function Fs(t,s){let a=s?M[t].points:M[t],{stroke:o,fill:m,clip:b,flags:k,_stroke:C=a._stroke,_fill:T=a._fill,_width:I=a.width}=a._paths;I=Re(I*ke,3);let V=null,G=I%2/2;s&&T==null&&(T=I>0?"#fff":C);let ue=a.pxAlign==1&&G>0;if(ue&&_.translate(G,G),!s){let je=We-I/2,ve=Ie-I/2,xe=Be+I,ne=xt+I;V=new Path2D,V.rect(je,ve,xe,ne)}s?Fn(C,I,a.dash,a.cap,T,o,m,k,b):$i(t,C,I,a.dash,a.cap,T,o,m,k,V,b),ue&&_.translate(-G,-G)}function $i(t,s,a,o,m,b,k,C,T,I,V){let G=!1;T!=0&&fe.forEach((ue,je)=>{if(ue.series[0]==t){let ve=M[ue.series[1]],xe=n[ue.series[1]],ne=(ve._paths||Zl).band;el(ne)&&(ne=ue.dir==1?ne[0]:ne[1]);let K,Le=null;ve.show&&ne&&Za(xe,Je,Qe)?(Le=ue.fill(l,je)||b,K=ve._paths.clip):ne=null,Fn(s,a,o,m,Le,k,C,T,I,V,K,ne),G=!0}}),G||Fn(s,a,o,m,b,k,C,T,I,V)}const Is=Pl|fs;function Fn(t,s,a,o,m,b,k,C,T,I,V,G){Ns(t,s,a,o,m),(T||I||G)&&(_.save(),T&&_.clip(T),I&&_.clip(I)),G?(C&Is)==Is?(_.clip(G),V&&_.clip(V),rn(m,k),sn(t,b,s)):C&fs?(rn(m,k),_.clip(G),sn(t,b,s)):C&Pl&&(_.save(),_.clip(G),V&&_.clip(V),rn(m,k),_.restore(),sn(t,b,s)):(rn(m,k),sn(t,b,s)),(T||I||G)&&_.restore()}function sn(t,s,a){a>0&&(s instanceof Map?s.forEach((o,m)=>{_.strokeStyle=nn=m,_.stroke(o)}):s!=null&&t&&_.stroke(s))}function rn(t,s){s instanceof Map?s.forEach((a,o)=>{_.fillStyle=wl=o,_.fill(a)}):s!=null&&t&&_.fill(s)}function Ki(t,s,a,o){let m=J[t],b;if(o<=0)b=[0,0];else{let k=m._space=m.space(l,t,s,a,o),C=m._incrs=m.incrs(l,t,s,a,o,k);b=_c(s,a,C,o,k)}return m._found=b}function In(t,s,a,o,m,b,k,C,T,I){let V=k%2/2;w==1&&_.translate(V,V),Ns(C,k,T,I,C),_.beginPath();let G,ue,je,ve,xe=m+(o==0||o==3?-b:b);a==0?(ue=m,ve=xe):(G=m,je=xe);for(let ne=0;ne<t.length;ne++)s[ne]!=null&&(a==0?G=je=t[ne]:ue=ve=t[ne],_.moveTo(G,ue),_.lineTo(je,ve));_.stroke(),w==1&&_.translate(-V,-V)}function Yi(t){let s=!0;return J.forEach((a,o)=>{if(!a.show)return;let m=N[a.scale];if(m.min==null){a._show&&(s=!1,a._show=!1,_l(!1));return}else a._show||(s=!1,a._show=!0,_l(!1));let b=a.side,k=b%2,{min:C,max:T}=m,[I,V]=Ki(o,C,T,k==0?oe:R);if(V==0)return;let G=m.distr==2,ue=a._splits=a.splits(l,o,C,T,I,V,G),je=m.distr==2?ue.map(K=>Dt[K]):ue,ve=m.distr==2?Dt[ue[1]]-Dt[ue[0]]:I,xe=a._values=a.values(l,a.filter(l,je,o,V,ve),o,V,ve);a._rotate=b==2?a.rotate(l,xe,o,V):0;let ne=a._size;a._size=Rt(a.size(l,xe,o,t)),ne!=null&&a._size!=ne&&(s=!1)}),s}function Ji(t){let s=!0;return Rs.forEach((a,o)=>{let m=a(l,o,sl,t);m!=Yt[o]&&(s=!1),Yt[o]=m}),s}function Qi(){for(let t=0;t<J.length;t++){let s=J[t];if(!s.show||!s._show)continue;let a=s.side,o=a%2,m,b,k=s.stroke(l,t),C=a==0||a==3?-1:1,[T,I]=s._found;if(s.label!=null){let ht=s.labelGap*C,bt=qe((s._lpos+ht)*ke);Ls(s.labelFont[0],k,"center",a==2?ql:ir),_.save(),o==1?(m=b=0,_.translate(bt,qe(Ie+xt/2)),_.rotate((a==3?-pn:pn)/2)):(m=qe(We+Be/2),b=bt);let al=ei(s.label)?s.label(l,t,T,I):s.label;_.fillText(al,m,b),_.restore()}if(I==0)continue;let V=N[s.scale],G=o==0?Be:xt,ue=o==0?We:Ie,je=s._splits,ve=V.distr==2?je.map(ht=>Dt[ht]):je,xe=V.distr==2?Dt[je[1]]-Dt[je[0]]:T,ne=s.ticks,K=s.border,Le=ne.show?ne.size:0,ze=qe(Le*ke),tt=qe((s.alignTo==2?s._size-Le-s.gap:s.gap)*ke),Me=s._rotate*-pn/180,Ve=$(s._pos*ke),wt=(ze+tt)*C,ft=Ve+wt;b=o==0?ft:0,m=o==1?ft:0;let Et=s.font[0],Nt=s.align==1?Ml:s.align==2?Yn:Me>0?Ml:Me<0?Yn:o==0?"center":a==3?Yn:Ml,Wt=Me||o==1?"middle":a==2?ql:ir;Ls(Et,k,Nt,Wt);let _t=s.font[1]*s.lineGap,At=je.map(ht=>$(y(ht,V,G,ue))),Lt=s._values;for(let ht=0;ht<Lt.length;ht++){let bt=Lt[ht];if(bt!=null){o==0?m=At[ht]:b=At[ht],bt=""+bt;let al=bt.indexOf(`
|
||
`)==-1?[bt]:bt.split(/\n/gm);for(let dt=0;dt<al.length;dt++){let nr=al[dt];Me?(_.save(),_.translate(m,b+dt*_t),_.rotate(Me),_.fillText(nr,0,0),_.restore()):_.fillText(nr,m,b+dt*_t)}}}ne.show&&In(At,ne.filter(l,ve,t,I,xe),o,a,Ve,ze,Re(ne.width*ke,3),ne.stroke(l,t),ne.dash,ne.cap);let Bt=s.grid;Bt.show&&In(At,Bt.filter(l,ve,t,I,xe),o,o==0?2:1,o==0?Ie:We,o==0?xt:Be,Re(Bt.width*ke,3),Bt.stroke(l,t),Bt.dash,Bt.cap),K.show&&In([Ve],[1],o==0?1:0,o==0?1:2,o==1?Ie:We,o==1?xt:Be,Re(K.width*ke,3),K.stroke(l,t),K.dash,K.cap)}et("drawAxes")}function _l(t){M.forEach((s,a)=>{a>0&&(s._paths=null,t&&(i==1?(s.min=null,s.max=null):s.facets.forEach(o=>{o.min=null,o.max=null})))})}let an=!1,zn=!1,Hl=[];function Zi(){zn=!1;for(let t=0;t<Hl.length;t++)et(...Hl[t]);Hl.length=0}function bl(){an||(ho(zs),an=!0)}function Xi(t,s=!1){an=!0,zn=s,t(l),zs(),s&&Hl.length>0&&queueMicrotask(Zi)}l.batch=Xi;function zs(){if(Cn&&(Ui(),Cn=!1),pl&&(Fi(),pl=!1),en){if(Pe(W,Ml,ge),Pe(W,ql,pe),Pe(W,Kl,oe),Pe(W,Yl,R),Pe(z,Ml,ge),Pe(z,ql,pe),Pe(z,Kl,oe),Pe(z,Yl,R),Pe(S,Kl,it),Pe(S,Yl,Ye),v.width=qe(it*ke),v.height=qe(Ye*ke),J.forEach(({_el:t,_show:s,_size:a,_pos:o,side:m})=>{if(t!=null)if(s){let b=m===3||m===0?a:0,k=m%2==1;Pe(t,k?"left":"top",o-b),Pe(t,k?"width":"height",a),Pe(t,k?"top":"left",k?pe:ge),Pe(t,k?"height":"width",k?R:oe),is(t,ul)}else vt(t,ul)}),nn=wl=Mn=Rn=Dn=Nn=Ln=Pn=Tn=null,yt=1,Ul(!0),ge!=He||pe!=lt||oe!=gt||R!=It){_l(!1);let t=oe/gt,s=R/It;if(Ee&&!ll&&A.left>=0){A.left*=t,A.top*=s,vl&&Ut(vl,qe(A.left),0,oe,R),Sl&&Ut(Sl,0,qe(A.top),oe,R);for(let a=0;a<Ct.length;a++){let o=Ct[a];o!=null&&(xl[a]*=t,yl[a]*=s,Ut(o,Rt(xl[a]),Rt(yl[a]),oe,R))}}if(Ne.show&&!tn&&Ne.left>=0&&Ne.width>0){Ne.left*=t,Ne.width*=t,Ne.top*=s,Ne.height*=s;for(let a in Gn)Pe(Cl,a,Ne[a])}He=ge,lt=pe,gt=oe,It=R}et("setSize"),en=!1}it>0&&Ye>0&&(_.clearRect(0,0,v.width,v.height),et("drawClear"),H.forEach(t=>t()),et("draw")),Ne.show&&tn&&(on(Ne),tn=!1),Ee&&ll&&(il(null,!0,!1),ll=!1),L.show&&L.live&&kt&&(Bn(),kt=!1),g||(g=!0,l.status=1,et("ready")),Vl=!1,an=!1}l.redraw=(t,s)=>{pl=s||!1,t!==!1?Qt(B,x.min,x.max):bl()};function Vn(t,s){let a=N[t];if(a.from==null){if(nt==0){let o=a.range(l,s.min,s.max,t);s.min=o[0],s.max=o[1]}if(s.min>s.max){let o=s.min;s.min=s.max,s.max=o}if(nt>1&&s.min!=null&&s.max!=null&&s.max-s.min<1e-16)return;t==B&&a.distr==2&&nt>0&&(s.min=Ot(s.min,n[0]),s.max=Ot(s.max,n[0]),s.min==s.max&&s.max++),P[t]=s,Cn=!0,bl()}}l.setScale=Vn;let Hn,Wn,vl,Sl,Vs,Hs,jl,kl,Ws,Bs,De,Oe,Jt=!1;const st=A.drag;let Ze=st.x,Xe=st.y;Ee&&(A.x&&(Hn=Mt(Oa,z)),A.y&&(Wn=Mt(Fa,z)),x.ori==0?(vl=Hn,Sl=Wn):(vl=Wn,Sl=Hn),De=A.left,Oe=A.top);const Ne=l.select=Ge({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),Cl=Ne.show?Mt(Pa,Ne.over?z:W):null;function on(t,s){if(Ne.show){for(let a in t)Ne[a]=t[a],a in Gn&&Pe(Cl,a,t[a]);s!==!1&&et("setSelect")}}l.setSelect=on;function ea(t){if(M[t].show)F&&is(q[t],ul);else if(F&&vt(q[t],ul),Ee){let a=gl?Ct[0]:Ct[t];a!=null&&Ut(a,-10,-10,oe,R)}}function Qt(t,s,a){Vn(t,{min:s,max:a})}function Vt(t,s,a,o){s.focus!=null&&ra(t),s.show!=null&&M.forEach((m,b)=>{b>0&&(t==b||t==null)&&(m.show=s.show,ea(b),i==2?(Qt(m.facets[0].scale,null,null),Qt(m.facets[1].scale,null,null)):Qt(m.scale,null,null),bl())}),a!==!1&&et("setSeries",t,s),o&&Gl("setSeries",l,t,s)}l.setSeries=Vt;function ta(t,s){Ge(fe[t],s)}function la(t,s){t.fill=ye(t.fill||null),t.dir=Se(t.dir,-1),s=s??fe.length,fe.splice(s,0,t)}function na(t){t==null?fe.length=0:fe.splice(t,1)}l.addBand=la,l.setBand=ta,l.delBand=na;function sa(t,s){M[t].alpha=s,Ee&&Ct[t]!=null&&(Ct[t].style.opacity=s),F&&q[t]&&(q[t].style.opacity=s)}let qt,Zt,rl;const El={focus:!0};function ra(t){if(t!=rl){let s=t==null,a=zt.alpha!=1;M.forEach((o,m)=>{if(i==1||m>0){let b=s||m==0||m==t;o._focus=s?null:b,a&&sa(m,b?1:zt.alpha)}}),rl=t,a&&bl()}}F&&ml&&de(ur,ee,t=>{A._lock||(nl(t),rl!=null&&Vt(null,El,!0,Ue.setSeries))});function Ht(t,s,a){let o=N[s];a&&(t=t/ke-(o.ori==1?pe:ge));let m=oe;o.ori==1&&(m=R,t=m-t),o.dir==-1&&(t=m-t);let b=o._min,k=o._max,C=t/m,T=b+(k-b)*C,I=o.distr;return I==3?Dl(10,T):I==4?eo(T,o.asinh):I==100?o.bwd(T):T}function ia(t,s){let a=Ht(t,B,s);return Ot(a,n[0],Je,Qe)}l.valToIdx=t=>Ot(t,n[0]),l.posToIdx=ia,l.posToVal=Ht,l.valToPos=(t,s,a)=>N[s].ori==0?f(t,N[s],a?Be:oe,a?We:0):h(t,N[s],a?xt:R,a?Ie:0),l.setCursor=(t,s,a)=>{De=t.left,Oe=t.top,il(null,s,a)};function Us(t,s){Pe(Cl,Ml,Ne.left=t),Pe(Cl,Kl,Ne.width=s)}function Gs(t,s){Pe(Cl,ql,Ne.top=t),Pe(Cl,Yl,Ne.height=s)}let Wl=x.ori==0?Us:Gs,Bl=x.ori==1?Us:Gs;function aa(){if(F&&L.live)for(let t=i==2?1:0;t<M.length;t++){if(t==0&&me)continue;let s=L.values[t],a=0;for(let o in s)_e[t][a++].firstChild.nodeValue=s[o]}}function Bn(t,s){if(t!=null&&(t.idxs?t.idxs.forEach((a,o)=>{ce[o]=a}):so(t.idx)||ce.fill(t.idx),L.idx=ce[0]),F&&L.live){for(let a=0;a<M.length;a++)(a>0||i==1&&!me)&&oa(a,ce[a]);aa()}kt=!1,s!==!1&&et("setLegend")}l.setLegend=Bn;function oa(t,s){let a=M[t],o=t==0&&E==2?Dt:n[t],m;me?m=a.values(l,t,s)??Ae:(m=a.value(l,s==null?null:o[s],t,s),m=m==null?Ae:{_:m}),L.values[t]=m}function il(t,s,a){Ws=De,Bs=Oe,[De,Oe]=A.move(l,De,Oe),A.left=De,A.top=Oe,Ee&&(vl&&Ut(vl,qe(De),0,oe,R),Sl&&Ut(Sl,0,qe(Oe),oe,R));let o,m=Je>Qe;qt=Te,Zt=null;let b=x.ori==0?oe:R,k=x.ori==1?oe:R;if(De<0||nt==0||m){o=A.idx=null;for(let C=0;C<M.length;C++){let T=Ct[C];T!=null&&Ut(T,-10,-10,oe,R)}ml&&Vt(null,El,!0,t==null&&Ue.setSeries),L.live&&(ce.fill(o),kt=!0)}else{let C,T,I;i==1&&(C=x.ori==0?De:Oe,T=Ht(C,B),o=A.idx=Ot(T,n[0],Je,Qe),I=j(n[0][o],x,b,0));let V=-10,G=-10,ue=0,je=0,ve=!0,xe="",ne="";for(let K=i==2?1:0;K<M.length;K++){let Le=M[K],ze=ce[K],tt=ze==null?null:i==1?n[K][ze]:n[K][1][ze],Me=A.dataIdx(l,K,o,T),Ve=Me==null?null:i==1?n[K][Me]:n[K][1][Me];if(kt=kt||Ve!=tt||Me!=ze,ce[K]=Me,K>0&&Le.show){let wt=Me==null?-10:Me==o?I:j(i==1?n[0][Me]:n[K][0][Me],x,b,0),ft=Ve==null?-10:D(Ve,i==1?N[Le.scale]:N[Le.facets[1].scale],k,0);if(ml&&Ve!=null){let Et=x.ori==1?De:Oe,Nt=$e(zt.dist(l,K,Me,ft,Et));if(Nt<qt){let Wt=zt.bias;if(Wt!=0){let _t=Ht(Et,Le.scale),At=Ve>=0?1:-1,Lt=_t>=0?1:-1;Lt==At&&(Lt==1?Wt==1?Ve>=_t:Ve<=_t:Wt==1?Ve<=_t:Ve>=_t)&&(qt=Nt,Zt=K)}else qt=Nt,Zt=K}}if(kt||gl){let Et,Nt;x.ori==0?(Et=wt,Nt=ft):(Et=ft,Nt=wt);let Wt,_t,At,Lt,Bt,ht,bt=!0,al=at.bbox;if(al!=null){bt=!1;let dt=al(l,K);At=dt.left,Lt=dt.top,Wt=dt.width,_t=dt.height}else At=Et,Lt=Nt,Wt=_t=at.size(l,K);if(ht=at.fill(l,K),Bt=at.stroke(l,K),gl)K==Zt&&qt<=zt.prox&&(V=At,G=Lt,ue=Wt,je=_t,ve=bt,xe=ht,ne=Bt);else{let dt=Ct[K];dt!=null&&(xl[K]=At,yl[K]=Lt,xr(dt,Wt,_t,bt),mr(dt,ht,Bt),Ut(dt,Rt(At),Rt(Lt),oe,R))}}}}if(gl){let K=zt.prox,Le=rl==null?qt<=K:qt>K||Zt!=rl;if(kt||Le){let ze=Ct[0];ze!=null&&(xl[0]=V,yl[0]=G,xr(ze,ue,je,ve),mr(ze,xe,ne),Ut(ze,Rt(V),Rt(G),oe,R))}}}if(Ne.show&&Jt)if(t!=null){let[C,T]=Ue.scales,[I,V]=Ue.match,[G,ue]=t.cursor.sync.scales,je=t.cursor.drag;if(Ze=je._x,Xe=je._y,Ze||Xe){let{left:ve,top:xe,width:ne,height:K}=t.select,Le=t.scales[G].ori,ze=t.posToVal,tt,Me,Ve,wt,ft,Et=C!=null&&I(C,G),Nt=T!=null&&V(T,ue);Et&&Ze?(Le==0?(tt=ve,Me=ne):(tt=xe,Me=K),Ve=N[C],wt=j(ze(tt,G),Ve,b,0),ft=j(ze(tt+Me,G),Ve,b,0),Wl(Ft(wt,ft),$e(ft-wt))):Wl(0,b),Nt&&Xe?(Le==1?(tt=ve,Me=ne):(tt=xe,Me=K),Ve=N[T],wt=D(ze(tt,ue),Ve,k,0),ft=D(ze(tt+Me,ue),Ve,k,0),Bl(Ft(wt,ft),$e(ft-wt))):Bl(0,k)}else qn()}else{let C=$e(Ws-Vs),T=$e(Bs-Hs);if(x.ori==1){let ue=C;C=T,T=ue}Ze=st.x&&C>=st.dist,Xe=st.y&&T>=st.dist;let I=st.uni;I!=null?Ze&&Xe&&(Ze=C>=I,Xe=T>=I,!Ze&&!Xe&&(T>C?Xe=!0:Ze=!0)):st.x&&st.y&&(Ze||Xe)&&(Ze=Xe=!0);let V,G;Ze&&(x.ori==0?(V=jl,G=De):(V=kl,G=Oe),Wl(Ft(V,G),$e(G-V)),Xe||Bl(0,k)),Xe&&(x.ori==1?(V=jl,G=De):(V=kl,G=Oe),Bl(Ft(V,G),$e(G-V)),Ze||Wl(0,b)),!Ze&&!Xe&&(Wl(0,0),Bl(0,0))}if(st._x=Ze,st._y=Xe,t==null){if(a){if(lr!=null){let[C,T]=Ue.scales;Ue.values[0]=C!=null?Ht(x.ori==0?De:Oe,C):null,Ue.values[1]=T!=null?Ht(x.ori==1?De:Oe,T):null}Gl(Jn,l,De,Oe,oe,R,o)}if(ml){let C=a&&Ue.setSeries,T=zt.prox;rl==null?qt<=T&&Vt(Zt,El,!0,C):qt>T?Vt(null,El,!0,C):Zt!=rl&&Vt(Zt,El,!0,C)}}kt&&(L.idx=o,Bn()),s!==!1&&et("setCursor")}let Xt=null;Object.defineProperty(l,"rect",{get(){return Xt==null&&Ul(!1),Xt}});function Ul(t=!1){t?Xt=null:(Xt=z.getBoundingClientRect(),et("syncRect",Xt))}function qs(t,s,a,o,m,b,k){A._lock||Jt&&t!=null&&t.movementX==0&&t.movementY==0||(Un(t,s,a,o,m,b,k,!1,t!=null),t!=null?il(null,!0,!0):il(s,!0,!1))}function Un(t,s,a,o,m,b,k,C,T){if(Xt==null&&Ul(!1),nl(t),t!=null)a=t.clientX-Xt.left,o=t.clientY-Xt.top;else{if(a<0||o<0){De=-10,Oe=-10;return}let[I,V]=Ue.scales,G=s.cursor.sync,[ue,je]=G.values,[ve,xe]=G.scales,[ne,K]=Ue.match,Le=s.axes[0].side%2==1,ze=x.ori==0?oe:R,tt=x.ori==1?oe:R,Me=Le?b:m,Ve=Le?m:b,wt=Le?o:a,ft=Le?a:o;if(ve!=null?a=ne(I,ve)?y(ue,N[I],ze,0):-10:a=ze*(wt/Me),xe!=null?o=K(V,xe)?y(je,N[V],tt,0):-10:o=tt*(ft/Ve),x.ori==1){let Et=a;a=o,o=Et}}T&&(s==null||s.cursor.event.type==Jn)&&((a<=1||a>=oe-1)&&(a=ol(a,oe)),(o<=1||o>=R-1)&&(o=ol(o,R))),C?(Vs=a,Hs=o,[jl,kl]=A.move(l,a,o)):(De=a,Oe=o)}const Gn={width:0,height:0,left:0,top:0};function qn(){on(Gn,!1)}let $s,Ks,Ys,Js;function Qs(t,s,a,o,m,b,k){Jt=!0,Ze=Xe=st._x=st._y=!1,Un(t,s,a,o,m,b,k,!0,!1),t!=null&&(de(Qn,ss,Zs,!1),Gl(or,l,jl,kl,oe,R,null));let{left:C,top:T,width:I,height:V}=Ne;$s=C,Ks=T,Ys=I,Js=V}function Zs(t,s,a,o,m,b,k){Jt=st._x=st._y=!1,Un(t,s,a,o,m,b,k,!1,!0);let{left:C,top:T,width:I,height:V}=Ne,G=I>0||V>0,ue=$s!=C||Ks!=T||Ys!=I||Js!=V;if(G&&ue&&on(Ne),st.setScale&&G&&ue){let je=C,ve=I,xe=T,ne=V;if(x.ori==1&&(je=T,ve=V,xe=C,ne=I),Ze&&Qt(B,Ht(je,B),Ht(je+ve,B)),Xe)for(let K in N){let Le=N[K];K!=B&&Le.from==null&&Le.min!=Te&&Qt(K,Ht(xe+ne,K),Ht(xe,K))}qn()}else A.lock&&(A._lock=!A._lock,il(s,!0,t!=null));t!=null&&(ut(Qn,ss),Gl(Qn,l,De,Oe,oe,R,null))}function ca(t,s,a,o,m,b,k){if(A._lock)return;nl(t);let C=Jt;if(Jt){let T=!0,I=!0,V=10,G,ue;x.ori==0?(G=Ze,ue=Xe):(G=Xe,ue=Ze),G&&ue&&(T=De<=V||De>=oe-V,I=Oe<=V||Oe>=R-V),G&&T&&(De=De<jl?0:oe),ue&&I&&(Oe=Oe<kl?0:R),il(null,!0,!0),Jt=!1}De=-10,Oe=-10,ce.fill(null),il(null,!0,!0),C&&(Jt=C)}function Xs(t,s,a,o,m,b,k){A._lock||(nl(t),An(),qn(),t!=null&&Gl(fr,l,De,Oe,oe,R,null))}function er(){J.forEach(bc),En(l.width,l.height,!0)}fl(mn,Rl,er);const Al={};Al.mousedown=Qs,Al.mousemove=qs,Al.mouseup=Zs,Al.dblclick=Xs,Al.setSeries=(t,s,a,o)=>{let m=Ue.match[2];a=m(l,s,a),a!=-1&&Vt(a,o,!0,!1)},Ee&&(de(or,z,Qs),de(Jn,z,qs),de(cr,z,t=>{nl(t),Ul(!1)}),de(ur,z,ca),de(fr,z,Xs),hs.add(l),l.syncRect=Ul);const cn=l.hooks=e.hooks||{};function et(t,s,a){zn?Hl.push([t,s,a]):t in cn&&cn[t].forEach(o=>{o.call(null,l,s,a)})}(e.plugins||[]).forEach(t=>{for(let s in t.hooks)cn[s]=(cn[s]||[]).concat(t.hooks[s])});const tr=(t,s,a)=>a,Ue=Ge({key:null,setSeries:!1,filters:{pub:vr,sub:vr},scales:[B,M[1]?M[1].scale:null],match:[Sr,Sr,tr],values:[null,null]},A.sync);Ue.match.length==2&&Ue.match.push(tr),A.sync=Ue;const lr=Ue.key,$n=ji(lr);function Gl(t,s,a,o,m,b,k){Ue.filters.pub(t,s,a,o,m,b,k)&&$n.pub(t,s,a,o,m,b,k)}$n.sub(l);function ua(t,s,a,o,m,b,k){Ue.filters.sub(t,s,a,o,m,b,k)&&Al[t](null,s,a,o,m,b,k)}l.pub=ua;function fa(){$n.unsub(l),hs.delete(l),re.clear(),as(mn,Rl,er),c.remove(),ee?.remove(),et("destroy")}l.destroy=fa;function Kn(){et("init",e,n),Ds(n||e.data,!1),P[B]?Vn(B,P[B]):An(),tn=Ne.show&&(Ne.width>0||Ne.height>0),ll=kt=!0,En(e.width,e.height)}return M.forEach(Ts),J.forEach(Bi),r?r instanceof HTMLElement?(r.appendChild(c),Kn()):r(l,Kn):Kn(),l}ct.assign=Ge;ct.fmtNum=ws;ct.rangeNum=gn;ct.rangeLog=wn;ct.rangeAsinh=xs;ct.orient=dl;ct.pxRatio=ke;ct.join=fo;ct.fmtDate=bs,ct.tzDate=So;ct.sync=ji;{ct.addGap=rc,ct.clipGaps=vn;let e=ct.paths={points:Ti};e.linear=Di,e.stepped=oc,e.bars=cc,e.spline=fc}const Gr=["#22d3ee","#f59e0b","#a78bfa","#34d399","#fb7185","#60a5fa","#facc15","#c084fc"];function vc({minutes:e=[],roverIds:n=[],metric:r="dischargedMah"}){const l=Gt.useRef(null),i=Gt.useMemo(()=>{const f=Array.from(new Set(e.map(g=>Number(g.bucketTs)/1e3))).sort((g,c)=>g-c),h=new Map(f.map((g,c)=>[g,c])),y=new Map(n.map(g=>[String(g),new Array(f.length).fill(null)]));return e.forEach(g=>{const c=y.get(String(g.roverId)),v=h.get(Number(g.bucketTs)/1e3);!c||v==null||(c[v]=g[r]==null?null:Number(g[r]))}),{data:[f,...n.map(g=>y.get(String(g)))],series:n.map((g,c)=>({label:String(g),stroke:Gr[c%Gr.length],width:1.5,spanGaps:!1,value:(v,_)=>_==null?"--":Number(_).toLocaleString(void 0,{maximumFractionDigits:3})}))}},[r,e,n]);return Gt.useEffect(()=>{if(!l.current||!i.data[0].length)return;const f=l.current,h={dischargedMah:"Discharged mAh/min",chargedMah:"Charged mAh/min",avgVoltageMv:"Average voltage mV",avgCurrentMa:"Average current mA",avgTemperatureC:"Average temperature °C"},y=new ct({width:Math.max(320,f.clientWidth),height:384,title:h[r]||r,cursor:{drag:{x:!0,y:!1,setScale:!0}},legend:{show:!0,live:!0},axes:[{stroke:"#94a3b8",grid:{stroke:"rgba(115,115,115,0.22)"}},{stroke:"#94a3b8",grid:{stroke:"rgba(115,115,115,0.22)"}}],scales:{x:{time:!0}},series:[{label:"Time"},...i.series],hooks:{ready:[c=>{c.root.addEventListener("dblclick",()=>c.setScale("x",{min:null,max:null}))}]}},i.data,f),g=new ResizeObserver(()=>{y.setSize({width:Math.max(320,f.clientWidth),height:384})});return g.observe(f),()=>{g.disconnect(),y.destroy()}},[r,i]),i.data[0].length?u.jsxs("div",{children:[u.jsx("p",{className:"mb-0.5 text-[0.68rem] text-slate-400",children:"Drag horizontally to zoom. Double-click to restore the full range. Hover for exact values."}),u.jsx("div",{ref:l,className:"min-h-[24rem] w-full overflow-hidden text-slate-200",role:"img","aria-label":`Fleet time series for ${r}`})]}):u.jsx("p",{className:"surface p-1 text-sm text-slate-400",children:"No minute time-series data in this range."})}const qr=[{label:"24 hours",ms:1440*60*1e3},{label:"7 days",ms:10080*60*1e3},{label:"30 days",ms:720*60*60*1e3},{label:"90 days",ms:2160*60*60*1e3},{label:"1 year",ms:365*24*60*60*1e3}],Sc=[["dischargedMah","Discharged mAh"],["chargedMah","Charged mAh"],["avgVoltageMv","Average voltage"],["avgCurrentMa","Average current"],["avgTemperatureC","Average temperature"]];function Y(e,n=2){return e!=null&&e!==""&&Number.isFinite(Number(e))?Number(e).toLocaleString(void 0,{maximumFractionDigits:n}):"--"}function Tt(e){return e!=null&&e!==""&&Number.isFinite(Number(e))?new Date(Number(e)).toLocaleString():"--"}function ls(e){const n=Math.round((Number(e)||0)/6e4);return n<60?`${n}m`:n<1440?`${Math.floor(n/60)}h ${n%60}m`:`${Math.floor(n/1440)}d ${Math.floor(n%1440/60)}h`}function $r(e){const n=Number(e)||0;return n>=1e6?`${Y(n/1e6)} km`:`${Y(n/1e3)} m`}function ot({label:e,value:n,detail:r=null}){return u.jsxs("div",{className:"surface min-w-0 px-1 py-0.5",children:[u.jsx("div",{className:"text-[0.68rem] text-slate-400",children:e}),u.jsx("div",{className:"truncate text-sm font-semibold text-slate-100",children:n}),r?u.jsx("div",{className:"truncate text-[0.68rem] text-slate-500",children:r}):null]})}function ns(e,n){const r=n.map(h=>Object.fromEntries(Object.entries(h).map(([y,g])=>[y,g&&typeof g=="object"?JSON.stringify(g):g]))),l=ka.unparse(r),i=URL.createObjectURL(new Blob([l],{type:"text/csv;charset=utf-8"})),f=document.createElement("a");f.href=i,f.download=e,f.click(),URL.revokeObjectURL(i)}function jc({report:e,onSaved:n}){const r=ba(),l=Kr(v=>v.session?.role||null),i=l==="admin"||l==="lockdown",[f,h]=Gt.useState({roverId:e.rovers[0]?.roverId||"",chemistry:"unknown",ratedCapacityMah:"",installedDate:new Date().toISOString().slice(0,10),notes:""}),[y,g]=Gt.useState(""),c=v=>{v.preventDefault(),g("Saving…"),r.emit("fleetReports:replaceBattery",{roverId:f.roverId,chemistry:f.chemistry,ratedCapacityMah:Number(f.ratedCapacityMah),installedAt:new Date(`${f.installedDate}T12:00:00`).getTime(),notes:f.notes},(_={})=>{if(_.error){g(_.error);return}g(`Registered ${_.battery?.batteryKey||"battery"}`),n()})};return u.jsxs(pt,{title:"Physical battery registry",meta:`${e.batteryRegistry.length} historical records`,bodyClassName:"space-y-0.5 p-0.5",children:[u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[u.jsx("thead",{className:"text-slate-400",children:u.jsxs("tr",{children:[u.jsx("th",{children:"Rover"}),u.jsx("th",{children:"Battery identity"}),u.jsx("th",{children:"Chemistry"}),u.jsx("th",{children:"Rated capacity mAh"}),u.jsx("th",{children:"Installed"}),u.jsx("th",{children:"Retired"}),u.jsx("th",{children:"Learned baseline mAh"}),u.jsx("th",{children:"Notes"})]})}),u.jsx("tbody",{children:e.batteryRegistry.map(v=>u.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[u.jsx("td",{children:v.roverId}),u.jsx("td",{children:v.batteryKey}),u.jsx("td",{children:v.chemistry||"--"}),u.jsx("td",{children:Y(v.ratedCapacityMah,0)}),u.jsx("td",{children:Tt(v.installedAt)}),u.jsx("td",{children:Tt(v.retiredAt)}),u.jsx("td",{children:Y(v.healthyBaselineMah)}),u.jsx("td",{children:v.notes||"--"})]},v.batteryKey))})]})}),i?u.jsxs("form",{className:"surface grid gap-0.5 p-1 text-xs md:grid-cols-2 xl:grid-cols-6",onSubmit:c,children:[u.jsxs("label",{className:"space-y-0.5",children:[u.jsx("span",{className:"text-slate-400",children:"Rover"}),u.jsx("select",{className:"w-full bg-neutral-800 p-0.5",value:f.roverId,onChange:v=>h(_=>({..._,roverId:v.target.value})),children:e.rovers.map(v=>u.jsx("option",{value:v.roverId,children:v.name},v.roverId))})]}),u.jsxs("label",{className:"space-y-0.5",children:[u.jsx("span",{className:"text-slate-400",children:"Chemistry"}),u.jsxs("select",{className:"w-full bg-neutral-800 p-0.5",value:f.chemistry,onChange:v=>h(_=>({..._,chemistry:v.target.value})),children:[u.jsx("option",{value:"unknown",children:"Unknown"}),u.jsx("option",{value:"NiMH",children:"NiMH"}),u.jsx("option",{value:"Li-ion",children:"Li-ion"})]})]}),u.jsxs("label",{className:"space-y-0.5",children:[u.jsx("span",{className:"text-slate-400",children:"Rated capacity mAh"}),u.jsx("input",{required:!0,min:"1",max:"65535",type:"number",className:"w-full bg-neutral-800 p-0.5",value:f.ratedCapacityMah,onChange:v=>h(_=>({..._,ratedCapacityMah:v.target.value}))})]}),u.jsxs("label",{className:"space-y-0.5",children:[u.jsx("span",{className:"text-slate-400",children:"Installation date"}),u.jsx("input",{required:!0,type:"date",className:"w-full bg-neutral-800 p-0.5",value:f.installedDate,onChange:v=>h(_=>({..._,installedDate:v.target.value}))})]}),u.jsxs("label",{className:"space-y-0.5",children:[u.jsx("span",{className:"text-slate-400",children:"Notes"}),u.jsx("input",{className:"w-full bg-neutral-800 p-0.5",value:f.notes,onChange:v=>h(_=>({..._,notes:v.target.value}))})]}),u.jsxs("div",{className:"flex items-end gap-0.5",children:[u.jsx("button",{type:"submit",className:"button-dark px-1 py-0.5",children:"Install/replace battery"}),u.jsx("span",{className:"text-slate-400",children:y})]})]}):u.jsx("p",{className:"surface px-1 py-0.5 text-xs text-slate-400",children:"Battery history is read-only. Admin access is required to register a physical replacement."})]})}function kc(){const[e,n]=Gt.useState(qr[1].ms),[r,l]=Gt.useState(()=>Date.now()),[i,f]=Gt.useState("dischargedMah"),[h,y]=Gt.useState([]),g=r-e,{report:c,loading:v,error:_,refresh:S}=_a({since:g,until:r,compact:!1,includeEvents:!0,roverIds:h.length?h:null}),W=Gt.useMemo(()=>c?.rovers.map(w=>w.roverId)||[],[c]),z=w=>{y($=>$.includes(w)?$.filter(Q=>Q!==w):[...$,w])};return u.jsxs(u.Fragment,{children:[u.jsxs(pt,{title:"Fleet reports",meta:c?`Generated ${Tt(c.generatedAt)}`:"Read-only operational history",actions:u.jsx(Yr,{className:"button-dark px-1 py-0.25 text-[0.75rem]",to:"/",children:"Back to rover page"}),bodyClassName:"space-y-0.5 p-0.5 text-sm",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-0.5",children:[qr.map(w=>u.jsx("button",{type:"button",className:`button-dark px-1 py-0.5 text-xs ${e===w.ms?"text-cyan-200":""}`,onClick:()=>{n(w.ms),l(Date.now())},children:w.label},w.label)),u.jsx("button",{type:"button",className:"button-dark px-1 py-0.5 text-xs",onClick:()=>l(Date.now()),children:"Refresh"}),u.jsxs("span",{className:"text-xs text-slate-400",children:[Tt(g)," through ",Tt(r)]})]}),c?.rovers.length?u.jsxs("div",{className:"flex flex-wrap gap-0.5",children:[c.rovers.map(w=>u.jsxs("button",{type:"button",className:`button-dark px-1 py-0.5 text-xs ${h.includes(w.roverId)?"text-cyan-200":""}`,onClick:()=>z(w.roverId),children:[h.includes(w.roverId)?"✓ ":"",w.name]},w.roverId)),h.length?u.jsx("button",{type:"button",className:"button-dark px-1 py-0.5 text-xs",onClick:()=>y([]),children:"Clear rover filter"}):null]}):null]}),v&&!c?u.jsx(pt,{title:"Loading",bodyClassName:"p-1 text-sm text-slate-400",children:"Loading detailed fleet evidence…"}):null,_?u.jsx(pt,{title:"Report unavailable",bodyClassName:"p-1 text-sm text-red-300",children:_}):null,c?u.jsxs(u.Fragment,{children:[u.jsxs(pt,{title:"Exact totals",meta:`${c.totals.sampleCount.toLocaleString()} sensor samples`,bodyClassName:"grid grid-cols-2 gap-0.5 p-0.5 md:grid-cols-4 xl:grid-cols-6",children:[u.jsx(ot,{label:"Rovers",value:`${c.totals.onlineRoverCount}/${c.totals.roverCount} online`}),u.jsx(ot,{label:"Telemetry coverage",value:ls(c.totals.coverageMs)}),u.jsx(ot,{label:"Telemetry gaps",value:Y(c.totals.telemetryGapCount,0)}),u.jsx(ot,{label:"Commands",value:Y(c.totals.commandCount,0),detail:`${Y(c.totals.driveCommandCount,0)} drive/motor`}),u.jsx(ot,{label:"Rejected commands",value:Y(c.totals.rejectedCommandCount,0)}),u.jsx(ot,{label:"Distance",value:$r(c.totals.distanceMm)}),u.jsx(ot,{label:"Overcurrent episodes",value:Y(c.totals.overcurrentEpisodeCount,0)}),u.jsx(ot,{label:"Bumps",value:Y(c.totals.bumpCount,0)}),u.jsx(ot,{label:"Cliff episodes",value:Y(c.totals.cliffCount,0)}),u.jsx(ot,{label:"Wheel drops",value:Y(c.totals.wheelDropCount,0)}),u.jsx(ot,{label:"Virtual walls",value:Y(c.totals.virtualWallCount,0)}),u.jsx(ot,{label:"Charged",value:`${Y(c.totals.chargedMah)} mAh`}),u.jsx(ot,{label:"Discharged",value:`${Y(c.totals.dischargedMah)} mAh`}),u.jsx(ot,{label:"Battery sessions",value:Y(c.totals.batterySessionCount,0)}),u.jsx(ot,{label:"Warnings",value:Y(c.totals.warningFindingCount,0)}),u.jsx(ot,{label:"Critical",value:Y(c.totals.criticalFindingCount,0)})]}),u.jsx(pt,{title:"Needs attention",meta:c.findings.length,bodyClassName:"space-y-0.5 p-0.5 text-xs",children:c.findings.length?c.findings.map(w=>u.jsxs("details",{className:"surface px-1 py-0.5",children:[u.jsxs("summary",{className:"cursor-pointer text-slate-100",children:[u.jsx("span",{className:w.severity==="critical"?"text-red-300":w.severity==="warning"?"text-amber-300":"text-slate-400",children:w.severity})," · ",w.roverId?`${w.roverId} · `:"",w.title," · confidence ",w.confidence]}),u.jsx("pre",{className:"mt-0.5 overflow-x-auto whitespace-pre-wrap text-[0.68rem] text-slate-300",children:JSON.stringify(w.evidence,null,2)})]},w.key)):u.jsx("p",{className:"surface px-1 py-0.5 text-emerald-300",children:"No findings in the selected range."})}),u.jsx(pt,{title:"Time series",meta:`${c.minutes.length.toLocaleString()} minute rows`,actions:u.jsx("select",{className:"surface px-1 py-0.25 text-xs text-slate-100",value:i,onChange:w=>f(w.target.value),children:Sc.map(([w,$])=>u.jsx("option",{value:w,children:$},w))}),bodyClassName:"p-0.5",children:u.jsx(vc,{minutes:c.minutes,roverIds:W,metric:i})}),u.jsx(pt,{title:"Rover comparison",meta:c.rovers.length,actions:u.jsx("button",{type:"button",className:"button-dark px-1 py-0.25 text-xs",onClick:()=>ns("fleet-rovers.csv",c.rovers),children:"Export CSV"}),bodyClassName:"overflow-x-auto p-0.5",children:u.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[u.jsx("thead",{className:"text-slate-400",children:u.jsxs("tr",{children:[u.jsx("th",{children:"Rover"}),u.jsx("th",{children:"Online"}),u.jsx("th",{children:"Samples"}),u.jsx("th",{children:"Coverage"}),u.jsx("th",{children:"Gaps"}),u.jsx("th",{children:"Distance"}),u.jsx("th",{children:"Commands"}),u.jsx("th",{children:"Drive/motor"}),u.jsx("th",{children:"Rejected"}),u.jsx("th",{children:"Overcurrents"}),u.jsx("th",{children:"Bumps"}),u.jsx("th",{children:"Cliffs"}),u.jsx("th",{children:"Wheel drops"}),u.jsx("th",{children:"Virtual walls"}),u.jsx("th",{children:"Charged mAh"}),u.jsx("th",{children:"Discharged mAh"}),u.jsx("th",{children:"Voltage avg/min/max mV"}),u.jsx("th",{children:"Temperature avg/min/max °C"}),u.jsx("th",{children:"Charge now mAh"}),u.jsx("th",{children:"Reported capacity mAh"}),u.jsx("th",{children:"Last sample"})]})}),u.jsx("tbody",{children:c.rovers.map(w=>u.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[u.jsx("td",{children:w.name}),u.jsx("td",{children:w.online?"yes":"no"}),u.jsx("td",{children:Y(w.sampleCount,0)}),u.jsx("td",{children:ls(w.coverageMs)}),u.jsx("td",{children:Y(w.gapCount,0)}),u.jsx("td",{children:$r(w.distanceMm)}),u.jsx("td",{children:Y(w.commandCount,0)}),u.jsx("td",{children:Y(w.driveCommandCount,0)}),u.jsx("td",{children:Y(w.rejectedCommandCount,0)}),u.jsx("td",{children:Y(w.overcurrentEpisodeCount,0)}),u.jsx("td",{children:Y(w.bumpCount,0)}),u.jsx("td",{children:Y(w.cliffCount,0)}),u.jsx("td",{children:Y(w.wheelDropCount,0)}),u.jsx("td",{children:Y(w.virtualWallCount,0)}),u.jsx("td",{children:Y(w.chargedMah)}),u.jsx("td",{children:Y(w.dischargedMah)}),u.jsxs("td",{children:[Y(w.averageVoltageMv,0)," / ",Y(w.minimumVoltageMv,0)," / ",Y(w.maximumVoltageMv,0)]}),u.jsxs("td",{children:[Y(w.averageTemperatureC)," / ",Y(w.minimumTemperatureC)," / ",Y(w.maximumTemperatureC)]}),u.jsx("td",{children:Y(w.latestChargeMah,0)}),u.jsx("td",{children:Y(w.reportedCapacityMah,0)}),u.jsx("td",{children:Tt(w.lastSampleAt)})]},w.roverId))})]})}),u.jsx(pt,{title:"Battery sessions",meta:c.batterySessions.length,actions:u.jsx("button",{type:"button",className:"button-dark px-1 py-0.25 text-xs",onClick:()=>ns("fleet-battery-sessions.csv",c.batterySessions),children:"Export CSV"}),bodyClassName:"overflow-x-auto p-0.5",children:u.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[u.jsx("thead",{className:"text-slate-400",children:u.jsxs("tr",{children:[u.jsx("th",{children:"Rover"}),u.jsx("th",{children:"Kind"}),u.jsx("th",{children:"Started"}),u.jsx("th",{children:"Ended"}),u.jsx("th",{children:"Duration"}),u.jsx("th",{children:"Start/end charge"}),u.jsx("th",{children:"Charged mAh"}),u.jsx("th",{children:"Discharged mAh"}),u.jsx("th",{children:"Voltage min/max"}),u.jsx("th",{children:"Temperature min/max"}),u.jsx("th",{children:"Samples"}),u.jsx("th",{children:"Gaps"}),u.jsx("th",{children:"Confidence"}),u.jsx("th",{children:"Qualification"})]})}),u.jsx("tbody",{children:c.batterySessions.map(w=>u.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[u.jsx("td",{children:w.roverId}),u.jsx("td",{children:w.kind}),u.jsx("td",{children:Tt(w.startedAt)}),u.jsx("td",{children:Tt(w.endedAt)}),u.jsx("td",{children:ls((w.endedAt||c.generatedAt)-w.startedAt)}),u.jsxs("td",{children:[Y(w.startChargeMah,0)," / ",Y(w.endChargeMah,0)," mAh"]}),u.jsx("td",{children:Y(w.chargedMah)}),u.jsx("td",{children:Y(w.dischargedMah)}),u.jsxs("td",{children:[Y(w.minVoltageMv,0)," / ",Y(w.maxVoltageMv,0)," mV"]}),u.jsxs("td",{children:[Y(w.minTemperatureC)," / ",Y(w.maxTemperatureC)," °C"]}),u.jsx("td",{children:Y(w.sampleCount,0)}),u.jsx("td",{children:Y(w.gapCount,0)}),u.jsx("td",{children:w.confidence}),u.jsx("td",{children:w.qualificationReason})]},w.id))})]})}),u.jsx(pt,{title:"Battery health calculations",meta:c.batteryHealth.length,bodyClassName:"overflow-x-auto p-0.5",children:u.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[u.jsx("thead",{className:"text-slate-400",children:u.jsxs("tr",{children:[u.jsx("th",{children:"Rover"}),u.jsx("th",{children:"Battery identity"}),u.jsx("th",{children:"Qualified tests"}),u.jsx("th",{children:"Baseline tests"}),u.jsx("th",{children:"Learned baseline mAh"}),u.jsx("th",{children:"Latest usable mAh"}),u.jsx("th",{children:"Capacity retained"}),u.jsx("th",{children:"Discharged throughput mAh"}),u.jsx("th",{children:"Equivalent full cycles"}),u.jsx("th",{children:"Latest qualified test"}),u.jsx("th",{children:"Confidence"}),u.jsx("th",{children:"Confidence reason"})]})}),u.jsx("tbody",{children:c.batteryHealth.map(w=>u.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[u.jsx("td",{children:w.roverId}),u.jsx("td",{children:w.batteryKey}),u.jsx("td",{children:Y(w.qualifiedTestCount,0)}),u.jsx("td",{children:Y(w.baselineTestCount,0)}),u.jsx("td",{children:Y(w.baselineMah)}),u.jsx("td",{children:Y(w.measuredUsableMah)}),u.jsx("td",{children:w.capacityRetentionPercent==null?"--":`${Y(w.capacityRetentionPercent)}%`}),u.jsx("td",{children:Y(w.dischargedThroughputMah)}),u.jsx("td",{children:Y(w.equivalentFullCycles,3)}),u.jsx("td",{children:Tt(w.latestQualifiedTestAt)}),u.jsx("td",{children:w.confidence}),u.jsx("td",{children:w.confidenceReason})]},w.roverId))})]})}),u.jsx(jc,{report:c,onSaved:S}),u.jsx(pt,{title:"Structured event history",meta:`${c.events.length} returned`,actions:u.jsx("button",{type:"button",className:"button-dark px-1 py-0.25 text-xs",onClick:()=>ns("fleet-events.csv",c.events),children:"Export CSV"}),bodyClassName:"space-y-0.5 p-0.5",children:c.events.map(w=>u.jsxs("details",{className:"surface px-1 py-0.5 text-xs",children:[u.jsxs("summary",{className:"cursor-pointer text-slate-200",children:[Tt(w.ts)," · ",w.severity," · ",w.source," · ",w.type,w.roverId?` · ${w.roverId}`:""]}),u.jsx("pre",{className:"mt-0.5 overflow-x-auto whitespace-pre-wrap text-[0.68rem] text-slate-300",children:JSON.stringify(w.payload,null,2)})]},w.id))}),u.jsx(pt,{title:"Daily report and Discord delivery history",meta:c.dailyReportHistory.length,bodyClassName:"overflow-x-auto p-0.5",children:u.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[u.jsx("thead",{className:"text-slate-400",children:u.jsxs("tr",{children:[u.jsx("th",{children:"Report day"}),u.jsx("th",{children:"Generated"}),u.jsx("th",{children:"Stored bytes"}),u.jsx("th",{children:"Discord delivered"}),u.jsx("th",{children:"Delivery error"})]})}),u.jsx("tbody",{children:c.dailyReportHistory.map(w=>u.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[u.jsx("td",{children:w.reportDate}),u.jsx("td",{children:Tt(w.generatedAt)}),u.jsx("td",{children:Y(w.reportBytes,0)}),u.jsx("td",{children:Tt(w.discordDeliveredAt)}),u.jsx("td",{children:w.discordError||"--"})]},w.reportDate))})]})}),u.jsxs(pt,{title:"Collector and storage diagnostics",bodyClassName:"grid gap-0.5 p-0.5 md:grid-cols-2",children:[u.jsx("pre",{className:"surface overflow-x-auto whitespace-pre-wrap p-1 text-[0.68rem] text-slate-300",children:JSON.stringify(c.diagnostics.collector,null,2)}),u.jsx("pre",{className:"surface overflow-x-auto whitespace-pre-wrap p-1 text-[0.68rem] text-slate-300",children:JSON.stringify(c.diagnostics.storage,null,2)})]}),u.jsxs(pt,{title:"Methodology",bodyClassName:"space-y-0.5 p-1 text-xs text-slate-300",children:[u.jsx("p",{children:"Battery throughput integrates OI packet 23 signed battery current: delta mAh = current mA × elapsed milliseconds / 3,600,000. Positive current is charged throughput; negative current is discharged throughput."}),u.jsx("p",{children:"Intervals exceeding the configured maximum gap are excluded rather than interpreted as zero. Packet 25 charge movement is retained as independent evidence. Packet 26 is displayed as the rover-reported fixed reference and is not treated as measured battery health."}),u.jsx("p",{children:"A high-confidence capacity test requires a qualified full endpoint, continuous telemetry, configured minimum discharge depth, and a low endpoint. Partial or interrupted sessions remain visible with lower confidence and an explicit qualification reason."})]})]}):null]})}function Ec(){da({identitySurface:"passive"});const e=Kr(l=>pa(l,"fleetReports")),{value:n}=ma("page",{backgroundTheme:ga}),r=xa(n?.backgroundTheme);return u.jsxs("div",{className:`${r} min-h-screen text-slate-100`,children:[u.jsx(ya,{}),u.jsx("main",{className:`mx-auto flex min-h-screen w-full max-w-[120rem] flex-col ${wa} p-1`,children:e?u.jsx(kc,{}):u.jsxs(pt,{title:"Fleet reports unavailable",bodyClassName:"space-y-0.5 p-1 text-sm text-slate-300",children:[u.jsx("p",{children:"This server has not enabled fleet reporting."}),u.jsx(Yr,{className:"button-dark inline-block px-1 py-0.5 text-xs",to:"/",children:"Back to rover page"})]})})]})}export{Ec as default};
|
||
//# sourceMappingURL=FleetReportsApp-9Z_DFtwj.js.map
|