precision-dashwidgets 0.5.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -21
- package/dist/{deflate-BhCs3EVM.mjs → deflate-CyCS27iF.mjs} +1 -1
- package/dist/index-CRAkqt4--CvnY7WxJ.mjs +4 -0
- package/dist/{index-BPlDjM00.mjs → index-CdW9BP2T.mjs} +9 -9
- package/dist/index-GF8k2nCC-Rypj-gGv.mjs +4 -0
- package/dist/{index-Oh_goZGT-ChJfpWzo.mjs → index-Oh_goZGT-Drk6kHj-.mjs} +2 -2
- package/dist/{index-UOUUzHJY-w-g8Wwzh.mjs → index-UOUUzHJY-DebPJ0dC.mjs} +1 -1
- package/dist/{index-dhOjlnSX-BYdQtWmD.mjs → index-dhOjlnSX-11_jYWLn.mjs} +1 -1
- package/dist/{index-u1qleOVs-BYmcfDHg.mjs → index-u1qleOVs-B74-wHol.mjs} +2 -2
- package/dist/{index-BKzfWMQL.mjs → index-w9j4W2ma.mjs} +38 -20
- package/dist/{jpeg-CcPIHJJb.mjs → jpeg-jsrKVbbY.mjs} +1 -1
- package/dist/{lerc-BgJ5uP3F.mjs → lerc-CBpfbMul.mjs} +2 -2
- package/dist/{lerc-XufrP0FH-AWUOo2VT.mjs → lerc-XufrP0FH-BsxGX2dW.mjs} +1 -1
- package/dist/{lzw-BPNO0d6S.mjs → lzw-BWgBDxct.mjs} +1 -1
- package/dist/{packbits-2KoZ88H4.mjs → packbits-CUORHrxc.mjs} +1 -1
- package/dist/precision-dashwidgets.es.js +1 -1
- package/dist/precision-dashwidgets.umd.js +4 -4
- package/dist/{raw-BOTKG_OX.mjs → raw-DLEwRloC.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/{webimage-UA6QS-y3.mjs → webimage-BOc3YOov.mjs} +1 -1
- package/package.json +1 -1
- package/dist/index-CRAkqt4--DYvOyo89.mjs +0 -4
- package/dist/index-GF8k2nCC-lOm3hJ2E.mjs +0 -4
|
@@ -97,7 +97,7 @@ ${e}</tr>
|
|
|
97
97
|
`+this.renderer.text(a);A?r+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):r+=c;continue}default:{const a='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,A=this.renderer){var i,n;let r="";for(let s=0;s<e.length;s++){const o=e[s];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[o.type]){const a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=a||"";continue}}const g=o;switch(g.type){case"escape":{r+=A.text(g);break}case"html":{r+=A.html(g);break}case"link":{r+=A.link(g);break}case"image":{r+=A.image(g);break}case"strong":{r+=A.strong(g);break}case"em":{r+=A.em(g);break}case"codespan":{r+=A.codespan(g);break}case"br":{r+=A.br(g);break}case"del":{r+=A.del(g);break}case"text":{r+=A.text(g);break}default:{const a='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Y0,KB=(Y0=class{constructor(t){Fi(this,"options"),Fi(this,"block"),this.options=t||cg}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?uo.lex:uo.lexInline}provideParser(){return this.block?Bo.parse:Bo.parseInline}},Fi(Y0,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Y0),u5=class{constructor(...t){Fi(this,"defaults",M0()),Fi(this,"options",this.setOptions),Fi(this,"parse",this.parseMarkdown(!0)),Fi(this,"parseInline",this.parseMarkdown(!1)),Fi(this,"Parser",Bo),Fi(this,"Renderer",YB),Fi(this,"TextRenderer",J0),Fi(this,"Lexer",uo),Fi(this,"Tokenizer",JB),Fi(this,"Hooks",KB),this.use(...t)}walkTokens(t,e){var A,i;let n=[];for(const r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{const s=r;for(const o of s.header)n=n.concat(this.walkTokens(o.tokens,e));for(const o of s.rows)for(const g of o)n=n.concat(this.walkTokens(g.tokens,e));break}case"list":{const s=r;n=n.concat(this.walkTokens(s.items,e));break}default:{const s=r;(i=(A=this.defaults.extensions)==null?void 0:A.childTokens)!=null&&i[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{const g=s[o].flat(1/0);n=n.concat(this.walkTokens(g,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(A=>{const i={...A};if(i.async=this.defaults.async||i.async||!1,A.extensions&&(A.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=e.renderers[n.name];r?e.renderers[n.name]=function(...s){let o=n.renderer.apply(this,s);return o===!1&&(o=r.apply(this,s)),o}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),A.renderer){const n=this.defaults.renderer||new YB(this.defaults);for(const r in A.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const s=r,o=A.renderer[s],g=n[s];n[s]=(...a)=>{let c=o.apply(n,a);return c===!1&&(c=g.apply(n,a)),c||""}}i.renderer=n}if(A.tokenizer){const n=this.defaults.tokenizer||new JB(this.defaults);for(const r in A.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const s=r,o=A.tokenizer[s],g=n[s];n[s]=(...a)=>{let c=o.apply(n,a);return c===!1&&(c=g.apply(n,a)),c}}i.tokenizer=n}if(A.hooks){const n=this.defaults.hooks||new KB;for(const r in A.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const s=r,o=A.hooks[s],g=n[s];KB.passThroughHooks.has(r)?n[s]=a=>{if(this.defaults.async)return Promise.resolve(o.call(n,a)).then(l=>g.call(n,l));const c=o.call(n,a);return g.call(n,c)}:n[s]=(...a)=>{let c=o.apply(n,a);return c===!1&&(c=g.apply(n,a)),c}}i.hooks=n}if(A.walkTokens){const n=this.defaults.walkTokens,r=A.walkTokens;i.walkTokens=function(s){let o=[];return o.push(r.call(this,s)),n&&(o=o.concat(n.call(this,s))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return uo.lex(t,e??this.defaults)}parser(t,e){return Bo.parse(t,e??this.defaults)}parseMarkdown(t){return(e,A)=>{const i={...A},n={...this.defaults,...i},r=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=t);const s=n.hooks?n.hooks.provideLexer():t?uo.lex:uo.lexInline,o=n.hooks?n.hooks.provideParser():t?Bo.parse:Bo.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(e):e).then(g=>s(g,n)).then(g=>n.hooks?n.hooks.processAllTokens(g):g).then(g=>n.walkTokens?Promise.all(this.walkTokens(g,n.walkTokens)).then(()=>g):g).then(g=>o(g,n)).then(g=>n.hooks?n.hooks.postprocess(g):g).catch(r);try{n.hooks&&(e=n.hooks.preprocess(e));let g=s(e,n);n.hooks&&(g=n.hooks.processAllTokens(g)),n.walkTokens&&this.walkTokens(g,n.walkTokens);let a=o(g,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(g){return r(g)}}}onError(t,e){return A=>{if(A.message+=`
|
|
98
98
|
Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+ws(A.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(A);throw A}}},lg=new u5;function hi(t,e){return lg.parse(t,e)}hi.options=hi.setOptions=function(t){return lg.setOptions(t),hi.defaults=lg.defaults,Tv(hi.defaults),hi},hi.getDefaults=M0,hi.defaults=cg,hi.use=function(...t){return lg.use(...t),hi.defaults=lg.defaults,Tv(hi.defaults),hi},hi.walkTokens=function(t,e){return lg.walkTokens(t,e)},hi.parseInline=lg.parseInline,hi.Parser=Bo,hi.parser=Bo.parse,hi.Renderer=YB,hi.TextRenderer=J0,hi.Lexer=uo,hi.lexer=uo.lex,hi.Tokenizer=JB,hi.Hooks=KB,hi.parse=hi,hi.options,hi.setOptions,hi.use,hi.walkTokens,hi.parseInline,Bo.parse,uo.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:$v,setPrototypeOf:Zv,isFrozen:B5,getPrototypeOf:C5,getOwnPropertyDescriptor:f5}=Object;let{freeze:Vn,seal:Sr,create:K0}=Object,{apply:V0,construct:W0}=typeof Reflect<"u"&&Reflect;Vn||(Vn=function(t){return t}),Sr||(Sr=function(t){return t}),V0||(V0=function(t,e){for(var A=arguments.length,i=new Array(A>2?A-2:0),n=2;n<A;n++)i[n-2]=arguments[n];return t.apply(e,i)}),W0||(W0=function(t){for(var e=arguments.length,A=new Array(e>1?e-1:0),i=1;i<e;i++)A[i-1]=arguments[i];return new t(...A)});const VB=zn(Array.prototype.forEach),E5=zn(Array.prototype.lastIndexOf),e2=zn(Array.prototype.pop),PI=zn(Array.prototype.push),d5=zn(Array.prototype.splice),WB=zn(String.prototype.toLowerCase),z0=zn(String.prototype.toString),X0=zn(String.prototype.match),qI=zn(String.prototype.replace),Q5=zn(String.prototype.indexOf),p5=zn(String.prototype.trim),jr=zn(Object.prototype.hasOwnProperty),Wn=zn(RegExp.prototype.test),HI=y5(TypeError);function zn(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var A=arguments.length,i=new Array(A>1?A-1:0),n=1;n<A;n++)i[n-1]=arguments[n];return V0(t,e,i)}}function y5(t){return function(){for(var e=arguments.length,A=new Array(e),i=0;i<e;i++)A[i]=arguments[i];return W0(t,A)}}function Gt(t,e){let A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:WB;Zv&&Zv(t,null);let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){const r=A(n);r!==n&&(B5(e)||(e[i]=r),n=r)}t[n]=!0}return t}function m5(t){for(let e=0;e<t.length;e++)jr(t,e)||(t[e]=null);return t}function Ds(t){const e=K0(null);for(const[A,i]of $v(t))jr(t,A)&&(Array.isArray(i)?e[A]=m5(i):i&&typeof i=="object"&&i.constructor===Object?e[A]=Ds(i):e[A]=i);return e}function JI(t,e){for(;t!==null;){const i=f5(t,e);if(i){if(i.get)return zn(i.get);if(typeof i.value=="function")return zn(i.value)}t=C5(t)}function A(){return null}return A}const A2=Vn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),j0=Vn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$0=Vn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),w5=Vn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Z0=Vn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),D5=Vn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),t2=Vn(["#text"]),i2=Vn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ep=Vn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),n2=Vn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zB=Vn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_5=Sr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),S5=Sr(/<%[\w\W]*|[\w\W]*%>/gm),v5=Sr(/\$\{[\w\W]*/gm),b5=Sr(/^data-[\-\w.\u00B7-\uFFFF]+$/),x5=Sr(/^aria-[\-\w]+$/),r2=Sr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),R5=Sr(/^(?:\w+script|data):/i),F5=Sr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),s2=Sr(/^html$/i),N5=Sr(/^[a-z][.\w]*(-[.\w]+)+$/i);var o2=Object.freeze({__proto__:null,ARIA_ATTR:x5,ATTR_WHITESPACE:F5,CUSTOM_ELEMENT:N5,DATA_ATTR:b5,DOCTYPE_NAME:s2,ERB_EXPR:S5,IS_ALLOWED_URI:r2,IS_SCRIPT_OR_DATA:R5,MUSTACHE_EXPR:_5,TMPLIT_EXPR:v5});const YI={element:1,text:3,progressingInstruction:7,comment:8,document:9},k5=function(){return typeof window>"u"?null:window},M5=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let A=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(A=e.getAttribute(i));const n="dompurify"+(A?"#"+A:"");try{return t.createPolicy(n,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},a2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function g2(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k5();const e=X=>g2(X);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==YI.document||!t.Element)return e.isSupported=!1,e;let{document:A}=t;const i=A,n=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:s,Node:o,Element:g,NodeFilter:a,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:l,DOMParser:I,trustedTypes:h}=t,u=g.prototype,E=JI(u,"cloneNode"),C=JI(u,"remove"),f=JI(u,"nextSibling"),y=JI(u,"childNodes"),Q=JI(u,"parentNode");if(typeof s=="function"){const X=A.createElement("template");X.content&&X.content.ownerDocument&&(A=X.content.ownerDocument)}let d,w="";const{implementation:p,createNodeIterator:m,createDocumentFragment:D,getElementsByTagName:x}=A,{importNode:N}=i;let F=a2();e.isSupported=typeof $v=="function"&&typeof Q=="function"&&p&&p.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:k,TMPLIT_EXPR:_,DATA_ATTR:b,ARIA_ATTR:v,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:Y}=o2;let{IS_ALLOWED_URI:R}=o2,W=null;const ne=Gt({},[...A2,...j0,...$0,...Z0,...t2]);let le=null;const Z=Gt({},[...i2,...ep,...n2,...zB]);let ae=Object.seal(K0(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,Ee=null;const me=Object.seal(K0(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let He=!0,ke=!0,eA=!1,dA=!0,XA=!1,OA=!0,TA=!1,YA=!1,Ve=!1,de=!1,nA=!1,PA=!1,At=!0,fi=!1;const U="user-content-";let Tt=!0,Ai=!1,FA={},Nt=null;const it=Gt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ti=null;const jA=Gt({},["audio","video","img","source","image","track"]);let gi=null;const Li=Gt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ye="http://www.w3.org/1998/Math/MathML",We="http://www.w3.org/2000/svg",ze="http://www.w3.org/1999/xhtml";let cA=ze,qA=!1,$A=null;const nt=Gt({},[ye,We,ze],z0);let et=Gt({},["mi","mo","mn","ms","mtext"]),Wt=Gt({},["annotation-xml"]);const $t=Gt({},["title","style","font","a","script"]);let xt=null;const Yt=["application/xhtml+xml","text/html"],Ri="text/html";let Ht=null,st=null;const ni=A.createElement("form"),fA=function(X){return X instanceof RegExp||X instanceof Function},Qt=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(st&&st===X)){if((!X||typeof X!="object")&&(X={}),X=Ds(X),xt=Yt.indexOf(X.PARSER_MEDIA_TYPE)===-1?Ri:X.PARSER_MEDIA_TYPE,Ht=xt==="application/xhtml+xml"?z0:WB,W=jr(X,"ALLOWED_TAGS")?Gt({},X.ALLOWED_TAGS,Ht):ne,le=jr(X,"ALLOWED_ATTR")?Gt({},X.ALLOWED_ATTR,Ht):Z,$A=jr(X,"ALLOWED_NAMESPACES")?Gt({},X.ALLOWED_NAMESPACES,z0):nt,gi=jr(X,"ADD_URI_SAFE_ATTR")?Gt(Ds(Li),X.ADD_URI_SAFE_ATTR,Ht):Li,Ti=jr(X,"ADD_DATA_URI_TAGS")?Gt(Ds(jA),X.ADD_DATA_URI_TAGS,Ht):jA,Nt=jr(X,"FORBID_CONTENTS")?Gt({},X.FORBID_CONTENTS,Ht):it,ie=jr(X,"FORBID_TAGS")?Gt({},X.FORBID_TAGS,Ht):Ds({}),Ee=jr(X,"FORBID_ATTR")?Gt({},X.FORBID_ATTR,Ht):Ds({}),FA=jr(X,"USE_PROFILES")?X.USE_PROFILES:!1,He=X.ALLOW_ARIA_ATTR!==!1,ke=X.ALLOW_DATA_ATTR!==!1,eA=X.ALLOW_UNKNOWN_PROTOCOLS||!1,dA=X.ALLOW_SELF_CLOSE_IN_ATTR!==!1,XA=X.SAFE_FOR_TEMPLATES||!1,OA=X.SAFE_FOR_XML!==!1,TA=X.WHOLE_DOCUMENT||!1,de=X.RETURN_DOM||!1,nA=X.RETURN_DOM_FRAGMENT||!1,PA=X.RETURN_TRUSTED_TYPE||!1,Ve=X.FORCE_BODY||!1,At=X.SANITIZE_DOM!==!1,fi=X.SANITIZE_NAMED_PROPS||!1,Tt=X.KEEP_CONTENT!==!1,Ai=X.IN_PLACE||!1,R=X.ALLOWED_URI_REGEXP||r2,cA=X.NAMESPACE||ze,et=X.MATHML_TEXT_INTEGRATION_POINTS||et,Wt=X.HTML_INTEGRATION_POINTS||Wt,ae=X.CUSTOM_ELEMENT_HANDLING||{},X.CUSTOM_ELEMENT_HANDLING&&fA(X.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ae.tagNameCheck=X.CUSTOM_ELEMENT_HANDLING.tagNameCheck),X.CUSTOM_ELEMENT_HANDLING&&fA(X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ae.attributeNameCheck=X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),X.CUSTOM_ELEMENT_HANDLING&&typeof X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ae.allowCustomizedBuiltInElements=X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),XA&&(ke=!1),nA&&(de=!0),FA&&(W=Gt({},t2),le=[],FA.html===!0&&(Gt(W,A2),Gt(le,i2)),FA.svg===!0&&(Gt(W,j0),Gt(le,ep),Gt(le,zB)),FA.svgFilters===!0&&(Gt(W,$0),Gt(le,ep),Gt(le,zB)),FA.mathMl===!0&&(Gt(W,Z0),Gt(le,n2),Gt(le,zB))),X.ADD_TAGS&&(typeof X.ADD_TAGS=="function"?me.tagCheck=X.ADD_TAGS:(W===ne&&(W=Ds(W)),Gt(W,X.ADD_TAGS,Ht))),X.ADD_ATTR&&(typeof X.ADD_ATTR=="function"?me.attributeCheck=X.ADD_ATTR:(le===Z&&(le=Ds(le)),Gt(le,X.ADD_ATTR,Ht))),X.ADD_URI_SAFE_ATTR&&Gt(gi,X.ADD_URI_SAFE_ATTR,Ht),X.FORBID_CONTENTS&&(Nt===it&&(Nt=Ds(Nt)),Gt(Nt,X.FORBID_CONTENTS,Ht)),X.ADD_FORBID_CONTENTS&&(Nt===it&&(Nt=Ds(Nt)),Gt(Nt,X.ADD_FORBID_CONTENTS,Ht)),Tt&&(W["#text"]=!0),TA&&Gt(W,["html","head","body"]),W.table&&(Gt(W,["tbody"]),delete ie.tbody),X.TRUSTED_TYPES_POLICY){if(typeof X.TRUSTED_TYPES_POLICY.createHTML!="function")throw HI('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof X.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw HI('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');d=X.TRUSTED_TYPES_POLICY,w=d.createHTML("")}else d===void 0&&(d=M5(h,n)),d!==null&&typeof w=="string"&&(w=d.createHTML(""));Vn&&Vn(X),st=X}},ti=Gt({},[...j0,...$0,...w5]),Kt=Gt({},[...Z0,...D5]),wt=function(X){let qe=Q(X);(!qe||!qe.tagName)&&(qe={namespaceURI:cA,tagName:"template"});const Ue=WB(X.tagName),DA=WB(qe.tagName);return $A[X.namespaceURI]?X.namespaceURI===We?qe.namespaceURI===ze?Ue==="svg":qe.namespaceURI===ye?Ue==="svg"&&(DA==="annotation-xml"||et[DA]):!!ti[Ue]:X.namespaceURI===ye?qe.namespaceURI===ze?Ue==="math":qe.namespaceURI===We?Ue==="math"&&Wt[DA]:!!Kt[Ue]:X.namespaceURI===ze?qe.namespaceURI===We&&!Wt[DA]||qe.namespaceURI===ye&&!et[DA]?!1:!Kt[Ue]&&($t[Ue]||!ti[Ue]):!!(xt==="application/xhtml+xml"&&$A[X.namespaceURI]):!1},Vt=function(X){PI(e.removed,{element:X});try{Q(X).removeChild(X)}catch{C(X)}},ci=function(X,qe){try{PI(e.removed,{attribute:qe.getAttributeNode(X),from:qe})}catch{PI(e.removed,{attribute:null,from:qe})}if(qe.removeAttribute(X),X==="is")if(de||nA)try{Vt(qe)}catch{}else try{qe.setAttribute(X,"")}catch{}},Ji=function(X){let qe=null,Ue=null;if(Ve)X="<remove></remove>"+X;else{const tt=X0(X,/^[\r\n\t ]+/);Ue=tt&&tt[0]}xt==="application/xhtml+xml"&&cA===ze&&(X='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+X+"</body></html>");const DA=d?d.createHTML(X):X;if(cA===ze)try{qe=new I().parseFromString(DA,xt)}catch{}if(!qe||!qe.documentElement){qe=p.createDocument(cA,"template",null);try{qe.documentElement.innerHTML=qA?w:DA}catch{}}const It=qe.body||qe.documentElement;return X&&Ue&&It.insertBefore(A.createTextNode(Ue),It.childNodes[0]||null),cA===ze?x.call(qe,TA?"html":"body")[0]:TA?qe.documentElement:It},ji=function(X){return m.call(X.ownerDocument||X,X,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},J=function(X){return X instanceof l&&(typeof X.nodeName!="string"||typeof X.textContent!="string"||typeof X.removeChild!="function"||!(X.attributes instanceof c)||typeof X.removeAttribute!="function"||typeof X.setAttribute!="function"||typeof X.namespaceURI!="string"||typeof X.insertBefore!="function"||typeof X.hasChildNodes!="function")},ee=function(X){return typeof o=="function"&&X instanceof o};function ge(X,qe,Ue){VB(X,DA=>{DA.call(e,qe,Ue,st)})}const xe=function(X){let qe=null;if(ge(F.beforeSanitizeElements,X,null),J(X))return Vt(X),!0;const Ue=Ht(X.nodeName);if(ge(F.uponSanitizeElement,X,{tagName:Ue,allowedTags:W}),OA&&X.hasChildNodes()&&!ee(X.firstElementChild)&&Wn(/<[/\w!]/g,X.innerHTML)&&Wn(/<[/\w!]/g,X.textContent)||X.nodeType===YI.progressingInstruction||OA&&X.nodeType===YI.comment&&Wn(/<[/\w]/g,X.data))return Vt(X),!0;if(!(me.tagCheck instanceof Function&&me.tagCheck(Ue))&&(!W[Ue]||ie[Ue])){if(!ie[Ue]&&Oe(Ue)&&(ae.tagNameCheck instanceof RegExp&&Wn(ae.tagNameCheck,Ue)||ae.tagNameCheck instanceof Function&&ae.tagNameCheck(Ue)))return!1;if(Tt&&!Nt[Ue]){const DA=Q(X)||X.parentNode,It=y(X)||X.childNodes;if(It&&DA){const tt=It.length;for(let GA=tt-1;GA>=0;--GA){const Ei=E(It[GA],!0);Ei.__removalCount=(X.__removalCount||0)+1,DA.insertBefore(Ei,f(X))}}}return Vt(X),!0}return X instanceof g&&!wt(X)||(Ue==="noscript"||Ue==="noembed"||Ue==="noframes")&&Wn(/<\/no(script|embed|frames)/i,X.innerHTML)?(Vt(X),!0):(XA&&X.nodeType===YI.text&&(qe=X.textContent,VB([M,k,_],DA=>{qe=qI(qe,DA," ")}),X.textContent!==qe&&(PI(e.removed,{element:X.cloneNode()}),X.textContent=qe)),ge(F.afterSanitizeElements,X,null),!1)},Ne=function(X,qe,Ue){if(At&&(qe==="id"||qe==="name")&&(Ue in A||Ue in ni))return!1;if(!(ke&&!Ee[qe]&&Wn(b,qe))&&!(He&&Wn(v,qe))&&!(me.attributeCheck instanceof Function&&me.attributeCheck(qe,X))){if(!le[qe]||Ee[qe]){if(!(Oe(X)&&(ae.tagNameCheck instanceof RegExp&&Wn(ae.tagNameCheck,X)||ae.tagNameCheck instanceof Function&&ae.tagNameCheck(X))&&(ae.attributeNameCheck instanceof RegExp&&Wn(ae.attributeNameCheck,qe)||ae.attributeNameCheck instanceof Function&&ae.attributeNameCheck(qe,X))||qe==="is"&&ae.allowCustomizedBuiltInElements&&(ae.tagNameCheck instanceof RegExp&&Wn(ae.tagNameCheck,Ue)||ae.tagNameCheck instanceof Function&&ae.tagNameCheck(Ue))))return!1}else if(!gi[qe]&&!Wn(R,qI(Ue,O,""))&&!((qe==="src"||qe==="xlink:href"||qe==="href")&&X!=="script"&&Q5(Ue,"data:")===0&&Ti[X])&&!(eA&&!Wn(T,qI(Ue,O,"")))&&Ue)return!1}return!0},Oe=function(X){return X!=="annotation-xml"&&X0(X,Y)},kA=function(X){ge(F.beforeSanitizeAttributes,X,null);const{attributes:qe}=X;if(!qe||J(X))return;const Ue={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let DA=qe.length;for(;DA--;){const It=qe[DA],{name:tt,namespaceURI:GA,value:Ei}=It,Jt=Ht(tt),_i=Ei;let ri=tt==="value"?_i:p5(_i);if(Ue.attrName=Jt,Ue.attrValue=ri,Ue.keepAttr=!0,Ue.forceKeepAttr=void 0,ge(F.uponSanitizeAttribute,X,Ue),ri=Ue.attrValue,fi&&(Jt==="id"||Jt==="name")&&(ci(tt,X),ri=U+ri),OA&&Wn(/((--!?|])>)|<\/(style|title|textarea)/i,ri)){ci(tt,X);continue}if(Jt==="attributename"&&X0(ri,"href")){ci(tt,X);continue}if(Ue.forceKeepAttr)continue;if(!Ue.keepAttr){ci(tt,X);continue}if(!dA&&Wn(/\/>/i,ri)){ci(tt,X);continue}XA&&VB([M,k,_],Dr=>{ri=qI(ri,Dr," ")});const Jr=Ht(X.nodeName);if(!Ne(Jr,Jt,ri)){ci(tt,X);continue}if(d&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!GA)switch(h.getAttributeType(Jr,Jt)){case"TrustedHTML":{ri=d.createHTML(ri);break}case"TrustedScriptURL":{ri=d.createScriptURL(ri);break}}if(ri!==_i)try{GA?X.setAttributeNS(GA,tt,ri):X.setAttribute(tt,ri),J(X)?Vt(X):e2(e.removed)}catch{ci(tt,X)}}ge(F.afterSanitizeAttributes,X,null)},vA=function X(qe){let Ue=null;const DA=ji(qe);for(ge(F.beforeSanitizeShadowDOM,qe,null);Ue=DA.nextNode();)ge(F.uponSanitizeShadowNode,Ue,null),xe(Ue),kA(Ue),Ue.content instanceof r&&X(Ue.content);ge(F.afterSanitizeShadowDOM,qe,null)};return e.sanitize=function(X){let qe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ue=null,DA=null,It=null,tt=null;if(qA=!X,qA&&(X="<!-->"),typeof X!="string"&&!ee(X))if(typeof X.toString=="function"){if(X=X.toString(),typeof X!="string")throw HI("dirty is not a string, aborting")}else throw HI("toString is not a function");if(!e.isSupported)return X;if(YA||Qt(qe),e.removed=[],typeof X=="string"&&(Ai=!1),Ai){if(X.nodeName){const Jt=Ht(X.nodeName);if(!W[Jt]||ie[Jt])throw HI("root node is forbidden and cannot be sanitized in-place")}}else if(X instanceof o)Ue=Ji("<!---->"),DA=Ue.ownerDocument.importNode(X,!0),DA.nodeType===YI.element&&DA.nodeName==="BODY"||DA.nodeName==="HTML"?Ue=DA:Ue.appendChild(DA);else{if(!de&&!XA&&!TA&&X.indexOf("<")===-1)return d&&PA?d.createHTML(X):X;if(Ue=Ji(X),!Ue)return de?null:PA?w:""}Ue&&Ve&&Vt(Ue.firstChild);const GA=ji(Ai?X:Ue);for(;It=GA.nextNode();)xe(It),kA(It),It.content instanceof r&&vA(It.content);if(Ai)return X;if(de){if(nA)for(tt=D.call(Ue.ownerDocument);Ue.firstChild;)tt.appendChild(Ue.firstChild);else tt=Ue;return(le.shadowroot||le.shadowrootmode)&&(tt=N.call(i,tt,!0)),tt}let Ei=TA?Ue.outerHTML:Ue.innerHTML;return TA&&W["!doctype"]&&Ue.ownerDocument&&Ue.ownerDocument.doctype&&Ue.ownerDocument.doctype.name&&Wn(s2,Ue.ownerDocument.doctype.name)&&(Ei="<!DOCTYPE "+Ue.ownerDocument.doctype.name+`>
|
|
99
99
|
`+Ei),XA&&VB([M,k,_],Jt=>{Ei=qI(Ei,Jt," ")}),d&&PA?d.createHTML(Ei):Ei},e.setConfig=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qt(X),YA=!0},e.clearConfig=function(){st=null,YA=!1},e.isValidAttribute=function(X,qe,Ue){st||Qt({});const DA=Ht(X),It=Ht(qe);return Ne(DA,It,Ue)},e.addHook=function(X,qe){typeof qe=="function"&&PI(F[X],qe)},e.removeHook=function(X,qe){if(qe!==void 0){const Ue=E5(F[X],qe);return Ue===-1?void 0:d5(F[X],Ue,1)[0]}return e2(F[X])},e.removeHooks=function(X){F[X]=[]},e.removeAllHooks=function(){F=a2()},e}var T5=g2();const L5={class:"markdown-header"},U5={key:1,class:"markdown-output"},G5={key:0,class:"markdown-placeholder"},O5={class:"placeholder-text"},P5=["innerHTML"],q5=B.defineComponent({inheritAttrs:!1,__name:"Markdown",props:{markdownText:{},mode:{},sanitize:{type:Boolean},inputFormat:{},disabled:{type:Boolean}},emits:["update:markdownText","changeMode"],setup(t,{emit:e}){const A=t,i=e;hi.setOptions({gfm:!0,breaks:!0});const n=B.ref(A.markdownText??"");B.watch(()=>A.markdownText,a=>{a!==void 0&&a!==n.value&&(n.value=a)});const r=B.ref(A.disabled?!1:A.mode?A.mode==="edit":!1);B.watch(()=>A.mode,a=>{a&&!A.disabled&&(r.value=a==="edit")}),B.watch(()=>A.disabled,a=>{a&&(r.value=!1)});const s=B.computed(()=>{const a=A.inputFormat==="html"?n.value??"":hi.parse(n.value??"");return A.sanitize===!1?a:T5.sanitize(a)});function o(){i("update:markdownText",n.value)}function g(){A.disabled||(r.value=!r.value,i("changeMode",r.value?"edit":"preview"))}return(a,c)=>(B.openBlock(),B.createElementBlock("div",B.mergeProps({class:"markdown-widget-wrap"},a.$attrs),[B.createElementVNode("div",L5,[t.disabled?B.createCommentVNode("",!0):(B.openBlock(),B.createBlock(Eq,{key:0,class:"edit-icon",onClick:g,width:20,height:20}))]),r.value&&!t.disabled?B.withDirectives((B.openBlock(),B.createElementBlock("textarea",{key:0,"onUpdate:modelValue":c[0]||(c[0]=l=>n.value=l),onInput:o,class:"markdown-input",placeholder:"Write markdown here…"},null,544)),[[B.vModelText,n.value]]):(B.openBlock(),B.createElementBlock("div",U5,[n.value?(B.openBlock(),B.createElementBlock("div",{key:1,innerHTML:s.value},null,8,P5)):(B.openBlock(),B.createElementBlock("div",G5,[c[1]||(c[1]=B.createElementVNode("div",{class:"placeholder-title"},"Markdown Editor",-1)),B.createElementVNode("div",O5,B.toDisplayString(t.disabled?"No content available":"Click the pencil icon above to start editing"),1)]))]))],16))}}),H5=co(q5,[["__scopeId","data-v-165dbe2e"]]),J5={class:"text-viewer"},Y5={key:0,class:"text-viewer__loading"},K5={key:1,class:"text-viewer__error"},V5={key:2,class:"text-viewer__empty"},W5={class:"text-viewer__code-wrapper"},z5={key:0,class:"text-viewer__line-numbers"},X5={class:"text-viewer__footer"},j5={class:"text-viewer__file-info"},$5=B.defineComponent({__name:"TextViewer",props:{src:{type:String,default:null},content:{type:String,default:null},fileType:{type:String,default:"text",validator:t=>["text","json","csv","xml","yaml","yml","log"].includes(t)},maxHeight:{type:String,default:"600px"},showLineNumbers:{type:Boolean,default:!0},wrapText:{type:Boolean,default:!1}},setup(t){const e=t,A=B.ref(""),i=B.ref(!1),n=B.ref(null),r=B.computed(()=>{if(e.fileType==="json")try{const l=JSON.parse(A.value);return JSON.stringify(l,null,2)}catch{return A.value}return A.value}),s=B.computed(()=>r.value.split(`
|
|
100
|
-
`)),o=B.computed(()=>({json:"language-json",csv:"language-csv",xml:"language-xml",yaml:"language-yaml",yml:"language-yaml",log:"language-log",text:"language-text"})[e.fileType]||"language-text"),g=B.computed(()=>({type:e.fileType.toUpperCase(),lines:s.value.length,characters:r.value.length}));async function a(){if(e.src){i.value=!0,n.value=null;try{const l=await fetch(e.src);if(!l.ok)throw new Error(`Failed to fetch: ${l.statusText}`);A.value=await l.text()}catch(l){n.value=l.message}finally{i.value=!1}}}function c(){navigator.clipboard.writeText(r.value)}return B.watch(()=>e.src,l=>{l&&!e.content&&a()},{immediate:!0}),B.watch(()=>e.content,l=>{l&&(A.value=l)},{immediate:!0}),(l,I)=>(B.openBlock(),B.createElementBlock("div",J5,[i.value?(B.openBlock(),B.createElementBlock("div",Y5,"Loading content...")):n.value?(B.openBlock(),B.createElementBlock("div",K5,[I[0]||(I[0]=B.createElementVNode("strong",null,"Error loading file:",-1)),B.createTextVNode(" "+B.toDisplayString(n.value),1)])):A.value?(B.openBlock(),B.createElementBlock(B.Fragment,{key:3},[B.createElementVNode("div",{class:"text-viewer__content",style:B.normalizeStyle({maxHeight:t.maxHeight,whiteSpace:t.wrapText?"pre-wrap":"pre"})},[B.createElementVNode("div",W5,[t.showLineNumbers?(B.openBlock(),B.createElementBlock("div",z5,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(s.value,(h,u)=>(B.openBlock(),B.createElementBlock("div",{key:u,class:"text-viewer__line-number"},B.toDisplayString(u+1),1))),128))])):B.createCommentVNode("",!0),B.createElementVNode("pre",{class:B.normalizeClass(["text-viewer__code-block",o.value])},[B.createElementVNode("code",null,B.toDisplayString(r.value),1)],2)])],4),B.createElementVNode("div",X5,[B.createElementVNode("span",j5,B.toDisplayString(g.value.type)+" | "+B.toDisplayString(g.value.lines)+" lines | "+B.toDisplayString(g.value.characters)+" characters ",1),B.createElementVNode("button",{onClick:c,class:"text-viewer__copy-button"}," Copy to Clipboard ")])],64)):(B.openBlock(),B.createElementBlock("div",V5,"No content available"))]))}}),Z5=co($5,[["__scopeId","data-v-4007de4f"]]);B.defineAsyncComponent(()=>Promise.resolve().then(()=>kee).then(t=>t.DataExplorer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Mee).then(t=>t.UMAP)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Tee).then(t=>t.Markdown)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Lee).then(t=>t.TextViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>$ee).then(t=>t.ProportionPlot)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>tAe).then(t=>t.AiPlotly)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>iAe).then(t=>t.TSViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>l4).then(t=>t.OmeViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>l4).then(t=>t.TiffViewer));const c2="dashboard:globalVars";function Ig(t=!1){const e=B.inject(c2,null);return!e&&t&&console.warn("[Widget] dashboard:globalVars not provided."),e}const eK={class:"data-explorer-wrap"},AK={class:"data-explorer-info"},tK=B.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(t){const e=Ig(),A=B.ref("Data Explorer"),i=B.computed(()=>B.unref(e.s3Url));return B.watchEffect(()=>{}),(n,r)=>{const s=B.resolveComponent("el-icon");return B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(n.$slots,"default",{widgetName:A.value},void 0,!0),B.createElementVNode("div",eK,[B.createElementVNode("div",AK,[B.createVNode(B.unref(Dc.ElTooltip),{placement:"top-start"},{content:B.withCtx(()=>[...r[0]||(r[0]=[B.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])]),default:B.withCtx(()=>[B.createVNode(s,{color:"#8300BF"},{default:B.withCtx(()=>[B.createVNode(B.unref(uq))]),_:1})]),_:1})]),B.createVNode(B.unref(G1),{srcUrl:i.value},null,8,["srcUrl"])])],64)}}}),_s=(t,e)=>{const A=t.__vccOpts||t;for(const[i,n]of e)A[i]=n;return A},iK=_s(tK,[["__scopeId","data-v-c63ff2cc"]]),nK={class:"umap-wrap"},rK=_s(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(t){const e=Ig(),A=B.ref("Data Explorer"),i=B.computed(()=>B.unref(e==null?void 0:e.s3Url));return(n,r)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(n.$slots,"default",{widgetName:A.value},void 0,!0),B.createElementVNode("div",nK,[B.createVNode(B.unref(Mv),{srcUrl:i.value},null,8,["srcUrl"])])],64))}}),[["__scopeId","data-v-78e97b02"]]),KI=B0.defineStore("precisionGlobalVars",()=>{const t=B.ref(null),e=B.ref(null),A=B.ref(null),i=B.ref(null),n=B.ref(null);function r(l){t.value=l===""?null:l}function s(l){e.value=l===""?null:l}function o(l){A.value=l===""?null:l}function g(l){i.value=l===""?null:l}function a(l){n.value=l===""?null:l}function c(l,I){switch(l){case"selectedGene":r(I);break;case"selectedMetadataColumn":s(I);break;case"selectedGene1":o(I);break;case"selectedGene2":g(I);break;case"selectedGeneX":a(I);break;default:console.warn(`Unknown selection key: ${l}`)}}return{selectedGene:t,selectedMetadataColumn:e,selectedGene1:A,selectedGene2:i,selectedGeneX:n,setSelectedGene:r,setSelectedMetadataColumn:s,setSelectedGene1:o,setSelectedGene2:g,setSelectedGeneX:a,setSelection:c}});function hg(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function sK(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function l2(t){let e,A,i;t.length!==2?(e=hg,A=(o,g)=>hg(t(o),g),i=(o,g)=>t(o)-g):(e=t===hg||t===sK?t:oK,A=t,i=t);function n(o,g,a=0,c=o.length){if(a<c){if(e(g,g)!==0)return c;do{const l=a+c>>>1;A(o[l],g)<0?a=l+1:c=l}while(a<c)}return a}function r(o,g,a=0,c=o.length){if(a<c){if(e(g,g)!==0)return c;do{const l=a+c>>>1;A(o[l],g)<=0?a=l+1:c=l}while(a<c)}return a}function s(o,g,a=0,c=o.length){const l=n(o,g,a,c-1);return l>a&&i(o[l-1],g)>-i(o[l],g)?l-1:l}return{left:n,center:s,right:r}}function oK(){return 0}function aK(t){return t===null?NaN:+t}function*gK(t,e){for(let A of t)A!=null&&(A=+A)>=A&&(yield A)}const cK=l2(hg).right;l2(aK).center;function lK(t,e){let A=0,i,n=0,r=0;for(let s of t)s!=null&&(s=+s)>=s&&(i=s-n,n+=i/++A,r+=i*(s-n));if(A>1)return r/(A-1)}function IK(t,e){const A=lK(t);return A&&Math.sqrt(A)}function Co(t,e){let A,i;if(e===void 0)for(const n of t)n!=null&&(A===void 0?n>=n&&(A=i=n):(A>n&&(A=n),i<n&&(i=n)));else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(A===void 0?r>=r&&(A=i=r):(A>r&&(A=r),i<r&&(i=r)))}return[A,i]}class I2 extends Map{constructor(e,A=BK){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:A}}),e!=null)for(const[i,n]of e)this.set(i,n)}get(e){return super.get(h2(this,e))}has(e){return super.has(h2(this,e))}set(e,A){return super.set(hK(this,e),A)}delete(e){return super.delete(uK(this,e))}}function h2({_intern:t,_key:e},A){const i=e(A);return t.has(i)?t.get(i):A}function hK({_intern:t,_key:e},A){const i=e(A);return t.has(i)?t.get(i):(t.set(i,A),A)}function uK({_intern:t,_key:e},A){const i=e(A);return t.has(i)&&(A=t.get(i),t.delete(i)),A}function BK(t){return t!==null&&typeof t=="object"?t.valueOf():t}function CK(t=hg){if(t===hg)return u2;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,A)=>{const i=t(e,A);return i||i===0?i:(t(A,A)===0)-(t(e,e)===0)}}function u2(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const fK=Math.sqrt(50),EK=Math.sqrt(10),dK=Math.sqrt(2);function XB(t,e,A){const i=(e-t)/Math.max(0,A),n=Math.floor(Math.log10(i)),r=i/Math.pow(10,n),s=r>=fK?10:r>=EK?5:r>=dK?2:1;let o,g,a;return n<0?(a=Math.pow(10,-n)/s,o=Math.round(t*a),g=Math.round(e*a),o/a<t&&++o,g/a>e&&--g,a=-a):(a=Math.pow(10,n)*s,o=Math.round(t/a),g=Math.round(e/a),o*a<t&&++o,g*a>e&&--g),g<o&&.5<=A&&A<2?XB(t,e,A*2):[o,g,a]}function QK(t,e,A){if(e=+e,t=+t,A=+A,!(A>0))return[];if(t===e)return[t];const i=e<t,[n,r,s]=i?XB(e,t,A):XB(t,e,A);if(!(r>=n))return[];const o=r-n+1,g=new Array(o);if(i)if(s<0)for(let a=0;a<o;++a)g[a]=(r-a)/-s;else for(let a=0;a<o;++a)g[a]=(r-a)*s;else if(s<0)for(let a=0;a<o;++a)g[a]=(n+a)/-s;else for(let a=0;a<o;++a)g[a]=(n+a)*s;return g}function Ap(t,e,A){return e=+e,t=+t,A=+A,XB(t,e,A)[2]}function pK(t,e,A){e=+e,t=+t,A=+A;const i=e<t,n=i?Ap(e,t,A):Ap(t,e,A);return(i?-1:1)*(n<0?1/-n:n)}function jB(t,e){let A;if(e===void 0)for(const i of t)i!=null&&(A<i||A===void 0&&i>=i)&&(A=i);else{let i=-1;for(let n of t)(n=e(n,++i,t))!=null&&(A<n||A===void 0&&n>=n)&&(A=n)}return A}function tp(t,e){let A;for(const i of t)i!=null&&(A>i||A===void 0&&i>=i)&&(A=i);return A}function B2(t,e,A=0,i=1/0,n){if(e=Math.floor(e),A=Math.floor(Math.max(0,A)),i=Math.floor(Math.min(t.length-1,i)),!(A<=e&&e<=i))return t;for(n=n===void 0?u2:CK(n);i>A;){if(i-A>600){const g=i-A+1,a=e-A+1,c=Math.log(g),l=.5*Math.exp(2*c/3),I=.5*Math.sqrt(c*l*(g-l)/g)*(a-g/2<0?-1:1),h=Math.max(A,Math.floor(e-a*l/g+I)),u=Math.min(i,Math.floor(e+(g-a)*l/g+I));B2(t,e,h,u,n)}const r=t[e];let s=A,o=i;for(VI(t,A,e),n(t[i],r)>0&&VI(t,A,i);s<o;){for(VI(t,s,o),++s,--o;n(t[s],r)<0;)++s;for(;n(t[o],r)>0;)--o}n(t[A],r)===0?VI(t,A,o):(++o,VI(t,o,i)),o<=e&&(A=o+1),e<=o&&(i=o-1)}return t}function VI(t,e,A){const i=t[e];t[e]=t[A],t[A]=i}function ip(t,e,A){if(t=Float64Array.from(gK(t)),!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return tp(t);if(e>=1)return jB(t);var i,n=(i-1)*e,r=Math.floor(n),s=jB(B2(t,r).subarray(0,r+1)),o=tp(t.subarray(r+1));return s+(o-s)*(n-r)}}function yK(t,e){let A=0,i=0;if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(++A,i+=n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(++A,i+=r)}if(A)return i/A}function mK(t,e){return ip(t,.5)}function wK(t,e,A){t=+t,e=+e,A=(n=arguments.length)<2?(e=t,t=0,1):n<3?1:+A;for(var i=-1,n=Math.max(0,Math.ceil((e-t)/A))|0,r=new Array(n);++i<n;)r[i]=t+i*A;return r}function DK(t){return t}var np=1,rp=2,sp=3,WI=4,C2=1e-6;function _K(t){return"translate("+t+",0)"}function SK(t){return"translate(0,"+t+")"}function vK(t){return e=>+t(e)}function bK(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),A=>+t(A)+e}function xK(){return!this.__axis}function f2(t,e){var A=[],i=null,n=null,r=6,s=6,o=3,g=typeof window<"u"&&window.devicePixelRatio>1?0:.5,a=t===np||t===WI?-1:1,c=t===WI||t===rp?"x":"y",l=t===np||t===sp?_K:SK;function I(h){var u=i??(e.ticks?e.ticks.apply(e,A):e.domain()),E=n??(e.tickFormat?e.tickFormat.apply(e,A):DK),C=Math.max(r,0)+o,f=e.range(),y=+f[0]+g,Q=+f[f.length-1]+g,d=(e.bandwidth?bK:vK)(e.copy(),g),w=h.selection?h.selection():h,p=w.selectAll(".domain").data([null]),m=w.selectAll(".tick").data(u,e).order(),D=m.exit(),x=m.enter().append("g").attr("class","tick"),N=m.select("line"),F=m.select("text");p=p.merge(p.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),m=m.merge(x),N=N.merge(x.append("line").attr("stroke","currentColor").attr(c+"2",a*r)),F=F.merge(x.append("text").attr("fill","currentColor").attr(c,a*C).attr("dy",t===np?"0em":t===sp?"0.71em":"0.32em")),h!==w&&(p=p.transition(h),m=m.transition(h),N=N.transition(h),F=F.transition(h),D=D.transition(h).attr("opacity",C2).attr("transform",function(M){return isFinite(M=d(M))?l(M+g):this.getAttribute("transform")}),x.attr("opacity",C2).attr("transform",function(M){var k=this.parentNode.__axis;return l((k&&isFinite(k=k(M))?k:d(M))+g)})),D.remove(),p.attr("d",t===WI||t===rp?s?"M"+a*s+","+y+"H"+g+"V"+Q+"H"+a*s:"M"+g+","+y+"V"+Q:s?"M"+y+","+a*s+"V"+g+"H"+Q+"V"+a*s:"M"+y+","+g+"H"+Q),m.attr("opacity",1).attr("transform",function(M){return l(d(M)+g)}),N.attr(c+"2",a*r),F.attr(c,a*C).text(E),w.filter(xK).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===rp?"start":t===WI?"end":"middle"),w.each(function(){this.__axis=d})}return I.scale=function(h){return arguments.length?(e=h,I):e},I.ticks=function(){return A=Array.from(arguments),I},I.tickArguments=function(h){return arguments.length?(A=h==null?[]:Array.from(h),I):A.slice()},I.tickValues=function(h){return arguments.length?(i=h==null?null:Array.from(h),I):i&&i.slice()},I.tickFormat=function(h){return arguments.length?(n=h,I):n},I.tickSize=function(h){return arguments.length?(r=s=+h,I):r},I.tickSizeInner=function(h){return arguments.length?(r=+h,I):r},I.tickSizeOuter=function(h){return arguments.length?(s=+h,I):s},I.tickPadding=function(h){return arguments.length?(o=+h,I):o},I.offset=function(h){return arguments.length?(g=+h,I):g},I}function E2(t){return f2(sp,t)}function d2(t){return f2(WI,t)}var RK={value:()=>{}};function op(){for(var t=0,e=arguments.length,A={},i;t<e;++t){if(!(i=arguments[t]+"")||i in A||/[\s.]/.test(i))throw new Error("illegal type: "+i);A[i]=[]}return new $B(A)}function $B(t){this._=t}function FK(t,e){return t.trim().split(/^|\s+/).map(function(A){var i="",n=A.indexOf(".");if(n>=0&&(i=A.slice(n+1),A=A.slice(0,n)),A&&!e.hasOwnProperty(A))throw new Error("unknown type: "+A);return{type:A,name:i}})}$B.prototype=op.prototype={constructor:$B,on:function(t,e){var A=this._,i=FK(t+"",A),n,r=-1,s=i.length;if(arguments.length<2){for(;++r<s;)if((n=(t=i[r]).type)&&(n=NK(A[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<s;)if(n=(t=i[r]).type)A[n]=Q2(A[n],t.name,e);else if(e==null)for(n in A)A[n]=Q2(A[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var A in e)t[A]=e[A].slice();return new $B(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var A=new Array(n),i=0,n,r;i<n;++i)A[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],i=0,n=r.length;i<n;++i)r[i].value.apply(e,A)},apply:function(t,e,A){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],n=0,r=i.length;n<r;++n)i[n].value.apply(e,A)}};function NK(t,e){for(var A=0,i=t.length,n;A<i;++A)if((n=t[A]).name===e)return n.value}function Q2(t,e,A){for(var i=0,n=t.length;i<n;++i)if(t[i].name===e){t[i]=RK,t=t.slice(0,i).concat(t.slice(i+1));break}return A!=null&&t.push({name:e,value:A}),t}var ap="http://www.w3.org/1999/xhtml";const p2={svg:"http://www.w3.org/2000/svg",xhtml:ap,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ZB(t){var e=t+="",A=e.indexOf(":");return A>=0&&(e=t.slice(0,A))!=="xmlns"&&(t=t.slice(A+1)),p2.hasOwnProperty(e)?{space:p2[e],local:t}:t}function kK(t){return function(){var e=this.ownerDocument,A=this.namespaceURI;return A===ap&&e.documentElement.namespaceURI===ap?e.createElement(t):e.createElementNS(A,t)}}function MK(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function y2(t){var e=ZB(t);return(e.local?MK:kK)(e)}function TK(){}function gp(t){return t==null?TK:function(){return this.querySelector(t)}}function LK(t){typeof t!="function"&&(t=gp(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=new Array(s),g,a,c=0;c<s;++c)(g=r[c])&&(a=t.call(g,g.__data__,c,r))&&("__data__"in g&&(a.__data__=g.__data__),o[c]=a);return new ur(i,this._parents)}function UK(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function GK(){return[]}function m2(t){return t==null?GK:function(){return this.querySelectorAll(t)}}function OK(t){return function(){return UK(t.apply(this,arguments))}}function PK(t){typeof t=="function"?t=OK(t):t=m2(t);for(var e=this._groups,A=e.length,i=[],n=[],r=0;r<A;++r)for(var s=e[r],o=s.length,g,a=0;a<o;++a)(g=s[a])&&(i.push(t.call(g,g.__data__,a,s)),n.push(g));return new ur(i,n)}function w2(t){return function(){return this.matches(t)}}function D2(t){return function(e){return e.matches(t)}}var qK=Array.prototype.find;function HK(t){return function(){return qK.call(this.children,t)}}function JK(){return this.firstElementChild}function YK(t){return this.select(t==null?JK:HK(typeof t=="function"?t:D2(t)))}var KK=Array.prototype.filter;function VK(){return Array.from(this.children)}function WK(t){return function(){return KK.call(this.children,t)}}function zK(t){return this.selectAll(t==null?VK:WK(typeof t=="function"?t:D2(t)))}function XK(t){typeof t!="function"&&(t=w2(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=[],g,a=0;a<s;++a)(g=r[a])&&t.call(g,g.__data__,a,r)&&o.push(g);return new ur(i,this._parents)}function _2(t){return new Array(t.length)}function jK(){return new ur(this._enter||this._groups.map(_2),this._parents)}function eC(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}eC.prototype={constructor:eC,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function $K(t){return function(){return t}}function ZK(t,e,A,i,n,r){for(var s=0,o,g=e.length,a=r.length;s<a;++s)(o=e[s])?(o.__data__=r[s],i[s]=o):A[s]=new eC(t,r[s]);for(;s<g;++s)(o=e[s])&&(n[s]=o)}function eV(t,e,A,i,n,r,s){var o,g,a=new Map,c=e.length,l=r.length,I=new Array(c),h;for(o=0;o<c;++o)(g=e[o])&&(I[o]=h=s.call(g,g.__data__,o,e)+"",a.has(h)?n[o]=g:a.set(h,g));for(o=0;o<l;++o)h=s.call(t,r[o],o,r)+"",(g=a.get(h))?(i[o]=g,g.__data__=r[o],a.delete(h)):A[o]=new eC(t,r[o]);for(o=0;o<c;++o)(g=e[o])&&a.get(I[o])===g&&(n[o]=g)}function AV(t){return t.__data__}function tV(t,e){if(!arguments.length)return Array.from(this,AV);var A=e?eV:ZK,i=this._parents,n=this._groups;typeof t!="function"&&(t=$K(t));for(var r=n.length,s=new Array(r),o=new Array(r),g=new Array(r),a=0;a<r;++a){var c=i[a],l=n[a],I=l.length,h=iV(t.call(c,c&&c.__data__,a,i)),u=h.length,E=o[a]=new Array(u),C=s[a]=new Array(u),f=g[a]=new Array(I);A(c,l,E,C,f,h,e);for(var y=0,Q=0,d,w;y<u;++y)if(d=E[y]){for(y>=Q&&(Q=y+1);!(w=C[Q])&&++Q<u;);d._next=w||null}}return s=new ur(s,i),s._enter=o,s._exit=g,s}function iV(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function nV(){return new ur(this._exit||this._groups.map(_2),this._parents)}function rV(t,e,A){var i=this.enter(),n=this,r=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(n=e(n),n&&(n=n.selection())),A==null?r.remove():A(r),i&&n?i.merge(n).order():n}function sV(t){for(var e=t.selection?t.selection():t,A=this._groups,i=e._groups,n=A.length,r=i.length,s=Math.min(n,r),o=new Array(n),g=0;g<s;++g)for(var a=A[g],c=i[g],l=a.length,I=o[g]=new Array(l),h,u=0;u<l;++u)(h=a[u]||c[u])&&(I[u]=h);for(;g<n;++g)o[g]=A[g];return new ur(o,this._parents)}function oV(){for(var t=this._groups,e=-1,A=t.length;++e<A;)for(var i=t[e],n=i.length-1,r=i[n],s;--n>=0;)(s=i[n])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function aV(t){t||(t=gV);function e(l,I){return l&&I?t(l.__data__,I.__data__):!l-!I}for(var A=this._groups,i=A.length,n=new Array(i),r=0;r<i;++r){for(var s=A[r],o=s.length,g=n[r]=new Array(o),a,c=0;c<o;++c)(a=s[c])&&(g[c]=a);g.sort(e)}return new ur(n,this._parents).order()}function gV(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function cV(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function lV(){return Array.from(this)}function IV(){for(var t=this._groups,e=0,A=t.length;e<A;++e)for(var i=t[e],n=0,r=i.length;n<r;++n){var s=i[n];if(s)return s}return null}function hV(){let t=0;for(const e of this)++t;return t}function uV(){return!this.node()}function BV(t){for(var e=this._groups,A=0,i=e.length;A<i;++A)for(var n=e[A],r=0,s=n.length,o;r<s;++r)(o=n[r])&&t.call(o,o.__data__,r,n);return this}function CV(t){return function(){this.removeAttribute(t)}}function fV(t){return function(){this.removeAttributeNS(t.space,t.local)}}function EV(t,e){return function(){this.setAttribute(t,e)}}function dV(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function QV(t,e){return function(){var A=e.apply(this,arguments);A==null?this.removeAttribute(t):this.setAttribute(t,A)}}function pV(t,e){return function(){var A=e.apply(this,arguments);A==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,A)}}function yV(t,e){var A=ZB(t);if(arguments.length<2){var i=this.node();return A.local?i.getAttributeNS(A.space,A.local):i.getAttribute(A)}return this.each((e==null?A.local?fV:CV:typeof e=="function"?A.local?pV:QV:A.local?dV:EV)(A,e))}function S2(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mV(t){return function(){this.style.removeProperty(t)}}function wV(t,e,A){return function(){this.style.setProperty(t,e,A)}}function DV(t,e,A){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,A)}}function _V(t,e,A){return arguments.length>1?this.each((e==null?mV:typeof e=="function"?DV:wV)(t,e,A??"")):Fc(this.node(),t)}function Fc(t,e){return t.style.getPropertyValue(e)||S2(t).getComputedStyle(t,null).getPropertyValue(e)}function SV(t){return function(){delete this[t]}}function vV(t,e){return function(){this[t]=e}}function bV(t,e){return function(){var A=e.apply(this,arguments);A==null?delete this[t]:this[t]=A}}function xV(t,e){return arguments.length>1?this.each((e==null?SV:typeof e=="function"?bV:vV)(t,e)):this.node()[t]}function v2(t){return t.trim().split(/^|\s+/)}function cp(t){return t.classList||new b2(t)}function b2(t){this._node=t,this._names=v2(t.getAttribute("class")||"")}b2.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function x2(t,e){for(var A=cp(t),i=-1,n=e.length;++i<n;)A.add(e[i])}function R2(t,e){for(var A=cp(t),i=-1,n=e.length;++i<n;)A.remove(e[i])}function RV(t){return function(){x2(this,t)}}function FV(t){return function(){R2(this,t)}}function NV(t,e){return function(){(e.apply(this,arguments)?x2:R2)(this,t)}}function kV(t,e){var A=v2(t+"");if(arguments.length<2){for(var i=cp(this.node()),n=-1,r=A.length;++n<r;)if(!i.contains(A[n]))return!1;return!0}return this.each((typeof e=="function"?NV:e?RV:FV)(A,e))}function MV(){this.textContent=""}function TV(t){return function(){this.textContent=t}}function LV(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function UV(t){return arguments.length?this.each(t==null?MV:(typeof t=="function"?LV:TV)(t)):this.node().textContent}function GV(){this.innerHTML=""}function OV(t){return function(){this.innerHTML=t}}function PV(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function qV(t){return arguments.length?this.each(t==null?GV:(typeof t=="function"?PV:OV)(t)):this.node().innerHTML}function HV(){this.nextSibling&&this.parentNode.appendChild(this)}function JV(){return this.each(HV)}function YV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KV(){return this.each(YV)}function VV(t){var e=typeof t=="function"?t:y2(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function WV(){return null}function zV(t,e){var A=typeof t=="function"?t:y2(t),i=e==null?WV:typeof e=="function"?e:gp(e);return this.select(function(){return this.insertBefore(A.apply(this,arguments),i.apply(this,arguments)||null)})}function XV(){var t=this.parentNode;t&&t.removeChild(this)}function jV(){return this.each(XV)}function $V(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ZV(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function e9(t){return this.select(t?ZV:$V)}function A9(t){return arguments.length?this.property("__data__",t):this.node().__data__}function t9(t){return function(e){t.call(this,e,this.__data__)}}function i9(t){return t.trim().split(/^|\s+/).map(function(e){var A="",i=e.indexOf(".");return i>=0&&(A=e.slice(i+1),e=e.slice(0,i)),{type:e,name:A}})}function n9(t){return function(){var e=this.__on;if(e){for(var A=0,i=-1,n=e.length,r;A<n;++A)r=e[A],(!t.type||r.type===t.type)&&r.name===t.name?this.removeEventListener(r.type,r.listener,r.options):e[++i]=r;++i?e.length=i:delete this.__on}}}function r9(t,e,A){return function(){var i=this.__on,n,r=t9(e);if(i){for(var s=0,o=i.length;s<o;++s)if((n=i[s]).type===t.type&&n.name===t.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=r,n.options=A),n.value=e;return}}this.addEventListener(t.type,r,A),n={type:t.type,name:t.name,value:e,listener:r,options:A},i?i.push(n):this.__on=[n]}}function s9(t,e,A){var i=i9(t+""),n,r=i.length,s;if(arguments.length<2){var o=this.node().__on;if(o){for(var g=0,a=o.length,c;g<a;++g)for(n=0,c=o[g];n<r;++n)if((s=i[n]).type===c.type&&s.name===c.name)return c.value}return}for(o=e?r9:n9,n=0;n<r;++n)this.each(o(i[n],e,A));return this}function F2(t,e,A){var i=S2(t),n=i.CustomEvent;typeof n=="function"?n=new n(e,A):(n=i.document.createEvent("Event"),A?(n.initEvent(e,A.bubbles,A.cancelable),n.detail=A.detail):n.initEvent(e,!1,!1)),t.dispatchEvent(n)}function o9(t,e){return function(){return F2(this,t,e)}}function a9(t,e){return function(){return F2(this,t,e.apply(this,arguments))}}function g9(t,e){return this.each((typeof e=="function"?a9:o9)(t,e))}function*c9(){for(var t=this._groups,e=0,A=t.length;e<A;++e)for(var i=t[e],n=0,r=i.length,s;n<r;++n)(s=i[n])&&(yield s)}var N2=[null];function ur(t,e){this._groups=t,this._parents=e}function zI(){return new ur([[document.documentElement]],N2)}function l9(){return this}ur.prototype=zI.prototype={constructor:ur,select:LK,selectAll:PK,selectChild:YK,selectChildren:zK,filter:XK,data:tV,enter:jK,exit:nV,join:rV,merge:sV,selection:l9,order:oV,sort:aV,call:cV,nodes:lV,node:IV,size:hV,empty:uV,each:BV,attr:yV,style:_V,property:xV,classed:kV,text:UV,html:qV,raise:JV,lower:KV,append:VV,insert:zV,remove:jV,clone:e9,datum:A9,on:s9,dispatch:g9,[Symbol.iterator]:c9};function sn(t){return typeof t=="string"?new ur([[document.querySelector(t)]],[document.documentElement]):new ur([[t]],N2)}function I9(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ug(t,e){if(t=I9(t),e===void 0&&(e=t.currentTarget),e){var A=e.ownerSVGElement||e;if(A.createSVGPoint){var i=A.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var n=e.getBoundingClientRect();return[t.clientX-n.left-e.clientLeft,t.clientY-n.top-e.clientTop]}}return[t.pageX,t.pageY]}const lp={capture:!0,passive:!1};function Ip(t){t.preventDefault(),t.stopImmediatePropagation()}function h9(t){var e=t.document.documentElement,A=sn(t).on("dragstart.drag",Ip,lp);"onselectstart"in e?A.on("selectstart.drag",Ip,lp):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function u9(t,e){var A=t.document.documentElement,i=sn(t).on("dragstart.drag",null);e&&(i.on("click.drag",Ip,lp),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in A?i.on("selectstart.drag",null):(A.style.MozUserSelect=A.__noselect,delete A.__noselect)}function hp(t,e,A){t.prototype=e.prototype=A,A.constructor=t}function k2(t,e){var A=Object.create(t.prototype);for(var i in e)A[i]=e[i];return A}function XI(){}var jI=.7,AC=1/jI,Nc="\\s*([+-]?\\d+)\\s*",$I="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ss="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",B9=/^#([0-9a-f]{3,8})$/,C9=new RegExp(`^rgb\\(${Nc},${Nc},${Nc}\\)$`),f9=new RegExp(`^rgb\\(${Ss},${Ss},${Ss}\\)$`),E9=new RegExp(`^rgba\\(${Nc},${Nc},${Nc},${$I}\\)$`),d9=new RegExp(`^rgba\\(${Ss},${Ss},${Ss},${$I}\\)$`),Q9=new RegExp(`^hsl\\(${$I},${Ss},${Ss}\\)$`),p9=new RegExp(`^hsla\\(${$I},${Ss},${Ss},${$I}\\)$`),M2={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hp(XI,$r,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:T2,formatHex:T2,formatHex8:y9,formatHsl:m9,formatRgb:L2,toString:L2});function T2(){return this.rgb().formatHex()}function y9(){return this.rgb().formatHex8()}function m9(){return q2(this).formatHsl()}function L2(){return this.rgb().formatRgb()}function $r(t){var e,A;return t=(t+"").trim().toLowerCase(),(e=B9.exec(t))?(A=e[1].length,e=parseInt(e[1],16),A===6?U2(e):A===3?new nr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):A===8?tC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):A===4?tC(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=C9.exec(t))?new nr(e[1],e[2],e[3],1):(e=f9.exec(t))?new nr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=E9.exec(t))?tC(e[1],e[2],e[3],e[4]):(e=d9.exec(t))?tC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Q9.exec(t))?P2(e[1],e[2]/100,e[3]/100,1):(e=p9.exec(t))?P2(e[1],e[2]/100,e[3]/100,e[4]):M2.hasOwnProperty(t)?U2(M2[t]):t==="transparent"?new nr(NaN,NaN,NaN,0):null}function U2(t){return new nr(t>>16&255,t>>8&255,t&255,1)}function tC(t,e,A,i){return i<=0&&(t=e=A=NaN),new nr(t,e,A,i)}function w9(t){return t instanceof XI||(t=$r(t)),t?(t=t.rgb(),new nr(t.r,t.g,t.b,t.opacity)):new nr}function up(t,e,A,i){return arguments.length===1?w9(t):new nr(t,e,A,i??1)}function nr(t,e,A,i){this.r=+t,this.g=+e,this.b=+A,this.opacity=+i}hp(nr,up,k2(XI,{brighter(t){return t=t==null?AC:Math.pow(AC,t),new nr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?jI:Math.pow(jI,t),new nr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new nr(Bg(this.r),Bg(this.g),Bg(this.b),iC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:G2,formatHex:G2,formatHex8:D9,formatRgb:O2,toString:O2}));function G2(){return`#${Cg(this.r)}${Cg(this.g)}${Cg(this.b)}`}function D9(){return`#${Cg(this.r)}${Cg(this.g)}${Cg(this.b)}${Cg((isNaN(this.opacity)?1:this.opacity)*255)}`}function O2(){const t=iC(this.opacity);return`${t===1?"rgb(":"rgba("}${Bg(this.r)}, ${Bg(this.g)}, ${Bg(this.b)}${t===1?")":`, ${t})`}`}function iC(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Bg(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Cg(t){return t=Bg(t),(t<16?"0":"")+t.toString(16)}function P2(t,e,A,i){return i<=0?t=e=A=NaN:A<=0||A>=1?t=e=NaN:e<=0&&(t=NaN),new Zr(t,e,A,i)}function q2(t){if(t instanceof Zr)return new Zr(t.h,t.s,t.l,t.opacity);if(t instanceof XI||(t=$r(t)),!t)return new Zr;if(t instanceof Zr)return t;t=t.rgb();var e=t.r/255,A=t.g/255,i=t.b/255,n=Math.min(e,A,i),r=Math.max(e,A,i),s=NaN,o=r-n,g=(r+n)/2;return o?(e===r?s=(A-i)/o+(A<i)*6:A===r?s=(i-e)/o+2:s=(e-A)/o+4,o/=g<.5?r+n:2-r-n,s*=60):o=g>0&&g<1?0:s,new Zr(s,o,g,t.opacity)}function _9(t,e,A,i){return arguments.length===1?q2(t):new Zr(t,e,A,i??1)}function Zr(t,e,A,i){this.h=+t,this.s=+e,this.l=+A,this.opacity=+i}hp(Zr,_9,k2(XI,{brighter(t){return t=t==null?AC:Math.pow(AC,t),new Zr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?jI:Math.pow(jI,t),new Zr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,A=this.l,i=A+(A<.5?A:1-A)*e,n=2*A-i;return new nr(Bp(t>=240?t-240:t+120,n,i),Bp(t,n,i),Bp(t<120?t+240:t-120,n,i),this.opacity)},clamp(){return new Zr(H2(this.h),nC(this.s),nC(this.l),iC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=iC(this.opacity);return`${t===1?"hsl(":"hsla("}${H2(this.h)}, ${nC(this.s)*100}%, ${nC(this.l)*100}%${t===1?")":`, ${t})`}`}}));function H2(t){return t=(t||0)%360,t<0?t+360:t}function nC(t){return Math.max(0,Math.min(1,t||0))}function Bp(t,e,A){return(t<60?e+(A-e)*t/60:t<180?A:t<240?e+(A-e)*(240-t)/60:e)*255}const Cp=t=>()=>t;function S9(t,e){return function(A){return t+A*e}}function v9(t,e,A){return t=Math.pow(t,A),e=Math.pow(e,A)-t,A=1/A,function(i){return Math.pow(t+i*e,A)}}function b9(t){return(t=+t)==1?J2:function(e,A){return A-e?v9(e,A,t):Cp(isNaN(e)?A:e)}}function J2(t,e){var A=e-t;return A?S9(t,A):Cp(isNaN(t)?e:t)}const rC=function t(e){var A=b9(e);function i(n,r){var s=A((n=up(n)).r,(r=up(r)).r),o=A(n.g,r.g),g=A(n.b,r.b),a=J2(n.opacity,r.opacity);return function(c){return n.r=s(c),n.g=o(c),n.b=g(c),n.opacity=a(c),n+""}}return i.gamma=t,i}(1);function x9(t,e){e||(e=[]);var A=t?Math.min(e.length,t.length):0,i=e.slice(),n;return function(r){for(n=0;n<A;++n)i[n]=t[n]*(1-r)+e[n]*r;return i}}function R9(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function F9(t,e){var A=e?e.length:0,i=t?Math.min(A,t.length):0,n=new Array(i),r=new Array(A),s;for(s=0;s<i;++s)n[s]=dp(t[s],e[s]);for(;s<A;++s)r[s]=e[s];return function(o){for(s=0;s<i;++s)r[s]=n[s](o);return r}}function N9(t,e){var A=new Date;return t=+t,e=+e,function(i){return A.setTime(t*(1-i)+e*i),A}}function es(t,e){return t=+t,e=+e,function(A){return t*(1-A)+e*A}}function k9(t,e){var A={},i={},n;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(n in e)n in t?A[n]=dp(t[n],e[n]):i[n]=e[n];return function(r){for(n in A)i[n]=A[n](r);return i}}var fp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ep=new RegExp(fp.source,"g");function M9(t){return function(){return t}}function T9(t){return function(e){return t(e)+""}}function Y2(t,e){var A=fp.lastIndex=Ep.lastIndex=0,i,n,r,s=-1,o=[],g=[];for(t=t+"",e=e+"";(i=fp.exec(t))&&(n=Ep.exec(e));)(r=n.index)>A&&(r=e.slice(A,r),o[s]?o[s]+=r:o[++s]=r),(i=i[0])===(n=n[0])?o[s]?o[s]+=n:o[++s]=n:(o[++s]=null,g.push({i:s,x:es(i,n)})),A=Ep.lastIndex;return A<e.length&&(r=e.slice(A),o[s]?o[s]+=r:o[++s]=r),o.length<2?g[0]?T9(g[0].x):M9(e):(e=g.length,function(a){for(var c=0,l;c<e;++c)o[(l=g[c]).i]=l.x(a);return o.join("")})}function dp(t,e){var A=typeof e,i;return e==null||A==="boolean"?Cp(e):(A==="number"?es:A==="string"?(i=$r(e))?(e=i,rC):Y2:e instanceof $r?rC:e instanceof Date?N9:R9(e)?x9:Array.isArray(e)?F9:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?k9:es)(t,e)}function L9(t,e){return t=+t,e=+e,function(A){return Math.round(t*(1-A)+e*A)}}var K2=180/Math.PI,Qp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function V2(t,e,A,i,n,r){var s,o,g;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(g=t*A+e*i)&&(A-=t*g,i-=e*g),(o=Math.sqrt(A*A+i*i))&&(A/=o,i/=o,g/=o),t*i<e*A&&(t=-t,e=-e,g=-g,s=-s),{translateX:n,translateY:r,rotate:Math.atan2(e,t)*K2,skewX:Math.atan(g)*K2,scaleX:s,scaleY:o}}var sC;function U9(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Qp:V2(e.a,e.b,e.c,e.d,e.e,e.f)}function G9(t){return t==null||(sC||(sC=document.createElementNS("http://www.w3.org/2000/svg","g")),sC.setAttribute("transform",t),!(t=sC.transform.baseVal.consolidate()))?Qp:(t=t.matrix,V2(t.a,t.b,t.c,t.d,t.e,t.f))}function W2(t,e,A,i){function n(a){return a.length?a.pop()+" ":""}function r(a,c,l,I,h,u){if(a!==l||c!==I){var E=h.push("translate(",null,e,null,A);u.push({i:E-4,x:es(a,l)},{i:E-2,x:es(c,I)})}else(l||I)&&h.push("translate("+l+e+I+A)}function s(a,c,l,I){a!==c?(a-c>180?c+=360:c-a>180&&(a+=360),I.push({i:l.push(n(l)+"rotate(",null,i)-2,x:es(a,c)})):c&&l.push(n(l)+"rotate("+c+i)}function o(a,c,l,I){a!==c?I.push({i:l.push(n(l)+"skewX(",null,i)-2,x:es(a,c)}):c&&l.push(n(l)+"skewX("+c+i)}function g(a,c,l,I,h,u){if(a!==l||c!==I){var E=h.push(n(h)+"scale(",null,",",null,")");u.push({i:E-4,x:es(a,l)},{i:E-2,x:es(c,I)})}else(l!==1||I!==1)&&h.push(n(h)+"scale("+l+","+I+")")}return function(a,c){var l=[],I=[];return a=t(a),c=t(c),r(a.translateX,a.translateY,c.translateX,c.translateY,l,I),s(a.rotate,c.rotate,l,I),o(a.skewX,c.skewX,l,I),g(a.scaleX,a.scaleY,c.scaleX,c.scaleY,l,I),a=c=null,function(h){for(var u=-1,E=I.length,C;++u<E;)l[(C=I[u]).i]=C.x(h);return l.join("")}}}var O9=W2(U9,"px, ","px)","deg)"),P9=W2(G9,", ",")",")"),q9=1e-12;function z2(t){return((t=Math.exp(t))+1/t)/2}function H9(t){return((t=Math.exp(t))-1/t)/2}function J9(t){return((t=Math.exp(2*t))-1)/(t+1)}const Y9=function t(e,A,i){function n(r,s){var o=r[0],g=r[1],a=r[2],c=s[0],l=s[1],I=s[2],h=c-o,u=l-g,E=h*h+u*u,C,f;if(E<q9)f=Math.log(I/a)/e,C=function(m){return[o+m*h,g+m*u,a*Math.exp(e*m*f)]};else{var y=Math.sqrt(E),Q=(I*I-a*a+i*E)/(2*a*A*y),d=(I*I-a*a-i*E)/(2*I*A*y),w=Math.log(Math.sqrt(Q*Q+1)-Q),p=Math.log(Math.sqrt(d*d+1)-d);f=(p-w)/e,C=function(m){var D=m*f,x=z2(w),N=a/(A*y)*(x*J9(e*D+w)-H9(w));return[o+N*h,g+N*u,a*x/z2(e*D+w)]}}return C.duration=f*1e3*e/Math.SQRT2,C}return n.rho=function(r){var s=Math.max(.001,+r),o=s*s,g=o*o;return t(s,o,g)},n}(Math.SQRT2,2,4);var kc=0,ZI=0,eh=0,X2=1e3,oC,Ah,aC=0,fg=0,gC=0,th=typeof performance=="object"&&performance.now?performance:Date,j2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pp(){return fg||(j2(K9),fg=th.now()+gC)}function K9(){fg=0}function cC(){this._call=this._time=this._next=null}cC.prototype=$2.prototype={constructor:cC,restart:function(t,e,A){if(typeof t!="function")throw new TypeError("callback is not a function");A=(A==null?pp():+A)+(e==null?0:+e),!this._next&&Ah!==this&&(Ah?Ah._next=this:oC=this,Ah=this),this._call=t,this._time=A,yp()},stop:function(){this._call&&(this._call=null,this._time=1/0,yp())}};function $2(t,e,A){var i=new cC;return i.restart(t,e,A),i}function V9(){pp(),++kc;for(var t=oC,e;t;)(e=fg-t._time)>=0&&t._call.call(void 0,e),t=t._next;--kc}function Z2(){fg=(aC=th.now())+gC,kc=ZI=0;try{V9()}finally{kc=0,z9(),fg=0}}function W9(){var t=th.now(),e=t-aC;e>X2&&(gC-=e,aC=t)}function z9(){for(var t,e=oC,A,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(A=e._next,e._next=null,e=t?t._next=A:oC=A);Ah=t,yp(i)}function yp(t){if(!kc){ZI&&(ZI=clearTimeout(ZI));var e=t-fg;e>24?(t<1/0&&(ZI=setTimeout(Z2,t-th.now()-gC)),eh&&(eh=clearInterval(eh))):(eh||(aC=th.now(),eh=setInterval(W9,X2)),kc=1,j2(Z2))}}function eb(t,e,A){var i=new cC;return e=e==null?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,A),i}var X9=op("start","end","cancel","interrupt"),j9=[],Ab=0,tb=1,mp=2,lC=3,ib=4,wp=5,IC=6;function hC(t,e,A,i,n,r){var s=t.__transition;if(!s)t.__transition={};else if(A in s)return;$9(t,A,{name:e,index:i,group:n,on:X9,tween:j9,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ab})}function Dp(t,e){var A=As(t,e);if(A.state>Ab)throw new Error("too late; already scheduled");return A}function vs(t,e){var A=As(t,e);if(A.state>lC)throw new Error("too late; already running");return A}function As(t,e){var A=t.__transition;if(!A||!(A=A[e]))throw new Error("transition not found");return A}function $9(t,e,A){var i=t.__transition,n;i[e]=A,A.timer=$2(r,0,A.time);function r(a){A.state=tb,A.timer.restart(s,A.delay,A.time),A.delay<=a&&s(a-A.delay)}function s(a){var c,l,I,h;if(A.state!==tb)return g();for(c in i)if(h=i[c],h.name===A.name){if(h.state===lC)return eb(s);h.state===ib?(h.state=IC,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<e&&(h.state=IC,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[c])}if(eb(function(){A.state===lC&&(A.state=ib,A.timer.restart(o,A.delay,A.time),o(a))}),A.state=mp,A.on.call("start",t,t.__data__,A.index,A.group),A.state===mp){for(A.state=lC,n=new Array(I=A.tween.length),c=0,l=-1;c<I;++c)(h=A.tween[c].value.call(t,t.__data__,A.index,A.group))&&(n[++l]=h);n.length=l+1}}function o(a){for(var c=a<A.duration?A.ease.call(null,a/A.duration):(A.timer.restart(g),A.state=wp,1),l=-1,I=n.length;++l<I;)n[l].call(t,c);A.state===wp&&(A.on.call("end",t,t.__data__,A.index,A.group),g())}function g(){A.state=IC,A.timer.stop(),delete i[e];for(var a in i)return;delete t.__transition}}function uC(t,e){var A=t.__transition,i,n,r=!0,s;if(A){e=e==null?null:e+"";for(s in A){if((i=A[s]).name!==e){r=!1;continue}n=i.state>mp&&i.state<wp,i.state=IC,i.timer.stop(),i.on.call(n?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete A[s]}r&&delete t.__transition}}function Z9(t){return this.each(function(){uC(this,t)})}function eW(t,e){var A,i;return function(){var n=vs(this,t),r=n.tween;if(r!==A){i=A=r;for(var s=0,o=i.length;s<o;++s)if(i[s].name===e){i=i.slice(),i.splice(s,1);break}}n.tween=i}}function AW(t,e,A){var i,n;if(typeof A!="function")throw new Error;return function(){var r=vs(this,t),s=r.tween;if(s!==i){n=(i=s).slice();for(var o={name:e,value:A},g=0,a=n.length;g<a;++g)if(n[g].name===e){n[g]=o;break}g===a&&n.push(o)}r.tween=n}}function tW(t,e){var A=this._id;if(t+="",arguments.length<2){for(var i=As(this.node(),A).tween,n=0,r=i.length,s;n<r;++n)if((s=i[n]).name===t)return s.value;return null}return this.each((e==null?eW:AW)(A,t,e))}function _p(t,e,A){var i=t._id;return t.each(function(){var n=vs(this,i);(n.value||(n.value={}))[e]=A.apply(this,arguments)}),function(n){return As(n,i).value[e]}}function nb(t,e){var A;return(typeof e=="number"?es:e instanceof $r?rC:(A=$r(e))?(e=A,rC):Y2)(t,e)}function iW(t){return function(){this.removeAttribute(t)}}function nW(t){return function(){this.removeAttributeNS(t.space,t.local)}}function rW(t,e,A){var i,n=A+"",r;return function(){var s=this.getAttribute(t);return s===n?null:s===i?r:r=e(i=s,A)}}function sW(t,e,A){var i,n=A+"",r;return function(){var s=this.getAttributeNS(t.space,t.local);return s===n?null:s===i?r:r=e(i=s,A)}}function oW(t,e,A){var i,n,r;return function(){var s,o=A(this),g;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),g=o+"",s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o)))}}function aW(t,e,A){var i,n,r;return function(){var s,o=A(this),g;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),g=o+"",s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o)))}}function gW(t,e){var A=ZB(t),i=A==="transform"?P9:nb;return this.attrTween(t,typeof e=="function"?(A.local?aW:oW)(A,i,_p(this,"attr."+t,e)):e==null?(A.local?nW:iW)(A):(A.local?sW:rW)(A,i,e))}function cW(t,e){return function(A){this.setAttribute(t,e.call(this,A))}}function lW(t,e){return function(A){this.setAttributeNS(t.space,t.local,e.call(this,A))}}function IW(t,e){var A,i;function n(){var r=e.apply(this,arguments);return r!==i&&(A=(i=r)&&lW(t,r)),A}return n._value=e,n}function hW(t,e){var A,i;function n(){var r=e.apply(this,arguments);return r!==i&&(A=(i=r)&&cW(t,r)),A}return n._value=e,n}function uW(t,e){var A="attr."+t;if(arguments.length<2)return(A=this.tween(A))&&A._value;if(e==null)return this.tween(A,null);if(typeof e!="function")throw new Error;var i=ZB(t);return this.tween(A,(i.local?IW:hW)(i,e))}function BW(t,e){return function(){Dp(this,t).delay=+e.apply(this,arguments)}}function CW(t,e){return e=+e,function(){Dp(this,t).delay=e}}function fW(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?BW:CW)(e,t)):As(this.node(),e).delay}function EW(t,e){return function(){vs(this,t).duration=+e.apply(this,arguments)}}function dW(t,e){return e=+e,function(){vs(this,t).duration=e}}function QW(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?EW:dW)(e,t)):As(this.node(),e).duration}function pW(t,e){if(typeof e!="function")throw new Error;return function(){vs(this,t).ease=e}}function yW(t){var e=this._id;return arguments.length?this.each(pW(e,t)):As(this.node(),e).ease}function mW(t,e){return function(){var A=e.apply(this,arguments);if(typeof A!="function")throw new Error;vs(this,t).ease=A}}function wW(t){if(typeof t!="function")throw new Error;return this.each(mW(this._id,t))}function DW(t){typeof t!="function"&&(t=w2(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=[],g,a=0;a<s;++a)(g=r[a])&&t.call(g,g.__data__,a,r)&&o.push(g);return new fo(i,this._parents,this._name,this._id)}function _W(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,A=t._groups,i=e.length,n=A.length,r=Math.min(i,n),s=new Array(i),o=0;o<r;++o)for(var g=e[o],a=A[o],c=g.length,l=s[o]=new Array(c),I,h=0;h<c;++h)(I=g[h]||a[h])&&(l[h]=I);for(;o<i;++o)s[o]=e[o];return new fo(s,this._parents,this._name,this._id)}function SW(t){return(t+"").trim().split(/^|\s+/).every(function(e){var A=e.indexOf(".");return A>=0&&(e=e.slice(0,A)),!e||e==="start"})}function vW(t,e,A){var i,n,r=SW(e)?Dp:vs;return function(){var s=r(this,t),o=s.on;o!==i&&(n=(i=o).copy()).on(e,A),s.on=n}}function bW(t,e){var A=this._id;return arguments.length<2?As(this.node(),A).on.on(t):this.each(vW(A,t,e))}function xW(t){return function(){var e=this.parentNode;for(var A in this.__transition)if(+A!==t)return;e&&e.removeChild(this)}}function RW(){return this.on("end.remove",xW(this._id))}function FW(t){var e=this._name,A=this._id;typeof t!="function"&&(t=gp(t));for(var i=this._groups,n=i.length,r=new Array(n),s=0;s<n;++s)for(var o=i[s],g=o.length,a=r[s]=new Array(g),c,l,I=0;I<g;++I)(c=o[I])&&(l=t.call(c,c.__data__,I,o))&&("__data__"in c&&(l.__data__=c.__data__),a[I]=l,hC(a[I],e,A,I,a,As(c,A)));return new fo(r,this._parents,e,A)}function NW(t){var e=this._name,A=this._id;typeof t!="function"&&(t=m2(t));for(var i=this._groups,n=i.length,r=[],s=[],o=0;o<n;++o)for(var g=i[o],a=g.length,c,l=0;l<a;++l)if(c=g[l]){for(var I=t.call(c,c.__data__,l,g),h,u=As(c,A),E=0,C=I.length;E<C;++E)(h=I[E])&&hC(h,e,A,E,I,u);r.push(I),s.push(c)}return new fo(r,s,e,A)}var kW=zI.prototype.constructor;function MW(){return new kW(this._groups,this._parents)}function TW(t,e){var A,i,n;return function(){var r=Fc(this,t),s=(this.style.removeProperty(t),Fc(this,t));return r===s?null:r===A&&s===i?n:n=e(A=r,i=s)}}function rb(t){return function(){this.style.removeProperty(t)}}function LW(t,e,A){var i,n=A+"",r;return function(){var s=Fc(this,t);return s===n?null:s===i?r:r=e(i=s,A)}}function UW(t,e,A){var i,n,r;return function(){var s=Fc(this,t),o=A(this),g=o+"";return o==null&&(g=o=(this.style.removeProperty(t),Fc(this,t))),s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o))}}function GW(t,e){var A,i,n,r="style."+e,s="end."+r,o;return function(){var g=vs(this,t),a=g.on,c=g.value[r]==null?o||(o=rb(e)):void 0;(a!==A||n!==c)&&(i=(A=a).copy()).on(s,n=c),g.on=i}}function OW(t,e,A){var i=(t+="")=="transform"?O9:nb;return e==null?this.styleTween(t,TW(t,i)).on("end.style."+t,rb(t)):typeof e=="function"?this.styleTween(t,UW(t,i,_p(this,"style."+t,e))).each(GW(this._id,t)):this.styleTween(t,LW(t,i,e),A).on("end.style."+t,null)}function PW(t,e,A){return function(i){this.style.setProperty(t,e.call(this,i),A)}}function qW(t,e,A){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&PW(t,s,A)),i}return r._value=e,r}function HW(t,e,A){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,qW(t,e,A??""))}function JW(t){return function(){this.textContent=t}}function YW(t){return function(){var e=t(this);this.textContent=e??""}}function KW(t){return this.tween("text",typeof t=="function"?YW(_p(this,"text",t)):JW(t==null?"":t+""))}function VW(t){return function(e){this.textContent=t.call(this,e)}}function WW(t){var e,A;function i(){var n=t.apply(this,arguments);return n!==A&&(e=(A=n)&&VW(n)),e}return i._value=t,i}function zW(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,WW(t))}function XW(){for(var t=this._name,e=this._id,A=sb(),i=this._groups,n=i.length,r=0;r<n;++r)for(var s=i[r],o=s.length,g,a=0;a<o;++a)if(g=s[a]){var c=As(g,e);hC(g,t,A,a,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new fo(i,this._parents,t,A)}function jW(){var t,e,A=this,i=A._id,n=A.size();return new Promise(function(r,s){var o={value:s},g={value:function(){--n===0&&r()}};A.each(function(){var a=vs(this,i),c=a.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(g)),a.on=e}),n===0&&r()})}var $W=0;function fo(t,e,A,i){this._groups=t,this._parents=e,this._name=A,this._id=i}function sb(){return++$W}var Eo=zI.prototype;fo.prototype={constructor:fo,select:FW,selectAll:NW,selectChild:Eo.selectChild,selectChildren:Eo.selectChildren,filter:DW,merge:_W,selection:MW,transition:XW,call:Eo.call,nodes:Eo.nodes,node:Eo.node,size:Eo.size,empty:Eo.empty,each:Eo.each,on:bW,attr:gW,attrTween:uW,style:OW,styleTween:HW,text:KW,textTween:zW,remove:RW,tween:tW,delay:fW,duration:QW,ease:yW,easeVarying:wW,end:jW,[Symbol.iterator]:Eo[Symbol.iterator]};function ZW(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var ez={time:null,delay:0,duration:250,ease:ZW};function Az(t,e){for(var A;!(A=t.__transition)||!(A=A[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return A}function tz(t){var e,A;t instanceof fo?(e=t._id,t=t._name):(e=sb(),(A=ez).time=pp(),t=t==null?null:t+"");for(var i=this._groups,n=i.length,r=0;r<n;++r)for(var s=i[r],o=s.length,g,a=0;a<o;++a)(g=s[a])&&hC(g,t,e,a,s,A||Az(g,e));return new fo(i,this._parents,t,e)}zI.prototype.interrupt=Z9,zI.prototype.transition=tz;const Sp=Math.PI,vp=2*Sp,Eg=1e-6,iz=vp-Eg;function ob(t){this._+=t[0];for(let e=1,A=t.length;e<A;++e)this._+=arguments[e]+t[e]}function nz(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ob;const A=10**e;return function(i){this._+=i[0];for(let n=1,r=i.length;n<r;++n)this._+=Math.round(arguments[n]*A)/A+i[n]}}class rz{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?ob:nz(e)}moveTo(e,A){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+A}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,A){this._append`L${this._x1=+e},${this._y1=+A}`}quadraticCurveTo(e,A,i,n){this._append`Q${+e},${+A},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(e,A,i,n,r,s){this._append`C${+e},${+A},${+i},${+n},${this._x1=+r},${this._y1=+s}`}arcTo(e,A,i,n,r){if(e=+e,A=+A,i=+i,n=+n,r=+r,r<0)throw new Error(`negative radius: ${r}`);let s=this._x1,o=this._y1,g=i-e,a=n-A,c=s-e,l=o-A,I=c*c+l*l;if(this._x1===null)this._append`M${this._x1=e},${this._y1=A}`;else if(I>Eg)if(!(Math.abs(l*g-a*c)>Eg)||!r)this._append`L${this._x1=e},${this._y1=A}`;else{let h=i-s,u=n-o,E=g*g+a*a,C=h*h+u*u,f=Math.sqrt(E),y=Math.sqrt(I),Q=r*Math.tan((Sp-Math.acos((E+I-C)/(2*f*y)))/2),d=Q/y,w=Q/f;Math.abs(d-1)>Eg&&this._append`L${e+d*c},${A+d*l}`,this._append`A${r},${r},0,0,${+(l*h>c*u)},${this._x1=e+w*g},${this._y1=A+w*a}`}}arc(e,A,i,n,r,s){if(e=+e,A=+A,i=+i,s=!!s,i<0)throw new Error(`negative radius: ${i}`);let o=i*Math.cos(n),g=i*Math.sin(n),a=e+o,c=A+g,l=1^s,I=s?n-r:r-n;this._x1===null?this._append`M${a},${c}`:(Math.abs(this._x1-a)>Eg||Math.abs(this._y1-c)>Eg)&&this._append`L${a},${c}`,i&&(I<0&&(I=I%vp+vp),I>iz?this._append`A${i},${i},0,1,${l},${e-o},${A-g}A${i},${i},0,1,${l},${this._x1=a},${this._y1=c}`:I>Eg&&this._append`A${i},${i},0,${+(I>=Sp)},${l},${this._x1=e+i*Math.cos(r)},${this._y1=A+i*Math.sin(r)}`)}rect(e,A,i,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+A}h${i=+i}v${+n}h${-i}Z`}toString(){return this._}}function sz(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function BC(t,e){if(!isFinite(t)||t===0)return null;var A=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),i=t.slice(0,A);return[i.length>1?i[0]+i.slice(2):i,+t.slice(A+1)]}function Mc(t){return t=BC(Math.abs(t)),t?t[1]:NaN}function oz(t,e){return function(A,i){for(var n=A.length,r=[],s=0,o=t[0],g=0;n>0&&o>0&&(g+o+1>i&&(o=Math.max(1,i-g)),r.push(A.substring(n-=o,n+o)),!((g+=o+1)>i));)o=t[s=(s+1)%t.length];return r.reverse().join(e)}}function az(t){return function(e){return e.replace(/[0-9]/g,function(A){return t[+A]})}}var gz=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function CC(t){if(!(e=gz.exec(t)))throw new Error("invalid format: "+t);var e;return new bp({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}CC.prototype=bp.prototype;function bp(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}bp.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cz(t){e:for(var e=t.length,A=1,i=-1,n;A<e;++A)switch(t[A]){case".":i=n=A;break;case"0":i===0&&(i=A),n=A;break;default:if(!+t[A])break e;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(n+1):t}var fC;function lz(t,e){var A=BC(t,e);if(!A)return fC=void 0,t.toPrecision(e);var i=A[0],n=A[1],r=n-(fC=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,s=i.length;return r===s?i:r>s?i+new Array(r-s+1).join("0"):r>0?i.slice(0,r)+"."+i.slice(r):"0."+new Array(1-r).join("0")+BC(t,Math.max(0,e+r-1))[0]}function ab(t,e){var A=BC(t,e);if(!A)return t+"";var i=A[0],n=A[1];return n<0?"0."+new Array(-n).join("0")+i:i.length>n+1?i.slice(0,n+1)+"."+i.slice(n+1):i+new Array(n-i.length+2).join("0")}const gb={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:sz,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ab(t*100,e),r:ab,s:lz,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function cb(t){return t}var lb=Array.prototype.map,Ib=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Iz(t){var e=t.grouping===void 0||t.thousands===void 0?cb:oz(lb.call(t.grouping,Number),t.thousands+""),A=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",n=t.decimal===void 0?".":t.decimal+"",r=t.numerals===void 0?cb:az(lb.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",g=t.nan===void 0?"NaN":t.nan+"";function a(l,I){l=CC(l);var h=l.fill,u=l.align,E=l.sign,C=l.symbol,f=l.zero,y=l.width,Q=l.comma,d=l.precision,w=l.trim,p=l.type;p==="n"?(Q=!0,p="g"):gb[p]||(d===void 0&&(d=12),w=!0,p="g"),(f||h==="0"&&u==="=")&&(f=!0,h="0",u="=");var m=(I&&I.prefix!==void 0?I.prefix:"")+(C==="$"?A:C==="#"&&/[boxX]/.test(p)?"0"+p.toLowerCase():""),D=(C==="$"?i:/[%p]/.test(p)?s:"")+(I&&I.suffix!==void 0?I.suffix:""),x=gb[p],N=/[defgprs%]/.test(p);d=d===void 0?6:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d));function F(M){var k=m,_=D,b,v,T;if(p==="c")_=x(M)+_,M="";else{M=+M;var O=M<0||1/M<0;if(M=isNaN(M)?g:x(Math.abs(M),d),w&&(M=cz(M)),O&&+M==0&&E!=="+"&&(O=!1),k=(O?E==="("?E:o:E==="-"||E==="("?"":E)+k,_=(p==="s"&&!isNaN(M)&&fC!==void 0?Ib[8+fC/3]:"")+_+(O&&E==="("?")":""),N){for(b=-1,v=M.length;++b<v;)if(T=M.charCodeAt(b),48>T||T>57){_=(T===46?n+M.slice(b+1):M.slice(b))+_,M=M.slice(0,b);break}}}Q&&!f&&(M=e(M,1/0));var Y=k.length+M.length+_.length,R=Y<y?new Array(y-Y+1).join(h):"";switch(Q&&f&&(M=e(R+M,R.length?y-_.length:1/0),R=""),u){case"<":M=k+M+_+R;break;case"=":M=k+R+M+_;break;case"^":M=R.slice(0,Y=R.length>>1)+k+M+_+R.slice(Y);break;default:M=R+k+M+_;break}return r(M)}return F.toString=function(){return l+""},F}function c(l,I){var h=Math.max(-8,Math.min(8,Math.floor(Mc(I)/3)))*3,u=Math.pow(10,-h),E=a((l=CC(l),l.type="f",l),{suffix:Ib[8+h/3]});return function(C){return E(u*C)}}return{format:a,formatPrefix:c}}var EC,xp,hb;hz({thousands:",",grouping:[3],currency:["$",""]});function hz(t){return EC=Iz(t),xp=EC.format,hb=EC.formatPrefix,EC}function uz(t){return Math.max(0,-Mc(Math.abs(t)))}function Bz(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mc(e)/3)))*3-Mc(Math.abs(t)))}function Cz(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Mc(e)-Mc(t))+1}function Rp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}const ub=Symbol("implicit");function Tc(){var t=new I2,e=[],A=[],i=ub;function n(r){let s=t.get(r);if(s===void 0){if(i!==ub)return i;t.set(r,s=e.push(r)-1)}return A[s%A.length]}return n.domain=function(r){if(!arguments.length)return e.slice();e=[],t=new I2;for(const s of r)t.has(s)||t.set(s,e.push(s)-1);return n},n.range=function(r){return arguments.length?(A=Array.from(r),n):A.slice()},n.unknown=function(r){return arguments.length?(i=r,n):i},n.copy=function(){return Tc(e,A).unknown(i)},Rp.apply(n,arguments),n}function Fp(){var t=Tc().unknown(void 0),e=t.domain,A=t.range,i=0,n=1,r,s,o=!1,g=0,a=0,c=.5;delete t.unknown;function l(){var I=e().length,h=n<i,u=h?n:i,E=h?i:n;r=(E-u)/Math.max(1,I-g+a*2),o&&(r=Math.floor(r)),u+=(E-u-r*(I-g))*c,s=r*(1-g),o&&(u=Math.round(u),s=Math.round(s));var C=wK(I).map(function(f){return u+r*f});return A(h?C.reverse():C)}return t.domain=function(I){return arguments.length?(e(I),l()):e()},t.range=function(I){return arguments.length?([i,n]=I,i=+i,n=+n,l()):[i,n]},t.rangeRound=function(I){return[i,n]=I,i=+i,n=+n,o=!0,l()},t.bandwidth=function(){return s},t.step=function(){return r},t.round=function(I){return arguments.length?(o=!!I,l()):o},t.padding=function(I){return arguments.length?(g=Math.min(1,a=+I),l()):g},t.paddingInner=function(I){return arguments.length?(g=Math.min(1,I),l()):g},t.paddingOuter=function(I){return arguments.length?(a=+I,l()):a},t.align=function(I){return arguments.length?(c=Math.max(0,Math.min(1,I)),l()):c},t.copy=function(){return Fp(e(),[i,n]).round(o).paddingInner(g).paddingOuter(a).align(c)},Rp.apply(l(),arguments)}function fz(t){return function(){return t}}function Ez(t){return+t}var Bb=[0,1];function Lc(t){return t}function Np(t,e){return(e-=t=+t)?function(A){return(A-t)/e}:fz(isNaN(e)?NaN:.5)}function dz(t,e){var A;return t>e&&(A=t,t=e,e=A),function(i){return Math.max(t,Math.min(e,i))}}function Qz(t,e,A){var i=t[0],n=t[1],r=e[0],s=e[1];return n<i?(i=Np(n,i),r=A(s,r)):(i=Np(i,n),r=A(r,s)),function(o){return r(i(o))}}function pz(t,e,A){var i=Math.min(t.length,e.length)-1,n=new Array(i),r=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)n[s]=Np(t[s],t[s+1]),r[s]=A(e[s],e[s+1]);return function(o){var g=cK(t,o,1,i)-1;return r[g](n[g](o))}}function yz(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function mz(){var t=Bb,e=Bb,A=dp,i,n,r,s=Lc,o,g,a;function c(){var I=Math.min(t.length,e.length);return s!==Lc&&(s=dz(t[0],t[I-1])),o=I>2?pz:Qz,g=a=null,l}function l(I){return I==null||isNaN(I=+I)?r:(g||(g=o(t.map(i),e,A)))(i(s(I)))}return l.invert=function(I){return s(n((a||(a=o(e,t.map(i),es)))(I)))},l.domain=function(I){return arguments.length?(t=Array.from(I,Ez),c()):t.slice()},l.range=function(I){return arguments.length?(e=Array.from(I),c()):e.slice()},l.rangeRound=function(I){return e=Array.from(I),A=L9,c()},l.clamp=function(I){return arguments.length?(s=I?!0:Lc,c()):s!==Lc},l.interpolate=function(I){return arguments.length?(A=I,c()):A},l.unknown=function(I){return arguments.length?(r=I,l):r},function(I,h){return i=I,n=h,c()}}function wz(){return mz()(Lc,Lc)}function Dz(t,e,A,i){var n=pK(t,e,A),r;switch(i=CC(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(r=Bz(n,s))&&(i.precision=r),hb(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(r=Cz(n,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=r-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(r=uz(n))&&(i.precision=r-(i.type==="%")*2);break}}return xp(i)}function _z(t){var e=t.domain;return t.ticks=function(A){var i=e();return QK(i[0],i[i.length-1],A??10)},t.tickFormat=function(A,i){var n=e();return Dz(n[0],n[n.length-1],A??10,i)},t.nice=function(A){A==null&&(A=10);var i=e(),n=0,r=i.length-1,s=i[n],o=i[r],g,a,c=10;for(o<s&&(a=s,s=o,o=a,a=n,n=r,r=a);c-- >0;){if(a=Ap(s,o,A),a===g)return i[n]=s,i[r]=o,e(i);if(a>0)s=Math.floor(s/a)*a,o=Math.ceil(o/a)*a;else if(a<0)s=Math.ceil(s*a)/a,o=Math.floor(o*a)/a;else break;g=a}return t},t}function vr(){var t=wz();return t.copy=function(){return yz(t,vr())},Rp.apply(t,arguments),_z(t)}function Sz(t){for(var e=t.length/6|0,A=new Array(e),i=0;i<e;)A[i]="#"+t.slice(i*6,++i*6);return A}const dC=Sz("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");function wn(t){return function(){return t}}const Cb=1e-12;function fb(t){let e=3;return t.digits=function(A){if(!arguments.length)return e;if(A==null)e=null;else{const i=Math.floor(A);if(!(i>=0))throw new RangeError(`invalid digits: ${A}`);e=i}return t},()=>new rz(e)}function Eb(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function db(t){this._context=t}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Qb(t){return new db(t)}function pb(t){return t[0]}function yb(t){return t[1]}function vz(t,e){var A=wn(!0),i=null,n=Qb,r=null,s=fb(o);t=typeof t=="function"?t:t===void 0?pb:wn(t),e=typeof e=="function"?e:e===void 0?yb:wn(e);function o(g){var a,c=(g=Eb(g)).length,l,I=!1,h;for(i==null&&(r=n(h=s())),a=0;a<=c;++a)!(a<c&&A(l=g[a],a,g))===I&&((I=!I)?r.lineStart():r.lineEnd()),I&&r.point(+t(l,a,g),+e(l,a,g));if(h)return r=null,h+""||null}return o.x=function(g){return arguments.length?(t=typeof g=="function"?g:wn(+g),o):t},o.y=function(g){return arguments.length?(e=typeof g=="function"?g:wn(+g),o):e},o.defined=function(g){return arguments.length?(A=typeof g=="function"?g:wn(!!g),o):A},o.curve=function(g){return arguments.length?(n=g,i!=null&&(r=n(i)),o):n},o.context=function(g){return arguments.length?(g==null?i=r=null:r=n(i=g),o):i},o}function bz(t,e,A){var i=null,n=wn(!0),r=null,s=Qb,o=null,g=fb(a);t=typeof t=="function"?t:t===void 0?pb:wn(+t),e=typeof e=="function"?e:wn(e===void 0?0:+e),A=typeof A=="function"?A:A===void 0?yb:wn(+A);function a(l){var I,h,u,E=(l=Eb(l)).length,C,f=!1,y,Q=new Array(E),d=new Array(E);for(r==null&&(o=s(y=g())),I=0;I<=E;++I){if(!(I<E&&n(C=l[I],I,l))===f)if(f=!f)h=I,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),u=I-1;u>=h;--u)o.point(Q[u],d[u]);o.lineEnd(),o.areaEnd()}f&&(Q[I]=+t(C,I,l),d[I]=+e(C,I,l),o.point(i?+i(C,I,l):Q[I],A?+A(C,I,l):d[I]))}if(y)return o=null,y+""||null}function c(){return vz().defined(n).curve(s).context(r)}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:wn(+l),i=null,a):t},a.x0=function(l){return arguments.length?(t=typeof l=="function"?l:wn(+l),a):t},a.x1=function(l){return arguments.length?(i=l==null?null:typeof l=="function"?l:wn(+l),a):i},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:wn(+l),A=null,a):e},a.y0=function(l){return arguments.length?(e=typeof l=="function"?l:wn(+l),a):e},a.y1=function(l){return arguments.length?(A=l==null?null:typeof l=="function"?l:wn(+l),a):A},a.lineX0=a.lineY0=function(){return c().x(t).y(e)},a.lineY1=function(){return c().x(t).y(A)},a.lineX1=function(){return c().x(i).y(e)},a.defined=function(l){return arguments.length?(n=typeof l=="function"?l:wn(!!l),a):n},a.curve=function(l){return arguments.length?(s=l,r!=null&&(o=s(r)),a):s},a.context=function(l){return arguments.length?(l==null?r=o=null:o=s(r=l),a):r},a}function mb(t,e,A){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-A),t._x2,t._y2)}function kp(t,e){this._context=t,this._k=(1-e)/6}kp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:mb(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:mb(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}},function t(e){function A(i){return new kp(i,e)}return A.tension=function(i){return t(+i)},A}(0);function xz(t,e,A){var i=t._x1,n=t._y1,r=t._x2,s=t._y2;if(t._l01_a>Cb){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,g=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/g,n=(n*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/g}if(t._l23_a>Cb){var a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);r=(r*a+t._x1*t._l23_2a-e*t._l12_2a)/c,s=(s*a+t._y1*t._l23_2a-A*t._l12_2a)/c}t._context.bezierCurveTo(i,n,r,s,t._x2,t._y2)}function wb(t,e){this._context=t,this._alpha=e}wb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var A=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(A*A+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:xz(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Rz=function t(e){function A(i){return e?new wb(i,e):new kp(i,0)}return A.alpha=function(i){return t(+i)},A}(.5),QC=t=>()=>t;function Fz(t,{sourceEvent:e,target:A,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:A,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function Qo(t,e,A){this.k=t,this.x=e,this.y=A}Qo.prototype={constructor:Qo,scale:function(t){return t===1?this:new Qo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Qo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Br=new Qo(1,0,0);Qo.prototype;function Mp(t){t.stopImmediatePropagation()}function ih(t){t.preventDefault(),t.stopImmediatePropagation()}function Nz(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function kz(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Db(){return this.__zoom||Br}function Mz(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Tz(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lz(t,e,A){var i=t.invertX(e[0][0])-A[0][0],n=t.invertX(e[1][0])-A[1][0],r=t.invertY(e[0][1])-A[0][1],s=t.invertY(e[1][1])-A[1][1];return t.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function Tp(){var t=Nz,e=kz,A=Lz,i=Mz,n=Tz,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],o=250,g=Y9,a=op("start","zoom","end"),c,l,I,h=500,u=150,E=0,C=10;function f(_){_.property("__zoom",Db).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",N).filter(n).on("touchstart.zoom",F).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}f.transform=function(_,b,v,T){var O=_.selection?_.selection():_;O.property("__zoom",Db),_!==O?w(_,b,v,T):O.interrupt().each(function(){p(this,arguments).event(T).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},f.scaleBy=function(_,b,v,T){f.scaleTo(_,function(){var O=this.__zoom.k,Y=typeof b=="function"?b.apply(this,arguments):b;return O*Y},v,T)},f.scaleTo=function(_,b,v,T){f.transform(_,function(){var O=e.apply(this,arguments),Y=this.__zoom,R=v==null?d(O):typeof v=="function"?v.apply(this,arguments):v,W=Y.invert(R),ne=typeof b=="function"?b.apply(this,arguments):b;return A(Q(y(Y,ne),R,W),O,s)},v,T)},f.translateBy=function(_,b,v,T){f.transform(_,function(){return A(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),s)},null,T)},f.translateTo=function(_,b,v,T,O){f.transform(_,function(){var Y=e.apply(this,arguments),R=this.__zoom,W=T==null?d(Y):typeof T=="function"?T.apply(this,arguments):T;return A(Br.translate(W[0],W[1]).scale(R.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof v=="function"?-v.apply(this,arguments):-v),Y,s)},T,O)};function y(_,b){return b=Math.max(r[0],Math.min(r[1],b)),b===_.k?_:new Qo(b,_.x,_.y)}function Q(_,b,v){var T=b[0]-v[0]*_.k,O=b[1]-v[1]*_.k;return T===_.x&&O===_.y?_:new Qo(_.k,T,O)}function d(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function w(_,b,v,T){_.on("start.zoom",function(){p(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){p(this,arguments).event(T).end()}).tween("zoom",function(){var O=this,Y=arguments,R=p(O,Y).event(T),W=e.apply(O,Y),ne=v==null?d(W):typeof v=="function"?v.apply(O,Y):v,le=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),Z=O.__zoom,ae=typeof b=="function"?b.apply(O,Y):b,ie=g(Z.invert(ne).concat(le/Z.k),ae.invert(ne).concat(le/ae.k));return function(Ee){if(Ee===1)Ee=ae;else{var me=ie(Ee),He=le/me[2];Ee=new Qo(He,ne[0]-me[0]*He,ne[1]-me[1]*He)}R.zoom(null,Ee)}})}function p(_,b,v){return!v&&_.__zooming||new m(_,b)}function m(_,b){this.that=_,this.args=b,this.active=0,this.sourceEvent=null,this.extent=e.apply(_,b),this.taps=0}m.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,b){return this.mouse&&_!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var b=sn(this.that).datum();a.call(_,this.that,new Fz(_,{sourceEvent:this.sourceEvent,target:f,transform:this.that.__zoom,dispatch:a}),b)}};function D(_,...b){if(!t.apply(this,arguments))return;var v=p(this,b).event(_),T=this.__zoom,O=Math.max(r[0],Math.min(r[1],T.k*Math.pow(2,i.apply(this,arguments)))),Y=ug(_);if(v.wheel)(v.mouse[0][0]!==Y[0]||v.mouse[0][1]!==Y[1])&&(v.mouse[1]=T.invert(v.mouse[0]=Y)),clearTimeout(v.wheel);else{if(T.k===O)return;v.mouse=[Y,T.invert(Y)],uC(this),v.start()}ih(_),v.wheel=setTimeout(R,u),v.zoom("mouse",A(Q(y(T,O),v.mouse[0],v.mouse[1]),v.extent,s));function R(){v.wheel=null,v.end()}}function x(_,...b){if(I||!t.apply(this,arguments))return;var v=_.currentTarget,T=p(this,b,!0).event(_),O=sn(_.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",le,!0),Y=ug(_,v),R=_.clientX,W=_.clientY;h9(_.view),Mp(_),T.mouse=[Y,this.__zoom.invert(Y)],uC(this),T.start();function ne(Z){if(ih(Z),!T.moved){var ae=Z.clientX-R,ie=Z.clientY-W;T.moved=ae*ae+ie*ie>E}T.event(Z).zoom("mouse",A(Q(T.that.__zoom,T.mouse[0]=ug(Z,v),T.mouse[1]),T.extent,s))}function le(Z){O.on("mousemove.zoom mouseup.zoom",null),u9(Z.view,T.moved),ih(Z),T.event(Z).end()}}function N(_,...b){if(t.apply(this,arguments)){var v=this.__zoom,T=ug(_.changedTouches?_.changedTouches[0]:_,this),O=v.invert(T),Y=v.k*(_.shiftKey?.5:2),R=A(Q(y(v,Y),T,O),e.apply(this,b),s);ih(_),o>0?sn(this).transition().duration(o).call(w,R,T,_):sn(this).call(f.transform,R,T,_)}}function F(_,...b){if(t.apply(this,arguments)){var v=_.touches,T=v.length,O=p(this,b,_.changedTouches.length===T).event(_),Y,R,W,ne;for(Mp(_),R=0;R<T;++R)W=v[R],ne=ug(W,this),ne=[ne,this.__zoom.invert(ne),W.identifier],O.touch0?!O.touch1&&O.touch0[2]!==ne[2]&&(O.touch1=ne,O.taps=0):(O.touch0=ne,Y=!0,O.taps=1+!!c);c&&(c=clearTimeout(c)),Y&&(O.taps<2&&(l=ne[0],c=setTimeout(function(){c=null},h)),uC(this),O.start())}}function M(_,...b){if(this.__zooming){var v=p(this,b).event(_),T=_.changedTouches,O=T.length,Y,R,W,ne;for(ih(_),Y=0;Y<O;++Y)R=T[Y],W=ug(R,this),v.touch0&&v.touch0[2]===R.identifier?v.touch0[0]=W:v.touch1&&v.touch1[2]===R.identifier&&(v.touch1[0]=W);if(R=v.that.__zoom,v.touch1){var le=v.touch0[0],Z=v.touch0[1],ae=v.touch1[0],ie=v.touch1[1],Ee=(Ee=ae[0]-le[0])*Ee+(Ee=ae[1]-le[1])*Ee,me=(me=ie[0]-Z[0])*me+(me=ie[1]-Z[1])*me;R=y(R,Math.sqrt(Ee/me)),W=[(le[0]+ae[0])/2,(le[1]+ae[1])/2],ne=[(Z[0]+ie[0])/2,(Z[1]+ie[1])/2]}else if(v.touch0)W=v.touch0[0],ne=v.touch0[1];else return;v.zoom("touch",A(Q(R,W,ne),v.extent,s))}}function k(_,...b){if(this.__zooming){var v=p(this,b).event(_),T=_.changedTouches,O=T.length,Y,R;for(Mp(_),I&&clearTimeout(I),I=setTimeout(function(){I=null},h),Y=0;Y<O;++Y)R=T[Y],v.touch0&&v.touch0[2]===R.identifier?delete v.touch0:v.touch1&&v.touch1[2]===R.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(R=ug(R,this),Math.hypot(l[0]-R[0],l[1]-R[1])<C)){var W=sn(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return f.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:QC(+_),f):i},f.filter=function(_){return arguments.length?(t=typeof _=="function"?_:QC(!!_),f):t},f.touchable=function(_){return arguments.length?(n=typeof _=="function"?_:QC(!!_),f):n},f.extent=function(_){return arguments.length?(e=typeof _=="function"?_:QC([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),f):e},f.scaleExtent=function(_){return arguments.length?(r[0]=+_[0],r[1]=+_[1],f):[r[0],r[1]]},f.translateExtent=function(_){return arguments.length?(s[0][0]=+_[0][0],s[1][0]=+_[1][0],s[0][1]=+_[0][1],s[1][1]=+_[1][1],f):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},f.constrain=function(_){return arguments.length?(A=_,f):A},f.duration=function(_){return arguments.length?(o=+_,f):o},f.interpolate=function(_){return arguments.length?(g=_,f):g},f.on=function(){var _=a.on.apply(a,arguments);return _===a?f:_},f.clickDistance=function(_){return arguments.length?(E=(_=+_)*_,f):Math.sqrt(E)},f.tapDistance=function(_){return arguments.length?(C=+_,f):C},f}function mt(t,e,A,i){function n(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function o(c){try{a(i.next(c))}catch(l){s(l)}}function g(c){try{a(i.throw(c))}catch(l){s(l)}}function a(c){c.done?r(c.value):n(c.value).then(o,g)}a((i=i.apply(t,e||[])).next())})}function _b(t){var e=typeof Symbol=="function"&&Symbol.iterator,A=e&&t[e],i=0;if(A)return A.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function kt(t){return this instanceof kt?(this.v=t,this):new kt(t)}function bs(t,e,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=A.apply(t,e||[]),n,r=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",s),n[Symbol.asyncIterator]=function(){return this},n;function s(h){return function(u){return Promise.resolve(u).then(h,l)}}function o(h,u){i[h]&&(n[h]=function(E){return new Promise(function(C,f){r.push([h,E,C,f])>1||g(h,E)})},u&&(n[h]=u(n[h])))}function g(h,u){try{a(i[h](u))}catch(E){I(r[0][3],E)}}function a(h){h.value instanceof kt?Promise.resolve(h.value.v).then(c,l):I(r[0][2],h)}function c(h){g("next",h)}function l(h){g("throw",h)}function I(h,u){h(u),r.shift(),r.length&&g(r[0][0],r[0][1])}}function pC(t){var e,A;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,r){e[n]=t[n]?function(s){return(A=!A)?{value:kt(t[n](s)),done:!1}:r?r(s):s}:r}}function dg(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],A;return e?e.call(t):(t=typeof _b=="function"?_b(t):t[Symbol.iterator](),A={},i("next"),i("throw"),i("return"),A[Symbol.asyncIterator]=function(){return this},A);function i(r){A[r]=t[r]&&function(s){return new Promise(function(o,g){s=t[r](s),n(o,g,s.done,s.value)})}}function n(r,s,o,g){Promise.resolve(g).then(function(a){r({value:a,done:o})},s)}}typeof SuppressedError=="function"&&SuppressedError;const Uz=new TextDecoder("utf-8"),Lp=t=>Uz.decode(t),Gz=new TextEncoder,Up=t=>Gz.encode(t),Oz=t=>typeof t=="number",Sb=t=>typeof t=="boolean",fn=t=>typeof t=="function",rr=t=>t!=null&&Object(t)===t,Qg=t=>rr(t)&&fn(t.then),nh=t=>rr(t)&&fn(t[Symbol.iterator]),Uc=t=>rr(t)&&fn(t[Symbol.asyncIterator]),Gp=t=>rr(t)&&rr(t.schema),vb=t=>rr(t)&&"done"in t&&"value"in t,bb=t=>rr(t)&&fn(t.stat)&&Oz(t.fd),xb=t=>rr(t)&&Op(t.body),yC=t=>"_getDOMStream"in t&&"_getNodeStream"in t,Pz=t=>rr(t)&&fn(t.abort)&&fn(t.getWriter)&&!yC(t),Op=t=>rr(t)&&fn(t.cancel)&&fn(t.getReader)&&!yC(t),qz=t=>rr(t)&&fn(t.end)&&fn(t.write)&&Sb(t.writable)&&!yC(t),Rb=t=>rr(t)&&fn(t.read)&&fn(t.pipe)&&Sb(t.readable)&&!yC(t),Hz=t=>rr(t)&&fn(t.clear)&&fn(t.bytes)&&fn(t.position)&&fn(t.setPosition)&&fn(t.capacity)&&fn(t.getBufferIdentifier)&&fn(t.createLong),Pp=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Jz(t){const e=t[0]?[t[0]]:[];let A,i,n,r;for(let s,o,g=0,a=0,c=t.length;++g<c;){if(s=e[a],o=t[g],!s||!o||s.buffer!==o.buffer||o.byteOffset<s.byteOffset){o&&(e[++a]=o);continue}if({byteOffset:A,byteLength:n}=s,{byteOffset:i,byteLength:r}=o,A+n<i||i+r<A){o&&(e[++a]=o);continue}e[a]=new Uint8Array(s.buffer,A,i-A+r)}return e}function Fb(t,e,A=0,i=e.byteLength){const n=t.byteLength,r=new Uint8Array(t.buffer,t.byteOffset,n),s=new Uint8Array(e.buffer,e.byteOffset,Math.min(i,n));return r.set(s,A),t}function xs(t,e){const A=Jz(t),i=A.reduce((c,l)=>c+l.byteLength,0);let n,r,s,o=0,g=-1;const a=Math.min(e||Number.POSITIVE_INFINITY,i);for(const c=A.length;++g<c;){if(n=A[g],r=n.subarray(0,Math.min(n.length,a-o)),a<=o+r.length){r.length<n.length?A[g]=n.subarray(r.length):r.length===n.length&&g++,s?Fb(s,r,o):s=r;break}Fb(s||(s=new Uint8Array(a)),r,o),o+=r.length}return[s||new Uint8Array(0),A.slice(g),i-(s?s.byteLength:0)]}function Qi(t,e){let A=vb(e)?e.value:e;return A instanceof t?t===Uint8Array?new t(A.buffer,A.byteOffset,A.byteLength):A:A?(typeof A=="string"&&(A=Up(A)),A instanceof ArrayBuffer?new t(A):A instanceof Pp?new t(A):Hz(A)?Qi(t,A.bytes()):ArrayBuffer.isView(A)?A.byteLength<=0?new t(0):new t(A.buffer,A.byteOffset,A.byteLength/t.BYTES_PER_ELEMENT):t.from(A)):new t(0)}const rh=t=>Qi(Int32Array,t),Nb=t=>Qi(BigInt64Array,t),Xt=t=>Qi(Uint8Array,t),qp=t=>(t.next(),t);function*Yz(t,e){const A=function*(n){yield n},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pp?A(e):nh(e)?e:A(e);return yield*qp(function*(n){let r=null;do r=n.next(yield Qi(t,r));while(!r.done)}(i[Symbol.iterator]())),new t}const Kz=t=>Yz(Uint8Array,t);function kb(t,e){return bs(this,arguments,function*(){if(Qg(e))return yield kt(yield kt(yield*pC(dg(kb(t,yield kt(e))))));const i=function(s){return bs(this,arguments,function*(){yield yield kt(yield kt(s))})},n=function(s){return bs(this,arguments,function*(){yield kt(yield*pC(dg(qp(function*(o){let g=null;do g=o.next(yield g==null?void 0:g.value);while(!g.done)}(s[Symbol.iterator]())))))})},r=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pp?i(e):nh(e)?n(e):Uc(e)?e:i(e);return yield kt(yield*pC(dg(qp(function(s){return bs(this,arguments,function*(){let o=null;do o=yield kt(s.next(yield yield kt(Qi(t,o))));while(!o.done)})}(r[Symbol.asyncIterator]()))))),yield kt(new t)})}const Vz=t=>kb(Uint8Array,t);function Mb(t,e,A){if(t!==0){A=A.slice(0,e);for(let i=-1,n=A.length;++i<n;)A[i]+=t}return A.subarray(0,e)}function Wz(t,e){let A=0;const i=t.length;if(i!==e.length)return!1;if(i>0)do if(t[A]!==e[A])return!1;while(++A<i);return!0}const br={fromIterable(t){return mC(zz(t))},fromAsyncIterable(t){return mC(Xz(t))},fromDOMStream(t){return mC(jz(t))},fromNodeStream(t){return mC(Zz(t))},toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}},mC=t=>(t.next(),t);function*zz(t){let e,A=!1,i=[],n,r,s,o=0;function g(){return r==="peek"?xs(i,s)[0]:([n,i,o]=xs(i,s),n)}({cmd:r,size:s}=(yield null)||{cmd:"read",size:0});const a=Kz(t)[Symbol.iterator]();try{do if({done:e,value:n}=Number.isNaN(s-o)?a.next():a.next(s-o),!e&&n.byteLength>0&&(i.push(n),o+=n.byteLength),e||s<=o)do({cmd:r,size:s}=yield g());while(s<o);while(!e)}catch(c){(A=!0)&&typeof a.throw=="function"&&a.throw(c)}finally{A===!1&&typeof a.return=="function"&&a.return(null)}return null}function Xz(t){return bs(this,arguments,function*(){let A,i=!1,n=[],r,s,o,g=0;function a(){return s==="peek"?xs(n,o)[0]:([r,n,g]=xs(n,o),r)}({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0});const c=Vz(t)[Symbol.asyncIterator]();try{do if({done:A,value:r}=Number.isNaN(o-g)?yield kt(c.next()):yield kt(c.next(o-g)),!A&&r.byteLength>0&&(n.push(r),g+=r.byteLength),A||o<=g)do({cmd:s,size:o}=yield yield kt(a()));while(o<g);while(!A)}catch(l){(i=!0)&&typeof c.throw=="function"&&(yield kt(c.throw(l)))}finally{i===!1&&typeof c.return=="function"&&(yield kt(c.return(new Uint8Array(0))))}return yield kt(null)})}function jz(t){return bs(this,arguments,function*(){let A=!1,i=!1,n=[],r,s,o,g=0;function a(){return s==="peek"?xs(n,o)[0]:([r,n,g]=xs(n,o),r)}({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0});const c=new $z(t);try{do if({done:A,value:r}=Number.isNaN(o-g)?yield kt(c.read()):yield kt(c.read(o-g)),!A&&r.byteLength>0&&(n.push(Xt(r)),g+=r.byteLength),A||o<=g)do({cmd:s,size:o}=yield yield kt(a()));while(o<g);while(!A)}catch(l){(i=!0)&&(yield kt(c.cancel(l)))}finally{i===!1?yield kt(c.cancel()):t.locked&&c.releaseLock()}return yield kt(null)})}class $z{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return mt(this,void 0,void 0,function*(){const{reader:A,source:i}=this;A&&(yield A.cancel(e).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(e){return mt(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const A=yield this.reader.read();return!A.done&&(A.value=Xt(A)),A})}}const Hp=(t,e)=>{const A=n=>i([e,n]);let i;return[e,A,new Promise(n=>(i=n)&&t.once(e,A))]};function Zz(t){return bs(this,arguments,function*(){const A=[];let i="error",n=!1,r=null,s,o,g=0,a=[],c;function l(){return s==="peek"?xs(a,o)[0]:([c,a,g]=xs(a,o),c)}if({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0},t.isTTY)return yield yield kt(new Uint8Array(0)),yield kt(null);try{A[0]=Hp(t,"end"),A[1]=Hp(t,"error");do{if(A[2]=Hp(t,"readable"),[i,r]=yield kt(Promise.race(A.map(h=>h[2]))),i==="error")break;if((n=i==="end")||(Number.isFinite(o-g)?(c=Xt(t.read(o-g)),c.byteLength<o-g&&(c=Xt(t.read()))):c=Xt(t.read()),c.byteLength>0&&(a.push(c),g+=c.byteLength)),n||o<=g)do({cmd:s,size:o}=yield yield kt(l()));while(o<g)}while(!n)}finally{yield kt(I(A,i==="error"?r:null))}return yield kt(null);function I(h,u){return c=a=null,new Promise((E,C)=>{for(const[f,y]of h)t.off(f,y);try{const f=t.destroy;f&&f.call(t,u),u=void 0}catch(f){u=f||u}finally{u!=null?C(u):E()}})}})}var on;(function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"})(on||(on={}));var Ln;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(Ln||(Ln={}));var Un;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(Un||(Un={}));var xr;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(xr||(xr={}));var ht;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(ht||(ht={}));var Rs;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Rs||(Rs={}));const Jp=2,Fs=4,po=4,ui=4,oa=new Int32Array(2),Tb=new Float32Array(oa.buffer),Lb=new Float64Array(oa.buffer),wC=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Yp;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(Yp||(Yp={}));let Gc=class tq{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new tq(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return oa[0]=this.readInt32(e),Tb[0]}readFloat64(e){return oa[wC?0:1]=this.readInt32(e),oa[wC?1:0]=this.readInt32(e+4),Lb[0]}writeInt8(e,A){this.bytes_[e]=A}writeUint8(e,A){this.bytes_[e]=A}writeInt16(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8}writeUint16(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8}writeInt32(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8,this.bytes_[e+2]=A>>16,this.bytes_[e+3]=A>>24}writeUint32(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8,this.bytes_[e+2]=A>>16,this.bytes_[e+3]=A>>24}writeInt64(e,A){this.writeInt32(e,Number(BigInt.asIntN(32,A))),this.writeInt32(e+4,Number(BigInt.asIntN(32,A>>BigInt(32))))}writeUint64(e,A){this.writeUint32(e,Number(BigInt.asUintN(32,A))),this.writeUint32(e+4,Number(BigInt.asUintN(32,A>>BigInt(32))))}writeFloat32(e,A){Tb[0]=A,this.writeInt32(e,oa[0])}writeFloat64(e,A){Lb[0]=A,this.writeInt32(e,oa[wC?0:1]),this.writeInt32(e+4,oa[wC?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Fs+po)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let A=0;A<po;A++)e+=String.fromCharCode(this.readInt8(this.position_+Fs+A));return e}__offset(e,A){const i=e-this.readInt32(e);return A<this.readInt16(i)?this.readInt16(i+A):0}__union(e,A){return e.bb_pos=A+this.readInt32(A),e.bb=this,e}__string(e,A){e+=this.readInt32(e);const i=this.readInt32(e);e+=Fs;const n=this.bytes_.subarray(e,e+i);return A===Yp.UTF8_BYTES?n:this.text_decoder_.decode(n)}__union_with_string(e,A){return typeof e=="string"?this.__string(A):this.__union(e,A)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Fs}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=po)throw new Error("FlatBuffers: file identifier must be length "+po);for(let A=0;A<po;A++)if(e.charCodeAt(A)!=this.readInt8(this.position()+Fs+A))return!1;return!0}createScalarList(e,A){const i=[];for(let n=0;n<A;++n){const r=e(n);r!==null&&i.push(r)}return i}createObjList(e,A){const i=[];for(let n=0;n<A;++n){const r=e(n);r!==null&&i.push(r.unpack())}return i}},Ub=class iq{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let A;e?A=e:A=1024,this.bb=Gc.allocate(A),this.space=A}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,A){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+A)+1&e-1;for(;this.space<i+e+A;){const n=this.bb.capacity();this.bb=iq.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)}pad(e){for(let A=0;A<e;A++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,A,i){(this.force_defaults||A!=i)&&(this.addInt8(A),this.slot(e))}addFieldInt16(e,A,i){(this.force_defaults||A!=i)&&(this.addInt16(A),this.slot(e))}addFieldInt32(e,A,i){(this.force_defaults||A!=i)&&(this.addInt32(A),this.slot(e))}addFieldInt64(e,A,i){(this.force_defaults||A!==i)&&(this.addInt64(A),this.slot(e))}addFieldFloat32(e,A,i){(this.force_defaults||A!=i)&&(this.addFloat32(A),this.slot(e))}addFieldFloat64(e,A,i){(this.force_defaults||A!=i)&&(this.addFloat64(A),this.slot(e))}addFieldOffset(e,A,i){(this.force_defaults||A!=i)&&(this.addOffset(A),this.slot(e))}addFieldStruct(e,A,i){A!=i&&(this.nested(A),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const A=e.capacity();if(A&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=A<<1,n=Gc.allocate(i);return n.setPosition(i-A),n.bytes().set(e.bytes(),i-A),n}addOffset(e){this.prep(Fs,0),this.writeInt32(this.offset()-e+Fs)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let A=0;A<e;A++)this.vtable[A]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let A=this.vtable_in_use-1;for(;A>=0&&this.vtable[A]==0;A--);const i=A+1;for(;A>=0;A--)this.addInt16(this.vtable[A]!=0?e-this.vtable[A]:0);const n=2;this.addInt16(e-this.object_start);const r=(i+n)*Jp;this.addInt16(r);let s=0;const o=this.space;e:for(A=0;A<this.vtables.length;A++){const g=this.bb.capacity()-this.vtables[A];if(r==this.bb.readInt16(g)){for(let a=Jp;a<r;a+=Jp)if(this.bb.readInt16(o+a)!=this.bb.readInt16(g+a))continue e;s=this.vtables[A];break}}return s?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,s-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,A,i){const n=i?ui:0;if(A){const r=A;if(this.prep(this.minalign,Fs+po+n),r.length!=po)throw new TypeError("FlatBuffers: file identifier must be length "+po);for(let s=po-1;s>=0;s--)this.writeInt8(r.charCodeAt(s))}this.prep(this.minalign,Fs+n),this.addOffset(e),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,A){this.finish(e,A,!0)}requiredField(e,A){const i=this.bb.capacity()-e,n=i-this.bb.readInt32(i);if(!(A<this.bb.readInt16(n)&&this.bb.readInt16(n+A)!=0))throw new TypeError("FlatBuffers: field "+A+" must be set")}startVector(e,A,i){this.notNested(),this.vector_num_elems=A,this.prep(Fs,e*A),this.prep(i,e*A)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const A=this.createString(e);return this.string_maps.set(e,A),A}createString(e){if(e==null)return 0;let A;return e instanceof Uint8Array?A=e:A=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,A.length,1),this.bb.setPosition(this.space-=A.length),this.bb.bytes().set(A,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const A=[];for(let i=0;i<e.length;++i){const n=e[i];if(n!==null)A.push(this.createObjectOffset(n));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return A}createStructOffsetList(e,A){return A(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}};var DC;(function(t){t[t.BUFFER=0]="BUFFER"})(DC||(DC={}));var _C;(function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"})(_C||(_C={}));class aa{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBodyCompression(e,A){return(A||new aa).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,A){return e.setPosition(e.position()+ui),(A||new aa).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):_C.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):DC.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,A){e.addFieldInt8(0,A,_C.LZ4_FRAME)}static addMethod(e,A){e.addFieldInt8(1,A,DC.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,A,i){return aa.startBodyCompression(e),aa.addCodec(e,A),aa.addMethod(e,i),aa.endBodyCompression(e)}}let Gb=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,A,i){return e.prep(8,16),e.writeInt64(BigInt(i??0)),e.writeInt64(BigInt(A??0)),e.offset()}},Ob=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,A,i){return e.prep(8,16),e.writeInt64(BigInt(i??0)),e.writeInt64(BigInt(A??0)),e.offset()}},yo=class F1{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsRecordBatch(e,A){return(A||new F1).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,A){return e.setPosition(e.position()+ui),(A||new F1).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,A){const i=this.bb.__offset(this.bb_pos,6);return i?(A||new Ob).__init(this.bb.__vector(this.bb_pos+i)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new Gb).__init(this.bb.__vector(this.bb_pos+i)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const A=this.bb.__offset(this.bb_pos,10);return A?(e||new aa).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addNodes(e,A){e.addFieldOffset(1,A,0)}static startNodesVector(e,A){e.startVector(16,A,8)}static addBuffers(e,A){e.addFieldOffset(2,A,0)}static startBuffersVector(e,A){e.startVector(16,A,8)}static addCompression(e,A){e.addFieldOffset(3,A,0)}static endRecordBatch(e){return e.endObject()}},Oc=class N1{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDictionaryBatch(e,A){return(A||new N1).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,A){return e.setPosition(e.position()+ui),(A||new N1).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new yo).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addData(e,A){e.addFieldOffset(1,A,0)}static addIsDelta(e,A){e.addFieldInt8(2,+A,0)}static endDictionaryBatch(e){return e.endObject()}};var Pc;(function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"})(Pc||(Pc={}));var SC;(function(t){t[t.DenseArray=0]="DenseArray"})(SC||(SC={}));class Cr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsInt(e,A){return(A||new Cr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,A){return e.setPosition(e.position()+ui),(A||new Cr).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,A){e.addFieldInt32(0,A,0)}static addIsSigned(e,A){e.addFieldInt8(1,+A,0)}static endInt(e){return e.endObject()}static createInt(e,A,i){return Cr.startInt(e),Cr.addBitWidth(e,A),Cr.addIsSigned(e,i),Cr.endInt(e)}}class mo{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDictionaryEncoding(e,A){return(A||new mo).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,A){return e.setPosition(e.position()+ui),(A||new mo).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new Cr).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}isOrdered(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):SC.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addIndexType(e,A){e.addFieldOffset(1,A,0)}static addIsOrdered(e,A){e.addFieldInt8(2,+A,0)}static addDictionaryKind(e,A){e.addFieldInt16(3,A,SC.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}class En{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsKeyValue(e,A){return(A||new En).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,A){return e.setPosition(e.position()+ui),(A||new En).__init(e.readInt32(e.position())+e.position(),e)}key(e){const A=this.bb.__offset(this.bb_pos,4);return A?this.bb.__string(this.bb_pos+A,e):null}value(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.__string(this.bb_pos+A,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,A){e.addFieldOffset(0,A,0)}static addValue(e,A){e.addFieldOffset(1,A,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,A,i){return En.startKeyValue(e),En.addKey(e,A),En.addValue(e,i),En.endKeyValue(e)}}let Pb=class cB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBinary(e,A){return(A||new cB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,A){return e.setPosition(e.position()+ui),(A||new cB).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return cB.startBinary(e),cB.endBinary(e)}},qb=class lB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBool(e,A){return(A||new lB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,A){return e.setPosition(e.position()+ui),(A||new lB).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return lB.startBool(e),lB.endBool(e)}},vC=class pI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDate(e,A){return(A||new pI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,A){return e.setPosition(e.position()+ui),(A||new pI).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):xr.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,xr.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,A){return pI.startDate(e),pI.addUnit(e,A),pI.endDate(e)}},qc=class ig{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDecimal(e,A){return(A||new ig).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,A){return e.setPosition(e.position()+ui),(A||new ig).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,A){e.addFieldInt32(0,A,0)}static addScale(e,A){e.addFieldInt32(1,A,0)}static addBitWidth(e,A){e.addFieldInt32(2,A,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,A,i,n){return ig.startDecimal(e),ig.addPrecision(e,A),ig.addScale(e,i),ig.addBitWidth(e,n),ig.endDecimal(e)}},bC=class yI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDuration(e,A){return(A||new yI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,A){return e.setPosition(e.position()+ui),(A||new yI).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,ht.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,A){return yI.startDuration(e),yI.addUnit(e,A),yI.endDuration(e)}},xC=class mI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFixedSizeBinary(e,A){return(A||new mI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,A){return e.setPosition(e.position()+ui),(A||new mI).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,A){e.addFieldInt32(0,A,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,A){return mI.startFixedSizeBinary(e),mI.addByteWidth(e,A),mI.endFixedSizeBinary(e)}},RC=class wI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFixedSizeList(e,A){return(A||new wI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,A){return e.setPosition(e.position()+ui),(A||new wI).__init(e.readInt32(e.position())+e.position(),e)}listSize(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,A){e.addFieldInt32(0,A,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,A){return wI.startFixedSizeList(e),wI.addListSize(e,A),wI.endFixedSizeList(e)}};class Ns{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFloatingPoint(e,A){return(A||new Ns).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,A){return e.setPosition(e.position()+ui),(A||new Ns).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Un.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,A){e.addFieldInt16(0,A,Un.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,A){return Ns.startFloatingPoint(e),Ns.addPrecision(e,A),Ns.endFloatingPoint(e)}}class ks{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsInterval(e,A){return(A||new ks).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,A){return e.setPosition(e.position()+ui),(A||new ks).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Rs.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,Rs.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,A){return ks.startInterval(e),ks.addUnit(e,A),ks.endInterval(e)}}let Hb=class IB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsLargeBinary(e,A){return(A||new IB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,A){return e.setPosition(e.position()+ui),(A||new IB).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return IB.startLargeBinary(e),IB.endLargeBinary(e)}},Jb=class hB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsLargeUtf8(e,A){return(A||new hB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,A){return e.setPosition(e.position()+ui),(A||new hB).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return hB.startLargeUtf8(e),hB.endLargeUtf8(e)}},Yb=class uB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsList(e,A){return(A||new uB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,A){return e.setPosition(e.position()+ui),(A||new uB).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return uB.startList(e),uB.endList(e)}},FC=class DI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsMap(e,A){return(A||new DI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,A){return e.setPosition(e.position()+ui),(A||new DI).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){const e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,A){e.addFieldInt8(0,+A,0)}static endMap(e){return e.endObject()}static createMap(e,A){return DI.startMap(e),DI.addKeysSorted(e,A),DI.endMap(e)}},Kb=class BB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsNull(e,A){return(A||new BB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,A){return e.setPosition(e.position()+ui),(A||new BB).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return BB.startNull(e),BB.endNull(e)}};class pg{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsStruct_(e,A){return(A||new pg).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,A){return e.setPosition(e.position()+ui),(A||new pg).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return pg.startStruct_(e),pg.endStruct_(e)}}class Rr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsTime(e,A){return(A||new Rr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,A){return e.setPosition(e.position()+ui),(A||new Rr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.MILLISECOND}bitWidth(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,A){e.addFieldInt16(0,A,ht.MILLISECOND)}static addBitWidth(e,A){e.addFieldInt32(1,A,32)}static endTime(e){return e.endObject()}static createTime(e,A,i){return Rr.startTime(e),Rr.addUnit(e,A),Rr.addBitWidth(e,i),Rr.endTime(e)}}class Fr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsTimestamp(e,A){return(A||new Fr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,A){return e.setPosition(e.position()+ui),(A||new Fr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.SECOND}timezone(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.__string(this.bb_pos+A,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,A){e.addFieldInt16(0,A,ht.SECOND)}static addTimezone(e,A){e.addFieldOffset(1,A,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,A,i){return Fr.startTimestamp(e),Fr.addUnit(e,A),Fr.addTimezone(e,i),Fr.endTimestamp(e)}}class sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsUnion(e,A){return(A||new sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,A){return e.setPosition(e.position()+ui),(A||new sr).__init(e.readInt32(e.position())+e.position(),e)}mode(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Ln.Sparse}typeIds(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.readInt32(this.bb.__vector(this.bb_pos+A)+e*4):0}typeIdsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){const e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,A){e.addFieldInt16(0,A,Ln.Sparse)}static addTypeIds(e,A){e.addFieldOffset(1,A,0)}static createTypeIdsVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addInt32(A[i]);return e.endVector()}static startTypeIdsVector(e,A){e.startVector(4,A,4)}static endUnion(e){return e.endObject()}static createUnion(e,A,i){return sr.startUnion(e),sr.addMode(e,A),sr.addTypeIds(e,i),sr.endUnion(e)}}let Vb=class CB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsUtf8(e,A){return(A||new CB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,A){return e.setPosition(e.position()+ui),(A||new CB).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return CB.startUtf8(e),CB.endUtf8(e)}};var Ni;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"})(Ni||(Ni={}));let Nr=class I0{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsField(e,A){return(A||new I0).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,A){return e.setPosition(e.position()+ui),(A||new I0).__init(e.readInt32(e.position())+e.position(),e)}name(e){const A=this.bb.__offset(this.bb_pos,4);return A?this.bb.__string(this.bb_pos+A,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Ni.NONE}type(e){const A=this.bb.__offset(this.bb_pos,10);return A?this.bb.__union(e,this.bb_pos+A):null}dictionary(e){const A=this.bb.__offset(this.bb_pos,12);return A?(e||new mo).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}children(e,A){const i=this.bb.__offset(this.bb_pos,14);return i?(A||new I0).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,16);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,A){e.addFieldOffset(0,A,0)}static addNullable(e,A){e.addFieldInt8(1,+A,0)}static addTypeType(e,A){e.addFieldInt8(2,A,Ni.NONE)}static addType(e,A){e.addFieldOffset(3,A,0)}static addDictionary(e,A){e.addFieldOffset(4,A,0)}static addChildren(e,A){e.addFieldOffset(5,A,0)}static createChildrenVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startChildrenVector(e,A){e.startVector(4,A,4)}static addCustomMetadata(e,A){e.addFieldOffset(6,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static endField(e){return e.endObject()}},Ms=class ra{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsSchema(e,A){return(A||new ra).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,A){return e.setPosition(e.position()+ui),(A||new ra).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pc.Little}fields(e,A){const i=this.bb.__offset(this.bb_pos,6);return i?(A||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const A=this.bb.__offset(this.bb_pos,10);return A?this.bb.readInt64(this.bb.__vector(this.bb_pos+A)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,A){e.addFieldInt16(0,A,Pc.Little)}static addFields(e,A){e.addFieldOffset(1,A,0)}static createFieldsVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startFieldsVector(e,A){e.startVector(4,A,4)}static addCustomMetadata(e,A){e.addFieldOffset(2,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static addFeatures(e,A){e.addFieldOffset(3,A,0)}static createFeaturesVector(e,A){e.startVector(8,A.length,8);for(let i=A.length-1;i>=0;i--)e.addInt64(A[i]);return e.endVector()}static startFeaturesVector(e,A){e.startVector(8,A,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,A){e.finish(A)}static finishSizePrefixedSchemaBuffer(e,A){e.finish(A,void 0,!0)}static createSchema(e,A,i,n,r){return ra.startSchema(e),ra.addEndianness(e,A),ra.addFields(e,i),ra.addCustomMetadata(e,n),ra.addFeatures(e,r),ra.endSchema(e)}};var si;(function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"})(si||(si={}));var oe;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(oe||(oe={}));var wo;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(wo||(wo={}));const e7=void 0;function sh(t){if(t===null)return"null";if(t===e7)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>sh(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,A)=>typeof A=="bigint"?`${A}`:A)}function vi(t){if(typeof t=="bigint"&&(t<Number.MIN_SAFE_INTEGER||t>Number.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function Wb(t,e){return vi(t/e)+vi(t%e)/vi(e)}const A7=Symbol.for("isArrowBigNum");function ts(t,...e){return e.length===0?Object.setPrototypeOf(Qi(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}ts.prototype[A7]=!0,ts.prototype.toJSON=function(){return`"${ah(this)}"`},ts.prototype.valueOf=function(t){return zb(this,t)},ts.prototype.toString=function(){return ah(this)},ts.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return zb(this);case"string":return ah(this);case"default":return i7(this)}return ah(this)};function Hc(...t){return ts.apply(this,t)}function Jc(...t){return ts.apply(this,t)}function oh(...t){return ts.apply(this,t)}Object.setPrototypeOf(Hc.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Jc.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(oh.prototype,Object.create(Uint32Array.prototype)),Object.assign(Hc.prototype,ts.prototype,{constructor:Hc,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Jc.prototype,ts.prototype,{constructor:Jc,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(oh.prototype,ts.prototype,{constructor:oh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const t7=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function zb(t,e){const{buffer:A,byteOffset:i,byteLength:n,signed:r}=t,s=new BigUint64Array(A,i,n/8),o=r&&s.at(-1)&BigInt(1)<<BigInt(63);let g=BigInt(0),a=0;if(o){for(const c of s)g|=(c^t7)*(BigInt(1)<<BigInt(64*a++));g*=BigInt(-1),g-=BigInt(1)}else for(const c of s)g|=c*(BigInt(1)<<BigInt(64*a++));if(typeof e=="number"){const c=BigInt(Math.pow(10,e)),l=g/c,I=g%c;return vi(l)+vi(I)/vi(c)}return vi(g)}function ah(t){if(t.byteLength===8)return`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`;if(!t.signed)return Kp(t);let e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return Kp(t);e=e.slice();let i=1;for(let r=0;r<e.length;r++){const s=e[r],o=~s+i;e[r]=o,i&=s===0?1:0}return`-${Kp(e)}`}function i7(t){return t.byteLength===8?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:ah(t)}function Kp(t){let e="";const A=new Uint32Array(2);let i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer);let r=-1;const s=i.length-1;do{for(A[0]=i[r=0];r<s;)i[r++]=A[1]=A[0]/10,A[0]=(A[0]-A[1]*10<<16)+i[r];i[r]=A[1]=A[0]/10,A[0]=A[0]-A[1]*10,e=`${A[0]}${e}`}while(n[0]||n[1]||n[2]||n[3]);return e??"0"}class Vp{static new(e,A){switch(A){case!0:return new Hc(e);case!1:return new Jc(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Hc(e)}return e.byteLength===16?new oh(e):new Jc(e)}static signed(e){return new Hc(e)}static unsigned(e){return new Jc(e)}static decimal(e){return new oh(e)}constructor(e,A){return Vp.new(e,A)}}var Xb,jb,$b,Zb,ex,Ax,tx,ix,nx,rx,sx,ox,ax,gx,cx,lx,Ix,hx,ux,Bx,Cx,fx;class zA{static isNull(e){return(e==null?void 0:e.typeId)===oe.Null}static isInt(e){return(e==null?void 0:e.typeId)===oe.Int}static isFloat(e){return(e==null?void 0:e.typeId)===oe.Float}static isBinary(e){return(e==null?void 0:e.typeId)===oe.Binary}static isLargeBinary(e){return(e==null?void 0:e.typeId)===oe.LargeBinary}static isUtf8(e){return(e==null?void 0:e.typeId)===oe.Utf8}static isLargeUtf8(e){return(e==null?void 0:e.typeId)===oe.LargeUtf8}static isBool(e){return(e==null?void 0:e.typeId)===oe.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===oe.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===oe.Date}static isTime(e){return(e==null?void 0:e.typeId)===oe.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===oe.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===oe.Interval}static isDuration(e){return(e==null?void 0:e.typeId)===oe.Duration}static isList(e){return(e==null?void 0:e.typeId)===oe.List}static isStruct(e){return(e==null?void 0:e.typeId)===oe.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===oe.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===oe.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===oe.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===oe.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===oe.Dictionary}static isDenseUnion(e){return zA.isUnion(e)&&e.mode===Ln.Dense}static isSparseUnion(e){return zA.isUnion(e)&&e.mode===Ln.Sparse}constructor(e){this.typeId=e}}Xb=Symbol.toStringTag,zA[Xb]=(t=>(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(zA.prototype);class ga extends zA{constructor(){super(oe.Null)}toString(){return"Null"}}jb=Symbol.toStringTag,ga[jb]=(t=>t[Symbol.toStringTag]="Null")(ga.prototype);class yg extends zA{constructor(e,A){super(oe.Int),this.isSigned=e,this.bitWidth=A}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}$b=Symbol.toStringTag,yg[$b]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(yg.prototype);class gh extends yg{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(gh.prototype,"ArrayType",{value:Int32Array});class NC extends zA{constructor(e){super(oe.Float),this.precision=e}get ArrayType(){switch(this.precision){case Un.HALF:return Uint16Array;case Un.SINGLE:return Float32Array;case Un.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Zb=Symbol.toStringTag,NC[Zb]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(NC.prototype);class kC extends zA{constructor(){super(oe.Binary)}toString(){return"Binary"}}ex=Symbol.toStringTag,kC[ex]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(kC.prototype);class MC extends zA{constructor(){super(oe.LargeBinary)}toString(){return"LargeBinary"}}Ax=Symbol.toStringTag,MC[Ax]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(MC.prototype);class TC extends zA{constructor(){super(oe.Utf8)}toString(){return"Utf8"}}tx=Symbol.toStringTag,TC[tx]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(TC.prototype);class LC extends zA{constructor(){super(oe.LargeUtf8)}toString(){return"LargeUtf8"}}ix=Symbol.toStringTag,LC[ix]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(LC.prototype);class UC extends zA{constructor(){super(oe.Bool)}toString(){return"Bool"}}nx=Symbol.toStringTag,UC[nx]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(UC.prototype);class GC extends zA{constructor(e,A,i=128){super(oe.Decimal),this.scale=e,this.precision=A,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}rx=Symbol.toStringTag,GC[rx]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(GC.prototype);class OC extends zA{constructor(e){super(oe.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${xr[this.unit]}>`}get ArrayType(){return this.unit===xr.DAY?Int32Array:BigInt64Array}}sx=Symbol.toStringTag,OC[sx]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(OC.prototype);class PC extends zA{constructor(e,A){super(oe.Time),this.unit=e,this.bitWidth=A}toString(){return`Time${this.bitWidth}<${ht[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}ox=Symbol.toStringTag,PC[ox]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(PC.prototype);class qC extends zA{constructor(e,A){super(oe.Timestamp),this.unit=e,this.timezone=A}toString(){return`Timestamp<${ht[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ax=Symbol.toStringTag,qC[ax]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(qC.prototype);class HC extends zA{constructor(e){super(oe.Interval),this.unit=e}toString(){return`Interval<${Rs[this.unit]}>`}}gx=Symbol.toStringTag,HC[gx]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(HC.prototype);class JC extends zA{constructor(e){super(oe.Duration),this.unit=e}toString(){return`Duration<${ht[this.unit]}>`}}cx=Symbol.toStringTag,JC[cx]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(JC.prototype);class YC extends zA{constructor(e){super(oe.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lx=Symbol.toStringTag,YC[lx]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(YC.prototype);class Xn extends zA{constructor(e){super(oe.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Ix=Symbol.toStringTag,Xn[Ix]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(Xn.prototype);class KC extends zA{constructor(e,A,i){super(oe.Union),this.mode=e,this.children=i,this.typeIds=A=Int32Array.from(A),this.typeIdToChildIndex=A.reduce((n,r,s)=>(n[r]=s)&&n||n,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}hx=Symbol.toStringTag,KC[hx]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(KC.prototype);class VC extends zA{constructor(e){super(oe.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}ux=Symbol.toStringTag,VC[ux]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(VC.prototype);class WC extends zA{constructor(e,A){super(oe.FixedSizeList),this.listSize=e,this.children=[A]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Bx=Symbol.toStringTag,WC[Bx]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(WC.prototype);class zC extends zA{constructor(e,A=!1){var i,n,r;if(super(oe.Map),this.children=[e],this.keysSorted=A,e&&(e.name="entries",!((i=e==null?void 0:e.type)===null||i===void 0)&&i.children)){const s=(n=e==null?void 0:e.type)===null||n===void 0?void 0:n.children[0];s&&(s.name="key");const o=(r=e==null?void 0:e.type)===null||r===void 0?void 0:r.children[1];o&&(o.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Cx=Symbol.toStringTag,zC[Cx]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(zC.prototype);const n7=(t=>()=>++t)(-1);class Yc extends zA{constructor(e,A,i,n){super(oe.Dictionary),this.indices=A,this.dictionary=e,this.isOrdered=n||!1,this.id=i==null?n7():vi(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}fx=Symbol.toStringTag,Yc[fx]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(Yc.prototype);function Do(t){const e=t;switch(t.typeId){case oe.Decimal:return t.bitWidth/32;case oe.Interval:return 1+e.unit;case oe.FixedSizeList:return e.listSize;case oe.FixedSizeBinary:return e.byteWidth;default:return 1}}class Ut{visitMany(e,...A){return e.map((i,n)=>this.visit(i,...A.map(r=>r[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,A=!0){return r7(this,e,A)}getVisitFnByTypeId(e,A=!0){return Kc(this,e,A)}visitNull(e,...A){return null}visitBool(e,...A){return null}visitInt(e,...A){return null}visitFloat(e,...A){return null}visitUtf8(e,...A){return null}visitLargeUtf8(e,...A){return null}visitBinary(e,...A){return null}visitLargeBinary(e,...A){return null}visitFixedSizeBinary(e,...A){return null}visitDate(e,...A){return null}visitTimestamp(e,...A){return null}visitTime(e,...A){return null}visitDecimal(e,...A){return null}visitList(e,...A){return null}visitStruct(e,...A){return null}visitUnion(e,...A){return null}visitDictionary(e,...A){return null}visitInterval(e,...A){return null}visitDuration(e,...A){return null}visitFixedSizeList(e,...A){return null}visitMap(e,...A){return null}}function r7(t,e,A=!0){return typeof e=="number"?Kc(t,e,A):typeof e=="string"&&e in oe?Kc(t,oe[e],A):e&&e instanceof zA?Kc(t,Ex(e),A):e!=null&&e.type&&e.type instanceof zA?Kc(t,Ex(e.type),A):Kc(t,oe.NONE,A)}function Kc(t,e,A=!0){let i=null;switch(e){case oe.Null:i=t.visitNull;break;case oe.Bool:i=t.visitBool;break;case oe.Int:i=t.visitInt;break;case oe.Int8:i=t.visitInt8||t.visitInt;break;case oe.Int16:i=t.visitInt16||t.visitInt;break;case oe.Int32:i=t.visitInt32||t.visitInt;break;case oe.Int64:i=t.visitInt64||t.visitInt;break;case oe.Uint8:i=t.visitUint8||t.visitInt;break;case oe.Uint16:i=t.visitUint16||t.visitInt;break;case oe.Uint32:i=t.visitUint32||t.visitInt;break;case oe.Uint64:i=t.visitUint64||t.visitInt;break;case oe.Float:i=t.visitFloat;break;case oe.Float16:i=t.visitFloat16||t.visitFloat;break;case oe.Float32:i=t.visitFloat32||t.visitFloat;break;case oe.Float64:i=t.visitFloat64||t.visitFloat;break;case oe.Utf8:i=t.visitUtf8;break;case oe.LargeUtf8:i=t.visitLargeUtf8;break;case oe.Binary:i=t.visitBinary;break;case oe.LargeBinary:i=t.visitLargeBinary;break;case oe.FixedSizeBinary:i=t.visitFixedSizeBinary;break;case oe.Date:i=t.visitDate;break;case oe.DateDay:i=t.visitDateDay||t.visitDate;break;case oe.DateMillisecond:i=t.visitDateMillisecond||t.visitDate;break;case oe.Timestamp:i=t.visitTimestamp;break;case oe.TimestampSecond:i=t.visitTimestampSecond||t.visitTimestamp;break;case oe.TimestampMillisecond:i=t.visitTimestampMillisecond||t.visitTimestamp;break;case oe.TimestampMicrosecond:i=t.visitTimestampMicrosecond||t.visitTimestamp;break;case oe.TimestampNanosecond:i=t.visitTimestampNanosecond||t.visitTimestamp;break;case oe.Time:i=t.visitTime;break;case oe.TimeSecond:i=t.visitTimeSecond||t.visitTime;break;case oe.TimeMillisecond:i=t.visitTimeMillisecond||t.visitTime;break;case oe.TimeMicrosecond:i=t.visitTimeMicrosecond||t.visitTime;break;case oe.TimeNanosecond:i=t.visitTimeNanosecond||t.visitTime;break;case oe.Decimal:i=t.visitDecimal;break;case oe.List:i=t.visitList;break;case oe.Struct:i=t.visitStruct;break;case oe.Union:i=t.visitUnion;break;case oe.DenseUnion:i=t.visitDenseUnion||t.visitUnion;break;case oe.SparseUnion:i=t.visitSparseUnion||t.visitUnion;break;case oe.Dictionary:i=t.visitDictionary;break;case oe.Interval:i=t.visitInterval;break;case oe.IntervalDayTime:i=t.visitIntervalDayTime||t.visitInterval;break;case oe.IntervalYearMonth:i=t.visitIntervalYearMonth||t.visitInterval;break;case oe.Duration:i=t.visitDuration;break;case oe.DurationSecond:i=t.visitDurationSecond||t.visitDuration;break;case oe.DurationMillisecond:i=t.visitDurationMillisecond||t.visitDuration;break;case oe.DurationMicrosecond:i=t.visitDurationMicrosecond||t.visitDuration;break;case oe.DurationNanosecond:i=t.visitDurationNanosecond||t.visitDuration;break;case oe.FixedSizeList:i=t.visitFixedSizeList;break;case oe.Map:i=t.visitMap;break}if(typeof i=="function")return i;if(!A)return()=>null;throw new Error(`Unrecognized type '${oe[e]}'`)}function Ex(t){switch(t.typeId){case oe.Null:return oe.Null;case oe.Int:{const{bitWidth:e,isSigned:A}=t;switch(e){case 8:return A?oe.Int8:oe.Uint8;case 16:return A?oe.Int16:oe.Uint16;case 32:return A?oe.Int32:oe.Uint32;case 64:return A?oe.Int64:oe.Uint64}return oe.Int}case oe.Float:switch(t.precision){case Un.HALF:return oe.Float16;case Un.SINGLE:return oe.Float32;case Un.DOUBLE:return oe.Float64}return oe.Float;case oe.Binary:return oe.Binary;case oe.LargeBinary:return oe.LargeBinary;case oe.Utf8:return oe.Utf8;case oe.LargeUtf8:return oe.LargeUtf8;case oe.Bool:return oe.Bool;case oe.Decimal:return oe.Decimal;case oe.Time:switch(t.unit){case ht.SECOND:return oe.TimeSecond;case ht.MILLISECOND:return oe.TimeMillisecond;case ht.MICROSECOND:return oe.TimeMicrosecond;case ht.NANOSECOND:return oe.TimeNanosecond}return oe.Time;case oe.Timestamp:switch(t.unit){case ht.SECOND:return oe.TimestampSecond;case ht.MILLISECOND:return oe.TimestampMillisecond;case ht.MICROSECOND:return oe.TimestampMicrosecond;case ht.NANOSECOND:return oe.TimestampNanosecond}return oe.Timestamp;case oe.Date:switch(t.unit){case xr.DAY:return oe.DateDay;case xr.MILLISECOND:return oe.DateMillisecond}return oe.Date;case oe.Interval:switch(t.unit){case Rs.DAY_TIME:return oe.IntervalDayTime;case Rs.YEAR_MONTH:return oe.IntervalYearMonth}return oe.Interval;case oe.Duration:switch(t.unit){case ht.SECOND:return oe.DurationSecond;case ht.MILLISECOND:return oe.DurationMillisecond;case ht.MICROSECOND:return oe.DurationMicrosecond;case ht.NANOSECOND:return oe.DurationNanosecond}return oe.Duration;case oe.Map:return oe.Map;case oe.List:return oe.List;case oe.Struct:return oe.Struct;case oe.Union:switch(t.mode){case Ln.Dense:return oe.DenseUnion;case Ln.Sparse:return oe.SparseUnion}return oe.Union;case oe.FixedSizeBinary:return oe.FixedSizeBinary;case oe.FixedSizeList:return oe.FixedSizeList;case oe.Dictionary:return oe.Dictionary}throw new Error(`Unrecognized type '${oe[t.typeId]}'`)}Ut.prototype.visitInt8=null,Ut.prototype.visitInt16=null,Ut.prototype.visitInt32=null,Ut.prototype.visitInt64=null,Ut.prototype.visitUint8=null,Ut.prototype.visitUint16=null,Ut.prototype.visitUint32=null,Ut.prototype.visitUint64=null,Ut.prototype.visitFloat16=null,Ut.prototype.visitFloat32=null,Ut.prototype.visitFloat64=null,Ut.prototype.visitDateDay=null,Ut.prototype.visitDateMillisecond=null,Ut.prototype.visitTimestampSecond=null,Ut.prototype.visitTimestampMillisecond=null,Ut.prototype.visitTimestampMicrosecond=null,Ut.prototype.visitTimestampNanosecond=null,Ut.prototype.visitTimeSecond=null,Ut.prototype.visitTimeMillisecond=null,Ut.prototype.visitTimeMicrosecond=null,Ut.prototype.visitTimeNanosecond=null,Ut.prototype.visitDenseUnion=null,Ut.prototype.visitSparseUnion=null,Ut.prototype.visitIntervalDayTime=null,Ut.prototype.visitIntervalYearMonth=null,Ut.prototype.visitDuration=null,Ut.prototype.visitDurationSecond=null,Ut.prototype.visitDurationMillisecond=null,Ut.prototype.visitDurationMicrosecond=null,Ut.prototype.visitDurationNanosecond=null;const dx=new Float64Array(1),Vc=new Uint32Array(dx.buffer);function Qx(t){const e=(t&31744)>>10,A=(t&1023)/1024,i=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return i*(A?Number.NaN:1/0);case 0:return i*(A?6103515625e-14*A:0)}return i*Math.pow(2,e-15)*(1+A)}function s7(t){if(t!==t)return 32256;dx[0]=t;const e=(Vc[1]&2147483648)>>16&65535;let A=Vc[1]&2146435072,i=0;return A>=1089470464?Vc[0]>0?A=31744:(A=(A&2080374784)>>16,i=(Vc[1]&1048575)>>10):A<=1056964608?(i=1048576+(Vc[1]&1048575),i=1048576+(i<<(A>>20)-998)>>21,A=0):(A=A-1056964608>>10,i=(Vc[1]&1048575)+512>>10),e|A|i&65535}class ut extends Ut{}function Et(t){return(e,A,i)=>{if(e.setValid(A,i!=null))return t(e,A,i)}}const o7=(t,e,A)=>{t[e]=Math.floor(A/864e5)},px=(t,e,A,i)=>{if(A+1<e.length){const n=vi(e[A]),r=vi(e[A+1]);t.set(i.subarray(0,r-n),n)}},a7=({offset:t,values:e},A,i)=>{const n=t+A;i?e[n>>3]|=1<<n%8:e[n>>3]&=~(1<<n%8)},_o=({values:t},e,A)=>{t[e]=A},Wp=({values:t},e,A)=>{t[e]=A},yx=({values:t},e,A)=>{t[e]=s7(A)},g7=(t,e,A)=>{switch(t.type.precision){case Un.HALF:return yx(t,e,A);case Un.SINGLE:case Un.DOUBLE:return Wp(t,e,A)}},mx=({values:t},e,A)=>{o7(t,e,A.valueOf())},wx=({values:t},e,A)=>{t[e]=BigInt(A)},c7=({stride:t,values:e},A,i)=>{e.set(i.subarray(0,t),t*A)},Dx=({values:t,valueOffsets:e},A,i)=>px(t,e,A,i),_x=({values:t,valueOffsets:e},A,i)=>px(t,e,A,Up(i)),l7=(t,e,A)=>{t.type.unit===xr.DAY?mx(t,e,A):wx(t,e,A)},Sx=({values:t},e,A)=>{t[e]=BigInt(A/1e3)},vx=({values:t},e,A)=>{t[e]=BigInt(A)},bx=({values:t},e,A)=>{t[e]=BigInt(A*1e3)},xx=({values:t},e,A)=>{t[e]=BigInt(A*1e6)},I7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Sx(t,e,A);case ht.MILLISECOND:return vx(t,e,A);case ht.MICROSECOND:return bx(t,e,A);case ht.NANOSECOND:return xx(t,e,A)}},Rx=({values:t},e,A)=>{t[e]=A},Fx=({values:t},e,A)=>{t[e]=A},Nx=({values:t},e,A)=>{t[e]=A},kx=({values:t},e,A)=>{t[e]=A},h7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Rx(t,e,A);case ht.MILLISECOND:return Fx(t,e,A);case ht.MICROSECOND:return Nx(t,e,A);case ht.NANOSECOND:return kx(t,e,A)}},u7=({values:t,stride:e},A,i)=>{t.set(i.subarray(0,e),e*A)},B7=(t,e,A)=>{const i=t.children[0],n=t.valueOffsets,r=kr.getVisitFn(i);if(Array.isArray(A))for(let s=-1,o=n[e],g=n[e+1];o<g;)r(i,o++,A[++s]);else for(let s=-1,o=n[e],g=n[e+1];o<g;)r(i,o++,A.get(++s))},C7=(t,e,A)=>{const i=t.children[0],{valueOffsets:n}=t,r=kr.getVisitFn(i);let{[e]:s,[e+1]:o}=n;const g=A instanceof Map?A.entries():Object.entries(A);for(const a of g)if(r(i,s,a),++s>=o)break},f7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e[r]),E7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e.get(r)),d7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e.get(n.name)),Q7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e[n.name]),p7=(t,e,A)=>{const i=t.type.children.map(r=>kr.getVisitFn(r.type)),n=A instanceof Map?d7(e,A):A instanceof Ki?E7(e,A):Array.isArray(A)?f7(e,A):Q7(e,A);t.type.children.forEach((r,s)=>n(i[s],t.children[s],r,s))},y7=(t,e,A)=>{t.type.mode===Ln.Dense?Mx(t,e,A):Tx(t,e,A)},Mx=(t,e,A)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];kr.visit(n,t.valueOffsets[e],A)},Tx=(t,e,A)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];kr.visit(n,e,A)},m7=(t,e,A)=>{var i;(i=t.dictionary)===null||i===void 0||i.set(t.values[e],A)},w7=(t,e,A)=>{t.type.unit===Rs.DAY_TIME?Lx(t,e,A):Ux(t,e,A)},Lx=({values:t},e,A)=>{t.set(A.subarray(0,2),2*e)},Ux=({values:t},e,A)=>{t[e]=A[0]*12+A[1]%12},Gx=({values:t},e,A)=>{t[e]=A},Ox=({values:t},e,A)=>{t[e]=A},Px=({values:t},e,A)=>{t[e]=A},qx=({values:t},e,A)=>{t[e]=A},D7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Gx(t,e,A);case ht.MILLISECOND:return Ox(t,e,A);case ht.MICROSECOND:return Px(t,e,A);case ht.NANOSECOND:return qx(t,e,A)}},_7=(t,e,A)=>{const{stride:i}=t,n=t.children[0],r=kr.getVisitFn(n);if(Array.isArray(A))for(let s=-1,o=e*i;++s<i;)r(n,o+s,A[s]);else for(let s=-1,o=e*i;++s<i;)r(n,o+s,A.get(s))};ut.prototype.visitBool=Et(a7),ut.prototype.visitInt=Et(_o),ut.prototype.visitInt8=Et(_o),ut.prototype.visitInt16=Et(_o),ut.prototype.visitInt32=Et(_o),ut.prototype.visitInt64=Et(_o),ut.prototype.visitUint8=Et(_o),ut.prototype.visitUint16=Et(_o),ut.prototype.visitUint32=Et(_o),ut.prototype.visitUint64=Et(_o),ut.prototype.visitFloat=Et(g7),ut.prototype.visitFloat16=Et(yx),ut.prototype.visitFloat32=Et(Wp),ut.prototype.visitFloat64=Et(Wp),ut.prototype.visitUtf8=Et(_x),ut.prototype.visitLargeUtf8=Et(_x),ut.prototype.visitBinary=Et(Dx),ut.prototype.visitLargeBinary=Et(Dx),ut.prototype.visitFixedSizeBinary=Et(c7),ut.prototype.visitDate=Et(l7),ut.prototype.visitDateDay=Et(mx),ut.prototype.visitDateMillisecond=Et(wx),ut.prototype.visitTimestamp=Et(I7),ut.prototype.visitTimestampSecond=Et(Sx),ut.prototype.visitTimestampMillisecond=Et(vx),ut.prototype.visitTimestampMicrosecond=Et(bx),ut.prototype.visitTimestampNanosecond=Et(xx),ut.prototype.visitTime=Et(h7),ut.prototype.visitTimeSecond=Et(Rx),ut.prototype.visitTimeMillisecond=Et(Fx),ut.prototype.visitTimeMicrosecond=Et(Nx),ut.prototype.visitTimeNanosecond=Et(kx),ut.prototype.visitDecimal=Et(u7),ut.prototype.visitList=Et(B7),ut.prototype.visitStruct=Et(p7),ut.prototype.visitUnion=Et(y7),ut.prototype.visitDenseUnion=Et(Mx),ut.prototype.visitSparseUnion=Et(Tx),ut.prototype.visitDictionary=Et(m7),ut.prototype.visitInterval=Et(w7),ut.prototype.visitIntervalDayTime=Et(Lx),ut.prototype.visitIntervalYearMonth=Et(Ux),ut.prototype.visitDuration=Et(D7),ut.prototype.visitDurationSecond=Et(Gx),ut.prototype.visitDurationMillisecond=Et(Ox),ut.prototype.visitDurationMicrosecond=Et(Px),ut.prototype.visitDurationNanosecond=Et(qx),ut.prototype.visitFixedSizeList=Et(_7),ut.prototype.visitMap=Et(C7);const kr=new ut,is=Symbol.for("parent"),Wc=Symbol.for("rowIndex");class zp{constructor(e,A){return this[is]=e,this[Wc]=A,new Proxy(this,new v7)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[Wc],A=this[is],i=A.type.children,n={};for(let r=-1,s=i.length;++r<s;)n[i[r].name]=or.visit(A.children[r],e);return n}toString(){return`{${[...this].map(([e,A])=>`${sh(e)}: ${sh(A)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new S7(this[is],this[Wc])}}class S7{constructor(e,A){this.childIndex=0,this.children=e.children,this.rowIndex=A,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,or.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(zp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[is]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wc]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class v7{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[is].type.children.map(A=>A.name)}has(e,A){return e[is].type.children.findIndex(i=>i.name===A)!==-1}getOwnPropertyDescriptor(e,A){if(e[is].type.children.findIndex(i=>i.name===A)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,A){if(Reflect.has(e,A))return e[A];const i=e[is].type.children.findIndex(n=>n.name===A);if(i!==-1){const n=or.visit(e[is].children[i],e[Wc]);return Reflect.set(e,A,n),n}}set(e,A,i){const n=e[is].type.children.findIndex(r=>r.name===A);return n!==-1?(kr.visit(e[is].children[n],e[Wc],i),Reflect.set(e,A,i)):Reflect.has(e,A)||typeof A=="symbol"?Reflect.set(e,A,i):!1}}class at extends Ut{}function Bt(t){return(e,A)=>e.getValid(A)?t(e,A):null}const b7=(t,e)=>864e5*t[e],x7=(t,e)=>null,Hx=(t,e,A)=>{if(A+1>=e.length)return null;const i=vi(e[A]),n=vi(e[A+1]);return t.subarray(i,n)},R7=({offset:t,values:e},A)=>{const i=t+A;return(e[i>>3]&1<<i%8)!==0},Jx=({values:t},e)=>b7(t,e),Yx=({values:t},e)=>vi(t[e]),ca=({stride:t,values:e},A)=>e[t*A],F7=({stride:t,values:e},A)=>Qx(e[t*A]),Kx=({values:t},e)=>t[e],N7=({stride:t,values:e},A)=>e.subarray(t*A,t*(A+1)),Vx=({values:t,valueOffsets:e},A)=>Hx(t,e,A),Wx=({values:t,valueOffsets:e},A)=>{const i=Hx(t,e,A);return i!==null?Lp(i):null},k7=({values:t},e)=>t[e],M7=({type:t,values:e},A)=>t.precision!==Un.HALF?e[A]:Qx(e[A]),T7=(t,e)=>t.type.unit===xr.DAY?Jx(t,e):Yx(t,e),zx=({values:t},e)=>1e3*vi(t[e]),Xx=({values:t},e)=>vi(t[e]),jx=({values:t},e)=>Wb(t[e],BigInt(1e3)),$x=({values:t},e)=>Wb(t[e],BigInt(1e6)),L7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return zx(t,e);case ht.MILLISECOND:return Xx(t,e);case ht.MICROSECOND:return jx(t,e);case ht.NANOSECOND:return $x(t,e)}},Zx=({values:t},e)=>t[e],eR=({values:t},e)=>t[e],AR=({values:t},e)=>t[e],tR=({values:t},e)=>t[e],U7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return Zx(t,e);case ht.MILLISECOND:return eR(t,e);case ht.MICROSECOND:return AR(t,e);case ht.NANOSECOND:return tR(t,e)}},G7=({values:t,stride:e},A)=>Vp.decimal(t.subarray(e*A,e*(A+1))),O7=(t,e)=>{const{valueOffsets:A,stride:i,children:n}=t,{[e*i]:r,[e*i+1]:s}=A,g=n[0].slice(r,s-r);return new Ki([g])},P7=(t,e)=>{const{valueOffsets:A,children:i}=t,{[e]:n,[e+1]:r}=A,s=i[0];return new jp(s.slice(n,r-n))},q7=(t,e)=>new zp(t,e),H7=(t,e)=>t.type.mode===Ln.Dense?iR(t,e):nR(t,e),iR=(t,e)=>{const A=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[A];return or.visit(i,t.valueOffsets[e])},nR=(t,e)=>{const A=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[A];return or.visit(i,e)},J7=(t,e)=>{var A;return(A=t.dictionary)===null||A===void 0?void 0:A.get(t.values[e])},Y7=(t,e)=>t.type.unit===Rs.DAY_TIME?rR(t,e):sR(t,e),rR=({values:t},e)=>t.subarray(2*e,2*(e+1)),sR=({values:t},e)=>{const A=t[e],i=new Int32Array(2);return i[0]=Math.trunc(A/12),i[1]=Math.trunc(A%12),i},oR=({values:t},e)=>t[e],aR=({values:t},e)=>t[e],gR=({values:t},e)=>t[e],cR=({values:t},e)=>t[e],K7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return oR(t,e);case ht.MILLISECOND:return aR(t,e);case ht.MICROSECOND:return gR(t,e);case ht.NANOSECOND:return cR(t,e)}},V7=(t,e)=>{const{stride:A,children:i}=t,r=i[0].slice(e*A,A);return new Ki([r])};at.prototype.visitNull=Bt(x7),at.prototype.visitBool=Bt(R7),at.prototype.visitInt=Bt(k7),at.prototype.visitInt8=Bt(ca),at.prototype.visitInt16=Bt(ca),at.prototype.visitInt32=Bt(ca),at.prototype.visitInt64=Bt(Kx),at.prototype.visitUint8=Bt(ca),at.prototype.visitUint16=Bt(ca),at.prototype.visitUint32=Bt(ca),at.prototype.visitUint64=Bt(Kx),at.prototype.visitFloat=Bt(M7),at.prototype.visitFloat16=Bt(F7),at.prototype.visitFloat32=Bt(ca),at.prototype.visitFloat64=Bt(ca),at.prototype.visitUtf8=Bt(Wx),at.prototype.visitLargeUtf8=Bt(Wx),at.prototype.visitBinary=Bt(Vx),at.prototype.visitLargeBinary=Bt(Vx),at.prototype.visitFixedSizeBinary=Bt(N7),at.prototype.visitDate=Bt(T7),at.prototype.visitDateDay=Bt(Jx),at.prototype.visitDateMillisecond=Bt(Yx),at.prototype.visitTimestamp=Bt(L7),at.prototype.visitTimestampSecond=Bt(zx),at.prototype.visitTimestampMillisecond=Bt(Xx),at.prototype.visitTimestampMicrosecond=Bt(jx),at.prototype.visitTimestampNanosecond=Bt($x),at.prototype.visitTime=Bt(U7),at.prototype.visitTimeSecond=Bt(Zx),at.prototype.visitTimeMillisecond=Bt(eR),at.prototype.visitTimeMicrosecond=Bt(AR),at.prototype.visitTimeNanosecond=Bt(tR),at.prototype.visitDecimal=Bt(G7),at.prototype.visitList=Bt(O7),at.prototype.visitStruct=Bt(q7),at.prototype.visitUnion=Bt(H7),at.prototype.visitDenseUnion=Bt(iR),at.prototype.visitSparseUnion=Bt(nR),at.prototype.visitDictionary=Bt(J7),at.prototype.visitInterval=Bt(Y7),at.prototype.visitIntervalDayTime=Bt(rR),at.prototype.visitIntervalYearMonth=Bt(sR),at.prototype.visitDuration=Bt(K7),at.prototype.visitDurationSecond=Bt(oR),at.prototype.visitDurationMillisecond=Bt(aR),at.prototype.visitDurationMicrosecond=Bt(gR),at.prototype.visitDurationNanosecond=Bt(cR),at.prototype.visitFixedSizeList=Bt(V7),at.prototype.visitMap=Bt(P7);const or=new at,zc=Symbol.for("keys"),Xc=Symbol.for("vals"),jc=Symbol.for("kKeysAsStrings"),Xp=Symbol.for("_kKeysAsStrings");class jp{constructor(e){return this[zc]=new Ki([e.children[0]]).memoize(),this[Xc]=e.children[1],new Proxy(this,new z7)}get[jc](){return this[Xp]||(this[Xp]=Array.from(this[zc].toArray(),String))}[Symbol.iterator](){return new W7(this[zc],this[Xc])}get size(){return this[zc].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[zc],A=this[Xc],i={};for(let n=-1,r=e.length;++n<r;)i[e.get(n)]=or.visit(A,n);return i}toString(){return`{${[...this].map(([e,A])=>`${sh(e)}: ${sh(A)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class W7{constructor(e,A){this.keys=e,this.vals=A,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),or.visit(this.vals,e)]})}}class z7{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[jc]}has(e,A){return e[jc].includes(A)}getOwnPropertyDescriptor(e,A){if(e[jc].indexOf(A)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,A){if(Reflect.has(e,A))return e[A];const i=e[jc].indexOf(A);if(i!==-1){const n=or.visit(Reflect.get(e,Xc),i);return Reflect.set(e,A,n),n}}set(e,A,i){const n=e[jc].indexOf(A);return n!==-1?(kr.visit(Reflect.get(e,Xc),n,i),Reflect.set(e,A,i)):Reflect.has(e,A)?Reflect.set(e,A,i):!1}}Object.defineProperties(jp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[zc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xp]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let lR;function IR(t,e,A,i){const{length:n=0}=t;let r=typeof e!="number"?0:e,s=typeof A!="number"?n:A;return r<0&&(r=(r%n+n)%n),s<0&&(s=(s%n+n)%n),s<r&&(lR=r,r=s,s=lR),s>n&&(s=n),i?i(t,r,s):[r,s]}const $p=(t,e)=>t<0?e+t:t,hR=t=>t!==t;function $c(t){if(typeof t!=="object"||t===null)return hR(t)?hR:A=>A===t;if(t instanceof Date){const A=t.valueOf();return i=>i instanceof Date?i.valueOf()===A:!1}return ArrayBuffer.isView(t)?A=>A?Wz(t,A):!1:t instanceof Map?j7(t):Array.isArray(t)?X7(t):t instanceof Ki?$7(t):Z7(t,!0)}function X7(t){const e=[];for(let A=-1,i=t.length;++A<i;)e[A]=$c(t[A]);return XC(e)}function j7(t){let e=-1;const A=[];for(const i of t.values())A[++e]=$c(i);return XC(A)}function $7(t){const e=[];for(let A=-1,i=t.length;++A<i;)e[A]=$c(t.get(A));return XC(e)}function Z7(t,e=!1){const A=Object.keys(t);if(!e&&A.length===0)return()=>!1;const i=[];for(let n=-1,r=A.length;++n<r;)i[n]=$c(t[A[n]]);return XC(i,A)}function XC(t,e){return A=>{if(!A||typeof A!="object")return!1;switch(A.constructor){case Array:return eX(t,A);case Map:return uR(t,A,A.keys());case jp:case zp:case Object:case void 0:return uR(t,A,e||Object.keys(A))}return A instanceof Ki?AX(t,A):!1}}function eX(t,e){const A=t.length;if(e.length!==A)return!1;for(let i=-1;++i<A;)if(!t[i](e[i]))return!1;return!0}function AX(t,e){const A=t.length;if(e.length!==A)return!1;for(let i=-1;++i<A;)if(!t[i](e.get(i)))return!1;return!0}function uR(t,e,A){const i=A[Symbol.iterator](),n=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),r=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let s=0;const o=t.length;let g=r.next(),a=i.next(),c=n.next();for(;s<o&&!a.done&&!c.done&&!g.done&&!(a.value!==c.value||!t[s](g.value));++s,a=i.next(),c=n.next(),g=r.next());return s===o&&a.done&&c.done&&g.done?!0:(i.return&&i.return(),n.return&&n.return(),r.return&&r.return(),!1)}function BR(t,e,A,i){return(A&1<<i)!==0}function tX(t,e,A,i){return(A&1<<i)>>i}function jC(t,e,A){const i=A.byteLength+7&-8;if(t>0||A.byteLength<i){const n=new Uint8Array(i);return n.set(t%8===0?A.subarray(t>>3):$C(new Zp(A,t,e,null,BR)).subarray(0,i)),n}return A}function $C(t){const e=[];let A=0,i=0,n=0;for(const s of t)s&&(n|=1<<i),++i===8&&(e[A++]=n,n=i=0);(A===0||i>0)&&(e[A++]=n);const r=new Uint8Array(e.length+7&-8);return r.set(e),r}class Zp{constructor(e,A,i,n,r){this.bytes=e,this.length=i,this.context=n,this.get=r,this.bit=A%8,this.byteIndex=A>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function ey(t,e,A){if(A-e<=0)return 0;if(A-e<8){let r=0;for(const s of new Zp(t,e,A-e,t,tX))r+=s;return r}const i=A>>3<<3,n=e+(e%8===0?0:8-e%8);return ey(t,e,n)+ey(t,i,A)+iX(t,n>>3,i-n>>3)}function iX(t,e,A){let i=0,n=Math.trunc(e);const r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=A===void 0?t.byteLength:n+A;for(;s-n>=4;)i+=Ay(r.getUint32(n)),n+=4;for(;s-n>=2;)i+=Ay(r.getUint16(n)),n+=2;for(;s-n>=1;)i+=Ay(r.getUint8(n)),n+=1;return i}function Ay(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const nX=-1;class pi{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return zA.isSparseUnion(e)?this.children.some(A=>A.nullable):zA.isDenseUnion(e)?this.children.some(A=>A.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:A,values:i,nullBitmap:n,typeIds:r}=this;return A&&(e+=A.byteLength),i&&(e+=i.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),this.children.reduce((s,o)=>s+o.byteLength,e)}get nullCount(){if(zA.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let e=this._nullCount,A;return e<=nX&&(A=this.nullBitmap)&&(this._nullCount=e=A.length===0?0:this.length-ey(A,this.offset,this.offset+this.length)),e}constructor(e,A,i,n,r,s=[],o){this.type=e,this.children=s,this.dictionary=o,this.offset=Math.floor(Math.max(A||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1));let g;r instanceof pi?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=Do(e),r&&((g=r[0])&&(this.valueOffsets=g),(g=r[1])&&(this.values=g),(g=r[2])&&(this.nullBitmap=g),(g=r[3])&&(this.typeIds=g)))}getValid(e){const{type:A}=this;if(zA.isUnion(A)){const i=A,n=this.children[i.typeIdToChildIndex[this.typeIds[e]]],r=i.mode===Ln.Dense?this.valueOffsets[e]:e;return n.getValid(r)}if(this.nullable&&this.nullCount>0){const i=this.offset+e;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(e,A){let i;const{type:n}=this;if(zA.isUnion(n)){const r=n,s=this.children[r.typeIdToChildIndex[this.typeIds[e]]],o=r.mode===Ln.Dense?this.valueOffsets[e]:e;i=s.getValid(o),s.setValid(o,A)}else{let{nullBitmap:r}=this;const{offset:s,length:o}=this,g=s+e,a=1<<g%8,c=g>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((s+o+63&-64)>>3).fill(255),this.nullCount>0?(r.set(jC(s,o,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));const l=r[c];i=(l&a)!==0,r[c]=A?l|a:l&~a}return i!==!!A&&(this._nullCount=this.nullCount+(A?-1:1)),A}clone(e=this.type,A=this.offset,i=this.length,n=this._nullCount,r=this,s=this.children){return new pi(e,A,i,n,r,s,this.dictionary)}slice(e,A){const{stride:i,typeId:n,children:r}=this,s=+(this._nullCount===0)-1,o=n===16?i:1,g=this._sliceBuffers(e,A,i,n);return this.clone(this.type,this.offset+e,A,s,g,r.length===0||this.valueOffsets?r:this._sliceChildren(r,o*e,o*A))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===oe.Null)return this.clone(this.type,0,e,0);const{length:A,nullCount:i}=this,n=new Uint8Array((e+63&-64)>>3).fill(255,0,A>>3);n[A>>3]=(1<<A-(A&-8))-1,i>0&&n.set(jC(this.offset,A,this.nullBitmap),0);const r=this.buffers;return r[wo.VALIDITY]=n,this.clone(this.type,0,e,i+(e-A),r)}_sliceBuffers(e,A,i,n){let r;const{buffers:s}=this;return(r=s[wo.TYPE])&&(s[wo.TYPE]=r.subarray(e,e+A)),(r=s[wo.OFFSET])&&(s[wo.OFFSET]=r.subarray(e,e+A+1))||(r=s[wo.DATA])&&(s[wo.DATA]=n===6?r:r.subarray(i*e,i*(e+A))),s}_sliceChildren(e,A,i){return e.map(n=>n.slice(A,i))}}pi.prototype.children=Object.freeze([]);class ch extends Ut{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:A,["offset"]:i=0,["length"]:n=0}=e;return new pi(A,i,n,n)}visitBool(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length>>3,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitInt(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitFloat(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitUtf8(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitLargeUtf8(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=Nb(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitLargeBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=Nb(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitFixedSizeBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDate(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitTimestamp(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitTime(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDecimal(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitList(e){const{["type"]:A,["offset"]:i=0,["child"]:n}=e,r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,void 0,r],[n])}visitStruct(e){const{["type"]:A,["offset"]:i=0,["children"]:n=[]}=e,r=Xt(e.nullBitmap),{length:s=n.reduce((g,{length:a})=>Math.max(g,a),0),nullCount:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,void 0,r],n)}visitUnion(e){const{["type"]:A,["offset"]:i=0,["children"]:n=[]}=e,r=Qi(A.ArrayType,e.typeIds),{["length"]:s=r.length,["nullCount"]:o=-1}=e;if(zA.isSparseUnion(A))return new pi(A,i,s,o,[void 0,void 0,void 0,r],n);const g=rh(e.valueOffsets);return new pi(A,i,s,o,[g,void 0,void 0,r],n)}visitDictionary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.indices.ArrayType,e.data),{["dictionary"]:s=new Ki([new ch().visit({type:A.dictionary})])}=e,{["length"]:o=r.length,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[void 0,r,n],[],s)}visitInterval(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDuration(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitFixedSizeList(e){const{["type"]:A,["offset"]:i=0,["child"]:n=new ch().visit({type:A.valueType})}=e,r=Xt(e.nullBitmap),{["length"]:s=n.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,void 0,r],[n])}visitMap(e){const{["type"]:A,["offset"]:i=0,["child"]:n=new ch().visit({type:A.childType})}=e,r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,void 0,r],[n])}}const rX=new ch;function Ot(t){return rX.visit(t)}class CR{constructor(e=0,A){this.numChunks=e,this.getChunkIterator=A,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function sX(t){return t.some(e=>e.nullable)}function fR(t){return t.reduce((e,A)=>e+A.nullCount,0)}function ER(t){return t.reduce((e,A,i)=>(e[i+1]=e[i]+A.length,e),new Uint32Array(t.length+1))}function dR(t,e,A,i){const n=[];for(let r=-1,s=t.length;++r<s;){const o=t[r],g=e[r],{length:a}=o;if(g>=i)break;if(A>=g+a)continue;if(g>=A&&g+a<=i){n.push(o);continue}const c=Math.max(0,A-g),l=Math.min(i-g,a);n.push(o.slice(c,l-c))}return n.length===0&&n.push(t[0].slice(0,0)),n}function ty(t,e,A,i){let n=0,r=0,s=e.length-1;do{if(n>=s-1)return A<e[s]?i(t,n,A-e[n]):null;r=n+Math.trunc((s-n)*.5),A<e[r]?s=r:n=r}while(n<s)}function iy(t,e){return t.getValid(e)}function ZC(t){function e(A,i,n){return t(A[i],n)}return function(A){const i=this.data;return ty(i,this._offsets,A,e)}}function QR(t){let e;function A(i,n,r){return t(i[n],r,e)}return function(i,n){const r=this.data;e=n;const s=ty(r,this._offsets,i,A);return e=void 0,s}}function pR(t){let e;function A(i,n,r){let s=r,o=0,g=0;for(let a=n-1,c=i.length;++a<c;){const l=i[a];if(~(o=t(l,e,s)))return g+o;s=0,g+=l.length}return-1}return function(i,n){e=i;const r=this.data,s=typeof n!="number"?A(r,0,0):ty(r,this._offsets,n,A);return e=void 0,s}}class gt extends Ut{}function oX(t,e){return e===null&&t.length>0?0:-1}function aX(t,e){const{nullBitmap:A}=t;if(!A||t.nullCount<=0)return-1;let i=0;for(const n of new Zp(A,t.offset+(e||0),t.length,A,BR)){if(!n)return i;++i}return-1}function pt(t,e,A){if(e===void 0)return-1;if(e===null)switch(t.typeId){case oe.Union:break;case oe.Dictionary:break;default:return aX(t,A)}const i=or.getVisitFn(t),n=$c(e);for(let r=(A||0)-1,s=t.length;++r<s;)if(n(i(t,r)))return r;return-1}function yR(t,e,A){const i=or.getVisitFn(t),n=$c(e);for(let r=(A||0)-1,s=t.length;++r<s;)if(n(i(t,r)))return r;return-1}gt.prototype.visitNull=oX,gt.prototype.visitBool=pt,gt.prototype.visitInt=pt,gt.prototype.visitInt8=pt,gt.prototype.visitInt16=pt,gt.prototype.visitInt32=pt,gt.prototype.visitInt64=pt,gt.prototype.visitUint8=pt,gt.prototype.visitUint16=pt,gt.prototype.visitUint32=pt,gt.prototype.visitUint64=pt,gt.prototype.visitFloat=pt,gt.prototype.visitFloat16=pt,gt.prototype.visitFloat32=pt,gt.prototype.visitFloat64=pt,gt.prototype.visitUtf8=pt,gt.prototype.visitLargeUtf8=pt,gt.prototype.visitBinary=pt,gt.prototype.visitLargeBinary=pt,gt.prototype.visitFixedSizeBinary=pt,gt.prototype.visitDate=pt,gt.prototype.visitDateDay=pt,gt.prototype.visitDateMillisecond=pt,gt.prototype.visitTimestamp=pt,gt.prototype.visitTimestampSecond=pt,gt.prototype.visitTimestampMillisecond=pt,gt.prototype.visitTimestampMicrosecond=pt,gt.prototype.visitTimestampNanosecond=pt,gt.prototype.visitTime=pt,gt.prototype.visitTimeSecond=pt,gt.prototype.visitTimeMillisecond=pt,gt.prototype.visitTimeMicrosecond=pt,gt.prototype.visitTimeNanosecond=pt,gt.prototype.visitDecimal=pt,gt.prototype.visitList=pt,gt.prototype.visitStruct=pt,gt.prototype.visitUnion=pt,gt.prototype.visitDenseUnion=yR,gt.prototype.visitSparseUnion=yR,gt.prototype.visitDictionary=pt,gt.prototype.visitInterval=pt,gt.prototype.visitIntervalDayTime=pt,gt.prototype.visitIntervalYearMonth=pt,gt.prototype.visitDuration=pt,gt.prototype.visitDurationSecond=pt,gt.prototype.visitDurationMillisecond=pt,gt.prototype.visitDurationMicrosecond=pt,gt.prototype.visitDurationNanosecond=pt,gt.prototype.visitFixedSizeList=pt,gt.prototype.visitMap=pt;const ef=new gt;class ct extends Ut{}function Ct(t){const{type:e}=t;if(t.nullCount===0&&t.stride===1&&(zA.isInt(e)&&e.bitWidth!==64||zA.isTime(e)&&e.bitWidth!==64||zA.isFloat(e)&&e.precision!==Un.HALF))return new CR(t.data.length,i=>{const n=t.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let A=0;return new CR(t.data.length,i=>{const r=t.data[i].length,s=t.slice(A,A+r);return A+=r,new gX(s)})}class gX{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}ct.prototype.visitNull=Ct,ct.prototype.visitBool=Ct,ct.prototype.visitInt=Ct,ct.prototype.visitInt8=Ct,ct.prototype.visitInt16=Ct,ct.prototype.visitInt32=Ct,ct.prototype.visitInt64=Ct,ct.prototype.visitUint8=Ct,ct.prototype.visitUint16=Ct,ct.prototype.visitUint32=Ct,ct.prototype.visitUint64=Ct,ct.prototype.visitFloat=Ct,ct.prototype.visitFloat16=Ct,ct.prototype.visitFloat32=Ct,ct.prototype.visitFloat64=Ct,ct.prototype.visitUtf8=Ct,ct.prototype.visitLargeUtf8=Ct,ct.prototype.visitBinary=Ct,ct.prototype.visitLargeBinary=Ct,ct.prototype.visitFixedSizeBinary=Ct,ct.prototype.visitDate=Ct,ct.prototype.visitDateDay=Ct,ct.prototype.visitDateMillisecond=Ct,ct.prototype.visitTimestamp=Ct,ct.prototype.visitTimestampSecond=Ct,ct.prototype.visitTimestampMillisecond=Ct,ct.prototype.visitTimestampMicrosecond=Ct,ct.prototype.visitTimestampNanosecond=Ct,ct.prototype.visitTime=Ct,ct.prototype.visitTimeSecond=Ct,ct.prototype.visitTimeMillisecond=Ct,ct.prototype.visitTimeMicrosecond=Ct,ct.prototype.visitTimeNanosecond=Ct,ct.prototype.visitDecimal=Ct,ct.prototype.visitList=Ct,ct.prototype.visitStruct=Ct,ct.prototype.visitUnion=Ct,ct.prototype.visitDenseUnion=Ct,ct.prototype.visitSparseUnion=Ct,ct.prototype.visitDictionary=Ct,ct.prototype.visitInterval=Ct,ct.prototype.visitIntervalDayTime=Ct,ct.prototype.visitIntervalYearMonth=Ct,ct.prototype.visitDuration=Ct,ct.prototype.visitDurationSecond=Ct,ct.prototype.visitDurationMillisecond=Ct,ct.prototype.visitDurationMicrosecond=Ct,ct.prototype.visitDurationNanosecond=Ct,ct.prototype.visitFixedSizeList=Ct,ct.prototype.visitMap=Ct;const ny=new ct;var mR;const wR={},DR={};let Ki=class wc{constructor(e){var A,i,n;const r=e[0]instanceof wc?e.flatMap(o=>o.data):e;if(r.length===0||r.some(o=>!(o instanceof pi)))throw new TypeError("Vector constructor expects an Array of Data instances.");const s=(A=r[0])===null||A===void 0?void 0:A.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:o,set:g,indexOf:a}=wR[s.typeId],c=r[0];this.isValid=l=>iy(c,l),this.get=l=>o(c,l),this.set=(l,I)=>g(c,l,I),this.indexOf=l=>a(c,l),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,DR[s.typeId]),this._offsets=ER(r);break}this.data=r,this.type=s,this.stride=Do(s),this.numChildren=(n=(i=s.children)===null||i===void 0?void 0:i.length)!==null&&n!==void 0?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,A)=>e+A.byteLength,0)}get nullable(){return sX(this.data)}get nullCount(){return fR(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${oe[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get($p(e,this.length))}set(e,A){}indexOf(e,A){return-1}includes(e,A){return this.indexOf(e,A)>-1}[Symbol.iterator](){return ny.visit(this)}concat(...e){return new wc(this.data.concat(e.flatMap(A=>A.data).flat(Number.POSITIVE_INFINITY)))}slice(e,A){return new wc(IR(this,e,A,({data:i,_offsets:n},r,s)=>dR(i,n,r,s)))}toJSON(){return[...this]}toArray(){const{type:e,data:A,length:i,stride:n,ArrayType:r}=this;switch(e.typeId){case oe.Int:case oe.Float:case oe.Decimal:case oe.Time:case oe.Timestamp:switch(A.length){case 0:return new r;case 1:return A[0].values.subarray(0,i*n);default:return A.reduce((s,{values:o,length:g})=>(s.array.set(o.subarray(0,g*n),s.offset),s.offset+=g*n,s),{array:new r(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var A;return this.getChildAt((A=this.type.children)===null||A===void 0?void 0:A.findIndex(i=>i.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new wc(this.data.map(({children:A})=>A[e])):null}get isMemoized(){return zA.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(zA.isDictionary(this.type)){const e=new Af(this.data[0].dictionary),A=this.data.map(i=>{const n=i.clone();return n.dictionary=e,n});return new wc(A)}return new Af(this)}unmemoize(){if(zA.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),A=this.data.map(i=>{const n=i.clone();return n.dictionary=e,n});return new wc(A)}return this}};mR=Symbol.toStringTag,Ki[mR]=(t=>{t.type=zA.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(oe).map(A=>oe[A]).filter(A=>typeof A=="number"&&A!==oe.NONE);for(const A of e){const i=or.getVisitFnByTypeId(A),n=kr.getVisitFnByTypeId(A),r=ef.getVisitFnByTypeId(A);wR[A]={get:i,set:n,indexOf:r},DR[A]=Object.create(t,{isValid:{value:ZC(iy)},get:{value:ZC(or.getVisitFnByTypeId(A))},set:{value:QR(kr.getVisitFnByTypeId(A))},indexOf:{value:pR(ef.getVisitFnByTypeId(A))}})}return"Vector"})(Ki.prototype);class Af extends Ki{constructor(e){super(e.data);const A=this.get,i=this.set,n=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(s){const o=r[s];if(o!==void 0)return o;const g=A.call(this,s);return r[s]=g,g}}),Object.defineProperty(this,"set",{value(s,o){i.call(this,s,o),r[s]=o}}),Object.defineProperty(this,"slice",{value:(s,o)=>new Af(n.call(this,s,o))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ki(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ry{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,A,i,n){return e.prep(8,24),e.writeInt64(BigInt(n??0)),e.pad(4),e.writeInt32(i),e.writeInt64(BigInt(A??0)),e.offset()}}class fr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFooter(e,A){return(A||new fr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,A){return e.setPosition(e.position()+ui),(A||new fr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):on.V1}schema(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new Ms).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}dictionaries(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new ry).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,A){const i=this.bb.__offset(this.bb_pos,10);return i?(A||new ry).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,12);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,A){e.addFieldInt16(0,A,on.V1)}static addSchema(e,A){e.addFieldOffset(1,A,0)}static addDictionaries(e,A){e.addFieldOffset(2,A,0)}static startDictionariesVector(e,A){e.startVector(24,A,8)}static addRecordBatches(e,A){e.addFieldOffset(3,A,0)}static startRecordBatchesVector(e,A){e.startVector(24,A,8)}static addCustomMetadata(e,A){e.addFieldOffset(4,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,A){e.finish(A)}static finishSizePrefixedFooterBuffer(e,A){e.finish(A,void 0,!0)}}class Bi{constructor(e=[],A,i,n=on.V5){this.fields=e||[],this.metadata=A||new Map,i||(i=sy(this.fields)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,A)=>`${A}: ${e}`).join(", ")} }>`}select(e){const A=new Set(e),i=this.fields.filter(n=>A.has(n.name));return new Bi(i,this.metadata)}selectAt(e){const A=e.map(i=>this.fields[i]).filter(Boolean);return new Bi(A,this.metadata)}assign(...e){const A=e[0]instanceof Bi?e[0]:Array.isArray(e[0])?new Bi(e[0]):new Bi(e),i=[...this.fields],n=tf(tf(new Map,this.metadata),A.metadata),r=A.fields.filter(o=>{const g=i.findIndex(a=>a.name===o.name);return~g?(i[g]=o.clone({metadata:tf(tf(new Map,i[g].metadata),o.metadata)}))&&!1:!0}),s=sy(r,new Map);return new Bi([...i,...r],n,new Map([...this.dictionaries,...s]))}}Bi.prototype.fields=null,Bi.prototype.metadata=null,Bi.prototype.dictionaries=null;class Mi{static new(...e){let[A,i,n,r]=e;return e[0]&&typeof e[0]=="object"&&({name:A}=e[0],i===void 0&&(i=e[0].type),n===void 0&&(n=e[0].nullable),r===void 0&&(r=e[0].metadata)),new Mi(`${A}`,i,n,r)}constructor(e,A,i=!1,n){this.name=e,this.type=A,this.nullable=i,this.metadata=n||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[A,i,n,r]=e;return!e[0]||typeof e[0]!="object"?[A=this.name,i=this.type,n=this.nullable,r=this.metadata]=e:{name:A=this.name,type:i=this.type,nullable:n=this.nullable,metadata:r=this.metadata}=e[0],Mi.new(A,i,n,r)}}Mi.prototype.type=null,Mi.prototype.name=null,Mi.prototype.nullable=null,Mi.prototype.metadata=null;function tf(t,e){return new Map([...t||new Map,...e||new Map])}function sy(t,e=new Map){for(let A=-1,i=t.length;++A<i;){const r=t[A].type;if(zA.isDictionary(r)){if(!e.has(r.id))e.set(r.id,r.dictionary);else if(e.get(r.id)!==r.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}r.children&&r.children.length>0&&sy(r.children,e)}return e}var cX=Ub,lX=Gc;class lh{static decode(e){e=new lX(Xt(e));const A=fr.getRootAsFooter(e),i=Bi.decode(A.schema(),new Map,A.version());return new IX(i,A)}static encode(e){const A=new cX,i=Bi.encode(A,e.schema);fr.startRecordBatchesVector(A,e.numRecordBatches);for(const s of[...e.recordBatches()].slice().reverse())la.encode(A,s);const n=A.endVector();fr.startDictionariesVector(A,e.numDictionaries);for(const s of[...e.dictionaryBatches()].slice().reverse())la.encode(A,s);const r=A.endVector();return fr.startFooter(A),fr.addSchema(A,i),fr.addVersion(A,on.V5),fr.addRecordBatches(A,n),fr.addDictionaries(A,r),fr.finishFooterBuffer(A,fr.endFooter(A)),A.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,A=on.V5,i,n){this.schema=e,this.version=A,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let e,A=-1,i=this.numRecordBatches;++A<i;)(e=this.getRecordBatch(A))&&(yield e)}*dictionaryBatches(){for(let e,A=-1,i=this.numDictionaries;++A<i;)(e=this.getDictionaryBatch(A))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}}class IX extends lh{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,A){super(e,A.version()),this._footer=A}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){const A=this._footer.recordBatches(e);if(A)return la.decode(A)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){const A=this._footer.dictionaries(e);if(A)return la.decode(A)}return null}}class la{static decode(e){return new la(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,A){const{metaDataLength:i}=A,n=BigInt(A.offset),r=BigInt(A.bodyLength);return ry.createBlock(e,n,i,r)}constructor(e,A,i){this.metaDataLength=e,this.offset=vi(i),this.bodyLength=vi(A)}}const Vi=Object.freeze({done:!0,value:void 0});class _R{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class oy{tee(){return this._getDOMStream().tee()}pipe(e,A){return this._getNodeStream().pipe(e,A)}pipeTo(e,A){return this._getDOMStream().pipeTo(e,A)}pipeThrough(e,A){return this._getDOMStream().pipeThrough(e,A)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class hX extends oy{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return mt(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Vi);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return br.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return br.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return mt(this,void 0,void 0,function*(){return yield this.abort(e),Vi})}return(e){return mt(this,void 0,void 0,function*(){return yield this.close(),Vi})}read(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((A,i)=>{this.resolvers.push({resolve:A,reject:i})}):Promise.resolve(Vi)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class nf extends hX{write(e){if((e=Xt(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Lp(this.toUint8Array(!0)):this.toUint8Array(!1).then(Lp)}toUint8Array(e=!1){return e?xs(this._values)[0]:mt(this,void 0,void 0,function*(){var A,i,n,r;const s=[];let o=0;try{for(var g=!0,a=dg(this),c;c=yield a.next(),A=c.done,!A;g=!0){r=c.value,g=!1;const l=r;s.push(l),o+=l.byteLength}}catch(l){i={error:l}}finally{try{!g&&!A&&(n=a.return)&&(yield n.call(a))}finally{if(i)throw i.error}}return xs(s,o)[0]})}}class rf{constructor(e){e&&(this.source=new uX(br.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Zc{constructor(e){e instanceof Zc?this.source=e.source:e instanceof nf?this.source=new mg(br.fromAsyncIterable(e)):Rb(e)?this.source=new mg(br.fromNodeStream(e)):Op(e)?this.source=new mg(br.fromDOMStream(e)):xb(e)?this.source=new mg(br.fromDOMStream(e.body)):nh(e)?this.source=new mg(br.fromIterable(e)):Qg(e)?this.source=new mg(br.fromAsyncIterable(e)):Uc(e)&&(this.source=new mg(br.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class uX{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,A="read"){return this.source.next({cmd:A,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Vi)}return(e){return Object.create(this.source.return&&this.source.return(e)||Vi)}}class mg{constructor(e){this.source=e,this._closedPromise=new Promise(A=>this._closedPromiseResolve=A)}cancel(e){return mt(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return mt(this,arguments,void 0,function*(A,i="read"){return yield this.source.next({cmd:i,size:A})})}throw(e){return mt(this,void 0,void 0,function*(){const A=this.source.throw&&(yield this.source.throw(e))||Vi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(A)})}return(e){return mt(this,void 0,void 0,function*(){const A=this.source.return&&(yield this.source.return(e))||Vi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(A)})}}class SR extends rf{constructor(e,A){super(),this.position=0,this.buffer=Xt(e),this.size=A===void 0?this.buffer.byteLength:A}readInt32(e){const{buffer:A,byteOffset:i}=this.readAt(e,4);return new DataView(A,i).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){const{buffer:A,size:i,position:n}=this;return A&&n<i?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(i,n+Math.min(i-n,e)),A.subarray(n,this.position)):null}readAt(e,A){const i=this.buffer,n=Math.min(this.size,e+A);return i?i.subarray(e,n):new Uint8Array(A)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}}class sf extends Zc{constructor(e,A){super(),this.position=0,this._handle=e,typeof A=="number"?this.size=A:this._pending=mt(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return mt(this,void 0,void 0,function*(){const{buffer:A,byteOffset:i}=yield this.readAt(e,4);return new DataView(A,i).getInt32(0,!0)})}seek(e){return mt(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return mt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:A,size:i,position:n}=this;if(A&&n<i){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let r=n,s=0,o=0;const g=Math.min(i,r+Math.min(i-r,e)),a=new Uint8Array(Math.max(0,(this.position=g)-r));for(;(r+=o)<g&&(s+=o)<a.byteLength;)({bytesRead:o}=yield A.read(a,s,a.byteLength-s,r));return a}return null})}readAt(e,A){return mt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:i,size:n}=this;if(i&&e+A<n){const r=Math.min(n,e+A),s=new Uint8Array(r-e);return(yield i.read(s,0,A,e)).buffer}return new Uint8Array(A)})}close(){return mt(this,void 0,void 0,function*(){const e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return mt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return mt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}const BX=65536;function el(t){return t<0&&(t=4294967295+t+1),`0x${t.toString(16)}`}const Al=8,ay=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class vR{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){const A=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let n=A[3]*i[3];this.buffer[0]=n&65535;let r=n>>>16;return n=A[2]*i[3],r+=n,n=A[3]*i[2]>>>0,r+=n,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0<n?BX:0,this.buffer[1]+=r>>>16,this.buffer[1]+=A[1]*i[3]+A[2]*i[2]+A[3]*i[1],this.buffer[1]+=A[0]*i[3]+A[1]*i[2]+A[2]*i[1]+A[3]*i[0]<<16,this}_plus(e){const A=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],A<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=A}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${el(this.buffer[1])} ${el(this.buffer[0])}`}}class yi extends vR{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,A=new Uint32Array(2)){return yi.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(2)){return yi.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(2)){const i=e.length,n=new yi(A);for(let r=0;r<i;){const s=Al<i-r?Al:i-r,o=new yi(new Uint32Array([Number.parseInt(e.slice(r,r+s),10),0])),g=new yi(new Uint32Array([ay[s],0]));n.times(g),n.plus(o),r+=s}return n}static convertArray(e){const A=new Uint32Array(e.length*2);for(let i=-1,n=e.length;++i<n;)yi.from(e[i],new Uint32Array(A.buffer,A.byteOffset+2*i*4,2));return A}static multiply(e,A){return new yi(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new yi(new Uint32Array(e.buffer)).plus(A)}}class ar extends vR{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){const A=this.buffer[1]<<0,i=e.buffer[1]<<0;return A<i||A===i&&this.buffer[0]<e.buffer[0]}static from(e,A=new Uint32Array(2)){return ar.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(2)){return ar.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(2)){const i=e.startsWith("-"),n=e.length,r=new ar(A);for(let s=i?1:0;s<n;){const o=Al<n-s?Al:n-s,g=new ar(new Uint32Array([Number.parseInt(e.slice(s,s+o),10),0])),a=new ar(new Uint32Array([ay[o],0]));r.times(a),r.plus(g),s+=o}return i?r.negate():r}static convertArray(e){const A=new Uint32Array(e.length*2);for(let i=-1,n=e.length;++i<n;)ar.from(e[i],new Uint32Array(A.buffer,A.byteOffset+2*i*4,2));return A}static multiply(e,A){return new ar(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new ar(new Uint32Array(e.buffer)).plus(A)}}class Ts{constructor(e){this.buffer=e}high(){return new ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){const A=new yi(new Uint32Array([this.buffer[3],0])),i=new yi(new Uint32Array([this.buffer[2],0])),n=new yi(new Uint32Array([this.buffer[1],0])),r=new yi(new Uint32Array([this.buffer[0],0])),s=new yi(new Uint32Array([e.buffer[3],0])),o=new yi(new Uint32Array([e.buffer[2],0])),g=new yi(new Uint32Array([e.buffer[1],0])),a=new yi(new Uint32Array([e.buffer[0],0]));let c=yi.multiply(r,a);this.buffer[0]=c.low();const l=new yi(new Uint32Array([c.high(),0]));return c=yi.multiply(n,a),l.plus(c),c=yi.multiply(r,g),l.plus(c),this.buffer[1]=l.low(),this.buffer[3]=l.lessThan(c)?1:0,this.buffer[2]=l.high(),new yi(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(yi.multiply(i,a)).plus(yi.multiply(n,g)).plus(yi.multiply(r,o)),this.buffer[3]+=yi.multiply(A,a).plus(yi.multiply(i,g)).plus(yi.multiply(n,o)).plus(yi.multiply(r,s)).low(),this}plus(e){const A=new Uint32Array(4);return A[3]=this.buffer[3]+e.buffer[3]>>>0,A[2]=this.buffer[2]+e.buffer[2]>>>0,A[1]=this.buffer[1]+e.buffer[1]>>>0,A[0]=this.buffer[0]+e.buffer[0]>>>0,A[0]<this.buffer[0]>>>0&&++A[1],A[1]<this.buffer[1]>>>0&&++A[2],A[2]<this.buffer[2]>>>0&&++A[3],this.buffer[3]=A[3],this.buffer[2]=A[2],this.buffer[1]=A[1],this.buffer[0]=A[0],this}hex(){return`${el(this.buffer[3])} ${el(this.buffer[2])} ${el(this.buffer[1])} ${el(this.buffer[0])}`}static multiply(e,A){return new Ts(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new Ts(new Uint32Array(e.buffer)).plus(A)}static from(e,A=new Uint32Array(4)){return Ts.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(4)){return Ts.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(4)){const i=e.startsWith("-"),n=e.length,r=new Ts(A);for(let s=i?1:0;s<n;){const o=Al<n-s?Al:n-s,g=new Ts(new Uint32Array([Number.parseInt(e.slice(s,s+o),10),0,0,0])),a=new Ts(new Uint32Array([ay[o],0,0,0]));r.times(a),r.plus(g),s+=o}return i?r.negate():r}static convertArray(e){const A=new Uint32Array(e.length*4);for(let i=-1,n=e.length;++i<n;)Ts.from(e[i],new Uint32Array(A.buffer,A.byteOffset+4*4*i,4));return A}}class bR extends Ut{constructor(e,A,i,n,r=on.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=A,this.buffers=i,this.dictionaries=n,this.metadataVersion=r}visit(e){return super.visit(e instanceof Mi?e.type:e)}visitNull(e,{length:A}=this.nextFieldNode()){return Ot({type:e,length:A})}visitBool(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitInt(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitFloat(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitUtf8(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDate(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitTimestamp(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitTime(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDecimal(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitList(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),children:this.visitMany(e.children)})}visitUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<on.V5&&this.readNullBitmap(e,i),e.mode===Ln.Sparse?this.visitSparseUnion(e,{length:A,nullCount:i}):this.visitDenseUnion(e,{length:A,nullCount:i})}visitDenseUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDuration(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitFixedSizeList(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),child:this.visit(e.children[0])})}visitMap(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,A,i=this.nextBufferRange()){return A>0&&this.readData(e,i)||new Uint8Array(0)}readOffsets(e,A){return this.readData(e,A)}readTypeIds(e,A){return this.readData(e,A)}readData(e,{length:A,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+A)}readDictionary(e){return this.dictionaries.get(e.id)}}class CX extends bR{constructor(e,A,i,n,r){super(new Uint8Array(0),A,i,n,r),this.sources=e}readNullBitmap(e,A,{offset:i}=this.nextBufferRange()){return A<=0?new Uint8Array(0):$C(this.sources[i])}readOffsets(e,{offset:A}=this.nextBufferRange()){return Qi(Uint8Array,Qi(e.OffsetArrayType,this.sources[A]))}readTypeIds(e,{offset:A}=this.nextBufferRange()){return Qi(Uint8Array,Qi(e.ArrayType,this.sources[A]))}readData(e,{offset:A}=this.nextBufferRange()){const{sources:i}=this;return zA.isTimestamp(e)||(zA.isInt(e)||zA.isTime(e))&&e.bitWidth===64||zA.isDuration(e)||zA.isDate(e)&&e.unit===xr.MILLISECOND?Qi(Uint8Array,ar.convertArray(i[A])):zA.isDecimal(e)?Qi(Uint8Array,Ts.convertArray(i[A])):zA.isBinary(e)||zA.isLargeBinary(e)||zA.isFixedSizeBinary(e)?fX(i[A]):zA.isBool(e)?$C(i[A]):zA.isUtf8(e)||zA.isLargeUtf8(e)?Up(i[A].join("")):Qi(Uint8Array,Qi(e.ArrayType,i[A].map(n=>+n)))}}function fX(t){const e=t.join(""),A=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)A[i>>1]=Number.parseInt(e.slice(i,i+2),16);return A}class lt extends Ut{compareSchemas(e,A){return e===A||A instanceof e.constructor&&this.compareManyFields(e.fields,A.fields)}compareManyFields(e,A){return e===A||Array.isArray(e)&&Array.isArray(A)&&e.length===A.length&&e.every((i,n)=>this.compareFields(i,A[n]))}compareFields(e,A){return e===A||A instanceof e.constructor&&e.name===A.name&&e.nullable===A.nullable&&this.visit(e.type,A.type)}}function jn(t,e){return e instanceof t.constructor}function wg(t,e){return t===e||jn(t,e)}function So(t,e){return t===e||jn(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function of(t,e){return t===e||jn(t,e)&&t.precision===e.precision}function EX(t,e){return t===e||jn(t,e)&&t.byteWidth===e.byteWidth}function gy(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function Ih(t,e){return t===e||jn(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function hh(t,e){return t===e||jn(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function dX(t,e){return t===e||jn(t,e)&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function QX(t,e){return t===e||jn(t,e)&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function cy(t,e){return t===e||jn(t,e)&&t.mode===e.mode&&t.typeIds.every((A,i)=>A===e.typeIds[i])&&Ia.compareManyFields(t.children,e.children)}function pX(t,e){return t===e||jn(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&Ia.visit(t.indices,e.indices)&&Ia.visit(t.dictionary,e.dictionary)}function ly(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function uh(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function yX(t,e){return t===e||jn(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function mX(t,e){return t===e||jn(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}lt.prototype.visitNull=wg,lt.prototype.visitBool=wg,lt.prototype.visitInt=So,lt.prototype.visitInt8=So,lt.prototype.visitInt16=So,lt.prototype.visitInt32=So,lt.prototype.visitInt64=So,lt.prototype.visitUint8=So,lt.prototype.visitUint16=So,lt.prototype.visitUint32=So,lt.prototype.visitUint64=So,lt.prototype.visitFloat=of,lt.prototype.visitFloat16=of,lt.prototype.visitFloat32=of,lt.prototype.visitFloat64=of,lt.prototype.visitUtf8=wg,lt.prototype.visitLargeUtf8=wg,lt.prototype.visitBinary=wg,lt.prototype.visitLargeBinary=wg,lt.prototype.visitFixedSizeBinary=EX,lt.prototype.visitDate=gy,lt.prototype.visitDateDay=gy,lt.prototype.visitDateMillisecond=gy,lt.prototype.visitTimestamp=Ih,lt.prototype.visitTimestampSecond=Ih,lt.prototype.visitTimestampMillisecond=Ih,lt.prototype.visitTimestampMicrosecond=Ih,lt.prototype.visitTimestampNanosecond=Ih,lt.prototype.visitTime=hh,lt.prototype.visitTimeSecond=hh,lt.prototype.visitTimeMillisecond=hh,lt.prototype.visitTimeMicrosecond=hh,lt.prototype.visitTimeNanosecond=hh,lt.prototype.visitDecimal=wg,lt.prototype.visitList=dX,lt.prototype.visitStruct=QX,lt.prototype.visitUnion=cy,lt.prototype.visitDenseUnion=cy,lt.prototype.visitSparseUnion=cy,lt.prototype.visitDictionary=pX,lt.prototype.visitInterval=ly,lt.prototype.visitIntervalDayTime=ly,lt.prototype.visitIntervalYearMonth=ly,lt.prototype.visitDuration=uh,lt.prototype.visitDurationSecond=uh,lt.prototype.visitDurationMillisecond=uh,lt.prototype.visitDurationMicrosecond=uh,lt.prototype.visitDurationNanosecond=uh,lt.prototype.visitFixedSizeList=yX,lt.prototype.visitMap=mX;const Ia=new lt;function Iy(t,e){return Ia.compareSchemas(t,e)}function hy(t,e){return wX(t,e.map(A=>A.data.concat()))}function wX(t,e){const A=[...t.fields],i=[],n={numBatches:e.reduce((l,I)=>Math.max(l,I.length),0)};let r=0,s=0,o=-1;const g=e.length;let a,c=[];for(;n.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,o=-1;++o<g;)c[o]=a=e[o].shift(),s=Math.min(s,a?a.length:s);Number.isFinite(s)&&(c=DX(A,s,c,e,n),s>0&&(i[r++]=Ot({type:new Xn(A),length:s,nullCount:0,children:c.slice()})))}return[t=t.assign(A),i.map(l=>new gr(t,l))]}function DX(t,e,A,i,n){var r;const s=(e+63&-64)>>3;for(let o=-1,g=i.length;++o<g;){const a=A[o],c=a==null?void 0:a.length;if(c>=e)c===e?A[o]=a:(A[o]=a.slice(0,e),n.numBatches=Math.max(n.numBatches,i[o].unshift(a.slice(e,c-e))));else{const l=t[o];t[o]=l.clone({nullable:!0}),A[o]=(r=a==null?void 0:a._changeLengthAndBackfillNullBitmap(e))!==null&&r!==void 0?r:Ot({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)})}}return A}var xR;class $n{constructor(...e){var A,i;if(e.length===0)return this.batches=[],this.schema=new Bi([]),this._offsets=[0],this;let n,r;e[0]instanceof Bi&&(n=e.shift()),e.at(-1)instanceof Uint32Array&&(r=e.pop());const s=g=>{if(g){if(g instanceof gr)return[g];if(g instanceof $n)return g.batches;if(g instanceof pi){if(g.type instanceof Xn)return[new gr(new Bi(g.type.children),g)]}else{if(Array.isArray(g))return g.flatMap(a=>s(a));if(typeof g[Symbol.iterator]=="function")return[...g].flatMap(a=>s(a));if(typeof g=="object"){const a=Object.keys(g),c=a.map(h=>new Ki([g[h]])),l=n??new Bi(a.map((h,u)=>new Mi(String(h),c[u].type,c[u].nullable))),[,I]=hy(l,c);return I.length===0?[new gr(g)]:I}}}return[]},o=e.flatMap(g=>s(g));if(n=(i=n??((A=o[0])===null||A===void 0?void 0:A.schema))!==null&&i!==void 0?i:new Bi([]),!(n instanceof Bi))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const g of o){if(!(g instanceof gr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Iy(n,g.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=o,this._offsets=r??ER(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,A)=>e+A.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=fR(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get($p(e,this.numRows))}set(e,A){}indexOf(e,A){return-1}[Symbol.iterator](){return this.batches.length>0?ny.visit(new Ki(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
100
|
+
`)),o=B.computed(()=>({json:"language-json",csv:"language-csv",xml:"language-xml",yaml:"language-yaml",yml:"language-yaml",log:"language-log",text:"language-text"})[e.fileType]||"language-text"),g=B.computed(()=>({type:e.fileType.toUpperCase(),lines:s.value.length,characters:r.value.length}));async function a(){if(e.src){i.value=!0,n.value=null;try{const l=await fetch(e.src);if(!l.ok)throw new Error(`Failed to fetch: ${l.statusText}`);A.value=await l.text()}catch(l){n.value=l.message}finally{i.value=!1}}}function c(){navigator.clipboard.writeText(r.value)}return B.watch(()=>e.src,l=>{l&&!e.content&&a()},{immediate:!0}),B.watch(()=>e.content,l=>{l&&(A.value=l)},{immediate:!0}),(l,I)=>(B.openBlock(),B.createElementBlock("div",J5,[i.value?(B.openBlock(),B.createElementBlock("div",Y5,"Loading content...")):n.value?(B.openBlock(),B.createElementBlock("div",K5,[I[0]||(I[0]=B.createElementVNode("strong",null,"Error loading file:",-1)),B.createTextVNode(" "+B.toDisplayString(n.value),1)])):A.value?(B.openBlock(),B.createElementBlock(B.Fragment,{key:3},[B.createElementVNode("div",{class:"text-viewer__content",style:B.normalizeStyle({maxHeight:t.maxHeight,whiteSpace:t.wrapText?"pre-wrap":"pre"})},[B.createElementVNode("div",W5,[t.showLineNumbers?(B.openBlock(),B.createElementBlock("div",z5,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(s.value,(h,u)=>(B.openBlock(),B.createElementBlock("div",{key:u,class:"text-viewer__line-number"},B.toDisplayString(u+1),1))),128))])):B.createCommentVNode("",!0),B.createElementVNode("pre",{class:B.normalizeClass(["text-viewer__code-block",o.value])},[B.createElementVNode("code",null,B.toDisplayString(r.value),1)],2)])],4),B.createElementVNode("div",X5,[B.createElementVNode("span",j5,B.toDisplayString(g.value.type)+" | "+B.toDisplayString(g.value.lines)+" lines | "+B.toDisplayString(g.value.characters)+" characters ",1),B.createElementVNode("button",{onClick:c,class:"text-viewer__copy-button"}," Copy to Clipboard ")])],64)):(B.openBlock(),B.createElementBlock("div",V5,"No content available"))]))}}),Z5=co($5,[["__scopeId","data-v-4007de4f"]]);B.defineAsyncComponent(()=>Promise.resolve().then(()=>kee).then(t=>t.DataExplorer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Mee).then(t=>t.UMAP)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Tee).then(t=>t.Markdown)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>Lee).then(t=>t.TextViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>$ee).then(t=>t.ProportionPlot)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>tAe).then(t=>t.AiPlotly)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>iAe).then(t=>t.TSViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>l4).then(t=>t.OmeViewer)),B.defineAsyncComponent(()=>Promise.resolve().then(()=>l4).then(t=>t.TiffViewer));const c2="dashboard:globalVars";function Ig(t=!1){const e=B.inject(c2,null);return!e&&t&&console.warn("[Widget] dashboard:globalVars not provided."),e}const eK={class:"data-explorer-wrap"},AK={class:"data-explorer-info"},tK=B.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(t){const e=Ig(),A=B.ref("Data Explorer"),i=B.computed(()=>{var n;return(n=B.unref(e==null?void 0:e.services))==null?void 0:n.s3Url});return B.watchEffect(()=>{}),(n,r)=>{const s=B.resolveComponent("el-icon");return B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(n.$slots,"default",{widgetName:A.value},void 0,!0),B.createElementVNode("div",eK,[B.createElementVNode("div",AK,[B.createVNode(B.unref(Dc.ElTooltip),{placement:"top-start"},{content:B.withCtx(()=>[...r[0]||(r[0]=[B.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])]),default:B.withCtx(()=>[B.createVNode(s,{color:"#8300BF"},{default:B.withCtx(()=>[B.createVNode(B.unref(uq))]),_:1})]),_:1})]),B.createVNode(B.unref(G1),{srcUrl:i.value},null,8,["srcUrl"])])],64)}}}),_s=(t,e)=>{const A=t.__vccOpts||t;for(const[i,n]of e)A[i]=n;return A},iK=_s(tK,[["__scopeId","data-v-dcb02f80"]]),nK={class:"umap-wrap"},rK=_s(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(t){const e=Ig(),A=B.ref("Data Explorer"),i=B.computed(()=>{var n;return(n=B.unref(e==null?void 0:e.services))==null?void 0:n.s3Url});return(n,r)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(n.$slots,"default",{widgetName:A.value},void 0,!0),B.createElementVNode("div",nK,[B.createVNode(B.unref(Mv),{srcUrl:i.value},null,8,["srcUrl"])])],64))}}),[["__scopeId","data-v-0bdda911"]]),KI=B0.defineStore("precisionGlobalVars",()=>{const t=B.ref(null),e=B.ref(null),A=B.ref(null),i=B.ref(null),n=B.ref(null);function r(l){t.value=l===""?null:l}function s(l){e.value=l===""?null:l}function o(l){A.value=l===""?null:l}function g(l){i.value=l===""?null:l}function a(l){n.value=l===""?null:l}function c(l,I){switch(l){case"selectedGene":r(I);break;case"selectedMetadataColumn":s(I);break;case"selectedGene1":o(I);break;case"selectedGene2":g(I);break;case"selectedGeneX":a(I);break;default:console.warn(`Unknown selection key: ${l}`)}}return{selectedGene:t,selectedMetadataColumn:e,selectedGene1:A,selectedGene2:i,selectedGeneX:n,setSelectedGene:r,setSelectedMetadataColumn:s,setSelectedGene1:o,setSelectedGene2:g,setSelectedGeneX:a,setSelection:c}});function hg(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function sK(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function l2(t){let e,A,i;t.length!==2?(e=hg,A=(o,g)=>hg(t(o),g),i=(o,g)=>t(o)-g):(e=t===hg||t===sK?t:oK,A=t,i=t);function n(o,g,a=0,c=o.length){if(a<c){if(e(g,g)!==0)return c;do{const l=a+c>>>1;A(o[l],g)<0?a=l+1:c=l}while(a<c)}return a}function r(o,g,a=0,c=o.length){if(a<c){if(e(g,g)!==0)return c;do{const l=a+c>>>1;A(o[l],g)<=0?a=l+1:c=l}while(a<c)}return a}function s(o,g,a=0,c=o.length){const l=n(o,g,a,c-1);return l>a&&i(o[l-1],g)>-i(o[l],g)?l-1:l}return{left:n,center:s,right:r}}function oK(){return 0}function aK(t){return t===null?NaN:+t}function*gK(t,e){for(let A of t)A!=null&&(A=+A)>=A&&(yield A)}const cK=l2(hg).right;l2(aK).center;function lK(t,e){let A=0,i,n=0,r=0;for(let s of t)s!=null&&(s=+s)>=s&&(i=s-n,n+=i/++A,r+=i*(s-n));if(A>1)return r/(A-1)}function IK(t,e){const A=lK(t);return A&&Math.sqrt(A)}function Co(t,e){let A,i;if(e===void 0)for(const n of t)n!=null&&(A===void 0?n>=n&&(A=i=n):(A>n&&(A=n),i<n&&(i=n)));else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(A===void 0?r>=r&&(A=i=r):(A>r&&(A=r),i<r&&(i=r)))}return[A,i]}class I2 extends Map{constructor(e,A=BK){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:A}}),e!=null)for(const[i,n]of e)this.set(i,n)}get(e){return super.get(h2(this,e))}has(e){return super.has(h2(this,e))}set(e,A){return super.set(hK(this,e),A)}delete(e){return super.delete(uK(this,e))}}function h2({_intern:t,_key:e},A){const i=e(A);return t.has(i)?t.get(i):A}function hK({_intern:t,_key:e},A){const i=e(A);return t.has(i)?t.get(i):(t.set(i,A),A)}function uK({_intern:t,_key:e},A){const i=e(A);return t.has(i)&&(A=t.get(i),t.delete(i)),A}function BK(t){return t!==null&&typeof t=="object"?t.valueOf():t}function CK(t=hg){if(t===hg)return u2;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,A)=>{const i=t(e,A);return i||i===0?i:(t(A,A)===0)-(t(e,e)===0)}}function u2(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const fK=Math.sqrt(50),EK=Math.sqrt(10),dK=Math.sqrt(2);function XB(t,e,A){const i=(e-t)/Math.max(0,A),n=Math.floor(Math.log10(i)),r=i/Math.pow(10,n),s=r>=fK?10:r>=EK?5:r>=dK?2:1;let o,g,a;return n<0?(a=Math.pow(10,-n)/s,o=Math.round(t*a),g=Math.round(e*a),o/a<t&&++o,g/a>e&&--g,a=-a):(a=Math.pow(10,n)*s,o=Math.round(t/a),g=Math.round(e/a),o*a<t&&++o,g*a>e&&--g),g<o&&.5<=A&&A<2?XB(t,e,A*2):[o,g,a]}function QK(t,e,A){if(e=+e,t=+t,A=+A,!(A>0))return[];if(t===e)return[t];const i=e<t,[n,r,s]=i?XB(e,t,A):XB(t,e,A);if(!(r>=n))return[];const o=r-n+1,g=new Array(o);if(i)if(s<0)for(let a=0;a<o;++a)g[a]=(r-a)/-s;else for(let a=0;a<o;++a)g[a]=(r-a)*s;else if(s<0)for(let a=0;a<o;++a)g[a]=(n+a)/-s;else for(let a=0;a<o;++a)g[a]=(n+a)*s;return g}function Ap(t,e,A){return e=+e,t=+t,A=+A,XB(t,e,A)[2]}function pK(t,e,A){e=+e,t=+t,A=+A;const i=e<t,n=i?Ap(e,t,A):Ap(t,e,A);return(i?-1:1)*(n<0?1/-n:n)}function jB(t,e){let A;if(e===void 0)for(const i of t)i!=null&&(A<i||A===void 0&&i>=i)&&(A=i);else{let i=-1;for(let n of t)(n=e(n,++i,t))!=null&&(A<n||A===void 0&&n>=n)&&(A=n)}return A}function tp(t,e){let A;for(const i of t)i!=null&&(A>i||A===void 0&&i>=i)&&(A=i);return A}function B2(t,e,A=0,i=1/0,n){if(e=Math.floor(e),A=Math.floor(Math.max(0,A)),i=Math.floor(Math.min(t.length-1,i)),!(A<=e&&e<=i))return t;for(n=n===void 0?u2:CK(n);i>A;){if(i-A>600){const g=i-A+1,a=e-A+1,c=Math.log(g),l=.5*Math.exp(2*c/3),I=.5*Math.sqrt(c*l*(g-l)/g)*(a-g/2<0?-1:1),h=Math.max(A,Math.floor(e-a*l/g+I)),u=Math.min(i,Math.floor(e+(g-a)*l/g+I));B2(t,e,h,u,n)}const r=t[e];let s=A,o=i;for(VI(t,A,e),n(t[i],r)>0&&VI(t,A,i);s<o;){for(VI(t,s,o),++s,--o;n(t[s],r)<0;)++s;for(;n(t[o],r)>0;)--o}n(t[A],r)===0?VI(t,A,o):(++o,VI(t,o,i)),o<=e&&(A=o+1),e<=o&&(i=o-1)}return t}function VI(t,e,A){const i=t[e];t[e]=t[A],t[A]=i}function ip(t,e,A){if(t=Float64Array.from(gK(t)),!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return tp(t);if(e>=1)return jB(t);var i,n=(i-1)*e,r=Math.floor(n),s=jB(B2(t,r).subarray(0,r+1)),o=tp(t.subarray(r+1));return s+(o-s)*(n-r)}}function yK(t,e){let A=0,i=0;if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(++A,i+=n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(++A,i+=r)}if(A)return i/A}function mK(t,e){return ip(t,.5)}function wK(t,e,A){t=+t,e=+e,A=(n=arguments.length)<2?(e=t,t=0,1):n<3?1:+A;for(var i=-1,n=Math.max(0,Math.ceil((e-t)/A))|0,r=new Array(n);++i<n;)r[i]=t+i*A;return r}function DK(t){return t}var np=1,rp=2,sp=3,WI=4,C2=1e-6;function _K(t){return"translate("+t+",0)"}function SK(t){return"translate(0,"+t+")"}function vK(t){return e=>+t(e)}function bK(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),A=>+t(A)+e}function xK(){return!this.__axis}function f2(t,e){var A=[],i=null,n=null,r=6,s=6,o=3,g=typeof window<"u"&&window.devicePixelRatio>1?0:.5,a=t===np||t===WI?-1:1,c=t===WI||t===rp?"x":"y",l=t===np||t===sp?_K:SK;function I(h){var u=i??(e.ticks?e.ticks.apply(e,A):e.domain()),E=n??(e.tickFormat?e.tickFormat.apply(e,A):DK),C=Math.max(r,0)+o,f=e.range(),y=+f[0]+g,Q=+f[f.length-1]+g,d=(e.bandwidth?bK:vK)(e.copy(),g),w=h.selection?h.selection():h,p=w.selectAll(".domain").data([null]),m=w.selectAll(".tick").data(u,e).order(),D=m.exit(),x=m.enter().append("g").attr("class","tick"),N=m.select("line"),F=m.select("text");p=p.merge(p.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),m=m.merge(x),N=N.merge(x.append("line").attr("stroke","currentColor").attr(c+"2",a*r)),F=F.merge(x.append("text").attr("fill","currentColor").attr(c,a*C).attr("dy",t===np?"0em":t===sp?"0.71em":"0.32em")),h!==w&&(p=p.transition(h),m=m.transition(h),N=N.transition(h),F=F.transition(h),D=D.transition(h).attr("opacity",C2).attr("transform",function(M){return isFinite(M=d(M))?l(M+g):this.getAttribute("transform")}),x.attr("opacity",C2).attr("transform",function(M){var k=this.parentNode.__axis;return l((k&&isFinite(k=k(M))?k:d(M))+g)})),D.remove(),p.attr("d",t===WI||t===rp?s?"M"+a*s+","+y+"H"+g+"V"+Q+"H"+a*s:"M"+g+","+y+"V"+Q:s?"M"+y+","+a*s+"V"+g+"H"+Q+"V"+a*s:"M"+y+","+g+"H"+Q),m.attr("opacity",1).attr("transform",function(M){return l(d(M)+g)}),N.attr(c+"2",a*r),F.attr(c,a*C).text(E),w.filter(xK).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===rp?"start":t===WI?"end":"middle"),w.each(function(){this.__axis=d})}return I.scale=function(h){return arguments.length?(e=h,I):e},I.ticks=function(){return A=Array.from(arguments),I},I.tickArguments=function(h){return arguments.length?(A=h==null?[]:Array.from(h),I):A.slice()},I.tickValues=function(h){return arguments.length?(i=h==null?null:Array.from(h),I):i&&i.slice()},I.tickFormat=function(h){return arguments.length?(n=h,I):n},I.tickSize=function(h){return arguments.length?(r=s=+h,I):r},I.tickSizeInner=function(h){return arguments.length?(r=+h,I):r},I.tickSizeOuter=function(h){return arguments.length?(s=+h,I):s},I.tickPadding=function(h){return arguments.length?(o=+h,I):o},I.offset=function(h){return arguments.length?(g=+h,I):g},I}function E2(t){return f2(sp,t)}function d2(t){return f2(WI,t)}var RK={value:()=>{}};function op(){for(var t=0,e=arguments.length,A={},i;t<e;++t){if(!(i=arguments[t]+"")||i in A||/[\s.]/.test(i))throw new Error("illegal type: "+i);A[i]=[]}return new $B(A)}function $B(t){this._=t}function FK(t,e){return t.trim().split(/^|\s+/).map(function(A){var i="",n=A.indexOf(".");if(n>=0&&(i=A.slice(n+1),A=A.slice(0,n)),A&&!e.hasOwnProperty(A))throw new Error("unknown type: "+A);return{type:A,name:i}})}$B.prototype=op.prototype={constructor:$B,on:function(t,e){var A=this._,i=FK(t+"",A),n,r=-1,s=i.length;if(arguments.length<2){for(;++r<s;)if((n=(t=i[r]).type)&&(n=NK(A[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<s;)if(n=(t=i[r]).type)A[n]=Q2(A[n],t.name,e);else if(e==null)for(n in A)A[n]=Q2(A[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var A in e)t[A]=e[A].slice();return new $B(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var A=new Array(n),i=0,n,r;i<n;++i)A[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],i=0,n=r.length;i<n;++i)r[i].value.apply(e,A)},apply:function(t,e,A){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],n=0,r=i.length;n<r;++n)i[n].value.apply(e,A)}};function NK(t,e){for(var A=0,i=t.length,n;A<i;++A)if((n=t[A]).name===e)return n.value}function Q2(t,e,A){for(var i=0,n=t.length;i<n;++i)if(t[i].name===e){t[i]=RK,t=t.slice(0,i).concat(t.slice(i+1));break}return A!=null&&t.push({name:e,value:A}),t}var ap="http://www.w3.org/1999/xhtml";const p2={svg:"http://www.w3.org/2000/svg",xhtml:ap,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ZB(t){var e=t+="",A=e.indexOf(":");return A>=0&&(e=t.slice(0,A))!=="xmlns"&&(t=t.slice(A+1)),p2.hasOwnProperty(e)?{space:p2[e],local:t}:t}function kK(t){return function(){var e=this.ownerDocument,A=this.namespaceURI;return A===ap&&e.documentElement.namespaceURI===ap?e.createElement(t):e.createElementNS(A,t)}}function MK(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function y2(t){var e=ZB(t);return(e.local?MK:kK)(e)}function TK(){}function gp(t){return t==null?TK:function(){return this.querySelector(t)}}function LK(t){typeof t!="function"&&(t=gp(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=new Array(s),g,a,c=0;c<s;++c)(g=r[c])&&(a=t.call(g,g.__data__,c,r))&&("__data__"in g&&(a.__data__=g.__data__),o[c]=a);return new ur(i,this._parents)}function UK(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function GK(){return[]}function m2(t){return t==null?GK:function(){return this.querySelectorAll(t)}}function OK(t){return function(){return UK(t.apply(this,arguments))}}function PK(t){typeof t=="function"?t=OK(t):t=m2(t);for(var e=this._groups,A=e.length,i=[],n=[],r=0;r<A;++r)for(var s=e[r],o=s.length,g,a=0;a<o;++a)(g=s[a])&&(i.push(t.call(g,g.__data__,a,s)),n.push(g));return new ur(i,n)}function w2(t){return function(){return this.matches(t)}}function D2(t){return function(e){return e.matches(t)}}var qK=Array.prototype.find;function HK(t){return function(){return qK.call(this.children,t)}}function JK(){return this.firstElementChild}function YK(t){return this.select(t==null?JK:HK(typeof t=="function"?t:D2(t)))}var KK=Array.prototype.filter;function VK(){return Array.from(this.children)}function WK(t){return function(){return KK.call(this.children,t)}}function zK(t){return this.selectAll(t==null?VK:WK(typeof t=="function"?t:D2(t)))}function XK(t){typeof t!="function"&&(t=w2(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=[],g,a=0;a<s;++a)(g=r[a])&&t.call(g,g.__data__,a,r)&&o.push(g);return new ur(i,this._parents)}function _2(t){return new Array(t.length)}function jK(){return new ur(this._enter||this._groups.map(_2),this._parents)}function eC(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}eC.prototype={constructor:eC,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function $K(t){return function(){return t}}function ZK(t,e,A,i,n,r){for(var s=0,o,g=e.length,a=r.length;s<a;++s)(o=e[s])?(o.__data__=r[s],i[s]=o):A[s]=new eC(t,r[s]);for(;s<g;++s)(o=e[s])&&(n[s]=o)}function eV(t,e,A,i,n,r,s){var o,g,a=new Map,c=e.length,l=r.length,I=new Array(c),h;for(o=0;o<c;++o)(g=e[o])&&(I[o]=h=s.call(g,g.__data__,o,e)+"",a.has(h)?n[o]=g:a.set(h,g));for(o=0;o<l;++o)h=s.call(t,r[o],o,r)+"",(g=a.get(h))?(i[o]=g,g.__data__=r[o],a.delete(h)):A[o]=new eC(t,r[o]);for(o=0;o<c;++o)(g=e[o])&&a.get(I[o])===g&&(n[o]=g)}function AV(t){return t.__data__}function tV(t,e){if(!arguments.length)return Array.from(this,AV);var A=e?eV:ZK,i=this._parents,n=this._groups;typeof t!="function"&&(t=$K(t));for(var r=n.length,s=new Array(r),o=new Array(r),g=new Array(r),a=0;a<r;++a){var c=i[a],l=n[a],I=l.length,h=iV(t.call(c,c&&c.__data__,a,i)),u=h.length,E=o[a]=new Array(u),C=s[a]=new Array(u),f=g[a]=new Array(I);A(c,l,E,C,f,h,e);for(var y=0,Q=0,d,w;y<u;++y)if(d=E[y]){for(y>=Q&&(Q=y+1);!(w=C[Q])&&++Q<u;);d._next=w||null}}return s=new ur(s,i),s._enter=o,s._exit=g,s}function iV(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function nV(){return new ur(this._exit||this._groups.map(_2),this._parents)}function rV(t,e,A){var i=this.enter(),n=this,r=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(n=e(n),n&&(n=n.selection())),A==null?r.remove():A(r),i&&n?i.merge(n).order():n}function sV(t){for(var e=t.selection?t.selection():t,A=this._groups,i=e._groups,n=A.length,r=i.length,s=Math.min(n,r),o=new Array(n),g=0;g<s;++g)for(var a=A[g],c=i[g],l=a.length,I=o[g]=new Array(l),h,u=0;u<l;++u)(h=a[u]||c[u])&&(I[u]=h);for(;g<n;++g)o[g]=A[g];return new ur(o,this._parents)}function oV(){for(var t=this._groups,e=-1,A=t.length;++e<A;)for(var i=t[e],n=i.length-1,r=i[n],s;--n>=0;)(s=i[n])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function aV(t){t||(t=gV);function e(l,I){return l&&I?t(l.__data__,I.__data__):!l-!I}for(var A=this._groups,i=A.length,n=new Array(i),r=0;r<i;++r){for(var s=A[r],o=s.length,g=n[r]=new Array(o),a,c=0;c<o;++c)(a=s[c])&&(g[c]=a);g.sort(e)}return new ur(n,this._parents).order()}function gV(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function cV(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function lV(){return Array.from(this)}function IV(){for(var t=this._groups,e=0,A=t.length;e<A;++e)for(var i=t[e],n=0,r=i.length;n<r;++n){var s=i[n];if(s)return s}return null}function hV(){let t=0;for(const e of this)++t;return t}function uV(){return!this.node()}function BV(t){for(var e=this._groups,A=0,i=e.length;A<i;++A)for(var n=e[A],r=0,s=n.length,o;r<s;++r)(o=n[r])&&t.call(o,o.__data__,r,n);return this}function CV(t){return function(){this.removeAttribute(t)}}function fV(t){return function(){this.removeAttributeNS(t.space,t.local)}}function EV(t,e){return function(){this.setAttribute(t,e)}}function dV(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function QV(t,e){return function(){var A=e.apply(this,arguments);A==null?this.removeAttribute(t):this.setAttribute(t,A)}}function pV(t,e){return function(){var A=e.apply(this,arguments);A==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,A)}}function yV(t,e){var A=ZB(t);if(arguments.length<2){var i=this.node();return A.local?i.getAttributeNS(A.space,A.local):i.getAttribute(A)}return this.each((e==null?A.local?fV:CV:typeof e=="function"?A.local?pV:QV:A.local?dV:EV)(A,e))}function S2(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mV(t){return function(){this.style.removeProperty(t)}}function wV(t,e,A){return function(){this.style.setProperty(t,e,A)}}function DV(t,e,A){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,A)}}function _V(t,e,A){return arguments.length>1?this.each((e==null?mV:typeof e=="function"?DV:wV)(t,e,A??"")):Fc(this.node(),t)}function Fc(t,e){return t.style.getPropertyValue(e)||S2(t).getComputedStyle(t,null).getPropertyValue(e)}function SV(t){return function(){delete this[t]}}function vV(t,e){return function(){this[t]=e}}function bV(t,e){return function(){var A=e.apply(this,arguments);A==null?delete this[t]:this[t]=A}}function xV(t,e){return arguments.length>1?this.each((e==null?SV:typeof e=="function"?bV:vV)(t,e)):this.node()[t]}function v2(t){return t.trim().split(/^|\s+/)}function cp(t){return t.classList||new b2(t)}function b2(t){this._node=t,this._names=v2(t.getAttribute("class")||"")}b2.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function x2(t,e){for(var A=cp(t),i=-1,n=e.length;++i<n;)A.add(e[i])}function R2(t,e){for(var A=cp(t),i=-1,n=e.length;++i<n;)A.remove(e[i])}function RV(t){return function(){x2(this,t)}}function FV(t){return function(){R2(this,t)}}function NV(t,e){return function(){(e.apply(this,arguments)?x2:R2)(this,t)}}function kV(t,e){var A=v2(t+"");if(arguments.length<2){for(var i=cp(this.node()),n=-1,r=A.length;++n<r;)if(!i.contains(A[n]))return!1;return!0}return this.each((typeof e=="function"?NV:e?RV:FV)(A,e))}function MV(){this.textContent=""}function TV(t){return function(){this.textContent=t}}function LV(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function UV(t){return arguments.length?this.each(t==null?MV:(typeof t=="function"?LV:TV)(t)):this.node().textContent}function GV(){this.innerHTML=""}function OV(t){return function(){this.innerHTML=t}}function PV(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function qV(t){return arguments.length?this.each(t==null?GV:(typeof t=="function"?PV:OV)(t)):this.node().innerHTML}function HV(){this.nextSibling&&this.parentNode.appendChild(this)}function JV(){return this.each(HV)}function YV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KV(){return this.each(YV)}function VV(t){var e=typeof t=="function"?t:y2(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function WV(){return null}function zV(t,e){var A=typeof t=="function"?t:y2(t),i=e==null?WV:typeof e=="function"?e:gp(e);return this.select(function(){return this.insertBefore(A.apply(this,arguments),i.apply(this,arguments)||null)})}function XV(){var t=this.parentNode;t&&t.removeChild(this)}function jV(){return this.each(XV)}function $V(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ZV(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function e9(t){return this.select(t?ZV:$V)}function A9(t){return arguments.length?this.property("__data__",t):this.node().__data__}function t9(t){return function(e){t.call(this,e,this.__data__)}}function i9(t){return t.trim().split(/^|\s+/).map(function(e){var A="",i=e.indexOf(".");return i>=0&&(A=e.slice(i+1),e=e.slice(0,i)),{type:e,name:A}})}function n9(t){return function(){var e=this.__on;if(e){for(var A=0,i=-1,n=e.length,r;A<n;++A)r=e[A],(!t.type||r.type===t.type)&&r.name===t.name?this.removeEventListener(r.type,r.listener,r.options):e[++i]=r;++i?e.length=i:delete this.__on}}}function r9(t,e,A){return function(){var i=this.__on,n,r=t9(e);if(i){for(var s=0,o=i.length;s<o;++s)if((n=i[s]).type===t.type&&n.name===t.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=r,n.options=A),n.value=e;return}}this.addEventListener(t.type,r,A),n={type:t.type,name:t.name,value:e,listener:r,options:A},i?i.push(n):this.__on=[n]}}function s9(t,e,A){var i=i9(t+""),n,r=i.length,s;if(arguments.length<2){var o=this.node().__on;if(o){for(var g=0,a=o.length,c;g<a;++g)for(n=0,c=o[g];n<r;++n)if((s=i[n]).type===c.type&&s.name===c.name)return c.value}return}for(o=e?r9:n9,n=0;n<r;++n)this.each(o(i[n],e,A));return this}function F2(t,e,A){var i=S2(t),n=i.CustomEvent;typeof n=="function"?n=new n(e,A):(n=i.document.createEvent("Event"),A?(n.initEvent(e,A.bubbles,A.cancelable),n.detail=A.detail):n.initEvent(e,!1,!1)),t.dispatchEvent(n)}function o9(t,e){return function(){return F2(this,t,e)}}function a9(t,e){return function(){return F2(this,t,e.apply(this,arguments))}}function g9(t,e){return this.each((typeof e=="function"?a9:o9)(t,e))}function*c9(){for(var t=this._groups,e=0,A=t.length;e<A;++e)for(var i=t[e],n=0,r=i.length,s;n<r;++n)(s=i[n])&&(yield s)}var N2=[null];function ur(t,e){this._groups=t,this._parents=e}function zI(){return new ur([[document.documentElement]],N2)}function l9(){return this}ur.prototype=zI.prototype={constructor:ur,select:LK,selectAll:PK,selectChild:YK,selectChildren:zK,filter:XK,data:tV,enter:jK,exit:nV,join:rV,merge:sV,selection:l9,order:oV,sort:aV,call:cV,nodes:lV,node:IV,size:hV,empty:uV,each:BV,attr:yV,style:_V,property:xV,classed:kV,text:UV,html:qV,raise:JV,lower:KV,append:VV,insert:zV,remove:jV,clone:e9,datum:A9,on:s9,dispatch:g9,[Symbol.iterator]:c9};function sn(t){return typeof t=="string"?new ur([[document.querySelector(t)]],[document.documentElement]):new ur([[t]],N2)}function I9(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ug(t,e){if(t=I9(t),e===void 0&&(e=t.currentTarget),e){var A=e.ownerSVGElement||e;if(A.createSVGPoint){var i=A.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var n=e.getBoundingClientRect();return[t.clientX-n.left-e.clientLeft,t.clientY-n.top-e.clientTop]}}return[t.pageX,t.pageY]}const lp={capture:!0,passive:!1};function Ip(t){t.preventDefault(),t.stopImmediatePropagation()}function h9(t){var e=t.document.documentElement,A=sn(t).on("dragstart.drag",Ip,lp);"onselectstart"in e?A.on("selectstart.drag",Ip,lp):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function u9(t,e){var A=t.document.documentElement,i=sn(t).on("dragstart.drag",null);e&&(i.on("click.drag",Ip,lp),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in A?i.on("selectstart.drag",null):(A.style.MozUserSelect=A.__noselect,delete A.__noselect)}function hp(t,e,A){t.prototype=e.prototype=A,A.constructor=t}function k2(t,e){var A=Object.create(t.prototype);for(var i in e)A[i]=e[i];return A}function XI(){}var jI=.7,AC=1/jI,Nc="\\s*([+-]?\\d+)\\s*",$I="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ss="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",B9=/^#([0-9a-f]{3,8})$/,C9=new RegExp(`^rgb\\(${Nc},${Nc},${Nc}\\)$`),f9=new RegExp(`^rgb\\(${Ss},${Ss},${Ss}\\)$`),E9=new RegExp(`^rgba\\(${Nc},${Nc},${Nc},${$I}\\)$`),d9=new RegExp(`^rgba\\(${Ss},${Ss},${Ss},${$I}\\)$`),Q9=new RegExp(`^hsl\\(${$I},${Ss},${Ss}\\)$`),p9=new RegExp(`^hsla\\(${$I},${Ss},${Ss},${$I}\\)$`),M2={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hp(XI,$r,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:T2,formatHex:T2,formatHex8:y9,formatHsl:m9,formatRgb:L2,toString:L2});function T2(){return this.rgb().formatHex()}function y9(){return this.rgb().formatHex8()}function m9(){return q2(this).formatHsl()}function L2(){return this.rgb().formatRgb()}function $r(t){var e,A;return t=(t+"").trim().toLowerCase(),(e=B9.exec(t))?(A=e[1].length,e=parseInt(e[1],16),A===6?U2(e):A===3?new nr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):A===8?tC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):A===4?tC(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=C9.exec(t))?new nr(e[1],e[2],e[3],1):(e=f9.exec(t))?new nr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=E9.exec(t))?tC(e[1],e[2],e[3],e[4]):(e=d9.exec(t))?tC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Q9.exec(t))?P2(e[1],e[2]/100,e[3]/100,1):(e=p9.exec(t))?P2(e[1],e[2]/100,e[3]/100,e[4]):M2.hasOwnProperty(t)?U2(M2[t]):t==="transparent"?new nr(NaN,NaN,NaN,0):null}function U2(t){return new nr(t>>16&255,t>>8&255,t&255,1)}function tC(t,e,A,i){return i<=0&&(t=e=A=NaN),new nr(t,e,A,i)}function w9(t){return t instanceof XI||(t=$r(t)),t?(t=t.rgb(),new nr(t.r,t.g,t.b,t.opacity)):new nr}function up(t,e,A,i){return arguments.length===1?w9(t):new nr(t,e,A,i??1)}function nr(t,e,A,i){this.r=+t,this.g=+e,this.b=+A,this.opacity=+i}hp(nr,up,k2(XI,{brighter(t){return t=t==null?AC:Math.pow(AC,t),new nr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?jI:Math.pow(jI,t),new nr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new nr(Bg(this.r),Bg(this.g),Bg(this.b),iC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:G2,formatHex:G2,formatHex8:D9,formatRgb:O2,toString:O2}));function G2(){return`#${Cg(this.r)}${Cg(this.g)}${Cg(this.b)}`}function D9(){return`#${Cg(this.r)}${Cg(this.g)}${Cg(this.b)}${Cg((isNaN(this.opacity)?1:this.opacity)*255)}`}function O2(){const t=iC(this.opacity);return`${t===1?"rgb(":"rgba("}${Bg(this.r)}, ${Bg(this.g)}, ${Bg(this.b)}${t===1?")":`, ${t})`}`}function iC(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Bg(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Cg(t){return t=Bg(t),(t<16?"0":"")+t.toString(16)}function P2(t,e,A,i){return i<=0?t=e=A=NaN:A<=0||A>=1?t=e=NaN:e<=0&&(t=NaN),new Zr(t,e,A,i)}function q2(t){if(t instanceof Zr)return new Zr(t.h,t.s,t.l,t.opacity);if(t instanceof XI||(t=$r(t)),!t)return new Zr;if(t instanceof Zr)return t;t=t.rgb();var e=t.r/255,A=t.g/255,i=t.b/255,n=Math.min(e,A,i),r=Math.max(e,A,i),s=NaN,o=r-n,g=(r+n)/2;return o?(e===r?s=(A-i)/o+(A<i)*6:A===r?s=(i-e)/o+2:s=(e-A)/o+4,o/=g<.5?r+n:2-r-n,s*=60):o=g>0&&g<1?0:s,new Zr(s,o,g,t.opacity)}function _9(t,e,A,i){return arguments.length===1?q2(t):new Zr(t,e,A,i??1)}function Zr(t,e,A,i){this.h=+t,this.s=+e,this.l=+A,this.opacity=+i}hp(Zr,_9,k2(XI,{brighter(t){return t=t==null?AC:Math.pow(AC,t),new Zr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?jI:Math.pow(jI,t),new Zr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,A=this.l,i=A+(A<.5?A:1-A)*e,n=2*A-i;return new nr(Bp(t>=240?t-240:t+120,n,i),Bp(t,n,i),Bp(t<120?t+240:t-120,n,i),this.opacity)},clamp(){return new Zr(H2(this.h),nC(this.s),nC(this.l),iC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=iC(this.opacity);return`${t===1?"hsl(":"hsla("}${H2(this.h)}, ${nC(this.s)*100}%, ${nC(this.l)*100}%${t===1?")":`, ${t})`}`}}));function H2(t){return t=(t||0)%360,t<0?t+360:t}function nC(t){return Math.max(0,Math.min(1,t||0))}function Bp(t,e,A){return(t<60?e+(A-e)*t/60:t<180?A:t<240?e+(A-e)*(240-t)/60:e)*255}const Cp=t=>()=>t;function S9(t,e){return function(A){return t+A*e}}function v9(t,e,A){return t=Math.pow(t,A),e=Math.pow(e,A)-t,A=1/A,function(i){return Math.pow(t+i*e,A)}}function b9(t){return(t=+t)==1?J2:function(e,A){return A-e?v9(e,A,t):Cp(isNaN(e)?A:e)}}function J2(t,e){var A=e-t;return A?S9(t,A):Cp(isNaN(t)?e:t)}const rC=function t(e){var A=b9(e);function i(n,r){var s=A((n=up(n)).r,(r=up(r)).r),o=A(n.g,r.g),g=A(n.b,r.b),a=J2(n.opacity,r.opacity);return function(c){return n.r=s(c),n.g=o(c),n.b=g(c),n.opacity=a(c),n+""}}return i.gamma=t,i}(1);function x9(t,e){e||(e=[]);var A=t?Math.min(e.length,t.length):0,i=e.slice(),n;return function(r){for(n=0;n<A;++n)i[n]=t[n]*(1-r)+e[n]*r;return i}}function R9(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function F9(t,e){var A=e?e.length:0,i=t?Math.min(A,t.length):0,n=new Array(i),r=new Array(A),s;for(s=0;s<i;++s)n[s]=dp(t[s],e[s]);for(;s<A;++s)r[s]=e[s];return function(o){for(s=0;s<i;++s)r[s]=n[s](o);return r}}function N9(t,e){var A=new Date;return t=+t,e=+e,function(i){return A.setTime(t*(1-i)+e*i),A}}function es(t,e){return t=+t,e=+e,function(A){return t*(1-A)+e*A}}function k9(t,e){var A={},i={},n;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(n in e)n in t?A[n]=dp(t[n],e[n]):i[n]=e[n];return function(r){for(n in A)i[n]=A[n](r);return i}}var fp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ep=new RegExp(fp.source,"g");function M9(t){return function(){return t}}function T9(t){return function(e){return t(e)+""}}function Y2(t,e){var A=fp.lastIndex=Ep.lastIndex=0,i,n,r,s=-1,o=[],g=[];for(t=t+"",e=e+"";(i=fp.exec(t))&&(n=Ep.exec(e));)(r=n.index)>A&&(r=e.slice(A,r),o[s]?o[s]+=r:o[++s]=r),(i=i[0])===(n=n[0])?o[s]?o[s]+=n:o[++s]=n:(o[++s]=null,g.push({i:s,x:es(i,n)})),A=Ep.lastIndex;return A<e.length&&(r=e.slice(A),o[s]?o[s]+=r:o[++s]=r),o.length<2?g[0]?T9(g[0].x):M9(e):(e=g.length,function(a){for(var c=0,l;c<e;++c)o[(l=g[c]).i]=l.x(a);return o.join("")})}function dp(t,e){var A=typeof e,i;return e==null||A==="boolean"?Cp(e):(A==="number"?es:A==="string"?(i=$r(e))?(e=i,rC):Y2:e instanceof $r?rC:e instanceof Date?N9:R9(e)?x9:Array.isArray(e)?F9:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?k9:es)(t,e)}function L9(t,e){return t=+t,e=+e,function(A){return Math.round(t*(1-A)+e*A)}}var K2=180/Math.PI,Qp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function V2(t,e,A,i,n,r){var s,o,g;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(g=t*A+e*i)&&(A-=t*g,i-=e*g),(o=Math.sqrt(A*A+i*i))&&(A/=o,i/=o,g/=o),t*i<e*A&&(t=-t,e=-e,g=-g,s=-s),{translateX:n,translateY:r,rotate:Math.atan2(e,t)*K2,skewX:Math.atan(g)*K2,scaleX:s,scaleY:o}}var sC;function U9(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Qp:V2(e.a,e.b,e.c,e.d,e.e,e.f)}function G9(t){return t==null||(sC||(sC=document.createElementNS("http://www.w3.org/2000/svg","g")),sC.setAttribute("transform",t),!(t=sC.transform.baseVal.consolidate()))?Qp:(t=t.matrix,V2(t.a,t.b,t.c,t.d,t.e,t.f))}function W2(t,e,A,i){function n(a){return a.length?a.pop()+" ":""}function r(a,c,l,I,h,u){if(a!==l||c!==I){var E=h.push("translate(",null,e,null,A);u.push({i:E-4,x:es(a,l)},{i:E-2,x:es(c,I)})}else(l||I)&&h.push("translate("+l+e+I+A)}function s(a,c,l,I){a!==c?(a-c>180?c+=360:c-a>180&&(a+=360),I.push({i:l.push(n(l)+"rotate(",null,i)-2,x:es(a,c)})):c&&l.push(n(l)+"rotate("+c+i)}function o(a,c,l,I){a!==c?I.push({i:l.push(n(l)+"skewX(",null,i)-2,x:es(a,c)}):c&&l.push(n(l)+"skewX("+c+i)}function g(a,c,l,I,h,u){if(a!==l||c!==I){var E=h.push(n(h)+"scale(",null,",",null,")");u.push({i:E-4,x:es(a,l)},{i:E-2,x:es(c,I)})}else(l!==1||I!==1)&&h.push(n(h)+"scale("+l+","+I+")")}return function(a,c){var l=[],I=[];return a=t(a),c=t(c),r(a.translateX,a.translateY,c.translateX,c.translateY,l,I),s(a.rotate,c.rotate,l,I),o(a.skewX,c.skewX,l,I),g(a.scaleX,a.scaleY,c.scaleX,c.scaleY,l,I),a=c=null,function(h){for(var u=-1,E=I.length,C;++u<E;)l[(C=I[u]).i]=C.x(h);return l.join("")}}}var O9=W2(U9,"px, ","px)","deg)"),P9=W2(G9,", ",")",")"),q9=1e-12;function z2(t){return((t=Math.exp(t))+1/t)/2}function H9(t){return((t=Math.exp(t))-1/t)/2}function J9(t){return((t=Math.exp(2*t))-1)/(t+1)}const Y9=function t(e,A,i){function n(r,s){var o=r[0],g=r[1],a=r[2],c=s[0],l=s[1],I=s[2],h=c-o,u=l-g,E=h*h+u*u,C,f;if(E<q9)f=Math.log(I/a)/e,C=function(m){return[o+m*h,g+m*u,a*Math.exp(e*m*f)]};else{var y=Math.sqrt(E),Q=(I*I-a*a+i*E)/(2*a*A*y),d=(I*I-a*a-i*E)/(2*I*A*y),w=Math.log(Math.sqrt(Q*Q+1)-Q),p=Math.log(Math.sqrt(d*d+1)-d);f=(p-w)/e,C=function(m){var D=m*f,x=z2(w),N=a/(A*y)*(x*J9(e*D+w)-H9(w));return[o+N*h,g+N*u,a*x/z2(e*D+w)]}}return C.duration=f*1e3*e/Math.SQRT2,C}return n.rho=function(r){var s=Math.max(.001,+r),o=s*s,g=o*o;return t(s,o,g)},n}(Math.SQRT2,2,4);var kc=0,ZI=0,eh=0,X2=1e3,oC,Ah,aC=0,fg=0,gC=0,th=typeof performance=="object"&&performance.now?performance:Date,j2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pp(){return fg||(j2(K9),fg=th.now()+gC)}function K9(){fg=0}function cC(){this._call=this._time=this._next=null}cC.prototype=$2.prototype={constructor:cC,restart:function(t,e,A){if(typeof t!="function")throw new TypeError("callback is not a function");A=(A==null?pp():+A)+(e==null?0:+e),!this._next&&Ah!==this&&(Ah?Ah._next=this:oC=this,Ah=this),this._call=t,this._time=A,yp()},stop:function(){this._call&&(this._call=null,this._time=1/0,yp())}};function $2(t,e,A){var i=new cC;return i.restart(t,e,A),i}function V9(){pp(),++kc;for(var t=oC,e;t;)(e=fg-t._time)>=0&&t._call.call(void 0,e),t=t._next;--kc}function Z2(){fg=(aC=th.now())+gC,kc=ZI=0;try{V9()}finally{kc=0,z9(),fg=0}}function W9(){var t=th.now(),e=t-aC;e>X2&&(gC-=e,aC=t)}function z9(){for(var t,e=oC,A,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(A=e._next,e._next=null,e=t?t._next=A:oC=A);Ah=t,yp(i)}function yp(t){if(!kc){ZI&&(ZI=clearTimeout(ZI));var e=t-fg;e>24?(t<1/0&&(ZI=setTimeout(Z2,t-th.now()-gC)),eh&&(eh=clearInterval(eh))):(eh||(aC=th.now(),eh=setInterval(W9,X2)),kc=1,j2(Z2))}}function eb(t,e,A){var i=new cC;return e=e==null?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,A),i}var X9=op("start","end","cancel","interrupt"),j9=[],Ab=0,tb=1,mp=2,lC=3,ib=4,wp=5,IC=6;function hC(t,e,A,i,n,r){var s=t.__transition;if(!s)t.__transition={};else if(A in s)return;$9(t,A,{name:e,index:i,group:n,on:X9,tween:j9,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ab})}function Dp(t,e){var A=As(t,e);if(A.state>Ab)throw new Error("too late; already scheduled");return A}function vs(t,e){var A=As(t,e);if(A.state>lC)throw new Error("too late; already running");return A}function As(t,e){var A=t.__transition;if(!A||!(A=A[e]))throw new Error("transition not found");return A}function $9(t,e,A){var i=t.__transition,n;i[e]=A,A.timer=$2(r,0,A.time);function r(a){A.state=tb,A.timer.restart(s,A.delay,A.time),A.delay<=a&&s(a-A.delay)}function s(a){var c,l,I,h;if(A.state!==tb)return g();for(c in i)if(h=i[c],h.name===A.name){if(h.state===lC)return eb(s);h.state===ib?(h.state=IC,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<e&&(h.state=IC,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[c])}if(eb(function(){A.state===lC&&(A.state=ib,A.timer.restart(o,A.delay,A.time),o(a))}),A.state=mp,A.on.call("start",t,t.__data__,A.index,A.group),A.state===mp){for(A.state=lC,n=new Array(I=A.tween.length),c=0,l=-1;c<I;++c)(h=A.tween[c].value.call(t,t.__data__,A.index,A.group))&&(n[++l]=h);n.length=l+1}}function o(a){for(var c=a<A.duration?A.ease.call(null,a/A.duration):(A.timer.restart(g),A.state=wp,1),l=-1,I=n.length;++l<I;)n[l].call(t,c);A.state===wp&&(A.on.call("end",t,t.__data__,A.index,A.group),g())}function g(){A.state=IC,A.timer.stop(),delete i[e];for(var a in i)return;delete t.__transition}}function uC(t,e){var A=t.__transition,i,n,r=!0,s;if(A){e=e==null?null:e+"";for(s in A){if((i=A[s]).name!==e){r=!1;continue}n=i.state>mp&&i.state<wp,i.state=IC,i.timer.stop(),i.on.call(n?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete A[s]}r&&delete t.__transition}}function Z9(t){return this.each(function(){uC(this,t)})}function eW(t,e){var A,i;return function(){var n=vs(this,t),r=n.tween;if(r!==A){i=A=r;for(var s=0,o=i.length;s<o;++s)if(i[s].name===e){i=i.slice(),i.splice(s,1);break}}n.tween=i}}function AW(t,e,A){var i,n;if(typeof A!="function")throw new Error;return function(){var r=vs(this,t),s=r.tween;if(s!==i){n=(i=s).slice();for(var o={name:e,value:A},g=0,a=n.length;g<a;++g)if(n[g].name===e){n[g]=o;break}g===a&&n.push(o)}r.tween=n}}function tW(t,e){var A=this._id;if(t+="",arguments.length<2){for(var i=As(this.node(),A).tween,n=0,r=i.length,s;n<r;++n)if((s=i[n]).name===t)return s.value;return null}return this.each((e==null?eW:AW)(A,t,e))}function _p(t,e,A){var i=t._id;return t.each(function(){var n=vs(this,i);(n.value||(n.value={}))[e]=A.apply(this,arguments)}),function(n){return As(n,i).value[e]}}function nb(t,e){var A;return(typeof e=="number"?es:e instanceof $r?rC:(A=$r(e))?(e=A,rC):Y2)(t,e)}function iW(t){return function(){this.removeAttribute(t)}}function nW(t){return function(){this.removeAttributeNS(t.space,t.local)}}function rW(t,e,A){var i,n=A+"",r;return function(){var s=this.getAttribute(t);return s===n?null:s===i?r:r=e(i=s,A)}}function sW(t,e,A){var i,n=A+"",r;return function(){var s=this.getAttributeNS(t.space,t.local);return s===n?null:s===i?r:r=e(i=s,A)}}function oW(t,e,A){var i,n,r;return function(){var s,o=A(this),g;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),g=o+"",s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o)))}}function aW(t,e,A){var i,n,r;return function(){var s,o=A(this),g;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),g=o+"",s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o)))}}function gW(t,e){var A=ZB(t),i=A==="transform"?P9:nb;return this.attrTween(t,typeof e=="function"?(A.local?aW:oW)(A,i,_p(this,"attr."+t,e)):e==null?(A.local?nW:iW)(A):(A.local?sW:rW)(A,i,e))}function cW(t,e){return function(A){this.setAttribute(t,e.call(this,A))}}function lW(t,e){return function(A){this.setAttributeNS(t.space,t.local,e.call(this,A))}}function IW(t,e){var A,i;function n(){var r=e.apply(this,arguments);return r!==i&&(A=(i=r)&&lW(t,r)),A}return n._value=e,n}function hW(t,e){var A,i;function n(){var r=e.apply(this,arguments);return r!==i&&(A=(i=r)&&cW(t,r)),A}return n._value=e,n}function uW(t,e){var A="attr."+t;if(arguments.length<2)return(A=this.tween(A))&&A._value;if(e==null)return this.tween(A,null);if(typeof e!="function")throw new Error;var i=ZB(t);return this.tween(A,(i.local?IW:hW)(i,e))}function BW(t,e){return function(){Dp(this,t).delay=+e.apply(this,arguments)}}function CW(t,e){return e=+e,function(){Dp(this,t).delay=e}}function fW(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?BW:CW)(e,t)):As(this.node(),e).delay}function EW(t,e){return function(){vs(this,t).duration=+e.apply(this,arguments)}}function dW(t,e){return e=+e,function(){vs(this,t).duration=e}}function QW(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?EW:dW)(e,t)):As(this.node(),e).duration}function pW(t,e){if(typeof e!="function")throw new Error;return function(){vs(this,t).ease=e}}function yW(t){var e=this._id;return arguments.length?this.each(pW(e,t)):As(this.node(),e).ease}function mW(t,e){return function(){var A=e.apply(this,arguments);if(typeof A!="function")throw new Error;vs(this,t).ease=A}}function wW(t){if(typeof t!="function")throw new Error;return this.each(mW(this._id,t))}function DW(t){typeof t!="function"&&(t=w2(t));for(var e=this._groups,A=e.length,i=new Array(A),n=0;n<A;++n)for(var r=e[n],s=r.length,o=i[n]=[],g,a=0;a<s;++a)(g=r[a])&&t.call(g,g.__data__,a,r)&&o.push(g);return new fo(i,this._parents,this._name,this._id)}function _W(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,A=t._groups,i=e.length,n=A.length,r=Math.min(i,n),s=new Array(i),o=0;o<r;++o)for(var g=e[o],a=A[o],c=g.length,l=s[o]=new Array(c),I,h=0;h<c;++h)(I=g[h]||a[h])&&(l[h]=I);for(;o<i;++o)s[o]=e[o];return new fo(s,this._parents,this._name,this._id)}function SW(t){return(t+"").trim().split(/^|\s+/).every(function(e){var A=e.indexOf(".");return A>=0&&(e=e.slice(0,A)),!e||e==="start"})}function vW(t,e,A){var i,n,r=SW(e)?Dp:vs;return function(){var s=r(this,t),o=s.on;o!==i&&(n=(i=o).copy()).on(e,A),s.on=n}}function bW(t,e){var A=this._id;return arguments.length<2?As(this.node(),A).on.on(t):this.each(vW(A,t,e))}function xW(t){return function(){var e=this.parentNode;for(var A in this.__transition)if(+A!==t)return;e&&e.removeChild(this)}}function RW(){return this.on("end.remove",xW(this._id))}function FW(t){var e=this._name,A=this._id;typeof t!="function"&&(t=gp(t));for(var i=this._groups,n=i.length,r=new Array(n),s=0;s<n;++s)for(var o=i[s],g=o.length,a=r[s]=new Array(g),c,l,I=0;I<g;++I)(c=o[I])&&(l=t.call(c,c.__data__,I,o))&&("__data__"in c&&(l.__data__=c.__data__),a[I]=l,hC(a[I],e,A,I,a,As(c,A)));return new fo(r,this._parents,e,A)}function NW(t){var e=this._name,A=this._id;typeof t!="function"&&(t=m2(t));for(var i=this._groups,n=i.length,r=[],s=[],o=0;o<n;++o)for(var g=i[o],a=g.length,c,l=0;l<a;++l)if(c=g[l]){for(var I=t.call(c,c.__data__,l,g),h,u=As(c,A),E=0,C=I.length;E<C;++E)(h=I[E])&&hC(h,e,A,E,I,u);r.push(I),s.push(c)}return new fo(r,s,e,A)}var kW=zI.prototype.constructor;function MW(){return new kW(this._groups,this._parents)}function TW(t,e){var A,i,n;return function(){var r=Fc(this,t),s=(this.style.removeProperty(t),Fc(this,t));return r===s?null:r===A&&s===i?n:n=e(A=r,i=s)}}function rb(t){return function(){this.style.removeProperty(t)}}function LW(t,e,A){var i,n=A+"",r;return function(){var s=Fc(this,t);return s===n?null:s===i?r:r=e(i=s,A)}}function UW(t,e,A){var i,n,r;return function(){var s=Fc(this,t),o=A(this),g=o+"";return o==null&&(g=o=(this.style.removeProperty(t),Fc(this,t))),s===g?null:s===i&&g===n?r:(n=g,r=e(i=s,o))}}function GW(t,e){var A,i,n,r="style."+e,s="end."+r,o;return function(){var g=vs(this,t),a=g.on,c=g.value[r]==null?o||(o=rb(e)):void 0;(a!==A||n!==c)&&(i=(A=a).copy()).on(s,n=c),g.on=i}}function OW(t,e,A){var i=(t+="")=="transform"?O9:nb;return e==null?this.styleTween(t,TW(t,i)).on("end.style."+t,rb(t)):typeof e=="function"?this.styleTween(t,UW(t,i,_p(this,"style."+t,e))).each(GW(this._id,t)):this.styleTween(t,LW(t,i,e),A).on("end.style."+t,null)}function PW(t,e,A){return function(i){this.style.setProperty(t,e.call(this,i),A)}}function qW(t,e,A){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&PW(t,s,A)),i}return r._value=e,r}function HW(t,e,A){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,qW(t,e,A??""))}function JW(t){return function(){this.textContent=t}}function YW(t){return function(){var e=t(this);this.textContent=e??""}}function KW(t){return this.tween("text",typeof t=="function"?YW(_p(this,"text",t)):JW(t==null?"":t+""))}function VW(t){return function(e){this.textContent=t.call(this,e)}}function WW(t){var e,A;function i(){var n=t.apply(this,arguments);return n!==A&&(e=(A=n)&&VW(n)),e}return i._value=t,i}function zW(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,WW(t))}function XW(){for(var t=this._name,e=this._id,A=sb(),i=this._groups,n=i.length,r=0;r<n;++r)for(var s=i[r],o=s.length,g,a=0;a<o;++a)if(g=s[a]){var c=As(g,e);hC(g,t,A,a,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new fo(i,this._parents,t,A)}function jW(){var t,e,A=this,i=A._id,n=A.size();return new Promise(function(r,s){var o={value:s},g={value:function(){--n===0&&r()}};A.each(function(){var a=vs(this,i),c=a.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(g)),a.on=e}),n===0&&r()})}var $W=0;function fo(t,e,A,i){this._groups=t,this._parents=e,this._name=A,this._id=i}function sb(){return++$W}var Eo=zI.prototype;fo.prototype={constructor:fo,select:FW,selectAll:NW,selectChild:Eo.selectChild,selectChildren:Eo.selectChildren,filter:DW,merge:_W,selection:MW,transition:XW,call:Eo.call,nodes:Eo.nodes,node:Eo.node,size:Eo.size,empty:Eo.empty,each:Eo.each,on:bW,attr:gW,attrTween:uW,style:OW,styleTween:HW,text:KW,textTween:zW,remove:RW,tween:tW,delay:fW,duration:QW,ease:yW,easeVarying:wW,end:jW,[Symbol.iterator]:Eo[Symbol.iterator]};function ZW(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var ez={time:null,delay:0,duration:250,ease:ZW};function Az(t,e){for(var A;!(A=t.__transition)||!(A=A[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return A}function tz(t){var e,A;t instanceof fo?(e=t._id,t=t._name):(e=sb(),(A=ez).time=pp(),t=t==null?null:t+"");for(var i=this._groups,n=i.length,r=0;r<n;++r)for(var s=i[r],o=s.length,g,a=0;a<o;++a)(g=s[a])&&hC(g,t,e,a,s,A||Az(g,e));return new fo(i,this._parents,t,e)}zI.prototype.interrupt=Z9,zI.prototype.transition=tz;const Sp=Math.PI,vp=2*Sp,Eg=1e-6,iz=vp-Eg;function ob(t){this._+=t[0];for(let e=1,A=t.length;e<A;++e)this._+=arguments[e]+t[e]}function nz(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ob;const A=10**e;return function(i){this._+=i[0];for(let n=1,r=i.length;n<r;++n)this._+=Math.round(arguments[n]*A)/A+i[n]}}class rz{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?ob:nz(e)}moveTo(e,A){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+A}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,A){this._append`L${this._x1=+e},${this._y1=+A}`}quadraticCurveTo(e,A,i,n){this._append`Q${+e},${+A},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(e,A,i,n,r,s){this._append`C${+e},${+A},${+i},${+n},${this._x1=+r},${this._y1=+s}`}arcTo(e,A,i,n,r){if(e=+e,A=+A,i=+i,n=+n,r=+r,r<0)throw new Error(`negative radius: ${r}`);let s=this._x1,o=this._y1,g=i-e,a=n-A,c=s-e,l=o-A,I=c*c+l*l;if(this._x1===null)this._append`M${this._x1=e},${this._y1=A}`;else if(I>Eg)if(!(Math.abs(l*g-a*c)>Eg)||!r)this._append`L${this._x1=e},${this._y1=A}`;else{let h=i-s,u=n-o,E=g*g+a*a,C=h*h+u*u,f=Math.sqrt(E),y=Math.sqrt(I),Q=r*Math.tan((Sp-Math.acos((E+I-C)/(2*f*y)))/2),d=Q/y,w=Q/f;Math.abs(d-1)>Eg&&this._append`L${e+d*c},${A+d*l}`,this._append`A${r},${r},0,0,${+(l*h>c*u)},${this._x1=e+w*g},${this._y1=A+w*a}`}}arc(e,A,i,n,r,s){if(e=+e,A=+A,i=+i,s=!!s,i<0)throw new Error(`negative radius: ${i}`);let o=i*Math.cos(n),g=i*Math.sin(n),a=e+o,c=A+g,l=1^s,I=s?n-r:r-n;this._x1===null?this._append`M${a},${c}`:(Math.abs(this._x1-a)>Eg||Math.abs(this._y1-c)>Eg)&&this._append`L${a},${c}`,i&&(I<0&&(I=I%vp+vp),I>iz?this._append`A${i},${i},0,1,${l},${e-o},${A-g}A${i},${i},0,1,${l},${this._x1=a},${this._y1=c}`:I>Eg&&this._append`A${i},${i},0,${+(I>=Sp)},${l},${this._x1=e+i*Math.cos(r)},${this._y1=A+i*Math.sin(r)}`)}rect(e,A,i,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+A}h${i=+i}v${+n}h${-i}Z`}toString(){return this._}}function sz(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function BC(t,e){if(!isFinite(t)||t===0)return null;var A=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),i=t.slice(0,A);return[i.length>1?i[0]+i.slice(2):i,+t.slice(A+1)]}function Mc(t){return t=BC(Math.abs(t)),t?t[1]:NaN}function oz(t,e){return function(A,i){for(var n=A.length,r=[],s=0,o=t[0],g=0;n>0&&o>0&&(g+o+1>i&&(o=Math.max(1,i-g)),r.push(A.substring(n-=o,n+o)),!((g+=o+1)>i));)o=t[s=(s+1)%t.length];return r.reverse().join(e)}}function az(t){return function(e){return e.replace(/[0-9]/g,function(A){return t[+A]})}}var gz=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function CC(t){if(!(e=gz.exec(t)))throw new Error("invalid format: "+t);var e;return new bp({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}CC.prototype=bp.prototype;function bp(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}bp.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cz(t){e:for(var e=t.length,A=1,i=-1,n;A<e;++A)switch(t[A]){case".":i=n=A;break;case"0":i===0&&(i=A),n=A;break;default:if(!+t[A])break e;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(n+1):t}var fC;function lz(t,e){var A=BC(t,e);if(!A)return fC=void 0,t.toPrecision(e);var i=A[0],n=A[1],r=n-(fC=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,s=i.length;return r===s?i:r>s?i+new Array(r-s+1).join("0"):r>0?i.slice(0,r)+"."+i.slice(r):"0."+new Array(1-r).join("0")+BC(t,Math.max(0,e+r-1))[0]}function ab(t,e){var A=BC(t,e);if(!A)return t+"";var i=A[0],n=A[1];return n<0?"0."+new Array(-n).join("0")+i:i.length>n+1?i.slice(0,n+1)+"."+i.slice(n+1):i+new Array(n-i.length+2).join("0")}const gb={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:sz,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ab(t*100,e),r:ab,s:lz,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function cb(t){return t}var lb=Array.prototype.map,Ib=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Iz(t){var e=t.grouping===void 0||t.thousands===void 0?cb:oz(lb.call(t.grouping,Number),t.thousands+""),A=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",n=t.decimal===void 0?".":t.decimal+"",r=t.numerals===void 0?cb:az(lb.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",g=t.nan===void 0?"NaN":t.nan+"";function a(l,I){l=CC(l);var h=l.fill,u=l.align,E=l.sign,C=l.symbol,f=l.zero,y=l.width,Q=l.comma,d=l.precision,w=l.trim,p=l.type;p==="n"?(Q=!0,p="g"):gb[p]||(d===void 0&&(d=12),w=!0,p="g"),(f||h==="0"&&u==="=")&&(f=!0,h="0",u="=");var m=(I&&I.prefix!==void 0?I.prefix:"")+(C==="$"?A:C==="#"&&/[boxX]/.test(p)?"0"+p.toLowerCase():""),D=(C==="$"?i:/[%p]/.test(p)?s:"")+(I&&I.suffix!==void 0?I.suffix:""),x=gb[p],N=/[defgprs%]/.test(p);d=d===void 0?6:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d));function F(M){var k=m,_=D,b,v,T;if(p==="c")_=x(M)+_,M="";else{M=+M;var O=M<0||1/M<0;if(M=isNaN(M)?g:x(Math.abs(M),d),w&&(M=cz(M)),O&&+M==0&&E!=="+"&&(O=!1),k=(O?E==="("?E:o:E==="-"||E==="("?"":E)+k,_=(p==="s"&&!isNaN(M)&&fC!==void 0?Ib[8+fC/3]:"")+_+(O&&E==="("?")":""),N){for(b=-1,v=M.length;++b<v;)if(T=M.charCodeAt(b),48>T||T>57){_=(T===46?n+M.slice(b+1):M.slice(b))+_,M=M.slice(0,b);break}}}Q&&!f&&(M=e(M,1/0));var Y=k.length+M.length+_.length,R=Y<y?new Array(y-Y+1).join(h):"";switch(Q&&f&&(M=e(R+M,R.length?y-_.length:1/0),R=""),u){case"<":M=k+M+_+R;break;case"=":M=k+R+M+_;break;case"^":M=R.slice(0,Y=R.length>>1)+k+M+_+R.slice(Y);break;default:M=R+k+M+_;break}return r(M)}return F.toString=function(){return l+""},F}function c(l,I){var h=Math.max(-8,Math.min(8,Math.floor(Mc(I)/3)))*3,u=Math.pow(10,-h),E=a((l=CC(l),l.type="f",l),{suffix:Ib[8+h/3]});return function(C){return E(u*C)}}return{format:a,formatPrefix:c}}var EC,xp,hb;hz({thousands:",",grouping:[3],currency:["$",""]});function hz(t){return EC=Iz(t),xp=EC.format,hb=EC.formatPrefix,EC}function uz(t){return Math.max(0,-Mc(Math.abs(t)))}function Bz(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mc(e)/3)))*3-Mc(Math.abs(t)))}function Cz(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Mc(e)-Mc(t))+1}function Rp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}const ub=Symbol("implicit");function Tc(){var t=new I2,e=[],A=[],i=ub;function n(r){let s=t.get(r);if(s===void 0){if(i!==ub)return i;t.set(r,s=e.push(r)-1)}return A[s%A.length]}return n.domain=function(r){if(!arguments.length)return e.slice();e=[],t=new I2;for(const s of r)t.has(s)||t.set(s,e.push(s)-1);return n},n.range=function(r){return arguments.length?(A=Array.from(r),n):A.slice()},n.unknown=function(r){return arguments.length?(i=r,n):i},n.copy=function(){return Tc(e,A).unknown(i)},Rp.apply(n,arguments),n}function Fp(){var t=Tc().unknown(void 0),e=t.domain,A=t.range,i=0,n=1,r,s,o=!1,g=0,a=0,c=.5;delete t.unknown;function l(){var I=e().length,h=n<i,u=h?n:i,E=h?i:n;r=(E-u)/Math.max(1,I-g+a*2),o&&(r=Math.floor(r)),u+=(E-u-r*(I-g))*c,s=r*(1-g),o&&(u=Math.round(u),s=Math.round(s));var C=wK(I).map(function(f){return u+r*f});return A(h?C.reverse():C)}return t.domain=function(I){return arguments.length?(e(I),l()):e()},t.range=function(I){return arguments.length?([i,n]=I,i=+i,n=+n,l()):[i,n]},t.rangeRound=function(I){return[i,n]=I,i=+i,n=+n,o=!0,l()},t.bandwidth=function(){return s},t.step=function(){return r},t.round=function(I){return arguments.length?(o=!!I,l()):o},t.padding=function(I){return arguments.length?(g=Math.min(1,a=+I),l()):g},t.paddingInner=function(I){return arguments.length?(g=Math.min(1,I),l()):g},t.paddingOuter=function(I){return arguments.length?(a=+I,l()):a},t.align=function(I){return arguments.length?(c=Math.max(0,Math.min(1,I)),l()):c},t.copy=function(){return Fp(e(),[i,n]).round(o).paddingInner(g).paddingOuter(a).align(c)},Rp.apply(l(),arguments)}function fz(t){return function(){return t}}function Ez(t){return+t}var Bb=[0,1];function Lc(t){return t}function Np(t,e){return(e-=t=+t)?function(A){return(A-t)/e}:fz(isNaN(e)?NaN:.5)}function dz(t,e){var A;return t>e&&(A=t,t=e,e=A),function(i){return Math.max(t,Math.min(e,i))}}function Qz(t,e,A){var i=t[0],n=t[1],r=e[0],s=e[1];return n<i?(i=Np(n,i),r=A(s,r)):(i=Np(i,n),r=A(r,s)),function(o){return r(i(o))}}function pz(t,e,A){var i=Math.min(t.length,e.length)-1,n=new Array(i),r=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)n[s]=Np(t[s],t[s+1]),r[s]=A(e[s],e[s+1]);return function(o){var g=cK(t,o,1,i)-1;return r[g](n[g](o))}}function yz(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function mz(){var t=Bb,e=Bb,A=dp,i,n,r,s=Lc,o,g,a;function c(){var I=Math.min(t.length,e.length);return s!==Lc&&(s=dz(t[0],t[I-1])),o=I>2?pz:Qz,g=a=null,l}function l(I){return I==null||isNaN(I=+I)?r:(g||(g=o(t.map(i),e,A)))(i(s(I)))}return l.invert=function(I){return s(n((a||(a=o(e,t.map(i),es)))(I)))},l.domain=function(I){return arguments.length?(t=Array.from(I,Ez),c()):t.slice()},l.range=function(I){return arguments.length?(e=Array.from(I),c()):e.slice()},l.rangeRound=function(I){return e=Array.from(I),A=L9,c()},l.clamp=function(I){return arguments.length?(s=I?!0:Lc,c()):s!==Lc},l.interpolate=function(I){return arguments.length?(A=I,c()):A},l.unknown=function(I){return arguments.length?(r=I,l):r},function(I,h){return i=I,n=h,c()}}function wz(){return mz()(Lc,Lc)}function Dz(t,e,A,i){var n=pK(t,e,A),r;switch(i=CC(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(r=Bz(n,s))&&(i.precision=r),hb(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(r=Cz(n,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=r-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(r=uz(n))&&(i.precision=r-(i.type==="%")*2);break}}return xp(i)}function _z(t){var e=t.domain;return t.ticks=function(A){var i=e();return QK(i[0],i[i.length-1],A??10)},t.tickFormat=function(A,i){var n=e();return Dz(n[0],n[n.length-1],A??10,i)},t.nice=function(A){A==null&&(A=10);var i=e(),n=0,r=i.length-1,s=i[n],o=i[r],g,a,c=10;for(o<s&&(a=s,s=o,o=a,a=n,n=r,r=a);c-- >0;){if(a=Ap(s,o,A),a===g)return i[n]=s,i[r]=o,e(i);if(a>0)s=Math.floor(s/a)*a,o=Math.ceil(o/a)*a;else if(a<0)s=Math.ceil(s*a)/a,o=Math.floor(o*a)/a;else break;g=a}return t},t}function vr(){var t=wz();return t.copy=function(){return yz(t,vr())},Rp.apply(t,arguments),_z(t)}function Sz(t){for(var e=t.length/6|0,A=new Array(e),i=0;i<e;)A[i]="#"+t.slice(i*6,++i*6);return A}const dC=Sz("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");function wn(t){return function(){return t}}const Cb=1e-12;function fb(t){let e=3;return t.digits=function(A){if(!arguments.length)return e;if(A==null)e=null;else{const i=Math.floor(A);if(!(i>=0))throw new RangeError(`invalid digits: ${A}`);e=i}return t},()=>new rz(e)}function Eb(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function db(t){this._context=t}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Qb(t){return new db(t)}function pb(t){return t[0]}function yb(t){return t[1]}function vz(t,e){var A=wn(!0),i=null,n=Qb,r=null,s=fb(o);t=typeof t=="function"?t:t===void 0?pb:wn(t),e=typeof e=="function"?e:e===void 0?yb:wn(e);function o(g){var a,c=(g=Eb(g)).length,l,I=!1,h;for(i==null&&(r=n(h=s())),a=0;a<=c;++a)!(a<c&&A(l=g[a],a,g))===I&&((I=!I)?r.lineStart():r.lineEnd()),I&&r.point(+t(l,a,g),+e(l,a,g));if(h)return r=null,h+""||null}return o.x=function(g){return arguments.length?(t=typeof g=="function"?g:wn(+g),o):t},o.y=function(g){return arguments.length?(e=typeof g=="function"?g:wn(+g),o):e},o.defined=function(g){return arguments.length?(A=typeof g=="function"?g:wn(!!g),o):A},o.curve=function(g){return arguments.length?(n=g,i!=null&&(r=n(i)),o):n},o.context=function(g){return arguments.length?(g==null?i=r=null:r=n(i=g),o):i},o}function bz(t,e,A){var i=null,n=wn(!0),r=null,s=Qb,o=null,g=fb(a);t=typeof t=="function"?t:t===void 0?pb:wn(+t),e=typeof e=="function"?e:wn(e===void 0?0:+e),A=typeof A=="function"?A:A===void 0?yb:wn(+A);function a(l){var I,h,u,E=(l=Eb(l)).length,C,f=!1,y,Q=new Array(E),d=new Array(E);for(r==null&&(o=s(y=g())),I=0;I<=E;++I){if(!(I<E&&n(C=l[I],I,l))===f)if(f=!f)h=I,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),u=I-1;u>=h;--u)o.point(Q[u],d[u]);o.lineEnd(),o.areaEnd()}f&&(Q[I]=+t(C,I,l),d[I]=+e(C,I,l),o.point(i?+i(C,I,l):Q[I],A?+A(C,I,l):d[I]))}if(y)return o=null,y+""||null}function c(){return vz().defined(n).curve(s).context(r)}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:wn(+l),i=null,a):t},a.x0=function(l){return arguments.length?(t=typeof l=="function"?l:wn(+l),a):t},a.x1=function(l){return arguments.length?(i=l==null?null:typeof l=="function"?l:wn(+l),a):i},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:wn(+l),A=null,a):e},a.y0=function(l){return arguments.length?(e=typeof l=="function"?l:wn(+l),a):e},a.y1=function(l){return arguments.length?(A=l==null?null:typeof l=="function"?l:wn(+l),a):A},a.lineX0=a.lineY0=function(){return c().x(t).y(e)},a.lineY1=function(){return c().x(t).y(A)},a.lineX1=function(){return c().x(i).y(e)},a.defined=function(l){return arguments.length?(n=typeof l=="function"?l:wn(!!l),a):n},a.curve=function(l){return arguments.length?(s=l,r!=null&&(o=s(r)),a):s},a.context=function(l){return arguments.length?(l==null?r=o=null:o=s(r=l),a):r},a}function mb(t,e,A){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-A),t._x2,t._y2)}function kp(t,e){this._context=t,this._k=(1-e)/6}kp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:mb(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:mb(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}},function t(e){function A(i){return new kp(i,e)}return A.tension=function(i){return t(+i)},A}(0);function xz(t,e,A){var i=t._x1,n=t._y1,r=t._x2,s=t._y2;if(t._l01_a>Cb){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,g=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/g,n=(n*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/g}if(t._l23_a>Cb){var a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);r=(r*a+t._x1*t._l23_2a-e*t._l12_2a)/c,s=(s*a+t._y1*t._l23_2a-A*t._l12_2a)/c}t._context.bezierCurveTo(i,n,r,s,t._x2,t._y2)}function wb(t,e){this._context=t,this._alpha=e}wb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var A=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(A*A+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:xz(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Rz=function t(e){function A(i){return e?new wb(i,e):new kp(i,0)}return A.alpha=function(i){return t(+i)},A}(.5),QC=t=>()=>t;function Fz(t,{sourceEvent:e,target:A,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:A,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function Qo(t,e,A){this.k=t,this.x=e,this.y=A}Qo.prototype={constructor:Qo,scale:function(t){return t===1?this:new Qo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Qo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Br=new Qo(1,0,0);Qo.prototype;function Mp(t){t.stopImmediatePropagation()}function ih(t){t.preventDefault(),t.stopImmediatePropagation()}function Nz(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function kz(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Db(){return this.__zoom||Br}function Mz(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Tz(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lz(t,e,A){var i=t.invertX(e[0][0])-A[0][0],n=t.invertX(e[1][0])-A[1][0],r=t.invertY(e[0][1])-A[0][1],s=t.invertY(e[1][1])-A[1][1];return t.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function Tp(){var t=Nz,e=kz,A=Lz,i=Mz,n=Tz,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],o=250,g=Y9,a=op("start","zoom","end"),c,l,I,h=500,u=150,E=0,C=10;function f(_){_.property("__zoom",Db).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",x).on("dblclick.zoom",N).filter(n).on("touchstart.zoom",F).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}f.transform=function(_,b,v,T){var O=_.selection?_.selection():_;O.property("__zoom",Db),_!==O?w(_,b,v,T):O.interrupt().each(function(){p(this,arguments).event(T).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},f.scaleBy=function(_,b,v,T){f.scaleTo(_,function(){var O=this.__zoom.k,Y=typeof b=="function"?b.apply(this,arguments):b;return O*Y},v,T)},f.scaleTo=function(_,b,v,T){f.transform(_,function(){var O=e.apply(this,arguments),Y=this.__zoom,R=v==null?d(O):typeof v=="function"?v.apply(this,arguments):v,W=Y.invert(R),ne=typeof b=="function"?b.apply(this,arguments):b;return A(Q(y(Y,ne),R,W),O,s)},v,T)},f.translateBy=function(_,b,v,T){f.transform(_,function(){return A(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),s)},null,T)},f.translateTo=function(_,b,v,T,O){f.transform(_,function(){var Y=e.apply(this,arguments),R=this.__zoom,W=T==null?d(Y):typeof T=="function"?T.apply(this,arguments):T;return A(Br.translate(W[0],W[1]).scale(R.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof v=="function"?-v.apply(this,arguments):-v),Y,s)},T,O)};function y(_,b){return b=Math.max(r[0],Math.min(r[1],b)),b===_.k?_:new Qo(b,_.x,_.y)}function Q(_,b,v){var T=b[0]-v[0]*_.k,O=b[1]-v[1]*_.k;return T===_.x&&O===_.y?_:new Qo(_.k,T,O)}function d(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function w(_,b,v,T){_.on("start.zoom",function(){p(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){p(this,arguments).event(T).end()}).tween("zoom",function(){var O=this,Y=arguments,R=p(O,Y).event(T),W=e.apply(O,Y),ne=v==null?d(W):typeof v=="function"?v.apply(O,Y):v,le=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),Z=O.__zoom,ae=typeof b=="function"?b.apply(O,Y):b,ie=g(Z.invert(ne).concat(le/Z.k),ae.invert(ne).concat(le/ae.k));return function(Ee){if(Ee===1)Ee=ae;else{var me=ie(Ee),He=le/me[2];Ee=new Qo(He,ne[0]-me[0]*He,ne[1]-me[1]*He)}R.zoom(null,Ee)}})}function p(_,b,v){return!v&&_.__zooming||new m(_,b)}function m(_,b){this.that=_,this.args=b,this.active=0,this.sourceEvent=null,this.extent=e.apply(_,b),this.taps=0}m.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,b){return this.mouse&&_!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var b=sn(this.that).datum();a.call(_,this.that,new Fz(_,{sourceEvent:this.sourceEvent,target:f,transform:this.that.__zoom,dispatch:a}),b)}};function D(_,...b){if(!t.apply(this,arguments))return;var v=p(this,b).event(_),T=this.__zoom,O=Math.max(r[0],Math.min(r[1],T.k*Math.pow(2,i.apply(this,arguments)))),Y=ug(_);if(v.wheel)(v.mouse[0][0]!==Y[0]||v.mouse[0][1]!==Y[1])&&(v.mouse[1]=T.invert(v.mouse[0]=Y)),clearTimeout(v.wheel);else{if(T.k===O)return;v.mouse=[Y,T.invert(Y)],uC(this),v.start()}ih(_),v.wheel=setTimeout(R,u),v.zoom("mouse",A(Q(y(T,O),v.mouse[0],v.mouse[1]),v.extent,s));function R(){v.wheel=null,v.end()}}function x(_,...b){if(I||!t.apply(this,arguments))return;var v=_.currentTarget,T=p(this,b,!0).event(_),O=sn(_.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",le,!0),Y=ug(_,v),R=_.clientX,W=_.clientY;h9(_.view),Mp(_),T.mouse=[Y,this.__zoom.invert(Y)],uC(this),T.start();function ne(Z){if(ih(Z),!T.moved){var ae=Z.clientX-R,ie=Z.clientY-W;T.moved=ae*ae+ie*ie>E}T.event(Z).zoom("mouse",A(Q(T.that.__zoom,T.mouse[0]=ug(Z,v),T.mouse[1]),T.extent,s))}function le(Z){O.on("mousemove.zoom mouseup.zoom",null),u9(Z.view,T.moved),ih(Z),T.event(Z).end()}}function N(_,...b){if(t.apply(this,arguments)){var v=this.__zoom,T=ug(_.changedTouches?_.changedTouches[0]:_,this),O=v.invert(T),Y=v.k*(_.shiftKey?.5:2),R=A(Q(y(v,Y),T,O),e.apply(this,b),s);ih(_),o>0?sn(this).transition().duration(o).call(w,R,T,_):sn(this).call(f.transform,R,T,_)}}function F(_,...b){if(t.apply(this,arguments)){var v=_.touches,T=v.length,O=p(this,b,_.changedTouches.length===T).event(_),Y,R,W,ne;for(Mp(_),R=0;R<T;++R)W=v[R],ne=ug(W,this),ne=[ne,this.__zoom.invert(ne),W.identifier],O.touch0?!O.touch1&&O.touch0[2]!==ne[2]&&(O.touch1=ne,O.taps=0):(O.touch0=ne,Y=!0,O.taps=1+!!c);c&&(c=clearTimeout(c)),Y&&(O.taps<2&&(l=ne[0],c=setTimeout(function(){c=null},h)),uC(this),O.start())}}function M(_,...b){if(this.__zooming){var v=p(this,b).event(_),T=_.changedTouches,O=T.length,Y,R,W,ne;for(ih(_),Y=0;Y<O;++Y)R=T[Y],W=ug(R,this),v.touch0&&v.touch0[2]===R.identifier?v.touch0[0]=W:v.touch1&&v.touch1[2]===R.identifier&&(v.touch1[0]=W);if(R=v.that.__zoom,v.touch1){var le=v.touch0[0],Z=v.touch0[1],ae=v.touch1[0],ie=v.touch1[1],Ee=(Ee=ae[0]-le[0])*Ee+(Ee=ae[1]-le[1])*Ee,me=(me=ie[0]-Z[0])*me+(me=ie[1]-Z[1])*me;R=y(R,Math.sqrt(Ee/me)),W=[(le[0]+ae[0])/2,(le[1]+ae[1])/2],ne=[(Z[0]+ie[0])/2,(Z[1]+ie[1])/2]}else if(v.touch0)W=v.touch0[0],ne=v.touch0[1];else return;v.zoom("touch",A(Q(R,W,ne),v.extent,s))}}function k(_,...b){if(this.__zooming){var v=p(this,b).event(_),T=_.changedTouches,O=T.length,Y,R;for(Mp(_),I&&clearTimeout(I),I=setTimeout(function(){I=null},h),Y=0;Y<O;++Y)R=T[Y],v.touch0&&v.touch0[2]===R.identifier?delete v.touch0:v.touch1&&v.touch1[2]===R.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(R=ug(R,this),Math.hypot(l[0]-R[0],l[1]-R[1])<C)){var W=sn(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return f.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:QC(+_),f):i},f.filter=function(_){return arguments.length?(t=typeof _=="function"?_:QC(!!_),f):t},f.touchable=function(_){return arguments.length?(n=typeof _=="function"?_:QC(!!_),f):n},f.extent=function(_){return arguments.length?(e=typeof _=="function"?_:QC([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),f):e},f.scaleExtent=function(_){return arguments.length?(r[0]=+_[0],r[1]=+_[1],f):[r[0],r[1]]},f.translateExtent=function(_){return arguments.length?(s[0][0]=+_[0][0],s[1][0]=+_[1][0],s[0][1]=+_[0][1],s[1][1]=+_[1][1],f):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},f.constrain=function(_){return arguments.length?(A=_,f):A},f.duration=function(_){return arguments.length?(o=+_,f):o},f.interpolate=function(_){return arguments.length?(g=_,f):g},f.on=function(){var _=a.on.apply(a,arguments);return _===a?f:_},f.clickDistance=function(_){return arguments.length?(E=(_=+_)*_,f):Math.sqrt(E)},f.tapDistance=function(_){return arguments.length?(C=+_,f):C},f}function mt(t,e,A,i){function n(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function o(c){try{a(i.next(c))}catch(l){s(l)}}function g(c){try{a(i.throw(c))}catch(l){s(l)}}function a(c){c.done?r(c.value):n(c.value).then(o,g)}a((i=i.apply(t,e||[])).next())})}function _b(t){var e=typeof Symbol=="function"&&Symbol.iterator,A=e&&t[e],i=0;if(A)return A.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function kt(t){return this instanceof kt?(this.v=t,this):new kt(t)}function bs(t,e,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=A.apply(t,e||[]),n,r=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",s),n[Symbol.asyncIterator]=function(){return this},n;function s(h){return function(u){return Promise.resolve(u).then(h,l)}}function o(h,u){i[h]&&(n[h]=function(E){return new Promise(function(C,f){r.push([h,E,C,f])>1||g(h,E)})},u&&(n[h]=u(n[h])))}function g(h,u){try{a(i[h](u))}catch(E){I(r[0][3],E)}}function a(h){h.value instanceof kt?Promise.resolve(h.value.v).then(c,l):I(r[0][2],h)}function c(h){g("next",h)}function l(h){g("throw",h)}function I(h,u){h(u),r.shift(),r.length&&g(r[0][0],r[0][1])}}function pC(t){var e,A;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,r){e[n]=t[n]?function(s){return(A=!A)?{value:kt(t[n](s)),done:!1}:r?r(s):s}:r}}function dg(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],A;return e?e.call(t):(t=typeof _b=="function"?_b(t):t[Symbol.iterator](),A={},i("next"),i("throw"),i("return"),A[Symbol.asyncIterator]=function(){return this},A);function i(r){A[r]=t[r]&&function(s){return new Promise(function(o,g){s=t[r](s),n(o,g,s.done,s.value)})}}function n(r,s,o,g){Promise.resolve(g).then(function(a){r({value:a,done:o})},s)}}typeof SuppressedError=="function"&&SuppressedError;const Uz=new TextDecoder("utf-8"),Lp=t=>Uz.decode(t),Gz=new TextEncoder,Up=t=>Gz.encode(t),Oz=t=>typeof t=="number",Sb=t=>typeof t=="boolean",fn=t=>typeof t=="function",rr=t=>t!=null&&Object(t)===t,Qg=t=>rr(t)&&fn(t.then),nh=t=>rr(t)&&fn(t[Symbol.iterator]),Uc=t=>rr(t)&&fn(t[Symbol.asyncIterator]),Gp=t=>rr(t)&&rr(t.schema),vb=t=>rr(t)&&"done"in t&&"value"in t,bb=t=>rr(t)&&fn(t.stat)&&Oz(t.fd),xb=t=>rr(t)&&Op(t.body),yC=t=>"_getDOMStream"in t&&"_getNodeStream"in t,Pz=t=>rr(t)&&fn(t.abort)&&fn(t.getWriter)&&!yC(t),Op=t=>rr(t)&&fn(t.cancel)&&fn(t.getReader)&&!yC(t),qz=t=>rr(t)&&fn(t.end)&&fn(t.write)&&Sb(t.writable)&&!yC(t),Rb=t=>rr(t)&&fn(t.read)&&fn(t.pipe)&&Sb(t.readable)&&!yC(t),Hz=t=>rr(t)&&fn(t.clear)&&fn(t.bytes)&&fn(t.position)&&fn(t.setPosition)&&fn(t.capacity)&&fn(t.getBufferIdentifier)&&fn(t.createLong),Pp=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Jz(t){const e=t[0]?[t[0]]:[];let A,i,n,r;for(let s,o,g=0,a=0,c=t.length;++g<c;){if(s=e[a],o=t[g],!s||!o||s.buffer!==o.buffer||o.byteOffset<s.byteOffset){o&&(e[++a]=o);continue}if({byteOffset:A,byteLength:n}=s,{byteOffset:i,byteLength:r}=o,A+n<i||i+r<A){o&&(e[++a]=o);continue}e[a]=new Uint8Array(s.buffer,A,i-A+r)}return e}function Fb(t,e,A=0,i=e.byteLength){const n=t.byteLength,r=new Uint8Array(t.buffer,t.byteOffset,n),s=new Uint8Array(e.buffer,e.byteOffset,Math.min(i,n));return r.set(s,A),t}function xs(t,e){const A=Jz(t),i=A.reduce((c,l)=>c+l.byteLength,0);let n,r,s,o=0,g=-1;const a=Math.min(e||Number.POSITIVE_INFINITY,i);for(const c=A.length;++g<c;){if(n=A[g],r=n.subarray(0,Math.min(n.length,a-o)),a<=o+r.length){r.length<n.length?A[g]=n.subarray(r.length):r.length===n.length&&g++,s?Fb(s,r,o):s=r;break}Fb(s||(s=new Uint8Array(a)),r,o),o+=r.length}return[s||new Uint8Array(0),A.slice(g),i-(s?s.byteLength:0)]}function Qi(t,e){let A=vb(e)?e.value:e;return A instanceof t?t===Uint8Array?new t(A.buffer,A.byteOffset,A.byteLength):A:A?(typeof A=="string"&&(A=Up(A)),A instanceof ArrayBuffer?new t(A):A instanceof Pp?new t(A):Hz(A)?Qi(t,A.bytes()):ArrayBuffer.isView(A)?A.byteLength<=0?new t(0):new t(A.buffer,A.byteOffset,A.byteLength/t.BYTES_PER_ELEMENT):t.from(A)):new t(0)}const rh=t=>Qi(Int32Array,t),Nb=t=>Qi(BigInt64Array,t),Xt=t=>Qi(Uint8Array,t),qp=t=>(t.next(),t);function*Yz(t,e){const A=function*(n){yield n},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pp?A(e):nh(e)?e:A(e);return yield*qp(function*(n){let r=null;do r=n.next(yield Qi(t,r));while(!r.done)}(i[Symbol.iterator]())),new t}const Kz=t=>Yz(Uint8Array,t);function kb(t,e){return bs(this,arguments,function*(){if(Qg(e))return yield kt(yield kt(yield*pC(dg(kb(t,yield kt(e))))));const i=function(s){return bs(this,arguments,function*(){yield yield kt(yield kt(s))})},n=function(s){return bs(this,arguments,function*(){yield kt(yield*pC(dg(qp(function*(o){let g=null;do g=o.next(yield g==null?void 0:g.value);while(!g.done)}(s[Symbol.iterator]())))))})},r=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pp?i(e):nh(e)?n(e):Uc(e)?e:i(e);return yield kt(yield*pC(dg(qp(function(s){return bs(this,arguments,function*(){let o=null;do o=yield kt(s.next(yield yield kt(Qi(t,o))));while(!o.done)})}(r[Symbol.asyncIterator]()))))),yield kt(new t)})}const Vz=t=>kb(Uint8Array,t);function Mb(t,e,A){if(t!==0){A=A.slice(0,e);for(let i=-1,n=A.length;++i<n;)A[i]+=t}return A.subarray(0,e)}function Wz(t,e){let A=0;const i=t.length;if(i!==e.length)return!1;if(i>0)do if(t[A]!==e[A])return!1;while(++A<i);return!0}const br={fromIterable(t){return mC(zz(t))},fromAsyncIterable(t){return mC(Xz(t))},fromDOMStream(t){return mC(jz(t))},fromNodeStream(t){return mC(Zz(t))},toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}},mC=t=>(t.next(),t);function*zz(t){let e,A=!1,i=[],n,r,s,o=0;function g(){return r==="peek"?xs(i,s)[0]:([n,i,o]=xs(i,s),n)}({cmd:r,size:s}=(yield null)||{cmd:"read",size:0});const a=Kz(t)[Symbol.iterator]();try{do if({done:e,value:n}=Number.isNaN(s-o)?a.next():a.next(s-o),!e&&n.byteLength>0&&(i.push(n),o+=n.byteLength),e||s<=o)do({cmd:r,size:s}=yield g());while(s<o);while(!e)}catch(c){(A=!0)&&typeof a.throw=="function"&&a.throw(c)}finally{A===!1&&typeof a.return=="function"&&a.return(null)}return null}function Xz(t){return bs(this,arguments,function*(){let A,i=!1,n=[],r,s,o,g=0;function a(){return s==="peek"?xs(n,o)[0]:([r,n,g]=xs(n,o),r)}({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0});const c=Vz(t)[Symbol.asyncIterator]();try{do if({done:A,value:r}=Number.isNaN(o-g)?yield kt(c.next()):yield kt(c.next(o-g)),!A&&r.byteLength>0&&(n.push(r),g+=r.byteLength),A||o<=g)do({cmd:s,size:o}=yield yield kt(a()));while(o<g);while(!A)}catch(l){(i=!0)&&typeof c.throw=="function"&&(yield kt(c.throw(l)))}finally{i===!1&&typeof c.return=="function"&&(yield kt(c.return(new Uint8Array(0))))}return yield kt(null)})}function jz(t){return bs(this,arguments,function*(){let A=!1,i=!1,n=[],r,s,o,g=0;function a(){return s==="peek"?xs(n,o)[0]:([r,n,g]=xs(n,o),r)}({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0});const c=new $z(t);try{do if({done:A,value:r}=Number.isNaN(o-g)?yield kt(c.read()):yield kt(c.read(o-g)),!A&&r.byteLength>0&&(n.push(Xt(r)),g+=r.byteLength),A||o<=g)do({cmd:s,size:o}=yield yield kt(a()));while(o<g);while(!A)}catch(l){(i=!0)&&(yield kt(c.cancel(l)))}finally{i===!1?yield kt(c.cancel()):t.locked&&c.releaseLock()}return yield kt(null)})}class $z{constructor(e){this.source=e,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return mt(this,void 0,void 0,function*(){const{reader:A,source:i}=this;A&&(yield A.cancel(e).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(e){return mt(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const A=yield this.reader.read();return!A.done&&(A.value=Xt(A)),A})}}const Hp=(t,e)=>{const A=n=>i([e,n]);let i;return[e,A,new Promise(n=>(i=n)&&t.once(e,A))]};function Zz(t){return bs(this,arguments,function*(){const A=[];let i="error",n=!1,r=null,s,o,g=0,a=[],c;function l(){return s==="peek"?xs(a,o)[0]:([c,a,g]=xs(a,o),c)}if({cmd:s,size:o}=(yield yield kt(null))||{cmd:"read",size:0},t.isTTY)return yield yield kt(new Uint8Array(0)),yield kt(null);try{A[0]=Hp(t,"end"),A[1]=Hp(t,"error");do{if(A[2]=Hp(t,"readable"),[i,r]=yield kt(Promise.race(A.map(h=>h[2]))),i==="error")break;if((n=i==="end")||(Number.isFinite(o-g)?(c=Xt(t.read(o-g)),c.byteLength<o-g&&(c=Xt(t.read()))):c=Xt(t.read()),c.byteLength>0&&(a.push(c),g+=c.byteLength)),n||o<=g)do({cmd:s,size:o}=yield yield kt(l()));while(o<g)}while(!n)}finally{yield kt(I(A,i==="error"?r:null))}return yield kt(null);function I(h,u){return c=a=null,new Promise((E,C)=>{for(const[f,y]of h)t.off(f,y);try{const f=t.destroy;f&&f.call(t,u),u=void 0}catch(f){u=f||u}finally{u!=null?C(u):E()}})}})}var on;(function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"})(on||(on={}));var Ln;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(Ln||(Ln={}));var Un;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(Un||(Un={}));var xr;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(xr||(xr={}));var ht;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(ht||(ht={}));var Rs;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Rs||(Rs={}));const Jp=2,Fs=4,po=4,ui=4,oa=new Int32Array(2),Tb=new Float32Array(oa.buffer),Lb=new Float64Array(oa.buffer),wC=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Yp;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(Yp||(Yp={}));let Gc=class tq{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new tq(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return oa[0]=this.readInt32(e),Tb[0]}readFloat64(e){return oa[wC?0:1]=this.readInt32(e),oa[wC?1:0]=this.readInt32(e+4),Lb[0]}writeInt8(e,A){this.bytes_[e]=A}writeUint8(e,A){this.bytes_[e]=A}writeInt16(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8}writeUint16(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8}writeInt32(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8,this.bytes_[e+2]=A>>16,this.bytes_[e+3]=A>>24}writeUint32(e,A){this.bytes_[e]=A,this.bytes_[e+1]=A>>8,this.bytes_[e+2]=A>>16,this.bytes_[e+3]=A>>24}writeInt64(e,A){this.writeInt32(e,Number(BigInt.asIntN(32,A))),this.writeInt32(e+4,Number(BigInt.asIntN(32,A>>BigInt(32))))}writeUint64(e,A){this.writeUint32(e,Number(BigInt.asUintN(32,A))),this.writeUint32(e+4,Number(BigInt.asUintN(32,A>>BigInt(32))))}writeFloat32(e,A){Tb[0]=A,this.writeInt32(e,oa[0])}writeFloat64(e,A){Lb[0]=A,this.writeInt32(e,oa[wC?0:1]),this.writeInt32(e+4,oa[wC?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Fs+po)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let A=0;A<po;A++)e+=String.fromCharCode(this.readInt8(this.position_+Fs+A));return e}__offset(e,A){const i=e-this.readInt32(e);return A<this.readInt16(i)?this.readInt16(i+A):0}__union(e,A){return e.bb_pos=A+this.readInt32(A),e.bb=this,e}__string(e,A){e+=this.readInt32(e);const i=this.readInt32(e);e+=Fs;const n=this.bytes_.subarray(e,e+i);return A===Yp.UTF8_BYTES?n:this.text_decoder_.decode(n)}__union_with_string(e,A){return typeof e=="string"?this.__string(A):this.__union(e,A)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Fs}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=po)throw new Error("FlatBuffers: file identifier must be length "+po);for(let A=0;A<po;A++)if(e.charCodeAt(A)!=this.readInt8(this.position()+Fs+A))return!1;return!0}createScalarList(e,A){const i=[];for(let n=0;n<A;++n){const r=e(n);r!==null&&i.push(r)}return i}createObjList(e,A){const i=[];for(let n=0;n<A;++n){const r=e(n);r!==null&&i.push(r.unpack())}return i}},Ub=class iq{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let A;e?A=e:A=1024,this.bb=Gc.allocate(A),this.space=A}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,A){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+A)+1&e-1;for(;this.space<i+e+A;){const n=this.bb.capacity();this.bb=iq.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)}pad(e){for(let A=0;A<e;A++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,A,i){(this.force_defaults||A!=i)&&(this.addInt8(A),this.slot(e))}addFieldInt16(e,A,i){(this.force_defaults||A!=i)&&(this.addInt16(A),this.slot(e))}addFieldInt32(e,A,i){(this.force_defaults||A!=i)&&(this.addInt32(A),this.slot(e))}addFieldInt64(e,A,i){(this.force_defaults||A!==i)&&(this.addInt64(A),this.slot(e))}addFieldFloat32(e,A,i){(this.force_defaults||A!=i)&&(this.addFloat32(A),this.slot(e))}addFieldFloat64(e,A,i){(this.force_defaults||A!=i)&&(this.addFloat64(A),this.slot(e))}addFieldOffset(e,A,i){(this.force_defaults||A!=i)&&(this.addOffset(A),this.slot(e))}addFieldStruct(e,A,i){A!=i&&(this.nested(A),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const A=e.capacity();if(A&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=A<<1,n=Gc.allocate(i);return n.setPosition(i-A),n.bytes().set(e.bytes(),i-A),n}addOffset(e){this.prep(Fs,0),this.writeInt32(this.offset()-e+Fs)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let A=0;A<e;A++)this.vtable[A]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let A=this.vtable_in_use-1;for(;A>=0&&this.vtable[A]==0;A--);const i=A+1;for(;A>=0;A--)this.addInt16(this.vtable[A]!=0?e-this.vtable[A]:0);const n=2;this.addInt16(e-this.object_start);const r=(i+n)*Jp;this.addInt16(r);let s=0;const o=this.space;e:for(A=0;A<this.vtables.length;A++){const g=this.bb.capacity()-this.vtables[A];if(r==this.bb.readInt16(g)){for(let a=Jp;a<r;a+=Jp)if(this.bb.readInt16(o+a)!=this.bb.readInt16(g+a))continue e;s=this.vtables[A];break}}return s?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,s-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,A,i){const n=i?ui:0;if(A){const r=A;if(this.prep(this.minalign,Fs+po+n),r.length!=po)throw new TypeError("FlatBuffers: file identifier must be length "+po);for(let s=po-1;s>=0;s--)this.writeInt8(r.charCodeAt(s))}this.prep(this.minalign,Fs+n),this.addOffset(e),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,A){this.finish(e,A,!0)}requiredField(e,A){const i=this.bb.capacity()-e,n=i-this.bb.readInt32(i);if(!(A<this.bb.readInt16(n)&&this.bb.readInt16(n+A)!=0))throw new TypeError("FlatBuffers: field "+A+" must be set")}startVector(e,A,i){this.notNested(),this.vector_num_elems=A,this.prep(Fs,e*A),this.prep(i,e*A)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const A=this.createString(e);return this.string_maps.set(e,A),A}createString(e){if(e==null)return 0;let A;return e instanceof Uint8Array?A=e:A=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,A.length,1),this.bb.setPosition(this.space-=A.length),this.bb.bytes().set(A,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const A=[];for(let i=0;i<e.length;++i){const n=e[i];if(n!==null)A.push(this.createObjectOffset(n));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return A}createStructOffsetList(e,A){return A(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}};var DC;(function(t){t[t.BUFFER=0]="BUFFER"})(DC||(DC={}));var _C;(function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"})(_C||(_C={}));class aa{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBodyCompression(e,A){return(A||new aa).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,A){return e.setPosition(e.position()+ui),(A||new aa).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):_C.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):DC.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,A){e.addFieldInt8(0,A,_C.LZ4_FRAME)}static addMethod(e,A){e.addFieldInt8(1,A,DC.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,A,i){return aa.startBodyCompression(e),aa.addCodec(e,A),aa.addMethod(e,i),aa.endBodyCompression(e)}}let Gb=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,A,i){return e.prep(8,16),e.writeInt64(BigInt(i??0)),e.writeInt64(BigInt(A??0)),e.offset()}},Ob=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,A,i){return e.prep(8,16),e.writeInt64(BigInt(i??0)),e.writeInt64(BigInt(A??0)),e.offset()}},yo=class F1{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsRecordBatch(e,A){return(A||new F1).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,A){return e.setPosition(e.position()+ui),(A||new F1).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,A){const i=this.bb.__offset(this.bb_pos,6);return i?(A||new Ob).__init(this.bb.__vector(this.bb_pos+i)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new Gb).__init(this.bb.__vector(this.bb_pos+i)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const A=this.bb.__offset(this.bb_pos,10);return A?(e||new aa).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addNodes(e,A){e.addFieldOffset(1,A,0)}static startNodesVector(e,A){e.startVector(16,A,8)}static addBuffers(e,A){e.addFieldOffset(2,A,0)}static startBuffersVector(e,A){e.startVector(16,A,8)}static addCompression(e,A){e.addFieldOffset(3,A,0)}static endRecordBatch(e){return e.endObject()}},Oc=class N1{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDictionaryBatch(e,A){return(A||new N1).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,A){return e.setPosition(e.position()+ui),(A||new N1).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new yo).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addData(e,A){e.addFieldOffset(1,A,0)}static addIsDelta(e,A){e.addFieldInt8(2,+A,0)}static endDictionaryBatch(e){return e.endObject()}};var Pc;(function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"})(Pc||(Pc={}));var SC;(function(t){t[t.DenseArray=0]="DenseArray"})(SC||(SC={}));class Cr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsInt(e,A){return(A||new Cr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,A){return e.setPosition(e.position()+ui),(A||new Cr).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,A){e.addFieldInt32(0,A,0)}static addIsSigned(e,A){e.addFieldInt8(1,+A,0)}static endInt(e){return e.endObject()}static createInt(e,A,i){return Cr.startInt(e),Cr.addBitWidth(e,A),Cr.addIsSigned(e,i),Cr.endInt(e)}}class mo{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDictionaryEncoding(e,A){return(A||new mo).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,A){return e.setPosition(e.position()+ui),(A||new mo).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new Cr).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}isOrdered(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):SC.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,A){e.addFieldInt64(0,A,BigInt("0"))}static addIndexType(e,A){e.addFieldOffset(1,A,0)}static addIsOrdered(e,A){e.addFieldInt8(2,+A,0)}static addDictionaryKind(e,A){e.addFieldInt16(3,A,SC.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}class En{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsKeyValue(e,A){return(A||new En).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,A){return e.setPosition(e.position()+ui),(A||new En).__init(e.readInt32(e.position())+e.position(),e)}key(e){const A=this.bb.__offset(this.bb_pos,4);return A?this.bb.__string(this.bb_pos+A,e):null}value(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.__string(this.bb_pos+A,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,A){e.addFieldOffset(0,A,0)}static addValue(e,A){e.addFieldOffset(1,A,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,A,i){return En.startKeyValue(e),En.addKey(e,A),En.addValue(e,i),En.endKeyValue(e)}}let Pb=class cB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBinary(e,A){return(A||new cB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,A){return e.setPosition(e.position()+ui),(A||new cB).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return cB.startBinary(e),cB.endBinary(e)}},qb=class lB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsBool(e,A){return(A||new lB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,A){return e.setPosition(e.position()+ui),(A||new lB).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return lB.startBool(e),lB.endBool(e)}},vC=class pI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDate(e,A){return(A||new pI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,A){return e.setPosition(e.position()+ui),(A||new pI).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):xr.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,xr.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,A){return pI.startDate(e),pI.addUnit(e,A),pI.endDate(e)}},qc=class ig{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDecimal(e,A){return(A||new ig).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,A){return e.setPosition(e.position()+ui),(A||new ig).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,A){e.addFieldInt32(0,A,0)}static addScale(e,A){e.addFieldInt32(1,A,0)}static addBitWidth(e,A){e.addFieldInt32(2,A,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,A,i,n){return ig.startDecimal(e),ig.addPrecision(e,A),ig.addScale(e,i),ig.addBitWidth(e,n),ig.endDecimal(e)}},bC=class yI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsDuration(e,A){return(A||new yI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDuration(e,A){return e.setPosition(e.position()+ui),(A||new yI).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,ht.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(e,A){return yI.startDuration(e),yI.addUnit(e,A),yI.endDuration(e)}},xC=class mI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFixedSizeBinary(e,A){return(A||new mI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,A){return e.setPosition(e.position()+ui),(A||new mI).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,A){e.addFieldInt32(0,A,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,A){return mI.startFixedSizeBinary(e),mI.addByteWidth(e,A),mI.endFixedSizeBinary(e)}},RC=class wI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFixedSizeList(e,A){return(A||new wI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,A){return e.setPosition(e.position()+ui),(A||new wI).__init(e.readInt32(e.position())+e.position(),e)}listSize(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,A){e.addFieldInt32(0,A,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,A){return wI.startFixedSizeList(e),wI.addListSize(e,A),wI.endFixedSizeList(e)}};class Ns{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFloatingPoint(e,A){return(A||new Ns).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,A){return e.setPosition(e.position()+ui),(A||new Ns).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Un.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,A){e.addFieldInt16(0,A,Un.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,A){return Ns.startFloatingPoint(e),Ns.addPrecision(e,A),Ns.endFloatingPoint(e)}}class ks{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsInterval(e,A){return(A||new ks).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,A){return e.setPosition(e.position()+ui),(A||new ks).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Rs.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,A){e.addFieldInt16(0,A,Rs.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,A){return ks.startInterval(e),ks.addUnit(e,A),ks.endInterval(e)}}let Hb=class IB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsLargeBinary(e,A){return(A||new IB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeBinary(e,A){return e.setPosition(e.position()+ui),(A||new IB).__init(e.readInt32(e.position())+e.position(),e)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(e){return IB.startLargeBinary(e),IB.endLargeBinary(e)}},Jb=class hB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsLargeUtf8(e,A){return(A||new hB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsLargeUtf8(e,A){return e.setPosition(e.position()+ui),(A||new hB).__init(e.readInt32(e.position())+e.position(),e)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(e){return hB.startLargeUtf8(e),hB.endLargeUtf8(e)}},Yb=class uB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsList(e,A){return(A||new uB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,A){return e.setPosition(e.position()+ui),(A||new uB).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return uB.startList(e),uB.endList(e)}},FC=class DI{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsMap(e,A){return(A||new DI).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,A){return e.setPosition(e.position()+ui),(A||new DI).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){const e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,A){e.addFieldInt8(0,+A,0)}static endMap(e){return e.endObject()}static createMap(e,A){return DI.startMap(e),DI.addKeysSorted(e,A),DI.endMap(e)}},Kb=class BB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsNull(e,A){return(A||new BB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,A){return e.setPosition(e.position()+ui),(A||new BB).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return BB.startNull(e),BB.endNull(e)}};class pg{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsStruct_(e,A){return(A||new pg).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,A){return e.setPosition(e.position()+ui),(A||new pg).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return pg.startStruct_(e),pg.endStruct_(e)}}class Rr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsTime(e,A){return(A||new Rr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,A){return e.setPosition(e.position()+ui),(A||new Rr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.MILLISECOND}bitWidth(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,A){e.addFieldInt16(0,A,ht.MILLISECOND)}static addBitWidth(e,A){e.addFieldInt32(1,A,32)}static endTime(e){return e.endObject()}static createTime(e,A,i){return Rr.startTime(e),Rr.addUnit(e,A),Rr.addBitWidth(e,i),Rr.endTime(e)}}class Fr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsTimestamp(e,A){return(A||new Fr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,A){return e.setPosition(e.position()+ui),(A||new Fr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ht.SECOND}timezone(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.__string(this.bb_pos+A,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,A){e.addFieldInt16(0,A,ht.SECOND)}static addTimezone(e,A){e.addFieldOffset(1,A,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,A,i){return Fr.startTimestamp(e),Fr.addUnit(e,A),Fr.addTimezone(e,i),Fr.endTimestamp(e)}}class sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsUnion(e,A){return(A||new sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,A){return e.setPosition(e.position()+ui),(A||new sr).__init(e.readInt32(e.position())+e.position(),e)}mode(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Ln.Sparse}typeIds(e){const A=this.bb.__offset(this.bb_pos,6);return A?this.bb.readInt32(this.bb.__vector(this.bb_pos+A)+e*4):0}typeIdsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){const e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,A){e.addFieldInt16(0,A,Ln.Sparse)}static addTypeIds(e,A){e.addFieldOffset(1,A,0)}static createTypeIdsVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addInt32(A[i]);return e.endVector()}static startTypeIdsVector(e,A){e.startVector(4,A,4)}static endUnion(e){return e.endObject()}static createUnion(e,A,i){return sr.startUnion(e),sr.addMode(e,A),sr.addTypeIds(e,i),sr.endUnion(e)}}let Vb=class CB{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsUtf8(e,A){return(A||new CB).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,A){return e.setPosition(e.position()+ui),(A||new CB).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return CB.startUtf8(e),CB.endUtf8(e)}};var Ni;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"})(Ni||(Ni={}));let Nr=class I0{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsField(e,A){return(A||new I0).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,A){return e.setPosition(e.position()+ui),(A||new I0).__init(e.readInt32(e.position())+e.position(),e)}name(e){const A=this.bb.__offset(this.bb_pos,4);return A?this.bb.__string(this.bb_pos+A,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Ni.NONE}type(e){const A=this.bb.__offset(this.bb_pos,10);return A?this.bb.__union(e,this.bb_pos+A):null}dictionary(e){const A=this.bb.__offset(this.bb_pos,12);return A?(e||new mo).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}children(e,A){const i=this.bb.__offset(this.bb_pos,14);return i?(A||new I0).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,16);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,A){e.addFieldOffset(0,A,0)}static addNullable(e,A){e.addFieldInt8(1,+A,0)}static addTypeType(e,A){e.addFieldInt8(2,A,Ni.NONE)}static addType(e,A){e.addFieldOffset(3,A,0)}static addDictionary(e,A){e.addFieldOffset(4,A,0)}static addChildren(e,A){e.addFieldOffset(5,A,0)}static createChildrenVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startChildrenVector(e,A){e.startVector(4,A,4)}static addCustomMetadata(e,A){e.addFieldOffset(6,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static endField(e){return e.endObject()}},Ms=class ra{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsSchema(e,A){return(A||new ra).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,A){return e.setPosition(e.position()+ui),(A||new ra).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pc.Little}fields(e,A){const i=this.bb.__offset(this.bb_pos,6);return i?(A||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const A=this.bb.__offset(this.bb_pos,10);return A?this.bb.readInt64(this.bb.__vector(this.bb_pos+A)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,A){e.addFieldInt16(0,A,Pc.Little)}static addFields(e,A){e.addFieldOffset(1,A,0)}static createFieldsVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startFieldsVector(e,A){e.startVector(4,A,4)}static addCustomMetadata(e,A){e.addFieldOffset(2,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static addFeatures(e,A){e.addFieldOffset(3,A,0)}static createFeaturesVector(e,A){e.startVector(8,A.length,8);for(let i=A.length-1;i>=0;i--)e.addInt64(A[i]);return e.endVector()}static startFeaturesVector(e,A){e.startVector(8,A,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,A){e.finish(A)}static finishSizePrefixedSchemaBuffer(e,A){e.finish(A,void 0,!0)}static createSchema(e,A,i,n,r){return ra.startSchema(e),ra.addEndianness(e,A),ra.addFields(e,i),ra.addCustomMetadata(e,n),ra.addFeatures(e,r),ra.endSchema(e)}};var si;(function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"})(si||(si={}));var oe;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(oe||(oe={}));var wo;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(wo||(wo={}));const e7=void 0;function sh(t){if(t===null)return"null";if(t===e7)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>sh(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,A)=>typeof A=="bigint"?`${A}`:A)}function vi(t){if(typeof t=="bigint"&&(t<Number.MIN_SAFE_INTEGER||t>Number.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function Wb(t,e){return vi(t/e)+vi(t%e)/vi(e)}const A7=Symbol.for("isArrowBigNum");function ts(t,...e){return e.length===0?Object.setPrototypeOf(Qi(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}ts.prototype[A7]=!0,ts.prototype.toJSON=function(){return`"${ah(this)}"`},ts.prototype.valueOf=function(t){return zb(this,t)},ts.prototype.toString=function(){return ah(this)},ts.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return zb(this);case"string":return ah(this);case"default":return i7(this)}return ah(this)};function Hc(...t){return ts.apply(this,t)}function Jc(...t){return ts.apply(this,t)}function oh(...t){return ts.apply(this,t)}Object.setPrototypeOf(Hc.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Jc.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(oh.prototype,Object.create(Uint32Array.prototype)),Object.assign(Hc.prototype,ts.prototype,{constructor:Hc,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Jc.prototype,ts.prototype,{constructor:Jc,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(oh.prototype,ts.prototype,{constructor:oh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const t7=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function zb(t,e){const{buffer:A,byteOffset:i,byteLength:n,signed:r}=t,s=new BigUint64Array(A,i,n/8),o=r&&s.at(-1)&BigInt(1)<<BigInt(63);let g=BigInt(0),a=0;if(o){for(const c of s)g|=(c^t7)*(BigInt(1)<<BigInt(64*a++));g*=BigInt(-1),g-=BigInt(1)}else for(const c of s)g|=c*(BigInt(1)<<BigInt(64*a++));if(typeof e=="number"){const c=BigInt(Math.pow(10,e)),l=g/c,I=g%c;return vi(l)+vi(I)/vi(c)}return vi(g)}function ah(t){if(t.byteLength===8)return`${new t.BigIntArray(t.buffer,t.byteOffset,1)[0]}`;if(!t.signed)return Kp(t);let e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return Kp(t);e=e.slice();let i=1;for(let r=0;r<e.length;r++){const s=e[r],o=~s+i;e[r]=o,i&=s===0?1:0}return`-${Kp(e)}`}function i7(t){return t.byteLength===8?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:ah(t)}function Kp(t){let e="";const A=new Uint32Array(2);let i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2);const n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer);let r=-1;const s=i.length-1;do{for(A[0]=i[r=0];r<s;)i[r++]=A[1]=A[0]/10,A[0]=(A[0]-A[1]*10<<16)+i[r];i[r]=A[1]=A[0]/10,A[0]=A[0]-A[1]*10,e=`${A[0]}${e}`}while(n[0]||n[1]||n[2]||n[3]);return e??"0"}class Vp{static new(e,A){switch(A){case!0:return new Hc(e);case!1:return new Jc(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Hc(e)}return e.byteLength===16?new oh(e):new Jc(e)}static signed(e){return new Hc(e)}static unsigned(e){return new Jc(e)}static decimal(e){return new oh(e)}constructor(e,A){return Vp.new(e,A)}}var Xb,jb,$b,Zb,ex,Ax,tx,ix,nx,rx,sx,ox,ax,gx,cx,lx,Ix,hx,ux,Bx,Cx,fx;class zA{static isNull(e){return(e==null?void 0:e.typeId)===oe.Null}static isInt(e){return(e==null?void 0:e.typeId)===oe.Int}static isFloat(e){return(e==null?void 0:e.typeId)===oe.Float}static isBinary(e){return(e==null?void 0:e.typeId)===oe.Binary}static isLargeBinary(e){return(e==null?void 0:e.typeId)===oe.LargeBinary}static isUtf8(e){return(e==null?void 0:e.typeId)===oe.Utf8}static isLargeUtf8(e){return(e==null?void 0:e.typeId)===oe.LargeUtf8}static isBool(e){return(e==null?void 0:e.typeId)===oe.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===oe.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===oe.Date}static isTime(e){return(e==null?void 0:e.typeId)===oe.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===oe.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===oe.Interval}static isDuration(e){return(e==null?void 0:e.typeId)===oe.Duration}static isList(e){return(e==null?void 0:e.typeId)===oe.List}static isStruct(e){return(e==null?void 0:e.typeId)===oe.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===oe.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===oe.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===oe.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===oe.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===oe.Dictionary}static isDenseUnion(e){return zA.isUnion(e)&&e.mode===Ln.Dense}static isSparseUnion(e){return zA.isUnion(e)&&e.mode===Ln.Sparse}constructor(e){this.typeId=e}}Xb=Symbol.toStringTag,zA[Xb]=(t=>(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(zA.prototype);class ga extends zA{constructor(){super(oe.Null)}toString(){return"Null"}}jb=Symbol.toStringTag,ga[jb]=(t=>t[Symbol.toStringTag]="Null")(ga.prototype);class yg extends zA{constructor(e,A){super(oe.Int),this.isSigned=e,this.bitWidth=A}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}$b=Symbol.toStringTag,yg[$b]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(yg.prototype);class gh extends yg{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(gh.prototype,"ArrayType",{value:Int32Array});class NC extends zA{constructor(e){super(oe.Float),this.precision=e}get ArrayType(){switch(this.precision){case Un.HALF:return Uint16Array;case Un.SINGLE:return Float32Array;case Un.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Zb=Symbol.toStringTag,NC[Zb]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(NC.prototype);class kC extends zA{constructor(){super(oe.Binary)}toString(){return"Binary"}}ex=Symbol.toStringTag,kC[ex]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(kC.prototype);class MC extends zA{constructor(){super(oe.LargeBinary)}toString(){return"LargeBinary"}}Ax=Symbol.toStringTag,MC[Ax]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(MC.prototype);class TC extends zA{constructor(){super(oe.Utf8)}toString(){return"Utf8"}}tx=Symbol.toStringTag,TC[tx]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(TC.prototype);class LC extends zA{constructor(){super(oe.LargeUtf8)}toString(){return"LargeUtf8"}}ix=Symbol.toStringTag,LC[ix]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(LC.prototype);class UC extends zA{constructor(){super(oe.Bool)}toString(){return"Bool"}}nx=Symbol.toStringTag,UC[nx]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(UC.prototype);class GC extends zA{constructor(e,A,i=128){super(oe.Decimal),this.scale=e,this.precision=A,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}rx=Symbol.toStringTag,GC[rx]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(GC.prototype);class OC extends zA{constructor(e){super(oe.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${xr[this.unit]}>`}get ArrayType(){return this.unit===xr.DAY?Int32Array:BigInt64Array}}sx=Symbol.toStringTag,OC[sx]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(OC.prototype);class PC extends zA{constructor(e,A){super(oe.Time),this.unit=e,this.bitWidth=A}toString(){return`Time${this.bitWidth}<${ht[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}ox=Symbol.toStringTag,PC[ox]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(PC.prototype);class qC extends zA{constructor(e,A){super(oe.Timestamp),this.unit=e,this.timezone=A}toString(){return`Timestamp<${ht[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ax=Symbol.toStringTag,qC[ax]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(qC.prototype);class HC extends zA{constructor(e){super(oe.Interval),this.unit=e}toString(){return`Interval<${Rs[this.unit]}>`}}gx=Symbol.toStringTag,HC[gx]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(HC.prototype);class JC extends zA{constructor(e){super(oe.Duration),this.unit=e}toString(){return`Duration<${ht[this.unit]}>`}}cx=Symbol.toStringTag,JC[cx]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(JC.prototype);class YC extends zA{constructor(e){super(oe.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lx=Symbol.toStringTag,YC[lx]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(YC.prototype);class Xn extends zA{constructor(e){super(oe.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Ix=Symbol.toStringTag,Xn[Ix]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(Xn.prototype);class KC extends zA{constructor(e,A,i){super(oe.Union),this.mode=e,this.children=i,this.typeIds=A=Int32Array.from(A),this.typeIdToChildIndex=A.reduce((n,r,s)=>(n[r]=s)&&n||n,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}hx=Symbol.toStringTag,KC[hx]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(KC.prototype);class VC extends zA{constructor(e){super(oe.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}ux=Symbol.toStringTag,VC[ux]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(VC.prototype);class WC extends zA{constructor(e,A){super(oe.FixedSizeList),this.listSize=e,this.children=[A]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Bx=Symbol.toStringTag,WC[Bx]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(WC.prototype);class zC extends zA{constructor(e,A=!1){var i,n,r;if(super(oe.Map),this.children=[e],this.keysSorted=A,e&&(e.name="entries",!((i=e==null?void 0:e.type)===null||i===void 0)&&i.children)){const s=(n=e==null?void 0:e.type)===null||n===void 0?void 0:n.children[0];s&&(s.name="key");const o=(r=e==null?void 0:e.type)===null||r===void 0?void 0:r.children[1];o&&(o.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}Cx=Symbol.toStringTag,zC[Cx]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(zC.prototype);const n7=(t=>()=>++t)(-1);class Yc extends zA{constructor(e,A,i,n){super(oe.Dictionary),this.indices=A,this.dictionary=e,this.isOrdered=n||!1,this.id=i==null?n7():vi(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}fx=Symbol.toStringTag,Yc[fx]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(Yc.prototype);function Do(t){const e=t;switch(t.typeId){case oe.Decimal:return t.bitWidth/32;case oe.Interval:return 1+e.unit;case oe.FixedSizeList:return e.listSize;case oe.FixedSizeBinary:return e.byteWidth;default:return 1}}class Ut{visitMany(e,...A){return e.map((i,n)=>this.visit(i,...A.map(r=>r[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,A=!0){return r7(this,e,A)}getVisitFnByTypeId(e,A=!0){return Kc(this,e,A)}visitNull(e,...A){return null}visitBool(e,...A){return null}visitInt(e,...A){return null}visitFloat(e,...A){return null}visitUtf8(e,...A){return null}visitLargeUtf8(e,...A){return null}visitBinary(e,...A){return null}visitLargeBinary(e,...A){return null}visitFixedSizeBinary(e,...A){return null}visitDate(e,...A){return null}visitTimestamp(e,...A){return null}visitTime(e,...A){return null}visitDecimal(e,...A){return null}visitList(e,...A){return null}visitStruct(e,...A){return null}visitUnion(e,...A){return null}visitDictionary(e,...A){return null}visitInterval(e,...A){return null}visitDuration(e,...A){return null}visitFixedSizeList(e,...A){return null}visitMap(e,...A){return null}}function r7(t,e,A=!0){return typeof e=="number"?Kc(t,e,A):typeof e=="string"&&e in oe?Kc(t,oe[e],A):e&&e instanceof zA?Kc(t,Ex(e),A):e!=null&&e.type&&e.type instanceof zA?Kc(t,Ex(e.type),A):Kc(t,oe.NONE,A)}function Kc(t,e,A=!0){let i=null;switch(e){case oe.Null:i=t.visitNull;break;case oe.Bool:i=t.visitBool;break;case oe.Int:i=t.visitInt;break;case oe.Int8:i=t.visitInt8||t.visitInt;break;case oe.Int16:i=t.visitInt16||t.visitInt;break;case oe.Int32:i=t.visitInt32||t.visitInt;break;case oe.Int64:i=t.visitInt64||t.visitInt;break;case oe.Uint8:i=t.visitUint8||t.visitInt;break;case oe.Uint16:i=t.visitUint16||t.visitInt;break;case oe.Uint32:i=t.visitUint32||t.visitInt;break;case oe.Uint64:i=t.visitUint64||t.visitInt;break;case oe.Float:i=t.visitFloat;break;case oe.Float16:i=t.visitFloat16||t.visitFloat;break;case oe.Float32:i=t.visitFloat32||t.visitFloat;break;case oe.Float64:i=t.visitFloat64||t.visitFloat;break;case oe.Utf8:i=t.visitUtf8;break;case oe.LargeUtf8:i=t.visitLargeUtf8;break;case oe.Binary:i=t.visitBinary;break;case oe.LargeBinary:i=t.visitLargeBinary;break;case oe.FixedSizeBinary:i=t.visitFixedSizeBinary;break;case oe.Date:i=t.visitDate;break;case oe.DateDay:i=t.visitDateDay||t.visitDate;break;case oe.DateMillisecond:i=t.visitDateMillisecond||t.visitDate;break;case oe.Timestamp:i=t.visitTimestamp;break;case oe.TimestampSecond:i=t.visitTimestampSecond||t.visitTimestamp;break;case oe.TimestampMillisecond:i=t.visitTimestampMillisecond||t.visitTimestamp;break;case oe.TimestampMicrosecond:i=t.visitTimestampMicrosecond||t.visitTimestamp;break;case oe.TimestampNanosecond:i=t.visitTimestampNanosecond||t.visitTimestamp;break;case oe.Time:i=t.visitTime;break;case oe.TimeSecond:i=t.visitTimeSecond||t.visitTime;break;case oe.TimeMillisecond:i=t.visitTimeMillisecond||t.visitTime;break;case oe.TimeMicrosecond:i=t.visitTimeMicrosecond||t.visitTime;break;case oe.TimeNanosecond:i=t.visitTimeNanosecond||t.visitTime;break;case oe.Decimal:i=t.visitDecimal;break;case oe.List:i=t.visitList;break;case oe.Struct:i=t.visitStruct;break;case oe.Union:i=t.visitUnion;break;case oe.DenseUnion:i=t.visitDenseUnion||t.visitUnion;break;case oe.SparseUnion:i=t.visitSparseUnion||t.visitUnion;break;case oe.Dictionary:i=t.visitDictionary;break;case oe.Interval:i=t.visitInterval;break;case oe.IntervalDayTime:i=t.visitIntervalDayTime||t.visitInterval;break;case oe.IntervalYearMonth:i=t.visitIntervalYearMonth||t.visitInterval;break;case oe.Duration:i=t.visitDuration;break;case oe.DurationSecond:i=t.visitDurationSecond||t.visitDuration;break;case oe.DurationMillisecond:i=t.visitDurationMillisecond||t.visitDuration;break;case oe.DurationMicrosecond:i=t.visitDurationMicrosecond||t.visitDuration;break;case oe.DurationNanosecond:i=t.visitDurationNanosecond||t.visitDuration;break;case oe.FixedSizeList:i=t.visitFixedSizeList;break;case oe.Map:i=t.visitMap;break}if(typeof i=="function")return i;if(!A)return()=>null;throw new Error(`Unrecognized type '${oe[e]}'`)}function Ex(t){switch(t.typeId){case oe.Null:return oe.Null;case oe.Int:{const{bitWidth:e,isSigned:A}=t;switch(e){case 8:return A?oe.Int8:oe.Uint8;case 16:return A?oe.Int16:oe.Uint16;case 32:return A?oe.Int32:oe.Uint32;case 64:return A?oe.Int64:oe.Uint64}return oe.Int}case oe.Float:switch(t.precision){case Un.HALF:return oe.Float16;case Un.SINGLE:return oe.Float32;case Un.DOUBLE:return oe.Float64}return oe.Float;case oe.Binary:return oe.Binary;case oe.LargeBinary:return oe.LargeBinary;case oe.Utf8:return oe.Utf8;case oe.LargeUtf8:return oe.LargeUtf8;case oe.Bool:return oe.Bool;case oe.Decimal:return oe.Decimal;case oe.Time:switch(t.unit){case ht.SECOND:return oe.TimeSecond;case ht.MILLISECOND:return oe.TimeMillisecond;case ht.MICROSECOND:return oe.TimeMicrosecond;case ht.NANOSECOND:return oe.TimeNanosecond}return oe.Time;case oe.Timestamp:switch(t.unit){case ht.SECOND:return oe.TimestampSecond;case ht.MILLISECOND:return oe.TimestampMillisecond;case ht.MICROSECOND:return oe.TimestampMicrosecond;case ht.NANOSECOND:return oe.TimestampNanosecond}return oe.Timestamp;case oe.Date:switch(t.unit){case xr.DAY:return oe.DateDay;case xr.MILLISECOND:return oe.DateMillisecond}return oe.Date;case oe.Interval:switch(t.unit){case Rs.DAY_TIME:return oe.IntervalDayTime;case Rs.YEAR_MONTH:return oe.IntervalYearMonth}return oe.Interval;case oe.Duration:switch(t.unit){case ht.SECOND:return oe.DurationSecond;case ht.MILLISECOND:return oe.DurationMillisecond;case ht.MICROSECOND:return oe.DurationMicrosecond;case ht.NANOSECOND:return oe.DurationNanosecond}return oe.Duration;case oe.Map:return oe.Map;case oe.List:return oe.List;case oe.Struct:return oe.Struct;case oe.Union:switch(t.mode){case Ln.Dense:return oe.DenseUnion;case Ln.Sparse:return oe.SparseUnion}return oe.Union;case oe.FixedSizeBinary:return oe.FixedSizeBinary;case oe.FixedSizeList:return oe.FixedSizeList;case oe.Dictionary:return oe.Dictionary}throw new Error(`Unrecognized type '${oe[t.typeId]}'`)}Ut.prototype.visitInt8=null,Ut.prototype.visitInt16=null,Ut.prototype.visitInt32=null,Ut.prototype.visitInt64=null,Ut.prototype.visitUint8=null,Ut.prototype.visitUint16=null,Ut.prototype.visitUint32=null,Ut.prototype.visitUint64=null,Ut.prototype.visitFloat16=null,Ut.prototype.visitFloat32=null,Ut.prototype.visitFloat64=null,Ut.prototype.visitDateDay=null,Ut.prototype.visitDateMillisecond=null,Ut.prototype.visitTimestampSecond=null,Ut.prototype.visitTimestampMillisecond=null,Ut.prototype.visitTimestampMicrosecond=null,Ut.prototype.visitTimestampNanosecond=null,Ut.prototype.visitTimeSecond=null,Ut.prototype.visitTimeMillisecond=null,Ut.prototype.visitTimeMicrosecond=null,Ut.prototype.visitTimeNanosecond=null,Ut.prototype.visitDenseUnion=null,Ut.prototype.visitSparseUnion=null,Ut.prototype.visitIntervalDayTime=null,Ut.prototype.visitIntervalYearMonth=null,Ut.prototype.visitDuration=null,Ut.prototype.visitDurationSecond=null,Ut.prototype.visitDurationMillisecond=null,Ut.prototype.visitDurationMicrosecond=null,Ut.prototype.visitDurationNanosecond=null;const dx=new Float64Array(1),Vc=new Uint32Array(dx.buffer);function Qx(t){const e=(t&31744)>>10,A=(t&1023)/1024,i=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return i*(A?Number.NaN:1/0);case 0:return i*(A?6103515625e-14*A:0)}return i*Math.pow(2,e-15)*(1+A)}function s7(t){if(t!==t)return 32256;dx[0]=t;const e=(Vc[1]&2147483648)>>16&65535;let A=Vc[1]&2146435072,i=0;return A>=1089470464?Vc[0]>0?A=31744:(A=(A&2080374784)>>16,i=(Vc[1]&1048575)>>10):A<=1056964608?(i=1048576+(Vc[1]&1048575),i=1048576+(i<<(A>>20)-998)>>21,A=0):(A=A-1056964608>>10,i=(Vc[1]&1048575)+512>>10),e|A|i&65535}class ut extends Ut{}function Et(t){return(e,A,i)=>{if(e.setValid(A,i!=null))return t(e,A,i)}}const o7=(t,e,A)=>{t[e]=Math.floor(A/864e5)},px=(t,e,A,i)=>{if(A+1<e.length){const n=vi(e[A]),r=vi(e[A+1]);t.set(i.subarray(0,r-n),n)}},a7=({offset:t,values:e},A,i)=>{const n=t+A;i?e[n>>3]|=1<<n%8:e[n>>3]&=~(1<<n%8)},_o=({values:t},e,A)=>{t[e]=A},Wp=({values:t},e,A)=>{t[e]=A},yx=({values:t},e,A)=>{t[e]=s7(A)},g7=(t,e,A)=>{switch(t.type.precision){case Un.HALF:return yx(t,e,A);case Un.SINGLE:case Un.DOUBLE:return Wp(t,e,A)}},mx=({values:t},e,A)=>{o7(t,e,A.valueOf())},wx=({values:t},e,A)=>{t[e]=BigInt(A)},c7=({stride:t,values:e},A,i)=>{e.set(i.subarray(0,t),t*A)},Dx=({values:t,valueOffsets:e},A,i)=>px(t,e,A,i),_x=({values:t,valueOffsets:e},A,i)=>px(t,e,A,Up(i)),l7=(t,e,A)=>{t.type.unit===xr.DAY?mx(t,e,A):wx(t,e,A)},Sx=({values:t},e,A)=>{t[e]=BigInt(A/1e3)},vx=({values:t},e,A)=>{t[e]=BigInt(A)},bx=({values:t},e,A)=>{t[e]=BigInt(A*1e3)},xx=({values:t},e,A)=>{t[e]=BigInt(A*1e6)},I7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Sx(t,e,A);case ht.MILLISECOND:return vx(t,e,A);case ht.MICROSECOND:return bx(t,e,A);case ht.NANOSECOND:return xx(t,e,A)}},Rx=({values:t},e,A)=>{t[e]=A},Fx=({values:t},e,A)=>{t[e]=A},Nx=({values:t},e,A)=>{t[e]=A},kx=({values:t},e,A)=>{t[e]=A},h7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Rx(t,e,A);case ht.MILLISECOND:return Fx(t,e,A);case ht.MICROSECOND:return Nx(t,e,A);case ht.NANOSECOND:return kx(t,e,A)}},u7=({values:t,stride:e},A,i)=>{t.set(i.subarray(0,e),e*A)},B7=(t,e,A)=>{const i=t.children[0],n=t.valueOffsets,r=kr.getVisitFn(i);if(Array.isArray(A))for(let s=-1,o=n[e],g=n[e+1];o<g;)r(i,o++,A[++s]);else for(let s=-1,o=n[e],g=n[e+1];o<g;)r(i,o++,A.get(++s))},C7=(t,e,A)=>{const i=t.children[0],{valueOffsets:n}=t,r=kr.getVisitFn(i);let{[e]:s,[e+1]:o}=n;const g=A instanceof Map?A.entries():Object.entries(A);for(const a of g)if(r(i,s,a),++s>=o)break},f7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e[r]),E7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e.get(r)),d7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e.get(n.name)),Q7=(t,e)=>(A,i,n,r)=>i&&A(i,t,e[n.name]),p7=(t,e,A)=>{const i=t.type.children.map(r=>kr.getVisitFn(r.type)),n=A instanceof Map?d7(e,A):A instanceof Ki?E7(e,A):Array.isArray(A)?f7(e,A):Q7(e,A);t.type.children.forEach((r,s)=>n(i[s],t.children[s],r,s))},y7=(t,e,A)=>{t.type.mode===Ln.Dense?Mx(t,e,A):Tx(t,e,A)},Mx=(t,e,A)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];kr.visit(n,t.valueOffsets[e],A)},Tx=(t,e,A)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];kr.visit(n,e,A)},m7=(t,e,A)=>{var i;(i=t.dictionary)===null||i===void 0||i.set(t.values[e],A)},w7=(t,e,A)=>{t.type.unit===Rs.DAY_TIME?Lx(t,e,A):Ux(t,e,A)},Lx=({values:t},e,A)=>{t.set(A.subarray(0,2),2*e)},Ux=({values:t},e,A)=>{t[e]=A[0]*12+A[1]%12},Gx=({values:t},e,A)=>{t[e]=A},Ox=({values:t},e,A)=>{t[e]=A},Px=({values:t},e,A)=>{t[e]=A},qx=({values:t},e,A)=>{t[e]=A},D7=(t,e,A)=>{switch(t.type.unit){case ht.SECOND:return Gx(t,e,A);case ht.MILLISECOND:return Ox(t,e,A);case ht.MICROSECOND:return Px(t,e,A);case ht.NANOSECOND:return qx(t,e,A)}},_7=(t,e,A)=>{const{stride:i}=t,n=t.children[0],r=kr.getVisitFn(n);if(Array.isArray(A))for(let s=-1,o=e*i;++s<i;)r(n,o+s,A[s]);else for(let s=-1,o=e*i;++s<i;)r(n,o+s,A.get(s))};ut.prototype.visitBool=Et(a7),ut.prototype.visitInt=Et(_o),ut.prototype.visitInt8=Et(_o),ut.prototype.visitInt16=Et(_o),ut.prototype.visitInt32=Et(_o),ut.prototype.visitInt64=Et(_o),ut.prototype.visitUint8=Et(_o),ut.prototype.visitUint16=Et(_o),ut.prototype.visitUint32=Et(_o),ut.prototype.visitUint64=Et(_o),ut.prototype.visitFloat=Et(g7),ut.prototype.visitFloat16=Et(yx),ut.prototype.visitFloat32=Et(Wp),ut.prototype.visitFloat64=Et(Wp),ut.prototype.visitUtf8=Et(_x),ut.prototype.visitLargeUtf8=Et(_x),ut.prototype.visitBinary=Et(Dx),ut.prototype.visitLargeBinary=Et(Dx),ut.prototype.visitFixedSizeBinary=Et(c7),ut.prototype.visitDate=Et(l7),ut.prototype.visitDateDay=Et(mx),ut.prototype.visitDateMillisecond=Et(wx),ut.prototype.visitTimestamp=Et(I7),ut.prototype.visitTimestampSecond=Et(Sx),ut.prototype.visitTimestampMillisecond=Et(vx),ut.prototype.visitTimestampMicrosecond=Et(bx),ut.prototype.visitTimestampNanosecond=Et(xx),ut.prototype.visitTime=Et(h7),ut.prototype.visitTimeSecond=Et(Rx),ut.prototype.visitTimeMillisecond=Et(Fx),ut.prototype.visitTimeMicrosecond=Et(Nx),ut.prototype.visitTimeNanosecond=Et(kx),ut.prototype.visitDecimal=Et(u7),ut.prototype.visitList=Et(B7),ut.prototype.visitStruct=Et(p7),ut.prototype.visitUnion=Et(y7),ut.prototype.visitDenseUnion=Et(Mx),ut.prototype.visitSparseUnion=Et(Tx),ut.prototype.visitDictionary=Et(m7),ut.prototype.visitInterval=Et(w7),ut.prototype.visitIntervalDayTime=Et(Lx),ut.prototype.visitIntervalYearMonth=Et(Ux),ut.prototype.visitDuration=Et(D7),ut.prototype.visitDurationSecond=Et(Gx),ut.prototype.visitDurationMillisecond=Et(Ox),ut.prototype.visitDurationMicrosecond=Et(Px),ut.prototype.visitDurationNanosecond=Et(qx),ut.prototype.visitFixedSizeList=Et(_7),ut.prototype.visitMap=Et(C7);const kr=new ut,is=Symbol.for("parent"),Wc=Symbol.for("rowIndex");class zp{constructor(e,A){return this[is]=e,this[Wc]=A,new Proxy(this,new v7)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[Wc],A=this[is],i=A.type.children,n={};for(let r=-1,s=i.length;++r<s;)n[i[r].name]=or.visit(A.children[r],e);return n}toString(){return`{${[...this].map(([e,A])=>`${sh(e)}: ${sh(A)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new S7(this[is],this[Wc])}}class S7{constructor(e,A){this.childIndex=0,this.children=e.children,this.rowIndex=A,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,or.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(zp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[is]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wc]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class v7{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[is].type.children.map(A=>A.name)}has(e,A){return e[is].type.children.findIndex(i=>i.name===A)!==-1}getOwnPropertyDescriptor(e,A){if(e[is].type.children.findIndex(i=>i.name===A)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,A){if(Reflect.has(e,A))return e[A];const i=e[is].type.children.findIndex(n=>n.name===A);if(i!==-1){const n=or.visit(e[is].children[i],e[Wc]);return Reflect.set(e,A,n),n}}set(e,A,i){const n=e[is].type.children.findIndex(r=>r.name===A);return n!==-1?(kr.visit(e[is].children[n],e[Wc],i),Reflect.set(e,A,i)):Reflect.has(e,A)||typeof A=="symbol"?Reflect.set(e,A,i):!1}}class at extends Ut{}function Bt(t){return(e,A)=>e.getValid(A)?t(e,A):null}const b7=(t,e)=>864e5*t[e],x7=(t,e)=>null,Hx=(t,e,A)=>{if(A+1>=e.length)return null;const i=vi(e[A]),n=vi(e[A+1]);return t.subarray(i,n)},R7=({offset:t,values:e},A)=>{const i=t+A;return(e[i>>3]&1<<i%8)!==0},Jx=({values:t},e)=>b7(t,e),Yx=({values:t},e)=>vi(t[e]),ca=({stride:t,values:e},A)=>e[t*A],F7=({stride:t,values:e},A)=>Qx(e[t*A]),Kx=({values:t},e)=>t[e],N7=({stride:t,values:e},A)=>e.subarray(t*A,t*(A+1)),Vx=({values:t,valueOffsets:e},A)=>Hx(t,e,A),Wx=({values:t,valueOffsets:e},A)=>{const i=Hx(t,e,A);return i!==null?Lp(i):null},k7=({values:t},e)=>t[e],M7=({type:t,values:e},A)=>t.precision!==Un.HALF?e[A]:Qx(e[A]),T7=(t,e)=>t.type.unit===xr.DAY?Jx(t,e):Yx(t,e),zx=({values:t},e)=>1e3*vi(t[e]),Xx=({values:t},e)=>vi(t[e]),jx=({values:t},e)=>Wb(t[e],BigInt(1e3)),$x=({values:t},e)=>Wb(t[e],BigInt(1e6)),L7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return zx(t,e);case ht.MILLISECOND:return Xx(t,e);case ht.MICROSECOND:return jx(t,e);case ht.NANOSECOND:return $x(t,e)}},Zx=({values:t},e)=>t[e],eR=({values:t},e)=>t[e],AR=({values:t},e)=>t[e],tR=({values:t},e)=>t[e],U7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return Zx(t,e);case ht.MILLISECOND:return eR(t,e);case ht.MICROSECOND:return AR(t,e);case ht.NANOSECOND:return tR(t,e)}},G7=({values:t,stride:e},A)=>Vp.decimal(t.subarray(e*A,e*(A+1))),O7=(t,e)=>{const{valueOffsets:A,stride:i,children:n}=t,{[e*i]:r,[e*i+1]:s}=A,g=n[0].slice(r,s-r);return new Ki([g])},P7=(t,e)=>{const{valueOffsets:A,children:i}=t,{[e]:n,[e+1]:r}=A,s=i[0];return new jp(s.slice(n,r-n))},q7=(t,e)=>new zp(t,e),H7=(t,e)=>t.type.mode===Ln.Dense?iR(t,e):nR(t,e),iR=(t,e)=>{const A=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[A];return or.visit(i,t.valueOffsets[e])},nR=(t,e)=>{const A=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[A];return or.visit(i,e)},J7=(t,e)=>{var A;return(A=t.dictionary)===null||A===void 0?void 0:A.get(t.values[e])},Y7=(t,e)=>t.type.unit===Rs.DAY_TIME?rR(t,e):sR(t,e),rR=({values:t},e)=>t.subarray(2*e,2*(e+1)),sR=({values:t},e)=>{const A=t[e],i=new Int32Array(2);return i[0]=Math.trunc(A/12),i[1]=Math.trunc(A%12),i},oR=({values:t},e)=>t[e],aR=({values:t},e)=>t[e],gR=({values:t},e)=>t[e],cR=({values:t},e)=>t[e],K7=(t,e)=>{switch(t.type.unit){case ht.SECOND:return oR(t,e);case ht.MILLISECOND:return aR(t,e);case ht.MICROSECOND:return gR(t,e);case ht.NANOSECOND:return cR(t,e)}},V7=(t,e)=>{const{stride:A,children:i}=t,r=i[0].slice(e*A,A);return new Ki([r])};at.prototype.visitNull=Bt(x7),at.prototype.visitBool=Bt(R7),at.prototype.visitInt=Bt(k7),at.prototype.visitInt8=Bt(ca),at.prototype.visitInt16=Bt(ca),at.prototype.visitInt32=Bt(ca),at.prototype.visitInt64=Bt(Kx),at.prototype.visitUint8=Bt(ca),at.prototype.visitUint16=Bt(ca),at.prototype.visitUint32=Bt(ca),at.prototype.visitUint64=Bt(Kx),at.prototype.visitFloat=Bt(M7),at.prototype.visitFloat16=Bt(F7),at.prototype.visitFloat32=Bt(ca),at.prototype.visitFloat64=Bt(ca),at.prototype.visitUtf8=Bt(Wx),at.prototype.visitLargeUtf8=Bt(Wx),at.prototype.visitBinary=Bt(Vx),at.prototype.visitLargeBinary=Bt(Vx),at.prototype.visitFixedSizeBinary=Bt(N7),at.prototype.visitDate=Bt(T7),at.prototype.visitDateDay=Bt(Jx),at.prototype.visitDateMillisecond=Bt(Yx),at.prototype.visitTimestamp=Bt(L7),at.prototype.visitTimestampSecond=Bt(zx),at.prototype.visitTimestampMillisecond=Bt(Xx),at.prototype.visitTimestampMicrosecond=Bt(jx),at.prototype.visitTimestampNanosecond=Bt($x),at.prototype.visitTime=Bt(U7),at.prototype.visitTimeSecond=Bt(Zx),at.prototype.visitTimeMillisecond=Bt(eR),at.prototype.visitTimeMicrosecond=Bt(AR),at.prototype.visitTimeNanosecond=Bt(tR),at.prototype.visitDecimal=Bt(G7),at.prototype.visitList=Bt(O7),at.prototype.visitStruct=Bt(q7),at.prototype.visitUnion=Bt(H7),at.prototype.visitDenseUnion=Bt(iR),at.prototype.visitSparseUnion=Bt(nR),at.prototype.visitDictionary=Bt(J7),at.prototype.visitInterval=Bt(Y7),at.prototype.visitIntervalDayTime=Bt(rR),at.prototype.visitIntervalYearMonth=Bt(sR),at.prototype.visitDuration=Bt(K7),at.prototype.visitDurationSecond=Bt(oR),at.prototype.visitDurationMillisecond=Bt(aR),at.prototype.visitDurationMicrosecond=Bt(gR),at.prototype.visitDurationNanosecond=Bt(cR),at.prototype.visitFixedSizeList=Bt(V7),at.prototype.visitMap=Bt(P7);const or=new at,zc=Symbol.for("keys"),Xc=Symbol.for("vals"),jc=Symbol.for("kKeysAsStrings"),Xp=Symbol.for("_kKeysAsStrings");class jp{constructor(e){return this[zc]=new Ki([e.children[0]]).memoize(),this[Xc]=e.children[1],new Proxy(this,new z7)}get[jc](){return this[Xp]||(this[Xp]=Array.from(this[zc].toArray(),String))}[Symbol.iterator](){return new W7(this[zc],this[Xc])}get size(){return this[zc].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[zc],A=this[Xc],i={};for(let n=-1,r=e.length;++n<r;)i[e.get(n)]=or.visit(A,n);return i}toString(){return`{${[...this].map(([e,A])=>`${sh(e)}: ${sh(A)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class W7{constructor(e,A){this.keys=e,this.vals=A,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),or.visit(this.vals,e)]})}}class z7{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[jc]}has(e,A){return e[jc].includes(A)}getOwnPropertyDescriptor(e,A){if(e[jc].indexOf(A)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,A){if(Reflect.has(e,A))return e[A];const i=e[jc].indexOf(A);if(i!==-1){const n=or.visit(Reflect.get(e,Xc),i);return Reflect.set(e,A,n),n}}set(e,A,i){const n=e[jc].indexOf(A);return n!==-1?(kr.visit(Reflect.get(e,Xc),n,i),Reflect.set(e,A,i)):Reflect.has(e,A)?Reflect.set(e,A,i):!1}}Object.defineProperties(jp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[zc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xp]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let lR;function IR(t,e,A,i){const{length:n=0}=t;let r=typeof e!="number"?0:e,s=typeof A!="number"?n:A;return r<0&&(r=(r%n+n)%n),s<0&&(s=(s%n+n)%n),s<r&&(lR=r,r=s,s=lR),s>n&&(s=n),i?i(t,r,s):[r,s]}const $p=(t,e)=>t<0?e+t:t,hR=t=>t!==t;function $c(t){if(typeof t!=="object"||t===null)return hR(t)?hR:A=>A===t;if(t instanceof Date){const A=t.valueOf();return i=>i instanceof Date?i.valueOf()===A:!1}return ArrayBuffer.isView(t)?A=>A?Wz(t,A):!1:t instanceof Map?j7(t):Array.isArray(t)?X7(t):t instanceof Ki?$7(t):Z7(t,!0)}function X7(t){const e=[];for(let A=-1,i=t.length;++A<i;)e[A]=$c(t[A]);return XC(e)}function j7(t){let e=-1;const A=[];for(const i of t.values())A[++e]=$c(i);return XC(A)}function $7(t){const e=[];for(let A=-1,i=t.length;++A<i;)e[A]=$c(t.get(A));return XC(e)}function Z7(t,e=!1){const A=Object.keys(t);if(!e&&A.length===0)return()=>!1;const i=[];for(let n=-1,r=A.length;++n<r;)i[n]=$c(t[A[n]]);return XC(i,A)}function XC(t,e){return A=>{if(!A||typeof A!="object")return!1;switch(A.constructor){case Array:return eX(t,A);case Map:return uR(t,A,A.keys());case jp:case zp:case Object:case void 0:return uR(t,A,e||Object.keys(A))}return A instanceof Ki?AX(t,A):!1}}function eX(t,e){const A=t.length;if(e.length!==A)return!1;for(let i=-1;++i<A;)if(!t[i](e[i]))return!1;return!0}function AX(t,e){const A=t.length;if(e.length!==A)return!1;for(let i=-1;++i<A;)if(!t[i](e.get(i)))return!1;return!0}function uR(t,e,A){const i=A[Symbol.iterator](),n=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),r=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let s=0;const o=t.length;let g=r.next(),a=i.next(),c=n.next();for(;s<o&&!a.done&&!c.done&&!g.done&&!(a.value!==c.value||!t[s](g.value));++s,a=i.next(),c=n.next(),g=r.next());return s===o&&a.done&&c.done&&g.done?!0:(i.return&&i.return(),n.return&&n.return(),r.return&&r.return(),!1)}function BR(t,e,A,i){return(A&1<<i)!==0}function tX(t,e,A,i){return(A&1<<i)>>i}function jC(t,e,A){const i=A.byteLength+7&-8;if(t>0||A.byteLength<i){const n=new Uint8Array(i);return n.set(t%8===0?A.subarray(t>>3):$C(new Zp(A,t,e,null,BR)).subarray(0,i)),n}return A}function $C(t){const e=[];let A=0,i=0,n=0;for(const s of t)s&&(n|=1<<i),++i===8&&(e[A++]=n,n=i=0);(A===0||i>0)&&(e[A++]=n);const r=new Uint8Array(e.length+7&-8);return r.set(e),r}class Zp{constructor(e,A,i,n,r){this.bytes=e,this.length=i,this.context=n,this.get=r,this.bit=A%8,this.byteIndex=A>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}function ey(t,e,A){if(A-e<=0)return 0;if(A-e<8){let r=0;for(const s of new Zp(t,e,A-e,t,tX))r+=s;return r}const i=A>>3<<3,n=e+(e%8===0?0:8-e%8);return ey(t,e,n)+ey(t,i,A)+iX(t,n>>3,i-n>>3)}function iX(t,e,A){let i=0,n=Math.trunc(e);const r=new DataView(t.buffer,t.byteOffset,t.byteLength),s=A===void 0?t.byteLength:n+A;for(;s-n>=4;)i+=Ay(r.getUint32(n)),n+=4;for(;s-n>=2;)i+=Ay(r.getUint16(n)),n+=2;for(;s-n>=1;)i+=Ay(r.getUint8(n)),n+=1;return i}function Ay(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const nX=-1;class pi{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return zA.isSparseUnion(e)?this.children.some(A=>A.nullable):zA.isDenseUnion(e)?this.children.some(A=>A.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:A,values:i,nullBitmap:n,typeIds:r}=this;return A&&(e+=A.byteLength),i&&(e+=i.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),this.children.reduce((s,o)=>s+o.byteLength,e)}get nullCount(){if(zA.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let e=this._nullCount,A;return e<=nX&&(A=this.nullBitmap)&&(this._nullCount=e=A.length===0?0:this.length-ey(A,this.offset,this.offset+this.length)),e}constructor(e,A,i,n,r,s=[],o){this.type=e,this.children=s,this.dictionary=o,this.offset=Math.floor(Math.max(A||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1));let g;r instanceof pi?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=Do(e),r&&((g=r[0])&&(this.valueOffsets=g),(g=r[1])&&(this.values=g),(g=r[2])&&(this.nullBitmap=g),(g=r[3])&&(this.typeIds=g)))}getValid(e){const{type:A}=this;if(zA.isUnion(A)){const i=A,n=this.children[i.typeIdToChildIndex[this.typeIds[e]]],r=i.mode===Ln.Dense?this.valueOffsets[e]:e;return n.getValid(r)}if(this.nullable&&this.nullCount>0){const i=this.offset+e;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(e,A){let i;const{type:n}=this;if(zA.isUnion(n)){const r=n,s=this.children[r.typeIdToChildIndex[this.typeIds[e]]],o=r.mode===Ln.Dense?this.valueOffsets[e]:e;i=s.getValid(o),s.setValid(o,A)}else{let{nullBitmap:r}=this;const{offset:s,length:o}=this,g=s+e,a=1<<g%8,c=g>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((s+o+63&-64)>>3).fill(255),this.nullCount>0?(r.set(jC(s,o,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));const l=r[c];i=(l&a)!==0,r[c]=A?l|a:l&~a}return i!==!!A&&(this._nullCount=this.nullCount+(A?-1:1)),A}clone(e=this.type,A=this.offset,i=this.length,n=this._nullCount,r=this,s=this.children){return new pi(e,A,i,n,r,s,this.dictionary)}slice(e,A){const{stride:i,typeId:n,children:r}=this,s=+(this._nullCount===0)-1,o=n===16?i:1,g=this._sliceBuffers(e,A,i,n);return this.clone(this.type,this.offset+e,A,s,g,r.length===0||this.valueOffsets?r:this._sliceChildren(r,o*e,o*A))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===oe.Null)return this.clone(this.type,0,e,0);const{length:A,nullCount:i}=this,n=new Uint8Array((e+63&-64)>>3).fill(255,0,A>>3);n[A>>3]=(1<<A-(A&-8))-1,i>0&&n.set(jC(this.offset,A,this.nullBitmap),0);const r=this.buffers;return r[wo.VALIDITY]=n,this.clone(this.type,0,e,i+(e-A),r)}_sliceBuffers(e,A,i,n){let r;const{buffers:s}=this;return(r=s[wo.TYPE])&&(s[wo.TYPE]=r.subarray(e,e+A)),(r=s[wo.OFFSET])&&(s[wo.OFFSET]=r.subarray(e,e+A+1))||(r=s[wo.DATA])&&(s[wo.DATA]=n===6?r:r.subarray(i*e,i*(e+A))),s}_sliceChildren(e,A,i){return e.map(n=>n.slice(A,i))}}pi.prototype.children=Object.freeze([]);class ch extends Ut{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:A,["offset"]:i=0,["length"]:n=0}=e;return new pi(A,i,n,n)}visitBool(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length>>3,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitInt(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitFloat(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitUtf8(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitLargeUtf8(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=Nb(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitLargeBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.data),r=Xt(e.nullBitmap),s=Nb(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,n,r])}visitFixedSizeBinary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDate(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitTimestamp(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitTime(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDecimal(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitList(e){const{["type"]:A,["offset"]:i=0,["child"]:n}=e,r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,void 0,r],[n])}visitStruct(e){const{["type"]:A,["offset"]:i=0,["children"]:n=[]}=e,r=Xt(e.nullBitmap),{length:s=n.reduce((g,{length:a})=>Math.max(g,a),0),nullCount:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,void 0,r],n)}visitUnion(e){const{["type"]:A,["offset"]:i=0,["children"]:n=[]}=e,r=Qi(A.ArrayType,e.typeIds),{["length"]:s=r.length,["nullCount"]:o=-1}=e;if(zA.isSparseUnion(A))return new pi(A,i,s,o,[void 0,void 0,void 0,r],n);const g=rh(e.valueOffsets);return new pi(A,i,s,o,[g,void 0,void 0,r],n)}visitDictionary(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.indices.ArrayType,e.data),{["dictionary"]:s=new Ki([new ch().visit({type:A.dictionary})])}=e,{["length"]:o=r.length,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[void 0,r,n],[],s)}visitInterval(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitDuration(e){const{["type"]:A,["offset"]:i=0}=e,n=Xt(e.nullBitmap),r=Qi(A.ArrayType,e.data),{["length"]:s=r.length,["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,r,n])}visitFixedSizeList(e){const{["type"]:A,["offset"]:i=0,["child"]:n=new ch().visit({type:A.valueType})}=e,r=Xt(e.nullBitmap),{["length"]:s=n.length/Do(A),["nullCount"]:o=e.nullBitmap?-1:0}=e;return new pi(A,i,s,o,[void 0,void 0,r],[n])}visitMap(e){const{["type"]:A,["offset"]:i=0,["child"]:n=new ch().visit({type:A.childType})}=e,r=Xt(e.nullBitmap),s=rh(e.valueOffsets),{["length"]:o=s.length-1,["nullCount"]:g=e.nullBitmap?-1:0}=e;return new pi(A,i,o,g,[s,void 0,r],[n])}}const rX=new ch;function Ot(t){return rX.visit(t)}class CR{constructor(e=0,A){this.numChunks=e,this.getChunkIterator=A,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function sX(t){return t.some(e=>e.nullable)}function fR(t){return t.reduce((e,A)=>e+A.nullCount,0)}function ER(t){return t.reduce((e,A,i)=>(e[i+1]=e[i]+A.length,e),new Uint32Array(t.length+1))}function dR(t,e,A,i){const n=[];for(let r=-1,s=t.length;++r<s;){const o=t[r],g=e[r],{length:a}=o;if(g>=i)break;if(A>=g+a)continue;if(g>=A&&g+a<=i){n.push(o);continue}const c=Math.max(0,A-g),l=Math.min(i-g,a);n.push(o.slice(c,l-c))}return n.length===0&&n.push(t[0].slice(0,0)),n}function ty(t,e,A,i){let n=0,r=0,s=e.length-1;do{if(n>=s-1)return A<e[s]?i(t,n,A-e[n]):null;r=n+Math.trunc((s-n)*.5),A<e[r]?s=r:n=r}while(n<s)}function iy(t,e){return t.getValid(e)}function ZC(t){function e(A,i,n){return t(A[i],n)}return function(A){const i=this.data;return ty(i,this._offsets,A,e)}}function QR(t){let e;function A(i,n,r){return t(i[n],r,e)}return function(i,n){const r=this.data;e=n;const s=ty(r,this._offsets,i,A);return e=void 0,s}}function pR(t){let e;function A(i,n,r){let s=r,o=0,g=0;for(let a=n-1,c=i.length;++a<c;){const l=i[a];if(~(o=t(l,e,s)))return g+o;s=0,g+=l.length}return-1}return function(i,n){e=i;const r=this.data,s=typeof n!="number"?A(r,0,0):ty(r,this._offsets,n,A);return e=void 0,s}}class gt extends Ut{}function oX(t,e){return e===null&&t.length>0?0:-1}function aX(t,e){const{nullBitmap:A}=t;if(!A||t.nullCount<=0)return-1;let i=0;for(const n of new Zp(A,t.offset+(e||0),t.length,A,BR)){if(!n)return i;++i}return-1}function pt(t,e,A){if(e===void 0)return-1;if(e===null)switch(t.typeId){case oe.Union:break;case oe.Dictionary:break;default:return aX(t,A)}const i=or.getVisitFn(t),n=$c(e);for(let r=(A||0)-1,s=t.length;++r<s;)if(n(i(t,r)))return r;return-1}function yR(t,e,A){const i=or.getVisitFn(t),n=$c(e);for(let r=(A||0)-1,s=t.length;++r<s;)if(n(i(t,r)))return r;return-1}gt.prototype.visitNull=oX,gt.prototype.visitBool=pt,gt.prototype.visitInt=pt,gt.prototype.visitInt8=pt,gt.prototype.visitInt16=pt,gt.prototype.visitInt32=pt,gt.prototype.visitInt64=pt,gt.prototype.visitUint8=pt,gt.prototype.visitUint16=pt,gt.prototype.visitUint32=pt,gt.prototype.visitUint64=pt,gt.prototype.visitFloat=pt,gt.prototype.visitFloat16=pt,gt.prototype.visitFloat32=pt,gt.prototype.visitFloat64=pt,gt.prototype.visitUtf8=pt,gt.prototype.visitLargeUtf8=pt,gt.prototype.visitBinary=pt,gt.prototype.visitLargeBinary=pt,gt.prototype.visitFixedSizeBinary=pt,gt.prototype.visitDate=pt,gt.prototype.visitDateDay=pt,gt.prototype.visitDateMillisecond=pt,gt.prototype.visitTimestamp=pt,gt.prototype.visitTimestampSecond=pt,gt.prototype.visitTimestampMillisecond=pt,gt.prototype.visitTimestampMicrosecond=pt,gt.prototype.visitTimestampNanosecond=pt,gt.prototype.visitTime=pt,gt.prototype.visitTimeSecond=pt,gt.prototype.visitTimeMillisecond=pt,gt.prototype.visitTimeMicrosecond=pt,gt.prototype.visitTimeNanosecond=pt,gt.prototype.visitDecimal=pt,gt.prototype.visitList=pt,gt.prototype.visitStruct=pt,gt.prototype.visitUnion=pt,gt.prototype.visitDenseUnion=yR,gt.prototype.visitSparseUnion=yR,gt.prototype.visitDictionary=pt,gt.prototype.visitInterval=pt,gt.prototype.visitIntervalDayTime=pt,gt.prototype.visitIntervalYearMonth=pt,gt.prototype.visitDuration=pt,gt.prototype.visitDurationSecond=pt,gt.prototype.visitDurationMillisecond=pt,gt.prototype.visitDurationMicrosecond=pt,gt.prototype.visitDurationNanosecond=pt,gt.prototype.visitFixedSizeList=pt,gt.prototype.visitMap=pt;const ef=new gt;class ct extends Ut{}function Ct(t){const{type:e}=t;if(t.nullCount===0&&t.stride===1&&(zA.isInt(e)&&e.bitWidth!==64||zA.isTime(e)&&e.bitWidth!==64||zA.isFloat(e)&&e.precision!==Un.HALF))return new CR(t.data.length,i=>{const n=t.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let A=0;return new CR(t.data.length,i=>{const r=t.data[i].length,s=t.slice(A,A+r);return A+=r,new gX(s)})}class gX{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}ct.prototype.visitNull=Ct,ct.prototype.visitBool=Ct,ct.prototype.visitInt=Ct,ct.prototype.visitInt8=Ct,ct.prototype.visitInt16=Ct,ct.prototype.visitInt32=Ct,ct.prototype.visitInt64=Ct,ct.prototype.visitUint8=Ct,ct.prototype.visitUint16=Ct,ct.prototype.visitUint32=Ct,ct.prototype.visitUint64=Ct,ct.prototype.visitFloat=Ct,ct.prototype.visitFloat16=Ct,ct.prototype.visitFloat32=Ct,ct.prototype.visitFloat64=Ct,ct.prototype.visitUtf8=Ct,ct.prototype.visitLargeUtf8=Ct,ct.prototype.visitBinary=Ct,ct.prototype.visitLargeBinary=Ct,ct.prototype.visitFixedSizeBinary=Ct,ct.prototype.visitDate=Ct,ct.prototype.visitDateDay=Ct,ct.prototype.visitDateMillisecond=Ct,ct.prototype.visitTimestamp=Ct,ct.prototype.visitTimestampSecond=Ct,ct.prototype.visitTimestampMillisecond=Ct,ct.prototype.visitTimestampMicrosecond=Ct,ct.prototype.visitTimestampNanosecond=Ct,ct.prototype.visitTime=Ct,ct.prototype.visitTimeSecond=Ct,ct.prototype.visitTimeMillisecond=Ct,ct.prototype.visitTimeMicrosecond=Ct,ct.prototype.visitTimeNanosecond=Ct,ct.prototype.visitDecimal=Ct,ct.prototype.visitList=Ct,ct.prototype.visitStruct=Ct,ct.prototype.visitUnion=Ct,ct.prototype.visitDenseUnion=Ct,ct.prototype.visitSparseUnion=Ct,ct.prototype.visitDictionary=Ct,ct.prototype.visitInterval=Ct,ct.prototype.visitIntervalDayTime=Ct,ct.prototype.visitIntervalYearMonth=Ct,ct.prototype.visitDuration=Ct,ct.prototype.visitDurationSecond=Ct,ct.prototype.visitDurationMillisecond=Ct,ct.prototype.visitDurationMicrosecond=Ct,ct.prototype.visitDurationNanosecond=Ct,ct.prototype.visitFixedSizeList=Ct,ct.prototype.visitMap=Ct;const ny=new ct;var mR;const wR={},DR={};let Ki=class wc{constructor(e){var A,i,n;const r=e[0]instanceof wc?e.flatMap(o=>o.data):e;if(r.length===0||r.some(o=>!(o instanceof pi)))throw new TypeError("Vector constructor expects an Array of Data instances.");const s=(A=r[0])===null||A===void 0?void 0:A.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:o,set:g,indexOf:a}=wR[s.typeId],c=r[0];this.isValid=l=>iy(c,l),this.get=l=>o(c,l),this.set=(l,I)=>g(c,l,I),this.indexOf=l=>a(c,l),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,DR[s.typeId]),this._offsets=ER(r);break}this.data=r,this.type=s,this.stride=Do(s),this.numChildren=(n=(i=s.children)===null||i===void 0?void 0:i.length)!==null&&n!==void 0?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,A)=>e+A.byteLength,0)}get nullable(){return sX(this.data)}get nullCount(){return fR(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${oe[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get($p(e,this.length))}set(e,A){}indexOf(e,A){return-1}includes(e,A){return this.indexOf(e,A)>-1}[Symbol.iterator](){return ny.visit(this)}concat(...e){return new wc(this.data.concat(e.flatMap(A=>A.data).flat(Number.POSITIVE_INFINITY)))}slice(e,A){return new wc(IR(this,e,A,({data:i,_offsets:n},r,s)=>dR(i,n,r,s)))}toJSON(){return[...this]}toArray(){const{type:e,data:A,length:i,stride:n,ArrayType:r}=this;switch(e.typeId){case oe.Int:case oe.Float:case oe.Decimal:case oe.Time:case oe.Timestamp:switch(A.length){case 0:return new r;case 1:return A[0].values.subarray(0,i*n);default:return A.reduce((s,{values:o,length:g})=>(s.array.set(o.subarray(0,g*n),s.offset),s.offset+=g*n,s),{array:new r(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var A;return this.getChildAt((A=this.type.children)===null||A===void 0?void 0:A.findIndex(i=>i.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new wc(this.data.map(({children:A})=>A[e])):null}get isMemoized(){return zA.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(zA.isDictionary(this.type)){const e=new Af(this.data[0].dictionary),A=this.data.map(i=>{const n=i.clone();return n.dictionary=e,n});return new wc(A)}return new Af(this)}unmemoize(){if(zA.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),A=this.data.map(i=>{const n=i.clone();return n.dictionary=e,n});return new wc(A)}return this}};mR=Symbol.toStringTag,Ki[mR]=(t=>{t.type=zA.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(oe).map(A=>oe[A]).filter(A=>typeof A=="number"&&A!==oe.NONE);for(const A of e){const i=or.getVisitFnByTypeId(A),n=kr.getVisitFnByTypeId(A),r=ef.getVisitFnByTypeId(A);wR[A]={get:i,set:n,indexOf:r},DR[A]=Object.create(t,{isValid:{value:ZC(iy)},get:{value:ZC(or.getVisitFnByTypeId(A))},set:{value:QR(kr.getVisitFnByTypeId(A))},indexOf:{value:pR(ef.getVisitFnByTypeId(A))}})}return"Vector"})(Ki.prototype);class Af extends Ki{constructor(e){super(e.data);const A=this.get,i=this.set,n=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(s){const o=r[s];if(o!==void 0)return o;const g=A.call(this,s);return r[s]=g,g}}),Object.defineProperty(this,"set",{value(s,o){i.call(this,s,o),r[s]=o}}),Object.defineProperty(this,"slice",{value:(s,o)=>new Af(n.call(this,s,o))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ki(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ry{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,A,i,n){return e.prep(8,24),e.writeInt64(BigInt(n??0)),e.pad(4),e.writeInt32(i),e.writeInt64(BigInt(A??0)),e.offset()}}class fr{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsFooter(e,A){return(A||new fr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,A){return e.setPosition(e.position()+ui),(A||new fr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):on.V1}schema(e){const A=this.bb.__offset(this.bb_pos,6);return A?(e||new Ms).__init(this.bb.__indirect(this.bb_pos+A),this.bb):null}dictionaries(e,A){const i=this.bb.__offset(this.bb_pos,8);return i?(A||new ry).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,A){const i=this.bb.__offset(this.bb_pos,10);return i?(A||new ry).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,12);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,A){e.addFieldInt16(0,A,on.V1)}static addSchema(e,A){e.addFieldOffset(1,A,0)}static addDictionaries(e,A){e.addFieldOffset(2,A,0)}static startDictionariesVector(e,A){e.startVector(24,A,8)}static addRecordBatches(e,A){e.addFieldOffset(3,A,0)}static startRecordBatchesVector(e,A){e.startVector(24,A,8)}static addCustomMetadata(e,A){e.addFieldOffset(4,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,A){e.finish(A)}static finishSizePrefixedFooterBuffer(e,A){e.finish(A,void 0,!0)}}class Bi{constructor(e=[],A,i,n=on.V5){this.fields=e||[],this.metadata=A||new Map,i||(i=sy(this.fields)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,A)=>`${A}: ${e}`).join(", ")} }>`}select(e){const A=new Set(e),i=this.fields.filter(n=>A.has(n.name));return new Bi(i,this.metadata)}selectAt(e){const A=e.map(i=>this.fields[i]).filter(Boolean);return new Bi(A,this.metadata)}assign(...e){const A=e[0]instanceof Bi?e[0]:Array.isArray(e[0])?new Bi(e[0]):new Bi(e),i=[...this.fields],n=tf(tf(new Map,this.metadata),A.metadata),r=A.fields.filter(o=>{const g=i.findIndex(a=>a.name===o.name);return~g?(i[g]=o.clone({metadata:tf(tf(new Map,i[g].metadata),o.metadata)}))&&!1:!0}),s=sy(r,new Map);return new Bi([...i,...r],n,new Map([...this.dictionaries,...s]))}}Bi.prototype.fields=null,Bi.prototype.metadata=null,Bi.prototype.dictionaries=null;class Mi{static new(...e){let[A,i,n,r]=e;return e[0]&&typeof e[0]=="object"&&({name:A}=e[0],i===void 0&&(i=e[0].type),n===void 0&&(n=e[0].nullable),r===void 0&&(r=e[0].metadata)),new Mi(`${A}`,i,n,r)}constructor(e,A,i=!1,n){this.name=e,this.type=A,this.nullable=i,this.metadata=n||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[A,i,n,r]=e;return!e[0]||typeof e[0]!="object"?[A=this.name,i=this.type,n=this.nullable,r=this.metadata]=e:{name:A=this.name,type:i=this.type,nullable:n=this.nullable,metadata:r=this.metadata}=e[0],Mi.new(A,i,n,r)}}Mi.prototype.type=null,Mi.prototype.name=null,Mi.prototype.nullable=null,Mi.prototype.metadata=null;function tf(t,e){return new Map([...t||new Map,...e||new Map])}function sy(t,e=new Map){for(let A=-1,i=t.length;++A<i;){const r=t[A].type;if(zA.isDictionary(r)){if(!e.has(r.id))e.set(r.id,r.dictionary);else if(e.get(r.id)!==r.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}r.children&&r.children.length>0&&sy(r.children,e)}return e}var cX=Ub,lX=Gc;class lh{static decode(e){e=new lX(Xt(e));const A=fr.getRootAsFooter(e),i=Bi.decode(A.schema(),new Map,A.version());return new IX(i,A)}static encode(e){const A=new cX,i=Bi.encode(A,e.schema);fr.startRecordBatchesVector(A,e.numRecordBatches);for(const s of[...e.recordBatches()].slice().reverse())la.encode(A,s);const n=A.endVector();fr.startDictionariesVector(A,e.numDictionaries);for(const s of[...e.dictionaryBatches()].slice().reverse())la.encode(A,s);const r=A.endVector();return fr.startFooter(A),fr.addSchema(A,i),fr.addVersion(A,on.V5),fr.addRecordBatches(A,n),fr.addDictionaries(A,r),fr.finishFooterBuffer(A,fr.endFooter(A)),A.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,A=on.V5,i,n){this.schema=e,this.version=A,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let e,A=-1,i=this.numRecordBatches;++A<i;)(e=this.getRecordBatch(A))&&(yield e)}*dictionaryBatches(){for(let e,A=-1,i=this.numDictionaries;++A<i;)(e=this.getDictionaryBatch(A))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}}class IX extends lh{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,A){super(e,A.version()),this._footer=A}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){const A=this._footer.recordBatches(e);if(A)return la.decode(A)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){const A=this._footer.dictionaries(e);if(A)return la.decode(A)}return null}}class la{static decode(e){return new la(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,A){const{metaDataLength:i}=A,n=BigInt(A.offset),r=BigInt(A.bodyLength);return ry.createBlock(e,n,i,r)}constructor(e,A,i){this.metaDataLength=e,this.offset=vi(i),this.bodyLength=vi(A)}}const Vi=Object.freeze({done:!0,value:void 0});class _R{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class oy{tee(){return this._getDOMStream().tee()}pipe(e,A){return this._getNodeStream().pipe(e,A)}pipeTo(e,A){return this._getDOMStream().pipeTo(e,A)}pipeThrough(e,A){return this._getDOMStream().pipeThrough(e,A)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class hX extends oy{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return mt(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Vi);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return br.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return br.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return mt(this,void 0,void 0,function*(){return yield this.abort(e),Vi})}return(e){return mt(this,void 0,void 0,function*(){return yield this.close(),Vi})}read(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((A,i)=>{this.resolvers.push({resolve:A,reject:i})}):Promise.resolve(Vi)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class nf extends hX{write(e){if((e=Xt(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Lp(this.toUint8Array(!0)):this.toUint8Array(!1).then(Lp)}toUint8Array(e=!1){return e?xs(this._values)[0]:mt(this,void 0,void 0,function*(){var A,i,n,r;const s=[];let o=0;try{for(var g=!0,a=dg(this),c;c=yield a.next(),A=c.done,!A;g=!0){r=c.value,g=!1;const l=r;s.push(l),o+=l.byteLength}}catch(l){i={error:l}}finally{try{!g&&!A&&(n=a.return)&&(yield n.call(a))}finally{if(i)throw i.error}}return xs(s,o)[0]})}}class rf{constructor(e){e&&(this.source=new uX(br.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Zc{constructor(e){e instanceof Zc?this.source=e.source:e instanceof nf?this.source=new mg(br.fromAsyncIterable(e)):Rb(e)?this.source=new mg(br.fromNodeStream(e)):Op(e)?this.source=new mg(br.fromDOMStream(e)):xb(e)?this.source=new mg(br.fromDOMStream(e.body)):nh(e)?this.source=new mg(br.fromIterable(e)):Qg(e)?this.source=new mg(br.fromAsyncIterable(e)):Uc(e)&&(this.source=new mg(br.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class uX{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,A="read"){return this.source.next({cmd:A,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Vi)}return(e){return Object.create(this.source.return&&this.source.return(e)||Vi)}}class mg{constructor(e){this.source=e,this._closedPromise=new Promise(A=>this._closedPromiseResolve=A)}cancel(e){return mt(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return mt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return mt(this,arguments,void 0,function*(A,i="read"){return yield this.source.next({cmd:i,size:A})})}throw(e){return mt(this,void 0,void 0,function*(){const A=this.source.throw&&(yield this.source.throw(e))||Vi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(A)})}return(e){return mt(this,void 0,void 0,function*(){const A=this.source.return&&(yield this.source.return(e))||Vi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(A)})}}class SR extends rf{constructor(e,A){super(),this.position=0,this.buffer=Xt(e),this.size=A===void 0?this.buffer.byteLength:A}readInt32(e){const{buffer:A,byteOffset:i}=this.readAt(e,4);return new DataView(A,i).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){const{buffer:A,size:i,position:n}=this;return A&&n<i?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(i,n+Math.min(i-n,e)),A.subarray(n,this.position)):null}readAt(e,A){const i=this.buffer,n=Math.min(this.size,e+A);return i?i.subarray(e,n):new Uint8Array(A)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}}class sf extends Zc{constructor(e,A){super(),this.position=0,this._handle=e,typeof A=="number"?this.size=A:this._pending=mt(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return mt(this,void 0,void 0,function*(){const{buffer:A,byteOffset:i}=yield this.readAt(e,4);return new DataView(A,i).getInt32(0,!0)})}seek(e){return mt(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return mt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:A,size:i,position:n}=this;if(A&&n<i){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let r=n,s=0,o=0;const g=Math.min(i,r+Math.min(i-r,e)),a=new Uint8Array(Math.max(0,(this.position=g)-r));for(;(r+=o)<g&&(s+=o)<a.byteLength;)({bytesRead:o}=yield A.read(a,s,a.byteLength-s,r));return a}return null})}readAt(e,A){return mt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:i,size:n}=this;if(i&&e+A<n){const r=Math.min(n,e+A),s=new Uint8Array(r-e);return(yield i.read(s,0,A,e)).buffer}return new Uint8Array(A)})}close(){return mt(this,void 0,void 0,function*(){const e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return mt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return mt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}const BX=65536;function el(t){return t<0&&(t=4294967295+t+1),`0x${t.toString(16)}`}const Al=8,ay=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class vR{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){const A=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let n=A[3]*i[3];this.buffer[0]=n&65535;let r=n>>>16;return n=A[2]*i[3],r+=n,n=A[3]*i[2]>>>0,r+=n,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0<n?BX:0,this.buffer[1]+=r>>>16,this.buffer[1]+=A[1]*i[3]+A[2]*i[2]+A[3]*i[1],this.buffer[1]+=A[0]*i[3]+A[1]*i[2]+A[2]*i[1]+A[3]*i[0]<<16,this}_plus(e){const A=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],A<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=A}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${el(this.buffer[1])} ${el(this.buffer[0])}`}}class yi extends vR{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,A=new Uint32Array(2)){return yi.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(2)){return yi.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(2)){const i=e.length,n=new yi(A);for(let r=0;r<i;){const s=Al<i-r?Al:i-r,o=new yi(new Uint32Array([Number.parseInt(e.slice(r,r+s),10),0])),g=new yi(new Uint32Array([ay[s],0]));n.times(g),n.plus(o),r+=s}return n}static convertArray(e){const A=new Uint32Array(e.length*2);for(let i=-1,n=e.length;++i<n;)yi.from(e[i],new Uint32Array(A.buffer,A.byteOffset+2*i*4,2));return A}static multiply(e,A){return new yi(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new yi(new Uint32Array(e.buffer)).plus(A)}}class ar extends vR{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){const A=this.buffer[1]<<0,i=e.buffer[1]<<0;return A<i||A===i&&this.buffer[0]<e.buffer[0]}static from(e,A=new Uint32Array(2)){return ar.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(2)){return ar.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(2)){const i=e.startsWith("-"),n=e.length,r=new ar(A);for(let s=i?1:0;s<n;){const o=Al<n-s?Al:n-s,g=new ar(new Uint32Array([Number.parseInt(e.slice(s,s+o),10),0])),a=new ar(new Uint32Array([ay[o],0]));r.times(a),r.plus(g),s+=o}return i?r.negate():r}static convertArray(e){const A=new Uint32Array(e.length*2);for(let i=-1,n=e.length;++i<n;)ar.from(e[i],new Uint32Array(A.buffer,A.byteOffset+2*i*4,2));return A}static multiply(e,A){return new ar(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new ar(new Uint32Array(e.buffer)).plus(A)}}class Ts{constructor(e){this.buffer=e}high(){return new ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(e){const A=new yi(new Uint32Array([this.buffer[3],0])),i=new yi(new Uint32Array([this.buffer[2],0])),n=new yi(new Uint32Array([this.buffer[1],0])),r=new yi(new Uint32Array([this.buffer[0],0])),s=new yi(new Uint32Array([e.buffer[3],0])),o=new yi(new Uint32Array([e.buffer[2],0])),g=new yi(new Uint32Array([e.buffer[1],0])),a=new yi(new Uint32Array([e.buffer[0],0]));let c=yi.multiply(r,a);this.buffer[0]=c.low();const l=new yi(new Uint32Array([c.high(),0]));return c=yi.multiply(n,a),l.plus(c),c=yi.multiply(r,g),l.plus(c),this.buffer[1]=l.low(),this.buffer[3]=l.lessThan(c)?1:0,this.buffer[2]=l.high(),new yi(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(yi.multiply(i,a)).plus(yi.multiply(n,g)).plus(yi.multiply(r,o)),this.buffer[3]+=yi.multiply(A,a).plus(yi.multiply(i,g)).plus(yi.multiply(n,o)).plus(yi.multiply(r,s)).low(),this}plus(e){const A=new Uint32Array(4);return A[3]=this.buffer[3]+e.buffer[3]>>>0,A[2]=this.buffer[2]+e.buffer[2]>>>0,A[1]=this.buffer[1]+e.buffer[1]>>>0,A[0]=this.buffer[0]+e.buffer[0]>>>0,A[0]<this.buffer[0]>>>0&&++A[1],A[1]<this.buffer[1]>>>0&&++A[2],A[2]<this.buffer[2]>>>0&&++A[3],this.buffer[3]=A[3],this.buffer[2]=A[2],this.buffer[1]=A[1],this.buffer[0]=A[0],this}hex(){return`${el(this.buffer[3])} ${el(this.buffer[2])} ${el(this.buffer[1])} ${el(this.buffer[0])}`}static multiply(e,A){return new Ts(new Uint32Array(e.buffer)).times(A)}static add(e,A){return new Ts(new Uint32Array(e.buffer)).plus(A)}static from(e,A=new Uint32Array(4)){return Ts.fromString(typeof e=="string"?e:e.toString(),A)}static fromNumber(e,A=new Uint32Array(4)){return Ts.fromString(e.toString(),A)}static fromString(e,A=new Uint32Array(4)){const i=e.startsWith("-"),n=e.length,r=new Ts(A);for(let s=i?1:0;s<n;){const o=Al<n-s?Al:n-s,g=new Ts(new Uint32Array([Number.parseInt(e.slice(s,s+o),10),0,0,0])),a=new Ts(new Uint32Array([ay[o],0,0,0]));r.times(a),r.plus(g),s+=o}return i?r.negate():r}static convertArray(e){const A=new Uint32Array(e.length*4);for(let i=-1,n=e.length;++i<n;)Ts.from(e[i],new Uint32Array(A.buffer,A.byteOffset+4*4*i,4));return A}}class bR extends Ut{constructor(e,A,i,n,r=on.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=A,this.buffers=i,this.dictionaries=n,this.metadataVersion=r}visit(e){return super.visit(e instanceof Mi?e.type:e)}visitNull(e,{length:A}=this.nextFieldNode()){return Ot({type:e,length:A})}visitBool(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitInt(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitFloat(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitUtf8(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDate(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitTimestamp(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitTime(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDecimal(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitList(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),children:this.visitMany(e.children)})}visitUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<on.V5&&this.readNullBitmap(e,i),e.mode===Ln.Sparse?this.visitSparseUnion(e,{length:A,nullCount:i}):this.visitDenseUnion(e,{length:A,nullCount:i})}visitDenseUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitDuration(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),data:this.readData(e)})}visitFixedSizeList(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),child:this.visit(e.children[0])})}visitMap(e,{length:A,nullCount:i}=this.nextFieldNode()){return Ot({type:e,length:A,nullCount:i,nullBitmap:this.readNullBitmap(e,i),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,A,i=this.nextBufferRange()){return A>0&&this.readData(e,i)||new Uint8Array(0)}readOffsets(e,A){return this.readData(e,A)}readTypeIds(e,A){return this.readData(e,A)}readData(e,{length:A,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+A)}readDictionary(e){return this.dictionaries.get(e.id)}}class CX extends bR{constructor(e,A,i,n,r){super(new Uint8Array(0),A,i,n,r),this.sources=e}readNullBitmap(e,A,{offset:i}=this.nextBufferRange()){return A<=0?new Uint8Array(0):$C(this.sources[i])}readOffsets(e,{offset:A}=this.nextBufferRange()){return Qi(Uint8Array,Qi(e.OffsetArrayType,this.sources[A]))}readTypeIds(e,{offset:A}=this.nextBufferRange()){return Qi(Uint8Array,Qi(e.ArrayType,this.sources[A]))}readData(e,{offset:A}=this.nextBufferRange()){const{sources:i}=this;return zA.isTimestamp(e)||(zA.isInt(e)||zA.isTime(e))&&e.bitWidth===64||zA.isDuration(e)||zA.isDate(e)&&e.unit===xr.MILLISECOND?Qi(Uint8Array,ar.convertArray(i[A])):zA.isDecimal(e)?Qi(Uint8Array,Ts.convertArray(i[A])):zA.isBinary(e)||zA.isLargeBinary(e)||zA.isFixedSizeBinary(e)?fX(i[A]):zA.isBool(e)?$C(i[A]):zA.isUtf8(e)||zA.isLargeUtf8(e)?Up(i[A].join("")):Qi(Uint8Array,Qi(e.ArrayType,i[A].map(n=>+n)))}}function fX(t){const e=t.join(""),A=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)A[i>>1]=Number.parseInt(e.slice(i,i+2),16);return A}class lt extends Ut{compareSchemas(e,A){return e===A||A instanceof e.constructor&&this.compareManyFields(e.fields,A.fields)}compareManyFields(e,A){return e===A||Array.isArray(e)&&Array.isArray(A)&&e.length===A.length&&e.every((i,n)=>this.compareFields(i,A[n]))}compareFields(e,A){return e===A||A instanceof e.constructor&&e.name===A.name&&e.nullable===A.nullable&&this.visit(e.type,A.type)}}function jn(t,e){return e instanceof t.constructor}function wg(t,e){return t===e||jn(t,e)}function So(t,e){return t===e||jn(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function of(t,e){return t===e||jn(t,e)&&t.precision===e.precision}function EX(t,e){return t===e||jn(t,e)&&t.byteWidth===e.byteWidth}function gy(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function Ih(t,e){return t===e||jn(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function hh(t,e){return t===e||jn(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function dX(t,e){return t===e||jn(t,e)&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function QX(t,e){return t===e||jn(t,e)&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function cy(t,e){return t===e||jn(t,e)&&t.mode===e.mode&&t.typeIds.every((A,i)=>A===e.typeIds[i])&&Ia.compareManyFields(t.children,e.children)}function pX(t,e){return t===e||jn(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&Ia.visit(t.indices,e.indices)&&Ia.visit(t.dictionary,e.dictionary)}function ly(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function uh(t,e){return t===e||jn(t,e)&&t.unit===e.unit}function yX(t,e){return t===e||jn(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}function mX(t,e){return t===e||jn(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&Ia.compareManyFields(t.children,e.children)}lt.prototype.visitNull=wg,lt.prototype.visitBool=wg,lt.prototype.visitInt=So,lt.prototype.visitInt8=So,lt.prototype.visitInt16=So,lt.prototype.visitInt32=So,lt.prototype.visitInt64=So,lt.prototype.visitUint8=So,lt.prototype.visitUint16=So,lt.prototype.visitUint32=So,lt.prototype.visitUint64=So,lt.prototype.visitFloat=of,lt.prototype.visitFloat16=of,lt.prototype.visitFloat32=of,lt.prototype.visitFloat64=of,lt.prototype.visitUtf8=wg,lt.prototype.visitLargeUtf8=wg,lt.prototype.visitBinary=wg,lt.prototype.visitLargeBinary=wg,lt.prototype.visitFixedSizeBinary=EX,lt.prototype.visitDate=gy,lt.prototype.visitDateDay=gy,lt.prototype.visitDateMillisecond=gy,lt.prototype.visitTimestamp=Ih,lt.prototype.visitTimestampSecond=Ih,lt.prototype.visitTimestampMillisecond=Ih,lt.prototype.visitTimestampMicrosecond=Ih,lt.prototype.visitTimestampNanosecond=Ih,lt.prototype.visitTime=hh,lt.prototype.visitTimeSecond=hh,lt.prototype.visitTimeMillisecond=hh,lt.prototype.visitTimeMicrosecond=hh,lt.prototype.visitTimeNanosecond=hh,lt.prototype.visitDecimal=wg,lt.prototype.visitList=dX,lt.prototype.visitStruct=QX,lt.prototype.visitUnion=cy,lt.prototype.visitDenseUnion=cy,lt.prototype.visitSparseUnion=cy,lt.prototype.visitDictionary=pX,lt.prototype.visitInterval=ly,lt.prototype.visitIntervalDayTime=ly,lt.prototype.visitIntervalYearMonth=ly,lt.prototype.visitDuration=uh,lt.prototype.visitDurationSecond=uh,lt.prototype.visitDurationMillisecond=uh,lt.prototype.visitDurationMicrosecond=uh,lt.prototype.visitDurationNanosecond=uh,lt.prototype.visitFixedSizeList=yX,lt.prototype.visitMap=mX;const Ia=new lt;function Iy(t,e){return Ia.compareSchemas(t,e)}function hy(t,e){return wX(t,e.map(A=>A.data.concat()))}function wX(t,e){const A=[...t.fields],i=[],n={numBatches:e.reduce((l,I)=>Math.max(l,I.length),0)};let r=0,s=0,o=-1;const g=e.length;let a,c=[];for(;n.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,o=-1;++o<g;)c[o]=a=e[o].shift(),s=Math.min(s,a?a.length:s);Number.isFinite(s)&&(c=DX(A,s,c,e,n),s>0&&(i[r++]=Ot({type:new Xn(A),length:s,nullCount:0,children:c.slice()})))}return[t=t.assign(A),i.map(l=>new gr(t,l))]}function DX(t,e,A,i,n){var r;const s=(e+63&-64)>>3;for(let o=-1,g=i.length;++o<g;){const a=A[o],c=a==null?void 0:a.length;if(c>=e)c===e?A[o]=a:(A[o]=a.slice(0,e),n.numBatches=Math.max(n.numBatches,i[o].unshift(a.slice(e,c-e))));else{const l=t[o];t[o]=l.clone({nullable:!0}),A[o]=(r=a==null?void 0:a._changeLengthAndBackfillNullBitmap(e))!==null&&r!==void 0?r:Ot({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)})}}return A}var xR;class $n{constructor(...e){var A,i;if(e.length===0)return this.batches=[],this.schema=new Bi([]),this._offsets=[0],this;let n,r;e[0]instanceof Bi&&(n=e.shift()),e.at(-1)instanceof Uint32Array&&(r=e.pop());const s=g=>{if(g){if(g instanceof gr)return[g];if(g instanceof $n)return g.batches;if(g instanceof pi){if(g.type instanceof Xn)return[new gr(new Bi(g.type.children),g)]}else{if(Array.isArray(g))return g.flatMap(a=>s(a));if(typeof g[Symbol.iterator]=="function")return[...g].flatMap(a=>s(a));if(typeof g=="object"){const a=Object.keys(g),c=a.map(h=>new Ki([g[h]])),l=n??new Bi(a.map((h,u)=>new Mi(String(h),c[u].type,c[u].nullable))),[,I]=hy(l,c);return I.length===0?[new gr(g)]:I}}}return[]},o=e.flatMap(g=>s(g));if(n=(i=n??((A=o[0])===null||A===void 0?void 0:A.schema))!==null&&i!==void 0?i:new Bi([]),!(n instanceof Bi))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const g of o){if(!(g instanceof gr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Iy(n,g.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=o,this._offsets=r??ER(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,A)=>e+A.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=fR(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get($p(e,this.numRows))}set(e,A){}indexOf(e,A){return-1}[Symbol.iterator](){return this.batches.length>0?ny.visit(new Ki(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
101
101
|
${this.toArray().join(`,
|
|
102
102
|
`)}
|
|
103
103
|
]`}concat(...e){const A=this.schema,i=this.data.concat(e.flatMap(({data:n})=>n));return new $n(A,i.map(n=>new gr(A,n)))}slice(e,A){const i=this.schema;[e,A]=IR({length:this.numRows},e,A);const n=dR(this.data,this._offsets,e,A);return new $n(i,n.map(r=>new gr(i,r)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(A=>A.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){const A=this.data.map(i=>i.children[e]);if(A.length===0){const{type:i}=this.schema.fields[e],n=Ot({type:i,length:0,nullCount:0});A.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ki(A)}return null}setChild(e,A){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===e),A)}setChildAt(e,A){let i=this.schema,n=[...this.batches];if(e>-1&&e<this.numCols){A||(A=new Ki([Ot({type:new ga,length:this.numRows})]));const r=i.fields.slice(),s=r[e].clone({type:A.type}),o=this.schema.fields.map((g,a)=>this.getChildAt(a));[r[e],o[e]]=[s,A],[i,n]=hy(i,o)}return new $n(i,n)}select(e){const A=this.schema.fields.reduce((i,n,r)=>i.set(n.name,r),new Map);return this.selectAt(e.map(i=>A.get(i)).filter(i=>i>-1))}selectAt(e){const A=this.schema.selectAt(e),i=this.batches.map(n=>n.selectAt(e));return new $n(A,i)}assign(e){const A=this.schema.fields,[i,n]=e.schema.fields.reduce((o,g,a)=>{const[c,l]=o,I=A.findIndex(h=>h.name===g.name);return~I?l[I]=a:c.push(a),o},[[],[]]),r=this.schema.assign(e.schema),s=[...A.map((o,g)=>[g,n[g]]).map(([o,g])=>g===void 0?this.getChildAt(o):e.getChildAt(g)),...i.map(o=>e.getChildAt(o))].filter(Boolean);return new $n(...hy(r,s))}}xR=Symbol.toStringTag,$n[xR]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=ZC(iy),t.get=ZC(or.getVisitFn(oe.Struct)),t.set=QR(kr.getVisitFn(oe.Struct)),t.indexOf=pR(ef.getVisitFn(oe.Struct)),"Table"))($n.prototype);var RR;let gr=class fB{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Bi))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ot({nullCount:0,type:new Xn(this.schema.fields),children:this.schema.fields.map(A=>Ot({type:A.type,nullCount:0}))})]=e,!(this.data instanceof pi))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=FR(this.schema,this.data.children);break}case 1:{const[A]=e,{fields:i,children:n,length:r}=Object.keys(A).reduce((g,a,c)=>(g.children[c]=A[a],g.length=Math.max(g.length,A[a].length),g.fields[c]=Mi.new({name:a,type:A[a].type,nullable:!0}),g),{length:0,fields:new Array,children:new Array}),s=new Bi(i),o=Ot({type:new Xn(i),length:r,children:n,nullCount:0});[this.schema,this.data]=FR(s,o.children,r);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=NR(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return or.visit(this.data,e)}at(e){return this.get($p(e,this.numRows))}set(e,A){return kr.visit(this.data,e,A)}indexOf(e,A){return ef.visit(this.data,e,A)}[Symbol.iterator](){return ny.visit(new Ki([this.data]))}toArray(){return[...this]}concat(...e){return new $n(this.schema,[this,...e])}slice(e,A){const[i]=new Ki([this.data]).slice(e,A).data;return new fB(this.schema,i)}getChild(e){var A;return this.getChildAt((A=this.schema.fields)===null||A===void 0?void 0:A.findIndex(i=>i.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new Ki([this.data.children[e]]):null}setChild(e,A){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===e),A)}setChildAt(e,A){let i=this.schema,n=this.data;if(e>-1&&e<this.numCols){A||(A=new Ki([Ot({type:new ga,length:this.numRows})]));const r=i.fields.slice(),s=n.children.slice(),o=r[e].clone({type:A.type});[r[e],s[e]]=[o,A.data[0]],i=new Bi(r,new Map(this.schema.metadata)),n=Ot({type:new Xn(r),children:s})}return new fB(i,n)}select(e){const A=this.schema.select(e),i=new Xn(A.fields),n=[];for(const r of e){const s=this.schema.fields.findIndex(o=>o.name===r);~s&&(n[s]=this.data.children[s])}return new fB(A,Ot({type:i,length:this.numRows,children:n}))}selectAt(e){const A=this.schema.selectAt(e),i=e.map(r=>this.data.children[r]).filter(Boolean),n=Ot({type:new Xn(A.fields),length:this.numRows,children:i});return new fB(A,n)}};RR=Symbol.toStringTag,gr[RR]=(t=>(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(gr.prototype);function FR(t,e,A=e.reduce((i,n)=>Math.max(i,n.length),0)){var i;const n=[...t.fields],r=[...e],s=(A+63&-64)>>3;for(const[o,g]of t.fields.entries()){const a=e[o];(!a||a.length!==A)&&(n[o]=g.clone({nullable:!0}),r[o]=(i=a==null?void 0:a._changeLengthAndBackfillNullBitmap(A))!==null&&i!==void 0?i:Ot({type:g.type,length:A,nullCount:A,nullBitmap:new Uint8Array(s)}))}return[t.assign(n),Ot({type:new Xn(n),length:A,children:r})]}function NR(t,e,A=new Map){var i,n;if(((i=t==null?void 0:t.length)!==null&&i!==void 0?i:0)>0&&(t==null?void 0:t.length)===(e==null?void 0:e.length))for(let r=-1,s=t.length;++r<s;){const{type:o}=t[r],g=e[r];for(const a of[g,...((n=g==null?void 0:g.dictionary)===null||n===void 0?void 0:n.data)||[]])NR(o.children,a==null?void 0:a.children,A);if(zA.isDictionary(o)){const{id:a}=o;if(!A.has(a))g!=null&&g.dictionary&&A.set(a,g.dictionary);else if(A.get(a)!==g.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return A}class uy extends gr{constructor(e){const A=e.fields.map(n=>Ot({type:n.type})),i=Ot({type:new Xn(e.fields),nullCount:0,children:A});super(e,i)}}let ha=class go{constructor(){this.bb=null,this.bb_pos=0}__init(e,A){return this.bb_pos=e,this.bb=A,this}static getRootAsMessage(e,A){return(A||new go).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,A){return e.setPosition(e.position()+ui),(A||new go).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):on.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):si.NONE}header(e){const A=this.bb.__offset(this.bb_pos,8);return A?this.bb.__union(e,this.bb_pos+A):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,A){const i=this.bb.__offset(this.bb_pos,12);return i?(A||new En).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,A){e.addFieldInt16(0,A,on.V1)}static addHeaderType(e,A){e.addFieldInt8(1,A,si.NONE)}static addHeader(e,A){e.addFieldOffset(2,A,0)}static addBodyLength(e,A){e.addFieldInt64(3,A,BigInt("0"))}static addCustomMetadata(e,A){e.addFieldOffset(4,A,0)}static createCustomMetadataVector(e,A){e.startVector(4,A.length,4);for(let i=A.length-1;i>=0;i--)e.addOffset(A[i]);return e.endVector()}static startCustomMetadataVector(e,A){e.startVector(4,A,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,A){e.finish(A)}static finishSizePrefixedMessageBuffer(e,A){e.finish(A,void 0,!0)}static createMessage(e,A,i,n,r,s){return go.startMessage(e),go.addVersion(e,A),go.addHeaderType(e,i),go.addHeader(e,n),go.addBodyLength(e,r),go.addCustomMetadata(e,s),go.endMessage(e)}};class _X extends Ut{visit(e,A){return e==null||A==null?void 0:super.visit(e,A)}visitNull(e,A){return Kb.startNull(A),Kb.endNull(A)}visitInt(e,A){return Cr.startInt(A),Cr.addBitWidth(A,e.bitWidth),Cr.addIsSigned(A,e.isSigned),Cr.endInt(A)}visitFloat(e,A){return Ns.startFloatingPoint(A),Ns.addPrecision(A,e.precision),Ns.endFloatingPoint(A)}visitBinary(e,A){return Pb.startBinary(A),Pb.endBinary(A)}visitLargeBinary(e,A){return Hb.startLargeBinary(A),Hb.endLargeBinary(A)}visitBool(e,A){return qb.startBool(A),qb.endBool(A)}visitUtf8(e,A){return Vb.startUtf8(A),Vb.endUtf8(A)}visitLargeUtf8(e,A){return Jb.startLargeUtf8(A),Jb.endLargeUtf8(A)}visitDecimal(e,A){return qc.startDecimal(A),qc.addScale(A,e.scale),qc.addPrecision(A,e.precision),qc.addBitWidth(A,e.bitWidth),qc.endDecimal(A)}visitDate(e,A){return vC.startDate(A),vC.addUnit(A,e.unit),vC.endDate(A)}visitTime(e,A){return Rr.startTime(A),Rr.addUnit(A,e.unit),Rr.addBitWidth(A,e.bitWidth),Rr.endTime(A)}visitTimestamp(e,A){const i=e.timezone&&A.createString(e.timezone)||void 0;return Fr.startTimestamp(A),Fr.addUnit(A,e.unit),i!==void 0&&Fr.addTimezone(A,i),Fr.endTimestamp(A)}visitInterval(e,A){return ks.startInterval(A),ks.addUnit(A,e.unit),ks.endInterval(A)}visitDuration(e,A){return bC.startDuration(A),bC.addUnit(A,e.unit),bC.endDuration(A)}visitList(e,A){return Yb.startList(A),Yb.endList(A)}visitStruct(e,A){return pg.startStruct_(A),pg.endStruct_(A)}visitUnion(e,A){sr.startTypeIdsVector(A,e.typeIds.length);const i=sr.createTypeIdsVector(A,e.typeIds);return sr.startUnion(A),sr.addMode(A,e.mode),sr.addTypeIds(A,i),sr.endUnion(A)}visitDictionary(e,A){const i=this.visit(e.indices,A);return mo.startDictionaryEncoding(A),mo.addId(A,BigInt(e.id)),mo.addIsOrdered(A,e.isOrdered),i!==void 0&&mo.addIndexType(A,i),mo.endDictionaryEncoding(A)}visitFixedSizeBinary(e,A){return xC.startFixedSizeBinary(A),xC.addByteWidth(A,e.byteWidth),xC.endFixedSizeBinary(A)}visitFixedSizeList(e,A){return RC.startFixedSizeList(A),RC.addListSize(A,e.listSize),RC.endFixedSizeList(A)}visitMap(e,A){return FC.startMap(A),FC.addKeysSorted(A,e.keysSorted),FC.endMap(A)}}const By=new _X;function SX(t,e=new Map){return new Bi(bX(t,e),af(t.metadata),e)}function kR(t){return new Er(t.count,TR(t.columns),LR(t.columns))}function vX(t){return new Ls(kR(t.data),t.id,t.isDelta)}function bX(t,e){return(t.fields||[]).filter(Boolean).map(A=>Mi.fromJSON(A,e))}function MR(t,e){return(t.children||[]).filter(Boolean).map(A=>Mi.fromJSON(A,e))}function TR(t){return(t||[]).reduce((e,A)=>[...e,new ua(A.count,xX(A.VALIDITY)),...TR(A.children)],[])}function LR(t,e=[]){for(let A=-1,i=(t||[]).length;++A<i;){const n=t[A];n.VALIDITY&&e.push(new Us(e.length,n.VALIDITY.length)),n.TYPE_ID&&e.push(new Us(e.length,n.TYPE_ID.length)),n.OFFSET&&e.push(new Us(e.length,n.OFFSET.length)),n.DATA&&e.push(new Us(e.length,n.DATA.length)),e=LR(n.children,e)}return e}function xX(t){return(t||[]).reduce((e,A)=>e+ +(A===0),0)}function RX(t,e){let A,i,n,r,s,o;return!e||!(r=t.dictionary)?(s=GR(t,MR(t,e)),n=new Mi(t.name,s,t.nullable,af(t.metadata))):e.has(A=r.id)?(i=(i=r.indexType)?UR(i):new gh,o=new Yc(e.get(A),i,A,r.isOrdered),n=new Mi(t.name,o,t.nullable,af(t.metadata))):(i=(i=r.indexType)?UR(i):new gh,e.set(A,s=GR(t,MR(t,e))),o=new Yc(s,i,A,r.isOrdered),n=new Mi(t.name,o,t.nullable,af(t.metadata))),n||null}function af(t=[]){return new Map(t.map(({key:e,value:A})=>[e,A]))}function UR(t){return new yg(t.isSigned,t.bitWidth)}function GR(t,e){const A=t.type.name;switch(A){case"NONE":return new ga;case"null":return new ga;case"binary":return new kC;case"largebinary":return new MC;case"utf8":return new TC;case"largeutf8":return new LC;case"bool":return new UC;case"list":return new YC((e||[])[0]);case"struct":return new Xn(e||[]);case"struct_":return new Xn(e||[])}switch(A){case"int":{const i=t.type;return new yg(i.isSigned,i.bitWidth)}case"floatingpoint":{const i=t.type;return new NC(Un[i.precision])}case"decimal":{const i=t.type;return new GC(i.scale,i.precision,i.bitWidth)}case"date":{const i=t.type;return new OC(xr[i.unit])}case"time":{const i=t.type;return new PC(ht[i.unit],i.bitWidth)}case"timestamp":{const i=t.type;return new qC(ht[i.unit],i.timezone)}case"interval":{const i=t.type;return new HC(Rs[i.unit])}case"duration":{const i=t.type;return new JC(ht[i.unit])}case"union":{const i=t.type,[n,...r]=(i.mode+"").toLowerCase(),s=n.toUpperCase()+r.join("");return new KC(Ln[s],i.typeIds||[],e||[])}case"fixedsizebinary":{const i=t.type;return new VC(i.byteWidth)}case"fixedsizelist":{const i=t.type;return new WC(i.listSize,(e||[])[0])}case"map":{const i=t.type;return new zC((e||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${A}"`)}var FX=Ub,NX=Gc;class Zn{static fromJSON(e,A){const i=new Zn(0,on.V5,A);return i._createHeader=kX(e,A),i}static decode(e){e=new NX(Xt(e));const A=ha.getRootAsMessage(e),i=A.bodyLength(),n=A.version(),r=A.headerType(),s=new Zn(i,n,r);return s._createHeader=MX(A,r),s}static encode(e){const A=new FX;let i=-1;return e.isSchema()?i=Bi.encode(A,e.header()):e.isRecordBatch()?i=Er.encode(A,e.header()):e.isDictionaryBatch()&&(i=Ls.encode(A,e.header())),ha.startMessage(A),ha.addVersion(A,on.V5),ha.addHeader(A,i),ha.addHeaderType(A,e.headerType),ha.addBodyLength(A,BigInt(e.bodyLength)),ha.finishMessageBuffer(A,ha.endMessage(A)),A.asUint8Array()}static from(e,A=0){if(e instanceof Bi)return new Zn(0,on.V5,si.Schema,e);if(e instanceof Er)return new Zn(A,on.V5,si.RecordBatch,e);if(e instanceof Ls)return new Zn(A,on.V5,si.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===si.Schema}isRecordBatch(){return this.headerType===si.RecordBatch}isDictionaryBatch(){return this.headerType===si.DictionaryBatch}constructor(e,A,i,n){this._version=A,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=vi(e)}}class Er{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,A,i){this._nodes=A,this._buffers=i,this._length=vi(e)}}class Ls{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,A,i=!1){this._data=e,this._isDelta=i,this._id=vi(A)}}class Us{constructor(e,A){this.offset=vi(e),this.length=vi(A)}}class ua{constructor(e,A){this.length=vi(e),this.nullCount=vi(A)}}function kX(t,e){return()=>{switch(e){case si.Schema:return Bi.fromJSON(t);case si.RecordBatch:return Er.fromJSON(t);case si.DictionaryBatch:return Ls.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${si[e]}, type: ${e} }`)}}function MX(t,e){return()=>{switch(e){case si.Schema:return Bi.decode(t.header(new Ms),new Map,t.version());case si.RecordBatch:return Er.decode(t.header(new yo),t.version());case si.DictionaryBatch:return Ls.decode(t.header(new Oc),t.version())}throw new Error(`Unrecognized Message type: { name: ${si[e]}, type: ${e} }`)}}Mi.encode=KX,Mi.decode=JX,Mi.fromJSON=RX,Bi.encode=YX,Bi.decode=TX,Bi.fromJSON=SX,Er.encode=VX,Er.decode=LX,Er.fromJSON=kR,Ls.encode=WX,Ls.decode=UX,Ls.fromJSON=vX,ua.encode=zX,ua.decode=OX,Us.encode=XX,Us.decode=GX;function TX(t,e=new Map,A=on.V5){const i=HX(t,e);return new Bi(i,gf(t),e,A)}function LX(t,e=on.V5){if(t.compression()!==null)throw new Error("Record batch compression not implemented");return new Er(t.length(),PX(t),qX(t,e))}function UX(t,e=on.V5){return new Ls(Er.decode(t.data(),e),t.id(),t.isDelta())}function GX(t){return new Us(t.offset(),t.length())}function OX(t){return new ua(t.length(),t.nullCount())}function PX(t){const e=[];for(let A,i=-1,n=-1,r=t.nodesLength();++i<r;)(A=t.nodes(i))&&(e[++n]=ua.decode(A));return e}function qX(t,e){const A=[];for(let i,n=-1,r=-1,s=t.buffersLength();++n<s;)(i=t.buffers(n))&&(e<on.V4&&(i.bb_pos+=8*(n+1)),A[++r]=Us.decode(i));return A}function HX(t,e){const A=[];for(let i,n=-1,r=-1,s=t.fieldsLength();++n<s;)(i=t.fields(n))&&(A[++r]=Mi.decode(i,e));return A}function OR(t,e){const A=[];for(let i,n=-1,r=-1,s=t.childrenLength();++n<s;)(i=t.children(n))&&(A[++r]=Mi.decode(i,e));return A}function JX(t,e){let A,i,n,r,s,o;return!e||!(o=t.dictionary())?(n=qR(t,OR(t,e)),i=new Mi(t.name(),n,t.nullable(),gf(t))):e.has(A=vi(o.id()))?(r=(r=o.indexType())?PR(r):new gh,s=new Yc(e.get(A),r,A,o.isOrdered()),i=new Mi(t.name(),s,t.nullable(),gf(t))):(r=(r=o.indexType())?PR(r):new gh,e.set(A,n=qR(t,OR(t,e))),s=new Yc(n,r,A,o.isOrdered()),i=new Mi(t.name(),s,t.nullable(),gf(t))),i||null}function gf(t){const e=new Map;if(t)for(let A,i,n=-1,r=Math.trunc(t.customMetadataLength());++n<r;)(A=t.customMetadata(n))&&(i=A.key())!=null&&e.set(i,A.value());return e}function PR(t){return new yg(t.isSigned(),t.bitWidth())}function qR(t,e){const A=t.typeType();switch(A){case Ni.NONE:return new ga;case Ni.Null:return new ga;case Ni.Binary:return new kC;case Ni.LargeBinary:return new MC;case Ni.Utf8:return new TC;case Ni.LargeUtf8:return new LC;case Ni.Bool:return new UC;case Ni.List:return new YC((e||[])[0]);case Ni.Struct_:return new Xn(e||[])}switch(A){case Ni.Int:{const i=t.type(new Cr);return new yg(i.isSigned(),i.bitWidth())}case Ni.FloatingPoint:{const i=t.type(new Ns);return new NC(i.precision())}case Ni.Decimal:{const i=t.type(new qc);return new GC(i.scale(),i.precision(),i.bitWidth())}case Ni.Date:{const i=t.type(new vC);return new OC(i.unit())}case Ni.Time:{const i=t.type(new Rr);return new PC(i.unit(),i.bitWidth())}case Ni.Timestamp:{const i=t.type(new Fr);return new qC(i.unit(),i.timezone())}case Ni.Interval:{const i=t.type(new ks);return new HC(i.unit())}case Ni.Duration:{const i=t.type(new bC);return new JC(i.unit())}case Ni.Union:{const i=t.type(new sr);return new KC(i.mode(),i.typeIdsArray()||[],e||[])}case Ni.FixedSizeBinary:{const i=t.type(new xC);return new VC(i.byteWidth())}case Ni.FixedSizeList:{const i=t.type(new RC);return new WC(i.listSize(),(e||[])[0])}case Ni.Map:{const i=t.type(new FC);return new zC((e||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${Ni[A]}" (${A})`)}function YX(t,e){const A=e.fields.map(r=>Mi.encode(t,r));Ms.startFieldsVector(t,A.length);const i=Ms.createFieldsVector(t,A),n=e.metadata&&e.metadata.size>0?Ms.createCustomMetadataVector(t,[...e.metadata].map(([r,s])=>{const o=t.createString(`${r}`),g=t.createString(`${s}`);return En.startKeyValue(t),En.addKey(t,o),En.addValue(t,g),En.endKeyValue(t)})):-1;return Ms.startSchema(t),Ms.addFields(t,i),Ms.addEndianness(t,jX?Pc.Little:Pc.Big),n!==-1&&Ms.addCustomMetadata(t,n),Ms.endSchema(t)}function KX(t,e){let A=-1,i=-1,n=-1;const r=e.type;let s=e.typeId;zA.isDictionary(r)?(s=r.dictionary.typeId,n=By.visit(r,t),i=By.visit(r.dictionary,t)):i=By.visit(r,t);const o=(r.children||[]).map(c=>Mi.encode(t,c)),g=Nr.createChildrenVector(t,o),a=e.metadata&&e.metadata.size>0?Nr.createCustomMetadataVector(t,[...e.metadata].map(([c,l])=>{const I=t.createString(`${c}`),h=t.createString(`${l}`);return En.startKeyValue(t),En.addKey(t,I),En.addValue(t,h),En.endKeyValue(t)})):-1;return e.name&&(A=t.createString(e.name)),Nr.startField(t),Nr.addType(t,i),Nr.addTypeType(t,s),Nr.addChildren(t,g),Nr.addNullable(t,!!e.nullable),A!==-1&&Nr.addName(t,A),n!==-1&&Nr.addDictionary(t,n),a!==-1&&Nr.addCustomMetadata(t,a),Nr.endField(t)}function VX(t,e){const A=e.nodes||[],i=e.buffers||[];yo.startNodesVector(t,A.length);for(const s of A.slice().reverse())ua.encode(t,s);const n=t.endVector();yo.startBuffersVector(t,i.length);for(const s of i.slice().reverse())Us.encode(t,s);const r=t.endVector();return yo.startRecordBatch(t),yo.addLength(t,BigInt(e.length)),yo.addNodes(t,n),yo.addBuffers(t,r),yo.endRecordBatch(t)}function WX(t,e){const A=Er.encode(t,e.data);return Oc.startDictionaryBatch(t),Oc.addId(t,BigInt(e.id)),Oc.addIsDelta(t,e.isDelta),Oc.addData(t,A),Oc.endDictionaryBatch(t)}function zX(t,e){return Ob.createFieldNode(t,BigInt(e.length),BigInt(e.nullCount))}function XX(t,e){return Gb.createBuffer(t,BigInt(e.offset),BigInt(e.length))}const jX=(()=>{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),new Int16Array(t)[0]===256})(),Cy=t=>`Expected ${si[t]} Message in stream, but was null or length 0.`,fy=t=>`Header pointer of flatbuffer-encoded ${si[t]} Message is null or length 0.`,HR=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,JR=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class YR{constructor(e){this.source=e instanceof rf?e:new rf(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Vi:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let A;if((A=this.next()).done)return null;if(e!=null&&A.value.headerType!==e)throw new Error(Cy(e));return A.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const A=Xt(this.source.read(e));if(A.byteLength<e)throw new Error(JR(e,A.byteLength));return A.byteOffset%8===0&&A.byteOffset+A.byteLength<=A.buffer.byteLength?A:A.slice()}readSchema(e=!1){const A=si.Schema,i=this.readMessage(A),n=i==null?void 0:i.header();if(e&&!n)throw new Error(fy(A));return n}readMetadataLength(){const e=this.source.read(cf),A=e&&new Gc(e),i=(A==null?void 0:A.readInt32(0))||0;return{done:i===0,value:i}}readMetadata(e){const A=this.source.read(e);if(!A)return Vi;if(A.byteLength<e)throw new Error(HR(e,A.byteLength));return{done:!1,value:Zn.decode(A)}}}class $X{constructor(e,A){this.source=e instanceof Zc?e:bb(e)?new sf(e,A):new Zc(e)}[Symbol.asyncIterator](){return this}next(){return mt(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?Vi:e})}throw(e){return mt(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return mt(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return mt(this,void 0,void 0,function*(){let A;if((A=yield this.next()).done)return null;if(e!=null&&A.value.headerType!==e)throw new Error(Cy(e));return A.value})}readMessageBody(e){return mt(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);const A=Xt(yield this.source.read(e));if(A.byteLength<e)throw new Error(JR(e,A.byteLength));return A.byteOffset%8===0&&A.byteOffset+A.byteLength<=A.buffer.byteLength?A:A.slice()})}readSchema(){return mt(this,arguments,void 0,function*(e=!1){const A=si.Schema,i=yield this.readMessage(A),n=i==null?void 0:i.header();if(e&&!n)throw new Error(fy(A));return n})}readMetadataLength(){return mt(this,void 0,void 0,function*(){const e=yield this.source.read(cf),A=e&&new Gc(e),i=(A==null?void 0:A.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(e){return mt(this,void 0,void 0,function*(){const A=yield this.source.read(e);if(!A)return Vi;if(A.byteLength<e)throw new Error(HR(e,A.byteLength));return{done:!1,value:Zn.decode(A)}})}}class ZX extends YR{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof _R?e:new _R(e)}next(){const{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Zn.fromJSON(e.schema,si.Schema)};if(this._dictionaryIndex<e.dictionaries.length){const A=e.dictionaries[this._dictionaryIndex++];return this._body=A.data.columns,{done:!1,value:Zn.fromJSON(A,si.DictionaryBatch)}}if(this._batchIndex<e.batches.length){const A=e.batches[this._batchIndex++];return this._body=A.columns,{done:!1,value:Zn.fromJSON(A,si.RecordBatch)}}return this._body=[],Vi}readMessageBody(e){return A(this._body);function A(i){return(i||[]).reduce((n,r)=>[...n,...r.VALIDITY&&[r.VALIDITY]||[],...r.TYPE_ID&&[r.TYPE_ID]||[],...r.OFFSET&&[r.OFFSET]||[],...r.DATA&&[r.DATA]||[],...A(r.children)],[])}}readMessage(e){let A;if((A=this.next()).done)return null;if(e!=null&&A.value.headerType!==e)throw new Error(Cy(e));return A.value}readSchema(){const e=si.Schema,A=this.readMessage(e),i=A==null?void 0:A.header();if(!A||!i)throw new Error(fy(e));return i}}const cf=4,Ey="ARROW1",Bh=new Uint8Array(Ey.length);for(let t=0;t<Ey.length;t+=1)Bh[t]=Ey.codePointAt(t);function dy(t,e=0){for(let A=-1,i=Bh.length;++A<i;)if(Bh[A]!==t[e+A])return!1;return!0}const Ch=Bh.length,KR=Ch+cf,ej=Ch*2+cf;class Mr extends oy{constructor(e){super(),this._impl=e}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const A=this._impl.open(e);return Qg(A)?A.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return br.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return br.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,A){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Mr?e:Gp(e)?nj(e):bb(e)?oj(e):Qg(e)?mt(this,void 0,void 0,function*(){return yield Mr.from(yield e)}):xb(e)||Op(e)||Rb(e)||Uc(e)?sj(new Zc(e)):rj(new rf(e))}static readAll(e){return e instanceof Mr?e.isSync()?jR(e):$R(e):Gp(e)||ArrayBuffer.isView(e)||nh(e)||vb(e)?jR(e):$R(e)}}class lf extends Mr{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return bs(this,arguments,function*(){yield kt(yield*pC(dg(this[Symbol.iterator]())))})}}class If extends Mr{constructor(e){super(e),this._impl=e}readAll(){return mt(this,void 0,void 0,function*(){var e,A,i,n;const r=new Array;try{for(var s=!0,o=dg(this),g;g=yield o.next(),e=g.done,!e;s=!0){n=g.value,s=!1;const a=n;r.push(a)}}catch(a){A={error:a}}finally{try{!s&&!e&&(i=o.return)&&(yield i.call(o))}finally{if(A)throw A.error}}return r})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class VR extends lf{constructor(e){super(e),this._impl=e}}class Aj extends If{constructor(e){super(e),this._impl=e}}class WR{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,A){const i=this._loadVectors(e,A,this.schema.fields),n=Ot({type:new Xn(this.schema.fields),length:e.length,children:i});return new gr(this.schema,n)}_loadDictionaryBatch(e,A){const{id:i,isDelta:n}=e,{dictionaries:r,schema:s}=this,o=r.get(i),g=s.dictionaries.get(i),a=this._loadVectors(e.data,A,[g]);return(o&&n?o.concat(new Ki(a)):new Ki(a)).memoize()}_loadVectors(e,A,i){return new bR(A,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}class hf extends WR{constructor(e,A){super(A),this._reader=Gp(e)?new ZX(this._handle=e):new YR(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=XR(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Vi}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Vi}next(){if(this.closed)return Vi;let e;const{_reader:A}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const i=e.header(),n=A.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const i=e.header(),n=A.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new uy(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class uf extends WR{constructor(e,A){super(A),this._reader=new $X(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return mt(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return mt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=XR(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return mt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Vi})}return(e){return mt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Vi})}next(){return mt(this,void 0,void 0,function*(){if(this.closed)return Vi;let e;const{_reader:A}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const i=e.header(),n=yield A.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const i=e.header(),n=yield A.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new uy(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return mt(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class zR extends hf{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,A){super(e instanceof SR?e:new SR(e),A)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const A of this._footer.dictionaryBatches())A&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var A;if(this.closed)return null;this._footer||this.open();const i=(A=this._footer)===null||A===void 0?void 0:A.getRecordBatch(e);if(i&&this._handle.seek(i.offset)){const n=this._reader.readMessage(si.RecordBatch);if(n!=null&&n.isRecordBatch()){const r=n.header(),s=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(r,s)}}return null}_readDictionaryBatch(e){var A;const i=(A=this._footer)===null||A===void 0?void 0:A.getDictionaryBatch(e);if(i&&this._handle.seek(i.offset)){const n=this._reader.readMessage(si.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){const r=n.header(),s=this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(r,s);this.dictionaries.set(r.id,o)}}}_readFooter(){const{_handle:e}=this,A=e.size-KR,i=e.readInt32(A),n=e.readAt(A-i,i);return lh.decode(n)}_readNextMessageAndValidate(e){var A;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const i=(A=this._footer)===null||A===void 0?void 0:A.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(e)}return null}}class tj extends uf{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...A){const i=typeof A[0]!="number"?A.shift():void 0,n=A[0]instanceof Map?A.shift():void 0;super(e instanceof sf?e:new sf(e,i),n)}isFile(){return!0}isAsync(){return!0}open(e){const A=Object.create(null,{open:{get:()=>super.open}});return mt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield A.open.call(this,e)})}readRecordBatch(e){return mt(this,void 0,void 0,function*(){var A;if(this.closed)return null;this._footer||(yield this.open());const i=(A=this._footer)===null||A===void 0?void 0:A.getRecordBatch(e);if(i&&(yield this._handle.seek(i.offset))){const n=yield this._reader.readMessage(si.RecordBatch);if(n!=null&&n.isRecordBatch()){const r=n.header(),s=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(r,s)}}return null})}_readDictionaryBatch(e){return mt(this,void 0,void 0,function*(){var A;const i=(A=this._footer)===null||A===void 0?void 0:A.getDictionaryBatch(e);if(i&&(yield this._handle.seek(i.offset))){const n=yield this._reader.readMessage(si.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){const r=n.header(),s=yield this._reader.readMessageBody(n.bodyLength),o=this._loadDictionaryBatch(r,s);this.dictionaries.set(r.id,o)}}})}_readFooter(){return mt(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const A=e.size-KR,i=yield e.readInt32(A),n=yield e.readAt(A-i,i);return lh.decode(n)})}_readNextMessageAndValidate(e){return mt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const A=this._footer.getRecordBatch(this._recordBatchIndex);if(A&&(yield this._handle.seek(A.offset)))return yield this._reader.readMessage(e)}return null})}}class ij extends hf{constructor(e,A){super(e,A)}_loadVectors(e,A,i){return new CX(A,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}function XR(t,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:t.autoDestroy}function*jR(t){const e=Mr.from(t);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function $R(t){return bs(this,arguments,function*(){const A=yield kt(Mr.from(t));try{if(!(yield kt(A.open({autoDestroy:!1}))).closed)do yield yield kt(A);while(!(yield kt(A.reset().open())).closed)}finally{yield kt(A.cancel())}})}function nj(t){return new lf(new ij(t))}function rj(t){const e=t.peek(Ch+7&-8);return e&&e.byteLength>=4?dy(e)?new VR(new zR(t.read())):new lf(new hf(t)):new lf(new hf(function*(){}()))}function sj(t){return mt(this,void 0,void 0,function*(){const e=yield t.peek(Ch+7&-8);return e&&e.byteLength>=4?dy(e)?new VR(new zR(yield t.read())):new If(new uf(t)):new If(new uf(function(){return bs(this,arguments,function*(){})}()))})}function oj(t){return mt(this,void 0,void 0,function*(){const{size:e}=yield t.stat(),A=new sf(t,e);return e>=ej&&dy(yield A.readAt(0,Ch+7&-8))?new Aj(new tj(A)):new If(new uf(A))})}class Wi extends Ut{static assemble(...e){const A=n=>n.flatMap(r=>Array.isArray(r)?A(r):r instanceof gr?r.data.children:r.data),i=new Wi;return i.visitMany(A(e)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof Ki)return this.visitMany(e.data),this;const{type:A}=e;if(!zA.isDictionary(A)){const{length:i}=e;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(zA.isUnion(A))this.nodes.push(new ua(i,0));else{const{nullCount:n}=e;zA.isNull(A)||ns.call(this,n<=0?new Uint8Array(0):jC(e.offset,i,e.nullBitmap)),this.nodes.push(new ua(i,n))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function ns(t){const e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new Us(this._byteLength,e)),this._byteLength+=e,this}function aj(t){var e;const{type:A,length:i,typeIds:n,valueOffsets:r}=t;if(ns.call(this,n),A.mode===Ln.Sparse)return py.call(this,t);if(A.mode===Ln.Dense){if(t.offset<=0)return ns.call(this,r),py.call(this,t);{const s=new Int32Array(i),o=Object.create(null),g=Object.create(null);for(let a,c,l=-1;++l<i;)(a=n[l])!==void 0&&((c=o[a])===void 0&&(c=o[a]=r[l]),s[l]=r[l]-c,g[a]=((e=g[a])!==null&&e!==void 0?e:0)+1);ns.call(this,s),this.visitMany(t.children.map((a,c)=>{const l=A.typeIds[c],I=o[l],h=g[l];return a.slice(I,Math.min(i,h))}))}}return this}function gj(t){let e;return t.nullCount>=t.length?ns.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?ns.call(this,jC(t.offset,t.length,e)):ns.call(this,$C(t.values))}function vo(t){return ns.call(this,t.values.subarray(0,t.length*t.stride))}function Bf(t){const{length:e,values:A,valueOffsets:i}=t,n=vi(i[0]),r=vi(i[e]),s=Math.min(r-n,A.byteLength-n);return ns.call(this,Mb(-n,e+1,i)),ns.call(this,A.subarray(n,n+s)),this}function Qy(t){const{length:e,valueOffsets:A}=t;if(A){const{[0]:i,[e]:n}=A;return ns.call(this,Mb(-i,e+1,A)),this.visit(t.children[0].slice(i,n-i))}return this.visit(t.children[0])}function py(t){return this.visitMany(t.type.children.map((e,A)=>t.children[A]).filter(Boolean))[0]}Wi.prototype.visitBool=gj,Wi.prototype.visitInt=vo,Wi.prototype.visitFloat=vo,Wi.prototype.visitUtf8=Bf,Wi.prototype.visitLargeUtf8=Bf,Wi.prototype.visitBinary=Bf,Wi.prototype.visitLargeBinary=Bf,Wi.prototype.visitFixedSizeBinary=vo,Wi.prototype.visitDate=vo,Wi.prototype.visitTimestamp=vo,Wi.prototype.visitTime=vo,Wi.prototype.visitDecimal=vo,Wi.prototype.visitList=Qy,Wi.prototype.visitStruct=py,Wi.prototype.visitUnion=aj,Wi.prototype.visitInterval=vo,Wi.prototype.visitDuration=vo,Wi.prototype.visitFixedSizeList=Qy,Wi.prototype.visitMap=Qy;class ZR extends oy{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,A){throw new Error('"throughDOM" not available in this environment')}constructor(e){super(),this._position=0,this._started=!1,this._sink=new nf,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,rr(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Qg(e)?e.then(A=>this.writeAll(A)):Uc(e)?Dy(this,e):wy(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,A=null){return e===this._sink||e instanceof nf?this._sink=e:(this._sink=new nf,e&&Pz(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&qz(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!A||!Iy(A,this._schema))&&(A==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=A,this._writeSchema(A))),this}write(e){let A=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof $n&&!(A=e.schema))return this.finish()&&void 0;if(e instanceof gr&&!(A=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(A&&!Iy(A,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,A)}e instanceof gr?e instanceof uy||this._writeRecordBatch(e):e instanceof $n?this.writeAll(e.batches):nh(e)&&this.writeAll(e)}_writeMessage(e,A=8){const i=A-1,n=Zn.encode(e),r=n.byteLength,s=this._writeLegacyIpcFormat?4:8,o=r+s+i&~i,g=o-r-s;return e.headerType===si.RecordBatch?this._recordBatchBlocks.push(new la(o,e.bodyLength,this._position)):e.headerType===si.DictionaryBatch&&this._dictionaryBlocks.push(new la(o,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-s)),r>0&&this._write(n),this._writePadding(g)}_write(e){if(this._started){const A=Xt(e);A&&A.byteLength>0&&(this._sink.write(A),this._position+=A.byteLength)}return this}_writeSchema(e){return this._writeMessage(Zn.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Bh)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:A,nodes:i,bufferRegions:n,buffers:r}=Wi.assemble(e),s=new Er(e.numRows,i,n),o=Zn.from(s,A);return this._writeDictionaries(e)._writeMessage(o)._writeBodyBuffers(r)}_writeDictionaryBatch(e,A,i=!1){const{byteLength:n,nodes:r,bufferRegions:s,buffers:o}=Wi.assemble(new Ki([e])),g=new Er(e.length,r,s),a=new Ls(g,A,i),c=Zn.from(a,n);return this._writeMessage(c)._writeBodyBuffers(o)}_writeBodyBuffers(e){let A,i,n;for(let r=-1,s=e.length;++r<s;)(A=e[r])&&(i=A.byteLength)>0&&(this._write(A),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(e){var A,i;for(const[n,r]of e.dictionaries){const s=(A=r==null?void 0:r.data)!==null&&A!==void 0?A:[],o=this._seenDictionaries.get(n),g=(i=this._dictionaryDeltaOffsets.get(n))!==null&&i!==void 0?i:0;if(!o||o.data[0]!==s[0])for(const[a,c]of s.entries())this._writeDictionaryBatch(c,n,a>0);else if(g<s.length)for(const a of s.slice(g))this._writeDictionaryBatch(a,n,!0);this._seenDictionaries.set(n,r),this._dictionaryDeltaOffsets.set(n,s.length)}return this}}class yy extends ZR{static writeAll(e,A){const i=new yy(A);return Qg(e)?e.then(n=>i.writeAll(n)):Uc(e)?Dy(i,e):wy(i,e)}}class my extends ZR{static writeAll(e){const A=new my;return Qg(e)?e.then(i=>A.writeAll(i)):Uc(e)?Dy(A,e):wy(A,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,A,i=!1){if(!i&&this._seenDictionaries.has(A))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,A,i)}_writeFooter(e){const A=lh.encode(new lh(e,on.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(A)._write(Int32Array.of(A.byteLength))._writeMagic()}}function wy(t,e){let A=e;e instanceof $n&&(A=e.batches,t.reset(void 0,e.schema));for(const i of A)t.write(i);return t.finish()}function Dy(t,e){return mt(this,void 0,void 0,function*(){var A,i,n,r,s,o,g;try{for(A=!0,i=dg(e);n=yield i.next(),r=n.done,!r;A=!0){g=n.value,A=!1;const a=g;t.write(a)}}catch(a){s={error:a}}finally{try{!A&&!r&&(o=i.return)&&(yield o.call(i))}finally{if(s)throw s.error}}return t.finish()})}function cj(t,e="stream"){return(e==="stream"?yy:my).writeAll(t).toUint8Array(!0)}var lj=Object.create,eF=Object.defineProperty,Ij=Object.getOwnPropertyDescriptor,hj=Object.getOwnPropertyNames,uj=Object.getPrototypeOf,Bj=Object.prototype.hasOwnProperty,Cj=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fj=(t,e,A,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of hj(e))!Bj.call(t,n)&&n!==A&&eF(t,n,{get:()=>e[n],enumerable:!(i=Ij(e,n))||i.enumerable});return t},Ej=(t,e,A)=>(A=t!=null?lj(uj(t)):{},fj(!t||!t.__esModule?eF(A,"default",{value:t,enumerable:!0}):A,t)),dj=Cj((t,e)=>{e.exports=Worker}),Qj=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.AUTOMATIC=1]="AUTOMATIC",t[t.READ_ONLY=2]="READ_ONLY",t[t.READ_WRITE=3]="READ_WRITE",t))(Qj||{}),pj=(t=>(t[t.IDENTIFIER=0]="IDENTIFIER",t[t.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",t[t.STRING_CONSTANT=2]="STRING_CONSTANT",t[t.OPERATOR=3]="OPERATOR",t[t.KEYWORD=4]="KEYWORD",t[t.COMMENT=5]="COMMENT",t))(pj||{}),yj=(t=>(t[t.NONE=0]="NONE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR",t))(yj||{}),mj=(t=>(t[t.NONE=0]="NONE",t[t.CONNECT=1]="CONNECT",t[t.DISCONNECT=2]="DISCONNECT",t[t.OPEN=3]="OPEN",t[t.QUERY=4]="QUERY",t[t.INSTANTIATE=5]="INSTANTIATE",t))(mj||{}),wj=(t=>(t[t.NONE=0]="NONE",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR",t[t.START=3]="START",t[t.RUN=4]="RUN",t[t.CAPTURE=5]="CAPTURE",t))(wj||{}),Dj=(t=>(t[t.NONE=0]="NONE",t[t.WEB_WORKER=1]="WEB_WORKER",t[t.NODE_WORKER=2]="NODE_WORKER",t[t.BINDINGS=3]="BINDINGS",t[t.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",t))(Dj||{}),_j=class{log(e){}},Sj=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",t[t.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",t))(Sj||{}),vj=class{constructor(e,A){this._bindings=e,this._conn=A}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let A=await this._bindings.runQuery(this._conn,e),i=Mr.from(A);return console.assert(i.isSync(),"Reader is not sync"),console.assert(i.isFile(),"Reader is not file"),new $n(i)}async send(e,A=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let i=await this._bindings.startPendingQuery(this._conn,e,A);for(;i==null;){if(this._bindings.isDetached()){console.error("cannot send a message since the worker is not set!");return}i=await this._bindings.pollPendingQuery(this._conn)}let n=new AF(this._bindings,this._conn,i),r=await Mr.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let A=await this._bindings.createPrepared(this._conn,e);return new bj(this._bindings,this._conn,A)}async insertArrowTable(e,A){let i=cj(e,"stream");await this.insertArrowFromIPCStream(i,A)}async insertArrowFromIPCStream(e,A){await this._bindings.insertArrowFromIPCStream(this._conn,e,A)}async insertCSVFromPath(e,A){await this._bindings.insertCSVFromPath(this._conn,e,A)}async insertJSONFromPath(e,A){await this._bindings.insertJSONFromPath(this._conn,e,A)}},AF=class{constructor(e,A,i){this.db=e,this.conn=A,this.header=i,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e=null;for(this._inFlight!=null&&(e=await this._inFlight,this._inFlight=null);e==null;)e=await this.db.fetchQueryResults(this.conn);return this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},bj=class{constructor(e,A,i){this.bindings=e,this.connectionId=A,this.statementId=i}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let A=await this.bindings.runPrepared(this.connectionId,this.statementId,e),i=Mr.from(A);return console.assert(i.isSync()),console.assert(i.isFile()),new $n(i)}async send(...e){let A=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),i=new AF(this.bindings,this.connectionId,A),n=await Mr.from(i);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},xj=(t=>(t.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",t.CLOSE_PREPARED="CLOSE_PREPARED",t.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",t.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",t.CONNECT="CONNECT",t.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",t.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",t.CREATE_PREPARED="CREATE_PREPARED",t.DISCONNECT="DISCONNECT",t.DROP_FILE="DROP_FILE",t.DROP_FILES="DROP_FILES",t.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",t.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",t.FLUSH_FILES="FLUSH_FILES",t.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",t.GET_TABLE_NAMES="GET_TABLE_NAMES",t.GET_VERSION="GET_VERSION",t.GLOB_FILE_INFOS="GLOB_FILE_INFOS",t.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",t.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",t.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",t.INSTANTIATE="INSTANTIATE",t.OPEN="OPEN",t.PING="PING",t.POLL_PENDING_QUERY="POLL_PENDING_QUERY",t.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",t.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",t.REGISTER_FILE_URL="REGISTER_FILE_URL",t.RESET="RESET",t.RUN_PREPARED="RUN_PREPARED",t.RUN_QUERY="RUN_QUERY",t.SEND_PREPARED="SEND_PREPARED",t.START_PENDING_QUERY="START_PENDING_QUERY",t.TOKENIZE="TOKENIZE",t))(xj||{}),Rj=(t=>(t.CONNECTION_INFO="CONNECTION_INFO",t.ERROR="ERROR",t.FEATURE_FLAGS="FEATURE_FLAGS",t.FILE_BUFFER="FILE_BUFFER",t.FILE_INFOS="FILE_INFOS",t.FILE_SIZE="FILE_SIZE",t.FILE_STATISTICS="FILE_STATISTICS",t.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",t.LOG="LOG",t.PROGRESS_UPDATE="PROGRESS_UPDATE",t.OK="OK",t.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",t.QUERY_PLAN="QUERY_PLAN",t.QUERY_RESULT="QUERY_RESULT",t.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",t.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",t.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",t.REGISTERED_FILE="REGISTERED_FILE",t.SCRIPT_TOKENS="SCRIPT_TOKENS",t.SUCCESS="SUCCESS",t.TABLE_NAMES="TABLE_NAMES",t.VERSION_STRING="VERSION_STRING",t))(Rj||{}),Zt=class{constructor(e,A){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=A,this.promise=new Promise((i,n)=>{this.promiseResolver=i,this.promiseRejecter=n})}};function Cf(t){switch(t.typeId){case oe.Binary:return{sqlType:"binary"};case oe.Bool:return{sqlType:"bool"};case oe.Date:return{sqlType:"date"};case oe.DateDay:return{sqlType:"date32[d]"};case oe.DateMillisecond:return{sqlType:"date64[ms]"};case oe.Decimal:{let e=t;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case oe.Float:return{sqlType:"float"};case oe.Float16:return{sqlType:"float16"};case oe.Float32:return{sqlType:"float32"};case oe.Float64:return{sqlType:"float64"};case oe.Int:return{sqlType:"int32"};case oe.Int16:return{sqlType:"int16"};case oe.Int32:return{sqlType:"int32"};case oe.Int64:return{sqlType:"int64"};case oe.Uint16:return{sqlType:"uint16"};case oe.Uint32:return{sqlType:"uint32"};case oe.Uint64:return{sqlType:"uint64"};case oe.Uint8:return{sqlType:"uint8"};case oe.IntervalDayTime:return{sqlType:"interval[dt]"};case oe.IntervalYearMonth:return{sqlType:"interval[m]"};case oe.List:return{sqlType:"list",valueType:Cf(t.valueType)};case oe.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:t.byteWidth};case oe.Null:return{sqlType:"null"};case oe.Utf8:return{sqlType:"utf8"};case oe.Struct:return{sqlType:"struct",fields:t.children.map(e=>_y(e.name,e.type))};case oe.Map:{let e=t;return{sqlType:"map",keyType:Cf(e.keyType),valueType:Cf(e.valueType)}}case oe.Time:return{sqlType:"time[s]"};case oe.TimeMicrosecond:return{sqlType:"time[us]"};case oe.TimeMillisecond:return{sqlType:"time[ms]"};case oe.TimeNanosecond:return{sqlType:"time[ns]"};case oe.TimeSecond:return{sqlType:"time[s]"};case oe.Timestamp:return{sqlType:"timestamp",timezone:t.timezone||void 0};case oe.TimestampSecond:return{sqlType:"timestamp[s]",timezone:t.timezone||void 0};case oe.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:t.timezone||void 0};case oe.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:t.timezone||void 0};case oe.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:t.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(t.toString()))}function _y(t,e){let A=Cf(e);return A.name=t,A}var Fj=/'(opfs:\/\/\S*?)'/g,Nj=/(opfs:\/\/\S*?)/g;function kj(t){return t.search(Nj)>-1}function Mj(t){return[...t.matchAll(Fj)].map(e=>e[1])}var Tj=new TextEncoder,Lj=class{constructor(e,A=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._config={},this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),A!=null&&this.attach(A)}get logger(){return this._logger}get config(){return this._config}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((A,i)=>{this._workerShutdownResolver=A})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,A=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!:"+e.type+","+e.data);return}let i=this._nextMessageId++;return this._pendingRequests.set(i,e),this._worker.postMessage({messageId:i,type:e.type,data:e.data},A),await e.promise}onMessage(e){var A;let i=e.data;switch(i.type){case"PROGRESS_UPDATE":{for(let r of this._onExecutionProgress)r(i.data);return}case"LOG":{this._logger.log(i.data);return}case"INSTANTIATE_PROGRESS":{for(let r of this._onInstantiationProgress)r(i.data);return}}let n=this._pendingRequests.get(i.requestId);if(!n){console.warn("unassociated response: [".concat(i.requestId,", ").concat(i.type.toString(),"]"));return}if(this._pendingRequests.delete(i.requestId),i.type=="ERROR"){let r=new Error(i.data.message);r.name=i.data.name,(A=Object.getOwnPropertyDescriptor(r,"stack"))!=null&&A.writable&&(r.stack=i.data.stack),n.promiseRejecter(r);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(i.type=="OK"){n.promiseResolver(i.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],i.type=="OK"){n.promiseResolver(i.data);return}break;case"GLOB_FILE_INFOS":if(i.type=="FILE_INFOS"){n.promiseResolver(i.data);return}break;case"GET_VERSION":if(i.type=="VERSION_STRING"){n.promiseResolver(i.data);return}break;case"GET_FEATURE_FLAGS":if(i.type=="FEATURE_FLAGS"){n.promiseResolver(i.data);return}break;case"GET_TABLE_NAMES":if(i.type=="TABLE_NAMES"){n.promiseResolver(i.data);return}break;case"TOKENIZE":if(i.type=="SCRIPT_TOKENS"){n.promiseResolver(i.data);return}break;case"COPY_FILE_TO_BUFFER":if(i.type=="FILE_BUFFER"){n.promiseResolver(i.data);return}break;case"EXPORT_FILE_STATISTICS":if(i.type=="FILE_STATISTICS"){n.promiseResolver(i.data);return}break;case"CONNECT":if(i.type=="CONNECTION_INFO"){n.promiseResolver(i.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(i.type=="QUERY_RESULT"){n.promiseResolver(i.data);return}break;case"SEND_PREPARED":if(i.type=="QUERY_RESULT_HEADER"){n.promiseResolver(i.data);return}break;case"START_PENDING_QUERY":if(i.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(i.data);return}break;case"POLL_PENDING_QUERY":if(i.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(i.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],i.type=="SUCCESS"){n.promiseResolver(i.data);return}break;case"FETCH_QUERY_RESULTS":if(i.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(i.data);return}break;case"CREATE_PREPARED":if(i.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(i.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(i.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}isDetached(){return!this._worker}async reset(){let e=new Zt("RESET",null);return await this.postTask(e)}async ping(){let e=new Zt("PING",null);await this.postTask(e)}async dropFile(e){let A=new Zt("DROP_FILE",e);return await this.postTask(A)}async dropFiles(e){let A=new Zt("DROP_FILES",e);return await this.postTask(A)}async flushFiles(){let e=new Zt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,A=null,i=n=>{}){this._onInstantiationProgress.push(i);let n=new Zt("INSTANTIATE",[e,A]);return await this.postTask(n)}async getVersion(){let e=new Zt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Zt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){this._config=e;let A=new Zt("OPEN",e);await this.postTask(A)}async tokenize(e){let A=new Zt("TOKENIZE",e);return await this.postTask(A)}async connectInternal(){let e=new Zt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new vj(this,e)}async disconnect(e){let A=new Zt("DISCONNECT",e);await this.postTask(A)}async runQuery(e,A){if(this.shouldOPFSFileHandling()){let i=await this.registerOPFSFileFromSQL(A);try{return await this._runQueryAsync(e,A)}finally{i.length>0&&await this.dropFiles(i)}}else return await this._runQueryAsync(e,A)}async _runQueryAsync(e,A){let i=new Zt("RUN_QUERY",[e,A]);return await this.postTask(i)}async startPendingQuery(e,A,i=!1){if(this.shouldOPFSFileHandling()){let n=await this.registerOPFSFileFromSQL(A);try{return await this._startPendingQueryAsync(e,A,i)}finally{n.length>0&&await this.dropFiles(n)}}else return await this._startPendingQueryAsync(e,A,i)}async _startPendingQueryAsync(e,A,i=!1){let n=new Zt("START_PENDING_QUERY",[e,A,i]);return await this.postTask(n)}async pollPendingQuery(e){let A=new Zt("POLL_PENDING_QUERY",e);return await this.postTask(A)}async cancelPendingQuery(e){let A=new Zt("CANCEL_PENDING_QUERY",e);return await this.postTask(A)}async fetchQueryResults(e){let A=new Zt("FETCH_QUERY_RESULTS",e);return await this.postTask(A)}async getTableNames(e,A){let i=new Zt("GET_TABLE_NAMES",[e,A]);return await this.postTask(i)}async createPrepared(e,A){let i=new Zt("CREATE_PREPARED",[e,A]);return await this.postTask(i)}async closePrepared(e,A){let i=new Zt("CLOSE_PREPARED",[e,A]);await this.postTask(i)}async runPrepared(e,A,i){let n=new Zt("RUN_PREPARED",[e,A,i]);return await this.postTask(n)}async sendPrepared(e,A,i){let n=new Zt("SEND_PREPARED",[e,A,i]);return await this.postTask(n)}async globFiles(e){let A=new Zt("GLOB_FILE_INFOS",e);return await this.postTask(A)}async registerFileText(e,A){let i=Tj.encode(A);await this.registerFileBuffer(e,i)}async registerFileURL(e,A,i,n){A===void 0&&(A=e);let r=new Zt("REGISTER_FILE_URL",[e,A,i,n]);await this.postTask(r)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,A){let i=new Zt("REGISTER_FILE_BUFFER",[e,A]);await this.postTask(i,[A.buffer])}async registerFileHandle(e,A,i,n){let r=new Zt("REGISTER_FILE_HANDLE",[e,A,i,n]);await this.postTask(r,[])}async registerOPFSFileName(e){let A=new Zt("REGISTER_OPFS_FILE_NAME",[e]);await this.postTask(A,[])}async collectFileStatistics(e,A){let i=new Zt("COLLECT_FILE_STATISTICS",[e,A]);await this.postTask(i,[])}async exportFileStatistics(e){let A=new Zt("EXPORT_FILE_STATISTICS",e);return await this.postTask(A,[])}async copyFileToBuffer(e){let A=new Zt("COPY_FILE_TO_BUFFER",e);return await this.postTask(A)}async copyFileToPath(e,A){let i=new Zt("COPY_FILE_TO_PATH",[e,A]);await this.postTask(i)}async insertArrowFromIPCStream(e,A,i){if(A.length==0)return;let n=new Zt("INSERT_ARROW_FROM_IPC_STREAM",[e,A,i]);await this.postTask(n,[A.buffer])}async insertCSVFromPath(e,A,i){if(i.columns!==void 0){let r=[];for(let s in i.columns){let o=i.columns[s];r.push(_y(s,o))}i.columnsFlat=r,delete i.columns}let n=new Zt("IMPORT_CSV_FROM_PATH",[e,A,i]);await this.postTask(n)}async insertJSONFromPath(e,A,i){if(i.columns!==void 0){let r=[];for(let s in i.columns){let o=i.columns[s];r.push(_y(s,o))}i.columnsFlat=r,delete i.columns}let n=new Zt("IMPORT_JSON_FROM_PATH",[e,A,i]);await this.postTask(n)}shouldOPFSFileHandling(){var e,A;return kj((e=this.config.path)!=null?e:"")?((A=this.config.opfs)==null?void 0:A.fileHandling)=="auto":!1}async registerOPFSFileFromSQL(e){let A=Mj(e),i=[];for(let n of A)try{await this.registerOPFSFileName(n),i.push(n)}catch(r){throw console.error(r),new Error("File Not found:"+n)}return i}};function Uj(){let t=new TextDecoder;return e=>(typeof SharedArrayBuffer<"u"&&e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),t.decode(e))}Uj();var Gj=(t=>(t[t.BUFFER=0]="BUFFER",t[t.NODE_FS=1]="NODE_FS",t[t.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",t[t.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",t[t.HTTP=4]="HTTP",t[t.S3=5]="S3",t))(Gj||{}),Oj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Pj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),qj=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Hj=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Sy={name:"@duckdb/duckdb-wasm",version:"1.32.0"},Jj=Sy.name,Yj=Sy.version,vy=Sy.version.split(".");vy[0],vy[1],vy[2];var Kj=()=>typeof navigator>"u";function Vj(){let t="https://cdn.jsdelivr.net/npm/".concat(Jj,"@").concat(Yj,"/dist/");return{mvp:{mainModule:"".concat(t,"duckdb-mvp.wasm"),mainWorker:"".concat(t,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(t,"duckdb-eh.wasm"),mainWorker:"".concat(t,"duckdb-browser-eh.worker.js")}}}var by=null,xy=null,Ry=null,Fy=null,Ny=null;async function Wj(){return by==null&&(by=typeof BigInt64Array<"u"),xy==null&&(xy=await Pj()),Ry==null&&(Ry=await Hj()),Fy==null&&(Fy=await qj()),Ny==null&&(Ny=await Oj()),{bigInt64Array:by,crossOriginIsolated:Kj()||globalThis.crossOriginIsolated||!1,wasmExceptions:xy,wasmSIMD:Fy,wasmThreads:Ry,wasmBulkMemory:Ny}}async function zj(t){let e=await Wj();if(e.wasmExceptions){if(e.wasmSIMD&&e.wasmThreads&&e.crossOriginIsolated&&t.coi)return{mainModule:t.coi.mainModule,mainWorker:t.coi.mainWorker,pthreadWorker:t.coi.pthreadWorker};if(t.eh)return{mainModule:t.eh.mainModule,mainWorker:t.eh.mainWorker,pthreadWorker:null}}return{mainModule:t.mvp.mainModule,mainWorker:t.mvp.mainWorker,pthreadWorker:null}}Ej(dj());const Xj=new Set(["donor_id"]);function ff(t){for(const e of Object.keys(t))Xj.has(e.toLowerCase())&&delete t[e];return t}class Ef{constructor(e="/data"){this.basePath=e,this.db=null,this.conn=null,this.umapData=null,this.tsneData=null,this.geneCache=new Map,this.loadedChunks=new Set}async initialize(){try{const e=Vj(),A=await zj(e),i=URL.createObjectURL(new Blob([`importScripts("${A.mainWorker}");`],{type:"text/javascript"})),n=new Worker(i),r=new _j;this.db=new Lj(r,n),await this.db.instantiate(A.mainModule),this.conn=await this.db.connect(),await this.loadEssentialData()}catch(e){throw console.error("Failed to initialize data manager:",e),new Error(`Initialization failed: ${e.message}`)}}async loadEssentialData(){const e=[{name:"umap.parquet",path:`${this.basePath}/umap_complete.parquet`,required:!0},{name:"tsne.parquet",path:`${this.basePath}/tsne_complete.parquet`,required:!1},{name:"gene_locations.parquet",path:`${this.basePath}/gene_locations.parquet`,required:!0},{name:"gene_stats.parquet",path:`${this.basePath}/gene_stats.parquet`,required:!0},{name:"cells.parquet",path:`${this.basePath}/cells.parquet`,required:!0},{name:"metadata.parquet",path:`${this.basePath}/metadata.parquet`,required:!1},{name:"genes.parquet",path:`${this.basePath}/genes.parquet`,required:!0}];for(const r of e)try{const s=await fetch(r.path);if(!s.ok){if(r.required)throw new Error(`Failed to load required file: ${r.name} (${s.status} ${s.statusText})`);console.log(`Optional file ${r.name} not available, skipping...`);continue}const o=await s.arrayBuffer();await this.db.registerFileBuffer(r.name,new Uint8Array(o))}catch(s){if(r.required)throw s;console.log(`Optional file ${r.name} not available:`,s.message)}let A=new Map;try{try{(await this.conn.query('SELECT * FROM "metadata.parquet"')).toArray().map(o=>o.toJSON()).forEach(o=>{A.set(o.cell_id,o)})}catch{console.log("metadata.parquet not found, trying cells.parquet..."),(await this.conn.query('SELECT * FROM "cells.parquet"')).toArray().map(g=>g.toJSON()).forEach(g=>{A.set(g.cell_id,g)})}}catch(r){console.warn("Could not load cell metadata:",r)}const n=(await this.conn.query('SELECT * FROM "umap.parquet"')).toArray().map(r=>r.toJSON());this.umapData=n.map(r=>{const s=A.get(r.cell_id)||{};return ff({...r,...s})});try{const r=await this.conn.query('SELECT * FROM "tsne.parquet"');this.tsneData=r.toArray().map(s=>{const o=s.toJSON(),g=A.get(o.cell_id)||{};return ff({...o,...g})})}catch{console.log("tSNE data not available"),this.tsneData=null}}async getReductionData(e="umap"){if(e==="umap"){if(!this.umapData)throw new Error("UMAP data not loaded");return this.umapData}else if(e==="tsne"){if(!this.tsneData)throw new Error("tSNE data not available");return this.tsneData}else throw new Error(`Unknown reduction type: ${e}`)}async searchGenes(e){if(!e||e.length<1)return[];try{const n=(await this.conn.query(`
|
|
@@ -126,7 +126,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
126
126
|
SELECT cell_id, expression
|
|
127
127
|
FROM "${h}"
|
|
128
128
|
WHERE gene_id = ${n}
|
|
129
|
-
`)).toArray().map(E=>E.toJSON())}const I=performance.now()-c;return this.geneCache.set(e,l),l}catch(A){throw console.error(`Failed to load gene ${e}:`,A),A}}hasTsne(){return this.tsneData!==null}getCellCount(){return this.umapData?this.umapData.length:0}clearCache(){this.geneCache.clear()}}const jj={class:"pp-container"},$j={key:0,class:"loading-container"},Zj={key:1,class:"error-container"},e$={key:2,class:"dashboard"},A$={class:"content-layout"},t$={class:"controls"},i$={class:"label"},n$=["disabled"],r$=["value"],s$={class:"label"},o$=["disabled"],a$=["value"],g$=["disabled"],c$={key:0,class:"pp-message"},l$={class:"plot-and-legend"},I$={class:"plot-container"},h$={key:0,class:"loading-overlay"},u$={class:"pp-tooltip-header"},B$={class:"pp-tooltip-label"},C$={class:"pp-tooltip-value"},f$={key:0,class:"legend"},ky=100,tF=12,My="(other)",E$=_s({__name:"ProportionPlot",props:{dataPath:{type:String,default:"/data"}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=B.ref(null),n=B.ref(null),r=B.ref(!0),s=B.ref(null),o=B.ref(!1),g=B.ref(""),a=B.ref([]),c=B.ref([]),l=B.ref(""),I=B.ref("");let h=null;const u=()=>{clearTimeout(h),h=setTimeout(()=>{E.value.length>0&&d(E.value)},100)},E=B.ref([]),C=B.ref([]),f=B.ref(null),y=B.ref({x:0,y:0});B.onMounted(async()=>{window.addEventListener("resize",u);try{n.value=new Ef(A.dataPath),await n.value.initialize();const w=await n.value.getReductionData("umap");if(a.value=w,w.length>0){const p=w[0],m=Object.keys(p).filter(D=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(D));c.value=m,m.length>=2?(l.value=m.includes("Atlas_annotation")?"Atlas_annotation":m[0],I.value=m[1]!==l.value?m[1]:m[0]):m.length===1&&(l.value=m[0],I.value=m[0])}r.value=!1,await B.nextTick(),l.value&&I.value&&await Q()}catch(w){console.error("Failed to initialize:",w),s.value=`Failed to load data: ${w.message}`,r.value=!1}}),B.onBeforeUnmount(()=>{clearTimeout(h),window.removeEventListener("resize",u)});async function Q(){if(!(!l.value||!I.value||a.value.length===0)){o.value=!0,g.value="Computing proportions...";try{await B.nextTick();const w=a.value,p=new Map,m=new Map,D=new Map;for(const R of w){const W=String(R[l.value]??"(missing)"),ne=String(R[I.value]??"(missing)"),le=`${W}\0${ne}`;p.set(le,(p.get(le)||0)+1),m.set(W,(m.get(W)||0)+1),D.set(ne,(D.get(ne)||0)+1)}const x=Array.from(m.entries()).sort((R,W)=>W[1]-R[1]).slice(0,ky).map(([R])=>R),N=new Set(x),F=Array.from(D.entries()).sort((R,W)=>W[1]-R[1]).slice(0,tF).map(([R])=>R),M=new Set(F),k=new Map,_=new Map;for(const R of w){const W=String(R[l.value]??"(missing)");if(!N.has(W))continue;let ne=String(R[I.value]??"(missing)");M.has(ne)||(ne=My);const le=`${W}\0${ne}`;k.set(le,(k.get(le)||0)+1),_.set(W,(_.get(W)||0)+1)}const b=[],v=new Set;for(const[R,W]of k){const[ne,le]=R.split("\0"),Z=_.get(ne)||1;b.push({x:ne,y:le,p:W/Z}),v.add(le)}if(b.length===0){g.value="No data to plot.";return}const T=x.filter(R=>_.has(R)),O=Array.from(v);E.value={rows:b,xLevels:T,yLevels:O},await B.nextTick(),d(E.value);const Y=(T.length>=ky?` Limited to top ${ky} ${l.value}.`:"")+(O.includes(My)?` Limited to top ${tF} ${I.value} (+ ${My}).`:"");g.value=`Plotted ${O.length} categories across ${T.length} groups.${Y}`}catch(w){console.error("Failed to compute proportions:",w),g.value=`Error: ${w.message}`}finally{o.value=!1}}}function d({rows:w,xLevels:p,yLevels:m}){const D=sn(i.value);if(D.selectAll("*").remove(),!w||w.length===0)return;const x=D.node();if(!x||!x.parentElement)return;const F=x.parentElement.getBoundingClientRect(),M=F.width,k=F.height,_=Math.max(...p.map(ie=>ie.length)),b=Math.min(_*5.5,200)+40,v={top:48,right:16,bottom:Math.max(80,b),left:56},T=M-v.left-v.right,O=k-v.top-v.bottom;D.attr("width",M).attr("height",k);const Y=D.append("g").attr("transform",`translate(${v.left},${v.top})`),R=new Map;for(const ie of w)R.set(`${ie.x}\0${ie.y}`,ie.p);const W=Fp().domain(p).range([0,T]).padding(.15),ne=vr().domain([0,1]).range([O,0]),le=Tc().domain(m).range(dC);p.forEach(ie=>{let Ee=0;m.forEach(me=>{const He=R.get(`${ie}\0${me}`)||0;Y.append("rect").attr("x",W(ie)).attr("y",ne(Ee+He)).attr("width",W.bandwidth()).attr("height",ne(Ee)-ne(Ee+He)).attr("fill",le(me)).attr("opacity",.85).style("cursor","pointer").on("mouseenter",ke=>{f.value={x:ie,rows:m.map(eA=>({label:eA,color:le(eA),pct:((R.get(`${ie}\0${eA}`)||0)*100).toFixed(1)+"%"})).filter(eA=>eA.pct!=="0.0%")}}).on("mousemove",ke=>{y.value={x:ke.clientX+12,y:ke.clientY-10}}).on("mouseleave",()=>{f.value=null}),Ee+=He})});const Z=Y.append("g").attr("transform",`translate(0,${O})`).call(E2(W));l.value.toLowerCase()==="atlas_annotation"?Z.selectAll(".tick").each(function(){const ie=sn(this),Ee=ie.select("text"),He=`https://nervosensus.netlify.app/?view=cards&atlasannotation=${Ee.text()}`;ie.append("a").attr("href",He).attr("target","_blank").node().appendChild(Ee.node()),Ee.attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px").style("fill","#667eea").style("cursor","pointer")}):Z.selectAll("text").attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px"),Y.append("g").call(d2(ne).tickFormat(xp(".0%"))).selectAll("text").style("font-size","12px"),Y.append("text").attr("transform","rotate(-90)").attr("x",-O/2).attr("y",-40).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text("Proportion"),Y.append("text").attr("x",T/2).attr("y",O+v.bottom-10).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(l.value),D.append("text").attr("x",M/2).attr("y",24).attr("text-anchor","middle").style("font-size","16px").style("font-weight","700").text(`${I.value} proportions within ${l.value}`),C.value=m.map(ie=>({label:ie,color:le(ie)}))}return(w,p)=>(B.openBlock(),B.createElementBlock("div",jj,[r.value?(B.openBlock(),B.createElementBlock("div",$j,[...p[2]||(p[2]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading data...",-1)])])):s.value?(B.openBlock(),B.createElementBlock("div",Zj,[p[3]||(p[3]=B.createElementVNode("strong",null,"Error:",-1)),B.createTextVNode(" "+B.toDisplayString(s.value),1)])):(B.openBlock(),B.createElementBlock("div",e$,[p[9]||(p[9]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Proportion Plot")],-1)),B.createElementVNode("div",A$,[B.createElementVNode("div",t$,[B.createElementVNode("label",i$,[p[5]||(p[5]=B.createTextVNode(" X-axis (group): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":p[0]||(p[0]=m=>l.value=m),onChange:Q,class:"select",disabled:o.value||c.value.length===0},[p[4]||(p[4]=B.createElementVNode("option",{disabled:"",value:""},"-- choose --",-1)),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(c.value,m=>(B.openBlock(),B.createElementBlock("option",{key:m,value:m},B.toDisplayString(m),9,r$))),128))],40,n$),[[B.vModelSelect,l.value]])]),B.createElementVNode("label",s$,[p[7]||(p[7]=B.createTextVNode(" Y-axis (category): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":p[1]||(p[1]=m=>I.value=m),onChange:Q,class:"select",disabled:o.value||c.value.length===0},[p[6]||(p[6]=B.createElementVNode("option",{disabled:"",value:""},"-- choose --",-1)),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(c.value,m=>(B.openBlock(),B.createElementBlock("option",{key:m+"-y",value:m},B.toDisplayString(m),9,a$))),128))],40,o$),[[B.vModelSelect,I.value]])]),B.createElementVNode("button",{class:"visualize-btn",disabled:!l.value||!I.value||o.value,onClick:Q},B.toDisplayString(o.value?"Working...":"Plot"),9,g$),g.value?(B.openBlock(),B.createElementBlock("div",c$,B.toDisplayString(g.value),1)):B.createCommentVNode("",!0)]),B.createElementVNode("div",l$,[B.createElementVNode("div",I$,[o.value?(B.openBlock(),B.createElementBlock("div",h$,[...p[8]||(p[8]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Computing proportions...",-1)])])):B.createCommentVNode("",!0),(B.openBlock(),B.createElementBlock("svg",{ref_key:"plotSvg",ref:i,class:"plot-svg"},null,512)),f.value?(B.openBlock(),B.createElementBlock("div",{key:1,class:"pp-tooltip",style:B.normalizeStyle({left:y.value.x+"px",top:y.value.y+"px"})},[B.createElementVNode("div",u$,B.toDisplayString(f.value.x),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(f.value.rows,m=>(B.openBlock(),B.createElementBlock("div",{key:m.label,class:"pp-tooltip-row"},[B.createElementVNode("span",{class:"legend-swatch",style:B.normalizeStyle({background:m.color})},null,4),B.createElementVNode("span",B$,B.toDisplayString(m.label),1),B.createElementVNode("span",C$,B.toDisplayString(m.pct),1)]))),128))],4)):B.createCommentVNode("",!0)]),C.value.length?(B.openBlock(),B.createElementBlock("div",f$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(C.value,m=>(B.openBlock(),B.createElementBlock("span",{key:m.label,class:"legend-item"},[B.createElementVNode("span",{class:"legend-swatch",style:B.normalizeStyle({background:m.color})},null,4),B.createTextVNode(" "+B.toDisplayString(m.label),1)]))),128))])):B.createCommentVNode("",!0)])])]))]))}},[["__scopeId","data-v-97607b4a"]]),d$={class:"proportion-plot-wrap"},Q$="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",p$=_s(B.defineComponent({inheritAttrs:!1,__name:"Proportion",props:{dataPath:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>e.dataPath??(A?B.unref(A.s3Url):null)??Q$);return(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",d$,[B.createVNode(E$,{"data-path":n.value,"onUpdate:Vars":B.unref(i).setSelection},null,8,["data-path","onUpdate:Vars"])])],64))}}),[["__scopeId","data-v-356bb78d"]]);var y$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ty(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var iF={exports:{}};(function(t,e){(function(A,i){t.exports=i()})(y$,function(){var A=function(S){return S instanceof Uint8Array||S instanceof Uint16Array||S instanceof Uint32Array||S instanceof Int8Array||S instanceof Int16Array||S instanceof Int32Array||S instanceof Float32Array||S instanceof Float64Array||S instanceof Uint8ClampedArray},i=function(S,P){for(var $=Object.keys(P),Se=0;Se<$.length;++Se)S[$[Se]]=P[$[Se]];return S},n=`
|
|
129
|
+
`)).toArray().map(E=>E.toJSON())}const I=performance.now()-c;return this.geneCache.set(e,l),l}catch(A){throw console.error(`Failed to load gene ${e}:`,A),A}}hasTsne(){return this.tsneData!==null}getCellCount(){return this.umapData?this.umapData.length:0}clearCache(){this.geneCache.clear()}}const jj={class:"pp-container"},$j={key:0,class:"loading-container"},Zj={key:1,class:"error-container"},e$={key:2,class:"dashboard"},A$={class:"content-layout"},t$={class:"controls"},i$={class:"label"},n$=["disabled"],r$=["value"],s$={class:"label"},o$=["disabled"],a$=["value"],g$=["disabled"],c$={key:0,class:"pp-message"},l$={class:"plot-and-legend"},I$={class:"plot-container"},h$={key:0,class:"loading-overlay"},u$={class:"pp-tooltip-header"},B$={class:"pp-tooltip-label"},C$={class:"pp-tooltip-value"},f$={key:0,class:"legend"},ky=100,tF=12,My="(other)",E$=_s({__name:"ProportionPlot",props:{dataPath:{type:String,default:"/data"}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=B.ref(null),n=B.ref(null),r=B.ref(!0),s=B.ref(null),o=B.ref(!1),g=B.ref(""),a=B.ref([]),c=B.ref([]),l=B.ref(""),I=B.ref("");let h=null;const u=()=>{clearTimeout(h),h=setTimeout(()=>{E.value.length>0&&d(E.value)},100)},E=B.ref([]),C=B.ref([]),f=B.ref(null),y=B.ref({x:0,y:0});B.onMounted(async()=>{window.addEventListener("resize",u);try{n.value=new Ef(A.dataPath),await n.value.initialize();const w=await n.value.getReductionData("umap");if(a.value=w,w.length>0){const p=w[0],m=Object.keys(p).filter(D=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(D));c.value=m,m.length>=2?(l.value=m.includes("Atlas_annotation")?"Atlas_annotation":m[0],I.value=m[1]!==l.value?m[1]:m[0]):m.length===1&&(l.value=m[0],I.value=m[0])}r.value=!1,await B.nextTick(),l.value&&I.value&&await Q()}catch(w){console.error("Failed to initialize:",w),s.value=`Failed to load data: ${w.message}`,r.value=!1}}),B.onBeforeUnmount(()=>{clearTimeout(h),window.removeEventListener("resize",u)});async function Q(){if(!(!l.value||!I.value||a.value.length===0)){o.value=!0,g.value="Computing proportions...";try{await B.nextTick();const w=a.value,p=new Map,m=new Map,D=new Map;for(const R of w){const W=String(R[l.value]??"(missing)"),ne=String(R[I.value]??"(missing)"),le=`${W}\0${ne}`;p.set(le,(p.get(le)||0)+1),m.set(W,(m.get(W)||0)+1),D.set(ne,(D.get(ne)||0)+1)}const x=Array.from(m.entries()).sort((R,W)=>W[1]-R[1]).slice(0,ky).map(([R])=>R),N=new Set(x),F=Array.from(D.entries()).sort((R,W)=>W[1]-R[1]).slice(0,tF).map(([R])=>R),M=new Set(F),k=new Map,_=new Map;for(const R of w){const W=String(R[l.value]??"(missing)");if(!N.has(W))continue;let ne=String(R[I.value]??"(missing)");M.has(ne)||(ne=My);const le=`${W}\0${ne}`;k.set(le,(k.get(le)||0)+1),_.set(W,(_.get(W)||0)+1)}const b=[],v=new Set;for(const[R,W]of k){const[ne,le]=R.split("\0"),Z=_.get(ne)||1;b.push({x:ne,y:le,p:W/Z}),v.add(le)}if(b.length===0){g.value="No data to plot.";return}const T=x.filter(R=>_.has(R)),O=Array.from(v);E.value={rows:b,xLevels:T,yLevels:O},await B.nextTick(),d(E.value);const Y=(T.length>=ky?` Limited to top ${ky} ${l.value}.`:"")+(O.includes(My)?` Limited to top ${tF} ${I.value} (+ ${My}).`:"");g.value=`Plotted ${O.length} categories across ${T.length} groups.${Y}`}catch(w){console.error("Failed to compute proportions:",w),g.value=`Error: ${w.message}`}finally{o.value=!1}}}function d({rows:w,xLevels:p,yLevels:m}){const D=sn(i.value);if(D.selectAll("*").remove(),!w||w.length===0)return;const x=D.node();if(!x||!x.parentElement)return;const F=x.parentElement.getBoundingClientRect(),M=F.width,k=F.height,_=Math.max(...p.map(ie=>ie.length)),b=Math.min(_*5.5,200)+40,v={top:48,right:16,bottom:Math.max(80,b),left:56},T=M-v.left-v.right,O=k-v.top-v.bottom;D.attr("width",M).attr("height",k);const Y=D.append("g").attr("transform",`translate(${v.left},${v.top})`),R=new Map;for(const ie of w)R.set(`${ie.x}\0${ie.y}`,ie.p);const W=Fp().domain(p).range([0,T]).padding(.15),ne=vr().domain([0,1]).range([O,0]),le=Tc().domain(m).range(dC);p.forEach(ie=>{let Ee=0;m.forEach(me=>{const He=R.get(`${ie}\0${me}`)||0;Y.append("rect").attr("x",W(ie)).attr("y",ne(Ee+He)).attr("width",W.bandwidth()).attr("height",ne(Ee)-ne(Ee+He)).attr("fill",le(me)).attr("opacity",.85).style("cursor","pointer").on("mouseenter",ke=>{f.value={x:ie,rows:m.map(eA=>({label:eA,color:le(eA),pct:((R.get(`${ie}\0${eA}`)||0)*100).toFixed(1)+"%"})).filter(eA=>eA.pct!=="0.0%")}}).on("mousemove",ke=>{y.value={x:ke.clientX+12,y:ke.clientY-10}}).on("mouseleave",()=>{f.value=null}),Ee+=He})});const Z=Y.append("g").attr("transform",`translate(0,${O})`).call(E2(W));l.value.toLowerCase()==="atlas_annotation"?Z.selectAll(".tick").each(function(){const ie=sn(this),Ee=ie.select("text"),He=`https://nervosensus.netlify.app/?view=cards&atlasannotation=${Ee.text()}`;ie.append("a").attr("href",He).attr("target","_blank").node().appendChild(Ee.node()),Ee.attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px").style("fill","#667eea").style("cursor","pointer")}):Z.selectAll("text").attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px"),Y.append("g").call(d2(ne).tickFormat(xp(".0%"))).selectAll("text").style("font-size","12px"),Y.append("text").attr("transform","rotate(-90)").attr("x",-O/2).attr("y",-40).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text("Proportion"),Y.append("text").attr("x",T/2).attr("y",O+v.bottom-10).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(l.value),D.append("text").attr("x",M/2).attr("y",24).attr("text-anchor","middle").style("font-size","16px").style("font-weight","700").text(`${I.value} proportions within ${l.value}`),C.value=m.map(ie=>({label:ie,color:le(ie)}))}return(w,p)=>(B.openBlock(),B.createElementBlock("div",jj,[r.value?(B.openBlock(),B.createElementBlock("div",$j,[...p[2]||(p[2]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading data...",-1)])])):s.value?(B.openBlock(),B.createElementBlock("div",Zj,[p[3]||(p[3]=B.createElementVNode("strong",null,"Error:",-1)),B.createTextVNode(" "+B.toDisplayString(s.value),1)])):(B.openBlock(),B.createElementBlock("div",e$,[p[9]||(p[9]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Proportion Plot")],-1)),B.createElementVNode("div",A$,[B.createElementVNode("div",t$,[B.createElementVNode("label",i$,[p[5]||(p[5]=B.createTextVNode(" X-axis (group): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":p[0]||(p[0]=m=>l.value=m),onChange:Q,class:"select",disabled:o.value||c.value.length===0},[p[4]||(p[4]=B.createElementVNode("option",{disabled:"",value:""},"-- choose --",-1)),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(c.value,m=>(B.openBlock(),B.createElementBlock("option",{key:m,value:m},B.toDisplayString(m),9,r$))),128))],40,n$),[[B.vModelSelect,l.value]])]),B.createElementVNode("label",s$,[p[7]||(p[7]=B.createTextVNode(" Y-axis (category): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":p[1]||(p[1]=m=>I.value=m),onChange:Q,class:"select",disabled:o.value||c.value.length===0},[p[6]||(p[6]=B.createElementVNode("option",{disabled:"",value:""},"-- choose --",-1)),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(c.value,m=>(B.openBlock(),B.createElementBlock("option",{key:m+"-y",value:m},B.toDisplayString(m),9,a$))),128))],40,o$),[[B.vModelSelect,I.value]])]),B.createElementVNode("button",{class:"visualize-btn",disabled:!l.value||!I.value||o.value,onClick:Q},B.toDisplayString(o.value?"Working...":"Plot"),9,g$),g.value?(B.openBlock(),B.createElementBlock("div",c$,B.toDisplayString(g.value),1)):B.createCommentVNode("",!0)]),B.createElementVNode("div",l$,[B.createElementVNode("div",I$,[o.value?(B.openBlock(),B.createElementBlock("div",h$,[...p[8]||(p[8]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Computing proportions...",-1)])])):B.createCommentVNode("",!0),(B.openBlock(),B.createElementBlock("svg",{ref_key:"plotSvg",ref:i,class:"plot-svg"},null,512)),f.value?(B.openBlock(),B.createElementBlock("div",{key:1,class:"pp-tooltip",style:B.normalizeStyle({left:y.value.x+"px",top:y.value.y+"px"})},[B.createElementVNode("div",u$,B.toDisplayString(f.value.x),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(f.value.rows,m=>(B.openBlock(),B.createElementBlock("div",{key:m.label,class:"pp-tooltip-row"},[B.createElementVNode("span",{class:"legend-swatch",style:B.normalizeStyle({background:m.color})},null,4),B.createElementVNode("span",B$,B.toDisplayString(m.label),1),B.createElementVNode("span",C$,B.toDisplayString(m.pct),1)]))),128))],4)):B.createCommentVNode("",!0)]),C.value.length?(B.openBlock(),B.createElementBlock("div",f$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(C.value,m=>(B.openBlock(),B.createElementBlock("span",{key:m.label,class:"legend-item"},[B.createElementVNode("span",{class:"legend-swatch",style:B.normalizeStyle({background:m.color})},null,4),B.createTextVNode(" "+B.toDisplayString(m.label),1)]))),128))])):B.createCommentVNode("",!0)])])]))]))}},[["__scopeId","data-v-97607b4a"]]),d$={class:"proportion-plot-wrap"},Q$="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",p$=_s(B.defineComponent({inheritAttrs:!1,__name:"Proportion",props:{dataPath:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>{var r;return e.dataPath??(A?(r=B.unref(A.services))==null?void 0:r.s3Url:null)??Q$});return(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",d$,[B.createVNode(E$,{"data-path":n.value,"onUpdate:Vars":B.unref(i).setSelection},null,8,["data-path","onUpdate:Vars"])])],64))}}),[["__scopeId","data-v-fea395b3"]]);var y$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ty(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var iF={exports:{}};(function(t,e){(function(A,i){t.exports=i()})(y$,function(){var A=function(S){return S instanceof Uint8Array||S instanceof Uint16Array||S instanceof Uint32Array||S instanceof Int8Array||S instanceof Int16Array||S instanceof Int32Array||S instanceof Float32Array||S instanceof Float64Array||S instanceof Uint8ClampedArray},i=function(S,P){for(var $=Object.keys(P),Se=0;Se<$.length;++Se)S[$[Se]]=P[$[Se]];return S},n=`
|
|
130
130
|
`;function r(S){return typeof atob<"u"?atob(S):"base64:"+S}function s(S){var P=new Error("(regl) "+S);throw console.error(P),P}function o(S,P){S||s(P)}function g(S){return S?": "+S:""}function a(S,P,$){S in P||s("unknown parameter ("+S+")"+g($)+". possible values: "+Object.keys(P).join())}function c(S,P){A(S)||s("invalid parameter type"+g(P)+". must be a typed array")}function l(S,P){switch(P){case"number":return typeof S=="number";case"object":return typeof S=="object";case"string":return typeof S=="string";case"boolean":return typeof S=="boolean";case"function":return typeof S=="function";case"undefined":return typeof S>"u";case"symbol":return typeof S=="symbol"}}function I(S,P,$){l(S,P)||s("invalid parameter type"+g($)+". expected "+P+", got "+typeof S)}function h(S,P){S>=0&&(S|0)===S||s("invalid parameter type, ("+S+")"+g(P)+". must be a nonnegative integer")}function u(S,P,$){P.indexOf(S)<0&&s("invalid value"+g($)+". must be one of: "+P)}var E=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function C(S){Object.keys(S).forEach(function(P){E.indexOf(P)<0&&s('invalid regl constructor argument "'+P+'". must be one of '+E)})}function f(S,P){for(S=S+"";S.length<P;)S=" "+S;return S}function y(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function Q(S,P){this.number=S,this.line=P,this.errors=[]}function d(S,P,$){this.file=S,this.line=P,this.message=$}function w(){var S=new Error,P=(S.stack||S).toString(),$=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(P);if($)return $[1];var Se=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(P);return Se?Se[1]:"unknown"}function p(){var S=new Error,P=(S.stack||S).toString(),$=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(P);if($)return $[1];var Se=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(P);return Se?Se[1]:"unknown"}function m(S,P){var $=S.split(`
|
|
131
131
|
`),Se=1,Te=0,_e={unknown:new y,0:new y};_e.unknown.name=_e[0].name=P||w(),_e.unknown.lines.push(new Q(0,""));for(var Fe=0;Fe<$.length;++Fe){var Ye=$[Fe],Je=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Ye);if(Je)switch(Je[1]){case"line":var AA=/(\d+)(\s+\d+)?/.exec(Je[2]);AA&&(Se=AA[1]|0,AA[2]&&(Te=AA[2]|0,Te in _e||(_e[Te]=new y)));break;case"define":var iA=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Je[2]);iA&&(_e[Te].name=iA[1]?r(iA[2]):iA[2]);break}_e[Te].lines.push(new Q(Se++,Ye))}return Object.keys(_e).forEach(function(tA){var aA=_e[tA];aA.lines.forEach(function(Ke){aA.index[Ke.number]=Ke})}),_e}function D(S){var P=[];return S.split(`
|
|
132
132
|
`).forEach(function($){if(!($.length<5)){var Se=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec($);Se?P.push(new d(Se[1]|0,Se[2]|0,Se[3].trim())):$.length>0&&P.push(new d("unknown",0,$))}}),P}function x(S,P){P.forEach(function($){var Se=S[$.file];if(Se){var Te=Se.index[$.line];if(Te){Te.errors.push($),Se.hasErrors=!0;return}}S.unknown.hasErrors=!0,S.unknown.lines[0].errors.push($)})}function N(S,P,$,Se,Te){if(!S.getShaderParameter(P,S.COMPILE_STATUS)){var _e=S.getShaderInfoLog(P),Fe=Se===S.FRAGMENT_SHADER?"fragment":"vertex";T($,"string",Fe+" shader source must be a string",Te);var Ye=m($,Te),Je=D(_e);x(Ye,Je),Object.keys(Ye).forEach(function(AA){var iA=Ye[AA];if(!iA.hasErrors)return;var tA=[""],aA=[""];function Ke(Ze,he){tA.push(Ze),aA.push(he||"")}Ke("file number "+AA+": "+iA.name+`
|
|
@@ -180,7 +180,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
180
180
|
gl_Position = vec4(pos, 0, 1);
|
|
181
181
|
gl_PointSize = pointSize;
|
|
182
182
|
vColor = color;
|
|
183
|
-
}`,attributes:{position:[Kt,wt],color:(()=>{if(ti.color.startsWith("#"))return[...Ee(ti.color),ti.opacity];const ci=ti.color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);return ci?[parseInt(ci[1])/255,parseInt(ci[2])/255,parseInt(ci[3])/255,ti.opacity]:[.8,.8,.8,ti.opacity]})()},uniforms:{pointSize:Math.max(12,8*Qt.k),scale:Qt.k,translate:[2*Qt.x/jA.width,-(2*Qt.y)/jA.height]},count:1,primitive:"points",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"src alpha",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"},equation:"add"}})()}st(),await B.nextTick(),eA()}function ke(Ve){const de=n.value,nA=de.getContext("2d"),At=de.parentElement.getBoundingClientRect();de.width=Math.max(1,Math.floor(At.width)),de.height=Math.max(300,Math.floor(At.height));const fi=Co(Ve,FA=>FA.x),U=Co(Ve,FA=>FA.y),Tt=vr().domain(fi).range([20,de.width-20]),Ai=vr().domain(U).range([de.height-20,20]);nA.clearRect(0,0,de.width,de.height),Ve.forEach(FA=>{nA.fillStyle=FA.color,nA.globalAlpha=FA.opacity,nA.beginPath(),nA.arc(Tt(FA.x),Ai(FA.y),2,0,2*Math.PI),nA.fill()}),nA.globalAlpha=1}function eA(){if(!r.value)return;const Ve=r.value,de=Ve.getContext("2d"),nA=Math.max(Ve.width||150,Ve.height||150);Ve.width!==nA&&(Ve.width=nA),Ve.height!==nA&&(Ve.height=nA);const PA=de.createImageData(nA,nA),At=PA.data,fi=it=>Math.max(0,Math.min(255,Math.round(it))),U=it=>(Math.max(it[0]??0,it[1]??0,it[2]??0)<=1?it.map(gi=>gi*255):it).map(fi),Tt=U(Ee(v.value)),Ai=U(Ee(k.value)),FA=U(Ee(_.value)),Nt=U(Ee(b.value));for(let it=0;it<nA;it++)for(let Ti=0;Ti<nA;Ti++){const jA=Ti/(nA-1),gi=(nA-1-it)/(nA-1);let Li=Tt[0]*(1-jA)*(1-gi),ye=Tt[1]*(1-jA)*(1-gi),We=Tt[2]*(1-jA)*(1-gi);if(Li+=Ai[0]*jA*(1-gi),ye+=Ai[1]*jA*(1-gi),We+=Ai[2]*jA*(1-gi),Li+=FA[0]*(1-jA)*gi,ye+=FA[1]*(1-jA)*gi,We+=FA[2]*(1-jA)*gi,jA>0&&gi>0){const cA=jA*gi,qA=(Ai[0]+FA[0])/2,$A=(Ai[1]+FA[1])/2,nt=(Ai[2]+FA[2])/2;Li+=qA*cA,ye+=$A*cA,We+=nt*cA;const et=Math.pow(cA,2)*T.value,Wt=1+et;Li=(Li+Nt[0]*et)/Wt,ye=(ye+Nt[1]*et)/Wt,We=(We+Nt[2]*et)/Wt}const ze=(it*nA+Ti)*4;At[ze]=fi(Li),At[ze+1]=fi(ye),At[ze+2]=fi(We),At[ze+3]=255}de.putImageData(PA,0,0)}function dA(Ve){const de={};Ve.cell_type&&(de.cell_type=Ve.cell_type),de[p.value]=Ve.expr1,de[m.value]=Ve.expr2;const nA=new Set(["cell_id","umap_1","umap_2","tsne_1","tsne_2","x","y","color","zIndex","opacity","expr1","expr2","norm1","norm2"]);return Object.keys(Ve).forEach(PA=>{!nA.has(PA)&&Ve[PA]!==null&&Ve[PA]!==void 0&&(de[PA]=Ve[PA])}),de}function XA(Ve){return Ve===p.value?{color:k.value}:Ve===m.value?{color:_.value}:{}}function OA(Ve){return Ve.split("_").map(de=>de.charAt(0).toUpperCase()+de.slice(1)).join(" ")}function TA(Ve,de){return typeof de=="number"?Ve===p.value||Ve===m.value?de.toFixed(3):de<.01&&de>0?de.toExponential(2):Math.abs(de)>1e3?de.toLocaleString():de.toFixed(2):de}async function YA(){W.value&&await He(),await B.nextTick(),Q.value&&eA()}return(Ve,de)=>(B.openBlock(),B.createElementBlock("div",w$,[B.createElementVNode("div",D$,[B.createElementVNode("div",_$,[B.createElementVNode("div",S$,[de[14]||(de[14]=B.createElementVNode("h3",null,"Gene Co-expression Analysis",-1)),B.createElementVNode("div",v$,[de[13]||(de[13]=B.createElementVNode("label",{for:"reduction-select"},"Visualization:",-1)),B.withDirectives(B.createElementVNode("select",{id:"reduction-select","onUpdate:modelValue":de[0]||(de[0]=nA=>f.value=nA),disabled:u.value},[de[12]||(de[12]=B.createElementVNode("option",{value:"umap"},"UMAP",-1)),B.createElementVNode("option",{value:"tsne",disabled:!y.value}," tSNE "+B.toDisplayString(y.value?"":"(not available)"),9,x$)],8,b$),[[B.vModelSelect,f.value]])])]),B.createElementVNode("div",R$,[B.createElementVNode("div",F$,[B.createElementVNode("div",N$,[B.createElementVNode("label",k$,[de[15]||(de[15]=B.createElementVNode("span",{class:"gene-number"},"Gene 1",-1)),p.value?(B.openBlock(),B.createElementBlock("span",{key:0,class:"selected-gene",style:B.normalizeStyle({color:k.value})},B.toDisplayString(p.value),5)):B.createCommentVNode("",!0)]),B.withDirectives(B.createElementVNode("input",{id:"gene1-select","onUpdate:modelValue":de[1]||(de[1]=nA=>d.value=nA),type:"text",placeholder:"Gene name (e.g., CDH9)",onInput:de[2]||(de[2]=nA=>le(1)),disabled:u.value,list:"gene1-list",autocomplete:"off",class:"gene-input"},null,40,M$),[[B.vModelText,d.value]]),B.createElementVNode("datalist",T$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(D.value,nA=>(B.openBlock(),B.createElementBlock("option",{key:nA,value:nA},null,8,L$))),128))])]),de[17]||(de[17]=B.createElementVNode("div",{class:"vs-separator"},[B.createElementVNode("span",null,"vs")],-1)),B.createElementVNode("div",U$,[B.createElementVNode("label",G$,[de[16]||(de[16]=B.createElementVNode("span",{class:"gene-number"},"Gene 2",-1)),m.value?(B.openBlock(),B.createElementBlock("span",{key:0,class:"selected-gene",style:B.normalizeStyle({color:_.value})},B.toDisplayString(m.value),5)):B.createCommentVNode("",!0)]),B.withDirectives(B.createElementVNode("input",{id:"gene2-select","onUpdate:modelValue":de[3]||(de[3]=nA=>w.value=nA),type:"text",placeholder:"Gene name (e.g., TAC1)",onInput:de[4]||(de[4]=nA=>le(2)),disabled:u.value,list:"gene2-list",autocomplete:"off",class:"gene-input"},null,40,O$),[[B.vModelText,w.value]]),B.createElementVNode("datalist",P$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(x.value,nA=>(B.openBlock(),B.createElementBlock("option",{key:nA,value:nA},null,8,q$))),128))])])]),B.createElementVNode("button",{onClick:ie,disabled:!Y.value||u.value,class:"visualize-btn"},[u.value?(B.openBlock(),B.createElementBlock("span",J$,[...de[18]||(de[18]=[B.createElementVNode("span",{class:"btn-spinner"},null,-1),B.createTextVNode("Loading...",-1)])])):(B.openBlock(),B.createElementBlock("span",Y$,[(B.openBlock(),B.createElementBlock("svg",K$,[...de[19]||(de[19]=[B.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),B.createElementVNode("path",{d:"m21 21-4.35-4.35"},null,-1)])])),de[20]||(de[20]=B.createTextVNode(" Visualize Co-expression ",-1))]))],8,H$)])]),u.value&&!o.value?(B.openBlock(),B.createElementBlock("div",V$,[de[21]||(de[21]=B.createElementVNode("div",{class:"spinner"},null,-1)),B.createElementVNode("p",null,B.toDisplayString(E.value),1)])):B.createCommentVNode("",!0),C.value?(B.openBlock(),B.createElementBlock("div",W$,[de[22]||(de[22]=B.createElementVNode("strong",null,"⚠️ Error:",-1)),B.createTextVNode(" "+B.toDisplayString(C.value)+" ",1),B.createElementVNode("button",{onClick:de[5]||(de[5]=nA=>C.value=null),class:"dismiss-btn"},"Dismiss")])):B.createCommentVNode("",!0),R.value?(B.openBlock(),B.createElementBlock("div",z$,[B.createElementVNode("div",X$,[de[23]||(de[23]=B.createElementVNode("span",{class:"stat-label"},"Total cells:",-1)),B.createElementVNode("span",j$,B.toDisplayString(O.value.totalCells.toLocaleString()),1)]),B.createElementVNode("div",$$,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:k.value})},B.toDisplayString(p.value)+" expressing:",5),B.createElementVNode("span",Z$,B.toDisplayString(O.value.gene1Expressing.toLocaleString())+" ("+B.toDisplayString(O.value.gene1Pct)+"%)",1)]),B.createElementVNode("div",eZ,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:_.value})},B.toDisplayString(m.value)+" expressing:",5),B.createElementVNode("span",AZ,B.toDisplayString(O.value.gene2Expressing.toLocaleString())+" ("+B.toDisplayString(O.value.gene2Pct)+"%)",1)]),B.createElementVNode("div",tZ,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:b.value})},"Co-expressing:",4),B.createElementVNode("span",iZ,B.toDisplayString(O.value.coexpressing.toLocaleString())+" ("+B.toDisplayString(O.value.coexpressPct)+"%)",1)])])):B.createCommentVNode("",!0)]),B.createElementVNode("div",nZ,[W.value||u.value&&o.value?(B.openBlock(),B.createElementBlock("div",rZ,[u.value&&o.value?(B.openBlock(),B.createElementBlock("div",sZ,[de[24]||(de[24]=B.createElementVNode("div",{class:"small-spinner"},null,-1)),B.createElementVNode("p",null,B.toDisplayString(E.value),1)])):(B.openBlock(),B.createElementBlock("div",oZ,[B.createElementVNode("canvas",{ref_key:"chartCanvas",ref:n},null,512),W.value||u.value&&o.value?(B.openBlock(),B.createElementBlock("button",{key:0,class:"floating-mixer-toggle",onClick:de[6]||(de[6]=nA=>Q.value=!Q.value),title:Q.value?"Hide Color Mixing Guide":"Open Color Mixing Guide","aria-expanded":Q.value.toString()},[Q.value?(B.openBlock(),B.createElementBlock("svg",cZ,[...de[26]||(de[26]=[B.createElementVNode("path",{d:"M6 9l6 6 6-6"},null,-1)])])):(B.openBlock(),B.createElementBlock("svg",gZ,[...de[25]||(de[25]=[B.createElementVNode("path",{d:"M18 15l-6-6-6 6"},null,-1)])]))],8,aZ)):B.createCommentVNode("",!0),Q.value&&(W.value||u.value&&o.value)?(B.openBlock(),B.createElementBlock("div",lZ,[de[30]||(de[30]=B.createElementVNode("div",{class:"floating-mixer-header"},[B.createElementVNode("span",null,"Color Mixing Guide")],-1)),B.createElementVNode("div",IZ,[B.createElementVNode("div",null,[B.createElementVNode("canvas",{ref_key:"gradientCanvas",ref:r,class:"gradient-canvas",width:"150",height:"150",onClick:eA},null,512),B.createElementVNode("div",hZ,[B.createElementVNode("div",uZ,B.toDisplayString(m.value||"Gene 2")+" Expression ",1),B.createElementVNode("div",BZ,B.toDisplayString(p.value||"Gene 1")+" Expression ",1),de[27]||(de[27]=B.createElementVNode("div",{class:"axis-arrow x-arrow-right"},"→",-1)),de[28]||(de[28]=B.createElementVNode("div",{class:"axis-arrow y-arrow-top"},"↑",-1))])]),B.createElementVNode("div",CZ,[de[29]||(de[29]=B.createElementVNode("label",{for:"boost-slider",class:"boost-label"},"Boost",-1)),B.withDirectives(B.createElementVNode("input",{id:"boost-slider",type:"range","onUpdate:modelValue":de[7]||(de[7]=nA=>T.value=nA),min:"0.1",max:"100",step:"0.1",onInput:YA,class:"boost-slider-vertical",orient:"vertical"},null,544),[[B.vModelText,T.value,void 0,{number:!0}]])])])])):B.createCommentVNode("",!0),a.value?(B.openBlock(),B.createElementBlock("div",{key:2,class:"tooltip",style:B.normalizeStyle({left:c.value.x+"px",top:c.value.y+"px"})},[B.createElementVNode("div",fZ,"ID: "+B.toDisplayString(a.value.cell_id),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(dA(a.value),(nA,PA)=>(B.openBlock(),B.createElementBlock("div",{key:PA,class:"tooltip-row"},[B.createElementVNode("span",{class:"tooltip-label",style:B.normalizeStyle(XA(PA))},B.toDisplayString(OA(PA))+":",5),B.createElementVNode("span",EZ,B.toDisplayString(TA(PA,nA)),1)]))),128))],4)):B.createCommentVNode("",!0)]))])):B.createCommentVNode("",!0),R.value?(B.openBlock(),B.createElementBlock("div",dZ,[B.createElementVNode("div",QZ,[B.createElementVNode("div",pZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[8]||(de[8]=nA=>v.value=nA),class:"color-picker",onChange:YA,title:"Choose color for no expression"},null,544),[[B.vModelText,v.value]]),de[31]||(de[31]=B.createElementVNode("span",null,"None",-1))]),B.createElementVNode("div",yZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[9]||(de[9]=nA=>k.value=nA),class:"color-picker",onChange:YA,title:`Choose color for ${p.value} only`},null,40,mZ),[[B.vModelText,k.value]]),B.createElementVNode("span",null,B.toDisplayString(p.value)+" only",1)]),B.createElementVNode("div",wZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[10]||(de[10]=nA=>_.value=nA),class:"color-picker",onChange:YA,title:`Choose color for ${m.value} only`},null,40,DZ),[[B.vModelText,_.value]]),B.createElementVNode("span",null,B.toDisplayString(m.value)+" only",1)]),B.createElementVNode("div",_Z,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[11]||(de[11]=nA=>b.value=nA),class:"color-picker",onChange:YA,title:"Choose color for co-expression"},null,544),[[B.vModelText,b.value]]),de[32]||(de[32]=B.createElementVNode("span",null,"Both",-1))])])])):B.createCommentVNode("",!0),!W.value&&!u.value&&!C.value?(B.openBlock(),B.createElementBlock("div",SZ,[...de[33]||(de[33]=[B.createElementVNode("div",{class:"empty-icon"},"🔬",-1),B.createElementVNode("h3",null,"Ready to visualize gene co-expression",-1),B.createElementVNode("p",null,"Select two genes and a dimension reduction method to get started",-1)])])):B.createCommentVNode("",!0)])]))}},[["__scopeId","data-v-4a0fb898"]]),bZ={class:"gene-coexpression-wrap"},xZ="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",RZ=_s(B.defineComponent({inheritAttrs:!1,__name:"GeneExpressionViewer",props:{dataPath:{},initialGene1:{},initialGene2:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>e.dataPath??(A?B.unref(A.s3Url):null)??xZ);return B.onMounted(()=>{e.initialGene1&&i.selectedGene1===null&&i.setSelectedGene1(e.initialGene1),e.initialGene2&&i.selectedGene2===null&&i.setSelectedGene2(e.initialGene2)}),(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",bZ,[B.createVNode(vZ,{gene1:B.unref(i).selectedGene1??void 0,gene2:B.unref(i).selectedGene2??void 0,"onUpdate:Vars":B.unref(i).setSelection,"data-path":n.value},null,8,["gene1","gene2","onUpdate:Vars","data-path"])])],64))}}),[["__scopeId","data-v-2eeb7a01"]]),FZ={class:"umap-comparison-dashboard"},NZ={key:0,class:"loading-container"},kZ={key:1,class:"error-container"},MZ={key:2,class:"dashboard"},TZ={class:"both-pannels"},LZ={class:"panel"},UZ={class:"controls"},GZ={class:"label"},OZ=["value"],PZ={class:"canvas-container"},qZ={class:"legend-header"},HZ=["title"],JZ={key:0},YZ={key:1},KZ={class:"legend-items"},VZ=["onClick"],WZ={key:0,class:"legend-x"},zZ=["href"],XZ={key:1,class:"legend-label"},jZ={class:"tooltip-header"},$Z={class:"tooltip-value"},ZZ={class:"panel"},eee={class:"controls"},Aee={class:"label"},tee={class:"gene-input-wrapper"},iee={id:"gene-suggestions"},nee=["value"],ree=["disabled"],see={class:"canvas-container"},oee={key:0,class:"loading-overlay"},aee={key:0,class:"legend"},gee=_s({__name:"SideBySide",props:{dataPath:{type:String,default:"/data"},metadataColumn:{type:String,default:null},gene:{type:String,default:null}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=e,n=B.ref(null),r=B.ref(null),s=B.ref(null),o=B.ref(null),g=B.ref(null),a=B.ref(Br),c=B.ref(null),l=B.ref(null),I=B.ref([]),h=B.ref([]),u=B.ref(null),E=B.ref(!0),C=B.ref({x:0,y:0}),f=B.ref(!1),y=B.ref(!1),Q=B.ref(!0),d=B.ref(null),w=B.ref([]),p=B.ref([]),m=B.ref(A.metadataColumn||""),D=B.ref([]),x=B.ref(new Set),N=B.ref(""),F=B.ref(A.gene||""),M=B.ref([]),k=B.ref(!1);let _=null;B.watch(()=>A.metadataColumn,ye=>{ye&&ye!==m.value&&(m.value=ye,w.value.length>0&&U())}),B.watch(()=>A.gene,ye=>{ye&&ye!==F.value&&(F.value=ye,N.value=ye,w.value.length>0&&it())}),B.watch(m,ye=>{ye&&i("update:Vars","selectedMetadataColumn",ye)}),B.watch(F,ye=>{ye&&i("update:Vars","selectedGene",ye)});function b(ye){const We=parseInt(ye.slice(1,3),16)/255,ze=parseInt(ye.slice(3,5),16)/255,cA=parseInt(ye.slice(5,7),16)/255;return[We,ze,cA]}function v(){if(Z.length>0&&(Z.forEach(ye=>{try{ye.destroy()}catch(We){console.warn("Error destroying texture:",We)}}),Z=[]),n.value&&ae.length>0&&(ae.forEach(({event:ye,handler:We})=>{n.value.removeEventListener(ye,We)}),ae=[]),o.value){try{o.value.destroy()}catch(ye){console.warn("Error destroying regl:",ye)}o.value=null,ne=null}}function T(){if(r.value&&eA.length>0&&(eA.forEach(({event:ye,handler:We})=>{r.value.removeEventListener(ye,We)}),eA=[]),g.value){try{g.value.destroy()}catch(ye){console.warn("Error destroying right regl:",ye)}g.value=null,ke=null}}let O=!1,Y=null,R=null,W=null,ne=null,le=[],Z=[],ae=[],ie=!1,Ee=null,me=null,He=null,ke=null,eA=[];const dA=B.computed(()=>{if(!u.value)return null;let ye=I.value.find(We=>We.cell_id===u.value);return!ye&&h.value.length>0&&(ye=h.value.find(We=>We.cell_id===u.value)),ye});B.onMounted(async()=>{try{s.value=new Ef(A.dataPath),await s.value.initialize();const ye=await s.value.getReductionData("umap");if(w.value=ye,ye.length>0){const We=ye[0],ze=Object.keys(We).filter(cA=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(cA));p.value=ze,ze.length>0&&(A.metadataColumn&&ze.includes(A.metadataColumn)?m.value=A.metadataColumn:m.value||(m.value=ze.includes("Atlas_annotation")?"Atlas_annotation":ze[0]))}Q.value=!1,await B.nextTick(),XA(),m.value&&U(),A.gene&&(F.value=A.gene,N.value=A.gene,await it())}catch(ye){console.error("Failed to initialize:",ye),d.value=`Failed to load data: ${ye.message}`,Q.value=!1}}),B.onBeforeUnmount(()=>{c.value&&c.value.disconnect(),l.value&&l.value.disconnect(),v(),T()});function XA(){n.value&&(c.value=new ResizeObserver(()=>{!y.value&&m.value&&U()}),c.value.observe(n.value.closest(".panel"))),r.value&&(l.value=new ResizeObserver(()=>{F.value&&it()}),l.value.observe(r.value.closest(".panel")))}function OA(){clearTimeout(_),_=setTimeout(async()=>{if(N.value.length<1){M.value=[];return}try{const ye=await s.value.searchGenes(N.value);M.value=ye.map(We=>We.gene_name).slice(0,20)}catch(ye){console.error("Gene search failed:",ye)}},300)}async function TA(){N.value.trim()&&(F.value=N.value,await it())}function YA(ye,We,ze){const cA=new Map;ye.forEach(nt=>{const et=nt[We];et!=null&&(cA.has(et)||cA.set(et,[]),cA.get(et).push(nt))});const qA=[];cA.forEach((nt,et)=>{if(nt.length===0)return;const Wt=nt.reduce((xt,Yt)=>xt+Yt.x,0)/nt.length,$t=nt.reduce((xt,Yt)=>xt+Yt.y,0)/nt.length;qA.push({text:String(et),x:Wt,y:$t,color:ze(et),count:nt.length})});const $A=.3;for(let nt=0;nt<qA.length;nt++)for(let et=nt+1;et<qA.length;et++){const Wt=qA[nt].x-qA[et].x,$t=qA[nt].y-qA[et].y,xt=Math.sqrt(Wt*Wt+$t*$t);if(xt<$A&&xt>0){const Yt=($A-xt)/2,Ri=Math.atan2($t,Wt);qA[nt].x+=Math.cos(Ri)*Yt,qA[nt].y+=Math.sin(Ri)*Yt,qA[et].x-=Math.cos(Ri)*Yt,qA[et].y-=Math.sin(Ri)*Yt}}return qA}function Ve(ye,We){We.value=new Set(ye)}function de(ye){const We=x;We.value.has(ye)?We.value.delete(ye):We.value.add(ye),PA(),ke&&F.value&&At()}function nA(){y.value=!0,f.value=!f.value,setTimeout(()=>{y.value=!1},350)}function PA(){if(!ne||!R||!W||!n.value)return;const We=[],ze=[];I.value.forEach(cA=>{const qA=String(cA[m.value]);if(We.push(R(cA.x),W(cA.y)),x.value.has(qA)){const $A=$r(cA.color).rgb();ze.push($A.r/255,$A.g/255,$A.b/255,.8)}else ze.push(.85,.85,.85,.3)}),Y=ne({frag:`
|
|
183
|
+
}`,attributes:{position:[Kt,wt],color:(()=>{if(ti.color.startsWith("#"))return[...Ee(ti.color),ti.opacity];const ci=ti.color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);return ci?[parseInt(ci[1])/255,parseInt(ci[2])/255,parseInt(ci[3])/255,ti.opacity]:[.8,.8,.8,ti.opacity]})()},uniforms:{pointSize:Math.max(12,8*Qt.k),scale:Qt.k,translate:[2*Qt.x/jA.width,-(2*Qt.y)/jA.height]},count:1,primitive:"points",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"src alpha",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"},equation:"add"}})()}st(),await B.nextTick(),eA()}function ke(Ve){const de=n.value,nA=de.getContext("2d"),At=de.parentElement.getBoundingClientRect();de.width=Math.max(1,Math.floor(At.width)),de.height=Math.max(300,Math.floor(At.height));const fi=Co(Ve,FA=>FA.x),U=Co(Ve,FA=>FA.y),Tt=vr().domain(fi).range([20,de.width-20]),Ai=vr().domain(U).range([de.height-20,20]);nA.clearRect(0,0,de.width,de.height),Ve.forEach(FA=>{nA.fillStyle=FA.color,nA.globalAlpha=FA.opacity,nA.beginPath(),nA.arc(Tt(FA.x),Ai(FA.y),2,0,2*Math.PI),nA.fill()}),nA.globalAlpha=1}function eA(){if(!r.value)return;const Ve=r.value,de=Ve.getContext("2d"),nA=Math.max(Ve.width||150,Ve.height||150);Ve.width!==nA&&(Ve.width=nA),Ve.height!==nA&&(Ve.height=nA);const PA=de.createImageData(nA,nA),At=PA.data,fi=it=>Math.max(0,Math.min(255,Math.round(it))),U=it=>(Math.max(it[0]??0,it[1]??0,it[2]??0)<=1?it.map(gi=>gi*255):it).map(fi),Tt=U(Ee(v.value)),Ai=U(Ee(k.value)),FA=U(Ee(_.value)),Nt=U(Ee(b.value));for(let it=0;it<nA;it++)for(let Ti=0;Ti<nA;Ti++){const jA=Ti/(nA-1),gi=(nA-1-it)/(nA-1);let Li=Tt[0]*(1-jA)*(1-gi),ye=Tt[1]*(1-jA)*(1-gi),We=Tt[2]*(1-jA)*(1-gi);if(Li+=Ai[0]*jA*(1-gi),ye+=Ai[1]*jA*(1-gi),We+=Ai[2]*jA*(1-gi),Li+=FA[0]*(1-jA)*gi,ye+=FA[1]*(1-jA)*gi,We+=FA[2]*(1-jA)*gi,jA>0&&gi>0){const cA=jA*gi,qA=(Ai[0]+FA[0])/2,$A=(Ai[1]+FA[1])/2,nt=(Ai[2]+FA[2])/2;Li+=qA*cA,ye+=$A*cA,We+=nt*cA;const et=Math.pow(cA,2)*T.value,Wt=1+et;Li=(Li+Nt[0]*et)/Wt,ye=(ye+Nt[1]*et)/Wt,We=(We+Nt[2]*et)/Wt}const ze=(it*nA+Ti)*4;At[ze]=fi(Li),At[ze+1]=fi(ye),At[ze+2]=fi(We),At[ze+3]=255}de.putImageData(PA,0,0)}function dA(Ve){const de={};Ve.cell_type&&(de.cell_type=Ve.cell_type),de[p.value]=Ve.expr1,de[m.value]=Ve.expr2;const nA=new Set(["cell_id","umap_1","umap_2","tsne_1","tsne_2","x","y","color","zIndex","opacity","expr1","expr2","norm1","norm2"]);return Object.keys(Ve).forEach(PA=>{!nA.has(PA)&&Ve[PA]!==null&&Ve[PA]!==void 0&&(de[PA]=Ve[PA])}),de}function XA(Ve){return Ve===p.value?{color:k.value}:Ve===m.value?{color:_.value}:{}}function OA(Ve){return Ve.split("_").map(de=>de.charAt(0).toUpperCase()+de.slice(1)).join(" ")}function TA(Ve,de){return typeof de=="number"?Ve===p.value||Ve===m.value?de.toFixed(3):de<.01&&de>0?de.toExponential(2):Math.abs(de)>1e3?de.toLocaleString():de.toFixed(2):de}async function YA(){W.value&&await He(),await B.nextTick(),Q.value&&eA()}return(Ve,de)=>(B.openBlock(),B.createElementBlock("div",w$,[B.createElementVNode("div",D$,[B.createElementVNode("div",_$,[B.createElementVNode("div",S$,[de[14]||(de[14]=B.createElementVNode("h3",null,"Gene Co-expression Analysis",-1)),B.createElementVNode("div",v$,[de[13]||(de[13]=B.createElementVNode("label",{for:"reduction-select"},"Visualization:",-1)),B.withDirectives(B.createElementVNode("select",{id:"reduction-select","onUpdate:modelValue":de[0]||(de[0]=nA=>f.value=nA),disabled:u.value},[de[12]||(de[12]=B.createElementVNode("option",{value:"umap"},"UMAP",-1)),B.createElementVNode("option",{value:"tsne",disabled:!y.value}," tSNE "+B.toDisplayString(y.value?"":"(not available)"),9,x$)],8,b$),[[B.vModelSelect,f.value]])])]),B.createElementVNode("div",R$,[B.createElementVNode("div",F$,[B.createElementVNode("div",N$,[B.createElementVNode("label",k$,[de[15]||(de[15]=B.createElementVNode("span",{class:"gene-number"},"Gene 1",-1)),p.value?(B.openBlock(),B.createElementBlock("span",{key:0,class:"selected-gene",style:B.normalizeStyle({color:k.value})},B.toDisplayString(p.value),5)):B.createCommentVNode("",!0)]),B.withDirectives(B.createElementVNode("input",{id:"gene1-select","onUpdate:modelValue":de[1]||(de[1]=nA=>d.value=nA),type:"text",placeholder:"Gene name (e.g., CDH9)",onInput:de[2]||(de[2]=nA=>le(1)),disabled:u.value,list:"gene1-list",autocomplete:"off",class:"gene-input"},null,40,M$),[[B.vModelText,d.value]]),B.createElementVNode("datalist",T$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(D.value,nA=>(B.openBlock(),B.createElementBlock("option",{key:nA,value:nA},null,8,L$))),128))])]),de[17]||(de[17]=B.createElementVNode("div",{class:"vs-separator"},[B.createElementVNode("span",null,"vs")],-1)),B.createElementVNode("div",U$,[B.createElementVNode("label",G$,[de[16]||(de[16]=B.createElementVNode("span",{class:"gene-number"},"Gene 2",-1)),m.value?(B.openBlock(),B.createElementBlock("span",{key:0,class:"selected-gene",style:B.normalizeStyle({color:_.value})},B.toDisplayString(m.value),5)):B.createCommentVNode("",!0)]),B.withDirectives(B.createElementVNode("input",{id:"gene2-select","onUpdate:modelValue":de[3]||(de[3]=nA=>w.value=nA),type:"text",placeholder:"Gene name (e.g., TAC1)",onInput:de[4]||(de[4]=nA=>le(2)),disabled:u.value,list:"gene2-list",autocomplete:"off",class:"gene-input"},null,40,O$),[[B.vModelText,w.value]]),B.createElementVNode("datalist",P$,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(x.value,nA=>(B.openBlock(),B.createElementBlock("option",{key:nA,value:nA},null,8,q$))),128))])])]),B.createElementVNode("button",{onClick:ie,disabled:!Y.value||u.value,class:"visualize-btn"},[u.value?(B.openBlock(),B.createElementBlock("span",J$,[...de[18]||(de[18]=[B.createElementVNode("span",{class:"btn-spinner"},null,-1),B.createTextVNode("Loading...",-1)])])):(B.openBlock(),B.createElementBlock("span",Y$,[(B.openBlock(),B.createElementBlock("svg",K$,[...de[19]||(de[19]=[B.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),B.createElementVNode("path",{d:"m21 21-4.35-4.35"},null,-1)])])),de[20]||(de[20]=B.createTextVNode(" Visualize Co-expression ",-1))]))],8,H$)])]),u.value&&!o.value?(B.openBlock(),B.createElementBlock("div",V$,[de[21]||(de[21]=B.createElementVNode("div",{class:"spinner"},null,-1)),B.createElementVNode("p",null,B.toDisplayString(E.value),1)])):B.createCommentVNode("",!0),C.value?(B.openBlock(),B.createElementBlock("div",W$,[de[22]||(de[22]=B.createElementVNode("strong",null,"⚠️ Error:",-1)),B.createTextVNode(" "+B.toDisplayString(C.value)+" ",1),B.createElementVNode("button",{onClick:de[5]||(de[5]=nA=>C.value=null),class:"dismiss-btn"},"Dismiss")])):B.createCommentVNode("",!0),R.value?(B.openBlock(),B.createElementBlock("div",z$,[B.createElementVNode("div",X$,[de[23]||(de[23]=B.createElementVNode("span",{class:"stat-label"},"Total cells:",-1)),B.createElementVNode("span",j$,B.toDisplayString(O.value.totalCells.toLocaleString()),1)]),B.createElementVNode("div",$$,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:k.value})},B.toDisplayString(p.value)+" expressing:",5),B.createElementVNode("span",Z$,B.toDisplayString(O.value.gene1Expressing.toLocaleString())+" ("+B.toDisplayString(O.value.gene1Pct)+"%)",1)]),B.createElementVNode("div",eZ,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:_.value})},B.toDisplayString(m.value)+" expressing:",5),B.createElementVNode("span",AZ,B.toDisplayString(O.value.gene2Expressing.toLocaleString())+" ("+B.toDisplayString(O.value.gene2Pct)+"%)",1)]),B.createElementVNode("div",tZ,[B.createElementVNode("span",{class:"stat-label",style:B.normalizeStyle({color:b.value})},"Co-expressing:",4),B.createElementVNode("span",iZ,B.toDisplayString(O.value.coexpressing.toLocaleString())+" ("+B.toDisplayString(O.value.coexpressPct)+"%)",1)])])):B.createCommentVNode("",!0)]),B.createElementVNode("div",nZ,[W.value||u.value&&o.value?(B.openBlock(),B.createElementBlock("div",rZ,[u.value&&o.value?(B.openBlock(),B.createElementBlock("div",sZ,[de[24]||(de[24]=B.createElementVNode("div",{class:"small-spinner"},null,-1)),B.createElementVNode("p",null,B.toDisplayString(E.value),1)])):(B.openBlock(),B.createElementBlock("div",oZ,[B.createElementVNode("canvas",{ref_key:"chartCanvas",ref:n},null,512),W.value||u.value&&o.value?(B.openBlock(),B.createElementBlock("button",{key:0,class:"floating-mixer-toggle",onClick:de[6]||(de[6]=nA=>Q.value=!Q.value),title:Q.value?"Hide Color Mixing Guide":"Open Color Mixing Guide","aria-expanded":Q.value.toString()},[Q.value?(B.openBlock(),B.createElementBlock("svg",cZ,[...de[26]||(de[26]=[B.createElementVNode("path",{d:"M6 9l6 6 6-6"},null,-1)])])):(B.openBlock(),B.createElementBlock("svg",gZ,[...de[25]||(de[25]=[B.createElementVNode("path",{d:"M18 15l-6-6-6 6"},null,-1)])]))],8,aZ)):B.createCommentVNode("",!0),Q.value&&(W.value||u.value&&o.value)?(B.openBlock(),B.createElementBlock("div",lZ,[de[30]||(de[30]=B.createElementVNode("div",{class:"floating-mixer-header"},[B.createElementVNode("span",null,"Color Mixing Guide")],-1)),B.createElementVNode("div",IZ,[B.createElementVNode("div",null,[B.createElementVNode("canvas",{ref_key:"gradientCanvas",ref:r,class:"gradient-canvas",width:"150",height:"150",onClick:eA},null,512),B.createElementVNode("div",hZ,[B.createElementVNode("div",uZ,B.toDisplayString(m.value||"Gene 2")+" Expression ",1),B.createElementVNode("div",BZ,B.toDisplayString(p.value||"Gene 1")+" Expression ",1),de[27]||(de[27]=B.createElementVNode("div",{class:"axis-arrow x-arrow-right"},"→",-1)),de[28]||(de[28]=B.createElementVNode("div",{class:"axis-arrow y-arrow-top"},"↑",-1))])]),B.createElementVNode("div",CZ,[de[29]||(de[29]=B.createElementVNode("label",{for:"boost-slider",class:"boost-label"},"Boost",-1)),B.withDirectives(B.createElementVNode("input",{id:"boost-slider",type:"range","onUpdate:modelValue":de[7]||(de[7]=nA=>T.value=nA),min:"0.1",max:"100",step:"0.1",onInput:YA,class:"boost-slider-vertical",orient:"vertical"},null,544),[[B.vModelText,T.value,void 0,{number:!0}]])])])])):B.createCommentVNode("",!0),a.value?(B.openBlock(),B.createElementBlock("div",{key:2,class:"tooltip",style:B.normalizeStyle({left:c.value.x+"px",top:c.value.y+"px"})},[B.createElementVNode("div",fZ,"ID: "+B.toDisplayString(a.value.cell_id),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(dA(a.value),(nA,PA)=>(B.openBlock(),B.createElementBlock("div",{key:PA,class:"tooltip-row"},[B.createElementVNode("span",{class:"tooltip-label",style:B.normalizeStyle(XA(PA))},B.toDisplayString(OA(PA))+":",5),B.createElementVNode("span",EZ,B.toDisplayString(TA(PA,nA)),1)]))),128))],4)):B.createCommentVNode("",!0)]))])):B.createCommentVNode("",!0),R.value?(B.openBlock(),B.createElementBlock("div",dZ,[B.createElementVNode("div",QZ,[B.createElementVNode("div",pZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[8]||(de[8]=nA=>v.value=nA),class:"color-picker",onChange:YA,title:"Choose color for no expression"},null,544),[[B.vModelText,v.value]]),de[31]||(de[31]=B.createElementVNode("span",null,"None",-1))]),B.createElementVNode("div",yZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[9]||(de[9]=nA=>k.value=nA),class:"color-picker",onChange:YA,title:`Choose color for ${p.value} only`},null,40,mZ),[[B.vModelText,k.value]]),B.createElementVNode("span",null,B.toDisplayString(p.value)+" only",1)]),B.createElementVNode("div",wZ,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[10]||(de[10]=nA=>_.value=nA),class:"color-picker",onChange:YA,title:`Choose color for ${m.value} only`},null,40,DZ),[[B.vModelText,_.value]]),B.createElementVNode("span",null,B.toDisplayString(m.value)+" only",1)]),B.createElementVNode("div",_Z,[B.withDirectives(B.createElementVNode("input",{type:"color","onUpdate:modelValue":de[11]||(de[11]=nA=>b.value=nA),class:"color-picker",onChange:YA,title:"Choose color for co-expression"},null,544),[[B.vModelText,b.value]]),de[32]||(de[32]=B.createElementVNode("span",null,"Both",-1))])])])):B.createCommentVNode("",!0),!W.value&&!u.value&&!C.value?(B.openBlock(),B.createElementBlock("div",SZ,[...de[33]||(de[33]=[B.createElementVNode("div",{class:"empty-icon"},"🔬",-1),B.createElementVNode("h3",null,"Ready to visualize gene co-expression",-1),B.createElementVNode("p",null,"Select two genes and a dimension reduction method to get started",-1)])])):B.createCommentVNode("",!0)])]))}},[["__scopeId","data-v-4a0fb898"]]),bZ={class:"gene-coexpression-wrap"},xZ="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",RZ=_s(B.defineComponent({inheritAttrs:!1,__name:"GeneExpressionViewer",props:{dataPath:{},initialGene1:{},initialGene2:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>{var r;return e.dataPath??(A?(r=B.unref(A.services))==null?void 0:r.s3Url:null)??xZ});return B.onMounted(()=>{e.initialGene1&&i.selectedGene1===null&&i.setSelectedGene1(e.initialGene1),e.initialGene2&&i.selectedGene2===null&&i.setSelectedGene2(e.initialGene2)}),(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",bZ,[B.createVNode(vZ,{gene1:B.unref(i).selectedGene1??void 0,gene2:B.unref(i).selectedGene2??void 0,"onUpdate:Vars":B.unref(i).setSelection,"data-path":n.value},null,8,["gene1","gene2","onUpdate:Vars","data-path"])])],64))}}),[["__scopeId","data-v-86d0f81d"]]),FZ={class:"umap-comparison-dashboard"},NZ={key:0,class:"loading-container"},kZ={key:1,class:"error-container"},MZ={key:2,class:"dashboard"},TZ={class:"both-pannels"},LZ={class:"panel"},UZ={class:"controls"},GZ={class:"label"},OZ=["value"],PZ={class:"canvas-container"},qZ={class:"legend-header"},HZ=["title"],JZ={key:0},YZ={key:1},KZ={class:"legend-items"},VZ=["onClick"],WZ={key:0,class:"legend-x"},zZ=["href"],XZ={key:1,class:"legend-label"},jZ={class:"tooltip-header"},$Z={class:"tooltip-value"},ZZ={class:"panel"},eee={class:"controls"},Aee={class:"label"},tee={class:"gene-input-wrapper"},iee={id:"gene-suggestions"},nee=["value"],ree=["disabled"],see={class:"canvas-container"},oee={key:0,class:"loading-overlay"},aee={key:0,class:"legend"},gee=_s({__name:"SideBySide",props:{dataPath:{type:String,default:"/data"},metadataColumn:{type:String,default:null},gene:{type:String,default:null}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=e,n=B.ref(null),r=B.ref(null),s=B.ref(null),o=B.ref(null),g=B.ref(null),a=B.ref(Br),c=B.ref(null),l=B.ref(null),I=B.ref([]),h=B.ref([]),u=B.ref(null),E=B.ref(!0),C=B.ref({x:0,y:0}),f=B.ref(!1),y=B.ref(!1),Q=B.ref(!0),d=B.ref(null),w=B.ref([]),p=B.ref([]),m=B.ref(A.metadataColumn||""),D=B.ref([]),x=B.ref(new Set),N=B.ref(""),F=B.ref(A.gene||""),M=B.ref([]),k=B.ref(!1);let _=null;B.watch(()=>A.metadataColumn,ye=>{ye&&ye!==m.value&&(m.value=ye,w.value.length>0&&U())}),B.watch(()=>A.gene,ye=>{ye&&ye!==F.value&&(F.value=ye,N.value=ye,w.value.length>0&&it())}),B.watch(m,ye=>{ye&&i("update:Vars","selectedMetadataColumn",ye)}),B.watch(F,ye=>{ye&&i("update:Vars","selectedGene",ye)});function b(ye){const We=parseInt(ye.slice(1,3),16)/255,ze=parseInt(ye.slice(3,5),16)/255,cA=parseInt(ye.slice(5,7),16)/255;return[We,ze,cA]}function v(){if(Z.length>0&&(Z.forEach(ye=>{try{ye.destroy()}catch(We){console.warn("Error destroying texture:",We)}}),Z=[]),n.value&&ae.length>0&&(ae.forEach(({event:ye,handler:We})=>{n.value.removeEventListener(ye,We)}),ae=[]),o.value){try{o.value.destroy()}catch(ye){console.warn("Error destroying regl:",ye)}o.value=null,ne=null}}function T(){if(r.value&&eA.length>0&&(eA.forEach(({event:ye,handler:We})=>{r.value.removeEventListener(ye,We)}),eA=[]),g.value){try{g.value.destroy()}catch(ye){console.warn("Error destroying right regl:",ye)}g.value=null,ke=null}}let O=!1,Y=null,R=null,W=null,ne=null,le=[],Z=[],ae=[],ie=!1,Ee=null,me=null,He=null,ke=null,eA=[];const dA=B.computed(()=>{if(!u.value)return null;let ye=I.value.find(We=>We.cell_id===u.value);return!ye&&h.value.length>0&&(ye=h.value.find(We=>We.cell_id===u.value)),ye});B.onMounted(async()=>{try{s.value=new Ef(A.dataPath),await s.value.initialize();const ye=await s.value.getReductionData("umap");if(w.value=ye,ye.length>0){const We=ye[0],ze=Object.keys(We).filter(cA=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(cA));p.value=ze,ze.length>0&&(A.metadataColumn&&ze.includes(A.metadataColumn)?m.value=A.metadataColumn:m.value||(m.value=ze.includes("Atlas_annotation")?"Atlas_annotation":ze[0]))}Q.value=!1,await B.nextTick(),XA(),m.value&&U(),A.gene&&(F.value=A.gene,N.value=A.gene,await it())}catch(ye){console.error("Failed to initialize:",ye),d.value=`Failed to load data: ${ye.message}`,Q.value=!1}}),B.onBeforeUnmount(()=>{c.value&&c.value.disconnect(),l.value&&l.value.disconnect(),v(),T()});function XA(){n.value&&(c.value=new ResizeObserver(()=>{!y.value&&m.value&&U()}),c.value.observe(n.value.closest(".panel"))),r.value&&(l.value=new ResizeObserver(()=>{F.value&&it()}),l.value.observe(r.value.closest(".panel")))}function OA(){clearTimeout(_),_=setTimeout(async()=>{if(N.value.length<1){M.value=[];return}try{const ye=await s.value.searchGenes(N.value);M.value=ye.map(We=>We.gene_name).slice(0,20)}catch(ye){console.error("Gene search failed:",ye)}},300)}async function TA(){N.value.trim()&&(F.value=N.value,await it())}function YA(ye,We,ze){const cA=new Map;ye.forEach(nt=>{const et=nt[We];et!=null&&(cA.has(et)||cA.set(et,[]),cA.get(et).push(nt))});const qA=[];cA.forEach((nt,et)=>{if(nt.length===0)return;const Wt=nt.reduce((xt,Yt)=>xt+Yt.x,0)/nt.length,$t=nt.reduce((xt,Yt)=>xt+Yt.y,0)/nt.length;qA.push({text:String(et),x:Wt,y:$t,color:ze(et),count:nt.length})});const $A=.3;for(let nt=0;nt<qA.length;nt++)for(let et=nt+1;et<qA.length;et++){const Wt=qA[nt].x-qA[et].x,$t=qA[nt].y-qA[et].y,xt=Math.sqrt(Wt*Wt+$t*$t);if(xt<$A&&xt>0){const Yt=($A-xt)/2,Ri=Math.atan2($t,Wt);qA[nt].x+=Math.cos(Ri)*Yt,qA[nt].y+=Math.sin(Ri)*Yt,qA[et].x-=Math.cos(Ri)*Yt,qA[et].y-=Math.sin(Ri)*Yt}}return qA}function Ve(ye,We){We.value=new Set(ye)}function de(ye){const We=x;We.value.has(ye)?We.value.delete(ye):We.value.add(ye),PA(),ke&&F.value&&At()}function nA(){y.value=!0,f.value=!f.value,setTimeout(()=>{y.value=!1},350)}function PA(){if(!ne||!R||!W||!n.value)return;const We=[],ze=[];I.value.forEach(cA=>{const qA=String(cA[m.value]);if(We.push(R(cA.x),W(cA.y)),x.value.has(qA)){const $A=$r(cA.color).rgb();ze.push($A.r/255,$A.g/255,$A.b/255,.8)}else ze.push(.85,.85,.85,.3)}),Y=ne({frag:`
|
|
184
184
|
precision mediump float;
|
|
185
185
|
varying vec4 vColor;
|
|
186
186
|
void main() {
|
|
@@ -336,7 +336,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An err
|
|
|
336
336
|
gl_Position = vec4(pos, 0, 1);
|
|
337
337
|
gl_PointSize = pointSize;
|
|
338
338
|
vColor = color;
|
|
339
|
-
}`,attributes:{position:Qt,color:ti},uniforms:{pointSize:xt.prop("pointSize"),scale:xt.prop("scale"),translate:xt.prop("translate")},count:Qt.length/2,primitive:"points",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"src alpha",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"},equation:"add"}});const wt=Tp().scaleExtent([.5,10]).filter(ee=>ee.type!=="wheel").on("zoom",ee=>{ee.sourceEvent&&ee.sourceEvent.type!=="wheel"&&(a.value=ee.transform,Tt(),o.value&&m.value&&(sn(n.value).property("__zoom",ee.transform),FA()))});sn(ye).call(wt);let Vt=0;const ci=16,Ji=ee=>{ee.preventDefault();const ge=ye.getBoundingClientRect(),xe=ee.clientX-ge.left,Ne=ee.clientY-ge.top,Oe=a.value||Br,kA=xe/ye.width*2-1,vA=-(Ne/ye.height*2-1),X=2*Oe.x/ye.width,qe=-(2*Oe.y)/ye.height,Ue=(kA-X)/Oe.k,DA=(vA-qe)/Oe.k,It=-ee.deltaY*.002,tt=Math.max(.5,Math.min(10,Oe.k*Math.pow(2,It))),GA=kA-Ue*tt,Ei=vA-DA*tt,Jt=GA*ye.width/2,_i=-(Ei*ye.height)/2,ri=Br.translate(Jt,_i).scale(tt);a.value=ri,Tt(),sn(ye).property("__zoom",ri),n.value&&o.value&&m.value&&(sn(n.value).property("__zoom",ri),FA())},ji=ee=>{const ge=Date.now();if(ge-Vt<ci)return;Vt=ge;const xe=ye.getBoundingClientRect(),Ne=ee.clientX-xe.left,Oe=ee.clientY-xe.top,kA=a.value||Br,vA=Ne/ye.width*2-1,X=-(Oe/ye.height*2-1),qe=.02;let Ue=null,DA=qe,It=-1;if(h.value.forEach((tt,GA)=>{const Ei=ni(tt.x),Jt=fA(tt.y),_i=2*kA.x/ye.width,ri=-(2*kA.y)/ye.height,Jr=Ei*kA.k+_i,Dr=Jt*kA.k+ri,Es=Jr-vA,kQ=Dr-X,MQ=Math.sqrt(Es*Es+kQ*kQ);MQ<DA&&(DA=MQ,Ue=tt,It=GA)}),Ue){u.value=Ue.cell_id,E.value=!1;const tt=ni(Ue.x),GA=fA(Ue.y),Ei=2*kA.x/ye.width,Jt=-(2*kA.y)/ye.height,_i=(tt*kA.k+Ei+1)/2*ye.width,ri=(1-(GA*kA.k+Jt))/2*ye.height,Jr=ye.getBoundingClientRect()}else u.value=null;Tt(),o.value&&m.value&&FA()},J=()=>{u.value=null,Tt(),o.value&&m.value&&FA()};ye.addEventListener("wheel",Ji,{passive:!1}),ye.addEventListener("mousemove",ji),ye.addEventListener("mouseleave",J),eA=[{event:"wheel",handler:Ji},{event:"mousemove",handler:ji},{event:"mouseleave",handler:J}],Tt()}catch($A){console.error("Failed to render gene UMAP:",$A),k.value=!1}}function Ti(ye){const We={},ze=new Set(["cell_id","umap_1","umap_2","tsne_1","tsne_2","x","y","color","opacity","expr","norm"]);return Object.keys(ye).forEach(cA=>{!ze.has(cA)&&ye[cA]!==null&&ye[cA]!==void 0&&(We[cA]=ye[cA])}),We}function jA(ye){return{}}function gi(ye){return ye.split("_").map(We=>We.charAt(0).toUpperCase()+We.slice(1)).join(" ")}B.ref("#ff0000"),B.ref("#0000ff");function Li(ye,We){return typeof We=="number"?ye===F.value||ye===m.value?We.toFixed(3):We<.01&&We>0?We.toExponential(2):Math.abs(We)>1e3?We.toLocaleString():We.toFixed(2):We}return(ye,We)=>(B.openBlock(),B.createElementBlock("div",FZ,[Q.value?(B.openBlock(),B.createElementBlock("div",NZ,[...We[2]||(We[2]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading UMAP data...",-1)])])):d.value?(B.openBlock(),B.createElementBlock("div",kZ,[We[3]||(We[3]=B.createElementVNode("strong",null,"⚠️ Error:",-1)),B.createTextVNode(" "+B.toDisplayString(d.value),1)])):(B.openBlock(),B.createElementBlock("div",MZ,[We[11]||(We[11]=B.createElementVNode("div",{class:"filter-placeholder"},null,-1)),B.createElementVNode("div",TZ,[B.createElementVNode("div",LZ,[We[6]||(We[6]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Cell Metadata")],-1)),B.createElementVNode("div",UZ,[B.createElementVNode("label",GZ,[We[4]||(We[4]=B.createTextVNode(" Select metadata: ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":We[0]||(We[0]=ze=>m.value=ze),onChange:U,class:"select"},[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(p.value,ze=>(B.openBlock(),B.createElementBlock("option",{key:ze,value:ze},B.toDisplayString(ze),9,OZ))),128))],544),[[B.vModelSelect,m.value]])])]),B.createElementVNode("div",PZ,[B.createElementVNode("canvas",{ref_key:"leftCanvas",ref:n},null,512)]),D.value.length>0?(B.openBlock(),B.createElementBlock("div",{key:0,class:B.normalizeClass(["legend",{"legend-expanded":f.value}])},[B.createElementVNode("div",qZ,[We[5]||(We[5]=B.createElementVNode("div",{class:"legend-title"},"Legend",-1)),B.createElementVNode("button",{class:"legend-toggle",onClick:B.withModifiers(nA,["stop"]),title:f.value?"Collapse":"Expand"},[f.value?(B.openBlock(),B.createElementBlock("span",JZ,"▼")):(B.openBlock(),B.createElementBlock("span",YZ,"▲"))],8,HZ)]),B.createElementVNode("div",KZ,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(D.value,(ze,cA)=>(B.openBlock(),B.createElementBlock("div",{key:cA,class:"legend-item"},[B.createElementVNode("div",{class:B.normalizeClass(["legend-color",{"legend-color-hidden":!x.value.has(ze.label)}]),style:B.normalizeStyle({background:ze.color,borderColor:ze.color}),onClick:qA=>de(ze.label)},[x.value.has(ze.label)?B.createCommentVNode("",!0):(B.openBlock(),B.createElementBlock("span",WZ,"✕"))],14,VZ),m.value.toLowerCase()==="atlas_annotation"?(B.openBlock(),B.createElementBlock("a",{key:0,class:"legend-label legend-link",href:`https://nervosensus.netlify.app/?view=cards&atlasannotation=${ze.label}`,target:"_blank",rel:"noopener noreferrer"},B.toDisplayString(ze.label),9,zZ)):(B.openBlock(),B.createElementBlock("span",XZ,B.toDisplayString(ze.label),1))]))),128))])],2)):B.createCommentVNode("",!0),dA.value?(B.openBlock(),B.createElementBlock("div",{key:1,class:"tooltip",style:B.normalizeStyle({left:C.value.x+"px",top:C.value.y+"px"})},[B.createElementVNode("div",jZ,B.toDisplayString(dA.value.cell_id),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(Ti(dA.value),(ze,cA)=>(B.openBlock(),B.createElementBlock("div",{key:cA,class:"tooltip-row"},[B.createElementVNode("span",{class:"tooltip-label",style:B.normalizeStyle(jA())},B.toDisplayString(gi(cA))+":",5),B.createElementVNode("span",$Z,B.toDisplayString(Li(cA,ze)),1)]))),128))],4)):B.createCommentVNode("",!0)]),B.createElementVNode("div",ZZ,[We[10]||(We[10]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Assay RNA (Gene Expression)")],-1)),B.createElementVNode("div",eee,[B.createElementVNode("label",Aee,[We[7]||(We[7]=B.createTextVNode(" Select gene: ",-1)),B.createElementVNode("div",tee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":We[1]||(We[1]=ze=>N.value=ze),type:"text",placeholder:"Gene name (e.g., CDH9)",class:"gene-input",list:"gene-suggestions",onInput:OA},null,544),[[B.vModelText,N.value]]),B.createElementVNode("datalist",iee,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(M.value,ze=>(B.openBlock(),B.createElementBlock("option",{key:ze,value:ze},null,8,nee))),128))]),B.createElementVNode("button",{onClick:TA,disabled:!N.value.trim()||k.value,class:"visualize-btn"},B.toDisplayString(k.value?"Loading...":"Visualize"),9,ree)])])]),B.createElementVNode("div",see,[k.value?(B.openBlock(),B.createElementBlock("div",oee,[...We[8]||(We[8]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Loading gene expression...",-1)])])):B.createCommentVNode("",!0),B.createElementVNode("canvas",{ref_key:"rightCanvas",ref:r},null,512)]),F.value&&!k.value?(B.openBlock(),B.createElementBlock("div",aee,[...We[9]||(We[9]=[B.createElementVNode("div",{class:"legend-title"},"Expression Level",-1),B.createElementVNode("div",{class:"gradient-bar"},[B.createElementVNode("div",{class:"gradient-fill"}),B.createElementVNode("div",{class:"gradient-labels"},[B.createElementVNode("span",null,"Low"),B.createElementVNode("span",null,"High")])],-1)])])):B.createCommentVNode("",!0)])])]))]))}},[["__scopeId","data-v-7ea6fa01"]]),cee={class:"side-by-side-wrap"},lee="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",Iee=_s(B.defineComponent({inheritAttrs:!1,__name:"SideBySide",props:{dataPath:{},initialGene:{},initialMetadataColumn:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>e.dataPath??(A?B.unref(A.s3Url):null)??lee);return B.onMounted(()=>{e.initialGene&&i.selectedGene===null&&i.setSelectedGene(e.initialGene),e.initialMetadataColumn&&i.selectedMetadataColumn===null&&i.setSelectedMetadataColumn(e.initialMetadataColumn)}),(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",cee,[B.createVNode(gee,{gene:B.unref(i).selectedGene??void 0,metadataColumn:B.unref(i).selectedMetadataColumn??void 0,"onUpdate:Vars":s[0]||(s[0]=(o,g)=>B.unref(i).setSelection(o,g)),"data-path":n.value},null,8,["gene","metadataColumn","data-path"])])],64))}}),[["__scopeId","data-v-79a2dcfe"]]),hee={class:"violin-plot-container"},uee={key:0,class:"loading-container"},Bee={key:1,class:"error-container"},Cee={key:2,class:"dashboard"},fee={class:"content-layout"},Eee={class:"controls"},dee={class:"label"},Qee=["value"],pee={class:"label gene-expression-label"},yee={class:"gene-input-wrapper"},mee={id:"gene-suggestions"},wee=["value"],Dee=["disabled"],_ee={class:"label"},See={class:"plot-type-toggle"},vee={class:"checkbox-label"},bee={class:"plot-container"},xee={key:0,class:"loading-overlay"},Ree=_s({__name:"ViolinPlot",props:{dataPath:{type:String,default:"/data"},metadataColumn:{type:String,default:null},gene:{type:String,default:null}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=e,n=B.ref(null),r=B.ref(null),s=B.ref(null),o=B.ref(!0),g=B.ref(null),a=B.ref(!1),c=B.ref([]),l=B.ref([]),I=B.ref(A.metadataColumn||""),h=B.ref("gene"),u=B.ref(A.gene||""),E=B.ref(A.gene||""),C=B.ref([]),f=B.ref("violin"),y=B.ref(!1),Q=B.ref([]);let d=null;B.watch(()=>A.metadataColumn,_=>{_&&_!==I.value&&(I.value=_,c.value.length>0&&x())}),B.watch(()=>A.gene,_=>{_&&_!==E.value&&(E.value=_,u.value=_,c.value.length>0&&N())}),B.watch(I,_=>{_&&i("update:Vars","selectedMetadataColumn",_)}),B.watch(E,_=>{_&&i("update:Vars","selectedGene",_)}),B.watch(f,()=>{Q.value.length>0&&(F(Q.value),y.value&&M(Q.value))});let w=null;const p=()=>{clearTimeout(w),w=setTimeout(()=>{Q.value.length>0&&(F(Q.value),y.value&&M(Q.value))},100)};B.onMounted(async()=>{window.addEventListener("resize",p);try{s.value=new Ef(A.dataPath),await s.value.initialize();const _=await s.value.getReductionData("umap");if(c.value=_,_.length>0){const b=_[0],v=Object.keys(b).filter(T=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(T));l.value=v,v.length>0&&(A.metadataColumn&&v.includes(A.metadataColumn)?I.value=A.metadataColumn:I.value||(I.value=v.includes("Atlas_annotation")?"Atlas_annotation":v[0]))}o.value=!1,await B.nextTick(),A.gene&&(E.value=A.gene,u.value=A.gene,h.value="gene",await N())}catch(_){console.error("Failed to initialize:",_),g.value=`Failed to load data: ${_.message}`,o.value=!1}}),B.onBeforeUnmount(()=>{d&&clearTimeout(d),w&&clearTimeout(w),window.removeEventListener("resize",p);const _=r.value;_&&_.getContext("2d").clearRect(0,0,_.width,_.height)});function m(){clearTimeout(d),d=setTimeout(async()=>{if(u.value.length<1){C.value=[];return}try{const _=await s.value.searchGenes(u.value);C.value=_.map(b=>b.gene_name).slice(0,20)}catch(_){console.error("Gene search failed:",_)}},300)}async function D(){u.value.trim()&&(E.value=u.value.trim().toUpperCase(),await N())}async function x(){E.value&&await N()}async function N(){if(!(!E.value||!I.value))try{a.value=!0;const _=await s.value.getGeneExpression(E.value);a.value=!1;const b=new Map(_.map(O=>[O.cell_id,O.expression])),v=new Map;c.value.forEach(O=>{const Y=O[I.value],R=b.get(O.cell_id)||0;v.has(Y)||v.set(Y,[]),v.get(Y).push(R)});const T=Array.from(v.entries()).map(([O,Y])=>({category:String(O),values:Y}));Q.value=T,await B.nextTick(),F(T),y.value&&M(T)}catch(_){console.error("Failed to render violin plot:",_),g.value=`Failed to load gene data: ${_.message}`,a.value=!1}}function F(_){const b=sn(n.value);if(b.selectAll("*").remove(),!_||_.length===0)return;const v=b.node();if(!v||!v.parentElement)return;const O=v.parentElement.getBoundingClientRect(),Y=O.width,R=O.height,W=Math.max(..._.map(Ve=>Ve.category.length)),ne=Math.min(W*5.5,200)+40,le={top:40,right:40,bottom:Math.max(80,ne),left:80},Z=Y-le.left-le.right,ae=R-le.top-le.bottom;b.attr("width",Y).attr("height",R).attr("viewBox",null).attr("preserveAspectRatio",null);const ie=b.append("g").attr("transform",`translate(${le.left},${le.top})`),Ee=Fp().domain(_.map(Ve=>Ve.category)).range([0,Z]).padding(.2),me=_.flatMap(Ve=>Ve.values),He=Co(me),ke=vr().domain(He).range([ae,0]).nice(),eA=Tc(dC);function dA(Ve,de){return function(nA){return de.map(PA=>[PA,yK(nA,At=>Ve(PA-At))])}}function XA(Ve){return function(de){return Math.abs(de/=Ve)<=1?.75*(1-de*de)/Ve:0}}_.forEach(Ve=>{const de=Ve.category,nA=Ve.values.filter(Nt=>Nt!=null&&!isNaN(Nt));if(nA.length===0)return;const PA=nA.slice().sort(hg),At=mK(PA),fi=ip(PA,.25),U=ip(PA,.75),Tt=tp(PA),Ai=jB(PA),FA=Ee(de)+Ee.bandwidth()/2;if(f.value==="violin"){const Nt=IK(nA),it=nA.length,Ti=1.06*Nt*Math.pow(it,-1/5),jA=ke.ticks(50),gi=dA(XA(Ti),jA)(nA),Li=jB(gi,ze=>ze[1]),ye=vr().domain([0,Li]).range([0,Ee.bandwidth()/2]);b.property("__scales__",{xScale:Ee,yScale:ke,margin:le,width:Y,height:R});const We=bz().x0(ze=>Ee(de)+Ee.bandwidth()/2-ye(ze[1])).x1(ze=>Ee(de)+Ee.bandwidth()/2+ye(ze[1])).y(ze=>ke(ze[0])).curve(Rz);ie.append("path").datum(gi).attr("d",We).attr("fill",eA(de)).attr("opacity",.7).attr("stroke",eA(de)).attr("stroke-width",1.5),ie.append("line").attr("x1",FA-5).attr("x2",FA+5).attr("y1",ke(At)).attr("y2",ke(At)).attr("stroke","white").attr("stroke-width",3),ie.append("rect").attr("x",FA-3).attr("y",ke(U)).attr("width",6).attr("height",ke(fi)-ke(U)).attr("fill","white").attr("stroke","#333").attr("stroke-width",1)}else{const Nt=Math.min(Ee.bandwidth()*.6,80),it=Nt*.5;b.property("__scales__",{xScale:Ee,yScale:ke,margin:le,width:Y,height:R}),ie.append("line").attr("x1",FA).attr("x2",FA).attr("y1",ke(Tt)).attr("y2",ke(fi)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA).attr("x2",FA).attr("y1",ke(U)).attr("y2",ke(Ai)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-it/2).attr("x2",FA+it/2).attr("y1",ke(Tt)).attr("y2",ke(Tt)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-it/2).attr("x2",FA+it/2).attr("y1",ke(Ai)).attr("y2",ke(Ai)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("rect").attr("x",FA-Nt/2).attr("y",ke(U)).attr("width",Nt).attr("height",ke(fi)-ke(U)).attr("fill",eA(de)).attr("opacity",.7).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-Nt/2).attr("x2",FA+Nt/2).attr("y1",ke(At)).attr("y2",ke(At)).attr("stroke","white").attr("stroke-width",2.5)}});const OA=ie.append("g").attr("transform",`translate(0,${ae})`).call(E2(Ee));I.value.toLowerCase()==="atlas_annotation"?OA.selectAll(".tick").each(function(){const Ve=sn(this),de=Ve.select("text"),PA=`https://nervosensus.netlify.app/?view=cards&atlasannotation=${de.text()}`;Ve.append("a").attr("href",PA).attr("target","_blank").node().appendChild(de.node()),de.attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px").style("fill","#667eea").style("cursor","pointer")}):OA.selectAll("text").attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px"),ie.append("g").call(d2(ke)).selectAll("text").style("font-size","12px"),ie.append("text").attr("x",Z/2).attr("y",ae+le.bottom-10).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(I.value);const YA=`${E.value} Expression`;ie.append("text").attr("transform","rotate(-90)").attr("x",-ae/2).attr("y",-le.left+20).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(YA),b.append("text").attr("x",Y/2).attr("y",20).attr("text-anchor","middle").style("font-size","16px").style("font-weight","700").text(`Violin Plot: ${YA} by ${I.value}`)}function M(_){if(!_||_.length===0)return;const b=r.value;if(!b)return;const T=sn(n.value).property("__scales__");if(!T){console.warn("Scales not found on SVG");return}const{xScale:O,yScale:Y,margin:R,width:W,height:ne}=T,le=window.devicePixelRatio||1;b.width=W*le,b.height=ne*le,b.style.width=`${W}px`,b.style.height=`${ne}px`;const Z=b.getContext("2d");Z.scale(le,le),Z.clearRect(0,0,W,ne),Z.save(),Z.translate(R.left,R.top);const ae=Tc(dC);_.forEach(ie=>{const Ee=ie.category,me=ie.values.filter(dA=>dA!=null&&!isNaN(dA));if(me.length===0)return;const He=O(Ee)+O.bandwidth()/2,ke=O.bandwidth()*.35,eA=ae(Ee);Z.fillStyle=eA,Z.strokeStyle="white",Z.lineWidth=.3,Z.globalAlpha=.4,me.forEach(dA=>{const XA=He+(Math.random()-.5)*ke,OA=Y(dA);Z.beginPath(),Z.arc(XA,OA,1.5,0,Math.PI*2),Z.fill(),Z.stroke()})}),Z.restore()}function k(){if(Q.value.length>0)if(y.value)M(Q.value);else{const _=r.value;_&&_.getContext("2d").clearRect(0,0,_.width,_.height)}}return(_,b)=>(B.openBlock(),B.createElementBlock("div",hee,[o.value?(B.openBlock(),B.createElementBlock("div",uee,[...b[5]||(b[5]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading data...",-1)])])):g.value?(B.openBlock(),B.createElementBlock("div",Bee,[b[6]||(b[6]=B.createElementVNode("strong",null,"� Error:",-1)),B.createTextVNode(" "+B.toDisplayString(g.value),1)])):(B.openBlock(),B.createElementBlock("div",Cee,[b[12]||(b[12]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Gene Expression Distribution")],-1)),B.createElementVNode("div",fee,[B.createElementVNode("div",Eee,[B.createElementVNode("label",dee,[b[7]||(b[7]=B.createTextVNode(" X-axis (Metadata): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":b[0]||(b[0]=v=>I.value=v),onChange:x,class:"select"},[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(l.value,v=>(B.openBlock(),B.createElementBlock("option",{key:v,value:v},B.toDisplayString(v),9,Qee))),128))],544),[[B.vModelSelect,I.value]])]),B.createElementVNode("label",pee,[b[8]||(b[8]=B.createTextVNode(" Gene Expression ",-1)),B.createElementVNode("div",yee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=v=>u.value=v),type:"text",placeholder:"Gene name (e.g., CDH9)",class:"gene-input",list:"gene-suggestions",onInput:m},null,544),[[B.vModelText,u.value]]),B.createElementVNode("datalist",mee,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(C.value,v=>(B.openBlock(),B.createElementBlock("option",{key:v,value:v},null,8,wee))),128))]),B.createElementVNode("button",{onClick:D,disabled:!u.value.trim()||a.value,class:"visualize-btn"},B.toDisplayString(a.value?"Loading...":"Visualize"),9,Dee)])]),B.createElementVNode("label",_ee,[b[9]||(b[9]=B.createTextVNode(" Plot Type: ",-1)),B.createElementVNode("div",See,[B.createElementVNode("button",{onClick:b[2]||(b[2]=v=>f.value="violin"),class:B.normalizeClass([{active:f.value==="violin"},"toggle-btn"])}," Violin ",2),B.createElementVNode("button",{onClick:b[3]||(b[3]=v=>f.value="box"),class:B.normalizeClass([{active:f.value==="box"},"toggle-btn"])}," Box ",2)])]),B.createElementVNode("label",vee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":b[4]||(b[4]=v=>y.value=v),type:"checkbox",class:"checkbox",onChange:k},null,544),[[B.vModelCheckbox,y.value]]),b[10]||(b[10]=B.createTextVNode(" Show data points ",-1))])]),B.createElementVNode("div",bee,[a.value?(B.openBlock(),B.createElementBlock("div",xee,[...b[11]||(b[11]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Loading data...",-1)])])):B.createCommentVNode("",!0),(B.openBlock(),B.createElementBlock("svg",{ref_key:"violinSvg",ref:n,class:"violin-svg"},null,512)),B.createElementVNode("canvas",{ref_key:"dataPointsCanvas",ref:r,class:"data-points-canvas"},null,512)])])]))]))}},[["__scopeId","data-v-fe87f25d"]]),Fee={class:"gene-x-expression-wrap"},Nee="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",nF=_s(B.defineComponent({inheritAttrs:!1,__name:"GeneXDistribution",props:{dataPath:{},initialGene:{},initialMetadataColumn:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>e.dataPath??(A?B.unref(A.s3Url):null)??Nee);B.onMounted(()=>{e.initialGene&&i.selectedGeneX===null&&i.setSelectedGeneX(e.initialGene),e.initialMetadataColumn&&i.selectedMetadataColumn===null&&i.setSelectedMetadataColumn(e.initialMetadataColumn)});function r(s,o){s==="selectedGene"?i.setSelection("selectedGeneX",o):i.setSelection(s,o)}return(s,o)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(s.$slots,"default",{},void 0,!0),B.createElementVNode("div",Fee,[B.createVNode(Ree,{gene:B.unref(i).selectedGeneX??void 0,metadataColumn:B.unref(i).selectedMetadataColumn??void 0,"onUpdate:Vars":r,"data-path":n.value},null,8,["gene","metadataColumn","data-path"])])],64))}}),[["__scopeId","data-v-3180d386"]]),kee=Object.freeze(Object.defineProperty({__proto__:null,DataExplorer:G1,DataExplorerCore:U1,clearDataExplorerStore:L1,createDataExplorerStore:T1},Symbol.toStringTag,{value:"Module"})),Mee=Object.freeze(Object.defineProperty({__proto__:null,UMAP:Mv,UMAPControlPanel:Rv,UMAPScatterplot:xv,clearUMAPStore:kv,createUMAPStore:Nv},Symbol.toStringTag,{value:"Module"})),Tee=Object.freeze(Object.defineProperty({__proto__:null,Markdown:H5},Symbol.toStringTag,{value:"Module"})),Lee=Object.freeze(Object.defineProperty({__proto__:null,TextViewer:Z5},Symbol.toStringTag,{value:"Module"})),Uee={class:"pp-container"},Gee={class:"pp-header"},Oee={class:"pp-controls"},Pee={class:"pp-field"},qee=["disabled"],Hee={class:"pp-field"},Jee=["disabled"],Yee=["value"],Kee=["value"],Vee=["disabled"],Wee=["value"],zee={class:"pp-field"},Xee=["disabled"],jee={key:0,class:"pp-message"},Uy=100,Gy=12,Oy="(other)",$ee=Object.freeze(Object.defineProperty({__proto__:null,ProportionPlot:co(B.defineComponent({__name:"ProportionPlot",props:{apiUrl:{},pkg:{},srcUrl:{},srcFileType:{},srcFileId:{},tableNameOverride:{}},setup(t){const e=t;let A;const i=B.inject("duckdb");if(!i)throw new Error('[@pennsieve-viz/core] DuckDB store not provided. Please provide a DuckDB store via app.provide("duckdb", store)');const n=i,r=B.ref(null),s=B.ref(null),o=B.ref(e.srcUrl||"https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/precision_human_drg_data.parquet"),g=B.computed(()=>n.formatIdFromUrl(o.value)),a=B.ref(!1),c=B.ref(""),l=B.ref([]),I=B.ref(""),h=B.ref(""),u=`proportion-plot-${Math.random().toString(36).slice(2)}`;B.watch(()=>({srcUrl:e.srcUrl,srcFileType:e.srcFileType,srcFileId:e.srcFileId,pkg:e.pkg,apiUrl:e.apiUrl}),async({srcUrl:M,srcFileType:k,srcFileId:_,pkg:b,apiUrl:v})=>{var T,O;try{if(M&&(o.value=M),await y(),o.value){const W=k??(o.value.toLowerCase().endsWith(".csv")?"csv":"parquet");await d(W,g.value);return}const Y=(T=b==null?void 0:b.content)==null?void 0:T.id,R=(O=b==null?void 0:b.content)==null?void 0:O.packageType;if(Y&&v){const W=await D(Y,v);if(!W)return;const ne=await x(Y,W,v),le=R==="CSV"?"csv":"parquet",Z=W.replace(/[^a-zA-Z0-9_.-]/g,"_");o.value=ne,await d(le,Z)}}catch(Y){console.error("[ProportionPlot] Load failed:",(Y==null?void 0:Y.message)||Y),c.value=`Load failed: ${(Y==null?void 0:Y.message)||Y}`}},{immediate:!0});const E=new Set(["VARCHAR","STRING","TEXT","BOOL","BOOLEAN","DATE","TIMESTAMP"]),C=B.computed(()=>l.value.filter(M=>E.has(M.type)||M.type.startsWith("VARCHAR"))),f=B.computed(()=>l.value.filter(M=>!E.has(M.type)));async function y(){if(r.value)return;const{connectionId:M}=await n.createConnection(`prop_${Date.now()}`);r.value=M}function Q(M){const k=String(M).replace(/[^A-Za-z0-9_]/g,"_");return(/^[A-Za-z_]/.test(k)?k:`t_${k}`).slice(0,63)}async function d(M,k){r.value||await y();const _=(k||e.srcFileId||o.value||"file").replace(/[^A-Za-z0-9]/g,"_");a.value=!0,c.value="Loading file into DuckDB…";try{const b=M??(o.value.toLowerCase().endsWith(".csv")?"csv":"parquet"),v=e.tableNameOverride||Q(`file_${_.slice(0,48)}`),T=await n.loadFile(o.value,b,v,{},r.value,_);s.value=T,await p(!0)}finally{a.value=!1}}function w(M){return'"'+String(M).replace(/"/g,'""')+'"'}async function p(M=!1){var k,_,b,v;if(!s.value||!r.value)return;const T=`PRAGMA table_info(${w(s.value)})`,O=await n.executeQuery(T,r.value);if(l.value=O.map(Y=>({name:String(Y.name),type:String(Y.type).toUpperCase()})),M||!I.value||!h.value){const Y=l.value.filter(R=>E.has(R.type)||R.type.startsWith("VARCHAR"));I.value=((k=Y[0])==null?void 0:k.name)||((_=l.value[0])==null?void 0:_.name)||"",h.value=((b=Y[1])==null?void 0:b.name)||((v=Y[0])==null?void 0:v.name)||""}c.value=`Columns: ${l.value.length}.`}async function m(){if(!(!s.value||!r.value)){if(!I.value||!h.value){c.value="Pick both X and Y";return}a.value=!0,c.value="Computing proportions…";try{const M=w(s.value),k=w(I.value),_=w(h.value),b=`
|
|
339
|
+
}`,attributes:{position:Qt,color:ti},uniforms:{pointSize:xt.prop("pointSize"),scale:xt.prop("scale"),translate:xt.prop("translate")},count:Qt.length/2,primitive:"points",depth:{enable:!1},blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"src alpha",dstRGB:"one minus src alpha",dstAlpha:"one minus src alpha"},equation:"add"}});const wt=Tp().scaleExtent([.5,10]).filter(ee=>ee.type!=="wheel").on("zoom",ee=>{ee.sourceEvent&&ee.sourceEvent.type!=="wheel"&&(a.value=ee.transform,Tt(),o.value&&m.value&&(sn(n.value).property("__zoom",ee.transform),FA()))});sn(ye).call(wt);let Vt=0;const ci=16,Ji=ee=>{ee.preventDefault();const ge=ye.getBoundingClientRect(),xe=ee.clientX-ge.left,Ne=ee.clientY-ge.top,Oe=a.value||Br,kA=xe/ye.width*2-1,vA=-(Ne/ye.height*2-1),X=2*Oe.x/ye.width,qe=-(2*Oe.y)/ye.height,Ue=(kA-X)/Oe.k,DA=(vA-qe)/Oe.k,It=-ee.deltaY*.002,tt=Math.max(.5,Math.min(10,Oe.k*Math.pow(2,It))),GA=kA-Ue*tt,Ei=vA-DA*tt,Jt=GA*ye.width/2,_i=-(Ei*ye.height)/2,ri=Br.translate(Jt,_i).scale(tt);a.value=ri,Tt(),sn(ye).property("__zoom",ri),n.value&&o.value&&m.value&&(sn(n.value).property("__zoom",ri),FA())},ji=ee=>{const ge=Date.now();if(ge-Vt<ci)return;Vt=ge;const xe=ye.getBoundingClientRect(),Ne=ee.clientX-xe.left,Oe=ee.clientY-xe.top,kA=a.value||Br,vA=Ne/ye.width*2-1,X=-(Oe/ye.height*2-1),qe=.02;let Ue=null,DA=qe,It=-1;if(h.value.forEach((tt,GA)=>{const Ei=ni(tt.x),Jt=fA(tt.y),_i=2*kA.x/ye.width,ri=-(2*kA.y)/ye.height,Jr=Ei*kA.k+_i,Dr=Jt*kA.k+ri,Es=Jr-vA,kQ=Dr-X,MQ=Math.sqrt(Es*Es+kQ*kQ);MQ<DA&&(DA=MQ,Ue=tt,It=GA)}),Ue){u.value=Ue.cell_id,E.value=!1;const tt=ni(Ue.x),GA=fA(Ue.y),Ei=2*kA.x/ye.width,Jt=-(2*kA.y)/ye.height,_i=(tt*kA.k+Ei+1)/2*ye.width,ri=(1-(GA*kA.k+Jt))/2*ye.height,Jr=ye.getBoundingClientRect()}else u.value=null;Tt(),o.value&&m.value&&FA()},J=()=>{u.value=null,Tt(),o.value&&m.value&&FA()};ye.addEventListener("wheel",Ji,{passive:!1}),ye.addEventListener("mousemove",ji),ye.addEventListener("mouseleave",J),eA=[{event:"wheel",handler:Ji},{event:"mousemove",handler:ji},{event:"mouseleave",handler:J}],Tt()}catch($A){console.error("Failed to render gene UMAP:",$A),k.value=!1}}function Ti(ye){const We={},ze=new Set(["cell_id","umap_1","umap_2","tsne_1","tsne_2","x","y","color","opacity","expr","norm"]);return Object.keys(ye).forEach(cA=>{!ze.has(cA)&&ye[cA]!==null&&ye[cA]!==void 0&&(We[cA]=ye[cA])}),We}function jA(ye){return{}}function gi(ye){return ye.split("_").map(We=>We.charAt(0).toUpperCase()+We.slice(1)).join(" ")}B.ref("#ff0000"),B.ref("#0000ff");function Li(ye,We){return typeof We=="number"?ye===F.value||ye===m.value?We.toFixed(3):We<.01&&We>0?We.toExponential(2):Math.abs(We)>1e3?We.toLocaleString():We.toFixed(2):We}return(ye,We)=>(B.openBlock(),B.createElementBlock("div",FZ,[Q.value?(B.openBlock(),B.createElementBlock("div",NZ,[...We[2]||(We[2]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading UMAP data...",-1)])])):d.value?(B.openBlock(),B.createElementBlock("div",kZ,[We[3]||(We[3]=B.createElementVNode("strong",null,"⚠️ Error:",-1)),B.createTextVNode(" "+B.toDisplayString(d.value),1)])):(B.openBlock(),B.createElementBlock("div",MZ,[We[11]||(We[11]=B.createElementVNode("div",{class:"filter-placeholder"},null,-1)),B.createElementVNode("div",TZ,[B.createElementVNode("div",LZ,[We[6]||(We[6]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Cell Metadata")],-1)),B.createElementVNode("div",UZ,[B.createElementVNode("label",GZ,[We[4]||(We[4]=B.createTextVNode(" Select metadata: ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":We[0]||(We[0]=ze=>m.value=ze),onChange:U,class:"select"},[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(p.value,ze=>(B.openBlock(),B.createElementBlock("option",{key:ze,value:ze},B.toDisplayString(ze),9,OZ))),128))],544),[[B.vModelSelect,m.value]])])]),B.createElementVNode("div",PZ,[B.createElementVNode("canvas",{ref_key:"leftCanvas",ref:n},null,512)]),D.value.length>0?(B.openBlock(),B.createElementBlock("div",{key:0,class:B.normalizeClass(["legend",{"legend-expanded":f.value}])},[B.createElementVNode("div",qZ,[We[5]||(We[5]=B.createElementVNode("div",{class:"legend-title"},"Legend",-1)),B.createElementVNode("button",{class:"legend-toggle",onClick:B.withModifiers(nA,["stop"]),title:f.value?"Collapse":"Expand"},[f.value?(B.openBlock(),B.createElementBlock("span",JZ,"▼")):(B.openBlock(),B.createElementBlock("span",YZ,"▲"))],8,HZ)]),B.createElementVNode("div",KZ,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(D.value,(ze,cA)=>(B.openBlock(),B.createElementBlock("div",{key:cA,class:"legend-item"},[B.createElementVNode("div",{class:B.normalizeClass(["legend-color",{"legend-color-hidden":!x.value.has(ze.label)}]),style:B.normalizeStyle({background:ze.color,borderColor:ze.color}),onClick:qA=>de(ze.label)},[x.value.has(ze.label)?B.createCommentVNode("",!0):(B.openBlock(),B.createElementBlock("span",WZ,"✕"))],14,VZ),m.value.toLowerCase()==="atlas_annotation"?(B.openBlock(),B.createElementBlock("a",{key:0,class:"legend-label legend-link",href:`https://nervosensus.netlify.app/?view=cards&atlasannotation=${ze.label}`,target:"_blank",rel:"noopener noreferrer"},B.toDisplayString(ze.label),9,zZ)):(B.openBlock(),B.createElementBlock("span",XZ,B.toDisplayString(ze.label),1))]))),128))])],2)):B.createCommentVNode("",!0),dA.value?(B.openBlock(),B.createElementBlock("div",{key:1,class:"tooltip",style:B.normalizeStyle({left:C.value.x+"px",top:C.value.y+"px"})},[B.createElementVNode("div",jZ,B.toDisplayString(dA.value.cell_id),1),(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(Ti(dA.value),(ze,cA)=>(B.openBlock(),B.createElementBlock("div",{key:cA,class:"tooltip-row"},[B.createElementVNode("span",{class:"tooltip-label",style:B.normalizeStyle(jA())},B.toDisplayString(gi(cA))+":",5),B.createElementVNode("span",$Z,B.toDisplayString(Li(cA,ze)),1)]))),128))],4)):B.createCommentVNode("",!0)]),B.createElementVNode("div",ZZ,[We[10]||(We[10]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Assay RNA (Gene Expression)")],-1)),B.createElementVNode("div",eee,[B.createElementVNode("label",Aee,[We[7]||(We[7]=B.createTextVNode(" Select gene: ",-1)),B.createElementVNode("div",tee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":We[1]||(We[1]=ze=>N.value=ze),type:"text",placeholder:"Gene name (e.g., CDH9)",class:"gene-input",list:"gene-suggestions",onInput:OA},null,544),[[B.vModelText,N.value]]),B.createElementVNode("datalist",iee,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(M.value,ze=>(B.openBlock(),B.createElementBlock("option",{key:ze,value:ze},null,8,nee))),128))]),B.createElementVNode("button",{onClick:TA,disabled:!N.value.trim()||k.value,class:"visualize-btn"},B.toDisplayString(k.value?"Loading...":"Visualize"),9,ree)])])]),B.createElementVNode("div",see,[k.value?(B.openBlock(),B.createElementBlock("div",oee,[...We[8]||(We[8]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Loading gene expression...",-1)])])):B.createCommentVNode("",!0),B.createElementVNode("canvas",{ref_key:"rightCanvas",ref:r},null,512)]),F.value&&!k.value?(B.openBlock(),B.createElementBlock("div",aee,[...We[9]||(We[9]=[B.createElementVNode("div",{class:"legend-title"},"Expression Level",-1),B.createElementVNode("div",{class:"gradient-bar"},[B.createElementVNode("div",{class:"gradient-fill"}),B.createElementVNode("div",{class:"gradient-labels"},[B.createElementVNode("span",null,"Low"),B.createElementVNode("span",null,"High")])],-1)])])):B.createCommentVNode("",!0)])])]))]))}},[["__scopeId","data-v-7ea6fa01"]]),cee={class:"side-by-side-wrap"},lee="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",Iee=_s(B.defineComponent({inheritAttrs:!1,__name:"SideBySide",props:{dataPath:{},initialGene:{},initialMetadataColumn:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>{var r;return e.dataPath??(A?(r=B.unref(A.services))==null?void 0:r.s3Url:null)??lee});return B.onMounted(()=>{e.initialGene&&i.selectedGene===null&&i.setSelectedGene(e.initialGene),e.initialMetadataColumn&&i.selectedMetadataColumn===null&&i.setSelectedMetadataColumn(e.initialMetadataColumn)}),(r,s)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(r.$slots,"default",{},void 0,!0),B.createElementVNode("div",cee,[B.createVNode(gee,{gene:B.unref(i).selectedGene??void 0,metadataColumn:B.unref(i).selectedMetadataColumn??void 0,"onUpdate:Vars":s[0]||(s[0]=(o,g)=>B.unref(i).setSelection(o,g)),"data-path":n.value},null,8,["gene","metadataColumn","data-path"])])],64))}}),[["__scopeId","data-v-4fa6ccbe"]]),hee={class:"violin-plot-container"},uee={key:0,class:"loading-container"},Bee={key:1,class:"error-container"},Cee={key:2,class:"dashboard"},fee={class:"content-layout"},Eee={class:"controls"},dee={class:"label"},Qee=["value"],pee={class:"label gene-expression-label"},yee={class:"gene-input-wrapper"},mee={id:"gene-suggestions"},wee=["value"],Dee=["disabled"],_ee={class:"label"},See={class:"plot-type-toggle"},vee={class:"checkbox-label"},bee={class:"plot-container"},xee={key:0,class:"loading-overlay"},Ree=_s({__name:"ViolinPlot",props:{dataPath:{type:String,default:"/data"},metadataColumn:{type:String,default:null},gene:{type:String,default:null}},emits:["update:Vars"],setup(t,{emit:e}){const A=t,i=e,n=B.ref(null),r=B.ref(null),s=B.ref(null),o=B.ref(!0),g=B.ref(null),a=B.ref(!1),c=B.ref([]),l=B.ref([]),I=B.ref(A.metadataColumn||""),h=B.ref("gene"),u=B.ref(A.gene||""),E=B.ref(A.gene||""),C=B.ref([]),f=B.ref("violin"),y=B.ref(!1),Q=B.ref([]);let d=null;B.watch(()=>A.metadataColumn,_=>{_&&_!==I.value&&(I.value=_,c.value.length>0&&x())}),B.watch(()=>A.gene,_=>{_&&_!==E.value&&(E.value=_,u.value=_,c.value.length>0&&N())}),B.watch(I,_=>{_&&i("update:Vars","selectedMetadataColumn",_)}),B.watch(E,_=>{_&&i("update:Vars","selectedGene",_)}),B.watch(f,()=>{Q.value.length>0&&(F(Q.value),y.value&&M(Q.value))});let w=null;const p=()=>{clearTimeout(w),w=setTimeout(()=>{Q.value.length>0&&(F(Q.value),y.value&&M(Q.value))},100)};B.onMounted(async()=>{window.addEventListener("resize",p);try{s.value=new Ef(A.dataPath),await s.value.initialize();const _=await s.value.getReductionData("umap");if(c.value=_,_.length>0){const b=_[0],v=Object.keys(b).filter(T=>!["cell_id","umap_1","umap_2","tsne_1","tsne_2"].includes(T));l.value=v,v.length>0&&(A.metadataColumn&&v.includes(A.metadataColumn)?I.value=A.metadataColumn:I.value||(I.value=v.includes("Atlas_annotation")?"Atlas_annotation":v[0]))}o.value=!1,await B.nextTick(),A.gene&&(E.value=A.gene,u.value=A.gene,h.value="gene",await N())}catch(_){console.error("Failed to initialize:",_),g.value=`Failed to load data: ${_.message}`,o.value=!1}}),B.onBeforeUnmount(()=>{d&&clearTimeout(d),w&&clearTimeout(w),window.removeEventListener("resize",p);const _=r.value;_&&_.getContext("2d").clearRect(0,0,_.width,_.height)});function m(){clearTimeout(d),d=setTimeout(async()=>{if(u.value.length<1){C.value=[];return}try{const _=await s.value.searchGenes(u.value);C.value=_.map(b=>b.gene_name).slice(0,20)}catch(_){console.error("Gene search failed:",_)}},300)}async function D(){u.value.trim()&&(E.value=u.value.trim().toUpperCase(),await N())}async function x(){E.value&&await N()}async function N(){if(!(!E.value||!I.value))try{a.value=!0;const _=await s.value.getGeneExpression(E.value);a.value=!1;const b=new Map(_.map(O=>[O.cell_id,O.expression])),v=new Map;c.value.forEach(O=>{const Y=O[I.value],R=b.get(O.cell_id)||0;v.has(Y)||v.set(Y,[]),v.get(Y).push(R)});const T=Array.from(v.entries()).map(([O,Y])=>({category:String(O),values:Y}));Q.value=T,await B.nextTick(),F(T),y.value&&M(T)}catch(_){console.error("Failed to render violin plot:",_),g.value=`Failed to load gene data: ${_.message}`,a.value=!1}}function F(_){const b=sn(n.value);if(b.selectAll("*").remove(),!_||_.length===0)return;const v=b.node();if(!v||!v.parentElement)return;const O=v.parentElement.getBoundingClientRect(),Y=O.width,R=O.height,W=Math.max(..._.map(Ve=>Ve.category.length)),ne=Math.min(W*5.5,200)+40,le={top:40,right:40,bottom:Math.max(80,ne),left:80},Z=Y-le.left-le.right,ae=R-le.top-le.bottom;b.attr("width",Y).attr("height",R).attr("viewBox",null).attr("preserveAspectRatio",null);const ie=b.append("g").attr("transform",`translate(${le.left},${le.top})`),Ee=Fp().domain(_.map(Ve=>Ve.category)).range([0,Z]).padding(.2),me=_.flatMap(Ve=>Ve.values),He=Co(me),ke=vr().domain(He).range([ae,0]).nice(),eA=Tc(dC);function dA(Ve,de){return function(nA){return de.map(PA=>[PA,yK(nA,At=>Ve(PA-At))])}}function XA(Ve){return function(de){return Math.abs(de/=Ve)<=1?.75*(1-de*de)/Ve:0}}_.forEach(Ve=>{const de=Ve.category,nA=Ve.values.filter(Nt=>Nt!=null&&!isNaN(Nt));if(nA.length===0)return;const PA=nA.slice().sort(hg),At=mK(PA),fi=ip(PA,.25),U=ip(PA,.75),Tt=tp(PA),Ai=jB(PA),FA=Ee(de)+Ee.bandwidth()/2;if(f.value==="violin"){const Nt=IK(nA),it=nA.length,Ti=1.06*Nt*Math.pow(it,-1/5),jA=ke.ticks(50),gi=dA(XA(Ti),jA)(nA),Li=jB(gi,ze=>ze[1]),ye=vr().domain([0,Li]).range([0,Ee.bandwidth()/2]);b.property("__scales__",{xScale:Ee,yScale:ke,margin:le,width:Y,height:R});const We=bz().x0(ze=>Ee(de)+Ee.bandwidth()/2-ye(ze[1])).x1(ze=>Ee(de)+Ee.bandwidth()/2+ye(ze[1])).y(ze=>ke(ze[0])).curve(Rz);ie.append("path").datum(gi).attr("d",We).attr("fill",eA(de)).attr("opacity",.7).attr("stroke",eA(de)).attr("stroke-width",1.5),ie.append("line").attr("x1",FA-5).attr("x2",FA+5).attr("y1",ke(At)).attr("y2",ke(At)).attr("stroke","white").attr("stroke-width",3),ie.append("rect").attr("x",FA-3).attr("y",ke(U)).attr("width",6).attr("height",ke(fi)-ke(U)).attr("fill","white").attr("stroke","#333").attr("stroke-width",1)}else{const Nt=Math.min(Ee.bandwidth()*.6,80),it=Nt*.5;b.property("__scales__",{xScale:Ee,yScale:ke,margin:le,width:Y,height:R}),ie.append("line").attr("x1",FA).attr("x2",FA).attr("y1",ke(Tt)).attr("y2",ke(fi)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA).attr("x2",FA).attr("y1",ke(U)).attr("y2",ke(Ai)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-it/2).attr("x2",FA+it/2).attr("y1",ke(Tt)).attr("y2",ke(Tt)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-it/2).attr("x2",FA+it/2).attr("y1",ke(Ai)).attr("y2",ke(Ai)).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("rect").attr("x",FA-Nt/2).attr("y",ke(U)).attr("width",Nt).attr("height",ke(fi)-ke(U)).attr("fill",eA(de)).attr("opacity",.7).attr("stroke",eA(de)).attr("stroke-width",2),ie.append("line").attr("x1",FA-Nt/2).attr("x2",FA+Nt/2).attr("y1",ke(At)).attr("y2",ke(At)).attr("stroke","white").attr("stroke-width",2.5)}});const OA=ie.append("g").attr("transform",`translate(0,${ae})`).call(E2(Ee));I.value.toLowerCase()==="atlas_annotation"?OA.selectAll(".tick").each(function(){const Ve=sn(this),de=Ve.select("text"),PA=`https://nervosensus.netlify.app/?view=cards&atlasannotation=${de.text()}`;Ve.append("a").attr("href",PA).attr("target","_blank").node().appendChild(de.node()),de.attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px").style("fill","#667eea").style("cursor","pointer")}):OA.selectAll("text").attr("transform","rotate(-45)").style("text-anchor","end").style("font-size","12px"),ie.append("g").call(d2(ke)).selectAll("text").style("font-size","12px"),ie.append("text").attr("x",Z/2).attr("y",ae+le.bottom-10).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(I.value);const YA=`${E.value} Expression`;ie.append("text").attr("transform","rotate(-90)").attr("x",-ae/2).attr("y",-le.left+20).attr("text-anchor","middle").style("font-size","14px").style("font-weight","600").text(YA),b.append("text").attr("x",Y/2).attr("y",20).attr("text-anchor","middle").style("font-size","16px").style("font-weight","700").text(`Violin Plot: ${YA} by ${I.value}`)}function M(_){if(!_||_.length===0)return;const b=r.value;if(!b)return;const T=sn(n.value).property("__scales__");if(!T){console.warn("Scales not found on SVG");return}const{xScale:O,yScale:Y,margin:R,width:W,height:ne}=T,le=window.devicePixelRatio||1;b.width=W*le,b.height=ne*le,b.style.width=`${W}px`,b.style.height=`${ne}px`;const Z=b.getContext("2d");Z.scale(le,le),Z.clearRect(0,0,W,ne),Z.save(),Z.translate(R.left,R.top);const ae=Tc(dC);_.forEach(ie=>{const Ee=ie.category,me=ie.values.filter(dA=>dA!=null&&!isNaN(dA));if(me.length===0)return;const He=O(Ee)+O.bandwidth()/2,ke=O.bandwidth()*.35,eA=ae(Ee);Z.fillStyle=eA,Z.strokeStyle="white",Z.lineWidth=.3,Z.globalAlpha=.4,me.forEach(dA=>{const XA=He+(Math.random()-.5)*ke,OA=Y(dA);Z.beginPath(),Z.arc(XA,OA,1.5,0,Math.PI*2),Z.fill(),Z.stroke()})}),Z.restore()}function k(){if(Q.value.length>0)if(y.value)M(Q.value);else{const _=r.value;_&&_.getContext("2d").clearRect(0,0,_.width,_.height)}}return(_,b)=>(B.openBlock(),B.createElementBlock("div",hee,[o.value?(B.openBlock(),B.createElementBlock("div",uee,[...b[5]||(b[5]=[B.createElementVNode("div",{class:"spinner"},null,-1),B.createElementVNode("p",{class:"loading-text"},"Loading data...",-1)])])):g.value?(B.openBlock(),B.createElementBlock("div",Bee,[b[6]||(b[6]=B.createElementVNode("strong",null,"� Error:",-1)),B.createTextVNode(" "+B.toDisplayString(g.value),1)])):(B.openBlock(),B.createElementBlock("div",Cee,[b[12]||(b[12]=B.createElementVNode("div",{class:"header"},[B.createElementVNode("h3",{class:"title"},"Gene Expression Distribution")],-1)),B.createElementVNode("div",fee,[B.createElementVNode("div",Eee,[B.createElementVNode("label",dee,[b[7]||(b[7]=B.createTextVNode(" X-axis (Metadata): ",-1)),B.withDirectives(B.createElementVNode("select",{"onUpdate:modelValue":b[0]||(b[0]=v=>I.value=v),onChange:x,class:"select"},[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(l.value,v=>(B.openBlock(),B.createElementBlock("option",{key:v,value:v},B.toDisplayString(v),9,Qee))),128))],544),[[B.vModelSelect,I.value]])]),B.createElementVNode("label",pee,[b[8]||(b[8]=B.createTextVNode(" Gene Expression ",-1)),B.createElementVNode("div",yee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=v=>u.value=v),type:"text",placeholder:"Gene name (e.g., CDH9)",class:"gene-input",list:"gene-suggestions",onInput:m},null,544),[[B.vModelText,u.value]]),B.createElementVNode("datalist",mee,[(B.openBlock(!0),B.createElementBlock(B.Fragment,null,B.renderList(C.value,v=>(B.openBlock(),B.createElementBlock("option",{key:v,value:v},null,8,wee))),128))]),B.createElementVNode("button",{onClick:D,disabled:!u.value.trim()||a.value,class:"visualize-btn"},B.toDisplayString(a.value?"Loading...":"Visualize"),9,Dee)])]),B.createElementVNode("label",_ee,[b[9]||(b[9]=B.createTextVNode(" Plot Type: ",-1)),B.createElementVNode("div",See,[B.createElementVNode("button",{onClick:b[2]||(b[2]=v=>f.value="violin"),class:B.normalizeClass([{active:f.value==="violin"},"toggle-btn"])}," Violin ",2),B.createElementVNode("button",{onClick:b[3]||(b[3]=v=>f.value="box"),class:B.normalizeClass([{active:f.value==="box"},"toggle-btn"])}," Box ",2)])]),B.createElementVNode("label",vee,[B.withDirectives(B.createElementVNode("input",{"onUpdate:modelValue":b[4]||(b[4]=v=>y.value=v),type:"checkbox",class:"checkbox",onChange:k},null,544),[[B.vModelCheckbox,y.value]]),b[10]||(b[10]=B.createTextVNode(" Show data points ",-1))])]),B.createElementVNode("div",bee,[a.value?(B.openBlock(),B.createElementBlock("div",xee,[...b[11]||(b[11]=[B.createElementVNode("div",{class:"small-spinner"},null,-1),B.createElementVNode("p",null,"Loading data...",-1)])])):B.createCommentVNode("",!0),(B.openBlock(),B.createElementBlock("svg",{ref_key:"violinSvg",ref:n,class:"violin-svg"},null,512)),B.createElementVNode("canvas",{ref_key:"dataPointsCanvas",ref:r,class:"data-points-canvas"},null,512)])])]))]))}},[["__scopeId","data-v-fe87f25d"]]),Fee={class:"gene-x-expression-wrap"},Nee="https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/humandrg/v2",nF=_s(B.defineComponent({inheritAttrs:!1,__name:"GeneXDistribution",props:{dataPath:{},initialGene:{},initialMetadataColumn:{}},setup(t){const e=t,A=Ig(),i=KI(),n=B.computed(()=>{var s;return e.dataPath??(A?(s=B.unref(A.services))==null?void 0:s.s3Url:null)??Nee});B.onMounted(()=>{e.initialGene&&i.selectedGeneX===null&&i.setSelectedGeneX(e.initialGene),e.initialMetadataColumn&&i.selectedMetadataColumn===null&&i.setSelectedMetadataColumn(e.initialMetadataColumn)});function r(s,o){s==="selectedGene"?i.setSelection("selectedGeneX",o):i.setSelection(s,o)}return(s,o)=>(B.openBlock(),B.createElementBlock(B.Fragment,null,[B.renderSlot(s.$slots,"default",{},void 0,!0),B.createElementVNode("div",Fee,[B.createVNode(Ree,{gene:B.unref(i).selectedGeneX??void 0,metadataColumn:B.unref(i).selectedMetadataColumn??void 0,"onUpdate:Vars":r,"data-path":n.value},null,8,["gene","metadataColumn","data-path"])])],64))}}),[["__scopeId","data-v-d523c42c"]]),kee=Object.freeze(Object.defineProperty({__proto__:null,DataExplorer:G1,DataExplorerCore:U1,clearDataExplorerStore:L1,createDataExplorerStore:T1},Symbol.toStringTag,{value:"Module"})),Mee=Object.freeze(Object.defineProperty({__proto__:null,UMAP:Mv,UMAPControlPanel:Rv,UMAPScatterplot:xv,clearUMAPStore:kv,createUMAPStore:Nv},Symbol.toStringTag,{value:"Module"})),Tee=Object.freeze(Object.defineProperty({__proto__:null,Markdown:H5},Symbol.toStringTag,{value:"Module"})),Lee=Object.freeze(Object.defineProperty({__proto__:null,TextViewer:Z5},Symbol.toStringTag,{value:"Module"})),Uee={class:"pp-container"},Gee={class:"pp-header"},Oee={class:"pp-controls"},Pee={class:"pp-field"},qee=["disabled"],Hee={class:"pp-field"},Jee=["disabled"],Yee=["value"],Kee=["value"],Vee=["disabled"],Wee=["value"],zee={class:"pp-field"},Xee=["disabled"],jee={key:0,class:"pp-message"},Uy=100,Gy=12,Oy="(other)",$ee=Object.freeze(Object.defineProperty({__proto__:null,ProportionPlot:co(B.defineComponent({__name:"ProportionPlot",props:{apiUrl:{},pkg:{},srcUrl:{},srcFileType:{},srcFileId:{},tableNameOverride:{}},setup(t){const e=t;let A;const i=B.inject("duckdb");if(!i)throw new Error('[@pennsieve-viz/core] DuckDB store not provided. Please provide a DuckDB store via app.provide("duckdb", store)');const n=i,r=B.ref(null),s=B.ref(null),o=B.ref(e.srcUrl||"https://temp-precision-dashboard-data.s3.us-east-1.amazonaws.com/precision_human_drg_data.parquet"),g=B.computed(()=>n.formatIdFromUrl(o.value)),a=B.ref(!1),c=B.ref(""),l=B.ref([]),I=B.ref(""),h=B.ref(""),u=`proportion-plot-${Math.random().toString(36).slice(2)}`;B.watch(()=>({srcUrl:e.srcUrl,srcFileType:e.srcFileType,srcFileId:e.srcFileId,pkg:e.pkg,apiUrl:e.apiUrl}),async({srcUrl:M,srcFileType:k,srcFileId:_,pkg:b,apiUrl:v})=>{var T,O;try{if(M&&(o.value=M),await y(),o.value){const W=k??(o.value.toLowerCase().endsWith(".csv")?"csv":"parquet");await d(W,g.value);return}const Y=(T=b==null?void 0:b.content)==null?void 0:T.id,R=(O=b==null?void 0:b.content)==null?void 0:O.packageType;if(Y&&v){const W=await D(Y,v);if(!W)return;const ne=await x(Y,W,v),le=R==="CSV"?"csv":"parquet",Z=W.replace(/[^a-zA-Z0-9_.-]/g,"_");o.value=ne,await d(le,Z)}}catch(Y){console.error("[ProportionPlot] Load failed:",(Y==null?void 0:Y.message)||Y),c.value=`Load failed: ${(Y==null?void 0:Y.message)||Y}`}},{immediate:!0});const E=new Set(["VARCHAR","STRING","TEXT","BOOL","BOOLEAN","DATE","TIMESTAMP"]),C=B.computed(()=>l.value.filter(M=>E.has(M.type)||M.type.startsWith("VARCHAR"))),f=B.computed(()=>l.value.filter(M=>!E.has(M.type)));async function y(){if(r.value)return;const{connectionId:M}=await n.createConnection(`prop_${Date.now()}`);r.value=M}function Q(M){const k=String(M).replace(/[^A-Za-z0-9_]/g,"_");return(/^[A-Za-z_]/.test(k)?k:`t_${k}`).slice(0,63)}async function d(M,k){r.value||await y();const _=(k||e.srcFileId||o.value||"file").replace(/[^A-Za-z0-9]/g,"_");a.value=!0,c.value="Loading file into DuckDB…";try{const b=M??(o.value.toLowerCase().endsWith(".csv")?"csv":"parquet"),v=e.tableNameOverride||Q(`file_${_.slice(0,48)}`),T=await n.loadFile(o.value,b,v,{},r.value,_);s.value=T,await p(!0)}finally{a.value=!1}}function w(M){return'"'+String(M).replace(/"/g,'""')+'"'}async function p(M=!1){var k,_,b,v;if(!s.value||!r.value)return;const T=`PRAGMA table_info(${w(s.value)})`,O=await n.executeQuery(T,r.value);if(l.value=O.map(Y=>({name:String(Y.name),type:String(Y.type).toUpperCase()})),M||!I.value||!h.value){const Y=l.value.filter(R=>E.has(R.type)||R.type.startsWith("VARCHAR"));I.value=((k=Y[0])==null?void 0:k.name)||((_=l.value[0])==null?void 0:_.name)||"",h.value=((b=Y[1])==null?void 0:b.name)||((v=Y[0])==null?void 0:v.name)||""}c.value=`Columns: ${l.value.length}.`}async function m(){if(!(!s.value||!r.value)){if(!I.value||!h.value){c.value="Pick both X and Y";return}a.value=!0,c.value="Computing proportions…";try{const M=w(s.value),k=w(I.value),_=w(h.value),b=`
|
|
340
340
|
WITH xf AS (
|
|
341
341
|
SELECT ${k} AS x, COUNT(*) AS c
|
|
342
342
|
FROM ${M}
|