1var Gw=Object.defineProperty;var Zw=(ue,Bt,Wt)=>Bt in ue?Gw(ue,Bt,{enumerable:!0,configurable:!0,writable:!0,value:Wt}):ue[Bt]=Wt;var Xr=(ue,Bt,Wt)=>Zw(ue,typeof Bt!="symbol"?Bt+"":Bt,Wt);import{am as Na,_ as Qw,m as Xw,v as Yw,d as Kw,c as Ve,o as Be,b as yr,h as Jw,a as Ae,W as tv,aA as kf,e as Cf,s as Ba,N as Sf}from"./index-F2gfJemj.js";import{f as ev}from"./fp-lfxFO2SJ.js";import{U as rv}from"./Upsell30x-DwZSkv4j.js";var Ss={exports:{}},nv=Ss.exports,Af;function iv(){return Af||(Af=1,(function(ue,Bt){(function(Wt,Dt){ue.exports=Dt()})(nv,(function(){/*! 2* jQuery JavaScript Library v3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector 3* https://jquery.com/ 4* 5* Includes Sizzle.js 6* https://sizzlejs.com/ 7* 8* Copyright JS Foundation and other contributors 9* Released under the MIT license 10* https://jquery.org/license 11* 12* Date: 2018-01-20T17:24Z 13*/var Wt=[],Dt=window.document,Re=Object.getPrototypeOf,Ke=Wt.slice,mi=Wt.concat,Rn=Wt.push,bi=Wt.indexOf,wi={},Fa=wi.toString,vi=wi.hasOwnProperty,Oa=vi.toString,Ef=Oa.call(Object),he={},Yt=function(r){return typeof r=="function"&&typeof r.nodeType!="number"},Yr=function(r){return r!=null&&r===r.window},Tf={type:!0,src:!0,noModule:!0};function Da(r,t,e){var n,i=(t=t||Dt).createElement("script");if(i.text=r,e)for(n in Tf)e[n]&&(i[n]=e[n]);t.head.appendChild(i).parentNode.removeChild(i)}function Kr(r){return r==null?r+"":typeof r=="object"||typeof r=="function"?wi[Fa.call(r)]||"object":typeof r}var Pa="3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector",P=function(r,t){return new P.fn.init(r,t)},Mf=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function As(r){var t=!!r&&"length"in r&&r.length,e=Kr(r);return!Yt(r)&&!Yr(r)&&(e==="array"||t===0||typeof t=="number"&&t>0&&t-1 in r)}P.fn=P.prototype={jquery:Pa,constructor:P,length:0,toArray:function(){return Ke.call(this)},get:function(r){return r==null?Ke.call(this):r<0?this[r+this.length]:this[r]},pushStack:function(r){var t=P.merge(this.constructor(),r);return t.prevObject=this,t},each:function(r){return P.each(this,r)},map:function(r){return this.pushStack(P.map(this,(function(t,e){return r.call(t,e,t)})))},slice:function(){return this.pushStack(Ke.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(r){var t=this.length,e=+r+(r<0?t:0);return this.pushStack(e>=0&&e<t?[this[e]]:[])},end:function(){return this.prevObject||this.constructor()},push:Rn,sort:Wt.sort,splice:Wt.splice},P.extend=P.fn.extend=function(){var r,t,e,n,i,s,o=arguments[0]||{},a=1,l=arguments.length,h=!1;for(typeof o=="boolean"&&(h=o,o=arguments[a]||{},a++),typeof o=="object"||Yt(o)||(o={}),a===l&&(o=this,a--);a<l;a++)if((r=arguments[a])!=null)for(t in r)e=o[t],o!==(n=r[t])&&(h&&n&&(P.isPlainObject(n)||(i=Array.isArray(n)))?(i?(i=!1,s=e&&Array.isArray(e)?e:[]):s=e&&P.isPlainObject(e)?e:{}
13,o[t]=P.extend(h,s,n)):n!==void 0&&(o[t]=n));return o},P.extend({expando:"jQuery"+(Pa+Math.random()).replace(/\D/g,""),isReady:!0,error:function(r){throw new Error(r)},noop:function(){},isPlainObject:function(r){var t,e;return!(!r||Fa.call(r)!=="[object Object]")&&(!(t=Re(r))||typeof(e=vi.call(t,"constructor")&&t.constructor)=="function"&&Oa.call(e)===Ef)},isEmptyObject:function(r){var t;for(t in r)return!1;return!0},globalEval:function(r){Da(r)},each:function(r,t){var e,n=0;if(As(r))for(e=r.length;n<e&&t.call(r[n],n,r[n])!==!1;n++);else for(n in r)if(t.call(r[n],n,r[n])===!1)break;return r},trim:function(r){return r==null?"":(r+"").replace(Mf,"")},makeArray:function(r,t){var e=t||[];return r!=null&&(As(Object(r))?P.merge(e,typeof r=="string"?[r]:r):Rn.call(e,r)),e},inArray:function(r,t,e){return t==null?-1:bi.call(t,r,e)},merge:function(r,t){for(var e=+t.length,n=0,i=r.length;n<e;n++)r[i++]=t[n];return r.length=i,r},grep:function(r,t,e){for(var n=[],i=0,s=r.length,o=!e;i<s;i++)!t(r[i],i)!==o&&n.push(r[i]);return n},map:function(r,t,e){var n,i,s=0,o=[];if(As(r))for(n=r.length;s<n;s++)(i=t(r[s],s,e))!=null&&o.push(i);else for(s in r)(i=t(r[s],s,e))!=null&&o.push(i);return mi.apply([],o)},guid:1,support:he}),typeof Symbol=="function"&&(P.fn[Symbol.iterator]=Wt[Symbol.iterator]),P.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(r,t){wi["[object "+t+"]"]=t.toLowerCase()}));var Rr=(function(r){var t,e,n,i,s,o,a,l,h,c,u,p,d,w,m,g,f,b,v,_="sizzle"+1*new Date,A=r.document,S=0,C=0,R=Y(),x=Y(),T=Y(),y=function(V,Q){return V===Q&&(u=!0),0},E={}.hasOwnProperty,L=[],N=L.pop,q=L.push,H=L.push,W=L.slice,U=function(V,Q){for(var et=0,ot=V.length;et<ot;et++)if(V[et]===Q)return et;return-1},k="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",O="[\\x20\\t\\r\\n\\f]",z="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",B="\\["+O+"*("+z+")(?:"+O+"*([*^$|!~]?=)"+O+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+z+"))|)"+O+"*\\]",F=":("+z+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+B+")*)|.*)\\)|)",j=new RegExp(O+"+","g"),$=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),G=new RegExp("^"+O+"*,"+O+"*"),Z=new RegExp("^"+O+"*([>+~]|"+O+")"+O+"*"),X=new RegExp("="+O+`*([^\\]'"]*?)`+O+"*\\]","g"),st=new RegExp(F),nt=new RegExp("^"+z+"$"),it={ID:new RegExp("^#("+z+")"),CLASS:new RegExp("^\\.("+z+")"),TAG:new RegExp("^("+z+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),bool:new RegExp("^(?:"+k+")$","i"),needsContext:new RegExp("^"+O+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)","i")},mt=/^(?:input|select|textarea|button)$/i,gt=/^h\d$/i,_t=/^[^{]+\{\s*\[native \w/,xt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ct=/[+~]/,kt=new RegExp("\\\\([\\da-f]{1,6}"+O+"?|("+O+")|.)","ig"),At=function(V,Q,et){var ot="0x"+Q-65536;return ot!=ot||et?Q:ot<0?String.fromCharCode(ot+65536):String.fromCharCode(ot>>10|55296,1023&ot|56320)},St=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Ut=function(V,Q){return Q?V==="\0"?"�":V.slice(0,-1)+"\\"+V.charCodeAt(V.length-1).toString(16)+" ":"\\"+V},M=function(){p()},I=En((function(V){return V.disabled===!0&&("form"in V||"label"in V)}),{dir:"parentNode",next:"legend"});try{H.apply(L=W.call(A.childNodes),A.childNodes),L[A.childNodes.length].nodeType}catch{H={apply:L.length?function(Q,et){q.apply(Q,W.call(et))}:function(Q,et){for(var ot=Q.length,rt=0;Q[ot++]=et[rt++];);Q.length=ot-1}}}function D(V,Q,et,ot){var rt,ht,dt,wt,vt,Mt,Rt,Tt=Q&&Q.ownerDocument,Ht=Q?Q.nodeType:9;if(et=et||[],typeof V!="string"||!V||Ht!==1&&Ht!==9&&Ht!==11)return et;if(!ot&&((Q?Q.ownerDocument||Q:A)!==d&&p(Q),Q=Q||d,m)){if(Ht!==11&&(vt=xt.exec(V)))if(rt=vt[1]){if(Ht===9){if(!(dt=Q.getElementById(rt)))return et;if(dt.id===rt)return et.push(dt),et}else if(Tt&&(dt=Tt.getElementById(rt))&&v(Q,dt)&&dt.id===rt)return et.push(dt),et}else{if(vt[2])return H.apply(et,Q.getElementsByTagName(V)),et;if((rt=vt[3])&&e.getElementsByClassName&&Q.getElementsByClassName)return H.apply(et,Q.getElementsByClassName(rt)),et}if(e.qsa&&!T[V+" "]&&(!g||!g.test(V))){if(Ht!==1)Tt=Q,Rt=V;else if(Q.nodeName.toLowerCase()!=="object"){for((wt=Q.getAttribute("id"))?wt=wt.replace(St,Ut):Q.setAttribute("id",wt=_),ht=(Mt=o(V)).length;ht--;)Mt[ht]="#"+wt+" "+Mr(Mt[ht]);Rt=Mt.join(","),Tt=ct.test(V)&&Qt(Q.parentNode)||Q}if(Rt)try{return H.apply(et,Tt.querySelectorAll(Rt)),et}catch{}finally{wt===_&&Q.removeAttribute("id")}}}return l(V.replace($,"$1"),Q,et,ot)}function Y(){var V=[];return function Q(et,ot){return V.push(et+" ")>n.cacheLength&&delete Q[V.shift()],Q[et+" "]=ot}}function J(V){return V[_]=!0,V}function tt(V){var Q=d.createElement("fieldset");try{return!!V(Q)}catch{return!1}finally{Q.parentNode&&Q.parentNode.removeChild(Q),Q=null}}function lt(V,Q){var et=Q&&V,ot=et&&V.nodeType===1&&Q.nodeType===1&&V.sourceIndex-Q.sourceIndex;if(ot)return ot;if(et){for(;et=et.nextSibling;)if(et===Q)return-1}return V?1:-1}function Et(V){return function(Q){return Q.nodeName.toLowerCase()==="input"&&Q.type===V}}function zt(V){return function(Q){var et=Q.nodeName.toLowerCase();return(et==="input"||et==="button")&&Q.type===V}}function te(V){return function(Q){return"form"in Q?Q.parentNode&&Q.disabled===!1?"label"in Q?"label"in Q.parentNode?Q.parentNode.disabled===V:Q.disabled===V:Q.isDisabled===V||Q.isDisabled!==!V&&I(Q)===V:Q.disabled===V:"label"in Q&&Q.disabled===V}}function It(V){return J((function(Q){return Q=+Q,J((function(et,ot){for(var rt,ht=V([],et.length,Q),dt=ht.length;dt--;)et[rt=ht[dt]]&&(et[rt]=!(ot[rt]=et[rt]))}))}))}function Qt(V){return V&&V.getElementsByTagName!==void 0&&V}for(t in e=D.support={},s=D.isXML=function(V){var Q=V&&(V.ownerDocument||V).documentElement;return!!Q&&Q.nodeName!=="HTML"},p=D.setDocument=function(V){var Q,et,ot=V?V.ownerDocument||V:A;return ot!==d&&ot.nodeType===9&&ot.documentElement&&(w=(d=ot).documentElement,m=!s(d),A!==d&&(et=d.defaultView)&&et.top!==et&&(et.addEventListener?et.addEventListener("unload",M,!1):et.attachEvent&&et.attachEvent("onunload",M)),e.attributes=tt((function(rt){return rt.className="i",!rt.getAttribute("className")})),e.getElementsByTagName=tt((function(rt){return rt.appendChild(d.createComment("")),!rt.getElementsByTagName("*").length})),e.getElementsByClassName=_t.test(d.getElementsByClassName),e.getById=tt((function(rt){return w.appendChild(rt).id=_,!d.getElementsByName||!d.getElementsByName(_).length})),e.getById?(n.filter.ID=function(rt){var ht=rt.replace(kt,At);return function(dt){return dt.getAttribute("id")===ht}},n.find.ID=function(rt,ht){if(ht.getElementById!==void 0&&m){var dt=ht.getElementById(rt);return dt?[dt]:[]}}):(n.filter.ID=function(rt){var ht=rt.replace(kt,At);return function(dt){var wt=dt.getAttributeNode!==void 0&&dt.getAttributeNode("id");return wt&&wt.value===ht}},n.find.ID=function(rt,ht){if(ht.getElementById!==void 0&&m){var dt,wt,vt,Mt=ht.getElementById(rt);if(Mt){if((dt=Mt.getAttributeNode("id"))&&dt.value===rt)return[Mt];for(vt=ht.getElementsByName(rt),wt=0;Mt=vt[wt++];)if((dt=Mt.getAttributeNode("id"))&&dt.value===rt)return[Mt]}return[]}}),n.find.TAG=e.getElementsByTagName?function(rt,ht){return ht.getElementsByTagName!==void 0?ht.getElementsByTagName(rt):e.qsa?ht.querySelectorAll(rt):void 0}:function(rt,ht){var dt,wt=[],vt=0,Mt=ht.getElementsByTagName(rt);if(rt==="*"){for(;dt=Mt[vt++];)dt.nodeType===1&&wt.push(dt);return wt}return Mt},n.find.CLASS=e.getElementsByClassName&&function(rt,ht){if(ht.getElementsByClassName!==void 0&&m)return ht.getElementsByClassName(rt)},f=[],g=[],(e.qsa=_t.test(d.querySelectorAll))&&(tt((function(rt){w.appendChild(rt).innerHTML="<a id='"+_+"'></a><select id='"+_+"-\r\\' msallowcapture=''><option selected=''></option></select>",rt.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+O+`*(?:''|"")`),rt.querySelectorAll("[selected]").length||g.push("\\["+O+"*(?:value|"+k+")"),rt.querySelectorAll("[id~="+_+"-]").length||g.push("~="),rt.querySelectorAll(":checked").length||g.push(":checked"),rt.querySelectorAll("a#"+_+"+*").length||g.push(".#.+[+~]")})),tt((function(rt){rt.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var ht=d.createElement("input");ht.setAttribute("type","hidden"),rt.appendChild(ht).setAttribute("name","D"),rt.querySelectorAll("[name=d]").length&&g.push("name"+O+"*[*^$|!~]?="),rt.querySelectorAll(":enabled").length!==2&&g.push(":enabled",":disabled"),w.appendChild(rt).disabled=!0,rt.querySelectorAll(":disabled").length!==2&&g.push(":enabled",":disabled"),rt.querySelectorAll("*,:x"),g.push(",.*:")}))),(e.matchesSelector=_t.test(b=w.matches||w.webkitMatchesSelector||w.mozMatchesSelector||w.oMatchesSelector||w.msMatchesSelector))&&tt((function(rt){e.disconnectedMatch=b.call(rt,"*"),b.call(rt,"[s!='']:x"),f.push("!=",F)})),g=g.length&&new RegExp(g.join("|")),f=f.length&&new RegExp(f.join("|")),Q=_t.test(w.compareDocumentPosition),v=Q||_t.test(w.contains)?function(rt,ht){var dt=rt.nodeType===9?rt.documentElement:rt,wt=ht&&ht.parentNode;return rt===wt||!(!wt||wt.nodeType!==1||!(dt.contains?dt.contains(wt):rt.compareDocumentPosition&&16&rt.compareDocumentPosition(wt)))}:function(rt,ht){if(ht){for(;ht=ht.parentNode;)if(ht===rt)return!0}return!1},y=Q?function(rt,ht){if(rt===ht)return u=!0,0;var dt=!rt.compareDocumentPosition-!ht.compareDocumentPosition;return dt||(1&(dt=(rt.ownerDocument||rt)===(ht.ownerDocument||ht)?rt.compareDocumentPosition(ht):1)||!e.sortDetached&&ht.compareDocumentPosition(rt)===dt?rt===d||rt.ownerDocument===A&&v(A,rt)?-1:ht===d||ht.ownerDocument===A&&v(A,ht)?1:c?U(c,rt)-U(c,ht):0:4&dt?-1:1)}:function(rt,ht){if(rt===ht)return u=!0,0;var dt,wt=0,vt=rt.parentNode,Mt=ht.parentNode,Rt=[rt],Tt=[ht];if(!vt||!Mt)return rt===d?-1:ht===d?1:vt?-1:Mt?1:c?U(c,rt)-U(c,ht):0;if(vt===Mt)return lt(rt,ht);for(dt=rt;dt=dt.parentNode;)Rt.unshift(dt);for(dt=ht;dt=dt.parentNode;)Tt.unshift(dt);for(;Rt[wt]===Tt[wt];)wt++;return wt?lt(Rt[wt],Tt[wt]):Rt[wt]===A?-1:Tt[wt]===A?1:0}),d}
13,D.matches=function(V,Q){return D(V,null,null,Q)},D.matchesSelector=function(V,Q){if((V.ownerDocument||V)!==d&&p(V),Q=Q.replace(X,"='$1']"),e.matchesSelector&&m&&!T[Q+" "]&&(!f||!f.test(Q))&&(!g||!g.test(Q)))try{var et=b.call(V,Q);if(et||e.disconnectedMatch||V.document&&V.document.nodeType!==11)return et}catch{}return D(Q,d,null,[V]).length>0},D.contains=function(V,Q){return(V.ownerDocument||V)!==d&&p(V),v(V,Q)},D.attr=function(V,Q){(V.ownerDocument||V)!==d&&p(V);var et=n.attrHandle[Q.toLowerCase()],ot=et&&E.call(n.attrHandle,Q.toLowerCase())?et(V,Q,!m):void 0;return ot!==void 0?ot:e.attributes||!m?V.getAttribute(Q):(ot=V.getAttributeNode(Q))&&ot.specified?ot.value:null},D.escape=function(V){return(V+"").replace(St,Ut)},D.error=function(V){throw new Error("Syntax error, unrecognized expression: "+V)},D.uniqueSort=function(V){var Q,et=[],ot=0,rt=0;if(u=!e.detectDuplicates,c=!e.sortStable&&V.slice(0),V.sort(y),u){for(;Q=V[rt++];)Q===V[rt]&&(ot=et.push(rt));for(;ot--;)V.splice(et[ot],1)}return c=null,V},i=D.getText=function(V){var Q,et="",ot=0,rt=V.nodeType;if(rt){if(rt===1||rt===9||rt===11){if(typeof V.textContent=="string")return V.textContent;for(V=V.firstChild;V;V=V.nextSibling)et+=i(V)}else if(rt===3||rt===4)return V.nodeValue}else for(;Q=V[ot++];)et+=i(Q);return et},n=D.selectors={cacheLength:50,createPseudo:J,match:it,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(V){return V[1]=V[1].replace(kt,At),V[3]=(V[3]||V[4]||V[5]||"").replace(kt,At),V[2]==="~="&&(V[3]=" "+V[3]+" "),V.slice(0,4)},CHILD:function(V){return V[1]=V[1].toLowerCase(),V[1].slice(0,3)==="nth"?(V[3]||D.error(V[0]),V[4]=+(V[4]?V[5]+(V[6]||1):2*(V[3]==="even"||V[3]==="odd")),V[5]=+(V[7]+V[8]||V[3]==="odd")):V[3]&&D.error(V[0]),V},PSEUDO:function(V){var Q,et=!V[6]&&V[2];return it.CHILD.test(V[0])?null:(V[3]?V[2]=V[4]||V[5]||"":et&&st.test(et)&&(Q=o(et,!0))&&(Q=et.indexOf(")",et.length-Q)-et.length)&&(V[0]=V[0].slice(0,Q),V[2]=et.slice(0,Q)),V.slice(0,3))}},filter:{TAG:function(V){var Q=V.replace(kt,At).toLowerCase();return V==="*"?function(){return!0}:function(et){return et.nodeName&&et.nodeName.toLowerCase()===Q}},CLASS:function(V){var Q=R[V+" "];return Q||(Q=new RegExp("(^|"+O+")"+V+"("+O+"|$)"))&&R(V,(function(et){return Q.test(typeof et.className=="string"&&et.className||et.getAttribute!==void 0&&et.getAttribute("class")||"")}))},ATTR:function(V,Q,et){return function(ot){var rt=D.attr(ot,V);return rt==null?Q==="!=":!Q||(rt+="",Q==="="?rt===et:Q==="!="?rt!==et:Q==="^="?et&&rt.indexOf(et)===0:Q==="*="?et&&rt.indexOf(et)>-1:Q==="$="?et&&rt.slice(-et.length)===et:Q==="~="?(" "+rt.replace(j," ")+" ").indexOf(et)>-1:Q==="|="&&(rt===et||rt.slice(0,et.length+1)===et+"-"))}},CHILD:function(V,Q,et,ot,rt){var ht=V.slice(0,3)!=="nth",dt=V.slice(-4)!=="last",wt=Q==="of-type";return ot===1&&rt===0?function(vt){return!!vt.parentNode}:function(vt,Mt,Rt){var Tt,Ht,Xt,Nt,pe,ge,xe=ht!==dt?"nextSibling":"previousSibling",ee=vt.parentNode,K=wt&&vt.nodeName.toLowerCase(),ft=!Rt&&!wt,bt=!1;if(ee){if(ht){for(;xe;){for(Nt=vt;Nt=Nt[xe];)if(wt?Nt.nodeName.toLowerCase()===K:Nt.nodeType===1)return!1;ge=xe=V==="only"&&!ge&&"nextSibling"}return!0}if(ge=[dt?ee.firstChild:ee.lastChild],dt&&ft){for(bt=(pe=(Tt=(Ht=(Xt=(Nt=ee)[_]||(Nt[_]={}))[Nt.uniqueID]||(Xt[Nt.uniqueID]={}))[V]||[])[0]===S&&Tt[1])&&Tt[2],Nt=pe&&ee.childNodes[pe];Nt=++pe&&Nt&&Nt[xe]||(bt=pe=0)||ge.pop();)if(Nt.nodeType===1&&++bt&&Nt===vt){Ht[V]=[S,pe,bt];break}}else if(ft&&(bt=pe=(Tt=(Ht=(Xt=(Nt=vt)[_]||(Nt[_]={}))[Nt.uniqueID]||(Xt[Nt.uniqueID]={}))[V]||[])[0]===S&&Tt[1]),bt===!1)for(;(Nt=++pe&&Nt&&Nt[xe]||(bt=pe=0)||ge.pop())&&((wt?Nt.nodeName.toLowerCase()!==K:Nt.nodeType!==1)||!++bt||(ft&&((Ht=(Xt=Nt[_]||(Nt[_]={}))[Nt.uniqueID]||(Xt[Nt.uniqueID]={}))[V]=[S,bt]),Nt!==vt)););return(bt-=rt)===ot||bt%ot==0&&bt/ot>=0}}},PSEUDO:function(V,Q){var et,ot=n.pseudos[V]||n.setFilters[V.toLowerCase()]||D.error("unsupported pseudo: "+V);return ot[_]?ot(Q):ot.length>1?(et=[V,V,"",Q],n.setFilters.hasOwnProperty(V.toLowerCase())?J((function(rt,ht){for(var dt,wt=ot(rt,Q),vt=wt.length;vt--;)rt[dt=U(rt,wt[vt])]=!(ht[dt]=wt[vt])})):function(rt){return ot(rt,0,et)}):ot}},pseudos:{not:J((function(V){var Q=[],et=[],ot=a(V.replace($,"$1"));return ot[_]?J((function(rt,ht,dt,wt){for(var vt,Mt=ot(rt,null,wt,[]),Rt=rt.length;Rt--;)(vt=Mt[Rt])&&(rt[Rt]=!(ht[Rt]=vt))})):function(rt,ht,dt){return Q[0]=rt,ot(Q,null,dt,et),Q[0]=null,!et.pop()}})),has:J((function(V){return function(Q){return D(V,Q).length>0}})),contains:J((function(V){return V=V.replace(kt,At),function(Q){return(Q.textContent||Q.innerText||i(Q)).indexOf(V)>-1}})),lang:J((function(V){return nt.test(V||"")||D.error("unsupported lang: "+V),V=V.replace(kt,At).toLowerCase(),function(Q){var et;do if(et=m?Q.lang:Q.getAttribute("xml:lang")||Q.getAttribute("lang"))return(et=et.toLowerCase())===V||et.indexOf(V+"-")===0;while((Q=Q.parentNode)&&Q.nodeType===1);return!1}}
vendor: 4,485 bytes, line 13
13)),target:function(V){var Q=r.location&&r.location.hash;return Q&&Q.slice(1)===V.id},root:function(V){return V===w},focus:function(V){return V===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(V.type||V.href||~V.tabIndex)},enabled:te(!1),disabled:te(!0),checked:function(V){var Q=V.nodeName.toLowerCase();return Q==="input"&&!!V.checked||Q==="option"&&!!V.selected},selected:function(V){return V.parentNode&&V.parentNode.selectedIndex,V.selected===!0},empty:function(V){for(V=V.firstChild;V;V=V.nextSibling)if(V.nodeType<6)return!1;return!0},parent:function(V){return!n.pseudos.empty(V)},header:function(V){return gt.test(V.nodeName)},input:function(V){return mt.test(V.nodeName)},button:function(V){var Q=V.nodeName.toLowerCase();return Q==="input"&&V.type==="button"||Q==="button"},text:function(V){var Q;return V.nodeName.toLowerCase()==="input"&&V.type==="text"&&((Q=V.getAttribute("type"))==null||Q.toLowerCase()==="text")},first:It((function(){return[0]})),last:It((function(V,Q){return[Q-1]})),eq:It((function(V,Q,et){return[et<0?et+Q:et]})),even:It((function(V,Q){for(var et=0;et<Q;et+=2)V.push(et);return V})),odd:It((function(V,Q){for(var et=1;et<Q;et+=2)V.push(et);return V})),lt:It((function(V,Q,et){for(var ot=et<0?et+Q:et;--ot>=0;)V.push(ot);return V})),gt:It((function(V,Q,et){for(var ot=et<0?et+Q:et;++ot<Q;)V.push(ot);return V}))}},n.pseudos.nth=n.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})n.pseudos[t]=Et(t);for(t in{submit:!0,reset:!0})n.pseudos[t]=zt(t);function An(){}function Mr(V){for(var Q=0,et=V.length,ot="";Q<et;Q++)ot+=V[Q].value;return ot}function En(V,Q,et){var ot=Q.dir,rt=Q.next,ht=rt||ot,dt=et&&ht==="parentNode",wt=C++;return Q.first?function(vt,Mt,Rt){for(;vt=vt[ot];)if(vt.nodeType===1||dt)return V(vt,Mt,Rt);return!1}:function(vt,Mt,Rt){var Tt,Ht,Xt,Nt=[S,wt];if(Rt){for(;vt=vt[ot];)if((vt.nodeType===1||dt)&&V(vt,Mt,Rt))return!0}else for(;vt=vt[ot];)if(vt.nodeType===1||dt)if(Ht=(Xt=vt[_]||(vt[_]={}))[vt.uniqueID]||(Xt[vt.uniqueID]={}),rt&&rt===vt.nodeName.toLowerCase())vt=vt[ot]||vt;else{if((Tt=Ht[ht])&&Tt[0]===S&&Tt[1]===wt)return Nt[2]=Tt[2];if(Ht[ht]=Nt,Nt[2]=V(vt,Mt,Rt))return!0}return!1}}function hr(V){return V.length>1?function(Q,et,ot){for(var rt=V.length;rt--;)if(!V[rt](Q,et,ot))return!1;return!0}:V[0]}function Tn(V,Q,et,ot,rt){for(var ht,dt=[],wt=0,vt=V.length,Mt=Q!=null;wt<vt;wt++)(ht=V[wt])&&(et&&!et(ht,ot,rt)||(dt.push(ht),Mt&&Q.push(wt)));return dt}function fe(V,Q,et,ot,rt,ht){return ot&&!ot[_]&&(ot=fe(ot)),rt&&!rt[_]&&(rt=fe(rt,ht)),J((function(dt,wt,vt,Mt){var Rt,Tt,Ht,Xt=[],Nt=[],pe=wt.length,ge=dt||(function(K,ft,bt){for(var Lt=0,jt=ft.length;Lt<jt;Lt++)D(K,ft[Lt],bt);return bt})(Q||"*",vt.nodeType?[vt]:vt,[]),xe=!V||!dt&&Q?ge:Tn(ge,Xt,V,vt,Mt),ee=et?rt||(dt?V:pe||ot)?[]:wt:xe;if(et&&et(xe,ee,vt,Mt),ot)for(Rt=Tn(ee,Nt),ot(Rt,[],vt,Mt),Tt=Rt.length;Tt--;)(Ht=Rt[Tt])&&(ee[Nt[Tt]]=!(xe[Nt[Tt]]=Ht));if(dt){if(rt||V){if(rt){for(Rt=[],Tt=ee.length;Tt--;)(Ht=ee[Tt])&&Rt.push(xe[Tt]=Ht);rt(null,ee=[],Rt,Mt)}for(Tt=ee.length;Tt--;)(Ht=ee[Tt])&&(Rt=rt?U(dt,Ht):Xt[Tt])>-1&&(dt[Rt]=!(wt[Rt]=Ht))}}else ee=Tn(ee===wt?ee.splice(pe,ee.length):ee),rt?rt(null,wt,ee,Mt):H.apply(wt,ee)}))}function cr(V){for(var Q,et,ot,rt=V.length,ht=n.relative[V[0].type],dt=ht||n.relative[" "],wt=ht?1:0,vt=En((function(Tt){return Tt===Q}),dt,!0),Mt=En((function(Tt){return U(Q,Tt)>-1}),dt,!0),Rt=[function(Tt,Ht,Xt){var Nt=!ht&&(Xt||Ht!==h)||((Q=Ht).nodeType?vt(Tt,Ht,Xt):Mt(Tt,Ht,Xt));return Q=null,Nt}];wt<rt;wt++)if(et=n.relative[V[wt].type])Rt=[En(hr(Rt),et)];else{if((et=n.filter[V[wt].type].apply(null,V[wt].matches))[_]){for(ot=++wt;ot<rt&&!n.relative[V[ot].type];ot++);return fe(wt>1&&hr(Rt),wt>1&&Mr(V.slice(0,wt-1).concat({value:V[wt-2].type===" "?"*":""})).replace($,"$1"),et,wt<ot&&cr(V.slice(wt,ot)),ot<rt&&cr(V=V.slice(ot)),ot<rt&&Mr(V))}Rt.push(et)}return hr(Rt)}return An.prototype=n.filters=n.pseudos,n.setFilters=new An,o=D.tokenize=function(V,Q){var et,ot,rt,ht,dt,wt,vt,Mt=x[V+" "];if(Mt)return Q?0:Mt.slice(0);for(dt=V,wt=[],vt=n.preFilter;dt;){for(ht in et&&!(ot=G.exec(dt))||(ot&&(dt=dt.slice(ot[0].length)||dt),wt.push(rt=[])),et=!1,(ot=Z.exec(dt))&&(et=ot.shift(),rt.push({value:et,type:ot[0].replace($," ")}),dt=dt.slice(et.length)),n.filter)!(ot=it[ht].exec(dt))||vt[ht]&&!(ot=vt[ht](ot))||(et=ot.shift(),rt.push({value:et,type:ht,matches:ot}),dt=dt.slice(et.length));if(!et)break}return Q?dt.length:dt?D.error(V):x(V,wt).slice(0)},a=D.compile=function(V,Q){var et,ot=[],rt=[],ht=T[V+" "];
13if(!ht){for(Q||(Q=o(V)),et=Q.length;et--;)(ht=cr(Q[et]))[_]?ot.push(ht):rt.push(ht);ht=T(V,(function(dt,wt){var vt=wt.length>0,Mt=dt.length>0,Rt=function(Tt,Ht,Xt,Nt,pe){var ge,xe,ee,K=0,ft="0",bt=Tt&&[],Lt=[],jt=h,Jt=Tt||Mt&&n.find.TAG("*",pe),$t=S+=jt==null?1:Math.random()||.1,oe=Jt.length;for(pe&&(h=Ht===d||Ht||pe);ft!==oe&&(ge=Jt[ft])!=null;ft++){if(Mt&&ge){for(xe=0,Ht||ge.ownerDocument===d||(p(ge),Xt=!m);ee=dt[xe++];)if(ee(ge,Ht||d,Xt)){Nt.push(ge);break}pe&&(S=$t)}vt&&((ge=!ee&&ge)&&K--,Tt&&bt.push(ge))}if(K+=ft,vt&&ft!==K){for(xe=0;ee=wt[xe++];)ee(bt,Lt,Ht,Xt);if(Tt){if(K>0)for(;ft--;)bt[ft]||Lt[ft]||(Lt[ft]=N.call(Nt));Lt=Tn(Lt)}H.apply(Nt,Lt),pe&&!Tt&&Lt.length>0&&K+wt.length>1&&D.uniqueSort(Nt)}return pe&&(S=$t,h=jt),bt};return vt?J(Rt):Rt})(rt,ot)),ht.selector=V}return ht},l=D.select=function(V,Q,et,ot){var rt,ht,dt,wt,vt,Mt=typeof V=="function"&&V,Rt=!ot&&o(V=Mt.selector||V);if(et=et||[],Rt.length===1){if((ht=Rt[0]=Rt[0].slice(0)).length>2&&(dt=ht[0]).type==="ID"&&Q.nodeType===9&&m&&n.relative[ht[1].type]){if(!(Q=(n.find.ID(dt.matches[0].replace(kt,At),Q)||[])[0]))return et;Mt&&(Q=Q.parentNode),V=V.slice(ht.shift().value.length)}for(rt=it.needsContext.test(V)?0:ht.length;rt--&&(dt=ht[rt],!n.relative[wt=dt.type]);)if((vt=n.find[wt])&&(ot=vt(dt.matches[0].replace(kt,At),ct.test(ht[0].type)&&Qt(Q.parentNode)||Q))){if(ht.splice(rt,1),!(V=ot.length&&Mr(ht)))return H.apply(et,ot),et;break}}return(Mt||a(V,Rt))(ot,Q,!m,et,!Q||ct.test(V)&&Qt(Q.parentNode)||Q),et},e.sortStable=_.split("").sort(y).join("")===_,e.detectDuplicates=!!u,p(),D})(window);P.find=Rr,P.expr=Rr.selectors,P.expr[":"]=P.expr.pseudos,P.uniqueSort=P.unique=Rr.uniqueSort,P.text=Rr.getText,P.isXMLDoc=Rr.isXML,P.contains=Rr.contains,P.escapeSelector=Rr.escape;var Jr=function(r,t,e){for(var n=[],i=e!==void 0;(r=r[t])&&r.nodeType!==9;)if(r.nodeType===1){if(i&&P(r).is(e))break;n.push(r)}return n},za=function(r,t){for(var e=[];r;r=r.nextSibling)r.nodeType===1&&r!==t&&e.push(r);return e},Ha=P.expr.match.needsContext;function Je(r,t){return r.nodeName&&r.nodeName.toLowerCase()===t.toLowerCase()}var Ua=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Es(r,t,e){return Yt(t)?P.grep(r,(function(n,i){return!!t.call(n,i,n)!==e})):t.nodeType?P.grep(r,(function(n){return n===t!==e})):typeof t!="string"?P.grep(r,(function(n){return bi.call(t,n)>-1!==e})):P.filter(t,r,e)}P.filter=function(r,t,e){var n=t[0];return e&&(r=":not("+r+")"),t.length===1&&n.nodeType===1?P.find.matchesSelector(n,r)?[n]:[]:P.find.matches(r,P.grep(t,(function(i){return i.nodeType===1})))},P.fn.extend({find:function(r){var t,e,n=this.length,i=this;if(typeof r!="string")return this.pushStack(P(r).filter((function(){for(t=0;t<n;t++)if(P.contains(i[t],this))return!0})));for(e=this.pushStack([]),t=0;t<n;t++)P.find(r,i[t],e);return n>1?P.uniqueSort(e):e},filter:function(r){return this.pushStack(Es(this,r||[],!1))},not:function(r){return this.pushStack(Es(this,r||[],!0))},is:function(r){return!!Es(this,typeof r=="string"&&Ha.test(r)?P(r):r||[],!1).length}});var Va,Rf=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(P.fn.init=function(r,t,e){var n,i;if(!r)return this;if(e=e||Va,typeof r=="string"){if(!(n=r[0]==="<"&&r[r.length-1]===">"&&r.length>=3?[null,r,null]:Rf.exec(r))||!n[1]&&t)return!t||t.jquery?(t||e).find(r):this.constructor(t).find(r);if(n[1]){if(t=t instanceof P?t[0]:t,P.merge(this,P.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:Dt,!0)),Ua.test(n[1])&&P.isPlainObject(t))for(n in t)Yt(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(i=Dt.getElementById(n[2]))&&(this[0]=i,this.length=1),this}return r.nodeType?(this[0]=r,this.length=1,this):Yt(r)?e.ready!==void 0?e.ready(r):r(P):P.makeArray(r,this)}).prototype=P.fn,Va=P(Dt);var Lf=/^(?:parents|prev(?:Until|All))/,If={children:!0,contents:!0,next:!0,prev:!0};function qa(r,t){for(;(r=r[t])&&r.nodeType!==1;);return r}P.fn.extend({has:function(r){var t=P(r,this),e=t.length;return this.filter((function(){for(var n=0;n<e;n++)if(P.contains(this,t[n]))return!0}))},closest:function(r,t){var e,n=0,i=this.length,s=[],o=typeof r!="string"&&P(r);if(!Ha.test(r)){for(;n<i;n++)for(e=this[n];e&&e!==t;e=e.parentNode)if(e.nodeType<11&&(o?o.index(e)>
vendor: 6,389 bytes, line 13
13-1:e.nodeType===1&&P.find.matchesSelector(e,r))){s.push(e);break}}return this.pushStack(s.length>1?P.uniqueSort(s):s)},index:function(r){return r?typeof r=="string"?bi.call(P(r),this[0]):bi.call(this,r.jquery?r[0]:r):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(r,t){return this.pushStack(P.uniqueSort(P.merge(this.get(),P(r,t))))},addBack:function(r){return this.add(r==null?this.prevObject:this.prevObject.filter(r))}}),P.each({parent:function(r){var t=r.parentNode;return t&&t.nodeType!==11?t:null},parents:function(r){return Jr(r,"parentNode")},parentsUntil:function(r,t,e){return Jr(r,"parentNode",e)},next:function(r){return qa(r,"nextSibling")},prev:function(r){return qa(r,"previousSibling")},nextAll:function(r){return Jr(r,"nextSibling")},prevAll:function(r){return Jr(r,"previousSibling")},nextUntil:function(r,t,e){return Jr(r,"nextSibling",e)},prevUntil:function(r,t,e){return Jr(r,"previousSibling",e)},siblings:function(r){return za((r.parentNode||{}).firstChild,r)},children:function(r){return za(r.firstChild)},contents:function(r){return Je(r,"iframe")?r.contentDocument:(Je(r,"template")&&(r=r.content||r),P.merge([],r.childNodes))}},(function(r,t){P.fn[r]=function(e,n){var i=P.map(this,t,e);return r.slice(-5)!=="Until"&&(n=e),n&&typeof n=="string"&&(i=P.filter(n,i)),this.length>1&&(If[r]||P.uniqueSort(i),Lf.test(r)&&i.reverse()),this.pushStack(i)}}));var Lr=/[^\x20\t\r\n\f]+/g;function tn(r){return r}function yi(r){throw r}function ja(r,t,e,n){var i;try{r&&Yt(i=r.promise)?i.call(r).done(t).fail(e):r&&Yt(i=r.then)?i.call(r,t,e):t.apply(void 0,[r].slice(n))}catch(s){e.apply(void 0,[s])}}P.Callbacks=function(r){r=typeof r=="string"?(function(c){var u={};return P.each(c.match(Lr)||[],(function(p,d){u[d]=!0})),u})(r):P.extend({},r);var t,e,n,i,s=[],o=[],a=-1,l=function(){for(i=i||r.once,n=t=!0;o.length;a=-1)for(e=o.shift();++a<s.length;)s[a].apply(e[0],e[1])===!1&&r.stopOnFalse&&(a=s.length,e=!1);r.memory||(e=!1),t=!1,i&&(s=e?[]:"")},h={add:function(){return s&&(e&&!t&&(a=s.length-1,o.push(e)),(function c(u){P.each(u,(function(p,d){Yt(d)?r.unique&&h.has(d)||s.push(d):d&&d.length&&Kr(d)!=="string"&&c(d)}))})(arguments),e&&!t&&l()),this},remove:function(){return P.each(arguments,(function(c,u){for(var p;(p=P.inArray(u,s,p))>-1;)s.splice(p,1),p<=a&&a--})),this},has:function(c){return c?P.inArray(c,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return i=o=[],s=e="",this},disabled:function(){return!s},lock:function(){return i=o=[],e||t||(s=e=""),this},locked:function(){return!!i},fireWith:function(c,u){return i||(u=[c,(u=u||[]).slice?u.slice():u],o.push(u),t||l()),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!n}};return h},P.extend({Deferred:function(r){var t=[["notify","progress",P.Callbacks("memory"),P.Callbacks("memory"),2],["resolve","done",P.Callbacks("once memory"),P.Callbacks("once memory"),0,"resolved"],["reject","fail",P.Callbacks("once memory"),P.Callbacks("once memory"),1,"rejected"]],e="pending",n={state:function(){return e},always:function(){return i.done(arguments).fail(arguments),this},catch:function(s){return n.then(null,s)},pipe:function(){var s=arguments;return P.Deferred((function(o){P.each(t,(function(a,l){var h=Yt(s[l[4]])&&s[l[4]];i[l[1]]((function(){var c=h&&h.apply(this,arguments);c&&Yt(c.promise)?c.promise().progress(o.notify).done(o.resolve).fail(o.reject):o[l[0]+"With"](this,h?[c]:arguments)}))})),s=null})).promise()},then:function(s,o,a){var l=0;function h(c,u,p,d){return function(){var w=this,m=arguments,g=function(){var b,v;if(!(c<l)){if((b=p.apply(w,m))===u.promise())throw new TypeError("Thenable self-resolution");v=b&&(typeof b=="object"||typeof b=="function")&&b.then,Yt(v)?d?v.call(b,h(l,u,tn,d),h(l,u,yi,d)):(l++,v.call(b,h(l,u,tn,d),h(l,u,yi,d),h(l,u,tn,u.notifyWith))):(p!==tn&&(w=void 0,m=[b]),(d||u.resolveWith)(w,m))}},f=d?g:function(){try{g()}catch(b){P.Deferred.exceptionHook&&P.Deferred.exceptionHook(b,f.stackTrace),c+1>=l&&(p!==yi&&(w=void 0,m=[b]),u.rejectWith(w,m))}};c?f():(P.Deferred.getStackHook&&(f.stackTrace=P.Deferred.getStackHook()),window.setTimeout(f))}}return P.Deferred((function(c){t[0][3].add(h(0,c,Yt(a)?a:tn,c.notifyWith)),t[1][3].add(h(0,c,Yt(s)?s:tn)),t[2][3].add(h(0,c,Yt(o)?o:yi))})).promise()},promise:function(s){return s!=null?P.extend(s,n):n}},i={};return P.each(t,(function(s,o){var a=o[2],l=o[5];n[o[1]]=a.add,l&&a.add((function(){e=l}),t[3-s][2].disable,t[3-s][3].disable,t[0][2].lock,t[0][3].lock),a.add(o[3].fire),i[o[0]]=function(){return i[o[0]+"With"](this===i?void 0:this,arguments),this},i[o[0]+"With"]=a.fireWith})),n.promise(i),r&&r.call(i,i),i},when:function(r){var t=arguments.length,e=t,n=Array(e),i=Ke.call(arguments),s=P.Deferred(),o=function(a){return function(l){n[a]=this,i[a]=arguments.length>1?Ke.call(arguments):l,--t||s.resolveWith(n,i)}};if(t<=1&&(ja(r,s.done(o(e)).resolve,s.reject,!t),s.state()==="pending"||Yt(i[e]&&i[e].then)))return s.then();for(;e--;)ja(i[e],o(e),s.reject);return s.promise()}});var Nf=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;P.Deferred.exceptionHook=function(r,t){window.console&&window.console.warn&&r&&Nf.test(r.name)&&window.console.warn("jQuery.Deferred exception: "+r.message,r.stack,t)},P.readyException=function(r){window.setTimeout((function(){throw r}))};var Ts=P.Deferred();function _i(){Dt.removeEventListener("DOMContentLoaded",_i),window.removeEventListener("load",_i),P.ready()}P.fn.ready=function(r){return Ts.then(r).catch((function(t){P.readyException(t)})),this},P.extend({isReady:!1,readyWait:1,ready:function(r){(r===!0?--P.readyWait:P.isReady)||(P.isReady=!0,r!==!0&&--P.readyWait>0||Ts.resolveWith(Dt,[P]))}}),P.ready.then=Ts.then,Dt.readyState==="complete"||Dt.readyState!=="loading"&&!Dt.documentElement.doScroll?window.setTimeout(P.ready):(Dt.addEventListener("DOMContentLoaded",_i),window.addEventListener("load",_i));var ur=function(r,t,e,n,i,s,o){var a=0,l=r.length,h=e==null;if(Kr(e)==="object")for(a in i=!0,e)ur(r,t,a,e[a],!0,s,o);else if(n!==void 0&&(i=!0,Yt(n)||(o=!0),h&&(o?(t.call(r,n),t=null):(h=t,t=function(c,u,p){return h.call(P(c),p)})),t))for(;a<l;a++)t(r[a],e,o?n:n.call(r[a],a,t(r[a],e)));return i?r:h?t.call(r):l?t(r[0],e):s},Bf=/^-ms-/,Ff=/-([a-z])/g;function Of(r,t){return t.toUpperCase()}function dr(r){return r.replace(Bf,"ms-").replace(Ff,Of)}
13var xi=function(r){return r.nodeType===1||r.nodeType===9||!+r.nodeType};function Ln(){this.expando=P.expando+Ln.uid++}Ln.uid=1,Ln.prototype={cache:function(r){var t=r[this.expando];return t||(t={},xi(r)&&(r.nodeType?r[this.expando]=t:Object.defineProperty(r,this.expando,{value:t,configurable:!0}))),t},set:function(r,t,e){var n,i=this.cache(r);if(typeof t=="string")i[dr(t)]=e;else for(n in t)i[dr(n)]=t[n];return i},get:function(r,t){return t===void 0?this.cache(r):r[this.expando]&&r[this.expando][dr(t)]},access:function(r,t,e){return t===void 0||t&&typeof t=="string"&&e===void 0?this.get(r,t):(this.set(r,t,e),e!==void 0?e:t)},remove:function(r,t){var e,n=r[this.expando];if(n!==void 0){if(t!==void 0)for(e=(t=Array.isArray(t)?t.map(dr):(t=dr(t))in n?[t]:t.match(Lr)||[]).length;e--;)delete n[t[e]];(t===void 0||P.isEmptyObject(n))&&(r.nodeType?r[this.expando]=void 0:delete r[this.expando])}},hasData:function(r){var t=r[this.expando];return t!==void 0&&!P.isEmptyObject(t)}};var Vt=new Ln,Le=new Ln,Df=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Pf=/[A-Z]/g;function Wa(r,t,e){var n;if(e===void 0&&r.nodeType===1)if(n="data-"+t.replace(Pf,"-$&").toLowerCase(),typeof(e=r.getAttribute(n))=="string"){try{e=(function(i){return i==="true"||i!=="false"&&(i==="null"?null:i===+i+""?+i:Df.test(i)?JSON.parse(i):i)})(e)}catch{}Le.set(r,t,e)}else e=void 0;return e}P.extend({hasData:function(r){return Le.hasData(r)||Vt.hasData(r)},data:function(r,t,e){return Le.access(r,t,e)},removeData:function(r,t){Le.remove(r,t)},_data:function(r,t,e){return Vt.access(r,t,e)},_removeData:function(r,t){Vt.remove(r,t)}}),P.fn.extend({data:function(r,t){var e,n,i,s=this[0],o=s&&s.attributes;if(r===void 0){if(this.length&&(i=Le.get(s),s.nodeType===1&&!Vt.get(s,"hasDataAttrs"))){for(e=o.length;e--;)o[e]&&(n=o[e].name).indexOf("data-")===0&&(n=dr(n.slice(5)),Wa(s,n,i[n]));Vt.set(s,"hasDataAttrs",!0)}return i}return typeof r=="object"?this.each((function(){Le.set(this,r)})):ur(this,(function(a){var l;if(s&&a===void 0)return(l=Le.get(s,r))!==void 0||(l=Wa(s,r))!==void 0?l:void 0;this.each((function(){Le.set(this,r,a)}))}),null,t,arguments.length>1,null,!0)},removeData:function(r){return this.each((function(){Le.remove(this,r)}))}}),P.extend({queue:function(r,t,e){var n;if(r)return t=(t||"fx")+"queue",n=Vt.get(r,t),e&&(!n||Array.isArray(e)?n=Vt.access(r,t,P.makeArray(e)):n.push(e)),n||[]},dequeue:function(r,t){t=t||"fx";var e=P.queue(r,t),n=e.length,i=e.shift(),s=P._queueHooks(r,t);i==="inprogress"&&(i=e.shift(),n--),i&&(t==="fx"&&e.unshift("inprogress"),delete s.stop,i.call(r,(function(){P.dequeue(r,t)}),s)),!n&&s&&s.empty.fire()},_queueHooks:function(r,t){var e=t+"queueHooks";return Vt.get(r,e)||Vt.access(r,e,{empty:P.Callbacks("once memory").add((function(){Vt.remove(r,[t+"queue",e])}))})}}),P.fn.extend({queue:function(r,t){var e=2;return typeof r!="string"&&(t=r,r="fx",e--),arguments.length<e?P.queue(this[0],r):t===void 0?this:this.each((function(){var n=P.queue(this,r,t);P._queueHooks(this,r),r==="fx"&&n[0]!=="inprogress"&&P.dequeue(this,r)}))},dequeue:function(r){return this.each((function(){P.dequeue(this,r)}))},clearQueue:function(r){return this.queue(r||"fx",[])},promise:function(r,t){var e,n=1,i=P.Deferred(),s=this,o=this.length,a=function(){--n||i.resolveWith(s,[s])};for(typeof r!="string"&&(t=r,r=void 0),r=r||"fx";o--;)(e=Vt.get(s[o],r+"queueHooks"))&&e.empty&&(n++,e.empty.add(a));return a(),i.promise(t)}});var $a=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ki=new RegExp("^(?:([+-])=|)("+$a+")([a-z%]*)$","i"),_r=["Top","Right","Bottom","Left"],Ga=function(r,t){return(r=r).style.display==="none"||r.style.display===""&&P.contains(r.ownerDocument,r)&&P.css(r,"display")==="none"},Za=function(r,t,e,n){var i,s,o={};for(s in t)o[s]=r.style[s],r.style[s]=t[s];for(s in i=e.apply(r,[]),t)r.style[s]=o[s];return i},Qa={};function zf(r){var t,e=r.ownerDocument,n=r.nodeName,i=Qa[n];return i||(t=e.body.appendChild(e.createElement(n)),i=P.css(t,"display"),t.parentNode.removeChild(t),i==="none"&&(i="block"),Qa[n]=i,i)}function Xa(r,t){for(var e,n,i=[],s=0,o=r.length;s<o;s++)(n=r[s]).style&&(e=n.style.display,t?(e==="none"&&(i[s]=Vt.get(n,"display")||null,i[s]||(n.style.display="")),n.style.display===""&&Ga(n)&&(i[s]=zf(n))):e!=="none"&&(i[s]="none",Vt.set(n,"display",e)));for(s=0;s<o;s++)i[s]!=null&&(r[s].style.display=i[s]);return r}P.fn.extend({show:function(){return Xa(this,!0)},hide:function(){return Xa(this)},toggle:function(r){return typeof r=="boolean"?r?this.show():this.hide():this.each((function(){Ga(this)?P(this).show():P(this).hide()}))}});var Ya=/^(?:checkbox|radio)$/i,Ka=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ja=/^$|^module$|\/(?:java|ecma)script/i,qe={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Ie(r,t){var e;return e=r.getElementsByTagName!==void 0?r.getElementsByTagName(t||"*"):r.querySelectorAll!==void 0?r.querySelectorAll(t||"*"):[],t===void 0||t&&Je(r,t)?P.merge([r],e):e}function Ms(r,t){for(var e=0,n=r.length;e<n;e++)Vt.set(r[e],"globalEval",!t||Vt.get(t[e],"globalEval"))}qe.optgroup=qe.option,qe.tbody=qe.tfoot=qe.colgroup=qe.caption=qe.thead,qe.th=qe.td;var Hf=/<|&#?\w+;/;function tl(r,t,e,n,i){for(var s,o,a,l,h,c,u=t.createDocumentFragment(),p=[],d=0,w=r.length;d<w;d++)if((s=r[d])||s===0)if(Kr(s)==="object")P.merge(p,s.nodeType?[s]:s);else if(Hf.test(s)){for(o=o||u.appendChild(t.createElement("div")),a=(Ka.exec(s)||["",""])[1].toLowerCase(),l=qe[a]||qe._default,o.innerHTML=l[1]+P.htmlPrefilter(s)+l[2],c=l[0];c--;)o=o.lastChild;P.merge(p,o.childNodes),(o=u.firstChild).textContent=""}else p.push(t.createTextNode(s));for(u.textContent="",d=0;s=p[d++];)if(n&&P.inArray(s,n)>-1)i&&i.push(s);else if(h=P.contains(s.ownerDocument,s),o=Ie(u.appendChild(s),"script"),h&&Ms(o),e)for(c=0;s=o[c++];)Ja.test(s.type||"")&&e.push(s);return u}(function(){var r=Dt.createDocumentFragment().appendChild(Dt.createElement("div")),t=Dt.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),r.appendChild(t),he.checkClone
13=r.cloneNode(!0).cloneNode(!0).lastChild.checked,r.innerHTML="<textarea>x</textarea>",he.noCloneChecked=!!r.cloneNode(!0).lastChild.defaultValue})();var Ci=Dt.documentElement,Uf=/^key/,Vf=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,el=/^([^.]*)(?:\.(.+)|)/;function Si(){return!0}function en(){return!1}function rl(){try{return Dt.activeElement}catch{}}function Rs(r,t,e,n,i,s){var o,a;if(typeof t=="object"){for(a in typeof e!="string"&&(n=n||e,e=void 0),t)Rs(r,a,e,n,t[a],s);return r}if(n==null&&i==null?(i=e,n=e=void 0):i==null&&(typeof e=="string"?(i=n,n=void 0):(i=n,n=e,e=void 0)),i===!1)i=en;else if(!i)return r;return s===1&&(o=i,i=function(l){return P().off(l),o.apply(this,arguments)},i.guid=o.guid||(o.guid=P.guid++)),r.each((function(){P.event.add(this,t,i,n,e)}))}P.event={global:{},add:function(r,t,e,n,i){var s,o,a,l,h,c,u,p,d,w,m,g=Vt.get(r);if(g)for(e.handler&&(e=(s=e).handler,i=s.selector),i&&P.find.matchesSelector(Ci,i),e.guid||(e.guid=P.guid++),(l=g.events)||(l=g.events={}),(o=g.handle)||(o=g.handle=function(f){return P!==void 0&&P.event.triggered!==f.type?P.event.dispatch.apply(r,arguments):void 0}),h=(t=(t||"").match(Lr)||[""]).length;h--;)d=m=(a=el.exec(t[h])||[])[1],w=(a[2]||"").split(".").sort(),d&&(u=P.event.special[d]||{},d=(i?u.delegateType:u.bindType)||d,u=P.event.special[d]||{},c=P.extend({type:d,origType:m,data:n,handler:e,guid:e.guid,selector:i,needsContext:i&&P.expr.match.needsContext.test(i),namespace:w.join(".")},s),(p=l[d])||((p=l[d]=[]).delegateCount=0,u.setup&&u.setup.call(r,n,w,o)!==!1||r.addEventListener&&r.addEventListener(d,o)),u.add&&(u.add.call(r,c),c.handler.guid||(c.handler.guid=e.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),P.event.global[d]=!0)},remove:function(r,t,e,n,i){var s,o,a,l,h,c,u,p,d,w,m,g=Vt.hasData(r)&&Vt.get(r);if(g&&(l=g.events)){for(h=(t=(t||"").match(Lr)||[""]).length;h--;)if(d=m=(a=el.exec(t[h])||[])[1],w=(a[2]||"").split(".").sort(),d){for(u=P.event.special[d]||{},p=l[d=(n?u.delegateType:u.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+w.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=p.length;s--;)c=p[s],!i&&m!==c.origType||e&&e.guid!==c.guid||a&&!a.test(c.namespace)||n&&n!==c.selector&&(n!=="**"||!c.selector)||(p.splice(s,1),c.selector&&p.delegateCount--,u.remove&&u.remove.call(r,c));o&&!p.length&&(u.teardown&&u.teardown.call(r,w,g.handle)!==!1||P.removeEvent(r,d,g.handle),delete l[d])}else for(d in l)P.event.remove(r,d+t[h],e,n,!0);P.isEmptyObject(l)&&Vt.remove(r,"handle events")}},dispatch:function(r){var t,e,n,i,s,o,a=P.event.fix(r),l=new Array(arguments.length),h=(Vt.get(this,"events")||{})[a.type]||[],c=P.event.special[a.type]||{};for(l[0]=a,t=1;t<arguments.length;t++)l[t]=arguments[t];if(a.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,a)!==!1){for(o=P.event.handlers.call(this,a,h),t=0;(i=o[t++])&&!a.isPropagationStopped();)for(a.currentTarget=i.elem,e=0;(s=i.handlers[e++])&&!a.isImmediatePropagationStopped();)a.rnamespace&&!a.rnamespace.test(s.namespace)||(a.handleObj=s,a.data=s.data,(n=((P.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,l))!==void 0&&(a.result=n)===!1&&(a.preventDefault(),a.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,a),a.result}},handlers:function(r,t){var e,n,i,s,o,a=[],l=t.delegateCount,h=r.target;if(l&&h.nodeType&&!(r.type==="click"&&r.button>=1)){for(;h!==this;h=h.parentNode||this)if(h.nodeType===1&&(r.type!=="click"||h.disabled!==!0)){for(s=[],o={},e=0;e<l;e++)o[i=(n=t[e]).selector+" "]===void 0&&(o[i]=n.needsContext?P(i,this).index(h)>-1:P.find(i,this,null,[h]).length),o[i]&&s.push(n);s.length&&a.push({elem:h,handlers:s})}}return h=this,l<t.length&&a.push({elem:h,handlers:t.slice(l)}),a},addProp:function(r,t){Object.defineProperty(P.Event.prototype,r,{enumerable:!0,configurable:!0,get:Yt(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[r]},set:function(e){Object.defineProperty(this,r,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(r){return r[P.expando]?r:new P.Event(r)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==rl()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===rl()&&this.blur)return this.blur(),!1},delegateType:"focusout"}
13,click:{trigger:function(){if(this.type==="checkbox"&&this.click&&Je(this,"input"))return this.click(),!1},_default:function(r){return Je(r.target,"a")}},beforeunload:{postDispatch:function(r){r.result!==void 0&&r.originalEvent&&(r.originalEvent.returnValue=r.result)}}}},P.removeEvent=function(r,t,e){r.removeEventListener&&r.removeEventListener(t,e)},P.Event=function(r,t){if(!(this instanceof P.Event))return new P.Event(r,t);r&&r.type?(this.originalEvent=r,this.type=r.type,this.isDefaultPrevented=r.defaultPrevented||r.defaultPrevented===void 0&&r.returnValue===!1?Si:en,this.target=r.target&&r.target.nodeType===3?r.target.parentNode:r.target,this.currentTarget=r.currentTarget,this.relatedTarget=r.relatedTarget):this.type=r,t&&P.extend(this,t),this.timeStamp=r&&r.timeStamp||Date.now(),this[P.expando]=!0},P.Event.prototype={constructor:P.Event,isDefaultPrevented:en,isPropagationStopped:en,isImmediatePropagationStopped:en,isSimulated:!1,preventDefault:function(){var r=this.originalEvent;this.isDefaultPrevented=Si,r&&!this.isSimulated&&r.preventDefault()},stopPropagation:function(){var r=this.originalEvent;this.isPropagationStopped=Si,r&&!this.isSimulated&&r.stopPropagation()},stopImmediatePropagation:function(){var r=this.originalEvent;this.isImmediatePropagationStopped=Si,r&&!this.isSimulated&&r.stopImmediatePropagation(),this.stopPropagation()}},P.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(r){var t=r.button;return r.which==null&&Uf.test(r.type)?r.charCode!=null?r.charCode:r.keyCode:!r.which&&t!==void 0&&Vf.test(r.type)?1&t?1:2&t?3:4&t?2:0:r.which}},P.event.addProp),P.each({mouseenter:"mouseover",mouseleave:"mou
13seout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(r,t){P.event.special[r]={delegateType:t,bindType:t,handle:function(e){var n,i=e.relatedTarget,s=e.handleObj;return i&&(i===this||P.contains(this,i))||(e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t),n}}})),P.fn.extend({on:function(r,t,e,n){return Rs(this,r,t,e,n)},one:function(r,t,e,n){return Rs(this,r,t,e,n,1)},off:function(r,t,e){var n,i;if(r&&r.preventDefault&&r.handleObj)return n=r.handleObj,P(r.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if(typeof r=="object"){for(i in r)this.off(i,t,r[i]);return this}return t!==!1&&typeof t!="function"||(e=t,t=void 0),e===!1&&(e=en),this.each((function(){P.event.remove(this,r,e,t)}))}});var qf=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,jf=/<script|<style|<link/i,Wf=/checked\s*(?:[^=]|=\s*.checked.)/i,$f=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function nl(r,t){return Je(r,"table")&&Je(t.nodeType!==11?t:t.firstChild,"tr")&&P(r).children("tbody")[0]||r}function Gf(r){return r.type=(r.getAttribute("type")!==null)+"/"+r.type,r}function Zf(r){return(r.type||"").slice(0,5)==="true/"?r.type=r.type.slice(5):r.removeAttribute("type"),r}function il(r,t){var e,n,i,s,o,a,l,h;if(t.nodeType===1){if(Vt.hasData(r)&&(s=Vt.access(r),o=Vt.set(t,s),h=s.events))for(i in delete o.handle,o.events={},h)for(e=0,n=h[i].length;e<n;e++)P.event.add(t,i,h[i][e]);Le.hasData(r)&&(a=Le.access(r),l=P.extend({},a),Le.set(t,l))}}function Qf(r,t){var e=t.nodeName.toLowerCase();e==="input"&&Ya.test(r.type)?t.checked=r.checked:e!=="input"&&e!=="textarea"||(t.defaultValue=r.defaultValue)}function rn(r,t,e,n){t=mi.apply([],t);var i,s,o,a,l,h,c=0,u=r.length,p=u-1,d=t[0],w=Yt(d);if(w||u>1&&typeof d=="string"&&!he.checkClone&&Wf.test(d))return r.each((function(m){var g=r.eq(m);w&&(t[0]=d.call(this,m,g.html())),rn(g,t,e,n)}));if(u&&(s=(i=tl(t,r[0].ownerDocument,!1,r,n)).firstChild,i.childNodes.length===1&&(i=s),s||n)){for(a=(o=P.map(Ie(i,"script"),Gf)).length;c<u;c++)l=i,c!==p&&(l=P.clone(l,!0,!0),a&&P.merge(o,Ie(l,"script"))),e.call(r[c],l,c);if(a)for(h=o[o.length-1].ownerDocument,P.map(o,Zf),c=0;c<a;c++)l=o[c],Ja.test(l.type||"")&&!Vt.access(l,"globalEval")&&P.contains(h,l)&&(l.src&&(l.type||"").toLowerCase()!=="module"?P._evalUrl&&P._evalUrl(l.src):Da(l.textContent.replace($f,""),h,l))}return r}function sl(r,t,e){for(var n,i=t?P.filter(t,r):r,s=0;(n=i[s])!=null;s++)e||n.nodeType!==1||P.cleanData(Ie(n)),n.parentNode&&(e&&P.contains(n.ownerDocument,n)&&Ms(Ie(n,"script")),n.parentNode.removeChild(n));return r}P.extend({htmlPrefilter:function(r){return r.replace(qf,"<$1></$2>")},clone:function(r,t,e){var n,i,s,o,a=r.cloneNode(!0),l=P.contains(r.ownerDocument,r);if(!(he.noCloneChecked||r.nodeType!==1&&r.nodeType!==11||P.isXMLDoc(r)))for(o=Ie(a),n=0,i=(s=Ie(r)).length;n<i;n++)Qf(s[n],o[n]);if(t)if(e)for(s=s||Ie(r),o=o||Ie(a),n=0,i=s.length;n<i;n++)il(s[n],o[n]);else il(r,a);return(o=Ie(a,"script")).length>0&&Ms(o,!l&&Ie(r,"script")),a},cleanData:function(r){for(var t,e,n,i=P.event.special,s=0;(e=r[s])!==void 0;s++)if(xi(e)){if(t=e[Vt.expando]){if(t.events)for(n in t.events)i[n]?P.event.remove(e,n):P.removeEvent(e,n,t.handle);e[Vt.expando]=void 0}e[Le.expando]&&(e[Le.expando]=void 0)}}}),P.fn.extend({detach:function(r){return sl(this,r,!0)},remove:function(r){return sl(this,r)},text:function(r){return ur(this,(function(t){return t===void 0?P.text(this):this.empty().each((function(){this.nodeType!==1&&this.nodeType!==11&&this.nodeType!==9||(this.textContent=t)}))}),null,r,arguments.length)},append:function(){return rn(this,arguments,(function(r){this.nodeType!==1&&this.nodeType!==11&&this.nodeType!==9||nl(this,r).appendChild(r)}))},prepend:function(){return rn(this,arguments,(function(r){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=nl(this,r);t.insertBefore(r,t.firstChild)}}))},before:function(){return rn(this,arguments,(function(r){this.parentNode&&this.parentNode.insertBefore(r,this)}))},after:function(){return rn(this,arguments,(function(r){this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling)}))},empty:function(){for(var r,t=0;(r=this[t])!=null;t++)r.nodeType===1&&(P.cleanData(Ie(r,!1)),r.textContent="");return this},clone:function(r,t){return r=r!=null&&r,t=t??r,this.map((function(){return P.clone(this,r,t)}))},html:function(r){return ur(this,(function(t){var e=this[0]||{},n=0,i=this.length;if(t===void 0&&e.nodeType===1)return e.innerHTML;if(typeof t=="string"&&!jf.test(t)&&!qe[(Ka.exec(t)||["",""])[1].toLowerCase()]){t=P.htmlPrefilter(t);try{for(;n<i;n++)(e=this[n]||{}
13).nodeType===1&&(P.cleanData(Ie(e,!1)),e.innerHTML=t);e=0}catch{}}e&&this.empty().append(t)}),null,r,arguments.length)},replaceWith:function(){var r=[];return rn(this,arguments,(function(t){var e=this.parentNode;P.inArray(this,r)<0&&(P.cleanData(Ie(this)),e&&e.replaceChild(t,this))}),r)}}),P.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(r,t){P.fn[r]=function(e){for(var n,i=[],s=P(e),o=s.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),P(s[a])[t](n),Rn.apply(i,n.get());return this.pushStack(i)}}));var Ls=new RegExp("^("+$a+")(?!px)[a-z%]+$","i"),Ai=function(r){var t=r.ownerDocument.defaultView;return t&&t.opener||(t=window),t.getComputedStyle(r)},Xf=new RegExp(_r.join("|"),"i");function In(r,t,e){var n,i,s,o,a=r.style;return(e=e||Ai(r))&&((o=e.getPropertyValue(t)||e[t])!==""||P.contains(r.ownerDocument,r)||(o=P.style(r,t)),!he.pixelBoxStyles()&&Ls.test(o)&&Xf.test(t)&&(n=a.width,i=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=o,o=e.width,a.width=n,a.minWidth=i,a.maxWidth=s)),o!==void 0?o+"":o}function ol(r,t){return{get:function(){if(!r())return(this.get=t).apply(this,arguments);delete this.get}}}(function(){function r(){if(l){a.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",Ci.appendChild(a).appendChild(l);var h=window.getComputedStyle(l);e=h.top!=="1%",o=t(h.marginLeft)===12,l.style.right="60%",s=t(h.right)===36,n=t(h.width)===36,l.style.position="absolute",i=l.offsetWidth===36||"absolute",Ci.removeChild(a),l=null}}function t(h){return Math.round(parseFloat(h))}var e,n,i,s,o,a=Dt.createElement("div"),l=Dt.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",he.clearCloneStyle=l.style.backgroundClip==="content-box",P.extend(he,{boxSizingReliable:function(){return r(),n},pixelBoxStyles:function(){return r(),s},pixelPosition:function(){return r(),e},reliableMarginLeft:function(){return r(),o},scrollboxSize:function(){return r(),i}}))})();var nn,al,Yf=/^(none|table(?!-c[ea]).+)/,ll=/^--/,Kf={position:"absolute",visibility:"hidden",display:"block"},hl={letterSpacing:"0",fontWeight:"400"},cl=["Webkit","Moz","ms"],ul=Dt.createElement("div").style;function dl(r){var t=P.cssProps[r];return t||(t=P.cssProps[r]=(function(e){if(e in ul)return e;for(var n=e[0].toUpperCase()+e.slice(1),i=cl.length;i--;)if((e=cl[i]+n)in ul)return e})(r)||r),t}function fl(r,t,e){var n=ki.exec(t);return n?Math.max(0,n[2]-(e||0))+(n[3]||"px"):t}function Is(r,t,e,n,i,s){var o=t==="width"?1:0,a=0,l=0;if(e===(n?"border":"content"))return 0;for(;o<4;o+=2)e==="margin"&&(l+=P.css(r,e+_r[o],!0,i)),n?(e==="content"&&(l-=P.css(r,"padding"+_r[o],!0,i)),e!=="margin"&&(l-=P.css(r,"border"+_r[o]+"Width",!0,i))):(l+=P.css(r,"padding"+_r[o],!0,i),e!=="padding"?l+=P.css(r,"border"+_r[o]+"Width",!0,i):a+=P.css(r,"border"+_r[o]+"Width",!0,i));return!n&&s>=0&&(l+=Math.max(0,Math.ceil(r["offset"+t[0].toUpperCase()+t.slice(1)]-s-l-a-.5))),l}function pl(r,t,e){var n=Ai(r),i=In(r,t,n),s=P.css(r,"boxSizing",!1,n)==="border-box",o=s;if(Ls.test(i)){if(!e)return i;i="auto"}return o=o&&(he.boxSizingReliable()||i===r.style[t]),(i==="auto"||!parseFloat(i)&&P.css(r,"display",!1,n)==="inline")&&(i=r["offset"+t[0].toUpperCase()+t.slice(1)],o=!0),(i=parseFloat(i)||0)+Is(r,t,e||(s?"border":"content"),o,n,i)+"px"}P.extend({cssHooks:{opacity:{get:function(r,t){if(t){var e=In(r,"opacity");return e===""?"1":e}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(r,t,e,n){if(r&&r.nodeType!==3&&r.nodeType!==8&&r.style){var i,s,o,a=dr(t),l=ll.test(t),h=r.style;if(l||(t=dl(a)),o=P.cssHooks[t]||P.cssHooks[a],e===void 0)return o&&"get"in o&&(i=o.get(r,!1,n))!==void 0?i:h[t];(s=typeof e)=="string"&&(i=ki.exec(e))&&i[1]&&(e=(function(c,u,p,d){var w,m,g=2
130,f=function(){return P.css(c,u,"")},b=f(),v=p&&p[3]||(P.cssNumber[u]?"":"px"),_=(P.cssNumber[u]||v!=="px"&&+b)&&ki.exec(P.css(c,u));if(_&&_[3]!==v){for(b/=2,v=v||_[3],_=+b||1;g--;)P.style(c,u,_+v),(1-m)*(1-(m=f()/b||.5))<=0&&(g=0),_/=m;_*=2,P.style(c,u,_+v),p=p||[]}return p&&(_=+_||+b||0,w=p[1]?_+(p[1]+1)*p[2]:+p[2]),w})(r,t,i),s="number"),e!=null&&e==e&&(s==="number"&&(e+=i&&i[3]||(P.cssNumber[a]?"":"px")),he.clearCloneStyle||e!==""||t.indexOf("background")!==0||(h[t]="inherit"),o&&"set"in o&&(e=o.set(r,e,n))===void 0||(l?h.setProperty(t,e):h[t]=e))}},css:function(r,t,e,n){var i,s,o,a=dr(t);return ll.test(t)||(t=dl(a)),(o=P.cssHooks[t]||P.cssHooks[a])&&"get"in o&&(i=o.get(r,!0,e)),i===void 0&&(i=In(r,t,n)),i==="normal"&&t in hl&&(i=hl[t]),e===""||e?(s=parseFloat(i),e===!0||isFinite(s)?s||0:i):i}}),P.each(["height","width"],(function(r,t){P.cssHooks[t]={get:function(e,n,i){if(n)return!Yf.test(P.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?pl(e,t,i):Za(e,Kf,(function(){return pl(e,t,i)}))},set:function(e,n,i){var s,o=Ai(e),a=P.css(e,"boxSizing",!1,o)==="border-box",l=i&&Is(e,t,i,a,o);return a&&he.scrollboxSize()===o.position&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Is(e,t,"border",!1,o)-.5)),l&&(s=ki.exec(n))&&(s[3]||"px")!=="px"&&(e.style[t]=n,n=P.css(e,t)),fl(0,n,l)}}})),P.cssHooks.marginLeft=ol(he.reliableMarginLeft,(function(r,t){if(t)return(parseFloat(In(r,"marginLeft"))||r.getBoundingClientRect().left-Za(r,{marginLeft:0},(function(){return r.getBoundingClientRect().left})))+"px"})),P.each({margin:"",padding:"",border:"Width"},(function(r,t){P.cssHooks[r+t]={expand:function(e){for(var n=0,i={},s=typeof e=="string"?e.split(" "):[e];n<4;n++)i[r+_r[n]+t]=s[n]||s[n-2]||s[0];return i}},r!=="margin"&&(P.cssHooks[r+t].set=fl)})),P.fn.extend({css:function(r,t){return ur(this,(function(e,n,i){var s,o,a={},l=0;if(Array.isArray(n)){for(s=Ai(e),o=n.length;l<o;l++)a[n[l]]=P.css(e,n[l],!1,s);return a}return i!==void 0?P.style(e,n,i):P.css(e,n)}),r,t,arguments.length>1)}}),P.fn.delay=function(r,t){return r=P.fx&&P.fx.speeds[r]||r,t=t||"fx",this.queue(t,(function(e,n){var i=window.setTimeout(e,r);n.stop=function(){window.clearTimeout(i)}}))},nn=Dt.createElement("input"),al=Dt.createElement("select").appendChild(Dt.createElement("option")),nn.type="checkbox",he.checkOn=nn.value!=="",he.optSelected=al.selected,(nn=Dt.createElement("input")).value="t",nn.type="radio",he.radioValue=nn.value==="t";var gl,Nn=P.expr.attrHandle;P.fn.extend({attr:function(r,t){return ur(this,P.attr,r,t,arguments.length>1)},removeAttr:function(r){return this.each((function(){P.removeAttr(this,r)}))}}),P.extend({attr:function(r,t,e){var n,i,s=r.nodeType;if(s!==3&&s!==8&&s!==2)return r.getAttribute===void 0?P.prop(r,t,e):(s===1&&P.isXMLDoc(r)||(i=P.attrHooks[t.toLowerCase()]||(P.expr.match.bool.test(t)?gl:void 0)),e!==void 0?e===null?void P.removeAttr(r,t):i&&"set"in i&&(n=i.set(r,e,t))!==void 0?n:(r.setAttribute(t,e+""),e):i&&"get"in i&&(n=i.get(r,t))!==null?n:(n=P.find.attr(r,t))==null?void 0:n)},attrHooks:{type:{set:function(r,t){if(!he.radioValue&&t==="radio"&&Je(r,"input")){var e=r.value;return r.setAttribute("type",t),e&&(r.value=e),t}}}},removeAttr:function(r,t){var e,n=0,i=t&&t.match(Lr);if(i&&r.nodeType===1)for(;e=i[n++];)r.removeAttribute(e)}}),gl={set:function(r,t,e){return t===!1?P.removeAttr(r,e):r.setAttribute(e,e),e}},P.each(P.expr.match.bool.source.match(/\w+/g),(function(r,t){var e=Nn[t]||P.find.attr;Nn[t]=function(n,i,s){var o,a,l=i.toLowerCase();return s||(a=Nn[l],Nn[l]=o,o=e(n,i,s)!=null?l:null,Nn[l]=a),o}}));var Jf=/^(?:input|select|textarea|button)$/i,tp=/^(?:a|area)$/i;function sn(r){return(r.match(Lr)||[]).join(" ")}function Ir(r){return r.getAttribute&&r.getAttribute("class")||""}function Ns(r){return Array.isArray(r)?r:typeof r=="string"&&r.match(Lr)||[]}P.fn.extend({prop:function(r,t){return ur(this,P.prop,r,t,arguments.length>1)},removeProp:function(r){return this.each((function(){delete this[P.propFix[r]||r]}))}}),P.extend({prop:function(r,t,e){var n,i,s=r.nodeType;if(s!==3&&s!==8&&s!==2)return s===1&&P.isXMLDoc(r)||(t=P.propFix[t]||t,i=P.propHooks[t]),e!==void 0?i&&"set"in i&&(n=i.set(r,e,t))!==void 0?n:r[t]=e:i&&"get"in i&&(n=i.get(r,t))!==null?n:r[t]},propHooks:{tabIndex:{get:function(r){var t=P.find.attr(r,"tabindex");return t?parseInt(t,10):Jf.test(r.nodeName)||tp.test(r.nodeName)&&r.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),he.optSelected||(P.propHooks.selected={get:function(r){var t=r.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(r){var t=r.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),P.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){P.propFix[this.toLowerCase()]=this})),P.fn.extend({addClass:function(r){var t,e,n,i,s,o,a,l=0;if(Yt(r))return this.each((function(h){P(this).addClass(r.call(this,h,Ir(this)))}));if((t=Ns(r)).length){for(;e=this[l++];)if(i=Ir(e),n=e.nodeType===1&&" "+sn(i)+" "){for(o=0;s=t[o++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");i!==(a=sn(n))&&e.setAttribute("class",a)}}return this},removeClass:function(r){var t,e,n,i,s,o,a,l=0;if(Yt(r))return this.each((function(h){P(this).removeClass(r.call(this,h,Ir(this)))}));if(!arguments.length)return this.attr("class","");if((t=Ns(r)).length){for(;e=this[l++];)if(i=Ir(e),n=e.nodeType===1&&" "+sn(i)+" "){for(o=0;s=t[o++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");i!==(a=sn(n))&&e.setAttribute("class",a)}}return this},toggleClass:function(r,t){var e=typeof r,n=e==="string"||Array.isArray(r);return typeof t=="boolean"&&n?t?this.addClass(r):this.removeClass(r):Yt(r)?this.each((function(i){P(this).toggleClass(r.call(this,i,Ir(this),t),t)})):this.each((function(){var i,s,o,a;if(n)for(s=0,o=P(this),a=Ns(r);i=a[s++];)o.hasClass(i)?o.removeClass(i):o.addClass(i);
13else r!==void 0&&e!=="boolean"||((i=Ir(this))&&Vt.set(this,"__className__",i),this.setAttribute&&this.setAttribute("class",i||r===!1?"":Vt.get(this,"__className__")||""))}))},hasClass:function(r){var t,e,n=0;for(t=" "+r+" ";e=this[n++];)if(e.nodeType===1&&(" "+sn(Ir(e))+" ").indexOf(t)>-1)return!0;return!1}});var ep=/\r/g;P.fn.extend({val:function(r){var t,e,n,i=this[0];return arguments.length?(n=Yt(r),this.each((function(s){var o;this.nodeType===1&&((o=n?r.call(this,s,P(this).val()):r)==null?o="":typeof o=="number"?o+="":Array.isArray(o)&&(o=P.map(o,(function(a){return a==null?"":a+""}))),(t=P.valHooks[this.type]||P.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&t.set(this,o,"value")!==void 0||(this.value=o))}))):i?(t=P.valHooks[i.type]||P.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&(e=t.get(i,"value"))!==void 0?e:typeof(e=i.value)=="string"?e.replace(ep,""):e??"":void 0}}),P.extend({valHooks:{option:{get:function(r){var t=P.find.attr(r,"value");return t??sn(P.text(r))}},select:{get:function(r){var t,e,n,i=r.options,s=r.selectedIndex,o=r.type==="select-one",a=o?null:[],l=o?s+1:i.length;for(n=s<0?l:o?s:0;n<l;n++)if(((e=i[n]).selected||n===s)&&!e.disabled&&(!e.parentNode.disabled||!Je(e.parentNode,"optgroup"))){if(t=P(e).val(),o)return t;a.push(t)}return a}
13,set:function(r,t){for(var e,n,i=r.options,s=P.makeArray(t),o=i.length;o--;)((n=i[o]).selected=P.inArray(P.valHooks.option.get(n),s)>-1)&&(e=!0);return e||(r.selectedIndex=-1),s}}}}),P.each(["radio","checkbox"],(function(){P.valHooks[this]={set:function(r,t){if(Array.isArray(t))return r.checked=P.inArray(P(r).val(),t)>-1}},he.checkOn||(P.valHooks[this].get=function(r){return r.getAttribute("value")===null?"on":r.value})})),he.focusin="onfocusin"in window;var ml=/^(?:focusinfocus|focusoutblur)$/,bl=function(r){r.stopPropagation()};P.extend(P.event,{trigger:function(r,t,e,n){var i,s,o,a,l,h,c,u,p=[e||Dt],d=vi.call(r,"type")?r.type:r,w=vi.call(r,"namespace")?r.namespace.split("."):[];if(s=u=o=e=e||Dt,e.nodeType!==3&&e.nodeType!==8&&!ml.test(d+P.event.triggered)&&(d.indexOf(".")>-1&&(w=d.split("."),d=w.shift(),w.sort()),l=d.indexOf(":")<0&&"on"+d,(r=r[P.expando]?r:new P.Event(d,typeof r=="object"&&r)).isTrigger=n?2:3,r.namespace=w.join("."),r.rnamespace=r.namespace?new RegExp("(^|\\.)"+w.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,r.result=void 0,r.target||(r.target=e),t=t==null?[r]:P.makeArray(t,[r]),c=P.event.special[d]||{}
13,n||!c.trigger||c.trigger.apply(e,t)!==!1)){if(!n&&!c.noBubble&&!Yr(e)){for(a=c.delegateType||d,ml.test(a+d)||(s=s.parentNode);s;s=s.parentNode)p.push(s),o=s;o===(e.ownerDocument||Dt)&&p.push(o.defaultView||o.parentWindow||window)}for(i=0;(s=p[i++])&&!r.isPropagationStopped();)u=s,r.type=i>1?a:c.bindType||d,(h=(Vt.get(s,"events")||{})[r.type]&&Vt.get(s,"handle"))&&h.apply(s,t),(h=l&&s[l])&&h.apply&&xi(s)&&(r.result=h.apply(s,t),r.result===!1&&r.preventDefault());return r.type=d,n||r.isDefaultPrevented()||c._default&&c._default.apply(p.pop(),t)!==!1||!xi(e)||l&&Yt(e[d])&&!Yr(e)&&((o=e[l])&&(e[l]=null),P.event.triggered=d,r.isPropagationStopped()&&u.addEventListener(d,bl),e[d](),r.isPropagationStopped()&&u.removeEventListener(d,bl),P.event.triggered=void 0,o&&(e[l]=o)),r.result}},simulate:function(r,t,e){var n=P.extend(new P.Event,e,{type:r,isSimulated:!0});P.event.trigger(n,null,t)}}),P.fn.extend({trigger:function(r,t){return this.each((function(){P.event.trigger(r,t,this)}))},triggerHandler:function(r,t){var e=this[0];if(e)return P.event.trigger(r,t,e,!0)}}),he.focusin||P.each({focus:"focusin",blur:"focusout"},(function(r,t){var e=function(n){P.event.simulate(t,n.target,P.event.fix(n))};P.event.special[t]={setup:function(){var n=this.ownerDocument||this,i=Vt.access(n,t);i||n.addEventListener(r,e,!0),Vt.access(n,t,(i||0)+1)},teardown:function(){var n=this.ownerDocument||this,i=Vt.access(n,t)-1;i?Vt.access(n,t,i):(n.removeEventListener(r,e,!0),Vt.remove(n,t))}}}));var wl,rp=/\[\]$/,vl=/\r?\n/g,np=/^(?:submit|button|image|reset|file)$/i,ip=/^(?:input|select|textarea|keygen)/i;function Bs(r,t,e,n){var i;if(Array.isArray(t))P.each(t,(function(s,o){e||rp.test(r)?n(r,o):Bs(r+"["+(typeof o=="object"&&o!=null?s:"")+"]",o,e,n)}));else if(e||Kr(t)!=="object")n(r,t);else for(i in t)Bs(r+"["+i+"]",t[i],e,n)}P.param=function(r,t){var e,n=[],i=function(s,o){var a=Yt(o)?o():o;n[n.length]=encodeURIComponent(s)+"="+encodeURIComponent(a??"")};if(Array.isArray(r)||r.jquery&&!P.isPlainObject(r))P.each(r,(function(){i(this.name,this.value)}));else for(e in r)Bs(e,r[e],t,i);return n.join("&")},P.fn.extend({serialize:function(){return P.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var r=P.prop(this,"elements");return r?P.makeArray(r):this})).filter((function(){var r=this.type;return this.name&&!P(this).is(":disabled")&&ip.test(this.nodeName)&&!np.test(r)&&(this.checked||!Ya.test(r))})).map((function(r,t){var e=P(this).val();return e==null?null:Array.isArray(e)?P.map(e,(function(n){return{name:t.name,value:n.replace(vl,`\r 14`)}})):{name:t.name,value:e.replace(vl,`\r 15`)}})).get()}}),P.fn.extend({wrapAll:function(r){var t;return this[0]&&(Yt(r)&&(r=r.call(this[0])),t=P(r,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(r){return Yt(r)?this.each((function(t){P(this).wrapInner(r.call(this,t))})):this.each((function(){var t=P(this),e=t.contents();e.length?e.wrapAll(r):t.append(r)}))},wrap:function(r){var t=Yt(r);return this.each((function(e){P(this).wrapAll(t?r.call(this,e):r)}))},unwrap:function(r){return this.parent(r).not("body").each((function(){P(this).replaceWith(this.childNodes)})),this}}),P.expr.pseudos.hidden=function(r){return!P.expr.pseudos.visible(r)},P.expr.pseudos.visible=function(r){return!!(r.offsetWidth||r.offsetHeight||r.getClientRects().length)},he.createHTMLDocument=((wl=Dt.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",wl.childNodes.length===2),P.parseHTML=function(r,t,e){return typeof r!="string"?[]:(typeof t=="boolean"&&(e=t,t=!1),t||(he.createHTMLDocument?((n=(t=Dt.implementation.createHTMLDocument("")).createElement("base")).href=Dt.location.href,t.head.appendChild(n)):t=Dt),s=!e&&[],(i=Ua.exec(r))?[t.createElement(i[1])]:(i=tl([r],t,s),s&&s.length&&P(s).remove(),P.merge([],i.childNodes)));var n,i,s},P.offset={setOffset:function(r,t,e){var n,i,s,o,a,l,h=P.css(r,"position"),c=P(r),u={};h==="static"&&(r.style.position="relative"),a=c.offset(),s=P.css(r,"top"),l=P.css(r,"left"),(h==="absolute"||h==="fixed")&&(s+l).indexOf("auto")>-1?(o=(n=c.position()).top,i=n.left):(o=parseFloat(s)||0,i=parseFloat(l)||0),Yt(t)&&(t=t.call(r,e,P.extend({},a))),t.top!=null&&(u.top=t.top-a.top+o),t.left!=null&&(u.left=t.left-a.left+i),"using"in t?t.using.call(r,u):c.css(u)}},P.fn.extend({offset:function(r){if(arguments.length)return r===void 0?this:this.each((function(i){P.offset.setOffset(this,r,i)}));var t,e,n=this[0];return n?n.getClientRects().length?(t=n.getBoundingClientRect(),e=n.ownerDocument.defaultView,{top:t.top+e.pageYOffset,left:t.left+e.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var r,t,e,n=this[0],i={top:0,left:0};if(P.css(n,"position")==="fixed")t=n.getBoundingClientRect();else{for(t=this.offset(),e=n.ownerDocument,r=n.offsetParent||e.documentElement;r&&(r===e.body||r===e.documentElement)&&P.css(r,"position")==="static";)r=r.parentNode;r&&r!==n&&r.nodeType===1&&((i=P(r).offset()).top+=P.css(r,"borderTopWidth",!0),i.left+=P.css(r,"borderLeftWidth",!0))}return{top:t.top-i.top-P.css(n,"marginTop",!0),left:t.left-i.left-P.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var r=this.offsetParent;r&&P.css(r,"position")==="static";)r=r.offsetParent;return r||Ci}))}}),P.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(r,t){var e=t==="pageYOffset";P.fn[r]=function(n){return ur(this,(function(i,s,o){var a;if(Yr(i)?a=i:i.nodeType===9&&(a=i.defaultView),o===void 0)return a?a[t]:i[s];a?a.scrollTo(e?a.pageXOffset:o,e?o:a.pageYOffset):i[s]=o}),r,n,arguments.length)}})),P.each(["top","left"],(function(r,t){P.cssHooks[t]=ol(he.pixelPosition,(function(e,n){if(n)return n=In(e,t),Ls.test(n)?P(e).position()[t]+"px":n}))})),P.each({Height:"height",Width:"width"},(function(r,t){P.each({padding:"inner"+r,content:t,"":"outer"+r},(function(e,n){P.fn[n]=function(i,s){var o=arguments.length&&(e||typeof i!="boolean"),a=e||(i===!0||s===!0?"margin":"border");return ur(this,(function(l,h,c){var u;return Yr(l)?n.indexOf("outer")===0?l["inner"+r]:l.document.documentElement["client"+r]:l.nodeType===9?(u=l.documentElement,Math.max(l.body["scroll"+r],u["scroll"+r],l.body["offset"+r],u["offset"+r],u["client"+r])):c===void 0?P.css(l,h,a):P.style(l,h,c,a)}),t,o?i:void 0,o)}}))})),P.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(r,t){P.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),P.fn.extend({hover:function(r,t){return this.mouseenter(r).mouseleave(t||r)}}),P.fn.extend({bind:function(r,t,e){return this.on(r,null,t,e)},unbind:function(r,t){return this.off(r,null,t)},delegate:function(r,t,e,n){return this.on(t,r,e,n)},undelegate:function(r,t,e){return arguments.length===1?this.off(r,"**"):this.off(t,r||"**",e)}}),P.proxy=function(r,t){var e,n,i;if(typeof t=="string"&&(e=r[t],t=r,r=e),Yt(r))return n=Ke.call(arguments,2),i=function(){return r.apply(t||this,n.concat(Ke.call(arguments)))},i.guid=r.guid=r.guid||P.guid++,i},P.holdReady=function(r){r?P.readyWait++:P.ready(!0)}
15,P.isArray=Array.isArray,P.parseJSON=JSON.parse,P.nodeName=Je,P.isFunction=Yt,P.isWindow=Yr,P.camelCase=dr,P.type=Kr,P.now=Date.now,P.isNumeric=function(r){var t=P.type(r);return(t==="number"||t==="string")&&!isNaN(r-parseFloat(r))};const pt=P;function Kt(r){return yl("div",r)}function yl(r,t){const e=document.createElement(r);return t&&(t.class&&e.classList.add(t.class),t.id&&(e.id=t.id),t.style&&_l(e,t.style)),e}function Fe(r){const t=getComputedStyle(r);t.display!=="none"&&(r._initialDisplay=t.display),r.style.display="none"}function Ei(r){if(getComputedStyle(r).display==="none"){const t=r._initialDisplay||"block";r.style.display=t}}function _l(r,t){for(let e of Object.keys(t))r.style[e]=t[e]}let sp=(r,{clientX:t,clientY:e})=>{const{left:n,top:i,width:s,height:o}=r.getBoundingClientRect(),a=t-n,l=e-i;return{x:a,y:l,xNormalized:a/s,yNormalized:l/o,width:s,height:o}};function xl(r,t){const{clientX:e,clientY:n}=r;return sp(t,{clientX:e,clientY:n})}var ut=Object.freeze({__proto__:null,applyStyle:_l,create:yl,div:Kt,empty:function(r){for(;r.firstChild;)r.removeChild(r.firstChild)},guid:function(){return("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)},hide:Fe,hideAll:function(r){document.querySelectorAll(r).forEach((t=>{Fe(t)}))},offset:function(r){if(!r.getClientRects().length)return{top:0,left:0};const t=r.getBoundingClientRect(),e=r.ownerDocument.defaultView;return{top:t.top+e.pageYOffset,left:t.left+e.pageXOffset}},pageCoordinates:function(r){if(r.type.startsWith("touch")){const t=r.touches[0];return{x:t.pageX,y:t.pageY}}return{x:r.pageX,y:r.pageY}},relativeDOMBBox:(r,t)=>{const{x:e,y:n,width:i,height:s}=r.getBoundingClientRect(),{x:o,y:a,width:l,height:h}=t.getBoundingClientRect();return{x:o-e,y:a-n,width:l,height:h}},show:Ei,translateMouseCoordinates:xl});/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */const{entries:kl,setPrototypeOf:Cl,isFrozen:op,getPrototypeOf:ap,getOwnPropertyDescriptor:lp}=Object;let{freeze:Te,seal:Ze,create:hp}=Object,{apply:Fs,construct:Os}=typeof Reflect<"u"&&Reflect;Fs||(Fs=function(r,t,e){return r.apply(t,e)}),Te||(Te=function(r){return r}),Ze||(Ze=function(r){return r}),Os||(Os=function(r,t){return new r(...t)});const cp=je(Array.prototype.forEach),Sl=je(Array.prototype.pop),Bn=je(Array.prototype.push),Ti=je(String.prototype.toLowerCase),Ds=je(String.prototype.toString),up=je(String.prototype.match),Qe=je(String.prototype.replace),dp=je(String.prototype.indexOf),fp=je(String.prototype.trim),Oe=je(RegExp.prototype.test),Fn=(Al=TypeError,function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return Os(Al,t)});var Al;function je(r){return function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return Fs(r,t,n)}}function Pt(r,t,e){var n;e=(n=e)!==null&&n!==void 0?n:Ti,Cl&&Cl(r,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=e(s);o!==s&&(op(t)||(t[i]=o),s=o)}r[s]=!0}return r}function on(r){const t=hp(null);for(const[e,n]of kl(r))t[e]=n;return t}function Mi(r,t){for(;r!==null;){const e=lp(r,t);if(e){if(e.get)return je(e.get);if(typeof e.value=="function")return je(e.value)}r=ap(r)}return function(e){return null}}const El=Te(["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","section","select","shadow","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"]),Ps=Te(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),zs=Te(["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"]),p
15p=Te(["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"]),Hs=Te(["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"]),gp=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tl=Te(["#text"]),Ml=Te(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Us=Te(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","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"]),Rl=Te(["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","
15subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ri=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),mp=Ze(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bp=Ze(/<%[\w\W]*|[\w\W]*%>/gm),wp=Ze(/\${[\w\W]*}/gm),vp=Ze(/^data-[\-\w.\u00B7-\uFFFF]/),yp=Ze(/^aria-[\-\w]+$/),Ll=Ze(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_p=Ze(/^(?:\w+script|data):/i),xp=Ze(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Il=Ze(/^html$/i);var Nl=Object.freeze({__proto__:null,MUSTACHE_EXPR:mp,ERB_EXPR:bp,TMPLIT_EXPR:wp,DATA_ATTR:vp,ARIA_ATTR:yp,IS_ALLOWED_URI:Ll,IS_SCRIPT_OR_DATA:_p,ATTR_WHITESPACE:xp,DOCTYPE_NAME:Il});const kp=()=>typeof window>"u"?null:window;var Bl=(function r(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kp();const e=K=>r(K);if(e.version="3.0.5",e.removed=[],!t||!t.document||t.document.nodeType!==9)return e.isSupported=!1,e;const n=t.document,i=n.currentScript;let{document:s}=t;const{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:h,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:w}=t,m=h.prototype,g=Mi(m,"cloneNode"),f=Mi(m,"nextSibling"),b=Mi(m,"childNodes"),v=Mi(m,"parentNode");if(typeof a=="function"){const K=s.createElement("template");K.content&&K.content.ownerDocument&&(s=K.content.ownerDocument)}let _,A="";const{implementation:S,createNodeIterator:C,createDocumentFragment:R,getElementsByTagName:x}=s,{importNode:T}=n;let y={};e.isSupported=typeof kl=="function"&&typeof v=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:E,ERB_EXPR:L,TMPLIT_EXPR:N,DATA_ATTR:q,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:U}=Nl;let{IS_ALLOWED_URI:k}=Nl,O=null;const z=Pt({},[...El,...Ps,...zs,...Hs,...Tl]);let B=null;const F=Pt({},[...Ml,...Us,...Rl,...Ri]);let j=Object.seal(Object.create(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}})),$=null,G=null,Z=!0,X=!0,st=!1,nt=!0,it=!1,mt=!1,gt=!1,_t=!1,xt=!1,ct=!1,kt=!1,At=!0,St=!1,Ut=!0,M=!1,I={},D=null;const Y=Pt({},["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 J=null;const tt=Pt({},["audio","video","img","source","image","track"]);let lt=null;const Et=Pt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),zt="http://www.w3.org/1998/Math/MathML",te="http://www.w3.org/2000/svg",It="http://www.w3.org/1999/xhtml";let Qt=It,An=!1,Mr=null;const En=Pt({},[zt,te,It],Ds);let hr;const Tn=["application/xhtml+xml","text/html"];let fe,cr=null;const V=s.createElement("form"),Q=function(K){return K instanceof RegExp||K instanceof Function},et=function(K){if(!cr||cr!==K){if(K&&typeof K=="object"||(K={}),K=on(K),hr=hr=Tn.indexOf(K.PARSER_MEDIA_TYPE)===-1?"text/html":K.PARSER_MEDIA_TYPE,fe=hr==="application/xhtml+xml"?Ds:Ti,O="ALLOWED_TAGS"in K?Pt({},K.ALLOWED_TAGS,fe):z,B="ALLOWED_ATTR"in K?Pt({},K.ALLOWED_ATTR,fe):F,Mr="ALLOWED_NAMESPACES"in K?Pt({},K.ALLOWED_NAMESPACES,Ds):En,lt="ADD_URI_SAFE_ATTR"in K?Pt(on(Et),K.ADD_URI_SAFE_ATTR,fe):Et,J="ADD_DATA_URI_TAGS"in K?Pt(on(tt),K.ADD_DATA_URI_TAGS,fe):tt,D="FORBID_CONTENTS"in K?Pt({},K.FORBID_CONTENTS,fe):Y,$="FORBID_TAGS"in K?Pt({},K.FORBID_TAGS,fe):{},G="FORBID_ATTR"in K?Pt({},K.FORBID_ATTR,fe):{},I="USE_PROFILES"in K&&K.USE_PROFILES,Z=K.ALLOW_ARIA_ATTR!==!1,X=K.ALLOW_DATA_ATTR!==!1,st=K.ALLOW_UNKNOWN_PROTOCOLS||!1,nt=K.ALLOW_SELF_CLOSE_IN_ATTR!==!1,it=K.SAFE_FOR_TEMPLATES||!1,mt=K.WHOLE_DOCUMENT||!1,xt=K.RETURN_DOM||!1,ct=K.RETURN_DOM_FRAGMENT||!1,kt=K.RETURN_TRUSTED_TYPE||!1,_t=K.FORCE_BODY||!1,At=K.SANITIZE_DOM!==!1,St=K.SANITIZE_NAMED_PROPS||!1,Ut=K.KEEP_CONTENT!==!1,M=K.IN_PLACE||!1,k=K.ALLOWED_URI_REGEXP||Ll,Qt=K.NAMESPACE||It,j=K.CUSTOM_ELEMENT_HANDLING||{},K.CUSTOM_ELEMENT_HANDLING&&Q(K.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=K.CUSTOM_ELEMENT_HANDLING.tagNameCheck),K.CUSTOM_ELEMENT_HANDLING&&Q(K.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=K.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),K.CUSTOM_ELEMENT_HANDLING&&typeof K.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(j.allowCustomizedBuiltInElements=K.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),it&&(X=!1),ct&&(xt=!0),I&&(O=Pt({},[...Tl]),B=[],I.html===!0&&(Pt(O,El),Pt(B,Ml)),I.svg===!0&&(Pt(O,Ps),Pt(B,Us),Pt(B,Ri)),I.svgFilters===!0&&(Pt(O,zs),Pt(B,Us),Pt(B,Ri)),I.mathMl===!0&&(Pt(O,Hs),Pt(B,Rl),Pt(B,Ri))),K.ADD_TAGS&&(O===z&&(O=on(O)),Pt(O,K.ADD_TAGS,fe)),K.ADD_ATTR&&(B===F&&(B=on(B)),Pt(B,K.ADD_ATTR,fe)),K.ADD_URI_SAFE_ATTR&&Pt(lt,
15K.ADD_URI_SAFE_ATTR,fe),K.FORBID_CONTENTS&&(D===Y&&(D=on(D)),Pt(D,K.FORBID_CONTENTS,fe)),Ut&&(O["#text"]=!0),mt&&Pt(O,["html","head","body"]),O.table&&(Pt(O,["tbody"]),delete $.tbody),K.TRUSTED_TYPES_POLICY){if(typeof K.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof K.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=K.TRUSTED_TYPES_POLICY,A=_.createHTML("")}else _===void 0&&(_=(function(ft,bt){if(typeof ft!="object"||typeof ft.createPolicy!="function")return null;let Lt=null;const jt="data-tt-policy-suffix";bt&&bt.hasAttribute(jt)&&(Lt=bt.getAttribute(jt));const Jt="dompurify"+(Lt?"#"+Lt:"");try{return ft.createPolicy(Jt,{createHTML:$t=>$t,createScriptURL:$t=>$t})}catch{return null}})(w,i)),_!==null&&typeof A=="string"&&(A=_.createHTML(""));Te&&Te(K),cr=K}},ot=Pt({},["mi","mo","mn","ms","mtext"]),rt=Pt({},["foreignobject","desc","title","annotation-xml"]),ht=Pt({},["title","style","font","a","script"]),dt=Pt({},Ps);Pt(dt,zs),Pt(dt,pp);const wt=Pt({},Hs);Pt(wt,gp);const vt=function(K){Bn(e.removed,{element:K});try{K.parentNode.removeChild(K)}catch{K.remove()}},Mt=function(K,ft){try{Bn(e.removed,{attribute:ft.getAttributeNode(K),from:ft})}catch{Bn(e.removed,{attribute:null,from:ft})}if(ft.removeAttribute(K),K==="is"&&!B[K])if(xt||ct)try{vt(ft)}catch{}else try{ft.setAttribute(K,"")}catch{}},Rt=function(K){let ft,bt;if(_t)K="<remove></remove>"+K;else{const Jt=up(K,/^[\r\n\t ]+/);bt=Jt&&Jt[0]}hr==="application/xhtml+xml"&&Qt===It&&(K='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+K+"</body></html>");const Lt=_?_.createHTML(K):K;if(Qt===It)try{ft=new d().parseFromString(Lt,hr)}catch{}if(!ft||!ft.documentElement){ft=S.createDocument(Qt,"template",null);try{ft.documentElement.innerHTML=An?A:Lt}catch{}}const jt=ft.body||ft.documentElement;return K&&bt&&jt.insertBefore(s.createTextNode(bt),jt.childNodes[0]||null),Qt===It?x.call(ft,mt?"html":"body")[0]:mt?ft.documentElement:jt},Tt=function(K){return C.call(K.ownerDocument||K,K,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Ht=function(K){return typeof l=="object"?K instanceof l:K&&typeof K=="object"&&typeof K.nodeType=="number"&&typeof K.nodeName=="string"},Xt=function(K,ft,bt){y[K]&&cp(y[K],(Lt=>{Lt.call(e,ft,bt,cr)}))},Nt=function(K){let ft;if(Xt("beforeSanitizeElements",K,null),(bt=K)instanceof p&&(typeof bt.nodeName!="string"||typeof bt.textContent!="string"||typeof bt.removeChild!="function"||!(bt.attributes instanceof u)||typeof bt.removeAttribute!="function"||typeof bt.setAttribute!="function"||typeof bt.namespaceURI!="string"||typeof bt.insertBefore!="function"||typeof bt.hasChildNodes!="function"))return vt(K),!0;var bt;const Lt=fe(K.nodeName);if(Xt("uponSanitizeElement",K,{tagName:Lt,allowedTags:O}),K.hasChildNodes()&&!Ht(K.firstElementChild)&&(!Ht(K.content)||!Ht(K.content.firstElementChild))&&Oe(/<[/\w]/g,K.innerHTML)&&Oe(/<[/\w]/g,K.textContent))return vt(K),!0;if(!O[Lt]||$[Lt]){if(!$[Lt]&&ge(Lt)&&(j.tagNameCheck instanceof RegExp&&Oe(j.tagNameCheck,Lt)||j.tagNameCheck instanceof Function&&j.tagNameCheck(Lt)))return!1;if(Ut&&!D[Lt]){const jt=v(K)||K.parentNode,Jt=b(K)||K.childNodes;if(Jt&&jt)for(let $t=Jt.length-1;$t>=0;--$t)jt.insertBefore(g(Jt[$t],!0),f(K))}return vt(K),!0}return K instanceof h&&!(function(jt){let Jt=v(jt);Jt&&Jt.tagName||(Jt={namespaceURI:Qt,tagName:"template"});const $t=Ti(jt.tagName),oe=Ti(Jt.tagName);return!!Mr[jt.namespaceURI]&&(jt.namespaceURI===te?Jt.namespaceURI===It?$t==="svg":Jt.namespaceURI===zt?$t==="svg"&&(oe==="annotation-xml"||ot[oe]):!!dt[$t]:jt.namespaceURI===zt?Jt.namespaceURI===It?$t==="math":Jt.namespaceURI===te?$t==="math"&&rt[oe]:!!wt[$t]:jt.namespaceURI===It?!(Jt.namespaceURI===te&&!rt[oe])&&!(Jt.namespaceURI===zt&&!ot[oe])&&!wt[$t]&&(ht[$t]||!dt[$t]):!(hr!=="application/xhtml+xml"||!Mr[jt.namespaceURI]))})(K)?(vt(K),!0):Lt!=="noscript"&&Lt!=="noembed"&&Lt!=="noframes"||!Oe(/<\/no(script|embed|frames)/i,K.innerHTML)?(it&&K.nodeType===3&&(ft=K.textContent,ft=Qe(ft,E," "),ft=Qe(ft,L," "),ft=Qe(ft,N," "),K.textContent!==ft&&(Bn(e.removed,{element:K.cloneNode()}),K.textContent=ft)),Xt("afterSanitizeElements",K,null),!1):(vt(K),!0)},pe=function(K,ft,bt){if(At&&(ft==="id"||ft==="name")&&(bt in s||bt in V))return!1;if(!(X&&!G[ft]&&Oe(q,ft))){if(!(Z&&Oe(H,ft))){if(!B[ft]||G[ft]){if(!(ge(K)&&(j.tagNameCheck instanceof RegExp&&Oe(j.tagNameCheck,K)||j.tagNameCheck instanceof Function&&j.tagNameCheck(K))&&(j.attributeNameCheck instanceof RegExp&&Oe(j.attributeNameCheck,ft)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(ft))||ft==="is"&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&Oe(j.tagNameCheck,bt)||j.tagNameCheck instanceof Function&&j.tagNameCheck(bt))))return!1}else if(!lt[ft]){if(!Oe(k,Qe(bt,U,""))){if((ft!=="src"&&ft!=="xlink:href"&&ft!=="href"||K==="script"||dp(bt,"data:")!==0||!J[K])&&!(st&&!Oe(W,Qe(bt,U,"")))){if(bt)return!1}}}}}return!0},ge=function(K){return K.indexOf("-")>0},xe=function(K){let ft,bt,Lt,jt;Xt("beforeSanitizeAttributes",K,null);const{attributes:Jt}=K;if(!Jt)return;const $t={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B};for(jt=Jt.length;jt--;){ft=Jt[jt];const{name:oe,namespaceURI:Mn}=ft;if(bt=oe==="value"?ft.value:fp(ft.value),Lt=fe(oe),$t.attrName=Lt,$t.attrValue=bt,$t.keepAttr=!0,$t.forceKeepAttr=void 0,Xt("uponSanitizeAttribute",K,$t),bt=$t.attrValue,$t.forceKeepAttr||(Mt(oe,K),!$t.keepAttr))continue;if(!nt&&Oe(/\/>/i,bt)){Mt(oe,K);continue}it&&(bt=Qe(bt,E," "),bt=Qe(bt,L," "),bt=Qe(bt,N," "));const xf=fe(K.nodeName);
15if(pe(xf,Lt,bt)){if(!St||Lt!=="id"&&Lt!=="name"||(Mt(oe,K),bt="user-content-"+bt),_&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Mn)switch(w.getAttributeType(xf,Lt)){case"TrustedHTML":bt=_.createHTML(bt);break;case"TrustedScriptURL":bt=_.createScriptURL(bt)}try{Mn?K.setAttributeNS(Mn,oe,bt):K.setAttribute(oe,bt),Sl(e.removed)}catch{}}}Xt("afterSanitizeAttributes",K,null)},ee=function K(ft){let bt;const Lt=Tt(ft);for(Xt("beforeSanitizeShadowDOM",ft,null);bt=Lt.nextNode();)Xt("uponSanitizeShadowNode",bt,null),Nt(bt)||(bt.content instanceof o&&K(bt.content),xe(bt));Xt("afterSanitizeShadowDOM",ft,null)};return e.sanitize=function(K){let ft,bt,Lt,jt,Jt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(An=!K,An&&(K="<!-->"),typeof K!="string"&&!Ht(K)){if(typeof K.toString!="function")throw Fn("toString is not a function");if(typeof(K=K.toString())!="string")throw Fn("dirty is not a string, aborting")}if(!e.isSupported)return K;if(gt||et(Jt),e.removed=[],typeof K=="string"&&(M=!1),M){if(K.nodeName){const Mn=fe(K.nodeName);if(!O[Mn]||$[Mn])throw Fn("root node is forbidden and cannot be sanitized in-place")}}else if(K instanceof l)ft=Rt("<!---->"),bt=ft.ownerDocument.importNode(K,!0),bt.nodeType===1&&bt.nodeName==="BODY"||bt.nodeName==="HTML"?ft=bt:ft.appendChild(bt);else{if(!xt&&!it&&!mt&&K.indexOf("<")===-1)return _&&kt?_.createHTML(K):K;if(ft=Rt(K),!ft)return xt?null:kt?A:""}ft&&_t&&vt(ft.firstChild);const $t=Tt(M?K:ft);for(;Lt=$t.nextNode();)Nt(Lt)||(Lt.content instanceof o&&ee(Lt.content),xe(Lt));if(M)return K;if(xt){if(ct)for(jt=R.call(ft.ownerDocument);ft.firstChild;)jt.appendChild(ft.firstChild);else jt=ft;return(B.shadowroot||B.shadowrootmode)&&(jt=T.call(n,jt,!0)),jt}let oe=mt?ft.outerHTML:ft.innerHTML;return mt&&O["!doctype"]&&ft.ownerDocument&&ft.ownerDocument.doctype&&ft.ownerDocument.doctype.name&&Oe(Il,ft.ownerDocument.doctype.name)&&(oe="<!DOCTYPE "+ft.ownerDocument.doctype.name+`> 16`+oe),it&&(oe=Qe(oe,E," "),oe=Qe(oe,L," "),oe=Qe(oe,N," ")),_&&kt?_.createHTML(oe):oe},e.setConfig=function(K){et(K),gt=!0},e.clearConfig=function(){cr=null,gt=!1},e.isValidAttribute=function(K,ft,bt){cr||et({});const Lt=fe(K),jt=fe(ft);return pe(Lt,jt,bt)},e.addHook=function(K,ft){typeof ft=="function"&&(y[K]=y[K]||[],Bn(y[K],ft))},e.removeHook=function(K){if(y[K])return Sl(y[K])},e.removeHooks=function(K){y[K]&&(y[K]=[])},e.removeAllHooks=function(){y={}},e})();function Fl(r,t){const e=Kt({class:"igv-ui-trackgear-popover-check-container"}),n=Dl("check",t===!0?"#444":"transparent");n.style.borderColor="gray",n.style.borderWidth="1px",n.style.borderStyle="solid",e.appendChild(n);let i=Kt();return i.textContent=r,e.appendChild(i),e}function Ol(r,t){return Dl(r,t)}function Dl(r,t){t=t||"currentColor";let e=Pl[r];e||(e=Pl.question);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttributeNS(null,"viewBox","0 0 "+e[0]+" "+e[1]);const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"fill",t),i.setAttributeNS(null,"d",e[4]),n.appendChild(i),n}const Pl={check:[512,512,[],"f00c","M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"],cog:[512,512,[],"f013","M444.788 291.1l42.616 24.599c4.867 2.809 7.126 8.618 5.459 13.985-11.07 35.642-29.97 67.842-54.689 94.586a12.016 12.016 0 0 1-14.832 2.254l-42.584-24.595a191.577 191.577 0 0 1-60.759 35.13v49.182a12.01 12.01 0 0 1-9.377 11.718c-34.956 7.85-72.499 8.256-109.219.007-5.49-1.233-9.403-6.096-9.403-11.723v-49.184a191.555 191.555 0 0 1-60.759-35.13l-42.584 24.595a12.016 12.016 0 0 1-14.832-2.254c-24.718-26.744-43.619-58.944-54.689-94.586-1.667-5.366.592-11.175 5.459-13.985L67.212 291.1a193.48 193.48 0 0 1 0-70.199l-42.616-24.599c-4.867-2.809-7.126-8.618-5.459-13.985 11.07-35.642 29.97-67.842 54.689-94.586a12.016 12.016 0 0 1 14.832-2.254l42.584 24.595a191.577 191.577 0 0 1 60.759-35.13V25.759a12.01 12.01 0 0 1 9.377-11.718c34.956-7.85 72.499-8.256 109.219-.007 5.49 1.233 9.403 6.096 9.403 11.723v49.184a191.555 191.555 0 0 1 60.759 35.13l42.584-24.595a12.016 12.016 0 0 1 14.832 2.254c24.718 26.744 43.619 58.944 54.689 94.586 1.667 5.366-.592 11.175-5.459 13.985L444.788 220.9a193.485 193.485 0 0 1 0 70.2zM336 256c0-44.112-35.888-80-80-80s-80 35.888-80 80 35.888 80 80 80 80-35.888 80-80z"],exclamation:[192,512,[],"f12a","M176 432c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80zM25.26 25.199l13.6 272C39.499 309.972 50.041 320 62.83 320h66.34c12.789 0 23.331-10.028 23.97-22.801l13.6-272C167.425 11.49 156.496 0 142.77 0H49.23C35.504 0 24.575 11.49 25.26 25.199z"],"exclamation-circle":[512,512,[],"f06a","M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418
16-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"],"exclamation-triangle":[576,512,[],"f071","M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"],minus:[448,512,[],"f068","M424 318.2c13.3 0 24-10.7 24-24v-76.4c0-13.3-10.7-24-24-24H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h400z"],"minus-circle":[512,512,[],"f056","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z"],"minus-square":[448,512,[],"f146","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM92 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H92z"],plus:[448,512,[],"f067","M448 294.2v-76.4c0-13.3-10.7-24-24-24H286.2V56c0-13.3-10.7-24-24-24h-76.4c-13.3 0-24 10.7-24 24v137.8H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h137.8V456c0 13.3 10.7 24 24 24h76.4c13.3 0 24-10.7 24-24V318.2H424c13.3 0 24-10.7 24-24z"],"plus-circle":[512,512,[],"f055","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"],"plus-square":[448,512,[],"f0fe","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"],question:[384,512,[],"f128","M202.021 0C122.202 0 70.503 32.703 29.914 91.026c-7.363 10.58-5.093 25.086 5.178 32.874l43.138 32.709c10.373 7.865 25.132 6.026 33.253-4.148 25.049-31.381 43.63-49.449 82.757-49.449 30.764 0 68.816 19.799 68.816 49.631 0 22.552-18.617 34.134-48.993 51.164-35.423 19.86-82.299 44.576-82.299 106.405V320c0 13.255 10.745 24 24 24h72.471c13.255 0 24-10.745 24-24v-5.773c0-42.86 125.268-44.645 125.268-160.627C377.504 66.256 286.902 0 202.021 0zM192 373.459c-38.196 0-69.271 31.075-69.271 69.271 0 38.195 31.075 69.27 69.271 69.27s69.271-31.075 69.271-69.271-31.075-69.27-69.271-69.27z"],save:[448,512,[],"f0c7","M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"],search:[512,512,[],"f002","M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"],share:[512,512,[],"f064","M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"],spinner:[512,512,[],"f110","M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"],square:[448,512,[],"f0c8","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"],"square-full":[512,512,[],"f45c","M512 512H0V0h512v512z"],times:[384,512,[],"f00d","M323.1 441l53.9-53.9c9.4-9.4 9.4-24.5 0-33.9L279.8 256l97.2-97.2c9.4-9.4 9.4-24.5 0-33.9L323.1 71c-9.4-9.4-24.5-9.4-33.9 0L192 168.2 94.8 71c-9.4-9.4-24.5-9.4-33.9 0L7 124.9c-9.4 9.4-9.4 24.5 0 33.9l97.2 97.2L7 353.2c-9.4 9.4-9.4 24.5 0 33.9L60.9 441c9.4 9.4 24.5 9.4 33.9 0l97.2-97.2 97.2 97.2c9.3 9.3 24.5 9.3 33.9 0z"],"times-circle":[512,512,[],"f057","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"],wrench:[512,512,[],"f0ad","M481.156 200c9.3 0 15.12 10.155 10.325 18.124C466.295 259.992 420.419 288 368 288c-79.222 0-143.501-63.974-143.997-143.079C223.505 65.469 288.548-.001 368.002 0c52.362.001 98.196 27.949 123.4 69.743C496.24 77.766 490.523 88 481.154 88H376l-40 56 40 56h105.156zm-171.649 93.003L109.255 493.255c-24.994 24.993-65.515 24.994-90.51 0-24.993-24.994-24.993-65.516 0-90.51L218.991 202.5c16.16 41.197 49.303 74.335 90.516 90.503zM104 432c0-13.255-10.745-24-24-24s-24 10.745-24 24 10.745 24 24 24 24-10.745 24-24z"]};var Nr=Object.freeze({__proto__:null,createCheckbox:Fl,createIcon:Ol});function Li(r,t){var e=document.createElement("div");r.appendChild(e),e.appendChild(Ol("times")),e.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation(),t()}))}var Vs=Object.freeze({__proto__:null,attachDialogCloseHandlerWithParent:Li});let De;function Br(r,t,e){t.addEventListener("mousedown",function(n){n.stopPropagation(),n.preventDefault();
16const i=Cp.bind(this),s=Sp.bind(this),o=getComputedStyle(this);De={constraint:e,dragFunction:i,dragEndFunction:s,screenX:n.screenX,screenY:n.screenY,top:parseInt(o.top.replace("px","")),left:parseInt(o.left.replace("px",""))},document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),document.addEventListener("mouseleave",s),document.addEventListener("mouseexit",s)}.bind(r))}function Cp(r){if(!De)return;r.stopPropagation(),r.preventDefault();const t=r.screenX-De.screenX,e=r.screenY-De.screenY,n=De.left+t,i=De.constraint?Math.max(De.constraint.minY,De.top+e):De.top+e;this.style.left=`${n}px`,this.style.top=`${i}px`}function Sp(r){if(!De)return;r.stopPropagation(),r.preventDefault();const t=De.dragFunction,e=De.dragEndFunction;document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e),document.removeEventListener("mouseleave",e),document.removeEventListener("mouseexit",e),De=void 0}const zl={401:"Access unauthorized",403:"Access forbidden",404:"Not found"};class Hl{constructor(t,e){this.alertProps=Object.assign({shouldFocus:!0,preventScroll:!1},e),this.container=Kt({class:"igv-ui-alert-dialog-container"}),t.appendChild(this.container),this.container.setAttribute("tabIndex","-1");const n=Kt();this.container.appendChild(n),this.errorHeadline=Kt(),n.appendChild(this.errorHeadline),this.errorHeadline.textContent="";let i=Kt({class:"igv-ui-alert-dialog-body"});this.container.appendChild(i),this.body=Kt({class:"igv-ui-alert-dialog-body-copy"}),i.appendChild(this.body);let s=Kt();this.container.appendChild(s),this.ok=Kt(),s.appendChild(this.ok),this.ok.textContent="OK";const o=()=>{typeof this.callback=="function"&&(this.callback("OK"),this.callback=void 0),this.body.innerHTML="",Fe(this.container)};this.ok.addEventListener("click",(a=>{a.stopPropagation(),o()})),this.container.addEventListener("keypress",(a=>{a.stopPropagation(),a.key==="Enter"&&o()})),Br(this.container,n),Fe(this.container)}present(t,e){this.errorHeadline.textContent=t.message?"ERROR":"";let n=t.message||t;zl.hasOwnProperty(n)&&(n=zl[n]);const i=Bl.sanitize(n);this.body.innerHTML=i,this.callback=e,Ei(this.container),this.alertProps.shouldFocus&&this.container.focus({preventScroll:this.alertProps.preventScroll})}}class Ap{constructor(t){this.parent=t,this.container=Kt({class:"igv-ui-generic-dialog-container"}),t.appendChild(this.container);const e=Kt({class:"igv-ui-generic-dialog-header"});this.container.appendChild(e),this.label=Kt({class:"igv-ui-generic-dialog-one-liner"}),this.container.appendChild(this.label),this.label.text="Unlabeled",this.input_container=Kt({class:"igv-ui-generic-dialog-input"}),this.container.appendChild(this.input_container),this.input=document.createElement("input"),this.input_container.appendChild(this.input);const n=Kt({class:"igv-ui-generic-dialog-ok-cancel"});this.container.appendChild(n),this.ok=Kt(),n.appendChild(this.ok),this.ok.textContent="OK",this.cancel=Kt(),n.appendChild(this.cancel),this.cancel.textContent="Cancel",Fe(this.container),this.input.addEventListener("keyup",(s=>{s.keyCode===13&&(typeof this.callback=="function"&&(this.callback(this.input.value),this.callback=void 0),this.input.value=void 0,Fe(this.container))})),this.ok.addEventListener("click",(()=>{typeof this.callback=="function"&&(this.callback(this.input.value),this.callback=void 0),this.input.value=void 0,Fe(this.container)}));const i=()=>{this.input.value="",Fe(this.container)};this.cancel.addEventListener("click",i),Li(e,i),Br(this.container,e)}get value(){return Bl.sanitize(this.input.value)}present(t,e){this.label.textContent=t.label,this.input.value=t.value,this.callback=t.callback||t.click,Ei(this.container),this.clampLocation(e.clientX,e.clientY)}clampLocation(t,e){const{width:n,height:i}=this.container.getBoundingClientRect(),s=window.innerHeight,o=window.innerWidth,a=Math.min(s-i,e),l=Math.min(o-n,t);this.container.style.left=`${l}px`,this.container.style.top=`${a}px`}}const Ul={licorice:"#000000",lead:"#1e1e1e",tungsten:"#3a3a3a",iron:"#545453",steel:"#6e6e6e",tin:"#878687",nickel:"#888787",aluminum:"#a09fa0",magnesium:"#b8b8b8",silver:"#d0d0d0",mercury:"#e8e8e8",snow:"#ffffff",cayenne:"#891100",mocha:"#894800",aspargus:"#888501",fern:"#458401",clover:"#028401",moss:"#018448",teal:"#008688",ocean:"#004a88",midnight:"#001888",eggplant:"#491a88",plum:"#891e88",maroon:"#891648",maraschino:"#ff2101",tangerine:"#ff8802",lemon:"#fffa03",lime:"#83f902",spring:"#05f802",seam_foam:"#03f987",turquoise:"#00fdff",aqua:"#008cff",blueberry:"#002eff",grape:"#8931ff",magenta:"#ff39ff",strawberry:"#ff2987",salmon:"#ff726e",cantaloupe:"#ffce6e",banana:"#fffb6d",honeydew:"#cefa6e",flora:"#68f96e",spindrift:"#68fbd0",ice:"#68fdff",sky:"#6acfff",orchid:"#6e76ff",lavender:"#d278ff",bubblegum:"#ff7aff",carnation:"#ff7fd3"};class Vl{constructor({parent:t,top:e,left:n,width:i,height:s,border:o,closeHandler:a}){let l=Kt({class:"igv-ui-generic-container"});t.appendChild(l),Fe(l),this.container=l,e!==void 0&&(this.container.style.top=`${e}px`),n!==void 0&&(this.container.style.left=`${n}px`),i!==void 0&&(this.container.style.width=`${i}px`),s!==void 0&&(this.container.style.height=`${s}px`),o&&(this.container.style.border=o);
16const h=Kt();this.container.appendChild(h),Li(h,(c=>{Fe(this.container),typeof a=="function"&&a(c)})),Br(this.container,h)}show(){Ei(this.container)}hide(){Fe(this.container)}dispose(){this.container.parent&&this.container.parent.removeChild(this.container)}}class Ep extends Vl{constructor({parent:t,top:e,left:n,width:i,height:s,defaultColors:o,colorHandler:a}){super({parent:t,top:e,left:n,width:i,height:s,border:"1px solid gray"}),Tp(this.container,a,o)}}const Tp=(r,t,e)=>{const n=Object.values(Ul);for(let i of n){const s=Kt({class:"igv-ui-color-swatch"});r.appendChild(s),ql(s,i,t)}if(e)for(let i of e){const s=Kt({class:"igv-ui-color-swatch"});r.appendChild(s),ql(s,i,t)}},ql=(r,t,e)=>{r.style.backgroundColor=t,r.addEventListener("mouseenter",(n=>r.style.borderColor=t)),r.addEventListener("mouseleave",(n=>r.style.borderColor="white")),r.addEventListener("click",(n=>{n.stopPropagation(),e(t)})),r.addEventListener("touchend",(n=>{n.stopPropagation(),e(t)}))};class qs{constructor(t,e){this.parent=t,this.popover=Kt({class:"igv-ui-popover"}),t.appendChild(this.popover);const n=Kt();this.popover.appendChild(n);const i=Kt();n.appendChild(i),e&&(i.textContent=e),Li(n,(()=>this.hide())),Br(this.popover,n),this.popoverContent=Kt(),this.popover.appendChild(this.popoverContent),this.popover.style.display="none"}presentContentWithEvent(t,e){this.popover.style.display="block",this.popoverContent.innerHTML=e,jl(t,this.popover,this.popoverContent)}presentMenu(t,e){if(e.length===0)return;this.popover.style.display="block";const n=(function(i,s){return i.map((function(a,l){let h;if(typeof a=="string")h=Kt(),h.innerHTML=a;else if(typeof a=="Node")h=a;else{if(typeof a.init=="function"&&a.init(),a.type==="checkbox")h=Fl("Show all bases",a.value);else if(a.type==="color"){const c=new Ep({parent:s.parentElement,width:364,colorHandler:p=>a.click(p)});h=Kt(),typeof a.label=="string"&&(h.innerHTML=a.label);const u=p=>{c.show(),Fe(s),p.preventDefault(),p.stopPropagation()};h.addEventListener("click",u),h.addEventListener("touchend",u),h.addEventListener("mouseup",(function(p){p.preventDefault(),p.stopPropagation()}))}else h=Kt(),typeof a.label=="string"&&(h.innerHTML=a.label);if(a.click&&a.type!=="color"){let c=function(u){a.click(),Fe(s),u.preventDefault(),u.stopPropagation()};h.addEventListener("click",c),h.addEventListener("touchend",c),h.addEventListener("mouseup",(function(u){u.preventDefault(),u.stopPropagation()}))}}return{object:h,init:a.init}}))})(e,this.popover);for(let i of n)this.popoverContent.appendChild(i.object);jl(t,this.popover,this.popoverContent)}hide(){this.popover.style.display="none",this.dispose()}dispose(){this.popover&&this.popover.parentNode.removeChild(this.popover);const t=Object.keys(this);for(let e of t)this[e]=void 0}}function jl(r,t,e){const{x:n,y:i,width:s}=xl(r,t.parentNode);t.style.top=`${i}px`;const{width:o}=t.getBoundingClientRect(),a=n+o,l=a-s;t.style.left=`${a>s?n-l:n}px`,e.style.maxWidth=`${Math.min(o,s)}px`}class Wl extends Vl{constructor({parent:t,width:e}){super({parent:t,width:e,border:"1px solid gray"})}configure(t,e){this.colorHandlers=e,this.setActiveColorHandler("color"),this.createSwatches(t)}setActiveColorHandler(t){this.activeColorHandler=this.colorHandlers[t]}createSwatches(t){this.container.querySelectorAll(".igv-ui-color-swatch").forEach((n=>n.remove()));const e=Object.values(Ul);for(let n of e){const i=Kt({class:"igv-ui-color-swatch"});this.container.appendChild(i),this.decorateSwatch(i,n)}if(t)for(let n of t){const i=Kt({class:"igv-ui-color-swatch"});this.container.appendChild(i),this.decorateSwatch(i,n)}}decorateSwatch(t,e){t.style.backgroundColor=e,t.addEventListener("mouseenter",(()=>t.style.borderColor=e)),t.addEventListener("mouseleave",(()=>t.style.borderColor="white")),t.addEventListener("click",(n=>{n.stopPropagation(),this.activeColorHandler(e)})),t.addEventListener("touchend",(n=>{n.stopPropagation(),this.activeColorHandler(e)}))}}typeof document<"u"&&(function(t){for(let e of document.styleSheets)if(e=e.href?e.href.replace(/^.*[\\\/]/,""):"",e===t)return!0;return!1}("igv-ui.css")||(function(){const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("title","igv-ui.css"),t.innerHTML=`.igv-ui-popover {
17 cursor: default; 18 position: absolute; 19 z-index: 2048; 20 border-color: #7F7F7F; 21 border-radius: 4px; 22 border-style: solid; 23 border-width: 1px; 24 font-family: "Open Sans", sans-serif; 25 font-size: small; 26 background-color: white; 27} 28.igv-ui-popover > div:first-child { 29 display: flex; 30 flex-direction: row; 31 flex-wrap: nowrap; 32 justify-content: space-between; 33 align-items: center; 34 width: 100%; 35 height: 24px; 36 cursor: move; 37 border-top-left-radius: 4px; 38 border-top-right-radius: 4px; 39 border-bottom-color: #7F7F7F; 40 border-bottom-style: solid; 41 border-bottom-width: thin; 42 background-color: #eee; 43} 44.igv-ui-popover > div:first-child > div:first-child { 45 margin-left: 4px; 46} 47.igv-ui-popover > div:first-child > div:last-child { 48 margin-right: 4px; 49 height: 12px; 50 width: 12px; 51 color: #7F7F7F; 52} 53.igv-ui-popover > div:first-child > div:last-child:hover { 54 cursor: pointer; 55 color: #444; 56} 57.igv-ui-popover > div:last-child { 58 overflow-y: auto; 59 overflow-x: hidden; 60 max-height: 400px; 61 max-width: 800px; 62 background-color: white; 63} 64.igv-ui-popover > div:last-child > div { 65 user-select: all; 66 margin-left: 4px; 67 margin-right: 4px; 68 min-width: 220px; 69 overflow-x: hidden; 70 text-overflow: ellipsis; 71 white-space: nowrap; 72} 73.igv-ui-popover > div:last-child > div > span { 74 font-weight: bolder; 75} 76.igv-ui-popover > div:last-child hr { 77 width: 100%; 78} 79 80.igv-ui-alert-dialog-container { 81 box-sizing: content-box; 82 position: absolute; 83 z-index: 2048; 84 top: 50%; 85 left: 50%; 86 width: 400px; 87 height: 200px; 88 border-color: #7F7F7F; 89 border-radius: 4px; 90 border-style: solid; 91 border-width: thin; 92 outline: none; 93 font-family: "Open Sans", sans-serif; 94 font-size: 15px; 95 font-weight: 400; 96 background-color: white; 97 display: flex; 98 flex-flow: column; 99 flex-wrap: nowrap; 100 justify-content: space-between; 101 align-items: center; 102} 103.igv-ui-alert-dialog-container > div:first-child { 104 display: flex; 105 flex-flow: row; 106 flex-wrap: nowrap; 107 justify-content: flex-start; 108 align-items: center; 109 width: 100%; 110 height: 24px; 111 cursor: move; 112 border-top-left-radius: 4px; 113 border-top-right-radius: 4px; 114 border-bottom-color: #7F7F7F; 115 border-bottom-style: solid; 116 border-bottom-width: thin; 117 background-color: #eee; 118} 119.igv-ui-alert-dialog-container > div:first-child div:first-child { 120 padding-left: 8px; 121} 122.igv-ui-alert-dialog-container .igv-ui-alert-dialog-body { 123 -webkit-user-select: text; 124 -moz-user-select: text; 125 -ms-user-select: text; 126 user-select: text; 127 color: #373737; 128 width: 100%; 129 height: calc(100% - 24px - 64px); 130 overflow-y: scroll; 131} 132.igv-ui-alert-dialog-container .igv-ui-alert-dialog-body .igv-ui-alert-dialog-body-copy { 133 margin: 16px; 134 width: auto; 135 height: auto; 136 overflow-wrap: break-word; 137 word-break: break-word; 138 background-color: white; 139 border: unset; 140} 141.igv-ui-alert-dialog-container > div:last-child { 142 width: 100%; 143 margin-bottom: 10px; 144 background-color: white; 145 display: flex; 146 flex-flow: row; 147 flex-wrap: nowrap; 148 justify-content: center; 149 align-items: center; 150} 151.igv-ui-alert-dialog-container > div:last-child div { 152 margin: unset; 153 width: 40px; 154 height: 30px; 155 line-height: 30px; 156 text-align: center; 157 color: white; 158 font-family: "Open Sans", sans-serif; 159 font-size: small; 160 font-weight: 400; 161 border-color: #2B81AF; 162 border-style: solid; 163 border-width: thin; 164 border-radius: 4px; 165 background-color: #2B81AF; 166} 167.igv-ui-alert-dialog-container > div:last-child div:hover { 168 cursor: pointer; 169 border-color: #25597f; 170 background-color: #25597f; 171} 172 173.igv-ui-color-swatch { 174 position: relative; 175 box-sizing: content-box; 176 display: flex; 177 flex-flow: row; 178 flex-wrap: wrap; 179 justify-content: center; 180 align-items: center; 181 width: 32px; 182 height: 32px; 183 border-style: solid; 184 border-width: 2px; 185 border-color: white; 186 border-radius: 4px; 187} 188 189.igv-ui-color-swatch:hover { 190 border-color: dimgray; 191} 192 193.igv-ui-colorpicker-menu-close-button { 194 display: flex; 195 flex-flow: row; 196 flex-wrap: nowrap; 197 justify-content: flex-end; 198 align-items: center; 199 width: 100%; 200 height: 32px; 201 margin-top: 4px; 202 margin-bottom: 4px; 203 padding-right: 8px; 204} 205.igv-ui-colorpicker-menu-close-button i.fa { 206 display: block; 207 margin-left: 4px; 208 margin-right: 4px; 209 color: #5f5f5f; 210} 211.igv-ui-colorpicker-menu-close-button i.fa:hover, 212.igv-ui-colorpicker-menu-close-button i.fa:focus, 213.igv-ui-colorpicker-menu-close-button i.fa:active { 214 cursor: pointer;
215 color: #0f0f0f; 216} 217 218.igv-ui-generic-dialog-container { 219 box-sizing: content-box; 220 position: fixed; 221 top: 0; 222 left: 0; 223 width: 300px; 224 height: 200px; 225 border-color: #7F7F7F; 226 border-radius: 4px; 227 border-style: solid; 228 border-width: thin; 229 font-family: "Open Sans", sans-serif; 230 font-size: medium; 231 font-weight: 400; 232 z-index: 2048; 233 background-color: white; 234 display: flex; 235 flex-flow: column; 236 flex-wrap: nowrap; 237 justify-content: flex-start; 238 align-items: center; 239} 240.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header { 241 display: flex; 242 flex-flow: row; 243 flex-wrap: nowrap; 244 justify-content: flex-end; 245 align-items: center; 246 width: 100%; 247 height: 24px; 248 cursor: move; 249 border-top-left-radius: 4px; 250 border-top-right-radius: 4px; 251 border-bottom-color: #7F7F7F; 252 border-bottom-style: solid; 253 border-bottom-width: thin; 254 background-color: #eee; 255} 256.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header div { 257 margin-right: 4px; 258 margin-bottom: 2px; 259 height: 12px; 260 width: 12px; 261 color: #7F7F7F; 262} 263.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header div:hover { 264 cursor: pointer; 265 color: #444; 266} 267.igv-ui-generic-dialog-container .igv-ui-generic-dialog-one-liner { 268 color: #373737; 269 width: 95%; 270 height: 24px; 271 line-height: 24px; 272 text-align: left; 273 margin-top: 8px; 274 padding-left: 8px; 275 overflow-wrap: break-word; 276 background-color: white; 277} 278.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input { 279 margin-top: 8px; 280 width: 95%; 281 height: 24px; 282 color: #373737; 283 line-height: 24px; 284 padding-left: 8px; 285 background-color: white; 286 display: flex; 287 flex-flow: row; 288 flex-wrap: nowrap; 289 justify-content: flex-start; 290 align-items: center; 291} 292.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input div { 293 width: 30%; 294 height: 100%; 295 font-size: 16px; 296 text-align: right; 297 padding-right: 8px; 298 background-color: white; 299} 300.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input input { 301 display: block; 302 height: 100%; 303 width: 100%; 304 padding-left: 4px; 305 font-family: "Open Sans", sans-serif; 306 font-weight: 400; 307 color: #373737; 308 text-align: left; 309 outline: none; 310 border-style: solid; 311 border-width: thin; 312 border-color: #7F7F7F; 313 background-color: white; 314} 315.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input input { 316 width: 50%; 317 font-size: 16px; 318} 319.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input { 320 margin-top: 8px; 321 width: calc(100% - 16px); 322 height: 24px; 323 color: #373737; 324 line-height: 24px; 325 display: flex; 326 flex-flow: row; 327 flex-wrap: nowrap; 328 justify-content: space-around; 329 align-items: center; 330} 331.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input input { 332 display: block; 333 height: 100%; 334 width: 100%; 335 padding-left: 4px; 336 font-family: "Open Sans", sans-serif; 337 font-weight: 400; 338 color: #373737; 339 text-align: left; 340 outline: none; 341 border-style: solid; 342 border-width: thin; 343 border-color: #7F7F7F; 344 background-color: white; 345} 346.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input input { 347 font-size: 16px; 348} 349.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel { 350 width: 100%; 351 height: 28px; 352 display: flex; 353 flex-flow: row; 354 flex-wrap: nowrap; 355 justify-content: space-around; 356 align-items: center; 357} 358.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel div { 359 margin-top: 32px; 360 color: white; 361 font-family: "Open Sans", sans-serif; 362 font-size: 14px; 363 font-weight: 400; 364 width: 75px; 365 height: 28px; 366 line-height: 28px; 367 text-align: center; 368 border-color: transparent; 369 border-style: solid; 370 border-width: thin; 371 border-radius: 2px; 372} 373.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel div:first-child { 374 margin-left: 32px; 375 margin-right: 0; 376 background-color: #5ea4e0; 377} 378.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel div:last-child { 379 margin-left: 0; 380 margin-right: 32px; 381 background-color: #c4c4c4; 382} 383.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel div:first-child:hover {
384 cursor: pointer; 385 background-color: #3b5c7f; 386} 387.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel div:last-child:hover { 388 cursor: pointer; 389 background-color: #7f7f7f; 390} 391.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok { 392 width: 100%; 393 height: 36px; 394 margin-top: 32px; 395 display: flex; 396 flex-flow: row; 397 flex-wrap: nowrap; 398 justify-content: space-around; 399 align-items: center; 400} 401.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok div { 402 width: 98px; 403 height: 36px; 404 line-height: 36px; 405 text-align: center; 406 color: white; 407 font-family: "Open Sans", sans-serif; 408 font-size: medium; 409 font-weight: 400; 410 border-color: white; 411 border-style: solid; 412 border-width: thin; 413 border-radius: 4px; 414 background-color: #2B81AF; 415} 416.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok div:hover { 417 cursor: pointer; 418 background-color: #25597f; 419} 420 421.igv-ui-generic-container { 422 box-sizing: content-box; 423 position: absolute; 424 z-index: 2048; 425 background-color: white; 426 cursor: pointer; 427 display: flex; 428 flex-direction: row; 429 flex-wrap: wrap; 430 justify-content: flex-start; 431 align-items: center; 432} 433.igv-ui-generic-container > div:first-child { 434 cursor: move; 435 display: flex; 436 flex-flow: row; 437 flex-wrap: nowrap; 438 justify-content: flex-end; 439 align-items: center; 440 height: 24px; 441 width: 100%; 442 background-color: #dddddd; 443} 444.igv-ui-generic-container > div:first-child > div { 445 display: block; 446 color: #5f5f5f; 447 cursor: pointer; 448 width: 14px; 449 height: 14px; 450 margin-right: 8px; 451 margin-bottom: 4px; 452} 453 454.igv-ui-dialog { 455 z-index: 2048; 456 position: fixed; 457 width: fit-content; 458 height: fit-content; 459 display: flex; 460 flex-flow: column; 461 flex-wrap: nowrap; 462 justify-content: flex-start; 463 background-color: white; 464 border-color: #7F7F7F; 465 border-radius: 4px; 466 border-style: solid; 467 border-width: thin; 468 font-family: "Open Sans", sans-serif; 469 font-size: medium; 470 font-weight: 400; 471} 472.igv-ui-dialog .igv-ui-dialog-header { 473 display: flex; 474 flex-flow: row; 475 flex-wrap: nowrap; 476 justify-content: flex-end; 477 align-items: center; 478 width: 100%; 479 height: 24px; 480 cursor: move; 481 border-top-left-radius: 4px; 482 border-top-right-radius: 4px; 483 border-bottom-color: #7F7F7F; 484 border-bottom-style: solid; 485 border-bottom-width: thin; 486 background-color: #eee; 487} 488.igv-ui-dialog .igv-ui-dialog-header div { 489 margin-right: 4px; 490 margin-bottom: 2px; 491 height: 12px; 492 width: 12px; 493 color: #7F7F7F; 494} 495.igv-ui-dialog .igv-ui-dialog-header div:hover { 496 cursor: pointer; 497 color: #444; 498} 499.igv-ui-dialog .igv-ui-dialog-one-liner { 500 width: 95%; 501 height: 24px; 502 line-height: 24px; 503 text-align: left; 504 margin: 8px; 505 overflow-wrap: break-word; 506 background-color: white; 507 font-weight: bold; 508} 509.igv-ui-dialog .igv-ui-dialog-ok-cancel { 510 width: 100%; 511 display: flex; 512 flex-flow: row; 513 flex-wrap: nowrap; 514 justify-content: space-around; 515 align-items: center; 516} 517.igv-ui-dialog .igv-ui-dialog-ok-cancel div { 518 margin: 16px; 519 margin-top: 32px; 520 color: white; 521 font-family: "Open Sans", sans-serif; 522 font-size: 14px; 523 font-weight: 400; 524 width: 75px; 525 height: 28px; 526 line-height: 28px; 527 text-align: center; 528 border-color: transparent; 529 border-style: solid; 530 border-width: thin; 531 border-radius: 2px; 532} 533.igv-ui-dialog .igv-ui-dialog-ok-cancel div:first-child { 534 background-color: #5ea4e0; 535} 536.igv-ui-dialog .igv-ui-dialog-ok-cancel div:last-child { 537 background-color: #c4c4c4; 538} 539.igv-ui-dialog .igv-ui-dialog-ok-cancel div:first-child:hover { 540 cursor: pointer; 541 background-color: #3b5c7f; 542} 543.igv-ui-dialog .igv-ui-dialog-ok-cancel div:last-child:hover { 544 cursor: pointer; 545 background-color: #7f7f7f; 546} 547.igv-ui-dialog .igv-ui-dialog-ok { 548 width: 100%; 549 height: 36px; 550 margin-top: 32px; 551 display: flex; 552 flex-flow: row; 553 flex-wrap: nowrap; 554 justify-content: space-around; 555 align-items: center; 556} 557.igv-ui-dialog .igv-ui-dialog-ok div { 558 width: 98px; 559 height: 36px; 560 line-height: 36px; 561 text-align: center; 562 color: white; 563 font-family: "Open Sans", sans-serif; 564 font-size: medium; 565 font-weight: 400; 566 border-color: white; 567 border-style: solid; 568 border-width: thin; 569 border-radius: 4px; 570 background-color: #2B81AF; 571} 572.igv-ui-dialog .igv-ui-dialog-ok div:hover {
573 cursor: pointer; 574 background-color: #25597f; 575} 576 577.igv-ui-panel, .igv-ui-panel-row, .igv-ui-panel-column { 578 z-index: 2048; 579 background-color: white; 580 font-family: "Open Sans", sans-serif; 581 font-size: medium; 582 font-weight: 400; 583 display: flex; 584 justify-content: flex-start; 585 align-items: flex-start; 586} 587 588.igv-ui-panel-column { 589 display: flex; 590 flex-direction: column; 591} 592 593.igv-ui-panel-row { 594 display: flex; 595 flex-direction: row; 596} 597 598.igv-ui-textbox { 599 background-color: white; 600 font-family: "Open Sans", sans-serif; 601 font-size: medium; 602 font-weight: 400; 603 display: flex; 604 justify-content: flex-start; 605 align-items: flex-start; 606} 607 608.igv-ui-table { 609 background-color: white; 610} 611 612.igv-ui-table thead { 613 position: sticky; 614 top: 0; 615} 616 617.igv-ui-table th { 618 text-align: left; 619} 620 621.igv-ui-table td { 622 padding-right: 20px; 623} 624 625.igv-ui-table tr:hover { 626 background-color: lightblue; 627} 628 629/*# sourceMappingURL=igv-ui.css.map */ 630`,document.head.append(t)})());function ce(r,t){const e=ut.div({class:"igv-menu-popup-check-container"}),n=ut.div();e.appendChild(n);const i=Nr.createIcon("check",t===!0?"#444":"transparent");n.appendChild(i);const s=ut.div();return s.innerText=r,e.appendChild(s),e}const Xe={trackMenuItemList:function(r){const t=new Set(["alignment","annotation","variant","eqtl","snp"]),e=r.track.config&&r.track.config.visibilityWindow!==void 0;let n=[];return r.track.config.type!=="sequence"&&(n.push((function(i){const s=a=>{const l=function(){let c=i.browser.inputDialog.value;c=c===""||c===void 0?"untitled":c.trim(),i.track.name=c},h={label:"Track Name",value:Mp(i.track)||"unnamed",callback:l};i.browser.inputDialog.present(h,a)},o=pt("<div>");return o.text("Set track name"),{object:o,click:s}})(r)),n.push((function(i){const s=a=>{const l=()=>{const c=Number(i.browser.inputDialog.value,10);c!==void 0&&(i.track.minHeight!==void 0&&i.track.minHeight>c&&(i.track.minHeight=c),i.track.maxHeight!==void 0&&i.track.maxHeight<c&&(i.track.minHeight=c),i.setTrackHeight(c,!0),i.checkContentHeight(),i.repaintViews(),i.track.autoHeight=!1)},h={label:"Track Height",value:i.track.height,callback:l};i.browser.inputDialog.present(h,a)},o=pt("<div>");return o.text("Set track height"),{object:o,click:s}})(r))),this.showColorPicker(r.track)&&(n.push("<hr/>"),n.push($l({trackView:r,label:"Set track color",option:"color"})),n.push((function({trackView:i,label:s}){const o=pt("<div>");return o.text(s),{object:o,click:()=>{i.track.color=void 0,i.repaintViews()}}})({trackView:r,label:"Unset track color"})),r.track.config.type!=="wig"&&r.track.config.type!=="annotation"||(n.push($l({trackView:r,label:"Set alt color",option:"altColor"})),n.push((function({trackView:i,label:s}){const o=pt("<div>");return o.text(s),{object:o,click:()=>{i.track.altColor=void 0,i.repaintViews()}}})({trackView:r,label:"Unset alt color"})))),r.track.menuItemList&&(n=n.concat(r.track.menuItemList())),(e||t.has(r.track.type))&&(n.push("<hr/>"),n.push((function(i){const s=a=>{const l=()=>{let c=i.browser.inputDialog.value;c=c===""||c===void 0?-1:c.trim(),i.track.visibilityWindow=Number.parseInt(c),i.track.config.visibilityWindow=Number.parseInt(c),i.updateViews()},h={label:"Visibility Window",value:i.track.visibilityWindow,callback:l};i.browser.inputDialog.present(h,a)},o=pt("<div>");return o.text("Set visibility window"),{object:o,click:s}})(r))),r.track.removable!==!1&&(n.push("<hr/>"),n.push((function(i){const s=pt("<div>");return s.text("Remove track"),{object:s,click:()=>i.browser.removeTrack(i.track)}})(r))),n},numericDataMenuItems:function(r){const t=[];t.push("<hr/>");const e=pt("<div>");return e.text("Set data range"),t.push({object:e,click:()=>{r.browser.dataRangeDialog.configure(r),r.browser.dataRangeDialog.present(pt(r.browser.columnContainer))}}),r.track.logScale!==void 0&&t.push({object:pt(ce("Log scale",r.track.logScale)),click:()=>{r.track.logScale=!r.track.logScale,r.repaintViews()}}),t.push({object:pt(ce("Autoscale",r.track.autoscale)),click:()=>{r.track.autoscale=!r.track.autoscale,r.updateViews()}}),t},trackMenuItemListHelper:function(r,t){var e=[];return r.length>0&&(e=r.map((function(n,i){var s;if(n.name?(s=pt("<div>")).text(n.name):n.object?s=n.object:typeof n.label=="string"?(s=pt("<div>")).html(n.label):typeof n=="string"&&(s=n.startsWith("<")?pt(n):pt("<div>"+n+"</div>")),i===0&&s.addClass("igv-track-menu-border-top"),n.click){let o=function(a){n.click(a),t.hide(),a.preventDefault(),a.stopPropagation()};s.on("click",o),s.on("touchend",(function(a){o(a)})),s.on("mouseup",(function(a){a.preventDefault(),a.stopPropagation()}))}return{object:s,init:n.init||void 0}}))),e},showColorPicker:r=>r.type===void 0||r.type==="bedtype"||r.type==="alignment"||r.type==="annotation"||r.type==="variant"||r.type==="wig"||r.type==="interact",createMenuItem(r,t){const e=pt("<div>");return e.text(r),{object:e,click:t}}};function $l({trackView:r,label:t,option:e}){const n=pt("<div>");return n.text(t),{object:n,click:()=>r.presentColorPicker(e)}}function Mp(r){return r.trackView.viewports[0].$trackLabel.text()}class Gl{constructor(t,e,n){this.browser=t,this.$container=pt("<div>",{class:"igv-generic-dialog-container"}),e.append(this.$container),this.$container.offset({left:0,top:0});const i=pt("<div>",{class:"igv-generic-dialog-header"});this.$container.append(i),Vs.attachDialogCloseHandlerWithParent(i[0],(()=>{this.$minimum_input.val(void 0),this.$maximum_input.val(void 0),this.$container.offset({left:0,top:0}),this.$container.hide()})),this.$minimum=pt("<div>",{class:"igv-generic-dialog-label-input"}),this.$container.append(this.$minimum);const s=pt("<div>");s.text("Minimum"),this.$minimum.append(s),this.$minimum_input=pt("<input>"),this.$minimum.append(this.$minimum_input),this.$maximum=pt("<div>",{class:"igv-generic-dialog-label-input"}),this.$container.append(this.$maximum);const o=pt("<div>");o.text("Maximum"),this.$maximum.append(o),this.$maximum_input=pt("<input>"),this.$maximum.append(this.$maximum_input);const a=pt("<div>",{class:"igv-generic-dialog-ok-cancel"});this.$container.append(a),this.$ok=pt("<div>"),a.append(this.$ok),this.$ok.text("OK"),this.$cancel=pt("<div>"),a.append(this.$cancel),this.$cancel.text("Cancel"),this.$cancel.on("click",(()=>{this.$minimum_input.val(void 0),this.$maximum_input.val(void 0),this.$container.offset({left:0,top:0}),this.$container.hide()})),Br(this.$container.get(0),i.get(0)),this.$container.hide()}configure(t){const e=t.dataRange();let n,i;e?(n=e.min,i=e.max):(n=0,i=100),this.$minimum_input.val(n),this.$maximum_input.val(i),this.$minimum_input.unbind(),this.$minimum_input.on("keyup",(s=>{s.keyCode===13&&this.processResults(t)})),this.$maximum_input.unbind(),this.$maximum_input.on("keyup",(s=>{s.keyCode===13&&this.processResults(t)})),this.$ok.unbind(),this.$ok.on("click",(s=>{this.processResults(t)}))}processResults(t){const e=Number(this.$minimum_input.val()),n=Number(this.$maximum_input.val());
630isNaN(e)||isNaN(n)?this.browser.alert.present(new Error("Must input numeric values"),void 0):t.setDataRange(e,n),this.$minimum_input.val(void 0),this.$maximum_input.val(void 0),this.$container.offset({left:0,top:0}),this.$container.hide()}present(t){const e=t.offset().top,n=pt("body").scrollTop();this.$container.offset({left:t.width()-this.$container.width(),top:e+n}),this.$container.show()}}function ve(r){return typeof r=="string"||r instanceof String}function Ot(r){var t=String(r).split(/[.,]/);return t[0].split("").reverse().reduce((function(e,n,i){return i%3==0?e+","+n:e+n})).split("").reverse().join("")+(t[1]?"."+t[1]:"")}const Fr=function(r){return r.split(/\n|\r\n|\r/g)};function Rp(r,t){var e,n,i=[],s=r.length,o=0,a=!1;if(s>0)for(i[o]=r.charAt(0),e=1;e<s;e++)(n=r.charAt(e))==='"'?a=!a:a||n!==t?i[o]+=n:i[++o]="";return i}function js(r){return r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r}function Ii(r){if(r.name!==void 0)return r.name;if(ve(r)){let t=r.lastIndexOf("/"),e=t<0?r:r.substr(t+1);return t=e.indexOf("?"),t>0&&(e=e.substr(0,t)),e}throw Error("Expected File or string, got "+typeof r)}function xr(r){return!!r&&typeof r!="function"&&(r instanceof File||r.hasOwnProperty("name")&&typeof r.slice=="function"&&typeof r.arrayBuffer=="function")}function Ws(r,t){const e=document.createElement("a");e.setAttribute("href",t),e.setAttribute("download",r),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}function Zl(r){for(var t=Lp,e=t.parser.loose.exec(r),n={},i=14;i--;)n[t.key[i]]=e[i]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,(function(s,o,a){o&&(n[t.q.name][o]=a)})),n}typeof process=="object"&&typeof window>"u"&&(Na.atob=function(r){return Buffer.from(r,"base64").toString("binary")});const Lp={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function an(r){let t=r.length;for(;--t>=0;)r[t]=0}const $s=256,Ql=286,On=30,Dn=15,Gs=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ni=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ip=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Xl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fr=new Array(576);an(fr);const Pn=new Array(60);an(Pn);const zn=new Array(512);an(zn);const Hn=new Array(256);an(Hn);const Zs=new Array(29);an(Zs);const Bi=new Array(On);function Qs(r,t,e,n,i){this.static_tree=r,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}let Yl,Kl,Jl;function Xs(r,t){this.dyn_tree=r,this.max_code=0,this.stat_desc=t}an(Bi);const th=r=>r<256?zn[r]:zn[256+(r>>>7)],Un=(r,t)=>{r.pending_buf[r.pending++]=255&t,r.pending_buf[r.pending++]=t>>>8&255},Ne=(r,t,e)=>{r.bi_valid>16-e?(r.bi_buf|=t<<r.bi_valid&65535,Un(r,r.bi_buf),r.bi_buf=t>>16-r.bi_valid,r.bi_valid+=e-16):(r.bi_buf|=t<<r.bi_valid&65535,r.bi_valid+=e)},tr=(r,t,e)=>{Ne(r,e[2*t],e[2*t+1])},eh=(r,t)=>{let e=0;do e|=1&r,r>>>=1,e<<=1;while(--t>0);return e>>>1},rh=(r,t,e)=>{const n=new Array(16);let i,s,o=0;for(i=1;i<=Dn;i++)o=o+e[i-1]<<1,n[i]=o;for(s=0;s<=t;s++){let a=r[2*s+1];a!==0&&(r[2*s]=eh(n[a]++,a))}},nh=r=>{let t;for(t=0;t<Ql;t++)r.dyn_ltree[2*t]=0;for(t=0;t<On;t++)r.dyn_dtree[2*t]=0;for(t=0;t<19;t++)r.bl_tree[2*t]=0;r.dyn_ltree[512]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},ih=r=>{r.bi_valid>8?Un(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},sh=(r,t,e,n)=>{const i=2*t,s=2*e;return r[i]<r[s]||r[i]===r[s]&&n[t]<=n[e]},Ys=(r,t,e)=>{const n=r.heap[e];let i=e<<1;for(;i<=r.heap_len&&(i<r.heap_len&&sh(t,r.heap[i+1],r.heap[i],r.depth)&&i++,!sh(t,n,r.heap[i],r.depth));
630)r.heap[e]=r.heap[i],e=i,i<<=1;r.heap[e]=n},oh=(r,t,e)=>{let n,i,s,o,a=0;if(r.sym_next!==0)do n=255&r.pending_buf[r.sym_buf+a++],n+=(255&r.pending_buf[r.sym_buf+a++])<<8,i=r.pending_buf[r.sym_buf+a++],n===0?tr(r,i,t):(s=Hn[i],tr(r,s+$s+1,t),o=Gs[s],o!==0&&(i-=Zs[s],Ne(r,i,o)),n--,s=th(n),tr(r,s,e),o=Ni[s],o!==0&&(n-=Bi[s],Ne(r,n,o)));while(a<r.sym_next);tr(r,256,t)},Ks=(r,t)=>{const e=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,a,l,h=-1;for(r.heap_len=0,r.heap_max=573,o=0;o<s;o++)e[2*o]!==0?(r.heap[++r.heap_len]=h=o,r.depth[o]=0):e[2*o+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=h<2?++h:0,e[2*l]=1,r.depth[l]=0,r.opt_len--,i&&(r.static_len-=n[2*l+1]);for(t.max_code=h,o=r.heap_len>>1;o>=1;o--)Ys(r,e,o);l=s;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],Ys(r,e,1),a=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=a,e[2*l]=e[2*o]+e[2*a],r.depth[l]=(r.depth[o]>=r.depth[a]?r.depth[o]:r.depth[a])+1,e[2*o+1]=e[2*a+1]=l,r.heap[1]=l++,Ys(r,e,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],((c,u)=>{const p=u.dyn_tree,d=u.max_code,w=u.stat_desc.static_tree,m=u.stat_desc.has_stree,g=u.stat_desc.extra_bits,f=u.stat_desc.extra_base,b=u.stat_desc.max_length;let v,_,A,S,C,R,x=0;for(S=0;S<=Dn;S++)c.bl_count[S]=0;for(p[2*c.heap[c.heap_max]+1]=0,v=c.heap_max+1;v<573;v++)_=c.heap[v],S=p[2*p[2*_+1]+1]+1,S>b&&(S=b,x++),p[2*_+1]=S,_>d||(c.bl_count[S]++,C=0,_>=f&&(C=g[_-f]),R=p[2*_],c.opt_len+=R*(S+C),m&&(c.static_len+=R*(w[2*_+1]+C)));if(x!==0){do{for(S=b-1;c.bl_count[S]===0;)S--;c.bl_count[S]--,c.bl_count[S+1]+=2,c.bl_count[b]--,x-=2}while(x>0);for(S=b;S!==0;S--)for(_=c.bl_count[S];_!==0;)A=c.heap[--v],A>d||(p[2*A+1]!==S&&(c.opt_len+=(S-p[2*A+1])*p[2*A],p[2*A+1]=S),_--)}})(r,t),rh(e,h,r.bl_count)},ah=(r,t,e)=>{let n,i,s=-1,o=t[1],a=0,l=7,h=4;for(o===0&&(l=138,h=3),t[2*(e+1)+1]=65535,n=0;n<=e;n++)i=o,o=t[2*(n+1)+1],++a<l&&i===o||(a<h?r.bl_tree[2*i]+=a:i!==0?(i!==s&&r.bl_tree[2*i]++,r.bl_tree[32]++):a<=10?r.bl_tree[34]++:r.bl_tree[36]++,a=0,s=i,o===0?(l=138,h=3):i===o?(l=6,h=3):(l=7,h=4))},lh=(r,t,e)=>{let n,i,s=-1,o=t[1],a=0,l=7,h=4;for(o===0&&(l=138,h=3),n=0;n<=e;n++)if(i=o,o=t[2*(n+1)+1],!(++a<l&&i===o)){if(a<h)do tr(r,i,r.bl_tree);while(--a!=0);else i!==0?(i!==s&&(tr(r,i,r.bl_tree),a--),tr(r,16,r.bl_tree),Ne(r,a-3,2)):a<=10?(tr(r,17,r.bl_tree),Ne(r,a-3,3)):(tr(r,18,r.bl_tree),Ne(r,a-11,7));a=0,s=i,o===0?(l=138,h=3):i===o?(l=6,h=3):(l=7,h=4)}};let hh=!1;const ch=(r,t,e,n)=>{Ne(r,0+(n?1:0),3),ih(r),Un(r,e),Un(r,~e),e&&r.pending_buf.set(r.window.subarray(t,t+e),r.pending),r.pending+=e};var Np=(r,t,e,n)=>{let i,s,o=0;r.level>0?(r.strm.data_type===2&&(r.strm.data_type=(a=>{let l,h=4093624447;for(l=0;l<=31;l++,h>>>=1)if(1&h&&a.dyn_ltree[2*l]!==0)return 0;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return 1;for(l=32;l<$s;l++)if(a.dyn_ltree[2*l]!==0)return 1;return 0})(r)),Ks(r,r.l_desc),Ks(r,r.d_desc),o=(a=>{let l;for(ah(a,a.dyn_ltree,a.l_desc.max_code),ah(a,a.dyn_dtree,a.d_desc.max_code),Ks(a,a.bl_desc),l=18;l>=3&&a.bl_tree[2*Xl[l]+1]===0;l--);return a.opt_len+=3*(l+1)+5+5+4,l})(r),i=r.opt_len+3+7>>>3,s=r.static_len+3+7>>>3,s<=i&&(i=s)):i=s=e+5,e+4<=i&&t!==-1?ch(r,t,e,n):r.strategy===4||s===i?(Ne(r,2+(n?1:0),3),oh(r,fr,Pn)):(Ne(r,4+(n?1:0),3),((a,l,h,c)=>{let u;for(Ne(a,l-257,5),Ne(a,h-1,5),Ne(a,c-4,4),u=0;u<c;u++)Ne(a,a.bl_tree[2*Xl[u]+1],3);lh(a,a.dyn_ltree,l-1),lh(a,a.dyn_dtree,h-1)})(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),oh(r,r.dyn_ltree,r.dyn_dtree)),nh(r),n&&ih(r)},Bp={_tr_init:r=>{hh||((()=>{let t,e,n,i,s;const o=new Array(16);for(n=0,i=0;i<28;i++)for(Zs[i]=n,t=0;t<1<<Gs[i];t++)Hn[n++]=i;for(Hn[n-1]=i,s=0,i=0;i<16;i++)for(Bi[i]=s,t=0;t<1<<Ni[i];t++)zn[s++]=i;for(s>>=7;i<On;i++)for(Bi[i]=s<<7,t=0;t<1<<Ni[i]-7;t++)zn[256+s++]=i;for(e=0;e<=Dn;e++)o[e]=0;for(t=0;t<=143;)fr[2*t+1]=8,t++,o[8]++;for(;t<=255;)fr[2*t+1]=9,t++,o[9]++;for(;t<=279;)fr[2*t+1]=7,t++,o[7]++;for(;t<=287;)fr[2*t+1]=8,t++,o[8]++;for(rh(fr,287,o),t=0;t<On;t++)Pn[2*t+1]=5,Pn[2*t]=eh(t,5);Yl=new Qs(fr,Gs,257,Ql,Dn),Kl=new Qs(Pn,Ni,0,On,Dn),Jl=new Qs(new Array(0),Ip,0,19,7)})(),hh=!0),r.l_desc=new Xs(r.dyn_ltree,Yl),r.d_desc=new Xs(r.dyn_dtree,Kl),r.bl_desc=new Xs(r.bl_tree,Jl),r.bi_buf=0,r.b
630i_valid=0,nh(r)},_tr_stored_block:ch,_tr_flush_block:Np,_tr_tally:(r,t,e)=>(r.pending_buf[r.sym_buf+r.sym_next++]=t,r.pending_buf[r.sym_buf+r.sym_next++]=t>>8,r.pending_buf[r.sym_buf+r.sym_next++]=e,t===0?r.dyn_ltree[2*e]++:(r.matches++,t--,r.dyn_ltree[2*(Hn[e]+$s+1)]++,r.dyn_dtree[2*th(t)]++),r.sym_next===r.sym_end),_tr_align:r=>{Ne(r,2,3),tr(r,256,fr),(t=>{t.bi_valid===16?(Un(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(r)}},Vn=(r,t,e,n)=>{let i=65535&r,s=r>>>16&65535,o=0;for(;e!==0;){o=e>2e3?2e3:e,e-=o;do i=i+t[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16};const Fp=new Uint32Array((()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t})());var ye=(r,t,e,n)=>{const i=Fp,s=n+e;r^=-1;for(let o=n;o<s;o++)r=r>>>8^i[255&(r^t[o])];return~r},Or={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Fi={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Op,_tr_stored_block:Js,_tr_flush_block:Dp,_tr_tally:kr,_tr_align:Pp}=Bp,{Z_NO_FLUSH:Cr,Z_PARTIAL_FLUSH:zp,Z_FULL_FLUSH:Hp,Z_FINISH:We,Z_BLOCK:uh,Z_OK:ke,Z_STREAM_END:dh,Z_STREAM_ERROR:er,Z_DATA_ERROR:Up,Z_BUF_ERROR:to,Z_DEFAULT_COMPRESSION:Vp,Z_FILTERED:qp,Z_HUFFMAN_ONLY:Oi,Z_RLE:jp,Z_FIXED:Wp,Z_DEFAULT_STRATEGY:$p,Z_UNKNOWN:Gp,Z_DEFLATED:Di}=Fi,Dr=258,rr=262,ln=42,Pr=113,qn=666,zr=(r,t)=>(r.msg=Or[t],t),fh=r=>2*r-(r>4?9:0),Sr=r=>{let t=r.length;for(;--t>=0;)r[t]=0},Zp=r=>{let t,e,n,i=r.w_size;t=r.hash_size,n=t;do e=r.head[--n],r.head[n]=e>=i?e-i:0;while(--t);t=i,n=t;do e=r.prev[--n],r.prev[n]=e>=i?e-i:0;while(--t)};let Ar=(r,t,e)=>(t<<r.hash_shift^e)&r.hash_mask;const Pe=r=>{const t=r.state;let e=t.pending;e>r.avail_out&&(e=r.avail_out),e!==0&&(r.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),r.next_out),r.next_out+=e,t.pending_out+=e,r.total_out+=e,r.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},ze=(r,t)=>{Dp(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,t),r.block_start=r.strstart,Pe(r.strm)},Gt=(r,t)=>{r.pending_buf[r.pending++]=t},jn=(r,t)=>{r.pending_buf[r.pending++]=t>>>8&255,r.pending_buf[r.pending++]=255&t},eo=(r,t,e,n)=>{let i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,t.set(r.input.subarray(r.next_in,r.next_in+i),e),r.state.wrap===1?r.adler=Vn(r.adler,t,i,e):r.state.wrap===2&&(r.adler=ye(r.adler,t,i,e)),r.next_in+=i,r.total_in+=i,i)},ph=(r,t)=>{let e,n,i=r.max_chain_length,s=r.strstart,o=r.prev_length,a=r.nice_match;const l=r.strstart>r.w_size-rr?r.strstart-(r.w_size-rr):0,h=r.window,c=r.w_mask,u=r.prev,p=r.strstart+Dr;let d=h[s+o-1],w=h[s+o];r.prev_length>=r.good_match&&(i>>=2),a>r.lookahead&&(a=r.lookahead);do if(e=t,h[e+o]===w&&h[e+o-1]===d&&h[e]===h[s]&&h[++e]===h[s+1]){s+=2,e++;do;while(h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&h[++s]===h[++e]&&s<p);if(n=Dr-(p-s),s=p-Dr,n>o){if(r.match_start=t,o=n,n>=a)break;d=h[s+o-1],w=h[s+o]}}while((t=u[t&c])>l&&--i!=0);return o<=r.lookahead?o:r.lookahead},hn=r=>{const t=r.w_size;let e,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=t+(t-rr)&&(r.window.set(r.window.subarray(t,t+t-n),0),r.match_start-=t,r.strstart-=t,r.block_start-=t,r.insert>r.strstart&&(r.insert=r.strstart),Zp(r),n+=t),r.strm.avail_in===0)break;if(e=eo(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=e,r.lookahead+r.insert>=3)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=Ar(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=Ar(r,r.ins_h,r.window[i+3-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert<3)););}while(r.lookahead<rr&&r.strm.avail_in!==0)},gh=(r,t)=>{let e,n,i,s=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,o=0,a=r.strm.avail_in;
vendor: 6,018 bytes, line 630
630do{if(e=65535,i=r.bi_valid+42>>3,r.strm.avail_out<i||(i=r.strm.avail_out-i,n=r.strstart-r.block_start,e>n+r.strm.avail_in&&(e=n+r.strm.avail_in),e>i&&(e=i),e<s&&(e===0&&t!==We||t===Cr||e!==n+r.strm.avail_in)))break;o=t===We&&e===n+r.strm.avail_in?1:0,Js(r,0,0,o),r.pending_buf[r.pending-4]=e,r.pending_buf[r.pending-3]=e>>8,r.pending_buf[r.pending-2]=~e,r.pending_buf[r.pending-1]=~e>>8,Pe(r.strm),n&&(n>e&&(n=e),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,e-=n),e&&(eo(r.strm,r.strm.output,r.strm.next_out,e),r.strm.next_out+=e,r.strm.avail_out-=e,r.strm.total_out+=e)}while(o===0);return a-=r.strm.avail_in,a&&(a>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=a&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-a,r.strm.next_in),r.strstart),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?4:t!==Cr&&t!==We&&r.strm.avail_in===0&&r.strstart===r.block_start?2:(i=r.window_size-r.strstart,r.strm.avail_in>i&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,i+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),i>r.strm.avail_in&&(i=r.strm.avail_in),i&&(eo(r.strm,r.window,r.strstart,i),r.strstart+=i,r.insert+=i>r.w_size-r.insert?r.w_size-r.insert:i),r.high_water<r.strstart&&(r.high_water=r.strstart),i=r.bi_valid+42>>3,i=r.pending_buf_size-i>65535?65535:r.pending_buf_size-i,s=i>r.w_size?r.w_size:i,n=r.strstart-r.block_start,(n>=s||(n||t===We)&&t!==Cr&&r.strm.avail_in===0&&n<=i)&&(e=n>i?i:n,o=t===We&&r.strm.avail_in===0&&e===n?1:0,Js(r,r.block_start,e,o),r.block_start+=e,Pe(r.strm)),o?3:1)},ro=(r,t)=>{let e,n;for(;;){if(r.lookahead<rr){if(hn(r),r.lookahead<rr&&t===Cr)return 1;if(r.lookahead===0)break}if(e=0,r.lookahead>=3&&(r.ins_h=Ar(r,r.ins_h,r.window[r.strstart+3-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),e!==0&&r.strstart-e<=r.w_size-rr&&(r.match_length=ph(r,e)),r.match_length>=3)if(n=kr(r,r.strstart-r.match_start,r.match_length-3),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=3){r.match_length--;do r.strstart++,r.ins_h=Ar(r,r.ins_h,r.window[r.strstart+3-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!=0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Ar(r,r.ins_h,r.window[r.strstart+1]);else n=kr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(ze(r,!1),r.strm.avail_out===0))return 1}return r.insert=r.strstart<2?r.strstart:2,t===We?(ze(r,!0),r.strm.avail_out===0?3:4):r.sym_next&&(ze(r,!1),r.strm.avail_out===0)?1:2},cn=(r,t)=>{let e,n,i;for(;;){if(r.lookahead<rr){if(hn(r),r.lookahead<rr&&t===Cr)return 1;if(r.lookahead===0)break}if(e=0,r.lookahead>=3&&(r.ins_h=Ar(r,r.ins_h,r.window[r.strstart+3-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=2,e!==0&&r.prev_length<r.max_lazy_match&&r.strstart-e<=r.w_size-rr&&(r.match_length=ph(r,e),r.match_length<=5&&(r.strategy===qp||r.match_length===3&&r.strstart-r.match_start>4096)&&(r.match_length=2)),r.prev_length>=3&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-3,n=kr(r,r.strstart-1-r.prev_match,r.prev_length-3),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=Ar(r,r.ins_h,r.window[r.strstart+3-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!=0);if(r.match_available=0,r.match_length=2,r.strstart++,n&&(ze(r,!1),r.strm.avail_out===0))return 1}else if(r.match_available){if(n=kr(r,0,r.window[r.strstart-1]),n&&ze(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return 1}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=kr(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<2?r.strstart:2,t===We?(ze(r,!0),r.strm.avail_out===0?3:4):r.sym_next&&(ze(r,!1),r.strm.avail_out===0)?1:2};function nr(r,t,e,n,i){this.good_length=r,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=i}const Wn=[new nr(0,0,0,0,gh),new nr(4,4,8,4,ro),new nr(4,5,16,8,ro),new nr(4,6,32,32,ro),new nr(4,4,16,16,cn),new nr(8,16,32,32,cn),new nr(8,16,128,128,cn),new nr(8,32,128,256,cn),new nr(32,128,258,1024,cn),new nr(32,258,258,4096,cn)];function Qp(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Di,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Sr(this.dyn_ltree),Sr(this.dyn_dtree),Sr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Sr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Sr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const $n=r=>
630{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.status!==ln&&t.status!==57&&t.status!==69&&t.status!==73&&t.status!==91&&t.status!==103&&t.status!==Pr&&t.status!==qn?1:0},mh=r=>{if($n(r))return zr(r,er);r.total_in=r.total_out=0,r.data_type=Gp;const t=r.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?57:t.wrap?ln:Pr,r.adler=t.wrap===2?0:1,t.last_flush=-2,Op(t),ke},bh=r=>{const t=mh(r);var e;return t===ke&&((e=r.state).window_size=2*e.w_size,Sr(e.head),e.max_lazy_match=Wn[e.level].max_lazy,e.good_match=Wn[e.level].good_length,e.nice_match=Wn[e.level].nice_length,e.max_chain_length=Wn[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),t},wh=(r,t,e,n,i,s)=>{if(!r)return er;let o=1;if(t===Vp&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>9||e!==Di||n<8||n>15||t<0||t>9||s<0||s>Wp||n===8&&o!==1)return zr(r,er);n===8&&(n=9);const a=new Qp;return r.state=a,a.strm=r,a.status=ln,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=s,a.method=e,bh(r)};var Xp=(r,t)=>{let e=t.length;if($n(r))return er;const n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==ln||n.lookahead)return er;if(i===1&&(r.adler=Vn(r.adler,t,e,0)),n.wrap=0,e>=n.w_size){i===0&&(Sr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let l=new Uint8Array(n.w_size);l.set(t.subarray(e-n.w_size,e),0),t=l,e=n.w_size}const s=r.avail_in,o=r.next_in,a=r.input;for(r.avail_in=e,r.next_in=0,r.input=t,hn(n);n.lookahead>=3;){let l=n.strstart,h=n.lookahead-2;do n.ins_h=Ar(n,n.ins_h,n.window[l+3-1]),n.prev[l&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=l,l++;while(--h);n.strstart=l,n.lookahead=2,hn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,r.next_in=o,r.input=a,r.avail_in=s,n.wrap=i,ke},Gn={deflateInit:(r,t)=>wh(r,t,Di,15,8,$p),deflateInit2:wh,deflateReset:bh,deflateResetKeep:mh,deflateSetHeader:(r,t)=>$n(r)||r.state.wrap!==2?er:(r.state.gzhead=t,ke),deflate:(r,t)=>{if($n(r)||t>uh||t<0)return r?zr(r,er):er;const e=r.state;if(!r.output||r.avail_in!==0&&!r.input||e.status===qn&&t!==We)return zr(r,r.avail_out===0?to:er);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Pe(r),r.avail_out===0)return e.last_flush=-1,ke}else if(r.avail_in===0&&fh(t)<=fh(n)&&t!==We)return zr(r,to);if(e.status===qn&&r.avail_in!==0)return zr(r,to);if(e.status===ln&&e.wrap===0&&(e.status=Pr),e.status===ln){let i=Di+(e.w_bits-8<<4)<<8,s=-1;if(s=e.strategy>=Oi||e.level<2?0:e.level<6?1:e.level===6?2:3,i|=s<<6,e.strstart!==0&&(i|=32),i+=31-i%31,jn(e,i),e.strstart!==0&&(jn(e,r.adler>>>16),jn(e,65535&r.adler)),r.adler=1,e.status=Pr,Pe(r),e.pending!==0)return e.last_flush=-1,ke}if(e.status===57){if(r.adler=0,Gt(e,31),Gt(e,139),Gt(e,8),e.gzhead)Gt(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),Gt(e,255&e.gzhead.time),Gt(e,e.gzhead.time>>8&255),Gt(e,e.gzhead.time>>16&255),Gt(e,e.gzhead.time>>24&255),Gt(e,e.level===9?2:e.strategy>=Oi||e.level<2?4:0),Gt(e,255&e.gzhead.os),e.gzhead.extra&&e.gzhead.extra.length&&(Gt(e,255&e.gzhead.extra.length),Gt(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(r.adler=ye(r.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=69;else if(Gt(e,0),Gt(e,0),Gt(e,0),Gt(e,0),Gt(e,0),Gt(e,e.level===9?2:e.strategy>=Oi||e.level<2?4:0),Gt(e,3),e.status=Pr,Pe(r),e.pending!==0)return e.last_flush=-1,ke}if(e.status===69){if(e.gzhead.extra){let i=e.pending,s=(65535&e.gzhead.extra.length)-e.gzindex;for(;e.pending+s>e.pending_buf_size;){let a=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+a),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>
630i&&(r.adler=ye(r.adler,e.pending_buf,e.pending-i,i)),e.gzindex+=a,Pe(r),e.pending!==0)return e.last_flush=-1,ke;i=0,s-=a}let o=new Uint8Array(e.gzhead.extra);e.pending_buf.set(o.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending+=s,e.gzhead.hcrc&&e.pending>i&&(r.adler=ye(r.adler,e.pending_buf,e.pending-i,i)),e.gzindex=0}e.status=73}if(e.status===73){if(e.gzhead.name){let i,s=e.pending;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=ye(r.adler,e.pending_buf,e.pending-s,s)),Pe(r),e.pending!==0)return e.last_flush=-1,ke;s=0}i=e.gzindex<e.gzhead.name.length?255&e.gzhead.name.charCodeAt(e.gzindex++):0,Gt(e,i)}while(i!==0);e.gzhead.hcrc&&e.pending>s&&(r.adler=ye(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=91}if(e.status===91){if(e.gzhead.comment){let i,s=e.pending;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=ye(r.adler,e.pending_buf,e.pending-s,s)),Pe(r),e.pending!==0)return e.last_flush=-1,ke;s=0}i=e.gzindex<e.gzhead.comment.length?255&e.gzhead.comment.charCodeAt(e.gzindex++):0,Gt(e,i)}while(i!==0);e.gzhead.hcrc&&e.pending>s&&(r.adler=ye(r.adler,e.pending_buf,e.pending-s,s))}e.status=103}if(e.status===103){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Pe(r),e.pending!==0))return e.last_flush=-1,ke;Gt(e,255&r.adler),Gt(e,r.adler>>8&255),r.adler=0}if(e.status=Pr,Pe(r),e.pending!==0)return e.last_flush=-1,ke}if(r.avail_in!==0||e.lookahead!==0||t!==Cr&&e.status!==qn){let i=e.level===0?gh(e,t):e.strategy===Oi?((s,o)=>{let a;for(;;){if(s.lookahead===0&&(hn(s),s.lookahead===0)){if(o===Cr)return 1;break}if(s.match_length=0,a=kr(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,a&&(ze(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===We?(ze(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ze(s,!1),s.strm.avail_out===0)?1:2})(e,t):e.strategy===jp?((s,o)=>{let a,l,h,c;const u=s.window;for(;;){if(s.lookahead<=Dr){if(hn(s),s.lookahead<=Dr&&o===Cr)return 1;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=3&&s.strstart>0&&(h=s.strstart-1,l=u[h],l===u[++h]&&l===u[++h]&&l===u[++h])){c=s.strstart+Dr;do;while(l===u[++h]&&l===u[++h]&&l===u[++h]&&l===u[++h]&&l===u[++h]&&l===u[++h]&&l===u[++h]&&l===u[++h]&&h<c);s.match_length=Dr-(c-h),s.match_length>s.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=3?(a=kr(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(a=kr(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),a&&(ze(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===We?(ze(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ze(s,!1),s.strm.avail_out===0)?1:2})(e,t):Wn[e.level].func(e,t);if(i!==3&&i!==4||(e.status=qn),i===1||i===3)return r.avail_out===0&&(e.last_flush=-1),ke;if(i===2&&(t===zp?Pp(e):t!==uh&&(Js(e,0,0,!1),t===Hp&&(Sr(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Pe(r),r.avail_out===0))return e.last_flush=-1,ke}return t!==We?ke:e.wrap<=0?dh:(e.wrap===2?(Gt(e,255&r.adler),Gt(e,r.adler>>8&255),Gt(e,r.adler>>16&255),Gt(e,r.adler>>24&255),Gt(e,255&r.total_in),Gt(e,r.total_in>>8&255),Gt(e,r.total_in>>16&255),Gt(e,r.total_in>>24&255)):(jn(e,r.adler>>>16),jn(e,65535&r.adler)),Pe(r),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?ke:dh)},deflateEnd:r=>{if($n(r))return er;const t=r.state.status;return r.state=null,t===Pr?zr(r,Up):ke},deflateSetDictionary:Xp,deflateInfo:"pako deflate (from Nodeca project)"};const Yp=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var Pi={assign:function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Yp(e,n)&&(r[n]=e[n])}}return r},flattenChunks:r=>{let t=0;for(let n=0,i=r.length;n<i;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,i=0,s=r.length;n<s;n++){let o=r[n];e.set(o,i),i+=o.length}return e}};let vh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{vh=!1}const Zn=new Uint8Array(256);for(let r=0;r<256;r++)Zn[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Zn[254]=Zn[254]=1;var Qn={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,i,s,o=r.length,a=0;for(i=0;i<o;i++)e=r.charCodeAt(i),(64512&e)==55296&&i+1<o&&(n=r.charCodeAt(i+1),(64512&n)==56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(a),s=0,i=0;s<a;i++)e=r.charCodeAt(i),(64512&e)==55296&&i+1<o&&(n=r.charCodeAt(i+1),(64512&n)==56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),e<128?t[
630s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|63&e):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|63&e):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|63&e);return t},buf2string:(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,i;const s=new Array(2*e);for(i=0,n=0;n<e;){let o=r[n++];if(o<128){s[i++]=o;continue}let a=Zn[o];if(a>4)s[i++]=65533,n+=a-1;else{for(o&=a===2?31:a===3?15:7;a>1&&n<e;)o=o<<6|63&r[n++],a--;a>1?s[i++]=65533:o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|1023&o)}}return((o,a)=>{if(a<65534&&o.subarray&&vh)return String.fromCharCode.apply(null,o.length===a?o:o.subarray(0,a));let l="";for(let h=0;h<a;h++)l+=String.fromCharCode(o[h]);return l})(s,i)},utf8border:(r,t)=>{(t=t||r.length)>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(192&r[e])==128;)e--;return e<0||e===0?t:e+Zn[r[e]]>t?e:t}},yh=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const _h=Object.prototype.toString,{Z_NO_FLUSH:Kp,Z_SYNC_FLUSH:Jp,Z_FULL_FLUSH:tg,Z_FINISH:eg,Z_OK:zi,Z_STREAM_END:rg,Z_DEFAULT_COMPRESSION:ng,Z_DEFAULT_STRATEGY:ig,Z_DEFLATED:sg}=Fi;function Hi(r){this.options=Pi.assign({level:ng,method:sg,chunkSize:16384,windowBits:15,memLevel:8,strategy:ig},r||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yh,this.strm.avail_out=0;let e=Gn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==zi)throw new Error(Or[e]);if(t.header&&Gn.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(n=typeof t.dictionary=="string"?Qn.string2buf(t.dictionary):_h.call(t.dictionary)==="[object ArrayBuffer]"?new Uint8Array(t.dictionary):t.dictionary,e=Gn.deflateSetDictionary(this.strm,n),e!==zi)throw new Error(Or[e]);this._dict_set=!0}}function og(r,t){const e=new Hi(t);if(e.push(r,!0),e.err)throw e.msg||Or[e.err];return e.result}Hi.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=t===~~t?t:t===!0?eg:Kp,typeof r=="string"?e.input=Qn.string2buf(r):_h.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;)if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(s===Jp||s===tg)&&e.avail_out<=6)this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;else{if(i=Gn.deflate(e,s),i===rg)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),i=Gn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===zi;if(e.avail_out!==0){if(s>0&&e.next_out>0)this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;else if(e.avail_in===0)break}else this.onData(e.output)}return!0},Hi.prototype.onData=function(r){this.chunks.push(r)},Hi.prototype.onEnd=function(r){r===zi&&(this.result=Pi.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var ag=function(r,t){return(t=t||{}).raw=!0,og(r,t)},lg={deflateRaw:ag};const Ui=16209;var hg=function(r,t){let e,n,i,s,o,a,l,h,c,u,p,d,w,m,g,f,b,v,_,A,S,C,R,x;const T=r.state;e=r.next_in,R=r.input,n=e+(r.avail_in-5),i=r.next_out,x=r.output,s=i-(t-r.avail_out),o=i+(r.avail_out-257),a=T.dmax,l=T.wsize,h=T.whave,c=T.wnext,u=T.window,p=T.hold,d=T.bits,w=T.lencode,m=T.distcode,g=(1<<T.lenbits)-1,f=(1<<T.distbits)-1;t:do{d<15&&(p+=R[e++]<<d,d+=8,p+=R[e++]<<d,d+=8),b=w[p&g];e:for(;;){if(v=b>>>24,p>>>=v,d-=v,v=b>>>16&255,v===0)x[i++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break t}r.msg="invalid literal/length code",T.mode=Ui;break t}b=w[(65535&b)+(p&(1<<v)-1)];continue e}for(_=65535&b,v&=15,v&&(d<v&&(p+=R[e++]<<d,d+=8),_+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=R[e++]<<d,d+=8,p+=R[e++]<<d,d+=8),b=m[p&f];;){if(v=b>>>24,p>>>=v,d-=v,v=b>>>16&255,16&v){if(A=65535&b,v&=15,d<v&&(p+=R[e++]<<d,d+=8,d<v&&(p+=R[e++]<<d,d+=8)),A+=p&(1<<v)-1,A>a){r.msg="invalid distance too far back",T.mode=Ui;break t}if(p>>>=v,d-=v,v=i-s,A>v){if(v=A-v,v>h&&T.sane){r.msg="invalid distance too far back",T.mode=Ui;break t}if(S=0,C=u,c===0){if(S+=l-v,v<_){_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}}else if(c<v){if(S+=l+c-v,v-=c,v<_){_-=v;do x[i++]=u[S++];while(--v);if(S=0,c<_){v=c,_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}}}else if(S+=c-v,v<_){_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}for(;_>2;)x[i++]=C[S++],x[i++]=C[S++],x[i++]=C[S++],_-=3;_&&(x[i++]=C[S++],_>1&&(x[i++]=C[S++]))}else{S=i-A;do x[i++]=x[S++],x[i++]=x[S++],x[i++]=x[S++],_-=3;while(_>2);_&&(x[i++]=x[S++],_>1&&(x[i++]=x[S++]))}break}if(64&v){r.msg="invalid distance code",T.mode=Ui;break t}b=m[(65535&b)+(p&(1<<v)-1)]}}break}}while(e<n&&i<o);_=d>>3,e-=_,d-=_<<3,p&=(1<<d)-1,r.next_in=e,r.next_out=i,r.avail_in=e<n?n-e+5:5-(e-n),r.avail_out=i<o?o-i+257:257-(i-o),T.hold=p,T.bits=d};
630const Vi=15,cg=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ug=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),dg=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),fg=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Xn=(r,t,e,n,i,s,o,a)=>{const l=a.bits;let h,c,u,p,d,w,m=0,g=0,f=0,b=0,v=0,_=0,A=0,S=0,C=0,R=0,x=null;const T=new Uint16Array(16),y=new Uint16Array(16);let E,L,N,q=null;for(m=0;m<=Vi;m++)T[m]=0;for(g=0;g<n;g++)T[t[e+g]]++;for(v=l,b=Vi;b>=1&&T[b]===0;b--);if(v>b&&(v=b),b===0)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(f=1;f<b&&T[f]===0;f++);for(v<f&&(v=f),S=1,m=1;m<=Vi;m++)if(S<<=1,S-=T[m],S<0)return-1;if(S>0&&(r===0||b!==1))return-1;for(y[1]=0,m=1;m<Vi;m++)y[m+1]=y[m]+T[m];for(g=0;g<n;g++)t[e+g]!==0&&(o[y[t[e+g]]++]=g);if(r===0?(x=q=o,w=20):r===1?(x=cg,q=ug,w=257):(x=dg,q=fg,w=0),R=0,g=0,m=f,d=s,_=v,A=0,u=-1,C=1<<v,p=C-1,r===1&&C>852||r===2&&C>592)return 1;for(;;){E=m-A,o[g]+1<w?(L=0,N=o[g]):o[g]>=w?(L=q[o[g]-w],N=x[o[g]-w]):(L=96,N=0),h=1<<m-A,c=1<<_,f=c;do c-=h,i[d+(R>>A)+c]=E<<24|L<<16|N;while(c!==0);for(h=1<<m-1;R&h;)h>>=1;if(h!==0?(R&=h-1,R+=h):R=0,g++,--T[m]==0){if(m===b)break;m=t[e+o[g]]}if(m>v&&(R&p)!==u){for(A===0&&(A=v),d+=f,_=m-A,S=1<<_;_+A<b&&(S-=T[_+A],!(S<=0));)_++,S<<=1;if(C+=1<<_,r===1&&C>852||r===2&&C>592)return 1;u=R&p,i[u]=v<<24|_<<16|d-s}}return R!==0&&(i[d+R]=m-A<<24|64<<16),a.bits=v,0};const{Z_FINISH:xh,Z_BLOCK:pg,Z_TREES:qi,Z_OK:Hr,Z_STREAM_END:gg,Z_NEED_DICT:mg,Z_STREAM_ERROR:$e,Z_DATA_ERROR:kh,Z_MEM_ERROR:Ch,Z_BUF_ERROR:bg,Z_DEFLATED:Sh}=Fi,ji=16180,Wi=16190,pr=16191,no=16192,io=16194,$i=16199,Gi=16200,so=16206,ae=16209,Ah=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function wg(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ur=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<ji||t.mode>16211?1:0},Eh=r=>{if(Ur(r))return $e;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=1&t.wrap),t.mode=ji,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Hr},Th=r=>{if(Ur(r))return $e;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,Eh(r)},Mh=(r,t)=>{let e;if(Ur(r))return $e;const n=r.state;return t<0?(e=0,t=-t):(e=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?$e:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Th(r))},Rh=(r,t)=>{if(!r)return $e;const e=new wg;r.state=e,e.strm=r,e.window=null,e.mode=ji;const n=Mh(r,t);return n!==Hr&&(r.state=null),n};let oo,ao,Lh=!0;const vg=r=>{if(Lh){oo=new Int32Array(512),ao=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Xn(1,r.lens,0,288,oo,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Xn(2,r.lens,0,32,ao,0,r.work,{bits:5}),Lh=!1}r.lencode=oo,r.lenbits=9,r.distcode=ao,r.distbits=5},Ih=(r,t,e,n)=>{let i;const s=r.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),s.window.set(t.subarray(e-n,e-n+i),s.wnext),(n-=i)?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0};var yg=(r,t)=>{let e,n,i,s,o,a,l,h,c,u,p,d,w,m,g,f,b,v,_,A,S,C,R=0;const x=new Uint8Array(4);let T,y;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ur(r)||!r.output||!r.input&&r.avail_in!==0)return $e;
vendor: 5,450 bytes, line 630
630e=r.state,e.mode===pr&&(e.mode=no),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,h=e.hold,c=e.bits,u=a,p=l,C=Hr;t:for(;;)switch(e.mode){case ji:if(e.wrap===0){e.mode=no;break}for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(2&e.wrap&&h===35615){e.wbits===0&&(e.wbits=15),e.check=0,x[0]=255&h,x[1]=h>>>8&255,e.check=ye(e.check,x,2,0),h=0,c=0,e.mode=16181;break}if(e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&h)<<8)+(h>>8))%31){r.msg="incorrect header check",e.mode=ae;break}if((15&h)!==Sh){r.msg="unknown compression method",e.mode=ae;break}if(h>>>=4,c-=4,S=8+(15&h),e.wbits===0&&(e.wbits=S),S>15||S>e.wbits){r.msg="invalid window size",e.mode=ae;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=512&h?16189:pr,h=0,c=0;break;case 16181:for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(e.flags=h,(255&e.flags)!==Sh){r.msg="unknown compression method",e.mode=ae;break}if(57344&e.flags){r.msg="unknown header flags set",e.mode=ae;break}e.head&&(e.head.text=h>>8&1),512&e.flags&&4&e.wrap&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ye(e.check,x,2,0)),h=0,c=0,e.mode=16182;case 16182:for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.head&&(e.head.time=h),512&e.flags&&4&e.wrap&&(x[0]=255&h,x[1]=h>>>8&255,x[2]=h>>>16&255,x[3]=h>>>24&255,e.check=ye(e.check,x,4,0)),h=0,c=0,e.mode=16183;case 16183:for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=255&h,e.head.os=h>>8),512&e.flags&&4&e.wrap&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ye(e.check,x,2,0)),h=0,c=0,e.mode=16184;case 16184:if(1024&e.flags){for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.length=h,e.head&&(e.head.extra_len=h),512&e.flags&&4&e.wrap&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ye(e.check,x,2,0)),h=0,c=0}else e.head&&(e.head.extra=null);e.mode=16185;case 16185:if(1024&e.flags&&(d=e.length,d>a&&(d=a),d&&(e.head&&(S=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+d),S)),512&e.flags&&4&e.wrap&&(e.check=ye(e.check,n,d,s)),a-=d,s+=d,e.length-=d),e.length))break t;e.length=0,e.mode=16186;case 16186:if(2048&e.flags){if(a===0)break t;d=0;do S=n[s+d++],e.head&&S&&e.length<65536&&(e.head.name+=String.fromCharCode(S));while(S&&d<a);if(512&e.flags&&4&e.wrap&&(e.check=ye(e.check,n,d,s)),a-=d,s+=d,S)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=16187;case 16187:if(4096&e.flags){if(a===0)break t;d=0;do S=n[s+d++],e.head&&S&&e.length<65536&&(e.head.comment+=String.fromCharCode(S));while(S&&d<a);if(512&e.flags&&4&e.wrap&&(e.check=ye(e.check,n,d,s)),a-=d,s+=d,S)break t}else e.head&&(e.head.comment=null);e.mode=16188;case 16188:if(512&e.flags){for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(4&e.wrap&&h!==(65535&e.check)){r.msg="header crc mismatch",e.mode=ae;break}h=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=pr;break;case 16189:for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}r.adler=e.check=Ah(h),h=0,c=0,e.mode=Wi;case Wi:if(e.havedict===0)return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,mg;r.adler=e.check=1,e.mode=pr;case pr:if(t===pg||t===qi)break t;case no:if(e.last){h>>>=7&c,c-=7&c,e.mode=so;break}for(;c<3;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}switch(e.last=1&h,h>>>=1,c-=1,3&h){case 0:e.mode=16193;break;case 1:if(vg(e),e.mode=$i,t===qi){h>>>=2,c-=2;break t}break;case 2:e.mode=16196;break;case 3:r.msg="invalid block type",e.mode=ae}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if((65535&h)!=(h>>>16^65535)){r.msg="invalid stored block lengths",e.mode=ae;break}if(e.length=65535&h,h=0,c=0,e.mode=io,t===qi)break t;case io:e.mode=16195;case 16195:if(d=e.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break t;i.set(n.subarray(s,s+d),o),a-=d,s+=d,l-=d,o+=d,e.length-=d;break}e.mode=pr;break;case 16196:for(;c<14;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(e.nlen=257+(31&h),h>>>=5,c-=5,e.ndist=1+(31&h),h>>>=5,c-=5,e.ncode=4+(15&h),h>>>=4,c-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=ae;break}e.have=0,e.mode=16197;case 16197:for(;e.have<e.ncode;){for(;c<3;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.lens[E[e.have++]]=7&h,h>>>=3,c-=3}for(;e.have<19;)e.lens[E[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,T={bits:e.lenbits},C=Xn(0,e.lens,0,19,e.lencode,0,e.work,T),e.lenbits=T.bits,C){r.msg="invalid code lengths set",e.mode=ae;break}e.have=0,e.mode=16198;case 16198:for(;e.have<e.nlen+e.ndist;){for(;R=e.lencode[h&(1<<e.lenbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(b<16)h>>>=g,c-=g,e.lens[e.have++]=b;else{if(b===16){for(y=g+2;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(h>>>=g,c-=g,e.have===0){r.msg="invalid bit length repeat",e.mode=ae;break}S=e.lens[e.have-1],d=3+(3&h),h>>>=2,c-=2}else if(b===17){for(y=g+3;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=g,c-=g,S=0,d=3+(7&h),h>>>=3,c-=3}else{for(y=g+7;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=g,c-=g,S=0,d=11+(127&h),h>>>=7,c-=7}if(e.have+d>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=ae;break}for(;d--;)e.lens[e.have++]=S}}if(e.mode===ae)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=ae;break}if(e.lenbits=9,T={bits:e.lenbits},C=Xn(1,e.lens,0,e.nlen,e.lencode,0,e.work,T),e.lenbits=T.bits,C){r.msg="invalid literal/lengths set",e.mode=ae;break}if(e.distbits=6,e.distcode=e.distdyn,T={bits:e.distbits}
vendor: 5,184 bytes, line 630
630,C=Xn(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,T),e.distbits=T.bits,C){r.msg="invalid distances set",e.mode=ae;break}if(e.mode=$i,t===qi)break t;case $i:e.mode=Gi;case Gi:if(a>=6&&l>=258){r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,hg(r,p),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,h=e.hold,c=e.bits,e.mode===pr&&(e.back=-1);break}for(e.back=0;R=e.lencode[h&(1<<e.lenbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(f&&!(240&f)){for(v=g,_=f,A=b;R=e.lencode[A+((h&(1<<v+_)-1)>>v)],g=R>>>24,f=R>>>16&255,b=65535&R,!(v+g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=v,c-=v,e.back+=v}if(h>>>=g,c-=g,e.back+=g,e.length=b,f===0){e.mode=16205;break}if(32&f){e.back=-1,e.mode=pr;break}if(64&f){r.msg="invalid literal/length code",e.mode=ae;break}e.extra=15&f,e.mode=16201;case 16201:if(e.extra){for(y=e.extra;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.length+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=16202;case 16202:for(;R=e.distcode[h&(1<<e.distbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(!(240&f)){for(v=g,_=f,A=b;R=e.distcode[A+((h&(1<<v+_)-1)>>v)],g=R>>>24,f=R>>>16&255,b=65535&R,!(v+g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=v,c-=v,e.back+=v}if(h>>>=g,c-=g,e.back+=g,64&f){r.msg="invalid distance code",e.mode=ae;break}e.offset=b,e.extra=15&f,e.mode=16203;case 16203:if(e.extra){for(y=e.extra;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.offset+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=ae;break}e.mode=16204;case 16204:if(l===0)break t;if(d=p-l,e.offset>d){if(d=e.offset-d,d>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=ae;break}d>e.wnext?(d-=e.wnext,w=e.wsize-d):w=e.wnext-d,d>e.length&&(d=e.length),m=e.window}else m=i,w=o-e.offset,d=e.length;d>l&&(d=l),l-=d,e.length-=d;do i[o++]=m[w++];while(--d);e.length===0&&(e.mode=Gi);break;case 16205:if(l===0)break t;i[o++]=e.length,l--,e.mode=Gi;break;case so:if(e.wrap){for(;c<32;){if(a===0)break t;a--,h|=n[s++]<<c,c+=8}if(p-=l,r.total_out+=p,e.total+=p,4&e.wrap&&p&&(r.adler=e.check=e.flags?ye(e.check,i,p,o-p):Vn(e.check,i,p,o-p)),p=l,4&e.wrap&&(e.flags?h:Ah(h))!==e.check){r.msg="incorrect data check",e.mode=ae;break}h=0,c=0}e.mode=16207;case 16207:if(e.wrap&&e.flags){for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(4&e.wrap&&h!==(4294967295&e.total)){r.msg="incorrect length check",e.mode=ae;break}h=0,c=0}e.mode=16208;case 16208:C=gg;break t;case ae:C=kh;break t;case 16210:return Ch;default:return $e}return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,(e.wsize||p!==r.avail_out&&e.mode<ae&&(e.mode<so||t!==xh))&&Ih(r,r.output,r.next_out,p-r.avail_out),u-=r.avail_in,p-=r.avail_out,r.total_in+=u,r.total_out+=p,e.total+=p,4&e.wrap&&p&&(r.adler=e.check=e.flags?ye(e.check,i,p,r.next_out-p):Vn(e.check,i,p,r.next_out-p)),r.data_type=e.bits+(e.last?64:0)+(e.mode===pr?128:0)+(e.mode===$i||e.mode===io?256:0),(u===0&&p===0||t===xh)&&C===Hr&&(C=bg),C},gr={inflateReset:Th,inflateReset2:Mh,inflateResetKeep:Eh,inflateInit:r=>Rh(r,15),inflateInit2:Rh,inflate:yg,inflateEnd:r=>{if(Ur(r))return $e;let t=r.state;return t.window&&(t.window=null),r.state=null,Hr},inflateGetHeader:(r,t)=>{if(Ur(r))return $e;const e=r.state;return 2&e.wrap?(e.head=t,t.done=!1,Hr):$e},inflateSetDictionary:(r,t)=>{const e=t.length;let n,i,s;return Ur(r)?$e:(n=r.state,n.wrap!==0&&n.mode!==Wi?$e:n.mode===Wi&&(i=1,i=Vn(i,t,e,0),i!==n.check)?kh:(s=Ih(r,t,e,e),s?(n.mode=16210,Ch):(n.havedict=1,Hr)))},inflateInfo:"pako inflate (from Nodeca project)"},_g=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Nh=Object.prototype.toString,{Z_NO_FLUSH:xg,Z_FINISH:kg,Z_OK:Yn,Z_STREAM_END:lo,Z_NEED_DICT:ho,Z_STREAM_ERROR:Cg,Z_DATA_ERROR:Bh,Z_MEM_ERROR:Sg}=Fi;function Zi(r){this.options=Pi.assign({chunkSize:65536,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||r&&r.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yh,this.strm.avail_out=0;let e=gr.inflateInit2(this.strm,t.windowBits);if(e!==Yn)throw new Error(Or[e]);if(this.header=new _g,gr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Qn.string2buf(t.dictionary):Nh.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=gr.inflateSetDictionary(this.strm,t.dictionary),e!==Yn)))throw new Error(Or[e])}function co(r,t){const e=new Zi(t);if(e.push(r),e.err)throw e.msg||Or[e.err];return e.result}Zi.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=t===~~t?t:t===!0?kg:xg,Nh.call(r)==="[object ArrayBuffer]"?e.input=new
630Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=gr.inflate(e,o),s===ho&&i&&(s=gr.inflateSetDictionary(e,i),s===Yn?s=gr.inflate(e,o):s===Bh&&(s=ho));e.avail_in>0&&s===lo&&e.state.wrap>0&&r[e.next_in]!==0;)gr.inflateReset(e),s=gr.inflate(e,o);switch(s){case Cg:case Bh:case ho:case Sg:return this.onEnd(s),this.ended=!0,!1}if(a=e.avail_out,e.next_out&&(e.avail_out===0||s===lo))if(this.options.to==="string"){let l=Qn.utf8border(e.output,e.next_out),h=e.next_out-l,c=Qn.buf2string(e.output,l);e.next_out=h,e.avail_out=n-h,h&&e.output.set(e.output.subarray(l,l+h),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(s!==Yn||a!==0){if(s===lo)return s=gr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Zi.prototype.onData=function(r){this.chunks.push(r)},Zi.prototype.onEnd=function(r){r===Yn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pi.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var Ag=function(r,t){return(t=t||{}).raw=!0,co(r,t)},Eg={inflate:co,inflateRaw:Ag,ungzip:co};const{deflateRaw:Tg}=lg,{inflate:Mg,inflateRaw:Rg,ungzip:Lg}=Eg;var Ig=Tg,uo=Mg,fo=Rg,Fh=Lg;const Ng=4;function Oh(r){const t=ArrayBuffer.isView(r)?r:new Uint8Array(r);return t[0]===31&&t[1]===139}function Dh(r){const t=ArrayBuffer.isView(r)?r:new Uint8Array(r);return(t[3]&Ng)!==0&&t[12]===66&&t[13]===67?mr(t.buffer):Fh(t)}function mr(r,t){const e=[];let n=0,i=0;for(t=t||r.byteLength-18;n<t;)try{const o=ArrayBuffer.isView(r)?r:new Uint8Array(r,n,18),a=o[11]<<8|o[10],l=(o[3],o[12],o[13],o[15],o[14],1+(o[17]<<8|o[16])),h=12+a+n,c=r.byteLength-h,u=l-a-19;if(c<u||u<=0)break;const p=new Uint8Array(r,h,u),d=fo(p);n+=u-1+26,i+=d.byteLength,e.push(d)}catch{break}if(e.length===1)return e[0];{const o=new Uint8Array(i);let a=0;for(let l=0;l<e.length;++l){var s=new Uint8Array(e[l]);Fg(s,0,o,a,s.length),a+=s.length}return o}}function Ph(r){const t=ArrayBuffer.isView(r)?r:new Uint8Array(r);return 1+(t[17]<<8|t[16])}const Bg=typeof new Uint8Array(1).subarray=="function";function Fg(r,t,e,n,i){if(i!==0){if(!r)throw"Undef src";if(!e)throw"Undef dest";i===r.length?po(r,e,n):Bg?po(r.subarray(t,t+i),e,n):r.BYTES_PER_ELEMENT===1&&i>100?po(new Uint8Array(r.buffer,r.byteOffset+t,i),e,n):(function(s,o,a,l,h){for(let c=0;c<h;++c)a[l+c]=s[o+c]})(r,t,e,n,i)}}function po(r,t,e){t.set(r,e)}function Vr(r,t){const e=r.split(","),n=e[0].split(":")[1];let i=e[1];if(n.indexOf("base64")>=0){i=atob(i);const s=new Uint8Array(i.length);for(let a=0;a<i.length;a++)s[a]=i.charCodeAt(a);let o;return o=n.indexOf("gzip")>0?Fh(s):s,o}return decodeURIComponent(i)}const Og=function(r,t){if(r.length!==0){var e=Math.floor(r.length*((100-t)/100));return e===0?(r.sort((function(n,i){return i-n})),r[e]):(function(n,i){var s,o=new zh;for(s=0;s<n.length;s++){var a=n[s];(o.content.length<i||a>o.content[0])&&(o.content.length===i&&o.pop(),o.push(a))}return o.content[0]})(r,e)}},Ce=function(r,t,e){return Math.min(Math.max(r,t),e)},Dg=function(r){return Math.log(r)/Math.LN2};function zh(){this.content=[]}function qr(r,t){return Math.random()*(t-r)+r}zh.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.sinkDown(0)),r},remove:function(r){for(var t=this.content.length,e=0;e<t;e++)if(this.content[e]===r){var n=this.content.pop();if(e===t-1)break;this.content[e]=n,this.bubbleUp(e),this.sinkDown(e);break}},size:function(){return this.content.length},bubbleUp:function(r){for(var t=this.content[r],e=t;r>0;){var n=Math.floor((r+1)/2)-1,i=this.content[n];if(e>=i)break;this.content[n]=t,this.content[r]=i,r=n}},sinkDown:function(r){for(var t=this.content.length,e=this.content[r],n=e;;){var i=2*(r+1),s=i-1,o=null;if(s<t){var a=this.content[s],l=a;a<n&&(o=s)}if(i<t&&this.content[i]<(o==null?n:l)&&(o=i),o==null)break;this.content[r]=this.content[o],this.content[o]=e,r=o}}};const qt={rgbListFromHSV:()=>{let r=[];for(let t=1;t>=.5;t-=.1)for(let e=0;e<1;e+=1/28){const n="rgb("+qt.hsvToRgb(e,1,t).join(",")+")";r.push(n)}return r.pop(),r.push(qt.rgbColor(16,16,16)),r},rgbToHex:function(r){return(r=r.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&r.length===4?"#"+("0"+parseInt(r[1],10).toString(16)).slice(-2)+("0"+parseInt(r[2],10).toString(16)).slice(-2)+("0"+parseInt(r[3],10).toString(16)).slice(-2):""},hexToRgb:function(r){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);if(t!==null)return"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")"},hsvToRgb:function(r,t,e){var n,i,s,o=Math.floor(6*r),a=6*r-o,l=e*(1-t),h=e*(1-a*t),c=e*(1-(1-a)*t);switch(o%6){case 0:n=e,i=c,s=l;break;case 1:n=h,i=e,s=l;break;case 2:n=l,i=e,s=c;break;case 3:n=l,i=h,s=e;break;case 4:n=c,i=l,s=e;break;case 5:n=e,i=l,s=h}return[Math.floor(255*n),Math.floor(255*i),Math.floor(255*s)]},hslToRgb:function(r,t,e){var n,i,s;if(t===0)n=i=s=e;else{var o=e<.5?e*(1+t):e+t-e*t,a=2*e-o;n=qt.hue2rgb(a,o,r+1/3),i=qt.hue2rgb(a,o,r),s=qt.hue2rgb(a,o,r-1/3)}return[255*n,255*i,255*s]},hue2rgb:(r,t,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+6*(t-r)*e:e<.5?t:e<2/3?r+(t-r)*(2/3-e)*6:r),rgbaColor:function(r,t,e,n){return"rgba("+(r=Ce(r,0,255))+","+(t=Ce(t,0,255))+","+(e=Ce(e,0,255))+","+(n=Ce(n,0,1))+")"},rgbColor:function(r,t,e){return"rgb("+(r=Ce(r,0,255))+","+(t=Ce(t,0,255))+","+(e=Ce(e,0,255))+")"},greyScale:function(r){var t=Ce(r,0,255);return"rgb("+t+","+t+","+t+")"},randomGrey:function(r,t){r=Ce(r,0,255),t=Ce(t,0,255);var e=Math.round(qr(r,t)).toString(10);return"rgb("+e+","+e+","+e+")"},randomRGB:function(r,t){return r=Ce(r,0,255),t=Ce(t,0,255),"rgb("+Math.round(qr(r,t)).toString(10)+","+Math.round(qr(r,t)).toString(10)+","+Math.round(qr(r,t)).toString(10)+")"},randomRGBConstantAlpha:function(r,t,e){return r=Ce(r,0,255),t=Ce(t,0,255),"rgba("+Math.round(qr(r,t)).toString(10)+","+Math.round(qr(r,t)).toString(10)+","+Math.round(qr(r,t)).toString(10)+","+e+")"}
630,addAlpha:function(r,t){if(r==="0"||r===".")r="rgb(0,0,0)";else{const n=this.colorNameToHex(r);n&&(r=n)}var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(r);if(r.startsWith("rgba")){const n=r.lastIndexOf(",");return r.substring(0,n+1)+t.toString()+")"}return e&&(r=qt.hexToRgb(r)),r.startsWith("rgb")?r.replace("rgb","rgba").replace(")",", "+t+")"):r},rgbComponents:function(r){if(r==="0"||r===".")return[0,0,0];if(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(r))r=qt.hexToRgb(r);else if(!r.startsWith("rgb")){const t=this.colorNameToHex(r);r=this.hexToRgb(t)}if(r.startsWith("rgb("))return r.substring(4,r.length-1).split(",").map((t=>Number.parseInt(t.trim())));if(r.startsWith("rgba("))return r.substring(5,r.length-1).split(",").map(((t,e)=>(t=t.trim(),e===3?Number.parseFloat(t):Number.parseInt(t))));throw Error("Unrecognized color string: color")},getCompositeColor:function(r,t,e){return"rgb("+Math.floor(e*t[0]+(1-e)*r[0])+","+Math.floor(e*t[1]+(1-e)*r[1])+","+Math.floor(e*t[2]+(1-e)*r[2])+")"},createColorString:function(r){return this.createColorStringSafe(r)||r},createColorStringSafe:function(r){if((r=(function(n){return n===void 0||((n.startsWith("'")||n.startsWith('"'))&&(n=n.substring(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.substring(0,n.length-1))),n})(r)).startsWith("rgb(")&&r.endsWith(")")||r.startsWith("#")&&r.length<8)return r;const t=this.colorNameToHex(r);if(t)return t;const e=r.split(",");return e.length===3&&go(e[0])&&go(e[1])&&go(e[2])?`rgb(${r})`:void 0},darkenLighten:function(r,t){let e,n=this.colorNameToHex(r);e=n?qt.hexToRgb(n):r.startsWith("rgb(")?r:qt.hexToRgb(r);const i=e.replace(")","").substring(4).split(","),s=Math.max(0,Math.min(255,Number.parseInt(i[0].trim())+t)),o=Math.max(0,Math.min(255,Number.parseInt(i[1].trim())+t)),a=Math.max(0,Math.min(255,Number.parseInt(i[2].trim())+t));return"rgb("+s.toString()+","+o.toString()+","+a.toString()+")"},colorNameToHex:function(r){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",s
630almon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",darkgrey:"#a9a9a9",darkslategrey:"#2f4f4f",dimgrey:"#696969",grey:"#808080",lightgray:"#d3d3d3",lightslategrey:"#778899",slategrey:"#708090"}[r]}};function go(r){const t=Number.parseInt(r);return!Number.isNaN(t)&&t>=0&&t<=255}const mo="googleapis";class Pg{constructor(){this.oauthTokens={}}setToken(t,e){e=e||mo,this.oauthTokens[e]=t}getToken(t){let e;t=t||mo;for(let n of Object.keys(this.oauthTokens))if(Hh(n).test(t)){e=this.oauthTokens[n];break}return e}removeToken(t){t=t||mo;for(let e of Object.keys(this.oauthTokens))Hh(e).test(t)&&(this.oauthTokens[e]=void 0)}}function Hh(r){return new RegExp("^"+r.split(/\*+/).map(zg).join(".*")+"$")}function zg(r){return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function Kn(r){return r.includes("googleapis")&&!r.includes("urlshortener")||bo(r)||Qi(r)}function bo(r){return r.startsWith("gs://")||r.startsWith("https://www.googleapis.com/storage")||r.startsWith("https://storage.cloud.google.com")||r.startsWith("https://storage.googleapis.com")}function Qi(r){return r.indexOf("drive.google.com")>=0||r.indexOf("www.googleapis.com/drive")>0}function Hg(r){let{bucket:t,object:e}=(function(i){let s,o;if(i.startsWith("gs://")){const a=i.indexOf("/",5);if(a>=0){s=i.substring(5,a);const l=i.indexOf("?");o=l<0?i.substring(a+1):i.substring(a+1,l)}}else if(i.startsWith("https://storage.googleapis.com")||i.startsWith("https://storage.cloud.google.com")){const a=i.indexOf("/v1/b/",8);if(a>0){const l=i.indexOf("/o/",a);if(l>0){const h=i.indexOf("?",l);s=i.substring(a+6,l),o=h>0?i.substring(l+3,h):i.substring(l+3)}}else{const l=i.indexOf("/",8),h=i.indexOf("/",l+1),c=i.indexOf("?",h);h>0&&(s=i.substring(l+1,h),o=c<0?i.substring(h+1):i.substring(h+1,c))}}else if(i.startsWith("https://www.googleapis.com/storage/v1/b")){const a=i.indexOf("/v1/b/",8),l=i.indexOf("/o/",a);if(l>0){const h=i.indexOf("?",l);s=i.substring(a+6,l),o=h>0?i.substring(l+3,h):i.substring(l+3)}}if(s&&o)return{bucket:s,object:o};throw Error(`Unrecognized Google Storage URI: ${i}`)})(r);e=(function(i){let s="";return i.split("").forEach((function(o){de.has(o)?s+=de.get(o):s+=o})),s})(e);const n=r.indexOf("?");return`https://storage.googleapis.com/storage/v1/b/${t}/o/${e}${n>0?r.substring(n)+"&alt=media":"?alt=media"}`}const de=new Map;function jr(){return window.google&&window.google.igv}async function Uh(r){if(!jr())throw Error("Google oAuth has not been initialized");if(google.igv.tokenResponse&&Date.now()<google.igv.tokenExpiresAt&&google.accounts.oauth2.hasGrantedAllScopes(google.igv.tokenResponse,r))return google.igv.tokenResponse.access_token;{const t=google.igv.tokenClient;return new Promise(((e,n)=>{try{t.callback=i=>{i.error!==void 0&&n(i),google.igv.tokenResponse=i,google.igv.tokenExpiresAt=Date.now()+1e3*i.expires_in,e(i.access_token)},t.requestAccessToken({scope:r})}catch{}}))}}function Vh(){return google.igv.apiKey}function qh(r){var t=jh(r);return t?"https://www.googleapis.com/drive/v3/files/"+t+"?alt=media&supportsTeamDrives=true":r}function jh(r){if(r.includes("/open?id=")){const t=r.indexOf("/open?id=")+9,e=r.indexOf("&");if(t>0&&e>t)return r.substring(t,e);if(t>0)return r.substring(t)}else{if(r.includes("/file/d/")){const t=r.indexOf("/file/d/")+8,e=r.lastIndexOf("/");return r.substring(t,e)}if(r.startsWith("https://www.googleapis.com/drive")){let t=r.indexOf("/files/");const e=r.indexOf("?");if(t>0)return t+=7,e>0?r.substring(t,e):r.substring(t)}}throw Error("Unknown Google Drive url format: "+r)}de.set("!","%21"),de.set("#","%23"),de.set("$","%24"),de.set("%","%25"),de.set("&","%26"),de.set("'","%27"),de.set("(","%28"),de.set(")","%29"),de.set("*","%2A"),de.set("+","%2B"),de.set(",","%2C"),de.set("/","%2F"),de.set(":","%3A"),de.set(";","%3B"),de.set("=","%3D"),de.set("?","%3F"),de.set("@","%40"),de.set("[","%5B"),de.set("]","%5D"),de.set(" ","%20");class Ug{constructor(t){this.requestsPerSecond=t.requestsPerSecond||10,this.lastStartTime=0,this.queued=[]}add(t,e){var n=this;return new Promise((function(i,s){n.queued.push({resolve:i,reject:s,asyncFunction:t}),n.dequeue()}))}addAll(t,e){var n=t.map(function(i){return this.add(i,e)}.bind(this));return Promise.all(n)}dequeue(){if(this.queued.length>0){var t=new Date,e=1e3/this.requestsPerSecond+1,n=t-this.lastStartTime;n>=e?this._execute():setTimeout(function(){this.dequeue()}.bind(this),e-n)}}async _execute(){this.lastStartTime=new Date;var t=this.queued.shift();const e=t.asyncFunction;try{const n=await e();t.resolve(n)}catch(n){t.reject(n)}}}function Wh(){if(jr())return jr()&&google.igv.tokenResponse&&Date.now()<google.igv.tokenExpiresAt?google.igv.tokenResponse.access_token:void 0}function wo(r){let t;return t=Oh(r)?Dh(r):new Uint8Array(r),"TextDecoder"in(function(){return typeof self<"u"?self:typeof Na<"u"?Na:window})()?new TextDecoder().decode(t):(function(e){for(var n="",i=0;i<e.length;){var s=e[i],o=0,a=0;if(s<=127?(o=0,a=255&s):s<=223?(o=1,a=31&s):s<=239?(o=2,a=15&s):s<=244&&(o=3,a=7&s),e.length-i-o>0)for(var l=0;l<o;)a=a<<6|63&(s=e[i+l+1]),l+=1;else a=65533,o=e.length-i;n+=String.fromCodePoint(a),i+=o+1}return n})(t)}const Ct=new class{constructor(){this.apiKey=void 0,this.googleThrottle=new Ug({requestsPerSecond:8}),this.RANGE_WARNING_GIVEN=!1,this.oauth=new Pg}setApiKey(r){this.apiKey=r}async loadArrayBuffer(r,t){return(t=t||{}).responseType||(t.responseType="arraybuffer"),xr(r)?this._loadFileSlice(r,t):this.load(r,t)}async loadByteArray(r,t){const e=await this.loadArrayBuffer(r,t);let n;return n=Oh(e)?Dh(e):new Uint8Array(e),n}async loadJson(r,t){((t=t||{}).method||(t.sendData?"POST":"GET"))==="POST"&&(t.contentType="application/json");const e=await this.loadString(r,t);return e&&JSON.parse(e)}async loadString(r,t){return t=t||{},r instanceof File?this._loadStringFromFile(r,t):this._loadStringFromUrl(r,t)}async load(r,t){t=t||{};const e=typeof r;if(xr(r=await(typeof r=="function"?r():r)))return this._loadFileSlice(r,t);if(typeof r.startsWith=="function"){if(r.startsWith("data:")){const n=Vr(r).buffer;if(t.range){const i=t.range.size?t.range.start+t.range.size:n.byteLength;return n.slice(t.range.start,i)}return n}return r.startsWith("https://drive.google.com")&&(r=qh(r)),Qi(r)||r.startsWith("https://www.dropbox.com")?this.googleThrottle.add((async()=>this._loadURL(r,t))):this._loadURL(r,t)}throw Error(`url must be either a 'File', 'string', 'function', or 'Promise'. Actual type: ${e}`)}async _loadURL(r,t){const e=this,n=r;r=(function(s){return s.startsWith("https://www.dropbox.com")?s.replace("//www.dropbox.com","//dl.dropboxusercontent.com"):s.startsWith("https://drive.google.com")?qh(s):s.includes("//www.broadinstitute.org/igvdata")?s.replace("//www.broadinstitute.org/igvdata","//data.broadinstitute.org/igvdata"):s.includes("//igvdata.broadinstitute.org")?s.replace("//igvdata.broadinstitute.org","//s3.amazonaws.com/igv.broadinstitute.org"):s.includes("//igv.genepattern.org")?s.replace("//igv.genepattern.org","//igv-genepattern-org.s3.amazonaws.com"):s.startsWith("ftp://ftp.ncbi.nlm.nih.gov/geo")?s.replace("ftp://","https://"):s})(r);let i=(t=t||{}).oauthToken||this.getOauthToken(r);return i&&(i=await(typeof i=="function"?i():i)),new Promise((function(s,o){Kn(r)&&!(function(f){return f.indexOf("X-Goog-Signature")>-1})(r)&&(bo(r)&&(r=Hg(r)),r=(function(f){let b=Ct.apiKey;if(b||typeof gapi>"u"||(b=gapi.apiKey),b!==void 0&&!f.includes("key=")){const v=f.includes("?")?"&":"?";f=f+v+"key="+b}return f})(r),Qi(r)&&(function(f){if(f.includes("supportsTeamDrive"))return f;{const b=f.includes("?")?"&":"?";f=f+b+"supportsTeamDrive=true"}})(r),i||(i=Wh()));const a=t.headers||{};i&&(function(f,b){b&&(f["Cache-Control"]="no-cache",f.Authorization="Bearer "+b)})(a,i);const l=t.range,h=new XMLHttpRequest,c=t.sendData||t.body,u=t.method||(c?"POST":"GET"),p=t.responseType,d=t.contentType,w=t.mimeType;if(h.open(u,r),t.timeout&&(h.timeout=t.timeout),l){let f="";l.size&&(f=l.start+l.size-1),h.setRequestHeader("Range","bytes="+l.start+"-"+f)}if(d&&h.setRequestHeader("Content-Type",d),w&&h.overrideMimeType(w),p&&(h.responseType=p),a)for(let f of Object.keys(a)){const b=a[f];h.setRequestHeader(f,b)}t.withCredentials===!0&&(h.withCredentials=!0),h.onload=async function(f){if(h.status===0||h.status>=200&&h.status<=300)if(t.method==="HEAD"){const b=t.requestedHeaders||["content-length"],v={};for(let _ of b)v[_]=h.getResponseHeader(_);s(v)}else l&&h.status!==206&&l.start!==0?(h.response.length>1e5&&!e.RANGE_WARNING_GIVEN&&alert(`Warning: Range header ignored for URL: ${r}. This can have severe performance impacts.`),s(h.response.slice(l.start,l.start+l.size))):s(h.response);
630else h.status===416?m(Error("416 Unsatisfiable Range")):!jr()||h.status!==404&&h.status!==401&&h.status!==403||!Kn(r)||t.retries?h.status===403?m("Access forbidden: "+r):m(h.status):g()},h.onerror=function(f){Kn(r)&&!t.retries?g():m("Error accessing resource: "+r+" Status: "+h.status)},h.ontimeout=function(f){m("Timed out")},h.onabort=function(f){o(f)};try{h.send(c)}catch(f){Kn(r)&&!t.retries?g():m(f)}function m(f){if(!o)throw f;o(f)}async function g(){try{const f=await(async function(v){if(jr()){const _=(function(A){return Qi(A)?"https://www.googleapis.com/auth/drive.file":bo(A)?"https://www.googleapis.com/auth/devstorage.read_only":"https://www.googleapis.com/auth/userinfo.profile"})(v);return await Uh(_)}throw Error("Authorization is required, but Google oAuth has not been initalized. Contact your site administrator for assistance.")})(n);t.retries=1,t.oauthToken=f;const b=await e.load(n,t);s(b)}catch(f){if(f.error){const b=f.error.startsWith("popup_blocked")?"Google login popup blocked by browser.":f.error;alert(b)}else m(f)}}}))}async _loadFileSlice(r,t){const n=await(t&&t.range?r.slice(t.range.start,t.range.start+t.range.size):r).arrayBuffer();return t.responseType==="arraybuffer"?n:wo(n)}async _loadStringFromFile(r,t){const e=t.range?r.slice(t.range.start,t.range.start+t.range.size):r;return wo(await e.arrayBuffer())}async _loadStringFromUrl(r,t){return(t=t||{}).responseType="arraybuffer",wo(await this.load(r,t))}setOauthToken(r,t){this.oauth.setToken(r,t)}getOauthToken(r){const t=Kn(r)?void 0:Zl(r).host;let e=this.oauth.getToken(t);if(e)return e;if(t===void 0){const n=Wh();if(n&&n.expires_at>Date.now())return n.access_token}}async getContentLength(r,t){(t=t||{}).method="HEAD",t.requestedHeaders=["content-length"];const e=(await this._loadURL(r,t))["content-length"];return e?Number.parseInt(e):0}};var ie={color:1};ie.parent=ie,ie.left=ie,ie.right=ie;class $h{constructor(){this.root=ie}insert(t,e,n){var i=new Vg(new Qh(t,e,n));for(this.treeInsert(i),i.color=2;i!==this.root&&i.parent.color===2;)if(i.parent===i.parent.parent.left){let s=i.parent.parent.right;s.color===2?(i.parent.color=1,s.color=1,i.parent.parent.color=2,i=i.parent.parent):(i===i.parent.right&&(i=i.parent,Gh.call(this,i)),i.parent.color=1,i.parent.parent.color=2,Zh.call(this,i.parent.parent))}else{let s=i.parent.parent.left;s.color===2?(i.parent.color=1,s.color=1,i.parent.parent.color=2,i=i.parent.parent):(i===i.parent.left&&(i=i.parent,Zh.call(this,i)),i.parent.color=1,i.parent.parent.color=2,Gh.call(this,i.parent.parent))}this.root.color=1}findOverlapping(t,e){var n=new Qh(t,e,0);if(this.root===ie)return[];var i=vo.call(this,n,this.root,[]);return i.length>1&&i.sort((function(s,o){return s.low-o.low})),i}logIntervals(){(function t(e,n){for(var i="",s=0;s<n;s++)i+=" ";n+=5,e.left!==ie&&t(e.left,n),e.right!==ie&&t(e.right,n)})(this.root,0)}mapIntervals(t){(function e(n){t(n.interval),n.left!==ie&&e(n.left),n.right!==ie&&e(n.right)})(this.root)}treeInsert(t){for(var e=this.root,n=ie;e!==ie;)n=e,e=t.interval.low<=e.interval.low?e.left:e.right;t.parent=n,n===ie?(this.root=t,t.left=t.right=ie):t.interval.low<=n.interval.low?n.left=t:n.right=t,yo.call(this,t)}}function vo(r,t,e){return t.interval.overlaps(r)&&e.push(t.interval),t.left!==ie&&t.left.max>=r.low&&vo.call(this,r,t.left,e),t.right!==ie&&t.right.min<=r.high&&vo.call(this,r,t.right,e),e}function Gh(r){var t=r.right;r.right=t.left,t.left!==ie&&(t.left.parent=r),t.parent=r.parent,r.parent===ie?this.root=t:r.parent.left===r?r.parent.left=t:r.parent.right=t,t.left=r,r.parent=t,yo.call(this,r)}function Zh(r){var t=r.left;r.left=t.right,t.right!==ie&&(t.right.parent=r),t.parent=r.parent,r.parent===ie?this.root=t:r.parent.right===r?r.parent.right=t:r.parent.left=t,t.right=r,r.parent=t,yo.call(this,r)}function yo(r){for(;r!==ie;){var t=r.left.max>r.right.max?r.left.max:r.right.max,e=r.interval.high;r.max=t>e?t:e;var n=r.left.min<r.right.min?r.left.min:r.right.min,i=r.interval.low;r.min=n<i?n:i,r=r.parent}}class Qh{constructor(t,e,n){this.low=t,this.high=e,this.value=n}equals(t){return!!t&&(this===t||this.low===t.low&&this.high===t.high)}compareTo(t){return this.low<t.low?-1:this.low>t.low?1:this.high<t.high?-1:this.high>t.high?1:0}overlaps(t){return this.low<=t.high&&t.low<=this.high}}function Vg(r){this.parent=ie,this.left=ie,this.right=ie,this.interval=r,this.color=2}class Jn{constructor(t,e,n){t=t||[],this.treeMap=this.buildTreeMap(t,e),this.range=n,this.count=t.length}containsRange(t){return this.range===void 0||this.range.contains(t.chr,t.start,t.end)}queryFeatures(t,e,n){const i=this.treeMap[t];if(!i)return[];const s=i.findOverlapping(e,n);if(s.length===0)return[];{const o=[],a=this.allFeatures[t];if(a){for(let l of s){const h=l.value;for(let c=h.start;c<h.end;c++){let u=a[c];if(u.start>n)break;u.end>=e&&o.push(u)}}o.sort((function(l,h){return l.start-h.start}))}return o}}getAllFeatures(){return this.allFeatures}buildTreeMap(t,e){const n={},i=[];if(this.allFeatures={},t){for(let s of t){let o=s.chr;e&&(o=e.getChromosomeName(o));let a=this.allFeatures[o];a||(i.push(o),a=[],this.allFeatures[o]=a),a.push(s)}for(let s of i){const o=this.allFeatures[s];o.sort((function(a,l){return a.start===l.start?0:a.start>l.start?1:-1})),n[s]=qg(o)}}return n}}function qg(r){const t=new $h,e=r.length,n=Math.max(10,Math.round(e/10));for(let i=0;i<e;i+=n){const s=Math.min(e,i+n),o=new jg(i,s),a=r[i].start;let l=a;for(let h=i;h<s;h++)l=Math.max(l,r[h].end);t.insert(a,l,o)}return t}class jg{constructor(t,e){this.start=t,this.end=e}}const Xi=function(r,t,e){if(r&&r.length!==0){const n=(function(s){const o=new $h,a=s.length,l=Math.max(10,Math.round(a/100));s.sort((function(h,c){return h.start===c.start?0:h.start>c.start?1:-1}));for(let h=0;h<a;h+=l){const c=Math.min(a,h+l),u=s.slice(h,c),p=u[0].start;let d=p;u.forEach((function(w){d=Math.max(d,w.end)})),o.insert(p,d,u)}return o}
630)(r),i=n.findOverlapping(t,e);return i.length===0?[]:(r=[],i.forEach((function(s){const o=s.value,a=o.length;for(let l=0;l<a;l++){const h=o[l];if(h.start>e)break;h.end>t&&r.push(h)}})),r.sort((function(s,o){return s.start-o.start})),r)}return[]},Xh={cantaloupe:{r:255,g:206,b:110},honeydew:{r:206,g:250,b:110},spindrift:{r:104,g:251,b:208},sky:{r:106,g:207,b:255},lavender:{r:210,g:120,b:255},carnation:{r:255,g:127,b:211},licorice:{r:0,g:0,b:0},snow:{r:255,g:255,b:255},salmon:{r:255,g:114,b:110},banana:{r:255,g:251,b:109},flora:{r:104,g:249,b:110},ice:{r:104,g:253,b:255},orchid:{r:110,g:118,b:255},bubblegum:{r:255,g:122,b:255},lead:{r:30,g:30,b:30},mercury:{r:232,g:232,b:232},tangerine:{r:255,g:136,b:2},lime:{r:131,g:249,b:2},sea_foam:{r:3,g:249,b:135},aqua:{r:0,g:140,b:255},grape:{r:137,g:49,b:255},strawberry:{r:255,g:41,b:135},tungsten:{r:58,g:58,b:58},silver:{r:208,g:208,b:208},maraschino:{r:255,g:33,b:1},lemon:{r:255,g:250,b:3},spring:{r:5,g:248,b:2},turquoise:{r:0,g:253,b:255},blueberry:{r:0,g:46,b:255},magenta:{r:255,g:57,b:255},iron:{r:84,g:84,b:83},magnesium:{r:184,g:184,b:184},mocha:{r:137,g:72,b:0},fern:{r:69,g:132,b:1},moss:{r:1,g:132,b:72},ocean:{r:0,g:74,b:136},eggplant:{r:73,g:26,b:136},maroon:{r:137,g:22,b:72},steel:{r:110,g:110,b:110},aluminum:{r:160,g:159,b:160},cayenne:{r:137,g:17,b:0},aspargus:{r:136,g:133,b:1},clover:{r:2,g:132,b:1},teal:{r:0,g:134,b:136},midnight:{r:0,g:24,b:136},plum:{r:137,g:30,b:136},tin:{r:135,g:134,b:135},nickel:{r:136,g:135,b:135}},Wg={Set1:["rgb(228,26,28)","rgb(55,126,184)","rgb(77,175,74)","rgb(166,86,40)","rgb(152,78,163)","rgb(255,127,0)","rgb(247,129,191)","rgb(153,153,153)","rgb(255,255,51)"],Dark2:["rgb(27,158,119)","rgb(217,95,2)","rgb(117,112,179)","rgb(231,41,138)","rgb(102,166,30)","rgb(230,171,2)","rgb(166,118,29)","rgb(102,102,102)"],Set2:["rgb(102, 194,165)","rgb(252,141,98)","rgb(141,160,203)","rgb(231,138,195)","rgb(166,216,84)","rgb(255,217,47)","rgb(229,196,148)","rgb(179,179,179)"],Set3:["rgb(141,211,199)","rgb(255,255,179)","rgb(190,186,218)","rgb(251,128,114)","rgb(128,177,211)","rgb(253,180,98)","rgb(179,222,105)","rgb(252,205,229)","rgb(217,217,217)","rgb(188,128,189)","rgb(204,235,197)","rgb(255,237,111)"],Pastel1:["rgb(251,180,174)","rgb(179,205,227)","rgb(204,235,197)","rgb(222,203,228)","rgb(254,217,166)","rgb(255,255,204)","rgb(229,216,189)","rgb(253,218,236)"],Pastel2:["rgb(173,226,207)","rgb(253,205,172)","rgb(203,213,232)","rgb(244,202,228)","rgb(230,245,201)","rgb(255,242,174)","rgb(243,225,206)"],Accent:["rgb(127,201,127)","rgb(190,174,212)","rgb(253,192,134)","rgb(255,255,153)","rgb(56,108,176)","rgb(240,2,127)","rgb(191,91,23)"]};class ti{constructor(t){this.colors=Wg[t],Array.isArray(this.colors)||(this.colors=[]),this.colorTable={},this.nextIdx=0,this.colorGenerator=new ri}getColor(t){return this.colorTable.hasOwnProperty(t)||(this.nextIdx<this.colors.length?this.colorTable[t]=this.colors[this.nextIdx]:this.colorTable[t]=this.colorGenerator.get(),this.nextIdx++),this.colorTable[t]}}class ei{constructor(t){this.colorTable=t||{},this.nextIdx=0,this.colorGenerator=new ri}getColor(t){if(!this.colorTable.hasOwnProperty(t)){if(this.colorTable.hasOwnProperty("*"))return this.colorTable["*"];this.colorTable[t]=this.colorGenerator.get()}return this.colorTable[t]}}function ri(){this.hue=Math.random(),this.goldenRatio=.618033988749895,this.hexwidth=2}function $g(r,t){return r=Ce(r,0,255),t=Ce(t,0,255),`rgb(${Math.round(Math.random()*(t-r)+r).toString(10)},${Math.round(Math.random()*(t-r)+r).toString(10)},${Math.round(Math.random()*(t-r)+r).toString(10)})`}ri.prototype.hsvToRgb=function(r,t,e){var n=Math.floor(6*r),i=6*r-n,s=e*(1-t),o=e*(1-i*t),a=e*(1-(1-i)*t),l=255,h=255,c=255;switch(n){case 0:l=e,h=a,c=s;break;case 1:l=o,h=e,c=s;break;case 2:l=s,h=e,c=a;break;case 3:l=s,h=o,c=e;break;case 4:l=a,h=s,c=e;break;case 5:l=e,h=s,c=o}return[Math.floor(256*l),Math.floor(256*h),Math.floor(256*c)]},ri.prototype.padHex=function(r){return r.length>this.hexwidth?r:new Array(this.hexwidth-r.length+1).join("0")+r},ri.prototype.get=function(r,t){this.hue+=this.goldenRatio,this.hue%=1,t
630ypeof r!="number"&&(r=.5),typeof t!="number"&&(t=.95);var e=this.hsvToRgb(this.hue,r,t);return"#"+this.padHex(e[0].toString(16))+this.padHex(e[1].toString(16))+this.padHex(e[2].toString(16))};const at={configureHighDPICanvas:function(r,t,e){const n=window.devicePixelRatio;r.canvas.style.width=`${t}px`,r.canvas.width=Math.floor(n*t),r.canvas.style.height=`${e}px`,r.canvas.height=Math.floor(n*e),r.scale(n,n)},setProperties:function(r,t){for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];r[e]=n}},strokeLine:function(r,t,e,n,i,s){t=Math.floor(t)+.5,e=Math.floor(e)+.5,n=Math.floor(n)+.5,i=Math.floor(i)+.5,s&&(r.save(),at.setProperties(r,s)),r.beginPath(),r.moveTo(t,e),r.lineTo(n,i),r.stroke(),s&&r.restore()},fillRect:function(r,t,e,n,i,s){t=Math.round(t),e=Math.round(e),s&&(r.save(),at.setProperties(r,s)),r.fillRect(t,e,n,i),s&&r.restore()},fillPolygon:function(r,t,e,n){n&&(r.save(),at.setProperties(r,n)),Yh(r,t,e),r.fill(),n&&r.restore()},strokePolygon:function(r,t,e,n){n&&(r.save(),at.setProperties(r,n)),Yh(r,t,e),r.stroke(),n&&r.restore()},fillText:function(r,t,e,n,i,s){if((i||s)&&r.save(),i&&at.setProperties(r,i),s){for(var o in r.translate(e,n),s){var a=s[o];o==="translate"&&r.translate(a.x,a.y),o==="rotate"&&r.rotate(a.angle*Math.PI/180)}r.fillText(t,0,0)}else r.fillText(t,e,n);(i||s)&&r.restore()},strokeText:function(r,t,e,n,i,s){if((i||s)&&r.save(),i&&at.setProperties(r,i),s){for(var o in r.translate(e,n),s){var a=s[o];o==="translate"&&r.translate(a.x,a.y),o==="rotate"&&r.rotate(a.angle*Math.PI/180)}r.strokeText(t,0,0)}else r.strokeText(t,e,n);(i||s)&&r.restore()},strokeCircle:function(r,t,e,n,i){i&&(r.save(),at.setProperties(r,i)),r.beginPath(),r.arc(t,e,n,0,2*Math.PI),r.stroke(),i&&r.restore()},fillCircle:function(r,t,e,n,i){i&&(r.save(),at.setProperties(r,i)),r.beginPath(),r.arc(t,e,n,0,2*Math.PI),r.fill(),i&&r.restore()},drawArrowhead:function(r,t,e,n,i){r.save(),n||(n=5),i&&(r.lineWidth=i),r.beginPath(),r.moveTo(t,e-n/2),r.lineTo(t,e+n/2),r.lineTo(t+n,e),r.lineTo(t,e-n/2),r.closePath(),r.fill(),r.restore()},dashedLine:function(r,t,e,n,i,s,o={}){s===void 0&&(s=2),r.setLineDash([s,s]),at.strokeLine(r,t,e,n,i,o),r.setLineDash([])},roundRect:function(r,t,e,n,i,s,o,a){a===void 0&&(a=!0),s===void 0&&(s=5),r.beginPath(),r.moveTo(t+s,e),r.lineTo(t+n-s,e),r.quadraticCurveTo(t+n,e,t+n,e+s),r.lineTo(t+n,e+i-s),r.quadraticCurveTo(t+n,e+i,t+n-s,e+i),r.lineTo(t+s,e+i),r.quadraticCurveTo(t,e+i,t,e+i-s),r.lineTo(t,e+s),r.quadraticCurveTo(t,e,t+s,e),r.closePath(),a&&r.stroke(),o&&r.fill()},polygon:function(r,t,e,n,i){i===void 0&&(i=!0),r.beginPath();var s=t.length;r.moveTo(t[0],e[0]);for(var o=1;o<s;o++)r.lineTo(t[o],e[o]);r.closePath(),i&&r.stroke(),n&&r.fill()},drawRandomColorVerticalLines:r=>{for(let t=0;t<r.canvas.width;t++)at.fillRect(r,t,0,1,r.canvas.height,{fillStyle:$g(100,250)})},labelTransformWithContext:(r,t)=>{r.translate(t,0),r.scale(-1,1),r.translate(-t,0)}};function Yh(r,t,e){var n,i=t.length;for(n=0;n<i;n++)t[n]=Math.round(t[n]),e[n]=Math.round(e[n]);for(r.beginPath(),r.moveTo(t[0],e[0]),n=1;n<i;n++)r.lineTo(t[n],e[n]);r.closePath()}class Gg{constructor(t){this.dialog=new Hl(t)}present(t,e){this.dialog.present(t,e)}}const Yi={gwascatalog:{fields:["bin","chr","start","end","name","pubMedID","author","pubDate","journal","title","trait","initSample","replSample","region","genes","riskAllele","riskAlFreq","pValue","pValueDesc","orOrBeta","ci95","platform","cnv"]},wgrna:{fields:["bin","chr","start","end","name","score","strand","thickStart","thickEnd","type"]},cpgislandext:{fields:["bin","chr","start","end","name","length","cpgNum","gcNum","perCpg","perGc","obsExp"]},clinVarMain:{fields:["chr1","start","end","name","score","strand","thickStart","thickEnd","reserved","blockCount","blockSizes","chromStarts","origName","clinSign","reviewStatus","type","geneId","snpId","nsvId","rcvAcc","testedInGtr","phenotypeList","phenotype","origin","assembly","cytogenetic","hgvsCod","hgvsProt","numSubmit","lastEval","guidelines","otherIds"]}};function Ki(r){const t=new Set(["boolean","number","string","symbol"]),e=typeof r;return r!==void 0&&(t.has(e)||r.substring||r.toFixed)}function Ft(r,t){var e={oauthToken:r.oauthToken,headers:r.headers,withCredentials:r.withCredentials,filename:r.filename};return Object.assign(e,t)}const _o=function(r){var t,e;if(r&&r.length>0){t=Number.MAX_VALUE,e=-Number.MAX_VALUE;for(let n of r)Number.isNaN(n.value)||(t=Math.min(t,n.value),e=Math.max(e,n.value));e>0&&(t=Math.min(0,t)),e<0&&(e=0)}else t=0,e=100;return{min:t,max:e}},Kh=function(r,t,e){let n=t.start,i=t.end;if(i===void 0)n-=e/2,i=n+e,i>r?(i=r,n=i-e):n<0&&(n=0,i=e);else if(i-n<e){const s=(i+n)/2;s-e/2<0?(n=0,i=n+e):s+e/2>r?(i=r,n=i-e):(n=s-e/2,i=n+e)}t.start=Math.ceil(n),t.end=Math.floor(i)};async function xo(r){if(ve(r)&&r.startsWith("https://drive.google.com")){if(Vh()===void 0)throw Error("Google drive is referenced, but API key is not defined. An API key is required for Google Drive access");const t=await(async function(e){let n="https://www.googleapis.com/drive/v3/files/"+jh(e)+"?supportsTeamDrives=true";const i=Vh();i&&(n+="&key="+i);let o=await(await fetch(n)).json();if(o.error&&o.error.code===404){const l=await Uh("https://www.googleapis.com/auth/drive.readonly");if(!l||(o=await(await fetch(n,{headers:{Authorization:`Bearer ${l}`}})).json(),o.error))throw Error(o.error)}return o}
630)(r);return t.originalFileName||t.name}return Ii(r)}function ko(r){var t,e;return r>1e7?(t=" mb",e=r/1e6,Math.floor(e).toString()+t):r>1e4?(t=" kb",e=r/1e3,Ot(Math.floor(e))+t):Ot(r)+" bp"}function ir(r){return ve(r)&&r.startsWith("data:")}function ni(r,t){const e=ut.div({class:t});r.appendChild(e)}function Jh(r,t){t.parentNode.insertBefore(r,t)}function tc(r,t){t.parentNode.insertBefore(r,t.nextSibling)}function Co(){return window.location.protocol==="https:"||window.location.hostname==="localhost"}function So(r,t){if(r.length<6)return;var e={chr1:r[0],start1:Number.parseInt(r[1]),end1:Number.parseInt(r[2]),chr2:r[3],start2:Number.parseInt(r[4]),end2:Number.parseInt(r[5])};if(isNaN(e.start1)||isNaN(e.end1)||isNaN(e.start2)||isNaN(e.end2))return;t&&t.hiccups===void 0&&(t.hiccups=!!t.columnNames&&ec(t.columnNames));const n=t&&t.hiccups,i=n?6:10;if(n||(r.length>6&&r[6]!=="."&&(e.name=r[6]),r.length>7&&r[7]!=="."&&(e.score=Number(r[7])),r.length>8&&r[8]!=="."&&(e.strand1=r[8]),r.length>9&&r[9]!=="."&&(e.strand2=r[9])),t){const s=t.colorColumn;s&&s<r.length&&(e.color=qt.createColorString(r[s]));const o=t.thicknessColumn;o&&o<r.length&&(e.thickness=r[o]),r.length>i&&t.columnNames&&t.columnNames.length===r.length&&(e.extras=r.slice(i))}return e.chr1===e.chr2&&(e.chr=e.chr1,e.start=Math.min(e.start1,e.start2),e.end=Math.max(e.end1,e.end2)),e}function Zg(r,t){if(!(r.length<8))return{chr:r[0],start:Number.parseInt(r[1]),end:Number.parseInt(r[2]),color:qt.createColorString(r[6]),value:Number(r[7])}}function ec(r){return r&&(r.includes("fdrDonut")||r.includes("fdr_donut"))}const rc=new Set(["narrowpeak","broadpeak","regionpeak","peaks","bedgraph","wig","gff3","gff","gtf","fusionjuncspan","refflat","seg","aed","bed","vcf","bb","bigbed","biginteract","biggenepred","bignarrowpeak","bw","bigwig","bam","tdf","refgene","genepred","genepredext","bedpe","bp","snp","rmsk","cram","gwas","maf","mut","tsv","hiccups","fasta","fa","fna","pytor"]);function nc(r){return Yi&&Yi[r]?(function(t){const e=t.fields,n=["chr","start","end"];for(let i=0;i<e.length;i++)for(let s of n)s===e[i]&&(t[s]=i);return t})(Yi[r]):void 0}function Ao(r){var t,e;if((r=r.toLowerCase()).endsWith("refgene.txt.gz")||r.endsWith("refgene.txt.bgz")||r.endsWith("refgene.txt")||r.endsWith("refgene.sorted.txt.gz")||r.endsWith("refgene.sorted.txt.bgz"))return"refgene";switch((t=r.indexOf("?"))>0&&(r=r.substr(0,t)),r.endsWith(".gz")&&(r=r.substr(0,r.length-3)),(r.endsWith(".txt")||r.endsWith(".tab")||r.endsWith(".bgz"))&&(r=r.substr(0,r.length-4)),e=(t=r.lastIndexOf("."))<0?r:r.substr(t+1)){case"bw":return"bigwig";case"bb":return"bigbed";case"fasta":case"fa":case"fna":return"fasta";default:return rc.has(e)?e:void 0}}function ic(r,t){if(ve(r)){if(r.includes("?")){const e=r.indexOf("?");return r.substring(0,e)+"."+t+r.substring(e)}return r+"."+t}}function sc(r){if((function(t){t.featureType&&(t.type=t.type||t.featureType,t.featureType=void 0),t.type==="junctions"?t.type="junction":t.type==="bed"?(t.type="annotation",t.format=t.format||"bed"):t.type==="annotations"?t.type="annotation":t.type==="alignments"?t.type="alignment":t.type==="bam"?(t.type="alignment",t.format="bam"):t.type==="vcf"?(t.type="variant",t.format="vcf"):t.type==="t2d"?t.type="gwas":t.type!=="FusionJuncSpan"||t.format?t.type==="aed"&&(t.type="annotation",t.format=t.format||"aed"):t.format="fusionjuncspan"})(r),r.type)return r.type;if(r.format)switch(r.format.toLowerCase()){case"bw":case"bigwig":case"wig":case"bedgraph":case"tdf":return"wig";case"vcf":return"variant";case"seg":return"seg";case"mut":case"maf":return"mut";case"bam":case"cram":return"alignment";case"hiccups":case"bedpe":case"bedpe-loop":case"biginteract":return"interact";case"bp":return"arc";case"gwas":return"gwas";case"bed":case"bigbed":case"bb":case"biggenepred":case"bignarrowpeak":return"bedtype";case"fasta":return"sequence";case"pytor":return"cnvpytor";default:return"annotation"}}async function oc(r){if(r.url){const t=await Ct.loadString(r.url,Ft(r,{range:{start:0,size:1e3}}));if(t&&ec(t.split(` 631`)[0].split(" ")))return"hiccups"}}function ac(r,t){Yi[r]={fields:t}}var Qg=Object.freeze({__proto__:null,knownFileExtensions:rc,getFormat:nc,inferFileFormat:Ao,inferFileFormatFromHeader:oc,inferTrackType:sc,inferIndexPath:ic,registerFileFormats:ac});const Xg=[["A","T"],["G","C"],["Y","R"],["W","S"],["K","M"],["D","H"],["B","V"]],un=new Map;for(let r of Xg){const t=r[0],e=r[1];un.set(t,e),un.set(e,t),un.set(t.toLowerCase(),e.toLowerCase()),un.set(e.toLowerCase(),t.toLowerCase())}function Wr(r){let t="",e=r.length;for(;e-- >0;){const n=r[e];t+=un.has(n)?un.get(n):n}return t}class Eo{constructor(t,e,n){this.name=t,this.order=e,this.bpLength=n}}
631const Yg=Fr,Kg=new Set(["fastaURL","indexURL","cytobandURL","indexed"]);class Jg{constructor(t){this.fastaURL=t.fastaURL,this.withCredentials=t.withCredentials,this.chromosomeNames=[],this.chromosomes={},this.sequences=new Map;const e={};for(let n in t)t.hasOwnProperty(n)&&!Kg.has(n)&&(e[n]=t[n]);this.config=e}async init(){return this.loadAll()}async getSequence(t,e,n){if(!this.sequences.has(t))return;let i=this.sequences.get(t).find((l=>l.contains(e,n)));if(!i&&(i=this.sequences.get(t).find((l=>l.overlaps(e,n))),!i))return;e-=i.offset,n-=i.offset;let s="";if(e<0)for(let l=e;l<Math.min(n,0);l++)s+="*";if(n<=0)return Promise.resolve(s);const o=i.sequence,a=Math.min(n,o.length);return s+o.substring(e,a)}async loadAll(){let t;if(ir(this.fastaURL)){let c=Vr(this.fastaURL);t="";for(let u of c)t+=String.fromCharCode(u)}else t=await Ct.load(this.fastaURL,Ft(this.config));const e=new Set,n=Yg(t),i=n.length;let s,o=0,a=0,l={};for(;o<i;){if(s=n[o++].trim(),!(s.startsWith("#")||s.length===0))if(s.startsWith(">")){l&&l.seq&&h.call(this,l,a++);const c=s.substr(1).split(/\s+/),u=c[0].split(":");if(l.chr=u[0],l.seq="",l.offset=0,u.length>1&&u[1].indexOf("-")>0){const p=u[1].split("-");p.length===2&&/^[0-9]+$/.test(p[0])&&/^[0-9]+$/.test(p[1]);const d=Number.parseInt(p[0]);if(Number.parseInt(p[1])>d&&(l.offset=d-1),c.length>1&&c[1].startsWith("@len="))try{l.length=parseInt(c[1].trim().substring(5))}catch{l.length=void 0}else l.length=void 0}}else l.seq+=s;l&&l.seq&&h.call(this,l,a)}function h(c,u){const p=c.length||c.offset+c.seq.length;if(e.has(c.chr)){const d=this.chromosomes[c.chr];d.bpLength=Math.max(d.bpLength,p)}else this.chromosomeNames.push(c.chr),this.sequences.set(c.chr,[]),this.chromosomes[c.chr]=new Eo(c.chr,u,p),e.add(c.chr);this.sequences.get(c.chr).push(new tm(c.offset,c.seq))}}}class tm{constructor(t,e){this.offset=t,this.sequence=e}contains(t,e){return this.offset<=t&&this.end>=e}overlaps(t,e){return this.offset<e&&this.end>t}get end(){return this.offset+this.sequence.length}}const $r=function(r,t,e,n){this.chr=r,this.start=t,this.end=e,this.features=n};$r.prototype.contains=function(r,t,e){return this.chr===r&&this.start<=t&&this.end>=e},$r.prototype.containsRange=function(r){return this.chr===r.chr&&this.start<=r.start&&this.end>=r.end};const em=Fr,rm=new Set(["fastaURL","indexURL","compressedIndexURL","cytobandURL","indexed"]);class nm{constructor(t){this.file=t.fastaURL,this.indexFile=t.indexURL||t.indexFile||this.file+".fai",this.compressedIndexFile=t.compressedIndexURL||!1,this.withCredentials=t.withCredentials,this.chromosomeNames=[],this.chromosomes={},this.sequences={},this.offsets={};const e={};for(let n in t)t.hasOwnProperty(n)&&!rm.has(n)&&(e[n]=t[n]);this.config=e}async init(){return this.getIndex()}async getSequence(t,e,n){if(!(this.interval&&this.interval.contains(t,e,n))){let o=e,a=n;if(n-e<5e4){const h=n-e,c=Math.round(e+h/2);o=Math.max(0,c-25e3),a=c+25e3}const l=await this.readSequence(t,o,a);this.interval=new $r(t,o,a,l)}const i=e-this.interval.start,s=n-e;return this.interval.features?this.interval.features.substr(i,s):null}async getIndex(){if(this.index)return this.index;{const t=await Ct.load(this.indexFile,Ft(this.config)),e=em(t),n=e.length;let i=0,s=0;for(this.index={};i<n;){const o=e[i++].split(" ");if(o.length===5){const a=o[0],l=parseInt(o[1]),h={size:l,position:parseInt(o[2]),basesPerLine:parseInt(o[3]),bytesPerLine:parseInt(o[4])};this.chromosomeNames.push(a),this.index[a]=h,this.chromosomes[a]=new Eo(a,s++,l)}}return this.index}}async getCompressedIndex(){if(this.compressedIndex)return this.compressedIndex;if(!this.compressedIndexFile)return this.compressedIndex=[],this.compressedIndex;this.compressedIndex=[];const t=await Ct.loadArrayBuffer(this.compressedIndexFile,Ft(this.config)),e=t.byteLength;if(e<8)return this.compressedIndex;const n=t.slice(0,8),i=Number(new DataView(n).getBigUint64(0,!0)),s=8+2*i*8;if(e!=s)return this.compressedIndex;this.compressedIndex.push([0,0]);for(let o=0;o<i;o++){const a=8+2*o*8,l=8+2*o*8+16,h=t.slice(a,l),c=new DataView(h),u=Number(c.getBigUint64(0,!0)),p=Number(c.getBigUint64(8,!0));this.compressedIndex.push([u,p])}return this.compressedIndex}async getRelevantCompressedBlockNumbers(t,e){if(t<0||e<0||e<t)return[];await this.getCompressedIndex();let n=[];const i=this.compressedIndex.length-1;if(this.compressedIndex.length==0)return[];if(t>this.compressedIndex[i][1])return[i];let s=0,o=i,a=Math.floor(this.compressedIndex.length/2),l=this.compressedIndex.length+1,h=!1;for(let u=0;u<l;u++){const p=this.compressedIndex[a][1],d=a<this.compressedIndex.length-1?this.compressedIndex[a+1][1]:1/0;if(p<=t&&d>t){h=!0;break}p<t?s=a+1:o=a-1,a=Math.ceil((o-s)/2)+s}if(!h)return[];n.push(a);for(let u=a+1;u<this.compressedIndex.length&&(n.push(u),!(this.compressedIndex[u][1]>=e));u++);const c=n[n.length-1];return c===this.compressedIndex.length-1&&this.compressedIndex[c][1]<e&&n.push(-1),n}async loadAndUncompressBlocks(t,e){if(await this.getCompressedIndex(),t.length==0)return"";let n=Array(t.length-1);for(let o=0;o<t.length-1;o++){const a=t[o],l=this.compressedIndex[a][0],h=t[o+1];let c=[];if(h!=-1){const p=this.compressedIndex[h][0]-l;c=await Ct.loadArrayBuffer(this.file,Ft(this.config,{range:{start:l,size:p}}))}else c=await Ct.loadArrayBuffer(this.file,Ft(this.config,{range:{start:l}}));const u=await mr(c);n[o]=u}let i="";for(let o=0;o<n.length;o++)for(let a=0;a<n[o].length;a++)i+=String.fromCharCode(n[o][a]);const s=e-this.compressedIndex[t[0]][1];return i=i.substring(s),i}async readSequence(t,e,n){await this.getIndex(),await this.getCompressedIndex();const i=this.index[t];if(!i)return this.interval=new $r(t,e,n,null),null;
631const s=Math.max(0,e),o=Math.min(i.size,n),a=i.bytesPerLine,l=i.basesPerLine,h=i.position,c=a-l,u=Math.floor(s/l),p=Math.floor(o/l),d=s-u*l,w=h+u*a+d,m=h+p*a+(o-p*l)-1,g=m-w+1;if(g<=0)return null;let f;if(this.compressedIndexFile){let S=await this.getRelevantCompressedBlockNumbers(w,m);if(S.length===0)return null;f=await this.loadAndUncompressBlocks(S,w)}else f=await Ct.load(this.file,Ft(this.config,{range:{start:w,size:g}}));if(!f)return null;let b,v="",_=0,A=f.length;for(d>0&&(b=Math.min(o-s,l-d),v+=f.substr(_,b),_+=b+c);_<A;)b=Math.min(l,A-_),v+=f.substr(_,b),_+=b+c;return v}}const im=Fr;class sm{constructor(t){this.url=t,this.chromosomeNames=[],this.chromosomes={}}async init(){return this.loadAll()}async getSequence(t,e,n){}async loadAll(){let t;if(ir(this.url)){let i=Vr(this.fastaURL);t="";for(let s of i)t+=String.fromCharCode(s)}else t=await Ct.load(this.url,{});this.chromosomeNames=[],this.chromosomes={};const e=im(t);let n=0;for(let i of e){const s=i.split(" ");this.chromosomeNames.push(s[0]);const o=Number.parseInt(s[1]),a=new Eo(s[0],n++,o);this.chromosomes[s[0]]=a}}}async function lc(r){let t;return t=r.format==="chromsizes"?new sm(r.fastaURL):ir(r.fastaURL)||r.indexed===!1?new Jg(r):new nm(r),await t.init(),t}const hc={A:"rgb( 0, 200, 0)",C:"rgb( 0,0,200)",T:"rgb(255,0,0)",G:"rgb(209,113, 5)",N:"rgb(80,80,80)"},Ji=Number.MIN_SAFE_INTEGER,om={TTT:"F",TTC:"F",TTA:"L",TTG:"L",CTT:"L",CTC:"L",CTA:"L",CTG:"L",ATT:"I",ATC:"I",ATA:"I",ATG:"M",GTT:"V",GTC:"V",GTA:"V",GTG:"V",TCT:"S",TCC:"S",TCA:"S",TCG:"S",CCT:"P",CCC:"P",CCA:"P",CCG:"P",ACT:"T",ACC:"T",ACA:"T",ACG:"T",GCT:"A",GCC:"A",GCA:"A",GCG:"A",TAT:"Y",TAC:"Y",TAA:"STOP",TAG:"STOP",CAT:"H",CAC:"H",CAA:"Q",CAG:"Q",AAT:"N",AAC:"N",AAA:"K",AAG:"K",GAT:"D",GAC:"D",GAA:"E",GAG:"E",TGT:"C",TGC:"C",TGA:"STOP",TGG:"W",CGT:"R",CGC:"R",CGA:"R",CGG:"R",AGT:"S",AGC:"S",AGA:"R",AGG:"R",GGT:"G",GGC:"G",GGA:"G",GGG:"G"},To={},Mo=["A","G","C","T","Y","R","W","S","K","M","D","V","H","B","N","X"],cc=["T","C","G","A","R","Y","W","S","M","K","H","B","D","V","N","X"];for(let r=0;r<Mo.length;r++)To[Mo[r]]=cc[r],To[Mo[r].toLowerCase()]=cc[r].toLowerCase();const ts=115;class uc{constructor(t,e){this.config=t,this.browser=e,this.type="sequence",this.removable=t.removable===void 0||t.removable,this.name=t.name,this.id=t.id,this.sequenceType=t.sequenceType||"dna",this.disableButtons=!1,this.order=t.order||Ji,this.ignoreTrackMenu=!1,this.reversed=t.reversed===!0,this.frameTranslate=t.frameTranslate===!0,this.height=this.frameTranslate?ts:25,t.url&&(t.fastaURL=t.url),t.fastaURL||(this.id=t.id||"sequence")}menuItemList(){return[{name:this.reversed?"Forward":"Reverse",click:()=>{this.reversed=!this.reversed,this.trackView.repaintViews()}},{name:this.frameTranslate?"Close Translation":"Three-frame Translate",click:()=>{if(this.frameTranslate=!this.frameTranslate,this.frameTranslate){for(let t of this.trackView.viewports)t.setContentHeight(ts);this.trackView.setTrackHeight(ts)}else{for(let t of this.trackView.viewports)t.setContentHeight(25);this.trackView.setTrackHeight(25)}this.trackView.repaintViews()}}]}contextMenuItemList(t){const e=t.viewport;if(e.referenceFrame.bpPerPixel<=1){const n=e.getWidth()*e.referenceFrame.bpPerPixel,i=e.referenceFrame.chr,s=Math.floor(e.referenceFrame.start),o=Math.ceil(s+n),a=[{label:this.reversed?"View visible sequence (reversed)...":"View visible sequence...",click:async()=>{let l=await this.browser.genome.sequence.getSequence(i,s,o);l?this.reversed&&(l=Wr(l)):l="Unknown sequence",this.browser.alert.present(l)}}];return Co()&&a.push({label:"Copy visible sequence",click:async()=>{let l=await this.browser.genome.sequence.getSequence(i,s,o);l?this.reversed&&(l=Wr(l)):l="Unknown sequence";try{await navigator.clipboard.writeText(l)}catch(h){this.browser.alert.present(`error copying sequence to clipboard ${h}`)}}}),a.push("<hr/>"),a}}translateSequence(t){const e=[[],[],[]];for(let n of[0,1,2]){let i=n;for(;t.length-i>=3;){let s=t.slice(i,i+3);this.reversed&&(s=s.split("").reverse().join(""));const o=om[s.toUpperCase()]||"";e[n].push({codons:s,aminoA:o}),i+=3}}return e}async getSequenceSource(){return this.config.fastaURL?(this.fasta||(this.fasta=new am(this.config,this.browser.genome),await this.fasta.init()),this.fasta):this.browser.genome.sequence}async getFeatures(t,e,n,i){if(e=Math.floor(e),n=Math.floor(n),i&&i>10)return null;
631{const s=await this.getSequenceSource();return{bpStart:e,sequence:await s.getSequence(t,e,n)}}}draw(t){const e=t.context;if(t.features){let n=t.features.sequence;if(!n)return;this.reversed&&(n=n.split("").map((function(o){return To[o]})).join(""));const i=t.features.bpStart,s=1+t.bpStart+t.pixelWidth*t.bpPerPixel;for(let o=Math.floor(t.bpStart);o<=s;o++){const a=Math.floor(o-i);if(a>=0&&a<n.length){const l=(o-t.bpStart)/t.bpPerPixel,h=1/t.bpPerPixel,c=n[a],u=this.fillColor(c.toUpperCase());if(t.bpPerPixel>.1)at.fillRect(e,l,5,h,10,{fillStyle:u});else{const p=l+.5*(h-e.measureText(c).width);t.axis==="y"?(e.save(),at.labelTransformWithContext(e,p),at.strokeText(e,c,p,15,{strokeStyle:u}),e.restore()):at.strokeText(e,c,p,15,{strokeStyle:u})}}}if(this.frameTranslate){let o=25;const a=this.translateSequence(n);for(let l=0;l<a.length;l++){const h=a[l];for(let c=0;c<h.length;c++){let u=c%2==0?"rgb(160,160,160)":"rgb(224,224,224)";const p=h[c],d=i+l+3*c-t.bpStart,w=Math.floor(d/t.bpPerPixel),m=Math.floor((d+3)/t.bpPerPixel),g=Math.round((w+m)/2);if(m<0)continue;if(w>t.pixelWidth)break;let f=p.aminoA;p.aminoA.indexOf("STOP")>-1?(u="rgb(255, 0, 0)",f="STOP"):p.aminoA==="M"&&(u="rgb(0, 153, 0)",f="START"),at.fillRect(e,w,o,m-w,25,{fillStyle:u}),t.bpPerPixel<=.1&&at.strokeText(e,f,g-e.measureText(f).width/2,o+15)}o+=30}}}}get supportsWholeGenome(){return!1}computePixelHeight(t){return this.height=this.frameTranslate?ts:25,this.height}fillColor(t){return this.color?this.color:this.sequenceType==="dna"?hc[t]||"gray":"rgb(0, 0, 150)"}getState(){const t={type:"sequence"};return this.order!==Ji&&(t.order=this.order),this.reversed&&(t.revealed=!0),t}}class am{constructor(t,e){this.config=t,this.genome=e}async init(){this.fasta=await lc(this.config),this.chrNameMap=new Map;for(let t of this.fasta.chromosomeNames)this.chrNameMap.set(this.genome.getChromosomeName(t),t)}async getSequence(t,e,n){const i=this.chrNameMap.has(t)?this.chrNameMap.get(t):t;return this.fasta.getSequence(i,e,n)}}class lm{constructor(t,e,n,i){this.guid=ut.guid(),this.trackView=t,this.referenceFrame=n,this.browser=t.browser,this.$viewport=pt('<div class="igv-viewport">'),e.appendChild(this.$viewport.get(0)),t.track.height&&(this.$viewport.get(0).style.height=`${t.track.height}px`),t.track instanceof uc&&(this.alert=new Hl(this.$viewport.get(0))),this.contentTop=0,this.contentHeight=this.$viewport.height(),this.$viewport.width(i),this.initializationHelper()}initializationHelper(){}showMessage(t){this.messageDiv||(this.messageDiv=document.createElement("div"),this.messageDiv.className="igv-viewport-message",this.$viewport.append(pt(this.messageDiv))),this.messageDiv.textContent=t,this.messageDiv.style.display="inline-block"}hideMessage(t){this.messageDiv&&(this.messageDiv.style.display="none")}setTrackLabel(t){}startSpinner(){}stopSpinner(){}checkZoomIn(){return!0}shift(){}setTop(t){this.contentTop=t,this.$viewport.height()}async loadFeatures(){}clearCache(){}async repaint(){}draw(t,e,n){}checkContentHeight(t){let e=this.trackView.track;if(t=t||this.cachedFeatures,e.displayMode==="FILL")this.setContentHeight(this.$viewport.height());else if(typeof e.computePixelHeight=="function"&&t&&t.length>0){let n=e.computePixelHeight(t);n!==this.contentHeight&&this.setContentHeight(n)}}getContentHeight(){return this.contentHeight}setContentHeight(t){this.contentHeight=t}isLoading(){return!1}saveSVG(){}isVisible(){return this.$viewport.width()}setWidth(t){this.$viewport.width(t)}getWidth(){return this.$viewport.width()}getContentTop(){return this.contentTop}containsPosition(t,e){}addMouseHandlers(){}removeMouseHandlers(){}dispose(){this.popover&&this.popover.dispose(),this.$viewport.get(0).remove();for(let t of Object.keys(this))this[t]=void 0}}/*!! 632 * Canvas 2 Svg v1.0.19 633 * A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document. 634 * 635 * Licensed under the MIT license: 636 * http://www.opensource.org/licenses/mit-license.php 637 * 638 * Author: 639 * Kerry Liu 640 * 641 * Copyright (c) 2014 Gliffy Inc. 642 */function me(r,t){var e,n=Object.keys(t);for(e=0;e<n.length;e++)r=r.replace(new RegExp("\\{"+n[e]+"\\}","gi"),t[n[e]]);return r}function es(r){var t,e,n;if(!r)throw new Error("cannot create a random attribute name for an undefined object");t="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",e="";do for(e="",n=0;n<12;n++)e+=t[Math.floor(51*Math.random())];while(r[e]);return e}function hm(r){var t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[r]||t.alphabetic}function Ro(r){var t=Math.sqrt(r[0]*r[0]+r[1]*r[1]);return[r[0]/t,r[1]/t]}const dc=(function(r,t){var e,n,i,s={};for(r=r.split(","),t=t||10,e=0;e<r.length;e+=2)n="&"+r[e+1]+";
642",i=parseInt(r[e],t),s[n]="&#"+i+";";return s["\\xa0"]=" ",s})("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),ii={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class Lo{constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){var n,i=this.__ctx.__createElement("stop");i.setAttribute("offset",t),e&&e.indexOf("rgba")!==-1?(n=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e),i.setAttribute("stop-color",me("rgb({r},{g},{b})",{r:n[1],g:n[2],b:n[3]})),i.setAttribute("stop-opacity",n[4])):i.setAttribute("stop-color",e),this.__root.appendChild(i)}}class fc{constructor(t,e){this.__root=t,this.__ctx=e}}class Gr{constructor(t){if(!(this instanceof Gr))return new Gr(t);if(this.config=t,this.width=t.width,this.height=t.height,this.enableMirroring=t.enableMirroring||!1,this.canvas=this,this.__document=document,t.ctx?this.__ctx=t.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.isSVG=!0,this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__createElement("svg"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__root.setAttribute("overflow","visible"),t.viewbox){const i=t.viewbox.x+" "+t.viewbox.y+" "+t.viewbox.width+" "+t.viewbox.height;this.__root.setAttribute("viewBox",i),this.viewbox=t.viewbox}this.__ids={},this.__defs=this.__createElement("defs"),this.__root.appendChild(this.__defs),this.multiLocusGap=t.multiLocusGap;
vendor: 9,130 bytes, line 642
642let e={id:"svg_output_backdrop",width:"100%",height:"100%",fill:t.backdropColor||"white"},n=this.__createElement("rect",e);this.__root.appendChild(n),this.__rootGroup=this.__createElement("g",{id:"root-group"}),this.__root.appendChild(this.__rootGroup),this.__currentElement=this.__rootGroup}setWidth(t){this.width=t,this.__root.setAttribute("width",this.width);const e=this.config.viewbox.x+" "+this.config.viewbox.y+" "+t+" "+this.config.viewbox.height;this.__root.setAttribute("viewBox",e)}setHeight(t){this.height=t,this.__root.setAttribute("height",this.height);const e=this.config.viewbox.x+" "+this.config.viewbox.y+" "+this.config.viewbox.width+" "+t;this.__root.setAttribute("viewBox",e)}__createElement(t,e,n){e===void 0&&(e={});let i=this.__document.createElementNS("http://www.w3.org/2000/svg",t);n&&(i.setAttribute("fill","none"),i.setAttribute("stroke","none"));for(let s of Object.keys(e))i.setAttribute(s,e[s]);return i}__setDefaultStyles(){var t,e,n=Object.keys(ii);for(t=0;t<n.length;t++)this[e=n[t]]=ii[e].canvas}__applyStyleState(t){var e,n,i=Object.keys(t);for(e=0;e<i.length;e++)this[n=i[e]]=t[n]}__getStyleState(){var t,e,n={},i=Object.keys(ii);for(t=0;t<i.length;t++)n[e=i[t]]=this[e];return n}__applyStyleToCurrentElement(t){var e=this.__currentElement,n=this.__currentElementsToStyle;n&&(e.setAttribute(t,""),e=n.element,n.children.forEach((function(d){d.setAttribute(t,"")})));var i,s,o,a,l,h=Object.keys(ii);for(i=0;i<h.length;i++)if(s=ii[h[i]],o=this[h[i]],s.apply){if(o instanceof fc){if(o.__ctx)for(;o.__ctx.__defs.childNodes.length;)a=o.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[a]=a,this.__defs.appendChild(o.__ctx.__defs.childNodes[0]);e.setAttribute(s.apply,me("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof Lo)e.setAttribute(s.apply,me("url(#{id})",{id:o.__root.getAttribute("id")}));else if(s&&s.apply.indexOf(t)!==-1&&s.svg!==o)if(s.svgAttr!=="stroke"&&s.svgAttr!=="fill"||!o||o.indexOf("rgba")===-1){var c=s.svgAttr;if(h[i]==="globalAlpha"&&(c=t+"-"+s.svgAttr,e.getAttribute(c)))continue;e.setAttribute(c,o)}else{l=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o),e.setAttribute(s.svgAttr,me("rgb({r},{g},{b})",{r:l[1],g:l[2],b:l[3]}));var u=l[4],p=this.globalAlpha;p!=null&&(u*=p),e.setAttribute(s.svgAttr+"-opacity",u)}}}__closestGroupOrSvg(t){return(t=t||this.__currentElement).nodeName==="g"||t.nodeName==="svg"?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){var e,n,i,s,o,a=new XMLSerializer().serializeToString(this.__root);if(t)for(e=Object.keys(dc),n=0;n<e.length;n++)i=e[n],s=dc[i],(o=new RegExp(i,"gi")).test(a)&&(a=a.replace(o,s));return a}getSvg(){return this.__root}saveWithTranslationAndClipRect(t,e,n,i,s,o){const a=`${t}_clip_rect`;let l=this.__createElement("clipPath",{id:a});this.__defs.appendChild(l);const h={x:"0",y:o.toString(),width:i.toString(),height:s.toString()};l.appendChild(this.__createElement("rect",h));const c=this.__createElement("g");c.setAttribute("transform",me("translate({x},{y})",{x:e,y:n})),c.setAttribute("clip-path",me("url(#{id})",{id:a}));const u=this.__closestGroupOrSvg();u.appendChild(c),this.__groupStack.push(u),this.__currentElement=c,this.__stack.push(this.__getStyleState())}save(){var t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__stack.push(this.__getStyleState())}restore(){this.__currentElement=this.__groupStack.pop(),this.__currentElementsToStyle=null,this.__currentElement||(this.__currentElement=this.__root.childNodes[1]);var t=this.__stack.pop();this.__applyStyleState(t)}__addTransform(t){var e=this.__closestGroupOrSvg();if(e.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var n=this.__createElement("g");e.appendChild(n),this.__currentElement=n}var i=this.__currentElement.getAttribute("transform");i?i+=" ":i="",i+=t,this.__currentElement.setAttribute("transform",i)}addTrackGroupWithTranslationAndClipRect(t,e,n,i,s,o){const a=t+"_clip_rect";let l=this.__createElement("clipPath",{id:a});this.__defs.appendChild(l),l.appendChild(this.__createElement("rect",{x:"0",y:o.toString(),width:i.toString(),height:s.toString()}));let h=this.__createElement("g");this.__rootGroup.appendChild(h),h.setAttribute("transform",me("translate({x},{y})",{x:e,y:n})),h.setAttribute("id",t+"_group"),h.setAttribute("clip-path",me("url(#{id})",{id:a})),this.__currentElement=h}scale(t,e){e===void 0&&(e=t),this.__addTransform(me("scale({x},{y})",{x:t,y:e}))}rotate(t){var e=180*t/Math.PI;this.__addTransform(me("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(me("translate({x},{y})",{x:t,y:e}))}transform(t,e,n,i,s,o){this.__addTransform(me("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:n,d:i,e:s,f:o}))}beginPath(){var t;this.__currentDefaultPath="",this.__currentPosition={},t=this.__createElement("path",{},!0),this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){var t=this.__currentElement;t.nodeName==="path"&&t.setAttribute("d",this.__currentDefaultPath)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(me("M {x} {y}",{x:t,y:e}))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath&&this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(me("L {x} {y}",{x:t,y:e})):this.__addPathCommand(me("M {x} {y}",{x:t,y:e}))}bezierCurveTo(t,e,n,i,s,o){this.__currentPosition={x:s,y:o},this.__addPathCommand(me("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:n,cp2y:i,x:s,y:o}))}quadraticCurveTo(t,e,n,i){this.__currentPosition={x:n,y:i},this.__addPathCommand(me("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:n,y:i}))}arcTo(t,e,n,i,s){var o=this.__currentPosition&&this.__currentPosition.x,a=this.__currentPosition&&this.__currentPosition.y;if(o!==void 0&&a!==void 0){if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(o===t&&a===e||t===n&&e===i||s===0)this.lineTo(t,e);else{var l=Ro([o-t,a-e]),h=Ro([n-t,i-e]);if(l[0]*h[1]!=l[1]*h[0]){var c=l[0]*h[0]+l[1]*h[1],u=Math.acos(Math.abs(c)),p=Ro([l[0]+h[0],l[1]+h[1]]),d=s/Math.sin(u/2),w=t+d*p[0],m=e+d*p[1],g=[-l[1],l[0]],f=[h[1],-h[0]],b=function(A){var S=A[0];return A[1]>=0?Math.acos(S):-Math.acos(S)},v=b(g),_=b(f);this.lineTo(w+g[0]*s,m+g[1]*s),this.arc(w,m,s,v,_)}else this.lineTo(t,e)}}}stroke(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,n,i){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+i),this.lineTo(t,e+i),this.lineTo(t,e),this.closePath()}fillRect(t,e,n,i){i<0&&(e+=i,i=-i),n<0&&(t+=n,n=-n);var s,o,a,l={x:t,y:e,width:n,height:i};(!this.viewbox||(s=this.viewbox,o=l,s.x<o.x+o.width&&s.x+s.width>o.x&&s.y<o.y+o.height&&s.y+s.height>o.y))&&(a=this.__createElement("rect",l,!0),this.__closestGroupOrSvg().appendChild(a),this.__currentElement=a,this.__applyStyleToCurrentElement("fill"))}strokeRect(t,e,n,i){var s;s=this.__createElement("rect",{x:t,y:e,width:n,height:i},!0),this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}strokeEllipse(t,e,n,i,s,o,a,l){this.__ellipse(t,e,n,i,s,o,a,l,"stroke")}fillEllipse(t,e,n,i,s,o,a,l){this.__ellipse(t,e,n,i,s,o,a,l,"fill")}__ellipse(t,e,n,i,s,o,a,l,h){const c={cx:t,cy:e,rx:n,ry:i},u=this.__createElement("ellipse",c,!0);this.__closestGroupOrSvg().appendChild(u),this.__currentElement=u,this.__applyStyleToCurrentElement(h)}__clearCanvas(){for(var t=this.__closestGroupOrSvg().getAttribute("transform"),e=this.__root.childNodes[1],n=e.childNodes,i=n.length-1;i>=0;i--)n[i]&&e.removeChild(n[i]);this.__currentElement=e,this.__groupStack=[],t&&this.__addTransform(t)}clearRect(t,e,n,i){if(t!==0||e!==0||n!==this.width||i!==this.height){var s,o=this.__closestGroupOrSvg();s=this.__createElement("rect",{x:t,y:e,width:n,height:i,fill:"#FFFFFF"},!0),o.appendChild(s)}else this.__clearCanvas()}createLinearGradient(t,e,n,i){var s=this.__createElement("linearGradient",{id:es(this.__ids),x1:t+"px",x2:n+"px",y1:e+"px",y2:i+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(s),new Lo(s,this)}createRadialGradient(t,e,n,i,s,o){var a=this.__createElement("radialGradient",{id:es(this.__ids),cx:i+"px",cy:s+"px",r:o+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(a),new Lo(a,this)}
642__parseFont(){var t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),e={style:t[1]||"normal",size:t[4]||"10px",family:t[6]||"sans-serif",weight:t[3]||"normal",decoration:t[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(e.decoration="underline"),this.__fontHref&&(e.href=this.__fontHref),e}__wrapTextLink(t,e){if(t.href){var n=this.__createElement("a");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),n.appendChild(e),n}return e}__applyText(t,e,n,i){var s,o,a=this.__parseFont(),l=this.__closestGroupOrSvg(),h=this.__createElement("text",{"font-family":a.family,"font-size":a.size,"font-style":a.style,"font-weight":a.weight,"text-decoration":a.decoration,x:e,y:n,"text-anchor":(s=this.textAlign,o={left:"start",right:"end",center:"middle",start:"start",end:"end"},o[s]||o.start),"dominant-baseline":hm(this.textBaseline)},!0);h.appendChild(this.__document.createTextNode(t)),this.__currentElement=h,this.__applyStyleToCurrentElement(i),l.appendChild(this.__wrapTextLink(a,h))}fillText(t,e,n){this.__applyText(t,e,n,"fill")}strokeText(t,e,n){this.__applyText(t,e,n,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,n,i,s,o){if(i!==s){(i%=2*Math.PI)===(s%=2*Math.PI)&&(s=(s+2*Math.PI-.001*(o?-1:1))%(2*Math.PI));var a=t+n*Math.cos(s),l=e+n*Math.sin(s),h=t+n*Math.cos(i),c=e+n*Math.sin(i),u=o?0:1,p=0,d=s-i;d<0&&(d+=2*Math.PI),p=o?d>Math.PI?0:1:d>Math.PI?1:0,this.lineTo(h,c),this.__addPathCommand(me("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:n,ry:n,xAxisRotation:0,largeArcFlag:p,sweepFlag:u,endX:a,endY:l})),this.__currentPosition={x:a,y:l}}}clip(){var t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),n=es(this.__ids),i=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",n),e.appendChild(this.__currentElement),this.__defs.appendChild(e),t.setAttribute("clip-path",me("url(#{id})",{id:n})),t.appendChild(i),this.__currentElement=i}drawImage(){var t,e,n,i,s,o,a,l,h,c,u,p,d,w=Array.prototype.slice.call(arguments),m=w[0],g=0,f=0;if(w.length===3)t=w[1],e=w[2],n=s=m.width,i=o=m.height;else if(w.length===5)t=w[1],e=w[2],n=w[3],i=w[4],s=m.width,o=m.height;else{if(w.length!==9)throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);g=w[1],f=w[2],s=w[3],o=w[4],t=w[5],e=w[6],n=w[7],i=w[8]}a=this.__closestGroupOrSvg(),this.__currentElement;var b="translate("+t+", "+e+")";if(m instanceof Gr){if((l=m.getSvg().cloneNode(!0)).childNodes&&l.childNodes.length>1){for(h=l.childNodes[0];h.childNodes.length;)d=h.childNodes[0].getAttribute("id"),this.__ids[d]=d,this.__defs.appendChild(h.childNodes[0]);if(c=l.childNodes[1]){var v,_=c.getAttribute("transform");v=_?_+" "+b:b,c.setAttribute("transform",v),a.appendChild(c)}}}else m.nodeName!=="CANVAS"&&m.nodeName!=="IMG"||((u=this.__createElement("image")).setAttribute("width",n),u.setAttribute("height",i),u.setAttribute("preserveAspectRatio","none"),(g||f||s!==m.width||o!==m.height)&&((p=this.__document.createElement("canvas")).width=n,p.height=i,p.getContext("2d").drawImage(m,g,f,s,o,0,0,n,i),m=p),u.setAttribute("transform",b),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m.nodeName==="CANVAS"?m.toDataURL():m.getAttribute("src")),a.appendChild(u))}createPattern(t,e){let n,i=this.__document.__createElement("pattern"),s=es(this.__ids);return i.setAttribute("id",s),i.setAttribute("width",t.width),i.setAttribute("height",t.height),t.nodeName==="CANVAS"||t.nodeName==="IMG"?(n=this.__createElement("image"),n.setAttribute("width",t.width),n.setAttribute("height",t.height),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.nodeName==="CANVAS"?t.toDataURL():t.getAttribute("src")),i.appendChild(n),this.__defs.appendChild(i)):t instanceof Gr&&(i.appendChild(t.__root.childNodes[1]),this.__defs.appendChild(i)),new fc(i,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const cm=function(r,t,e,n){this.start=r,this.end=t,this.name=e,this.stain=0,n==="acen"?this.type="c":(this.type=n.charAt(1),this.type==="p"&&(this.stain=parseInt(n.substring(4))))};function um(){return"2.15.13"}const pc=Fr,be={loadGenome:async function(r){const t=r.cytobandURL,e=r.aliasURL,n=await lc(r);let i;
642e&&(i=await(function(o,a){return Ct.loadString(o,Ft(a)).then((function(l){var h=pc(l),c=[];return h.forEach((function(u){!u.startsWith("#")&&u.length>0&&c.push(u.split(" "))})),c}))})(e,n.config));const s=new dm(r,n,i);return t&&(s.cytobands=await(async function(o,a,l){let h;if(ir(o)){const _=Vr(o);h="";const A=_.length;for(let S=0;S<A;S++)h+=String.fromCharCode(_[S])}else h=await Ct.loadString(o,Ft(a));const c={};let u,p=[];const d=pc(h);for(let _ of d){var w=_.split(" "),m=l.getChromosomeName(w[0]);if(u||(u=m),m!==u&&(c[u]=p,p=[],u=m),w.length===5){var g=parseInt(w[1]),f=parseInt(w[2]),b=w[3],v=w[4];p.push(new cm(g,f,b,v))}}return c})(t,n.config,s)),s},initializeGenomes:async function(r){if(!be.KNOWN_GENOMES){let n=function(i){return i.forEach((function(s){t[s.id]=s})),t};const t={};if(r.loadDefaultGenomes!==!1)try{const i=`https://igv.org/genomes/genomes.json?randomSeed=${Math.random().toString(36)}&version=2.15.13`;n(await Ct.loadJson(i,{timeout:5e3}))}catch{try{const s=`https://s3.amazonaws.com/igv.org.genomes/genomes.json?randomSeed=${Math.random().toString(36)}&version=2.15.13`;n(await Ct.loadJson(s,{}))}catch{}}const e=r.genomeList||r.genomes;e&&n(typeof e=="string"?await Ct.loadJson(e,{}):e),be.KNOWN_GENOMES=t}},isWholeGenomeView:function(r){return r.toLowerCase()==="all"},expandReference:function(r,t){if(ve(t)&&t.startsWith("{"))try{t=JSON.parse(t)}catch{}let e;if(ve(t)?e=t:t.genome?e=t.genome:t.id!==void 0&&t.fastaURL===void 0&&(e=t.id),e){const n=be.KNOWN_GENOMES[e];return n||r.present(new Error(`Unknown genome id: ${e}`),void 0),n}return t}};class dm{constructor(t,e,n){this.config=t,this.id=t.id||(function(o){return o.id!==void 0?o.id:o.fastaURL&&ve(o.fastaURL)?o.fastaURL:o.fastaURL&&o.fastaURL.name?o.fastaURL.name:("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)})(t),this.sequence=e,this.chromosomeNames=e.chromosomeNames,this.chromosomes=e.chromosomes,this.featureDB=new Map,this.wholeGenomeView=t.wholeGenomeView===void 0||t.wholeGenomeView,this.wholeGenomeView&&Object.keys(e.chromosomes).length>1?(function(o,a){let l;if(a.chromosomeOrder)Array.isArray(a.chromosomeOrder)?o.wgChromosomeNames=a.chromosomeOrder:o.wgChromosomeNames=a.chromosomeOrder.split(",").map((u=>u.trim())),l=o.wgChromosomeNames.map((u=>o.chromosomes[u])).filter((u=>u!==void 0));else{const u=Object.keys(o.chromosomes).map((m=>o.chromosomes[m].bpLength)).reduce(((m,g)=>Math.max(m,g)))/50;l=Object.values(o.chromosomes).filter((m=>m.bpLength>u));const p=l.filter((m=>c(m.name.replace("chr","")))),d=l.filter((m=>!c(m.name.replace("chr",""))));p.sort(((m,g)=>Number.parseInt(m.name.replace("chr",""))-Number.parseInt(g.name.replace("chr",""))));const w=p.map((m=>m.name));for(let m of d)w.push(m.name);o.wgChromosomeNames=w}const h=l.reduce(((u,p)=>u+p.bpLength),0);function c(u){return/^\d+$/.test(u)}o.chromosomes.all={name:"all",bpLength:h}})(this,t):this.wgChromosomeNames=e.chromosomeNames;var i={},s=this;i.all="all",this.chromosomeNames.forEach((function(o){var a=o.startsWith("chr")?o.substring(3):"chr"+o;i[a.toLowerCase()]=o,o==="chrM"&&(i.mt="chrM"),o==="MT"&&(i.chrm="MT"),i[o.toLowerCase()]=o})),n&&n.forEach((function(o){var a,l;for(l=0;l<o.length;l++)if(s.chromosomes[o[l]]){a=o[l];break}a&&o.forEach((function(h){h!==a&&(i[h.toLowerCase()]=a,i[h]=a)}))})),this.chrAliasTable=i}showWholeGenomeView(){return this.config.wholeGenomeView!==!1}toJSON(){return Object.assign({},this.config,{tracks:void 0})}getInitialLocus(){}getHomeChromosomeName(){return this.showWholeGenomeView()&&this.chromosomes.hasOwnProperty("all")?"all":this.chromosomeNames[0]}getChromosomeName(t){return t&&this.chrAliasTable[t.toLowerCase()]||t}getChromosome(t){return t=this.getChromosomeName(t),this.chromosomes[t]}getCytobands(t){return this.cytobands?this.cytobands[t]:null}getLongestChromosome(){var t,e=this.chromosomes;for(let i in e){if(e.hasOwnProperty(i)){var n=e[i];(t===void 0||n.bpLength>t.bpLength)&&(t=n)}return t}}getChromosomes(){return this.chromosomes}getGenomeCoordinate(t,e){var n=this.getCumulativeOffset(t);if(n!==void 0)return n+e}getChromosomeCoordinate(t){let e;this.cumulativeOffsets===void 0&&(this.cumulativeOffsets=computeCumulativeOffsets.call(this));let n=0;for(let i of this.wgChromosomeNames){const s=this.cumulativeOffsets[i];if(s>t)return{chr:e,position:t-n};e=i,n=s}return{chr:this.wgChromosomeNames[this.wgChromosomeNames.length-1],position:0}}getCumulativeOffset(t){this.cumulativeOffsets===void 0&&(this.cumulativeOffsets=function(){let n=this,i={},s=0;for(let o of n.wgChromosomeNames)i[o]=Math.floor(s),s+=n.getChromosome(o).bpLength;return i}.call(this));const e=this.getChromosomeName(t);return this.cumulativeOffsets[e]}getGenomeLength(){let t=this;if(!this.bpLength){let e=0;
642t.wgChromosomeNames.forEach((function(n){let i=t.chromosomes[n];e+=i.bpLength})),this.bpLength=e}return this.bpLength}async getSequence(t,e,n){return t=this.getChromosomeName(t),this.sequence.getSequence(t,e,n)}addFeaturesToDB(t,e){const n=(i,s)=>{const o=this.featureDB.get(i);o&&(s=s.end-s.start>o.end-o.start?s:o),this.featureDB.set(i,s)};for(let i of t)if(i.name&&n(i.name.toUpperCase(),i),i.gene&&i.gene.name&&n(i.gene.name.toUpperCase(),i),e.searchableFields)for(let s of e.searchableFields){const o=i.getAttributeValue(s);o&&(o.indexOf(" ")>0?n(o.replaceAll(" ","+").toUpperCase(),i):n(o.toUpperCase(),i))}}}let dn,gc=0,mc=0;class Io extends lm{constructor(t,e,n,i){super(t,e,n,i)}initializationHelper(){this.$spinner=pt("<div>",{class:"igv-loading-spinner-container"}),this.$viewport.append(this.$spinner),this.$spinner.append(pt("<div>"));const t=this.trackView.track;t.type!=="sequence"&&(this.$zoomInNotice=this.createZoomInNotice(this.$viewport)),t.name&&t.id!=="sequence"&&(this.$trackLabel=pt('<div class="igv-track-label">'),this.$viewport.append(this.$trackLabel),this.setTrackLabel(t.name),this.browser.trackLabelsVisible===!1&&this.$trackLabel.hide()),this.stopSpinner(),this.addMouseHandlers()}setContentHeight(t){super.setContentHeight(t),this.featureCache&&(this.featureCache.redraw=!0)}setTrackLabel(t){this.$trackLabel.empty(),this.$trackLabel.html(t);const e=this.$trackLabel.text();this.$trackLabel.attr("title",e)}startSpinner(){this.$spinner.show()}stopSpinner(){this.$spinner&&this.$spinner.hide()}checkZoomIn(){if(this.trackView.track&&this.trackView.track.type==="sequence"&&this.referenceFrame.bpPerPixel>10)return pt(this.canvas).remove(),this.canvas=void 0,!1;if(!this.viewIsReady())return!1;if((()=>{if(this.referenceFrame.chr.toLowerCase()!=="all"||this.trackView.track.supportsWholeGenome){const t=this.trackView.track.visibilityWindow;return t!==void 0&&t>0&&this.referenceFrame.bpPerPixel*this.$viewport.width()>t}return!0})()){if(this.canvas&&(pt(this.canvas).remove(),this.canvas=void 0),this.trackView.track.autoHeight){const t=this.trackView.minHeight||0;this.setContentHeight(t)}return this.$zoomInNotice&&this.$zoomInNotice.show(),!1}return this.$zoomInNotice&&this.$zoomInNotice.hide(),!0}shift(){const t=this.referenceFrame;if(this.canvas&&this.canvas._data&&this.canvas._data.referenceFrame.chr===this.referenceFrame.chr&&this.canvas._data.bpPerPixel===t.bpPerPixel){const e=Math.round((this.canvas._data.bpStart-t.start)/t.bpPerPixel);this.canvas.style.left=e+"px"}}setTop(t){if(super.setTop(t),this.canvas){const n=this.$viewport.height(),i=t+this.canvas._data.pixelTop,s=i+this.canvas._data.pixelHeight;(i>0||s<n)&&this.repaint()}else this.repaint();let e=t+this.canvas._data.pixelTop;this.canvas.style.top=`${e}px`}async loadFeatures(){const t=this.referenceFrame,e=t.chr,n=this.browser.genome.getChromosome(e).bpLength,i=this.$viewport.width()*t.bpPerPixel,s=Math.floor(Math.max(0,t.start-i)),o=Math.ceil(Math.min(n,t.start+i+i));if(!this.loading||this.loading.start!==s||this.loading.end!==o){this.loading={start:s,end:o},this.startSpinner();try{const a=this.trackView.track,l=await this.getFeatures(a,e,s,o,t.bpPerPixel);if(l){let h=[];if(a.roiSets&&a.roiSets.length>0)for(let u of a.roiSets){const p=await u.getFeatures(e,s,o,t.bpPerPixel);h.push({track:u,features:p})}const c=a&&(a.type==="wig"||a.type==="merged");return this.featureCache=new fm(e,s,o,t.bpPerPixel,l,h,c),this.loading=!1,this.hideMessage(),this.stopSpinner(),this.featureCache}}catch(a){this.trackView&&this.trackView.disposed!==!0&&(this.showMessage("Error loading track data"),this.browser.alert.present(a))}finally{this.loading=!1,this.stopSpinner()}}}repaintDimensions(){const t=be.isWholeGenomeView(this.referenceFrame.chr),e=t?this.$viewport.width():3*this.$viewport.width(),n=this.referenceFrame.bpPerPixel;return{bpStart:this.referenceFrame.start-(t?0:e/3*n),bpEnd:this.referenceFrame.end+(t?0:e/3*n),pixelWidth:e}}repaint(){if(this.featureCache===void 0)return;const{features:t,roiFeatures:e}=this.featureCache,{bpStart:n,bpEnd:i,pixelWidth:s}=this.repaintDimensions(),o=this.$viewport.height(),a=this.getContentHeight(),l=e?Math.max(a,o):a,h=Math.min(l,3*o);if(s===0||h===0)return void(this.canvas&&pt(this.canvas).remove());const c=Math.max(0,-this.contentTop-Math.floor(h/3)),u=this.referenceFrame.bpPerPixel,p=Math.round((n-this.referenceFrame.start)/u),d=(this.contentTop||0)+c,w=document.createElement("canvas");w.style.position="relative",w.style.display="block",w.style.width=s+"px",w.style.height=h+"px",w.style.left=p+"px",w.style.top=d+"px";const m=this.trackView.track.displayMode==="FILL"||this.trackView.track.supportHiDPI!==!1?window.devicePixelRatio:1;w.width=m*s,w.height=m*h;const g=w.getContext("2d");g.scale(m,m),g.translate(0,-c);const f={context:g,pixelXOffset:p,pixelWidth:s,pixelHeight:h,pixelTop:c,bpStart:n,bpEnd:i,bpPerPixel:u,referenceFrame:this.referenceFrame,selection:this.selection,viewport:this,viewportWidth:this.$viewport.width()};this.draw(f,t,e),this.canvas&&pt(this.canvas).remove(),w._data=f,this.canvas=w,this.$viewport.append(pt(w))}refresh(){if(!this.canvas||!this.featureCache)return;const t=this.canvas._data;t.context.clearRect(0,0,this.canvas.width,this.canvas.height);const{features:e,roiFeatures:n}=this.featureCache;this.draw(t,e,n)}draw(t,e,n){if(e&&(t.features=e,this.trackView.track.draw(t)),n&&n.length>0)for(let i of n)t.features=i.features,i.track.draw(t)}containsPosition(t,e){return this.referenceFrame.chr===t&&e>=this.referenceFrame.start&&e<=this.referenceFrame.calculateEnd(this.getWidth())}isLoading(){return this.loading}savePNG(){if(!this.canvas)return;const t=this.canvas._data,e=t?t.pixelTop:0,n=window.devicePixelRatio,i=this.$viewport.width()*n,s=this.$viewport.height()*n,o=-pt(this.canvas).position().left*n,a=(-this.contentTop-e)*n,l=this.canvas.getContext("2d").getImageData(o,a,i,s),h=document.createElement("canvas"),c=h.getContext("2d");h.width=l.width,h.height=l.height,c.putImageData(l,0,0),Ws((this.$trackLabel.text()?this.$trackLabel.text():"image")+".png",h.toDataURL("image/png"))}saveSVG(){let{width:t,height:e}=this.browser.columnContainer.getBoundingClientRect();const n=new Gr({width:t,height:8e3,backdropColor:"white",multiLocusGap:0,viewbox:{x:0,y:0,width:t,height:8e3}}),i={deltaX:32,deltaY:32};this.renderViewportToSVG(n,i),n.setHeight(e);const s=(this.trackView.track.name||this.trackView.track.id).replace(/\W/g,""),o=this.browser.referenceFrameList.indexOf(this.referenceFrame),a=n.get
642SerializedSvg(!0),l=URL.createObjectURL(new Blob([a],{type:"application/octet-stream"}));Ws(`${`${s}_referenceFrame_${o}_guid_${ut.guid()}`}.svg`,l)}renderViewportToSVG(t,{deltaX:e,deltaY:n}){if(this.$zoomInNotice&&this.$zoomInNotice.is(":visible"))return;const{width:i,height:s}=this.$viewport.get(0).getBoundingClientRect(),o=`${(this.trackView.track.name||this.trackView.track.id).replace(/\W/g,"")}_referenceFrame_${this.browser.referenceFrameList.indexOf(this.referenceFrame)}_guid_${ut.guid()}`;this.drawSVGWithContext(t,i,s,o,e,n+this.contentTop,-this.contentTop)}renderSVGContext(t,{deltaX:e,deltaY:n}){if(this.renderViewportToSVG(t,{deltaX:e,deltaY:n}),(!this.$zoomInNotice||!this.$zoomInNotice.is(":visible"))&&this.$trackLabel&&this.browser.trackLabelsVisible===!0){const{x:i,y:s,width:o,height:a}=ut.relativeDOMBBox(this.$viewport.get(0),this.$trackLabel.get(0));this.renderTrackLabelSVG(t,e+i,n+s,o,a)}}renderTrackLabelSVG(t,e,n,i,s){const o=`${(this.trackView.track.name||this.trackView.track.id).replace(/\W/g,"")}_track_label_guid_${ut.guid()}`;
642t.saveWithTranslationAndClipRect(o,e,n,i,s,0),t.fillStyle="white",t.fillRect(0,0,i,s),t.font="12px Arial",t.fillStyle="rgb(68, 68, 68)";const{width:a}=t.measureText(this.$trackLabel.text()),l=.25*(i-a),h=.7*(s-12);t.fillText(this.$trackLabel.text(),l,s-h),t.strokeStyle="rgb(68, 68, 68)",t.strokeRect(0,0,i,s),t.restore()}drawSVGWithContext(t,e,n,i,s,o,a){t.saveWithTranslationAndClipRect(i,s,o,e,n,a);let{start:l,bpPerPixel:h}=this.referenceFrame;const c={context:t,viewport:this,referenceFrame:this.referenceFrame,top:a,pixelTop:a,pixelWidth:e,pixelHeight:n,bpStart:l,bpEnd:l+e*h,bpPerPixel:h,viewportWidth:e,selection:this.selection},u=this.featureCache?this.featureCache.features:void 0,p=this.featureCache?this.featureCache.roiFeatures:void 0;this.draw(c,u,p),t.restore()}get cachedFeatures(){return this.featureCache?this.featureCache.features:[]}clearCache(){this.featureCache=void 0,this.canvas&&(this.canvas._data=void 0)}async getFeatures(t,e,n,i,s){if(this.featureCache&&this.featureCache.containsRange(e,n,i,s))return this.featureCache.features;if(typeof t.getFeatures=="function"){const o=await t.getFeatures(e,n,i,s,this);return this.checkContentHeight(o),o}}needsRepaint(){if(!this.canvas)return!0;const t=this.canvas._data;return!t||this.referenceFrame.start<t.bpStart||this.referenceFrame.end>t.bpEnd||this.referenceFrame.chr!==t.referenceFrame.chr||this.referenceFrame.bpPerPixel!=t.bpPerPixel}needsReload(){if(!this.featureCache)return!0;const{chr:t,bpPerPixel:e}=this.referenceFrame,{bpStart:n,bpEnd:i}=this.repaintDimensions();return!this.featureCache.containsRange(t,n,i,e)}createZoomInNotice(t){const e=pt("<div>",{class:"igv-zoom-in-notice-container"});t.append(e);const n=pt("<div>");return e.append(n),n.text("Zoom in to see features"),e.hide(),e}viewIsReady(){return this.browser&&this.browser.referenceFrameList&&this.referenceFrame}addMouseHandlers(){const t=this.$viewport.get(0);this.addViewportContextMenuHandler(t);const e=i=>{this.enableClick=!0,this.browser.mouseDownOnViewport(i,this),ut.pageCoordinates(i)};t.addEventListener("mousedown",e),t.addEventListener("touchstart",e);const n=i=>{this.browser.dragObject||this.browser.isScrolling?(this.browser.cancelTrackPan(),this.enableClick=!1):(this.browser.cancelTrackPan(),this.browser.endTrackDrag())};t.addEventListener("mouseup",n),t.addEventListener("touchend",n),typeof this.trackView.track.hoverText=="function"&&t.addEventListener("mousemove",(i=>{if(i.buttons===0&&Date.now()-mc>100){mc=Date.now();const s=this.createClickState(i);if(s){const o=this.trackView.track.hoverText(s);o?this.$viewport[0].setAttribute("title",o):this.$viewport[0].removeAttribute("title")}}})),this.addViewportClickHandler(this.$viewport.get(0)),this.trackView.track.name&&this.trackView.track.config.type!=="sequence"&&this.addTrackLabelClickHandler(this.$trackLabel.get(0))}addViewportContextMenuHandler(t){t.addEventListener("contextmenu",(e=>{if(this.browser.dragObject)return!1;const n=this.createClickState(e);if(n===void 0)return!1;e.preventDefault();let i=[];if(typeof this.trackView.track.contextMenuItemList=="function"){const s=this.trackView.track.contextMenuItemList(n);s&&(i=s)}i.length>0&&i.push({label:pt("<HR>")}),i.push({label:"Save Image (PNG)",click:()=>this.savePNG()}),i.push({label:"Save Image (SVG)",click:()=>this.saveSVG()}),this.browser.menuPopup.presentTrackContextMenu(e,i)}))}addViewportClickHandler(t){t.addEventListener("click",(e=>{if(this.enableClick&&this.canvas){if(e.which===3||e.ctrlKey||(pt(".igv-popover").hide(),this.browser.dragObject||this.browser.isScrolling))return;e.preventDefault();const n=ut.translateMouseCoordinates(e,this.$viewport.get(0)).x,i=ut.translateMouseCoordinates(e,this.canvas).x,s=this.referenceFrame,o=Math.floor(s.start+s.toBP(i)),a=Date.now();if(a-gc<this.browser.constants.doubleClickDelay){dn&&(window.clearTimeout(dn),dn=void 0);const l=Math.round(s.start+s.toBP(n));let h;if(this.referenceFrame.chr.toLowerCase()==="all"){const c=this.browser.genome.getChromosomeCoordinate(l).chr;if(this.browser.referenceFrameList.length===1)h=c;else{const u=this.browser.referenceFrameList.map((({locusSearchString:p})=>p));u[this.browser.referenceFrameList.indexOf(this.referenceFrame)]=c,h=u.join(" ")}this.browser.search(h)}else this.browser.zoomWithScaleFactor(.5,l,this.referenceFrame)}else e.shiftKey&&typeof this.trackView.track.shiftClick=="function"?this.trackView.track.shiftClick(o,e):typeof this.trackView.track.popupData=="function"&&(dn=setTimeout((()=>{const l=this.getPopupContent(e);l&&(this.popover&&this.popover.dispose(),this.popover=new qs(this.browser.columnContainer),this.popover.presentContentWithEvent(e,l)),window.clearTimeout(dn),dn=void 0}),this.browser.constants.doubleClickDelay));gc=a}}))}addTrackLabelClickHandler(t){t.addEventListener("click",(e=>{e.stopPropagation();const{track:n}=this.trackView;let i;typeof n.description=="function"?i=n.description():n.description&&(i=`<div>${n.description}</div>`),i&&(this.popover&&this.popover.dispose(),this.popover=new qs(this.browser.columnContainer,n.name||""),this.popover.presentContentWithEvent(e,i))}))}createClickState(t){if(!this.canvas)return;const e=this.referenceFrame,n=ut.translateMouseCoordinates(t,this.$viewport.get(0)),i=ut.translateMouseCoordinates(t,this.canvas),s=e.start+e.toBP(n.x);return{event:t,viewport:this,referenceFrame:e,genomicLocation:s,y:n.y-this.contentTop,canvasX:i.x,canvasY:i.y}}getPopupContent(t){const e=this.createClickState(t);if(e===void 0)return;let n=this.trackView.track;const i=n.popupData(e),s=this.browser.fireEvent("trackclick",[n,i]);let o;return s===void 0||s===!0?i&&i.length>0&&(o=i.map((a=>
642{if(a.name){const l=`<span>${a.name}</span>   ${a.value}`;return`<div title="${a.value}">${l}</div>`}return a==="<hr>"?a:a.html?a.html:`<div title="${a}">${a}</div>`})).join("")):typeof s=="string"&&(o=s),o}}class fm{constructor(t,e,n,i,s,o,a){this.chr=t,this.bpStart=e,this.bpEnd=n,this.bpPerPixel=i,this.features=s,this.roiFeatures=o,this.multiresolution=a}containsRange(t,e,n,i){const s=this.multiresolution?this.bpPerPixel/i:1;return e>=this.bpStart&&n<=this.bpEnd&&t===this.chr&&s>.5&&s<2}overlapsRange(t,e,n){return this.chr===t&&n>=this.bpStart&&e<=this.bpEnd}}function pm(r,t){if(!(r.length<6))return{chr:r[0],start:r[1],end:r[2],chr1:r[8],start1:Number.parseInt(r[9]),end1:Number.parseInt(r[10]),chr2:r[13],start2:Number.parseInt(r[14]),end2:Number.parseInt(r[15]),name:r[3],score:Number(r[4]),value:Number(r[5]),color:r[7]==="."?void 0:r[7]==="0"?"rgb(0,0,0)":r[7]}}const gm=new Set(["transcript","primary_transcript","processed_transcript","mRNA","mrna","lnc_RNA","miRNA","ncRNA","rRNA","scRNA","snRNA","snoRNA","tRNA"]),bc=new Set(["CDS","cds"]),wc=new Set(["start_codon","stop_codon"]),vc=new Set(["5UTR","3UTR","UTR","five_prime_UTR","three_prime_UTR","3'-UTR","5'-UTR"]),yc=new Set(["exon","coding-exon"]),_c=new Set;for(let r of[bc,wc,vc,yc])for(let t of r)_c.add(t);function xc(r){return r.includes("intron")}function mm(r){return bc.has(r)||wc.has(r)}function bm(r){return vc.has(r)}function kc(r){return gm.has(r)||r.endsWith("RNA")||r.endsWith("transcript")}function Cc(r){return _c.has(r)||r.endsWith("RNA")||xc(r)}const wm=new Set(["id","parent","name"]);class No{constructor(t){Object.assign(this,t)}popupData(t){const e=this.geneObject?this.geneObject.popupData():[];if(this.geneObject&&e.push("<hr/>"),this.name&&e.push({name:"Name",value:this.name}),e.push({name:"Type",value:this.type}),e.push({name:"Source",value:this.source}),this.score!==void 0&&e.push({name:"Score",value:this.score}),this.attributeString){const n=fn(this.attributeString,this.delim);for(let[i,s]of n)s!==void 0&&s.length>0&&!wm.has(i.toLowerCase())&&e.push({name:i+":",value:s})}return e.push({name:"Location",value:`${this.chr}:${Ot(this.start+1)}-${Ot(this.end)}`}),e}getAttributeValue(t){if(this.hasOwnProperty(t))return this[t];if(this._attributeCache||(this._attributeCache=new Map),this._attributeCache.has(t))return this._attributeCache.get(t);{const e=fn(this.attributeString,this.delim);let n;for(let[i,s]of e)if(i===t){n=s;break}return this._attributeCache.set(t,n),n}}}class Sc extends No{constructor(t){super(t),this.exons=[],this.parts=[]}addExon(t){this.exons.push(t),this.start=Math.min(this.start,t.start),this.end=Math.max(this.end,t.end)}addPart(t){this.parts.push(t)}assembleParts(){if(this.parts.length===0)return;this.parts.sort((function(n,i){return n.start-i.start}));let t=this.parts[0].start,e=this.parts[0].end;for(let n=1;n<this.parts.length;n++){const i=this.parts[n];xc(i.type)||(i.start<=e?e=Math.max(e,i.end):(this.findExonContaining({start:t,end:e})||this.exons.push({start:t,end:e,psuedo:!0}),t=i.start,e=i.end))}this.findExonContaining({start:t,end:e})||(this.exons.push({start:t,end:e,psuedo:!0}),this.start=Math.min(this.start,t),this.end=Math.max(this.end,e));for(let n of this.parts){const i=n.type;mm(i)?this.addCDS(n):bm(i)&&this.addUTR(n)}}findExonContaining({start:t,end:e}){for(let n of this.exons)if(n.end>=e&&n.start<=t)return n}addCDS(t){let e;const n=this.exons;for(let i of n)if(i.start<=t.start&&i.end>=t.end){e=i;break}e&&(e.cdStart=e.cdStart?Math.min(t.start,e.cdStart):t.start,e.cdEnd=e.cdEnd?Math.max(t.end,e.cdEnd):t.end),this.cdStart=this.cdStart?Math.min(t.start,this.cdStart):t.start,this.cdEnd=this.cdEnd?Math.max(t.end,this.cdEnd):t.end}addUTR(t){let e;const n=this.exons;for(let i=0;i<n.length;i++)if(n[i].start<=t.start&&n[i].end>=t.end){e=n[i];break}e&&(t.start===e.start&&t.end===e.end?e.utr=!0:(t.end<e.end&&(e.cdStart=t.end),t.start>e.start&&(e.cdEnd=t.start)))}finish(){this.assembleParts();var t=this.cdStart,e=this.cdEnd;this.exons.sort((function(n,i){return n.start-i.start})),t&&this.exons.forEach((function(n){(n.end<t||n.start>e)&&(n.utr=!0)}))}popupData(t){const e=super.popupData(t);for(let n of this.exons)if(!n.pseudo&&t>=n.start&&t<n.end&&typeof n.popupData=="function"){e.push("<hr/>");const i=n.popupData(t);for(let s of i)e.push(s)}for(let n of this.parts)if(t>=n.start&&t<n.end&&typeof n.popupData=="function"){e.push("<hr/>");const i=n.popupData(t);for(let s of i)e.push(s)}return e}}function Ac(r,t){const e=t.format;if(r.length<9)return;const n=e==="gff3"?"=":" ";
642return new No({source:Bo(r[1]),type:r[2],chr:r[0],start:parseInt(r[3])-1,end:parseInt(r[4]),score:r[5]==="."?void 0:Number(r[5]),strand:r[6],phase:r[7]==="."?0:parseInt(r[7]),attributeString:r[8],delim:n})}function vm(r,t){const e=Ac(r,t);if(!e)return;const n=fn(e.attributeString,e.delim);for(let[i,s]of n){const o=i.toLowerCase();o==="color"||o==="colour"?e.color=qt.createColorString(s):i==="ID"?e.id=s:i==="Parent"&&(e.parent=s)}return e}function ym(r,t){const e=Ac(r,t);if(!e)return;const n=fn(e.attributeString,e.delim);let i,s;switch(e.type){case"gene":i="gene_id";break;case"transcript":i="transcript_id",s="gene_id";break;default:s="transcript_id"}for(let[o,a]of n){const l=o.toLowerCase();l==="color"||l==="colour"?e.color=qt.createColorString(a):o===i?e.id=a:o===s&&(e.parent=a)}return e}function fn(r,t,e=!1){var n=[];for(let i of r.split(";")){i=i.trim();const s=i.indexOf(t);if(s>0&&s<i.length-1){const o=Ec(Bo(i.substring(0,s).trim(),e));let a=Ec(Bo(i.substring(s+1).trim(),e));n.push([o,a])}}return n}function Ec(r){return r.startsWith('"')&&r.endsWith('"')&&(r=r.substr(1,r.length-2)),r}const Tc=new Map([["%09"," "],["%0A",` 643`],["%0D","\r"],["%25","%"],["%3B",";"],["%3D","="],["%26","&"],["%2C",","]]);function Bo(r,t=!1){if(!r.includes("%"))return r;if(t)return decodeURIComponent(r);let e="";for(let n=0;n<r.length;n++)if(r.charCodeAt(n)===37&&n<r.length-2){const i=r.substring(n,n+3);Tc.has(i)?e+=Tc.get(i):e+=i,n+=2}else e+=r.charAt(n);return e}class Mc{constructor(t){this.message=t}}function Rc(r,t){if(r.length<3)return;t&&t.gffTags;const e=r[0],n=parseInt(r[1]),i=r.length>2?parseInt(r[2]):n+1;if(isNaN(n)||isNaN(i))return new Mc("Unparsable bed record.");const s=new Em({chr:e,start:n,end:i,score:1e3});try{if(r.length>3){if(r[3].indexOf(";")>0&&r[3].indexOf("=")>0){const o=fn(r[3],"=",!0);s.attributes={};for(let a of o)s.attributes[a[0]]=a[1],t.nameField!=null&&a[0]===t.nameField&&(s.name=a[1])}s.name||(s.name=r[3]==="."?"":r[3])}if(r.length>4&&(s.score=r[4]==="."?0:Number(r[4]),isNaN(s.score))||r.length>5&&(s.strand=r[5],s.strand!=="."&&s.strand!=="+"&&s.strand!=="-")||r.length>6&&(s.cdStart=parseInt(r[6]),isNaN(s.cdStart))||r.length>7&&(s.cdEnd=parseInt(r[7]),isNaN(s.cdEnd)))return s;if(r.length>8&&r[8]!=="."&&r[8]!=="0"&&(s.color=qt.createColorString(r[8])),r.length>11){const o=parseInt(r[9]);if(o>1e3)return s;const a=r[10].replace(/,$/,"").split(","),l=r[11].replace(/,$/,"").split(",");if(a.length!==l.length||o!==a.length)return s;const h=[];for(let c=0;c<o;c++){const u=n+parseInt(l[c]),p=u+parseInt(a[c]);h.push({start:u,end:p})}h.length>0&&(rs(h,s.cdStart,s.cdEnd),s.exons=h)}if(t){let o=t.thicknessColumn,a=t.colorColumn;a&&a<r.length&&(s.color=qt.createColorString(r[a])),o&&o<r.length&&(s.thickness=r[o])}}catch{}return s}function _m(r,t){if(!(r.length<=15))return{swScore:Number.parseInt(r[1]),milliDiv:Number.parseInt(r[2]),milliDel:Number.parseInt(r[3]),milliIns:Number.parseInt(r[4]),chr:r[5],start:Number.parseInt(r[6]),end:Number.parseInt(r[7]),strand:r[9],repName:r[10],repClass:r[11],repFamily:r[12],repStart:Number.parseInt(r[13]),repEnd:Number.parseInt(r[14]),repLeft:Number.parseInt(r[15])}}function Lc(r,t){var e=t.shift===void 0?0:1;if(r.length<=9+e)return;const n=parseInt(r[5+e]),i=parseInt(r[6+e]);var s={name:r[0+e],chr:r[1+e],strand:r[2+e],start:parseInt(r[3+e]),end:parseInt(r[4+e]),cdStart:n,cdEnd:i,id:r[0+e]};const o=Fo(parseInt(r[7+e]),r[8+e],r[9+e]);return rs(o,n,i),s.exons=o,s}function Ic(r,t){var e=t.shift===void 0?0:1;if(r.length<=11+e)return;const n=parseInt(r[5+e]),i=parseInt(r[6+e]),s={name:r[11+e],chr:r[1+e],strand:r[2+e],start:parseInt(r[3+e]),end:parseInt(r[4+e]),cdStart:n,cdEnd:i,id:r[0+e]},o=Fo(parseInt(r[7+e]),r[8+e],r[9+e]);return rs(o,n,i),s.exons=o,s}function xm(r,t){var e=t.shift===void 0?0:1;if(r.length<=10+e)return;const n=parseInt(r[6+e]),i=parseInt(r[7+e]);var s={name:r[0+e],id:r[1+e],chr:r[2+e],strand:r[3+e],start:parseInt(r[4+e]),end:parseInt(r[5+e]),cdStart:n,cdEnd:i};const o=Fo(parseInt(r[8+e]),r[9+e],r[10+e]);return rs(o,n,i),s.exons=o,s}function km(r,t){if(r.length<21)return;const e=r[13],n=parseInt(r[15]),i=parseInt(r[16]),s=r[8].charAt(0),o=parseInt(r[17]),a=[],l=r[20].replace(/,$/,"").split(","),h=r[18].replace(/,$/,"").split(",");for(let c=0;c<o;c++){const u=parseInt(l[c]),p=u+parseInt(h[c]);a.push({start:u,end:p})}return new Tm({chr:e,start:n,end:i,strand:s,exons:a,tokens:r})}function Fo(r,t,e){const n=parseInt(r),i=t.replace(/,$/,"").split(","),s=e.replace(/,$/,"").split(","),o=[];for(let a=0;a<n;
vendor: 2,647 bytes, line 643
643a++){const l=parseInt(i[a]),h=parseInt(s[a]);o.push({start:l,end:h})}return o}function rs(r,t,e){for(let n of r){const i=n.end,s=n.start;i<t||s>e?n.utr=!0:(t>=s&&t<=i&&(n.cdStart=t),e>=s&&e<=i&&(n.cdEnd=e))}}function Cm(r,t){var e,n,i,s,o,a,l;if(!(r.length<9))return e=r[0],n=parseInt(r[1]),i=parseInt(r[2]),o=r[3],a=Number(r[4]),s=r[5].trim(),l=Number(r[6]),a===0&&(a=l),{chr:e,start:n,end:i,name:o,score:a,strand:s,signal:l,pValue:Number(r[7]),qValue:Number(r[8])}}function Nc(r,t){if(r.length<=3)return;const e={chr:r[0],start:parseInt(r[1]),end:parseInt(r[2]),value:Number(r[3])};if(t){let n=t.colorColumn;n&&n<r.length&&(e.color=qt.createColorString(r[n]))}return e}function Sm(r,t){const e=t.wig;if(e&&e.format==="fixedStep"){const n=e.index*e.step+e.start,i=n+e.span,s=Number(r[0]);return++e.index,isNaN(s)?null:{chr:e.chrom,start:n,end:i,value:s}}if(e&&e.format==="variableStep"){if(r.length<2)return null;const n=parseInt(r[0],10)-1,i=n+e.span,s=Number(r[1]);return isNaN(s)?null:{chr:e.chrom,start:n,end:i,value:s}}return Nc(r)}function Am(r,t){if(r.length<6)return;const e=["bin","chr","start","end","name","score","strand","refNCBI","refUCSC","observed","molType","class","valid","avHet","avHetSE","func","locType","weight","exceptions","submitterCount","submitters","alleleFreqCount","alleles","alleleNs","alleleFreqs","bitfields"],n={chr:r[1],start:Number.parseInt(r[2]),end:Number.parseInt(r[3]),name:r[4],score:Number.parseInt(r[5])},i=Math.min(r.length,e.length);for(let s=6;s<i;s++)n[e[s]]=r[s];return n}class Em{constructor(t){Object.assign(this,t)}getAttributeValue(t){return this.hasOwnProperty(t)?this[t]:this.attributes?this.attributes[t]:void 0}}class Tm{constructor(t){Object.assign(this,t)}get score(){const t=this.tokens,e=parseInt(t[0]),n=parseInt(t[2]),i=parseInt(t[1]),s=parseInt(t[4]),o=parseInt(t[6]),a=parseInt(t[10]);return Math.floor(1e3*(e+n-i-s-o)/a)}get matches(){return this.tokens[0]}get misMatches(){return this.tokens[1]}get repMatches(){return this.tokens[2]}get nCount(){return this.tokens[3]}get qNumInsert(){return this.tokens[4]}get qBaseInsert(){return this.tokens[5]}get tNumInsert(){return this.tokens[6]}get tBaseInsert(){return this.tokens[7]}popupData(){return[{name:"chr",value:this.chr},{name:"start",value:this.start+1},{name:"end",value:this.end},{name:"strand",value:this.strand},{name:"score",value:this.score},{name:"match",value:this.matches},{name:"mis-match",value:this.misMatches},{name:"rep. match",value:this.repMatches},{name:"N's",value:this.nCount},{name:"Q gap count",value:this.qNumInsert},{name:"Q gap bases",value:this.qBaseInsert},{name:"T gap count",value:this.tNumInsert}
643,{name:"T gap bases",value:this.tBaseInsert}]}}function Mm(r,t){if(!(r.length<7)){var e=r[0],n=r[1],i=parseInt(r[2]),s=parseInt(r[3]),o=parseInt(r[4]),a=parseInt(r[5]),l=r[6],h={chr:e,name:n,junction_left:i,junction_right:s,num_junction_reads:o,num_spanning_frags:a,spanning_frag_coords:[],start:-1,end:-1},c=i,u=s;if(a>0)for(var p=l.split(","),d=0;d<p.length;d++){var w=p[d].split("-"),m=w[0],g=w[1];m<c&&(c=m),g>u&&(u=g),h.spanning_frag_coords.push({left:m,right:g})}return h.start=c,h.end=u,h}}function Rm(r,t){if(r.length<7)return null;const e={chr:r[0],start:parseInt(r[1])-1,end:parseInt(r[2]),"Strongest SNP-risk allele":r[3],"Disease/Phenotype":r[4],"P-value":r[5],"Odds ratio or beta":r[6]};return r.length>6&&(e.PUBMEDID=`<a target = "blank" href = "https://www.ncbi.nlm.nih.gov/pubmed/${r[7]}">${r[7]}</a>`),e}function Lm(r,t){const e=t.customFormat;if(r.length<e.fields.length)return;const n=e.coords||0,i=r[e.chr],s=parseInt(r[e.start])-n,o={chr:i,start:s,end:e.end!==void 0?parseInt(r[e.end]):s+1};return e.fields&&e.fields.forEach((function(a,l){l!==e.chr&&l!==e.start&&l!==e.end&&(o[a]=r[l])})),o}function Im(r,t){const e=t.columnNames;if(!e)throw Error("Sample names are not defined. Missing column headers?");const n=e.length-3,i=r[0],s=parseInt(r[1]),o=parseInt(r[2]),a=r.slice(3).map(Number);return a.length==n?{chr:i,start:s,end:o,values:a}:void 0}class Nm{constructor(t){this.config=t,this.header={},t.nameField&&(this.header.nameField=t.nameField),this.skipRows=0,t.decode?(this.decode=t.decode,this.delimiter=t.delimiter||" "):t.format&&(this.header.format=t.format.toLowerCase(),this.setDecoder(this.header.format)),this.delimiter||(this.delimiter=" ")}async parseHeader(t){let e,n,i=this.header;for(;(n=await t.nextLine())!==void 0;)if(n.startsWith("track")||n.startsWith("#track")){let s=Bm(n);Object.assign(i,s)}else if(!n.startsWith("browser"))if(n.startsWith("#columns")){let s=Fm(n);Object.assign(i,s)}else if(n.startsWith("##gff-version 3"))i.format="gff3";else if(n.startsWith("#gffTags"))i.gffTags=!0;else{if(n.startsWith("fixedStep")||n.startsWith("variableStep"))break;if(n.startsWith("#")){const s=n.split(this.delimiter||" ");s.length>1&&(e=s)}else{this.setDecoder(i.format);const s=n.split(this.delimiter||" ");try{const o=Object.assign({columnNames:e},i);if(this.decode(s,o))break;s.length>1&&(e=s)}catch{s.length>1&&(e=s)}}}if(e){i.columnNames=e;for(let s=0;s<e.length;s++)e[s]==="color"||e[s]==="colour"?i.colorColumn=s:e[s]==="thickness"&&(i.thicknessColumn=s)}return this.header=i,i}async parseFeatures(t){const e=[],n=this.decode,i=this.header.format,s=this.delimiter||" ";let o,a=0,l=0;for(;(o=await t.nextLine())!==void 0;){if(a++,a<=this.skipRows||!o||o.startsWith("track")||o.startsWith("#")||o.startsWith("browser"))continue;if(i==="wig"&&o.startsWith("fixedStep")){this.header.wig=Om(o);continue}if(i==="wig"&&o.startsWith("variableStep")){this.header.wig=Dm(o);continue}const h=o.split(s);if(h.length<1)continue;const c=n(h,this.header);c instanceof Mc?(l++,l>0):c&&e.push(c)}return n===So&&(function(h){if(h.length==0)return;const c=h[0];if(c.score===void 0&&c.name!==void 0){for(let d of h)if(!(typeof(u=d.name)=="number"?u-u==0:typeof u=="string"&&u.trim()!==""&&(Number.isFinite?Number.isFinite(+u):isFinite(+u)))&&d.name!==".")return;for(let d of h)d.score=Number(d.name),delete d.name}var u;const p=h.filter((d=>d.chr1!==d.chr2));for(let d of p){const w=Object.assign({},d);w.dup=!0,h.push(w),d.chr=d.chr1,d.start=d.start1,d.end=d.end1,w.chr=w.chr2,w.start=w.start2,w.end=w.end2}})(e),e}setDecoder(t){switch(t){case"narrowpeak":case"broadpeak":case"regionpeak":case"peaks":this.decode=Cm,this.delimiter=this.config.delimiter||/\s+/;break;case"bedgraph":this.decode=Nc,this.delimiter=/\s+/;break;case"wig":this.decode=Sm,this.delimiter=this.config.delimiter||/\s+/;break;case"gff3":case"gff":this.decode=vm,this.delimiter=" ";break;case"gtf":this.decode=ym,this.delimiter=" ";break;case"fusionjuncspan":this.decode=Mm,this.delimiter=this.config.delimiter||/\s+/;break;case"gtexgwas":this.skipRows=1,this.decode=Rm,this.delimiter=" ";break;case"refflat":this.decode=xm,this.delimiter=this.config.delimiter||/\s+/;break;case"genepred":this.decode=Lc,this.delimiter=this.config.delimiter||/\s+/;break;case"genepredext":this.decode=Ic,this.delimiter=this.config.delimiter||/\s+/;break;case"ensgene":this.decode=Lc,this.header.shift=1,this.delimiter=this.config.delimiter||/\s+/;break;case"refgene":this.decode=Ic,this.delimiter=this.config.delimiter||/\s+/,this.header.shift=1;break;case"bed":this.decode=Rc,this.delimiter=this.config.delimiter||/\s+/;break;case"bedpe":case"hiccups":this.decode=So,this.delimiter=this.config.delimiter||" ";break;case"bedpe-domain":this.decode=Zg,this.headerLine=!0,this.delimiter=this.config.delimiter||" ";break;case"bedpe-loop":this.decode=So,this.delimiter=this.config.delimiter||" ",this.header={colorColumn:7};break;case"interact":this.decode=pm,this.delimiter=this.config.delimiter||/\s+/;break;case"snp":this.decode=Am,this.delimiter=" ";break;case"rmsk":this.decode=_m,this.delimiter=" ";break;case"gcnv":this.decode=Im,this.delimiter=" ";break;default:const e=nc(t);e!==void 0?(this.decode=Lm,this.header.customFormat=e,this.delimiter=e.delimiter||" "):(this.decode=Rc,this.delimiter=this.config.delimiter||/\s+/)}}}function Bm(r){const t={},e=r.split(/(?:")([^"]+)(?:")|([^\s"]+)(?=\s+|$)/g);let n;const i=[];for(let o of e)o&&o.trim().length!==0&&(o.endsWith("=")?n=o:n?(i.push(n+o),n=void 0):i.push(o));for(let o of i){if(!o)return;var s=o.split("=",2);if(s.length===2){const a=s[0].trim(),l=s[1].trim();if(t.hasOwnProperty(a)){let h=t[a];Array.isArray(h)?h.push(l):t[a]=[h,l]}else t[a]=l}}return t.type=="interact"?t.format="interact":t.type==="gcnv"&&(t.format="gcnv"),t}function Fm(r){let t={},e=r.split(/\s+/);return e.length===2&&e[1].split(";").forEach((function(n){let i=n.split("=");i[0]==="color"?t.colorColumn=Number.parseInt(i[1])-1:i[0]==="thickness"&&(t.thicknessColumn=Number.parseInt(i[1])-1)})),t}
643function Om(r){const t=r.split(/\s+/);return{format:"fixedStep",chrom:t[1].split("=")[1],start:parseInt(t[2].split("=")[1],10)-1,step:parseInt(t[3].split("=")[1],10),span:t.length>4?parseInt(t[4].split("=")[1],10):1,index:0}}function Dm(r){const t=r.split(/\s+/);return{format:"variableStep",chrom:t[1].split("=")[1],span:t.length>2?parseInt(t[2].split("=")[1],10):1}}const Sn=class Sn{constructor(t,e){this.browser=e,this.init(t)}init(t){this.config=t,t.displayMode&&(t.displayMode=t.displayMode.toUpperCase());const e=Object.assign({},Sn.defaults);if(this.constructor.defaults)for(let i of Object.keys(this.constructor.defaults))e[i]=this.constructor.defaults[i];for(let i of Object.keys(e))this[i]=t.hasOwnProperty(i)?t[i]:e[i],i!=="color"&&i!=="altColor"||(this[i]=ve(n=this[i])&&n.indexOf(",")>0&&!n.startsWith("rgb(")&&!n.startsWith("rgba(")?`rgb(${n})`:n);var n;t.name||t.label?this.name=t.name||t.label:xr(t.url)?this.name=t.url.name:ve(t.url)&&!t.url.startsWith("data:")&&(this.name=Ii(t.url)),this.url=t.url,this.config.type&&(this.type=this.config.type),this.id=this.config.id===void 0?this.name:this.config.id,this.order=t.order,this.autoscaleGroup=t.autoscaleGroup,this.removable=t.removable===void 0||t.removable,this.minHeight=t.minHeight||Math.min(25,this.height),this.maxHeight=t.maxHeight||Math.max(1e3,this.height),t.onclick&&(this.onclick=t.onclick,t.onclick=void 0),t.description&&(typeof t.description=="function"?this.description=t.description:this.description=()=>t.description),t.hoverTextFields?this.hoverText=Pm.bind(this):typeof this.config.hoverText=="function"&&(this.hoverText=this.config.hoverText)}get name(){return this._name}set name(t){this._name=t,this.trackView&&this.trackView.setTrackLabelName(t)}updateConfig(t){this.init(t)}clearCachedFeatures(){this.trackView&&this.trackView.clearCachedFeatures()}updateViews(){this.trackView&&this.trackView.updateViews()}getState(){const t={};for(let i of Object.keys(this.config))i.startsWith("_")||(e=this.config[i])===void 0||typeof e=="function"||e instanceof File||e instanceof Promise||(t[i]=this.config[i]);var e;for(let i of Object.keys(t)){if(i.startsWith("_"))continue;const s=this[i];s&&(Ki(s)||typeof s=="boolean"||i==="metadata")&&(t[i]=s)}const n=Sn.defaults;if(this.constructor.defaults)for(let i of Object.keys(this.constructor.defaults))n[i]=this.constructor.defaults[i];for(let i of Object.keys(n))this[i]!==void 0&&n[i]!==this[i]&&(t[i]=this[i]);return!this.autoscale&&this.dataRange&&(t.min=this.dataRange.min,t.max=this.dataRange.max),t}get supportsWholeGenome(){return this.config.supportsWholeGenome===!0}hasSamples(){return!1}getGenomeId(){return this.browser.genome?this.browser.genome.id:void 0}setTrackProperties(t){if(this.disposed)return;const e={};let n;for(let i of Object.keys(t))switch(i.toLowerCase()){case"usescore":e.useScore=t[i]===1||t[i]==="1"||t[i]==="on"||t[i]===!0;break;case"visibility":switch(t[i]){case"2":case"3":case"pack":case"full":e.displayMode="EXPANDED";break;case"4":case"squish":e.displayMode="SQUISHED";break;case"1":case"dense":e.displayMode="COLLAPSED"}break;case"color":case"altcolor":e[i]=t[i].startsWith("rgb(")?t[i]:"rgb("+t[i]+")";break;case"featurevisiblitywindow":case"visibilitywindow":e.visibilityWindow=Number.parseInt(t[i]);break;case"maxheightpixels":n=t[i].split(":"),n.length===3&&(e.minHeight=Number.parseInt(n[2]),e.height=Number.parseInt(n[1]),e.maxHeight=Number.parseInt(n[0]));break;case"viewlimits":if(!this.config.autoscale){n=t[i].split(":");let o,a=0;n.length==1?o=Number(n[0]):n.length==2&&(a=Number(n[0]),o=Number(n[1])),e.autoscale=!1,e.dataRange={min:a,max:o},this.viewLimitMin=a,this.viewLimitMax=o}case"name":e[i]=t[i];break;case"url":e.infoURL=t[i];break;case"type":const s=t[i];Bc.has(s)?e[i]=Bc.get(s):e[i]=s;break;case"graphtype":e.graphType=t[i];break;default:e[i]=t[i]}for(let i of Object.keys(e))if(!this.config.hasOwnProperty(i)||i==="name"&&this.config._derivedName){let s=e[i];if(s==="true"&&(s=!0),s==="false"&&(s=!1),this[i]=s,i==="height"&&this.trackView)try{const o=Number.parseInt(s);this.trackView.setTrackHeight(o)}catch{}}}clickedFeatures(t){const e=t.viewport.cachedFeatures;if(!e||!Array.isArray(e)||e.length===0)return[];const n=t.genomicLocation,i=t.referenceFrame.bpPerPixel>.2?3*t.referenceFrame.bpPerPixel:.2;return Xi(e,n-i,n+i)}extractPopupData(t,e){const n=new Set(["row","color","chr","start","end","cdStart","cdEnd","strand","alpha"]),i=[];let s,o;for(let l in t)if(t.hasOwnProperty(l)&&!n.has(l)&&Ki(t[l])){let h=t[l];i.push({name:js(l),value:h}),l==="alleles"?s=t[l]:l==="alleleFreqs"&&(o=t[l])}if(s&&o){s.endsWith(",")&&(s=s.substr(0,s.length-1)),o.endsWith(",")&&(o=o.substr(0,o.length-1));let l=s.split(","),h=o.split(",");if(h.length>1){let c=[];for(let p=0;p<h.length;p++)c.push({a:l[p],af:Number(h[p])});c.sort((function(p,d){return p.af-d.af}));let u=c[c.length-1].a;if(u.length===1)for(let p=c.length-2;p>=0;p--){let d=c[p].a;if(d.length===1){e||(e=this.getGenomeId());const w=Sn.getCravatLink(t.chr,t.start+1,u,d,e);
643w&&(i.push("<hr/>"),i.push({html:w}),i.push("<hr/>"))}}}}if(t.attributes)for(let l of Object.keys(t.attributes))i.push({name:l,value:t.attributes[l]});let a=`${t.chr}:${Ot(t.start+1)}-${Ot(t.end)}`;return t.strand&&(a+=` (${t.strand})`),i.push({name:"Location",value:a}),i}description(){const t=(n,i)=>`<div class="igv-track-label-popup-shim"><b>${n}: </b>${i}</div>`;let e='<div class="igv-track-label-popup">';if(this.url?xr(this.url)?e+=t("Filename",this.url.name):e+=t("URL",this.url):e=this.name,this.config){if(this.config.metadata)for(let n of Object.keys(this.config.metadata))e+=t(n,this.config.metadata[n]);for(let n of Object.keys(this.config)){if(n.startsWith("_"))continue;let i=n.substr(0,1);if(i!==i.toLowerCase()){const s=this.config[n];s&&Ki(s)&&(e+=t(n,s))}}}return e+="</div>",e}getColorForFeature(t){return typeof this.color=="function"?this.color(feature):this.color}dispose(){this.disposed=!0;for(let t of Object.keys(this))this[t]=void 0}static getCravatLink(t,e,n,i,s){if(s==="hg38"||s==="GRCh38")return`<a target="_blank" href="https://run.opencravat.org/result/nocache/variant.html?chrom=${t.startsWith("chr")?t:"chr"+t}&pos=${e}&ref_base=${n}&alt_base=${i}"><b>Cravat ${n}->${i}</b></a>`}};Xr(Sn,"defaults",{height:50,autoHeight:!1,visibilityWindow:void 0,color:void 0,altColor:void 0,supportHiDPI:!0});let Se=Sn;function Pm(r){if(!this.hoverTextFields)return;const t=this.clickedFeatures(r);if(t&&t.length>0){let e="";for(let n=0;n<t.length;n++){if(n===10){e+="; ...";break}if(!t[n])continue;const i=t[n]._f||t[n];e.length>0&&(e+=` 644`),e="";for(let s of this.hoverTextFields)e.length>0&&(e+=` 645`),i.hasOwnProperty(s)?e+=i[s]:typeof i.getAttribute=="function"&&(e+=i.getAttribute(s))}return e}}const Bc=new Map([["wiggle_0","wig"],["bed","bed"],["bigBed","bigBed"],["bigWig","bigWig"]]);class Oo{constructor(t){switch(this.type=t||"seg",this.type){case"mut":this.sampleColumn=3,this.chrColumn=0,this.startColumn=1,this.endColumn=2,this.dataColumn=4;break;case"maf":this.sampleColumn=15,this.chrColumn=4,this.startColumn=5,this.endColumn=6,this.dataColumn=8;break;default:this.sampleColumn=0,this.chrColumn=1,this.startColumn=2,this.endColumn=3}}async parseHeader(t){let e;for(;(e=await t.nextLine())!==void 0;)if(!e.startsWith("#")){const n=e.split(" ");this.header={headings:n};break}return this.header}async parseFeatures(t){const e=[];let n;this.header||(this.header=await this.parseHeader(t)),this.type==="seg"&&(this.dataColumn=this.header.headings.length-1),this.header.headings.length>5&&(n=this.extractExtraColumns(this.header.headings));const i=this.header.headings[this.dataColumn];let s;for(;(s=await t.nextLine())!==void 0;){const o=s.split(" "),a=this.type==="seg"?Number(o[this.dataColumn]):o[this.dataColumn];if(o.length>this.dataColumn){const l=new zm({sample:o[this.sampleColumn],chr:o[this.chrColumn],start:parseInt(o[this.startColumn])-1,end:parseInt(o[this.endColumn]),value:a,valueColumnName:i});if(n){const h=this.extractExtraColumns(o);l.setAttributes({names:n,values:h})}e.push(l)}}return e}extractExtraColumns(t){const e=[];for(let n=0;n<t.length;n++)n!==this.chrColumn&&n!==this.startColumn&&n!==this.endColumn&&n!==this.sampleColumn&&e.push(t[n]);return e}}class zm{constructor({sample:t,chr:e,start:n,end:i,value:s,valueColumnName:o}){this.sample=t,this.chr=e,this.start=n,this.end=i,this.value=s,this.valueColumnName=o}setAttributes({names:t,values:e}){this.attributeNames=t,this.attributeValues=e}getAttribute(t){if(this.attributeNames){const e=this.attributeNames.indexOf(t);if(e>=0)return this.attributeValues[e]}}popupData(t,e){const n=new Set(["chr","start","end","sample","value","row","color","sampleKey","uniqueSampleKey","sampleId","chromosome","uniquePatientKey"]),i=this.chr+":"+Ot(this.start+1)+"-"+Ot(this.end),s=[{name:"Sample",value:this.sample},{name:"Location",value:i},{name:this.valueColumnName?js(this.valueColumnName):"Value",value:this.value}];if(t==="mut"&&e==="hg38"){const o=this.extractCravatLink(e);o&&(s.push("<hr/>"),s.push({html:o}),s.push("<hr/>"))}if(this.attributeNames&&this.attributeNames.length>0)for(let o=0;o<this.attributeNames.length;o++)!n.has(this.attributeNames[o])&this.valueColumnName!==this.attributeNames[o]&&s.push({name:js(this.attributeNames[o]),value:this.attributeValues[o]});return s}extractCravatLink(t){let e,n;if(this.attributeNames&&this.attributeNames.length>0){for(let i=0;i<this.attributeNames.length;i++)if(e||this.attributeNames[i]!=="Reference_Allele"||(e=this.attributeValues[i]),!n&&this.attributeNames[i].startsWith("Tumor_Seq_Allele")&&this.attributeValues[i]!==e&&(n=this.attributeValues[i]),e&&n)return Se.getCravatLink(this.chr,this.start+1,e,n,t)}}}function Hm(r){const t=new Fc;t.chr=r[0],t.pos=parseInt(r[1]),t.names=r[2],t.referenceBases=r[3],t.alternateBases=r[4],t.quality=r[5],t.filter=r[6],t.info={};const e=r[7];if(e)for(let i of e.split(";")){var n=i.split("=");t.info[n[0]]=n[1]}return t.init(),t}class Fc{init(){const t=this.referenceBases,e=this.alternateBases;if(this.info&&(this.info.VT?this.type=this.info.VT:this.info.SVTYPE?this.type="SV":this.info.PERIOD&&(this.t
645ype="STR")),this.type===void 0&&(this.type=(function(n,i){const s=n.length;if(i===void 0)return"UNKNOWN";if(i.trim().length===0||i==="<NON_REF>"||i==="<*>"||i===".")return"NONVARIANT";{const o=i.split(",").map((function(l){return s===1&&l.length===1?"SNP":l==="<NON_REF>"?"NONVARIANT":"OTHER"}));let a=o[0];for(let l of o)if(l!==a)return"MIXED";return a}})(t,e)),this.type==="NONVARIANT"&&(this.heterozygosity=0),this.info.END)this.start=this.pos-1,this.info.CHR2&&this.info.CHR2!==this.chr?this.end=this.start+1:this.end=Number.parseInt(this.info.END);else if(this.type==="NONVARIANT")this.start=this.pos-1,this.end=this.start+t.length;else{const n=e.split(",").filter((i=>i.length>0));this.alleles=[],this.start=void 0,this.end=void 0;for(let i of n)if(this.alleles.push(i),this.type!=="SV"&&Vm(i)){let s=i.length,o=t.length;const a=Math.min(s,o);let l=0;for(;l<a&&t.charCodeAt(l)===i.charCodeAt(l);)l++,s--,o--;for(;s>0&&o>0;){const u=l+s-1,p=l+o-1;if(i.charCodeAt(u)!==t.charCodeAt(p))break;s--,o--}for(;s>0&&o>0;){const u=l,p=l;if(i.charCodeAt(u)!==t.charCodeAt(p))break;l++,s--,o--}const h=this.pos+l-1,c=h+o;this.start=this.start===void 0?h:Math.min(this.start,h),this.end=this.end===void 0?c:Math.max(this.end,c)}this.start===void 0&&(this.start=this.pos-1,this.end=this.pos)}}popupData(t,e){const n=`${Ot(this.pos)}`,i=this.start===this.end?`${Ot(this.start)} | ${Ot(this.start+1)}`:`${Ot(this.start+1)}-${Ot(this.end)}`,s=[{name:"Chr",value:this.chr},{name:"Pos",value:n},{name:"Loc",value:i},{name:"ID",value:this.names?this.names:""},{name:"Ref",value:this.referenceBases},{name:"Alt",value:this.alternateBases.replace("<","<")},{name:"Qual",value:this.quality},{name:"Filter",value:this.filter}];if(this.type==="SNP"){let o=this.referenceBases;if(o.length===1){let a=this.alternateBases.split(",");for(let l of a)if(l.length===1){let h=Se.getCravatLink(this.chr,this.pos,o,l,e);h&&(s.push("<hr/>"),s.push({html:h}))}}}if(this.hasOwnProperty("heterozygosity")&&s.push({name:"Heterozygosity",value:this.heterozygosity}),this.info){s.push({html:'<hr style="border-top: dotted 1px;border-color: #c9c3ba" />'});for(let o of Object.keys(this.info))s.push({name:o,value:ns(decodeURIComponent(this.info[o]))})}return s}getInfo(t){return this.info?this.info[t]:void 0}isRefBlock(){return this.type==="NONVARIANT"}}const Um=new Set(["A","C","T","G"].map((r=>r.charCodeAt(0))));function Vm(r){for(let t=0;t<r.length;t++)if(!Um.has(r.charCodeAt(t)))return!1;return!0}function ns(r,t){return t===void 0&&(t=","),Array.isArray(r)?r.join(t):r}class Oc{construtor(){}async parseHeader(t,e){const n={};n.chrAliasTable=new Map;let i=await t.nextLine();if(!i.startsWith("##fileformat"))throw new Error("Invalid VCF file: missing fileformat line");for(n.version=i.substr(13);(i=await t.nextLine())!==void 0&&i.startsWith("#");){let o;const a={};if(i.startsWith("##")){if(i.startsWith("##INFO")||i.startsWith("##FILTER")||i.startsWith("##FORMAT")){const l=i.indexOf("<"),h=i.lastIndexOf(">");if(!(l>2&&h>0))continue;const c=i.substring(2,l-1);n[c]||(n[c]={});const u=Rp(i.substring(l+1,h-1),",");for(let p of u){var s=p.split("=");s.length>1&&(s[0]==="ID"?o=s[1]:a[s[0]]=s[1])}o&&(n[c][o]=a)}else if(i.startsWith("##contig")&&e){const l=i.indexOf("<ID=");let h=i.indexOf(",",l);h==-1&&(h=i.indexOf(">",l));const c=i.substring(l+4,h),u=e.getChromosomeName(c);n.chrAliasTable.set(u,c)}}else if(i.startsWith("#CHROM")){const l=i.split(" ");if(l.length>8){n.callSets=[];for(let h=9;h<l.length;h++)n.callSets.push({id:h,name:l[h]})}}}return this.header=n,n}async parseFeatures(t){const e=[],n=this.header.callSets,i=8+(n?n.length+1:0);let s;for(;(s=await t.nextLine())!==void 0;)if(s&&!s.startsWith("#")){const o=s.split(" ");if(o.length===i){const a=Hm(o);if(a.header=this.header,e.push(a),o.length>9){const l=qm(o[8].split(":"));a.calls={};for(let h=9;h<o.length;h++){const c=o[h],u=n[h-9],p={callSetName:u.name,info:{}};a.calls[u.id]=p,c.split(":").forEach((function(d,w){w===l.genotypeIndex?(p.genotype=[],d.split(/[\|\/]/).forEach((function(m){p.genotype.push(m==="."?m:parseInt(m))}))):p.info[l.fields[w]]=d}))}}a.info&&a.info.CHR2&&a.info.END&&e.push(jm(a))}}return e}}function qm(r){const t={genotypeIndex:-1,fields:r};for(let e=0;e<r.length;e++)r[e]==="GT"&&(t.genotypeIndex=e);return t}function jm(r){const t=r.info.CHR2,e=Number.parseInt(r.info.END);return{chr:t,start:e-1,end:e,_f:r}}class Wm{constructor(t){if(this.config=t,t.columns){if(t.columns.chromosome===void 0||t.columns.position===void 0||t.columns.value===void 0)throw Error("columns property must define chrCol, posCol, and valueCol");this.posCol=t.columns.position-1,this.chrCol=t.columns.chromosome-1,this.valueCol=t.columns.value-1}else this.posCol=2,this.chrCol=1,this.valueCol=3}async parseHeader(t){const e=await t.nextLine();return this.parseHeaderLine(e)}parseHeaderLine(t){if(this.columns=t.split(/\t/),!this.config.columns)for(let e=0;e<this.columns.length;e++)switch(this.columns[e].toLowerCase()){case"chr":case"chromosome":case"chr_id":this.chrCol=e;break;case"bp":case"pos":case"position":case"chr_pos":this.posCol=e;break;
645case"p":case"pval":case"pvalue":case"p-value":case"p.value":this.valueCol=e}return this.columns}async parseFeatures(t){const e=[],n=t.nextLine();let i;for(this.columns||this.parseHeaderLine(n);(i=t.nextLine())!==void 0;){const s=i.split(/\t/);if(s.length===this.columns.length){const o=s[this.chrCol],a=parseInt(s[this.posCol])-1,l=a+1,h=Number(s[this.valueCol]);e.push(new $m({chr:o,start:a,end:l,value:h,line:i,columns:this.columns}))}}return e}}class $m{constructor({chr:t,start:e,end:n,value:i,line:s,columns:o}){this.chr=t,this.start=e,this.end=n,this.value=i,this.line=s,this.columns=o}popupData(){const t=this.line.split(/\t/);return this.columns.map((function(e,n){return{name:e,value:t[n]}}))}getAttribute(t){const e=this.line.split(/\t/);for(let n=0;n<this.columns.length;n++)if(this.columns[n]===t)return e[n]}}var Gm=new RegExp("([^:]*)\\(([^)]*)\\)"),Zm=new RegExp("([^:]*):([^(]*)\\(([^)]*)\\)");class Qm{constructor(t){const e=t?t.decode:void 0;this.nameField=t?t.nameField:void 0,this.skipRows=0,this.decode=e||Jm,this.delimiter=" "}async parseHeader(t){let e,n;for(;(e=await t.nextLine())&&(e.startsWith("track")||e.startsWith("#")||e.startsWith("browser"));)if(e.startsWith("track")||e.startsWith("#track")){let i=Ym(e);n?Object.assign(n,i):n=i}else if(e.startsWith("#columns")){let i=Km(e);n?Object.assign(n,i):n=i}else e.startsWith("##gff-version 3")&&(this.format="gff3",n||(n={}),n.format="gff3");return this.header=n,n}async parseFeatures(t){const e=[],n=this.decode,i=this.delimiter||" ";let s,o=0;for(;(s=t.nextLine())!==void 0;){if(o++,o<=this.skipRows||s.startsWith("track")||s.startsWith("#")||s.startsWith("browser"))continue;let l=a();if(l.length<1)continue;if(!this.aed){this.aed=Xm(l);continue}const h=n.call(this,l,void 0);h&&e.push(h)}return e;function a(){for(var l,h,c=[],u="",p=!1;s||s==="";){for(l=0;l<s.length;l++)(h=s.charAt(l))===i?p?u+=h:(c.push(u),u=""):h==='"'?l+1<s.length&&s.charAt(l+1)==='"'?(p&&(u+='"'),l++):p=!p:u+=h;if(!p)break;u+=` 646`,s=nextLine()}return c.push(u),c}}}function Dc(r){var t=Zm.exec(r);if(t)return{namespace:t[1],name:t[2],type:t[3]};if(t=Gm.exec(r))return{namespace:"?",name:t[1],type:t[2]};throw new Error("Error parsing the header row of AED file - column not in ns:name(ns:type) format")}function Xm(r){var t,e,n;for(t={columns:[],metadata:{}},e=0;e<r.length;e++)n=Dc(r[e]),t.columns.push(n);return t}function Ym(r){const t={},e=r.split(/(?:")([^"]+)(?:")|([^\s"]+)(?=\s+|$)/g);let n;const i=[];for(let o of e)o&&o.trim().length!==0&&(o.endsWith("=")>0?n=o:n?(i.push(n+o),n=void 0):i.push(o));for(let o of i){if(!o)return;var s=o.split("=",2);if(s.length===2){const a=s[0].trim(),l=s[1].trim();t[a]=l}}return t}function Km(r){let t={},e=r.split(/\s+/);return e.length===2&&e[1].split(";").forEach((function(n){let i=n.split("=");i[0]==="color"?t.colorColumn=Number.parseInt(i[1])-1:i[0]==="thickness"&&(t.thicknessColumn=Number.parseInt(i[1])-1)})),t}function Pc(r,t){var e,n,i=r.columns;this.aed=r,this.allColumns=t,this.chr=null,this.start=null,this.end=null,this.score=1e3,this.strand=".",this.cdStart=null,this.cdEnd=null,this.name=null,this.color=null;for(let o=0;o<t.length;o++)if(e=t[o]){(n=i[o]).type==="aed:Integer"&&(e=parseInt(e));var s=[];if(n.namespace.length>0)for(let a=0;a<n.namespace.length;a++)s.push(n.namespace.charCodeAt(a));n.namespace.trim()==="bio"?n.name==="sequence"?this.chr=e:n.name==="start"?this.start=e:n.name==="end"?this.end=e:n.name==="cdsMin"?this.cdStart=e:n.name==="cdsMax"?this.cdEnd=e:n.name==="strand"&&(this.strand=e):n.namespace==="aed"?n.name==="name"&&(this.name=e):n.namespace==="style"&&n.name==="color"&&(this.color=qt.createColorString(e))}}function Jm(r,t){var e,n,i,s,o,a,l=0,h=this.aed.columns;if(r.length===h.length){for(a=0;a<r.length;a++)s=h[a],(i=r[a])!==""&&l++,s.name==="name"&&s.namespace==="aed"?e=i:s.name==="value"&&s.namespace==="aed"&&(n=i);if(l===2&&e&&n)return o=Dc(e),this.aed.metadata[o.namespace]||(this.aed.metadata[o.namespace]={}),void(this.aed.metadata[o.namespace][o.name]||(this.aed.metadata[o.namespace][o.name]={type:o.type,value:n}));var c=new Pc(this.aed,r);if(c.chr&&(c.start||c.start===0)&&c.end)return c}}Pc.prototype.popupData=function(){for(var r=[],t=this.aed,e=0;e<this.allColumns.length;e++){var n=this.allColumns[e],i=t.columns[e].name;i!=="sequence"&&i!=="color"&&n&&r.push({name:i,value:n})}return r};class Ee{constructor(t,e){this.littleEndian=e===void 0||e,this.position=0,this.view=t,this.length=t.byteLength}available(){return this.length-this.position}remLength(){return this.length-this.position}hasNext(){return this.position<this.length-1}getByte(){var t=this.view.getUint8(this.position,this.littleEndian);return this.position++,t}getShort(){var t=this.view.getInt16(this.position,this.littleEndian);return this.position+=2,t}getUShort(){var t=this.view.getUint16(this.position,this.littleEndian);return this.position+=2,t}getInt(){var t=this.view.getInt32(this.position,this.littleEndian);return this.position+=4,t}
646getUInt(){var t=this.view.getUint32(this.position,this.littleEndian);return this.position+=4,t}getLong(){var t=[];t[0]=this.view.getUint8(this.position),t[1]=this.view.getUint8(this.position+1),t[2]=this.view.getUint8(this.position+2),t[3]=this.view.getUint8(this.position+3),t[4]=this.view.getUint8(this.position+4),t[5]=this.view.getUint8(this.position+5),t[6]=this.view.getUint8(this.position+6),t[7]=this.view.getUint8(this.position+7);var e=0;if(this.littleEndian)for(let n=t.length-1;n>=0;n--)e=256*e+t[n];else for(let n=0;n<t.length;n++)e=256*e+t[n];return this.position+=8,e}getString(t){for(var e,n="";(e=this.view.getUint8(this.position++))!==0&&(n+=String.fromCharCode(e),!t||n.length!==t););return n}getFixedLengthString(t){var e,n,i="";for(e=0;e<t;e++)(n=this.view.getUint8(this.position++))>0&&(i+=String.fromCharCode(n));return i}getFixedLengthTrimmedString(t){var e,n,i="";for(e=0;e<t;e++)(n=this.view.getUint8(this.position++))>32&&(i+=String.fromCharCode(n));return i}getFloat(){var t=this.view.getFloat32(this.position,this.littleEndian);return this.position+=4,t}getDouble(){var t=this.view.getFloat64(this.position,this.littleEndian);return this.position+=8,t}skip(t){return this.position+=t,this.position}getVPointer(){var t=this.position,e=this.view.getUint8(t+1)<<8|this.view.getUint8(t),n=4294967296*(255&this.view.getUint8(t+6))+16777216*(255&this.view.getUint8(t+5))+65536*(255&this.view.getUint8(t+4))+256*(255&this.view.getUint8(t+3))+(255&this.view.getUint8(t+2));return this.position+=8,new t0(n,e)}}class t0{constructor(t,e){this.block=t,this.offset=e}isLessThan(t){return this.block<t.block||this.block===t.block&&this.offset<t.offset}isGreaterThan(t){return this.block>t.block||this.block===t.block&&this.offset>t.offset}isEqualTo(t){return this.block===t.block&&this.offset===t.offset}print(){return this.block+":"+this.offset}}function zc(r,t){if(r.length===0||(r.sort((function(i,s){const o=i.minv.block-s.minv.block;return o!==0?o:i.minv.offset-s.minv.offset})),r.length<=1))return r;t&&(r=r.filter((i=>i.maxv.isGreaterThan(t))));const e=[];let n;for(let i of r)n&&e0(n,i)?i.maxv.isGreaterThan(n.maxv)&&(n.maxv=i.maxv):(e.push(i),n=i);return e}function e0(r,t){return t.minv.block,r.maxv.block,r.maxv.block-r.minv.block<5e6}class r0{constructor(t){this.tabix=!0}parse(t,e){const n=new Ee(new DataView(t)),i=n.getInt();if(i!==21582659)throw Error(i===38359875?"CSI version 2 is not supported. Please enter an issue at https://github.com/igvteam/igv.js":"Not a CSI index");this.indices=[],this.blockMin=Number.MAX_SAFE_INTEGER,this.lastBlockPosition=[],this.sequenceIndexMap={},this.minShift=n.getInt(),this.depth=n.getInt();const s=[];let o=0;if(n.getInt()>=28){n.getInt(),n.getInt(),n.getInt(),n.getInt(),n.getInt(),n.getInt();const h=n.getInt(),c=n.position+h;let u=0;for(;n.position<c;){let p=n.getString();e&&(p=e.getChromosomeName(p)),this.sequenceIndexMap[p]=u,s[u]=p,u++}}const a=this.bin_limit()+1,l=n.getInt();for(let h=0;h<l;h++){const c=[],u=[],p=n.getInt();for(let d=0;d<p;d++){const w=n.getInt();if(u[w]=n.getVPointer(),w>a)n.getInt(),n.getVPointer(),n.getVPointer(),n.getLong(),n.getLong();else{c[w]=[];const m=n.getInt();for(let g=0;g<m;g++){const f=n.getVPointer(),b=n.getVPointer();f&&b&&(f.block<this.blockMin&&(this.blockMin=f.block),b.block>o&&(o=b.block),c[w].push([f,b]))}}}p>0&&(this.indices[h]={binIndex:c,loffset:u})}this.lastBlockPosition=o}get chromosomeNames(){return Object.keys(this.sequenceIndexMap)}chunksForRange(t,e,n){const i=this.indices[t];if(i){const s=this.reg2bins(e,n);if(s.length==0)return[];const o=[];for(let a of s)for(let l=a[0];l<=a[1];l++)if(i.binIndex[l]){const h=i.binIndex[l];for(let c of h){const u=c[0],p=c[1];o.push({minv:u,maxv:p,bin:l})}}return zc(o,i.loffset[s[0]])}return[]}reg2bins(t,e){(t-=1)<1&&(t=1),e>2**34&&(e=2**34),e-=1;let n=0,i=0,s=this.minShift+3*this.depth;const o=[];for(;n<=this.depth;s-=3,i+=1<<3*n,n+=1){const a=i+(t>>s),l=i+(e>>s);o.push([a,l])}return o}bin_limit(){return((1<<3*(this.depth+1))-1)/7}}class Hc{constructor(){}async parse(t,e,n){const i=[];let s=Number.MAX_SAFE_INTEGER,o=0;
646const a=new Ee(new DataView(t)),l=a.getInt(),h={};if(!(l===21578050||e&&l===21578324))throw new Error(indexURL+" is not a "+(e?"tabix":"bai")+" file");{const c=a.getInt();if(e){a.getInt(),a.getInt(),a.getInt(),a.getInt(),a.getInt(),a.getInt(),a.getInt();for(let u=0;u<c;u++){let p=a.getString();n&&(p=n.getChromosomeName(p)),h[p]=u}}for(let u=0;u<c;u++){const p={},d=[],w=a.getInt();for(let g=0;g<w;g++){const f=a.getInt();if(f===37450)a.getInt(),a.getVPointer(),a.getVPointer(),a.getLong(),a.getLong();else{p[f]=[];const b=a.getInt();for(let v=0;v<b;v++){const _=a.getVPointer(),A=a.getVPointer();_&&A&&(_.block<s&&(s=_.block),A.block>o&&(o=A.block),p[f].push([_,A]))}}}const m=a.getInt();for(let g=0;g<m;g++){const f=a.getVPointer();d.push(f)}w>0&&(i[u]={binIndex:p,linearIndex:d})}this.firstBlockPosition=s,this.lastBlockPosition=o,this.indices=i,this.sequenceIndexMap=h,this.tabix=e}}get chromosomeNames(){return Object.keys(this.sequenceIndexMap)}chunksForRange(t,e,n){const i=this.indices[t];if(i){const s=(function(u,p){const d=[];return p>=536870912&&(p=536870912),--p,d.push([0,0]),d.push([1+(u>>26),1+(p>>26)]),d.push([9+(u>>23),9+(p>>23)]),d.push([73+(u>>20),73+(p>>20)]),d.push([585+(u>>17),585+(p>>17)]),d.push([4681+(u>>14),4681+(p>>14)]),d})(e,n),o=[];for(let u of s)for(let p=u[0];p<=u[1];p++)if(i.binIndex[p]){const d=i.binIndex[p];for(let w of d){const m=w[0],g=w[1];o.push({minv:m,maxv:g})}}const a=i.linearIndex.length;let l;const h=Math.min(e>>14,a-1),c=Math.min(n>>14,a-1);for(let u=h;u<=c;u++){const p=i.linearIndex[u];if(p){l=p;break}}return zc(o,l)}return[]}}class n0{constructor(){}async parse(t,e){let n=0;this.chrIndex={},this.lastBlockPosition=[];const i=new Ee(new DataView(t));(function(o){o.getInt(),o.getInt();const a=o.getInt();if(o.getString(),o.getLong(),o.getLong(),o.getString(),o.getInt(),a>=3){let l=o.getInt();for(;l-- >0;)o.getString(),o.getString()}})(i);let s=i.getInt();for(;s-- >0;){let o=i.getString();e&&(o=e.getChromosomeName(o));const a=i.getInt(),l=i.getInt(),h=i.getInt();i.getInt(),i.getInt();let c=i.getLong();const u=[];for(let p=0;p<l;p++){const d=i.getLong();u.push({min:c,max:d}),c=d,d>n&&(n=d)}this.chrIndex[o]={chr:o,blocks:u,longestFeature:h,binWidth:a}}this.lastBlockPosition=n}get chromosomeNames(){return Object.keys(this.chrIndex)}chunksForRange(t,e,n){const i=this.chrIndex[t];if(i){const s=i.blocks,o=i.longestFeature,a=i.binWidth,l=Math.max(e-o,0),h=Math.floor(l/a);if(h>=s.length)return[];{const c=Math.min(Math.floor((n-1)/a),s.length-1),u=s[h].min,p=s[c].max;return p-u===0?[]:[{minv:{block:u,offset:0},maxv:{block:p,offset:0}}]}}}}async function Uc(r,t,e){let n=await Ct.loadArrayBuffer(r,Ft(t)),i=new DataView(n);switch(i.getUint8(0)===31&&i.getUint8(1)===139&&(n=mr(n).buffer,i=new DataView(n)),i.getInt32(0,!0)){case 21578050:return(async function(s,o){const a=new Hc;return await a.parse(s,!1,o),a})(n,e);case 21578324:return(async function(s,o){const a=new Hc;return await a.parse(s,!0,o),a})(n,e);case 21582659:return(async function(s,o){const a=new r0;return a.parse(s,o),a})(n,e);case 1480870228:return(async function(s,o){const a=new n0;return a.parse(s,o),a})(n,e);case 38359875:throw Error("CSI version 2 is not supported.");default:throw Error(`Unrecognized index type: ${r}`)}}function Ye(r){return typeof r=="string"||r instanceof String?new i0(r):new s0(r)}class i0{constructor(t){this.data=t,this.ptr=0}nextLine(){var t=this.ptr,e=this.data.indexOf(` 647`,t),n=this.data;if(e>0)return this.ptr=e+1,e>t&&n.charAt(e-1)==="\r"?n.substring(t,e-1):n.substring(t,e);var i=n.length;return this.ptr=i,t>=i?void 0:n.substring(t)}}class s0{constructor(t){this.data=t,this.length=this.data.length,this.ptr=0}nextLine(){var t,e;if(e="",!(this.ptr>=this.length)){for(var n=this.ptr;n<this.length;n++)if((t=String.fromCharCode(this.data[n]))!=="\r"){if(t===` 648`)break;e+=t}return this.ptr=n+1,e}}}class o0{constructor(t){this.config=t,this.filePtr=0,this.bufferPtr=0,this.buffer}async nextLine(){let t;try{for(;;){const e=this.buffer?this.buffer.length:0;for(;this.bufferPtr<e;){const n=String.fromCharCode(this.buffer[this.bufferPtr++]);if(n!=="\r"){if(n===` 649`)return t;t=t?t+n:n}}if(this.eof)return t;await this.readNextBlock()}}catch{return this.eof=!0,t}}async readNextBlock(){const t=Ft(this.config,{range:{start:this.filePtr,size:26}}),e=Ph(await Ct.loadArrayBuffer(this.config.url,t));if(e===0)this.eof=!0,this.buffer=void 0;else{const n=Ft(this.config,{range:{start:this.filePtr,size:e}}),i=await Ct.loadArrayBuffer(this.config.url,n);i.byteLength<e&&(this.eof=!0),this.buffer=mr(i),this.buffer.byteLength==0&&(this.eof=!0),this.bufferPtr=0,this.filePtr+=i.byteLength}}}const Vc=r=>{const t=ArrayBuffer.isView(r)?r:new Uint8Array(r);return 1+(t[17]<<8|t[16])};class qc{constructor(t){this.config=t,this.cacheBlocks=t.cacheBlocks!=0,this.cache=void 0}async getData(t,e){const n=t.block,i=e.block,s=e.offset===0,o=await this.getInflatedBlocks(n,i,s);if(o.length===1)return o[0];let a=0;for(const c of o)a+=c.byteLength;const l=new Uint8Array(a);let h=0;for(const c of o)l.set(c,h),h+=c.byteLength;return l}async getInflatedBlocks(t,e,n){if(this.cacheBlocks){const i=this.cache;if(i&&i.startBlock<=t&&(i.endBlock>=e||n&&i.nextEndBlock===e)){const s=t-i.startBlock,o=e-i.startBlock;return Do(i.buffer,s,o)}{let s;if(!i||i.startBlock>e||i.endBlock<t)s=await this.loadBLockData(t,e,{skipEnd:n});else{const a=[];if(t<i.startBlock){const h=await this.loadBLockData(t,i.startBlock,{skipEnd:!0});a.push(h)}let l;if(t<=i.startBlock&&e>=i.endBlock)l=i.buffer;else{const h=Math.max(0,t-i.startBlock);let c;if(e>=i.endBlock)c=i.buffer.byteLength;else{const u=jc(i.buffer);for(let p=0;p<u.length-1;p++)if(i.startBlock+u[p]===e){c=u[p+1];break}}l=i.buffer.slice(h,c)}if(a.push(l),e>i.endBlock){const h=await this.loadBLockData(i.endBlock,e,{skipStart:!0,skipEnd:n});a.push(h)}s=(function(h){if(h.length===1)return h[0];let c=0;for(const d of h)c+=d.byteLength;const u=new Uint8Array(c);let p=0;for(const d of h)u.set(new Uint8Array(d),p),p+=d.byteLength;return u.buffer})(a)}let o=e;if(n){const a=jc(s);e=a[a.length-1]}return this.cache={startBlock:t,endBlock:e,nextEndBlock:o,buffer:s},Do(s)}}return Do(await this.loadBLockData(t,e,{skipEnd:n}))}async loadBLockData(t,e,n){const i=this.config,s=n&&n.skipStart;let o=0;if(!(n&&n.skipEnd)){const l=Ft(i,{range:{start:e,size:26}}),h=await Ct.loadArrayBuffer(i.url,l);o=Vc(h)}if(s){const l=Ft(i,{range:{start:t,size:26}}),h=await Ct.loadArrayBuffer(i.url,l);t+=Vc(h)}const a=Ft(i,{range:{start:t,size:e+o-t}});return Ct.loadArrayBuffer(i.url,a)}}function jc(r){const t=r.byteLength;let e=0;const n=[0];for(;e<t;){const i=new Uint8Array(r,e);e+=1+(i[17]<<8|i[16]),e<t&&n.push(e)}return n}function Do(r,t,e){const n=[];let i=t=t||0;const s=r.byteLength-18;for(;i<s;)try{const o=new Uint8Array(r,i,18),a=o[11]<<8|o[10],l=o[17]<<8|o[16],h=12+a+i,c=r.byteLength-h,u=l-a-18;if(c<u||u<=0)break;const p=new Uint8Array(r,h,u),d=fo(p);if(n.push(d),e===i)break;i+=l+1}catch{break}return n}class a0{constructor(t,e){var n;this.config=t||{},this.genome=e,this.indexURL=t.indexURL,this.indexed=t.indexed||this.indexURL!==void 0,this.queryable=this.indexed,xr(this.config.url)?this.filename=this.config.url.name:ir(this.config.url)?(this.indexed=!1,this.dataURI=t.url):(n=Zl(this.config.url),this.filename=t.filename||n.file),this.parser=this.getParser(this.config),this.config.format!=="vcf"||this.config.indexURL}async defaultVisibilityWindow(){if(this.config.indexURL){const t=await this.getIndex();if(t&&t.lastBlockPosition){let e=0;const n=1e4;for(let i of t.chromosomeNames){const s=this.genome.getChromosome(i);s&&(e+=s.bpLength)}return Math.round(e/t.lastBlockPosition*n)}}}async readFeatures(t,e,n){return await this.getIndex()?(this.indexed=!0,this.loadFeaturesWithIndex(t,e,n)):this.dataURI?(this.indexed=!1,this.loadFeaturesFromDataURI()):(this.indexed=!1,this.loadFeaturesNoIndex())}
649async readHeader(){if(this.dataURI)return await this.loadFeaturesFromDataURI(this.dataURI),this.header;if(this.config.indexURL){const t=await this.getIndex();if(!t)throw new Error("Unable to load index: "+this.config.indexURL);let e;if(t.tabix)this._blockLoader=new qc(this.config),e=new o0(this.config);else{const n=Object.values(t.chrIndex).flatMap((s=>s.blocks)).map((s=>s.max)).reduce(((s,o)=>Math.min(s,o)),Number.MAX_SAFE_INTEGER),i=Ft(this.config,{bgz:t.tabix,range:{start:0,size:n}});e=Ye(await Ct.loadString(this.config.url,i))}return this.header=await this.parser.parseHeader(e),this.header}{const t=Ft(this.config),e=await Ct.loadString(this.config.url,t);let n=Ye(e);return this.header=await this.parser.parseHeader(n),n=Ye(e),this.features=await this.parser.parseFeatures(n),this.header}}getParser(t){switch(t.format){case"vcf":return new Oc(t);case"seg":return new Oo("seg");case"mut":return new Oo("mut");case"maf":return new Oo("maf");case"gwas":return new Wm(t);case"aed":return new Qm(t);default:return new Nm(t)}}async loadFeaturesNoIndex(){if(this.features){const t=this.features;return delete this.features,t}{const t=Ft(this.config),e=await Ct.loadString(this.config.url,t);if(!this.header){const i=Ye(e);this.header=await this.parser.parseHeader(i)}const n=Ye(e);return await this.parser.parseFeatures(n)}}async loadFeaturesWithIndex(t,e,n){this.dataURI||this.header||await this.readHeader();const i=this.config,s=this.parser,o=this.index.tabix,a=o?this.index.sequenceIndexMap[t]:t;if(a===void 0)return[];const l=this.genome,h=this.index.chunksForRange(a,e,n);if(h&&h.length!==0){const c=[];for(let u of h){let p;if(o)p=await this._blockLoader.getData(u.minv,u.maxv);else{const g=Ft(i,{range:{start:u.minv.block,size:u.maxv.block-u.minv.block+1}});p=await Ct.loadString(i.url,g)}const d=Ye(u.minv.offset?p.slice(u.minv.offset):p);let w=await s.parseFeatures(d);w=w.filter((g=>g._f===void 0));let m=!1;for(let g=0;g<w.length;g++){const f=w[g];if((l?l.getChromosomeName(f.chr):f.chr)!==t){if(c.length===0)continue;break}if(f.start>n){c.push(f);break}f.end>=e&&f.start<=n&&(m||(m=!0,g>0&&c.push(w[g-1])),c.push(f))}}return c.sort((function(u,p){return u.start-p.start})),c}return[]}async getIndex(){return this.index?this.index:this.config.indexURL?(this.index=await this.loadIndex(),this.index):void 0}async loadIndex(){return Uc(this.config.indexURL,this.config,this.genome)}async loadFeaturesFromDataURI(){if(this.features){const t=this.features;return delete this.features,t}{const t=Vr(this.dataURI);let e=Ye(t);return this.header=await this.parser.parseHeader(e),this.header instanceof String&&this.header.startsWith("##gff-version 3")&&(this.format="gff3"),e=Ye(t),this.features=await this.parser.parseFeatures(e),this.features}}}const l0=ve;class h0{constructor(t){this.config=t}async readFeatures(t,e,n){let i;i=typeof this.config.url=="function"?this.config.url({chr:t,start:e,end:n}):this.config.url.replace("$CHR",t).replace("$START",e).replace("$END",n);let s,o=Object.assign({},this.config);this.config.body!==void 0&&(typeof this.config.body=="function"?o.body=this.config.body({chr:t,start:e,end:n}):o.body=this.config.body.replace("$CHR",t).replace("$START",e).replace("$END",n));const a=await Ct.load(i,o);if(a&&(s=typeof this.config.parser=="function"?this.config.parser(a):l0(a)?JSON.parse(a):a),this.config.mappings){let l=Object.keys(this.config.mappings);for(let h of s)for(let c of l)h[c]=h[this.config.mappings[c]]}return s}}const Wc=function(r,t){this.config=r,this.genome=t,this.expandQueryInterval=!1};Wc.prototype.readFeatures=function(r,t,e){const n=Math.max(0,Math.floor(t));let i=Math.ceil(e);if(this.genome){const o=this.genome.getChromosome(r);o&&i>o.bpLength&&(i=o.bpLength)}const s=this.config.url+"?db="+this.config.db+"&table="+this.config.tableName+"&chr="+r+"&start="+n+"&end="+i;return Ct.loadJson(s,this.config).then((function(o){return o?(o.forEach((function(a){a.hasOwnProperty("exonStarts")&&a.hasOwnProperty("exonEnds")&&a.hasOwnProperty("exonCount")&&a.hasOwnProperty("cdsStart")&&a.hasOwnProperty("cdsEnd")&&(function(l){var h,c,u,p,d,w;h=l.exonCount,c=l.exonStarts.split(","),u=l.exonEnds.split(","),p=[];for(var m=0;m<h;m++){var g={start:d=parseInt(c[m]),end:w=parseInt(u[m])};(l.cdsStart>w||l.cdsEnd<l.cdsStart)&&(g.utr=!0),l.cdsStart>=d&&l.cdsStart<=w&&(g.cdStart=l.cdsStart),l.cdsEnd>=d&&l.cdsEnd<=w&&(g.cdEnd=l.cdsEnd),p.push(g)}l.exons=p})(a)})),o):null}))};const c0=["Name","gene_name","gene","gene_id","alias","locus","name"];class u0{constructor(t){this.format=t.format,this.nameField=t.nameField,this.filterTypes=t.filterTypes===void 0?new Set(["chromosome"]):new Set(t.filterTypes)}combineFeatures(t,e){let n;const i=this.filterTypes;if(t=t.filter((s=>i===void 0||!i.has(s.type))),this.format==="gff3"){const s=this.combineFeaturesById(t);n=this.combineFeaturesByType(s)}else n=this.combineFeaturesByType(t);return n.sort((function(s,o){return s.start-o.start})),this.numberExons(n,e),this.nameFeatures(n),n}combineFeaturesById(t){const e=new Map,n=[];for(let i of t)if(Cc(i.type)||kc(i.type)||!i.id)n.push(i);else{let s=e.get(i.chr);s||(s=new Map,e.set(i.chr,s));let o=s.get(i.id);o?o.push(i):s.set(i.id,[i])}for(let i of e.values())for(let s of i.values())if(s.length>1){const o=s[0];o.exons=[];for(let a of s)o.start=Math.min(o.start,a.start),o.end=Math.max(o.end,a.end),o.exons.push({start:a.start,end:a.end});n.push(o)}else n.push(s[0]);return n}combineFeaturesByType(t){const e=t.filter((u=>u.type==="gene"||u.type.endsWith("_gene"))),n=Object.create(null);for(let u of e)n[u.id]=u;const i=Object.create(null),s=[],o=new Set,a=this.filterTypes;t=t.filter((u=>a===void 0||!a.has(u.type)));for(let u of t)if(u.type,kc(u.type)){const p=u.id;if(p!==void 0){const d=new Sc(u);i[p]=d,s.push(d),o.add(u);const w=n[u.parent];w&&(d.geneObject=w,o.add(w))}}for(let u of t)if(Cc(u.type)){const p=c(u);if(p)for(let d of p){let w=i[d];if(!w&&this.format==="gtf"){const m=Object.assign({},u);m.type="transcript",w=new Sc(m),i[d]=w,s.push(w)}if(w!==void 0){if(l=u.type,yc.has(l))if(p.length>1){const m=new No(u);w.addExon(m)}else w.addExon(u);else w.addPart(u);o.add(u)}}}var l;
649s.forEach((function(u){typeof u.finish=="function"&&u.finish()}));const h=t.filter((u=>!o.has(u)));for(let u of h)s.push(u);return s;function c(u){return u.parent&&u.parent.trim()!==""?u.parent.trim().split(","):null}}numberExons(t,e){for(let n of t)if(n.exons&&(!e||n.end<=e.end&&n.start>e.start))for(let i=0;i<n.exons.length;i++)n.exons[i].number=n.strand==="-"?n.exons.length-i:i+1}nameFeatures(t){for(let e of t)if(e.attributeString){const n=this.format==="gff3"?"=":" ",i=fn(e.attributeString,n),s=new Map(i);if(this.nameField)e.name=s.get(this.nameField);else for(let o of c0)if(s.has(o)){e.name=s.get(o);break}}}}const $c=function(r){this.config=r,this.url=r.url,this.tissueId=r.tissueSiteDetailId,this.indexed=!0,this.datasetId=r.datasetId||"gtex_v8"};$c.prototype.readFeatures=async function(r,t,e){let n=r.startsWith("chr")?r:"chr"+r,i=Math.floor(t),s=Math.ceil(e),o=this.datasetId,a=this.url+"?chromosome="+n+"&start="+i+"&end="+s+"&tissueSiteDetailId="+this.tissueId+"&datasetId="+o;const l=await Ct.loadJson(a,{withCredentials:this.config.withCredentials});return l&&l.singleTissueEqtl?(l.singleTissueEqtl.forEach((function(h){h.chr=h.chromosome,h.position=h.pos,h.start=h.pos-1,h.end=h.start+1,h.snp=h.snpId,h.geneName=h.geneSymbol,h.geneId=h.gencodeId})),l.singleTissueEqtl):void 0};const Gc=function(r){this.config=r,this.url=r.url,this.cellConditionId=r.cellConditionId,this.valueThreshold=r.valueThreshold?r.valueThreshold:.05};Gc.prototype.readFeatures=function(r,t,e){var n=this,i=this.url+"?chromosome="+r+"&start="+t+"&end="+e+"&cell_condition_id="+this.cellConditionId;return new Promise((function(s,o){Ct.loadJson(i,{withCredentials:n.config.withCredentials}).then((function(a){a?(a.eqtls.forEach((function(l){l.chr=l.chromosome,l.start=l.position,l.end=l.position+1})),s(a.eqtls)):s(null)})).catch((function(a){o(a)}))}))};const Zc=Ct.apiKey;function Qc(r){var t=r.url+"/"+r.entity+"/"+r.entityId;return r.headers={"Cache-Control":"no-cache"},Ct.loadJson(t,r)}function is(r){return new Promise((function(t,e){var n=r.results?r.results:[],i=r.url,s=r.body,o=r.decode,a="?",l=r.fields;return Zc&&(i=i+a+"key="+Zc,a="&"),l&&(i=i+a+"fields="+l),(function h(c){c?s.pageToken=c:s.pageToken!==void 0&&delete s.pageToken;var u=JSON.stringify(s);Ct.loadJson(i,{sendData:u,contentType:"application/json",headers:{"Cache-Control":"no-cache"}}).then((function(p){var d,w;p?((w=o?o(p):p)&&w.forEach((function(m){n.push(m)})),(d=p.nextPageToken)?h(d):t(n)):t(n)})).catch((function(p){e(p)}))})()}))}const ss=function(r,t){this.config=r,this.genome=t,this.url=r.url,this.variantSetId=r.variantSetId,this.callSetIds=r.callSetIds,this.includeCalls=r.includeCalls===void 0||r.includeCalls};ss.prototype.readHeader=function(){var r=this;return r.header?Promise.resolve(r.header):(r.header={},r.includeCalls===!1?Promise.resolve(r.header):is({url:r.url+"/callsets/search",fields:"nextPageToken,callSets(id,name)",body:{variantSetIds:Array.isArray(r.variantSetId)?r.variantSetId:[r.variantSetId],pageSize:"10000"},decode:function(t){if(r.callSetIds){var e=[],n=new Set;return r.callSetIds.forEach((function(i){n.add(i)})),t.callSets.forEach((function(i){n.has(i.id)&&e.push(i)})),e}return t.callSets}}).then((function(t){return r.header.callSets=t,r.header})))},ss.prototype.readFeatures=function(r,t,e){const n=this,i=this.genome;return n.readHeader().then((function(s){return new Promise((function(o,a){n.chrAliasTable?o(n.chrAliasTable):n.readMetadata().then((function(l){n.metadata=l.metadata,n.chrAliasTable={},l.referenceBounds&&i&&l.referenceBounds.forEach((function(h){var c=h.referenceName,u=i.getChromosomeName(c);n.chrAliasTable[u]=c})),o(n.chrAliasTable)}))}))})).then((function(s){var o=s.hasOwnProperty(r)?s[r]:r;return is({url:n.url+"/variants/search",fields:n.includeCalls?void 0:"nextPageToken,variants(id,variantSetId,names,referenceName,start,end,referenceBases,alternateBases,quality,filter,info)",body:{variantSetIds:Array.isArray(n.variantSetId)?n.variantSetId:[n.variantSetId],callSetIds:n.callSetIds?n.callSetIds:void 0,referenceName:o,start:t.toString(),end:e.toString(),pageSize:"10000"},decode:function(a){var l,h=[];
649return a.variants.forEach((function(c){l=(function(u){var p,d=new Fc;return d.chr=u.referenceName,d.start=parseInt(u.start),d.end=parseInt(u.end),d.pos=d.start+1,d.names=ns(u.names,"; "),d.referenceBases=u.referenceBases,d.alternateBases=ns(u.alternateBases),d.quality=u.quality,d.filter=ns(u.filter),d.info={},u.info&&Object.keys(u.info).forEach((function(w){var m,g=u.info[w];m=Array.isArray(g)?g.join(","):g,d.info[w]=m})),d.calls={},u.calls&&u.calls.forEach((function(w){p=w.callSetId,d.calls[p]=w})),init(d),d})(c),l.isRefBlock()||h.push(l)})),h}})}))},ss.prototype.readMetadata=function(){return Qc({url:this.url,entity:"variantsets",entityId:this.variantSetId})};class d0{constructor(t){this.config=t}async readFeatures(t,e,n){const i=(await Ct.loadJson(this.config.url+"/variants/?count=50000")).records,s=[];for(let o of i)if(o.coordinates){o.id;const a=o.coordinates;a.chromosome&&s.push(new Xc(a.chromosome,a.start-1,a.stop,o)),a.chromosome2&&s.push(new Xc(a.chromosome2,a.start2-1,a.stop2,o))}return s}}class Xc{constructor(t,e,n,i){if(this.chr=t,this.start=e,this.end=n,this.id=i.id,this.entrezName=i.entrez_name,this.name=i.name,this.actionabilityScore=i.civic_actionability_score,i.coordinates.reference_bases&&(this.refBases=i.coordinates.reference_bases),i.coordinates.variant_bases&&(this.altBases=i.coordinates.variant_bases),i.variant_types&&(this.variant_types=i.variant_types),this.locationString=this.chr+":"+Ot(this.start+1)+"-"+Ot(this.end),this.actionabilityScore!==void 0){let s;if(this.actionabilityScore<=10)s=.2;else{const o=Math.min(30,this.actionabilityScore);s=.2+.8*Math.log10((o-10)/2)}this.alpha=s}}popupData(){const t=n("CIViC","https://civicdb.org/links/variants/"+this.id);this.refBases!==this.altBases&&this.refBases&&this.refBases.length===1&&this.altBases&&this.altBases.length;const e=[t];if(e.push({name:"Entrez",value:n(this.entrezName,"https://ghr.nlm.nih.gov/gene/"+this.entrezName)}),e.push({name:"Name",value:this.name}),this.variant_types&&this.variant_types.length>0){const i=this.variant_types.length===1?"Type":"Types";let s;for(let o of this.variant_types)s?s+=", "+o.display_name:s=o.display_name;e.push({name:i,value:s})}return e.push({name:"Actionability",value:this.actionabilityScore}),e.push({name:"Location",value:this.locationString}),e;function n(i,s){return"<a target='_blank' href='"+s+"'>"+i+"</a>"}}}class Po{constructor(t,e){if(this.config=t,this.genome=e,this.format=t.format?t.format.toUpperCase():"BAM",this.format!=="BAM"&&this.format!=="VCF")throw Error(`htsget format ${t.format} is not supported`)}async readHeaderData(){const t=`${zo(this.config)}?class=header&format=${this.format}`,e=await Ct.loadJson(t,Ft(this.config));return await this.loadUrls(e.htsget.urls)}async readData(t,e,n){const i=`${zo(this.config)}?format=${this.format}&referenceName=${t}&start=${Math.floor(e)}&end=${Math.ceil(n)}`,s=await Ct.loadJson(i,Ft(this.config));return this.loadUrls(s.htsget.urls)}async loadUrls(t){const e=[];for(let n of t)if(n.url.startsWith("data:"))e.push(Promise.resolve(f0(n.url)));else{const i=Ft(this.config||{});n.headers&&(i.headers=Object.assign(i.headers||{},n.headers)),e.push(Ct.loadArrayBuffer(n.url,i))}return(function(n){let i=0;for(let a of n)i+=a.byteLength;let s=0;const o=new Uint8Array(i);for(let a of n){const l=new Uint8Array(a);o.set(l,s),s+=l.length}return o})(await Promise.all(e))}static async inferFormat(t){try{const e=zo(t),n=`${e}${e.includes("?")?"&":"?"}class=header`,i=await Ct.loadJson(n,Ft(t));if(i.htsget){const s=i.htsget.format;if(s!=="BAM"&&s!=="VCF")throw Error(`htsget format ${s} is not supported`);t.format=s.toLowerCase(),t.sourceType="htsget",t.name||(t.name=await xo(t.url))}}catch{}}}function zo(r){if(r.url&&r.endpoint&&r.id)return r.url+r.endpoint+r.id;if(r.endpoint&&r.id)return r.endpoint+r.id;if(r.url)return r.url.startsWith("htsget://")?r.url.replace("htsget://","https://"):r.url;throw Error("Must specify either 'url', or 'endpoint' and 'id")}function f0(r){const t=r.split(","),e=t[0].split(":")[1];let n=t[1];n=e.indexOf("base64")>=0?atob(n):decodeURI(n);const i=new Uint8Array(n.length);for(var s=0;s<n.length;s++)i[s]=n.charCodeAt(s);return i}class p0 extends Po{constructor(t,e){super(t,e),this.parser=new Oc}
649async readHeader(){if(!this.header){const t=Ye(await this.readHeaderData());this.header=await this.parser.parseHeader(t,this.genome),this.chrAliasTable=this.header.chrAliasTable}return this.header}async readFeatures(t,e,n){if(this.config.format&&this.config.format.toUpperCase()!=="VCF")throw Error(`htsget format ${this.config.format} is not supported`);this.chrAliasTable||await this.readHeader();let i=this.chrAliasTable.has(t)?this.chrAliasTable.get(t):t;const s=Ye(await this.readData(i,e,n));return this.parser.parseFeatures(s)}}function Yc(r,t){t=t||Number.MAX_SAFE_INTEGER;const e=[];r.sort((function(n,i){return n.start-i.start})),e.push(-1e3);for(let n of r){let i=0;const s=Math.min(e.length,t);for(i=0;i<s;i++)if(n.start>=e[i]){n.row=i,e[i]=n.end;break}n.row=i,e[i]=n.end}}function Ho(r,t,e){const n=e||1e4,i=l=>{const h=Object.assign({},l);return h.chr="all",h.start=t.getGenomeCoordinate(l.chr,l.start),h.end=t.getGenomeCoordinate(l.chr,l.end),h._f=l,h.exons&&delete h.exons,h},s=new Set(t.wgChromosomeNames),o=[];let a=0;for(let l of t.wgChromosomeNames){if(Array.isArray(r)){const c={};for(let u of r){const p=t.getChromosomeName(u.chr);c.hasOwnProperty(p)||(c[p]=[]),c[p].push(u)}r=c}const h=r[l];if(h)for(let c of h){let u=t.getChromosomeName(c.chr);if(s.has(u))if(o.length<n)o.push(i(c));else{const p=n/(a+1);Math.random()<p&&(o[Math.floor(Math.random()*(n-1))]=i(c))}a++}}return o.sort((function(l,h){return l.start-h.start})),o}function Kc(r,t){if(t=t||1e3,r==null||r.length===0)return;const e={},n=[];for(let i of r){const s=i.chr;let o=e[s];o||(o=[],e[s]=o,n.push(s)),o.push(i)}for(let i of n)Yc(e[i],t)}class Jc{constructor(t,e){this.config=t||{},this.genome=e,this.sourceType=t.sourceType===void 0?"file":t.sourceType,this.maxWGCount=t.maxWGCount||1e4;const n=new Set(["bigwig","bw","bigbed","bb","biginteract","biggenepred","bignarrowpeak","tdf"]);this.queryable=t.indexURL||t.queryable===!0,t.reader?(this.reader=t.reader,this.queryable=t.queryable!==!1):t.sourceType==="ga4gh"?(this.reader=new ss(t,e),this.queryable=!0):t.sourceType==="immvar"?(this.reader=new Gc(t),this.queryable=!0):t.type==="eqtl"&&t.sourceType==="gtex-ws"?(this.reader=new $c(t),this.queryable=!0):t.sourceType==="htsget"?(this.reader=new p0(t,e),this.queryable=!0):t.sourceType==="ucscservice"?(this.reader=new Wc(t.source),this.queryable=!0):t.sourceType==="custom"?(this.reader=new h0(t.source),this.queryable=t.source.queryable!==!1):t.sourceType==="civic-ws"?(this.reader=new d0(t),this.queryable=!1):(this.reader=new a0(t,e),t.queryable!==void 0?this.queryable=t.queryable:(n.has(t.format)||this.reader.indexed)&&(this.queryable=!0)),this.searchable=t.searchable===!0||t.searchableFields||t.searchable!==!1&&!this.queryable}async defaultVisibilityWindow(){if(this.reader&&typeof this.reader.defaultVisibilityWindow=="function")return this.reader.defaultVisibilityWindow()}async trackType(){const t=await this.getHeader();return t?t.type:void 0}async getHeader(){if(!this.header)if(this.reader&&typeof this.reader.readHeader=="function"){const t=await this.reader.readHeader();t?(this.header=t,t.format&&(this.config.format=t.format)):this.header={}}else this.header={};return this.header}async getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:s}){const o=this.genome,a=o?o.getChromosomeName(t):t,l=a.toLowerCase()==="all";return(l&&!this.wgFeatures&&this.supportsWholeGenome()||this.config.disableCache||!this.featureCache||!this.featureCache.containsRange(new $r(a,e,n)))&&await this.loadFeatures(a,e,n,s),l?(this.wgFeatures||(this.supportsWholeGenome()?this.wgFeatures=Ho(this.featureCache.getAllFeatures(),this.genome,this.maxWGCount):this.wgFeatures=[]),this.wgFeatures):this.featureCache.queryFeatures(a,e,n)}supportsWholeGenome(){return!this.queryable}getAllFeatures(){return this.queryable||!this.featureCache?[]:this.featureCache.getAllFeatures()}async loadFeatures(t,e,n,i){const s=this.reader;let o=e,a=n;if((!i||i<=0)&&this.config.expandQuery!==!1){const c=this.genome?this.genome.getChromosome(t):void 0;o=0,a=Math.max(c?c.bpLength:Number.MAX_SAFE_INTEGER,n)}else if(i>n-e&&this.config.expandQuery!==!1){const c=Math.min(4.1*(n-e),i);o=Math.max(0,(e+n)/2-c),a=e+c}let l=await s.readFeatures(t,o,a);this.queryable===void 0&&(this.queryable=s.indexed);const h=this.queryable?new $r(t,o,a):void 0;l?(this.config.assembleGFF===!1||this.config.format!=="gtf"&&this.config.format!=="gff3"&&this.config.format!=="gff"||(l=new u0(this.config).combineFeatures(l,h)),this.config.format!=="wig"&&this.config.type!=="junctions"&&Kc(l,this.config.maxRows||Number.MAX_SAFE_INTEGER),this.featureCache=new Jn(l,this.genome,h),this.searchable&&this.genome.addFeaturesToDB(l,this.config)):this.featureCache=new Jn([],h)}}class tu{constructor(t,e,n){this.path=t.url,this.bufferSize=n||512e3,this.range={start:-1,size:-1},this.config=t}async dataViewForRange(t,e,n=0){try{if(!(this.data&&this.range.start<=t.start&&this.range.start+this.range.size>=t.start+t.size)){let o;o=t.size?Math.max(this.bufferSize,t.size):this.bufferSize,this.contentLength&&(o=Math.min(o,this.contentLength-t.start));const a={start:t.start,size:o},l=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:a}));this.data=l,this.range=a}const i=this.data.byteLength,s=t.start-this.range.start;return e?new Uint8Array(this.data,s,i-s):new DataView(this.data,s,i-s)}catch(i){if(n===0&&i.message&&i.message.startsWith("416")){try{return this.contentLength=await Ct.getContentLength(this.path,Ft(this.config)),this.dataViewForRange(t,e,++n)}catch{}throw i}}}}let eu=512e3;class g0{constructor(t,e){this.path=t.url,this.format=t.format||"bigwig",this.genome=e,this.rpTreeCache={},this.config=t,this.loader=ir(this.path)?new C0(this.path):Ct}async readWGFeatures(t,e){await this.loadHeader();const n=this.chromTree.idToChrom.length-1,i=this.chromTree.idToChrom[0],s=this.chromTree.idToChrom[n];return this.readFeatures(i,0,s,Number.MAX_VALUE,t,e)}async readFeatures(t,e,n,i,s,o){await this.loadHeader();const a=this.chromTree.chromToID[t],l=this.chromTree.chromToID[n];if(a===void 0||l===void 0)return[];let h,c;
649if(this.type==="bigwig"){const d=await this.getZoomHeaders();let w=s?(function(m,g){let f;for(let b=0;b<g.length;b++){const v=g[b];if(v.reductionLevel<m){f=v;break}}return f})(s,d):void 0;w?(h=w.indexOffset,c=k0):(h=this.header.fullIndexOffset,c=_0)}else h=this.header.fullIndexOffset,c=x0.call(this);const u=await this.loadRPTree(h),p=await u.findLeafItemsOverlapping(a,e,l,i);if(p&&p.length!==0){let d=Number.MAX_VALUE,w=0;for(let b of p)d=Math.min(d,b.dataOffset),w=Math.max(w,b.dataOffset+b.dataSize);const m=w-d,g=await this.loader.loadArrayBuffer(this.config.url,Ft(this.config,{range:{start:d,size:m}})),f=[];for(let b of p){const v=new Uint8Array(g,b.dataOffset-d,b.dataSize);let _;_=this.header.uncompressBuffSize>0?uo(v):v,c.call(this,new DataView(_.buffer),a,e,l,i,f,this.chromTree.idToChrom,o)}return f.sort((function(b,v){return b.start-v.start})),f}return[]}async getZoomHeaders(){return this.zoomLevelHeaders||await this.loadHeader(),this.zoomLevelHeaders}async loadHeader(){if(this.header)return this.header;{let t,e=await this.loader.loadArrayBuffer(this.path,Ft(this.config,{range:{start:0,size:64}}));this.littleEndian=!0;let n=new Ee(new DataView(e)),i=n.getUInt();if(i===2291137574)this.type="bigwig";else if(i===2273964779)this.type="bigbed";else{this.littleEndian=!1,n.littleEndian=!1,n.position=0;let l=n.getUInt();l===654085990?this.type="bigwig":l===3958540679&&(this.type="bigbed")}t={bwVersion:n.getUShort(),nZoomLevels:n.getUShort(),chromTreeOffset:n.getLong(),fullDataOffset:n.getLong(),fullIndexOffset:n.getLong(),fieldCount:n.getUShort(),definedFieldCount:n.getUShort(),autoSqlOffset:n.getLong(),totalSummaryOffset:n.getLong(),uncompressBuffSize:n.getInt(),extensionOffset:n.getLong()};const s=64;let o={start:s,size:t.fullDataOffset-s+5};e=await this.loader.loadArrayBuffer(this.path,Ft(this.config,{range:o}));const a=t.nZoomLevels;n=new Ee(new DataView(e)),this.zoomLevelHeaders=[],this.firstZoomDataOffset=Number.MAX_SAFE_INTEGER;for(let l=1;l<=a;l++){const h=a-l,c=new m0(h,n);this.firstZoomDataOffset=Math.min(c.dataOffset,this.firstZoomDataOffset),this.zoomLevelHeaders[h]=c}if(t.autoSqlOffset>0){n.position=t.autoSqlOffset-s;const l=n.getString();l&&(this.autoSql=(function(h){let c;const u=[];let p=!1;const d=h.trim().split(/\s*[\r\n]+\s*/g);for(let w of d)if(w.startsWith("table"))c=w.split(/\s+/)[1].trim();else if(w.startsWith("("))p=!0;else if(!w.startsWith(")")){if(p&&w.length>0){const m=w.indexOf(";"),g=w.substr(0,m).split(/\s+/),f=w.substr(m+1).replace(/"/g,"").trim();u.push({type:g[0],name:g[1],description:f})}}return{table:c,fields:u}})(l))}if(t.totalSummaryOffset>0&&(n.position=t.totalSummaryOffset-s,this.totalSummary=new v0(n)),!(t.chromTreeOffset>0))throw"BigWig chromosome tree offset <= 0";return n.position=t.chromTreeOffset-s,this.chromTree=new w0(n,s,this.genome),n.position=t.fullDataOffset-s,t.dataCount=n.getInt(),this.setDefaultVisibilityWindow(t),this.header=t,this.header}}async loadRPTree(t){let e=this.rpTreeCache[t];return e||(e=new b0(t,this.config,this.littleEndian,this.loader),await e.load(),this.rpTreeCache[t]=e,e)}async getType(){return await this.loadHeader(),this.type}async getTrackType(){return await this.loadHeader(),this.type==="bigwig"?"wig":this.autoSql&&this.autoSql.table==="chromatinInteract"?"interact":"annotation"}setDefaultVisibilityWindow(t){if(this.type==="bigwig")this.visibilityWindow=-1;else{let e=this.genome?this.genome.getGenomeLength():3088286401;this.visibilityWindow=t.dataCount<1e3?-1:e/t.dataCount*1e3}}}class m0{constructor(t,e){this.index=t,this.reductionLevel=e.getInt(),this.reserved=e.getInt(),this.dataOffset=e.getLong(),this.indexOffset=e.getLong()}}class b0{constructor(t,e,n,i){this.config=e,this.loader=i,this.fileOffset=t,this.path=e.url,this.littleEndian=n}async load(){const t=this.fileOffset+48,e=ir(this.path)?this.loader:new tu(this.config,eu);return this.rootNode=await this.readNode(t,e),this}async readNode(t,e){let n=await e.dataViewForRange({start:t,size:4},!1),i=new Ee(n,this.littleEndian);const s=i.getByte()===1;i.getByte();const o=i.getUShort();let a={start:t+=4,size:o*(s?32:24)};n=await e.dataViewForRange(a,!1);const l=new Array(o);if(i=new Ee(n),s){for(let h=0;h<o;h++){let c={isLeaf:!0,startChrom:i.getInt(),startBase:i.getInt(),endChrom:i.getInt(),endBase:i.getInt(),dataOffset:i.getL
649ong(),dataSize:i.getLong()};l[h]=c}return new ru(l)}for(let h=0;h<o;h++){let c={isLeaf:!1,startChrom:i.getInt(),startBase:i.getInt(),endChrom:i.getInt(),endBase:i.getInt(),childOffset:i.getLong()};l[h]=c}return new ru(l)}async findLeafItemsOverlapping(t,e,n,i){let s=this;return new Promise((function(o,a){let l=[],h=new Set,c=ir(s.path)?s.loader:new tu(s.config,eu);h.add(0),(function u(p,d){nu(p,t,e,n,i)&&p.items.forEach((function(w){nu(w,t,e,n,i)&&(w.isLeaf?l.push(w):w.childNode?u(w.childNode):(h.add(w.childOffset),s.readNode(w.childOffset,c).then((function(m){w.childNode=m,u(m,w.childOffset)})).catch(a)))})),d!==void 0&&h.delete(d),h.size===0&&o(l)})(s.rootNode,0)}))}}class ru{constructor(t){this.items=t;let e,n,i=Number.MAX_SAFE_INTEGER,s=0,o=Number.MAX_SAFE_INTEGER,a=0;for(e=0;e<t.length;e++)n=t[e],i=Math.min(i,n.startChrom),s=Math.max(s,n.endChrom),o=Math.min(o,n.startBase),a=Math.max(a,n.endBase);this.startChrom=i,this.endChrom=s,this.startBase=o,this.endBase=a}}class w0{constructor(t,e,n){let i=t.getInt(),s=t.getInt(),o=t.getInt(),a=t.getInt(),l=t.getLong(),h=t.getLong(),c={},u=[];this.header={magic:i,blockSize:s,keySize:o,valSize:a,itemCount:l,reserved:h},this.chromToID=c,this.idToChrom=u,(function p(d,w){w>=0&&(d.position=w);let m=d.getByte();d.getByte();let g,f,b,v,_,A,S=d.getUShort();if(m===1)for(g=0;g<S;g++)f=d.getFixedLengthTrimmedString(o),b=d.getInt(),d.getInt(),n&&(f=n.getChromosomeName(f)),c[f]=b,u[b]=f;else for(g=0;g<S;g++)f=d.getFixedLengthTrimmedString(o),v=d.getLong(),_=v-e,A=d.position,p(d,_),d.position=A})(t,-1)}}function nu(r,t,e,n,i){return r?(n>r.startChrom||n===r.startChrom&&i>=r.startBase)&&(t<r.endChrom||t===r.endChrom&&e<=r.endBase):!1}class v0{constructor(t){t?(this.basesCovered=t.getLong(),this.minVal=t.getDouble(),this.maxVal=t.getDouble(),this.sumData=t.getDouble(),this.sumSquares=t.getDouble(),y0.call(this)):(this.basesCovered=0,this.minVal=0,this.maxVal=0,this.sumData=0,this.sumSquares=0,this.mean=0,this.stddev=0)}}function y0(){let r=this.basesCovered;if(r>0){this.mean=this.sumData/r,this.stddev=Math.sqrt(this.sumSquares/(r-1));let t=this.minVal<0?this.mean-2*this.stddev:0,e=this.maxVal>0?this.mean+2*this.stddev:0;this.defaultRange={min:t,max:e}}}function _0(r,t,e,n,i,s,o){const a=new Ee(r),l=a.getInt(),h=a.getInt();let c=h,u=a.getInt();const p=a.getInt(),d=a.getInt(),w=a.getByte();a.getByte();let m=a.getUShort();if(l>=t&&l<=n){let g=0;for(;m-- >0;){let f;switch(w){case 1:c=a.getInt(),u=a.getInt(),f=a.getFloat();break;case 2:c=a.getInt(),f=a.getFloat(),u=c+d;break;case 3:f=a.getFloat(),c=h+g*p,u=c+d,g++}if(!(l<t||l===t&&u<e)){if(l>n||l===n&&c>=i)break;if(Number.isFinite(f)){const b=o[l];s.push({chr:b,start:c,end:u,value:f})}}}}}function x0(){const r=(function(t,e,n,i){if(i==="biginteract"||n&&n.table==="chromatinInteract"||n.table==="interact")return function(s,o){return s.chr1=o[5],s.start1=Number.parseInt(o[6]),s.end1=Number.parseInt(o[7]),s.chr2=o[10],s.start2=Number.parseInt(o[11]),s.end2=Number.parseInt(o[12]),s.name=o[0],s.score=Number(o[1]),s.value=Number(o[2]),s.color=o[4]==="."?void 0:o[4]==="0"?"rgb(0,0,0)":o[4],s};{const s=t-3;return function(o,a){if(s>0&&(o.name=a[0]),s>1&&(o.score=Number(a[1])),s>2&&(o.strand=a[2]),s>3&&(o.cdStart=parseInt(a[3])),s>4&&(o.cdEnd=parseInt(a[4])),s>5&&a[5]!=="."&&a[5]!=="0"&&a[5]!=="-1"){const l=qt.createColorString(a[5]);o.color=l.startsWith("rgb")?l:void 0}if(s>8){const l=parseInt(a[6]),h=a[7].split(","),c=a[8].split(","),u=[];for(let p=0;p<l;p++){const d=o.start+parseInt(c[p]),w=d+parseInt(h[p]);u.push({start:d,end:w})}(function(p,d,w){for(let m of p){const g=m.end,f=m.start;g<d||f>w?m.utr=!0:(d>=f&&d<=g&&(m.cdStart=d),w>=f&&w<=g&&(m.cdEnd=w))}})(u,o.cdStart,o.cdEnd),o.exons=u}if(n){for(let l=t;l<e;l++)if(l<n.fields.length){const h=n.fields[l].name,c=a[l-3];o[h]=c}}}}})(this.header.definedFieldCount,this.header.fieldCount,this.autoSql,this.format);return function(t,e,n,i,s,o,a){const l=new Ee(t);for(;l.remLength()>=13;){const h=l.getInt(),c=a[h],u=l.getInt(),p=l.getInt(),d=l.getString();if(!(h<e||h===e&&p<n)){if(h>i||h===i&&u>=s)break;if(p>0){const w={chr:c,start:u,end:p};o.push(w);const m=d.split(" ");r(w,m)}}}}}function k0(r,t,e,n,i,s,o,a){const l=new Ee(r);for(;l.remLength()>=32;){const h=l.getInt(),c=o[h],u=l.getInt(),p=l.getInt(),d=l.getInt(),w=l.getFloat(),m=l.getFloat(),g=l.getFloat();let f;switch(l.getFloat(),a){case"min":f=w;break;case"max":f=m;break;default:f=d===0?0:g/d}if(!(h<t||h===t&&p<e)){if(h>n||h===n&&u>=i)break;Number.isFinite(f)&&s.push({chr:c,start:u,end:p,value:f})}}}class C0{constructor(t){this.data=Vr(t).buffer}loadArrayBuffer(t,e){const n=e.range;return n?this.data.slice(n.start,n.start+n.size):this.data}async dataViewForRange(t,e){const n=Math.min(this.data.byteLength-t.start,t.size);return e?new Uint8Array(this.data,t.start,n):new DataView(this.data,t.start,n)}}class iu{constructor(t,e){this.reader=new g0(t,e),this.genome=e,this.format=t.format||"bigwig",this.wgValues={},this.queryable=!0}async getFeatures({chr:t,start:e,end:n,bpPerPixel:i,windowFunction:s}){const o=this.reader.type==="bigwig",a=t.toLowerCase()==="all"?o?await this.getWGValues(s):[]:await this.reader.readFeatures(t,e,t,n,i,s);return o||Yc(a),a}async getHeader(){return this.reader.loadHeader()}getDefaultRange(){return this.reader.totalSummary!==void 0?this.reader.totalSummary.defaultRange:void 0}async defaultVisibilityWindow(){return this.reader.defaultVisibilityWindow}async getWGValues(t){const e=this.genome;if(this.wgValues[t])return this.wgValues[t];{const n=e.getGenomeLength()/1e3,i=await this.reader.readWGFeatures(n,t);let s=[];for(let o of i){const a=o.chr,l=e.getCumulativeOffset(a),h=Object.assign({},o);h.chr="all",h.start=l+o.start,h.end=l+o.end,s.push(h)}return this.wgValues[t]=s,s}}supportsWholeGenome(){return this.reader.type==="bigwig"}async trackType(){return this.reader.getTrackType()}}class S0{constructor(t,e){this.config=t,this.genome=e,this.path=t.url,this.groupCache={},this.datasetCache={}}
649async readHeader(){if(this.magic!==void 0)return this;let t=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:0,size:64e3}})),e=new Ee(new DataView(t));if(this.magic=e.getInt(),this.version=e.getInt(),this.indexPos=e.getLong(),this.indexSize=e.getInt(),e.getInt(),this.version>=2){let s=e.getInt();for(this.windowFunctions=[];s-- >0;)this.windowFunctions.push(e.getString())}this.trackType=e.getString(),this.trackLine=e.getString();let n=e.getInt();for(this.trackNames=[];n-- >0;)this.trackNames.push(e.getString());this.genomeID=e.getString(),this.flags=e.getInt(),this.compressed=!!(1&this.flags),t=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:this.indexPos,size:this.indexSize}})),e=new Ee(new DataView(t)),this.datasetIndex={};let i=e.getInt();for(;i-- >0;){const s=e.getString(),o=e.getLong(),a=e.getInt();this.datasetIndex[s]={position:o,size:a}}for(this.groupIndex={},i=e.getInt();i-- >0;){const s=e.getString(),o=e.getLong(),a=e.getInt();this.groupIndex[s]={position:o,size:a}}return this}async readDataset(t,e,n){const i=t+"_"+e+"_"+n;if(this.datasetCache[i])return this.datasetCache[i];{await this.readHeader();const s=this.version<2?"":"/"+e,o=t.toLowerCase()==="all"||n===void 0?"0":n.toString();let a;a=e==="raw"?"/"+t+"/raw":"/"+t+"/z"+o+s;const l=this.datasetIndex[a];if(l===void 0)return;const h=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:l.position,size:l.size}}));if(!h)return;const c=new Ee(new DataView(h));let u=c.getInt();const p={};for(;u-- >0;)p[c.getString()]=c.getString();const d=c.getString(),w=c.getFloat();let m=c.getInt();const g=[];for(;m-- >0;)g.push({position:c.getLong(),size:c.getInt()});const f={name:a,attributes:p,dataType:d,tileWidth:w,tiles:g};return this.datasetCache[i]=f,f}}async readRootGroup(){const t=this.genome,e=this.groupCache["/"];if(e)return e;{const n=await this.readGroup("/"),i=n.chromosomes,s=n.maxZoom;s&&(this.maxZoom=Number(s));const o=n.totalCount;o&&(n.totalCount=Number(o));const a={};return i&&i.split(",").forEach((function(l){const h=t.getChromosomeName(l);a[h]=l})),this.chrAliasTable=a,this.groupCache["/"]=n,n}}async readGroup(t){const e=this.groupCache[t];if(e)return e;{await this.readHeader();const n=this.groupIndex[t];if(n===void 0)return;const i=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:n.position,size:n.size}}));if(!i)return;const s=new Ee(new DataView(i)),o={name:t};let a=s.getInt();for(;a-- >0;){const l=s.getString(),h=s.getString();o[l]=h}return this.groupCache[t]=o,o}}async readTiles(t,e){if(t.sort((function(h,c){return h.position-c.position})),(t=t.filter((function(h){return h.size>0}))).length===0)return Promise.resolve([]);const n=t[0],i=t[t.length-1],s=n.position,o=i.position+i.size-s,a=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:s,size:o}})),l=[];for(let h of t){const c=h.position-s,u=h.size;if(u>0){let p;this.compressed?p=uo(a.slice(c,c+u)).buffer:p=a.slice(c,c+u);const d=new Ee(new DataView(p)),w=d.getString();let m;switch(w){case"fixedStep":m=su(d,e);break;case"variableStep":m=ou(d,e);break;case"bed":case"bedWithName":m=au(d,e,w);break;default:throw"Unknown tile type: "+w}l.push(m)}}return l}async readTile(t,e){let n=await Ct.loadArrayBuffer(this.path,Ft(this.config,{range:{start:t.position,size:t.size}}));this.compressed&&(n=uo(n).buffer);const i=new Ee(new DataView(n)),s=i.getString();switch(s){case"fixedStep":return su(i,e);case"variableStep":return ou(i,e);case"bed":case"bedWithName":return au(i,e,s);default:throw"Unknown tile type: "+s}}}function su(r,t){const e=r.getInt(),n=r.getInt(),i=r.getFloat(),s=[];let o=t;for(;o-- >0;){let a=e;const l=[];for(;a-- >0;)l.push(r.getFloat());s.push(l)}return{type:"fixedStep",start:n,span:i,data:s,nTracks:t,nPositions:e}}function ou(r,t){const e=r.getInt(),n=r.getFloat(),i=r.getInt(),s=[];let o=i;for(;o-- >0;)s.push(r.getInt());r.getInt();const a=[];let l=t;for(;l-- >0;){o=i;const h=[];for(;o-- >0;)h.push(r.getFloat());a.push(h)}return{type:"variableStep",tileStart:e,span:n,start:s,data:a,nTracks:t,nPositions:i}}function au(r,t,e){const n=r.getInt();let i=n;const s=[];for(;i-- >0;)s.push(r.getInt());i=n;const o=[];for(;i-- >0;)o.push(r.getInt());r.getInt();const a=[];let l=t;for(;l-- >0;){let h=n;const c=[];for(;h-- >0;)c.push(r.getFloat());a.push(c)}if(e==="bedWithName"){i=n;const h=[];for(;i-- >0;)h.push(r.getString())}return{type:e,start:s,end:o,data:a,nTracks:t,nPositions:n}}class lu{constructor(t,e){this.genome=e,this.windowFunction=t.window
649Function||"mean",this.reader=new S0(t,e),this.queryable=!0}async getFeatures({chr:t,start:e,end:n,bpPerPixel:i}){if(t.toLowerCase()==="all"){const s=[],o=this.genome;if(this.genome.wgChromosomeNames)for(let a of o.wgChromosomeNames){const l=o.getChromosome(a).bpLength;i=l/1e3;const h=await this._getFeatures(a,0,l,i);if(h)for(let c of h){const u=Object.assign({},c);u.chr="all",u.start=o.getGenomeCoordinate(c.chr,c.start),u.end=o.getGenomeCoordinate(c.chr,c.end),u._f=c,s.push(u)}}return s}return this._getFeatures(t,e,n,i)}async _getFeatures(t,e,n,i){const s=new $r(t,e,n),o=this.genome;if(!this.rootGroup&&(this.rootGroup=await this.reader.readRootGroup(),!this.normalizationFactor)){const f=this.rootGroup.totalCount;f&&(this.normalizationFactor=1e6/f)}s.bpPerPixel=i;const a=(function(f,b,v){var _=v.getChromosome(f).bpLength;return Math.ceil(Math.log(Math.max(0,_/(700*b)))/M0)})(t,i,o);let l=this.reader.chrAliasTable[t],h=this.reader.maxZoom;l===void 0&&(l=t),h===void 0&&(h=-1);const c=a>h?"raw":this.windowFunction,u=await this.reader.readDataset(l,c,a);if(u==null)return[];const p=u.tileWidth,d=Math.floor(e/p),w=Math.floor(n/p),m=await this.reader.readTiles(u.tiles.slice(d,w+1),1),g=[];for(let f of m)switch(f.type){case"bed":A0(f,t,e,n,i,g);break;case"variableStep":E0(f,t,e,n,i,g);break;case"fixedStep":T0(f,t,e,n,i,g);break;default:throw"Unknown tile type: "+f.type}return g.sort((function(f,b){return f.start-b.start})),g}get supportsWholeGenome(){return!0}}function A0(r,t,e,n,i,s){const o=r.nPositions,a=r.start,l=r.end,h=r.data[0];for(let c=0;c<o;c++){const u=a[c],p=l[c];if(!(p<e)){if(u>n)break;s.push({chr:t,start:u,end:p,value:h[c]})}}}function E0(r,t,e,n,i,s){const o=r.nPositions,a=r.start,l=r.span,h=r.data[0];for(let c=0;c<o;c++){const u=a[c],p=u+l;if(!(p<e)){if(u>n)break;s.push({chr:t,start:u,end:p,value:h[c]})}}}function T0(r,t,e,n,i,s){const o=r.nPositions;let a=r.start;const l=r.span,h=r.data[0];for(let c=0;c<o;c++){const u=a+l;if(a>n)break;u>=e&&(Number.isNaN(h[c])||s.push({chr:t,start:a,end:u,value:h[c]})),a=u}}var M0=Math.log(2);class R0{constructor(t,e){this.config=t,this.genome=e,this.queryable=!1,this.searchable=t.searchable!==!1,this.updateFeatures(t.features)}updateFeatures(t){Kc(t=(function(e,n){if(n)for(let i of e)i.chr=n.getChromosomeName(i.chr);return e})(t,this.genome)),this.config.mappings&&(function(e,n){let i=Object.keys(n);e.forEach((function(s){i.forEach((function(o){s[o]=s[n[o]]}))}))})(t,this.config.mappings),this.featureCache=new Jn(t,this.genome),(this.searchable||this.config.searchableFields)&&this.genome.addFeaturesToDB(t,this.config)}async getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:s}){const o=this.genome,a=o?o.getChromosomeName(t):t;return a.toLowerCase()==="all"?Ho(this.featureCache.getAllFeatures(),this.genome,this.maxWGCount):this.featureCache.queryFeatures(a,e,n)}getAllFeatures(){return this.featureCache.getAllFeatures()}supportsWholeGenome(){return!0}}const L0=new Set(["bigwig","bw","bigbed","bb","biginteract","biggenepred","bignarrowpeak"]);function He(r,t){const e=r.format?r.format.toLowerCase():void 0;return r.features?new R0(r,t):L0.has(e)?new iu(r,t):e==="tdf"?new lu(r,t):new Jc(r,t)}const Uo=(function(r,t){const{r:e,g:n,b:i}=Xh[r];return`rgba(${e},${n},${i},${t})`})("nickel",2/16),hu=Uo;class Vo{constructor(t,e){if(this.url=t.url,t.name?this.name=t.name:t.url&&xr(t.url)?this.name=t.url.name:t.url&&ve(t.url)&&!t.url.startsWith("data:")&&(this.name=Ii(t.url)),this.isUserDefined=t.isUserDefined,t.features)this.featureSource=new I0(t.features,e);else{if(t.format)t.format=t.format.toLowerCase();else{const n=Ii(t.url);t.format=Ao(n)}this.featureSource=t.featureSource||He(t,e)}this.isUserDefined===!0?(this.color=t.color||hu,this.headerColor="rgba(155,185,129)"):(this.color=t.color||Uo,this.headerColor="rgb(190,190,190)")}async getFeatures(t,e,n){return this.featureSource.getFeatures({chr:t,start:e,end:n})}async getAllFeatures(){return typeof this.featureSource.getAllFeatures=="function"?await this.featureSource.getAllFeatures():{}}addFeature(t){this.isUserDefined&&this.featureSource.addFeature(t)}
649removeFeature(t){this.isUserDefined&&this.featureSource.removeFeature(t)}toJSON(){if(this.url)return{name:this.name,color:this.color,url:this.url,isUserDefined:this.isUserDefined};{const t=this.featureSource.getAllFeatures(),e=[];for(let n of Object.keys(t))for(let i of t[n])e.push(i);return{name:this.name,color:this.color,features:e,isUserDefined:this.isUserDefined}}}dispose(){for(let t of Object.keys(this))this[t]=void 0}}function cu(r,t,e,n){let i=Math.round((r-e)/n),s=Math.round((t-e)/n)-i;return s<3&&(s=3,i-=1),{x:i,width:s}}class I0{constructor(t,e){this.featureMap={},this.genome=e;for(let n of t){const i=e?e.getChromosomeName(n.chr):n.chr;let s=this.featureMap[i];s||(s=[],this.featureMap[i]=s),s.push(n)}for(let n of Object.keys(this.featureMap))this.featureMap[n].sort(((i,s)=>i.start-s.start))}getFeatures({chr:t,start:e,end:n}){if(t.toLowerCase()==="all")return Ho(this.featureMap,this.genome);{const i=this.featureMap[t];return i?i.filter((s=>s.end>e&&s.start<n)):[]}}getAllFeatures(){return this.featureMap}supportsWholeGenome(){return!0}addFeature(t){let e=this.featureMap[t.chr];e||(e=[],this.featureMap[t.chr]=e),e.push(t),e.sort(((n,i)=>n.start-i.start))}removeFeature({chr:t,start:e,end:n}){if(this.featureMap[t]){const i=`${t}-${e}-${n}`;this.featureMap[t]=this.featureMap[t].filter((s=>i!==`${s.chr}-${s.start}-${s.end}`))}}}class N0{constructor(t,e,n,i){this.rulerViewport=t,this.rulerSweeper=ut.div({class:"igv-ruler-sweeper"}),e.appendChild(this.rulerSweeper),this.browser=n,this.referenceFrame=i,this.isMouseHandlers=void 0,this.addBrowserObserver()}addBrowserObserver(){this.boundObserverHandler=(()=>{this.referenceFrame&&(be.isWholeGenomeView(this.referenceFrame.chr)?this.removeMouseHandlers():this.addMouseHandlers())}).bind(this),this.browser.on("locuschange",this.boundObserverHandler)}removeBrowserObserver(){this.browser.off("locuschange",this.boundObserverHandler)}addMouseHandlers(){if(this.isMouseHandlers===!0)return;let t,e,n,i,s,o;this.boundContentMouseDownHandler=function(a){t=!0,e=!0;const{x:l}=ut.translateMouseCoordinates(a,this.rulerViewport.contentDiv);i=n=l,s=1,this.rulerSweeper.style.display="block",this.rulerSweeper.style.backgroundColor=a.shift
649Key===!0?hu:"rgba(68, 134, 247, 0.25)",this.rulerSweeper.style.left=`${i}px`,this.rulerSweeper.style.width=`${s}px`}.bind(this),this.rulerViewport.contentDiv.addEventListener("mousedown",this.boundContentMouseDownHandler),this.boundDocumentMouseMoveHandler=function(a){let l;if(t&&e){const{x:h}=ut.translateMouseCoordinates(a,this.rulerViewport.contentDiv);l=Math.max(Math.min(h,this.rulerViewport.contentDiv.clientWidth),0),o=l-n,s=Math.abs(o),this.rulerSweeper.style.width=`${s}px`,o<0&&(i=n+o,this.rulerSweeper.style.left=`${i}px`)}}.bind(this),document.addEventListener("mousemove",this.boundDocumentMouseMoveHandler),this.boundDocumentMouseUpHandler=function(a){let l;t===!0&&e===!0&&(t=e=void 0,this.rulerSweeper.style.display="none",s>1)&&(l={start:Math.floor(this.referenceFrame.calculateEnd(i)),end:Math.floor(this.referenceFrame.calculateEnd(i+s))},a.shiftKey===!0?this.browser.roiManager.updateUserDefinedROISet(Object.assign({chr:this.referenceFrame.chr},l)):(Kh(this.browser.genome.getChromosome(this.referenceFrame.chr).bpLength,l,this.browser.minimumBases()),(function(h,c,u){h.start=Math.round(c.start),h.end=Math.round(c.end),h.bpPerPixel=(h.end-h.start)/u})(this.referenceFrame,l,this.rulerViewport.contentDiv.clientWidth),this.browser.updateViews(this.referenceFrame)))}.bind(this),document.addEventListener("mouseup",this.boundDocumentMouseUpHandler),this.isMouseHandlers=!0}removeMouseHandlers(){this.rulerViewport.contentDiv.removeEventListener("mousedown",this.boundContentMouseDownHandler),document.removeEventListener("mousemove",this.boundDocumentMouseMoveHandler),document.removeEventListener("mouseup",this.boundDocumentMouseUpHandler),this.isMouseHandlers=!1}dispose(){this.removeBrowserObserver(),this.removeMouseHandlers(),this.rulerSweeper.remove()}}class pn{constructor(t){this.paired=!0,this.firstAlignment=t,this.chr=t.chr,this.readName=t.readName,t.start<t.mate.position?(this.start=t.start,this.scStart=t.scStart,this.connectingStart=t.start+t.lengthOnRef,this.connectingEnd=t.mate.position):(this.start=t.mate.position,this.scStart=this.start,this.connectingStart=t.mate.position,this.connectingEnd=t.start),this.end=Math.max(t.mate.position,t.start+t.lengthOnRef),this.lengthOnRef=this.end-this.start;let e=Math.max(this.end,t.scStart+t.scLengthOnRef);this.scLengthOnRef=e-this.scStart}setSecondAlignment(t){this.secondAlignment=t;const e=this.firstAlignment;t.start>e.start?this.connectingEnd=t.start:this.connectingStart=t.start+t.lengthOnRef,this.start=Math.min(e.start,t.start),this.end=Math.max(e.start+e.lengthOnRef,t.start+t.lengthOnRef),this.lengthOnRef=this.end-this.start,this.scStart=Math.min(e.scStart,t.scStart);const n=Math.max(e.scStart+e.scLengthOnRef,t.scStart+t.scLengthOnRef);this.scLengthOnRef=n-this.scStart}containsLocation(t,e){const n=e?this.scStart:this.start,i=e?this.scLengthOnRef:this.lengthOnRef;return t>=n&&t<=n+i}alignmentContaining(t,e){return this.firstAlignment.containsLocation(t,e)?this.firstAlignment:this.secondAlignment&&this.secondAlignment.containsLocation(t,e)?this.secondAlignment:void 0}popupData(t){let e=this.firstAlignment.popupData(t);return this.secondAlignment&&(e.push("-------------------------------"),e=e.concat(this.secondAlignment.popupData(t))),e}isPaired(){return!0}isMateMapped(){return!0}isProperPair(){return this.firstAlignment.isProperPair()}get fragmentLength(){return Math.abs(this.firstAlignment.fragmentLength)}firstOfPairStrand(){return this.firstAlignment.isFirstOfPair()?this.firstAlignment.strand:this.secondAlignment&&this.secondAlignment.isFirstOfPair()?this.secondAlignment.strand:this.firstAlignment.mate.strand}hasTag(t){return this.firstAlignment.hasTag(t)||this.secondAlignment&&this.secondAlignment.hasTag(t)}}class B0{constructor(){this.alignments=[],this.score=void 0}findAlignment(t){const e=(i,s)=>s>=i.start&&s<i.start+i.lengthOnRef;let n;for(let i=0;i<this.alignments.length;i++){const s=this.alignments[i];if(t>=s.start&&t<s.start+s.lengthOnRef){s.paired?s.firstAlignment&&e(s.firstAlignment,t)?n=s.firstAlignment:s.secondAlignment&&e(s.secondAlignment,t)&&(n=s.secondAlignment):n=s;break}}return n}getSortValue({position:t,option:e,tag:n},i){e||(e="BASE");const s=this.findAlignment(t);if(s===void 0)return Number.MAX_VALUE;switch(e){case"NUCLEOTIDE":case"BASE":return(function(o,a,l){let h;const c=Math.floor(l)-a.start;if(c<a.sequence.length&&(h=a.sequence.charAt(c)),!h)return 0;const u=o.readBaseAt(l),p=o.readBaseQualityAt(l),d=a.coverageMap,w=Math.floor(l-d.bpStart),m=d.coverage[w];let g=0;if(o.insertions)for(let f of o.insertions)f.start===l&&(g=-m.ins);if(u)h=h.toUpperCase(),u==="N"&&g===0?g=2:h!==u&&u!=="="||g!==0?(u==="X"||h!==u)&&(g-=m["pos"+u]+m["neg"+u]+p/1e3):g=4-p/1e3;else{const f=m.del;f>0?g-=f:g===0&&(g=1)}return g})(s,i,t);case"STRAND":return s.strand?1:-1;case"START":return s.start;case"TAG":return s.tags()[n];case"READ_NAME":return s.readName;case"INSERT_SIZE":return-Math.abs(s.fragmentLength);case"GAP_SIZE":return-s.gapSizeAt(t);case"MATE_CHR":return s.mate;case"MQ":return s.mq===void 0?Number.MAX_VALUE:-s.mq;case"ALIGNED_READ_LENGTH":return-s.lengthOnRef;default:return Number.MAX_VALUE}}}function os(r){return r.isPaired()&&r.mate&&r.isMateMapped()&&r.chr===r.mate.chr&&(r.isFirstOfPair()||r.isSecondOfPair())&&!(r.isSecondary()||r.isSupplementary())}function uu(r){const t=[];for(let e of r)for(let n of e.alignments)n instanceof pn?(n.firstAlignment&&t.push(n.firstAlignment),n.secondAlignment&&t.push(n.secondAlignment)):t.push(n);return t}function as(r,t,e,n){if(r){if(r.length===0)return[];{r.sort((function(c,u){return n?c.scStart-u.scStart:c.start-u.start}));const i=[];let s,o=0,a=0;const l=new Set,h=()=>{s=new B0,i.push(s),o=0,a=0,l.clear()};for(h();r.length>0;)if(a>=0&&a<r.length){const c=r[a];l.add(c),s.alignments.push(c),o=n?c.scStart+c.scLengthOnRef+2:c.start+c.lengthOnRef+2,a=F0(r,(u=>(n?u.scStart:u.start)>o),a)}else r=r.filter((c=>!l.has(c))),h();return i}}}function F0(r,t,e){let n=e-1,i=r.length;for(;1+n<i;){const s=n+(i-n>>1);t(r[s])?i=s:n=s}return i}class Er{constructor(t,e,n,{samplingWindowSize:i,samplingDepth:s,pairsSupported:o,alleleFreqThreshold:a}){this.chr=t,this.start=Math.floor(e),this.end=Math.ceil(n),this.length=n-e,this.alleleFreqThreshold=a===void 0?.2:a,this.coverageMap=new O0(t,e,n,this.alleleFreqThreshold),this.alignments=[],this.downsampledIntervals=[],this.samplingWindowSize=i===void 0?100:i,this.samplingDepth=s===void 0?1e3:s,this.pairsSupported=o===void 0||o,this.paired=!1,this.pairsCache={},this.downsampledReads=new Set,this.currentBucket=new du(this.start,this.start+this.samplingWindowSize,this),this.filter=function(l){return l.isMapped()&&!l.isFailsVendorQualityCheck()}}push(t){this.filter(t)!==!1&&(this.coverageMap.incCounts(t),this.pairsSupported&&this.downsampledReads.has(t.readName)||(t.start>=this.currentBucket.end&&(this.finishBucket(),this.currentBucket=new du(t.start,t.start+this.samplingWindowSize,this)),this.currentBucket.addAlignment(t)))}
649forEach(t){this.alignments.forEach(t)}finish(){this.currentBucket!==void 0&&this.finishBucket(),this.alignments.sort((function(t,e){return t.start-e.start})),this.pairsCache=void 0,this.downsampledReads=void 0}contains(t,e,n){return this.chr===t&&this.start<=e&&this.end>=n}hasDownsampledIntervals(){return this.downsampledIntervals&&this.downsampledIntervals.length>0}finishBucket(){this.alignments=this.alignments.concat(this.currentBucket.alignments),this.currentBucket.downsampledCount>0&&this.downsampledIntervals.push(new D0(this.currentBucket.start,this.currentBucket.end,this.currentBucket.downsampledCount)),this.paired=this.paired||this.currentBucket.paired}setViewAsPairs(t){let e;e=t?(function(n){const i={},s=[];for(let o of n)for(let a of o.alignments)if(os(a)){let l=i[a.readName];l?(l.setSecondAlignment(a),i[a.readName]=void 0):(l=new pn(a),i[a.readName]=l,s.push(l))}else s.push(a);return s})(this.packedAlignmentRows):uu(this.packedAlignmentRows),this.packedAlignmentRows=as(e,this.start,this.end)}setShowSoftClips(t){const e=this.allAlignments();this.packedAlignmentRows=as(e,this.start,this.end,t)}repack(t,e){const n=this.allAlignments();this.packedAlignmentRows=as(n,this.start,this.end,e)}allAlignments(){const t=[];for(let e of this.packedAlignmentRows)for(let n of e.alignments)t.push(n);return t}getMax(t,e){return this.coverageMap.getMax(t,e)}sortRows(t){const e=[],n=[];for(let i of this.packedAlignmentRows)i.findAlignment(t.position)!==void 0?e.push(i):n.push(i);e.sort(((i,s)=>{const o=t.direction,a=i.getSortValue(t,this),l=s.getSortValue(t,this);if(l===void 0&&l!==void 0)return 1;if(a!==void 0&&l===void 0)return-1;const h=a>l?1:a<l?-1:0;return o===!0?h:-h}));for(let i of n)e.push(i);this.packedAlignmentRows=e}}class du{constructor(t,e,n){this.start=t,this.end=e,this.alignments=[],this.downsampledCount=0,this.samplingDepth=n.samplingDepth,this.pairsSupported=n.pairsSupported,this.downsampledReads=n.downsampledReads,this.pairsCache=n.pairsCache}addAlignment(t){var e,n,i;if(this.pairsSupported&&os(t)&&(i=this.pairsCache[t.readName]))return i.setSecondAlignment(t),void(this.pairsCache[t.readName]=void 0);this.alignments.length<this.samplingDepth?this.pairsSupported&&os(t)?(i=new pn(t),this.paired=!0,this.pairsCache[t.readName]=i,this.alignments.push(i)):this.alignments.push(t):((e=Math.floor(Math.random()*(this.samplingDepth+this.downsampledCount-1)))<this.samplingDepth?(n=this.alignments[e],this.pairsSupported&&os(t)?(this.pairsCache[n.readName]!==void 0&&(this.pairsCache[n.readName]=void 0),i=new pn(t),this.paired=!0,this.pairsCache[t.readName]=i,this.alignments[e]=i):this.alignments[e]=t,this.downsampledReads.add(n.readName)):this.downsampledReads.add(t.readName),this.downsampledCount++)}}class O0{constructor(t,e,n,i){this.chr=t,this.bpStart=e,this.length=n-e,this.coverage=new Array(this.length),this.maximum=0,this.threshold=i,this.qualityWeight=!0}getMax(t,e){let n=0;const i=this.coverage.length;for(let s=0;s<i;s++){const o=this.bpStart+s;if(o>e)break;const a=this.coverage[s];o>=t&&a&&(n=Math.max(n,a.total))}return n}incCounts(t){var e=this;if(t.blocks===void 0?n(t):t.blocks.forEach((function(i){n(i)})),t.gaps){for(let i of t.gaps)if(i.type==="D"){const s=i.start-e.bpStart;for(let o=s;o<s+i.len;o++)o<0||(this.coverage[o]||(this.coverage[o]=new qo(e.threshold)),this.coverage[o].del++)}}if(t.insertions)for(let i of t.insertions){const s=i.start-this.bpStart;s<0||(this.coverage[s]||(this.coverage[s]=new qo(e.threshold)),this.coverage[s].ins++)}function n(i){if(i.type==="S")return;const s=t.seq,o=t.qual,a=i.seqOffset;for(let l=i.start-e.bpStart,h=0;h<i.len;l++,h++){e.coverage[l]||(e.coverage[l]=new qo(e.threshold));const c=s==null?"N":s.charAt(a+h),u=t.strand?"pos"+c:"neg"+c,p=o&&a+h<o.length?o[a+h]:30;e.coverage[l][u]+=1,e.coverage[l]["qual"+c]+=p,e.coverage[l].total+=1,e.coverage[l].qual+=p,e.maximum=Math.max(e.coverage[l].total,e.maximum)}}}}class qo{constructor(t){this.qualityWeight=!0,this.posA=0,this.negA=0,this.posT=0,this.negT=0,this.posC=0,this.negC=0,this.posG=0,this.negG=0,this.posN=0,this.negN=0,this.pos=0,this.neg=0,this.qualA=0,this.qualT=0,this.qualC=0,this.qualG=0,this.qualN=0,this.qual=0,this.total=0,this.del=0,this.ins=0,this.threshold=t}hoverText(){const t=this.posA+this.posT+this.posC+this.posG+this.posN,e=this.negA+this.negT+this.negC+this.negG+this.negN;return`${this.total} (${t}+, ${e}-)`}
649isMismatch(t){const e=this.threshold*(this.qualityWeight&&this.qual?this.qual:this.total);let n=0;for(let i of["A","T","C","G"])i!==t&&(n+=this.qualityWeight&&this.qual?this["qual"+i]:this["pos"+i]+this["neg"+i]);return n>=e}}class D0{constructor(t,e,n){this.start=t,this.end=e,this.counts=n}popupData(t){return[{name:"start",value:this.start+1},{name:"end",value:this.end},{name:"# downsampled:",value:this.counts}]}}class P0{constructor(t){const e=t.split(",");this.chr=e[0],this.start=parseInt(e[1]),this.strand=e[2].charAt(0),this.mapQ=parseInt(e[4]),this.numMismatches=parseInt(e[5]),this.lenOnRef=_e.computeLengthOnReference(e[3])}printString(){return this.chr+":"+Ot(this.start)+"-"+Ot(this.start+this.lenOnRef)+" ("+this.strand+") = "+Ot(this.lenOnRef)+"bp @MAPQ: "+this.mapQ+" NM: "+this.numMismatches}}function fu(r){return r.split(";").filter((t=>t.length>0)).map((t=>new P0(t)))}const z0={c:1,C:1,s:2,S:2,i:4,I:4,f:4};class ls{constructor(){this.hidden=!1}isMapped(){return!(4&this.flags)}isPaired(){return!!(1&this.flags)}isProperPair(){return!!(2&this.flags)}isFirstOfPair(){return!!(64&this.flags)}isSecondOfPair(){return!!(128&this.flags)}isSecondary(){return!!(256&this.flags)}isSupplementary(){return!!(2048&this.flags)}isFailsVendorQualityCheck(){return!!(512&this.flags)}isDuplicate(){return!!(1024&this.flags)}isMateMapped(){return!(8&this.flags)}isNegativeStrand(){return!!(16&this.flags)}isMateNegativeStrand(){return!!(32&this.flags)}hasTag(t){return(this.tagDict||gu(this.tagBA)).hasOwnProperty(t)}tags(){return this.tagDict||(this.tagBA?(this.tagDict=gu(this.tagBA),this.tagBA=void 0):this.tagDict={}),this.tagDict}containsLocation(t,e){const n=e?this.scStart:this.start,i=e?this.scLengthOnRef:this.lengthOnRef;return t>=n&&t<=n+i}popupData(t){const e=[];if(t=Math.floor(t),this.insertions){const l=this.seq;for(let h of this.insertions){var n=h.start;if(t===n||t===n-1)return e.push({name:"Insertion",value:l.substr(h.seqOffset,h.len)}),e.push({name:"Location",value:n}),e}}e.push({name:"Read Name",value:this.readName}),e.push("<hr/>"),e.push({name:"Alignment Start",value:Ot(1+this.start),borderTop:!0}),e.push({name:"Read Strand",value:this.strand===!0?"(+)":"(-)",borderTop:!0});let i=this.cigar;i&&i.length>50&&(i=`${i.substring(0,23)} ... ${i.substring(i.length-25+2)}`),e.push({name:"Cigar",value:i}),e.push({name:"Mapping Quality",value:this.mq}),e.push({name:"Secondary",value:a(this.isSecondary())}),e.push({name:"Supplementary",value:a(this.isSupplementary())}),e.push({name:"Duplicate",value:a(this.isDuplicate())}),e.push({name:"Failed QC",value:a(this.isFailsVendorQualityCheck())}),this.isPaired()&&(e.push("<hr/>"),e.push({name:"First in Pair",value:!this.isSecondOfPair(),borderTop:!0}),e.push({name:"Mate is Mapped",value:a(this.isMateMapped())}),this.pairOrientation&&e.push({name:"Pair Orientation",value:this.pairOrientation}),this.isMateMapped()&&(e.push({name:"Mate Chromosome",value:this.mate.chr}),e.push({name:"Mate Start",value:this.mate.position+1}),e.push({name:"Mate Strand",value:this.mate.strand===!0?"(+)":"(-)"}),e.push({name:"Insert Size",value:this.fragmentLength})));const s=this.tags();if(s.hasOwnProperty("SA")){e.push("<hr/>"),e.push({name:"Supplementary Alignments",value:""});const l=fu(s.SA);if(l){e.push("<ul>");for(let h of l)e.push(`<li>${h.printString()}</li>`);e.push("</ul>")}}const o=new Set(["SA","MD"]);e.push("<hr/>");for(let l in s)o.has(l)||e.push({name:l,value:s[l]});return e.push({name:"Hidden Tags",value:"SA, MD"}),e.push("<hr/>"),e.push({name:"Genomic Location: ",value:Ot(1+t)}),e.push({name:"Read Base:",value:this.readBaseAt(t)}),e.push({name:"Base Quality:",value:this.readBaseQualityAt(t)}),e;function a(l){return l?"Yes":"No"}}readBaseAt(t){const e=pu(this.blocks,t);if(e){if(this.seq==="*")return"*";{const n=e.seqIndexAt(t);return this.seq[n]}}}readBaseQualityAt(t){const e=pu(this.blocks,t);if(e){if(this.qual==="*")return 30;{const n=e.seqIndexAt(t);return n>=0&&this.qual&&n<this.qual.length?this.qual[n]:30}}}gapSizeAt(t){if(this.gaps){for(let e of this.gaps)if(t>=e.start&&t<e.start+e.len)return e.len}return 0}softClippedBlocks(){let t,e,n;for(let i of this.blocks)i.type==="S"?n?e=i:t=i:i.type!=="H"&&(n=!0);return{left:t,right:e}}}function pu(r,t){for(let e=0;e<r.length;e++){const n=r[e];if(t>=n.start&&t<n.start+n.len)return n}}function gu(r){let t=0;const e=r.length,n={};for(;t<e;){const s=String.fromCharCode(r[t])+String.fromCharCode(r[t+1]);t+=2;const o=String.fromCharCode(r[t++]);let a;if(o==="A")a=String.fromCharCode(r[t]),t++;else if(o==="i"||o==="I")a=mu(r,t),t+=4;else if(o==="c")a=V0(r,t),t++;else if(o==="C")a=q0(r,t),t++;else if(o==="s"||o==="S")a=H0(r,t),t+=2;else if(o==="f")a=U0(r,t),t+=4;else if(o==="Z")for(a="";;){var i=r[t++];if(i===0)break;a+=String.fromCharCode(i)}else{if(o!=="B"){a="Error unknown type: "+o,n[s]=a;break}{const l=String.fromCharCode(r[t++]);let h=z0[l];if(h===void 0){n[s]=`Error: unknown element type '${l}'`;break}t+=4+mu(r,t)*h,a="[not shown]"}}n[s]=a}return n}function mu(r,t){return r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}function H0(r,t){return r[t+1]<<8|r[t]}function U0(r,t){return new DataView(r.buffer).getFloat32(t)}function V0(r,t){return new DataView(r.buffer).getInt8(t)}function q0(r,t){return new DataView(r.buffer).getUint8(t)}
649class br{constructor(t){t&&Object.assign(this,t)}seqIndexAt(t){return Math.floor(t)-this.start+this.seqOffset}}class bu{constructor(t){t||(t={}),this.vendorFailed=t.vendorFailed===void 0||t.vendorFailed,this.duplicates=t.duplicates===void 0||t.duplicates,this.secondary=t.secondary||!1,this.supplementary=t.supplementary||!1,this.mqThreshold=t.mqThreshold===void 0?0:t.mqThreshold,t.readgroups&&(this.readgroups=new Set(t.readgroups))}pass(t){if(this.vendorFailed&&t.isFailsVendorQualityCheck()||this.duplicates&&t.isDuplicate()||this.secondary&&t.isSecondary()||this.supplementary&&t.isSupplementary()||t.mq<this.mqThreshold)return!1;if(this.readgroups){var e=t.tags().RG;return this.readgroups.has(e)}return!0}}const wu=["=","A","C","x","G","x","x","x","T","x","x","x","x","x","x","N"],vu=["M","I","D","N","S","H","P","=","X","?","?","?","?","?","?","?"],j0=we(new Uint8Array([66,65,77,1]),0),yu=1e4,_e={readHeader:function(r,t,e){return Ct.loadArrayBuffer(r,t).then((function(n){var i;return i=mr(n),_e.decodeBamHeader(i,e)}))},decodeBamHeader:function(r,t){var e,n,i,s,o;if((e=we(r,0))!==j0)throw new Error("BAM header errror: bad magic number. This could be caused by either a corrupt or missing file.");n=we(r,4);for(var a=0;a<n;++a)String.fromCharCode(r[a+8]);var l=we(r,n+8),h=n+12;for(i={},s=[],o={},a=0;a<l;++a){for(var c=we(r,h),u="",p=0;p<c-1;++p)u+=String.fromCharCode(r[h+4+p]);we(r,h+c+4),i[u]=a,s[a]=u,t&&(o[t.getChromosomeName(u)]=u),h=h+8+c}return{magicNumber:e,size:h,chrNames:s,chrToIndex:i,chrAliasTable:o}},bam_tag2cigar:function(r,t,e,n,i,s){function o(f){return f==="C"||f==="c"||f==="A"?1:f==="S"||f==="s"?2:f==="I"||f==="i"||f==="f"?4:0}if(s.length!==1||i.start<0)return!1;for(var a=e+(n+1>>1)+n;a+4<t&&String.fromCharCode(r[a])+String.fromCharCode(r[a+1])!=="CG";){var l=String.fromCharCode(r[a+2]);if(l==="B")a+=8+o(l=String.fromCharCode(r[a+3]))*we(r,a+4);else if(l==="Z"||l==="H")for(a+=3;r[a++]!==0;);else a+=3+o(l)}if(a>=t||String.fromCharCode(r[a+2])!=="B"||String.fromCharCode(r[a+3])!=="I")return!1;var h=we(r,a+4),c=a+8;if(c+4*h>t)return!1;var u="",p=0;s.length=0,a=c;for(var d=0;d<h;++d,a+=4){var w=we(r,a),m=w>>4,g=vu[15&w];g!=="M"&&g!=="EQ"&&g!=="X"&&g!=="D"&&g!=="N"&&g!=="="||(p+=m),u=u+m+g,s.push({len:m,ltr:g})}return i.cigar=u,i.lengthOnRef=p,!0},decodeBamRecords:function(r,t,e,n,i,s,o,a){for(;t<r.length;){const p=t+we(r,t)+4,d=new ls,w=we(r,t+4),m=we(r,t+8);if(p>r.length)return;if(w<0){t=p;continue}if(i!==void 0&&(w>i||m>o))return!0;if(i!==void 0&&w<i){t=p;continue}const g=we(r,t+12),f=(65280&g)>>8,b=255&g,v=we(r,t+16),_=(4294901760&v)>>16,A=65535&v,S=we(r,t+20),C=we(r,t+24),R=we(r,t+28),x=we(r,t+32);let T=[];for(let k=0;k<b-1;++k)T.push(String.fromCharCode(r[t+36+k]));T=T.join("");let y=0,E="",L=t+36+b;const N=[];let q;for(let k=0;k<A;++k){var l=we(r,L),h=l>>4,c=vu[15&l];c!=="M"&&c!=="EQ"&&c!=="X"&&c!=="D"&&c!=="N"&&c!=="="||(y+=h),E=E+h+c,L+=4,q={len:h,ltr:c},N.push(q)}if(d.chr=n[w],d.start=m,d.flags=_,d.strand=!(16&_),d.readName=T,d.cigar=E,d.lengthOnRef=y,d.fragmentLength=x,d.mq=f,_e.bam_tag2cigar(r,p,L,S,d,N),d.end=d.start+d.lengthOnRef,d.end<s){t=p;continue}let H=[];const W=S+1>>1;for(let k=0;k<W;++k){var u=r[L+k];H.push(wu[(240&u)>>4]),H.push(wu[15&u])}H=H.slice(0,S).join(""),L+=W;const U=[];for(let k=0;k<S;++k)U.push(r[L+k]);L+=S,C>=0&&(d.mate={chr:n[C],position:R,strand:!(32&_)}
649),d.seq=H,d.qual=U,d.tagBA=new Uint8Array(r.buffer.slice(L,p)),this.setPairOrientation(d),(a===void 0||a.pass(d))&&(_u(d,N),e.push(d)),t=p}},decodeSamRecords:function(r,t,e,n,i,s){var o,a,l,h,c,u,p,d,w,m;for(h=(o=Fr(r)).length,a=0;a<h;a++)if(c=o[a].split(" "),(w=new ls).chr=c[2],w.start=Number.parseInt(c[3])-1,w.flags=Number.parseInt(c[1]),w.readName=c[0],w.strand=!(16&w.flags),w.mq=Number.parseInt(c[4]),w.cigar=c[5],w.fragmentLength=Number.parseInt(c[8]),w.seq=c[9],w.chr!=="*"&&w.isMapped()&&w.chr===e){if(w.start>i)break;if(d=0,(m=W0(w.cigar)).forEach((function(g){var f=g.len,b=g.ltr;b!=="M"&&b!=="EQ"&&b!=="X"&&b!=="D"&&b!=="N"&&b!=="="||(d+=f)})),w.lengthOnRef=d,!(w.start+d<n)){for(u=c[10],w.qual=[],l=0;l<u.length;l++)w.qual[l]=u.charCodeAt(l)-33;w.tagDict=c.length<11?{}:$0(c.slice(11)),w.isMateMapped()&&(p=c[6],w.mate={chr:p==="="?w.chr:p,position:Number.parseInt(c[7]),strand:!(32&w.flags)}),this.setPairOrientation(w),(s===void 0||s.pass(w))&&(_u(w,m),t.push(w))}}},setReaderDefaults:function(r,t){r.filter=new bu(t.filter),t.readgroup&&(r.filter.readgroups=new Set([t.readgroup])),r.alleleFreqThreshold=t.alleleFreqThreshold===void 0?.2:t.alleleFreqThreshold,r.samplingWindowSize=t.samplingWindowSize===void 0?100:t.samplingWindowSize,r.samplingDepth=t.samplingDepth===void 0?500:t.samplingDepth,r.samplingDepth>yu&&(r.samplingDepth=yu),t.viewAsPairs?r.pairsSupported=!0:r.pairsSupported=t.pairsSupported===void 0||t.pairsSupported},setPairOrientation:function(r){if(r.isMapped()&&r.mate&&r.isMateMapped()&&r.mate.chr===r.chr){var t=r.strand?"F":"R",e=r.mate,n=e.strand?"F":"R",i=" ",s=" ";r.isFirstOfPair()?(i="1",s="2"):r.isSecondOfPair()&&(i="2",s="1");var o=[],a=r.fragmentLength,l=r.end-r.start;a===0&&(a=(r.start<e.position?e.position+l:e.position-l)-r.start),a>0?(o[0]=t,o[1]=i,o[2]=n,o[3]=s):(o[2]=t,o[3]=i,o[0]=n,o[1]=s),r.pairOrientation=o.join("")}},computeLengthOnReference:function(r){let t=0,e="";for(let n=0;n<r.length;n++){const i=r.charCodeAt(n);if(i>47&&i<58)e+=r.charAt(n);else{switch(i){case 78:case 68:case 77:case 61:case 88:t+=parseInt(e.toString())}e=""}}return t}};function _u(r,t){const e=[];let n,i,s=0,o=r.start;r.scStart=r.start,r.scLengthOnRef=r.lengthOnRef;for(let a of t){let l;switch(a.ltr){case"H":case"P":break;case"S":l=o,r.scLengthOnRef+=a.len,e.length===0&&(r.scStart-=a.len,l-=a.len),e.push(new br({start:l,seqOffset:s,len:a.len,type:"S"})),s+=a.len;break;case"N":case"D":i===void 0&&(i=[]),i.push({start:o,len:a.len,type:a.ltr}),o+=a.len;break;case"I":n===void 0&&(n=[]),n.push(new br({start:o,len:a.len,seqOffset:s,type:"I"})),s+=a.len;break;case"M":case"EQ":case"=":case"X":e.push(new br({start:o,seqOffset:s,len:a.len,type:"M"})),s+=a.len,o+=a.len;break;default:}}r.blocks=e,r.insertions=n,r.gaps=i}function we(r,t){return r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}function W0(r){var t,e,n,i,s,o,a,l,h;for(t=[],e=[],s=null,i=r.length,n=0;n<i;n++)o=r.charAt(n),h=void 0,(h=o.charCodeAt(0))>=48&&h<=57?e.push(o):(a=o,l=Number.parseInt(e.join("")),e=[],s!==null&&s.ltr===a?s.len+=l:(s={len:l,ltr:a},t.push(s)));return t}function $0(r){var t={};return r.forEach((function(e){var n=e.split(":");t[n[0]]=n[2]})),t}class G0{constructor(t,e){this.config=t,this.genome=e,this.bamPath=t.url,this.isDataUri=ir(t.url),_e.setReaderDefaults(this,t)}async readAlignments(t,e,n){if(this.alignmentCache){const i=this.header,s=i.chrAliasTable.hasOwnProperty(t)?i.chrAliasTable[t]:t,o=this.alignmentCache.queryFeatures(s,e,n),a=new Er(t,e,n,this.config);for(let l of o)a.push(l);return a.finish(),a}if(this.isDataUri){const i=mr((function(s){const o=s.split(","),a=o[0].split(":")[1];let l=o[1];l=a.indexOf("base64")>=0?atob(l):decodeURI(l);const h=new Uint8Array(l.length);for(var c=0;c<l.length;c++)h[c]=l.charCodeAt(c);return h})(this.bamPath).buffer);return this.parseAlignments(i),this.fetchAlignments(t,e,n)}{const i=mr(await Ct.loadArrayBuffer(this.bamPath,Ft(this.config)));return this.parseAlignments(i),this.fetchAlignments(t,e,n)}}parseAlignments(t){const e=[];this.header=_e.decodeBamHeader(t),_e.decodeBamRecords(t,this.header.size,e,this.header.chrNames),this.alignmentCache=new Jn(e,this.genome)}fetchAlignments(t,e,n){const i=this.header.chrAliasTable.hasOwnProperty(t)?this.header.chrAliasTable[t]:t,s=this.alignmentCache.queryFeatures(i,e,n),o=new Er(t,e,n,this.config);for(let a of s)o.push(a);return o.finish(),o}}class xu{constructor(t,e){this.config=t,this.genome=e,this.bamPath=t.url,this.baiPath=t.indexURL,_e.setReaderDefaults(this,t),this._blockLoader=new qc(t)}async readAlignments(t,e,n){const i=(await this.getChrIndex())[this.chrAliasTable.hasOwnProperty(t)?this.chrAliasTable[t]:t],s=new Er(t,e,n,this.config);if(i===void 0)return s;{const o=(await this.getIndex()).chunksForRange(i,e,n);if(!o||o.length===0)return s;for(let a of o){const l=await this._blockLoader.getData(a.minv,a.maxv);if(_e.decodeBamRecords(l,a.minv.offset,s,this.indexToChr,i,e,n,this.filter))break}return s.finish(),s}}
649async getHeader(){if(!this.header){const t=this.genome,e=await this.getIndex();let n;if(e.firstBlockPosition){const s=Ft(this.config,{range:{start:e.firstBlockPosition,size:26}}),o=Ph(await Ct.loadArrayBuffer(this.bamPath,s));n=e.firstBlockPosition+o}else n=64e3;const i=Ft(this.config,{range:{start:0,size:n}});this.header=await _e.readHeader(this.bamPath,i,t)}return this.header}async getIndex(){const t=this.genome;return this.index||(this.index=await Uc(this.baiPath,this.config,t)),this.index}async getChrIndex(){if(this.chrToIndex)return this.chrToIndex;{const t=await this.getHeader();return this.chrToIndex=t.chrToIndex,this.indexToChr=t.chrNames,this.chrAliasTable=t.chrAliasTable,this.chrToIndex}}}class Z0{constructor(t,e){this.config=t,this.genome=e;const n={};t.sources.sequences.forEach((function(i){const s=e?e.getChromosomeName(i):i;n[s]=(function(o,a,l){const h={url:o.sources.url.replace("$CHR",l)};o.sources.indexURL&&(h.indexURL=o.sources.indexURL.replace("$CHR",l));const c=Object.assign(o,h);return new xu(c,a)})(t,e,i)})),this.bamReaders=n,_e.setReaderDefaults(this,t)}async readAlignments(t,e,n){return this.bamReaders.hasOwnProperty(t)?await this.bamReaders[t].readAlignments(t,e,n):new Er(t,e,n,this.config)}}const ku=function(r,t){this.config=r,this.genome=t,_e.setReaderDefaults(this,r)};function Q0(){const r=this,t=this.genome;if(this.header)return Promise.resolve(this.header);{const e=this.config.url+"?file="+this.config.alignmentFile+"&options=-b,-H",n=Ft(this.config);return _e.readHeader(e,n,t).then((function(i){return r.header=i,i}))}}ku.prototype.readAlignments=function(r,t,e){var n=this;return Q0.call(n).then((function(i){var s,o;return s=i.chrAliasTable.hasOwnProperty(r)?i.chrAliasTable[r]:r,o=n.config.url+"?reference="+n.config.referenceFile+"&file="+n.config.alignmentFile+"®ion="+s+":"+t+"-"+e,Ct.loadString(o,Ft(n.config)).then((function(a){var l;return i.chrToIndex[s],l=new Er(r,t,e,n.config),_e.decodeSamRecords(a,l,s,t,e,n.filter),l}))}))};class X0 extends Po{constructor(t,e){super(t,e),_e.setReaderDefaults(this,t)}async readAlignments(t,e,n){if(!this.header){const l=mr((await this.readHeaderData()).buffer);this.header=_e.decodeBamHeader(l,this.genome),this.chrAliasTable=new Map;for(let h of Object.keys(this.header.chrAliasTable))this.chrAliasTable.set(h,this.header.chrAliasTable[h])}let i=this.chrAliasTable.has(t)?this.chrAliasTable.get(t):t;const s=mr((await this.readData(i,e,n)).buffer),o=this.header.chrToIndex[t],a=new Er(t,e,n,this.config);return _e.decodeBamRecords(s,this.header.size,a,this.header.chrNames,o,e,n),a.finish(),a}}/*! For license information please see cram-bundle.js.LICENSE.txt */const jo=(()=>{var r={368:function(n,i,s){var o=this&&this.__awaiter||function(w,m,g,f){return new(g||(g=Promise))((function(b,v){function _(C){try{S(f.next(C))}catch(R){v(R)}}function A(C){try{S(f.throw(C))}catch(R){v(R)}}function S(C){var R;C.done?b(C.value):(R=C.value,R instanceof g?R:new g((function(x){x(R)}))).then(_,A)}S((f=f.apply(w,m||[])).next())}))},a=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(i,"__esModule",{value:!0});const l=a(s(4105)),h=a(s(1269)),c=s(597),u=s(3427),p=s(8577);function d(w,m){if(m.some((S=>S===void 0)))throw new p.CramMalformedError("invalid .crai index file");const[g,f,b,v,_,A]=m;w[g]||(w[g]=[]),w[g].push({start:f,span:b,containerStart:v,sliceStart:_,sliceBytes:A})}i.default=class{constructor(w){this.filehandle=(0,u.open)(w.url,w.path,w.filehandle),this._parseCache=new l.default({cache:new h.default({maxSize:1}),fill:(m,g)=>this.parseIndex()})}parseIndex(){const w={};return this.filehandle.readFile().then((m=>m[0]===31&&m[1]===139?(0,c.unzip)(m):m)).then((m=>{if(m.length>4&&m.readUInt32LE(0)===21578050)throw new p.CramMalformedError("invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support");let g=[],f="";for(let b=0;b<m.length;b+=1){const v=m[b];if(v>=48&&v<=57||!f&&v===45)f+=String.fromCharCode(v);else if(v===9)g.push(Number.parseInt(f,10)),f="";else if(v===10)g.push(Number.parseInt(f,10)),f="",d(w,g),g=[];else if(v!==13&&v!==32)throw new p.CramMalformedError("invalid .crai index file")}return f&&g.push(Number.parseInt(f,10)),g.length===6&&d(w,g),Object.entries(w).forEac
649h((([b,v])=>{w[b]=v.sort(((_,A)=>_.start-A.start||_.span-A.span))})),w}))}getIndex(w={}){return this._parseCache.get("index",null,w.signal)}hasDataForReferenceSequence(w){return o(this,void 0,void 0,(function*(){return!!(yield this.getIndex())[w]}))}getEntriesForRange(w,m,g){return o(this,void 0,void 0,(function*(){const f=(yield this.getIndex())[w];if(!f)return[];const b=_=>{const A=_.start,S=_.start+_.span;return A>g?-1:S<=m?1:0},v=[];for(let _=0;_<f.length;_+=1)b(f[_])===0&&v.push(f[_]);return v}))}}},1050:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.default=class{constructor(s,o){this.parameters=s,this.dataType=o}}},4863:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(1074);class c extends l.default{constructor(p,d){if(super(p,d),this.dataType!=="int")throw new a.CramUnimplementedError(`${this.dataType} decoding not yet implemented by BETA codec`)}decode(p,d,w,m){return(0,h.getBits)(d.content,m.coreBlock,this.parameters.length)-this.parameters.offset}}i.default=c},1738:function(n,i,s){var o=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(9488),l=o(s(1050));class h extends l.default{constructor(u,p,d){if(super(u,p),this.instantiateCodec=d,p!=="byteArray")throw new TypeError(`byteArrayLength does not support data type ${p}`)}decode(u,p,d,w){const m=this._getLengthCodec().decode(u,p,d,w),g=this._getDataCodec(),f=new Uint8Array(m);for(let b=0;b<m;b+=1)f[b]=g.decode(u,p,d,w);return f}_getLengthCodec(){const u=this.parameters.lengthsEncoding;return this.instantiateCodec(u,"int")}_getDataCodec(){const u=this.parameters.valuesEncoding;return this.instantiateCodec(u,"byte")}}i.default=h,"_getLengthCodec _getDataCodec".split(" ").forEach((c=>(0,a.tinyMemoize)(h,c)))},1405:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(1074);class c extends l.default{constructor(p,d){if(super(p,d),d!=="byteArray")throw new TypeError(`byteArrayStop codec does not support data type ${d}`)}decode(p,d,w,m){const{blockContentId:g}=this.parameters,f=w[g];if(!f)throw new a.CramMalformedError(`no block found with content ID ${g}`);const b=m.externalBlocks.getCursor(g);return this._decodeByteArray(f,b)}_decodeByteArray(p,d){const w=p.content,{stopByte:m}=this.parameters,g=d.bytePosition;let f=d.bytePosition;for(;w[f]!==m&&f<w.length;){if(f===w.length)throw new h.CramBufferOverrunError("byteArrayStop reading beyond length of data buffer?");f+=1}return d.bytePosition=f+1,w.subarray(g,f)}}i.default=c},5844:function(n,i,s){var o=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(9488),c=s(1074);class u extends l.default{constructor(d,w){if(super(d,w),this.dataType==="int")this._decodeData=this._decodeInt;else{if(this.dataType!=="byte")throw new a.CramUnimplementedError(`${this.dataType} decoding not yet implemented by EXTERNAL codec`);this._decodeData=this._decodeByte}}decode(d,w,m,g){const{blockContentId:f}=this.parameters,b=m[f];if(!b)throw new a.CramMalformedError(`no block found with content ID ${f}`);const v=g.externalBlocks.getCursor(f);return this._decodeData(b,v)}_decodeInt(d,w){const[m,g]=(0,h.parseItf8)(d.content,w.bytePosition);return w.bytePosition=w.bytePosition+g,m}_decodeByte(d,w){if(w.bytePosition>=d.content.length)throw new c.CramBufferOverrunError("attempted to read beyond end of block. this file seems truncated.");return d.content[w.bytePosition++]}}i.default=u},4229:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(1074);class c extends l.default{constructor(p,d){if(super(p,d),this.dataType!=="int")throw new a.CramUnimplementedError(`${this.dataType} decoding not yet implemented by GAMMA codec`)}decode(p,d,w,m){let g=1;for(;(0,h.getBits)(d.content,m.coreBlock,1)===0;)g+=1;return((0,h.getBits)(d.content,m.coreBlock,g-1)|1<<g-1)-this.parameters.offset}}i.default=c}
649,1074:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getBits=i.CramBufferOverrunError=void 0;class s extends Error{}i.CramBufferOverrunError=s,i.getBits=function(o,a,l){let h=0;if(a.bytePosition+(7-a.bitPosition+l)/8>o.length)throw new s("read error during decoding. the file seems to be truncated.");for(let c=l;c;c--)h<<=1,h|=o[a.bytePosition]>>a.bitPosition&1,a.bitPosition-=1,a.bitPosition<0&&(a.bytePosition+=1),a.bitPosition&=7;return h}},2082:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(1074);class c extends l.default{constructor(p,d){if(super(p,d),this.codes={},this.codeBook={},this.sortedByValue=[],this.sortedCodes=[],this.sortedValuesByBitCode=[],this.sortedBitCodes=[],this.sortedBitLengthsByBitCode=[],this.bitCodeToValue=[],!["byte","int"].includes(this.dataType))throw new TypeError(`${this.dataType} decoding not yet implemented by HUFFMAN_INT codec`);this.buildCodeBook(),this.buildCodes(),this.buildCaches(),this.sortedCodes[0].bitLength===0&&(this._decode=this._decodeZeroLengthCode)}buildCodeBook(){let p=new Array(this.parameters.numCodes);for(let d=0;d<this.parameters.numCodes;d+=1)p[d]={symbol:this.parameters.symbols[d],bitLength:this.parameters.bitLengths[d]};p=p.sort(((d,w)=>d.bitLength-w.bitLength||d.symbol-w.symbol)),this.codeBook={},p.forEach((d=>{this.codeBook[d.bitLength]||(this.codeBook[d.bitLength]=[]),this.codeBook[d.bitLength].push(d.symbol)}))}buildCodes(){this.codes={};let p=0,d=-1;
649Object.entries(this.codeBook).forEach((([w,m])=>{const g=parseInt(w,10);m.forEach((f=>{const b={bitLength:g,value:f,bitCode:0};d+=1;const v=g-p;if(d<<=v,b.bitCode=d,p+=v,(function(_){let A=_-(_>>1)&1431655765;return A=(858993459&A)+(A>>2&858993459),16843009*(A+(A>>4)&252645135)>>24})(d)>g)throw new a.CramMalformedError("Symbol out of range");this.codes[f]=b}))}))}buildCaches(){this.sortedCodes=Object.values(this.codes).sort(((d,w)=>d.bitLength-w.bitLength||d.bitCode-w.bitCode)),this.sortedByValue=Object.values(this.codes).sort(((d,w)=>d.value-w.value)),this.sortedValuesByBitCode=this.sortedCodes.map((d=>d.value)),this.sortedBitCodes=this.sortedCodes.map((d=>d.bitCode)),this.sortedBitLengthsByBitCode=this.sortedCodes.map((d=>d.bitLength));const p=Math.max(...this.sortedBitCodes);this.bitCodeToValue=new Array(p+1).fill(-1);for(let d=0;d<this.sortedBitCodes.length;d+=1)this.bitCodeToValue[this.sortedCodes[d].bitCode]=d}decode(p,d,w,m){return this._decode(p,d,m.coreBlock)}_decodeZeroLengthCode(){return this.sortedCodes[0].value}_decode(p,d,w){const m=d.content;let g=0,f=0;for(let b=0;b<this.sortedCodes.length;b+=1){const v=this.sortedCodes[b].bitLength;f<<=v-g,f|=(0,h.getBits)(m,w,v-g),g=v;{const _=this.bitCodeToValue[f];if(_>-1&&this.sortedBitLengthsByBitCode[_]===v)return this.sortedValuesByBitCode[_];for(let A=b;this.sortedCodes[A+1].bitLength===v&&A<this.sortedCodes.length;A+=1)b+=1}}throw new a.CramMalformedError("Huffman symbol not found.")}}i.default=c},8772:function(n,i,s){var o=this&&this.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(i,"__esModule",{value:!0}),i.instantiateCodec=void 0;const a=s(8577),l=o(s(2082)),h=o(s(5844)),c=o(s(1405)),u=o(s(1738)),p=o(s(4863)),d=o(s(4229)),w=o(s(8821)),m={1:h.default,3:l.default,4:u.default,5:c.default,6:p.default,7:w.default,9:d.default};i.instantiateCodec=function g(f,b){const v=(_=b==="ignore"?0:f.codecId,m[_]);var _;if(!v)throw new a.CramUnimplementedError(`no codec implemented for codec ID ${f.codecId}`);return new v(f.parameters,b,g)}},8821:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(1050)),h=s(1074);class c extends l.default{constructor(p,d){if(super(p,d),this.dataType!=="int")throw new a.CramUnimplementedError(`${this.dataType} decoding not yet implemented by SUBEXP codec`)}decode(p,d,w,m){let g,f,b=0;for(;(0,h.getBits)(d.content,m.coreBlock,1);)b+=1;return b===0?(g=this.parameters.K,f=(0,h.getBits)(d.content,m.coreBlock,g)):(g=b+this.parameters.K-1,f=1<<g|(0,h.getBits)(d.content,m.coreBlock,g)),f-this.parameters.offset}}i.default=c},2615:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.default={CRAM_FLAG_PRESERVE_QUAL_SCORES:1,CRAM_FLAG_DETACHED:2,CRAM_FLAG_MATE_DOWNSTREAM:4,CRAM_FLAG_NO_SEQ:8,CRAM_FLAG_MASK:15,CRAM_M_REVERSE:1,CRAM_M_UNMAP:2,BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048,BAM_CMATCH:0,BAM_CINS:1,BAM_CDEL:2,BAM_CREF_SKIP:3,BAM_CSOFT_CLIP:4,BAM_CHARD_CLIP:5,BAM_CPAD:6,BAM_CEQUAL:7,BAM_CDIFF:8,BAM_CBACK:9,BAM_CIGAR_STR:"MIDNSHP:XB",BAM_CIGAR_SHIFT:4,BAM_CIGAR_MASK:15,BAM_CIGAR_TYPE:246183}},8543:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0});const o=s(8772),a=s(8577),l={BF:"int",CF:"int",RI:"int",RL:"int",AP:"int",RG:"int",MF:"int",NS:"int",NP:"int",TS:"int",NF:"int",TC:"byte",TN:"int",FN:"int",FC:"byte",FP:"int",BS:"byte",IN:"byteArray",SC:"byteArray",DL:"int",BA:"byte",BB:"byteArray",RS:"int",PD:"int",HC:"int",MQ:"int",RN:"byteArray",QS:"byte",QQ:"byteArray",TL:"int"};i.default=class{constructor(h){this.dataSeriesCodecCache={},this.tagCodecCache={},this.tagEncoding={},this.readNamesIncluded=h.preservation.RN,this.APdelta=h.preservation.AP,this.referenceRequired=!!h.preservation.RR,this.tagIdsDictionary=h.preservation.TD,this.substitutionMatrix=(function(c){const u=new Array(5);for(let p=0;p<5;p+=1)u[p]=new Array(4);
649return u[0][c[0]>>6&3]="C",u[0][c[0]>>4&3]="G",u[0][c[0]>>2&3]="T",u[0][3&c[0]]="N",u[1][c[1]>>6&3]="A",u[1][c[1]>>4&3]="G",u[1][c[1]>>2&3]="T",u[1][3&c[1]]="N",u[2][c[2]>>6&3]="A",u[2][c[2]>>4&3]="C",u[2][c[2]>>2&3]="T",u[2][3&c[2]]="N",u[3][c[3]>>6&3]="A",u[3][c[3]>>4&3]="C",u[3][c[3]>>2&3]="G",u[3][3&c[3]]="N",u[4][c[4]>>6&3]="A",u[4][c[4]>>4&3]="C",u[4][c[4]>>2&3]="G",u[4][3&c[4]]="T",u})(h.preservation.SM),this.dataSeriesEncoding=h.dataSeriesEncoding,this.tagEncoding=h.tagEncoding,this.preservation=h.preservation,this._size=h._size,this._endPosition=h._endPosition}getCodecForTag(h){if(!this.tagCodecCache[h]){const c=this.tagEncoding[h];c&&(this.tagCodecCache[h]=(0,o.instantiateCodec)(c,"byteArray"))}return this.tagCodecCache[h]}getTagNames(h){return this.tagIdsDictionary[h]}getCodecForDataSeries(h){let c=this.dataSeriesCodecCache[h];if(c===void 0){const u=this.dataSeriesEncoding[h];if(u){const p=l[h];if(!p)throw new a.CramMalformedError(`data series name ${h} not defined in file compression header`);c=(0,o.instantiateCodec)(u,p),this.dataSeriesCodecCache[h]=c}}return c}toJSON(){const h={};return Object.keys(this).forEach((c=>{/Cache$/.test(c)||(h[c]=this[c])})),h}}},6284:function(n,i,s){var o=this&&this.__awaiter||function(d,w,m,g){return new(m||(m=Promise))((function(f,b){function v(S){try{A(g.next(S))}catch(C){b(C)}}function _(S){try{A(g.throw(S))}catch(C){b(C)}}function A(S){var C;S.done?f(S.value):(C=S.value,C instanceof m?C:new m((function(R){R(C)}))).then(v,_)}A((g=g.apply(d,w||[])).next())}))},a=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(i,"__esModule",{value:!0});const l=s(8577),h=s(9488),c=a(s(6601)),u=a(s(8543));class p{constructor(w,m){this.file=w,this.filePosition=m}getHeader(){return this._readContainerHeader(this.filePosition)}getCompressionHeaderBlock(){return o(this,void 0,void 0,(function*(){if(!(yield this.getHeader()).numRecords)return null;const w=yield this.file.getSectionParsers(),m=yield this.getFirstBlock();if(m===void 0)return;if(m.contentType!=="COMPRESSION_HEADER")throw new l.CramMalformedError(`invalid content type ${m.contentType} in what is supposed to be the compression header block`);const g=(0,h.parseItem)(m.content,w.cramCompressionHeader.parser,0,m.contentPosition);return Object.assign(Object.assign({},m),{parsedContent:g})}))}getFirstBlock(){return o(this,void 0,void 0,(function*(){const w=yield this.getHeader();return this.file.readBlock(w._endPosition)}))}getCompressionScheme(){return o(this,void 0,void 0,(function*(){const w=yield this.getCompressionHeaderBlock();if(w)return new u.default(w.parsedContent)}))}getSlice(w,m){return new c.default(this,w,m)}_readContainerHeader(w){return o(this,void 0,void 0,(function*(){const m=yield this.file.getSectionParsers(),{cramContainerHeader1:g,cramContainerHeader2:f}=m,{size:b}=yield this.file.stat();if(w>=b)return;const v=Buffer.allocUnsafe(g.maxLength);yield this.file.read(v,0,g.maxLength,w);const _=(0,h.parseItem)(v,g.parser),A=(0,h.itf8Size)(_.numLandmarks);if(w+_.length>=b)return;const S=Buffer.allocUnsafe(f.maxLength(_.numLandmarks));yield this.file.read(S,0,f.maxLength(_.numLandmarks),w+_._size-A);const C=(0,h.parseItem)(S,f.parser);return this.file.validateChecksums&&C.crc32!==void 0&&(yield this.file.checkCrc32(w,_._size+C._size-A-4,C.crc32,`container header beginning at position ${w}`)),Object.assign(_,C,{_size:_._size+C._size-A,_endPosition:_._size+C._size-A+w})}))}}i.default=p,"getHeader getCompressionHeaderBlock getCompressionScheme".split(" ").forEach((d=>(0,h.tinyMemoize)(p,d)))},5457:function(n,i,s){var o=this&&this.__awaiter||function(_,A,S,C){return new(S||(S=Promise))((function(R,x){function T(L){try{E(C.next(L))}catch(N){x(N)}}function y(L){try{E(C.throw(L))}catch(N){x(N)}}function E(L){var N;L.done?R(L.value):(N=L.value,N instanceof S?N:new S((function(q){q(N)}))).then(T,y)}E((C=C.apply(_,A||[])).next())}))},a=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(i,"__esModule",{value:!0});const l=s(597),h=a(s(2779)),c=a(s(1269)),u=s(8577),p=a(s(9675)),d=s(6141),w=a(s(3498)),m=a(s(6284)),g=s(3427),f=s(9488),b=s(7578);class v{constructor(A){var S;if(this.file=(0,g.open)(A.url,A.path,A.filehandle),this.validateChecksums=!0,this.fetchReferenceSequenceCallback=A.seqFetch,this.options={checkSequenceMD5:A.checkSequenceMD5,cacheSize:(S=A.cacheSize)!==null&&S!==void 0?S:2e4},this.featureCache=new c.default({maxSize:this.options.cacheSize}),(function(){const C=new Uint32Array([287454020]),R=new Uint8Array(C.buffer);return R[0]===68?0:R[0]===17?1:2})()>0)throw new Error("Detected big-endian machine, may be unable to run")}
649read(A,S,C,R){return this.file.read(A,S,C,R)}stat(){return this.file.stat()}getDefinition(){return o(this,void 0,void 0,(function*(){const A=Buffer.allocUnsafe(d.cramFileDefinition.maxLength);yield this.file.read(A,0,d.cramFileDefinition.maxLength,0);const S=d.cramFileDefinition.parser.parse(A).result;if(S.majorVersion!==2&&S.majorVersion!==3)throw new u.CramUnimplementedError(`CRAM version ${S.majorVersion} not supported`);return S}))}getSamHeader(){return o(this,void 0,void 0,(function*(){const A=yield this.getContainerById(0);if(!A)throw new u.CramMalformedError("file contains no containers");const S=yield A.getFirstBlock();if(S===void 0)return(0,b.parseHeaderText)("");const C=S.content,R=C.readInt32LE(0),x=C.toString("utf8",4,4+R);return this.header=x,(0,b.parseHeaderText)(x)}))}getHeaderText(){return o(this,void 0,void 0,(function*(){return yield this.getSamHeader(),this.header}))}getSectionParsers(){return o(this,void 0,void 0,(function*(){const{majorVersion:A}=yield this.getDefinition();return(0,d.getSectionParsers)(A)}))}getContainerById(A){return o(this,void 0,void 0,(function*(){const S=yield this.getSectionParsers();let C=S.cramFileDefinition.maxLength;const{size:R}=yield this.file.stat(),{cramContainerHeader1:x}=S;let T;for(let y=0;y<=A;y+=1){if(C+x.maxLength+8>=R)return;T=this.getContainerAtPosition(C);const E=yield T.getHeader();if(!E)throw new u.CramMalformedError(`container ${A} not found in file`);if(y===0){C=E._endPosition;for(let L=0;L<E.numBlocks;L+=1){const N=yield this.readBlock(C);if(N===void 0)return;C=N._endPosition}}else C+=E._size+E.length}return T}))}checkCrc32(A,S,C,R){return o(this,void 0,void 0,(function*(){const x=Buffer.allocUnsafe(S);yield this.file.read(x,0,S,A);const T=h.default.unsigned(x);if(T!==C)throw new u.CramMalformedError(`crc mismatch in ${R}: recorded CRC32 = ${C}, but calculated CRC32 = ${T}`)}))}containerCount(){return o(this,void 0,void 0,(function*(){const A=yield this.getSectionParsers(),{size:S}=yield this.file.stat(),{cramContainerHeader1:C}=A;let R=0,x=A.cramFileDefinition.maxLength;for(;x+C.maxLength+8<S;){const T=yield this.getContainerAtPosition(x).getHeader();if(!T)break;if(R===0){x=T._endPosition;for(let y=0;y<T.numBlocks;y+=1){const E=yield this.readBlock(x);if(E===void 0)return;x=E._endPosition}}else x+=T._size+T.length;R+=1}return R}))}getContainerAtPosition(A){return new m.default(this,A)}readBlockHeader(A){return o(this,void 0,void 0,(function*(){const S=yield this.getSectionParsers(),{cramBlockHeader:C}=S,{size:R}=yield this.file.stat();if(A+C.maxLength>=R)return;const x=Buffer.allocUnsafe(C.maxLength);return yield this.file.read(x,0,C.maxLength,A),(0,f.parseItem)(x,C.parser,0,A)}))}_parseSection(A,S,C=A.maxLength,R){return o(this,void 0,void 0,(function*(){let x;if(R)x=R;else{const{size:y}=yield this.file.stat();if(S+C>=y)return;x=Buffer.allocUnsafe(C),yield this.file.read(x,0,C,S)}const T=(0,f.parseItem)(x,A.parser,0,S);if(T._size!==C)throw new u.CramMalformedError(`section read error: requested size ${C} does not equal parsed size ${T._size}`);return T}))}_uncompress(A,S,C){if(A==="gzip")(0,l.unzip)(S).copy(C);else if(A==="bzip2"){const R=bzip2.array(S);let x,T=bzip2.header(R),y=0;do x=bzip2.decompress(R,T),x!=-1&&(Buffer.from(x).copy(C,y),y+=x.length,T-=x.length);while(x!=-1)}else if(A==="rans")(0,p.default)(S,C);else if(A==="rans4x16")w.default.r4x16_uncompress(S,C);else if(A==="arith")w.default.arith_uncompress(S,C);else if(A==="fqzcomp")w.default.fqzcomp_uncompress(S,C);else{if(A!=="tok3")throw new u.CramUnimplementedError(`${A} decompression not yet implemented`);w.default.tok3_uncompress(S,C)}}readBlock(A){return o(this,void 0,void 0,(function*(){const{majorVersion:S}=yield this.getDefinition(),C=yield this.getSectionParsers(),R=yield this.readBlockHeader(A);if(R===void 0)return;const x=R._endPosition,T=Buffer.allocUnsafe(R.uncompressedSize),y=Object.assign(Object.assign({},R),{_endPosition:x,contentPosition:x,content:T});if(R.compressionMethod!=="raw"){const E=Buffer.allocUnsafe(R.compressedSize);yield this.read(E,0,R.compressedSize,x),this._uncompress(R.compressionMethod,E,T)}else yield this.read(T,0,R.uncompressedSize,x);if(S>=3){const E=yield this._parseSection(C.cramBlockCrc32,x+R.compressedSize);if(E===void 0)return;y.crc32=E.crc32,this.validateChecksums&&(yield this.checkCrc32(A,R._size+R.compressedSize,E.crc32,"block data")),y._endPosition=E._endPosition,y._size=y.compressedSize+C.cramBlockCrc32.maxLength}else y._endPosition=x+y.compressedSize,y._size=y.compressedSize;return y}
649))}}i.default=v,"getDefinition getSectionParsers getSamHeader".split(" ").forEach((_=>(0,f.tinyMemoize)(v,_)))},8222:function(n,i,s){var o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(i,"__esModule",{value:!0}),i.CramRecord=void 0;const a=o(s(5457));var l=s(8631);Object.defineProperty(i,"CramRecord",{enumerable:!0,get:function(){return o(l).default}}),i.default=a.default},8631:function(n,i,s){var o=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(i,"__esModule",{value:!0}),i.MateFlagsDecoder=i.CramFlagsDecoder=i.BamFlagsDecoder=i.MateFlags=i.CramFlags=i.BamFlags=void 0;const a=o(s(2615)),l={a:0,A:0,c:1,C:1,g:2,G:2,t:3,T:3,n:4,N:4};function h(c){const u={};for(const[p,d]of c)u["is"+d]=w=>!!(w&p),u["set"+d]=w=>w|p;return u}i.BamFlags=[[1,"Paired"],[2,"ProperlyPaired"],[4,"SegmentUnmapped"],[8,"MateUnmapped"],[16,"ReverseComplemented"],[32,"MateReverseComplemented"],[64,"Read1"],[128,"Read2"],[256,"Secondary"],[512,"FailedQc"],[1024,"Duplicate"],[2048,"Supplementary"]],i.CramFlags=[[1,"PreservingQualityScores"],[2,"Detached"],[4,"WithMateDownstream"],[8,"DecodeSequenceAsStar"]],i.MateFlags=[[1,"OnNegativeStrand"],[2,"Unmapped"]],i.BamFlagsDecoder=h(i.BamFlags),i.CramFlagsDecoder=h(i.CramFlags),i.MateFlagsDecoder=h(i.MateFlags),i.default=class{constructor({flags:c,cramFlags:u,readLength:p,mappingQuality:d,lengthOnRef:w,qualityScores:m,mateRecordNumber:g,readBases:f,readFeatures:b,mateToUse:v,readGroupId:_,readName:A,sequenceId:S,uniqueId:C,templateSize:R,alignmentStart:x,tags:T}){this.flags=c,this.cramFlags=u,this.readLength=p,this.mappingQuality=d,this.lengthOnRef=w,this.qualityScores=m,f&&(this.readBases=f),this.readGroupId=_,this.readName=A,this.sequenceId=S,this.uniqueId=C,this.templateSize=R,this.alignmentStart=x,this.tags=T,b&&(this.readFeatures=b),v&&(this.mate={flags:v.mateFlags,readName:v.mateReadName,sequenceId:v.mateSequenceId,alignmentStart:v.mateAlignmentStart}),g&&(this.mateRecordNumber=g)}isPaired(){return!!(this.flags&a.default.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&a.default.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&a.default.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&a.default.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&a.default.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&a.default.BAM_FMREVERSE)}isRead1(){return!!(this.flags&a.default.BAM_FREAD1)}isRead2(){return!!(this.flags&a.default.BAM_FREAD2)}isSecondary(){return!!(this.flags&a.default.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&a.default.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&a.default.BAM_FDUP)}isSupplementary(){return!!(this.flags&a.default.BAM_FSUPPLEMENTARY)}isDetached(){return!!(this.cramFlags&a.default.CRAM_FLAG_DETACHED)}hasMateDownStream(){return!!(this.cramFlags&a.default.CRAM_FLAG_MATE_DOWNSTREAM)}isPreservingQualityScores(){return!!(this.cramFlags&a.default.CRAM_FLAG_PRESERVE_QUAL_SCORES)}isUnknownBases(){return!!(this.cramFlags&a.default.CRAM_FLAG_NO_SEQ)}getReadBases(){if(!this.readBases&&this._refRegion){const c=(function(u,p){if(!u.lengthOnRef&&!u.readLength||u.isUnknownBases())return null;const d=u.alignmentStart-p.start;if(!u.readFeatures)return p.seq.substr(d,u.lengthOnRef).toUpperCase();let w="",m=d,g=0;for(;w.length<u.readLength;)if(g<u.readFeatures.length){const f=u.readFeatures[g];if(f.code==="Q"||f.code==="q")g+=1;else if(f.pos===w.length+1)if(g+=1,f.code==="b"){const b=f.data;w+=b,m+=b.length}else f.code==="B"?(w+=f.data[0],m+=1):f.code==="X"?(w+=f.sub,m+=1):f.code==="I"?w+=f.data:f.code==="D"?m+=f.data:f.code==="i"?w+=f.data:f.code==="N"?m+=f.data:f.code==="S"?w+=f.data:f.code==="P"||f.code;else if(g<u.readFeatures.length){const b=p.seq.substr(m,u.readFeatures[g].pos-w.length-1);w+=b,m+=b.length}}else{const f=p.seq.substr(m,u.readLength-w.length);w+=f,m+=f.length}return w.toUpperCase()})(this,this._refRegion);c&&(this.readBases=c)}return this.readBases}getPairOrientation(){if(!this.isSegmentUnmapped()&&this.isPaired()&&!this.isMateUnmapped()&&this.mate&&this.sequenceId===this.mate.sequenceId){const c=this.isReverseComplemented()?"R":"F",u=this.isMateRever
649seComplemented()?"R":"F";let p=" ",d=" ";this.isRead1()?(p="1",d="2"):this.isRead2()&&(p="2",d="1");const w=[];let m=this.templateLength||this.templateSize;if(m===void 0)throw new Error("One of templateSize and templateLength must be set");return this.alignmentStart>this.mate.alignmentStart&&m>0&&(m=-m),m>0?(w[0]=c,w[1]=p,w[2]=u,w[3]=d):(w[2]=c,w[3]=p,w[0]=u,w[1]=d),w.join("")}return null}addReferenceSequence(c,u){this.readFeatures&&this.readFeatures.forEach((p=>{p.code==="X"&&(function(d,w,m,g){if(!w)return;const f=g.refPos-w.start,b=w.seq.charAt(f);b&&(g.ref=b);let v=l[b];v===void 0&&(v=4);const _=m.substitutionMatrix[v][g.data];_&&(g.sub=_)})(0,c,u,p)})),!this.readBases&&c.start<=this.alignmentStart&&c.end>=this.alignmentStart+(this.lengthOnRef||this.readLength)-1&&(this._refRegion=c)}toJSON(){const c={};return Object.keys(this).forEach((u=>{u.charAt(0)!=="_"&&(c[u]=this[u])})),c.readBases=this.getReadBases(),c}}},6141:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getSectionParsers=i.cramFileDefinition=i.isMappedSliceHeader=void 0;const o=s(9996),a=new o.Parser().itf8(),l={parser:new o.Parser().string("magic",{length:4}).uint8("majorVersion").uint8("minorVersion").string("fileId",{length:20,stripNull:!0}),maxLength:26};i.cramFileDefinition=l;const h={parser:new o.Parser().uint8("compressionMethod",{formatter:f=>{const b=["raw","gzip","bzip2","lzma","rans","rans4x16","arith","fqzcomp","tok3"][f];if(!b)throw new Error(`compression method number ${f} not implemented`);return b}}).uint8("contentType",{formatter:f=>{const b=["FILE_HEADER","COMPRESSION_HEADER","MAPPED_SLICE_HEADER","UNMAPPED_SLICE_HEADER","EXTERNAL_DATA","CORE_DATA"][f];if(!b)throw new Error(`invalid block content type id ${f}`);return b}}).itf8("contentId").itf8("compressedSize").itf8("uncompressedSize"),maxLength:17},c={parser:new o.Parser().uint32("crc32"),maxLength:4},u=new o.Parser().itf8("size").buffer("ents",{length:"size",formatter:f=>{function b(S,C){const R=f.toString("utf8",S,C),x=[];for(let T=0;T<R.length;T+=3)x.push(R.substr(T,3));return x}var v,_=[],A=0;for(v=0;v<f.length;v+=1)f[v]||(_.push(b(A,v)),A=v+1);return v>A&&_.push(b(A,v)),_}}),p=new o.Parser().uint8(null,{formatter:f=>!!f}),d=new o.Parser().itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:new o.Parser().string("key",{length:2,stripNull:!1}).choice("value",{tag:"key",choices:{MI:p,UI:p,PI:p,RN:p,AP:p,RR:p,SM:new o.Parser().array(null,{type:"uint8",length:5}),TD:new o.Parser().nest(null,{type:u,formatter:f=>f.ents})}})});function w(f){const b={};for(let v=0;v<f.ents.length;v+=1){const{key:_,value:A}=f.ents[v];b[_],b[_]=A}return b}const m={cramFileDefinition:l,cramBlockHeader:h,cramBlockCrc32:c};i.isMappedSliceHeader=function(f){return typeof f.refSeqId=="number"};const g={cramUnmappedSliceHeader(f){let b=0,v=new o.Parser().itf8("numRecords");return b+=5,f>=3?(v=v.ltf8("recordCounter"),b+=9):f===2&&(v=v.itf8("recordCounter"),b+=5),v=v.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:a,length:"numContentIds"}),b+=10,f>=2&&(v=v.array("md5",{type:"uint8",length:16}),b+=16),{parser:v,maxLength:_=>b+5*_}},cramMappedSliceHeader(f){let b=new o.Parser().itf8("refSeqId").itf8("refSeqStart").itf8("refSeqSpan").itf8("numRecords"),v=20;return f>=3?(b=b.ltf8("recordCounter"),v+=9):f===2&&(b=b.itf8("recordCounter"),v+=5),b=b.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:a,length:"numContentIds"}).itf8("refBaseBlockId"),v+=15,f>=2&&(b=b.array("md5",{type:"uint8",length:16}),v+=16),{parser:b,maxLength:_=>v+5*_}},cramEncoding:f=>({parser:new o.Parser().namely("cramEncoding").itf8("codecId").itf8("parametersBytes").choice("parameters",{tag:"codecId",choices:{0:new o.Parser,1:new o.Parser().itf8("blockContentId"),2:new o.Parser().itf8("offset").itf8("M"),3:o.Parser.start().itf8("numCodes").array("symbols",{length:"numCodes",type:a}).itf8("numLengths").array("bitLengths",{length:"numLengths",type:a}),4:o.Parser.start().nest("lengthsEncoding",{type:"cramEncoding"}).nest("valuesEncoding",{type:"cramEncoding"}),5:new o.Parser().uint8("stopByte").itf8("blockContentId"),6:new o.Parser().itf8("offset").itf8("length"),7:new o.Parser().itf8("offset").itf8("K"),8:new o.Parser().itf8("offset").itf8("log2m"),9:new o.Parser().itf8("offset")}})}),cramDataSeriesEncodingMap(f){return new o.Parser().itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:new o.Parser().string("key",{length:2,stripNull:!1}).nest("value",{type:this.cramEncoding(f).parser})})},cramTagEncodingMap(f){return new o.Parser().itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:new o.Parser().itf8("key",{formatter:b=>String.fromCharCode(b>>16&255)+String.fromCharCode(b>>8&255)+String.fromCharCode(255&b)}).nest("value",{type:this.cramEncoding(f).parser})})},cramCompressionHeader(f){let b=new o.Parser;return b=b.nest("preservation",{type:d,formatter:w}).nest("dataSeriesEncoding",{type:this.cramDataSeriesEncodingMap(f),formatter:w}).nest("tagEncoding",{type:this.cramTagEncodingMap(f),formatter:w}),{parser:b}},cramContainerHeader1(f){let b=new o.Parser().int32("length").itf8("refSeqId").itf8("refSeqStart").itf8("alignmentSpan").itf8("numRecords"),v=24;return f>=3?(b=b.ltf8("recordCounter"),v+=9):f===2&&(b=b.itf8("recordCounter"),v+=5),f>1&&(b=b.ltf8("numBases"),v+=9),b=b.itf8("numBlocks").itf8("numLandmarks"),v+=10,{parser:b,maxLength:v}},cramContainerHeader2(f){let b=new o.Parser().itf8("numLandmarks").array("landmarks",{type:new o.Parser().itf8(),length:"numLandmarks"}),v=0;return f>=3&&(b=b.uint32("crc32"),v=4),{parser:b,maxLength:_=>5+5*_+v}}};i.getSectionParsers=function(f){const b=Object.assign({},m);return Object.keys(g).forEach((v=>{b[v]=g[v](f)})),b}},3757:function(n,i,s){var o=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(i,"__esModule",{value:!0});const a=o(s(3720)),l=s(8577),h=s(8631),c=s(6141);function u(d){let w="";for(let m=0;m<d.length&&d[m]!==0;m++)w+=String.fromCharCode(d[m]);return w}function p(d,w){if(d==="Z")return u(w);if(d==="A")return String.fromCharCode(w[0]);if(d==="I")return a.default.fromBytesLE(w).toNumber();if(d==="i")return new Int32Array(w.buffer)[0];if(d==="s")return new Int16Array(w.buffer)[0];if(d==="S")return new Uint16Array(w.buffer)[0];if(d==="c")return new Int8Array(w.buffer)[0];if(d==="C")return w[0];if(d==="f")return new Float32Array(w.buffer)[0];if(d==="H")return Number.parseInt(u(w).replace(/^0x/,""),16);if(d==="B")return(function(m){const g=String.fromCharCode(m[0]),f=Int32Array.from(m.slice(1))[0],b=new Array(f);if(m=m.slice(5),g==="c"){const v=new Int8Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else if(g==="C"){const v=new Uint8Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else if(g==="s"){const v=new Int16Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else if(g==="S"){const v=new Uint16Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else if(g==="i"){const v=new Int32Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else if(g==="I"){const v=new Uint32Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}else{if(g!=="f")throw new Error("unknown type: "+g);{const v=new Float32Array(m.buffer);for(let _=0;_<f;_+=1)b[_]=v[_]}}return b})(w);throw new l.CramMalformedError(`Unrecognized tag type ${d}`)}i.default=function(d,w,m,g,f,b,v,_,A){let S=w("BF");const C=w("CF");if(!(0,c.isMappedSliceHeader)(g.parsedContent))throw new Error;let R;R=_>1&&g.parsedContent.refSeqId===-2?w("RI"):g.parsedContent.refSeqId;const x=w("RL");let T=w("AP");m.APdelta&&(T+=v.lastAlignmentStart),v.lastAlignmentStart=T;const y=w("RG");let E,L,N,q;if(m.readNamesIncluded&&(E=u(w("RN"))),h.CramFlagsDecoder.isDetached(C)){const $=w("MF");let G;m.readNamesIncluded||(G=u(w("RN")),E=G);const Z=w("NS"),X=w("NP");($||Z>-1)&&(L={mateFlags:$,mateSequenceId:Z,mateAlignmentStart:X,mateReadName:G}),N=w("TS"),h.MateFlagsDecoder.isUnmapped($)&&(S=h.BamFlagsDecoder.setMateUnmapped(S)),h.MateFlagsDecoder.isOnNegativeStrand($)&&(S=h.BamFlagsDecoder.setMateRever
649seComplemented(S))}else h.CramFlagsDecoder.isWithMateDownstream(C)&&(q=w("NF")+A+1);const H=w("TL");if(H<0)throw new l.CramMalformedError("invalid TL index");const W={},U=m.getTagNames(H),k=U.length;for(let $=0;$<k;$+=1){const G=U[$],Z=G.substr(0,2),X=G.substr(2,1),st=m.getCodecForTag(G);if(!st)throw new l.CramMalformedError(`no codec defined for auxiliary tag ${G}`);const nt=st.decode(d,f,b,v);W[Z]=p(X,nt)}let O,z,B,F,j;if(h.BamFlagsDecoder.isSegmentUnmapped(S))if(h.CramFlagsDecoder.isDecodeSequenceAsStar(C))j=null,F=null;else{const $=new Array(x);for(let G=0;G<$.length;G+=1)$[G]=w("BA");if(j=String.fromCharCode(...$),h.CramFlagsDecoder.isPreservingQualityScores(C)){F=new Array(x);for(let G=0;G<$.length;G+=1)F[G]=w("QS")}}else{const $=w("FN");if($&&(O=(function(G,Z,X,st,nt){let it=0,mt=G-1;const gt=new Array(Z);function _t([xt,ct]){const kt=X(ct);if(xt==="character")return String.fromCharCode(kt);if(xt==="string"){let At="";for(let St=0;St<kt.byteLength;St++)At+=String.fromCharCode(kt[St]);return At}return xt==="numArray"?kt.toArray():kt}for(let xt=0;xt<Z;xt+=1){const ct=String.fromCharCode(X("FC")),kt=X("FP"),At={B:["character","BA"],S:["string",nt>1?"SC":"IN"],X:["number","BS"],D:["number","DL"],I:["string","IN"],i:["character","BA"],b:["string","BB"],q:["numArray","QQ"],Q:["number","QS"],H:["number","HC"],P:["number","PD"],N:["number","RS"]}[ct];if(!At)throw new l.CramMalformedError(`invalid read feature code "${ct}"`);let St=_t(At);const Ut={B:["number","QS"]}[ct];Ut&&(St=[St,_t(Ut)]),it+=kt;const M=it;mt+=kt;const I=mt;ct==="D"||ct==="N"?mt+=St:ct==="I"||ct==="S"?mt-=St.length:ct==="i"&&(mt-=1),gt[xt]={code:ct,pos:M,refPos:I,data:St}}return gt})(T,$,w,0,_)),z=x,O)for(const{code:G,data:Z}of O)G==="D"||G==="N"?z+=Z:G==="I"||G==="S"?z-=Z.length:G==="i"&&(z-=1);if(Number.isNaN(z)&&(z=x),B=w("MQ"),h.CramFlagsDecoder.isPreservingQualityScores(C)){F=new Array(x);for(let G=0;G<F.length;G++)F[G]=w("QS")}}return{readLength:x,sequenceId:R,cramFlags:C,flags:S,alignmentStart:T,readGroupId:y,readName:E,mateToUse:L,templateSize:N,mateRecordNumber:q,readFeatures:O,lengthOnRef:z,mappingQuality:B,qualityScores:F,readBases:j,tags:W}}},6601:function(n,i,s){var o=this&&this.__awaiter||function(f,b,v,_){return new(v||(v=Promise))((function(A,S){function C(T){try{x(_.next(T))}catch(y){S(y)}}function R(T){try{x(_.throw(T))}catch(y){S(y)}}function x(T){var y;T.done?A(T.value):(y=T.value,y instanceof v?y:new v((function(E){E(y)}))).then(C,R)}x((_=_.apply(f,b||[])).next())}))},a=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(i,"__esModule",{value:!0});const l=s(8577),h=s(9488),c=a(s(2615)),u=a(s(3757)),p=a(s(8631)),d=s(6141),w=s(1074);function m(f,b,v,_){if(!_)throw new l.CramMalformedError("could not resolve intra-slice mate pairs, file seems truncated or malformed");const A=!!(_.mate||_.mateRecordNumber!==void 0&&_.mateRecordNumber!==b);v.readName||(v.readName=String(v.uniqueId),_.readName=v.readName),v.mate={sequenceId:_.sequenceId,alignmentStart:_.alignmentStart,uniqueId:_.uniqueId},_.readName&&(v.mate.readName=_.readName),_.mate||_.mateRecordNumber!==void 0||(_.mate={sequenceId:v.sequenceId,alignmentStart:v.alignmentStart,uniqueId:v.uniqueId},v.readName&&(_.mate.readName=v.readName)),v.flags|=c.default.BAM_FPAIRED,_.flags&c.default.BAM_FUNMAP&&(v.flags|=c.default.BAM_FMUNMAP),v.flags&c.default.BAM_FUNMAP&&(_.flags|=c.default.BAM_FMUNMAP),_.flags&c.default.BAM_FREVERSE&&(v.flags|=c.default.BAM_FMREVERSE),v.flags&c.default.BAM_FREVERSE&&(_.flags|=c.default.BAM_FMREVERSE),v.templateLength===void 0&&(A?(function(S,C,R){const x=(function L(N){const q=[N];if(N.mateRecordNumber!==void 0&&N.mateRecordNumber>=0){const H=S[N.mateRecordNumber];if(!H)throw new l.CramMalformedError("intra-slice mate record not found, this file seems malformed");q.push(...L(H))}return q})(R),T=x.map((L=>L.alignmentStart)),y=x.map((L=>L.alignmentStart+L.readLength-1)),E=Math.max(...y)-Math.min(...T)+1;E>=0&&x.forEach((L=>{if(L.templateLength!==void 0)throw new l.CramMalformedError("mate pair group has some members that have template lengths already, this file seems malformed");L.templateLength=E}))})(f,0,v):(function(S,C){const R=Math.min(S.alignmentStart,C.alignmentStart),x=Math.max(S.alignmentStart+S.readLength-1,C.alignmentStart+C.readLength-1)-R+1;S.templateLength=x,C.templateLength=x})(v,_)),delete v.mateRecordNumber}class g{constructor(b,v,_){this.container=b,this.containerPosition=v,this.file=b.file}getHeader(){return o(this,void 0,void 0,(function*(){const b=yield this.file.getSectionParsers(),v=yield this.container.getHeader(),_=yield this.file.readBlock(v._endPosition+this.containerPosition);if(_===void 0)throw new Error;if(_.contentType==="MAPPED_SLICE_HEADER"){const A=(0,h.parseItem)(_.content,b.cramMappedSliceHeader.parser,0,v._endPosition);return Object.assign(Object.assign({},_),{parsedContent:A})}if(_.contentType==="UNMAPPED_SLICE_HEADER"){const A=(0,h.parseItem)(_.content,b.cramUnmappedSliceHeader.parser,0,v._endPosition);return Object.assign(Object.assign({},_),{parsedContent:A})}throw new l.CramMalformedError(`error reading slice header block, invalid content type ${_.contentType}`)}))}getBlocks(){return o(this,void 0,void 0,(function*(){const b=yield this.getHeader();let v=b._endPosition;const _=new Array(b.parsedContent.numBlocks);for(let A=0;A<_.length;A+=1){const S=yield this.file.readBlock(v);if(S===void 0)throw new Error;_[A]=S,v=_[A]._endPosition}return _}))}getCoreDataBlock(){return o(this,void 0,void 0,(function*(){return(yield this.getBlocks())[0]}))}_getBlocksContentIdIndex(){return o(this,void 0,void 0,(function*(){const b=yield this.getBlocks(),v={};return b.forEach((_=>{_.contentType==="EXTERNAL_DATA"&&(v[_.contentId]=_)})),v}))}getBlockByContentId(b){return o(this,void 0,void 0,(function*(){return(yield this._getBlocksContentIdIndex())[b]}))}getReferenceRegion(){return o(this,void 0,void 0,(function*(){const b=(yield this.getHeader()).parsedContent;if(!(0,d.isMappedSliceHeader)(b))throw new Error;if(b.refSeqId<0)return;const v=yield this.container.getCompressionScheme();if(v===void 0)throw new Error;if(b.refBaseBlockId>=0){const _=yield this.getBlockByContentId(b.refBaseBlockId);if(!_)throw new l.CramMalformedError("embedded reference specified, but reference block does not exist");return{seq:_.data.toString("utf8"),start:b.refSeqStart,end:b.refSeqStart+b.refSeqSpan-1,span:b.refSeqSpan}}if(v.referenceRequired||this.file.fetchReferenceSequenceCallback){if(!this.file.fetchReferenceSequenceCallback)throw new Error("reference sequence not embedded, and seqFetch callback not provided, cannot fetch reference sequence");const _=yield this.file.fetchReferenceSequenceCallback(b.refSeqId,b.refSeqStart,b.refSeqStart+b.refSeqSpan-1);if(_.length!==b.refSeqSpan)throw new l.CramArgumentError("seqFetch callback returned a reference sequence of the wrong length");return{seq:_,start:b.refSeqStart,end:b.refSeqStart+b.refSeqSpan-1,span:b.refSeqSpan}}}))}getAllRecords(){return this.getRecords((()=>!0))}_fetchRecords(){return o(this,void 0,void 0,(function*(){const{majorVersion:b}=yield this.file.getDefinition(),v=yield this.container.getCompressionScheme();if(v===void 0)throw new Error;const _=yield this.getHeader();if(_===void 0)throw new Error;const A=yield this._getBlocksContentIdIndex();if(b>1&&this.file.options.checkSequenceMD5&&(0,d.isMappedSliceHeader)(_.parsedContent)&&_.parsedContent.refSeqId>=0&&_.parsedContent.md5.join("")!=="0000000000000000"){const T=yield this.getReferenceRegion();if(T){const{seq:y,start:E,end:L}=T,N=(0,h.sequenceMD5)(y),q=_.parsedContent.md5.map((H=>(H<16?"0":"")+H.toString(16))).join("");if(N!==q)throw new l.CramMalformedError(`MD5 checksum reference mismatch for ref ${_.parsedContent.refSeqId} pos ${E}..${L}. recorded MD5: ${q}, calculated MD5: ${N}`)}}const S=yield this.getCoreDataBlock(),C={lastAlignmentStart:(0,d.isMappedSliceHeader)(_.parsedContent)?_.parsedContent.refSeqStart:0,coreBlock:{bitPosition:7,bytePosition:0},externalBlocks:{map:new Map,getCursor(T){let y=this.map.get(T);return y===void 0&&(y={bitPosition:7,bytePosition:0},this.map.set(T,y)),y}}},R=T=>{const y=v.getCodecForDataSeries(T);if(!y)throw new l.CramMalformedError(`no codec defined for ${T} data series`);return y.decode(this,S,A,C)};let x=new Array(_.parsedContent.numRecords);for(let T=0;T<x.length;T+=1)try{const y=(0,u.default)(this,R,v,_,S,A,C,b,T);x[T]=new p.default(Object.assign(Object.assign({},y),{uniqueId:_.contentPosition+_.parsedContent.recordCounter+T+1}))}catch(y){if(y instanceof w.CramBufferOverrunError){x=x.filter((E=>!!E));break}throw y}for(let T=0;T<x.length;T+=1){const{mateRecordNumber:y}=x[T];y!==void 0&&y>=0&&m(x,T,x[T],x[y])}return x}))}getRecords(b){return o(this,void 0,void 0,(function*(){const v=this.container.filePosition+this.containerPosition;let _=this.file.featureCache.get(v.toString());_||(_=this._fetchRecords(),this.file.featureCache.set(v.toString(),_));const A=(yield _).filter(b);if(A.length&&this.file.fetchReferenceSequenceCallback){const S=yield this.getHeader();if((0,d.isMappedSliceHeader)(S.parsedContent)&&(S.parsedContent.refSeqId>=0||S.parsedContent.refSeqId===-2)){const C=S.parsedContent.refSeqId>=0?S.parsedContent.refSeqId:void 0,R=yield this.container.getCompressionScheme();if(R===void 0)throw new Error;const x={};for(let T=0;T<A.length;T+=1){const y=C!==void 0?C:A[T].sequenceId;let E=x[y];E||(E={id:y,start:A[T].alignmentStart,end:-1/0,seq:null},x[y]=E);const L=A[T].alignmentStart+(A[T].lengthOnRef||A[T].readLength)-1;L>E.end&&(E.end=L),A[T].alignmentStart<E.start&&(E.start=A[T].alignmentStart)}yield Promise.all(Object.values(x).map((T=>o(this,void 0,void 0,(function*(){T.id!==-1&&T.start<=T.end&&(T.seq=yield this.file.fetchReferenceSequenceCallback(T.id,T.start,T.end
649))})))));for(let T=0;T<A.length;T+=1){const y=x[C!==void 0?C:A[T].sequenceId];if(y&&y.seq){const E=y.seq;A[T].addReferenceSequence(Object.assign(Object.assign({},y),{seq:E}),R)}}}}return A}))}}i.default=g,"getHeader getBlocks _getBlocksContentIdIndex".split(" ").forEach((f=>(0,h.tinyMemoize)(g,f)))},9488:function(n,i,s){var o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(i,"__esModule",{value:!0}),i.sequenceMD5=i.tinyMemoize=i.parseItem=i.parseItf8=i.itf8Size=void 0;const a=o(s(2568)),l=s(1074);i.itf8Size=function(h){return-128&h?-16384&h?-2097152&h?-268435456&h?5:4:3:2:1},i.parseItf8=function(h,c){let u=c;const p=h[u];let d;if(p<128?(d=p,u+=1):p<192?(d=16383&(p<<8|h[u+1]),u+=2):p<224?(d=2097151&(p<<16|h[u+1]<<8|h[u+2]),u+=3):p<240?(d=268435455&(p<<24|h[u+1]<<16|h[u+2]<<8|h[u+3]),u+=4):(d=(15&p)<<28|h[u+1]<<20|h[u+2]<<12|h[u+3]<<4|15&h[u+4],u+=5),u>h.length)throw new l.CramBufferOverrunError("Attempted to read beyond end of buffer; this file seems truncated.");return[d,u-c]},i.parseItem=function(h,c,u=0,p=0){const{offset:d,result:w}=c.parse(h);return Object.assign(Object.assign({},w),{_endPosition:d+p,_size:d-u})},i.tinyMemoize=function(h,c){const u=h.prototype[c],p=`_memo_${c}`;h.prototype[c]=function(){if(!(p in this)){const d=u.call(this);this[p]=d,Promise.resolve(d).catch((()=>{delete this[p]}))}return this[p]}},i.sequenceMD5=function(h){return(0,a.default)(h.toUpperCase().replace(/[^\x21-\x7e]/g,""))}},8577:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CramArgumentError=i.CramSizeLimitError=i.CramMalformedError=i.CramUnimplementedError=i.CramError=void 0;class s extends Error{}i.CramError=s;class o extends Error{}i.CramUnimplementedError=o,i.CramMalformedError=class extends s{},i.CramSizeLimitError=class extends s{},i.CramArgumentError=class extends s{}},5590:function(n,i,s){var o=this&&this.__createBinding||(Object.create?function(d,w,m,g){g===void 0&&(g=m);var f=Object.getOwnPropertyDescriptor(w,m);f&&!("get"in f?!w.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return w[m]}}),Object.defineProperty(d,g,f)}:function(d,w,m,g){g===void 0&&(g=m),d[g]=w[m]}),a=this&&this.__setModuleDefault||(Object.create?function(d,w){Object.defineProperty(d,"default",{enumerable:!0,value:w})}:function(d,w){d.default=w}),l=this&&this.__importStar||function(d){if(d&&d.__esModule)return d;var w={};if(d!=null)for(var m in d)m!=="default"&&Object.prototype.hasOwnProperty.call(d,m)&&o(w,d,m);return a(w,d),w},h=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(i,"__esModule",{value:!0}),i.CramRecord=i.CraiIndex=i.IndexedCramFile=i.CramFile=void 0;const c=l(s(8222));i.CramFile=c.default,Object.defineProperty(i,"CramRecord",{enumerable:!0,get:function(){return c.CramRecord}});const u=h(s(946));i.IndexedCramFile=u.default;const p=h(s(368));i.CraiIndex=p.default},946:function(n,i,s){var o=this&&this.__awaiter||function(c,u,p,d){return new(p||(p=Promise))((function(w,m){function g(v){try{b(d.next(v))}catch(_){m(_)}}function f(v){try{b(d.throw(v))}catch(_){m(_)}}function b(v){var _;v.done?w(v.value):(_=v.value,_ instanceof p?_:new p((function(A){A(_)}))).then(g,f)}b((d=d.apply(c,u||[])).next())}))},a=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(i,"__esModule",{value:!0});const l=s(8577),h=a(s(8222));i.default=class{constructor(c){if(c.cram?this.cram=c.cram:this.cram=new h.default({url:c.cramUrl,path:c.cramPath,filehandle:c.cramFilehandle,seqFetch:c.seqFetch,checkSequenceMD5:c.checkSequenceMD5,cacheSize:c.cacheSize}),!(this.cram instanceof h.default))throw new Error("invalid arguments: no cramfile");if(this.index=c.index,!this.index.getEntriesForRange)throw new Error("invalid arguments: not an index");this.fetchSizeLimit=c.fetchSizeLimit||3e6}getRecordsForRange(c,u,p,d={}){return o(this,void 0,void 0,(function*(){if(d.viewAsPairs=d.viewAsPairs||!1,d.pairAcrossChr=d.pairAcrossChr||!1,d.maxInsertSize=d.maxInsertSize||2e5,typeof c=="string")throw new l.CramUnimplementedError("string sequence names not yet supported");const w=c,m=yield this.index.getEntriesForRange(w,u,p),g=m.map((_=>
649_.sliceBytes)).reduce(((_,A)=>_+A),0);if(g>this.fetchSizeLimit)throw new l.CramSizeLimitError(`data size of ${g.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);const f=_=>_.sequenceId===c&&_.alignmentStart<=p&&_.lengthOnRef!==void 0&&_.alignmentStart+_.lengthOnRef-1>=u,b=yield Promise.all(m.map((_=>this.getRecordsInSlice(_,f))));let v=Array.prototype.concat(...b);if(d.viewAsPairs){const _={},A={};for(let L=0;L<v.length;L+=1){const N=v[L].readName;if(N===void 0)throw new Error;const q=v[L].uniqueId;_[N]||(_[N]=0),_[N]+=1,A[q]=1}const S={};Object.entries(_).forEach((([L,N])=>{N===1&&(S[L]=!0)}));const C=[];for(let L=0;L<v.length;L+=1){const N=v[L],q=N.readName;if(q===void 0)throw new Error;if(S[q]&&N.mate&&(N.mate.sequenceId===w||d.pairAcrossChr)&&Math.abs(N.alignmentStart-N.mate.alignmentStart)<d.maxInsertSize){const H=this.index.getEntriesForRange(N.mate.sequenceId,N.mate.alignmentStart,N.mate.alignmentStart+1);C.push(H)}}const R=yield Promise.all(C);let x=[];for(let L=0;L<R.length;L+=1)x.push(...R[L]);x=x.sort(((L,N)=>L.toString().localeCompare(N.toString()))).filter(((L,N,q)=>!N||L.toString()!==q[N-1].toString()));const T=[],y=x.map((L=>L.sliceBytes)).reduce(((L,N)=>L+N),0);if(y>this.fetchSizeLimit)throw new Error(`mate data size of ${y.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);x.forEach((L=>{let N=this.cram.featureCache.get(L.toString());N||(N=this.getRecordsInSlice(L,(()=>!0)),this.cram.featureCache.set(L.toString(),N));const q=N.then((H=>{const W=[];for(let U=0;U<H.length;U+=1){const k=H[U];if(k.readName===void 0)throw new Error;S[k.readName]&&!A[k.uniqueId]&&W.push(k)}return W}));T.push(q)}));const E=yield Promise.all(T);if(E.length){const L=E.reduce(((N,q)=>N.concat(q)));v=v.concat(L)}}return v}))}getRecordsInSlice({containerStart:c,sliceStart:u,sliceBytes:p},d){return this.cram.getContainerAtPosition(c).getSlice(u,p).getRecords(d)}hasDataForReferenceSequence(c){return this.index.hasDataForReferenceSequence(c)}}},3427:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0}),i.open=i.fromUrl=i.RemoteFile=i.LocalFile=void 0;const a=o(s(8575)),l=s(4319),h=s(2949);function c(u){const{protocol:p,pathname:d}=a.default.parse(u);return p==="file:"?new h.LocalFile(unescape((0,l.ensureNotNullish)(d))):new h.RemoteFile(u)}Object.defineProperty(i,"LocalFile",{enumerable:!0,get:function(){return h.LocalFile}}),Object.defineProperty(i,"RemoteFile",{enumerable:!0,get:function(){return h.RemoteFile}}),i.fromUrl=c,i.open=function(u,p,d){if(d)return d;if(u)return c(u);if(p)return new h.LocalFile(p);throw new Error("no url, path, or filehandle provided, cannot open")}},5702:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RANS_BYTE_L=i.TOTFREQ=i.TF_SHIFT=void 0,i.TF_SHIFT=12,i.TOTFREQ=4096,i.RANS_BYTE_L=8388608},6484:function(n,i,s){var o=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=s(5702),h=o(s(7634));i.default=function(c,u,p,d){let w=c.getInt(),m=c.getInt(),g=c.getInt(),f=c.getInt();const b=d.remaining(),v=-4&b;for(let A=0;A<v;A+=4){const S=u.R[h.default.get(w,l.TF_SHIFT)],C=u.R[h.default.get(m,l.TF_SHIFT)],R=u.R[h.default.get(g,l.TF_SHIFT)],x=u.R[h.default.get(f,l.TF_SHIFT)];d.putAt(A,S),d.putAt(A+1,C),d.putAt(A+2,R),d.putAt(A+3,x),w=h.default.advanceSymbolStep(w,p[255&S],l.TF_SHIFT),m=h.default.advanceSymbolStep(m,p[255&C],l.TF_SHIFT),g=h.default.advanceSymbolStep(g,p[255&R],l.TF_SHIFT),f=h.default.advanceSymbolStep(f,p[255&x],l.TF_SHIFT),w=h.default.renormalize(w,c),m=h.default.renormalize(m,c),g=h.default.renormalize(g,c),f=h.default.renormalize(f,c)}let _;switch(d.setPosition(v),3&b){case 0:break;case 1:_=u.R[h.default.get(w,l.TF_SHIFT)],h.default.advanceSymbol(w,c,p[255&_],l.TF_SHIFT),d.put(_);break;case 2:_=u.R[h.default.get(w,l.TF_SHIFT)],h.default.advanceSymbol(w,c,p[255&_],l.TF_SHIFT),d.put(_),_=u.R[h.default.get(m,l.TF_SHIFT)],h.default.advanceSymbol(m,c,p[255&_],l.TF_SHIFT),d.put(_);break;case 3:_=u.R[h.default.get(w,l.TF_SHIFT)],h.default.advanceSymbol(w,c,p[255&_],l.TF_SHIFT),d.put(_),_=u.R[h.default.get(m,l.TF_SHIFT)],h.default.advanceSymbol(m,c,p[255&_],l.TF_SHIFT),d.put(_),_=u.R[h.default.get(g,l.TF_SHIFT)],h.default.advanceSymbol(g,c,p[255&_],l.TF_SHIFT),d.put(_);break;default:throw new a.CramMalformedError("invalid output size encountered during rANS decoding")}d.setPosition(0)}},7121:function(n,i,s){var o=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(5702),l=o(s(7634));i.default=function(h,c,u,p){const d=c.remaining();let w=h.getInt(),m=h.getInt(),g=h.getInt(),f=h.getInt();const b=d>>2;let v=0,_=b,A=2*b,S=3*b,C=0,R=0,x=0,T=0;for(;v<b;v+=1,_+=1,A+=1,S+=1){const y=255&u[C].R[l.default.get(w,a.TF_SHIFT)],E=255&u[R].R[l.default.get(m,a.TF_SHIFT)],L=255&u[x].R[l.default.get(g,a.TF_SHIFT)],N=255&u[T].R[l.default.get(f,a.TF_SHIFT)];c.putAt(v,y),c.putAt(_,E),c.putAt(A,L),c.putAt(S,N),w=l.default.advanceSymbolStep(w,p[C][y],a.TF_SHIFT),m=l.default.advanceSymbolStep(m,p[R][E],a.TF_SHIFT),g=l.default.advanceSymbolStep(g,p[x][L],a.TF_SHIFT),f=l.default.advanceSymbolStep(f,p[T][N],a.TF_SHIFT),w=l.default.renormalize(w,h),m=l.default.renormalize(m,h),g=l.default.renormalize(g,h),f=l.default.renormalize(f,h),C=y,R=E,x=L,T=N}for(;S<d;S+=1){const y=255&u[T].R[l.default.get(f,a.TF_SHIFT)];c.putAt(S,y),f=l.default.advanceSymbol(f,h,p[T][y],a.TF_SHIFT),T=y}}},7634:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0});const o=s(8577),a=s(5702);class l{constructor(){this.F=void 0,this.C=void 0}}function h(u,p,d,w){return d*(u>>w)+(u&(1<<w)-1)-p}const c={FC:l,AriDecoder:class{constructor(){this.fc=new Array(256);for(let u=0;u<this.fc.length;u+=1)this.fc[u]=new l;this.R=null}},Symbol:class{constructor(){this.start=void 0,this.freq=void 0}},symbolInit:function(u,p,d){if(!(p<=65536))throw new o.CramMalformedError("assertion failed: start <= 1<<16");if(!(d<=65536-p))throw new o.CramMalformedError("assertion failed: freq <= 1<<16");u.start=p,u.freq=d},advanceStep:h,advanceSymbolStep:function(u,p,d){return h(u,p.start,p.freq,d)},get:function(u,p){return u&(1<<p)-1}
649,advanceSymbol:function(u,p,d,w){return(function(m,g,f,b,v){if((m=b*(m>>v)+(m&(1<<v)-1)-f)<a.RANS_BYTE_L)do m=m<<8|255&g.get();while(m<a.RANS_BYTE_L);return m})(u,p,d.start,d.freq,w)},renormalize:function(u,p){if(u<a.RANS_BYTE_L)do u=u<<8|255&p.get();while(u<a.RANS_BYTE_L);return u}};i.default=c},696:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0}),i.readStatsO1=i.readStatsO0=void 0;const a=s(8577),l=s(5702),h=o(s(7634));function c(u){if(!u)throw new a.CramMalformedError("assertion failed")}i.readStatsO0=function(u,p,d){let w=0,m=0,g=255&u.get();do p.fc[g]==null&&(p.fc[g]=new h.default.FC),p.fc[g].F=255&u.get(),p.fc[g].F>=128&&(p.fc[g].F&=-129,p.fc[g].F=(127&p.fc[g].F)<<8|255&u.get()),p.fc[g].C=m,h.default.symbolInit(d[g],p.fc[g].C,p.fc[g].F),p.R||(p.R=new Array(l.TOTFREQ)),p.R.fill(g,m,m+p.fc[g].F),m+=p.fc[g].F,w===0&&g+1===(255&u.getByteAt(u.position()))?(g=255&u.get(),w=255&u.get()):w!==0?(w-=1,g+=1):g=255&u.get();while(g!==0);c(m<l.TOTFREQ)},i.readStatsO1=function(u,p,d){let w=0,m=255&u.get();do{let g=0,f=0,b=255&u.get();p[m]==null&&(p[m]=new h.default.AriDecoder);do p[m].fc[b]==null&&(p[m].fc[b]=new h.default.FC),p[m].fc[b].F=255&u.get(),p[m].fc[b].F>=128&&(p[m].fc[b].F&=-129,p[m].fc[b].F=(127&p[m].fc[b].F)<<8|255&u.get()),p[m].fc[b].C=f,p[m].fc[b].F===0&&(p[m].fc[b].F=l.TOTFREQ),d[m][b]==null&&(d[m][b]=new h.default.RansDecSymbol),h.default.symbolInit(d[m][b],p[m].fc[b].C,p[m].fc[b].F),p[m].R==null&&(p[m].R=new Array(l.TOTFREQ)),p[m].R.fill(b,f,f+p[m].fc[b].F),f+=p[m].fc[b].F,c(f<=l.TOTFREQ),g===0&&b+1===(255&u.getByteAt(u.position()))?(b=255&u.get(),g=255&u.get()):g!==0?(g-=1,b+=1):b=255&u.get();while(b!==0);w===0&&m+1===(255&u.getByteAt(u.position()))?(m=255&u.get(),w=255&u.get()):w!==0?(w-=1,m+=1):m=255&u.get()}while(m!==0)}},9675:function(n,i,s){var o=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8577),l=o(s(7634)),h=s(696),c=o(s(6484)),u=o(s(7121));class p{constructor(w,m=0){this._buffer=w,this._position=m,this.length=w.length}get(){const w=this._buffer[this._position];return this._position+=1,w}getByte(){return this.get()}getByteAt(w){return this._buffer[w]}position(){return this._position}put(w){return this._buffer[this._position]=w,this._position+=1,w}putAt(w,m){return this._buffer[w]=m,m}setPosition(w){return this._position=w,w}getInt(){const w=this._buffer.readInt32LE(this._position);return this._position+=4,w}remaining(){return this._buffer.length-this._position}}i.default=function(d,w,m=0){if(d.length===0)return w.fill(0),w;const g=new p(d,m),f=g.get();if(f!==0&&f!==1)throw new a.CramMalformedError(`Invalid rANS order ${f}`);if(g.getInt()!==g.remaining()-4)throw new a.CramMalformedError("Incorrect input length.");const b=g.getInt(),v=new p(w||Buffer.allocUnsafe(b));if(v.length<b)throw new a.CramMalformedError(`Output buffer too small to fit ${b} bytes.`);switch(f){case 0:return(function(_,A){const S=new l.default.AriDecoder,C=new Array(256);for(let R=0;R<C.length;R+=1)C[R]=new l.default.Symbol;return(0,h.readStatsO0)(_,S,C),(0,c.default)(_,S,C,A),A})(g,v);case 1:return(function(_,A){const S=new Array(256);for(let R=0;R<S.length;R+=1)S[R]=new l.default.AriDecoder;const C=new Array(256);for(let R=0;R<C.length;R+=1){C[R]=new Array(256);for(let x=0;x<C[R].length;x+=1)C[R][x]=new l.default.Symbol}return(0,h.readStatsO1)(_,S,C),(0,u.default)(_,A,S,C),A})(g,v);default:throw new a.CramMalformedError(`Invalid rANS order: ${f}`)}}},7578:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.parseHeaderText=void 0,i.parseHeaderText=function(s){const o=s.split(/\r?\n/),a=[];return o.forEach((l=>{const[h,...c]=l.split(/\t/),u=c.map((p=>{const[d,w]=p.split(":",2);return{tag:d,value:w}}));h&&a.push({tag:h.substr(1),data:u})})),a}},4319:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ensureNotNullish=void 0,i.ensureNotNullish=function(s){if(s==null)throw new Error("Value must not be nullish.");return s}},597:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.unzip=void 0;const o=s(9591);i.unzip=function(a){return Buffer.from((0,o.inflate)(a))}},9996:(n,i,s)=>{function o(f){return o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},o(f)}var a=s(8764).Buffer,l=s(22),h=s(2961)._,c=s(3720);typeof window<"u"&&(window.Buffer=a),typeof self<"u"&&(self.Buffer=a);var u={UInt8:1,UInt16LE:2,UInt16BE:2,UInt32LE:4,UInt32BE:4,Int8:1,Int16LE:2,Int16BE:2,Int32LE:4,Int32BE:4,FloatLE:4,FloatBE:4,DoubleLE:8,DoubleBE:8,UInt64:8,Int64:8},p={},d="___parser_",w=[];(function(){var f;for(f=1;f<=32;f++)w.push(f)})();var m={};Object.keys(u).concat(Object.keys({String:null,Buffer:null,Array:null,Skip:null,Choice:null,Nest:null,Bit:null,Itf8:null,Ltf8:null}
649)).forEach((function(f){m[f.toLowerCase()]=f}));var g=function(){this.varName="",this.type="",this.options={},this.next=null,this.head=null,this.compiled=null,this.endian="le",this.constructorFn=null,this.alias=null};g.start=function(){return new g},Object.keys(u).forEach((function(f){g.prototype[f.toLowerCase()]=function(v,_){return this.setNextParser(f.toLowerCase(),v,_)};var b=f.replace(/BE|LE/,"").toLowerCase();b in g.prototype||(g.prototype[b]=function(v,_){return this[b+this.endian](v,_)})})),w.forEach((function(f){g.prototype["bit".concat(f.toString())]=function(b,v){return v||(v={}),v.length=f,this.setNextParser("bit",b,v)}})),g.prototype.namely=function(f){return p[f]=this,this.alias=f,this},g.prototype.skip=function(f,b){if(b&&b.assert)throw new Error("assert option on skip is not allowed.");return this.setNextParser("skip","",{length:f})},g.prototype.string=function(f,b){if(!b.zeroTerminated&&!b.length&&!b.greedy)throw new Error("Neither length, zeroTerminated, nor greedy is defined for string.");if((b.zeroTerminated||b.length)&&b.greedy)throw new Error("greedy is mutually exclusive with length and zeroTerminated for string.");if(b.stripNull&&!b.length&&!b.greedy)throw new Error("Length or greedy must be defined if stripNull is defined.");return b.encoding=b.encoding||"utf8",this.setNextParser("string",f,b)},g.prototype.buffer=function(f,b){if(!b.length&&!b.readUntil)throw new Error("Length nor readUntil is defined in buffer parser");return this.setNextParser("buffer",f,b)},g.prototype.array=function(f,b){if(!b.readUntil&&!b.length&&!b.lengthInBytes)throw new Error("Length option of array is not defined.");if(!b.type)throw new Error("Type option of array is not defined.");if(typeof b.type=="string"&&!p[b.type]&&Object.keys(u).indexOf(m[b.type])<0)throw new Error('Specified primitive type "'.concat(b.type,'" is not supported.'));return this.setNextParser("array",f,b)},g.prototype.choice=function(f,b){if(arguments.length===1&&o(f)==="object"&&(b=f,f=null),!b.tag)throw new Error("Tag option of array is not defined.");if(!b.choices)throw new Error("Choices option of array is not defined.");return Object.keys(b.choices).forEach((function(v){if(!b.choices[v])throw new Error("Choice Case ".concat(v," of ").concat(f," is not valid."));if(typeof b.choices[v]=="string"&&!p[b.choices[v]]&&Object.keys(u).indexOf(m[b.choices[v]])<0)throw new Error('Specified primitive type "'.concat(b.choices[v],'" is not supported.'))}),this),this.setNextParser("choice",f,b)},g.prototype.nest=function(f,b){if(arguments.length===1&&o(f)==="object"&&(b=f,f=null),!b.type)throw new Error("Type option of nest is not defined.");if(!(b.type instanceof g||p[b.type]))throw new Error("Type option of nest must be a Parser object.");if(!(b.type instanceof g||f))throw new Error("options.type must be a object if variable name is omitted.");return this.setNextParser("nest",f,b)},g.prototype.endianess=function(f){switch(f.toLowerCase()){case"little":this.endian="le";break;case"big":this.endian="be";break;default:throw new Error("Invalid endianess: ".concat(f))}return this},g.prototype.create=function(f){if(!(f instanceof Function))throw new Error("Constructor must be a Function object.");return this.constructorFn=f,this},g.prototype.getCode=function(){var f=new h;return f.pushCode("if (!Buffer.isBuffer(buffer)) {"),f.generateError('"argument buffer is not a Buffer object"'),f.pushCode("}"),this.alias?this.addAliasedCode(f):this.addRawCode(f),this.alias?f.pushCode("return {0}(0)",d+this.alias):f.pushCode("return { offset: offset, result: vars };"),f.code},g.prototype.addRawCode=function(f){f.pushCode("var offset = 0;"),this.constructorFn?f.pushCode("var vars = new constructorFn();"):f.pushCode("var vars = {};"),this.generate(f),this.resolveReferences(f),f.pushCode("return { offset: offset, result: vars };")},g.prototype.addAliasedCode=function(f){return f.pushCode("function {0}(offset) {",d+this.alias),this.constructorFn?f.pushCode("var vars = new constructorFn();"):f.pushCode("var vars = {};"),this.generate(f),f.markResolved(this.alias),this.resolveReferences(f),f.pushCode("return { offset: offset, result: vars };"),f.pushCode("}"),f},g.prototype.resolveReferences=function(f){var b=f.getUnresolvedReferences();f.markRequested(b),b.forEach((function(v){p[v].addAliasedCode(f)}))},g.prototype.compile=function(){var f="(function(buffer, constructorFn, Long) { ".concat(this.getCode()," })");this.compiled=l.runInThisContext(f)},g.prototype.sizeOf=function(){var f=NaN;if(Object.keys(u).indexOf(this.type)>=0)f=u[this.type];
649else if(this.type==="String"&&typeof this.options.length=="number")f=this.options.length;else if(this.type==="Buffer"&&typeof this.options.length=="number")f=this.options.length;else if(this.type==="Array"&&typeof this.options.length=="number"){var b=NaN;typeof this.options.type=="string"?b=u[m[this.options.type]]:this.options.type instanceof g&&(b=this.options.type.sizeOf()),f=this.options.length*b}else this.type==="Skip"?f=this.options.length:this.type==="Nest"?f=this.options.type.sizeOf():this.type||(f=0);return this.next&&(f+=this.next.sizeOf()),f},g.prototype.parse=function(f){return this.compiled||this.compile(),this.compiled(f,this.constructorFn,c)},g.prototype.setNextParser=function(f,b,v){var _=new g;return _.type=m[f],_.varName=b,_.options=v||_.options,_.endian=this.endian,this.head?this.head.next=_:this.next=_,this.head=_,this},g.prototype.generate=function(f){this.type&&(this["generate".concat(this.type)](f),this.generateAssert(f));var b=f.generateVariable(this.varName);return this.options.formatter&&this.generateFormatter(f,b,this.options.formatter),this.generateNext(f)},g.prototype.generateAssert=function(f){if(this.options.assert){var b=f.generateVariable(this.varName);switch(o(this.options.assert)){case"function":f.pushCode("if (!({0}).call(vars, {1})) {",this.options.assert,b);break;case"number":f.pushCode("if ({0} !== {1}) {",this.options.assert,b);break;case"string":f.pushCode('if ("{0}" !== {1}) {',this.options.assert,b);break;default:throw new Error("Assert option supports only strings, numbers and assert functions.")}f.generateError('"Assert error: {0} is " + {0}',b),f.pushCode("}")}},g.prototype.generateNext=function(f){return this.next&&(f=this.next.generate(f)),f},Object.keys(u).forEach((function(f){g.prototype["generate".concat(f)]=function(b){f==="UInt64"?b.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), true, this.endian === 'le').toNumber();",b.generateVariable(this.varName),f):f==="Int64"?b.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), false, this.endian === 'le').toNumber();",b.generateVariable(this.varName),f):b.pushCode("{0} = buffer.read{1}(offset);",b.generateVariable(this.varName),f),b.pushCode("offset += {0};",u[f])}})),g.prototype.generateBit=function(f){var b=JSON.parse(JSON.stringify(this));if(b.varName=f.generateVariable(b.varName),f.bitFields.push(b),!this.next||this.next&&["Bit","Nest"].indexOf(this.next.type)<0){var v=0;f.bitFields.forEach((function(x){v+=x.options.length}));var _=f.generateTmpVariable();if(v<=8)f.pushCode("var {0} = buffer.readUInt8(offset);",_),v=8;else if(v<=16)f.pushCode("var {0} = buffer.readUInt16BE(offset);",_),v=16;else if(v<=24){var A=f.generateTmpVariable(),S=f.generateTmpVariable();f.pushCode("var {0} = buffer.readUInt16BE(offset);",A),f.pushCode("var {0} = buffer.readUInt8(offset + 2);",S),f.pushCode("var {2} = ({0} << 8) | {1};",A,S,_),v=24}else{if(!(v<=32))throw new Error("Currently, bit field sequence longer than 4-bytes is not supported.");f.pushCode("var {0} = buffer.readUInt32BE(offset);",_),v=32}f.pushCode("offset += {0};",v/8);var C=0,R=this.endian==="be";f.bitFields.forEach((function(x){f.pushCode("{0} = {1} >> {2} & {3};",x.varName,_,R?v-C-x.options.length:C,(1<<x.options.length)-1),C+=x.options.length})),f.bitFields=[]}},g.prototype.generateSkip=function(f){var b=f.generateOption(this.options.length);f.pushCode("offset += {0};",b)},g.prototype.generateString=function(f){var b=f.generateVariable(this.varName),v=f.generateTmpVariable();this.options.length&&this.options.zeroTerminated?(f.pushCode("var {0} = offset;",v),f.pushCode("while(buffer.readUInt8(offset++) !== 0 && offset - {0} < {1});",v,this.options.length),f.pushCode("{0} = buffer.toString('{1}', {2}, offset - {2} < {3} ? offset - 1 : offset);",b,this.options.encoding,v,this.options.length)):this.options.length?(f.pushCode("{0} = buffer.toString('{1}', offset, offset + {2});",b,this.options.encoding,f.generateOption(this.options.length)),f.pushCode("offset += {0};",f.generateOption(this.options.length))):this.options.zeroTerminated?(f.pushCode("var {0} = offset;",v),f.pushCode("while(buffer.readUInt8(offset++) !== 0);"),f.pushCode("{0} = buffer.toString('{1}', {2}, offset - 1);",b,this.options.encoding,v)):this.options.greedy&&(f.pushCode("var {0} = offset;",v),f.pushCode("while(buffer.length > offset++);"),f.pushCode("{0} = buffer.toString('{1}', {2}, offset);
649",b,this.options.encoding,v)),this.options.stripNull&&f.pushCode("{0} = {0}.replace(/\\x00+$/g, '')",b)},g.prototype.generateBuffer=function(f){this.options.readUntil==="eof"?f.pushCode("{0} = buffer.slice(offset);",f.generateVariable(this.varName)):(f.pushCode("{0} = buffer.slice(offset, offset + {1});",f.generateVariable(this.varName),f.generateOption(this.options.length)),f.pushCode("offset += {0};",f.generateOption(this.options.length))),this.options.clone&&f.pushCode("{0} = Buffer.from({0});",f.generateVariable(this.varName))},g.prototype.generateArray=function(f){var b=f.generateOption(this.options.length),v=f.generateOption(this.options.lengthInBytes),_=this.options.type,A=f.generateTmpVariable(),S=f.generateVariable(this.varName),C=f.generateTmpVariable(),R=this.options.key,x=typeof R=="string";if(x?f.pushCode("{0} = {};",S):f.pushCode("{0} = [];",S),typeof this.options.readUntil=="function"?f.pushCode("do {"):this.options.readUntil==="eof"?f.pushCode("for (var {0} = 0; offset < buffer.length; {0}++) {",A):v!==void 0?f.pushCode("for (var {0} = offset; offset - {0} < {1}; ) {",A,v):f.pushCode("for (var {0} = 0; {0} < {1}; {0}++) {",A,b),typeof _=="string")if(p[_]){var T=f.generateTmpVariable();f.pushCode("var {0} = {1}(offset);",T,d+_),f.pushCode("var {0} = {1}.result; offset = {1}.offset;",C,T),_!==this.alias&&f.addReference(_)}else f.pushCode("var {0} = buffer.read{1}(offset);",C,m[_]),f.pushCode("offset += {0};",u[m[_]]);else _ instanceof g&&(f.pushCode("var {0} = {};",C),f.pushScope(C),_.generate(f),f.popScope());x?f.pushCode("{0}[{2}.{1}] = {2};",S,R,C):f.pushCode("{0}.push({1});",S,C),f.pushCode("}"),typeof this.options.readUntil=="function"&&f.pushCode(" while (!({0}).call(this, {1}, buffer.slice(offset)));",this.options.readUntil,C)},g.prototype.generateChoiceCase=function(f,b,v){if(typeof v=="string")if(p[v]){var _=f.generateTmpVariable();f.pushCode("var {0} = {1}(offset);",_,d+v),f.pushCode("{0} = {1}.result; offset = {1}.offset;",f.generateVariable(this.varName),_),v!==this.alias&&f.addReference(v)}else f.pushCode("{0} = buffer.read{1}(offset);",f.generateVariable(this.varName),m[v]),f.pushCode("offset += {0};",u[m[v]]);else v instanceof g&&(f.pushPath(b),v.generate(f),f.popPath(b))},g.prototype.generateChoice=function(f){var b=f.generateOption(this.options.tag);this.varName&&f.pushCode("{0} = {};",f.generateVariable(this.varName)),f.pushCode("switch({0}) {",b),Object.keys(this.options.choices).forEach((function(v){var _=this.options.choices[v];Number.isNaN(parseInt(v,10))?f.pushCode("case '{0}':",v):f.pushCode("case {0}:",v),this.generateChoiceCase(f,this.varName,_),f.pushCode("break;")}),this),f.pushCode("default:"),this.options.defaultChoice?this.generateChoiceCase(f,this.varName,this.options.defaultChoice):f.generateError('"Met undefined tag value " + {0} + " at choice"',b),f.pushCode("}")},g.prototype.generateNest=function(f){var b=f.generateVariable(this.varName);if(this.options.type instanceof g)this.varName&&f.pushCode("{0} = {};",b),f.pushPath(this.varName),this.options.type.generate(f),f.popPath(this.varName);else if(p[this.options.type]){var v=f.generateTmpVariable();f.pushCode("var {0} = {1}(offset);",v,d+this.options.type),f.pushCode("{0} = {1}.result; offset = {1}.offset;",b,v),this.options.type!==this.alias&&f.addReference(this.options.type)}},g.prototype.generateFormatter=function(f,b,v){typeof v=="function"&&f.pushCode("{0} = ({1}).call(this, {0});",b,v)},g.prototype.isInteger=function(){return!!this.type.match(/U?Int[8|16|32][BE|LE]?|Bit\d+/)},g.prototype.itf8=function(f,b){return this.setNextParser("itf8",f,b)},g.prototype.itf8=function(f,b){return this.setNextParser("itf8",f,b)},g.prototype.generateItf8=function(f){var b=f.generateVariable(this.varName),v=f.generateTmpVariable();f.pushCode(` 650 var `.concat(v,` = buffer[offset]; 651 if (`).concat(v,` < 0x80) { 652 `).concat(b," = ").concat(v,`; 653 offset += 1; 654 } else if (`).concat(v,` < 0xc0) { 655 `).concat(b," = ((").concat(v,`<<8) | buffer[offset+1]) & 0x3fff; 656 offset += 2; 657 } else if (`).concat(v,` < 0xe0) { 658 `).concat(b," = ((").concat(v,`<<16) | (buffer[offset+1]<< 8) | buffer[offset+2]) & 0x1fffff; 659 offset += 3; 660 } else if (`).concat(v,` < 0xf0) { 661 `).concat(b," = ((").concat(v,`<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff; 662 offset += 4 663 } else { 664 `).concat(b," = ((").concat(v,` & 0x0f)<<28) | (buffer[offset+1]<<20) | (buffer[offset+2]<<12) | (buffer[offset+3]<<4) | (buffer[offset+4] & 0x0f); 665 // x=((0xff & 0x0f)<<28) | (0xff<<20) | (0xff<<12) | (0xff<<4) | (0x0f & 0x0f); 666 // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1; 667 offset += 5 668 } 669 `))},g.prototype.ltf8=function(f,b){return this.setNextParser("ltf8",f,b)},g.prototype.generateLtf8=function(f){var b=f.generateVariable(this.varName),v=f.generateTmpVariable();f.pushCode(` 670 var `.concat(v,` = buffer[offset]; 671 if (`).concat(v,` < 0x80) { 672 `).concat(b," = ").concat(v,`; 673 offset += 1; 674 } else if (`).concat(v,` < 0xc0) { 675 `).concat(b,` = ((buffer[offset]<<8) | buffer[offset+1]) & 0x3fff; 676 offset += 2; 677 } else if (`).concat(v,` < 0xe0) { 678 `).concat(b,` = ((buffer[offset]<<16) | (buffer[offset+1]<<8) | buffer[offset+2]) & 0x1fffff; 679 `).concat(b," = (((").concat(v,` & 63) << 16) | buffer.readUInt16LE(offset + 1)); 680 offset += 3; 681 } else if (`).concat(v,` < 0xf0) { 682 `).concat(b,` = ((buffer[offset]<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff; 683 offset += 4; 684 } else if (`).concat(v,` < 0xf8) { 685 `).concat(b,` = (((buffer[offset] & 15) * Math.pow(2,32))) + 686 (buffer[offset+1]<<24) | (buffer[offset+2]<<16 | buffer[offset+3]<<8 | buffer[offset+4]) 687 // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1; 688 offset += 5; 689 } else if (`).concat(v,` < 0xfc) { 690 `).concat(b,` = ((((buffer[offset] & 7) << 8) | buffer[offset+1] )) * Math.pow(2,32) + 691 (buffer[offset+2]<<24) | (buffer[offset+3]<<16 | buffer[offset+4]<<8 | buffer[offset+5]) 692 offset += 6; 693 } else if (`).concat(v,` < 0xfe) { 694 `).concat(b,` = ((((buffer[offset] & 3) << 16) | buffer[offset+1]<<8 | buffer[offset+2])) * Math.pow(2,32) + 695 (buffer[offset+3]<<24) | (buffer[offset+4]<<16 | buffer[offset+5]<<8 | buffer[offset+6]) 696 offset += 7; 697 } else if (`).concat(v,` < 0xff) { 698 `).concat(b,` = Long.fromBytesBE(buffer.slice(offset+1,offset+8)); 699 if (`).concat(b,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(b,`.lessThan(Number.MIN_SAFE_INTEGER)) 700 throw new Error('integer overflow') 701 `).concat(b," = ").concat(b,`.toNumber() 702 offset += 8; 703 } else { 704 `).concat(b,` = Long.fromBytesBE(buffer.slice(offset+1,offset+9)); 705 if (`).concat(b,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(b,`.lessThan(Number.MIN_SAFE_INTEGER)) 706 throw new Error('integer overflow') 707 `).concat(b," = ").concat(b,`.toNumber() 708 offset += 9; 709 } 710 `))},i.Parser=g},2961:(n,i)=>{function s(a){return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},s(a)}
710var o=function(){this.code="",this.scopes=[["vars"]],this.isAsync=!1,this.bitFields=[],this.tmpVariableCount=0,this.references={}};o.prototype.generateVariable=function(a){var l=[];for(Array.prototype.push.apply(l,this.scopes[this.scopes.length-1]);/^\$parent\./.test(a);)l.pop(),a=a.replace(/^\$parent\./,"");return a&&l.push(a),l.join(".")},o.prototype.generateOption=function(a){switch(s(a)){case"number":return a.toString();case"string":return this.generateVariable(a);case"function":return"(".concat(a,").call(").concat(this.generateVariable(),", vars)");default:return}},o.prototype.generateError=function(){var a=Array.prototype.slice.call(arguments),l=o.interpolate.apply(this,a);this.isAsync?this.pushCode("return process.nextTick(function() { callback(new Error(".concat(l,"), vars); });")):this.pushCode("throw new Error(".concat(l,");"))},o.prototype.generateTmpVariable=function(){return"$tmp".concat(this.tmpVariableCount++)},o.prototype.pushCode=function(){var a=Array.prototype.slice.call(arguments);this.code+="".concat(o.interpolate.apply(this,a),` 711`)},o.prototype.pushPath=function(a){a&&this.scopes[this.scopes.length-1].push(a)},o.prototype.popPath=function(a){a&&this.scopes[this.scopes.length-1].pop()},o.prototype.pushScope=function(a){this.scopes.push([a])},o.prototype.popScope=function(){this.scopes.pop()},o.prototype.addReference=function(a){this.references[a]||(this.references[a]={resolved:!1,requested:!1})},o.prototype.markResolved=function(a){this.references[a].resolved=!0},o.prototype.markRequested=function(a){a.forEach(function(l){this.references[l].requested=!0}.bind(this))},o.prototype.getUnresolvedReferences=function(){var a=this.references;return Object.keys(this.references).filter((function(l){return!a[l].resolved&&!a[l].requested}))},o.interpolate=function(a){var l=a.match(/{\d+}/g),h=Array.prototype.slice.call(arguments,1);return l&&l.forEach((function(c){var u=parseInt(c.substr(1,c.length-2),10);a=a.replace(c,h[u].toString())})),a},i._=o},22:n=>{n.exports.runInThisContext=function(i){return new Function("code","return eval(code);").call(globalThis,i)}},445:(n,i,s)=>{const o=s(7381),a=s(9260),l=s(576),h=s(4693),c=128;n.exports=class{decode(u){return this.stream=new a(u),this.decodeStream(this.stream)}decodeStream(u,p=0){var d=this.stream.ReadByte();16&d||(p=this.stream.ReadUint7());var w,m=p,g=1&d;if(8&d)return this.decodeStripe(this.stream,p);if(d&c&&([w,m]=this.decodePackMeta(this.stream)),32&d)var f=this.decodeCat(this.stream,m);else f=4&d?this.decodeExt(this.stream,m):64&d?g?this.decodeRLE1(this.stream,m):this.decodeRLE0(this.stream,m):g?this.decode1(this.stream,m):this.decode0(this.stream,m);return d&c&&(f=this.decodePack(f,w,p)),f}encode(u,p){if(this.stream=new a("",0,1.1*u.length+100),this.stream.WriteByte(p),16&p||this.stream.WriteUint7(u.length),8&p)return Buffer.concat([this.stream.buf.slice(0,this.stream.pos),this.encodeStripe(this.stream,u,p>>8)]);var d,w=1&p,m=u.length;return p&c&&([d,u,m]=this.encodePack(u)),p&c&&this.stream.WriteStream(d),64&p?w?this.encodeRLE1(u,m,this.stream):this.encodeRLE0(u,m,this.stream):w?this.encode1(u,m,this.stream):this.encode0(u,m,this.stream)}decode0(u,p){var d=new Buffer.allocUnsafe(p),w=u.ReadByte();w==0&&(w=256);var m=new l(w),g=new o(u);g.RangeStartDecode(u);for(var f=0;f<p;f++)d[f]=m.ModelDecode(u,g);return d}encode0(u,p,d){for(var w=0,m=0;m<p;m++)w<u[m]&&(w=u[m]);w++;var g=new l(w);d.WriteByte(w);var f=new o(d);for(m=0;m<p;m++)g.ModelEncode(d,f,u[m]);return f.RangeFinishEncode(d),d.buf.slice(0,d.pos)}decode1(u,p){var d=new Buffer.allocUnsafe(p),w=u.ReadByte();w==0&&(w=256);for(var m=new Array(w),g=0;g<w;g++)m[g]=new l(w);var f=new o(u);f.RangeStartDecode(u);var b=0;for(g=0;g<p;g++)d[g]=m[b].ModelDecode(u,f),b=d[g];return d}encode1(u,p,d){for(var w=0,m=0;m<p;m++)w<u[m]&&(w=u[m]);w++;var g=new Array(w);for(m=0;m<w;m++)g[m]=new l(w);d.WriteByte(w);var f=new o(d),b=0;for(m=0;m<p;m++)g[b].ModelEncode(d,f,u[m]),b=u[m];return f.RangeFinishEncode(d),d.buf.slice(0,d.pos)}decodeExt(u,p){var d=new Buffer.allocUnsafe(p),w=h.array(u.buf.slice(u.pos)),m=h.header(w),g=0;do{var f=h.decompress(w,m);f!=-1&&(Buffer.from(f).copy(d,g),g+=f.length,m-=f.length)}while(f!=-1);return d}encodeExt(u,p){}decodeRLE0(u,p){var d=new Buffer.allocUnsafe(p),w=u.ReadByte();w==0&&(w=256);for(var m=new l(w),g=new Array(258),f=0;f<=257;f++)g[f]=new l(4);var b=new o(u);for(b.RangeStartDecode(u),f=0;f<p;){d[f]=m.ModelDecode(u,b);for(var v=g[d[f]].ModelDecode(u,b),_=v,A=256;v==3;)v=g[A].ModelDecode(u,b),A=257,_+=v;for(var S=1;S<=_;S++)d[f+S]=d[f];f+=_+1}return d}encodeRLE0(u,p,d){for(var w=0,m=0;m<p;m++)w<u[m]&&(w=u[m]);w++;var g=new l(w),f=new Array(258);for(m=0;m<=257;m++)f[m]=new l(4);d.WriteByte(w);var b=new o(d);for(m=0;m<p;){g.ModelEncode(d,b,u[m]);for(var v=1;m+v<p&&u[m+v]==u[m];)v++;v--;var _=u[m];u[m],m+=v+1;var A=v>=3?3:v;for(f[_].ModelEncode(d,b,A),v-=A,_=256;A==3;)A=v>=3?3:v,f[_].ModelEncode(d,b,A),_=257,v-=A}return b.RangeFinishEncode(d),d.buf.slice(0,d.pos)}decodeRLE1(u,p){var d=new Buffer.allocUnsafe(p),w=u.ReadByte();w==0&&(w=256);for(var m=new Array(w),g=0;g<w;g++)m[g]=new l(w);var f=new Array(258);for(g=0;g<=257;g++)f[g]=new l(4);var b=new o(u);b.RangeStartDecode(u);var v=0;for(g=0;g<p;){d[g]=m[v].ModelDecode(u,b),v=d[g];for(var _=f[d[g]].ModelDecode(u,b),A=_,S=256;_==3;)_=f[S].ModelDecode(u,b),S=257,A+=_;for(var C=1;C<=A;C++)d[g+C]=d[g];g+=A+1}return d}encodeRLE1(u,p,d){for(var w=0,m=0;m<p;m++)w<u[m]&&(w=u[m]);w++;var g=new Array(w);for(m=0;m<w;m++)g[m]=new l(w);var f=new Array(258);for(m=0;m<=257;m++)f[m]=new l(4);d.WriteByte(w);for(var b=new o(d),v=(m=0,0);m<p;){g[v].ModelEncode(d,b,u[m]);for(var _=1;m+_<p&&u[m+_]==u[m];)_++;_--;var A=u[m];v=u[m],m+=_+1;var S=_>=3?3:_;for(f[A].ModelEncode(d,b,S),_-=S,A=256;S==3;)S=_>=3?3:_,f[A].ModelEncode(d,b,S),A=257,_-=S}return b.RangeFinishEncode(d),d.buf.slice(0,d.pos)}decodePackMeta(u){this.nsym=u.ReadByte();for(var p=new Array(this.nsym),d=0;d<this.nsym;d++)p[d]=u.ReadByte();return[p,u.ReadUint7()]}decodePack(u,p,d){var w=new Buffer.allocUnsafe(d);if(this.nsym<=1)for(var m=0;m<d;m++)w[m]=p[0];else if(this.nsym<=2){m=0;for(var g=0;m<d;m++){if(m%8==0)var f=u[g++];w[m]=p[1&f],f>>=1}}else if(this.nsym<=4)for(m=0,g=0;m<d;m++)m%4==0&&(f=u[g++]),w[m]=p[3&f],f>>=2;else{if(!(this.nsym<=16))return u;for(m=0,g=0;m<d;m++)m%2==0&&(f=u[g++]),w[m]=p[15&f],f>>=4}return w}packMeta(u){for(var p=new a("",0,1024),d=new Array(256),w=0;w<u.length;w++)d[u[w]]=1;var m=0;for(w=0;w<256;w++)d[w]&&(d[w]=++m);for(p.WriteByte(m),w=0;w<256;w++)d[w]&&(p.WriteByte(w),d[w]--);return[p,d,m]}encodePack(u){var p,d,w;[p,d,w]=this.packMeta(u);var m=u.length,g=0;if(w<=1)return p.WriteUint7(0),[p,new Buffer.allocUnsafe(0),0];if(w<=2){for(var f=new Buffer.allocUnsafe(Math.floor((m+7)/8)),b=(g=0,0);g<(-8&m);g+=8,b++)f[b]=(d[u[g+0]]|0)+(d[u[g+1]]<<1)+(d[u[g+2]]<<2)+(d[u[g+3]]<<3)+(d[u[g+4]]<<4)+(d[u[g+5]]<<5)+(d[u[g+6]]<<6)+(d[u[g+7]]<<7);if(g<m){f[b]=0;for(var v=0;g<m;)f[b]|=d[u[g++]]<<v,v++;b++}return p.WriteUint7(b),[p,f,f.length]}if(w<=4){for(f=new Buffer.allocUnsafe(Math.floor((m+3)/4)),g=0,b=0;g<(-4&m);g+=4,b++)f[b]=(d[u[g+0]]|0)+(d[u[g+1]]<<2)+(d[u[g+2]]<<4)+(d[u[g+3]]<<6);if(g<m){for(f[b]=0,v=0;g<m;)f[b]|=d[u[g++]]<<v,v+=2;b++}return p.WriteUint7(b),[p,f,f.length]}if(w<=16){for(f=new Buffer.allocUnsafe(Math.floor((m+1)/2)),g=0,b=0;g<(-2&m);g+=2,b++)f[b]=(d[u[g+0]]|0)+(d[u[g+1]]<<4);return g<m&&(f[b++]=d[u[g++]]),p.WriteUint7(b),[p,f,f.length]}return p.WriteUint7(u.length),[p,u,u.length]}
711encodeStripe(u,p,d){d==0&&(d=4);for(var w=new Array(d),m=new Array(d),g=0;g<d;g++)m[g]=Math.floor(p.length/d)+(p.length%d>g),w[g]=new Array(m[g]);for(var f=0,b=0;b<p.length;b+=d,f++)for(var v=0;v<d;v++)f<w[v].length&&(w[v][f]=p[b+v]);var _=new Array(d),A=0;for(g=0;g<d;g++){var S=this.encode(w[g],0),C=this.encode(w[g],1);_[g]=C.length<S.length?C:S,A+=_[g].length}var R=new a("",0,A+5*d+1);for(R.WriteByte(d),g=0;g<d;g++)R.WriteUint7(_[g].length);for(g=0;g<d;g++)R.WriteData(_[g],_[g].length);return R.buf.slice(0,R.buf.pos)}decodeStripe(u,p){for(var d=u.ReadByte(),w=new Array(d),m=new Array(d),g=0;g<d;g++)w[g]=u.ReadUint7();var f=new Array(d);for(g=0;g<d;g++)m[g]=Math.floor(p/d)+(p%d>g),f[g]=this.decodeStream(u,m[g]);var b=new Buffer.allocUnsafe(p);for(g=0;g<d;g++)for(var v=0;v<m[g];v++)b[v*d+g]=f[g][v];return b}decodeCat(u,p){for(var d=new Buffer.allocUnsafe(p),w=0;w<p;w++)d[w]=u.ReadByte();return d}}},7381:n=>{n.exports=class{constructor(i){this.low=0,this.range=4294967295,this.code=0,this.FFnum=0,this.carry=0,this.cache=0}RangeStartDecode(i){for(var s=0;s<5;s++)this.code=(this.code<<8)+i.ReadByte();this.code&=4294967295,this.code>>>=0}RangeGetFrequency(i){return this.range=Math.floor(this.range/i),Math.floor(this.code/this.range)}RangeDecode(i,s,o,a){for(this.code-=s*this.range,this.range*=o;this.range<16777216;)this.range*=256,this.code=256*this.code+i.ReadByte()}RangeShiftLow(i){if(this.low<4278190080|this.carry){for(i.WriteByte(this.cache+this.carry);this.FFnum;)i.WriteByte(this.carry-1),this.FFnum--;this.cache=this.low>>>24,this.carry=0}else this.FFnum++;this.low<<=8,this.low>>>=0}RangeEncode(i,s,o,a){var l=this.low;for(this.range=Math.floor(this.range/a),this.low+=s*this.range,this.low>>>=0,this.range*=o,this.low<l&&(this.carry!=0,this.carry=1);this.range<16777216;)this.range*=256,this.RangeShiftLow(i)}RangeFinishEncode(i){for(var s=0;s<5;s++)this.RangeShiftLow(i)}}},576:n=>{n.exports=class{constructor(i=256){this.total_freq=i,this.max_sym=i-1,this.S=new Array,this.F=new Array;for(var s=0;s<=this.max_sym;s++)this.S[s]=s,this.F[s]=1}ModelDecode(i,s){for(var o=s.RangeGetFrequency(this.total_freq),a=0,l=0;a+this.F[l]<=o;)a+=this.F[l++];s.RangeDecode(i,a,this.F[l],this.total_freq),this.F[l]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();var h=this.S[l];if(l>0&&this.F[l]>this.F[l-1]){var c=this.F[l];this.F[l]=this.F[l-1],this.F[l-1]=c,c=this.S[l],this.S[l]=this.S[l-1],this.S[l-1]=c}return h}ModelRenormalise(){this.total_freq=0;for(var i=0;i<=this.max_sym;i++)this.F[i]-=Math.floor(this.F[i]/2),this.total_freq+=this.F[i]}ModelEncode(i,s,o){for(var a=0,l=0;this.S[l]!=o;l++)a+=this.F[l];if(s.RangeEncode(i,a,this.F[l],this.total_freq),this.F[l]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise(),o=this.S[l],l>0&&this.F[l]>this.F[l-1]){var h=this.F[l];this.F[l]=this.F[l-1],this.F[l-1]=h,h=this.S[l],this.S[l]=this.S[l-1],this.S[l-1]=h}}}},5260:(n,i,s)=>{const o=s(9260),a=s(576),l=s(7381);function h(w,m,g){for(var f=0,b=0,v=-1,_=new Array(1024);b<g;){var A=w.ReadByte();if(_[f++]=A,b+=A,A==v){var S=w.ReadByte();for(b+=A*S;S--;)_[f++]=A}v=A}var C=0;for(f=0,b=0;b<g;){var R=0;do{var x=_[f++];R+=x}while(x==255);for(;R--;)m[b++]=C;C++}}function c(w,m,g){var f=w.context;return m.qctx=(m.qctx<<w.qshift)+w.qtab[g],f+=(m.qctx&(1<<w.qbits)-1)<<w.qloc,w.do_pos&&(f+=w.ptab[Math.min(m.p,1023)]<<w.ploc),w.do_delta&&(f+=w.dtab[Math.min(m.delta,255)]<<w.dloc,m.delta+=m.prevq!=g?1:0,m.prevq=g),w.do_sel&&(f+=m.s<<w.sloc),m.p--,65535&f}function u(w){var m={};m.context=w.ReadUint16(),m.pflags=w.ReadByte(),m.do_dedup=2&m.pflags,m.fixed_len=4&m.pflags,m.do_sel=8&m.pflags,m.do_qmap=16&m.pflags,m.do_pos=32&m.pflags,m.do_delta=64&m.pflags,m.do_qtab=128&m.pflags,m.max_sym=w.ReadByte();var g=w.ReadByte();if(m.qbits=g>>4,m.qshift=15&g,g=w.ReadByte(),m.qloc=g>>4,m.sloc=15&g,g=w.ReadByte(),m.ploc=g>>4,m.dloc=15&g,m.qmap=new Array(256),16&m.pflags)for(var f=0;f<m.max_sym;f++)m.qmap[f]=w.ReadByte();else for(f=0;f<256;f++)m.qmap[f]=f;if(m.qtab=new Array(1024),m.qbits>0&&128&m.pflags)h(w,m.qtab,256);else for(f=0;f<256;f++)m.qtab[f]=f;return m.ptab=new Array(1024),32&m.pflags&&h(w,m.ptab,1024),m.dtab=new Array(256),64&m.pflags&&h(w,m.dtab,256),m}function p(w,m,g,f,b,v){g.max_sel>0?b.s=f.sel.ModelDecode(w,m):b.s=0,b.x=g.stab[b.s];var _=g.params[b.x];if(_.fixed_len>=0){var A=f.len[0].ModelDecode(w,m);A|=f.len[1].ModelDecode(w,m)<<8,A|=f.len[2].ModelDecode(w,m)<<16,A|=f.len[3].ModelDecode(w,m)<<24,_.fixed_len>0&&(_.fixed_len=-A)}else A=-_.fixed_len;b.len=A,g.do_rev&&(v[b.rec]=f.rev.ModelDecode(w,m)),b.is_dup=0,2&_.pflags&&f.dup.ModelDecode(w,m)&&(b.is_dup=1),b.p=A,b.delta=0,b.qctx=0,b.prevq=0,b.rec++}function d(w,m,g){for(var f=0,b=0,v=new Array(2*g),_=0;f<g;){for(var A=f;f<g&&m[f]==b;)f++;var S=f-A;do{var C=Math.min(255,S);v[_++]=C,S-=C}while(C==255);b++}var R=-1,x=new Array(2*g),T=0;for(f=0;f<_;){var y=v[f++];if(x[T++]=y,y==R){for(A=f;f<_&&v[f]==R&&f-A<255;)f++;x[T++]=f-A}else R=y}w.WriteData(x,T)}n.exports={decode:function(w,m){return(function(g,f){var b=g.ReadUint7(),v=(function(N){var q={max_sym:0};if(N.ReadByte()==5){var H=N.ReadByte(),W=1&H?N.ReadByte():1,U=H.nparam>1?H.nparam-1:0,k=new Array(256);if(2&H)U=N.ReadByte(),h(N,k,256);else{for(var O=0;O<W;O++)k[O]=O;for(;O<256;O++)k[O]=W-1}q.do_rev=4&H,q.stab=k,q.max_sel=U,q.params=new Array(q.nparam);for(var z=0;z<W;z++)q.params[z]=u(N),q.max_sym<q.params[z].max_sym&&(q.max_sym=q.params[z].max_sym);return q}})(g);if(v){var _=v.params,A=new Array(f.length),S=(function(N){var q={};q.qual=new Array(65536);for(var H=0;H<65536;H++)q.qual[H]=new a(N.max_sym+1);for(q.len=new Array(4),H=0;H<4;H++)q.len[H]=new a(256);return q.rev=new a(2),q.dup=new a(2),N.max_sel>0&&(q.sel=new a(N.max_sel+1)),q})(v),C=new l(g);C.RangeStartDecode(g);for(var R=new Buffer.allocUnsafe(b),x={qctx:0,prevq:0,delta:0,p:0,s:0,x:0,len:0,is_dup:0,rec:0},T=0;T<b;){if(x.p==0){if(p(g,C,v,S,x,A),x.is_dup>0&&S.dup.ModelDecode(g,C)){for(var y=0;y<len;y++)R[T+y]=R[T+y-x.len];T+=x.len,x.p=0;continue}f.push(x.len);var E=(_=v.params[x.x]).context}var L=S.qual[E].ModelDecode(g,C);R[T++]=_.qmap[L],E=c(_,x,L)}return v.do_rev&&(function(N,q,H,W){for(var U=0,k=0;k<q;){if(H[U])for(var O=0,z=W[U]-1;O<z;){var B=N[k+O];N[k+O]=N[k+z],N[k+z]=B,O++,z--}k+=W[U++]}})(R,b,A,f),R}})(new o(w),m)},encode:function(w,m,g){for(var f=new Array(2),b=new Array(2),v=new Array(2),_=new Array(2),A=new Array(256),S=0;S<2;S++)f[S]=new Array(256),b[S]=new Array(256),v[S]=new Array(1024),_[S]=new Array(256);(R=new o("",0,1.1*w.length+100)).WriteUint7(w.length);var C=(function(x,T,y,E){for(var L=y[0],N=0;N<y.length&&y[N]==L;N++);var q=N==y.length?1:0,H=0,W=0;for(N=0;N<256;N++)E[0][N]=0;var U=0,k=0;for(N=0;N<x.length;N++)k==0&&(k=T[U<T.length-1?U++:U]),E[0][x[N]]++,k--;for(N=0;N<256;N++)E[0][N]&&(W<N&&(W=N),H++);var O=5,z=0;return H<=16&&(z=1,O=H<=2?1:H<=4?2:H<=8?3:4),[{qbits:8+(O>4),qshift:O,qloc:7,pbits:7,pshift:T[0]>128?1:0,ploc:0,dbits:O>4?0:1,dshift:3,dloc:15,sbits:0,sloc:15,do_stab:0,context:0,max_sym:W,nsym:H,do_qmap:z,do_dedup:0,fixed_len:T.length==1?1:0,do_sel:0,do_rev:0,do_pos:1,do_delta:O<=4?1:0,do_qtab:0,qbits:8+(O>4)-(q==0),sbits:1,sloc:15-(O<=4),do_stab:1,do_sel:1}]})(w,m,g,f),R=(function(x,T,y,E,L,N,q){for(var H=[0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,
7116,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],W=0;W<T.length;W++)q[W]=W;for(;W<256;W++)q[W]=T.length-1;x.WriteByte(5);var U=(T.length>1?1:0)|(T[0].do_stab?2:0);if(x.WriteByte(U),1&U&&x.WriteByte(T.length),2&U){var k=1<<T[0].sbits;k>0&&k--,x.WriteByte(k),d(x,q,256)}for(var O=0;O<T.length;O++){if(x.WriteUint16(T[O].context),x.WriteByte((T[O].do_qtab?128:0)|(T[O].do_delta?64:0)|(T[O].do_pos?32:0)|(T[O].do_qmap?16:0)|(T[O].do_sel?8:0)|(T[O].fixed_len?4:0)|(T[O].do_dedup?2:0)),T[O].do_qmap?x.WriteByte(T[O].nsym):x.WriteByte(T[O].max_sym),x.WriteByte(T[O].qbits<<4|T[O].qshift),x.WriteByte(T[O].qloc<<4|T[O].sloc),x.WriteByte(T[O].ploc<<4|T[O].dloc),T[O].do_qmap){T[O].max_sym=T[O].nsym;var z=0;for(W=0;W<256;W++)y[O][W]&&(x.WriteByte(W),y[O][W]=z++);for(;z<T[O].nsym;z++)x.WriteByte(0)}else for(W=0;W<256;W++)y[O][W]=W;if(T[O].qbits>0){for(W=0;W<256;W++)E[O][W]=W;T[O].do_qtab&&d(x,E[O],256)}if(T[O].pbits>0){for(W=0;W<1024;W++)L[O][W]=Math.min((1<<T[O].pbits)-1,W>>T[O].pshift);d(x,L[O],1024)}if(T[O].dbits>0){for(W=0;W<256;W++)H[W]>(1<<T[O].dbits)-1&&(H[W]=(1<<T[O].dbits)-1);for(W=0;W<256;W++)N[O][W]=H[Math.min(H.length-1,W>>T[O].dshift)];d(x,N[O],256)}}return x})(R,C,f,b,v,_,A);return(function(x,T,y,E,L,N,q,H,W,U){var k=1<<L[0].sbits;k>0&&k--;for(var O=T.length,z=0,B=0;B<L.length;B++)z<L[B].max_sym&&(z=L[B].max_sym);for(var F=new Array(65536),j=0;j<65536;j++)F[j]=new a(z+1);var $=new Array(4);for(j=0;j<4;j++)$[j]=new a(256);new a(2),new a(2);for(var G=new a(k+1),Z=new l(T),X=(B=0,j=0,0);j<O;){if(B==0){var st=E[X];L[0].sbits>0&&G.ModelEncode(x,Z,st);var nt=U[st],it=y[Math.min(y.length-1,X++)];L[nt].fixed_len?L[nt].fixed_len>0&&($[0].ModelEncode(x,Z,255&it),$[1].ModelEncode(x,Z,it>>8&255),$[2].ModelEncode(x,Z,it>>16&255),$[3].ModelEncode(x,Z,it>>24&255),L[nt].fixed_len=-1):($[0].ModelEncode(x,Z,255&it),$[1].ModelEncode(x,Z,it>>8&255),$[2].ModelEncode(x,Z,it>>16&255),$[3].ModelEncode(x,Z,it>>24&255)),L[nt].do_dedup&&process.exit(1),B=it;var mt=0,gt=L[nt].context,_t=0,xt=0}
711var ct=T[j++],kt=N[nt][ct];F[gt].ModelEncode(x,Z,kt),_t=(_t<<L[nt].qshift)+q[nt][kt],gt=L[nt].context,gt+=(_t&(1<<L[nt].qbits)-1)<<L[nt].qloc,L[nt].pbits>0&&(gt+=H[nt][Math.min(B,1023)]<<L[nt].ploc),L[nt].dbits>0&&(gt+=W[nt][Math.min(mt,255)]<<L[nt].dloc,mt+=xt!=kt?1:0,xt=kt),L[nt].do_sel&&(gt+=st<<L[nt].sloc),gt&=65535,B--}return Z.RangeFinishEncode(x),x.buf.slice(0,x.pos)})(R,w,m,g,C,f,b,v,_,A)}}},3498:(n,i,s)=>{var o=s(4459),a=s(594),l=s(445),h=s(5260),c=s(2881);n.exports={r4x8_uncompress:function(u,p){o.decode(u).copy(p,0,0)},r4x16_uncompress:function(u,p){a.decode(u).copy(p,0,0)},arith_uncompress:function(u,p){l.decode(u).copy(p,0,0)},fqzcomp_uncompress:function(u,p){var d=new Array;h.decode(u,d).copy(p,0,0)},tok3_uncompress:function(u,p){var d=c.decode(u,0,"\0");Buffer.from(d,"binary").copy(p,0,0)}}},9260:n=>{n.exports=class{constructor(i,s=0,o=0){o!=0?(this.buf=Buffer.allocUnsafe(o),this.length=o):(this.buf=i,this.length=i.length),this.pos=s}EOF(){return this.pos>=this.length}ReadData(i){var s=this.buf.slice(this.pos,this.pos+i);return this.pos+=i,s}ReadByte(){const i=this.buf[this.pos];return this.pos++,i}ReadChar(){const i=this.buf[this.pos];return this.pos++,String.fromCharCode(i)}ReadUint16(){return this.ReadByte()|this.ReadByte()<<8}ReadUint32(){const i=this.buf.readInt32LE(this.pos);return this.pos+=4,i}ReadString(){var i="";do{var s=this.buf[this.pos++];s&&(i+=String.fromCharCode(s))}while(s);return i}ReadUint7(){var i=0;do{var s=this.ReadByte();i=i<<7|127&s}while(128&s);return i}ReadITF8(){var i=this.buf[this.pos];return this.pos++,i>=240?(i=(15&i)<<28,i+=(this.buf[this.pos+0]<<20)+(this.buf[this.pos+1]<<12)+(this.buf[this.pos+2]<<4)+(this.buf[this.pos+3]>>4),this.pos+=4):i>=224?(i=(15&i)<<24,i+=(this.buf[this.pos+0]<<16)+(this.buf[this.pos+1]<<8)+(this.buf[this.pos+2]|0),this.pos+=3):i>=192?(i=(31&i)<<16,i+=(this.buf[this.pos+0]<<8)+(this.buf[this.pos+1]|0),this.pos+=2):i>=128&&(i=(63&i)<<8,i+=this.buf[this.pos],this.pos++),i}WriteByte(i){this.buf[this.pos++]=i}WriteChar(i){this.buf[this.pos++]=i.charCodeAt(0)}WriteString(i){for(var s=0;s<i.length;s++)this.buf[this.pos++]=i.charCodeAt(s);this.buf[this.pos++]=0}WriteData(i,s){for(var o=0;o<s;o++)this.buf[this.pos++]=i[o]}WriteStream(i){this.WriteData(i.buf,i.pos)}WriteUint16(i){this.WriteByte(255&i),this.WriteByte(i>>8&255)}WriteUint32(i){this.buf.writeInt32LE(i,this.pos),this.pos+=4}WriteUint7(i){var s=0,o=i;do s+=7,o>>=7;while(o>0);do s-=7,this.WriteByte((i>>s&127)+((s>0)<<7));while(s>0)}WriteITF8(i){i<0&&(i=1+i),i<=127?this.buf[this.pos++]=i:i<=16383?(this.buf[this.pos++]=128|Math.floor(i/256),this.buf[this.pos++]=255&i):i<131071?(this.buf[this.pos++]=192|Math.floor(i/65536),this.buf[this.pos++]=255&Math.floor(i/256),this.buf[this.pos++]=255&i):i<268435455?(this.buf[this.pos++]=224|Math.floor(i/16777216),this.buf[this.pos++]=255&Math.floor(i/65536),this.buf[this.pos++]=255&Math.floor(i/256),this.buf[this.pos++]=255&i):(this.buf[this.pos++]=240|Math.floor(i/268435456),this.buf[this.pos++]=255&Math.floor(i/1048576),this.buf[this.pos++]=255&Math.floor(i/4096),this.buf[this.pos++]=255&Math.floor(i/4),this.buf[this.pos++]=15&i)}WriteByteNeg(i){this.buf[--this.pos]=i}}},4459:(n,i,s)=>{const o=s(9260);function a(f){return 4095&f}function l(f,b){for(var v=0;b>=f[v+1];)v++;return v}function h(f){for(var b=new Array(4096),v=0,_=0;_<4096;_++){for(;_>=f[v+1];)v++;b[_]=v}return b}function c(f,b,v){return v*(f>>12)+(4095&f)-b}function u(f,b){for(;b<8388608;)b=(b<<8)+f.ReadByte();return b}function p(f,b){b.WriteByteNeg(f>>24&255),b.WriteByteNeg(f>>16&255),b.WriteByteNeg(f>>8&255),b.WriteByteNeg(255&f)}function d(f,b,v,_,A){return f=(function(S,C,R,x){for(var T=(8388608>>x<<8)*R;S>=T;)C.WriteByteNeg(255&S),S>>=8;return S})(f,b,_,A),(Math.floor(f/_)<<A)+f%_+v}function w(f,b,v){for(var _=0;_<256;_++)b[_]=0;var A=f.ReadByte(),S=A,C=0;do{var R=f.ReadITF8();b[A]=R,C>0?(C--,A++):(A=f.ReadByte())==S+1&&(C=f.ReadByte()),S=A}while(A!=0);for(v[0]=0,_=0;_<=255;_++)v[_+1]=v[_]+b[_]}function m(f){for(var b=0,v=0;v<256;v++)b+=f[v];const _=4096;var A=_/b;do{var S=0,C=0,R=0;for(b=0,v=0;v<256;v++)f[v]!=0&&(S<f[v]&&(S=f[v],C=v),f[v]=Math.floor(f[v]*A),f[v]==0&&(f[v]=1),b+=f[v]);b<_?f[C]+=_-b:b-_<f[C]/2&&f[C]>2?f[C]-=b-_:b!=_&&(A*=.99,R=1)}while(R)}function g(f,b){for(var v=0,_=0;_<256;_++)if(b[_]){if(v>0)v--;else if(f.WriteByte(_),_>0&&b[_-1]>0){for(v=_+1;v<256&&b[v];v++);v-=_+1,f.WriteByte(v)}f.WriteITF8(b[_])}f.WriteByte(0)}n.exports={decode:function(f){var b=new o(f),v=b.ReadByte(),_=(b.ReadUint32(),b.ReadUint32());return v==0?(function(A,S){var C=new Array(256),R=new Array(256);w(A,C,R);for(var x=h(R),T=new Array(4),y=0;y<4;y++)T[y]=A.ReadUint32();var E=new Buffer.allocUnsafe(S);for(y=0;y<S;y++){var L=y%4,N=x[a(T[L])];E[y]=N,T[L]=c(T[L],R[N],C[N]),T[L]=u(A,T[L])}return E})(b,_):(function(A,S){var C=new Array(256),R=new Array(256);(function(U,k,O){for(var z=0;z<256;z++){k[z]=new Array(256),O[z]=new Array(256);for(var B=0;B<256;B++)k[z][B]=0}var F=U.ReadByte(),j=F,$=0;do w(U,k[F],O[F]),$>0?($--,F++):(F=U.ReadByte())==j+1&&($=U.ReadByte()),j=F;while(F!=0)})(A,C,R);for(var x=new Array(256),T=0;T<256;T++)x[T]=h(R[T]);for(var y=new Array(4),E=new Array(4),L=0;L<4;L++)y[L]=A.ReadUint32(),E[L]=0;var N=new Buffer.allocUnsafe(S),q=Math.floor(S/4);for(T=0;T<q;T++)for(L=0;L<4;L++){var H=a(y[L]),W=x[E[L]][H];N[T+L*q]=W,y[L]=c(y[L],R[E[L]][W],C[E[L]][W]),y[L]=u(A,y[L]),E[L]=W}for(T*=4;T<S;)H=a(y[3]),W=l(R[E[3]],H),N[T++]=W,y[3]=c(y[3],R[E[3]][W],C[E[3]][W]),y[3]=u(A,y[3]),E[3]=W;return N})(b,_)},encode:function(f,b){return b==0?(function(v){const _=v.length;var A=new o("",0,780);A.WriteByte(0),A.WriteUint32(0),A.WriteUint32(0);var S=new Array(256);(function(L,N){for(var q=0;q<256;q++)N[q]=0;for(q=0;q<L.length;q++)N[L[q]]++})(v,S),m(S),g(A,S);var C=new Array(256);C[0]=0;for(var R=1;R<256;R++)C[R]=C[R-1]+S[R-1];var x=new Array(4);for(R=0;R<4;R++)x[R]=8388608;var T=Math.floor(1.05*_+100),y=new o("",T,T);for(R=_-1;R>
711=0;R--)x[R%4]=d(x[R%4],y,C[v[R]],S[v[R]],12);for(R=3;R>=0;R--)p(x[R],y);var E=A.pos;return A.buf.writeInt32LE(E-9+(y.length-y.pos),1),A.buf.writeInt32LE(_,5),Buffer.concat([A.buf.slice(0,A.pos),y.buf.slice(y.pos,y.length)],A.pos+y.length-y.pos)})(f):(function(v){const _=v.length;var A=new o("",0,198156);A.WriteByte(1),A.WriteUint32(0),A.WriteUint32(0);for(var S=new Array(256),C=new Array(256),R=new Array(256),x=0;x<256;x++)C[x]=new Array(256),R[x]=new Array(256);for((function(k,O,z){for(var B=0;B<256;B++){z[B]=0;for(var F=0;F<256;F++)O[B][F]=0}var j=0;for(B=0;B<k.length;B++)z[k[B]]++,O[j][k[B]]++,j=k[B];O[0][k[1*(k.length>>2)]]++,O[0][k[2*(k.length>>2)]]++,O[0][k[3*(k.length>>2)]]++,z[0]+=3})(v,C,S),(function(k,O){for(var z=0;z<256;z++)O[z]&&m(k[z])})(C,S),(function(k,O,z){for(var B=0,F=0;F<256;F++)if(z[F]){if(B>0)B--;else if(k.WriteByte(F),F>0&&z[F-1]>0){for(B=F+1;B<256&&z[B];B++);B-=F+1,k.WriteByte(B)}g(k,O[F])}k.WriteByte(0)})(A,C,S),x=0;x<256;x++)if(S[x]){R[x][0]=0;for(var T=1;T<256;T++)R[x][T]=R[x][T-1]+C[x][T-1]}var y=new Array(4),E=new Array(4);for(T=0;T<4;T++)y[T]=8388608,E[T]=0;var L=new o("",_,_),N=Math.floor(_/4),q=new Array(4),H=new Array(4);for(T=0;T<4;T++)q[T]=(T+1)*N-2,H[T]=v[q[T]+1];for(H[3]=v[_-1],x=_-2;x>4*N-2;x--)y[3]=d(y[3],L,R[v[x]][H[3]],C[v[x]][H[3]],12),H[3]=v[x];for(;q[0]>=0;)for(T=3;T>=0;T--){var W=v[q[T]];y[T]=d(y[T],L,R[W][H[T]],C[W][H[T]],12),H[T]=W,q[T]--}for(T=3;T>=0;T--)y[T]=d(y[T],L,R[0][H[T]],C[0][H[T]],12);for(x=3;x>=0;x--)p(y[x],L);var U=A.pos;return A.buf.writeInt32LE(U-9+(L.length-L.pos),1),A.buf.writeInt32LE(_,5),Buffer.concat([A.buf.slice(0,A.pos),L.buf.slice(L.pos,L.length)],A.pos+L.length-L.pos)})(f)}}},594:(n,i,s)=>{const o=s(9260);function a(C,R){return C&(1<<R)-1}function l(C,R){for(var x=0;R>=C[x+1];)x++;return x}function h(C,R){for(var x=1<<R,T=new Array(x),y=0,E=0;E<x;E++){for(;E>=C[y+1];)y++;T[E]=y}return T}function c(C,R,x,T){return x*(C>>T)+(C&(1<<T)-1)-R}function u(C,R){return R<32768&&(R=(R<<16)+C.ReadUint16()),R}function p(C,R){R.WriteByteNeg(C>>24&255),R.WriteByteNeg(C>>16&255),R.WriteByteNeg(C>>8&255),R.WriteByteNeg(255&C)}function d(C,R,x,T,y){return C=(function(E,L,N,q){for(var H=(1<<31-q)*N;E>=H;)L.WriteByteNeg(E>>8&255),L.WriteByteNeg(255&E),E>>=16;return E})(C,R,T,y),(Math.floor(C/T)<<y)+C%T+x}function w(C,R,x){x==0&&(x=4);for(var T=new Array(x),y=new Array(x),E=0;E<x;E++)y[E]=Math.floor(R.length/x)+(R.length%x>E),T[E]=new Array(y[E]);for(var L=0,N=0;N<R.length;N+=x,L++)for(var q=0;q<x;q++)L<T[q].length&&(T[q][L]=R[N+q]);var H=new Array(x),W=0;for(E=0;E<x;E++){var U=g(T[E],0),k=g(T[E],1);H[E]=k.length<U.length?k:U,W+=H[E].length}var O=new o("",0,W+5*x+1);for(O.WriteByte(x),E=0;E<x;E++)O.WriteUint7(H[E].length);for(E=0;E<x;E++)O.WriteData(H[E],H[E].length);return O.buf.slice(0,O.buf.pos)}function m(C,z){var x=C.ReadByte(),T=1&x,y=8&x,E=32&x,L=64&x,N=128&x;if(16&x||(z=C.ReadUint7()),y)return(function(F,j){for(var $=F.ReadByte(),G=new Array($),Z=new Array($),X=0;X<$;X++)G[X]=F.ReadUint7();var st=new Array($);for(X=0;X<$;X++)Z[X]=Math.floor(j/$)+(j%$>X),st[X]=m(F,Z[X]);var nt=new Buffer.allocUnsafe(j);for(X=0;X<$;X++)for(var it=0;
711it<Z[X];it++)nt[it*$+X]=st[X][it];return nt})(C,z);if(N)var q=z,[H,W,z]=(function(F){for(var j=F.ReadByte(),$=new Array(j),G=0;G<j;G++)$[G]=F.ReadByte();return[$,j,F.ReadUint7()]})(C);if(L)var U=z,[k,O,z]=(function(F){var j=F.ReadUint7(),$=F.ReadUint7();if(1&j)var G=F.ReadData((j-1)/2);else{var Z=F.ReadUint7();G=F.ReadData(Z),G=b(new o(G),j/2)}G=new o(G);var X=new Array(256),st=G.ReadByte();st==0&&(st=256);for(var nt=0;nt<st;nt++)X[G.ReadByte()]=1;return[X,G,$]})(C);if(E)var B=C.ReadData(z);else B=T==0?b(C,z):(function(F,j){var $=(st=F.ReadByte())>>4,G=F;if(1&st){var Z=F.ReadUint7(),X=F.ReadUint7(),st=new o(F.ReadData(X));G=new o(b(st,Z))}var nt=new Array(256),it=new Array(256);(function(M,I,D,Y){for(var J=0;J<256;J++){I[J]=new Array(256),D[J]=new Array(256);for(var tt=0;tt<256;tt++)I[J][tt]=0}var lt=f(M);for(J=0;J<256;J++)if(lt[J]){var Et=0;for(tt=0;tt<256;tt++)lt[tt]&&(Et>0?Et--:(I[J][tt]=M.ReadUint7(),I[J][tt]==0&&(Et=M.ReadByte())));for(_(I[J],Y),D[J][0]=0,tt=0;tt<256;tt++)D[J][tt+1]=D[J][tt]+I[J][tt]}})(G,nt,it,$);for(var mt=new Array(256),gt=0;gt<256;gt++)mt[gt]=h(it[gt],$);for(var _t=new Array(4),xt=new Array(4),ct=0;ct<4;ct++)_t[ct]=F.ReadUint32(),xt[ct]=0;var kt=new Buffer.allocUnsafe(j),At=Math.floor(j/4);for(gt=0;gt<At;gt++)for(ct=0;ct<4;ct++){var St=a(_t[ct],$),Ut=mt[xt[ct]][St];kt[gt+ct*At]=Ut,_t[ct]=c(_t[ct],it[xt[ct]][Ut],nt[xt[ct]][Ut],$),_t[ct]=u(F,_t[ct]),xt[ct]=Ut}for(gt*=4;gt<j;)St=a(_t[3],$),Ut=l(it[xt[3]],St),kt[gt++]=Ut,_t[3]=c(_t[3],it[xt[3]][Ut],nt[xt[3]][Ut],$),_t[3]=u(F,_t[3]),xt[3]=Ut;return kt})(C,z);return L&&(B=(function(F,j,$,G){new o(F);for(var Z=new Buffer.allocUnsafe(G),X=0,st=0;X<G;st++){var nt=F[st];if(j[nt])for(var it=$.ReadUint7(),mt=0;mt<=it;mt++)Z[X++]=nt;else Z[X++]=nt}return Z})(B,k,O,U)),N&&(B=(function(F,j,$,G){var Z=new Buffer.allocUnsafe(G),X=0;if($<=1)for(var st=0;st<G;st++)Z[st]=j[0];else if($<=2)for(st=0;st<G;st++){if(st%8==0)var nt=F[X++];Z[st]=j[1&nt],nt>>=1}else if($<=4)for(st=0;st<G;st++)st%4==0&&(nt=F[X++]),Z[st]=j[3&nt],nt>>=2;else if($<=16)for(st=0;st<G;st++)st%2==0&&(nt=F[X++]),Z[st]=j[15&nt],nt>>=4;return Z})(B,H,W,q)),B}function g(C,R){var x=new o("",0,10);x.WriteByte(R);var T=1&R,y=8&R,E=32&R,L=64&R,N=128&R,q=R>>8;if(16&R||x.WriteUint7(C.length),y)return Buffer.concat([x.buf.slice(0,x.pos),w(0,C,q)]);var H=new Buffer.alloc(0);N&&([H,C]=(function(k){for(var O=new Array(256),z=0;z<256;z++)O[z]=0;for(z=0;z<k.length;z++)O[k[z]]++;var B=new Array(256),F=0;for(z=0;z<256;z++)O[z]>0&&(B[z]=F++);if(!(F>16)){if(F<=1)var j=new Buffer.allocUnsafe(0);else if(F<=2){j=new Buffer.allocUnsafe(Math.ceil(k.length/8));var $=-1;for(z=0;z<k.length;z++)z%8==0&&(j[++$]=0),j[$]+=B[k[z]]<<z%8}else if(F<=4)for(j=new Buffer.allocUnsafe(Math.ceil(k.length/4)),$=-1,z=0;z<k.length;z++)z%4==0&&(j[++$]=0),j[$]+=B[k[z]]<<z%4*2;else for(j=new Buffer.allocUnsafe(Math.ceil(k.length/2)),$=-1,z=0;z<k.length;z++)z%2==0&&(j[++$]=0),j[$]+=B[k[z]]<<z%2*4;var G=new o("",0,F+5);for(G.WriteByte(F),$=0,z=0;z<256;z++)O[z]>0&&(O[z]=$++,G.WriteByte(z));return G.WriteUint7(j.length),[G.buf.slice(0,G.pos),j]}})(C));var W=new Buffer.alloc(0);if(L&&([W,C]=(function(k){for(var O=new Array(256),z=0;z<256;z++)O[z]=0;var B=-1;for(z=0;z<k.length;z++)O[k[z]]+=k[z]==B?1:-1,B=k[z];var F=0;for(z=0;z<256;z++)O[z]>0&&F++;for(F||(F=1,O[0]=1),(Z=new o("",0,F+1+k.length)).WriteByte(F),z=0;z<256;z++)O[z]>0&&Z.WriteByte(z);var j=new Buffer.allocUnsafe(k.length),$=0;for(z=0;z<k.length;z++)if(j[$++]=k[z],O[k[z]]>0){B=k[z];for(var G=0;z+G+1<k.length&&k[z+G+1]==B;)G++;Z.WriteUint7(G),z+=G}var Z,X=S(Z.buf.slice(0,Z.pos)),st=new o("",0,16);return st.WriteUint7(2*Z.pos),st.WriteUint7($),st.WriteUint7(X.length),[Z=Buffer.concat([st.buf.slice(0,st.pos),X]),j.slice(0,$)]})(C)),C.length<4&&T==1&&(T=0,x.buf[0]&=-2),E)var U=C;else U=T==0?S(C):(function(k){const O=k.length;for(var z=new o("",0,198156),B=new Array(256),F=new Array(256),j=new Array(256),$=0;$<256;$++)F[$]=new Array(256),j[$]=new Array(256);(function(ct,kt,At){for(var St=0;St<256;St++){At[St]=0;for(var Ut=0;Ut<256;Ut++)kt[St][Ut]=0}var M=0;for(St=0;St<ct.length;St++)At[M]++,kt[M][ct[St]]++,M=ct[St];At[M]++,kt[0][ct[1*(ct.length>>2)]]++,kt[0][ct[2*(ct.length>>2)]]++,kt[0][ct[3*(ct.length>>2)]]++,At[0]+=3})(k,F,B),(function(ct,kt,At){for(var St=0;St<256;St++)if(kt[St]){var Ut=Math.ceil(Math.log2(kt[St]));Ut>12&&(Ut=12),v(ct[St],Ut)}})(F,B);var G=new o("",0,198156);(function(ct,kt,At){A(ct,At);for(var St=0;St<256;St++)if(At[St]){for(var Ut=0,M=0;M<256;M++)if(At[M]){if(Ut)Ut--;else if(ct.WriteUint7(kt[St][M]),!kt[St][M]){for(var I=M+1;I<256;I++)if(At[I]){if(kt[St][I]!=0)break;Ut++}ct.WriteByte(Ut)}}}})(G,F,B);var Z=S(G.buf.slice(0,G.pos));for(Z.length<G.pos?(z.WriteByte(193),z.WriteUint7(G.pos),z.WriteUint7(Z.length),z.WriteData(Z,Z.length)):(z.WriteByte(192),z.WriteData(G.buf,G.pos)),(function(ct,kt,At){for(var St=0;St<256;St++)kt[St]&&_(ct[St],12)})(F,B),$=0;$<256;$++)if(B[$]){j[$][0]=0;for(var X=1;X<256;X++)j[$][X]=j[$][X-1]+F[$][X-1]}
711var st=new Array(4),nt=new Array(4);for(X=0;X<4;X++)st[X]=32768,nt[X]=0;var it=new o("",1.05*O+100|0,1.05*O+100|0),mt=Math.floor(O/4),gt=new Array(4),_t=new Array(4);for(X=0;X<4;X++)gt[X]=(X+1)*mt-2,_t[X]=k[gt[X]+1];for(_t[3]=k[O-1],$=O-2;$>4*mt-2;$--)st[3]=d(st[3],it,j[k[$]][_t[3]],F[k[$]][_t[3]],12),_t[3]=k[$];for(;gt[0]>=0;)for(X=3;X>=0;X--){var xt=k[gt[X]];st[X]=d(st[X],it,j[xt][_t[X]],F[xt][_t[X]],12),_t[X]=xt,gt[X]--}for(X=3;X>=0;X--)st[X]=d(st[X],it,j[0][_t[X]],F[0][_t[X]],12);for($=3;$>=0;$--)p(st[$],it);return Buffer.concat([z.buf.slice(0,z.pos),it.buf.slice(it.pos,it.length)],z.pos+it.length-it.pos)})(C);return Buffer.concat([x.buf.slice(0,x.pos),H,W,U])}function f(C){for(var R=new Array(256),x=0;x<256;x++)R[x]=0;var T=0,y=C.ReadByte(),E=y;do R[y]=1,T>0?(T--,y++):(y=C.ReadByte())==E+1&&(T=C.ReadByte()),E=y;while(y!=0);return R}function b(C,R){var x=new Array(256),T=new Array(256);(function(W,U,k){for(var O=0;O<256;O++)U[O]=0;var z=f(W);for(O=0;O<256;O++)z[O]>0&&(U[O]=W.ReadUint7());for(_(U,12),k[0]=0,O=0;O<=255;O++)k[O+1]=k[O]+U[O]})(C,x,T);for(var y=h(T,12),E=new Array(4),L=0;L<4;L++)E[L]=C.ReadUint32();var N=new Buffer.allocUnsafe(R);for(L=0;L<R;L++){var q=L%4,H=y[a(E[q],12)];N[L]=H,E[q]=c(E[q],T[H],x[H],12),E[q]=u(C,E[q])}return N}function v(C,R){for(var x=0,T=0;T<256;T++)x+=C[T];const y=1<<R;var E=y/x;do{var L=0,N=0,q=0;for(x=0,T=0;T<256;T++)C[T]!=0&&(L<C[T]&&(L=C[T],N=T),C[T]=Math.floor(C[T]*E),C[T]==0&&(C[T]=1),x+=C[T]);x<y?C[N]+=y-x:x-y<C[N]/2&&C[N]>2?C[N]-=x-y:x!=y&&(E=y/x,q=1)}while(q)}function _(C,R){for(var x=0,T=0;T<256;T++)x+=C[T];if(x!=0&&x!=1<<R){for(var y=0;x<1<<R;)x*=2,y++;for(T=0;T<256;T++)C[T]<<=y}}function A(C,R){for(var x=0,T=0;T<256;T++)if(R[T]){if(x>0)x--;else if(C.WriteByte(T),T>0&&R[T-1]>0){for(x=T+1;x<256&&R[x];x++);x-=T+1,C.WriteByte(x)}}C.WriteByte(0)}function S(C){const R=C.length;var x=new o("",0,780),T=new Array(256);(function(H,W){for(var U=0;U<256;U++)W[U]=0;for(U=0;U<H.length;U++)W[H[U]]++})(C,T);var y=Math.ceil(Math.log2(R));y>12&&(y=12),v(T,y),(function(H,W){A(H,W);for(var U=0;U<256;U++)W[U]&&H.WriteUint7(W[U])})(x,T),v(T,12);var E=new Array(256);E[0]=0;for(var L=1;L<256;L++)E[L]=E[L-1]+T[L-1];var N=new Array(4);for(L=0;L<4;L++)N[L]=32768;var q=new o("",1.05*R+100|0,1.05*R+100|0);for(L=R-1;L>=0;L--)N[L%4]=d(N[L%4],q,E[C[L]],T[C[L]],12);for(L=3;L>=0;L--)p(N[L],q);return Buffer.concat([x.buf.slice(0,x.pos),q.buf.slice(q.pos,q.length)],x.pos+q.length-q.pos)}n.exports={decode:function(C){return m(new o(C),0)},encode:g}},2881:(n,i,s)=>{const o=s(9260),a=s(594);var l=new(s(445));function h(m,g){for(var f=m+"";f.length<g;)f="0"+f;return f}function c(m,g,f,b){var v=m[0][0].ReadByte(),_=b-m[0][v].ReadUint32();if(v==5)return g[b]=g[_],f[b]=f[_],g[b];var A=1;g[b]="",f[b]=new Array(256);do{switch(v=m[A][0].ReadByte()){case 2:f[b][A]=m[A][2].ReadChar();break;case 1:f[b][A]=m[A][1].ReadString();break;case 7:f[b][A]=m[A][7].ReadUint32();break;case 3:var S=m[A][3].ReadUint32(),C=m[A][4].ReadByte();f[b][A]=h(S,C);break;case 8:f[b][A]=(f[_][A]|0)+m[A][8].ReadByte();break;case 9:S=(f[_][A]|0)+m[A][9].ReadByte(),C=f[_][A].length,f[b][A]=h(S,C);break;case 10:f[b][A]=f[_][A];break;default:f[b][A]=""}g[b]+=f[b][A++]}while(v!=12);return g[b]}function u(m,g,f,b,v,_){for(var A=0;A<b.length;A++)if(!(f>0&&g[A][0].type==5)&&g[A][f])switch(m[0].WriteByte(g[A][f].type),g[A][f].type){case 6:m[6].WriteUint32(g[A][f].val);break;case 5:m[5].WriteUint32(g[A][f].val);break;case 1:m[1].WriteString(g[A][f].val);break;case 2:m[2].WriteChar(g[A][f].val);break;case 7:m[7].WriteUint32(g[A][f].val);break;case 3:m[3].WriteUint32(g[A][f].val),m[4].WriteByte(g[A][f].val.length);break;case 8:case 9:m[g[A][f].type].WriteByte(g[A][f].val)}}function p(m,g,f,b){for(var v=0;v<=12;v++)if(!(m[v].pos<=0)){b.WriteByte(v+(v==0?128:0)),m[v]=m[v].buf.slice(0,m[v].pos);var _=d(m[v],f);b.WriteUint7(_.length),b.WriteData(_,_.length)}}function d(m,g){var f,b=1073741824,v=[0,1,64,65,128,129,201];for(var _ in v){var A=v[_];if(!(1&A&&m.length<100||8&A&&m.length%4!=0)){try{var S=g?l.encode(m,A):a.encode(m,A)}catch{S=0}S&&b>S.length&&(b=S.length,f=S)}}return f}function w(m,g,f,b,v){var _=0,A=v-1;m[v]=new Array(256),g[b]?m[v][0]={type:5,val:v-g[b]}:m[v][0]={type:6,val:v==0?0:1},g[b]=v;for(var S=b.match(/([a-zA-Z0-9]{1,9})|([^a-zA-Z0-9]+)/g),C=0;C<S.length;C++){var R=C+1,x=1,T=S[C];if(S[C].match(/^0+[0-9]*$/g)?x=3:S[C].match(/^[0-9]+$/g)?x=7:S[C].length==1&&(x=2),A>=0&&m[A][R])if(m[A][R].str==S[C])x=10,T="";else if(m[A][R].type==7||m[A][R].type==8){var y=T-m[A][R].str;f[R]++,y>=0&&y<256&&f[R]>v/2&&(x=8,T=y)}else m[A][R].type!=3&&m[A][R].type!=9||m[A][R].str.length!=T.length||(y=T-m[A][R].str,f[R]++,y>=0&&y<256&&f[R]>v/2&&(x=9,T=y));m[v][R]={str:S[C],val:T,type:x},_<m[v][R].val.length+3&&(_=m[v][R].val.length+3)}return m[v][++R]={type:12},[R+1,_]}n.exports={encode:function(m,g){var f=m.toString();f[f.length-1]==` 712`&&(f=f.substring(0,f.length-1));var b=f.split(` 713`),v=new o("",0,2*f.length+1e4);v.WriteUint32(f.length),v.WriteUint32(b.length),v.WriteByte(g);for(var _=new Array(b.length),A={},S=new Array(256).fill(0),C=0,R=0,x=0;x<b.length;x++){var[T,y]=w(_,A,S,b[x],x);C<T&&(C=T),R<y&&(R=y)}for(var E=0;E<C;E++){for(var L=new Array(13),N=0;N<=12;N++)L[N]=new o("",0,b.length*R);u(L,_,E,b),p(L,0,g,v)}
713return v.buf.slice(0,v.pos)},decode:function(m,g,f){(m=new o(m)).ReadUint32();var b=m.ReadUint32(),v=m.ReadByte(),_=(function(x,T,y,E){for(var L=-1,N=new Array(256);!x.EOF();){var q=x.ReadByte(),H=128&q,W=64&q,U=63&q;if(H&&(N[++L]=new Array(13)),U!=0&&H){var k=new Array(E-1).fill(10);N[L][0]=new o(Buffer.from([U].concat(k)))}if(W){var O=x.ReadByte(),z=x.ReadByte();N[L][U]=new o(N[O][z].buf)}else{var B=x.ReadUint7(),F=x.ReadData(B);N[L][U]=y?l.decode(F):a.decode(F),N[L][U]=new o(N[L][U])}}return N})(m,0,v,b),A=new Array(b),S=new Array(b),C="";f===void 0&&(f=` 714`);for(var R=0;R<b;R++)C+=c(_,A,S,R)+f;return C}}},1422:function(n,i,s){var o=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(i,"__esModule",{value:!0});const a=s(8904),l=o(s(9049)),h=o(s(450));class c{constructor({fill:p,cache:d}){if(typeof p!="function")throw new TypeError("must pass a fill function");if(typeof d!="object")throw new TypeError("must pass a cache object");if(typeof d.get!="function"||typeof d.set!="function"||typeof d.delete!="function")throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=d,this.fillCallback=p}static isAbortException(p){return p.name==="AbortError"||p.code==="ERR_ABORTED"||p.message==="AbortError: aborted"||p.message==="Error: aborted"}evict(p,d){this.cache.get(p)===d&&this.cache.delete(p)}fill(p,d,w,m){const g=new l.default,f=new h.default;f.addCallback(m);const b={aborter:g,promise:this.fillCallback(d,g.signal,(v=>{f.callback(v)})),settled:!1,statusReporter:f,get aborted(){return this.aborter.signal.aborted}};b.aborter.addSignal(w),b.aborter.signal.addEventListener("abort",(()=>{b.settled||this.evict(p,b)})),b.promise.then((()=>{b.settled=!0}),(()=>{b.settled=!0,this.evict(p,b)})).catch((v=>{throw v})),this.cache.set(p,b)}static checkSinglePromise(p,d){function w(){if(d&&d.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return p.then((m=>(w(),m)),(m=>{throw w(),m}))}has(p){return this.cache.has(p)}get(p,d,w,m){if(!w&&d instanceof a.AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");const g=this.cache.get(p);return g?g.aborted&&!g.settled?(this.evict(p,g),this.get(p,d,w,m)):g.settled?g.promise:(g.aborter.addSignal(w),g.statusReporter.addCallback(m),c.checkSinglePromise(g.promise,w)):(this.fill(p,d,w,m),c.checkSinglePromise(this.cache.get(p).promise,w))}delete(p){const d=this.cache.get(p);d&&(d.settled||d.aborter.abort(),this.cache.delete(p))}clear(){const p=this.cache.keys();let d=0;for(let w=p.next();!w.done;w=p.next())this.delete(w.value),d+=1;return d}}i.default=c},9049:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0});const o=s(8904);class a{}i.default=class{constructor(){this.signals=new Set,this.abortController=new o.AbortController}addSignal(l=new a){if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(l),l.aborted?this.handleAborted(l):typeof l.addEventListener=="function"&&l.addEventListener("abort",(()=>{this.handleAborted(l)}))}handleAborted(l){this.signals.delete(l),this.signals.size===0&&this.abortController.abort()}get signal(){return this.abortController.signal}abort(){this.abortController.abort()}}},450:(n,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.default=class{constructor(){this.callbacks=new Set}addCallback(s=(()=>{})){this.callbacks.add(s),s(this.currentMessage)}callback(s){this.currentMessage=s,this.callbacks.forEach((o=>{o(s)}))}}},8904:(n,i,s)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AbortSignal=i.AbortController=void 0;const o=s(5988);var a=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(s.g!==void 0)return s.g;throw new Error("unable to locate global object")};let l=a().AbortController===void 0?o.AbortController:a().AbortController;i.AbortController=l;let h=a().AbortController===void 0?o.AbortSignal:a().AbortSignal;i.AbortSignal=h},4105:function(n,i,s){var o=this&&this.__importDefault||function(l){return l&&l.__esMo
714dule?l:{default:l}};Object.defineProperty(i,"__esModule",{value:!0});const a=o(s(1422));i.default=a.default},5988:(n,i)=>{function s(m,g){if(!(m instanceof g))throw new TypeError("Cannot call a class as a function")}function o(m,g){for(var f=0;f<g.length;f++){var b=g[f];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(m,b.key,b)}}function a(m,g,f){return g&&o(m.prototype,g),Object.defineProperty(m,"prototype",{writable:!1}),m}function l(m){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(g){return g.__proto__||Object.getPrototypeOf(g)},l(m)}function h(m,g){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,b){return f.__proto__=b,f},h(m,g)}function c(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function u(){return u=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(m,g,f){var b=(function(_,A){for(;!Object.prototype.hasOwnProperty.call(_,A)&&(_=l(_))!==null;);return _})(m,g);if(b){var v=Object.getOwnPropertyDescriptor(b,g);return v.get?v.get.call(arguments.length<3?m:f):v.value}},u.apply(this,arguments)}Object.defineProperty(i,"__esModule",{value:!0});var p=(function(){function m(){s(this,m),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return a(m,[{key:"addEventListener",value:function(g,f,b){g in this.listeners||(this.listeners[g]=[]),this.listeners[g].push({callback:f,options:b})}},{key:"removeEventListener",value:function(g,f){if(g in this.listeners){for(var b=this.listeners[g],v=0,_=b.length;v<_;v++)if(b[v].callback===f)return void b.splice(v,1)}}},{key:"dispatchEvent",value:function(g){if(g.type in this.listeners){for(var f=this.listeners[g.type].slice(),b=0,v=f.length;b<v;b++){var _=f[b];try{_.callback.call(this,g)}catch(A){Promise.resolve().then((function(){throw A}))}_.options&&_.options.once&&this.removeEventListener(g.type,_.callback)}return!g.defaultPrevented}}}]),m})(),d=(function(m){(function(_,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");_.prototype=Object.create(A&&A.prototype,{constructor:{value:_,writable:!0,configurable:!0}}),Object.defineProperty(_,"prototype",{writable:!1}),A&&h(_,A)})(v,m);var g,f,b=(g=v,f=(function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}})(),function(){var _,A=l(g);if(f){var S=l(this).constructor;_=Reflect.construct(A,arguments,S)}else _=A.apply(this,arguments);return(function(C,R){if(R&&(typeof R=="object"||typeof R=="function"))return R;if(R!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(C)})(this,_)});function v(){var _;return s(this,v),(_=b.call(this)).listeners||p.call(c(_)),Object.defineProperty(c(_),"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(c(_),"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(c(_),"reason",{value:void 0,writable:!0,configurable:!0}),_}return a(v,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(_){_.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,_)),u(l(v.prototype),"dispatchEvent",this).call(this,_)}}]),v})(p),w=(function(){function m(){s(this,m),Object.defineProperty(this,"signal",{value:new d,writable:!0,configurable:!0})}return a(m,[{key:"abort",value:function(g){var f;try{f=new Event("abort")}catch{typeof document<"u"?document.createEvent?(f=document.createEvent("Event")).initEvent("abort",!1,!1):(f=document.createEventObject()).type="abort":f={type:"abort",bubbles:!1,cancelable:!1}}var b=g;if(b===void 0)if(typeof document>"u")(b=new Error("This operation was aborted")).name="AbortError";else try{b=new DOMException("signal is aborted without reason")}catch{(b=new Error("This operation was aborted")).name="AbortError"}
714this.signal.reason=b,this.signal.dispatchEvent(f)}},{key:"toString",value:function(){return"[object AbortController]"}}]),m})();typeof Symbol<"u"&&Symbol.toStringTag&&(w.prototype[Symbol.toStringTag]="AbortController",d.prototype[Symbol.toStringTag]="AbortSignal"),i.AbortController=w,i.AbortSignal=d,i.abortableFetch=function(m){typeof m=="function"&&(m={fetch:m});var g=m,f=g.fetch,b=g.Request,v=b===void 0?f.Request:b,_=g.AbortController,A=g.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,S=A!==void 0&&A;if(!(function(x){return x.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?!0:typeof x.Request=="function"&&!x.Request.prototype.hasOwnProperty("signal")||!x.AbortController})({Request:v,AbortController:_,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:S}))return{fetch:f,Request:C};var C=v;(C&&!C.prototype.hasOwnProperty("signal")||S)&&((C=function(x,T){var y;T&&T.signal&&(y=T.signal,delete T.signal);var E=new v(x,T);return y&&Object.defineProperty(E,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),E}).prototype=v.prototype);var R=f;return{fetch:function(x,T){var y=C&&C.prototype.isPrototypeOf(x)?x.signal:T?T.signal:void 0;if(y){var E;try{E=new DOMException("Aborted","AbortError")}catch{(E=new Error("Aborted")).name="AbortError"}if(y.aborted)return Promise.reject(E);var L=new Promise((function(N,q){y.addEventListener("abort",(function(){return q(E)}),{once:!0})}));return T&&T.signal&&delete T.signal,Promise.race([L,R(x,T)])}return R(x,T)},Request:C}}},9742:(n,i)=>{i.byteLength=function(p){var d=c(p),w=d[0],m=d[1];return 3*(w+m)/4-m},i.toByteArray=function(p){var d,w,m=c(p),g=m[0],f=m[1],b=new a((function(A,S,C){return 3*(S+C)/4-C})(0,g,f)),v=0,_=f>0?g-4:g;for(w=0;w<_;w+=4)d=o[p.charCodeAt(w)]<<18|o[p.charCodeAt(w+1)]<<12|o[p.charCodeAt(w+2)]<<6|o[p.charCodeAt(w+3)],b[v++]=d>>16&255,b[v++]=d>>8&255,b[v++]=255&d;return f===2&&(d=o[p.charCodeAt(w)]<<2|o[p.charCodeAt(w+1)]>>4,b[v++]=255&d),f===1&&(d=o[p.charCodeAt(w)]<<10|o[p.charCodeAt(w+1)]<<4|o[p.charCodeAt(w+2)]>>2,b[v++]=d>>8&255,b[v++]=255&d),b},i.fromByteArray=function(p){for(var d,w=p.length,m=w%3,g=[],f=16383,b=0,v=w-m;b<v;b+=f)g.push(u(p,b,b+f>v?v:b+f));return m===1?(d=p[w-1],g.push(s[d>>2]+s[d<<4&63]+"==")):m===2&&(d=(p[w-2]<<8)+p[w-1],g.push(s[d>>10]+s[d>>4&63]+s[d<<2&63]+"=")),g.join("")};for(var s=[],o=[],a=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0;h<64;++h)s[h]=l[h],o[l.charCodeAt(h)]=h;function c(p){var d=p.length;if(d%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=p.indexOf("=");return w===-1&&(w=d),[w,w===d?0:4-w%4]}function u(p,d,w){for(var m,g,f=[],b=d;b<w;b+=3)m=(p[b]<<16&16711680)+(p[b+1]<<8&65280)+(255&p[b+2]),f.push(s[(g=m)>>18&63]+s[g>>12&63]+s[g>>6&63]+s[63&g]);return f.join("")}o[45]=62,o[95]=63},2779:(n,i,s)=>{var o=s(8764).Buffer,a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function l(u){if(o.isBuffer(u))return u;var p=typeof o.alloc=="function"&&typeof o.from=="function";if(typeof u=="number")return p?o.alloc(u):new o(u);if(typeof u=="string")return p?o.from(u):new o(u);throw new Error("input must be buffer, number, or string, received "+typeof u)}function h(u,p){u=l(u),o.isBuffer(p)&&(p=p.readUInt32BE(0));for(var d=~p,w=0;w<u.length;w++)d=a[255&(d^u[w])]^d>>>8;return~d}function c(){return(function(u){var p=l(4);return p.writeInt32BE(u,0),p})(h.apply(null,arguments))}typeof Int32Array<"u"&&(a=new Int32Array(a)),c.signed=function(){return h.apply(null,arguments)},c.unsigned=function(){return h.apply(null,arguments)>>>0},n.exports=c},8764:(n,i,s)=>{const o=s(9742),a=s(645),l=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=u,i.SlowBuffer=function(M){return+M!=M&&(M=0),u.alloc(+M)},i.INSPECT_MAX_BYTES=50;const h=2147483647;
714function c(M){if(M>h)throw new RangeError('The value "'+M+'" is invalid for option "size"');const I=new Uint8Array(M);return Object.setPrototypeOf(I,u.prototype),I}function u(M,I,D){if(typeof M=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(M)}return p(M,I,D)}function p(M,I,D){if(typeof M=="string")return(function(tt,lt){if(typeof lt=="string"&<!==""||(lt="utf8"),!u.isEncoding(lt))throw new TypeError("Unknown encoding: "+lt);const Et=0|b(tt,lt);let zt=c(Et);const te=zt.write(tt,lt);return te!==Et&&(zt=zt.slice(0,te)),zt})(M,I);if(ArrayBuffer.isView(M))return(function(tt){if(ct(tt,Uint8Array)){const lt=new Uint8Array(tt);return g(lt.buffer,lt.byteOffset,lt.byteLength)}return m(tt)})(M);if(M==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof M);if(ct(M,ArrayBuffer)||M&&ct(M.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ct(M,SharedArrayBuffer)||M&&ct(M.buffer,SharedArrayBuffer)))return g(M,I,D);if(typeof M=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Y=M.valueOf&&M.valueOf();if(Y!=null&&Y!==M)return u.from(Y,I,D);const J=(function(tt){if(u.isBuffer(tt)){const lt=0|f(tt.length),Et=c(lt);return Et.length===0||tt.copy(Et,0,0,lt),Et}return tt.length!==void 0?typeof tt.length!="number"||kt(tt.length)?c(0):m(tt):tt.type==="Buffer"&&Array.isArray(tt.data)?m(tt.data):void 0})(M);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof M[Symbol.toPrimitive]=="function")return u.from(M[Symbol.toPrimitive]("string"),I,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof M)}function d(M){if(typeof M!="number")throw new TypeError('"size" argument must be of type number');if(M<0)throw new RangeError('The value "'+M+'" is invalid for option "size"')}function w(M){return d(M),c(M<0?0:0|f(M))}function m(M){const I=M.length<0?0:0|f(M.length),D=c(I);for(let Y=0;Y<I;Y+=1)D[Y]=255&M[Y];return D}function g(M,I,D){if(I<0||M.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(M.byteLength<I+(D||0))throw new RangeError('"length" is outside of buffer bounds');let Y;return Y=I===void 0&&D===void 0?new Uint8Array(M):D===void 0?new Uint8Array(M,I):new Uint8Array(M,I,D),Object.setPrototypeOf(Y,u.prototype),Y}function f(M){if(M>=h)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h.toString(16)+" bytes");return 0|M}function b(M,I){if(u.isBuffer(M))return M.length;if(ArrayBuffer.isView(M)||ct(M,ArrayBuffer))return M.byteLength;if(typeof M!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof M);const D=M.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&D===0)return 0;let J=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return gt(M).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*D;case"hex":return D>>>1;case"base64":return _t(M).length;default:if(J)return Y?-1:gt(M).length;I=(""+I).toLowerCase(),J=!0}}function v(M,I,D){let Y=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0)<=(I>>>=0))return"";for(M||(M="utf8");;)switch(M){case"hex":return W(this,I,D);case"utf8":case"utf-8":return L(this,I,D);case"ascii":return q(this,I,D);case"latin1":case"binary":return H(this,I,D);case"base64":return E(this,I,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,I,D);default:if(Y)throw new TypeError("Unknown encoding: "+M);M=(M+"").toLowerCase(),Y=!0}}function _(M,I,D){const Y=M[I];M[I]=M[D],M[D]=Y}function A(M,I,D,Y,J){if(M.length===0)return-1;
714if(typeof D=="string"?(Y=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),kt(D=+D)&&(D=J?0:M.length-1),D<0&&(D=M.length+D),D>=M.length){if(J)return-1;D=M.length-1}else if(D<0){if(!J)return-1;D=0}if(typeof I=="string"&&(I=u.from(I,Y)),u.isBuffer(I))return I.length===0?-1:S(M,I,D,Y,J);if(typeof I=="number")return I&=255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(M,I,D):Uint8Array.prototype.lastIndexOf.call(M,I,D):S(M,[I],D,Y,J);throw new TypeError("val must be string, number or Buffer")}function S(M,I,D,Y,J){let tt,lt=1,Et=M.length,zt=I.length;if(Y!==void 0&&((Y=String(Y).toLowerCase())==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le")){if(M.length<2||I.length<2)return-1;lt=2,Et/=2,zt/=2,D/=2}function te(It,Qt){return lt===1?It[Qt]:It.readUInt16BE(Qt*lt)}if(J){let It=-1;for(tt=D;tt<Et;tt++)if(te(M,tt)===te(I,It===-1?0:tt-It)){if(It===-1&&(It=tt),tt-It+1===zt)return It*lt}else It!==-1&&(tt-=tt-It),It=-1}else for(D+zt>Et&&(D=Et-zt),tt=D;tt>=0;tt--){let It=!0;for(let Qt=0;Qt<zt;Qt++)if(te(M,tt+Qt)!==te(I,Qt)){It=!1;break}if(It)return tt}return-1}function C(M,I,D,Y){D=Number(D)||0;const J=M.length-D;Y?(Y=Number(Y))>J&&(Y=J):Y=J;const tt=I.length;let lt;for(Y>tt/2&&(Y=tt/2),lt=0;lt<Y;++lt){const Et=parseInt(I.substr(2*lt,2),16);if(kt(Et))return lt;M[D+lt]=Et}return lt}function R(M,I,D,Y){return xt(gt(I,M.length-D),M,D,Y)}function x(M,I,D,Y){return xt((function(J){const tt=[];for(let lt=0;lt<J.length;++lt)tt.push(255&J.charCodeAt(lt));return tt})(I),M,D,Y)}function T(M,I,D,Y){return xt(_t(I),M,D,Y)}function y(M,I,D,Y){return xt((function(J,tt){let lt,Et,zt;const te=[];for(let It=0;It<J.length&&!((tt-=2)<0);++It)lt=J.charCodeAt(It),Et=lt>>8,zt=lt%256,te.push(zt),te.push(Et);return te})(I,M.length-D),M,D,Y)}function E(M,I,D){return I===0&&D===M.length?o.fromByteArray(M):o.fromByteArray(M.slice(I,D))}function L(M,I,D){D=Math.min(M.length,D);const Y=[];let J=I;for(;J<D;){const tt=M[J];let lt=null,Et=tt>239?4:tt>223?3:tt>191?2:1;if(J+Et<=D){let zt,te,It,Qt;switch(Et){case 1:tt<128&&(lt=tt);break;case 2:zt=M[J+1],(192&zt)==128&&(Qt=(31&tt)<<6|63&zt,Qt>127&&(lt=Qt));break;case 3:zt=M[J+1],te=M[J+2],(192&zt)==128&&(192&te)==128&&(Qt=(15&tt)<<12|(63&zt)<<6|63&te,Qt>2047&&(Qt<55296||Qt>57343)&&(lt=Qt));break;case 4:zt=M[J+1],te=M[J+2],It=M[J+3],(192&zt)==128&&(192&te)==128&&(192&It)==128&&(Qt=(15&tt)<<18|(63&zt)<<12|(63&te)<<6|63&It,Qt>65535&&Qt<1114112&&(lt=Qt))}}lt===null?(lt=65533,Et=1):lt>65535&&(lt-=65536,Y.push(lt>>>10&1023|55296),lt=56320|1023<),Y.push(lt),J+=Et}return(function(tt){const lt=tt.length;if(lt<=N)return String.fromCharCode.apply(String,tt);let Et="",zt=0;for(;zt<lt;)Et+=String.fromCharCode.apply(String,tt.slice(zt,zt+=N));return Et})(Y)}i.kMaxLength=h,u.TYPED_ARRAY_SUPPORT=(function(){try{const M=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(M,I),M.foo()===42}catch{return!1}})(),u.TYPED_ARRAY_SUPPORT||typeof console>"u",Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(M,I,D){return p(M,I,D)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(M,I,D){return(function(Y,J,tt){return d(Y),Y<=0?c(Y):J!==void 0?typeof tt=="string"?c(Y).fill(J,tt):c(Y).fill(J):c(Y)})(M,I,D)},u.allocUnsafe=function(M){return w(M)},u.allocUnsafeSlow=function(M){return w(M)},u.isBuffer=function(M){return M!=null&&M._isBuffer===!0&&M!==u.prototype},u.compare=function(M,I){if(ct(M,Uint8Array)&&(M=u.from(M,M.offset,M.byteLength)),ct(I,Uint8Array)&&(I=u.from(I,I.offset,I.byteLength)),!u.isBuffer(M)||!u.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(M===I)return 0;let D=M.length,Y=I.length;for(let J=0,tt=Math.min(D,Y);J<tt;++J)if(M[J]!==I[J]){D=M[J],Y=I[J];break}return D<Y?-1:Y<D?1:0},u.isEncoding=function(M){switch(String(M).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(M,I){if(!Array.isArray(M))throw new TypeError('"list" argument must be an Array of Buffers');if(M.length===0)return u.alloc(0);let D;if(I===void 0)for(I=0,D=0;D<M.length;++D)I+=M[D].length;const Y=u.allocUnsafe(I);let J=0;for(D=0;D<M.length;++D){let tt=M[D];if(ct(tt,Uint8Array))J+tt.length>Y.length?(u.isBuffer(tt)||(tt=u.from(tt)),tt.copy(Y,J)):Uint8Array.prototype.set.call(Y,tt,J);else{if(!u.isBuffer(tt))throw new TypeError('"list" argument must be an Array of Buffers');tt.copy(Y,J)}J+=tt.length}return Y},u.byteLength=b,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const M=this.length;if(M%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<M;I+=2)_(this,I,I+1);return this},u.prototype.swap32=function(){const M=this.length;if(M%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<M;I+=4)_(this,I,I+3),_(this,I+1,I+2);return this},u.prototype.swap64=function(){const M=this.length;if(M%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<M;I+=8)_(this,I,I+7),_(this,I+1,I+6),_(this,I+2,I+5),_(this,I+3,I+4);return this},u.prototype.toString=function(){const M=this.length;return M===0?"":arguments.length===0?L(this,0,M):v.apply(this,arguments)}
vendor: 7,791 bytes, line 714
714,u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(M){if(!u.isBuffer(M))throw new TypeError("Argument must be a Buffer");return this===M||u.compare(this,M)===0},u.prototype.inspect=function(){let M="";const I=i.INSPECT_MAX_BYTES;return M=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(M+=" ... "),"<Buffer "+M+">"},l&&(u.prototype[l]=u.prototype.inspect),u.prototype.compare=function(M,I,D,Y,J){if(ct(M,Uint8Array)&&(M=u.from(M,M.offset,M.byteLength)),!u.isBuffer(M))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof M);if(I===void 0&&(I=0),D===void 0&&(D=M?M.length:0),Y===void 0&&(Y=0),J===void 0&&(J=this.length),I<0||D>M.length||Y<0||J>this.length)throw new RangeError("out of range index");if(Y>=J&&I>=D)return 0;if(Y>=J)return-1;if(I>=D)return 1;if(this===M)return 0;let tt=(J>>>=0)-(Y>>>=0),lt=(D>>>=0)-(I>>>=0);const Et=Math.min(tt,lt),zt=this.slice(Y,J),te=M.slice(I,D);for(let It=0;It<Et;++It)if(zt[It]!==te[It]){tt=zt[It],lt=te[It];break}return tt<lt?-1:lt<tt?1:0},u.prototype.includes=function(M,I,D){return this.indexOf(M,I,D)!==-1},u.prototype.indexOf=function(M,I,D){return A(this,M,I,D,!0)},u.prototype.lastIndexOf=function(M,I,D){return A(this,M,I,D,!1)},u.prototype.write=function(M,I,D,Y){if(I===void 0)Y="utf8",D=this.length,I=0;else if(D===void 0&&typeof I=="string")Y=I,D=this.length,I=0;else{if(!isFinite(I))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");I>>>=0,isFinite(D)?(D>>>=0,Y===void 0&&(Y="utf8")):(Y=D,D=void 0)}const J=this.length-I;if((D===void 0||D>J)&&(D=J),M.length>0&&(D<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");let tt=!1;for(;;)switch(Y){case"hex":return C(this,M,I,D);case"utf8":case"utf-8":return R(this,M,I,D);case"ascii":case"latin1":case"binary":return x(this,M,I,D);case"base64":return T(this,M,I,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,M,I,D);default:if(tt)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),tt=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function q(M,I,D){let Y="";D=Math.min(M.length,D);for(let J=I;J<D;++J)Y+=String.fromCharCode(127&M[J]);return Y}function H(M,I,D){let Y="";D=Math.min(M.length,D);for(let J=I;J<D;++J)Y+=String.fromCharCode(M[J]);return Y}function W(M,I,D){const Y=M.length;(!I||I<0)&&(I=0),(!D||D<0||D>Y)&&(D=Y);let J="";for(let tt=I;tt<D;++tt)J+=At[M[tt]];return J}function U(M,I,D){const Y=M.slice(I,D);let J="";for(let tt=0;tt<Y.length-1;tt+=2)J+=String.fromCharCode(Y[tt]+256*Y[tt+1]);return J}function k(M,I,D){if(M%1!=0||M<0)throw new RangeError("offset is not uint");if(M+I>D)throw new RangeError("Trying to access beyond buffer length")}function O(M,I,D,Y,J,tt){if(!u.isBuffer(M))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>J||I<tt)throw new RangeError('"value" argument is out of bounds');if(D+Y>M.length)throw new RangeError("Index out of range")}function z(M,I,D,Y,J){st(I,Y,J,M,D,7);let tt=Number(I&BigInt(4294967295));M[D++]=tt,tt>>=8,M[D++]=tt,tt>>=8,M[D++]=tt,tt>>=8,M[D++]=tt;let lt=Number(I>>BigInt(32)&BigInt(4294967295));return M[D++]=lt,lt>>=8,M[D++]=lt,lt>>=8,M[D++]=lt,lt>>=8,M[D++]=lt,D}function B(M,I,D,Y,J){st(I,Y,J,M,D,7);let tt=Number(I&BigInt(4294967295));M[D+7]=tt,tt>>=8,M[D+6]=tt,tt>>=8,M[D+5]=tt,tt>>=8,M[D+4]=tt;let lt=Number(I>>BigInt(32)&BigInt(4294967295));return M[D+3]=lt,lt>>=8,M[D+2]=lt,lt>>=8,M[D+1]=lt,lt>>=8,M[D]=lt,D+8}function F(M,I,D,Y,J,tt){if(D+Y>M.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function j(M,I,D,Y,J){return I=+I,D>>>=0,J||F(M,0,D,4),a.write(M,I,D,Y,23,4),D+4}function $(M,I,D,Y,J){return I=+I,D>>>=0,J||F(M,0,D,8),a.write(M,I,D,Y,52,8),D+8}u.prototype.slice=function(M,I){const D=this.length;(M=~~M)<0?(M+=D)<0&&(M=0):M>D&&(M=D),(I=I===void 0?D:~~I)<0?(I+=D)<0&&(I=0):I>D&&(I=D),I<M&&(I=M);const Y=this.subarray(M,I);return Object.setPrototypeOf(Y,u.prototype),Y},u.prototype.readUintLE=u.prototype.readUIntLE=function(M,I,D){M>>>=0,I>>>=0,D||k(M,I,this.length);let Y=this[M],J=1,tt=0;for(;++tt<I&&(J*=256);)Y+=this[M+tt]*J;return Y},u.prototype.readUintBE=u.prototype.readUIntBE=function(M,I,D){M>>>=0,I>>>=0,D||k(M,I,this.length);let Y=this[M+--I],J=1;for(;I>0&&(J*=256);)Y+=this[M+--I]*J;return Y},u.prototype.readUint8=u.prototype.readUInt8=function(M,I){return M>>>=0,I||k(M,1,this.length),this[M]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(M,I){return M>>>=0,I||k(M,2,this.length),this[M]|this[M+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(M,I){return M>>>=0,I||k(M,2,this.length),this[M]<<8|this[M+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(M,I){return M>>>=0,I||k(M,4,this.length),(this[M]|this[M+1]<<8|this[M+2]<<16)+16777216*this[M+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(M,I){return M>>>=0,I||k(M,4,this.length),16777216*this[M]+(this[M+1]<<16|this[M+2]<<8|this[M+3])},u.prototype.readBigUInt64LE=St((function(M){nt(M>>>=0,"offset");const I=this[M],D=this[M+7];I!==void 0&&D!==void 0||it(M,this.length-8);const Y=I+256*this[++M]+65536*this[++M]+this[++M]*2**24,J=this[++M]+256*this[++M]+65536*this[++M]+D*2**24;return BigInt(Y)+(BigInt(J)<<BigInt(32))})),u.prototype.readBigUInt64BE=St((function(M){nt(M>>>=0,"offset");const I=this[M],D=this[M+7];I!==void 0&&D!==void 0||it(M,this.length-8);const Y=I*2**24+65536*this[++M]+256*this[++M]+this[++M],J=this[++M]*2**24+65536*this[++M]+256*this[++M]+D;return(BigInt(Y)<<BigInt(32))+BigInt(J)})),u.prototype.readIntLE=function(M,I,D){M>>>=0,I>>>=0,D||k(M,I,this.length);let Y=this[M],J=1,tt=0;for(;++tt<I&&(J*=256);)Y+=this[M+tt]*J;return J*=128,Y>=J&&(Y-=Math.pow(2,8*I)),Y},u.prototype.readIntBE=function(M,I,D){M>>>=0,I>>>=0,D||k(M,I,this.length);let Y=I,J=1,tt=this[M+--Y];for(;Y>0&&(J*=256);)tt+=this[M+--Y]*J;return J*=128,tt>=J&&(tt-=Math.pow(2,8*I)),tt},u.prototype.readInt8=function(M,I){return M>>>=0,I||k(M,1,this.length),128&this[M]?-1*(255-this[M]+1):this[M]},u.prototype.readInt16LE=function(M,I){M>>>=0,I||k(M,2,this.length);const D=this[M]|this[M+1]<<8;return 32768&D?4294901760|D:D},u.prototype.readInt16BE=function(M,I){M>>>=0,I||k(M,2,this.length);const D=this[M+1]|this[M]<<8;return 32768&D?4294901760|D:D},u.prototype.readInt32LE=function(M,I){return M>>>=0,I||k(M,4,this.length),this[M]|this[M+1]<<8|this[M+2]<<16|this[M+3]<<24},u.prototype.readInt32BE=function(M,I){return M>>>=0,I||k(M,4,this.length),this[M]<<24|this[M+1]<<16|this[M+2]<<8|this[M+3]},u.prototype.readBigInt64LE=St((function(M){nt(M>>>=0,"offset");const I=this[M],D=this[M+7];I!==void 0&&D!==void 0||it(M,this.length-8);const Y=this[M+4]+256*this[M+5]+65536*this[M+6]+(D<<24);return(BigInt(Y)<<BigInt(32))+BigInt(I+256*this[++M]+65536*this[++M]+this[++M]*16777216)})),u.prototype.readBigInt64BE=St((function(M){nt(M>>>=0,"offset");const I=this[M],D=this[M+7];I!==void 0&&D!==void 0||it(M,this.length-8);const Y=(I<<24)+65536*this[++M]+256*this[++M]+this[++M];return(BigInt(Y)<<BigInt(32))+BigInt(this[++M]*16777216+65536*this[++M]+256*this[++M]+D)})),u.prototype.readFloatLE=function(M,I){return M>>>=0,I||k(M,4,this.length),a.read(this,M,!0,23,4)},u.prototype.readFloatBE=function(M,I){return M>>>=0,I||k(M,4,this.length),a.read(this,M,!1,23,4)},u.prototype.readDoubleLE=function(M,I){return M>>>=0,I||k(M,8,this.length),a.read(this,M,!0,52,8)},u.prototype.readDoubleBE=function(M,I){return M>>>=0,I||k(M,8,this.length),a.read(this,M,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(M,I,D,Y){M=+M,I>>>=0,D>>>=0,Y||O(this,M,I,D,Math.pow(2,8*D)-1,0);let J=1,tt=0;for(this[I]=255&M;
vendor: 3,762 bytes, line 714
714++tt<D&&(J*=256);)this[I+tt]=M/J&255;return I+D},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(M,I,D,Y){M=+M,I>>>=0,D>>>=0,Y||O(this,M,I,D,Math.pow(2,8*D)-1,0);let J=D-1,tt=1;for(this[I+J]=255&M;--J>=0&&(tt*=256);)this[I+J]=M/tt&255;return I+D},u.prototype.writeUint8=u.prototype.writeUInt8=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,1,255,0),this[I]=255&M,I+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,2,65535,0),this[I]=255&M,this[I+1]=M>>>8,I+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,2,65535,0),this[I]=M>>>8,this[I+1]=255&M,I+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,4,4294967295,0),this[I+3]=M>>>24,this[I+2]=M>>>16,this[I+1]=M>>>8,this[I]=255&M,I+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,4,4294967295,0),this[I]=M>>>24,this[I+1]=M>>>16,this[I+2]=M>>>8,this[I+3]=255&M,I+4},u.prototype.writeBigUInt64LE=St((function(M,I=0){return z(this,M,I,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=St((function(M,I=0){return B(this,M,I,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(M,I,D,Y){if(M=+M,I>>>=0,!Y){const Et=Math.pow(2,8*D-1);O(this,M,I,D,Et-1,-Et)}let J=0,tt=1,lt=0;for(this[I]=255&M;++J<D&&(tt*=256);)M<0&<===0&&this[I+J-1]!==0&&(lt=1),this[I+J]=(M/tt|0)-lt&255;return I+D},u.prototype.writeIntBE=function(M,I,D,Y){if(M=+M,I>>>=0,!Y){const Et=Math.pow(2,8*D-1);O(this,M,I,D,Et-1,-Et)}let J=D-1,tt=1,lt=0;for(this[I+J]=255&M;--J>=0&&(tt*=256);)M<0&<===0&&this[I+J+1]!==0&&(lt=1),this[I+J]=(M/tt|0)-lt&255;return I+D},u.prototype.writeInt8=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,1,127,-128),M<0&&(M=255+M+1),this[I]=255&M,I+1},u.prototype.writeInt16LE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,2,32767,-32768),this[I]=255&M,this[I+1]=M>>>8,I+2},u.prototype.writeInt16BE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,2,32767,-32768),this[I]=M>>>8,this[I+1]=255&M,I+2},u.prototype.writeInt32LE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,4,2147483647,-2147483648),this[I]=255&M,this[I+1]=M>>>8,this[I+2]=M>>>16,this[I+3]=M>>>24,I+4},u.prototype.writeInt32BE=function(M,I,D){return M=+M,I>>>=0,D||O(this,M,I,4,2147483647,-2147483648),M<0&&(M=4294967295+M+1),this[I]=M>>>24,this[I+1]=M>>>16,this[I+2]=M>>>8,this[I+3]=255&M,I+4},u.prototype.writeBigInt64LE=St((function(M,I=0){return z(this,M,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=St((function(M,I=0){return B(this,M,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(M,I,D){return j(this,M,I,!0,D)},u.prototype.writeFloatBE=function(M,I,D){return j(this,M,I,!1,D)},u.prototype.writeDoubleLE=function(M,I,D){return $(this,M,I,!0,D)},u.prototype.writeDoubleBE=function(M,I,D){return $(this,M,I,!1,D)},u.prototype.copy=function(M,I,D,Y){if(!u.isBuffer(M))throw new TypeError("argument should be a Buffer");if(D||(D=0),Y||Y===0||(Y=this.length),I>=M.length&&(I=M.length),I||(I=0),Y>0&&Y<D&&(Y=D),Y===D||M.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("Index out of range");if(Y<0)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),M.length-I<Y-D&&(Y=M.length-I+D);const J=Y-D;return this===M&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,D,Y):Uint8Array.prototype.set.call(M,this.subarray(D,Y),I),J},u.prototype.fill=function(M,I,D,Y){if(typeof M=="string"){if(typeof I=="string"?(Y=I,I=0,D=this.length):typeof D=="str
714ing"&&(Y=D,D=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!u.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(M.length===1){const tt=M.charCodeAt(0);(Y==="utf8"&&tt<128||Y==="latin1")&&(M=tt)}}else typeof M=="number"?M&=255:typeof M=="boolean"&&(M=Number(M));if(I<0||this.length<I||this.length<D)throw new RangeError("Out of range index");if(D<=I)return this;let J;if(I>>>=0,D=D===void 0?this.length:D>>>0,M||(M=0),typeof M=="number")for(J=I;J<D;++J)this[J]=M;else{const tt=u.isBuffer(M)?M:u.from(M,Y),lt=tt.length;if(lt===0)throw new TypeError('The value "'+M+'" is invalid for argument "value"');for(J=0;J<D-I;++J)this[J+I]=tt[J%lt]}return this};const G={};function Z(M,I,D){G[M]=class extends D{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${M}]`,this.stack,delete this.name}get code(){return M}set code(Y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Y,writable:!0})}toString(){return`${this.name} [${M}]: ${this.message}`}}}function X(M){let I="",D=M.length;const Y=M[0]==="-"?1:0;for(;D>=Y+4;D-=3)I=`_${M.slice(D-3,D)}${I}`;return`${M.slice(0,D)}${I}`}function st(M,I,D,Y,J,tt){if(M>D||M<I){const lt=typeof I=="bigint"?"n":"";let Et;throw Et=I===0||I===BigInt(0)?`>= 0${lt} and < 2${lt} ** ${8*(tt+1)}${lt}`:`>= -(2${lt} ** ${8*(tt+1)-1}${lt}) and < 2 ** ${8*(tt+1)-1}${lt}`,new G.ERR_OUT_OF_RANGE("value",Et,M)}(function(lt,Et,zt){nt(Et,"offset"),lt[Et]!==void 0&<[Et+zt]!==void 0||it(Et,lt.length-(zt+1))})(Y,J,tt)}function nt(M,I){if(typeof M!="number")throw new G.ERR_INVALID_ARG_TYPE(I,"number",M)}function it(M,I,D){throw Math.floor(M)!==M?(nt(M,D),new G.ERR_OUT_OF_RANGE("offset","an integer",M)):I<0?new G.ERR_BUFFER_OUT_OF_BOUNDS:new G.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${I}`,M)}Z("ERR_BUFFER_OUT_OF_BOUNDS",(function(M){return M?`${M} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Z("ERR_INVALID_ARG_TYPE",(function(M,I){return`The "${M}" argument must be of type number. Received type ${typeof I}`}),TypeError),Z("ERR_OUT_OF_RANGE",(function(M,I,D){let Y=`The value of "${M}" is out of range.`,J=D;return Number.isInteger(D)&&Math.abs(D)>4294967296?J=X(String(D)):typeof D=="bigint"&&(J=String(D),(D>BigInt(2)**BigInt(32)||D<-(BigInt(2)**BigInt(32)))&&(J=X(J)),J+="n"),Y+=` It must be ${I}. Received ${J}`,Y}),RangeError);const mt=/[^+/0-9A-Za-z-_]/g;function gt(M,I){let D;I=I||1/0;const Y=M.length;let J=null;const tt=[];for(let lt=0;lt<Y;++lt){if(D=M.charCodeAt(lt),D>55295&&D<57344){if(!J){if(D>56319){(I-=3)>-1&&tt.push(239,191,189);continue}if(lt+1===Y){(I-=3)>-1&&tt.push(239,191,189);continue}J=D;continue}if(D<56320){(I-=3)>-1&&tt.push(239,191,189),J=D;continue}D=65536+(J-55296<<10|D-56320)}else J&&(I-=3)>-1&&tt.push(239,191,189);if(J=null,D<128){if((I-=1)<0)break;tt.push(D)}else if(D<2048){if((I-=2)<0)break;tt.push(D>>6|192,63&D|128)}else if(D<65536){if((I-=3)<0)break;tt.push(D>>12|224,D>>6&63|128,63&D|128)}else{if(!(D<1114112))throw new Error("Invalid code point");if((I-=4)<0)break;tt.push(D>>18|240,D>>12&63|128,D>>6&63|128,63&D|128)}}return tt}function _t(M){return o.toByteArray((function(I){if((I=(I=I.split("=")[0]).trim().replace(mt,"")).length<2)return"";for(;I.length%4!=0;)I+="=";return I})(M))}function xt(M,I,D,Y){let J;for(J=0;J<Y&&!(J+D>=I.length||J>=M.length);++J)I[J+D]=M[J];return J}function ct(M,I){return M instanceof I||M!=null&&M.constructor!=null&&M.constructor.name!=null&&M.constructor.name===I.name}function kt(M){return M!=M}const At=(function(){const M="0123456789abcdef",I=new Array(256);for(let D=0;D<16;++D){const Y=16*D;for(let J=0;J<16;++J)I[Y+J]=M[D]+M[J]}return I})();function St(M){return typeof BigInt>"u"?Ut:M}function Ut(){throw new Error("BigInt not supported")}},4693:n=>{var i={array:function(s){var o=0,a=0,l=[0,1,3,7,15,31,63,127,255];return function(h){for(var c=0;h>0;){var u=8-o;h>=u?(c<<=u,c|=l[u]&s[a++],o=0,h-=u):(c<<=h,c|=(s[a]&l[h]<<8-h-o)>>8-h-o,o+=h,h=0)}return c}},simple:function(s){var o,a,l=i.header(s),h=[],c=0;do(a=i.decompress(s,l))!=-1&&(h.push(a),c+=a.byteLength);while(a!=-1);o=new Uint8Array(c),c=0;for(var u=0;u<h.length;++u)a=h[u],o.set(a,c),c+=a.byteLength;return o},header:function(s){if(s(24)!=4348520)throw"No magic number found";var o=s(8)-48;if(o<1||o>9)throw"Not a BZIP archive";return o},decompress:function(s,o,a){for(var l=9e5,h="",c=0;c<6;c++)h+=s(8).toString(16);if(h=="177245385090")return-1;
714if(h!="314159265359")throw"eek not valid bzip data";if(s(32),s(1))throw"unsupported obsolete version";var u=s(24);if(u>l)throw"Initial position larger than buffer size";var p=s(16),d=new Uint8Array(256),w=0;for(c=0;c<16;c++)if(p&1<<15-c){var m=s(16);for(_=0;_<16;_++)m&1<<15-_&&(d[w++]=16*c+_)}var g=s(3);if(g<2||g>6)throw"another error";var f=s(15);if(f==0)throw"meh";var b=[];for(c=0;c<g;c++)b[c]=c;var v=new Uint8Array(32768);for(c=0;c<f;c++){for(var _=0;s(1);_++)if(_>=g)throw"whoops another error";var A=b[_];b.splice(_,1),b.splice(0,0,A),v[c]=A}var S=w+2,C=[];for(_=0;_<g;_++){var R,x,T,y=new Uint8Array(258),E=new Uint8Array(21);for(p=s(5),c=0;c<S;c++){for(;;){if(p<1||p>20)throw"I gave up a while ago on writing error messages";if(!s(1))break;s(1)?p--:p++}y[c]=p}for(R=x=y[0],c=1;c<S;c++)y[c]>x?x=y[c]:y[c]<R&&(R=y[c]);(T=C[_]={}).permute=new Uint32Array(258),T.limit=new Uint32Array(21),T.base=new Uint32Array(21),T.minLen=R,T.maxLen=x;var L=T.base.subarray(1),N=T.limit.subarray(1),q=0;for(c=R;c<=x;c++)for(p=0;p<S;p++)y[p]==c&&(T.permute[q++]=p);for(c=R;c<=x;c++)E[c]=N[c]=0;for(c=0;c<S;c++)E[y[c]]++;for(q=p=0,c=R;c<x;c++)q+=E[c],N[c]=q-1,q<<=1,L[c+1]=q-(p+=E[c]);N[x]=q+E[x]-1,L[R]=0}var H,W,U,k=new Uint32Array(256);for(c=0;c<256;c++)b[c]=c;H=W=S=U=0;for(var O=new Uint32Array(l);;){if(!S--){if(S=49,U>=f)throw"meow i'm a kitty, that's an error";L=(T=C[v[U++]]).base.subarray(1),N=T.limit.subarray(1)}for(_=s(c=T.minLen);;){if(c>T.maxLen)throw"rawr i'm a dinosaur";if(_<=N[c])break;c++,_=_<<1|s(1)}if((_-=L[c])<0||_>=258)throw"moo i'm a cow";var z=T.permute[_];if(z!=0&&z!=1){if(H){if(H=0,W+p>=l)throw"Boom.";for(k[A=d[b[0]]]+=p;p--;)O[W++]=A}if(z>w)break;if(W>=l)throw"I can't think of anything. Error";A=b[c=z-1],b.splice(c,1),b.splice(0,0,A),k[A=d[A]]++,O[W++]=A}else H||(H=1,p=0),p+=z==0?H:2*H,H<<=1}if(u<0||u>=W)throw"I'm a monkey and I'm throwing something at someone, namely you";for(_=0,c=0;c<256;c++)m=_+k[c],k[c]=_,_=m;for(c=0;c<W;c++)O[k[A=255&O[c]]]|=c<<8,k[A]++;var B=0,F=0,j=0;W&&(F=255&(B=O[u]),B>>=8,j=-1);var $,G,Z,X=new Uint8Array(l),st=0;for(a||(a=1/0);W;){for(W--,G=F,F=255&(B=O[B]),B>>=8,j++==3?($=F,Z=G,F=-1):($=1,Z=F);$--;)if(X[st++]=Z,!--a)return X;F!=G&&(j=0)}return X.subarray(0,st)}};n.exports=i},487:n=>{var i={utf8:{stringToBytes:function(s){return i.bin.stringToBytes(unescape(encodeURIComponent(s)))},bytesToString:function(s){return decodeURIComponent(escape(i.bin.bytesToString(s)))}},bin:{stringToBytes:function(s){for(var o=[],a=0;a<s.length;a++)o.push(255&s.charCodeAt(a));return o},bytesToString:function(s){for(var o=[],a=0;a<s.length;a++)o.push(String.fromCharCode(s[a]));return o.join("")}}};n.exports=i},1012:n=>{var i,s;i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s={rotl:function(o,a){return o<<a|o>>>32-a},rotr:function(o,a){return o<<32-a|o>>>a},endian:function(o){if(o.constructor==Number)return 16711935&s.rotl(o,8)|4278255360&s.rotl(o,24);for(var a=0;a<o.length;a++)o[a]=s.endian(o[a]);return o},randomBytes:function(o){for(var a=[];o>0;o--)a.push(Math.floor(256*Math.random()));return a},bytesToWords:function(o){for(var a=[],l=0,h=0;l<o.length;l++,h+=8)a[h>>>5]|=o[l]<<24-h%32;return a},wordsToBytes:function(o){for(var a=[],l=0;l<32*o.length;l+=8)a.push(o[l>>>5]>>>24-l%32&255);return a},bytesToHex:function(o){for(var a=[],l=0;l<o.length;l++)a.push((o[l]>>>4).toString(16)),a.push((15&o[l]).toString(16));return a.join("")},hexToBytes:function(o){for(var a=[],l=0;l<o.length;l+=2)a.push(parseInt(o.substr(l,2),16));return a},bytesToBase64:function(o){for(var a=[],l=0;l<o.length;l+=3)for(var h=o[l]<<16|o[l+1]<<8|o[l+2],c=0;c<4;c++)8*l+6*c<=8*o.length?a.push(i.charAt(h>>>6*(3-c)&63)):a.push("=");return a.join("")},base64ToBytes:function(o){o=o.replace(/[^A-Z0-9+\/]/gi,"");for(var a=[],l=0,h=0;l<o.length;h=++l%4)h!=0&&a.push((i.indexOf(o.charAt(l-1))&Math.pow(2,-2*h+8)-1)<<2*h|i.indexOf(o.charAt(l))>>>6-2*h);return a}},n.exports=s},2949:(n,i,s)=>{s.r(i),s.d(i,{BlobFile:()=>p,LocalFile:()=>a(),RemoteFile:()=>c,fromUrl:()=>d,open:()=>w});var o=s(7067),a=s.n(o),l=s(8764);const h=typeof window<"u"?window:typeof self<"u"?self:{fetch:void 0};class c{constructor(g,f={}){this.baseOverrides={},this.url=g;const b=f.fetch||h.fetch&&h.fetch.bind(h);if(!b)throw new TypeError("no fetch function supplied, and none found in global environment");f.overrides&&(this.baseOverrides=f.overrides),this.fetchImplementation=b}async getBufferFromResponse(g){if(typeof g.buffer=="function")return g.buffer();if(typeof g.arrayBuffer=="function"){const f=await g.arrayBuffer();return l.Buffer.from(f)}throw new TypeError("invalid HTTP response object, has no buffer method, and no arrayBuffer method")}async fetch(g,f){let b;try{b=await this.fetchImplementation(g,f)}catch(v){if(!`${v}`.includes("Failed to fetch"))throw v;b=await this.fetchImplementation(g,{...f,cache:"reload"})}return b}async read(g,f=0,b,v=0,_={}){const{headers:A={},signal:S,overrides:C={}}=_;b<1/0?A.range=`bytes=${v}-${v+b}`:b===1/0&&v!==0&&(A.range=`bytes=${v}-`);const R={...this.baseOverrides,...C,headers:{...A,...C.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:S},x=await this.fetch(this.url,R);if(!x.ok)throw new Error(`HTTP ${x.status} ${x.statusText} ${this.url}`);if(x.status===200&&v===0||x.status===206){const T=await this.getBufferFromResponse(x),y=T.copy(g,f,0,Math.min(b,T.length)),E=x.headers.get("content-range"),L=/\/(\d+)$/.exec(E||"");return L&&L[1]&&(this._stat={size:parseInt(L[1],10)}),{bytesRead:y,buffer:g}}throw x.status===200?new Error("${this.url} fetch returned status 200, expected 206"):new Error(`HTTP ${x.status} fetching ${this.url}`)}async readFile(g={}){let f,b;typeof g=="string"?(f=g,b={}):(f=g.encoding,b=g,delete b.encoding);const{headers:v={},signal:_,overrides:A={}}=b,S={headers:v,method:"GET",redirect:"follow",mode:"cors",signal:_,...this.baseOverrides,...A},C=await this.fetch(this.url,S);if(!C)throw new Error("generic-filehandle failed to fetch");if(C.status!==200)throw Object.assign(new Error(`HTTP ${C.status} fetching ${this.url}`),{status:C.status});if(f==="utf8")return C.text();if(f)throw new Error(`unsupported encoding: ${f}`);return this.getBufferFromResponse(C)}async stat(){if(!this._stat){const g=l.Buffer.allocUnsafe(10);if(await this.read(g,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}async close(){}}function u(m){const g=new FileReader;return new Promise(((f,b)=>{g.onerror=()=>{g.abort(),b(new Error("problem reading blob"))},g.onabort=()=>{b(new Error("blob reading was aborted"))},g.onload=()=>{g.result&&typeof g.result!="string"?f(g.result):b(new Error("unknown error reading blob"))},g.readAsArrayBuffer(m)}))}class p{constructor(g){this.blob=g,this.size=g.size}async read(g,f=0,b,v=0){if(!b)return{bytesRead:0,buffer:g};const _=v,A=_+b,S=await u(this.blob.slice(_,A)),C=l.Buffer.from(S);return{bytesRead:C.copy(g,f),buffer:C}}async readFile(g){let f;if(f=typeof g=="string"?g:g&&g.encoding,f==="utf8")return(function(v){const _=new FileReader;return new Promise(((A,S)=>{_.onerror=()=>{_.abort(),S(new Error("problem reading blob"))},_.onabort=()=>{S(new Error("blob reading was aborted"))},_.onload=()=>{_.result&&typeof _.result=="string"?A(_.result):S(new Error("unknown error reading blob"))},_.readAsText(v)}))})(this.blob);if(f)throw new Error(`unsupported encoding: ${f}`);const b=await u(this.blob);return l.Buffer.from(b)}
vendor: 12,110 bytes, line 714
714async stat(){return{size:this.size}}async close(){}}function d(m,g={}){return new c(m,g)}function w(m,g,f,b={}){if(f!==void 0)return f;if(m!==void 0)return d(m,b);if(g!==void 0)return new(a())(g,b);throw new Error("no url, path, or filehandle provided, cannot open")}},645:(n,i)=>{i.read=function(s,o,a,l,h){var c,u,p=8*h-l-1,d=(1<<p)-1,w=d>>1,m=-7,g=a?h-1:0,f=a?-1:1,b=s[o+g];for(g+=f,c=b&(1<<-m)-1,b>>=-m,m+=p;m>0;c=256*c+s[o+g],g+=f,m-=8);for(u=c&(1<<-m)-1,c>>=-m,m+=l;m>0;u=256*u+s[o+g],g+=f,m-=8);if(c===0)c=1-w;else{if(c===d)return u?NaN:1/0*(b?-1:1);u+=Math.pow(2,l),c-=w}return(b?-1:1)*u*Math.pow(2,c-l)},i.write=function(s,o,a,l,h,c){var u,p,d,w=8*c-h-1,m=(1<<w)-1,g=m>>1,f=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=l?0:c-1,v=l?1:-1,_=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(p=isNaN(o)?1:0,u=m):(u=Math.floor(Math.log(o)/Math.LN2),o*(d=Math.pow(2,-u))<1&&(u--,d*=2),(o+=u+g>=1?f/d:f*Math.pow(2,1-g))*d>=2&&(u++,d/=2),u+g>=m?(p=0,u=m):u+g>=1?(p=(o*d-1)*Math.pow(2,h),u+=g):(p=o*Math.pow(2,g-1)*Math.pow(2,h),u=0));h>=8;s[a+b]=255&p,b+=v,p/=256,h-=8);for(u=u<<h|p,w+=h;w>0;s[a+b]=255&u,b+=v,u/=256,w-=8);s[a+b-v]|=128*_}},8738:n=>{function i(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}n.exports=function(s){return s!=null&&(i(s)||(function(o){return typeof o.readFloatLE=="function"&&typeof o.slice=="function"&&i(o.slice(0,0))})(s)||!!s._isBuffer)}},3720:n=>{n.exports=s;var i=null;try{i=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function s(E,L,N){this.low=0|E,this.high=0|L,this.unsigned=!!N}function o(E){return(E&&E.__isLong__)===!0}s.prototype.__isLong__,Object.defineProperty(s.prototype,"__isLong__",{value:!0}),s.isLong=o;var a={},l={};function h(E,L){var N,q,H;return L?(H=0<=(E>>>=0)&&E<256)&&(q=l[E])?q:(N=u(E,(0|E)<0?-1:0,!0),H&&(l[E]=N),N):(H=-128<=(E|=0)&&E<128)&&(q=a[E])?q:(N=u(E,E<0?-1:0,!1),H&&(a[E]=N),N)}function c(E,L){if(isNaN(E))return L?_:v;if(L){if(E<0)return _;if(E>=g)return x}else{if(E<=-f)return T;if(E+1>=f)return R}return E<0?c(-E,L).neg():u(E%m|0,E/m|0,L)}function u(E,L,N){return new s(E,L,N)}s.fromInt=h,s.fromNumber=c,s.fromBits=u;var p=Math.pow;function d(E,L,N){if(E.length===0)throw Error("empty string");if(E==="NaN"||E==="Infinity"||E==="+Infinity"||E==="-Infinity")return v;if(typeof L=="number"?(N=L,L=!1):L=!!L,(N=N||10)<2||36<N)throw RangeError("radix");var q;if((q=E.indexOf("-"))>0)throw Error("interior hyphen");if(q===0)return d(E.substring(1),L,N).neg();for(var H=c(p(N,8)),W=v,U=0;U<E.length;U+=8){var k=Math.min(8,E.length-U),O=parseInt(E.substring(U,U+k),N);if(k<8){var z=c(p(N,k));W=W.mul(z).add(c(O))}else W=(W=W.mul(H)).add(c(O))}return W.unsigned=L,W}function w(E,L){return typeof E=="number"?c(E,L):typeof E=="string"?d(E,L):u(E.low,E.high,typeof L=="boolean"?L:E.unsigned)}s.fromString=d,s.fromValue=w;var m=4294967296,g=m*m,f=g/2,b=h(1<<24),v=h(0);s.ZERO=v;var _=h(0,!0);s.UZERO=_;var A=h(1);s.ONE=A;var S=h(1,!0);s.UONE=S;var C=h(-1);s.NEG_ONE=C;var R=u(-1,2147483647,!1);s.MAX_VALUE=R;var x=u(-1,-1,!0);s.MAX_UNSIGNED_VALUE=x;var T=u(0,-2147483648,!1);s.MIN_VALUE=T;var y=s.prototype;y.toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},y.toString=function(E){if((E=E||10)<2||36<E)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var L=c(E),N=this.div(L),q=N.mul(L).sub(this);return N.toString(E)+q.toInt().toString(E)}return"-"+this.neg().toString(E)}for(var H=c(p(E,6),this.unsigned),W=this,U="";;){var k=W.div(H),O=(W.sub(k.mul(H)).toInt()>>>0).toString(E);if((W=k).isZero())return O+U;for(;O.length<6;)O="0"+O;U=""+O+U}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var E=this.high!=0?this.high:this.low,L=31;L>0&&!(E&1<<L);L--);return this.high!=0?L+33:L+1},y.isZero=function(){return this.high===0&&this.low===0},y.eqz=y.isZero,y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return!(1&~this.low)},y.isEven=function(){return!(1&this.low)},y.equals=function(E){return o(E)||(E=w(E)),(this.unsigned===E.unsigned||this.high>>>31!=1||E.high>>>31!=1)&&this.high===E.high&&this.low===E.low},y.eq=y.equals,y.notEquals=function(E){return!this.eq(E)},y.neq=y.notEquals,y.ne=y.notEquals,y.lessThan=function(E){return this.comp(E)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(E){return this.comp(E)<=0},y.lte=y.lessThanOrEqual,y.le=y.lessThanOrEqual,y.greaterThan=function(E){return this.comp(E)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(E){return this.comp(E)>=0},y.gte=y.greaterThanOrEqual,y.ge=y.greaterThanOrEqual,y.compare=function(E){if(o(E)||(E=w(E)),this.eq(E))return 0;var L=this.isNegative(),N=E.isNegative();return L&&!N?-1:!L&&N?1:this.unsigned?E.high>>>0>this.high>>>0||E.high===this.high&&E.low>>>0>this.low>>>0?-1:1:this.sub(E).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(A)},y.neg=y.negate,y.add=function(E){o(E)||(E=w(E));var L=this.high>>>16,N=65535&this.high,q=this.low>>>16,H=65535&this.low,W=E.high>>>16,U=65535&E.high,k=E.low>>>16,O=0,z=0,B=0,F=0;return B+=(F+=H+(65535&E.low))>>>16,z+=(B+=q+k)>>>16,O+=(z+=N+U)>>>16,O+=L+W,u((B&=65535)<<16|(F&=65535),(O&=65535)<<16|(z&=65535),this.unsigned)},y.subtract=function(E){return o(E)||(E=w(E)),this.add(E.neg())},y.sub=y.subtract,y.multiply=function(E){if(this.isZero())return v;if(o(E)||(E=w(E)),i)return u(i.mul(this.low,this.high,E.low,E.high),i.get_high(),this.unsigned);if(E.isZero())return v;if(this.eq(T))return E.isOdd()?T:v;if(E.eq(T))return this.isOdd()?T:v;if(this.isNegative())return E.isNegative()?this.neg().mul(E.neg()):this.neg().mul(E).neg();if(E.isNegative())return this.mul(E.neg()).neg();if(this.lt(b)&&E.lt(b))return c(this.toNumber()*E.toNumber(),this.unsigned);var L=this.high>>>16,N=65535&this.high,q=this.low>>>16,H=65535&this.low,W=E.high>>>16,U=65535&E.high,k=E.low>>>16,O=65535&E.low,z=0,B=0,F=0,j=0;return F+=(j+=H*O)>>>16,B+=(F+=q*O)>>>16,F&=65535,B+=(F+=H*k)>>>16,z+=(B+=N*O)>>>16,B&=65535,z+=(B+=q*k)>>>16,B&=65535,z+=(B+=H*U)>>>16,z+=L*O+N*k+q*U+H*W,u((F&=65535)<<16|(j&=65535),(z&=65535)<<16|(B&=65535),this.unsigned)},y.mul=y.multiply,y.divide=function(E){if(o(E)||(E=w(E)),E.isZero())throw Error("division by zero");var L,N,q;if(i)return this.unsigned||this.high!==-2147483648||E.low!==-1||E.high!==-1?u((this.unsigned?i.div_u:i.div_s)(this.low,this.high,E.low,E.high),i.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?_:v;if(this.unsigned){if(E.unsigned||(E=E.toUnsigned()),E.gt(this))return _;if(E.gt(this.shru(1)))return S;q=_}else{if(this.eq(T))return E.eq(A)||E.eq(C)?T:E.eq(T)?A:(L=this.shr(1).div(E).shl(1)).eq(v)?E.isNegative()?A:C:(N=this.sub(E.mul(L)),q=L.add(N.div(E)));if(E.eq(T))return this.unsigned?_:v;if(this.isNegative())return E.isNegative()?this.neg().div(E.neg()):this.neg().div(E).neg();if(E.isNegative())return this.div(E.neg()).neg();q=v}for(N=this;N.gte(E);){L=Math.max(1,Math.floor(N.toNumber()/E.toNumber()));for(var H=Math.ceil(Math.log(L)/Math.LN2),W=H<=48?1:p(2,H-48),U=c(L),k=U.mul(E);k.isNegative()||k.gt(N);)k=(U=c(L-=W,this.unsigned)).mul(E);U.isZero()&&(U=A),q=q.add(U),N=N.sub(k)}return q},y.div=y.divide,y.modulo=function(E){return o(E)||(E=w(E)),i?u((this.unsigned?i.rem_u:i.rem_s)(this.low,this.high,E.low,E.high),i.get_high(),this.unsigned):this.sub(this.div(E).mul(E))},y.mod=y.modulo,y.rem=y.modulo,y.not=function(){return u(~this.low,~this.high,this.unsigned)},y.and=function(E){return o(E)||(E=w(E)),u(this.low&E.low,this.high&E.high,this.unsigned)},y.or=function(E){return o(E)||(E=w(E)),u(this.low|E.low,this.high|E.high,this.unsigned)},y.xor=function(E){return o(E)||(E=w(E)),u(this.low^E.low,this.high^E.high,this.unsigned)},y.shiftLeft=function(E){return o(E)&&(E=E.toInt()),(E&=63)==0?this:E<32?u(this.low<<E,this.high<<E|this.low>>>32-E,this.unsigned):u(0,this.low<<E-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(E){return o(E)&&(E=E.toInt()),(E&=63)==0?this:E<32?u(this.low>>>E|this.high<<32-E,this.high>>E,this.unsigned):u(this.high>>E-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(E){if(o(E)&&(E=E.toInt()),(E&=63)==0)return this;var L=this.high;return E<32?u(this.low>>>E|L<<32-E,L>>>E,this.unsigned):u(E===32?L:L>>>E-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.shr_u=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},y.toBytes=function(E){return E?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var E=this.high,L=this.low;return[255&L,L>>>8&255,L>>>16&255,L>>>24,255&E,E>>>8&255,E>>>16&255,E>>>24]},y.toBytesBE=function(){var E=this.high,L=this.low;return[E>>>24,E>>>16&255,E>>>8&255,255&E,L>>>24,L>>>16&255,L>>>8&255,255&L]},s.fromBytes=function(E,L,N){return N?s.fromBytesLE(E,L):s.fromBytesBE(E,L)},s.fromBytesLE=function(E,L){return new s(E[0]|E[1]<<8|E[2]<<16|E[3]<<24,E[4]|E[5]<<8|E[6]<<16|E[7]<<24,L)},s.fromBytesBE=function(E,L){return new s(E[4]<<24|E[5]<<16|E[6]<<8|E[7],E[0]<<24|E[1]<<16|E[2]<<8|E[3],L)}},2568:(n,i,s)=>{var o,a,l,h,c;o=s(1012),a=s(487).utf8,l=s(8738),h=s(487).bin,(c=function(u,p){u.constructor==String?u=p&&p.encoding==="binary"?h.stringToBytes(u):a.stringToBytes(u):l(u)?u=Array.prototype.slice.call(u,0):Array.isArray(u)||u.constructor===Uint8Array||(u=u.toString());for(var d=o.bytesToWords(u),w=8*u.length,m=1732584193,g=-271733879,f=-1732584194,b=271733878,v=0;v<d.length;v++)d[v]=16711935&(d[v]<<8|d[v]>>>24)|4278255360&(d[v]<<24|d[v]>>>8);d[w>>>5]|=128<<w%32,d[14+(w+64>>>9<<4)]=w;var _=c._ff,A=c._gg,S=c._hh,C=c._ii;for(v=0;v<d.length;v+=16){var R=m,x=g,T=f,y=b;m=_(m,g,f,b,d[v+0],7,-680876936),b=_(b,m,g,f,d[v+1],12,-389564586),f=_(f,b,m,g,d[v+2],17,606105819),g=_(g,f,b,m,d[v+3],22,-1044525330),m=_(m,g,f,b,d[v+4],7,-176418897),b=_(b,m,g,f,d[v+5],12,1200080426),f=_(f,b,m,g,d[v+6],17,-1473231341),g=_(g,f,b,m,d[v+7],22,-45705983),m=_(m,g,f,b,d[v+8],7,1770035416),b=_(b,m,g,f,d[v+9],12,-1958414417),f=_(f,b,m,g,d[v+10],17,-42063),g=_(g,f,b,m,d[v+11],22,-1990404162),m=_(m,g,f,b,d[v+12],7,1804603682),b=_(b,m,g,f,d[v+13],12,-40341101),f=_(f,b,m,g,d[v+14],17,-1502002290),m=A(m,g=_(g,f,b,m,d[v+15],22,1236535329),f,b,d[v+1],5,-165796510),b=A(b,m,g,f,d[v+6],9,-1069501632),f=A(f,b,m,g,d[v+11],14,643717713),g=A(g,f,b,m,d[v+0],20,-373897302),m=A(m,g,f,b,d[v+5],5,-701558691),b=A(b,m,g,f,d[v+10],9,38016083),f=A(f,b,m,g,d[v+15],14,-660478335),g=A(g,f,b,m,d[v+4],20,-405537848),m=A(m,g,f,b,d[v+9],5,568446438),b=A(b,m,g,f,d[v+14],9,-1019803690),f=A(f,b,m,g,d[v+3],14,-187363961),g=A(g,f,b,m,d[v+8],20,1163531501),m=A(m,g,f,b,d[v+13],5,-1444681467),b=A(b,m,g,f,d[v+2],9,-51403784),f=A(f,b,m,g,d[v+7],14,1735328473),m=S(m,g=A(g,f,b,m,d[v+12],20,-1926607734),f,b,d[v+5],4,-378558),b=S(b,m,g,f,d[v+8],
71411,-2022574463),f=S(f,b,m,g,d[v+11],16,1839030562),g=S(g,f,b,m,d[v+14],23,-35309556),m=S(m,g,f,b,d[v+1],4,-1530992060),b=S(b,m,g,f,d[v+4],11,1272893353),f=S(f,b,m,g,d[v+7],16,-155497632),g=S(g,f,b,m,d[v+10],23,-1094730640),m=S(m,g,f,b,d[v+13],4,681279174),b=S(b,m,g,f,d[v+0],11,-358537222),f=S(f,b,m,g,d[v+3],16,-722521979),g=S(g,f,b,m,d[v+6],23,76029189),m=S(m,g,f,b,d[v+9],4,-640364487),b=S(b,m,g,f,d[v+12],11,-421815835),f=S(f,b,m,g,d[v+15],16,530742520),m=C(m,g=S(g,f,b,m,d[v+2],23,-995338651),f,b,d[v+0],6,-198630844),b=C(b,m,g,f,d[v+7],10,1126891415),f=C(f,b,m,g,d[v+14],15,-1416354905),g=C(g,f,b,m,d[v+5],21,-57434055),m=C(m,g,f,b,d[v+12],6,1700485571),b=C(b,m,g,f,d[v+3],10,-1894986606),f=C(f,b,m,g,d[v+10],15,-1051523),g=C(g,f,b,m,d[v+1],21,-2054922799),m=C(m,g,f,b,d[v+8],6,1873313359),b=C(b,m,g,f,d[v+15],10,-30611744),f=C(f,b,m,g,d[v+6],15,-1560198380),g=C(g,f,b,m,d[v+13],21,1309151649),m=C(m,g,f,b,d[v+4],6,-145523070),b=C(b,m,g,f,d[v+11],10,-1120210379),f=C(f,b,m,g,d[v+2],15,718787259),g=C(g,f,b,m,d[v+9],21,-343485551),m=m+R>>>0,g=g+x>>>0,f=f+T>>>0,b=b+y>>>0}return o.endian([m,g,f,b])})._ff=function(u,p,d,w,m,g,f){var b=u+(p&d|~p&w)+(m>>>0)+f;return(b<<g|b>>>32-g)+p},c._gg=function(u,p,d,w,m,g,f){var b=u+(p&w|d&~w)+(m>>>0)+f;return(b<<g|b>>>32-g)+p},c._hh=function(u,p,d,w,m,g,f){var b=u+(p^d^w)+(m>>>0)+f;return(b<<g|b>>>32-g)+p},c._ii=function(u,p,d,w,m,g,f){var b=u+(d^(p|~w))+(m>>>0)+f;return(b<<g|b>>>32-g)+p},c._blocksize=16,c._digestsize=16,n.exports=function(u,p){if(u==null)throw new Error("Illegal argument "+u);var d=o.wordsToBytes(c(u,p));return p&&p.asBytes?d:p&&p.asString?h.bytesToString(d):o.bytesToHex(d)}},9591:(n,i,s)=>{var o={};(0,s(4236).assign)(o,s(4555),s(8843),s(1619)),n.exports=o},4555:(n,i,s)=>{var o=s(405),a=s(4236),l=s(9373),h=s(8898),c=s(2292),u=Object.prototype.toString;function p(w){if(!(this instanceof p))return new p(w);this.options=a.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},w||{});var m=this.options;m.raw&&m.windowBits>0?m.windowBits=-m.windowBits:m.gzip&&m.windowBits>0&&m.windowBits<16&&(m.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var g=o.deflateInit2(this.strm,m.level,m.method,m.windowBits,m.memLevel,m.strategy);if(g!==0)throw new Error(h[g]);if(m.header&&o.deflateSetHeader(this.strm,m.header),m.dictionary){var f;if(f=typeof m.dictionary=="string"?l.string2buf(m.dictionary):u.call(m.dictionary)==="[object ArrayBuffer]"?new Uint8Array(m.dictionary):m.dictionary,(g=o.deflateSetDictionary(this.strm,f))!==0)throw new Error(h[g]);this._dict_set=!0}}function d(w,m){var g=new p(m);if(g.push(w,!0),g.err)throw g.msg||h[g.err];return g.result}p.prototype.push=function(w,m){var g,f,b=this.strm,v=this.options.chunkSize;if(this.ended)return!1;f=m===~~m?m:m===!0?4:0,typeof w=="string"?b.input=l.string2buf(w):u.call(w)==="[object ArrayBuffer]"?b.input=new Uint8Array(w):b.input=w,b.next_in=0,b.avail_in=b.input.length;do{if(b.avail_out===0&&(b.output=new a.Buf8(v),b.next_out=0,b.avail_out=v),(g=o.deflate(b,f))!==1&&g!==0)return this.onEnd(g),this.ended=!0,!1;b.avail_out!==0&&(b.avail_in!==0||f!==4&&f!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(b.output,b.next_out))):this.onData(a.shrinkBuf(b.output,b.next_out)))}while((b.avail_in>0||b.avail_out===0)&&g!==1);return f===4?(g=o.deflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===0):f!==2||(this.onEnd(0),b.avail_out=0,!0)},p.prototype.onData=function(w){this.chunks.push(w)},p.prototype.onEnd=function(w){w===0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},i.Deflate=p,i.deflate=d,i.deflateRaw=function(w,m){return(m=m||{}).raw=!0,d(w,m)},i.gzip=function(w,m){return(m=m||{}).gzip=!0,d(w,m)}},8843:(n,i,s)=>{var o=s(7948),a=s(4236),l=s(9373),h=s(1619),c=s(8898),u=s(2292),p=s(2401),d=Object.prototype.toString;function w(g){if(!(this instanceof w))return new w(g);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},g||{});var f=this.options;f.raw&&f.windowBits>=0&&f.windowBits<16&&(f.windowBits=-f.windowBits,f.windowBits===0&&(f.windowBits=-15)),!(f.windowBits>=0&&f.windowBits<16)||g&&g.windowBits||(f.windowBits+=32),f.windowBits>15&&f.windowBits<48&&!(15&f.windowBits)&&(f.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=o.inflateInit2(this.strm,f.windowBits);if(b!==h.Z_OK)throw new Error(c[b]);if(this.header=new p,o.inflateGetHeader(this.strm,this.header),f.dictionary&&(typeof f.dictionary=="string"?f.dictionary=l.string2buf(f.dictionary):d.call(f.dictionary)==="[object ArrayBuffer]"&&(f.dictionary=new Uint8Array(f.dictionary)),f.raw&&(b=o.inflateSetDictionary(this.strm,f.dictionary))!==h.Z_OK))throw new Error(c[b])}function m(g,f){var b=new w(f);if(b.push(g,!0),b.err)throw b.msg||c[b.err];return b.result}w.prototype.push=function(g,f){var b,v,_,A,S,C=this.strm,R=this.options.chunkSize,x=this.options.dictionary,T=!1;if(this.ended)return!1;v=f===~~f?f:f===!0?h.Z_FINISH:h.Z_NO_FLUSH,typeof g=="string"?C.input=l.binstring2buf(g):d.call(g)==="[object ArrayBuffer]"?C.input=new
vendor: 2,876 bytes, line 714
714Uint8Array(g):C.input=g,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new a.Buf8(R),C.next_out=0,C.avail_out=R),(b=o.inflate(C,h.Z_NO_FLUSH))===h.Z_NEED_DICT&&x&&(b=o.inflateSetDictionary(this.strm,x)),b===h.Z_BUF_ERROR&&T===!0&&(b=h.Z_OK,T=!1),b!==h.Z_STREAM_END&&b!==h.Z_OK)return this.onEnd(b),this.ended=!0,!1;C.next_out&&(C.avail_out!==0&&b!==h.Z_STREAM_END&&(C.avail_in!==0||v!==h.Z_FINISH&&v!==h.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=l.utf8border(C.output,C.next_out),A=C.next_out-_,S=l.buf2string(C.output,_),C.next_out=A,C.avail_out=R-A,A&&a.arraySet(C.output,C.output,_,A,0),this.onData(S)):this.onData(a.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(T=!0)}while((C.avail_in>0||C.avail_out===0)&&b!==h.Z_STREAM_END);return b===h.Z_STREAM_END&&(v=h.Z_FINISH),v===h.Z_FINISH?(b=o.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h.Z_OK):v!==h.Z_SYNC_FLUSH||(this.onEnd(h.Z_OK),C.avail_out=0,!0)},w.prototype.onData=function(g){this.chunks.push(g)},w.prototype.onEnd=function(g){g===h.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},i.Inflate=w,i.inflate=m,i.inflateRaw=function(g,f){return(f=f||{}).raw=!0,m(g,f)},i.ungzip=m},4236:(n,i)=>{var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function o(h,c){return Object.prototype.hasOwnProperty.call(h,c)}i.assign=function(h){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var u=c.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var p in u)o(u,p)&&(h[p]=u[p])}}return h},i.shrinkBuf=function(h,c){return h.length===c?h:h.subarray?h.subarray(0,c):(h.length=c,h)};var a={arraySet:function(h,c,u,p,d){if(c.subarray&&h.subarray)h.set(c.subarray(u,u+p),d);else for(var w=0;w<p;w++)h[d+w]=c[u+w]},flattenChunks:function(h){var c,u,p,d,w,m;for(p=0,c=0,u=h.length;c<u;c++)p+=h[c].length;for(m=new Uint8Array(p),d=0,c=0,u=h.length;c<u;c++)w=h[c],m.set(w,d),d+=w.length;return m}},l={arraySet:function(h,c,u,p,d){for(var w=0;w<p;w++)h[d+w]=c[u+w]},flattenChunks:function(h){return[].concat.apply([],h)}};i.setTyped=function(h){h?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,l))},i.setTyped(s)},9373:(n,i,s)=>{var o=s(4236),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var h=new o.Buf8(256),c=0;c<256;c++)h[c]=c>=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;function u(p,d){if(d<65534&&(p.subarray&&l||!p.subarray&&a))return String.fromCharCode.apply(null,o.shrinkBuf(p,d));for(var w="",m=0;m<d;m++)w+=String.fromCharCode(p[m]);return w}h[254]=h[254]=1,i.string2buf=function(p){var d,w,m,g,f,b=p.length,v=0;for(g=0;g<b;
714g++)(64512&(w=p.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=p.charCodeAt(g+1)))==56320&&(w=65536+(w-55296<<10)+(m-56320),g++),v+=w<128?1:w<2048?2:w<65536?3:4;for(d=new o.Buf8(v),f=0,g=0;f<v;g++)(64512&(w=p.charCodeAt(g)))==55296&&g+1<b&&(64512&(m=p.charCodeAt(g+1)))==56320&&(w=65536+(w-55296<<10)+(m-56320),g++),w<128?d[f++]=w:w<2048?(d[f++]=192|w>>>6,d[f++]=128|63&w):w<65536?(d[f++]=224|w>>>12,d[f++]=128|w>>>6&63,d[f++]=128|63&w):(d[f++]=240|w>>>18,d[f++]=128|w>>>12&63,d[f++]=128|w>>>6&63,d[f++]=128|63&w);return d},i.buf2binstring=function(p){return u(p,p.length)},i.binstring2buf=function(p){for(var d=new o.Buf8(p.length),w=0,m=d.length;w<m;w++)d[w]=p.charCodeAt(w);return d},i.buf2string=function(p,d){var w,m,g,f,b=d||p.length,v=new Array(2*b);for(m=0,w=0;w<b;)if((g=p[w++])<128)v[m++]=g;else if((f=h[g])>4)v[m++]=65533,w+=f-1;else{for(g&=f===2?31:f===3?15:7;f>1&&w<b;)g=g<<6|63&p[w++],f--;f>1?v[m++]=65533:g<65536?v[m++]=g:(g-=65536,v[m++]=55296|g>>10&1023,v[m++]=56320|1023&g)}return u(v,m)},i.utf8border=function(p,d){var w;for((d=d||p.length)>p.length&&(d=p.length),w=d-1;w>=0&&(192&p[w])==128;)w--;return w<0||w===0?d:w+h[p[w]]>d?w:d}},6069:n=>{n.exports=function(i,s,o,a){for(var l=65535&i,h=i>>>16&65535,c=0;o!==0;){o-=c=o>2e3?2e3:o;do h=h+(l=l+s[a++]|0)|0;while(--c);l%=65521,h%=65521}return l|h<<16}},1619:n=>{n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},2869:n=>{var i=(function(){for(var s,o=[],a=0;a<256;a++){s=a;for(var l=0;l<8;l++)s=1&s?3988292384^s>>>1:s>>>1;o[a]=s}return o})();n.exports=function(s,o,a,l){var h=i,c=l+a;s^=-1;for(var u=l;u<c;u++)s=s>>>8^h[255&(s^o[u])];return~s}},405:(n,i,s)=>{var o,a=s(4236),l=s(342),h=s(6069),c=s(2869),u=s(8898),p=-2,d=258,w=262,m=103,g=113,f=666;function b(k,O){return k.msg=u[O],O}function v(k){return(k<<1)-(k>4?9:0)}function _(k){for(var O=k.length;--O>=0;)k[O]=0}function A(k){var O=k.state,z=O.pending;z>k.avail_out&&(z=k.avail_out),z!==0&&(a.arraySet(k.output,O.pending_buf,O.pending_out,z,k.next_out),k.next_out+=z,O.pending_out+=z,k.total_out+=z,k.avail_out-=z,O.pending-=z,O.pending===0&&(O.pending_out=0))}function S(k,O){l._tr_flush_block(k,k.block_start>=0?k.block_start:-1,k.strstart-k.block_start,O),k.block_start=k.strstart,A(k.strm)}function C(k,O){k.pending_buf[k.pending++]=O}function R(k,O){k.pending_buf[k.pending++]=O>>>8&255,k.pending_buf[k.pending++]=255&O}function x(k,O,z,B){var F=k.avail_in;return F>B&&(F=B),F===0?0:(k.avail_in-=F,a.arraySet(O,k.input,k.next_in,F,z),k.state.wrap===1?k.adler=h(k.adler,O,F,z):k.state.wrap===2&&(k.adler=c(k.adler,O,F,z)),k.next_in+=F,k.total_in+=F,F)}function T(k,O){var z,B,F=k.max_chain_length,j=k.strstart,$=k.prev_length,G=k.nice_match,Z=k.strstart>k.w_size-w?k.strstart-(k.w_size-w):0,X=k.window,st=k.w_mask,nt=k.prev,it=k.strstart+d,mt=X[j+$-1],gt=X[j+$];k.prev_length>=k.good_match&&(F>>=2),G>k.lookahead&&(G=k.lookahead);do if(X[(z=O)+$]===gt&&X[z+$-1]===mt&&X[z]===X[j]&&X[++z]===X[j+1]){j+=2,z++;do;while(X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&X[++j]===X[++z]&&j<it);if(B=d-(it-j),j=it-d,B>$){if(k.match_start=O,$=B,B>=G)break;mt=X[j+$-1],gt=X[j+$]}}while((O=nt[O&st])>Z&&--F!=0);return $<=k.lookahead?$:k.lookahead}function y(k){var O,z,B,F,j,$=k.w_size;do{if(F=k.window_size-k.lookahead-k.strstart,k.strstart>=$+($-w)){a.arraySet(k.window,k.window,$,$,0),k.match_start-=$,k.strstart-=$,k.block_start-=$,O=z=k.hash_size;do B=k.head[--O],k.head[O]=B>=$?B-$:0;while(--z);O=z=$;do B=k.prev[--O],k.prev[O]=B>=$?B-$:0;while(--z);F+=$}if(k.strm.avail_in===0)break;if(z=x(k.strm,k.window,k.strstart+k.lookahead,F),k.lookahead+=z,k.lookahead+k.insert>=3)for(j=k.strstart-k.insert,k.ins_h=k.window[j],k.ins_h=(k.ins_h<<k.hash_shift^k.window[j+1])&k.hash_mask;k.insert&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[j+3-1])&k.hash_mask,k.prev[j&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=j,j++,k.insert--,!(k.lookahead+k.insert<3)););}while(k.lookahead<w&&k.strm.avail_in!==0)}function E(k,O){for(var z,B;;){if(k.lookahead<w){if(y(k),k.lookahead<w&&O===0)return 1;if(k.lookahead===0)break}if(z=0,k.lookahead>=3&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+3-1])&k.hash_mask,z=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),z!==0&&k.strstart-z<=k.w_size-w&&(k.match_length=T(k,z)),k.match_length>=3)if(B=l._tr_tally(k,k.strstart-k.match_start,k.match_length-3),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=3){k.match_length--;do k.strstart++,k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+3-1])&k.hash_mask,z=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart;while(--k.match_length!=0);k.strstart++}else k.strstart+=k.match_length,k.match_length=0,k.ins_h=k.window[k.strstart],k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+1])&k.hash_mask;else B=l._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++;if(B&&(S(k,!1),k.strm.avail_out===0))return 1}return k.insert=k.strstart<2?k.strstart:2,O===4?(S(k,!0),k.strm.avail_out===0?3:4):k.last_lit&&(S(k,!1),k.strm.avail_out===0)?1:2}function L(k,O){for(var z,B,F;;){if(k.lookahead<w){if(y(k),k.lookahead<w&&O===0)return 1;if(k.lookahead===0)break}if(z=0,k.lookahead>=3&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+3-1])&k.hash_mask,z=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart),k.prev_length=k.match_length,k.prev_match=k.match_start,k.match_length=2,z!==0&&k.prev_length<k.max_lazy_match&&k.strstart-z<=k.w_size-w&&(k.match_length=T(k,z),k.match_length<=5&&(k.strategy===1||k.match_length===3&&k.strstart-k.match_start>4096)&&(k.match_length=2)),k.prev_length>=3&&k.match_length<=k.prev_length){F=k.strstart+k.lookahead-3,B=l._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-3),k.lookahead-=k.prev_length-1,k.prev_length-=2;do++k.strstart<=F&&(k.ins_h=(k.ins_h<<k.hash_shift^k.window[k.strstart+3-1])&k.hash_mask,z=k.prev[k.strstart&k.w_mask]=k.head[k.ins_h],k.head[k.ins_h]=k.strstart);while(--k.prev_length!=0);if(k.match_available=0,k.match_length=2,k.strstart++,B&&(S(k,!1),k.strm.avail_out===0))return 1}else if(k.match_available){if((B=l._tr_tally(k,0,k.window[k.strstart-1]))&&S(k,!1),k.strstart++,k.lookahead--,k.strm.avail_out===0)return 1}else k.match_available=1,k.strstart++,k.lookahead--}return k.match_available&&(B=l._tr_tally(k,0,k.window[k.strstart-1]),k.match_available=0),k.insert=k.strstart<2?k.strstart:2,O===4?(S(k,!0),k.strm.avail_out===0?3:4):k.last_lit&&(S(k,!1),k.strm.avail_out===0)?1:2}function N(k,O,z,B,F){this.good_length=k,this.max_lazy=O,this.nice_length=z,this.max_chain=B,this.func=F}function q(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(1146),this.dyn_dtree=new a.Buf16(122),this.bl_tree=new a.Buf16(78),_(this.dyn_ltree),_(this.dyn_dtree),_(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(16),this.heap=new a.Buf16(573),_(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(573),_(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function H(k){var O;return k&&k.state?(k.total_in=k.total_out=0,k.data_type=2,(O=k.state).pending=0,O.pending_out=0,O.wrap<0&&(O.wrap=-O.wrap),O.status=O.wrap?42:g,k.adler=O.wrap===2?0:1,O.last_flush=0,l._tr_init(O),0):b(k,p)}function W(k){var O,z=H(k);return z===0&&((O=k.state).window_size=2*O.w_size,_(O.head),O.max_lazy_match=o[O.level].max_lazy,O.good_match=o[O.level].good_length,O.nice_match=o[O.level].nice_length,O.max_chain_length=o[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=2,O.match_available=0,O.ins_h=0),z}function U(k,O,z,B,F,j){if(!k)return p;var $=1;if(O===-1&&(O=6),B<0?($=0,B=-B):B>15&&($=2,B-=16),F<1||F>9||z!==8||B<8||B>15||O<0||O>9||j<0||j>4)return b(k,p);B===8&&(B=9);var G=new q;return k.state=G,G.strm=k,G.wrap=$,G.gzhead=null,G.w_bits=B,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=F+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+3-1)/3),G.window=new a.Buf8(2*G.w_size),G.head=new a.Buf16(G.hash_size),G.prev=new a.Buf16(G.w_size),G.lit_bufsize=1<<F+6,G.pending_buf_size=4*G.lit_bufsize,G.pending_buf=new a.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=O,G.strategy=j,G.method=z,W(k)}o=[new N(0,0,0,0,(function(k,O){var z=65535;for(z>k.pending_buf_size-5&&(z=k.pending_buf_size-5);;){if(k.lookahead<=1){if(y(k),k.lookahead===0&&O===0)return 1;if(k.lookahead===0)break}
714k.strstart+=k.lookahead,k.lookahead=0;var B=k.block_start+z;if((k.strstart===0||k.strstart>=B)&&(k.lookahead=k.strstart-B,k.strstart=B,S(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-w&&(S(k,!1),k.strm.avail_out===0))return 1}return k.insert=0,O===4?(S(k,!0),k.strm.avail_out===0?3:4):(k.strstart>k.block_start&&(S(k,!1),k.strm.avail_out),1)})),new N(4,4,8,4,E),new N(4,5,16,8,E),new N(4,6,32,32,E),new N(4,4,16,16,L),new N(8,16,32,32,L),new N(8,16,128,128,L),new N(8,32,128,256,L),new N(32,128,258,1024,L),new N(32,258,258,4096,L)],i.deflateInit=function(k,O){return U(k,O,8,15,8,0)},i.deflateInit2=U,i.deflateReset=W,i.deflateResetKeep=H,i.deflateSetHeader=function(k,O){return k&&k.state?k.state.wrap!==2?p:(k.state.gzhead=O,0):p},i.deflate=function(k,O){var z,B,F,j;if(!k||!k.state||O>5||O<0)return k?b(k,p):p;if(B=k.state,!k.output||!k.input&&k.avail_in!==0||B.status===f&&O!==4)return b(k,k.avail_out===0?-5:p);if(B.strm=k,z=B.last_flush,B.last_flush=O,B.status===42)if(B.wrap===2)k.adler=0,C(B,31),C(B,139),C(B,8),B.gzhead?(C(B,(B.gzhead.text?1:0)+(B.gzhead.hcrc?2:0)+(B.gzhead.extra?4:0)+(B.gzhead.name?8:0)+(B.gzhead.comment?16:0)),C(B,255&B.gzhead.time),C(B,B.gzhead.time>>8&255),C(B,B.gzhead.time>>16&255),C(B,B.gzhead.time>>24&255),C(B,B.level===9?2:B.strategy>=2||B.level<2?4:0),C(B,255&B.gzhead.os),B.gzhead.extra&&B.gzhead.extra.length&&(C(B,255&B.gzhead.extra.length),C(B,B.gzhead.extra.length>>8&255)),B.gzhead.hcrc&&(k.adler=c(k.adler,B.pending_buf,B.pending,0)),B.gzindex=0,B.status=69):(C(B,0),C(B,0),C(B,0),C(B,0),C(B,0),C(B,B.level===9?2:B.strategy>=2||B.level<2?4:0),C(B,3),B.status=g);else{var $=8+(B.w_bits-8<<4)<<8;$|=(B.strategy>=2||B.level<2?0:B.level<6?1:B.level===6?2:3)<<6,B.strstart!==0&&($|=32),$+=31-$%31,B.status=g,R(B,$),B.strstart!==0&&(R(B,k.adler>>>16),R(B,65535&k.adler)),k.adler=1}if(B.status===69)if(B.gzhead.extra){for(F=B.pending;B.gzindex<(65535&B.gzhead.extra.length)&&(B.pending!==B.pending_buf_size||(B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),A(k),F=B.pending,B.pending!==B.pending_buf_size));)C(B,255&B.gzhead.extra[B.gzindex]),B.gzindex++;B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),B.gzindex===B.gzhead.extra.length&&(B.gzindex=0,B.status=73)}else B.status=73;if(B.status===73)if(B.gzhead.name){F=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),A(k),F=B.pending,B.pending===B.pending_buf_size)){j=1;break}j=B.gzindex<B.gzhead.name.length?255&B.gzhead.name.charCodeAt(B.gzindex++):0,C(B,j)}while(j!==0);B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),j===0&&(B.gzindex=0,B.status=91)}else B.status=91;if(B.status===91)if(B.gzhead.comment){F=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),A(k),F=B.pending,B.pending===B.pending_buf_size)){j=1;break}j=B.gzindex<B.gzhead.comment.length?255&B.gzhead.comment.charCodeAt(B.gzindex++):0,C(B,j)}while(j!==0);B.gzhead.hcrc&&B.pending>F&&(k.adler=c(k.adler,B.pending_buf,B.pending-F,F)),j===0&&(B.status=m)}else B.status=m;if(B.status===m&&(B.gzhead.hcrc?(B.pending+2>B.pending_buf_size&&A(k),B.pending+2<=B.pending_buf_size&&(C(B,255&k.adler),C(B,k.adler>>8&255),k.adler=0,B.status=g)):B.status=g),B.pending!==0){if(A(k),k.avail_out===0)return B.last_flush=-1,0}else if(k.avail_in===0&&v(O)<=v(z)&&O!==4)return b(k,-5);if(B.status===f&&k.avail_in!==0)return b(k,-5);if(k.avail_in!==0||B.lookahead!==0||O!==0&&B.status!==f){var G=B.strategy===2?(function(Z,X){for(var st;;){if(Z.lookahead===0&&(y(Z),Z.lookahead===0)){if(X===0)return 1;break}if(Z.match_length=0,st=l._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++,st&&(S(Z,!1),Z.strm.avail_out===0))return 1}return Z.insert=0,X===4?(S(Z,!0),Z.strm.avail_out===0?3:4):Z.last_lit&&(S(Z,!1),Z.strm.avail_out===0)?1:2})(B,O):B.strategy===3?(function(Z,X){for(var st,nt,it,mt,gt=Z.window;;){if(Z.lookahead<=d){if(y(Z),Z.lookahead<=d&&X===0)return 1;if(Z.lookahead===0)break}if(Z.match_length=0,Z.lookahead>=3&&Z.strstart>0&&(nt=gt[it=Z.strstart-1])===gt[++it]&&nt===gt[++it]&&nt===gt[++it]){mt=Z.strstart+d;do;while(nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&nt===gt[++it]&&it<mt);Z.match_length=d-(mt-it),Z.match_length>Z.lookahead&&(Z.match_length=Z.lookahead)}if(Z.match_length>=3?(st=l._tr_tally(Z,1,Z.match_length-3),Z.lookahead-=Z.match_length,Z.strstart+=Z.match_length,Z.match_length=0):(st=l._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++),st&&(S(Z,!1),Z.strm.avail_out===0))return 1}return Z.insert=0,X===4?(S(Z,!0),Z.strm.avail_out===0?3:4):Z.last_lit&&(S(Z,!1),Z.strm.avail_out===0)?1:2})(B,O):o[B.level].func(B,O);if(G!==3&&G!==4||(B.status=f),G===1||G===3)return k.avail_out===0&&(B.last_flush=-1),0;if(G===2&&(O===1?l._tr_align(B):O!==5&&(l._tr_stored_block(B,0,0,!1),O===3&&(_(B.head),B.lookahead===0&&(B.strstart=0,B.block_start=0,B.insert=0))),A(k),k.avail_out===0))return B.last_flush=-1,0}return O!==4?0:B.wrap<=0?1:(B.wrap===2?(C(B,255&k.adler),C(B,k.adler>>8&255),C(B,k.adler>>16&255),C(B,k.adler>>24&255),C(B,255&k.total_in),C(B,k.total_in>>8&255),C(B,k.total_in>>16&255),C(B,k.total_in>>24&255)):(R(B,k.adler>>>16),R(B,65535&k.adler)),A(k),B.wrap>0&&(B.wrap=-B.wrap),B.pending!==0?0:1)},i.deflateEnd=function(k){var O;return k&&k.state?(O=k.state.status)!==42&&O!==69&&O!==73&&O!==91&&O!==m&&O!==g&&O!==f?b(k,p):(k.state=null,O===g?b(k,-3):0):p},i.deflateSetDictionary=function(k,O){var z,B,F,j,$,G,Z,X,st=O.length;if(!k||!k.state||(j=(z=k.state).wrap)===2||j===1&&z.status!==42||z.lookahead)return p;for(j===1&&(k.adler=h(k.adler,O,st,0)),z.wrap=0,st>=z.w_size&&(j===0&&(_(z.head),z.strstart=0,z.block_start=0,z.insert=0),X=new a.Buf8(z.w_size),a.arraySet(X,O,st-z.w_size,z.w_size,0),O=X,st=z.w_size),$=k.avail_in,G=k.next_in,Z=k.input,k.avail_in=st,k.next_in=0,k.input=O,y(z);z.lookahead>=3;){B=z.strstart,F=z.lookahead-2;do z.ins_h=(z.ins_h<<z.hash_shift^z.window[B+3-1])&z.hash_mask,z.prev[B&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=B,B++;while(--F);z.strstart=B,z.lookahead=2,y(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=2,z.match_available=0,k.next_in=G,k.input=Z,k.avail_in=$,z.wrap=j,0},i.deflateInfo="pako deflate (from Nodeca project)"},2401:n=>{n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},4264:n=>{n.exports=function(i,s){var o,a,l,h,c,u,p,d,w,m,g,f,b,v,_,A,S,C,R,x,T,y,E,L,N;o=i.state,a=i.next_in,L=i.input,l=a+(i.avail_in-5),h=i.next_out,N=i.output,c=h-(s-i.avail_out),u=h+(i.avail_out-257),p=o.dmax,d=o.wsize,w=o.whave,m=o.wnext,g=o.window,f=o.hold,b=o.bits,v=o.lencode,_=o.distcode,A=(1<<o.lenbits)-1,S=(1<<o.distbits)-1;t:do{b<15&&(f+=L[a++]<<b,b+=8,f+=L[a++]<<b,b+=8),C=v[f&A];e:for(;;){if(f>>>=R=C>>>24,b-=R,(R=C>>>16&255)==0)N[h++]=65535&C;else{if(!(16&R)){if(!(64&R)){C=v[(65535&C)+(f&(1<<R)-1)];continue e}if(32&R){o.mode=12;break t}i.msg="invalid literal/length code",o.mode=30;break t}x=65535&C,(R&=15)&&(b<R&&(f+=L[a++]<<b,b+=8),x+=f&(1<<R)-1,f>>>=R,b-=R),b<15&&(f+=L[a++]<<b,b+=8,f+=L[a++]<<b,b+=8),C=_[f&S];r:for(;;){if(f>>>=R=C>>>24,b-=R,!(16&(R=C>>>16&255))){if(!(64&R)){C=_[(65535&C)+(f&(1<<R)-1)];continue r}i.msg="invalid distance code",o.mode=30;break t}if(T=65535&C,b<(R&=15)&&(f+=L[a++]<<b,(b+=8)<R&&(f+=L[a++]<<b,b+=8)),(T+=f&(1<<R)-1)>p){i.msg="invalid distance too far back",o.mode=30;break t}if(f>>>=R,b-=R,T>
vendor: 2,844 bytes, line 714
714(R=h-c)){if((R=T-R)>w&&o.sane){i.msg="invalid distance too far back",o.mode=30;break t}if(y=0,E=g,m===0){if(y+=d-R,R<x){x-=R;do N[h++]=g[y++];while(--R);y=h-T,E=N}}else if(m<R){if(y+=d+m-R,(R-=m)<x){x-=R;do N[h++]=g[y++];while(--R);if(y=0,m<x){x-=R=m;do N[h++]=g[y++];while(--R);y=h-T,E=N}}}else if(y+=m-R,R<x){x-=R;do N[h++]=g[y++];while(--R);y=h-T,E=N}for(;x>2;)N[h++]=E[y++],N[h++]=E[y++],N[h++]=E[y++],x-=3;x&&(N[h++]=E[y++],x>1&&(N[h++]=E[y++]))}else{y=h-T;do N[h++]=N[y++],N[h++]=N[y++],N[h++]=N[y++],x-=3;while(x>2);x&&(N[h++]=N[y++],x>1&&(N[h++]=N[y++]))}break}}break}}while(a<l&&h<u);a-=x=b>>3,f&=(1<<(b-=x<<3))-1,i.next_in=a,i.next_out=h,i.avail_in=a<l?l-a+5:5-(a-l),i.avail_out=h<u?u-h+257:257-(h-u),o.hold=f,o.bits=b}},7948:(n,i,s)=>{var o=s(4236),a=s(6069),l=s(2869),h=s(4264),c=s(9241),u=-2,p=12,d=30;function w(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(x){var T;return x&&x.state?(T=x.state,x.total_in=x.total_out=T.total=0,x.msg="",T.wrap&&(x.adler=1&T.wrap),T.mode=1,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new o.Buf32(852),T.distcode=T.distdyn=new o.Buf32(592),T.sane=1,T.back=-1,0):u}function f(x){var T;return x&&x.state?((T=x.state).wsize=0,T.whave=0,T.wnext=0,g(x)):u}function b(x,T){var y,E;return x&&x.state?(E=x.state,T<0?(y=0,T=-T):(y=1+(T>>4),T<48&&(T&=15)),T&&(T<8||T>15)?u:(E.window!==null&&E.wbits!==T&&(E.window=null),E.wrap=y,E.wbits=T,f(x))):u}function v(x,T){var y,E;return x?(E=new m,x.state=E,E.window=null,(y=b(x,T))!==0&&(x.state=null),y):u}var _,A,S=!0;function C(x){if(S){var T;for(_=new o.Buf32(512),A=new o.Buf32(32),T=0;T<144;)x.lens[T++]=8;for(;T<256;)x.lens[T++]=9;for(;T<280;)x.lens[T++]=7;for(;T<288;)x.lens[T++]=8;for(c(1,x.lens,0,288,_,0,x.work,{bits:9}),T=0;T<32;)x.lens[T++]=5;c(2,x.lens,0,32,A,0,x.work,{bits:5}),S=!1}x.lencode=_,x.lenbits=9,x.distcode=A,x.distbits=5}function R(x,T,y,E){var L,N=x.state;return N.window===null&&(N.wsize=1<<N.wbits,N.wnext=0,N.whave=0,N.window=new o.Buf8(N.wsize)),E>=N.wsize?(o.arraySet(N.window,T,y-N.wsize,N.wsize,0),N.wnext=0,N.whave=N.wsize):((L=N.wsize-N.wnext)>E&&(L=E),o.arraySet(N.window,T,y-E,L,N.wnext),(E-=L)?(o.arraySet(N.window,T,y-E,E,0),N.wnext=E,N.whave=N.wsize):(N.wnext+=L,N.wnext===N.wsize&&(N.wnext=0),N.whave<N.wsize&&(N.whave+=L))),0}
vendor: 7,628 bytes, line 714
714i.inflateReset=f,i.inflateReset2=b,i.inflateResetKeep=g,i.inflateInit=function(x){return v(x,15)},i.inflateInit2=v,i.inflate=function(x,T){var y,E,L,N,q,H,W,U,k,O,z,B,F,j,$,G,Z,X,st,nt,it,mt,gt,_t,xt=0,ct=new o.Buf8(4),kt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return u;(y=x.state).mode===p&&(y.mode=13),q=x.next_out,L=x.output,W=x.avail_out,N=x.next_in,E=x.input,H=x.avail_in,U=y.hold,k=y.bits,O=H,z=W,mt=0;t:for(;;)switch(y.mode){case 1:if(y.wrap===0){y.mode=13;break}for(;k<16;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(2&y.wrap&&U===35615){y.check=0,ct[0]=255&U,ct[1]=U>>>8&255,y.check=l(y.check,ct,2,0),U=0,k=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&U)<<8)+(U>>8))%31){x.msg="incorrect header check",y.mode=d;break}if((15&U)!=8){x.msg="unknown compression method",y.mode=d;break}if(k-=4,it=8+(15&(U>>>=4)),y.wbits===0)y.wbits=it;else if(it>y.wbits){x.msg="invalid window size",y.mode=d;break}y.dmax=1<<it,x.adler=y.check=1,y.mode=512&U?10:p,U=0,k=0;break;case 2:for(;k<16;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(y.flags=U,(255&y.flags)!=8){x.msg="unknown compression method",y.mode=d;break}if(57344&y.flags){x.msg="unknown header flags set",y.mode=d;break}y.head&&(y.head.text=U>>8&1),512&y.flags&&(ct[0]=255&U,ct[1]=U>>>8&255,y.check=l(y.check,ct,2,0)),U=0,k=0,y.mode=3;case 3:for(;k<32;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.head&&(y.head.time=U),512&y.flags&&(ct[0]=255&U,ct[1]=U>>>8&255,ct[2]=U>>>16&255,ct[3]=U>>>24&255,y.check=l(y.check,ct,4,0)),U=0,k=0,y.mode=4;case 4:for(;k<16;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.head&&(y.head.xflags=255&U,y.head.os=U>>8),512&y.flags&&(ct[0]=255&U,ct[1]=U>>>8&255,y.check=l(y.check,ct,2,0)),U=0,k=0,y.mode=5;case 5:if(1024&y.flags){for(;k<16;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.length=U,y.head&&(y.head.extra_len=U),512&y.flags&&(ct[0]=255&U,ct[1]=U>>>8&255,y.check=l(y.check,ct,2,0)),U=0,k=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&((B=y.length)>H&&(B=H),B&&(y.head&&(it=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),o.arraySet(y.head.extra,E,N,B,it)),512&y.flags&&(y.check=l(y.check,E,B,N)),H-=B,N+=B,y.length-=B),y.length))break t;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(H===0)break t;B=0;do it=E[N+B++],y.head&&it&&y.length<65536&&(y.head.name+=String.fromCharCode(it));while(it&&B<H);if(512&y.flags&&(y.check=l(y.check,E,B,N)),H-=B,N+=B,it)break t}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if(H===0)break t;B=0;do it=E[N+B++],y.head&&it&&y.length<65536&&(y.head.comment+=String.fromCharCode(it));while(it&&B<H);if(512&y.flags&&(y.check=l(y.check,E,B,N)),H-=B,N+=B,it)break t}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;k<16;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(U!==(65535&y.check)){x.msg="header crc mismatch",y.mode=d;break}U=0,k=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),x.adler=y.check=0,y.mode=p;break;case 10:for(;k<32;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}x.adler=y.check=w(U),U=0,k=0,y.mode=11;case 11:if(y.havedict===0)return x.next_out=q,x.avail_out=W,x.next_in=N,x.avail_in=H,y.hold=U,y.bits=k,2;x.adler=y.check=1,y.mode=p;case p:if(T===5||T===6)break t;case 13:if(y.last){U>>>=7&k,k-=7&k,y.mode=27;break}for(;k<3;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}switch(y.last=1&U,k-=1,3&(U>>>=1)){case 0:y.mode=14;break;case 1:if(C(y),y.mode=20,T===6){U>>>=2,k-=2;break t}break;case 2:y.mode=17;break;case 3:x.msg="invalid block type",y.mode=d}U>>>=2,k-=2;break;case 14:for(U>>>=7&k,k-=7&k;k<32;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if((65535&U)!=(U>>>16^65535)){x.msg="invalid stored block lengths",y.mode=d;break}if(y.length=65535&U,U=0,k=0,y.mode=15,T===6)break t;case 15:y.mode=16;case 16:if(B=y.length){if(B>H&&(B=H),B>W&&(B=W),B===0)break t;o.arraySet(L,E,N,B,q),H-=B,N+=B,W-=B,q+=B,y.length-=B;break}y.mode=p;break;case 17:for(;k<14;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(y.nlen=257+(31&U),U>>>=5,k-=5,y.ndist=1+(31&U),U>>>=5,k-=5,y.ncode=4+(15&U),U>>>=4,k-=4,y.nlen>286||y.ndist>30){x.msg="too many length or distance symbols",y.mode=d;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;k<3;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.lens[kt[y.have++]]=7&U,U>>>=3,k-=3}for(;y.have<19;)y.lens[kt[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,gt={bits:y.lenbits},mt=c(0,y.lens,0,19,y.lencode,0,y.work,gt),y.lenbits=gt.bits,mt){x.msg="invalid code lengths set",y.mode=d;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;G=(xt=y.lencode[U&(1<<y.lenbits)-1])>>>16&255,Z=65535&xt,!(($=xt>>>24)<=k);){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(Z<16)U>>>=$,k-=$,y.lens[y.have++]=Z;else{if(Z===16){for(_t=$+2;k<_t;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(U>>>=$,k-=$,y.have===0){x.msg="invalid bit length repeat",y.mode=d;break}it=y.lens[y.have-1],B=3+(3&U),U>>>=2,k-=2}else if(Z===17){for(_t=$+3;k<_t;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}k-=$,it=0,B=3+(7&(U>>>=$)),U>>>=3,k-=3}else{for(_t=$+7;k<_t;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}k-=$,it=0,B=11+(127&(U>>>=$)),U>>>=7,k-=7}if(y.have+B>y.nlen+y.ndist){x.msg="invalid bit length repeat",y.mode=d;break}for(;B--;)y.lens[y.have++]=it}}if(y.mode===d)break;if(y.lens[256]===0){x.msg="invalid code -- missing end-of-block",y.mode=d;break}if(y.lenbits=9,gt={bits:y.lenbits},mt=c(1,y.lens,0,y.nlen,y.lencode,0,y.work,gt),y.lenbits=gt.bits,mt){x.msg="invalid literal/lengths set",y.mode=d;break}if(y.distbits=6,y.distcode=y.distdyn,gt={bits:y.distbits},mt=c(2,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,gt),y.distbits=gt.bits,mt){x.msg="invalid distances set",y.mode=d;break}if(y.mode=20,T===6)break t;case 20:y.mode=21;case 21:if(H>=6&&W>=258){x.next_out=q,x.avail_out=W,x.next_in=N,x.avail_in=H,y.hold=U,y.bits=k,h(x,z),q=x.next_out,L=x.output,W=x.avail_out,N=x.next_in,E=x.input,H=x.avail_in,U=y.hold,k=y.bits,y.mode===p&&(y.back=-1);break}for(y.back=0;G=(xt=y.lencode[U&(1<<y.lenbits)-1])>>>16&255,Z=65535&xt,!(($=xt>>>24)<=k);){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(G&&!(240&G)){for(X=$,st=G,nt=Z;G=(xt=y.lencode[nt+((U&(1<<X+st)-1)>>X)])>>>16&255,Z=65535&xt,!(X+($=xt>>>24)<=k);){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}U>>>=X,k-=X,y.back+=X}if(U>>>=$,k-=$,y.back+=$,y.length=Z,G===0){y.mode=26;break}if(32&G){y.back=-1,y.mode=p;break}if(64&G){x.msg="invalid literal/length code",y.mode=d;break}y.extra=15&G,y.mode=22;case 22:if(y.extra){for(_t=y.extra;k<_t;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.length+=U&(1<<y.extra)-1,U>>>=y.extra,k-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;G=(xt=y.distcode[U&(1<<y.distbits)-1])>>>16&255,Z=65535&xt,!(($=xt>>>24)<=k);){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(!(240&G)){for(X=$,st=G,nt=Z;G=(xt=y.distcode[nt+((U&(1<<X+st)-1)>>X)])>>>16&255,Z=65535&xt,!(X+($=xt>>>24)<=k);){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}U>>>=X,k-=X,y.back+=X}if(U>>>=$,k-=$,y.back+=$,64&G){x.msg="invalid distance code",y.mode=d;break}y.offset=Z,y.extra=15&G,y.mode=24;case 24:if(y.extra){for(_t=y.extra;k<_t;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}y.offset+=U&(1<<y.extra)-1,U>>>=y.extra,k-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){x.msg="invalid distance too far back",y.mode=d;break}y.mode=25;case 25:if(W===0)break t;if(B=z-W,y.offset>B){if((B=y.offset-B)>y.whave&&y.sane){x.msg="invalid distance too far back",y.mode=d;break}B>y.wnext?(B-=y.wnext,F=y.wsize-B):F=y.wnext-B,B>y.length&&(B=y.length),j=y.window}else j=L,F=q-y.offset,B=y.length;B>W&&(B=W),W-=B,y.length-=B;do L[q++]=j[F++];while(--B);y.length===0&&(y.mode=21);break;case 26:if(W===0)break t;
714L[q++]=y.length,W--,y.mode=21;break;case 27:if(y.wrap){for(;k<32;){if(H===0)break t;H--,U|=E[N++]<<k,k+=8}if(z-=W,x.total_out+=z,y.total+=z,z&&(x.adler=y.check=y.flags?l(y.check,L,z,q-z):a(y.check,L,z,q-z)),z=W,(y.flags?U:w(U))!==y.check){x.msg="incorrect data check",y.mode=d;break}U=0,k=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;k<32;){if(H===0)break t;H--,U+=E[N++]<<k,k+=8}if(U!==(4294967295&y.total)){x.msg="incorrect length check",y.mode=d;break}U=0,k=0}y.mode=29;case 29:mt=1;break t;case d:mt=-3;break t;case 31:return-4;default:return u}return x.next_out=q,x.avail_out=W,x.next_in=N,x.avail_in=H,y.hold=U,y.bits=k,(y.wsize||z!==x.avail_out&&y.mode<d&&(y.mode<27||T!==4))&&R(x,x.output,x.next_out,z-x.avail_out)?(y.mode=31,-4):(O-=x.avail_in,z-=x.avail_out,x.total_in+=O,x.total_out+=z,y.total+=z,y.wrap&&z&&(x.adler=y.check=y.flags?l(y.check,L,z,x.next_out-z):a(y.check,L,z,x.next_out-z)),x.data_type=y.bits+(y.last?64:0)+(y.mode===p?128:0)+(y.mode===20||y.mode===15?256:0),(O===0&&z===0||T===4)&&mt===0&&(mt=-5),mt)},i.inflateEnd=function(x){if(!x||!x.state)return u;var T=x.state;return T.window&&(T.window=null),x.state=null,0},i.inflateGetHeader=function(x,T){var y;return x&&x.state&&2&(y=x.state).wrap?(y.head=T,T.done=!1,0):u},i.inflateSetDictionary=function(x,T){var y,E=T.length;return x&&x.state?(y=x.state).wrap!==0&&y.mode!==11?u:y.mode===11&&a(1,T,E,0)!==y.check?-3:R(x,T,E,E)?(y.mode=31,-4):(y.havedict=1,0):u},i.inflateInfo="pako inflate (from Nodeca project)"},9241:(n,i,s)=>{var o=s(4236),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(u,p,d,w,m,g,f,b){var v,_,A,S,C,R,x,T,y,E=b.bits,L=0,N=0,q=0,H=0,W=0,U=0,k=0,O=0,z=0,B=0,F=null,j=0,$=new o.Buf16(16),G=new o.Buf16(16),Z=null,X=0;for(L=0;L<=15;L++)$[L]=0;for(N=0;N<w;N++)$[p[d+N]]++;for(W=E,H=15;H>=1&&$[H]===0;H--);if(W>H&&(W=H),H===0)return m[g++]=20971520,m[g++]=20971520,b.bits=1,0;for(q=1;q<H&&$[q]===0;q++);for(W<q&&(W=q),O=1,L=1;L<=15;L++)if(O<<=1,(O-=$[L])<0)return-1;if(O>0&&(u===0||H!==1))return-1;for(G[1]=0,L=1;L<15;L++)G[L+1]=G[L]+$[L];for(N=0;N<w;N++)p[d+N]!==0&&(f[G[p[d+N]]++]=N);if(u===0?(F=Z=f,R=19):u===1?(F=a,j-=257,Z=l,X-=257,R=256):(F=h,Z=c,R=-1),B=0,N=0,L=q,C=g,U=W,k=0,A=-1,S=(z=1<<W)-1,u===1&&z>852||u===2&&z>592)return 1;for(;;){x=L-k,f[N]<R?(T=0,y=f[N]):f[N]>R?(T=Z[X+f[N]],y=F[j+f[N]]):(T=96,y=0),v=1<<L-k,q=_=1<<U;do m[C+(B>>k)+(_-=v)]=x<<24|T<<16|y;while(_!==0);for(v=1<<L-1;B&v;)v>>=1;if(v!==0?(B&=v-1,B+=v):B=0,N++,--$[L]==0){if(L===H)break;L=p[d+f[N]]}if(L>W&&(B&S)!==A){for(k===0&&(k=W),C+=q,O=1<<(U=L-k);U+k<H&&!((O-=$[U+k])<=0);)U++,O<<=1;if(z+=1<<U,u===1&&z>852||u===2&&z>592)return 1;m[A=B&S]=W<<24|U<<16|C-g}}return B!==0&&(m[C+B]=L-k<<24|4194304),b.bits=W,0}},8898:n=>{n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},342:(n,i,s)=>{var o=s(4236);function a(F){for(var j=F.length;--j>=0;)F[j]=0}var l=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],h=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);a(p);var d=new Array(60);a(d);var w=new Array(512);a(w);var m=new Array(256);a(m);var g=new Array(29);a(g);var f,b,v,_=new Array(30);function A(F,j,$,G,Z){this.static_tree=F,this.extra_bits=j,this.extra_base=$,this.elems=G,this.max_length=Z,this.has_stree=F&&F.length}function S(F,j){this.dyn_tree=F,this.max_code=0,this.stat_desc=j}function C(F){return F<256?w[F]:w[256+(F>>>7)]}function R(F,j){F.pending_buf[F.pending++]=255&j,F.pending_buf[F.pending++]=j>>>8&255}function x(F,j,$){F.bi_valid>16-$?(F.bi_buf|=j<<F.bi_valid&65535,R(F,F.bi_buf),F.bi_buf=j>>16-F.bi_valid,F.bi_valid+=$-16):(F.bi_buf|=j<<F.bi_valid&65535,F.bi_valid+=$)}function T(F,j,$){x(F,$[2*j],$[2*j+1])}function y(F,j){var $=0;do $|=1&F,F>>>=1,$<<=1;while(--j>0);return $>>>1}function E(F,j,$){var G,Z,X=new Array(16),st=0;for(G=1;G<=15;G++)X[G]=st=st+$[G-1]<<1;for(Z=0;Z<=j;Z++){var nt=F[2*Z+1];nt!==0&&(F[2*Z]=y(X[nt]++,nt))}}function L(F){var j;for(j=0;j<286;j++)F.dyn_ltree[2*j]=0;for(j=0;j<30;j++)F.dyn_dtree[2*j]=0;for(j=0;j<19;j++)F.bl_tree[2*j]=0;F.dyn_ltree[512]=1,F.opt_len=F.static_len=0,F.last_lit=F.matches=0}function N(F){F.bi_valid>8?R(F,F.bi_buf):F.bi_valid>0&&(F.pending_buf[F.pending++]=F.bi_buf),F.bi_buf=0,F.bi_valid=0}function q(F,j,$,G){var Z=2*j,X=2*$;return F[Z]<F[X]||F[Z]===F[X]&&G[j]<=G[$]}function H(F,j,$){for(var G=F.heap[$],Z=$<<1;Z<=F.heap_len&&(Z<F.heap_len&&q(j,F.heap[Z+1],F.heap[Z],F.depth)&&Z++,!q(j,G,F.heap[Z],F.depth));)F.heap[$]=F.heap[Z],$=Z,Z<<=1;F.heap[$]=G}function W(F,j,$){var G,Z,X,st,nt=0;
714if(F.last_lit!==0)do G=F.pending_buf[F.d_buf+2*nt]<<8|F.pending_buf[F.d_buf+2*nt+1],Z=F.pending_buf[F.l_buf+nt],nt++,G===0?T(F,Z,j):(T(F,(X=m[Z])+256+1,j),(st=l[X])!==0&&x(F,Z-=g[X],st),T(F,X=C(--G),$),(st=h[X])!==0&&x(F,G-=_[X],st));while(nt<F.last_lit);T(F,256,j)}function U(F,j){var $,G,Z,X=j.dyn_tree,st=j.stat_desc.static_tree,nt=j.stat_desc.has_stree,it=j.stat_desc.elems,mt=-1;for(F.heap_len=0,F.heap_max=573,$=0;$<it;$++)X[2*$]!==0?(F.heap[++F.heap_len]=mt=$,F.depth[$]=0):X[2*$+1]=0;for(;F.heap_len<2;)X[2*(Z=F.heap[++F.heap_len]=mt<2?++mt:0)]=1,F.depth[Z]=0,F.opt_len--,nt&&(F.static_len-=st[2*Z+1]);for(j.max_code=mt,$=F.heap_len>>1;$>=1;$--)H(F,X,$);Z=it;do $=F.heap[1],F.heap[1]=F.heap[F.heap_len--],H(F,X,1),G=F.heap[1],F.heap[--F.heap_max]=$,F.heap[--F.heap_max]=G,X[2*Z]=X[2*$]+X[2*G],F.depth[Z]=(F.depth[$]>=F.depth[G]?F.depth[$]:F.depth[G])+1,X[2*$+1]=X[2*G+1]=Z,F.heap[1]=Z++,H(F,X,1);while(F.heap_len>=2);F.heap[--F.heap_max]=F.heap[1],(function(gt,_t){var xt,ct,kt,At,St,Ut,M=_t.dyn_tree,I=_t.max_code,D=_t.stat_desc.static_tree,Y=_t.stat_desc.has_stree,J=_t.stat_desc.extra_bits,tt=_t.stat_desc.extra_base,lt=_t.stat_desc.max_length,Et=0;for(At=0;At<=15;At++)gt.bl_count[At]=0;for(M[2*gt.heap[gt.heap_max]+1]=0,xt=gt.heap_max+1;xt<573;xt++)(At=M[2*M[2*(ct=gt.heap[xt])+1]+1]+1)>lt&&(At=lt,Et++),M[2*ct+1]=At,ct>I||(gt.bl_count[At]++,St=0,ct>=tt&&(St=J[ct-tt]),Ut=M[2*ct],gt.opt_len+=Ut*(At+St),Y&&(gt.static_len+=Ut*(D[2*ct+1]+St)));if(Et!==0){do{for(At=lt-1;gt.bl_count[At]===0;)At--;gt.bl_count[At]--,gt.bl_count[At+1]+=2,gt.bl_count[lt]--,Et-=2}while(Et>0);for(At=lt;At!==0;At--)for(ct=gt.bl_count[At];ct!==0;)(kt=gt.heap[--xt])>I||(M[2*kt+1]!==At&&(gt.opt_len+=(At-M[2*kt+1])*M[2*kt],M[2*kt+1]=At),ct--)}})(F,j),E(X,mt,F.bl_count)}function k(F,j,$){var G,Z,X=-1,st=j[1],nt=0,it=7,mt=4;for(st===0&&(it=138,mt=3),j[2*($+1)+1]=65535,G=0;G<=$;G++)Z=st,st=j[2*(G+1)+1],++nt<it&&Z===st||(nt<mt?F.bl_tree[2*Z]+=nt:Z!==0?(Z!==X&&F.bl_tree[2*Z]++,F.bl_tree[32]++):nt<=10?F.bl_tree[34]++:F.bl_tree[36]++,nt=0,X=Z,st===0?(it=138,mt=3):Z===st?(it=6,mt=3):(it=7,mt=4))}function O(F,j,$){var G,Z,X=-1,st=j[1],nt=0,it=7,mt=4;for(st===0&&(it=138,mt=3),G=0;G<=$;G++)if(Z=st,st=j[2*(G+1)+1],!(++nt<it&&Z===st)){if(nt<mt)do T(F,Z,F.bl_tree);while(--nt!=0);else Z!==0?(Z!==X&&(T(F,Z,F.bl_tree),nt--),T(F,16,F.bl_tree),x(F,nt-3,2)):nt<=10?(T(F,17,F.bl_tree),x(F,nt-3,3)):(T(F,18,F.bl_tree),x(F,nt-11,7));nt=0,X=Z,st===0?(it=138,mt=3):Z===st?(it=6,mt=3):(it=7,mt=4)}}a(_);var z=!1;function B(F,j,$,G){x(F,0+(G?1:0),3),(function(Z,X,st,nt){N(Z),R(Z,st),R(Z,~st),o.arraySet(Z.pending_buf,Z.window,X,st,Z.pending),Z.pending+=st})(F,j,$)}i._tr_init=function(F){z||((function(){var j,$,G,Z,X,st=new Array(16);for(G=0,Z=0;Z<28;Z++)for(g[Z]=G,j=0;j<1<<l[Z];j++)m[G++]=Z;for(m[G-1]=Z,X=0,Z=0;Z<16;Z++)for(_[Z]=X,j=0;j<1<<h[Z];j++)w[X++]=Z;for(X>>=7;Z<30;Z++)for(_[Z]=X<<7,j=0;j<1<<h[Z]-7;j++)w[256+X++]=Z;for($=0;$<=15;$++)st[$]=0;for(j=0;j<=143;)p[2*j+1]=8,j++,st[8]++;for(;j<=255;)p[2*j+1]=9,j++,st[9]++;for(;j<=279;)p[2*j+1]=7,j++,st[7]++;for(;j<=287;)p[2*j+1]=8,j++,st[8]++;for(E(p,287,st),j=0;j<30;j++)d[2*j+1]=5,d[2*j]=y(j,5);f=new A(p,l,257,286,15),b=new A(d,h,0,30,15),v=new A(new Array(0),c,0,19,7)})(),z=!0),F.l_desc=new S(F.dyn_ltree,f),F.d_desc=new S(F.dyn_dtree,b),F.bl_desc=new S(F.bl_tree,v),F.bi_buf=0,F.bi_valid=0,L(F)},i._tr_stored_block=B,i._tr_flush_block=function(F,j,$,G){var Z,X,st=0;F.level>0?(F.strm.data_type===2&&(F.strm.data_type=(function(nt){var it,mt=4093624447;for(it=0;it<=31;it++,mt>>>=1)if(1&mt&&nt.dyn_ltree[2*it]!==0)return 0;if(nt.dyn_ltree[18]!==0||nt.dyn_ltree[20]!==0||nt.dyn_ltree[26]!==0)return 1;for(it=32;it<256;it++)if(nt.dyn_ltree[2*it]!==0)return 1;return 0})(F)),U(F,F.l_desc),U(F,F.d_desc),st=(function(nt){var it;for(k(nt,nt.dyn_ltree,nt.l_desc.max_code),k(nt,nt.dyn_dtree,nt.d_desc.max_code),U(nt,nt.bl_desc),it=18;it>=3&&nt.bl_tree[2*u[it]+1]===0;it--);return nt.opt_len+=3*(it+1)+5+5+4,it})(F),Z=F.opt_len+3+7>>>3,(X=F.static_len+3+7>>>3)<=Z&&(Z=X)):Z=X=$+5,$+4<=Z&&j!==-1?B(F,j,$,G):F.strategy===4||X===Z?(x(F,2+(G?1:0),3),W(F,p,d)):(x(F,4+(G?1:0),3),(function(nt,it,mt,gt){var _t;for(x(nt,it-257,5),x(nt,mt-1,5),x(nt,gt-4,4),_t=0;_t<gt;_t++)x(nt,nt.bl_tree[2*u[_t]+1],3);O(nt,nt.dyn_ltree,it-1),O(nt,nt.dyn_dtree,mt-1)})(F,F.l_desc.max_code+1,F.d_desc.max_code+1,st+1),W(F,F.dyn_ltree,F.dyn_dtree)),L(F),G&&N(F)},i._tr_tally=function(F,j,$){return F.pending_buf[F.d_buf+2*F.last_lit]=j>>>8&255,F.pending_buf[F.d_buf+2*F.last_lit+1]=255&j,F.pending_buf[F.l_buf+F.last_lit]=255&$,F.last_lit++,j===0?F.dyn_ltree[2*$]++:(F.matches++,j--,F.dyn_ltree[2*(m[$]+256+1)]++,F.dyn_dtree[2*C(j)]++),F.last_lit===F.lit_bufsize-1},i._tr_align=function(F){x(F,2,3),T(F,256,p),(function(j){j.bi_valid===16?(R(j,j.bi_buf),j.bi_buf=0,j.bi_valid=0):j.bi_valid>=8&&(j.pending_buf[j.pending++]=255&j.bi_buf,j.bi_buf>>=8,j.bi_valid-=8)})(F)}},2292:n=>{n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},2587:n=>{function i(s,o){return Object.prototype.hasOwnProperty.call(s,o)}n.exports=function(s,o,a,l){o=o||"&",a=a||"=";var h={};
714if(typeof s!="string"||s.length===0)return h;var c=/\+/g;s=s.split(o);var u=1e3;l&&typeof l.maxKeys=="number"&&(u=l.maxKeys);var p=s.length;u>0&&p>u&&(p=u);for(var d=0;d<p;++d){var w,m,g,f,b=s[d].replace(c,"%20"),v=b.indexOf(a);v>=0?(w=b.substr(0,v),m=b.substr(v+1)):(w=b,m=""),g=decodeURIComponent(w),f=decodeURIComponent(m),i(h,g)?Array.isArray(h[g])?h[g].push(f):h[g]=[h[g],f]:h[g]=f}return h}},2361:n=>{var i=function(s){switch(typeof s){case"string":return s;case"boolean":return s?"true":"false";case"number":return isFinite(s)?s:"";default:return""}};n.exports=function(s,o,a,l){return o=o||"&",a=a||"=",s===null&&(s=void 0),typeof s=="object"?Object.keys(s).map((function(h){var c=encodeURIComponent(i(h))+a;return Array.isArray(s[h])?s[h].map((function(u){return c+encodeURIComponent(i(u))})).join(o):c+encodeURIComponent(i(s[h]))})).join(o):l?encodeURIComponent(i(l))+a+encodeURIComponent(i(s)):""}},7673:(n,i,s)=>{i.decode=i.parse=s(2587),i.encode=i.stringify=s(2361)},1269:n=>{class i{constructor(o={}){if(!(o.maxSize&&o.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=o.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(o,a){this.cache.set(o,a),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(o){if(this.cache.has(o))return this.cache.get(o);if(this.oldCache.has(o)){const a=this.oldCache.get(o);return this.oldCache.delete(o),this._set(o,a),a}}set(o,a){return this.cache.has(o)?this.cache.set(o,a):this._set(o,a),this}has(o){return this.cache.has(o)||this.oldCache.has(o)}peek(o){return this.cache.has(o)?this.cache.get(o):this.oldCache.has(o)?this.oldCache.get(o):void 0}delete(o){const a=this.cache.delete(o);return a&&this._size--,this.oldCache.delete(o)||a}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[o]of this)yield o}*values(){for(const[,o]of this)yield o}*[Symbol.iterator](){for(const o of this.cache)yield o;for(const o of this.oldCache){const[a]=o;this.cache.has(a)||(yield o)}}get size(){let o=0;for(const a of this.oldCache.keys())this.cache.has(a)||o++;return this._size+o}}n.exports=i},2511:function(n,i,s){var o;n=s.nmd(n),(function(a){i&&i.nodeType,n&&n.nodeType;var l=typeof s.g=="object"&&s.g;l.global!==l&&l.window!==l&&l.self;var h,c=2147483647,u=36,p=/^xn--/,d=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g=Math.floor,f=String.fromCharCode;function b(y){throw RangeError(m[y])}function v(y,E){for(var L=y.length,N=[];L--;)N[L]=E(y[L]);return N}function _(y,E){var L=y.split("@"),N="";return L.length>1&&(N=L[0]+"@",y=L[1]),N+v((y=y.replace(w,".")).split("."),E).join(".")}function A(y){for(var E,L,N=[],q=0,H=y.length;q<H;)(E=y.charCodeAt(q++))>=55296&&E<=56319&&q<H?(64512&(L=y.charCodeAt(q++)))==56320?N.push(((1023&E)<<10)+(1023&L)+65536):(N.push(E),q--):N.push(E);return N}function S(y){return v(y,(function(E){var L="";return E>65535&&(L+=f((E-=65536)>>>10&1023|55296),E=56320|1023&E),L+f(E)})).join("")}function C(y,E){return y+22+75*(y<26)-((E!=0)<<5)}function R(y,E,L){var N=0;for(y=L?g(y/700):y>>1,y+=g(y/E);y>455;
714N+=u)y=g(y/35);return g(N+36*y/(y+38))}function x(y){var E,L,N,q,H,W,U,k,O,z,B,F=[],j=y.length,$=0,G=128,Z=72;for((L=y.lastIndexOf("-"))<0&&(L=0),N=0;N<L;++N)y.charCodeAt(N)>=128&&b("not-basic"),F.push(y.charCodeAt(N));for(q=L>0?L+1:0;q<j;){for(H=$,W=1,U=u;q>=j&&b("invalid-input"),((k=(B=y.charCodeAt(q++))-48<10?B-22:B-65<26?B-65:B-97<26?B-97:u)>=u||k>g((c-$)/W))&&b("overflow"),$+=k*W,!(k<(O=U<=Z?1:U>=Z+26?26:U-Z));U+=u)W>g(c/(z=u-O))&&b("overflow"),W*=z;Z=R($-H,E=F.length+1,H==0),g($/E)>c-G&&b("overflow"),G+=g($/E),$%=E,F.splice($++,0,G)}return S(F)}function T(y){var E,L,N,q,H,W,U,k,O,z,B,F,j,$,G,Z=[];for(F=(y=A(y)).length,E=128,L=0,H=72,W=0;W<F;++W)(B=y[W])<128&&Z.push(f(B));for(N=q=Z.length,q&&Z.push("-");N<F;){for(U=c,W=0;W<F;++W)(B=y[W])>=E&&B<U&&(U=B);for(U-E>g((c-L)/(j=N+1))&&b("overflow"),L+=(U-E)*j,E=U,W=0;W<F;++W)if((B=y[W])<E&&++L>c&&b("overflow"),B==E){for(k=L,O=u;!(k<(z=O<=H?1:O>=H+26?26:O-H));O+=u)G=k-z,$=u-z,Z.push(f(C(z+G%$,0))),k=g(G/$);Z.push(f(C(k,0))),H=R(L,j,N==q),L=0,++N}++L,++E}return Z.join("")}h={version:"1.3.2",ucs2:{decode:A,encode:S},decode:x,encode:T,toASCII:function(y){return _(y,(function(E){return d.test(E)?"xn--"+T(E):E}))},toUnicode:function(y){return _(y,(function(E){return p.test(E)?x(E.slice(4).toLowerCase()):E}))}},(o=function(){return h}.call(i,s,i,n))===void 0||(n.exports=o)})()},8575:(n,i,s)=>{var o=s(2511),a=s(2502);function l(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}i.parse=S,i.resolve=function(C,R){return S(C,!1,!0).resolve(R)},i.resolveObject=function(C,R){return C?S(C,!1,!0).resolveObject(R):R},i.format=function(C){return a.isString(C)&&(C=S(C)),C instanceof l?C.format():l.prototype.format.call(C)},i.Url=l;var h=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` 715`," "]),d=["'"].concat(p),w=["%","/","?",";","#"].concat(d),m=["/","?","#"],g=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=s(7673);function S(C,R,x){if(C&&a.isObject(C)&&C instanceof l)return C;var T=new l;return T.parse(C,R,x),T}l.prototype.parse=function(C,R,x){if(!a.isString(C))throw new TypeError("Parameter 'url' must be a string, not "+typeof C);var T=C.indexOf("?"),y=T!==-1&&T<C.indexOf("#")?"?":"#",E=C.split(y);E[0]=E[0].replace(/\\/g,"/");var L=C=E.join(y);if(L=L.trim(),!x&&C.split("#").length===1){var N=u.exec(L);if(N)return this.path=L,this.href=L,this.pathname=N[1],N[2]?(this.search=N[2],this.query=R?A.parse(this.search.substr(1)):this.search.substr(1)):R&&(this.search="",this.query={}),this}var q=h.exec(L);if(q){var H=(q=q[0]).toLowerCase();this.protocol=H,L=L.substr(q.length)}if(x||q||L.match(/^\/\/[^@\/]+@[^@\/]+/)){var W=L.substr(0,2)==="//";!W||q&&v[q]||(L=L.substr(2),this.slashes=!0)}if(!v[q]&&(W||q&&!_[q])){for(var U,k,O=-1,z=0;z<m.length;z++)(B=L.indexOf(m[z]))!==-1&&(O===-1||B<O)&&(O=B);for((k=O===-1?L.lastIndexOf("@"):L.lastIndexOf("@",O))!==-1&&(U=L.slice(0,k),L=L.slice(k+1),this.auth=decodeURIComponent(U)),O=-1,z=0;z<w.length;z++){var B;(B=L.indexOf(w[z]))!==-1&&(O===-1||B<O)&&(O=B)}O===-1&&(O=L.length),this.host=L.slice(0,O),L=L.slice(O),this.parseHost(),this.hostname=this.hostname||"";var F=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!F)for(var j=this.hostname.split(/\./),$=(z=0,j.length);z<$;z++){var G=j[z];if(G&&!G.match(g)){for(var Z="",X=0,st=G.length;X<st;X++)G.charCodeAt(X)>127?Z+="x":Z+=G[X];if(!Z.match(g)){var nt=j.slice(0,z),it=j.slice(z+1),mt=G.match(f);mt&&(nt.push(mt[1]),it.unshift(mt[2])),it.length&&(L="/"+it.join(".")+L),this.hostname=nt.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=o.toASCII(this.hostname));var gt=this.port?":"+this.port:"",_t=this.hostname||"";this.host=_t+gt,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),L[0]!=="/"&&(L="/"+L))}if(!b[H])for(z=0,$=d.length;z<$;z++){var xt=d[z];if(L.indexOf(xt)!==-1){var ct=encodeURIComponent(xt);ct===xt&&(ct=escape(xt)),L=L.split(xt).join(ct)}}var kt=L.indexOf("#");kt!==-1&&(this.hash=L.substr(kt),L=L.slice(0,kt));var At=L.indexOf("?");if(At!==-1?(this.search=L.substr(At),this.query=L.substr(At+1),R&&(this.query=A.parse(this.query)),L=L.slice(0,At)):R&&(this.search="",this.query={}),L&&(this.pathname=L),_[H]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){gt=this.pathname||"";var St=this.search||"";this.path=gt+St}return this.href=this.format(),this},l.prototype.format=function(){var C=this.auth||"";C&&(C=(C=encodeURIComponent(C)).replace(/%3A/i,":"),C+="@");var R=this.protocol||"",x=this.pathname||"",T=this.hash||"",y=!1,E="";this.host?y=C+this.host:this.hostname&&(y=C+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(y+=":"+this.port)),this.query&&a.isObject(this.query)&&Object.keys(this.query).length&&(E=A.stringify(this.query));var L=this.search||E&&"?"+E||"";return R&&R.substr(-1)!==":"&&(R+=":"),this.slashes||(!R||_[R])&&y!==!1?(y="//"+(y||""),x&&x.charAt(0)!=="/"&&(x="/"+x
715)):y||(y=""),T&&T.charAt(0)!=="#"&&(T="#"+T),L&&L.charAt(0)!=="?"&&(L="?"+L),R+y+(x=x.replace(/[?#]/g,(function(N){return encodeURIComponent(N)})))+(L=L.replace("#","%23"))+T},l.prototype.resolve=function(C){return this.resolveObject(S(C,!1,!0)).format()},l.prototype.resolveObject=function(C){if(a.isString(C)){var R=new l;R.parse(C,!1,!0),C=R}for(var x=new l,T=Object.keys(this),y=0;y<T.length;y++){var E=T[y];x[E]=this[E]}if(x.hash=C.hash,C.href==="")return x.href=x.format(),x;if(C.slashes&&!C.protocol){for(var L=Object.keys(C),N=0;N<L.length;N++){var q=L[N];q!=="protocol"&&(x[q]=C[q])}return _[x.protocol]&&x.hostname&&!x.pathname&&(x.path=x.pathname="/"),x.href=x.format(),x}if(C.protocol&&C.protocol!==x.protocol){if(!_[C.protocol]){for(var H=Object.keys(C),W=0;W<H.length;W++){var U=H[W];x[U]=C[U]}return x.href=x.format(),x}if(x.protocol=C.protocol,C.host||v[C.protocol])x.pathname=C.pathname;else{for(var k=(C.pathname||"").split("/");k.length&&!(C.host=k.shift()););C.host||(C.host=""),C.hostname||(C.hostname=""),k[0]!==""&&k.unshift(""),k.length<2&&k.unshift(""),x.pathname=k.join("/")}if(x.search=C.search,x.query=C.query,x.host=C.host||"",x.auth=C.auth,x.hostname=C.hostname||C.host,x.port=C.port,x.pathname||x.search){var O=x.pathname||"",z=x.search||"";x.path=O+z}return x.slashes=x.slashes||C.slashes,x.href=x.format(),x}var B=x.pathname&&x.pathname.charAt(0)==="/",F=C.host||C.pathname&&C.pathname.charAt(0)==="/",j=F||B||x.host&&C.pathname,$=j,G=x.pathname&&x.pathname.split("/")||[],Z=(k=C.pathname&&C.pathname.split("/")||[],x.protocol&&!_[x.protocol]);if(Z&&(x.hostname="",x.port=null,x.host&&(G[0]===""?G[0]=x.host:G.unshift(x.host)),x.host="",C.protocol&&(C.hostname=null,C.port=null,C.host&&(k[0]===""?k[0]=C.host:k.unshift(C.host)),C.host=null),j=j&&(k[0]===""||G[0]==="")),F)x.host=C.host||C.host===""?C.host:x.host,x.hostname=C.hostname||C.hostname===""?C.hostname:x.hostname,x.search=C.search,x.query=C.query,G=k;else if(k.length)G||(G=[]),G.pop(),G=G.concat(k),x.search=C.search,x.query=C.query;else if(!a.isNullOrUndefined(C.search))return Z&&(x.hostname=x.host=G.shift(),(mt=!!(x.host&&x.host.indexOf("@")>0)&&x.host.split("@"))&&(x.auth=mt.shift(),x.host=x.hostname=mt.shift())),x.search=C.search,x.query=C.query,a.isNull(x.pathname)&&a.isNull(x.search)||(x.path=(x.pathname?x.pathname:"")+(x.search?x.search:"")),x.href=x.format(),x;if(!G.length)return x.pathname=null,x.search?x.path="/"+x.search:x.path=null,x.href=x.format(),x;for(var X=G.slice(-1)[0],st=(x.host||C.host||G.length>1)&&(X==="."||X==="..")||X==="",nt=0,it=G.length;it>=0;it--)(X=G[it])==="."?G.splice(it,1):X===".."?(G.splice(it,1),nt++):nt&&(G.splice(it,1),nt--);if(!j&&!$)for(;nt--;nt)G.unshift("..");!j||G[0]===""||G[0]&&G[0].charAt(0)==="/"||G.unshift(""),st&&G.join("/").substr(-1)!=="/"&&G.push("");var mt,gt=G[0]===""||G[0]&&G[0].charAt(0)==="/";return Z&&(x.hostname=x.host=gt?"":G.length?G.shift():"",(mt=!!(x.host&&x.host.indexOf("@")>0)&&x.host.split("@"))&&(x.auth=mt.shift(),x.host=x.hostname=mt.shift())),(j=j||x.host&&G.length)&&!gt&&G.unshift(""),G.length?x.pathname=G.join("/"):(x.pathname=null,x.path=null),a.isNull(x.pathname)&&a.isNull(x.search)||(x.path=(x.pathname?x.pathname:"")+(x.search?x.search:"")),x.auth=C.auth||x.auth,x.slashes=x.slashes||C.slashes,x.href=x.format(),x},l.prototype.parseHost=function(){var C=this.host,R=c.exec(C);R&&((R=R[0])!==":"&&(this.port=R.substr(1)),C=C.substr(0,C.length-R.length)),C&&(this.hostname=C)}},2502:n=>{n.exports={isString:function(i){return typeof i=="string"},isObject:function(i){return typeof i=="object"&&i!==null},isNull:function(i){return i===null},isNullOrUndefined:function(i){return i==null}}},7067:()=>{}},t={};function e(n){var i=t[n];if(i!==void 0)return i.exports;var s=t[n]={id:n,loaded:!1,exports:{}};return r[n].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}return e.n=n=>{var i=n&&n.__esModule?()=>n.default:()=>n;return e.d(i,{a:i}),i},e.d=(n,i)=>{for(var s in i)e.o(i,s)&&!e.o(n,s)&&Object.defineProperty(n,s,{enumerable:!0,get:i[s]})},e.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}
715})(),e.o=(n,i)=>Object.prototype.hasOwnProperty.call(n,i),e.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.nmd=n=>(n.paths=[],n.children||(n.children=[]),n),e(5590)})();class Y0{constructor(t,e,n){this.config=t,this.browser=n,this.genome=e,this.cramFile=new jo.CramFile({filehandle:new Cu(t.url,t),seqFetch:t.seqFetch||function(s,o,a){const l=this.genome.sequence,h=this.genome;return this.getHeader().then((function(c){const u=h.getChromosomeName(c.chrNames[s]);return l.getSequence(u,o-1,a)}))}.bind(this),checkSequenceMD5:t.checkSequenceMD5===void 0||t.checkSequenceMD5});const i=new Cu(t.indexURL,t);this.indexedCramFile=new jo.IndexedCramFile({cram:this.cramFile,index:new jo.CraiIndex({filehandle:i}),fetchSizeLimit:3e7}),_e.setReaderDefaults(this,t)}async getHeader(){if(!this.header){const t=this.genome,e=await this.cramFile.getSamHeader(),n={},i=[],s={},o=[];for(let a of e)if(a.tag==="SQ"){for(let l of a.data)if(l.tag==="SN"){const h=l.value;n[h]=i.length,i.push(h),t&&(s[t.getChromosomeName(h)]=h);break}}else a.tag==="RG"&&o.push(a.data);this.header={chrNames:i,chrToIndex:n,chrAliasTable:s,readGroups:o}}return this.header}async readAlignments(t,e,n){this.browser;const i=await this.getHeader(),s=i.chrAliasTable.hasOwnProperty(t)?i.chrAliasTable[t]:t,o=i.chrToIndex[s],a=new Er(t,e,n,this.config);if(o===void 0)return a;try{const h=await this.indexedCramFile.getRecordsForRange(o,e,n);for(let c of h){const u=c.sequenceId,p=c.alignmentStart,d=p+c.lengthOnRef;if(u<0)continue;if(u>o||p>n)return;if(u<o||d<e)continue;const w=l(c,i.chrNames);this.filter.pass(w)&&a.push(w)}return a.finish(),a}catch(h){let c=h.message;throw c&&c.indexOf("MD5")>=0&&(c="Sequence mismatch. Is this the correct genome for the loaded CRAM?"),this.browser.alert.present(new Error(c)),h}function l(h,c){const u=new ls;if(u.chr=c[h.sequenceId],u.start=h.alignmentStart-1,u.lengthOnRef=h.lengthOnRef,u.flags=h.flags,u.strand=!(16&h.flags),u.fragmentLength=h.templateLength||h.templateSize,u.mq=h.mappingQuality,u.end=h.alignmentStart+h.lengthOnRef,u.readGroupId=h.readGroupId,h.mate&&h.mate.sequenceId!==void 0){const p=h.mate.flags!==void 0?!(1&h.mate.flags):!(32&h.flags);u.mate={chr:c[h.mate.sequenceId],position:h.mate.alignmentStart,strand:p}}return u.seq=h.getReadBases(),u.qual=h.qualityScores,u.tagDict=h.tags,u.readName=h.readName,(function(p,d){const w=[];let m,g,f=0,b="";if(d.scStart=d.start,d.scLengthOnRef=d.lengthOnRef,p.readFeatures)for(let _ of p.readFeatures){const A=_.code,S=_.data,C=_.pos-1,R=_.refPos-1;switch(A){case"S":case"I":case"i":case"N":case"D":if(C>f){const x=C-f;w.push(new br({start:R-x,seqOffset:f,len:x,type:"M"})),f+=x,b+=x+"M"}if(A==="S"){let x=R;d.scLengthOnRef+=S.length,C===0&&(d.scStart-=S.length,x-=S.length);const T=S.length;w.push(new br({start:x,seqOffset:f,len:T,type:"S"})),f+=T,b+=T+A}else if(A==="I"||A==="i"){m===void 0&&(m=[]);const x=A==="i"?1:S.length;m.push(new br({start:R,len:x,seqOffset:f,type:"I"})),f+=x,b+=x+A}else A!=="D"&&A!=="N"||(g||(g=[]),g.push({start:R,len:S,type:A}),b+=S+A);break;case"H":case"P":b+=S+A}}const v=p.readLength-f;v>0&&(w.push(new br({start:p.alignmentStart+p.lengthOnRef-v-1,seqOffset:f,len:v,type:"M"})),b+=v+"M"),d.blocks=w,d.insertions=m,d.gaps=g,d.cigar=b})(h,u),u.mate&&u.start>u.mate.position&&u.fragmentLength>0&&(u.fragmentLength=-u.fragmentLength),_e.setPairOrientation(u),u}}}class Cu{constructor(t,e){this.position=0,this.url=t,this.config=e,this.cache=new K0({fetch:(n,i)=>this._fetch(n,i)})}async _fetch(t,e){const n={start:t,size:e};this._stat={size:void 0};const i=await Ct.loadArrayBuffer(this.url,Ft(this.config,{range:n}));return Buffer.from(i)}async read(t,e=0,n=1/0,i=0){return i===null&&(this.position,this.position+=n),this.cache.get(t,e,n,i)}async readFile(){const t=await Ct.loadArrayBuffer(this.url,Ft(this.config));return Buffer.from(t)}async stat(){if(!this._stat){const t=Buffer.allocUnsafe(10);if(await this.read(t,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}}class K0{constructor({fetch:t,size:e=1e7,chunkSize:n=32768}){this.fetch=t,this.chunkSize=n,this.lruCache=new J0({maxSize:Math.floor(e/n)})}async get(t,e,n,i){if(t.length<e+n)throw new Error("output buffer not big enough for request");const s=Math.floor(i/this.chunkSize),o=Math.floor((i+n)/this.chunkSize),a=new Array(o-s+1);for(let c=s;c<=o;
715c+=1)a[c-s]=this._getChunk(c).then((u=>({data:u,chunkNumber:c})));const l=await Promise.all(a),h=i-l[0].chunkNumber*this.chunkSize;l.forEach((({data:c,chunkNumber:u})=>{const p=u*this.chunkSize;let d=0,w=this.chunkSize,m=e+(u-s)*this.chunkSize-h;u===s&&(m=e,d=h),u===o&&(w=i+n-p),c.copy(t,m,d,w)}))}_getChunk(t){const e=this.lruCache.get(t);if(e)return e;const n=this.fetch(t*this.chunkSize,this.chunkSize);return this.lruCache.set(t,n),n}}class J0{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){const e=this.oldCache.get(t);return this._set(t,e),e}}set(t,e){return this.cache.has(t)?this.cache.set(t,e):this._set(t,e),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){return this.cache.has(t)?this.cache.get(t):this.oldCache.has(t)?this.oldCache.get(t):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache)yield t;for(const t of this.oldCache){const[e]=t;this.cache.has(e)||(yield t)}}get size(){let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return this._size+t}}var Su={ALIGNMENT_MATCH:"M",INSERT:"I",DELETE:"D",SKIP:"N",CLIP_SOFT:"S",CLIP_HARD:"H",PAD:"P",SEQUENCE_MATCH:"=",SEQUENCE_MISMATCH:"X"};const Wo=function(r,t){this.config=r,this.genome=t,this.url=r.url,this.filter=new bu(r.filter),this.readGroupSetIds=r.readGroupSetIds,this.authKey=r.authKey,this.samplingWindowSize=r.samplingWindowSize===void 0?100:r.samplingWindowSize,this.samplingDepth=r.samplingDepth===void 0?1e3:r.samplingDepth,r.viewAsPairs?this.pairsSupported=!0:this.pairsSupported=r.pairsSupported===void 0||r.pairsSupported};Wo.prototype.readAlignments=function(r,t,e){const n=this.genome,i=this;return(i.chrAliasTable?Promise.resolve(i.chrAliasTable):i.readMetadata().then((function(o){if(i.chrAliasTable={},n&&o.readGroups&&o.readGroups.length>0){var a=o.readGroups[0].referenceSetId;return a?is({url:i.url+"/references/search",body:{referenceSetId:a},decode:function(l){return l.references}}).then((function(l){return l.forEach((function(h){var c=h.name,u=n.getChromosomeName(c);i.chrAliasTable[u]=c})),i.chrAliasTable})):((function(l,h){var c;if(h==="461916304629"||h==="337315832689"){for(c=1;c<23;c++)l["chr"+c]=c;l.chrX="X",l.chrY="Y",l.chrM="MT"}})(i.chrAliasTable,i.config.datasetId),i.chrAliasTable)}return i.chrAliasTable}))).then((function(o){var a=o.hasOwnProperty(r)?o[r]:r;return is({url:i.url+"/reads/search",body:{readGroupSetIds:[i.readGroupSetIds],referenceName:a,start:t,end:e,pageSize:"10000"},decode:s,results:new Er(r,t,e,i.config)})}));function s(o){var a,l,h,c,u,p=o.alignments,d=p.length,w=[];for(a=0;a<d;a++){let b=p[a];(l=new ls).readName=b.fragmentName,l.properPlacement=b.properPlacement,l.duplicateFragment=b.duplicateFragment,l.numberReads=b.numberReads,l.fragmentLength=b.fragmentLength,l.readNumber=b.readNumber,l.failedVendorQualityChecks=b.failedVendorQualityChecks,l.secondaryAlignment=b.secondaryAlignment,l.supplementaryAlignment=b.supplementaryAlignment,l.seq=b.alignedSequence,l.qual=b.alignedQuality,l.matePos=b.nextMatePosition,l.tagDict=b.info,l.flags=0,b.alignment?(l.mapped=!0,l.chr=b.alignment.position.referenceName,n&&(l.chr=n.getChromosomeName(l.chr)),l.start=parseInt(b.alignment.position.position),l.strand=!b.alignment.position.reverseStrand,l.mq=b.alignment.mappingQuality,l.cigar=m(b.alignment.cigar),h=g(b.alignment.cigar),l.lengthOnRef=h.lengthOnRef,u=f(l,h.array),l.blocks=u.blocks,l.insertions=u.insertions):l.mapped=!1,(c=b.nextMatePosition)&&(l.mate={chr:c.referenceFrame,position:parseInt(c.position),strand:!c.reverseStrand}),i.filter.pass(l)&&w.push(l)}return w;function m(b){var v="";return b.forEach((function(_){var A=Su[_.operation],S=_.operationLength;v+=S+A})),v}function g(b){var v,_,A,S,C=0,R=[];for(S=0;S<b.length;S++)v=b[S],A=Su[v.operation],_=parseInt(v.operationLength),A!=="M"&&A!=="EQ"&&A!=="X"&&A!=="D"&&A!=="N"&&A!=="="||(C+=_),R.push({len:_,ltr:A});return{lengthOnRef:C,array:R}}function f(b,v){for(var _,A,S,C=[],R=0,x=b.start,T=v.length,y=0;y<T;y++){var E=v[y];switch(E.ltr){case"H":case"P":break;case"S":R+=E.len,S="S";break;case"N":case"D":_===void 0&&(_=[]),_.push({start:x,len:E.len,type:E.ltr}),x+=E.len;break;case"I":A===void 0&&(A=[]),A.push(new br({start:x,len:E.len,seqOffset:R})),R+=E.len;break;case"M":case"EQ":case"=":case"X":C.push(new br({start:x,len:E.len,seqOffset:R,gapType:S})),R+=E.len,x+=E.len;break;default:}}return{blocks:C,insertions:A,gaps:_}}}},Wo.prototype.readMetadata=function(){return Qc({url:this.url,entity:"readgroupsets",entityId:this.readGroupSetIds})};class tb{constructor(t,e){const n=e.genome;if(this.config=t,this.genome=n,ir(t.url)&&(this.config.indexed=!1),t.sourceType==="ga4gh")this.bamReader=new Wo(t,n);else if(t.sourceType==="pysam")this.bamReader=new ku(t,n);else if(t.sourceType==="htsget")this.bamReader=new X0(t,n);else if(t.sourceType==="shardedBam")this.bamReader=new Z0(t,n);else if(t.format==="cram")this.bamReader=new Y0(t,n,e);else{if(!this.config.indexURL&&t.indexed!==!1)if(ve(this.config.url)){const i=ic(this.config.url,"bai");i?this.config.indexURL=i:this.config.indexed=!1}
715else this.config.indexed=!1;this.config.indexed!==!1?this.bamReader=new xu(t,n):this.bamReader=new G0(t,n)}this.viewAsPairs=t.viewAsPairs,this.showSoftClips=t.showSoftClips}setViewAsPairs(t){this.viewAsPairs=t}setShowSoftClips(t){this.showSoftClips=t}async getAlignments(t,e,n){const i=this.genome,s=this.showSoftClips,o=await this.bamReader.readAlignments(t,e,n);let a=o.alignments;this.viewAsPairs||(a=uu([{alignments:a}]));const l=a.length>0;if(o.packedAlignmentRows=as(a,o.start,o.end,s),this.alignmentContainer=o,l){const h=await i.sequence.getSequence(t,o.start,o.end);if(h)return o.coverageMap.refSeq=h,o.sequence=h,o}return o}}function gn(r,t,e){var n,i,s,o,a,l,h,c={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};if(this.dataRange===void 0||this.dataRange.max===void 0||this.dataRange.min===void 0)return;let u=this.flipAxis!==void 0&&this.flipAxis;function p(d){return d===0?"0":Math.abs(d)>=10?d.toFixed():Math.abs(d)>=1?d.toFixed(1):d.toFixed(2)}at.fillRect(r,0,0,t,e,{fillStyle:"rgb(255, 255, 255)"}),n=(h=.95*t)-8,a={x:i=h,y:s=o=.01*e},at.strokeLine(r,n,s,i,o,c),at.fillText(r,p(u?this.dataRange.min:this.dataRange.max),n+4,s+12,c),l={x:i,y:s=o=.99*e},at.strokeLine(r,n,s,i,o,c),at.fillText(r,p(u?this.dataRange.max:this.dataRange.min),n+4,s-4,c),at.strokeLine(r,a.x,a.y,l.x,l.y,c)}class hs{constructor({chr:t,start:e,end:n}){this.chr=t,this.start=e,this.end=n}contains(t){return t.chr===this.chr&&t.start>=this.start&&t.end<=this.end}overlaps(t){return t.chr===this.chr&&!(t.end<this.start||t.start>this.end)}extend(t){t.chr===this.chr&&(this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}getLocusString(){if(this.chr==="all")return"all";{const t=Ot(Math.floor(this.start)+1),e=Ot(Math.round(this.end));return`${this.chr}:${t}-${e}`}}static fromLocusString(t){if(t==="all")return new hs({chr:"all"});const e=t.split(":"),n=e[0],i=e[1].split("-"),s=Number.parseInt(i[0].replace(/,/g,""))-1,o=Number.parseInt(i[1].replace(/,/g,""));return new hs({chr:n,start:s,end:o})}}/*! 716 * vanilla-picker v2.12.1 717 * https://vanilla-picker.js.org 718 * 719 * Copyright 2017-2021 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate) 720 * Released under the ISC license. 721 */var $o=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},Go=(function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}})(),cs=function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return(function(e,n){var i=[],s=!0,o=!1,a=void 0;try{for(var l,h=e[Symbol.iterator]();!(s=(l=h.next()).done)&&(i.push(l.value),!n||i.length!==n);s=!0);}catch(c){o=!0,a=c}finally{try{!s&&h.return&&h.return()}finally{if(o)throw a}}return i})(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(r){return this.indexOf(r)===0},String.prototype.padStart=String.prototype.padStart||function(r,t){for(var e=this;e.length<r;)e=t+e;return e};var eb={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Au(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return(t>0?r.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):r.toString())||"0"}var rb=(function(){function r(t,e,n,i){$o(this,r);var s=this;if(t!==void 0)if(Array.isArray(t))this.rgba=t;else if(n===void 0){var o=t&&""+t;
vendor: 7,401 bytes, line 721
721o&&(function(a){if(a.startsWith("hsl")){var l=a.match(/([\-\d\.e]+)/g).map(Number),h=cs(l,4),c=h[0],u=h[1],p=h[2],d=h[3];d===void 0&&(d=1),c/=360,u/=100,p/=100,s.hsla=[c,u,p,d]}else if(a.startsWith("rgb")){var w=a.match(/([\-\d\.e]+)/g).map(Number),m=cs(w,4),g=m[0],f=m[1],b=m[2],v=m[3];v===void 0&&(v=1),s.rgba=[g,f,b,v]}else a.startsWith("#")?s.rgba=r.hexToRgb(a):s.rgba=r.nameToRgb(a)||r.hexToRgb(a)})(o.toLowerCase())}else this.rgba=[t,e,n,i===void 0?1:i]}return Go(r,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(n,i){return Au(n,i===3?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],i=(t?this.hsla:this.hsla.slice(0,3)).map((function(s,o){return Au(s*e[o],o===3?3:1)+n[o]}));return t?"hsla("+i+")":"hsl("+i+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=r.hslToRgb(this._hsla)},set:function(t){t.length===3&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=r.rgbToHsl(this._rgba)},set:function(t){t.length===3&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map((function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)})).map((function(t){return t.padStart(2,"0")})).join("")},set:function(t){this.rgba=r.hexToRgb(t)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(i){return parseInt(i,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(t){var e=t.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),n=eb[e];return n===void 0?n:r.hexToRgb(n.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=cs(t,4),n=e[0],i=e[1],s=e[2],o=e[3];n/=255,i/=255,s/=255;var a=Math.max(n,i,s),l=Math.min(n,i,s),h=void 0,c=void 0,u=(a+l)/2;if(a===l)h=c=0;else{var p=a-l;switch(c=u>.5?p/(2-a-l):p/(a+l),a){case n:h=(i-s)/p+(i<s?6:0);break;case i:h=(s-n)/p+2;break;case s:h=(n-i)/p+4}h/=6}return[h,c,u,o]}},{key:"hslToRgb",value:function(t){var e=cs(t,4),n=e[0],i=e[1],s=e[2],o=e[3],a=void 0,l=void 0,h=void 0;if(i===0)a=l=h=s;else{var c=function(w,m,g){return g<0&&(g+=1),g>1&&(g-=1),g<.16666666666666666?w+6*(m-w)*g:g<.5?m:g<.6666666666666666?w+(m-w)*(.6666666666666666-g)*6:w},u=s<.5?s*(1+i):s+i-s*i,p=2*s-u;a=c(p,u,n+1/3),l=c(p,u,n),h=c(p,u,n-1/3)}var d=[255*a,255*l,255*h].map(Math.round);return d[3]=o,d}}]),r})(),nb=(function(){function r(){$o(this,r),this._events=[]}return Go(r,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(t,e,n){this._events=this._events.filter((function(i){var s=!0;return t&&t!==i.target&&(s=!1),e&&e!==i.type&&(s=!1),n&&n!==i.handler&&(s=!1),s&&r._doRemove(i.target,i.type,i.handler),!s}))}},{key:"destroy",value:function(){this._events.forEach((function(t){return r._doRemove(t.target,t.type,t.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),r})();function Zo(r,t,e){var n=!1;function i(l,h,c){return Math.max(h,Math.min(l,c))}function s(l,h,c){if(c&&(n=!0),n){l.preventDefault();var u=t.getBoundingClientRect(),p=u.width,d=u.height,w=h.clientX,m=h.clientY,g=i(w-u.left,0,p),f=i(m-u.top,0,d);e(g/p,f/d)}}function o(l,h){(l.buttons===void 0?l.which:l.buttons)===1?s(l,l,h):n=!1}function a(l,h){l.touches.length===1?s(l,l.touches[0],h):n=!1}r.add(t,"mousedown",(function(l){o(l,!0)})),r.add(t,"touchstart",(function(l){a(l,!0)})),r.add(window,"mousemove",o),r.add(t,"touchmove",a),r.add(window,"mouseup",(function(l){n=!1})),r.add(t,"touchend",(function(l){n=!1})),r.add(t,"touchcancel",(function(l){n=!1}))}var Eu="keydown",us="mousedown",Qo="focusin";function sr(r,t){return(t||document).querySelector(r)}function ib(r){r.preventDefault(),r.stopPropagation()}function Xo(r,t,e,n,i){r.add(t,Eu,(function(s){e.indexOf(s.key)>=0&&n(s)}))}var Tu=(function(){function r(t){$o(this,r),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new nb,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return Go(r,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),(function(a,l,h){for(var c in a)l[c]=a[c]})(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var i=t.color||t.colour;i&&this._setColor(i)}var s=n.parent;if(s&&n.popup&&!this._popupInited){var o=function(a){return e.openHandler(a)};this._events.add(s,"click",o),Xo(this._events,s,[" ","Spacebar","Enter"],o),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Eu?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===us||e===Qo){var i=(this.__containedEvent||0)+100;t.timeStamp>i&&(n=!0)}else ib(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==us&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if(typeof t=="string"&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new rb(t)}catch(s){if(e.failSilently)return;throw s}if(!this.settings.alpha){var i=n.hsla;i[3]=1,n.hsla=i}this.colour=this.color=n,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e=(function(n){var i=document.createElement("div");return i.innerHTML=n,i.firstElementChild})(this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>
721Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>');return this.domElement=e,this._domH=sr(".picker_hue",e),this._domSL=sr(".picker_sl",e),this._domA=sr(".picker_alpha",e),this._domEdit=sr(".picker_editor input",e),this._domSample=sr(".picker_sample",e),this._domOkay=sr(".picker_done button",e),this._domCancel=sr(".picker_cancel button",e),e.classList.add("layout_"+this.settings.layout),this.settings.alpha||e.classList.add("no_alpha"),this.settings.editor||e.classList.add("no_editor"),this.settings.cancelButton||e.classList.add("no_cancel"),this._ifPopup((function(){return e.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,n=this.domElement,i=this._events;function s(l,h,c){i.add(l,h,c)}s(n,"click",(function(l){return l.preventDefault()})),Zo(i,this._domH,(function(l,h){return e._setHSLA(l)})),Zo(i,this._domSL,(function(l,h){return e._setHSLA(null,l,1-h)})),this.settings.alpha&&Zo(i,this._domA,(function(l,h){return e._setHSLA(null,null,null,1-h)}));var o=this._domEdit;s(o,"input",(function(l){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),s(o,"focus",(function(l){var h=this;h.selectionStart===h.selectionEnd&&h.select()}
721)),this._ifPopup((function(){var l=function(c){return t.closeHandler(c)};s(window,us,l),s(window,Qo,l),Xo(i,n,["Esc","Escape"],l);var h=function(c){t.__containedEvent=c.timeStamp};s(n,us,h),s(n,Qo,h),s(t._domCancel,"click",l)}));var a=function(l){t._ifPopup((function(){return t.closeHandler(l)})),t.onDone&&t.onDone(t.colour)};s(this._domOkay,"click",a),Xo(i,n,["Enter"],a)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){getComputedStyle(t).position==="static"&&(t.style.position="relative");var i=n===!0?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(s){s===i?e.classList.add(s):e.classList.remove(s)})),e.classList.add(i)}))}},{key:"_setHSLA",value:function(t,e,n,i,s){s=s||{};var o=this.colour,a=o.hsla;[t,e,n,i].forEach((function(l,h){(l||l===0)&&(a[h]=l)})),o.hsla=a,this._updateUI(s),this.onChange&&!s.silent&&this.onChange(o)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,i="hsl("+360*n[0]+", 100%, 50%)",s=e.hslString,o=e.hslaString,a=this._domH,l=this._domSL,h=this._domA,c=sr(".picker_selector",a),u=sr(".picker_selector",l),p=sr(".picker_selector",h);v(0,c,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=i,v(0,u,n[1]),_(0,u,1-n[2]),l.style.color=s,_(0,p,1-n[3]);var d=s,w=d.replace("hsl","hsla").replace(")",", 0)"),m="linear-gradient("+[d,w]+")";if(this._domA.style.background=m+`, linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em, 722 linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`,!t.fromEditor){var g=this.settings.editorFormat,f=this.settings.alpha,b=void 0;switch(g){case"rgb":b=e.printRGB(f);break;case"hsl":b=e.printHSL(f);break;default:b=e.printHex(f)}this._domEdit.value=b}this._domSample.style.color=o}function v(A,S,C){S.style.left=100*C+"%"}function _(A,S,C){S.style.top=100*C+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",i=e.style.display!==n;return i&&(e.style.display=n),i}}]),r})(),Yo=document.createElement("style");function sb(r){if(mn[r])return mn[r];if(mn["chr"+r]){const i=mn["chr"+r];return mn[r]=i,i}{const i=(t=Math.round(255*Math.random()).toString(10),e=Math.round(255*Math.random()).toString(10),n=Math.round(255*Math.random()).toString(10),"rgb("+t+","+e+","+n+")");return mn[r]=i,i}var t,e,n}Yo.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(Yo),Tu.StyleElement=Yo;const mn={chrX:"rgb(204, 153, 0)",chrY:"rgb(153, 204, 0",chrUn:"rgb(50, 50, 50)",chr1:"rgb(80, 80, 255)",chrI:"rgb(139, 155, 187)",chr2:"rgb(206, 61, 50)",chrII:"rgb(206, 61, 50)",chr2a:"rgb(216, 71, 60)",chr2b:"rgb(226, 81, 70)",chr3:"rgb(116, 155, 88)",chrIII:"rgb(116, 155, 88)",chr4:"rgb(240, 230, 133)",chrIV:"rgb(240, 230, 133)",chr5:"rgb(70, 105, 131)",chr6:"rgb(186, 99, 56)",chr7:"rgb(93, 177, 221)",chr8:"rgb(128, 34, 104)",chr9:"rgb(107, 215, 107)",chr10:"rgb(213, 149, 167)",chr11:"rgb(146, 72, 34)",chr12:"rgb(131, 123, 141)",chr13:"rgb(199, 81, 39)",chr14:"rgb(213, 143, 92)",chr15:"rgb(122, 101, 165)",chr16:"rgb(228, 175, 105)",chr17:"rgb(59, 27, 83)",chr18:"rgb(205, 222, 183)",chr19:"rgb(97, 42, 121)",chr20:"rgb(174, 31, 99)",chr21:"rgb(231, 199, 111)",chr22:"rgb(90, 101, 94)",chr23:"rgb(204, 153, 0)",chr24:"rgb(153, 204, 0)",chr25:"rgb(51, 204, 0)",chr26:"rgb(0, 204, 51)",chr27:"rgb(0, 204, 153)",chr28:"rgb(0, 153, 204)",chr29:"rgb(10, 71, 255)",chr30:"rgb(71, 117, 255)",chr31:"rgb(255, 194, 10)",chr32:"rgb(255, 209, 71)",chr33:"rgb(153, 0, 51)",chr34:"rgb(153, 26, 0)",chr35:"rgb(153, 102, 0)",chr36:"rgb(128, 153, 0)",chr37:"rgb(51, 153, 0)",chr38:"rgb(0, 153, 26)",chr39:"rgb(0, 153, 102)",chr40:"rgb(0, 128, 153)",chr41:"rgb(0, 51, 153)",chr42:"rgb(26, 0, 153)",chr43:"rgb(102, 0, 153)",chr44:"rgb(153, 0, 128)",chr45:"rgb(214, 0, 71)",chr46:"rgb(255, 20, 99)",chr47:"rgb(0, 214, 143)",chr48:"rgb(20, 255, 177)"};class ob{constructor(t){this.tracks=[],this.chordSets=[]}addChordSet(t){this.chordSets=this.chordSets.filter((n=>n.name!==t.name)),this.chordSets.push(t);let e=this.tracks.find((n=>t.trackName===n.name));e&&(e.chordSets=e.chordSets.filter((n=>n.name!==t.name)),e.chordSets.push(t)),e||(e=new ab(t),this.tracks.push(e))}clearChords(){this.tracks=[],this.chordSets=[]}getTrack(t){return this.tracks.find((e=>t===e.name))}getChordSet(t){return this.chordSets.find((e=>t===e.name))}}class ab{constructor(t){this.name=t.trackName,this.color=t.trackColor,this.visible=!0,this.chordSets=[t],this.id=("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}get chords(){if(this.chordSets.length===1)return this.chordSets[0].chords;const t=[];for(let e of this.chordSets)for(let n of e.chords)t.push(n);return t}}
722const Mu=Math.exp(5);class Ko{static isInstalled(){return window.JBrowseReactCircularGenomeView!==void 0&&window.React!==void 0&&window.ReactDOM!==void 0}constructor(t,e){if(e=e||{},this.config=e,Ko.isInstalled()){this.parent=t,this.groupByTrack=e.groupByTrack===!0,this.chordManager=new ob(e);const n=document.createElement("div");n.className="igv-circview-container",t.appendChild(n),this.createControls(n),this.resetControlPanel();const i=document.createElement("div");i.className="igv-circview-circular-genome-view",n.appendChild(i),this.container=i,e.assembly&&this.setAssembly(e.assembly),this.width=e.width||500,this.height=e.height||500,this.setSize(this.width,this.height)}}createControls(t){const e=document.createElement("div");e.className="igv-circview-toolbar",t.appendChild(e),this.toolbar=e;const n=document.createElement("div");n.className="igv-circview-track-panel",t.appendChild(n),this.controlPanel=n,this.controlPanel.style.display="none";const i=document.createElement("div");i.className="igv-circview-toolbar-button-container",this.toolbar.appendChild(i),this.showControlsButton=document.createElement("div"),this.showControlsButton.className="igv-circview-button",i.appendChild(this.showControlsButton),this.showControlsButton.innerText=this.controlPanel.style.display==="none"?"Show Controls":"Hide Controls",this.showControlsButton.addEventListener("click",(o=>{this.controlPanel.querySelectorAll("div").length>0&&(this.controlPanel.style.display==="none"?(this.controlPanel.style.display="flex",o.target.innerText="Hide Controls"):(this.controlPanel.style.display="none",o.target.innerText="Show Controls"))}));let s=document.createElement("div");s.className="igv-circview-button",i.appendChild(s),s.innerText="Clear All",s.addEventListener("click",(()=>{this.clearChords()})),this.config.showCloseButton!==!1&&(s=document.createElement("div"),s.className="igv-circview-button",i.appendChild(s),s.innerText="Close",s.addEventListener("click",(()=>{this.visible=!1})))}resetControlPanel(){this.controlPanel.innerHTML="",this.controlPanel.appendChild(this.createGroupByCB());const t=this.groupByTrack?this.chordManager.tracks:this.chordManager.chordSets;for(let e of t)this.addToControlPanel(e)}createGroupByCB(){const t=document.createElement("input");t.type="checkbox",t.id="groupByCB",t.style.width="1.4em",t.style.height="1.4em",t.checked=this.groupByTrack,t.onclick=i=>{this.groupByTrack=i.target.checked,this.resetControlPanel(),this.render()};const e=document.createElement("label");e.for="groupByCB",e.innerText="Group by track",e.style.color="black",e.style.paddingLeft="10px";
722const n=document.createElement("div");return n.style.width="100%",n.style.paddingTop="5px",n.style.paddingBottom="5px",n.style.background="rgb(216, 230, 234)",n.appendChild(t),n.appendChild(e),n}addToControlPanel(t){const e=document.createElement("div");this.controlPanel.appendChild(e);const n=document.createElement("div");n.className="igv-circview-button",e.appendChild(n),n.innerText=t.visible===!0?"Hide":"Show",n.addEventListener("click",(c=>{t.visible===!0?(this.hideChordSet(t.name),c.target.innerText="Show"):(this.showChordSet(t.name),c.target.innerText="Hide")}));const i=document.createElement("input"),s=c=>200*Math.log(c*Mu),o=document.createElement("div");o.className="igv-circview-button",o.innerHTML=" ",e.appendChild(o),o.style.backgroundColor=Jo(t.color,1);const a={parent:o,popup:"right",editorFormat:"rgb",color:t.color,onChange:({rgbaString:c})=>{o.style.backgroundColor=Jo(c,1),this.setColor(t.name,c),i.value=s(Ru(t.color))}},l=new Tu(a);i.setAttribute("title","Adjust transparency of arcs"),i.type="range",i.style.width="100px",i.style.marginRight="10px",i.setAttribute("class","range"),i.setAttribute("min","0"),i.setAttribute("max","1000"),i.value=s(Ru(t.color)),i.oninput=()=>{const c=(u=i.value,Math.exp(u/200)/Mu);var u;this.setColor(t.name,Jo(t.color,c)),l.setColor(t.color)},e.appendChild(i);const h=document.createElement("div");h.style.color="black",e.appendChild(h),h.innerText=h.title=t.name}setAssembly(t){const e=this.genomeId||Iu();if(this.genomeId===e)return;this.chordManager.clearChords(),this.genomeId=e,this.chrNames=new Set(t.chromosomes.map((s=>Lu(s.name))));const n=[],i=[];for(let s of t.chromosomes){const o=Lu(s.name);i.push(s.color||sb(o)),n.push({refName:o,uniqueId:o,start:0,end:s.bpLength})}this.assembly={name:t.name,sequence:{trackId:e,type:"ReferenceSequenceTrack",adapter:{type:"FromConfigSequenceAdapter",features:n}},refNameColors:i},this.render()}addChords(t,e={}){const n=e.name||e.track||"*",i=n.split(" ")[0].replaceAll("%20"," "),s={name:n.replaceAll("%20"," "),trackName:i,chords:t,color:e.color||"black",trackColor:e.trackColor||e.color||"black",visible:!0,id:e.id||Iu()};this.chordManager.addChordSet(s),this.resetControlPanel(),this.render()}setSize(t,e){if(e=e||t,this.width=t,this.height=e,this.viewState){const n=this.viewState.session.view;n.setWidth(t),n.setHeight(e),n.setBpPerPx(n.minBpPerPx)}}getSize(){return Math.min(this.width,this.height)}clearChords(){this.chordManager.clearChords(),this.resetControlPanel(),this.render()}clearSelection(){this.viewState.pluginManager.rootModel.session.clearSelection()}show(){this.parent.style.display="block"}hide(){this.parent.style.display="none"}get visible(){return this.parent.style.display!=="none"}set visible(t){this.parent.style.display=t?"block":"none"}hideChordSet(t){let e=this.getChordSet(t);e&&(e.visible=!1,this.render())}showChordSet(t){let e=this.getChordSet(t);e&&(e.visible=!0,this.render())}deleteTrack(t){let e=this.tracks.findIndex((n=>t===n.name));e>=0&&this.tracks.splice(e,1),this.render()}getChordSet(t){return this.groupByTrack?this.chordManager.getTrack(t):this.chordManager.getChordSet(t)}setColor(t,e){const n=this.getChordSet(t);if(n){n.color=e;const i=n.id;for(let s of this.viewState.config.tracks)if(i===s.trackId){s.displays[0].renderer.strokeColor.set(e);break}}}render(){const{createViewState:t,JBrowseCircularGenomeView:e}=JBrowseReactCircularGenomeView;ReactDOM.unmountComponentAtNode(this.container);const n=(this.groupByTrack?this.chordManager.tracks:this.chordManager.chordSets).filter((a=>a.visible)),i=[],s=[];for(let a of n)i.push({trackId:a.id,name:a.name,assemblyNames:["forIGV"],type:"VariantTrack",adapter:{type:"FromConfigAdapter",features:a.chords}}),s.push(a.color);this.viewState=t({assembly:this.assembly,tracks:i});for(let a=0;a<n.length;a++)this.viewState.config.tracks[a].displays[0].renderer.strokeColor.set(s[a]);this.element=React.createElement(e,{viewState:this.viewState}),this.setSize(this.width,this.height),ReactDOM.render(this.element,this.container);const o=this.config.onChordClick||lb;for(let a=0;a<n.length;a++)this.viewState.session.view.showTrack(this.viewState.config.tracks[a].trackId),o&&(this.viewState.pluginManager.jexl.addFunction("onChordClick",o),this.viewState.config.tracks[a].displays[0].onChordClick.set("jexl:onChordClick(feature, track, pluginManager)"))}}function Jo(r,t){const[e,n,i,s]=r.split(",");return`${e},${n},${i},${t})`}function Ru(r){return r.startsWith("rgba(")?Number(r.split(",")[3].replace(")","")):1}function Lu(r){return r.startsWith("chr")?r.substring(3):r}function lb(r,t,e){}function Iu(){return("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}typeof document<"u"&&(function(t){for(let e of document.styleSheets)if(e=e.href?e.href.replace(/^.*[\\\/]/,""):"",e===t)return!0;return!1}("circular-view.css")||(function(){const t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=`.igv-circview-container { 723 width: fit-content; 724 height: fit-content; 725 box-sizing: content-box; 726 color: dimgray; 727 font-family: "Open Sans", sans-serif; 728 font-size: 12px; 729 background-color: white; 730 border-color: dimgray; 731 border-style: solid; 732 border-width: thin; 733 display: flex; 734 flex-direction: column; 735 flex-wrap: nowrap; 736 justify-content: flex-start; 737 align-items: flex-start; 738} 739 740.igv-circview-toolbar { 741 position: relative; 742 width: 100%; 743 height: 32px; 744 background-color: lightgrey; 745 border-bottom-style: solid; 746 border-bottom-color: dimgray; 747 border-bottom-width: thin; 748 display: flex; 749 flex-flow: row; 750 flex-wrap: nowrap; 751 justify-content: space-between; 752 align-items: center; 753} 754 755.igv-circview-toolbar-button-container { 756 height: 100%; 757 width: fit-content; 758 display: flex; 759 flex-flow: row; 760 flex-wrap: nowrap; 761 justify-content: flex-start; 762 align-items: center; 763} 764.igv-circview-toolbar-button-container > div { 765 margin: 4px; 766} 767 768.igv-circview-track-panel { 769 z-index: 1024; 770 position: absolute; 771 top: 33px; 772 left: 0; 773 width: 100%; 774 height: fit-content; 775 border-bottom-style: solid; 776 border-bottom-color: dimgray; 777 border-bottom-width: thin; 778 background-color: white; 779 display: flex; 780 flex-flow: column; 781 flex-wrap: nowrap; 782 justify-content: flex-start; 783 align-items: flex-start; 784} 785.igv-circview-track-panel > div { 786 display: flex; 787 flex-flow: row; 788 flex-wrap: nowrap; 789 justify-content: flex-start; 790 align-items: center; 791} 792.igv-circview-track-panel > div > div { 793 margin: 4px; 794} 795 796.igv-circview-swatch-button { 797 cursor: pointer; 798 padding: 5px; 799 width: 8px; 800 height: 8px; 801 border: 1px solid #8d8b8b; 802 border-radius: 16px; 803} 804 805.igv-circview-button { 806 cursor: pointer; 807 padding: 5px; 808 color: #444; 809 vertical-align: middle; 810 text-align: center; 811 font-family: "Open Sans", sans-serif; 812 font-size: 12px; 813 border: 1px solid #8d8b8b; 814 border-radius: 4px; 815 background: #efefef; 816 box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.2); 817} 818 819.igv-circview-button:hover { 820 background: #efefef; 821 box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.6); 822} 823 824.igv-circview-button:active { 825 color: #007bff; 826 box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.6); 827} 828 829/*# sourceMappingURL=circular-view.css.map */ 830`,document.head.insertBefore(t,document.head.childNodes[document.head.childNodes.length-1])})());const or=r=>r.startsWith("chr")?r.substring(3):r;function Nu(r){const t=[],e=[];for(let n of r.wgChromosomeNames){const i=r.getChromosome(n);e.push(bn(i.name)),t.push({name:i.name,bpLength:i.bpLength})}return t}function ds(r,t,e,n){const i=t.color||"rgb(0,0,255)",s=qt.addAlpha(e.chr==="all"?i:bn(e.chr),n),o=qt.addAlpha(i,n),a=t.name.replaceAll(" ","%20"),l=e.chr==="all"?a:`${a} ${e.chr}:${e.start}-${e.end}`;
830t.browser.circularView.addChords(r,{track:l,color:s,trackColor:o}),t.browser.circularViewVisible||(t.browser.circularViewVisible=!0)}class hb{constructor(t,{minTLENPercentile:e,maxTLENPercentile:n}){this.totalCount=0,this.frCount=0,this.rfCount=0,this.ffCount=0,this.sumF=0,this.sumF2=0,this.lp=e===void 0?.1:e,this.up=n===void 0?99.5:n,this.isizes=[],this.compute(t)}compute(t){for(let i of t)if(i.isProperPair()){var e=Math.abs(i.fragmentLength);this.sumF+=e,this.sumF2+=e*e,this.isizes.push(e);var n=i.pairOrientation;if(typeof n=="string"&&n.length===4)switch(""+n.charAt(0)+n.charAt(2)){case"FF":case"RR":this.ffCount++;break;case"FR":this.frCount++;break;case"RF":this.rfCount++}this.totalCount++}this.ffCount/this.totalCount>.9?this.orienation="ff":this.frCount/this.totalCount>.9?this.orienation="fr":this.rfCount/this.totalCount>.9&&(this.orienation="rf"),this.minTLEN=this.lp===0?0:Bu(this.isizes,this.lp),this.maxTLEN=Bu(this.isizes,this.up)}}function Bu(r,t){if(r.length!==0){var e=Math.floor(r.length*(t/100));return r.sort((function(n,i){return n-i})),r[e]}}const ta={getTissueInfo:function(r,t){let e=(t=t||"https://gtexportal.org/rest/v1")+"/dataset/tissueInfo?datasetId="+(r=r||"gtex_v8");return Ct.loadJson(e,{})},trackConfiguration:function(r,t){return{type:"eqtl",sourceType:"gtex-ws",url:(t=t||"https://gtexportal.org/rest/v1")+"/association/singleTissueEqtlByLocation",tissueSiteDetailId:r.tissueSiteDetailId,name:r.tissueSiteDetailId.split("_").join(" "),visibilityWindow:25e4}}};function Fu(r,t,e){let n=(r.start-t)/e,i=(r.end-t)/e,s=i-n;return s<3&&(s=3,n-=1.5),{px:n,px1:i,pw:s}}function cb(r,t,e,n,i,s){try{i.save(),i.fillStyle=this.color,i.strokeStyle=this.color;const o=this.getColorForFeature(r);let a,l;i.fillStyle=o,i.strokeStyle=o,this.displayMode==="SQUISHED"&&r.row!==void 0?(a=this.featureHeight/2,l=this.margin+this.squishedRowHeight*r.row):this.displayMode==="EXPANDED"&&r.row!==void 0?(a=this.featureHeight,l=this.margin+this.expandedRowHeight*r.row):(a=this.featureHeight,l=this.margin);const h=s.pixelWidth,c=l+a/2,u=a/2,p=c-u/2,d=r.exons?r.exons.length:0,w=Fu(r,t,e),m=this.arrowSpacing,g=r.strand==="+"?1:r.strand==="-"?-1:0;if(d===0){const f=Math.max(0,w.px),b=Math.min(h,w.px1),v=b-f;if(i.fillRect(f,l,v,a),g!==0){i.fillStyle="white",i.strokeStyle="white";for(let _=f+m/2;_<b;_+=m)at.strokeLine(i,_-2*g,c-2,_,c),at.strokeLine(i,_-2*g,c+2,_,c);i.fillStyle=o,i.strokeStyle=o}}else{at.strokeLine(i,w.px+1,c,w.px1-1,c);const f=Math.max(0,w.px)+m/2,b=Math.min(h,w.px1);for(let v=f;v<b;v+=m)at.strokeLine(i,v-2*g,c-2,v,c),at.strokeLine(i,v-2*g,c+2,v,c);for(let v=0;v<d;v++){const _=r.exons[v];let A,S=Math.round((_.start-t)/e),C=Math.round((_.end-t)/e),R=Math.max(1,C-S);if(!(S+R<0)){if(S>h)break;if(_.utr)i.fillRect(S,p,R,u);else if(_.cdStart&&(A=Math.round((_.cdStart-t)/e),i.fillRect(S,p,A-S,u),R-=A-S,S=A),_.cdEnd&&(A=Math.round((_.cdEnd-t)/e),i.fillRect(A,p,C-A,u),R-=C-A,C=A),R=Math.max(R,1),i.fillRect(S,l,R,a),R>m+5&&g!==0){i.fillStyle="white",i.strokeStyle="white";for(let x=S+m/2;x<C;x+=m)at.strokeLine(i,x-2*g,c-2,x,c),at.strokeLine(i,x-2*g,c+2,x,c);i.fillStyle=o,i.strokeStyle=o}}}}s.drawLabel&&this.displayMode!=="SQUISHED"&&ub.call(this,i,r,w.px,w.px1,l,s.referenceFrame,s)}finally{i.restore()}}function ub(r,t,e,n,i,s,o){try{r.save();let a=t.name;if(a===void 0&&t.gene&&(a=t.gene.name),a===void 0&&(a=t.id||t.ID),!a||a===".")return;let l,h=(e+n)/2;this.displayMode==="COLLAPSED"&&this.labelDisplayMode==="SLANT"&&(l={rotate:{angle:45}});const c=(function(v,_){return _?v+20:v+25})(i,l);let u,p=this.getColorForFeature(t),d=!1;s.selection&&ta.gtexLoaded&&(d=!0,u=s.selection.colorForGene(a));const w={textAlign:this.labelDisplayMode==="SLANT"?void 0:"center",fillStyle:u||p,strokeStyle:u||p},m=r.measureText(a),g=h-m.width/2,f=h+m.width/2,b=o.rowLastLabelX[t.row]||-Number.MAX_SAFE_INTEGER;(o.labelAllFeatures||g>b||d)&&(o.rowLastLabelX[t.row]=f,o.axis==="y"?(r.save(),at.labelTransformWithContext(r,h),at.fillText(r,a,h,c,w,l),r.restore()):at.fillText(r,a,h,c,w,l))}finally{r.restore()}}const db=new Set(["nonsense","missense","stop-loss","frameshift","cds-indel"]),fb=new Set(["coding-synon"]),pb=new Set(["splice-3","splice-5"]),gb=new Set(["untranslated-5","untranslated-3"]);function ea(r,t,e,n,i){var s,o,a,l,h,c,u=Fu(r,t,e),p=this.margin,d=this.snpColors.length;switch(s=this.displayMode==="squished"?this.squishedRowHeight:this.expandedRowHeight,this.colorBy){case"function":l=r.func,c=l.split(","),h=c.map((function(w){return db.has(w)||pb.has(w)?d-1:fb.has(w)?d-2:gb.has(w)?d-3:0})),o=h.reduce((function(w,m){return Math.max(w,m)}));break;
830case"class":o=(a=r.class)==="deletion"?d-1:a==="mnp"?d-2:a==="microsatellite"||a==="named"?d-3:0}i.fillStyle=this.snpColors[o],i.fillRect(u.px,p,u.pw,s)}function mb(r,t,e,n,i){const s=this.displayMode==="EXPANDED"?this.expandedRowHeight:this.squishedRowHeight;let o=this.margin;this.displayMode!=="COLLAPSED"&&r.row!==void 0&&(o+=r.row*s);const a=o+.5*s,l=a-.5*s,h=a+.5*s,c=Math.round((r.junction_left-t)/e),u=Math.round((r.junction_right-t)/e);i.beginPath(),i.moveTo(c,a),i.bezierCurveTo(c,l,u,l,u,a),i.lineWidth=1+Math.log(r.num_junction_reads)/Math.log(2),i.strokeStyle="blue",i.stroke();const p=r.spanning_frag_coords;for(let d=0;d<p.length;d++){const w=p[d],m=Math.round((w.left-t)/e),g=Math.round((w.right-t)/e);i.beginPath(),i.moveTo(m,a),i.bezierCurveTo(m,h,g,h,g,a),i.lineWidth=1,i.strokeStyle="purple",i.stroke()}}class ra extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.labelDisplayMode=t.labelDisplayMode,t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):this.featureSource=t.featureSource?t.featureSource:He(t,this.browser.genome),t.type==="FusionJuncSpan"?(this.render=t.render||mb,this.squishedRowHeight=t.squishedRowHeight||50,this.expandedRowHeight=t.expandedRowHeight||50,this.height=t.height||this.margin+2*this.expandedRowHeight):t.type==="snp"?(this.render=t.render||ea,this.snpColors=["rgb(0,0,0)","rgb(0,0,255)","rgb(0,255,0)","rgb(255,0,0)"],this.colorBy="function",this.expandedRowHeight=t.expandedRowHeight||10,this.squishedRowHeight=t.squishedRowHeight||5,this.height=t.height||30):(this.render=t.render||cb,this.arrowSpacing=30,(function(e){e.browser.on&&(e.browser.on("trackdragend",n),e.browser.on("trackremoved",i));function n(){e.trackView&&e.displayMode!=="SQUISHED"&&e.trackView.updateViews()}function i(s){e.browser.un&&e===s&&(e.browser.un("trackdragend",n),e.browser.un("trackremoved",i))}})(this),this.squishedRowHeight=t.squishedRowHeight||15,this.expandedRowHeight=t.expandedRowHeight||30,this.height=t.height||this.margin+2*this.expandedRowHeight,t.colorBy&&(t.colorBy.field&&(t.colorTable=t.colorBy.pallete||t.colorBy.palette,t.colorBy=t.colorBy.field),this.colorBy=t.colorBy,t.colorTable?this.colorTable=new ei(t.colorTable):this.colorTable=new ti("Set1")))}async postInit(){if(typeof this.featureSource.getHeader!="function"||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),this.visibilityWindow===void 0&&typeof this.featureSource.defaultVisibilityWindow=="function"&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow()),this}get supportsWholeGenome(){return this.config.supportsWholeGenome!==void 0?this.config.supportsWholeGenome:this.featureSource&&typeof this.featureSource.supportsWholeGenome=="function"?this.featureSource.supportsWholeGenome():!(this.visibilityWindow!==void 0||this.config.indexed!==!1&&this.config.indexURL)||void 0}async getFeatures(t,e,n,i){const s=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:s})}computePixelHeight(t){if(this.displayMode==="COLLAPSED")return this.margin+this.expandedRowHeight;{let e=0;if(t&&typeof t.forEach=="function")for(let n of t)n.row&&n.row>e&&(e=n.row);return this.margin+(e+1)*(this.displayMode==="SQUISHED"?this.squishedRowHeight:this.expandedRowHeight)}}draw(t){const e=t.features,n=t.context,i=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth,a=t.pixelHeight,l=s+o*i+1;if(this.config.isMergedTrack||at.fillRect(n,0,t.pixelTop,o,a,{fillStyle:"rgb(255, 255, 255)"}),e){const h=[];t.rowLastX=[],t.rowLastLabelX=[];for(let p of e)if(p.start>s&&p.end<l){const d=this.displayMode==="COLLAPSED"?0:p.row||0;h[d]===void 0?h[d]=1:h[d]++,t.rowLastX[d]=-Number.MAX_SAFE_INTEGER,t.rowLastLabelX[d]=-Number.MAX_SAFE_INTEGER}const c=o/Math.max(1,Math.max(...h));let u=[];for(let p of e){if(p.end<s)continue;if(p.start>l)break;const d=this.displayMode==="COLLAPSED"?0:p.row;t.drawLabel=t.labelAllFeatures||c>10;const w=Math.ceil((p.end-s)/i),m=u[d];if(!m||w>m){this.render.call(this,p,s,i,a,n,t);const g=Math.floor((p.start-s)/i);m&&g-m<=0&&(n.globalAlpha=.5,at.strokeLine(n,g,0,g,a,{strokeStyle:"rgb(255, 255, 255)"}),n.globalAlpha=1),u[d]=w}}}}clickedFeatures(t){const e=t.y-this.margin,n=super.clickedFeatures(t);let i;switch(this.displayMode){case"SQUISHED":i=Math.floor(e/this.squishedRowHeight);break;case"EXPANDED":i=Math.floor(e/this.expandedRowHeight);break;default:i=void 0}return n.filter((function(s){return i===void 0||s.row===void 0||i===s.row}))}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=t.genomicLocation,i=[];for(let s of e){const o=s._f||s,a=typeof o.popupData=="function"?o.popupData(n):this.extractPopupData(o);if(a){i.length>0&&i.push("<hr/><hr/>");const l=this.infoURL||this.config.infoURL;for(let c of a)if(i.push(c),l&&c.name&&c.name.toLowerCase()==="name"&&c.value&&ve(c.value)&&!c.value.startsWith("<")){const u=l.replace("$$",s.name);c.value=`<a target=_blank href=${u}>${c.value}</a>`}const h=this.config.format==="gff"||this.config.format==="gff3"||this.config.format==="gtf";if(o.exons)for(let c=0;c<o.exons.length;c++){const u=o.exons[c];if(n>=u.start&&n<=u.end){const p=h?u.number:o.strand==="-"?o.exons.length-c:c+1;p&&(i.push("<hr/>"),i.push({name:"Exon Number",value:p}));break}}}}return i}menuItemList(){const t=[];if(this.render===ea){t.push("<hr/>");for(let e of["function","class"])t.push({object:pt(ce("Color by "+e,e===this.colorBy)),click:()=>{this.colorBy=e,this.trackView.repaintViews()}})}t.push("<hr/>");for(let e of["COLLAPSED","SQUISHED","EXPANDED"]){const n={COLLAPSED:"Collapse",SQUISHED:"Squish",EXPANDED:"Expand"};t.push({object:pt(ce(n[e],e===this.displayMode)),click:()=>{this.displayMode=e,this.config.displayMode=e,this.trackView.checkContentHeight(),this.trackView.repaintViews()}})}return t}contextMenuItemList(t){const e=this.clickedFeatures(t);if(e===void 0||e.length===0)return;e.length>1&&e.sort(((i,s)=>s.end-s.start-(i.end-i.start)));const n=e[0];if(n.end-n.start<=1e6){const i=[{label:"View feature sequence",click:async()=>{let s=await this.browser.genome.getSequence(n.chr,n.start,n.end);s?n.strand==="-"&&(s=Wr(s)):s="Unknown sequence",this.browser.alert.present(s)}}];return Co()&&navigator.clipboard!==void 0&&i.push({label:"Copy feature sequence",click:async()=>{let s=await this.browser.genome.getSequence(n.chr,n.start,n.end);s?n.strand==="-"&&(s=Wr(s)):s="Unknown sequence";try{await navigator.clipboard.writeText(s)}catch(o){this.browser.alert.present(`error copying sequence to clipboard ${o}`)}}}),i.push("<hr/>"),i}}description(){if(ea===this.render){let t="<html>"+this.name+"<hr/>";return t+="<em>Color By Function:</em><br>",t+='<span style="color:red">Red</span>: Coding-Non-Synonymous, Splice Site<br>',t+='<span style="color:green">Green</span>: Coding-Synonymous<br>',t+='<span style="color:blue">Blue</span>: Untranslated<br>',t+='<span style="color:black">Black</span>: Intron, Locus, Unknown<br><br>',t+="<em>Color By Class:</em><br>",t+='<span style="color:red">Red</span>: Deletion<br>',t+='<span style="color:green">Green</span>: MNP<br>',t+='<span style="color:blue">Blue</span>: Microsatellite, Named<br>',t+='<span style="color:black">Black</span>: Indel, Insertion, SNP',t+="</html>",t}return super.description()}
830getColorForFeature(t){let e;if(this.altColor&&t.strand==="-")e=typeof this.altColor=="function"?this.altColor(t):this.altColor;else if(this.color)e=typeof this.color=="function"?this.color(t):this.color;else if(this.colorBy){const n=t.getAttributeValue?t.getAttributeValue(this.colorBy):t[this.colorBy];e=this.colorTable.getColor(n)}else t.color&&(e=t.color);if(e||(e="rgb(0, 0, 150)"),t.alpha&&t.alpha!==1)e=qt.addAlpha(e,t.alpha);else if(this.useScore&&t.score&&!Number.isNaN(t.score)){const n=(function(i,s,o){const a=(s-i)/9,l=Math.floor((o-i)/a);return Math.min(1,.2+.8*l/9)})(this.config.min?this.config.min:this.viewLimitMin?this.viewLimitMin:0,this.config.max?this.config.max:this.viewLimitMax?this.viewLimitMax:1e3,t.score);t.alpha=n,e=qt.addAlpha(e,n)}return e}dispose(){this.trackView=void 0}}Xr(ra,"defaults",{type:"annotation",maxRows:1e3,displayMode:"EXPANDED",margin:10,featureHeight:14,autoHeight:!1,useScore:!1});class Ou{constructor(t){this.config=t,this.browser=t.browser,this.columnFormat=t.columnFormat,this.tableRowSelectionList=[],this.tableDOM=ut.div({class:"igv-roi-table"}),t.parent.appendChild(this.tableDOM),this.headerDOM=t,this.tableColumnTitles=this.tableDOM,this.tableRowContainer=this.tableDOM,this.footerDOM=t.gotoButtonHandler}set headerDOM({browser:t,parent:e,headerTitle:n,dismissHandler:i}){const s=ut.div();this.tableDOM.appendChild(s);const o=ut.div();s.appendChild(o),o.innerHTML=n;const a=ut.div();s.appendChild(a),a.appendChild(Nr.createIcon("times")),this.boundDismissHandler=function(u){u.stopPropagation(),i()}.bind(this),a.addEventListener("click",this.boundDismissHandler);const{y:l}=t.root.getBoundingClientRect(),{y:h}=e.getBoundingClientRect(),c=-(h-l);Br(this.tableDOM,s,{minX:0,minY:c}),this.tableDOM.style.display="none",this._headerDOM=s}set tableColumnTitles(t){const e=ut.div({class:"igv-roi-table-column-titles"});t.appendChild(e);for(const{label:n,width:i}of this.columnFormat){const s=ut.div();e.appendChild(s),s.style.width=i,s.innerText=n}this._tableColumnTitlesDOM=e}get tableColumnTitles(){return this._tableColumnTitlesDOM}set tableRowContainer(t){const e=ut.div({class:"igv-roi-table-row-container"});t.appendChild(e),this._tableRowContainerDOM=e}get tableRowContainer(){return this._tableRowContainerDOM}set footerDOM(t){const e=ut.div();this.tableDOM.appendChild(e);const n=ut.div({class:"igv-roi-table-button"});e.appendChild(n),n.id="igv-roi-table-view-button",n.textContent="Go To",n.style.pointerEvents="none",this._footerDOM=e,this.gotoButton=n,this.boundGotoButtonHandler=t.bind(this),this.gotoButton.addEventListener("click",this.boundGotoButtonHandler)}tableRowDOMHelper(t){t.addEventListener("mousedown",(e=>{e.stopPropagation(),t.classList.toggle("igv-roi-table-row-selected"),t.classList.contains("igv-roi-table-row-selected")?t.classList.remove("igv-roi-table-row-hover"):t.classList.add("igv-roi-table-row-hover"),this.setTableRowSelectionState(t.classList.contains("igv-roi-table-row-selected"))})),t.addEventListener("mouseover",(e=>{t.classList.contains("igv-roi-table-row-selected")?t.classList.remove("igv-roi-table-row-hover"):t.classList.add("igv-roi-table-row-hover")})),t.addEventListener("mouseout",(e=>{t.classList.remove("igv-roi-table-row-hover")}))}clearTable(){const t=this.tableRowContainer.querySelectorAll(".igv-roi-table-row");for(let e of t)e.remove()}setTableRowSelectionState(t){t?this.tableRowSelectionList.push(1):this.tableRowSelectionList.pop(),this.gotoButton.style.pointerEvents=this.tableRowSelectionList.length>0?"auto":"none"}present(){this.tableDOM.style.left="0px";const{y:t}=this.browser.root.getBoundingClientRect(),{y:e}=this.config.parent.getBoundingClientRect();this.tableDOM.style.top=t-e+"px",this.tableDOM.style.display="flex"}dismiss(){this.tableDOM.style.display="none"}dispose(){this.tableDOM.innerHTML="",this.tableDOM.remove();for(const t of Object.keys(this))this[t]=void 0;document.removeEventListener("click",this.boundDismissHandler)}}class na extends Ou{constructor(t){super(Object.assign({width:"1024px"},t)),this.descriptionDOM=t}set descriptionDOM(t){if(t.description){let e;e=ut.div({class:"igv-roi-table-description"}),this.tableDOM.insertBefore(e,this.tableColumnTitles),e.style.height="auto",e.innerHTML="BLAT result for query sequence:",e=ut.div({class:"igv-roi-table-description"}),this.tableDOM.insertBefore(e,this.tableColumnTitles),e.style.height="auto",e.style.maxHeight="128px",e.innerHTML=t.description,e=ut.div({class:"igv-roi-table-goto-explainer"}
830),this.tableDOM.insertBefore(e,this.tableColumnTitles),e.innerHTML="Select one or more rows and click Go To to view the regions"}}tableRowDOM(t){const e=ut.div({class:"igv-roi-table-row"}),n=t.map((i=>isFinite(i)?Ot(i):i));for(let i=0;i<n.length;i++){const s=ut.div();e.appendChild(s);const o=this.columnFormat[i];s.style.width=o.width||"fit-content",s.innerText=n[i]}return this.tableRowDOMHelper(e),e}renderTable(t){if(Array.from(this.tableRowContainer.querySelectorAll(".igv-roi-table-row")).forEach((e=>e.remove())),t.length>0)for(let e of t){const n=this.tableRowDOM(e);this.tableRowContainer.appendChild(n)}}static getColumnFormatConfiguration(){return[{label:"chr",width:"7%"},{label:"start",width:"12%"},{label:"end",width:"12%"},{label:"strand",width:"5%"},{label:"score",width:"5%"},{label:"match",width:"5%"},{label:"mis-match",width:"7%"},{label:"rep. match",width:"7%"},{label:"N's",width:"3%"},{label:"Q gap count",width:"9%"},{label:"Q gap bases",width:"9%"},{label:"T gap count",width:"9%"},{label:"T gap bases",width:"9%"}]}static gotoButtonHandler(t){t.stopPropagation();const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected"),n=[];for(const i of e){const s=[];i.querySelectorAll("div").forEach((h=>s.push(h.innerText)));const[o,a,l]=s;n.push(`${o}:${a}-${l}`)}for(const i of this.tableDOM.querySelectorAll(".igv-roi-table-row"))i.classList.remove("igv-roi-table-row-selected");this.setTableRowSelectionState(!1),this.browser.search(n.join(" "))}}const bb="https://igv.org/services/blatUCSC.php";async function wb({url:r,userSeq:t,db:e}){r=r||bb;const n=await(async function(i="",s,o){const a=new URLSearchParams;return a.append("userSeq",s),a.append("db",o),(await fetch(i,{method:"post",body:a})).json()})(r,t,e);return n.fields,n.blat.map(km)}const fs=25e3;class vb extends ra{constructor(t,e){super(t,e),this.name||(this.name="Blat Results"),this.sequence=t.sequence,this.table=void 0}openTableView(){if(this.table===void 0){const t=this.config.features.map((n=>[n.chr,n.start+1,n.end,n.strand,n.score,n.matches,n.misMatches,n.repMatches,n.nCount,n.qNumInsert,n.qBaseInsert,n.tNumInsert,n.tBaseInsert])),e={browser:this.browser,parent:this.browser.parent,headerTitle:this.config.title,description:this.sequence,dismissHandler:()=>{this.table.dismiss(),this.table.dispose(),this.table=void 0},columnFormat:na.getColumnFormatConfiguration(),gotoButtonHandler:na.gotoButtonHandler};this.table=new na(e),this.table.renderTable(t)}this.table.present()}menuItemList(){const t=super.menuItemList();return t.push("<hr/>"),t.push({label:"Open table view",click:()=>this.openTableView()}),t}dispose(){super.dispose(),this.table&&this.table.popover.parentElement.removeChild(this.table.popover)}}async function ia({sequence:r,browser:t,name:e,title:n}){if(r.length>fs)return void t.alert.present(`Sequence size exceeds maximum allowed length (${r.length} > 25000)`);const i=t.genome.id,s=t.config.blatServerURL;try{const o={type:"blat",name:e||"blat results",title:n||"blat results",sequence:r,altColor:"rgb(176, 176, 236)",color:"rgb(236, 176, 176)",features:await wb({url:s,userSeq:r,db:i})};(await t.loadTrack(o)).openTableView()}catch(o){t.alert.present(`Error performing blat search: ${o}`)}}const Du="rgb(185, 185, 185)";class Pu extends Se{constructor(t,e){super(t,e)}init(t){this.type="alignment",this.featureSource=new tb(t,this.browser),this.coverageTrack=new yb(t,this),this.alignmentTrack=new _b(t,this),super.init(t),this.alignmentTrack.setTop(this.coverageTrack,this.showCoverage),this.showAlignments||(this._height=this.coverageTrackHeight),t.sort&&(Array.isArray(t.sort)?this.assignSort(t.sort[0]):this.assignSort(t.sort))}set height(t){this._height=t,this.showAlignments&&(this.alignmentTrack.height=this.showCoverage?t-this.coverageTrackHeight:t)}get height(){return this._height}get minTemplateLength(){const t=this.config.minTLEN!==void 0?this.config.minTLEN:this.config.minFragmentLength;return t!==void 0?t:this._pairedEndStats?this._pairedEndStats.minTLEN:0}get maxTemplateLength(){const t=this.config.maxTLEN!==void 0?this.config.maxTLEN:this.config.maxFragmentLength;return t!==void 0?t:this._pairedEndStats?this._pairedEndStats.maxTLEN:1e3}sort(t){t=this.assignSort(t);for(let e of this.trackView.viewports)if(e.containsPosition(t.chr,t.position)){const n=e.cachedFeatures;n&&(n.sortRows(t),e.repaint())}}assignSort(t){if(t.locus){const e=(function(n){const i=n.split(":"),s=i[1].split("-"),o={chr:i[0],start:Number.parseInt(s[0].replace(/,/g,""))-1};return s.length>1?o.end=Number.parseInt(s[1].replace(/,/g,"")):o.end=o.start+1,o})(t.locus);t.chr=e.chr,t.position=e.start}else t.position--;return t.direction=t.direction==="ASC"||t.direction===!0,t.chr=this.browser.genome.getChromosomeName(t.chr),this.sortObject=t,this.sortObject}async getFeatures(t,e,n,i,s){const o=await this.featureSource.getAlignments(t,e,n);if(o.paired&&!this._pairedEndStats&&!this.config.maxFragmentLength){const l=new hb(o.alignments,this.config);l.totalCount>99&&(this._pairedEndStats=l)}o.alignments=void 0;const a=this.sortObject;return a&&a.chr===t&&a.position>=e&&a.position<=n&&o.sortRows(a),o}computePixelHeight(t){return(this.showCoverage?this.coverageTrackHeight:0)+(this.showAlignments?this.alignmentTrack.computePixelHeight(t):0)}draw(t){at.fillRect(t.context,0,t.pixelTop,t.pixelWidth,t.pixelHeight,{fillStyle:"rgb(255, 255, 255)"}),this.showCoverage===!0&&this.coverageTrackHeight>0?(this.trackView.axisCanvas.style.display="block",this.coverageTrack.draw(t)):this.trackView.axisCanvas.style.display="none",this.showAlignments===!0&&(this.alignmentTrack.setTop(this.coverageTrack,this.showCoverage),this.alignmentTrack.draw(t))}paintAxis(t,e,n){this.coverageTrack.paintAxis(t,e,this.coverageTrackHeight)}contextMenuItemList(t){return this.alignmentTrack.contextMenuItemList(t)}popupData(t){return this.showCoverage===!0&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight?this.coverageTrack.popupData(t):this.alignmentTrack.popupData(t)}clickedFeatures(t){let e;return e=this.showCoverage===!0&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight?this.coverageTrack.getClickedObject(t):this.alignmentTrack.getClickedObject(t),e?[e]:void 0}hoverText(t){if(this.showCoverage===!0&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight){const e=this.coverageTrack.getClickedObject(t);if(e)return e.hoverText()}}menuItemList(){let t=[];t=t.concat(Xe.numericDataMenuItems(this.trackView)),t.push("<hr/>");const e=pt('<div class="igv-track-menu-category">');e.text("Color by:"),t.push({name:void 0,object:e,click:void 0,init:void 0});const n=[{key:"strand",label:"read strand"}];this.alignmentTrack.hasPairs&&(n.push({key:"firstOfPairStrand",label:"first-of-pair strand"}),n.push({key:"pairOrientation",label:"pair orientation"}),n.push({key:"tlen",label:"insert size (TLEN)"}),n.push({key:"unexpectedPair",label:"pair orientation & insert size (TLEN)"}));const i="tag"+(this.alignmentTrack.colorByTag?" ("+this.alignmentTrack.colorByTag+")":"");n.push({key:"tag",label:i});for(let a of n){const l=this.alignmentTrack.colorBy===a.key;t.push(this.colorByCB(a,l))}const s=()=>
830{if(!this.autoHeight){const a=(this.showCoverage?this.coverageTrackHeight:0)+(this.showAlignments?this.alignmentTrack.height:0);this.trackView.setTrackHeight(a)}};t.push("<hr/>"),t.push({object:pt(ce("Show Coverage",this.showCoverage)),click:()=>{this.showCoverage=!this.showCoverage,s(),this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),t.push({object:pt(ce("Show Alignments",this.showAlignments)),click:()=>{this.showAlignments=!this.showAlignments,s(),this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),t.push("<hr/>"),t.push({object:pt(ce("Show all bases",this.showAllBases)),click:()=>{this.showAllBases=!this.showAllBases,this.config.showAllBases=this.showAllBases,this.trackView.repaintViews()}}),t.push("<hr/>"),t.push({object:pt(ce("Show mismatches",this.showMismatches)),click:()=>{this.showMismatches=!this.showMismatches,this.config.showMismatches=this.showMismatches,this.trackView.repaintViews()}}),t.push({object:pt(ce("Show insertions",this.showInsertions)),click:()=>{this.showInsertions=!this.showInsertions,this.config.showInsertions=this.showInsertions,this.getCachedAlignmentContainers(),this.trackView.repaintViews()}}),t.push({object:pt(ce("Show soft clips",this.showSoftClips)),click:()=>{this.showSoftClips=!this.showSoftClips,this.config.showSoftClips=this.showSoftClips,this.featureSource.setShowSoftClips(this.showSoftClips);const a=this.getCachedAlignmentContainers();for(let l of a)l.setShowSoftClips(this.showSoftClips);this.trackView.repaintViews()}}),this.pairsSupported&&this.alignmentTrack.hasPairs&&(t.push("<hr/>"),t.push({object:pt(ce("View as pairs",this.viewAsPairs)),click:()=>{this.viewAsPairs=!this.viewAsPairs,this.config.viewAsPairs=this.viewAsPairs,this.featureSource.setViewAsPairs(this.viewAsPairs);const a=this.getCachedAlignmentContainers();for(let l of a)l.setViewAsPairs(this.viewAsPairs);this.trackView.repaintViews()}})),this.browser.circularView&&(this.alignmentTrack.hasPairs||this.alignmentTrack.hasSupplemental)&&(t.push("<hr/>"),this.alignmentTrack.hasPairs&&t.push({label:"Add discordant pairs to circular view",click:()=>{for(let a of this.trackView.viewports)this.addPairedChordsForViewport(a)}}),this.alignmentTrack.hasSupplemental&&t.push({label:"Add split reads to circular view",click:()=>{for(let a of this.trackView.viewports)this.addSplitChordsForViewport(a)}})),t.push("<hr/>");const o=pt('<div class="igv-track-menu-category">');return o.text("Display mode:"),t.push({name:void 0,object:o,click:void 0,init:void 0}),t.push({object:pt(ce("expand",this.alignmentTrack.displayMode==="EXPANDED")),click:()=>{this.alignmentTrack.displayMode="EXPANDED",this.config.displayMode="EXPANDED",this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),t.push({object:pt(ce("squish",this.alignmentTrack.displayMode==="SQUISHED")),click:()=>{this.alignmentTrack.displayMode="SQUISHED",this.config.displayMode="SQUISHED",this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),t}colorByCB(t,e){return{name:void 0,object:pt(ce(t.label,e)),click:n=>{t.key!=="tag"?t.key===this.alignmentTrack.colorBy?(this.alignmentTrack.colorBy="none",this.config.colorBy="none",this.trackView.repaintViews()):(this.alignmentTrack.colorBy=t.key,this.config.colorBy=t.key,this.trackView.repaintViews()):this.browser.inputDialog.present({label:"Tag Name",value:this.alignmentTrack.colorByTag?this.alignmentTrack.colorByTag:"",callback:i=>{i?(this.alignmentTrack.colorBy="tag",this.alignmentTrack.colorByTag=i,this.alignmentTrack.tagColors||(this.alignmentTrack.tagColors=new ti("Set1"))):(this.alignmentTrack.colorBy="none",this.alignmentTrack.colorByTag=""),this.trackView.repaintViews()}},n)},init:void 0}}getState(){const t=super.getState();return this.sortObject&&(t.sort={chr:this.sortObject.chr,position:this.sortObject.position+1,option:this.sortObject.option,direction:this.sortObject.direction?"ASC":"DESC"}),t}getCachedAlignmentContainers(){return this.trackView.viewports.map((t=>t.cachedFeatures))}get dataRange(){return this.coverageTrack.dataRange}set dataRange(t){this.coverageTrack.dataRange=t}get logScale(){return this.coverageTrack.logScale}set logScale(t){this.coverageTrack.logScale=t}get autoscale(){return this.coverageTrack.autoscale}set autoscale(t){this.coverageTrack.autoscale=t}addPairedChordsForViewport(t){const e=this.maxTemplateLength,n=[],i=t.referenceFrame;
830for(let s of t.cachedFeatures.allAlignments())s.end>=i.start&&s.start<=i.end&&(s.paired?s.end-s.start>e&&n.push(s):s.mate&&s.mate.chr&&(s.mate.chr!==s.chr||Math.max(s.fragmentLength)>e)&&n.push(s));ds((s=>{const o=[];for(let a of s)if(a.paired)a.firstAlignment&&a.secondAlignment&&o.push({uniqueId:a.readName,refName:or(a.firstAlignment.chr),start:a.firstAlignment.start,end:a.firstAlignment.end,mate:{refName:or(a.secondAlignment.chr),start:a.secondAlignment.start,end:a.secondAlignment.end}});else{const l=a.mate;l&&l.chr&&l.position&&o.push({uniqueId:a.readName,refName:or(a.chr),start:a.start,end:a.end,mate:{refName:or(l.chr),start:l.position-1,end:l.position}})}return o})(n),this,i,.02)}addSplitChordsForViewport(t){const e=[],n=t.referenceFrame;for(let i of t.cachedFeatures.allAlignments()){const s=i.hasTag("SA");i.end>=n.start&&i.start<=n.end&&s&&e.push(i)}ds((i=>{const s=a=>{const l=fu(a.tags().SA);let h=0;for(let c of l)c.start!==a.start&&o.push({uniqueId:`${a.readName}_${h++}`,refName:or(a.chr),start:a.start,end:a.end,mate:{refName:or(c.chr),start:c.start,end:c.start+c.lenOnRef}})},o=[];for(let a of i)a.paired?(s(a.firstAlignment),a.secondAlignment&&s(a.secondAlignment)):s(a);return o})(e),this,n,.02)}}Xr(Pu,"defaults",{alleleFreqThreshold:.2,visibilityWindow:3e4,showCoverage:!0,showAlignments:!0,viewAsPairs:!1,pairsSupported:!0,showSoftClips:!1,showAllBases:!1,showInsertions:!0,showMismatches:!0,height:300,coverageTrackHeight:50});class yb{constructor(t,e){this.parent=e,this.featureSource=e.featureSource,this.paintAxis=gn,this.top=0,this.autoscale=t.autoscale||t.max===void 0,this.autoscale||(this.dataRange={min:t.min||0,max:t.max})}get height(){return this.parent.coverageTrackHeight}draw(t){const e=t.pixelTop;t.pixelHeight;const n=this.parent.browser.nucleotideColors;if(e>this.height)return;const i=t.context,s=t.features.coverageMap;let o;s.refSeq&&(o=s.refSeq.toUpperCase());const a=t.bpPerPixel,l=t.bpStart,h=l+t.pixelWidth*a+1;let c;c=this.parent.coverageColor?this.parent.coverageColor:this.parent.color&&typeof this.parent.color!="function"?qt.darkenLighten(this.parent.color,-35):"rgb(150, 150, 150)",at.setProperties(i,{fillStyle:c,strokeStyle:c});const u=Math.max(1,Math.ceil(1/a));for(let p=0,d=s.coverage.length;p<d;p++){const w=s.bpStart+p;if(w<l)continue;if(w>h)break;const m=s.coverage[p];if(!m)continue;const g=Math.round(m.total/this.dataRange.max*this.height),f=this.height-g,b=Math.floor((w-l)/a
830);at.fillRect(i,b,f,u,g)}if(o)for(let p=0,d=s.coverage.length;p<d;p++){const w=s.bpStart+p;if(w<l)continue;if(w>h)break;const m=s.coverage[p];if(!m)continue;const g=m.total/this.dataRange.max*this.height;let f=this.height-g;const b=Math.floor((w-l)/a),v=o[p];if(m.isMismatch(v)){at.setProperties(i,{fillStyle:n[v]}),at.fillRect(i,b,f,u,g);let _=0;for(let A of["A","C","T","G"]){const S=(m["pos"+A]+m["neg"+A])/this.dataRange.max*this.height;f=this.height-S-_,_+=S,at.setProperties(i,{fillStyle:n[A]}),at.fillRect(i,b,f,u,S)}}}}getClickedObject(t){let e=t.viewport.cachedFeatures;if(!e||e.length===0)return;const n=Math.floor(t.genomicLocation),i=e.coverageMap,s=Math.floor(n-i.bpStart);return i.coverage[s]}popupData(t){const e=[],n=this.getClickedObject(t);if(n){const i=Math.floor(t.genomicLocation),s=t.viewport.referenceFrame;e.push(s.chr+":"+Ot(1+i)),e.push({name:"Total Count",value:n.total});let o=n.posA+n.negA;o>0&&(o=o.toString()+" ("+Math.round(o/n.total*100)+"%, "+n.posA+"+, "+n.negA+"- )"),e.push({name:"A",value:o}),o=n.posC+n.negC,o>0&&(o=o.toString()+" ("+Math.round(o/n.total*100)+"%, "+n.posC+"+, "+n.negC+"- )"),e.push({name:"C",value:o}),o=n.posG+n.negG,o>0&&(o=o.toString()+" ("+Math.round(o/n.total*100)+"%, "+n.posG+"+, "+n.negG+"- )"),e.push({name:"G",value:o}),o=n.posT+n.negT,o>0&&(o=o.toString()+" ("+Math.round(o/n.total*100)+"%, "+n.posT+"+, "+n.negT+"- )"),e.push({name:"T",value:o}),o=n.posN+n.negN,o>0&&(o=o.toString()+" ("+Math.round(o/n.total*100)+"%, "+n.posN+"+, "+n.negN+"- )"),e.push({name:"N",value:o}),e.push("<HR/>"),e.push({name:"DEL",value:n.del.toString()}),e.push({name:"INS",value:n.ins.toString()})}return e}}class _b{constructor(t,e){this.parent=e,this.browser=e.browser,this.featureSource=e.featureSource,this.top=t.coverageTrackHeight===0?0:t.coverageTrackHeight+5,this.displayMode=t.displayMode||"EXPANDED",this.alignmentRowHeight=t.alignmentRowHeight||14,this.squishedRowHeight=t.squishedRowHeight||3,this.negStrandColor=t.negStrandColor||"rgba(150, 150, 230, 0.75)",this.posStrandColor=t.posStrandColor||"rgba(230, 150, 150, 0.75)",this.insertionColor=t.insertionColor||"rgb(138, 94, 161)",this.insertionTextColor=t.insertionTextColor||"white",this.showInsertionText=t.showInsertionText!==void 0&&!!t.showInsertionText,this.deletionColor=t.deletionColor||"black",this.deletionTextColor=t.deletionTextColor||"black",this.showDeletionText=t.showDeletionText!==void 0&&!!t.showDeletionText,this.skippedColor=t.skippedColor||"rgb(150, 170, 170)",this.pairConnectorColor=t.pairConnectorColor,this.smallTLENColor=t.smallTLENColor||t.smallFragmentLengthColor||"rgb(0, 0, 150)",this.largeTLENColor=t.largeTLENColor||t.largeFragmentLengthColor||"rgb(200, 0, 0)",this.pairOrientation=t.pairOrienation||"fr",this.pairColors={},this.pairColors.RL=t.rlColor||"rgb(0, 150, 0)",this.pairColors.RR=t.rrColor||"rgb(20, 50, 200)",this.pairColors.LL=t.llColor||"rgb(0, 150, 150)",this.colorBy=t.colorBy||"unexpectedPair",this.colorByTag=t.colorByTag?t.colorByTag.toUpperCase():void 0,this.bamColorTag=t.bamColorTag===void 0?"YC":t.bamColorTag,this.hideSmallIndels=t.hideSmallIndels,this.indelSizeThreshold=t.indelSizeThreshold||1,this.hasPairs=!1,this.hasSupplemental=!1}setTop(t,e){this.top=t.height===0||e===!1?0:5+t.height}computePixelHeight(t){return t.packedAlignmentRows?(t.hasDownsampledIntervals()?10:0)+(this.displayMode==="SQUISHED"?this.squishedRowHeight:this.alignmentRowHeight)*t.packedAlignmentRows.length+5:0}draw(t){const e=t.features,n=t.context,i=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth,a=s+o*i+1,l=this.parent.showSoftClips,h=this.parent.showAllBases,c=this.browser.nucleotideColors,u=e.packedAlignmentRows;n.save();let p=e.sequence;p&&(p=p.toUpperCase());let d=0,w=t.pixelTop;this.top&&n.translate(0,this.top);const m=w+t.pixelHeight;e.hasDownsampledIntervals()?(d=10,e.downsampledIntervals.forEach((function(v){var _=(v.start-s)/i,A=(v.end-s)/i;A-_>5&&(_+=1,A-=1),at.fillRect(n,_,2,A-_,3,{fillStyle:"black"})}))):d=0,this.alignmentsYOffset=d;const g=this.displayMode==="SQUISHED"?this.squishedRowHeight:this.alignmentRowHeight;if(u){const v=u.length;for(let _=0;_<v;_++){const A=u[_],S=d+g*_,C=g<=4?g:g-2;if(S>m)break;if(!(S+C<w)){for(let R of A.alignments)if(this.hasPairs=this.hasPairs||R.isPaired(),this.browser.cir
830cularView&&(this.hasSupplemental=this.hasSupplemental||R.hasTag("SA")),!(R.start+R.lengthOnRef<s)){if(R.start>a)break;R.hidden!==!0&&(R instanceof pn?(f.call(this,R,S,C),b.call(this,R.firstAlignment,S,C),R.secondAlignment&&b.call(this,R.secondAlignment,S,C)):b.call(this,R,S,C))}}}}function f(v,_,A){var S=this.getConnectorColor(v.firstAlignment),C=(v.connectingStart-s)/i,R=(v.connectingEnd-s)/i,x=_+A/2;v.connectingEnd<s||v.connectingStart>a||(v.mq<=0&&(S=qt.addAlpha(S,.15)),at.setProperties(n,{fillStyle:S,strokeStyle:S}),at.strokeLine(n,C,x,R,x))}function b(v,_,A){if(v.start+v.lengthOnRef<s||v.start>a)return;const S=l?v.blocks:v.blocks.filter((y=>y.type!=="S"));let C=this.getAlignmentColor(v);const R=C;v.mq<=0&&(C=qt.addAlpha(C,.15)),at.setProperties(n,{fillStyle:C,strokeStyle:R});const x=[];for(let y=0;y<S.length;y++){const E=S[y];if(!(y!==S.length-1&&S[y+1].start<s)&&(x.push(...T.call(this,E,y)),E.start+E.len>a))break}if(v.gaps){const y=_+A/2;for(let E of v.gaps){const L=(E.start-s)/i,N=(E.start+E.len-s)/i,q=N-L,H=E.len.toString(),W=6*H.length,U=L+q/2,k=E.type==="D"?this.deletionColor:this.skippedColor;if(at.strokeLine(n,L,y,N,y,{strokeStyle:k,lineWidth:2}),this.showDeletionText&&E.len>1&&q>=W+8){const O=U-W/2;at.fillRect(n,O-1,_-1,W+2,12,{fillStyle:"white"}),at.fillText(n,H,O,_+10,{font:"normal 10px monospace",fillStyle:this.deletionTextColor})}}}if(v.insertions&&this.parent.showInsertions){let y=-1;for(let E of v.insertions){if(this.hideSmallIndels&&E.len<=this.indelSizeThreshold||E.start<s)continue;if(E.start>a)break;const L=E.start-s,N=E.len.toString(),q=2+6*N.length,H=this.showInsertionText&&E.len!==1?Math.round(E.len/i):2,W=Math.max(Math.min(q,H),2),U=L/i-W/2;if(U-y>2){const k={fillStyle:this.insertionColor};at.fillRect(n,U-2,_,W+4,2,k),at.fillRect(n,U,_+2,W,A-4,k),at.fillRect(n,U-2,_+A-2,W+4,2,k),this.showInsertionText&&E.len>1&&H>q&&at.fillText(n,N,U+1,_+10,{font:"normal 10px monospace",fillStyle:this.insertionTextColor}),y=U}}}function T(y,E){const L=[],N=y.start-e.start,q=(y.start-s)/i,H=(y.start+y.len-s)/i,W=Math.max(1,H-q),U=100/i,k=Math.min(g/2,U/6),O=y.type==="S",z=v.mq<=0||this.highlightedAlignmentReadNamed===v.readName||O;let B=R;this.highlightedAlignmentReadNamed===v.readName?B="red":O&&(B="rgb(50,50,50)");const F=v.strand===!0&&E===S.length-1,j=v.strand===!1&&E===0;if(F|j){let $,G;F?($=[q,H,H+k,H,q,q],G=[_,_,_+A/2,_+A,_+A,_]):j&&($=[H,q,q-k,q,H,H],G=[_,_,_+A/2,_+A,_+A,_]),at.fillPolygon(n,$,G,{fillStyle:C}),z&&at.strokePolygon(n,$,G,{strokeStyle:B})}else at.fillRect(n,q,_,W,A,{fillStyle:C}),z&&(n.save(),n.strokeStyle=B,n.strokeRect(q,_,W,A),n.restore());if(O||h||this.parent.showMismatches&&p&&v.seq&&v.seq!=="*"){const $=v.seq?v.seq.toUpperCase():void 0,G=v.qual,Z=y.seqOffset,X=Math.max(1,1/i);for(let st=0,nt=y.len;st<nt;st++){const it=(y.start+st-s)/i;if(it+X<0)continue;if(it>o)break;let mt=$?$.charAt(Z+st):"";const gt=N+st>=0?p.charAt(N+st):"";if(mt==="="&&(mt=gt),mt==="X"||gt!==mt||O||h){let _t;!O&&G!==void 0&&G.length>Z+st?_t=xb(G[Z+st],c[mt]):_t=c[mt],_t&&L.push({bbox:{x:it,y:_,width:X,height:A},baseColor:_t,readChar:mt})}}}return L}x.forEach((({bbox:y,baseColor:E,readChar:L})=>{(function(N,q,H,W,U){var k;if(q<=.1&&H.height>=8){const O=Math.min(10,H.height);N.font=O+"px sans-serif",k=H.x+H.width/2,at.strokeText(N,U,k-N.measureText(U).width/2,O-1+H.y,{strokeStyle:W})}else at.fillRect(N,H.x,H.y,H.width,H.height,{fillStyle:W})})(n,i,y,E,L)}))}n.restore()}popupData(t){const e=this.getClickedObject(t);return e?e.popupData(t.genomicLocation):void 0}contextMenuItemList(t){const e=t.viewport,n=[],i=o=>{const a=this.parent.sortObject,l=!a||a.position!==Math.floor(t.genomicLocation)||!a.direction,h={chr:e.referenceFrame.chr,position:Math.floor(t.genomicLocation),option:o,direction:l};this.parent.sortObject=h,e.cachedFeatures.sortRows(h),e.repaint()};n.push("<b>Sort by...</b>"),n.push({label:" base",click:()=>i("BASE")}),n.push({label:" read strand",click:()=>i("STRAND")}),n.push({label:" insert size",click:()=>i("INSERT_SIZE")}),n.push({label:" gap size",click:()=>i("GAP_SIZE")}),n.push({label:" chromosome of mate",click:()=>i("MATE_CHR")}),n.push({label:" mapping quality",click:()=>i("MQ")}),n.push({label:" read name",click:()=>i("READ_NAME")}),n.push({label:" aligned read length",click:()=>i("ALIGNED_READ_LENGTH")}),n.push({label:" tag",click:()=>{const o=this.parent.sortObject,a=!o||o.position!==Math.floor(t.genomicLocation)||!o.direction,l={label:"Tag Name",value:this.sortByTag?this.sortByTag:"",callback:h=>{if(h){const c={chr:e.referenceFrame.chr,position:Math.floor(t.genomicLocation),option:"TAG",tag:h,direction:a};this.sortByTag=h,this.parent.sortObject=c,e.cachedFeatures.sortRows(c),e.repaint()}}};this.browser.inputDialog.present(l,t.event)}}),n.push("<hr/>");const s=this.getClickedObject(t);if(s){const o=this.parent.showSoftClips,a=typeof s.alignmentContaining=="function"?s.alignmentContaining(t.genomicLocation,o):s;if(a){a.isPaired()&&a.isMateMapped()&&n.push({label:"View mate in split screen",click:()=>
830{if(a.mate){const h=t.viewport.referenceFrame;if(this.browser.genome.getChromosome(a.mate.chr)){this.highlightedAlignmentReadNamed=a.readName;const c=h.end-h.start,u=a.mate.position-c/2,p=a.mate.position+c/2;this.browser.addMultiLocusPanel(a.mate.chr,u,p,h)}else this.browser.alert.present(`Reference does not contain chromosome: ${a.mate.chr}`)}},init:void 0}),n.push({label:"View read sequence",click:()=>{const h=a.seq;h&&h!=="*"?this.browser.alert.present(h):this.browser.alert.present("Read sequence: *")}}),Co()&&n.push({label:"Copy read sequence",click:async()=>{const h=a.seq;try{await navigator.clipboard.writeText(h)}catch(c){this.browser.alert.present(`error copying sequence to clipboard ${c}`)}}});const l=a.seq;if(l&&l!="*"){l.length<fs&&n.push({label:"BLAT read sequence",click:()=>{const c=a.isNegativeStrand()?Wr(l):l,u=`${a.readName} - blat`,p=`${this.parent.name} - ${u}`;ia({sequence:c,browser:this.browser,name:u,title:p})}});const h=a.softClippedBlocks();h.left&&h.left.len>20&&h.left.len<fs&&n.push({label:"BLAT left soft-clipped sequence",click:()=>{const c=l.substr(h.left.seqOffset,h.left.len),u=a.isNegativeStrand()?Wr(c):c,p=`${a.readName} - blat left clip`,d=`${this.parent.name} - ${p}`;ia({sequence:u,browser:this.browser,name:p,title:d})}}),h.right&&h.right.len>20&&h.right.len<fs&&n.push({label:"BLAT right soft-clipped sequence",click:()=>{const c=l.substr(h.right.seqOffset,h.right.len),u=a.isNegativeStrand()?Wr(c):c,p=`${a.readName} - blat right clip`,d=`${this.parent.name} - ${p}`;ia({sequence:u,browser:this.browser,name:p,title:d})}})}n.push("<hr/>")}}return this.browser.circularView&&(this.hasPairs||this.hasSupplemental)&&(this.hasPairs&&n.push({label:"Add discordant pairs to circular view",click:()=>{this.parent.addPairedChordsForViewport(e)}}),this.hasSupplemental&&n.push({label:"Add split reads to circular view",click:()=>{this.parent.addSplitChordsForViewport(e)}}),n.push("<hr/>")),n}getClickedObject(t){const e=t.viewport,n=t.y,i=t.genomicLocation,s=this.parent.showSoftClips;let o=e.cachedFeatures;if(!o||o.length===0)return;let a=o.packedAlignmentRows,l=o.downsampledIntervals;const h=this.displayMode==="SQUISHED"?this.squishedRowHeight:this.alignmentRowHeight;let c=Math.floor((n-this.top-this.alignmentsYOffset)/h);if(c<0){for(let u=0;u<l.length;u++)if(l[u].start<=i&&l[u].end>=i)return l[u]}else if(c<a.length){const u=a[c].alignments.filter((p=>p.containsLocation(i,s)));if(u.length>0)return u[0]}}getConnectorColor(t){if(this.pairConnectorColor)return this.pairConnectorColor;switch(this.colorBy){case"strand":case"firstOfPairStrand":case"pairOrientation":case"tag":return this.parent.color?typeof this.parent.color=="function"?this.parent.color(t):this.parent.color:"rgb(200, 200, 200)";default:return this.getAlignmentColor(t)}}getAlignmentColor(t){let e=Du;e=this.parent.color?typeof this.parent.color=="function"?this.parent.color(t):this.parent.color:Du;const n=this.colorBy;switch(n){case"strand":e=t.strand?this.posStrandColor:this.negStrandColor;break;case"firstOfPairStrand":t instanceof pn?e=t.firstOfPairStrand()?this.posStrandColor:this.negStrandColor:t.isPaired()&&(t.isFirstOfPair()?e=t.strand?this.posStrandColor:this.negStrandColor:t.isSecondOfPair()&&(e=t.strand?this.negStrandColor:this.posStrandColor));break;case"unexpectedPair":case"pairOrientation":if(this.pairOrientation&&t.pairOrientation){const s=kb[this.pairOrientation];if(s){const o=this.pairColors[s[t.pairOrientation]];if(o){e=o;break}}}if(n==="pairOrientation")break;case"tlen":case"fragmentLength":t.mate&&t.isMateMapped()&&(t.mate.chr!==t.chr?e=bn(t.mate.chr):this.parent.minTemplateLength&&Math.abs(t.fragmentLength)<this.parent.minTemplateLength?e=this.smallTLENColor:this.parent.maxTemplateLength&&Math.abs(t.fragmentLength)>this.parent.maxTemplateLength&&(e=this.largeTLENColor));break;case"tag":const i=t.tags()[this.colorByTag];i!==void 0&&(this.bamColorTag===this.colorByTag?e="rgb("+i+")":(this.tagColors||(this.tagColors=new ti("Set1")),e=this.tagColors.getColor(i)))}return e}}function xb(r,t){let e;return e=r<5?.1:Math.max(.1,Math.min(1,.1+.9*(r-5)/15)),e=Math.round(10*e)/10,e<1&&(t=qt.addAlpha(t,e)),t}const kb={fr:{F1R2:"LR",F2R1:"LR",F1F2:"LL",F2F1:"LL",R1R2:"RR",R2R1:"RR",R1F2:"RL",R2F1:"RL"},rf:{R1F2:"LR",R2F1:"LR",R1R2:"LL",R2R1:"LL",F1F2:"RR",F2F1:"RR",F1R2:"RL",F2R1:"RL"},ff:{F2F1:"LR",R1R2:"LR",F2R1:"LL",R1F2:"LL",R2F1:"RR",F1R2:"RR",R2R1:"RL",F1
830F2:"RL"}};function bn(r){if(wn[r])return wn[r];if(wn["chr"+r]){const t=wn["chr"+r];return wn[r]=t,t}{const t=qt.randomRGB(0,255);return wn[r]=t,t}}const wn={chrX:"rgb(204, 153, 0)",chrY:"rgb(153, 204, 0)",chrUn:"rgb(50, 50, 50)",chr1:"rgb(80, 80, 255)",chrI:"rgb(139, 155, 187)",chr2:"rgb(206, 61, 50)",chrII:"rgb(206, 61, 50)",chr2a:"rgb(216, 71, 60)",chr2b:"rgb(226, 81, 70)",chr3:"rgb(116, 155, 88)",chrIII:"rgb(116, 155, 88)",chr4:"rgb(240, 230, 133)",chrIV:"rgb(240, 230, 133)",chr5:"rgb(70, 105, 131)",chr6:"rgb(186, 99, 56)",chr7:"rgb(93, 177, 221)",chr8:"rgb(128, 34, 104)",chr9:"rgb(107, 215, 107)",chr10:"rgb(213, 149, 167)",chr11:"rgb(146, 72, 34)",chr12:"rgb(131, 123, 141)",chr13:"rgb(199, 81, 39)",chr14:"rgb(213, 143, 92)",chr15:"rgb(122, 101, 165)",chr16:"rgb(228, 175, 105)",chr17:"rgb(59, 27, 83)",chr18:"rgb(205, 222, 183)",chr19:"rgb(97, 42, 121)",chr20:"rgb(174, 31, 99)",chr21:"rgb(231, 199, 111)",chr22:"rgb(90, 101, 94)",chr23:"rgb(204, 153, 0)",chr24:"rgb(153, 204, 0)",chr25:"rgb(51, 204, 0)",chr26:"rgb(0, 204, 51)",chr27:"rgb(0, 204, 153)",chr28:"rgb(0, 153, 204)",chr29:"rgb(10, 71, 255)",chr30:"rgb(71, 117, 255)",chr31:"rgb(255, 194, 10)",chr32:"rgb(255, 209, 71)",chr33:"rgb(153, 0, 51)",chr34:"rgb(153, 26, 0)",chr35:"rgb(153, 102, 0)",chr36:"rgb(128, 153, 0)",chr37:"rgb(51, 153, 0)",chr38:"rgb(0, 153, 26)",chr39:"rgb(0, 153, 102)",chr40:"rgb(0, 128, 153)",chr41:"rgb(0, 51, 153)",chr42:"rgb(26, 0, 153)",chr43:"rgb(102, 0, 153)",chr44:"rgb(153, 0, 128)",chr45:"rgb(214, 0, 71)",chr46:"rgb(255, 20, 99)",chr47:"rgb(0, 214, 143)",chr48:"rgb(20, 255, 177)"};let zu,vn;class Cb extends Io{constructor(t,e,n,i){super(t,e,n,i)}get contentDiv(){return this.$viewport.get(0)}initializationHelper(){let t;this.$multiLocusCloseButton=pt("<div>",{class:"igv-multi-locus-close-button"}),this.$viewport.append(this.$multiLocusCloseButton),this.$multiLocusCloseButton.get(0).appendChild(Nr.createIcon("times-circle")),this.$multiLocusCloseButton.click((()=>{this.browser.removeMultiLocusPanel(this.referenceFrame)})),this.$rulerLabel=pt("<div>",{class:"igv-multi-locus-ruler-label"}),this.$viewport.append(this.$rulerLabel),t=document.createElement("div"),this.$rulerLabel.append(pt(t)),this.$rulerLabel.get(0).addEventListener("click",(async e=>{e.stopPropagation(),await this.browser.gotoMultilocusPanel(this.referenceFrame)})),this.$tooltip=pt("<div>",{class:"igv-ruler-tooltip"}),this.$tooltip.height(this.$viewport.height()),this.$viewport.append(this.$tooltip),this.$tooltipContent=pt("<div>"),this.$tooltip.append(this.$tooltipContent),this.rulerSweeper=new N0(this,this.$viewport.get(0).parentElement,this.browser,this.referenceFrame),this.attachMouseHandlers(be.isWholeGenomeView(this.referenceFrame.chr)),this.$tooltip.hide(),this.dismissLocusLabel()}presentLocusLabel(t){this.$multiLocusCloseButton.show(),this.$rulerLabel.show(),this.$rulerLabel.get(0).style.backgroundColor=bn(this.referenceFrame.chr);const e=this.$rulerLabel.get(0).querySelector("div"),{width:n}=this.$rulerLabel.get(0).getBoundingClientRect();e.innerHTML=`${this.referenceFrame.getMultiLocusLabel(t)}`;const{width:i}=e.getBoundingClientRect();i/n>.5&&(e.innerHTML=`${this.referenceFrame.getMultiLocusLabelBPLengthOnly(t)}`)}dismissLocusLabel(){this.$rulerLabel.hide(),this.$multiLocusCloseButton.hide()}attachMouseHandlers(t){if(this.namespace=`.ruler_track_viewport_${this.browser.referenceFrameList.indexOf(this.referenceFrame)}`,this.$viewport.off(this.namespace),t===!0){const e=this.browser.referenceFrameList.indexOf(this.referenceFrame),n=`click${this.namespace}`;this.$viewport.on(n,(i=>{const{x:s}=ut.translateMouseCoordinates(i,this.$viewport.get(0)),o=Math.round(this.referenceFrame.start+this.referenceFrame.toBP(s));let a;const{chr:l}=this.browser.genome.getChromosomeCoordinate(o);if(this.browser.referenceFrameList.length===1)a=l;else{let h=this.browser.referenceFrameList.map((({locusSearchString:c})=>c));h[e]=l,a=h.join(" ")}this.browser.search(a)})),this.$viewport.get(0).style.cursor="pointer"}else this.$viewport.get(0).style.cursor="default"}mouseMove(t){if(this.browser.cursorGuideVisible===!0){if(vn===void 0?(vn=this,this.$tooltip.show()):vn.guid!==this.guid?(vn.$tooltip&&vn.$tooltip.hide(),this.$tooltip.show(),vn=this):this.$tooltip.show(),this.browser.isMultiLocusWholeGenomeView()||be.isWholeGenomeView(this.referenceFrame.chr))return void this.$tooltip.hide();const{x:e}=ut.translateMouseCoordinates(t,this.$viewport.get(0)),{start:n,bpPerPixel:i}=this.referenceFrame,s=Math.round(.5+n+Math.max(0,e)*i);this.$tooltipContent.text(Ot(s));const{width:o}=this.$tooltipContent.get(0).getBoundingClientRect(),{width:a}=this.$viewport.get(0).getBoundingClientRect();this.$tooltip.css({left:`${Ce(e,0,a-o)}px`}),clearTimeout(zu),zu=setTimeout((()=>{this.$tooltip&&this.$tooltip.hide()}),1e4)}}startSpinner(){}stopSpinner(){}
830dispose(){this.rulerSweeper.dispose(),super.dispose()}}class Sb extends Io{constructor(t,e,n,i){super(t,e,n,i)}initializationHelper(){this.canvas=document.createElement("canvas"),this.canvas.className="igv-ideogram-canvas",this.$viewport.append(pt(this.canvas)),this.ideogram_ctx=this.canvas.getContext("2d"),this.addMouseHandlers()}addMouseHandlers(){this.addViewportClickHandler(this.$viewport.get(0))}addViewportClickHandler(t){this.boundClickHandler=function(e){const{xNormalized:n,width:i}=ut.translateMouseCoordinates(e,this.ideogram_ctx.canvas),{bpLength:s}=this.browser.genome.getChromosome(this.referenceFrame.chr),o=this.referenceFrame.bpPerPixel*i/s;let a=n;a-o/2<0&&(a=o/2),a+o/2>1&&(a=1-o/2);const l=Math.round((a-o/2)*s),h=Math.round((a+o/2)*s);this.referenceFrame.start=l,this.referenceFrame.end=h,this.referenceFrame.bpPerPixel=(h-l)/i,this.browser.updateViews(this.referenceFrame,this.browser.trackViews,!0)}.bind(this),t.addEventListener("click",this.boundClickHandler)}setWidth(t){this.$viewport.width(t)}drawSVGWithContext(t,e,n,i,s,o,a){t.saveWithTranslationAndClipRect(i,s,o,e,n,a),this.trackView.track.draw({context:t,referenceFrame:this.referenceFrame,pixelWidth:e,pixelHeight:n}),t.restore()}repaint(){this.draw({referenceFrame:this.referenceFrame})}draw({referenceFrame:t}){at.configureHighDPICanvas(this.ideogram_ctx,this.$viewport.width(),this.$viewport.height()),this.trackView.track.draw({context:this.ideogram_ctx,referenceFrame:t,pixelWidth:this.$viewport.width(),pixelHeight:this.$viewport.height()})}startSpinner(){}stopSpinner(){}}function sa(r,t,e,n){return r.track.type==="ruler"?new Cb(r,t,e,n):r.track.id==="ideogram"?new Sb(r,t,e,n):new Io(r,t,e,n)}const Ab={textAlign:"start",textBaseline:"bottom",strokeStyle:"black",fillStyle:"black"};class Eb{constructor(t,e,n,i){this.guid=ut.guid(),this.trackView=t,this.browser=t.browser,this.viewport=ut.div({class:"igv-viewport"}),e.appendChild(this.viewport),t.track.height&&(this.viewport.style.height=`${t.track.height}px`),this.canvas=document.createElement("canvas"),this.viewport.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.trackScrollDelta=0,this.contentTop=0,this.setWidth(i),this.browser.showSampleNames===!1&&this.hide(),this.addMouseHandlers()}checkCanvas(){const t=window.devicePixelRatio,e=this.viewport.clientHeight,n=this.browser.sampleNameViewportWidth;if(this.canvas.width!==n*t||this.canvas.height!==e*t){const i=this.canvas;i.width=n*t,i.height=e*t,i.style.width=`${n}px`,i.style.height=`${e}px`,this.ctx=this.canvas.getContext("2d"),this.ctx.scale(t,t)}}setTop(t){if(typeof this.trackView.track.getSamples=="function"){this.contentTop=t;const e=this.trackView.track.getSamples();this.repaint(e)}}setWidth(t){this.viewport.innerWidth=t,this.checkCanvas()}show(){this.viewport.style.display="block"}hide(){this.viewport.style.display="none"}async repaint(t){this.checkCanvas(),this.draw({context:this.ctx,samples:t})}draw({context:t,samples:e}){if(!e||e.names.length===0)return;(function(s,{textAlign:o,textBaseline:a,strokeStyle:l,fillStyle:h}
830,c){const u=Math.min(c,10);s.font=`${u}px sans-serif`,s.textAlign=o,s.textBaseline=a,s.fillStyle=h})(t,Ab,e.height),t.clearRect(0,0,t.canvas.width,t.canvas.height),t.fillStyle=(function(s){const{r:o,g:a,b:l}=Xh[s];return`rgb(${o},${a},${l})`})("lead");const n=this.viewport.getBoundingClientRect().height;let i=(e.yOffset||0)+this.contentTop;for(let s of e.names){if(i>n)break;if(i+e.height>0){const o=s,a=Tb(t,o,i,e.height);t.fillText(o,4,a)}i+=e.height}}renderSVGContext(t,{deltaX:e,deltaY:n}){if(typeof this.trackView.track.getSamples=="function"){const i=this.trackView.track.getSamples(),s=0,{width:o,height:a}=this.viewport.getBoundingClientRect(),l=`${(this.trackView.track.name||this.trackView.track.id).replace(/\W/g,"")}_sample_names_guid_${ut.guid()}`;t.saveWithTranslationAndClipRect(l,e,n+s,o,a,-s),this.draw({context:t,samples:i}),t.restore()}}addMouseHandlers(){this.addViewportContextMenuHandler(this.viewport)}removeMouseHandlers(){this.removeViewportContextMenuHandler(this.viewport)}addViewportContextMenuHandler(t){this.boundContextMenuHandler=function(e){e.preventDefault(),e.stopPropagation();const n={label:"Name Panel Width",value:this.browser.sampleNameViewportWidth,callback:i=>{this.browser.sampleNameViewportWidth=parseInt(i);for(let{sampleNameViewport:s}of this.browser.trackViews)s.setWidth(this.browser.sampleNameViewportWidth);this.browser.layoutChange()}};this.browser.inputDialog.present(n,e)}.bind(this),t.addEventListener("contextmenu",this.boundContextMenuHandler)}removeViewportContextMenuHandler(t){t.removeEventListener("contextmenu",this.boundContextMenuHandler)}dispose(){this.removeMouseHandlers(),this.viewport.remove()}}function Tb(r,t,e,n){return e+n-(function(i,s,o){const{actualBoundingBoxAscent:a,actualBoundingBoxDescent:l}=i.measureText(s);return(o-(a+l))/2})(r,t,n)}const yn=function(r){this.popover=ut.div({class:"igv-menu-popup"}),r.appendChild(this.popover);const t=ut.div({class:"igv-menu-popup-header"});this.popover.appendChild(t),Vs.attachDialogCloseHandlerWithParent(t,(()=>this.hide())),this.popoverContent=ut.div(),this.popover.appendChild(this.popoverContent),Br(this.popover,t),t.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()})),this.hide()};yn.prototype.hide=function(){this.popover.style.display="none"},yn.prototype.presentMenuList=function(r){if(Mb(),r.length>0){this.popoverContent.innerHTML="",r=Xe.trackMenuItemListHelper(r,this);for(let e of r){e.init&&e.init();let n=e.object;r.indexOf(e)===0&&n.removeClass("igv-track-menu-border-top"),n.hasClass("igv-track-menu-border-top")||n.hasClass("igv-menu-popup-check-container")||n.is("div")&&n.addClass("igv-menu-popup-shim"),this.popoverContent.appendChild(n.get(0))}this.popover.style.display="flex";const{width:t}=this.popover.getBoundingClientRect();this.popover.style.left=-t+"px",this.popover.style.top="0px"}},yn.prototype.presentTrackContextMenu=function(r,t){this.popoverContent.innerHTML="";const e=(n=t,i=this.popover,n.map((s=>{let o;if(typeof s=="string"&&s==="<hr/>")o=document.createElement("hr");else if(typeof s=="string")o=ut.div({class:"context-menu"}),o.innerHTML=s;else if(typeof s=="Node")o=s;else{if(typeof s.init=="function"&&s.init(),s.type==="checkbox")o=ce("Show all bases",s.value);else if(s.type==="color"){const a=new Wl({parent:i.parentElement,width:364});a.configure(void 0,{color:h=>s.click(h)}),o=ut.div({class:"context-menu"}),typeof s.label=="string"&&(o.innerHTML=s.label);const l=h=>{a.show(),ut.hide(i),h.preventDefault(),h.stopPropagation()};o.addEventListener("click",l),o.addEventListener("touchend",l),o.addEventListener("mouseup",(function(h){h.preventDefault(),h.stopPropagation()}))}else o=ut.div({class:"context-menu"}),typeof s.label=="string"&&(o.innerHTML=s.label);if(s.click&&s.type!=="color"){let a=function(l){s.click(),ut.hide(i),l.preventDefault(),l.stopPropagation()};o.addEventListener("click",a),o.addEventListener("touchend",a),o.addEventListener("mouseup",(function(l){l.preventDefault(),l.stopPropagation()}))}}return{el:o,init:s.init}})));var n,i;for(let{el:s}of e)this.popoverContent.appendChild(s);(function(s,o){o.style.display="flex";const{x:a,y:l}=ut.translateMouseCoordinates(s,o.parentNode),{width:h}=o.getBoundingClientRect(),c=a+h,{width:u}=o.parentNode.getBoundingClientRect();o.style.left=`${c>u?a-(c-u):a}px`,o.style.top=`${l}px`})(r,this.popover)},yn.prototype.dispose=function(){this.popoverContent.innerHTML="",this.popover.innerHTML="",Object.keys(this).forEac
830h((function(r){this[r]=void 0}))};const Mb=()=>{const r=document.querySelectorAll(".igv-menu-popup");for(let t=0;t<r.length;t++)r[t].style.display="none"},ps=new Set(["ruler","ideogram"]),Rb=new Set(["ruler","sequence","ideogram"]);class oa{constructor(t,e,n){this.browser=t,this.track=n,n.trackView=this,this.addDOMToColumnContainer(t,e,t.referenceFrameList)}startSpinner(){this.viewports&&this.viewports.length>0&&this.viewports[0].startSpinner()}stopSpinner(){this.viewports&&this.viewports.length>0&&this.viewports[0].stopSpinner()}addDOMToColumnContainer(t,e,n){this.axis=this.createAxis(t,this.track),this.viewports=[];const i=t.calculateViewportWidth(n.length),s=e.querySelectorAll(".igv-column");for(let o=0;o<s.length;o++){const a=sa(this,s[o],n[o],i);this.viewports.push(a)}this.sampleNameViewport=new Eb(this,t.columnContainer.querySelector(".igv-sample-name-column"),void 0,t.sampleNameViewportWidth),this.createTrackScrollbar(t),this.createTrackDragHandle(t),this.createTrackGearPopup(t)}createAxis(t,e){const n=ut.div();if(t.columnContainer.querySelector(".igv-axis-column").appendChild(n),n.style.height=`${e.height}px`,typeof e.paintAxis=="function"){e.dataRange&&n.addEventListener("click",(()=>{t.dataRangeDialog.configure(this),t.dataRangeDialog.present(pt(t.columnContainer))}));const{width:i,height:s}=n.getBoundingClientRect();this.axisCanvas=document.createElement("canvas"),this.axisCanvas.style.width=`${i}px`,this.axisCanvas.style.height=`${s}px`,n.appendChild(this.axisCanvas)}return n}resizeAxisCanvas(t,e){this.axis.style.width=`${t}px`,this.axis.style.height=`${e}px`,typeof this.track.paintAxis=="function"&&(this.axisCanvas.style.width=`${t}px`,this.axisCanvas.style.height=`${e}px`)}removeDOMFromColumnContainer(){this.boundAxisClickHander&&this.removeAxisEventListener(this.axis),this.axis.remove();for(let t of this.viewports)t.$viewport.remove();this.sampleNameViewport.dispose(),this.removeTrackScrollMouseHandlers(),this.outerScroll.remove(),this.removeTrackDragMouseHandlers(),this.dragHandle.remove(),this.removeTrackGearMouseHandlers(),this.gearContainer.remove()}renderSVGContext(t,{deltaX:e,deltaY:n}){(function(a,l,h,c,u){if(typeof l.paintAxis=="function"){const{y:p,width:d,height:w}=h.getBoundingClientRect(),m=`${(l.name||l.id).replace(/\W/g,"")}_axis_guid_${ut.guid()}`;a.saveWithTranslationAndClipRect(m,c,p+u,d,w,0),l.paintAxis(a,d,w),a.restore()}})(t,this.track,this.axisCanvas,e,n);const{width:i}=this.axis.getBoundingClientRect(),{y:s}=this.viewports[0].$viewport.get(0).getBoundingClientRect();let o={deltaX:i+e,deltaY:s+n};for(let a of this.viewports){a.renderSVGContext(t,o);const{width:l}=a.$viewport.get(0).getBoundingClientRect();o.deltaX+=l}this.browser.showSampleNames===!0&&this.sampleNameViewport.renderSVGContext(t,o)}dataRange(){return this.track.dataRange?this.track.dataRange:void 0}setDataRange(t,e){t!==void 0&&(this.track.dataRange.min=t),e!==void 0&&(this.track.dataRange.max=e),this.track.autoscale=!1,this.repaintViews()}presentColorPicker(t){if(Rb.has(this.track.type)===!1){const e=[],n=this.track.color||this.track.defaultColor;ve(n)&&e.push(n),this.track.altColor&&ve(this.track.altColor)&&e.push(this.track.altColor);const i=e.map((o=>o.startsWith("#")?o:o.startsWith("rgb(")?qt.rgbToHex(o):qt.colorNameToHex(o))),s={color:o=>{this.track.color=o,this.repaintViews()},altColor:o=>{this.track.altColor=o,this.repaintViews()}};this.browser.genericColorPicker.configure(i,s),this.browser.genericColorPicker.setActiveColorHandler(t),this.browser.genericColorPicker.show()}}setTrackHeight(t,e){e||(this.track.minHeight&&(t=Math.max(this.track.minHeight,t)),this.track.maxHeight&&(t=Math.min(this.track.maxHeight,t))),this.track.height=t,this.resizeAxisCanvas(this.axis.clientWidth,this.track.height),typeof this.track.paintAxis=="function"&&this.paintAxis();for(let{$viewport:n}of this.viewports)n.height(t);if(this.sampleNameViewport.viewport.style.height=`${t}px`,typeof this.track.computePixelHeight!="function")for(let n of this.viewports)n.setContentHeight(t);this.repaintViews(),ps.has(this.track.type)===!1&&this.updateScrollbar(),this.dragHandle.style.height=`${t}px`,this.gearContainer.style.height=`${t}px`}updateScrollbar(){const t=this.viewports[0].$viewport.height();this.outerScroll.style.height=`${t}px`;const e=this.maxViewportContentHeight(),n=Math.round(t/e*t);e>t?(this.innerScroll.style.display="block",this.innerScroll.style.height=`${n}px`):this.innerScroll.style.display="none"}moveScroller(t){const e=pt(this.innerScroll).position().top+t,n=Math.min(Math.max(0,e),this.outerScroll.clientHeight-this.innerScroll.clientHeight);pt(this.innerScroll).css("top",`${n}px`);const i=this.maxViewportContentHeight(),s=-Math.round(n*(i/this.viewports[0].$viewport.height()));for(let o of this.viewports)o.setTop(s);this.sampleNameViewport.trackScrollDelta=t,this.sampleNameViewport.setTop(s)}isLoading(){for(let t of this.viewports)if(t.isLoading())return!0}repaintViews(){for(let t of this.viewports)t.isVisible()&&t.repaint();typeof this.track.paintAxis=="function"&&this.paintAxis(),this.repaintSamples()}repaintSamples(){if(typeof this.track.getSamples=="function"){const t=this.track.getSamples();this.sampleNameViewport.repaint(t)}}
830setTrackLabelName(t){this.viewports.forEach((e=>e.setTrackLabel(t)))}resize(t){for(let e of this.viewports)e.setWidth(t)}async updateViews(){if(!this.browser||!this.browser.referenceFrameList)return;const t=this.viewports.filter((s=>s.isVisible()));if(t.forEach((s=>s.shift())),this.browser.dragObject)return;const e=t.filter((s=>s.needsRepaint())).filter((s=>s.checkZoomIn())),n=e.filter((s=>s.needsReload()));for(let s of n)await s.loadFeatures();if(this.disposed)return;if(this.track&&typeof this.track.variantRowCount=="function"&&n.length>0){let s=0;for(let o of this.viewports)o.featureCache&&o.featureCache.features&&(s=Math.max(s,o.featureCache.features.reduce(((a,l)=>Math.max(a,l.row||0)),0)));if(this.track.nVariantRows!==s+1){this.track.variantRowCount(s+1);for(let o of this.viewports)o.checkContentHeight()}}if(this.track.autoscale){let s=[];for(let o of t){const a=o.referenceFrame,l=a.start,h=l+a.toBP(o.getWidth());if(o.featureCache&&o.featureCache.features)if(typeof o.featureCache.features.getMax=="function"){const c=o.featureCache.features.getMax(l,h);s.push({value:c})}else{const c=Xi(o.featureCache.features,l,h);for(let u of c)s.push(u)}}typeof this.track.doAutoscale=="function"?this.track.dataRange=this.track.doAutoscale(s):this.track.dataRange=_o(s)}const i=this.track.autoscale||this.track.autoscaleGroup||this.track.type==="ruler";for(let s of t)e.includes(s)?s.repaint():i&&s.refresh();this.adjustTrackHeight(),this.repaintSamples(),this.updateRulerViewportLabels()}clearCachedFeatures(){for(let t of this.viewports)t.clearCache()}updateRulerViewportLabels(){const t=this.browser.calculateViewportWidth(this.viewports.length);for(let e of this.viewports)this.track.type==="ruler"&&(this.viewports.length>1?e.presentLocusLabel(t):e.dismissLocusLabel())}async getInViewFeatures(){if(!this.browser||!this.browser.referenceFrameList)return[];let t=[];const e=this.viewports.filter((n=>n.isVisible()));for(let n of e){const i=n.referenceFrame,{chr:s,start:o,bpPerPixel:a}=n.referenceFrame,l=o+i.toBP(n.getWidth());if((!n.featureCache||!n.featureCache.containsRange(s,o,l,a))&&await n.loadFeatures(),n.featureCache&&n.featureCache.features)if(typeof n.featureCache.features.getMax=="function"){const h=n.featureCache.features.getMax(o,l);t.push({value:h})}else{const h=typeof n.featureCache.queryFeatures=="function"?n.featureCache.queryFeatures(s,o,l):Xi(n.featureCache.features,o,l);t=t.concat(h)}}return t}checkContentHeight(){for(let t of this.viewports)t.checkContentHeight();this.adjustTrackHeight()}adjustTrackHeight(){var t=this.maxViewportContentHeight();if(this.track.autoHeight?this.setTrackHeight(t,!1):this.track.paintAxis&&this.paintAxis(),ps.has(this.track.type)===!1){const e=this.viewports[0].getContentTop(),n=this.viewports[0].$viewport.height(),i=Math.min(0,n-t);if(e<i)for(let s of this.viewports)s.setTop(i);this.updateScrollbar()}}createTrackScrollbar(t){const e=ut.div();if(t.columnContainer.querySelector(".igv-scrollbar-column").appendChild(e),e.style.height=`${this.track.height}px`,this.outerScroll=e,ps.has(this.track.type)===!1){const n=ut.div();e.appendChild(n),this.innerScroll=n,this.addTrackScrollMouseHandlers(t)}}createTrackDragHandle(t){const e=this.track.type==="ideogram"||this.track.type==="ruler"?"igv-track-drag-shim":"igv-track-drag-handle";this.dragHandle=ut.div({class:e}),t.columnContainer.querySelector(".igv-track-drag-column").appendChild(this.dragHandle),this.dragHandle.style.height=`${this.track.height}px`,this.addTrackDragMouseHandlers(t)}createTrackGearPopup(t){this.gearContainer=ut.div(),t.columnContainer.querySelector(".igv-gear-menu-column").appendChild(this.gearContainer),this.gearContainer.style.height=`${this.track.height}px`,this.track.ignoreTrackMenu===!0||(this.gear=ut.div(),this.gearContainer.appendChild(this.gear),this.gear.appendChild(Nr.createIcon("cog")),this.trackGearPopup=new yn(this.gear),this.addTrackGearMouseHandlers())}addAxisEventListener(t){this.boundAxisClickHander=function(e){this.browser.dataRangeDialog.configure(this),this.browser.dataRangeDialog.present(pt(this.browser.columnContainer))}.bind(this),t.addEventListener("click",this.boundAxisClickHander)}removeAxisEventListener(t){t.removeEventListener("click",this.boundAxisClickHander)}addTrackScrollMouseHandlers(t){this.boundTrackScrollMouseDownHandler=function(e){e.stopPropagation();const{y:n}=ut.pageCoordinates(e);pt(this.innerScroll).data("yDown",n.toString()),this.boundColumnContainerMouseMoveHandler=function(i){i.stopPropagation();const{y:s}=ut.pageCoordinates(i);this.moveScroller(s-parseInt(pt(this.innerScroll).data("yDown"))),pt(this.innerScroll).data("yDown",s.toString())}.bind(this),t.columnContainer.addEventListener("mousemove",this.boundColumnContainerMouseMoveHandler)}.bind(this),this.innerScroll.addEventListener("mousedown",this.boundTrackScrollMouseDownHandler),this.boundColumnContainerMouseUpHandler=function(e){t.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler)}.bind(this),t.columnContainer.addEventListener("mouseup",this.boundColumnContainerMouseUpHandler)}removeTrackScrollMouseHandlers(){ps.has(this.track.type)===!1&&(this.innerScroll.removeEventListener("mousedown",this.boundTrackScrollMouseDownHandler),this.browser.columnContainer.removeEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.browser.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler))}addTrackDragMouseHandlers(t){if(!(this.track.id==="ideogram"||this.track.id==="ruler")){let n=function(a){a.preventDefault(),e=a.target,e.classList.add("igv-track-drag-handle-hover"),t.startTrackDrag(this)},i=function(a){t.endTrackDrag(),e&&a.target!==e&&e.classList.remove("igv-track-drag-handle-hover"),e=void 0},s=function(a){a.preventDefault(),e===void 0&&a.target.classList.add("igv-track-drag-handle-hover"),t.updateTrackDrag(this)},o=function(a){a.preventDefault(),e===void 0&&a.target.classList.remove("igv-track-drag-handle-hover")},e;this.boundTrackDragMouseDownHandler=n.bind(this),this.dragHandle.addEventListener("mousedown",this.boundTrackDragMouseDownHandler),this.boundDocumentTrackDragMouseUpHandler=i.bind(this),document.addEventListener("mouseup",this.boundDocumentTrackDragMouseUpHandler),this.boundTrackDragMouseEnterHandler=s.bind(this),this.dragHandle.addEventListener("mouseenter",this.boundTrackDragMouseEnterHandler),this.dragHandle.addEventListener("mouseout",(a=>{a.preventDefault(),e===void 0&&a.target.classList.remove("igv-track-drag-handle-hover")})),this.boundTrackDragMouseOutHandler=o.bind(this),this.dragHandle.addEventListener("mouseout",this.boundTrackDragMouseOutHandler)}}removeTrackDragMouseHandlers(){this.track.id==="ideogram"||this.track.id==="ruler"||(this.dragHandle.removeEventListener("mousedown",this.boundTrackDragMouseDownHandler),document.removeEventListener("mouseup",this.boundDocumentTrackDragMouseUpHandler),this.dragHandle.removeEventListener("mouseup",this.boundTrackDragMouseEnterHandler),this.dragHandle.removeEventListener("mouseout",this.boundTrackDragMouseOutHandler))}addTrackGearMouseHandlers(){if(this.track.ignoreTrackMenu!==!0){let t=function(e){e.preventDefault(),e.stopPropagation(),this.trackGearPopup.presentMenuList(Xe.trackMenuItemList(this))};this.boundTrackGearClickHandler=t.bind(this),this.gear.addEventListener("click",this.boundTrackGearClickHandler)}}removeTrackGearMouseHandlers(){this.track.ignoreTrackMenu===!0||this.gear.removeEventListener("click",this.boundTrackGearClickHandler)}dispose(){this.removeAxisEventListener(this.axis),this.axis.remove();for(let t of this.viewports)t.dispose();
830this.sampleNameViewport.dispose(),this.removeTrackScrollMouseHandlers(),this.outerScroll.remove(),this.removeTrackDragMouseHandlers(),this.dragHandle.remove(),this.removeTrackGearMouseHandlers(),this.gearContainer.remove(),typeof this.track.dispose=="function"&&this.track.dispose();for(let t of Object.keys(this))this[t]=void 0;this.alert&&this.alert.container.remove(),this.disposed=!0}paintAxis(){if(typeof this.track.paintAxis=="function"){const{width:t,height:e}=this.axisCanvas.getBoundingClientRect(),n=window.devicePixelRatio||1;this.axisCanvas.height=n*e,this.axisCanvas.width=n*t;const i=this.axisCanvas.getContext("2d");i.scale(n,n),this.track.paintAxis(i,t,e)}}maxViewportContentHeight(){return Math.max(this.viewports.map((t=>t.getContentHeight())))}}const Hu="rgb(150, 150, 150)";class Uu extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.type="wig",this.featureType="numeric",this.paintAxis=gn;const e=t.format?t.format.toLowerCase():t.format;t.featureSource?(this.featureSource=t.featureSource,delete t.featureSource):this.featureSource=e==="bigwig"?new iu(t,this.browser.genome):e==="tdf"?new lu(t,this.browser.genome):He(t,this.browser.genome),t.max===void 0||t.autoscale===!0?this.autoscale=!0:this.dataRange={min:t.min||0,max:t.max}}async postInit(){const t=await this.getHeader();this.disposed||t&&this.setTrackProperties(t)}async getFeatures(t,e,n,i){const s=await this.featureSource.getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:this.visibilityWindow,windowFunction:this.windowFunction});if(this.normalize&&this.featureSource.normalizationFactor){const o=this.featureSource.normalizationFactor;for(let a of s)a.value*=o}if(this.scaleFactor){const o=this.scaleFactor;for(let a of s)a.value*=o}return s}menuItemList(){let t=[];return this.flipAxis!==void 0&&(t.push("<hr>"),t.push({label:"Flip y-axis",click:()=>{this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}})),t=t.concat(Xe.numericDataMenuItems(this.trackView)),t}async getHeader(){return typeof this.featureSource.getHeader=="function"&&(this.header=await this.featureSource.getHeader()),this.header}getScaleFactor(t,e,n,i){return i?n/(Math.log10(e+1)-(t<=0?0:Math.log10(t+1))):n/(e-t)}computeYPixelValue(t,e){return(this.flipAxis?t-this.dataRange.min:this.dataRange.max-t)*e}computeYPixelValueInLogScale(t,e){let n=this.dataRange.max,i=this.dataRange.min;return n<=0?0:(i<=-1&&(i=0),i=i<=0?0:Math.log10(i+1),n=Math.log10(n+1),t=Math.log10(t+1),(this.flipAxis?t-i:n-t)*e)}draw(t){const e=t.features,n=t.context,i=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth;t.pixelHeight;const a=s+o*i+1,l=this.color||Hu;let h;typeof l=="string"&&l.startsWith("rgb(")&&(h=qt.addAlpha(l,.1));const c=this.getScaleFactor(this.dataRange.min,this.dataRange.max,t.pixelHeight,this.logScale),u=p=>this.logScale?this.computeYPixelValueInLogScale(p,c):this.computeYPixelValue(p,c);if(e&&e.length>0&&(this.dataRange.min===void 0&&(this.dataRange.min=0),this.dataRange.max>this.dataRange.min)){let p,d=-1;const w=u(0);for(let m of e){if(m.end<s)continue;if(m.start>a)break;const g=Math.floor((m.start-s)/i);if(isNaN(g))continue;let f=u(m.value);const b=Math.ceil((m.end-s)/i),v=Math.max(1,b-g),_=this.getColorForFeature(m);if(this.graphType==="points"){const A=this.config.pointSize||3,S=g+v/2;at.fillCircle(n,S,f,A/2,{fillStyle:_,strokeStyle:_})}else if(this.graphType==="line")p!=null&&at.strokeLine(n,d,p,g,f,{fillStyle:_,strokeStyle:_}),at.strokeLine(n,g,f,g+v,f,{fillStyle:_,strokeStyle:_});else{const A=f-w;at.fillRect(n,g,w,v,A,{fillStyle:_})}d=g+v,p=f}if(this.dataRange.min<0){const m=this.dataRange.max/(this.dataRange.max-this.dataRange.min)*t.pixelHeight;at.strokeLine(n,0,m,t.pixelWidth,m,{strokeStyle:h})}}if(this.config.hasOwnProperty("guideLines")){for(let p of this.config.guideLines)if(p.hasOwnProperty("color")&&p.hasOwnProperty("y")&&p.hasOwnProperty("dotted")){let d=u(p.y),w={strokeStyle:p.color,strokeWidth:2};p.dotted?at.dashedLine(t.context,0,d,t.pixelWidth,d,5,w):at.strokeLine(t.context,0,d,t.pixelWidth,d,w)}}}popupData(t,e){if(e===void 0&&(e=this.clickedFeatures(t)),e&&e.length>0){const n=t.genomicLocation,i=[];e.sort((function(o,a){return Math.abs((o.start+o.end)/2-n)-Math.abs((a.start+a.end)/2-n)}));const s=e.length>
83010?e.slice(0,10):e;s.sort((function(o,a){return o.start-a.start}));for(let o of s)if(o){i.length>0&&i.push("<hr/>");let a=o.end-o.start==1?Ot(o.start+1):Ot(o.start+1)+"-"+Ot(o.end);i.push({name:"Position:",value:a}),i.push({name:"Value: ",value:Ot(o.value)})}return s.length<e.length&&i.push("<hr/>..."),i}return[]}get supportsWholeGenome(){return!this.config.indexURL&&this.config.supportsWholeGenome!==!1}getColorForFeature(t){let e=t.value<0&&this.altColor?this.altColor:this.color||Hu;return typeof e=="function"?e(t.value):e}dispose(){this.trackView=void 0}}Xr(Uu,"defaults",{height:50,flipAxis:!1,logScale:!1,windowFunction:"mean",graphType:"bar",autoscale:!0,normalize:void 0,scaleFactor:void 0});function Vu(r){this.thresholds=r.thresholds,this.colors=r.colors}function aa(r){this.scale=r,this.lowColor="rgb("+r.lowR+","+r.lowG+","+r.lowB+")",this.highColor="rgb("+r.highR+","+r.highG+","+r.highB+")",this.diff=r.high-r.low}Vu.prototype.getColor=function(r){for(let t of this.thresholds)if(r<t)return this.colors[this.thresholds.indexOf(t)];return this.colors[this.colors.length-1]},aa.prototype.getColor=function(r){var t,e=this.scale;return r<=e.low?this.lowColor:r>=e.high?this.highColor:(t=(r-e.low)/this.diff,"rgb("+Math.floor(e.lowR+t*(e.highR-e.lowR))+","+Math.floor(e.lowG+t*(e.highG-e.lowG))+","+Math.floor(e.lowB+t*(e.highB-e.lowB))+")")};class Lb{constructor(t){this.color=t}getColor(){return this.color}}class la extends Se{constructor(t,e){super(t,e)}init(t){if(super.init(t),this.type=t.type||"seg",this.type==="maf"&&(this.type="mut"),this.isLog=t.isLog,this.displayMode=t.displayMode||"EXPANDED",this.height=t.height||300,this.maxHeight=t.maxHeight||500,this.squishedRowHeight=t.sampleSquishHeight||t.squishedRowHeight||2,this.expandedRowHeight=t.sampleExpandHeight||t.expandedRowHeight||13,this.sampleHeight=this.squishedRowHeight,t.color?this.color=t.color:(this.posColorScale=t.posColorScale||new aa({low:.1,lowR:255,lowG:255,lowB:255,high:1.5,highR:255,highG:0,highB:0}),this.negColorScale=t.negColorScale||new aa({low:-1.5,lowR:0,lowG:0,lowB:255,high:-.1,highR:255,highG:255,highB:255}),this.type==="mut"&&(this.colorTable=new ei(t.colorTable||Ib))),this.sampleKeys=[],this.sampleNames=new Map,t.samples){for(let n of t.samples)this.sampleKeys.push(n),this.sampleNames.set(n,n);this.explicitSamples=!0}const e=Object.assign({},this.config);e.maxWGCount=e.maxWGCount||Number.MAX_SAFE_INTEGER,this.featureSource=He(e,this.browser.genome),this.initialSort=t.sort}async postInit(){typeof this.featureSource.getHeader=="function"&&(this.header=await this.featureSource.getHeader(),this.disposed)||this.header&&this.setTrackProperties(this.header)}menuItemList(){const t=[],e={SQUISHED:"Squish",EXPANDED:"Expand",FILL:"Fill"};t.push("<hr/>"),t.push("DisplayMode:");const n=this.type==="seg"?["SQUISHED","EXPANDED","FILL"]:["SQUISHED","EXPANDED"];for(let i of n){const s=ce(e[i],i===this.displayMode);t.push({object:pt(s),click:()=>{this.displayMode=i,this.config.displayMode=i,this.trackView.checkContentHeight(),this.trackView.repaintViews(),this.trackView.moveScroller(this.trackView.sampleNameViewport.trackScrollDelta)}})}return t}hasSamples(){return!0}getSamples(){return{names:this.sampleKeys.map((t=>this.sampleNames.get(t))),height:this.sampleHeight,yOffset:0}}async getFeatures(t,e,n){const i=await this.featureSource.getFeatures({chr:t,start:e,end:n});if(this.initialSort){const s=this.initialSort;this.sortSamples(s.chr,s.start,s.end,s.direction,i),this.initialSort=void 0}return i}draw({context:t,renderSVG:e,pixelTop:n,pixelWidth:i,pixelHeight:s,features:o,bpPerPixel:a,bpStart:l}){if(at.fillRect(t,0,n,i,s,{fillStyle:"rgb(255, 255, 255)"}),o&&o.length>0){this.checkForLog(o),this.updateSampleKeys(o);const h={};let c;switch(this.sampleKeys.forEach((function(m,g){h[m]=g})),this.displayMode){case"FILL":this.sampleHeight=s/this.sampleKeys.length,c=0;break;case"SQUISHED":this.sampleHeight=this.squishedRowHeight,c=0;break;default:this.sampleHeight=this.expandedRowHeight,c=1}const u=this.sampleHeight;for(let m of o)m.pixelRect=void 0;const p=n+s,d=l+i*a+1,w=a;this.sampleYStart=void 0;for(let m of o){if(m.end<l)continue;if(m.start>d)break;const g=m.sampleKey||m.sample;m.row=h[g];const f=m.row*u+c;if(this.sampleYStart===void 0&&(this.sampleYStart=f),f+u<n||f>p)continue;const b=Math.max(m.start,l);let v=Math.round((b-l)/w);
830const _=Math.min(m.end,d),A=Math.round((_-l)/w);let S,C,R=Math.max(1,A-v);if(this.color?S=typeof this.color=="function"?this.color(m):this.color:this.colorTable&&(S=this.colorTable.getColor(m.value.toLowerCase())),this.type==="mut")C=u-2*c,R<3&&(R=3,v-=1);else{let x=m.value;this.isLog||(x=Dg(x/2)),S=x<-.1?this.negColorScale.getColor(x):x>.1?this.posColorScale.getColor(x):"white";let T=u;if(u<.25){const y=.1+2*Math.abs(x);T=Math.min(1,y*u)}C=T-2*c}m.pixelRect={x:v,y:f,w:R,h:C},t.fillStyle=S,t.fillRect(v,f,R,C)}}}checkForLog(t){if(this.isLog===void 0){this.isLog=!1;for(let e of t)if(e.value<0)return void(this.isLog=!0)}}computePixelHeight(t){if(!t)return 0;const e=this.displayMode==="SQUISHED"?this.squishedRowHeight:this.expandedRowHeight;return this.updateSampleKeys(t),this.sampleKeys.length*e}async sortSamples(t,e,n,i,s){if(s||(s=await this.featureSource.getFeatures({chr:t,start:e,end:n})),!s)return;this.updateSampleKeys(s);const o={},a=i==="ASC"?1:-1,l=()=>{const c=n-e+1;for(let u of s){if(u.end<e)continue;if(u.start>n)break;const p=Math.max(e,u.start),d=(Math.min(n,u.end)-p)/c,w=u.sampleKey||u.sample,m=o[w]||0;o[w]=m+d*u.value}this.sampleKeys.sort((function(u,p){let d=o[u],w=o[p];return d||(d=a*Number.MAX_VALUE),w||(w=a*Number.MAX_VALUE),d===w?0:d>w?a:-1*a}))},h=()=>{for(let c of s){if(c.end<e)continue;if(c.start>n)break;const u=c.sampleKey||c.sample;(!o.hasOwnProperty(u)||c.value.localeCompare(o[u])>0)&&(o[u]=c.value)}this.sampleKeys.sort((function(c,u){let p=o[c]||"",d=o[u]||"";return a*p.localeCompare(d)}))};this.type==="mut"?h():l(),this.trackView.repaintViews()}clickedFeatures(t){const e=super.clickedFeatures(t),n=t.y;return e.filter((function(i){const s=i.pixelRect;return s&&n>=s.y&&n<=s.y+s.h}))}hoverText(t){const e=this.clickedFeatures(t);if(e&&e.length>0)return`${e[0].sample}: ${e[0].value}`}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=[];for(let i of e){n.length>0&&(n.push("<hr/>"),n.push("<hr/>"));const s=i._f||i,o=typeof s.popupData=="function"?s.popupData(this.type,this.browser.genome.id):this.extractPopupData(s);Array.prototype.push.apply(n,o)}return n}contextMenuItemList(t){const e=t.viewport.referenceFrame,n=t.genomicLocation,i=this.config.sort?this.config.sort.direction==="ASC"?"DESC":"ASC":"DESC",s=e.toBP(2.5),o=a=>{const l=t.viewport.cachedFeatures;this.sortSamples(a.chr,a.start,a.end,a.direction,l)};return[{label:this.type==="seg"?"Sort by value":"Sort by type",click:a=>{const l={direction:i,chr:t.viewport.referenceFrame.chr,start:n-s,end:n+s};o(l),this.config.sort=l}}]}get supportsWholeGenome(){return(this.config.indexed===!1||!this.config.indexURL)&&this.config.supportsWholeGenome!==!1}updateSampleKeys(t){if(!this.explicitSamples)for(let e of t){const n=e.sampleKey||e.sample;this.sampleNames.has(n)||(this.sampleNames.set(n,e.sample),this.sampleKeys.push(n))}}}const Ib={indel:"rgb(0,200,0)","targeted region":"rgb(236,155,43)",truncating:"rgb( 150,0,0)","non-coding transcript":"rgb(0,0,150)",synonymous:"rgb(109,165,95)",silent:"rgb(109,135,80)",missense_mutation:"rgb(72,130,187)",missense:"rgb(72,130,187)","splice site":"rgb(143,83,155)",splice_region:"rgb(143,83,155)",nonsense:"rgb(216, 57,81)",nonsense_mutation:"rgb(216, 57,81)",frame_shift_del:"rgb(226,135,65)",frame_shift_ins:"rgb(226,135,65)",in_frame_del:"rgb(247,235,94)",in_frame_ins:"rgb(247,235,94)","*other*":"rgb(159,91,50)"};class Nb extends Se{constructor(t,e){super(t,e),this.type="merged",this.featureType="numeric",this.paintAxis=gn,this.graphType=t.graphType}init(t){if(!t.tracks)throw Error("Error: no tracks defined for merged track"+t);super.init(t)}async postInit(){this.tracks=[];const t=[];for(let e of this.config.tracks){e.isMergedTrack=!0;const n=await this.browser.createTrack(e);n&&(n.autoscale=!1,this.tracks.push(n)),typeof n.postInit=="function"&&t.push(n.postInit())}this.flipAxis=!!this.config.flipAxis&&this.config.flipAxis,this.logScale=!!this.config.logScale&&this.config.logScale,this.autoscale=this.config.autoscale||this.config.max===void 0,this.autoscale||(this.dataRange={min:this.config.min||0,max:this.config.max});for(let e of this.tracks)e.autoscale=!1,e.dataRange=this.dataRange;return this.height=this.config.height||50,Promise.all(t)}get height(){return this._height}set height(t){if(this._height=t,this.tracks)for(let e of this.tracks)e.height=t,e.config.height=t}menuItemList(){let t=[];return this.flipAxis!==void 0&&t.push({label:"Flip y-axis",click:()=>{this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}}),t=t.concat(Xe.numericDataMenuItems(this.trackView)),t}async getFeatures(t,e,n,i){const s=this.tracks.map((a=>a.getFeatures(t,e,n,i))),o=await Promise.all(s);return new Bb(o)}draw(t){const e=t.features;for(let n=0,i=this.tracks.length;n<i;n++){const s=Object.assign({},t);s.features=e.featureArrays[n],this.tracks[n].dataRange=this.dataRange,this.tracks[n].flipAxis=this.flipAxis,this.tracks[n].logScale=this.logScale,this.graphType&&(this.tracks[n].graphType=this.graphType),this.tracks[n].draw(s)}}popupData(t){if(t.viewport&&t.viewport.cachedFeatures){const e=t.viewport.cachedFeatures.featureArrays;if(e&&e.length===this.tracks.length){const n=[];for(let i=0;i<this.tracks.length;i++){i>0&&n.push("<hr/>"),n.push(`<div style=background-color:rgb(245,245,245);border-bottom-style:dashed;border-bottom-width:1px;padding-bottom:5px;padding-top:10px;font-weight:bold;font-size:larger >${this.tracks[i].name}</div>`);const s=this.tracks[i].popupData(t,e[i]);n.push(...s)}return n}}}clickedFeatures(t){const e=t.viewport.cachedFeatures;if(!e)return[];const n=t.genomicLocation,i=[];for(let s of e.featureArrays){const o=t.referenceFrame.bpPerPixel>.2?3*t.referenceFrame.bpPerPixel:.2,a=Xi(s,n-o,n+o);for(let l of a)i.push(l)}return i}get supportsWholeGenome(){return this.tracks.every((t=>t.supportsWholeGenome))}}class Bb{constructor(t){this.featureArrays=t}getMax(t,e){let n=-Number.MAX_VALUE;for(let i of this.featureArrays)for(let s of i)if(s.value!==void 0&&!Number.isNaN(s.value)){if(s.end<t)continue;if(s.start>e)break;n=Math.max(n,s.value)}return n}}class ha extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.sinTheta=Math.sin(this.theta),this.cosTheta=Math.cos(this.theta),this.arcType=(function(e){if(!e.arcType)return"nested";switch(e.arcType){case"chiapet":return"inView";case"chiapetoutbound":return"partialInView";default:return e.arcType}})(t),this.alpha=t.alpha||.02,this.painter={flipAxis:!this.arcOrientation,dataRange:this.dataRange,paintAxis:gn},t.valueColumn?(this.valueColumn=t.valueColumn,this.hasValue=!0):t.useScore&&(this.hasValue=!0,this.valueColumn="score"),t.max?(this.dataRange={min:t.min||0,max:t.max},this.autoscale=!1):this.autoscale=!0,t.featureSource?(this.featureSource=t.featureSource,delete t._featureSource):(this.featureSource=He(t,this.browser.genome),this.featureSource.getWGFeatures=Fb)}async postInit(){if(typeof this.featureSource.getHeader!="function"||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),this.visibilityWindow===void 0&&typeof this.featureSource.defaultVisibilityWindow=="function"&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow(),this.featureSource.visibilityWindow=this.visibilityWindow),this}get supportsWholeGenome(){return!0}async getFeatures(t,e,n){const i=this.visibilityWindow,s=await this.featureSource.getFeatures({chr:t,start:e,end:n,visibilityWindow:i});return this.hasValue===void 0&&s&&s.length>0&&(this.hasValue=s[0].score!==void 0),s}draw(t){this.arcType==="proportional"||this.arcType==="inView"||this.arcType==="partialInView"?this.drawProportional(t):this.drawNested(t)}drawNested(t){const e=t.context,n=t.pixelWidth,i=t.pixelHeight,s=t.viewportWidth,o=t.bpPerPixel,a=t.bpStart,l=o;at.fillRect(e,0,t.pixelTop,n,i,{fillStyle:"rgb(255, 255, 255)"});const h=t.features;if(h){(function(){let d=0;for(let m of h){let g=(m.start-a)/l,f=(m.end-a)/l;g>=0&&f<=n&&(d=Math.max(d,f-g))}let w=Math.min(s,d)/2;if(d>0){let m=(i-10)/w;this.theta=(function(g){let f,b=[.01570925532366355,.15838444032453644,.3249196962329063,.5095254494944288,.7265425280053609,.9999999999999999],v=[.031415926535897934,.3141592653589793,.6283185307179586,.9424777960769379,1.2566370614359172,1.5707963267948966];for(f=0;f<b.length&&!(b[f]>g);f++);let _=f===0?0:b[f-1],A=f<b.length?b[f]:1,S=(g-_)/(A-_),C=f===0?0:v[f-1],R=f<v.length?v[f]:Math.PI/2;return Math.min(Math.PI/2,C+S*(R-C))})(m),this.sinTheta=Math.sin(this.theta),this.cosTheta=Math.cos(this.theta)}}).call(this);const u=this.arcOrientation?t.pixelHeight:0,p=this.arcOrientation;e.font="8px sans-serif",e.textAlign="center";for(let d of h){let w;if(d.drawState=void 0,typeof this.color=="function"?w=this.color(d):(w=this.color||d.color||"rgb(180,25,137)",w&&this.config.useScore&&(w=si(w,(c=d.score,Math.min(1,.11+c/779*.89).toString())))),e.lineWidth=d.thickness||this.thickness||1,d.chr1===d.chr2||d.chr==="all"){const{m1:m,m2:g}=qu(d,this.browser.genome);let f=Math.round((m-a)/l),b=Math.round((g-a)/l);
830if(b<0||f>n)continue;let v=b-f;v<3&&(v=3,f--);const _=v/2,A=_/this.sinTheta,S=this.cosTheta*A,C=f+_;let R,x,T;if(p?(R=this.height+S,x=Math.PI+Math.PI/2-this.theta,T=Math.PI+Math.PI/2+this.theta):(R=-S,x=Math.PI/2-this.theta,T=Math.PI/2+this.theta),this.showBlocks&&d.chr!=="all"){const y=(d.start1-a)/l,E=(d.end1-a)/l,L=(d.start2-a)/l,N=(d.end2-a)/l,q=this.arcOrientation?-this.blockHeight:this.blockHeight;e.fillRect(y,u,E-y,q),e.fillRect(L,u,N-L,q)}w&&!this.config.useScore&&v>s&&(w=si(w,this.alpha)),e.strokeStyle=w,e.fillStyle=w,e.beginPath(),e.arc(C,R,A,x,T,!1),e.stroke(),d.drawState={xc:C,yc:R,r:A}}else{let m=Math.round((d.start-a)/l),g=Math.round((d.end-a)/l);if(g<0||m>n)continue;let f=g-m;f<3&&(f=3,m--);const b=d.chr===d.chr1?d.chr2:d.chr1;e.strokeStyle=w,e.fillStyle=si(bn(b),.5),p?(e.fillRect(m,this.height/2,f,this.height/2),e.fillText(b,m+f/2,this.height/2-5),d.drawState={x:m,y:this.height/2,w:f,h:this.height/2}):(e.fillRect(m,0,f,this.height/2),e.fillText(b,m+f/2,this.height/2+13),d.drawState={x:m,y:0,w:f,h:this.height/2})}}}var c}getScaleFactor(t,e,n,i){return i?n/(Math.log10(e+1)-(t<=0?0:Math.log10(t+1))):n/(e-t)}drawProportional(t){const e=t.context,n=t.pixelWidth,i=t.pixelHeight,s=t.bpPerPixel,o=t.bpStart,a=s,l=t.referenceFrame.start,h=t.referenceFrame.end;at.fillRect(e,0,t.pixelTop,n,i,{fillStyle:"rgb(255, 255, 255)"});const c=t.features;if(c&&c.length>0){const p=this.getScaleFactor(0,this.dataRange.max,t.pixelHeight-1,this.logScale),d=this.arcOrientation?t.pixelHeight:0;for(let w of c){w.drawState=void 0;const m=this.valueColumn?w[this.valueColumn]:w.score;if(m===void 0||Number.isNaN(m))continue;const g=Math.round((this.logScale?Math.log10(m+1):m)*p);if(w.chr1===w.chr2||w.chr==="all"){const{m1:f,m2:b}=qu(w,this.browser.genome);let v=Math.round((f-o)/a),_=Math.round((b-o)/a)-v;if(_<3&&(_=3,v--),m<this.dataRange.min||m>this.dataRange.max)continue;if(this.arcType!=="proportional"){const x=this.arcType==="partialInView",T=f>=l&&b<=h;let y=!1,E=!1;if(!T&&x&&(y=l<=f&&f<=h,y||(E=l<=b&&b<=h)),!(T||y||E))continue}const A=_/2,S=v+_/2;w.drawState={xc:S,yc:d,radiusX:A,radiusY:g};const C=!!this.arcOrientation,R=w.color||this.color;if(e.strokeStyle=R,e.lineWidth=w.thickness||this.thickness||1,e.isSVG===!0?e.strokeEllipse(S,d,A,g,0,0,Math.PI,C):(e.beginPath(),e.ellipse(S,d,A,g,0,0,Math.PI,C),e.stroke()),this.alpha&&(e.fillStyle=si(R,this.alpha),e.isSVG===!0?e.fillEllipse(S,d,A,g,0,0,Math.PI,C):e.fill()),this.showBlocks&&w.chr!=="all"){e.fillStyle=R;const x=(w.start1-o)/a,T=(w.end1-o)/a,y=(w.start2-o)/a,E=(w.end2-o)/a,L=this.arcOrientation?-this.blockHeight:this.blockHeight;e.fillRect(x,d,T-x,L),e.fillRect(y,d,E-y,L)}}else{let f=Math.round((w.start-o)/a),b=Math.round((w.end-o)/a);if(b<0||f>n||m<this.dataRange.min||m>this.dataRange.max)continue;const v=Math.min(g,this.height-13);let _=b-f;_<3&&(_=3,f--);const A=w.chr===w.chr1?w.chr2:w.chr1;if(e.font="8px sans-serif",e.textAlign="center",e.fillStyle=si(bn(A),.5),this.arcOrientation){const S=this.height-v;e.fillRect(f,S,_,v),e.fillText(A,f+_/2,S-5),w.drawState={x:f,y:S,w:_,h:v}}else e.fillRect(f,0,_,v),e.fillText(A,f+_/2,v+13),w.drawState={x:f,y:0,w:_,h:v}}}}}clearAxis(t,e,n){at.fillRect(t,0,0,e,n,{fillStyle:"rgb(255, 255, 255)"})}paintAxis(t,e,n){const i={min:0,max:this.dataRange.max};this.arcType==="proportional"||this.arcType==="inView"||this.arcType==="partialInView"?(this.painter.flipAxis=!this.arcOrientation,this.painter.dataRange=i,this.painter.paintAxis(t,e,n)):this.clearAxis(t,e,n)}menuItemList(){let t=[];if(this.hasValue){t.push("<hr/>");const e={nested:"Nested",proportional:"Proportional - All",inView:"Proportional - Both Ends in View",partialInView:"Proportional - One End in View"};t.push("<b>Arc Type</b>");for(let n of["nested","proportional","inView","partialInView"])t.push({object:pt(ce(e[n],n===this.arcType)),click:()=>{this.arcType=n,this.trackView.repaintViews()}})}return t.push("<hr/>"),t.push({name:"Toggle arc direction",click:()=>{this.arcOrientation=!this.arcOrientation,this.trackView.repaintViews()}}),t.push({name:this.showBlocks?"Hide Blocks":"Show Blocks",click:()=>{this.showBlocks=!this.showBlocks,this.trackView.repaintViews()}}),this.arcType!=="proportional"&&this.arcType!=="inView"&&this.arcType!=="partialInView"||(t=t.concat(Xe.numericDataMenuItems(this.trackView))),this.browser.cir
830cularView&&(t.push("<hr/>"),t.push({label:"Add interactions to circular view",click:()=>{for(let e of this.trackView.viewports)this.addChordsForViewport(e.referenceFrame)}})),t}contextMenuItemList(t){if(this.browser.circularView){const e=t.viewport,n=[];return n.push({label:"Add interactions to circular view",click:()=>{const i=e.referenceFrame;this.addChordsForViewport(i)}}),n.push("<hr/>"),n}}addChordsForViewport(t){const e=(t.chr==="all"?this.featureSource.getAllFeatures():this.featureSource.featureCache.queryFeatures(t.chr,t.start,t.end)).filter((n=>n.drawState));e.length!==0&&ds(e.map((n=>{const i=n._f||n;return{uniqueId:`${i.chr1}:${i.start1}-${i.end1}_${i.chr2}:${i.start2}-${i.end2}`,refName:or(i.chr1),start:i.start1,end:i.end1,mate:{refName:or(i.chr2),start:i.start2,end:i.end2}}})),this,t,.5)}doAutoscale(t){let e=0;if(t)for(let n of t){const i=this.valueColumn?n[this.valueColumn]:n.score;Number.isNaN(i)||(e=Math.max(e,i))}return{min:0,max:e}}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=[];for(let i of e){const s=i._||i;if(n.push({name:"Region 1",value:ju(s.chr1,s.start1,s.end1,s.strand1)}),n.push({name:"Region 2",value:ju(s.chr2,s.start2,s.end2,s.strand2)}),s.name&&n.push({name:"Name",value:s.name}),s.value!==void 0&&n.push({name:"Value",value:s.value}),s.score!==void 0&&n.push({name:"Score",value:s.score}),s.extras&&this.header&&this.header.columnNames){const o=this.header.columnNames,a=this.header.hiccups?6:10;for(let l=a;l<o.length;l++)this.header.colorColumn!==l&&(o[l]==="info"?Ob(n,s.extras[l-a]):n.push({name:o[l],value:s.extras[l-a]}))}break}return n}clickedFeatures(t){const e=t.viewport.cachedFeatures,n=[];if(e){const i=this.arcType==="proportional"||this.arcType==="inView"||this.arcType==="partialInView";for(let s of e)if(s.drawState)if(s.chr1===s.chr2||s.chr==="all")if(i){const{xc:o,yc:a,radiusX:l,radiusY:h}=s.drawState,c=t.canvasX-o,u=t.canvasY-a,p=c/l*(c/l)+u/h*(u/h);p<=1&&n.push({score:1/p,feature:s})}else{const{xc:o,yc:a,r:l}=s.drawState,h=t.canvasX-o,c=t.canvasY-a,u=Math.abs(Math.sqrt(h*h+c*c)-l);u<5&&n.push({score:u,feature:s})}else{const{x:o,y:a,w:l,h}=s.drawState,c=5;if(t.canvasX>=o-c&&t.canvasX<=o+l+c&&t.canvasY>=a&&t.canvasY<=a+h){const u=-Math.abs(t.canvasX-(o+l/2));n.push({score:u,feature:s});break}}}return n.length>1&&n.sort(((i,s)=>i.score-s.score)),n.map((i=>i.feature))}}Xr(ha,"defaults",{height:250,theta:Math.PI/4,arcOrientation:!0,showBlocks:!0,blockHeight:3,thickness:1,alpha:.02,logScale:!0});function qu(r,t){let e=(r.start1+r.end1)/2,n=(r.start2+r.end2)/2;if(r.chr==="all"&&(e=t.getGenomeCoordinate(r.chr1,e),n=t.getGenomeCoordinate(r.chr2,n)),e>n){const i=e;e=n,n=i}return{m1:e,m2:n}}function ju(r,t,e,n){return n&&n!=="."?`${r}:${Ot(t+1)}-${Ot(e)} (${n})`:`${r}:${Ot(t+1)}-${Ot(e)}`}const Wu=new Map;function si(r,t){const e=`${r}_${t}`;let n=Wu.get(e);return n||(n=qt.addAlpha(r,t),Wu.set(e,n)),n}function Fb(r){const t=p=>{const d=Object.assign({},p);return d.chr="all",d.start=e.getGenomeCoordinate(p.chr1,p.start1),d.end=e.getGenomeCoordinate(p.chr2,p.end2),d},e=this.genome;let n,i=0;for(let p of e.wgChromosomeNames){let d=r[p];if(d)for(let w of d)w.dup||(i++,w.score&&(!n||w.score>n.score)&&(n=w))}const s=this.maxWGCount,o=n&&n.score>0&&i>s?5:1,a=Math.floor(s/o),l=n&&n.score>0?Math.log(n.score)/o:Number.MAX_SAFE_INTEGER;let h,c=[],u=[];for(let p=0;p<o;p++)u.push([0]),c.push([]);for(let p of e.wgChromosomeNames){let d=r[p];if(d){for(let w of d)if(!w.dup){const m=w.score?Math.max(0,Math.min(o-1,Math.floor(Math.log(w.score)/l))):0;if(c[m].length<a)c[m].push(t(w));else{const g=a/(u[m]+1);if(Math.random()<g){const f=Math.floor(Math.random()*(a-1));c[m][f]=t(w)}}u[m]++}}}if(o===1)h=c[0];else{h=[];for(let p of c)for(let d of p)h.push(d);n&&h.push(t(n)),h.sort((function(p,d){return p.start-d.start}))}return h}function Ob(r,t){const e=t.split(";");for(let n of e){const i=n.split("=");i.length===2&&r.push({name:i[0],value:i[1]})}}const Db=ve,$u=new Map([["REF","referenceBases"],["ALT","alternateBases"],["QUAL","quality"],["FILTER","filter"]]);class Gu extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.expandedVariantHeight=t.expandedVariantHeight||t.variantHeight||10,this.featureSource=He(t,this.browser.genome),this._initColorBy=t.colorBy,t.colorTable&&(this.colorTables=new Map,this.colorTables.set(t.colorBy,new ei(t.colorTable))),this._color=t.color,this._strokecolor=t.strokecolor,this._context_hook=t.context_hook,this.variantRowCount(1)}async postInit(){if(this.header=await this.getHeader(),!this.disposed){if(this.visibilityWindow===void 0&&this.config.indexed!==!1){const t=xr(this.config.url)?this.config.url.name:this.config.url;Db(t)&&t.toLowerCase().includes("gnomad")?this.visibilityWindow=1e3:typeof this.featureSource.defaultVisibilityWindow=="function"?this.visibilityWindow=await this.featureSource.defaultVisibilityWindow():this.visibilityWindow=1e6}return this}}get supportsWholeGenome(){return this.config.indexed===!1||this.config.supp
830ortsWholeGenome===!0}get color(){return this._color||"rgb(0,0,150)"}set color(t){this._color=t,this.colorBy=void 0}async getHeader(){if(!this.header){if(typeof this.featureSource.getHeader=="function"){const t=await this.featureSource.getHeader();t&&(this.callSets=t.callSets||[]),this.header=t}this.sampleNames=this.callSets?this.callSets.map((t=>t.name)):[]}return this.header}getCallsetsLength(){return this.callSets?this.callSets.length:0}async getFeatures(t,e,n,i){return this.header===void 0&&(this.header=await this.getHeader()),this.featureSource.getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:this.visibilityWindow})}hasSamples(){return this.getCallsetsLength()>0}getSamples(){return{yOffset:this.sampleYOffset,names:this.sampleNames,height:this.sampleHeight}}computePixelHeight(t){if(!t||t.length==0)return 10;const e=this.displayMode==="COLLAPSED"?1:this.nVariantRows,n=this.displayMode==="SQUISHED"?this.squishedVGap:this.expandedVGap,i=this.displayMode==="SQUISHED"?this.squishedVariantHeight:this.expandedVariantHeight,s=this.displayMode==="SQUISHED"?this.squishedCallHeight:this.expandedCallHeight;return 10+e*(i+n)+n+((this.showGenotypes===!1?0:this.getCallsetsLength()*e)+1)*(s+n)}variantRowCount(t){this.nVariantRows=t}draw({context:t,pixelWidth:e,pixelHeight:n,bpPerPixel:i,bpStart:s,pixelTop:o,features:a}){at.fillRect(t,0,o,e,n,{fillStyle:"rgb(255, 255, 255)"});const l=this.displayMode==="SQUISHED"?this.squishedVGap:this.expandedVGap,h=this.displayMode==="COLLAPSED"?1:this.nVariantRows,c=this.displayMode==="SQUISHED"?this.squishedVariantHeight:this.expandedVariantHeight;this.variantBandHeight=10+h*(c+l);let u=this.callSets;!u&&this._f&&(u=this._f.callSets);const p=this.getCallsetsLength();if(u&&p>0&&this.showGenotypes!==!1&&at.strokeLine(t,0,this.variantBandHeight,e,this.variantBandHeight,{strokeStyle:"rgb(224,224,224) "}),a){const d=this.displayMode==="SQUISHED"?this.squishedCallHeight:this.expandedCallHeight,w=this.displayMode==="SQUISHED"?this.squishedVGap:this.expandedVGap,m=s+e*i+1;for(let g of a){if(g.end<s)continue;if(g.start>m)break;const f=this.displayMode==="SQUISHED"?this.squishedVariantHeight:this.expandedVariantHeight,b=10+(this.displayMode==="COLLAPSED"?0:g.row*(f+w)),v=f;let _=Math.round((g.start-s)/i),A=Math.round((g.end-s)/i),S=Math.max(1,A-_);S<3?(S=3,_-=1):S>5&&(_+=1,S-=2),t.fillStyle=this.getColorForFeature(g),t.fillRect(_,b,S,v);let C=this.getVariantStrokecolor(g);if(C&&(t.strokeStyle=C,t.strokeRect(_,b,S,v)),this.callContextHook(g,t,_,b,S,v),g.pixelRect={x:_,y:b,w:S,h:v},p>0&&this.showGenotypes!==!1){const R=this.displayMode==="COLLAPSED"?1:this.nVariantRows;this.sampleYOffset=this.variantBandHeight+w,this.sampleHeight=R*(d+w);let x=0;if(u&&g.calls)for(let T of u){const y=g.calls[T.id];if(y){const E=this.displayMode==="COLLAPSED"?0:g.row,L=this.sampleYOffset+x*this.sampleHeight+E*(d+w);let N=!0,q=!0,H=!1;if(y.genotype)for(let W of y.genotype){if(W==="."){H=!0;break}W!==0&&(q=!1),W===0&&(N=!1)}y.genotype?t.fillStyle=H?this.noCallColor:q?this.homrefColor:N?this.homvarColor:this.hetvarColor:t.fillStyle=this.noGenotypeColor,t.fillRect(_,L,S,d),T.pixelRect={x:_,y:L,w:S,h:d}}x++}}}}}getColorForFeature(t){const e=t._f||t;let n;if(this.colorBy){const i=this.colorBy;let s;e.info.hasOwnProperty(i)?s=e.info[i]:$u.has(i)&&(s=e[$u.get(i)]),n=this.getVariantColorTable(i).getColor(s),n||(n="gray")}else n=this._color?typeof this._color=="function"?this._color(t):this._color:e.type==="NONVARIANT"?this.nonRefColor:e.type==="MIXED"?this.mixedColor:this.color;return n}getVariantStrokecolor(t){const e=t._f||t;let n;return n=this._strokecolor?typeof this._strokecolor=="function"?this._strokecolor(e):this._strokecolor:void 0,n}callContextHook(t,e,n,i,s,o){if(this._context_hook&&typeof this._context_hook=="function"){const a=t._f||t;e.save(),this._context_hook(a,e,n,i,s,o),e.restore()}}clickedFeatures(t){let e=super.clickedFeatures(t);const n=this.displayMode==="EXPANDED"?this.expandedVGap:this.squishedVGap,i=n+(this.displayMode==="SQUISHED"?this.squishedCallHeight:this.expandedCallHeight),s=t.y;if(s<=this.variantBandHeight){const o=this.displayMode==="SQUISHED"?this.squishedVariantHeight:this.expandedVariantHeight,a=Math.floor((s-10)/(o+n));this.displayMode!=="COLLAPSED"&&(e=e.filter((l=>l.row===a)))}else if(this.callSets){const o=this.callSets,a=s-this.variantBandHeight,l=Math.floor(a/this.sampleHeight);if(l>=0&&l<o.length){const h=Math.floor((a-l*this.sampleHeight)/i),c=this.displayMode==="COLLAPSED"?e:e.filter((p=>p.row===h)),u=o[l];e=c.map((p=>{const d=p.calls[u.id];return(function(w,m){if(w.genotype){let g="";if(m.alternateBases===".")g="No Call";else{const f=m.alternateBases.split(",");for(let b of w.genotype)g.length>0&&(g+="|"),b==="."?g+=".":b===0?g+=m.referenceBases:g+=f[b-1].replace("<","<")}w.genotypeName=g}})(d,p),d}))}}return e}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=t.genomicLocation,i=this.browser.genome.id,s=this.browser.sampleInformation;let o=[];for(let h of e){const c=h._f||h;if(o.length>0&&o.push({html:'<hr style="border-top-width:2px ;border-color: #c9c3ba" />'}),typeof c.popupData=="function"){const u=c.popupData(n,i);Array.prototype.push.apply(o,u)}else{const u=c;if(u.callSetName!==void 0&&o.push({name:"Name",value:u.callSetName}),u.genotypeName&&o.push({name:"Genotype",value:u.genotypeName}),u.phaseset!==void 0&&o.push({name:"Phase set",value:u.phaseset}),u.genotypeLikelihood!==void 0&&o.push({name:"genotypeLikelihood",value:u.genotypeLikelihood.toString()}),s){var a=s.getAttributes(u.callSetName);
830a&&Object.keys(a).forEach((function(p){var d=p.replace(/([A-Z])/g," $1");d=d.charAt(0).toUpperCase()+d.slice(1),o.push({name:d,value:a[p]})}))}var l=Object.keys(u.info);l.length&&o.push("<hr/>"),l.forEach((function(p){o.push({name:p,value:decodeURIComponent(u.info[p])})}))}}return o}menuItemList(){const t=[];if(this.header.INFO&&this.header.INFO){const e=this.header.INFO.SVTYPE?["SVTYPE"]:[];if(this._initColorBy&&this._initColorBy!=="SVTYPE"&&e.push(this._initColorBy),e.length>0){t.push("<hr/>");const n=pt('<div class="igv-track-menu-category igv-track-menu-border-top">');n.text("Color by:"),t.push({name:void 0,object:n,click:void 0,init:void 0}),e.sort();for(let i of e){const s=this.colorBy===i,o=i||"None";t.push(this.colorByCB({key:i,label:o},s))}t.push(this.colorByCB({key:void 0,label:"None"},this.colorBy===void 0)),t.push("<hr/>")}}this.getCallsetsLength()>0&&(t.push({object:pt('<div class="igv-track-menu-border-top">')}),t.push({object:pt(ce("Show Genotypes",this.showGenotypes)),click:()=>{this.showGenotypes=!this.showGenotypes,this.trackView.checkContentHeight(),this.trackView.repaintViews()}})),t.push({object:pt('<div class="igv-track-menu-border-top">')});for(let e of["COLLAPSED","SQUISHED","EXPANDED"])t.push({object:pt(ce({COLLAPSED:"Collapse",SQUISHED:"Squish",EXPANDED:"Expand"}[e],e===this.displayMode)),click:()=>{this.displayMode=e,this.trackView.checkContentHeight(),this.trackView.repaintViews()}});return this.browser.circularView&&(t.push("<hr>"),t.push({label:"Add SVs to circular view",click:()=>{for(let e of this.trackView.viewports)this.sendChordsForViewport(e)}})),t}contextMenuItemList(t){if(this.browser.circularView){const e=t.viewport,n=[];return n.push({label:"Add SVs to Circular View",click:()=>{this.sendChordsForViewport(e)}}),n.push("<hr/>"),n}}sendChordsForViewport(t){const e=t.referenceFrame;let n;if(e.chr==="all"){const i=this.featureSource.getAllFeatures(),s=Object.keys(i).map((o=>i[o]));n=[].concat(...s)}else n=this.featureSource.featureCache.queryFeatures(e.chr,e.start,e.end);ds(n.filter((i=>{const s=i._f||i;return s.info&&s.info.CHR2&&s.info.END&&(s.info.CHR2!==s.chr||Math.abs(Number.parseInt(s.info.END)-s.pos)>1e6)})).map((i=>{const s=i._f||i,o=Number.parseInt(s.info.END),a=o-100,l=o+100;return{uniqueId:`${s.chr}:${s.start}-${s.end}_${s.info.CHR2}:${s.info.END}`,refName:or(s.chr),start:s.start,end:s.end,mate:{refName:or(s.info.CHR2),start:a,end:l}}})),this,e,.5)}colorByCB(t,e){return{name:void 0,object:pt(ce(t.label,e)),click:()=>{t.key===this.colorBy?(this.colorBy=void 0,delete this.config.colorBy,this.trackView.repaintViews()):(this.colorBy=t.key,this.config.colorBy=t.key,this.trackView.repaintViews())},init:void 0}}getState(){const t=super.getState();return this._color&&typeof this._color!="function"&&(t.color=this._color),t}getVariantColorTable(t){if(this.colorTables||(this.colorTables=new Map),!this.colorTables.has(t)){let e;t==="SVTYPE"?e=Pb:e=new ti("Set1"),this.colorTables.set(t,e)}return this.colorTables.get(t)}}Xr(Gu,"defaults",{displayMode:"EXPANDED",sortDirection:"ASC",showGenotypes:!0,squishedVariantHeight:2,squishedCallHeight:1,expandedCallHeight:10,expandedVGap:2,squishedVGap:1,expandedGroupGap:10,squishedGroupGap:5,featureHeight:14,noGenotypeColor:"rgb(200,180,180)",noCallColor:"rgb(225, 225, 225)",nonRefColor:"rgb(200, 200, 215)",mixedColor:"rgb(200, 220, 200)",homrefColor:"rgb(200, 200, 200)",homvarColor:"rgb(17,248,254)",hetvarColor:"rgb(34,12,253)",colorBy:void 0,visibilityWindow:void 0,labelDisplayMode:void 0,type:"variant"});const Pb=new ei({DEL:"#ff2101",INS:"#001888",DUP:"#028401",INV:"#008688",CNV:"#8931ff",BND:"#891100","*":"#002eff"});class zb extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.name=t.name,this.pValueField=t.pValueField||"pValue",this.geneField=t.geneField||"geneSymbol",this.snpField=t.snpField||"snp";const e=t.minLogP||t.min,n=t.maxLogP||t.max;this.dataRange={min:e||3.5,max:n||25},this.autoscale=!n||t.autoscale,this.autoscalePercentile=t.autoscalePercentile===void 0?98:t.autoscalePercentile,this.background=t.background,this.divider=t.divider||"rgb(225,225,225)",this.dotSize=t.dotSize||2,this.height=t.height||100,this.autoHeight=!1,this.disableButtons=t.disableButtons,this.visibilityWindow=t.visibilityWindow===void 0?2e6:t.visibilityWindow>=0?Math.min(2e6,t.visibilityWindow):2e6,this.featureSource=He(t,this.browser.genome),ta.gtexLoaded=!0}paintAxis(t,e,n){const i=(this.dataRange.max-this.dataRange.min)/n,s={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};at.fillRect(t,0,0,e,n,{fillStyle:"rgb(255, 255, 255)"});const o=Math.ceil(10*(this.dataRange.max-this.dataRange.min)/n);for(let a=4;a<=this.dataRange.max;a+=o){const l=.85*e,h=l-5,c=l,u=n-(a-this.dataRange.min)/i;
830at.strokeLine(t,h,u,c,u,s),u>8&&at.fillText(t,a,h-1,u+2,s)}s.textAlign="center",at.fillText(t,"-log10(pvalue)",e/4,n/2,s,{rotate:{angle:-90}})}async getFeatures(t,e,n){const i=this.pValueField,s=this.visibilityWindow,o=await this.featureSource.getFeatures({chr:t,start:e,end:n,visibilityWindow:s});return o.forEach((function(a){a.value=a[i]})),o}draw(t){const e=t.context,n=t.pixelWidth,i=t.pixelHeight;this.background&&at.fillRect(e,0,0,n,i,{fillStyle:this.background}),at.strokeLine(e,0,i-1,n,i-1,{strokeStyle:this.divider});const s=o=>{const a=o?2*this.dotSize:this.dotSize,l=t.bpStart,h=(this.dataRange.max-this.dataRange.min)/i,c=t.referenceFrame.selection;for(let p of t.features){const d=(p.start-l+.5)/t.bpPerPixel;if(d<0)continue;if(d>n)break;const w=p.snp.toUpperCase(),m=p[this.geneField].toUpperCase(),g=c&&(c.snp===w||c.gene===m);if(!o||g){c&&c.snp===w&&c.addGene(m);var u=-Math.log(p[this.pValueField])/Math.LN10;if(u>=this.dataRange.min){let f;u>this.dataRange.max?(u=this.dataRange.max,f=!0):f=!1;const b=Math.max(0+a,i-Math.round((u-this.dataRange.min)/h));let v;p.px=d,p.py=b,p.radius=a,o&&c?(v=c.colorForGene(m),at.setProperties(e,{fillStyle:v,strokeStyle:"black"})):(v=f?"rgb(150, 150, 150)":"rgb(180, 180, 180)",at.setProperties(e,{fillStyle:v,strokeStyle:v})),at.fillCircle(e,d,b,a),at.strokeCircle(e,d,b,a)}}}};s(!1),s(!0)}popupData(t,e){if(e===void 0&&(e=t.viewport.cachedFeatures),!e||e.length===0)return[];const n=this.name,i=[];for(let s of e)Math.abs(s.px-t.canvasX)<s.radius+3&&Math.abs(s.py-t.canvasY)<s.radius+3&&(i.length>0&&i.push("<hr/>"),i.push({name:"snp id",value:s.snp},{name:"gene id",value:s.geneId},{name:"gene name",value:s.geneName},{name:"p value",value:s.pValue},{name:"tissue",value:n}));return i}menuItemList(){return Xe.numericDataMenuItems(this.trackView)}doAutoscale(t){if(t.length>0){var e=t.map((function(n){return-Math.log(n.value)/Math.LN10}));this.dataRange.max=Og(e,this.autoscalePercentile)}else{const n=this.config.maxLogP||this.config.max;this.dataRange.max=n||25}return this.dataRange}}const _n={X:"rgb(204, 153, 0)",Y:"rgb(153, 204, 0)",Un:"darkGray)",1:"rgb(80, 80, 255)",2:"rgb(206, 61, 50)","2a":"rgb(210, 65, 55)","2b":"rgb(215, 70, 60)",3:"rgb(116, 155, 88)",4:"rgb(240, 230, 133)",5:"rgb(70, 105, 131)",6:"rgb(186, 99, 56)",7:"rgb(93, 177, 221)",8:"rgb(128, 34, 104)",9:"rgb(107, 215, 107)",10:"rgb(213, 149, 167)",11:"rgb(146, 72, 34)",12:"rgb(131, 123, 141)",13:"rgb(199, 81, 39)",14:"rgb(213, 143, 92)",15:"rgb(122, 101, 165)",16:"rgb(228, 175, 105)",17:"rgb(59, 27, 83)",18:"rgb(205, 222, 183)",19:"rgb(97, 42, 121)",20:"rgb(174, 31, 99)",21:"rgb(231, 199, 111)",22:"rgb(90, 101, 94)",23:"rgb(204, 153, 0)",24:"rgb(153, 204, 0)",25:"rgb(51, 204, 0)",26:"rgb(0, 204, 51)",27:"rgb(0, 204, 153)",28:"rgb(0, 153, 204)",29:"rgb(10, 71, 255)",30:"rgb(71, 117, 255)",31:"rgb(255, 194, 10)",32:"rgb(255, 209, 71)",33:"rgb(153, 0, 51)",34:"rgb(153, 26, 0)",35:"rgb(153, 102, 0)",36:"rgb(128, 153, 0)",37:"rgb(51, 153, 0)",38:"rgb(0, 153, 26)",39:"rgb(0, 153, 102)",40:"rgb(0, 128, 153)",41:"rgb(0, 51, 153)",42:"rgb(26, 0, 153)",43:"rgb(102, 0, 153)",44:"rgb(153, 0, 128)",45:"rgb(214, 0, 71)",46:"rgb(255, 20, 99)",47:"rgb(0, 214, 143)",48:"rgb(20, 255, 177)"};for(let r of Object.keys(_n))_n["chr"+r]=_n[r];for(let r=1;r<=48;r++){if(r===10)continue;const t=Hb(r);_n[t]=_n[r.toString()]}function Hb(r){if(!+r)return!1;for(var t=String(+r).split(""),e=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",i=3;i--;)n=(e[+t.pop()+10*i]||"")+n;return Array(+t.join("")+1).join("M")+n}class Ub extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.useChrColors=t.useChrColors===void 0||t.useChrColors,this.trait=t.trait,this.posteriorProbability=t.posteriorProbability,this.valueProperty=t.format==="bed"?"score":"value",this.height=t.height||100,this.autoscale=t.autoscale,this.autoscalePercentile=t.autoscalePercentile===void 0?98:t.autoscalePercentile,this.background=t.background,this.divider=t.divider||"rgb(225,225,225)",this.dotSize=t.dotSize||3,this.popoverWindow=t.popoverWindow===void 0?1e8:t.popoverWindow,this.useChrColors?this.colorScale=new ei(t.colorTable||_n):t.color?this.colorScale=new Lb(t.color):this.colorScale=new Vu(t.colorScale||{thresholds:[5e-8,5e-4,.5],colors:["rgb(255,50,50)","rgb(251,100,100)","rgb(251,170,170)","rgb(227,238,249)"]}),this.featureSource=He(t,this.browser.genome)}async postInit(){if(typeof this.featureSource.getHeader!="function"||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),this.autoscale||(this.posteriorProbability?this.dataRange={min:this.config.min===void 0?0:this.config.min,max:this.config.max===void 0?1:this.config.max}:this.dataRange={min:this.config.min===void 0?0:this.config.min,max:this.config.max===void 0?25:this.config.max}),this}get supportsWholeGenome(){return!0}async getFeatures(t,e,n){const i=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:n,visibilityWindow:i})}draw(t){const e=t.features,n=t.context,i=t.pixelWidth,s=t.pixelHeight;if(this.background&&at.fillRect(n,0,0,i,s,{fillStyle:this.background}),at.strokeLine(n,0,s-1,i,s-1,{strokeStyle:this.divider}),e){const o=t.bpPerPixel,a=t.bpStart,l=a+i*o+1;for(let h of e){const c=h.start;if(c<a)continue;if(c>l)break;let u;if(this.posteriorProbability)u=h[this.valueProperty];else{const f=h[this.valueProperty];if(!f)continue;u=-Math.log10(f)}const p=this.useChrColors?h._f?h._f.chr:h.chr:u,d=this.colorScale.getColor(p),w=(this.dataRange.max-this.dataRange.min)/s,m=Math.round((c-a)/o),g=Math.max(this.dotSize,s-Math.round((u-this.dataRange.min)/w));d&&at.setProperties(n,{fillStyle:d,strokeStyle:"black"}),at.fillCircle(n,m,g,this.dotSize),h.px=m,h.py=g}}}paintAxis(t,e,n){at.fillRect(t,0,0,e,n,{fillStyle:"rgb(255, 255, 255)"});var i={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};const s=(this.dataRange.max-this.dataRange.min)/n;if(this.posteriorProbability)for(let a=this.dataRange.min;a<this.dataRange.max;a+=.1){const l=n-Math.round((a-this.dataRange.min)/s);at.strokeLine(t,45,l-2,50,l-2,i),at.fillText(t,a.toFixed(1),44,l+2,i)}else{const o=Math.ceil(10*(this.dataRange.max-this.dataRange.min)/n);for(let a=this.dataRange.min;a<this.dataRange.max;a+=o){const l=n-Math.round((a-this.dataRange.min)/s);at.strokeLine(t,45,l,50,l,i),at.fillText(t,Math.floor(a),44,l+4,i)}}i.textAlign="center",this.posteriorProbability?at.fillText(t,"PPA",e/2,n/2,i,{rotate:{angle:-90}}):at.fillText(t,"-log10(pvalue)",e/2,n/2,i,{rotate:{angle:-90}})}popupData(t,e){e===void 0&&(e=t.viewport.cachedFeatures);let n=[];const i=t.viewport.trackView.track;if(e){let s=0;for(let o of e){const a=Math.abs(t.canvasX-o.px),l=Math.abs(t.canvasY-o.py),h=o[this.valueProperty];if(a<this.dotSize&&l<this.dotSize){if(s>0&&n.push("<HR/>"),s==5){n.push("...");break}if(typeof o.popupData=="function")n=n.concat(o.popupData());else{const c=o.realChr||o.chr,u=(o.realStart||o.start)+1;n.push({name:"chromosome",value:c}),n.push({name:"position",value:u}),n.push({name:"name",value:o.name}),i.posteriorProbability?n.push({name:"posterior probability",value:h}):n.push({name:"pValue",value:h})}s++}}}return n}menuItemList(){return Xe.numericDataMenuItems(this.trackView)}doAutoscale(t){if(t.length>0){const e=this.valueProperty,n=this.posteriorProbability,i=t.map((function(s){const o=s[e];
830return{value:n?o:-Math.log(o)/Math.LN10}}));this.dataRange=_o(i)}else this.posteriorProbability?this.dataRange={min:this.config.min||0,max:this.config.max||1}:this.dataRange={min:this.config.max||25,max:this.config.min||0};return this.dataRange}}class Vb extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.autoscale=t.autoscale||t.max===void 0,this.dataRange={min:t.min||0,max:t.max},this.windowFunction=t.windowFunction||"mean",this.paintAxis=gn,this.graphType=t.graphType||"bar",t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):this.featureSource=He(this.config,this.browser.genome),this.visibilityWindow=-1,this.featureSource.visibilityWindow=this.visibilityWindow}async postInit(){if(typeof this.featureSource.getHeader=="function"){if(this.header=await this.featureSource.getHeader(),this.disposed)return;if(this.sampleNames=this.header.columnNames.slice(3),this.setTrackProperties(this.header),this.header.hasOwnProperty("clickToHighlight")){let t=this.header.clickToHighlight;this.config.clickToHighlight=t,this.config.samplesClickedToHighlight={}}if(this.header.hasOwnProperty("highlight")){this.config.highlightSamples={};let t=this.header.highlight;Array.isArray(t)||(t=[t]);for(let e of t){const n=e.split(";");n.length===2&&(this.config.highlightSamples[n[0]]=n[1])}}}}menuItemList(){return Xe.numericDataMenuItems(this.trackView)}async getFeatures(t,e,n){const i=await this.featureSource.getFeatures({chr:t,start:0,end:Number.MAX_SAFE_INTEGER,visibilityWindow:this.visibilityWindow});let s,o;for(let a=1;a<i.length-1;a++)if(s===void 0&&i[a].end>e&&(s=a-1),o===void 0&&i[a].start>n){o=a+1;break}return s===void 0&&(s=0),o===void 0&&(o=i.length),i.slice(s,o)}draw(t){const{features:e,context:n,bpPerPixel:i,bpStart:s,pixelWidth:o,pixelHeight:a}=t,l=c=>(this.dataRange.max-c)/(this.dataRange.max-this.dataRange.min)*a,h=function(c){let u=Math.floor((c-s)/i);return isNaN(u),u};if(e&&e.length>0&&(this.dataRange.min===void 0&&(this.dataRange.min=0),this.dataRange.max>this.dataRange.min)){const c=this.config.highlightSamples,u=this.config.onlyHandleClicksForHighlightedSamples,p=this.config.clickToHighlight;let d=-1,w={},m=[],g=[];this.clickDetectorCache={};for(let f of e){const b=h(f.start),v=h(f.end),_=d>=0?h(d):b;if(!isNaN(b)&&!isNaN(v)){this.clickDetectorCache[b]=[],this.clickDetectorCache[v]=[];for(let A=0;A<f.values.length;A++){const S=this.sampleNames[A],C=f.values[A],R=l(C);if(b-_>=1){const x=w[S],T=l(x),y=c&&c[S];y?m.push([_,T,b,R,y]):p&&S in this.config.samplesClickedToHighlight?m.push([_,T,b,R,this.config.samplesClickedToHighlight[S]]):at.
830strokeLine(n,_,T,b,R,{strokeStyle:"#D9D9D9"}),u&&!(S in c)||this.clickDetectorCache[b].push([_,T,b,R,S,y||"gray"])}if(v-b>=1){const x=c&&c[S];x?g.push([b,R,v,R,x]):p&&S in this.config.samplesClickedToHighlight?g.push([b,R,v,R,this.config.samplesClickedToHighlight[S]]):at.strokeLine(n,b,R,v,R,{strokeStyle:"gray"}),u&&!(S in c)||this.clickDetectorCache[v].push([b,R,v,R,S,x||"gray"])}w[S]=C}d=f.end}}for(let f of m)at.strokeLine(n,f[0],f[1],f[2],f[3],{strokeStyle:f[4],lineWidth:1.3});for(let f of g)at.strokeLine(n,f[0],f[1],f[2],f[3],{strokeStyle:f[4],lineWidth:2})}(c=>{if(this.config.hasOwnProperty("guideLines")){for(let u of this.config.guideLines)if(u.hasOwnProperty("color")&&u.hasOwnProperty("y")&&u.hasOwnProperty("dotted")){let p=l(u.y),d={strokeStyle:u.color,strokeWidth:2};u.dotted?at.dashedLine(c.context,0,p,c.pixelWidth,p,5,d):at.strokeLine(c.context,0,p,c.pixelWidth,p,d)}}})(t)}doAutoscale(t){let e,n;return t.length>0?(e=Number.MAX_VALUE,n=-Number.MAX_VALUE,t.forEach((function(i){e=Math.min(e,...i.values),n=Math.max(n,...i.values)})),e-=.01,n+=.01):(e=0,n=100),{min:e,max:n}}clickedFeatures(t){const e=t.canvasX,n=t.canvasY;let i=null;for(i of Object.keys(this.clickDetectorCache))if(i=parseInt(i),i>=e)break;if(i){let a=Number.MAX_VALUE,l=[];const h=this.clickDetectorCache[i];for(let c of h){const u=c[0],p=c[2];if(e<u||e>p)return[];const d=c[1],w=c[3];if(n<Math.min(d,w)-10||n>Math.max(d,w)+10)continue;const m=qb(e,n,u,d,p,w);m<a&&(l=[{name:c[4],color:c[5]}],a=m)}if(a<5){if(this.config.clickToHighlight){if(l[0].name in this.config.samplesClickedToHighlight)delete this.config.samplesClickedToHighlight[l[0].name];else if(this.config.clickToHighlight==="any"){var s=["red","darkblue","green","teal","olivedrab","orange","maroon","purple","blue","gold"],o=s[Math.floor(Math.random()*(s.length+1))];this.config.samplesClickedToHighlight[l[0].name]=o}else this.config.samplesClickedToHighlight[l[0].name]=this.config.clickToHighlight;this.trackView.repaintViews()}return l}}return[]}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=[];return e.forEach((function(i){for(let s of Object.keys(i))Ki(i[s])&&n.push({name:s,value:i[s]})})),n}get supportsWholeGenome(){return!1}}function qb(r,t,e,n,i,s){const o=i-e,a=s-n,l=Math.abs(o*(n-t)-(e-r)*a),h=Math.sqrt(o*o+a*a);return h>0?l/h:0}class jb extends Se{constructor(t,e){super(t,e),t.height||(this.height=300),this.arcOrientation=!1,this.theta=Math.PI/2,t.format==="bp"?this.featureSource=new Wb(t,e.genome):this.featureSource=new Jc(t,e.genome)}async getFeatures(t,e,n){const i=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:n,visibilityWindow:i})}draw(t){const e=t.context,n=Math.PI/2,i=t.pixelWidth,s=t.pixelHeight;t.viewportWidth;const o=t.bpPerPixel,a=t.bpStart,l=o,h=this.arcOrientation;at.fillRect(e,0,t.pixelTop,i,s,{fillStyle:"rgb(255, 255, 255)"});const c=t.features;if(c){Zu(c,1);for(let u of c)if(u.startLeft){let p=Math.round((u.startLeft-a)/l),d=Math.round((u.startRight-a)/l),w=Math.round((u.endLeft-a)/l),m=Math.round((u.endRight-a)/l);e.fillStyle=u.color,e.strokeStyle=u.color,e.beginPath();let g=(p+m)/2,f=(m-p)/2,b=this.height,v=Math.PI+(Math.PI/2-n),_=2*Math.PI-(Math.PI/2-n);h?(b=0,e.arc(g,b,f,_,v),e.lineTo(m,b)):(e.arc(g,b,f,v,_),e.lineTo(w,b));const A=(d+w)/2,S=(w-d)/2,C=b;h?(e.arc(A,C,S,v,_,!0),e.lineTo(w,C)):(e.arc(A,C,S,_,v,!0),e.lineTo(p,C)),e.stroke(),e.fill(),u.drawState={x1:g,y1:b,r1:f,x2:A,y2:C,r2:S,sa:v,ea:_}}else{let p=Math.round((u.start-a)/l),d=Math.round((u.end-a)/l);e.strokeStyle=u.color,e.beginPath();let w=(p+d)/2,m=(d-p)/2,g=this.height,f=Math.PI+(Math.PI/2-n),b=2*Math.PI-(Math.PI/2-n);h?(g=0,e.arc(w,g,m,b,f)):e.arc(w,g,m,f,b),e.stroke(),u.drawState={x1:w,y1:g,r1:m,sa:f,ea:b}}}}clickedFeatures(t){const e=super.clickedFeatures(t),n=[];Zu(e,-1);for(let i of e){const s=i.drawState,o=t.canvasX-s.x1,a=t.canvasY-s.y1,l=Math.sqrt(o*o+a*a),h=s.r1+3;let c,u;if(s.x2===void 0)c=l,u=s.r1-3;else{const p=t.canvasX-s.x2,d=t.canvasY-s.y2;c=Math.sqrt(p*p+d*d),u=s.r2-3}if(l<h&&c>u){n.push(i);break}}return n}popupData(t,e){if(e===void 0&&(e=this.clickedFeatures(t)),e&&e.length>0)return this.extractPopupData(e[0],this.getGenomeId())}menuItemList(){var t=this;return[{name:"Toggle arc direction",click:function(){t.arcOrientation=!t.arcOrientation,t.trackView.repaintViews()}}]}}function Zu(r,t){r.sort((function(e,n){const i=e.score===void 0?-Number.MAX_VALUE:e.score,s=n.score===void 0?-Number.MAX_VALUE:n.score;return(t===void 0?1:t)*(i-s)}))}class Wb{constructor(t,e){this.config=t,this.genome=e}async getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:s}){const o=this.genome;if(this.featureCache)return this.featureCache.queryFeatures(t,e,n);{const a=Ft(this.config),l=await Ct.loadString(this.config.url,a);return this.featureCache=new Jn((function(h){if(!h)return null;const c=Ye(h);let u,p=!0;const d=[],w=[],m=[];for(;
830(u=c.nextLine())!==void 0;){const f=u.split(" ");if(p&&u.startsWith("color:")){const b="rgb("+f[1]+","+f[2]+","+f[3]+")";d.push(b),f.length>4&&w.push(f[4])}else{p=!1;const b=f[0],v=Number.parseInt(f[1])-1,_=Number.parseInt(f[2])-1,A=Number.parseInt(f[3]),S=Number.parseInt(f[4]);var g=Number.parseInt(f[5]);const C=d[g];let R;R=v<=S?{chr:b,startLeft:Math.min(v,_),startRight:Math.max(v,_),endLeft:Math.min(A,S),endRight:Math.max(A,S),color:C,score:g}:{chr:b,startLeft:Math.min(A,S),startRight:Math.max(A,S),endLeft:Math.min(v,_),endRight:Math.max(v,_),color:C,score:g},R.start=R.startLeft,R.end=R.endRight,w.length>g&&(R.description=w[g]),m.push(R)}}return m})(l),o),this.featureCache.queryFeatures(t,e,n)}}}class Qu{constructor(t){this.browser=t,this.type="ideogram",this.height=16,this.order=Number.MIN_SAFE_INTEGER,this.disableButtons=!0,this.ignoreTrackMenu=!0}async getFeatures(t,e,n){return[]}computePixelHeight(t){return this.height}draw({context:t,referenceFrame:e,pixelWidth:n,pixelHeight:i}){const s=e.chr,o=e.genome.getChromosome(s);if(o===void 0||n<=0||i<=0||s.toLowerCase()==="all")return;(function({ctx:u,chr:p,referenceFrame:d,genome:w,width:m,height:g,stainColors:f}){if(w===void 0)return;at.fillRect(u,0,0,m,g,{fillStyle:qt.greyScale(255)});const A=w.getCytobands(p);if(A){const S=0+g/2,C=[],R=[];if(A.length===0)return;const x=m/A[A.length-1].end;u.beginPath(),at.roundRect(u,.5,.5+0,m-2*.5,g-2*.5,(g-2*.5)/2,0,1),u.clip();for(let T=0;T<A.length;T++){const y=A[T],E=x*y.start,L=x*y.end;y.type==="c"?(y.name.charAt(0)==="p"?(C[0]=E,R[0]=g+0,C[1]=E,R[1]=0,C[2]=L,R[2]=S):(C[0]=L,R[0]=g+0,C[1]=L,R[1]=0,C[2]=E,R[2]=S),u.fillStyle="rgb(150, 0, 0)",u.strokeStyle="rgb(150, 0, 0)",at.polygon(u,C,R,1,0)):(u.fillStyle=$b(f,y),at.fillRect(u,E,1,L-E,g-2))}}u.strokeStyle=qt.greyScale(41),at.roundRect(u,.5,.5+0,m-2*.5,g-2*.5,(g-2*.5)/2,0,1)})({ctx:t,chr:s,referenceFrame:e,genome:e.genome,width:n,height:i,stainColors:[]});const a=Math.round(e.bpPerPixel*n),l=e.start;let h=o.bpLength;const c=e.genome.getCytobands(s);if(c&&c.length>0&&c[c.length-1].end&&(h=Math.max(h,c[c.length-1].end),o.bpLength=h),a<h){const u=a/h,p=l/h;let d=Math.floor(p*n),w=Math.floor(u*n);d=Math.max(0,d),d=Math.min(n-w,d),t.save(),t.strokeStyle="red",t.lineWidth=w<2?1:2;const m=d+t.lineWidth/2;w=w<2?1:w-t.lineWidth;const g=t.lineWidth/2,f=i-t.lineWidth;t.strokeRect(m,g,w,f),t.restore()}}dispose(){this.trackView=void 0}}function $b(r,t){if(t.type==="c")return"rgb(150, 10, 10)";var e=t.stain,n=230;t.type==="p"&&(n=Math.floor(230-e/100*230));var i=r[n];return i||(i="rgb("+n+","+n+","+n+")",r[n]=i),i}let Xu=new ti("Dark2");["GT/AG","CT/AC","GC/AG","CT/GC","AT/AC","GT/AT","non-canonical"].forEach((r=>{Xu.getColor(r)}));const Me={};class Gb extends Se{constructor(t,e){super(t,e)}init(t){super.init(t),this.type=t.type||"junctions",t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):this.featureSource=t.featureSource?t.featureSource:He(t,this.browser.genome),this.margin=t.margin===void 0?10:t.margin,this.height||(this.height=100),t.colorByNumReadsThreshold===void 0&&(t.colorByNumReadsThreshold=5)}async postInit(){if(typeof this.featureSource.getHeader!="function"||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),this.visibilityWindow===void 0&&typeof this.featureSource.defaultVisibilityWindow=="function"&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow()),this}get supportsWholeGenome(){return!1}async getFeatures(t,e,n,i){const s=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:n,bpPerPixel:i,visibilityWindow:s})}computePixelHeight(t){return this.height}draw(t){const e=t.features,n=t.context,i=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth,a=t.pixelHeight,l=s+o*i+1;if(this.config.isMergedTrack||at.fillRect(n,0,t.pixelTop,o,a,{fillStyle:"rgb(255, 255, 255)"}),e){Me.referenceFrame=t.viewport.referenceFrame,Me.referenceFrameStart=Me.referenceFrame.start,Me.referenceFrameEnd=Me.referenceFrameStart+Me.referenceFrame.toBP(t.viewport.getWidth()),Me.featureZoomOutTracker={};for(let h of e)if(!(h.end<s)){if(h.start>l)break;this.renderJunction(h,s,i,a,n)}}}renderJunction(t,e,n,i,s){t.isVisible=!1;const o=Math.round((t.start-e)/n),a=Math.round((t.end-e)/n),l=(o+a)/2;if(a-o<=3){if(l in Me.featureZoomOutTracker)return;Me.featureZoomOutTracker[l]=!0}if(this.config.hideAnnotatedJunctions&&t.attributes.annotated_junction==="true"||this.config.hideUnannotatedJunctions&&t.attributes.annotated_junction==="false"||this.config.hideMotifs&&this.config.hideMotifs.includes(t.attributes.motif)||this.config.hideStrand===t.strand)return;if(this.config.minJunctionEndsVisible){let x=0;if(t.start>=Me.referenceFrameStart&&t.start<=Me.referenceFrameEnd&&(x+=1),t.end>=Me.referenceFrameStart&&t.end<=Me.referenceFrameEnd&&(x+=1),x<this.config.minJunctionEndsVisible)return}let h,c,u,p;if(t.attributes.uniquely_mapped&&(h=parseInt(t.attributes.uniquely_mapped),h<this.config.minUniquelyMappedReads||(c=parseInt(t.attributes.multi_mapped),u=h+c,u<this.config.minTotalReads)||u>
8300&&c/u>this.config.maxFractionMultiMappedReads||t.attributes.maximum_spliced_alignment_overhang&&parseInt(t.attributes.maximum_spliced_alignment_overhang)<this.config.minSplicedAlignmentOverhang)||t.attributes.num_samples_with_this_junction&&(p=parseInt(t.attributes.num_samples_with_this_junction),this.config.minSamplesWithThisJunction&&p<this.config.minSamplesWithThisJunction||this.config.maxSamplesWithThisJunction&&p>this.config.maxSamplesWithThisJunction||t.attributes.num_samples_total&&(t.attributes.percent_samples_with_this_junction=100*p/Number(t.attributes.num_samples_total),this.config.minPercentSamplesWithThisJunction&&(t.attributes.percent_samples_with_this_junction<this.config.minPercentSamplesWithThisJunction||t.attributes.percent_samples_with_this_junction>this.config.maxPercentSamplesWithThisJunction))))return;const d=this.margin,w=this.height,m=d+.5*w;let g=d;const f=d+w-10,b=(o+l)/2,v=(l+a)/2;let _,A,S=1;t.attributes.line_width?S=Number(t.attributes.line_width):(this.config.thicknessBasedOn===void 0||this.config.thicknessBasedOn==="numUniqueReads"?S=h:this.config.thicknessBasedOn==="numReads"?S=u:this.config.thicknessBasedOn==="numSamplesWithThisJunction"&&p!==void 0&&(S=p),S=1+Math.log(S+1)/Math.log(12)),this.config.bounceHeightBasedOn===void 0||this.config.bounceHeightBasedOn==="random"?_=(t.start+t.end)%7:this.config.bounceHeightBasedOn==="distance"?_=6*(t.end-t.start)/(Me.referenceFrameEnd-Me.referenceFrameStart):this.config.bounceHeightBasedOn==="thickness"&&(_=2*S),g+=w*Math.max(7-_,0)/10,A=t.attributes.color?t.attributes.color:this.config.colorBy===void 0||this.config.colorBy==="numUniqueReads"?h>this.config.colorByNumReadsThreshold?"blue":"#AAAAAA":this.config.colorBy==="numReads"?u>this.config.colorByNumReadsThreshold?"blue":"#AAAAAA":this.config.colorBy==="isAnnotatedJunction"?t.attributes.annotated_junction==="true"?"#b0b0ec":"orange":this.config.colorBy==="strand"?t.strand==="+"?"#b0b0ec":"#ecb0b0":this.config.colorBy==="motif"?Xu.getColor(t.attributes.motif):"#AAAAAA";let C="";t.attributes.label?C=t.attributes.label.replace(/_/g," "):this.config.labelWith===void 0||this.config.labelWith==="uniqueReadCount"?C=h:this.config.labelWith==="totalReadCount"?C=u:this.config.labelWith==="numSamplesWithThisJunction"?p!==void 0&&(C=p):this.config.labelWith==="percentSamplesWithThisJunction"?t.attributes.percent_samples_with_this_junction!==void 0&&(C=t.attributes.percent_samples_with_this_junction.toFixed(0)+"%"):this.config.labelWith==="motif"&&t.attributes.motif!==void 0&&(C+=t.attributes.motif),this.config.labelWithInParen==="uniqueReadCount"?C+=" ("+h+")":this.config.labelWithInParen==="totalReadCount"?C+=" ("+u+")":this.config.labelWithInParen==="multiMappedReadCount"?c>0&&(C+=" (+"+c+")"):this.config.labelWithInParen==="numSamplesWithThisJunction"?p!==void 0&&(C+=" ("+p+")"):this.config.labelWithInParen==="percentSamplesWithThisJunction"?t.attributes.percent_samples_with_this_junction!==void 0&&(C+=" ("+t.attributes.percent_samples_with_this_junction.toFixed(0)+"%)"):this.config.labelWithInParen==="motif"&&t.attributes.motif!==void 0&&(C+=` ${t.attributes.motif}`),t.isVisible=!0,s.beginPath(),s.moveTo(o,f),s.bezierCurveTo(b,g,v,g,a,f),s.lineWidth=S,s.strokeStyle=A,s.stroke();const R=(x,T,y,E)=>{x.beginPath(),x.moveTo(T,y),x.lineTo(T-E/2,y-E),x.lineTo(T+E/2,y-E),x.lineTo(T,y),x.closePath(),x.fill()};if(t.attributes.left_shape||t.attributes.right_shape){s.fillStyle=A;const x=s.lineWidth>2?10:7;t.attributes.left_shape&&R(s,o,f,x),t.attributes.right_shape&&R(s,a,f,x)}s.fillText(C,l-s.measureText(C).width/2,(7*g+m)/8)}clickedFeatures(t){return super.clickedFeatures(t).filter((function(e){return e.isVisible&&e.attributes}))}popupData(t,e){e===void 0&&(e=this.clickedFeatures(t));const n=t.genomicLocation,i=[];for(let s of e){const o=typeof s.popupData=="function"?s.popupData(n):this.extractPopupData(s._f||s,this.getGenomeId());o&&(i.length>0&&i.push("<hr/><hr/>"),Array.prototype.push.apply(i,o))}return i}dispose(){this.trackView=void 0}}class Yu{constructor(t){var e;this.config=t,this.url=(e=t.path||t.url).includes("//www.dropbox.com")?e.replace("//www.dropbox.com","//dl.dropboxusercontent.com"):e.startsWith("ftp://ftp.ncbi.nlm.nih.gov")?e.replace("ftp://","https://"):e}async read(t,e){const n=this.config.headers||{};if(t!==void 0&&e){const a="bytes="+t+"-"+(t+e-1);n.Range=a}let i=this.url.slice();if(this.config.oauthToken){const a=(async function(l){return typeof l=="function"?await Promise.resolve(l()):l})(this.config.oauthToken);n.Authorization=`Bearer ${a}`}this.config.apiKey&&(i=(function(a,l,h){const c=a.includes("?")?"&":"?";return a+c+l+"="+h})(i,"key",this.config.apiKey));const s=await fetch(i,{method:"GET",headers:n,redirect:"follow",mode:"cors"}),o=s.status;if(o>=400){const a=Error(s.statusText);throw a.code=o,a}return s.arrayBuffer()}}class Zb{constructor(t){this.file=t.file,this.fetchSize=t.fetchSize||16e3,this.maxSize=t.maxSize||1e6,this.buffers=[]}async read(t,e){let n=this.buffers.filter((i=>i.overlaps(t,t+e)));for(let i of n)if(i.contains(t,t+e))return i.slice(t,t+e);if(n.length===0){let i=Math.max(e,this.fetchSize);this.buffers.sort(((h,c)=>h.start-c.start));const s=(function(h,c,u){let p=u-1,d=h.length;for(;1+p<d;){const w=p+(d-p>>1);c(h[w])?d=w:p=w}return d})(this.buffers,(h=>h.start>t),0);s<this.buffers.length&&(i=Math.min(i,this.buffers[s].start-t));const o=t,a=await this.file.read(o,i),l=new gs(o,a);return this.addBuffer(l),l.slice(t,t+e)}{n.sort(((u,p)=>u.start-p.start));const i=[];let s=t;for(let u of n){if(s<u.start){const p=s,d=u.start-s,w=await this.file.read(p,d),m=new gs(p,w);i.push(m)}i.push(u),s=u.end}const o=t+e;if(o>s){const u=s,p=o-u,d=await this.file.read(u,p),w=new gs(u,d);i.push(w)}const a=i[0].start,l=(function(u){const p=u.reduce(((m,g)=>m+g.byteLength),0),d=new Uint8Array(p);let w=0;for(let m of u)d.set(new Uint8Array(m),w),w+=m.byteLength;return d.buffer})(i.map((u=>u.buffer))),h=new gs(a,l),c=new Set(n);return this.buffers=this.buffers.filter((u=>!c.has(u))),this.addBuffer(h),h.slice(t,t+e)}}addBuffer(t){const e=this.buffers.reduce(((n,i)=>n+i.size),0)+t.size;if(e>this.maxSize){const n=e-this.maxSize;this.buffers.sort(((o,a)=>o.creationTime-a.creationTime));let i,s=0;for(i=0;i<this.buffers.length&&(s+=this.buffers[i].size,!(s>n));i++);this.buffers=i<this.buffers.length-1?this.buffers.slice(i):[]}t.size<=this.maxSize&&this.buffers.push(t)}}class gs{constructor(t,e){this.creationTime=Date.now(),this.start=t,this.buffer=e}slice(t,e){if(t<this.start||e-t>this.buffer.byteLength)throw Error("buffer bounds error");return this.buffer.slice(t-this.start,e-this.start)}get end(){return this.start+this.buffer.byteLength}get size(){return this.buffer.byteLength}contains(t,e){return t>=this.start&&e<=this.end}overlaps(t,e){return t>this.start&&t<this.end||e>this.start&&e<this.end}toString(){return`Buffer ${this.creationTime} ${this.start} - ${this.end}`}}class Ku{constructor(t){this.file=t}async read(t,e){return e===0?new ArrayBuffer:(t!=null&&e?this.file.slice(t,t+e):this.file).arrayBuffer()}}var Qb=Object.defineProperty,Zr=(r,t,e)=>(((n,i,s)=>{i in n?Qb(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s})(r,typeof t!="symbol"?t+"":t,e),e);async function re(r,t,e=0){var n=new Map;for(let[i,s]of r.entries()){let o=await yt.unpack_from_async("<"+s,t,e);e+=yt.calcsize(s),o.length==1&&(o=o[0]),n.set(i,o)}return n}function Ju(r,t,e=0){var n=new Map;for(let[i,s]of r.entries()){let o=yt.unpack_from("<"+s,t,e);e+=yt.calcsize(s),o.length==1&&(o=o[0]),n.set(i,o)}return n}function ne(r){r||r()}function se(r){var t="<"+Array.from(r.values()).join("");return yt.calcsize(t)}function oi(r,t=8){return Math.ceil(r/t)*t}var Xb={u:"Uint",i:"Int",f:"Float"};function ms(r){var t,e,n=yt._is_big_endian(r);
830if(/S/.test(r))t="getString",e=0|((r.match(/S(\d*)/)||[])[1]||1);else{let[i,s,o]=r.match(/[<>=!@]?(i|u|f)(\d*)/);e=parseInt(o||4,10),t="get"+Xb[s]+(8*e).toFixed()}return[t,n,e]}var yt=new class{constructor(){this.big_endian=(function(){const t=new Uint8Array(4);return!((new Uint32Array(t.buffer)[0]=1)&t[0])})(),this.getters={s:"getUint8",b:"getInt8",B:"getUint8",h:"getInt16",H:"getUint16",i:"getInt32",I:"getUint32",l:"getInt32",L:"getUint32",q:"getInt64",Q:"getUint64",f:"getFloat32",d:"getFloat64"},this.byte_lengths={s:1,b:1,B:1,h:2,H:2,i:4,I:4,l:4,L:4,q:8,Q:8,f:4,d:8};let r=Object.keys(this.byte_lengths).join("");this.fmt_size_regex="(\\d*)(["+r+"])"}calcsize(r){for(var t,e=0,n=new RegExp(this.fmt_size_regex,"g");(t=n.exec(r))!==null;){let i=parseInt(t[1]||1,10),s=t[2];e+=i*this.byte_lengths[s]}return e}_is_big_endian(r){return!/^</.test(r)&&(!!/^(!|>)/.test(r)||this.big_endian)}async unpack_from_async(r,t,e){e=Number.parseInt(e||0);const n=this.calcsize(r),i=await t.slice(e,e+n);let s=0;for(var o,a=new xn(i),l=[],h=this._is_big_endian(r),c=new RegExp(this.fmt_size_regex,"g");(o=c.exec(r))!==null;){let p=parseInt(o[1]||1,10),d=o[2],w=this.getters[d],m=this.byte_lengths[d];if(d=="s")l.push(new TextDecoder().decode(i.slice(s,s+p))),s+=p;else for(var u=0;u<p;u++)l.push(a[w](s,!h)),s+=m}return l}unpack_from(r,t,e){e=Number.parseInt(e||0);const n=this.calcsize(r),i=t.slice(e,e+n);let s=0;for(var o,a=new xn(i),l=[],h=this._is_big_endian(r),c=new RegExp(this.fmt_size_regex,"g");(o=c.exec(r))!==null;){let p=parseInt(o[1]||1,10),d=o[2],w=this.getters[d],m=this.byte_lengths[d];if(d=="s")l.push(new TextDecoder().decode(i.slice(s,s+p))),s+=p;else for(var u=0;u<p;u++)l.push(a[w](s,!h)),s+=m}return l}},xn=class extends DataView{getUint64(r,t){const e=BigInt(this.getUint32(r,t)),n=BigInt(this.getUint32(r+4,t));let i=t?e+(n<<32n):(e<<32n)+n;return Number.parseInt(i)}getInt64(r,t){var e,n;t?(e=this.getUint32(r,!0),n=this.getInt32(r+4,!0)):(n=this.getInt32(r,!1),e=this.getUint32(r+4,!1));let i=BigInt(e)+(BigInt(n)<<32n);return Number.parseInt(i)}getString(r,t,e){const n=this.buffer.slice(r,r+e);return new TextDecoder().decode(n)}getVLENStruct(r,t,e){return[this.getUint32(r,t),this.getUint64(r+4,t),this.getUint32(r+12,t)]}};function td(r){return r.toString(2).length}function ed(r,t,e=0,n=!0){const i=t.slice(e,e+r);let s=new Uint8Array(i);return n||s.reverse(),s.reduce(((a,l,h)=>a+(l<<8*h)),0)}var rd=class{constructor(r,t){this.buf=r,this.offset=t,this.dtype=this.determine_dtype()}async determine_dtype(){let r=await re(nd,this.buf,this.offset);this.offset+=Yb;let t=15&r.get("class_and_version");if(t==Kb)return this._determine_dtype_fixed_point(r);if(t==Jb)return this._determine_dtype_floating_point(r);if(t==t1)throw"Time datatype class not supported.";if(t==e1)return this._determine_dtype_string(r);if(t==r1)throw"Bitfield datatype class not supported.";if(t==id)return{datatype_class:id,size:r.get("size")};if(t==n1)return this._determine_dtype_compound(r);if(t==i1)return["REFERENCE",r.get("size")];if(t==s1)return this.determine_dtype();if(t==a1)throw"Array datatype class not supported.";if(t==o1){let e=this._determine_dtype_vlen(r);return e[0]=="VLEN_SEQUENCE"&&(e=["VLEN_SEQUENCE",this.determine_dtype()]),e}throw"Invalid datatype class "+t}_determine_dtype_fixed_point(r){let t=r.get("size");if(![1,2,4,8].includes(t))throw"Unsupported datatype size";var e,n;return e=(8&r.get("class_bit_field_0"))>0?"i":"u",n=(1&r.get("class_bit_field_0"))==0?"<":">",this.offset+=4,n+e+t.toFixed()}_determine_dtype_floating_point(r){let t=r.get("size");if(![1,2,4,8].includes(t))throw"Unsupported datatype size";var e;return e=(1&r.get("class_bit_field_0"))==0?"<":">",this.offset+=12,e+"f"+t.toFixed()}_determine_dtype_string(r){return"S"+r.get("size").toFixed()}_determine_dtype_vlen(r){return(1&r.get("class_bit_field_0"))!=1?["VLEN_SEQUENCE",0,0]:["VLEN_STRING",r.get("class_bit_field_0")>>4,1&r.get("class_bit_field_1")]}_determine_dtype_compound(r){throw"Compound type not yet implemented!"}},nd=new Map([["class_and_version","B"],["class_bit_field_0","B"],["class_bit_field_1","B"],["class_bit_field_2","B"],["size","I"]]),Yb=se(nd);se(new Map([["offset","I"],["dimensionality","B"],["reserved_0","B"],["reserved_1","B"],["reserved_2","B"],["permutation","I"],["reserved_3","I"],["dim_size_1","I"],["dim_size_2","I"],["dim_size_3","I"],["dim_size_4","I"]]));var Kb=0,Jb=1,t1=2,e1=3,r1=4,id=5,n1=6,i1=7,s1=8,o1=9,a1=10;function kn(r){let t=r.length;for(;--t>=0;)r[t]=0}kn(new Array(576)),kn(new Array(60)),kn(new Array(512)),kn(new Array(256)),kn(new Array(29)),kn(new Array(30));var ca=(r,t,e,n)=>{let i=65535&r,s=r>>>16&65535,o=0;for(;e!==0;){o=e>2e3?2e3:e,e-=o;do i=i+t[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16},l1=new Uint32Array((()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t})()),ar=(r,t,e,n)=>{const i=l1,s=n+e;r^=-1;for(let o=n;o<s;o++)r=r>>
830>8^i[255&(r^t[o])];return~r},ua={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},sd={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8},h1=(r,t)=>Object.prototype.hasOwnProperty.call(r,t),od={assign:function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)h1(e,n)&&(r[n]=e[n])}}return r},flattenChunks:r=>{let t=0;for(let n=0,i=r.length;n<i;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,i=0,s=r.length;n<s;n++){let o=r[n];e.set(o,i),i+=o.length}return e}},ad=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{ad=!1}var ai=new Uint8Array(256);for(let r=0;r<256;r++)ai[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;ai[254]=ai[254]=1;var da={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,i,s,o=r.length,a=0;for(i=0;i<o;i++)e=r.charCodeAt(i),(64512&e)==55296&&i+1<o&&(n=r.charCodeAt(i+1),(64512&n)==56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(a),s=0,i=0;s<a;i++)e=r.charCodeAt(i),(64512&e)==55296&&i+1<o&&(n=r.charCodeAt(i+1),(64512&n)==56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|63&e):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|63&e):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|63&e);return t},buf2string:(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,i;const s=new Array(2*e);for(i=0,n=0;n<e;){let o=r[n++];if(o<128){s[i++]=o;continue}let a=ai[o];if(a>4)s[i++]=65533,n+=a-1;else{for(o&=a===2?31:a===3?15:7;a>1&&n<e;)o=o<<6|63&r[n++],a--;a>1?s[i++]=65533:o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|1023&o)}}return((o,a)=>{if(a<65534&&o.subarray&&ad)return String.fromCharCode.apply(null,o.length===a?o:o.subarray(0,a));let l="";for(let h=0;h<a;h++)l+=String.fromCharCode(o[h]);return l})(s,i)},utf8border:(r,t)=>{(t=t||r.length)>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(192&r[e])==128;)e--;return e<0||e===0?t:e+ai[r[e]]>t?e:t}},c1=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},u1=function(r,t){let e,n,i,s,o,a,l,h,c,u,p,d,w,m,g,f,b,v,_,A,S,C,R,x;const T=r.state;e=r.next_in,R=r.input,n=e+(r.avail_in-5),i=r.next_out,x=r.output,s=i-(t-r.avail_out),o=i+(r.avail_out-257),a=T.dmax,l=T.wsize,h=T.whave,c=T.wnext,u=T.window,p=T.hold,d=T.bits,w=T.lencode,m=T.distcode,g=(1<<T.lenbits)-1,f=(1<<T.distbits)-1;t:do{d<15&&(p+=R[e++]<<d,d+=8,p+=R[e++]<<d,d+=8),b=w[p&g];e:for(;;){if(v=b>>>24,p>>>=v,d-=v,v=b>>>16&255,v===0)x[i++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){T.mode=12;break t}r.msg="invalid literal/length code",T.mode=30;break t}b=w[(65535&b)+(p&(1<<v)-1)];continue e}for(_=65535&b,v&=15,v&&(d<v&&(p+=R[e++]<<d,d+=8),_+=p&(1<<v)-1,p>>>=v,d-=v),d<15&&(p+=R[e++]<<d,d+=8,p+=R[e++]<<d,d+=8),b=m[p&f];;){if(v=b>>>24,p>>>=v,d-=v,v=b>>>16&255,16&v){if(A=65535&b,v&=15,d<v&&(p+=R[e++]<<d,d+=8,d<v&&(p+=R[e++]<<d,d+=8)),A+=p&(1<<v)-1,A>a){r.msg="invalid distance too far back",T.mode=30;break t}if(p>>>=v,d-=v,v=i-s,A>v){if(v=A-v,v>h&&T.sane){r.msg="invalid distance too far back",T.mode=30;break t}if(S=0,C=u,c===0){if(S+=l-v,v<_){_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}}else if(c<v){if(S+=l+c-v,v-=c,v<_){_-=v;do x[i++]=u[S++];while(--v);if(S=0,c<_){v=c,_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}}}else if(S+=c-v,v<_){_-=v;do x[i++]=u[S++];while(--v);S=i-A,C=x}for(;_>2;)x[i++]=C[S++],x[i++]=C[S++],x[i++]=C[S++],_-=3;_&&(x[i++]=C[S++],_>1&&(x[i++]=C[S++]))}else{S=i-A;do x[i++]=x[S++],x[i++]=x[S++],x[i++]=x[S++],_-=3;while(_>2);_&&(x[i++]=x[S++],_>1&&(x[i++]=x[S++]))}break}if(64&v){r.msg="invalid distance code",T.mode=30;break t}b=m[(65535&b)+(p&(1<<v)-1)]}}break}}while(e<n&&i<o);_=d>>3,e-=_,d-=_<<3,p&=(1<<d)-1,r.next_in=e,r.next_out=i,r.avail_in=e<n?n-e+5:5-(e-n),r.avail_out=i<o?o-i+257:257-(i-o),T.hold=p,T.bits=d},bs=15,d1=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),f1=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),p1=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),g1=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),li=(r,t,e,n,i,s,o,a)=>{const l=a.bits;let h,c,u,p,d,w,m=0,g=0,f=0,b=0,v=0,_=0,A=0,S=0,C=0,R=0,x=null,T=0;const y=new Uint16Array(16),E=new Uint16Array(16);let L,N,q,H=null,W=0;for(m=0;m<=bs;m++)y[m]=0;for(g=0;g<n;g++)y[t[e+g]]++;for(v=l,b=bs;b>=1&&y[b]===0;b--);if(v>b&&(v=b),b===0)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(f=1;f<b&&y[f]===0;f++);for(v<f&&(v=f),S=1,m=1;m<=bs;m++)if(S<<=1,S-=y[m],S<0)return-1;if(S>0&&(r===0||b!==1))return-1;for(E[1]=0,m=1;m<bs;m++)E[m+1]=E[m]+y[m];for(g=0;g<n;g++)t[e+g]!==0&&(o[E[t[e+g]]++]=g);if(r===0?(x=H=o,w=19):r===1?(x=d1,T-=257,H=f1,W-=257,w=256):(x=p1,H=g1,w=-1),R=0,g=0,m=f,d=s,_=v,A=0,u=-1,C=1<<v,p=C-1,r===1&&C>852||r===2&&C>592)return 1;for(;;){L=m-A,o[g]<w?(N=0,q=o[g]):o[g]>
vendor: 4,621 bytes, line 830
830w?(N=H[W+o[g]],q=x[T+o[g]]):(N=96,q=0),h=1<<m-A,c=1<<_,f=c;do c-=h,i[d+(R>>A)+c]=L<<24|N<<16|q;while(c!==0);for(h=1<<m-1;R&h;)h>>=1;if(h!==0?(R&=h-1,R+=h):R=0,g++,--y[m]==0){if(m===b)break;m=t[e+o[g]]}if(m>v&&(R&p)!==u){for(A===0&&(A=v),d+=f,_=m-A,S=1<<_;_+A<b&&(S-=y[_+A],!(S<=0));)_++,S<<=1;if(C+=1<<_,r===1&&C>852||r===2&&C>592)return 1;u=R&p,i[u]=v<<24|_<<16|d-s}}return R!==0&&(i[d+R]=m-A<<24|64<<16),a.bits=v,0},{Z_FINISH:ld,Z_BLOCK:m1,Z_TREES:ws,Z_OK:Qr,Z_STREAM_END:b1,Z_NEED_DICT:w1,Z_STREAM_ERROR:Ge,Z_DATA_ERROR:hd,Z_MEM_ERROR:cd,Z_BUF_ERROR:v1,Z_DEFLATED:ud}=sd,wr=12,le=30,dd=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function y1(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var fa,pa,fd=r=>{if(!r||!r.state)return Ge;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Qr},pd=r=>{if(!r||!r.state)return Ge;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,fd(r)},gd=(r,t)=>{let e;if(!r||!r.state)return Ge;const n=r.state;return t<0?(e=0,t=-t):(e=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ge:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,pd(r))},md=(r,t)=>{if(!r)return Ge;const e=new y1;r.state=e,e.window=null;const n=gd(r,t);return n!==Qr&&(r.state=null),n},bd=!0,_1=r=>{if(bd){fa=new Int32Array(512),pa=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(li(1,r.lens,0,288,fa,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;li(2,r.lens,0,32,pa,0,r.work,{bits:5}),bd=!1}r.lencode=fa,r.lenbits=9,r.distcode=pa,r.distbits=5},wd=(r,t,e,n)=>{let i;const s=r.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),s.window.set(t.subarray(e-n,e-n+i),s.wnext),(n-=i)?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},x1=(r,t)=>{let e,n,i,s,o,a,l,h,c,u,p,d,w,m,g,f,b,v,_,A,S,C,R=0;const x=new Uint8Array(4);let T,y;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!r||!r.state||!r.output||!r.input&&r.avail_in!==0)return Ge;e=r.state,e.mode===wr&&(e.mode=13),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,h=e.hold,c=e.bits,u=a,p=l,C=Qr;t:for(;;)switch(e.mode){case 1:if(e.wrap===0){e.mode=13;break}for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(2&e.wrap&&h===35615){e.check=0,x[0]=255&h,x[1]=h>>>8&255,e.check=ar(e.check,x,2,0),h=0,c=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&h)<<8)+(h>>8))%31){r.msg="incorrect header check",e.mode=le;break}if((15&h)!==ud){r.msg="unknown compression method",e.mode=le;break}if(h>>>=4,c-=4,S=8+(15&h),e.wbits===0)e.wbits=S;else if(S>e.wbits){r.msg="invalid window size",e.mode=le;break}e.dmax=1<<e.wbits,r.adler=e.check=1,e.mode=512&h?10:wr,h=0,c=0;break;case 2:for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(e.flags=h,(255&e.flags)!==ud){r.msg="unknown compression method",e.mode=le;break}if(57344&e.flags){r.msg="unknown header flags set",e.mode=le;break}e.head&&(e.head.text=h>>8&1),512&e.flags&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ar(e.check,x,2,0)),h=0,c=0,e.mode=3;case 3:for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.head&&(e.head.time=h),512&e.flags&&(x[0]=255&h,x[1]=h>>>8&255,x[2]=h>>>16&255,x[3]=h>>>24&255,e.check=ar(e.check,x,4,0)),h=0,c=0,e.mode=4;case 4:for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=255&h,e.head.os=h>>8),512&e.flags&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ar(e.check,x,2,0)),h=0,c=0,e.mode=5;case 5:if(1024&e.flags){for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.length=h,e.head&&(e.head.extra_len=h),512&e.flags&&(x[0]=255&h,x[1]=h>>>8&255,e.check=ar(e.check,x,2,0)),h=0,c=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(d=e.length,d>
vendor: 3,245 bytes, line 830
830a&&(d=a),d&&(e.head&&(S=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+d),S)),512&e.flags&&(e.check=ar(e.check,n,d,s)),a-=d,s+=d,e.length-=d),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(a===0)break t;d=0;do S=n[s+d++],e.head&&S&&e.length<65536&&(e.head.name+=String.fromCharCode(S));while(S&&d<a);if(512&e.flags&&(e.check=ar(e.check,n,d,s)),a-=d,s+=d,S)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=8;case 8:if(4096&e.flags){if(a===0)break t;d=0;do S=n[s+d++],e.head&&S&&e.length<65536&&(e.head.comment+=String.fromCharCode(S));while(S&&d<a);if(512&e.flags&&(e.check=ar(e.check,n,d,s)),a-=d,s+=d,S)break t}else e.head&&(e.head.comment=null);e.mode=9;case 9:if(512&e.flags){for(;c<16;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(h!==(65535&e.check)){r.msg="header crc mismatch",e.mode=le;break}h=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=wr;break;case 10:for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}r.adler=e.check=dd(h),h=0,c=0,e.mode=11;case 11:if(e.havedict===0)return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,w1;r.adler=e.check=1,e.mode=wr;case wr:if(t===m1||t===ws)break t;case 13:if(e.last){h>>>=7&c,c-=7&c,e.mode=27;break}for(;c<3;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}switch(e.last=1&h,h>>>=1,c-=1,3&h){case 0:e.mode=14;break;case 1:if(_1(e),e.mode=20,t===ws){h>>>=2,c-=2;break t}break;case 2:e.mode=17;break;case 3:r.msg="invalid block type",e.mode=le}h>>>=2,c-=2;break;case 14:for(h>>>=7&c,c-=7&c;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if((65535&h)!=(h>>>16^65535)){r.msg="invalid stored block lengths",e.mode=le;break}if(e.length=65535&h,h=0,c=0,e.mode=15,t===ws)break t;case 15:e.mode=16;case 16:if(d=e.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break t;i.set(n.subarray(s,s+d),o),a-=d,s+=d,l-=d,o+=d,e.length-=d;break}e.mode=wr;break;case 17:for(;c<14;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(e.nlen=257+(31&h),h>>>=5,c-=5,e.ndist=1+(31&h),h>>>=5,c-=5,e.ncode=4+(15&h),h>>>=4,c-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=le;break}e.have=0,e.mode=18;case 18:for(;e.have<e.ncode;){for(;c<3;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.lens[E[e.have++]]=7&h,h>>>=3,c-=3}for(;e.have<19;)e.lens[E[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,T={bits:e.lenbits},C=li(0,e.lens,0,19,e.lencode,0,e.work,T),e.lenbits=T.bits,C){r.msg="invalid code lengths set",e.mode=le;break}e.have=0,e.mode=19;case 19:for(;e.have<e.nlen+e.ndist;){for(;R=e.lencode[h&(1<<e.lenbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(b<16)h>>>=g,c-=g,e.lens[e.have++]=b;else{if(b===16){for(y=g+2;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(h>>>=g,c-=g,e.have===0){r.msg="invalid bit length repeat",e.mode=le;break}S=e.lens[e.have-1],d=3+(3&h),h>>>=2,c-=2}else if(b===17){for(y=g+3;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=g,c-=g,S=0,d=3+(7&h),h>>>=3,c-=3}else{for(y=g+7;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=g,c-=g,S=0,d=11+(127&h),h>>>=7,c-=7}if(e.have+d>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=le;break}for(;d--;)e.lens[e.have++]=S}}if(e.mode===le)break;
vendor: 5,405 bytes, line 830
830if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=le;break}if(e.lenbits=9,T={bits:e.lenbits},C=li(1,e.lens,0,e.nlen,e.lencode,0,e.work,T),e.lenbits=T.bits,C){r.msg="invalid literal/lengths set",e.mode=le;break}if(e.distbits=6,e.distcode=e.distdyn,T={bits:e.distbits},C=li(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,T),e.distbits=T.bits,C){r.msg="invalid distances set",e.mode=le;break}if(e.mode=20,t===ws)break t;case 20:e.mode=21;case 21:if(a>=6&&l>=258){r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,u1(r,p),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,h=e.hold,c=e.bits,e.mode===wr&&(e.back=-1);break}for(e.back=0;R=e.lencode[h&(1<<e.lenbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(f&&!(240&f)){for(v=g,_=f,A=b;R=e.lencode[A+((h&(1<<v+_)-1)>>v)],g=R>>>24,f=R>>>16&255,b=65535&R,!(v+g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=v,c-=v,e.back+=v}if(h>>>=g,c-=g,e.back+=g,e.length=b,f===0){e.mode=26;break}if(32&f){e.back=-1,e.mode=wr;break}if(64&f){r.msg="invalid literal/length code",e.mode=le;break}e.extra=15&f,e.mode=22;case 22:if(e.extra){for(y=e.extra;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.length+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;R=e.distcode[h&(1<<e.distbits)-1],g=R>>>24,f=R>>>16&255,b=65535&R,!(g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(!(240&f)){for(v=g,_=f,A=b;R=e.distcode[A+((h&(1<<v+_)-1)>>v)],g=R>>>24,f=R>>>16&255,b=65535&R,!(v+g<=c);){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}h>>>=v,c-=v,e.back+=v}if(h>>>=g,c-=g,e.back+=g,64&f){r.msg="invalid distance code",e.mode=le;break}e.offset=b,e.extra=15&f,e.mode=24;case 24:if(e.extra){for(y=e.extra;c<y;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}e.offset+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=le;break}e.mode=25;case 25:if(l===0)break t;if(d=p-l,e.offset>d){if(d=e.offset-d,d>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=le;break}d>e.wnext?(d-=e.wnext,w=e.wsize-d):w=e.wnext-d,d>e.length&&(d=e.length),m=e.window}else m=i,w=o-e.offset,d=e.length;d>l&&(d=l),l-=d,e.length-=d;do i[o++]=m[w++];while(--d);e.length===0&&(e.mode=21);break;case 26:if(l===0)break t;i[o++]=e.length,l--,e.mode=21;break;case 27:if(e.wrap){for(;c<32;){if(a===0)break t;a--,h|=n[s++]<<c,c+=8}if(p-=l,r.total_out+=p,e.total+=p,p&&(r.adler=e.check=e.flags?ar(e.check,i,p,o-p):ca(e.check,i,p,o-p)),p=l,(e.flags?h:dd(h))!==e.check){r.msg="incorrect data check",e.mode=le;break}h=0,c=0}e.mode=28;case 28:if(e.wrap&&e.flags){for(;c<32;){if(a===0)break t;a--,h+=n[s++]<<c,c+=8}if(h!==(4294967295&e.total)){r.msg="incorrect length check",e.mode=le;break}h=0,c=0}e.mode=29;case 29:C=b1;break t;case le:C=hd;break t;case 31:return cd;default:return Ge}return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,e.hold=h,e.bits=c,(e.wsize||p!==r.avail_out&&e.mode<le&&(e.mode<27||t!==ld))&&wd(r,r.output,r.next_out,p-r.avail_out),u-=r.avail_in,p-=r.avail_out,r.total_in+=u,r.total_out+=p,e.total+=p,e.wrap&&p&&(r.adler=e.check=e.flags?ar(e.check,i,p,r.next_out-p):ca(e.check,i,p,r.next_out-p)),r.data_type=e.bits+(e.last?64:0)+(e.mode===wr?128:0)+(e.mode===20||e.mode===15?256:0),(u===0&&p===0||t===ld)&&C===Qr&&(C=v1),C},vr={inflateReset:pd,inflateReset2:gd,inflateResetKeep:fd,inflateInit:r=>md(r,15),inflateInit2:md,inflate:x1,inflateEnd:r=>{if(!r||!r.state)return Ge;let t=r.state;return t.window&&(t.window=null),r.state=null,Qr},inflateGetHeader:(r,t)=>{if(!r||!r.state)return Ge;const e=r.state;return 2&e.wrap?(e.head=t,t.done=!1,Qr):Ge},inflateSetDictionary:(r,t)=>{const e=t.length;let n,i,s;return r&&r.state?(n=r.state,n.wrap!==0&&n.mode!==11?Ge:n.mode===11&&(i=1,i=ca(i,t,e,0),i!==n.check)?hd:(s=wd(r,t,e,e),s?(n.mode=31,cd):(n.havedict=1,Qr))):Ge},inflateInfo:"pako inflate (from Nodeca project)"},k1=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},vd=Object.prototype.toString,{Z_NO_FLUSH:C1,Z_FINISH:S1,Z_OK:hi,Z_STREAM_END:ga,Z_NEED_DICT:ma,Z_STREAM_ERROR:A1,Z_DATA_ERROR:yd,Z_MEM_ERROR:E1}=sd;function vs(r){this.options=od.assign({chunkSize:65536,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||r&&r.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c1,this.strm.avail_out=0;let e=vr.inflateInit2(this.strm,t.windowBits);if(e!==hi)throw new Error(ua[e]);if(this.header=new k1,vr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=da.string2buf(t.dictionary):vd.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=vr.inflateSetDictionary(this.strm,t.dictionary),e!==hi)))throw new Error(ua[e])}function _d(r,t){const e=new vs(t);if(e.push(r),e.err)throw e.msg||ua[e.err];return e.result}vs.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=t===~~t?t:t===!0?S1:C1,vd.call(r)==="[object ArrayBuffer]"?e.input=new
830Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=vr.inflate(e,o),s===ma&&i&&(s=vr.inflateSetDictionary(e,i),s===hi?s=vr.inflate(e,o):s===yd&&(s=ma));e.avail_in>0&&s===ga&&e.state.wrap>0&&r[e.next_in]!==0;)vr.inflateReset(e),s=vr.inflate(e,o);switch(s){case A1:case yd:case ma:case E1:return this.onEnd(s),this.ended=!0,!1}if(a=e.avail_out,e.next_out&&(e.avail_out===0||s===ga))if(this.options.to==="string"){let l=da.utf8border(e.output,e.next_out),h=e.next_out-l,c=da.buf2string(e.output,l);e.next_out=h,e.avail_out=n-h,h&&e.output.set(e.output.subarray(l,l+h),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(s!==hi||a!==0){if(s===ga)return s=vr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},vs.prototype.onData=function(r){this.chunks.push(r)},vs.prototype.onEnd=function(r){r===hi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=od.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var T1={inflate:_d,ungzip:_d},{inflate:M1,ungzip:R1}=T1,L1=M1,I1=R1,xd=new Map([[1,function(r,t){let e=new Uint8Array(r);return L1(e).buffer}],[2,function(r,t){let e=r.byteLength,n=new Uint8Array(e),i=Math.floor(e/t),s=new DataView(r);for(var o=0;o<t;o++)for(var a=0;a<i;a++)n[o+a*t]=s.getUint8(o*i+a);return n.buffer}],[3,function(r,t){return(function(e){for(var n=e.byteLength%2!=0,i=e.byteLength-4,s=new DataView(e),o=0,a=0,l=0;l<i-1;l+=2)a=(a+(o=(o+s.getUint16(l,!0))%65535))%65535;n&&(a=(a+(o=(o+s.getUint8(i-1))%65535))%65535);var[h,c]=yt.unpack_from(">HH",e,i);if(c%=65535,o!=(h%=65535)||a!=c)throw'ValueError("fletcher32 checksum invalid")'})(r),r.slice(0,-4)}]]),kd=class{constructor(r,t){this.fh=r,this.offset=t,this.depth=null}async init(){this.all_nodes=new Map,await this._read_root_node(),await this._read_children()}async _read_children(){let r=this.depth;for(;r>0;){for(var t of this.all_nodes.get(r))for(var e of t.get("addresses"))this._add_node(await this._read_node(e,r-1));r--}}async _read_root_node(){let r=await this._read_node(this.offset,null);this._add_node(r),this.depth=r.get("node_level")}_add_node(r){let t=r.get("node_level");this.all_nodes.has(t)?this.all_nodes.get(t).push(r):this.all_nodes.set(t,[r])}async _read_node(r,t){let e=await this._read_node_header(r,t);return e.set("keys",[]),e.set("addresses",[]),e}async _read_node_header(r){throw"NotImplementedError: must define _read_node_header in implementation class"}},Cd=class extends kd{constructor(){super(...arguments),Zr(this,"B_LINK_NODE",new Map([["signature","4s"],["node_type","B"],["node_level","B"],["entries_used","H"],["left_sibling","Q"],["right_sibling","Q"]]))}async _read_node_header(r,t){let e=await re(this.B_LINK_NODE,this.fh,r);if(t!=null&&e.get("node_level")!=t)throw"node level does not match";return e}},N1=class extends Cd{constructor(r,t){super(r,t),Zr(this,"NODE_TYPE",0),this.ready=this.init()}async _read_node(r,t){let e=await this._read_node_header(r,t);r+=se(this.B_LINK_NODE);let n=[],i=[],s=e.get("entries_used");for(var o=0;o<s;o++){let a=(await yt.unpack_from_async("<Q",this.fh,r))[0];r+=8;let l=(await yt.unpack_from_async("<Q",this.fh,r))[0];r+=8,n.push(a),i.push(l)}return n.push((await yt.unpack_from_async("<Q",this.fh,r))[0]),e.set("keys",n),e.set("addresses",i),e}symbol_table_addresses(){var r=[],t=this.all_nodes.get(0);for(var e of t)r=r.concat(e.get("addresses"));return r}},B1=class extends Cd{constructor(r,t,e){super(r,t),Zr(this,"NODE_TYPE",1),this.dims=e,this.ready=this.init()}async _read_node(r,t){let e=await this._read_node_header(r,t);r+=se(this.B_LINK_NODE);var n=[],i=[];let s=e.get("entries_used");for(var o=0;o<s;o++){let[a,l]=await yt.unpack_from_async("<II",this.fh,r);r+=8;let h="<"+this.dims.toFixed()+"Q",c=yt.calcsize(h),u=await yt.unpack_from_async(h,this.fh,r);r+=c;let p=(await yt.unpack_from_async("<Q",this.fh,r))[0];r+=8,n.push(new Map([["chunk_size",a],["filter_mask",l],["chunk_offset",u]
830])),i.push(p)}return e.set("keys",n),e.set("addresses",i),e}async construct_data_from_chunks(r,t,e,n){var i,s,o;if(e instanceof Array){let C=e[0];if(C=="REFERENCE"){if(e[1]!=8)throw"NotImplementedError('Unsupported Reference type')";e="<u8",i="getUint64",s=!1,o=8}else{if(C!="VLEN_STRING"&&C!="VLEN_SEQUENCE")throw"NotImplementedError('datatype not implemented')";i="getVLENStruct",s=!1,o=16}}else[i,s,o]=ms(e);var a=t.reduce((function(C,R){return C*R}),1),l=r.reduce((function(C,R){return C*R}),1);let h=t.length;var c=1;r.slice().map((function(C){let R=c;return c*=C,R})),c=1;var u=t.slice().reverse().map((function(C){let R=c;return c*=C,R})).reverse(),p=new Array(a);let d=l*o;for(var w of this.all_nodes.get(0)){let C=w.get("keys"),R=w.get("addresses"),x=C.length;for(var m=0;m<x;m++){let T=C[m],y=R[m];var g;if(n==null)g=await this.fh.slice(y,y+d);else{g=await this.fh.slice(y,y+T.get("chunk_size"));let E=T.get("filter_mask");g=this._filter_chunk(g,E,n,o)}for(var f=T.get("chunk_offset").slice(),b=f.slice(),v=b.map((function(){return 0})),_=new xn(g),A=0;A<l;A++){for(var S=h-1;S>=0&&v[S]>=r[S];S--)v[S]=0,b[S]=f[S],S>0&&(v[S-1]+=1,b[S-1]+=1);if(b.slice(0,-1).every((function(E,L){return E<t[L]}))){let E=A*o,L=_[i](E,!s,o),N=b.slice(0,-1).reduce((function(q,H,W){return H*u[W]+q}),0);p[N]=L}v[h-1]+=1,b[h-1]+=1}}}return p}_filter_chunk(r,t,e,n){let i=e.length,s=r.slice();for(var o=i-1;o>=0;o--){if(t&1<<o)continue;let a=e[o],l=a.get("filter_id"),h=a.get("client_data");if(!xd.has(l))throw'NotImplementedError("Filter with id:'+l.toFixed()+' not supported")';s=xd.get(l)(s,n,h)}return s}},Sd=class extends kd{constructor(r,t){super(r,t),Zr(this,"B_TREE_HEADER",new Map([["signature","4s"],["version","B"],["node_type","B"],["node_size","I"],["record_size","H"],["depth","H"],["split_percent","B"],["merge_percent","B"],["root_address","Q"],["root_nrecords","H"],["total_nrecords","Q"]])),Zr(this,"B_LINK_NODE",new Map([["signature","4s"],["version","B"],["node_type","B"]])),this.ready=this.init()}async _read_root_node(){let r=await this._read_tree_header(this.offset);this.address_formats=this._calculate_address_formats(r),this.header=r,this.depth=r.get("depth");let t=[r.get("root_address"),r.get("root_nrecords"),r.get("total_nrecords")],e=await this._read_node(t,this.depth);this._add_node(e)}async _read_tree_header(r){return await re(this.B_TREE_HEADER,this.fh,this.offset)}_calculate_address_formats(r){let t=r.get("node_size"),e=r.get("record_size"),n=0,i=0,s=new Map,o=r.get("depth");for(var a=0;a<=o;a++){let l,h,c,u="",p="",d="";if(a==0?(l=0,h=0,c=0):a==1?(l=8,u="<Q",h=this._required_bytes(n),p=this._int_format(h),c=0):(l=8,u="<Q",h=this._required_bytes(n),p=this._int_format(h),c=this._required_bytes(i),d=this._int_format(c)),s.set(a,[l,h,c,u,p,d]),a<o){let w=l+h+c;n=this._nrecords_max(t,e,w),i>0?i*=n:i=n}}return s}_nrecords_max(r,t,e){return Math.floor((r-10-e)/(t+e))}_required_bytes(r){return Math.ceil(td(r)/8)}_int_format(r){return["<B","<H","<I","<Q"][r-1]}async _read_node(r,t){let[e,n,i]=r,s=this._read_node_header(e,t);e+=se(this.B_LINK_NODE);let o=this.header.get("record_size"),a=[];for(let c=0;c<n;c++){let u=await this._parse_record(this.fh,e,o);e+=o,a.push(u)}let l=[],h=this.address_formats.get(t);if(t!=0){let[c,u,p,d,w,m]=h;for(let g=0;g<=n;g++){let f=(await yt.unpack_from_async(d,this.fh,e))[0];e+=c;let b=(await yt.unpack_from_async(w,this.fh,e))[0];e+=u;let v=b;p>0&&(v=(await yt.unpack_from_async(m,this.fh,e))[0],e+=p),l.push([f,b,v])}}return s.set("keys",a),s.set("addresses",l),s}async _read_node_header(r,t){let e=await re(this.B_LINK_NODE,this.fh,r);return e.set("node_level",t),e}*iter_records(){for(let r of this.all_nodes.values())for(let t of r)for(let e of t.get("keys"))yield e}_parse_record(r){throw"NotImplementedError"}},F1=class extends Sd{constructor(){super(...arguments),Zr(this,"NODE_TYPE",5)}async _parse_record(r,t,e){let n=(await yt.unpack_from_async("<I",r,t))[0];t+=4;const i=await r.slice(t,t+7);return new Map([["namehash",n],["heapid",i]])}},O1=class extends Sd{constructor(){super(...arguments),Zr(this,"NODE_TYPE",6)}async _parse_record(r,t,e){let n=(await yt.unpack_from_async("<Q",r,t))[0];t+=8;const i=await r.slice(t,t+7);return new Map([["creationorder",n],["heapid",i]])}},D1=class{constructor(r,t){this.ready=this.init(r,t)}async init(r,t){let e=await yt.unpack_from_async("<B",r,t+8);var n;if(e==0)n=await re(Td,r,t),this._end_of_sblock=t+U1;else{if(e!=2&&e!=3)throw"unsupported superblock version: "+e.toFixed();n=await re(Md,r,t),this._end_of_sblock=t+V1}if(n.get("format_signature")!=H1)throw"Incorrect file signature: "+n.get("format_signature");
830if(n.get("offset_size")!=8||n.get("length_size")!=8)throw"File uses non-64-bit addressing";this.version=n.get("superblock_version"),this._contents=n,this._root_symbol_table=null,this._fh=r}async get_offset_to_dataobjects(){if(this.version==0){var r=new Ad(this._fh,this._end_of_sblock,!0);return await r.ready,this._root_symbol_table=r,r.group_offset}if(this.version==2||this.version==3)return this._contents.get("root_group_address");throw"Not implemented version = "+this.version.toFixed()}},P1=class{constructor(r,t){this.ready=this.init(r,t)}async init(r,t){let e=await re(W1,r,t);ne(e.get("signature")=="HEAP"),ne(e.get("version")==0);let n=e.get("address_of_data_segment"),i=await r.slice(n,n+e.get("data_segment_size"));e.set("heap_data",i),this._contents=e,this.data=i}get_object_name(r){let t=new Uint8Array(this.data).indexOf(0,r)-r;return yt.unpack_from("<"+t.toFixed()+"s",this.data,r)[0]}},Ad=class{constructor(r,t,e=!1){this.ready=this.init(r,t,e)}async init(r,t,e){var n;if(e)n=new Map([["symbols",1]]);else{if((n=await re(Ld,r,t)).get("signature")!="SNOD")throw"incorrect node type";t+=j1}for(var i=[],s=n.get("symbols"),o=0;o<s;o++)i.push(await re(Rd,r,t)),t+=q1;return e&&(this.group_offset=i[0].get("object_header_address")),this.entries=i,this._contents=n,this}assign_name(r){this.entries.forEach((function(t){let e=t.get("link_name_offset"),n=r.get_object_name(e);t.set("link_name",n)}))}get_links(r){var t={};return this.entries.forEach((function(e){let n=e.get("cache_type"),i=e.get("link_name");if(n==0||n==1)t[i]=e.get("object_header_address");else if(n==2){let o=e.get("scratch"),a=new ArrayBuffer(4),l=new Uint8Array(a);for(var s=0;s<4;s++)l[s]=o.charCodeAt(s);let h=yt.unpack_from("<I",a,0)[0];t[i]=r.get_object_name(h)}})),t}},Ed=class{constructor(r,t){this.ready=this.init(r,t)}async init(r,t){let e=await re(Id,r,t);t+=Nd;let n=e.get("collection_size")-Nd,i=await r.slice(t,t+n);this.heap_data=i,this._header=e,this._objects=null}get objects(){if(this._objects==null){this._objects=new Map;for(var r=0;r<=this.heap_data.byteLength-Fd;){let t=Ju(Bd,this.heap_data,r);if(t.get("object_index")==0)break;r+=Fd;let e=this.heap_data.slice(r,r+t.get("object_size"));this._objects.set(t.get("object_index"),e),r+=oi(t.get("object_size"))}}return this._objects}},z1=class{constructor(r,t){this.fh=r,this.ready=this.init(t)}async init(r){let t=await re(Od,this.fh,r);if(r+=se(Od),ne(t.get("signature")=="FRHP"),ne(t.get("version")==0),t.get("filter_info_size")>0)throw"Filter info size not supported on FractalHeap";if(t.get("btree_address_huge_objects")!=ys)throw"Huge objects not implemented in FractalHeap";t.set("btree_address_huge_objects",null),t.get("root_block_address")==ys&&t.set("root_block_address",null);let e=t.get("log2_maximum_heap_size"),n=this._min_size_nbits(e),i=new Map([["signature","4s"],["version","B"],["heap_header_adddress","Q"],["block_offset",`${n}B`]]);this.indirect_block_header=new Map(i),this.indirect_block_header_size=se(i),2&~t.get("flags")||i.set("checksum","I"),this.direct_block_header=i,this.direct_block_header_size=se(i);let s=t.get("maximum_direct_block_size");this._managed_object_offset_size=this._min_size_nbits(e);let o=Math.min(s,t.get("max_managed_object_size"));this._managed_object_length_size=this._min_size_integer(o);let a=t.get("starting_block_size"),l=t.get("table_width");if(!(a>0))throw"Starting block size == 0 not implemented";let h=Number(Math.floor(Math.log2(s)));ne(1n<<BigInt(h)==s);let c=Number(Math.floor(Math.log2(a)));ne(1n<<BigInt(c)==a),this._max_direct_nrows=h-c+2;let u=Math.floor(Math.log2(l));ne(1<<u==l),this._indirect_nrows_sub=u+c-1,this.header=t,this.nobjects=t.get("managed_object_count")+t.get("huge_object_count")+t.get("tiny_object_count");let p=[],d=t.get("root_block_address"),w=0;if(d!=null&&(w=t.get("indirect_current_rows_count")),w>0)for await(let b of this._iter_indirect_block(this.fh,d,w))p.push(b);else{let b=await this._read_direct_block(this.fh,d,a);p.push(b)}let m=p.reduce(((b,v)=>b+v.byteLength),0),g=new Uint8Array(m),f=0;p.forEach((b=>{g.set(new Uint8Array(b),f),f+=b.byteLength})),this.managed=g.buffer}async _read_direct_block(r,t,e){let n=await r.slice(t,t+e);return ne(Ju(this.direct_block_header,n).get("signature")=="FHDB"),n}get_data(r){let t=yt.unpack_from("<B",r,0)[0],e=t>>4&3,n=1;if(e==0){ne(t>>6==0);let i=this._managed_object_offset_size,s=ed(i,r,n);n+=i,i=this._managed_object_length_size;let o=ed(i,r,n);return this.managed.slice(s,s+o)}
830throw e==1?"tiny objectID not supported in FractalHeap":e==2?"huge objectID not supported in FractalHeap":"unknown objectID type in FractalHeap"}_min_size_integer(r){return this._min_size_nbits(td(r))}_min_size_nbits(r){return Math.ceil(r/8)}async*_iter_indirect_block(r,t,e){let n=await re(this.indirect_block_header,r,t);t+=this.indirect_block_header_size,ne(n.get("signature")=="FHIB");let i=n.get("block_offset").reduce(((h,c,u)=>h+(c<<8*u)),0);n.set("block_offset",i);let[s,o]=this._indirect_info(e),a=[];for(let h=0;h<s;h++){let c=(await yt.unpack_from_async("<Q",r,t))[0];if(t+=8,c==ys)break;let u=this._calc_block_size(h);a.push([c,u])}let l=[];for(let h=s;h<s+o;h++){let c=(await yt.unpack_from_async("<Q",r,t))[0];if(t+=8,c==ys)break;let u=this._calc_block_size(h),p=this._iblock_nrows_from_block_size(u);l.push([c,p])}for(let[h,c]of a)yield await this._read_direct_block(r,h,c);for(let[h,c]of l)for await(let u of this._iter_indirect_block(r,h,c))yield u}_calc_block_size(r){let t=Math.floor(r/this.header.get("table_width"));return 2**Math.max(t-1,0)*this.header.get("starting_block_size")}_iblock_nrows_from_block_size(r){let t=Math.floor(Math.log2(r));return ne(2**t==r),t-this._indirect_nrows_sub}_indirect_info(r){let t,e,n=this.header.get("table_width"),i=r*n,s=this._max_direct_nrows*n;return r<=s?(t=i,e=0):(t=s,e=i-s),[t,e]}_int_format(r){return["B","H","I","Q"][r-1]}},H1=yt.unpack_from("8s",new Uint8Array([137,72,68,70,13,10,26,10]).buffer)[0],ys=yt.unpack_from("<Q",new Uint8Array([255,255,255,255,255,255,255,255]).buffer)[0],Td=new Map([["format_signature","8s"],["superblock_version","B"],["free_storage_version","B"],["root_group_version","B"],["reserved_0","B"],["shared_header_version","B"],["offset_size","B"],["length_size","B"],["reserved_1","B"],["group_leaf_node_k","H"],["group_internal_node_k","H"],["file_consistency_flags","L"],["base_address_lower","Q"],["free_space_address","Q"],["end_of_file_address","Q"],["driver_information_address","Q"]]),U1=se(Td),Md=new Map([["format_signature","8s"],["superblock_version","B"],["offset_size","B"],["length_size","B"],["file_consistency_flags","B"],["base_address","Q"],["superblock_extension_address","Q"],["end_of_file_address","Q"],["root_group_address","Q"],["superblock_checksum","I"]]),V1=se(Md),Rd=new Map([["link_name_offset","Q"],["object_header_address","Q"],["cache_type","I"],["reserved","I"],["scratch","16s"]]),q1=se(Rd),Ld=new Map([["signature","4s"],["version","B"],["reserved_0","B"],["symbols","H"]]),j1=se(Ld),W1=new Map([["signature","4s"],["version","B"],["reserved","3s"],["data_segment_size","Q"],["offset_to_free_list","Q"],["address_of_data_segment","Q"]]),Id=new Map([["signature","4s"],["version","B"],["reserved","3s"],["collection_size","Q"]]),Nd=se(Id),Bd=new Map([["object_index","H"],["reference_count","H"],["reserved","I"],["object_size","Q"]]),Fd=se(Bd),Od=new Map([["signature","4s"],["version","B"],["object_index_size","H"],["filter_info_size","H"],["flags","B"],["max_managed_object_size","I"],["next_huge_object_index","Q"],["btree_address_huge_objects","Q"],["managed_freespace_size","Q"],["freespace_manager_address","Q"],["managed_space_size","Q"],["managed_alloc_size","Q"],["next_directblock_iterator_address","Q"],["managed_object_count","Q"],["huge_objects_total_size","Q"],["huge_object_count","Q"],["tiny_objects_total_size","Q"],["tiny_object_count","Q"],["table_width","H"],["starting_block_size","Q"],["maximum_direct_block_size","Q"],["log2_maximum_heap_size","H"],["indirect_starting_rows_count","H"],["root_block_address","Q"],["indirect_current_rows_count","H"]]),ba=class{constructor(r,t){this.ready=this.init(r,t)}async init(r,t){let e=(await yt.unpack_from_async("<B",r,t))[0];if(e==1)var[n,i,s]=await this._parse_v1_objects(r,t);else{if(e!=79)throw"InvalidHDF5File('unknown Data Object Header')";var[n,i,s]=await this._parse_v2_objects(r,t)}this.fh=r,this.msgs=n,this.msg_data=i,this.offset=t,this._global_heaps={},this._header=s,this._filter_pipeline=null,this._chunk_params_set=!1,this._chunks=null,this._chunk_dims=null,this._chunk_address=null}get dtype(){let r=this.find_msg_type(ew)[0].get("offset_to_message");return new rd(this.fh,r).dtype}get chunks(){return this._get_chunk_params().then((()=>this._chunks))}get shape(){let r=this.find_msg_type(Xd)[0].get("offset_to_message");return(async function(t,e){let n=(await yt.unpack_from_async("<B",t,e))[0];var i;if(n==1)ne((i=await re(va,t,e)).get("version")==1),e+=Vd;else{if(n!=2)throw"InvalidHDF5File('unknown dataspace message version')";ne((i=await re(ya,t,e)).get("version")==2),e+=qd}let s=i.get("dimensionality");return(await yt.unpack_from_async("<"+(2*s).toFixed()+"I",t,e)).filter((function(a,l){return l%2==0}
830))})(this.fh,r)}async get_filter_pipeline(){if(this._filter_pipeline!=null)return this._filter_pipeline;let r=this.find_msg_type(iw);if(!r.length)return this._filter_pipeline=null,this._filter_pipeline;var t=r[0].get("offset_to_message");let[e,n]=await yt.unpack_from_async("<BB",this.fh,t);t+=yt.calcsize("<BB");var i=[];if(e==1){await yt.unpack_from_async("<HI",this.fh,t),t+=yt.calcsize("<HI");for(var s=0;s<n;s++){let o=await re(Qd,this.fh,t);t+=J1;let a=oi(o.get("name_length"),8),l="<"+a.toFixed()+"s",h=(await yt.unpack_from_async(l,this.fh,t))[0];o.set("filter_name",h),t+=a,l="<"+o.get("client_data_values").toFixed()+"I";let c=await yt.unpack_from_async(l,this.fh,t);o.set("client_data",c),t+=4*o.get("client_data_values"),o.get("client_data_values")%2&&(t+=4),i.push(o)}}else{if(e!=2)throw`version ${e} is not supported`;for(let o=0;o<n;o++){let a=new Map,l=this.fh,h=(await yt.unpack_from_async("<H",l,t))[0];t+=2,a.set("filter_id",h);let c=0;h>255&&(c=(await yt.unpack_from_async("<H",l,t))[0],t+=2);let u=(await yt.unpack_from_async("<H",l,t))[0];t+=2;let p=(1&u)>0;a.set("optional",p);let d,w=(await yt.unpack_from_async("<H",l,t))[0];t+=2,c>0&&(d=(await yt.unpack_from_async(`${c}s`,l,t))[0],t+=c),a.set("name",d);let m=await yt.unpack_from_async(`<${w}i`,l,t);t+=4*w,a.set("client_data_values",m),i.push(a)}}return this._filter_pipeline=i,this._filter_pipeline}find_msg_type(r){return this.msgs.filter((function(t){return t.get("type")==r}))}async get_attributes(){let r={},t=this.find_msg_type(sw);for(let e of t){let n=e.get("offset_to_message"),[i,s]=await this.unpack_attribute(n);r[i]=s}return r}async get_fillvalue(){var r,t=this.find_msg_type(rw)[0].get("offset_to_message");let e=(await yt.unpack_from_async("<B",this.fh,t))[0];var n,i,s;if(e==1||e==2)n=await re(Gd,this.fh,t),t+=Y1,r=n.get("fillvalue_defined");else{if(e!=3)throw'InvalidHDF5File("Unknown fillvalue msg version: "'+String(e);n=await re(Zd,this.fh,t),t+=K1,r=32&n.get("flags")}if(r?(i=(await yt.unpack_from_async("<I",this.fh,t))[0],t+=4):i=0,i){let[o,a,l]=ms(await this.dtype);s=new xn(await this.fh.slice(t,t+l))[o](t,!a,l)}else s=0;return s}async unpack_attribute(r){let t=(await yt.unpack_from_async("<B",this.fh,r))[0];var e,n;if(t==1)ne((e=await re(Pd,this.fh,r)).get("version")==1),r+=$1,n=8;else{if(t!=3)throw"unsupported attribute message version: "+t;ne((e=await re(zd,this.fh,r)).get("version")==3),r+=G1,n=1}let i=e.get("name_size"),s=(await yt.unpack_from_async("<"+i.toFixed()+"s",this.fh,r))[0];var o;s=s.replace(/\x00$/,""),r+=oi(i,n);try{o=await new rd(this.fh,r).dtype}catch{return[s,null]}r+=oi(e.get("datatype_size"),n);let a=await this.determine_data_shape(this.fh,r),l=a.reduce((function(c,u){return c*u}),1);if(r+=oi(e.get("dataspace_size"),n),o.datatype_class===5)h=await this.fh.slice(r,r+o.size);else{var h=await this._attr_value(o,this.fh,l,r);a.length==0&&(h=h[0])}return[s,h]}async determine_data_shape(r,t){let e=(await yt.unpack_from_async("<B",r,t))[0];var n;if(e==1)ne((n=await re(va,r,t)).get("version")==1),t+=Vd;else{if(e!=2)throw"unknown dataspace message version";ne((n=await re(ya,r,t)).get("version")==2),t+=qd}let i=n.get("dimensionality");return await yt.unpack_from_async("<"+i.toFixed()+"Q",r,t)}async _attr_value(r,t,e,n){var i=new Array(e);if(r instanceof Array){let h=r[0];for(var s=0;s<e;s++)if(h=="VLEN_STRING"){let c=r[2];var[o,a]=await this._vlen_size_and_data(t,n);const u=new TextDecoder(c==0?"ascii":"utf-8");i[s]=u.decode(a),n+=16}else if(h=="REFERENCE"){var l=await yt.unpack_from_async("<Q",t,n);i[s]=l,n+=8}else{if(h!="VLEN_SEQUENCE")throw"NotImplementedError";{let c=r[1];var[o,a]=this._vlen_size_and_data(t,n);i[s]=this._attr_value(c,a,o,0),n+=16}}}else{let[h,c,u]=ms(r);const p=await t.slice(n,n+e*u);let d=new xn(p,0),w=0;for(s=0;s<e;s++)i[s]=d[h](w,!c,u),w+=u}return i}async _vlen_size_and_data(r,t){let e=(await yt.unpack_from_async("<I",r,t))[0],n=await re(Dd,r,t+4),i=n.get("collection_address");var s;return ne(n.get("collection_address")<Number.MAX_SAFE_INTEGER),i in this._global_heaps||(s=new Ed(this.fh,i),await s.ready,this._global_heaps[i]=s),[e,(s=this._global_heaps[i]).objects.get(n.get("object_index"))]}async _parse_v1_objects(r,t){let e=await re(Hd,r,t);ne(e.get("version")==1);let n=e.get("total_header_messages");for(var i=e.get("object_header_size"),s=t+se(Hd),o=await r.slice(s,s+i),a=[[s,i]],l=0,h=0,c=new Array(n),u=0;u<n;u++){h>=i&&([s,i]=a[++l],h=0);let w=await re(jd,r,s+h),m=s+h+Wd;if(w.set("offset_to_message",m),w.get("type")==Kd){var[p,d]=await yt.unpack_from_async("<QQ",r,m);a.push([p,d])}h+=Wd+w.get("size"),c[u]=w}return[c,o,e]}async _parse_v2_objects(r,t){var[e,n,i]=await this._parse_v2_header(r,t);t=i;for(var s=[],o=e.get("size_of_chunk_0"),a=r.slice(t,t+=o),l=[[i,o]],h=0,c=0;;){if(c>=o-_a){let m=l[++h];if(m==null)break;[i,o]=m,c=0}
830let d=await re($d,r,i+c),w=i+c+_a+n;if(d.set("offset_to_message",w),d.get("type")==Kd){var[u,p]=await yt.unpack_from_async("<QQ",r,w);l.push([u+4,p-4])}c+=_a+d.get("size")+n,s.push(d)}return[s,a,e]}async _parse_v2_header(r,t){let e=await re(Ud,r,t);var n;if(t+=se(Ud),ne(e.get("version")==2),n=4&e.get("flags")?2:0,ne(!(16&e.get("flags"))),32&e.get("flags")){let s=await yt.unpack_from_async("<4I",r,t);t+=16,e.set("access_time",s[0]),e.set("modification_time",s[1]),e.set("change_time",s[2]),e.set("birth_time",s[3])}let i=["<B","<H","<I","<Q"][3&e.get("flags")];return e.set("size_of_chunk_0",(await yt.unpack_from_async(i,r,t))[0]),[e,n,t+=yt.calcsize(i)]}async find_link(r){if(this._links){for(link of this._links)if(r===link[0])return link}else{const t=[];for await(const e of this.iter_links()){if(r===e[0])return e;t.push(e)}this._links=t}}async get_links(){const r=[];for await(const t of this.iter_links())r.push(t);return Object.fromEntries(r)}async*iter_links(){for(let r of this.msgs)r.get("type")==ow?yield*this._iter_links_from_symbol_tables(r):r.get("type")==nw?yield this._get_link_from_link_msg(r):r.get("type")==tw&&(yield*this._iter_link_from_link_info_msg(r))}async*_iter_links_from_symbol_tables(r){ne(r.get("size")==16);let t=await re(Z1,this.fh,r.get("offset_to_message"));yield*this._iter_links_btree_v1(t.get("btree_address"),t.get("heap_address"))}async*_iter_links_btree_v1(r,t){let e=new N1(this.fh,r);await e.ready;let n=new P1(this.fh,t);await n.ready;for(let i of e.symbol_table_addresses()){let s=new Ad(this.fh,i);await s.ready,s.assign_name(n),yield*Object.entries(s.get_links(n))}}async _get_link_from_link_msg(r){let t=r.get("offset_to_message");return await this._decode_link_msg(this.fh,t)[1]}async _decode_link_msg(r,t){let[e,n]=await yt.unpack_from_async("<BB",r,t);t+=2,ne(e==1);let i,s,o=2**(3&n),a=(16&n)>0,l=(4&n)>0;(8&n)>0?(i=(await yt.unpack_from_async("<B",r,t))[0],t+=1):i=0,ne([0,1].includes(i)),l&&(s=(await yt.unpack_from_async("<Q",r,t))[0],t+=8);let h=0;a&&(h=(await yt.unpack_from_async("<B",r,t))[0],t+=1);let c=h==0?"ascii":"utf-8",u=["<B","<H","<I","<Q"][3&n],p=(await yt.unpack_from_async(u,r,t))[0];t+=o;let d,w=new TextDecoder(c).decode(await r.slice(t,t+p));if(t+=p,i==0)d=(await yt.unpack_from_async("<Q",r,t))[0];else if(i==1){let m=(await yt.unpack_from_async("<H",r,t))[0];t+=2,d=new TextDecoder(c).decode(await r.slice(t,t+m))}return[s,[w,d]]}async*_iter_link_from_link_info_msg(r){let t=r.get("offset_to_message"),e=await this._decode_link_info_msg(this.fh,t),n=e.get("heap_address"),i=e.get("name_btree_address"),s=e.get("order_btree_address");i!=null&&(yield*this._iter_links_btree_v2(i,s,n))}async*_iter_links_btree_v2(r,t,e){let n,i=new z1(this.fh,e);await i.ready;const s=t!=null;s?(n=new O1(this.fh,t),await n.ready):(n=new F1(this.fh,r),await n.ready);let o=new Map;for(let l of n.iter_records()){let h=i.get_data(l.get("heapid")),[c,u]=await this._decode_link_msg(h,0);const p=s?c:u[0];o.set(p,u)}let a=Array.from(o.keys()).sort();for(let l of a)yield o.get(l)}async _decode_link_info_msg(r,t){let[e,n]=await yt.unpack_from_async("<BB",r,t);ne(e==0),t+=2,(1&n)>0&&(t+=8);let i=(2&n)>0?X1:Q1,s=await re(i,r,t),o=new Map;for(let[a,l]of s.entries())o.set(a,l==wa?null:l);return o}get is_dataset(){return this.find_msg_type(Xd).length>0}async get_data(){let r=this.find_msg_type(Yd)[0].get("offset_to_message");var[t,e,n,i]=await this._get_data_message_properties(r);if(n==0)throw"Compact storage of DataObject not implemented";return n==1?this._get_contiguous_data(i):n==2?this._get_chunked_data(r):void 0}async _get_data_message_properties(r){let t,e,n,[i,s,o]=await yt.unpack_from_async("<BBB",this.fh,r);return i==1||i==2?(t=s,e=o,n=r,n+=yt.calcsize("<BBB"),n+=yt.calcsize("<BI"),ne(e==1||e==2)):i!=3&&i!=4||(e=s,n=r,n+=yt.calcsize("<BB")),ne(i>=1&&i<=4),[i,t,e,n]}async _get_contiguous_data(r){let[t]=await yt.unpack_from_async("<Q",this.fh,r);const e=await this.shape,n=await this.dtype;if(t==wa){let a=e.reduce((function(l,h){return l*h}),1);return new Array(a)}var i=e.reduce((function(a,l){return a*l}),1);if(n instanceof Array){let a=n[0];if(a=="REFERENCE"){if(n[1]!=8)throw"NotImplementedError('Unsupported Reference type')";return await this.fh.slice(t,t+i)}if(a=="VLEN_STRING"){let l=n[2];const h=new TextDecoder(l==0?"ascii":"utf-8");var s=[];for(o=0;o<i;o++){const[c,u]=await this._vlen_size_and_data(this.fh,t);s[o]=h.decode(u),t+=16}return s}throw"NotImplementedError('datatype not implemented')"}if(/[<>=!@\|]?(i|u|f|S)(\d*)/.test(n)){let[a,l,h]=ms(n),c=new Array(i);const u=await this.fh.slice(t,t+h*i);let p=new xn(u);for(var o=0;o<i;o++)c[o]=p[a](o*h,!l,h);return c}if(n.datatype_class===5)return this.fh.slice(t,t+n.size);throw"not Implemented - no proper dtype defined"}async _get_chunked_data(r){if(await this._get_chunk_params(),this._chunk_address==wa)return[];var t=new B1(this.fh,this._chunk_address,this._chunk_dims);await t.ready;const e=await this.dtype,n=await this.shape,i=await this.chunks,s=await this.get_filter_pipeline();let o=await t.construct_data_from_chunks(i,n,e,s);if(e instanceof Array&&/^VLEN/.test(e[0])){let h=e[0];for(var a=0;a<o.length;a++){let[c,u,p]=o[a];var l;u in this._global_heaps?l=this._global_heaps[u]:(l=new Ed(this.fh,u),await l.ready,this._global_heaps[u]=l);let d=l.objects.get(p);if(h=="VLEN_STRING"){let w=e[2];const m=new TextDecoder(w==0?"ascii":"utf-8");o[a]=m.decode(d)}}}return o}async _get_chunk_params(){if(!this._chunk_params_set){this._chunk_params_set=!0;var r=this.find_msg_type(Yd)[0].get("offset_to_message"),[t,e,n,i]=await this._get_data_message_properties(r);if(n==2){var s;if(t==1||t==2){var o=(await yt.unpack_from_async("<Q",this.fh,i))[0];s=i+yt.calcsize("<Q")}else if(t==3){var[e,o]=await yt.unpack_from_async("<BQ",this.fh,i);s=i+yt.calcsize("<BQ")}ne(t>=1&&t<=3);var a="<"+(e-1).toFixed()+"I",l=await yt.unpack_from_async(a,this.fh,s);this._chunks=l,this._chunk_dims=e,this._chunk_address=o}}}},wa=yt.unpack_from("<Q",new Uint8Array([255,255,255,255,255,255,255,255]).buffer),Dd=new Map([["collection_address","Q"],["object_index","I"]]);se(Dd);var Pd=new Map([["version","B"],["reserved","B"],["name_size","H"],["datatype_size","H"],["dataspace_size","H"]]),$1=se(Pd),zd=new Map([["version","B"],["flags","B"],["name_size","H"],["datatype_size","H"],["dataspace_size","H"],["character_set_encoding","B"]]),G1=se(zd),Hd=new Map([["version","B"],["reserved","B"],["total_header_messages","H"],["object_reference_count","I"],["object_header_size","I"],["padding","I"]]),Ud=new Map([["signature","4s"],["version","B"],["flags","B"]]),va=new Map([["version","B"],["dimensionality","B"],["flags","B"],["reserved_0","B"],["reserved_1","I"]]),Vd=se(va),ya=new Map([["version","B"],["dimensionality","B"],["flags","B"],["type","B"]]),qd=se(ya),jd=new Map([["type","H"],["size","H"],["flags","B"],["reserved","3s"]]),Wd=se(jd),$d=new Map([["type","B"],["size","H"],["flags","B"]]),_a=se($d),Z1=new Map([["btree_address","Q"],["heap_address","Q"]]),Q1=new Map([["heap_address","Q"],["name_btree_address","Q"]]),X1=new Map([["heap_address","Q"],["name_btree_address","Q"],["order_btree_address","Q"]]),Gd=new Map([["version","B"],["space_allocation_time","B"],["fillvalue_write_time","B"],["fillvalue_defined","B"]]),Y1=se(Gd),Zd=new Map([["version","B"],["flags","B"]]),K1=se(Zd),Qd=new Map([["filter_id","H"],["name_length","H"],["flags","H"],["client_data_values","H"]]),J1=se(Qd),Xd=1,tw=2,ew=3,rw=5,nw=6,Yd=8,iw=11,sw=12,Kd=16,ow=17,xa=class{constructor(r,t){t==null?(this.parent=this,this.file=this):(this.parent=t,this.file=t.file),this.name=r}async init(r){const t=this.file.index;t&&this.name in t?this._links=t[this.name]:this._links=await r.get_links(),this._dataobjects=r,this._attrs=null,this._keys=null}get keys(){return this._keys==null&&(this._keys=Object.keys(this._links)),this._keys.slice()}get values(){return this.keys.map((r=>this.get(r)))}length(){return this.keys.length}_dereference(r){if(!r)throw"cannot deference null reference";let t=this.file._get_object_by_address(r);if(t==null)throw"reference not found in file";return t}async get(r){if(typeof r=="number")return this._dereference(r);var t=Jd(r);if(t=="/")return this.file;if(t==".")return this;if(/^\//.test(t))return this.file.get(t.slice(1));if((function(l){let h="/",c=l.lastIndexOf(h)+1,u=l.slice(0,c),p=new RegExp("^"+h+"+$"),d=new RegExp(h+"$");return u&&!p.test(u)&&(u=u.replace(d,"")),u})(t)!="")var[e,n]=t.split(/\/(.*)/);else var e=t,n=".";if(!(e in this._links))throw e+" not found in group";var i=Jd(this.name+"/"+e);let s=this._links[e];if(typeof s=="string")try{return this.get(s)}catch{return null}var o=new ba(this.file._fh,s);if(await o.ready,o.is_dataset){if(n!=".")throw i+" is a dataset, not a group";return new lw(i,o,this)}var a=new xa(i,this);return await a.init(o),a.get(n)}visit(r){return this.visititems(((t,e)=>r(t)))}visititems(r){var t=this.name.length;/\/$/.test(this.name)||(t+=1);for(var e=this.values.slice();e;){let n=e.shift();e.length==1;let i=r(n.name.slice(t),n);if(i!=null)return i;n instanceof xa&&(e=e.concat(n.values))}return null}get attrs(){return this._attrs==null&&(this._attrs=this._dataobjects.get_attributes()),this._attrs}},aw=class extends xa{constructor(r,t,e){super("/",null),this.ready=this.init(r,t,e)}async init(r,t,e){var n=new D1(r,0);await n.ready;var i=await n.get_offset_to_dataobjects(),s=new ba(r,i);if(await s.ready,this.parent=this,this.file=this,this.name="/",this._dataobjects=s,this._attrs=null,this._keys=null,this._fh=r,this.filename=t||"",this.mode="r",this.userblock_size=0,e&&e.index)this.index=e.index;else{let o;if(e&&e.indexOffset)o=e.indexOffset;else{const a=await this.attrs;if(a.hasOwnProperty("_index_offset"))o=a._index_offset;else{const l=this.indexName||"_index",h=await s.find_link(l);h&&(o=h[1])}}if(o)try{const a=new ba(r,o);await a.ready;const l=await a.get_data(),h=I1(l),c=new TextDecoder().decode(h);this.index=JSON.parse(c)}catch{}}this.index&&this.name in this.index?this._links=this.index[this.name]:this._links=await s.get_links()}_get_object_by_address(r){return this._dataobjects.offset==r?this:this.visititems((t=>{t._dataobjects.offset}))}},lw=class extends Array{constructor(r,t,e){super(),this.parent=e,this.file=e.file,this.name=r,this._dataobjects=t,this._attrs=null,this._astype=null}get value(){var r=this._dataobjects.get_data();return this._astype==null?this.getValue(r):r.astype(this._astype)}get shape(){return this._dataobjects.shape}get attrs(){return this._dataobjects.get_attributes()}get dtype(){return this._dataobjects.dtype}get fillvalue(){return this._dataobjects.get_fillvalue()}async to_array(){return(function(r,t){const e=r.length,n=t.reduce(((o,a)=>o*a),1);let i=r;const s=t.slice(1).reverse();for(let o of s){const a=[],{length:l}=i;let h=0;for(;h<l;)a.push(i.slice(h,h+=o));i=a}return i})(await this.value,await this.shape)}async getValue(r){const t=await this.dtype;return(typeof t=="string"||t instanceof String)&&t.startsWith("S")?(await r).map((e=>{let n=e.indexOf("\0");return n>=0?e.substring(0,n):e})):r}};function Jd(r){return r.replace(/\/(\/)+/g,"/")}async function hw(r){var t;
830r.url&&typeof(t=r.url).slice=="function"&&typeof t.arrayBuffer=="function"&&(r.file=r.url,r.url=void 0);const e=r.url!==void 0;let n=r.reader?r.reader:(function(u){if(u.url)return new Yu(u);if(u.path)return new NodeLocalFile(u);if(u.file)return new Ku(u.file);throw Error("One of 'url', 'path (node only)', or 'file (browser only)' must be specified")})(r);const i=r.fetchSize||2e3,s=r.maxSize||2e5;e&&(n=new Zb({file:n,fetchSize:i,maxSize:s}));const o=new cw(n),a=await(async function(u){let p;if(u.indexReader)p=u.indexReader;else{if(u.index)return u.index;u.indexURL?p=new Yu({url:u.indexURL}):u.indexPath?p=new NodeLocalFile({path:u.indexPath}):u.indexFile&&(p=new Ku({file:u.indexFile}))}if(p){const d=await p.read(),w=new TextDecoder().decode(d);return JSON.parse(w)}})(r),l=r.indexOffset,h=(function(u){if(u.url)return tf(u.url);if(u.path)return tf(u.path);if(u.file)return u.file.name})(r),c=new aw(o,h,{index:a,indexOffset:l});return await c.ready,c}class cw{constructor(t){this.fileReader=t}async slice(t,e){return this.fileReader.read(t,e-t)}}function tf(r){const t=r.lastIndexOf("/");return t>0?r.substring(t+1):r}class uw{constructor(t,e=1e5){this.h5_file=t,this.bin_size=e,this.h5_obj=void 0}async fetch(){return this.h5_obj||(this.h5_obj=await hw({url:this.h5_file,fetchSize:1e6,maxSize:2e8})),this.h5_obj}async get_keys(){return(await this.fetch()).keys}async get_rd_signal(t=this.bin_size){let e=await this.fetch(),n=e.keys,i=new dw(n),s=i.get_rd_bins(),o=i.get_snp_bins();this.available_bins=[...new Set(s,o)],this.available_bins.includes(t)||(t=this.available_bins.at(-1));const a=await e.get("rd_chromosomes");await a.dtype;let l=await a.value,h=await this.rd_stat(e,n,t);var c=[],u=[],p=[],d=[],w=[],m=[];for(let _ of l){var g=`his_rd_p_${_}_${t}`;let A=await this.get_chr_signal(e,n,_,t,g,h);c=c.concat(A);var f=`his_rd_p_${_}_${t}_GC`;let S=await this.get_chr_signal(e,n,_,t,f,h);u=u.concat(S);let C=`his_rd_p_${_}_${t}_partition_GC_merge`,R=await this.get_chr_signal(e,n,_,t,C,h);p=p.concat(R);let x=await this.rd_call_combined(e,n,_,t,h);d=d.concat(x);let T=`snp_likelihood_${_}_${t}_mask`,y=await this.get_baf_signals(e,n,_,t,T);w=w.concat(y[0]),m=m.concat(y[1])}this.callers=[],d.length!=0&&this.callers.push("ReadDepth"),d.length!=0&&this.callers.push("2D");var b={},v={RD_Raw:c,RD_Raw_gc_coor:u,ReadDepth:p,"2D":d,BAF1:w,BAF2:m};return b[t]=v,b}decode_segments(t){let e=[],n=[];for(let i of t)i==4294967295?(e.push(n),n=[]):n.push(i);return e}async rd_call_combined(t,e,n,i,s){let o,a=[],l=`his_rd_p_${n}_${i}_partition_GC_mosaic_segments_2d`;if(e.includes(l)){let u=await(await t.get(l)).value;o=this.decode_segments(u)}let h=`his_rd_p_${n}_${i}_partition_GC_mosaic_call_2d`;if(e.includes(h)){let u=await(await t.get(h)).to_array();o.forEach(((p,d)=>{p.forEach(((w,m)=>{a.push({chr:n,start:w*i,end:(w+1)*i,value:u[0][d]/s[4]*2})}))}))}return a}async rd_stat(t,e,n){let i,s=`rd_stat_${n}_auto`;return e.includes(s)&&(i=await(await t.get(s)).value),i}async get_chr_signal(t,e,n,i,s,o){let a=[];return e.includes(s)&&(await(await t.get(s)).value).forEach(((h,c)=>{a.push({chr:n,start:c*i,end:(c+1)*i,value:h/o[4]*2})})),a}async get_baf_signals(t,e,n,i,s){let o=[],a=[];return e.includes(s)&&(await(await t.get(s)).to_array()).forEach(((h,c)=>{let u=Math.max(...h);const p=h.indexOf(u);let d=Math.max(p/200,1-p/200);o.push({chr:n,start:c*i,end:(c+1)*i,value:-2*d}),d!=.5&&a.push({chr:n,start:c*i,end:(c+1)*i,value:-2*(1-d)})})),[o,a]}async get_baf_signals_v2(t,e,n,i,s){let o=[],a=[];return e.includes(s)&&(await(await t.get(s)).to_array()).forEach(((h,c)=>{isNaN(h)||(o.push({chr:n,start:c*i,end:(c+1)*i,value:-2*(.5-h)}),h!=.5&&a.push({chr:n,start:c*i,end:(c+1)*i,value:-2*(.5+h)}))})),[o,a]}}class dw{constructor(t){this.signals=t}get_rd_bins(){let t=[];return this.signals.forEach((e=>{let n=e.match(/^his_rd_p_(.*)_(\d+)$/);n&&t.push({chr:n[1],bin_size:n[2]})})),[...new Set(t.map((e=>Number(e.bin_size))))]}get_snp_bins(){let t=[];return this.signals.forEach((e=>{let n=e.match(/^snp_likelihood_(.*)_(\d+)_mask$/);n&&t.push({chr:n[1],bin_size:n[2]})})),[...new Set(t.map((e=>Number(e.bin_size))))]}}function ef(r){let t=(function(s){if(s.length<4)return s;let o,a,l,h,c,u;return o=s.slice().sort(((p,d)=>p-d)),o.length/4%1==0?(a=.5*(o[o.length/4]+o[o.length/4+1]),l=.5*(o[o.length*.75]+o[o.length*.75+1])):(a=o[Math.floor(o.length/4+1)],l=o[Math.ceil(o.length*.75+1)]),h=l-a,c=l+1.5*h,u=a-1.5*h,o.filter((p=>p>=u&&p<=c))})(r);const e=t.length,n=t.reduce(((s,o)=>s+o))/e,i=Math.sqrt(t.map((s=>Math.pow(s-n,2))).reduce(((s,o)=>s+o))/e);return[n,i]}var lr={range_function:function(r,t,e){return Array(Math.ceil((t-r)/e)).fill(r).map(((n,i)=>n+i*e))},getDistParams:ef,linspace:function(r,t,e){if(e===void 0&&(e=Math.max(Math.round(t-r)+1,1)),e<2)return e===1?[r]:[];var n=Array(e);for(let i=--e;i>=0;i--)n[i]=(i*t+(e-i)*r)/e;return n},GetFit:class{constructor(r){this.allBins=r}getValues(){return Object.values(this.allBins).reduce(((r,t)=>r.concat(t.filter((e=>e.binScore>0)).map((e=>e.binScore)))),[])}getMean(r){return r.reduce((function(t,e){return t+e}))/r.length}fit_data(){return ef(this.getValues())}histogram(r,t){const e=t[1]-t[0],n=[];r.forEach(((s,o)=>{t.forEach(((a,l)=>{if(n[a]||(n[a]={count:0}),a<=s&&s<a+e)return n[a].count++,!1}))}));const i=[];
830return n.forEach(((s,o)=>{i.push(s.count)})),i}}};function ka(r,t){return isNaN(r)||isNaN(t)||t<=0?NaN:r===0?.5:.5+.5*(rf(.5*t,.5,1)-rf(.5*t,.5,t/(t+r*r)))*Math.sign(r)}function rf(r,t,e){if(e==0)return 0;if(e==1)return 1;{let n=Ca(r+t)-Ca(r)-Ca(t)+r*Math.log(e)+t*Math.log(1-e);return e<(r+1)/(r+t+2)?Math.exp(n)*nf(r,t,e)/r:1-Math.exp(n)*nf(t,r,1-e)/t}}function nf(r,t,e,n=1e3){let i=1,s=1,o=1,a=r+t,l=r+1,h=r-1,c=1-a*e/l;for(let u=0;u<=n;u++){let p=parseFloat(u+1),d=p+p,w=p*(t-p)*e/((h+d)*(r+d)),m=i+w*s,g=c+w*o;w=-(r+p)*(a+p)*e/((l+d)*(r+d));let f=g+w*c,b=i;if(s=m/f,o=g/f,i=(m+w*i)/f,c=1,Math.abs(i-b)<3e-7*Math.abs(i))return i}}function sf(r){return r==0||r==1?1:r*sf(r-1)}function of(r){let t;var e=[75122.633153,80916.6278952,36308.2951477,8687.24529705,1168.92649479,83.8676043424,2.50662827511],n=0,i=1;if(r==0)t=1e99;else if(r%1==0)t=sf(r-1);else{for(let s=0;s<e.length;s++)n+=e[s]*Math.pow(r,s),i*=r+s;t=n*Math.pow(r+5.5,r+.5)*Math.exp(-(r+5.5))/i}return t}function Ca(r){return Math.log(of(r))}var Sa={TdistributionCDF:ka,gamma:of,t_test_1_sample:function(r,t,e,n){e==0&&(e=1);var i=(r-t)/e*Math.sqrt(n);return 1-ka(Math.abs(i),n-1)},t_test_2_samples:function(r,t,e,n,i,s){t==0&&(t=1),i==0&&(i=1);var o=(r-n)/Math.sqrt(t**2/e+i**2/s),a=(t**2/e+i**2/s)**2*(e-1)*(s-1)/(t**4*(s-1)/e**2+i**4*(e-1)/s**2);return 1-ka(Math.abs(o),parseInt(a+.5))}};function af(r){return r.reduce((function(t,e){return t>e?t:e}))}function lf(r,t,e,n){return t*Math.exp(-1*(r-e)**2/(2*n**2))/Math.sqrt(2*Math.PI)/n}function ci(r,t,e,n){return Math.exp(-1*(r-e)**2/(t**2+n**2))}function ui(r,t){let e;try{e=r.reduce(((n,i,s)=>n+Math.min(i,t[s])))}catch{return 0}return e}function hf(r,t,e,n){return t==0&&n==0?{nl:.5*(r+e),ne:0}:{nl:(r*n*n+e*t*t)/(t*t+n*n),ne:Math.sqrt(t*t*n*n/(t*t+n*n))}}function cf(r,t){let e=parseInt(t*(r.length-1)),n=t*(r.length-1)-e;return e<r.length-1?r[e]*(1-n)+r[e+1]*n:r[e]}function fw(r){const t=r.length,e=Math.max(...r);let n=r.indexOf(e);n>Math.floor(t/2)&&(n=t-1-n);const i=(t/2-n)/(t+1),s=Math.floor((t/2+n)/2),o=t-1-s;let a=r.slice(s,o+1).reduce(((l,h)=>l+h),0)/r.reduce(((l,h)=>l+h),0);return n===Math.floor(t/2)&&(a=1),{mean:i,p:a}}var pw=class{constructor(r,t){this.wigFeatures=r,this.binSize=t}get_fit(){var r=new lr.GetFit(this.wigFeatures),[t,e]=r.fit_data();return{globalMean:t,globalStd:e}}async call_2d(r=null,t=null,e="both",n=.1,i=0,s=10,o=0){let a=this.get_fit();this.globalMean=a.globalMean,this.globalStd=a.globalStd;let l=r??.05*this.binSize/3e9,h=t??parseInt(this.binSize/1e4),c=[],u=[],p=[],d=[],w=[],m=[];for(const[_,A]of Object.entries(this.wigFeatures)){let S=[],C=[],R=[];A.forEach(((N,q)=>{N.hets_count>4&&N.dp_count>h&&(S.push([q]),C.push(N.binScore),R.push(N.likelihood_score),delete N.likelihood_score)}));let x=[];for(let N=1;N<C.length;N++)x.push(Math.abs(C[N]-C[N-1]));let T=[0];for(let N=1;N<x.length;N++)T.push(Math.min(x[N-1],x[N]));T.push(0);let y=C.map(((N,q)=>Math.sqrt(Math.sqrt(N)**2+this.globalStd**2+Math.pow(T[q]/2,2)))),E=[];for(let N=0;N<S.length-1;N++){let q=0;try{q=ui(R[N],R[N+1])}catch{}let H=ci(C[N],y[N],C[N+1],y[N+1]);E.push(H*q)}for(;E.length>0;){E=E.filter((k=>typeof k=="number"));let N=af(E);if(isNaN(N),N<l)break;let q,H,W=E.indexOf(N),U=hf(C[W],y[W],C[W+1],y[W+1]);try{q=R[W].map(((k,O)=>k*R[W+1][O])),H=q.reduce(((k,O)=>k+O))}catch{}if(C[W]=U.nl,y[W]=U.ne,R[W]=q.map((function(k){return k/H})),S[W].push(...S[W+1]),C.splice(W+1,1),y.splice(W+1,1),S.splice(W+1,1),R.splice(W+1,1),E.splice(W,1),W<E.length){let k=ci(C[W],y[W],C[W+1],y[W+1])*ui(R[W],R[W+1]);E[W]=k}if(W>0){let k=ci(C[W-1],y[W-1],C[W],y[W])*ui(R[W-1],R[W]);E[W-1]=k}}let L=-1;for(;;){E=[];for(let W=0;W<C.length;W++)for(let U=W;U<C.length;U++)S[U][0]-S[W].at(-1)<n*(S[W].length+S[U].length)&&E.push(ci(C[W],y[W],C[U],y[U])*ui(R[W],R[U]));if(E.length==0)break;let N=af(E);if(N<l)break;let q=0,H=1;for(;q<S.length-1;){let W=ci(C[q],y[q],C[H],y[H])*ui(R[q],R[H]);if(S[H][0]-S[q].at(-1)<n*(S[q].length+S[H].length)&&W==N){let U=hf(C[q],y[q],C[q+1],y[q+1]);C[q]=U.nl,y[q]=U.ne;let k=R[q].map(((z,B)=>z*R[q+1][B])),O=k.reduce(((z,B)=>z+B));R[q]=k.map((function(z){return z/O})),S[q].push(...S[q+1]),S[q]=S[q].sort(((z,B)=>
830z-B)),C.splice(H,1),y.splice(H,1),S.splice(H,1),R.splice(H,1),H>=S.length&&(q+=1,H=q+1)}else H+=1,H>=S.length&&(q+=1,H=q+1)}if(L==S.length)break;L=S.length}S.forEach(((N,q)=>{let H=fw(R[q]);N.length>1&&(N.forEach(((W,U)=>{u.push(A[W]),H.mean<=i&&c.push(A[W]),A[W].segment_score=C[q]})),p.push(C[q]),d.push(y[q]),w.push(R[q]))}))}let g=parseInt(1e3*(1-o));g==0&&(g=1);let f=lr.linspace(o,1,g),b={},v={};for(let _=10;_>-1;_--)for(let A=0;A<_/2+1;A++){let S,C,R=_-A,x=f.map(((y,E)=>1-y+y*_/2)),T=_/2;_>0?(S=.5-A/(A+R),C=f.map(((y,E)=>.5-(1-y+y*A)/(2-2*y+(A+R)*y)))):(S=0,C=f.map(((y,E)=>0*y)));for(let y=0;y<p.length;y++){let E=lf(T*this.globalMean,1,p[y],d[y])*cf(w[y],.5+S);y in v?v[y].push([_,A,R,E,1]):v[y]=[_,A,R,E,1];let L=0,N=0,q=0;x.forEach(((H,W)=>{if(!isNaN(C[W])){let U=lf(H*this.globalMean,1,p[y],d[y])*cf(w[y],.5+C[W]);L+=U,U>N&&(N=U,q=f[W])}})),y in b?b[y].push([_,A,R,L/f.length,q]):b[y]=[_,A,R,L/f.length,q]}for(let y=0;y<p.length;y++)if(e=="germline")b[y].sort(((E,L)=>E[3]-L[3]));else if(b[y].sort(((E,L)=>E[3]-L[3])),e=="both"&&(v[y].sort(((E,L)=>E[3]-L[3])),v[y][0][3]>b[y][0][3])){let E=b[y].filter((L=>L[0]!=v[y][0][0]&&L[1]<=v[y][0][1]));b[y]=[v[y][0]].push(...E)}for(let y=0;y<p.length;y++)b[y][0][0],b[y][0][0],this.globalMean,Sa.t_test_1_sample(this.globalMean,p[y],d[y],m[y])}return{binScore:this.formatDataStructure(this.wigFeatures,"binScore",this.globalMean),segment_score:this.formatDataStructure(this.wigFeatures,"segment_score",this.globalMean)}}formatDataStructure(r,t,e=1){const n=[];for(const[i,s]of Object.entries(r))s.forEach((o=>{var a={...o};e!=1&&(a.value=o[t]/e*2),n.push(a)}));return n}formatDataStructure_BAF(r,t=2){const e=[],n=[];for(const[i,s]of Object.entries(this.wigFeatures))s.forEach((o=>{var a={...o},l={...o};let h=o[r];h!=.5&&(l.value=-2*(1-h),n.push(l)),a.value=-2*h,e.push(a)}));return[e,n]}};function uf(r){for(var t=1,e=1,n=1*r,i=1;i<50;i++)t*=i,n+=(e*=-1)*Math.pow(r,2*i+1)/(t*(2*i+1));return 2*n/Math.sqrt(3.14159265358979)}function di(r,t,e,n,i){var s=new Ue(e.slice(n,i));return s.std==0&&(s.std=t>0?t*s.mean/r:1),Aa(r,s.mean,s.std,i-n)/(i-n)}function gw(r,t,e,n,i){var s=new Ue(e.slice(n,i));if(s.mean<r){var o=(s.max-s.mean)/(t*Math.sqrt(2));return Math.pow(.5*(1+uf(o)),i-n)}return o=(s.min-s.mean)/(t*Math.sqrt(2)),Math.pow(.5*(1-uf(o)),i-n)}function df(r,t,e,n,i,s,o=1e3){for(var a=di(r,t,e,n,i),l=0,h=!1;a>s&!h&l<o;){h=!0,l+=1;var[c,u,p,d]=[1e10,1e10,1e10,1e10];if(n>0&&(c=di(r,t,e,n-1,i)),i-n>2)var u=di(r,t,e,n+1,i),p=di(r,t,e,n,i-1);if(i<e.length)var d=di(r,t,e,n,i+1);Math.min[d]<a&&(h=!1,c==Math.min[d]&&(n-=1,a=c),elif(u==Math.min[d]),n+=1,a=u,elif(p==Math.min[d]),i-=1,a=p,elif(d==Math.min[d]),i+=1,a=d)}return a<=s?i:0}
830class Ue{constructor(t){this.data=t,this.mean=t.reduce(((e,n)=>e+n))/t.length,this.std=Math.sqrt(t.reduce(((e,n)=>(n-this.mean)**2))/t.length)}}function Aa(r,t,e,n){e==0&&(e=1);var i=(r-t)/e*Math.sqrt(n);return 1-Sa.TdistributionCDF(Math.abs(i),n-1)}function _s(r,t,e,n,i,s){t==0&&(t=1),i==0&&(i=1);var o=(r-n)/Math.sqrt(t**2/e+i**2/s),a=(t**2/e+i**2/s)**2*(e-1)*(s-1)/(t**4*(s-1)/e**2+i**4*(e-1)/s**2);return 1-Sa.TdistributionCDF(Math.abs(o),parseInt(a+.5))}var mw=class{constructor(r,t,e){this.rd=r,this.mean=t,this.std=e,this.bin_bands=[2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128]}get_rd_signal_bandwidth(r){var t=[];return r.forEach(((e,n)=>{var i=0;i=e>this.mean/4?this.mean/(this.std**2*e):4/this.std**2,t.push(i)})),t}meanShiftCaller(r=3){var t={};return Object.entries(this.rd).forEach((([e,n])=>{var i=new Array(n.length).fill(!1),s=new Array(n.length);for(let o=0;o<n.length;o++)i[o]||(s[o]=n[o]);this.bin_bands.forEach(((o,a)=>{var l=i.map(((U,k)=>!U)),h=[];Object.entries(n).forEach((([U,k])=>{h.push(k.binScore)}));var c=[0],u=0;for(let U=0;U<i.length;U++)i[U]?u>0&&(c.push(c[c.length-1]+u-1),u=0):u+=1;c.shift();for(let U=0;U<r;U++){var p=this.get_rd_signal_bandwidth(h),d=new Array(h.length).fill(0);for(let k=0;k<h.length;k++)for(let O=k-3*o;O<=k+3*o+1;O++)if(!(O<0||O>=h.length||Math.abs(k-O)>=h.length)){var w=(O-k)*Math.exp(-.5*(O-k)**2/o**2)*Math.exp(-.5*(h[k]-h[O])**2*p[k]);d[k]+=w}for(var m=new Array,g=0;g<d.length-1;g++)d[g]<0&d[g+1]>=0&&m.push(g);m.push(d.length-1),m=m.concat(c).sort(((k,O)=>k-O)),m=Array.from(new Set(m));var f=0;for(g=0;g<m.length;g++){var b=h.slice(f,m[g]+1),v=b.reduce(((k,O)=>k+O))/b.length;h.fill(v,f,m[g]+1),f=m[g]+1}}g=0;for(var _=0;g<s.length;g++)l[g]&&(s[g]=h[_],_++);for(m=new Array,g=0;g<s.length-1;g++)Math.abs(s[g+1]-s[g])>.01&&m.push(g+1);for(m.unshift(0),m.push(s.length),i=new Array(this.rd.length).fill(!1),g=1;g<m.length;g++){var A=[m[g-1],m[g]],S=[m[g-1],m[g-1]];if(!(g>1))continue;S[0]=m[g-2];var C=[m[g],m[g]];if(!(g<m.length-1))continue;C[1]=m[g+1];var R=A[1]-A[0],x=S[1]-S[0],T=C[1]-C[0];if(R<=1)continue;var y=new Ue(s.slice(A[0],A[1]));if(T<=15||x<=15||R<=15){var E=1.8*Math.sqrt(s[S[0]]/this.mean)*this.std;if(Math.abs(s[S[0]]-s[A[0]])<E||(E=1.8*Math.sqrt(s[C[0]]/this.mean)*this.std,Math.abs(s[C[0]]-s[A[0]])<E))continue}else{var L=s.slice(S[0],S[1]),N=new Ue(L),q=s.slice(C[0],C[1]),H=new Ue(q);if(_s(y.mean,y.std,y.data.length,N.mean,N.std,N.data.length)>.01/genome_size*bin_size*(R+x)||_s(y.mean,y.std,y.data.length,H.mean,H.std,H.data.length)>.01/genome_size*bin_size*(R+T))continue}if(Aa(this.mean,y.mean,y.std,y.data.length)>.05)continue;let U=h.slice(A[0],A[1]);var W=new Ue(U);i.fill(!0,A[0],A[1]),s.fill(W.mean,A[0],A[1])}})),t[e]=s})),t}call_mean_shift(r=3){for(var t=new Array(this.rd.length).fill(!1),e=new Array(this.rd.length),n=0;n<this.rd.length;n++)t[n]||(e[n]=this.rd[n]);return this.bin_bands.forEach(((i,s)=>{var o=t.map(((W,U)=>!W)),a=[];o.forEach(((W,U)=>{W&&a.push(this.rd[U])}));for(var l=[0],h=0,c=0;c<t.length;c++)t[c]?h>0&&(l.push(l[l.length-1]+h-1),h=0):h+=1;l.shift();for(var u=0;u<r;u++){var p=this.get_rd_signal_bandwidth(a),d=new Array(a.length).fill(0);for(c=0;c<a.length;c++)for(var w=c-3*i;w<=c+3*i+1;w++)if(!(w<0||w>=a.length||Math.abs(c-w)>=a.length)){var m=(w-c)*Math.exp(-.5*(w-c)**2/i**2)*Math.exp(-.5*(a[c]-a[w])**2*p[c]);d[c]+=m}var g=new Array;for(c=0;c<d.length-1;c++)d[c]<0&d[c+1]>=0&&g.push(c);g.push(d.length-1),g=g.concat(l).sort(((W,U)=>W-U)),g=Array.from(new Set(g));var f=0;for(c=0;c<g.length;c++){var b=a.slice(f,g[c]+1),v=b.reduce(((W,U)=>W+U))/b.length;a.fill(v,f,g[c]+1),f=g[c]+1}}for(c=0,w=0;c<e.length;c++)o[c]&&(e[c]=a[w],w++);for(g=new Array,c=0;c<e.length-1;c++)Math.abs(e[c+1]-e[c])>.01&&g.push(c+1);for(g.unshift(0),g.push(e.length),t=new Array(this.rd.length).fill(!1),c=1;c<g.length;c++){var _=[g[c-1],g[c]],A=[g[c-1],g[c-1]];if(c>1){A[0]=g[c-2];var S=[g[c],g[c]];if(c<g.length-1){S[1]=g[c+1];var C=_[1]-_[0],R=A[1]-A[0],x=S[1]-S[0];if(!(C<=1)){var T=new Ue(e.slice(_[0],_[1]));if(x<=15||R<=15||C<=15){var y=1.8*Math.sqrt(e[A[0]]/this.mean)*this.std;if(Math.abs(e[A[0]]-e[_[0]])<y||(y=1.8*Math.sqrt(e[S[0]]/this.mean)*this.std,Math.abs(e[S[0]]-e[_[0]])<y))continue}else{var E=e.slice(A[0],A[1]),L=new Ue(E),N=e.slice(S[0],S[1]),q=new Ue(N);if(_s(T.mean,T.std,T.data.length,L.mean,L.std,L.data.length)>3483106931382794e-24*(C+R)||_s(T.mean,T.std,T.data.length,q.mean,q.std,q.data.length)>3483106931382794e-24*(C+x))continue}if(!(Aa(this.mean,T.mean,T.std,T.data.length)>.05)){var H=new Ue(this.rd.slice(_[0],_[1]));t.fill(!0,_[0],_[1]),e.fill(H.mean,_[0],_[1])}}}}}})),e}cnv_calling(r=1e5){var t=(t=.25)*this.mean,e=this.mean-t,n=this.mean+t,i=2971e6,s=this.meanShiftCaller(),o={},a=[];
830return Object.entries(s).forEach((([l,h])=>{for(var c=!1;!c;){c=!0;var u=new Array(1).fill(0);for(let y=0;y<h.length-1;y++)Math.abs(h[y+1]-h[y])>.01&&u.push(y+1);u.push(h.length);for(let y=0;y<u.length-2;y++){var p=Math.abs(h[u[y]]-h[u[y+1]]);if(p<t){var d=p+1,w=p+1;if(y>0&&(d=Math.abs(h[u[y]]-h[u[y-1]])),y<u.length-3&&(w=Math.abs(s[u[y+1]]-h[u[y+2]])),p<d&&p<w){c=!1;var m=new Ue(h.slice(u[y],u[y+2]));h.fill(m.mean,u[y],u[y+2]),u.splice(y+1,y+1)}}}}var g=[];Object.entries(this.rd[l]).forEach((([y,E])=>{g.push(E.binScore)}));for(var f,b=new Array(h.length).fill(""),v=0,_=.05*r/i;v<h.length;){for(var A=v,S=v;v<h.length&h[v]<e;)v+=1;if((R=v)>S+1){var C=df(this.mean,this.std,g,S,R,_);if(C){var R=C;b.fill("D",S,R)}}for(S=v;v<h.length&h[v]>n;)v+=1;(R=v)>S+1&&(C=df(this.mean,this.std,g,S,R,_))&&(R=C,b.fill("A",S,R)),v==A&&(v+=1)}for(v=0;v<h.length;){for(;v<h.length&b[v]!="";)v+=1;for(S=v;v<h.length&h[v]<e;)v+=1;(R=v)>S+1&&(gw(this.mean,this.std,g,S,R)<1682935038707506e-26&&b.fill(["d"]*(R-S),S,R),v-=1),v+=1}(v=0)<h.length&&(f=b[v]),S=0;for(var x=[...g];v<h.length;){for(;b[v]==f&&!((v+=1)>=b.length););if(v>S){var T=new Ue(x.slice(S,v));x.fill(T.mean,S,v)}v<h.length&&(f=b[v]),S=v}for(o[l]=x,v=0;v<h.length;){if((f=b[v])==""){v+=1;continue}for(S=v;v<h.length&f==b[v];)v+=1;let y,E=new Ue(x.slice(S,v)).mean/this.mean;y=f=="D"?"deletion":"duplication";let L={chr:l,start:r*S+1,end:r*v,size:r*(v-S+1),value:2*E,event_type:y};a.push(L)}})),[o,a]}};class bw{constructor(t,e){this.allVariants=t,this.rowBinSize=1e4,this.binSize=e,this.binFactor=e/this.rowBinSize}async computeDepthFeatures(){const t=Object.keys(this.allVariants),e=[];for(let n of t){const i=this.allVariants[n];if(i.length===0)continue;const s=i[0];let o=0,a=0,l=s.start=s.start%this.binSize,h=l+this.binSize,c=0;for(let u of i){const p=u.start+1;c=Math.max(Math.floor((u.start-1)/this.binSize),0),p>h&&(a>0&&e.push({chr:n,start:l,end:h,value:o,bin:c,count:a}),o=0,l=u.start-u.start%this.binSize,h=l+this.binSize);const d=u.calls[9].info.DP;d&&(o+=Number.parseInt(d),a++)}a>0&&e.push({chr:n,start:l,end:h,value:o,bin:c,count:a})}return e}async computeReadDepth(){const t=Object.keys(this.allVariants);var e={};for(let a of t){const l=this.allVariants[a];var n;if(l.length!==0)for(let h of l){n=Math.max(Math.floor(h.start/this.rowBinSize),0),e[a]||(e[a]=[]),e[a][n]||(e[a][n]={chr:a,start:n*this.rowBinSize,end:(n+1)*this.rowBinSize,value:0,sum_score:0,count:0});const c=h.calls[9].info.DP;c&&(e[a][n].sum_score+=Number.parseInt(c),e[a][n].count++)}}var i={};for(let a of t){i[a]||(i[a]=[]);for(let l=0;l<e[a].length/this.binFactor;l++){const h=l;i[a][l]||(i[a][l]={chr:a,binScore:0,start:h*this.binSize,end:(h+1)*this.binSize});for(var s=10*l;s<10*l+10;s++)if(e[a][s]){var o=100*parseInt(e[a][s].sum_score/e[a][s].count);i[a][l].binScore+=o}}}return this.readDepthMeanshift(i)}readDepthMeanshift(t){var e=new lr.GetFit(t),[n,i]=e.fit_data(),s=new mw(t,n,i),o=s.meanShiftCaller(),a=s.cnv_calling();return Object.entries(t).forEach((([l,h])=>{h.forEach(((c,u)=>{c.partition_level=parseInt(o[l][u]),c.partition_call=parseInt(a[0][l][u])}))})),[this.formatDataStructure(t,"binScore",n),this.formatDataStructure(t,"partition_level",n),this.formatDataStructure(t,"partition_call",n),a[1]]}formatDataStructure(t,e,n=1){const i=[];for(const[s,o]of Object.entries(t))o.forEach((a=>{var l={...a};n!=1&&(l.value=a[e]/n*2),i.push(l)}));return i}async computeBAF_v2(){const t=Object.keys(this.allVariants),e={},n=[],i=[];for(let a of t){const l=this.allVariants[a];if(l.length===0)continue;var s;for(let c of l){if(s=Math.max(Math.floor(c.start/this.binSize),0),e[a]||(e[a]=[]),!e[a][s]){if(s>0){let g=s-1;if(e[a][g]){const f=this.get_max_min_score(e[a][g]);if(f.value!=.5){let b=Object.assign({},f);b.value=-2*(1-f.value),i.push(b)}f.value=-2*f.value,e[a][g]=f,n.push(e[a][g])}}e[a][s]={chr:a,start:s*this.binSize,end:(s+1)*this.binSize,value:0,count:0,likelihood_score:[],min_score:0}}const u=c.calls[9];let p=u.genotype,d=u.info.AD.split(","),w=d[0],m=d[1];if(p[0]==0&&p[1]==1||p[0]==1&&p[1]==0){if(e[a][s].likelihood_score.length==0)e[a][s].likelihood_score=lr.linspace(0,1,100).map(((g,f)=>xs(w,m,g)));else{var o=0;e[a][s].likelihood_score=lr.linspace(0,1,100).map(((g,f)=>{var b=e[a][s].likelihood_score[f]*xs(w,m,g);return o+=b,b})),e[a][s].likelihood_score=lr.linspace(0,1,100).map(((g,f)=>e[a][s].likelihood_score[f]/o))}e[a][s].count++}}const h=this.get_max_min_score(e[a][s]);if(h.value!=.5){let c=Object.assign({},h);c.value=-2*(1-h.value),i.push(c)}h.value=-2*h.value,e[a][s]=h,n.push(e[a][s])}return[n,i]}format_BAF_likelihood(t){const e=[];for(const[n,i]of Object.entries(t))i.forEach((s=>{var o={...s};s.value!=.5&&(o.value=1-s.value,e.push(o))}));return e}get_max_min_score(t){if(t.likelihood_score.length>0){const e=Math.max(...t.likelihood_score),n=t.likelihood_score.indexOf(e);t.value=Math.max(n/100,1-n/100),t.min_score=Math.min(n/100,1-n/100)}else t.score=0;return t}async getAllbins(){const t=await this.computeDepthFeatures();return new lr.GetFit(t).fit_data(),t}async read_rd_baf(t="ReadDepth"){const e=Object.keys(this.allVariants);var n={};for(let l of e){const h=this.allVariants[l];var i;if(h.length!==0)for(let c of h){i=Math.max(Math.floor(c.start/this.rowBinSize),0),n[l]||(n[l]=[]),n[l][i]||(n[l][i]={chr:l,start:i*this.rowBinSize,end:(i+1)*this.rowBinSize,dp_sum_score:0,dp_count:0,hets_count:0,hets:[]});const u=c.calls[9],p=u.info.DP;
830p&&(n[l][i].dp_sum_score+=Number.parseInt(p),n[l][i].dp_count++);let d=u.info.AD.split(","),w=u.genotype;if(w[0]==0&&w[1]==1||w[0]==1&&w[1]==0){n[l][i].hets_count++;let m=parseInt(d[0]),g=parseInt(d[1]);n[l][i].hets.push({ref:m,alt:g})}}}var s,o=this.adjust_bin_size(n);if(t=="ReadDepth"){s=this.readDepthMeanshift(o);var a=this.formatDataStructure_BAF(o,"max_likelihood")}else if(t=="2D"){let l=new pw(o,this.binSize),h=await l.call_2d();s=[h.binScore,[],h.segment_score],a=l.formatDataStructure_BAF("max_likelihood")}return[s,a]}formatDataStructure_BAF(t,e,n=2){const i=[],s=[];for(const[o,a]of Object.entries(t))a.forEach((l=>{delete l.likelihood_score;var h={...l},c={...l};let u=l[e];u!=.5&&(c.value=-2*(1-u),s.push(c)),h.value=-2*u,i.push(h)}));return[i,s]}adjust_bin_size(t){const e=Object.keys(this.allVariants);var n={};for(let o of e){n[o]||(n[o]=[]);for(let a=0;a<t[o].length/this.binFactor;a++){const l=a;n[o][a]||(n[o][a]={chr:o,start:l*this.binSize,end:(l+1)*this.binSize,dp_count:0,hets_count:0,binScore:0,likelihood_score:[]});for(var i=10*a;i<10*a+10;i++)if(t[o][i]){var s=100*parseInt(t[o][i].dp_sum_score/t[o][i].dp_count);n[o][a].binScore+=s,n[o][a].dp_count+=t[o][i].dp_count,n[o][a].hets_count+=t[o][i].hets_count,t[o][i].hets.length!=0&&t[o][i].hets.forEach(((c,u)=>{if(n[o][a].likelihood_score.length==0)n[o][a].likelihood_score=lr.linspace(0,1,100).map(((d,w)=>xs(c.ref,c.alt,d)));else{var p=0;n[o][a].likelihood_score=lr.linspace(0,1,100).map(((d,w)=>{var m=n[o][a].likelihood_score[w]*xs(c.ref,c.alt,d);return p+=m,m})),n[o][a].likelihood_score=lr.linspace(0,1,100).map(((d,w)=>n[o][a].likelihood_score[w]/p))}}))}const h=this.get_max_min_score(n[o][a]);n[o][a].max_likelihood=h.value}}return n}}function xs(r,t,e,n=!0){return e**r*(1-e)**t+e**t*(1-e)**r}class ww extends Se{constructor(t,e){super(t,e),this.featureType="numeric",this.paintAxis=gn,t.max||(this.defaultScale=!0,this.autoscale=!1),this.height=t.height!==void 0?t.height:250}async init(t){this.type="cnvpytor",this.graphType=t.graphType||"points",this.bin_size=t.bin_size||1e5,this.signal_name=t.signal_name||"rd_snp",this.cnv_caller=t.cnv_caller||"2D",this.colors=t.colors||["gray","black","green","blue"],super.init(t)}get supportsWholeGenome(){return!0}get_signals(){let t=[];return this.signal_name=="rd_snp"?t=["RD_Raw","RD_Raw_gc_coor",this.cnv_caller,"BAF1","BAF2"]:this.signal_name=="rd"?t=["RD_Raw","RD_Raw_gc_coor",this.cnv_caller]:this.signal_name=="snp"?t=["BAF1","BAF2"]:this.signal_name=="cnh"&&(t=[this.cnv_caller]),t}get_signal_colors(){return[{singal_name:"RD_Raw",color:this.colors[0]},{singal_name:"RD_Raw_gc_coor",color:this.colors[1]},{singal_name:"ReadDepth",color:this.colors[2]},{singal_name:"2D",color:this.colors[2]},{singal_name:"BAF1",color:this.colors[3]},{singal_name:"BAF2",color:this.colors[3]}]}async postInit(){if(this.config.format=="vcf"){this.featureSource=He(this.config,this.browser.genome),this.header=await this.getHeader();var t=this.featureSource.reader.features.reduce((function(a,l){return a[l.chr]=a[l.chr]||[],a[l.chr].push(l),a}),Object.create(null));const n=new bw(t,this.bin_size);let i,s,o;this.wigFeatures_obj={},this.wigFeatures_obj[this.bin_size]={},this.config.cnv_caller=="2D"?(o=await n.read_rd_baf("2D"),i=o[0],s=o[1],this.wigFeatures_obj[this.bin_size]["2D"]=i[2],this.available_callers=["2D"]):(o=await n.read_rd_baf(),i=o[0],s=o[1],this.wigFeatures_obj[this.bin_size].ReadDepth=i[2],this.available_callers=["ReadDepth"]),this.wigFeatures_obj[this.bin_size].RD_Raw=i[0],this.wigFeatures_obj[this.bin_size].RD_Raw_gc_coor=i[1],this.wigFeatures_obj[this.bin_size].BAF1=s[0],this.wigFeatures_obj[this.bin_size].BAF2=s[1],this.available_bins=[this.bin_size],this.set_available_callers()}else this.cnvpytor_obj=new uw(this.config.url,this.bin_size),this.wigFeatures_obj=await this.cnvpytor_obj.get_rd_signal(this.bin_size),this.available_bins=this.cnvpytor_obj.available_bins,this.available_callers=this.cnvpytor_obj.callers,this.set_available_callers();this.tracks=[];const e=[];this.signals=this.get_signals(),this.signal_colors=this.get_signal_colors();for(let n in this.wigFeatures_obj)for(const[i,s]of Object.entries(this.wigFeatures_obj[n])
830)if(this.signals.includes(i)){let o={type:"wig",isMergedTrack:!0};o.features=s,o.name=i,o.color=this.signal_colors.filter((l=>l.singal_name===i)).map((l=>l.color));const a=await this.browser.createTrack(o);a&&(a.autoscale=!1,this.tracks.push(a)),typeof a.postInit=="function"&&e.push(a.postInit())}this.flipAxis=!!this.config.flipAxis&&this.config.flipAxis,this.logScale=!!this.config.logScale&&this.config.logScale,this.autoscale=this.config.autoscale,this.autoscale||(this.dataRange={min:this.config.min||0,max:this.config.max});for(let n of this.tracks)n.autoscale=!1,n.dataRange=this.dataRange;return Promise.all(e)}set_available_callers(){this.available_callers.includes(this.cnv_caller)||(this.available_callers.length>0?this.cnv_caller=this.available_callers[0]:this.cnv_caller=null)}async getHeader(){if(!this.header){if(typeof this.featureSource.getHeader=="function"){const t=await this.featureSource.getHeader();t&&(this.callSets=t.callSets||[]),this.header=t}this.sampleNames=this.callSets?this.callSets.map((t=>t.name)):[]}return this.header}get height(){return this._height}set height(t){if(this._height=t,this.tracks)for(let e of this.tracks)e.height=t,e.config.height=t}menuItemList(){let t=[];this.flipAxis!==void 0&&t.push({label:"Flip y-axis",click:()=>{this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}}),t=t.concat(Xe.numericDataMenuItems(this.trackView)),t.push("<hr/>"),t.push("Bin Sizes");for(let n of this.available_bins){const i=ce(n,n===this.bin_size);t.push({object:pt(i),click:async()=>{this.bin_size=n,await this.recreate_tracks(n),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}})}t.push("<hr/>"),t.push("Signal Type");let e={rd_snp:"RD and BAF Likelihood",rd:"RD Signal",snp:"BAF Likelihood"};for(let n in e){const i=ce(e[n],n===this.signal_name);t.push({object:pt(i),click:async()=>{this.signal_name=n,await this.recreate_tracks(this.bin_size),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}})}t.push("<hr/>"),t.push("CNV caller");for(let n of this.available_callers){const i=ce(n,n===this.cnv_caller);t.push({object:pt(i),click:async()=>{this.cnv_caller=n,await this.recreate_tracks(this.bin_size),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}})}return t}async recreate_tracks(t){this.tracks=[];const e=[];t in this.wigFeatures_obj||(this.wigFeatures_obj={...this.wigFeatures_obj,...await this.cnvpytor_obj.get_rd_signal(t)}),this.signals=this.get_signals(),this.signal_colors=this.get_signal_colors();for(const[n,i]of Object.entries(this.wigFeatures_obj[t]))if(this.signals.includes(n)){let s={type:"wig",isMergedTrack:!0};s.features=i,s.name=n,s.color=this.signal_colors.filter((a=>a.singal_name===n)).map((a=>a.color));const o=await this.browser.createTrack(s);o&&(o.autoscale=!1,this.tracks.push(o)),typeof o.postInit=="function"&&e.push(o.postInit())}this.flipAxis=!!this.config.flipAxis&&this.config.flipAxis,this.logScale=!!this.config.logScale&&this.config.logScale,this.autoscale=this.config.autoscale,this.autoscale||(this.dataRange={min:this.config.min||0,max:this.config.max});for(let n of this.tracks)n.autoscale=!1,n.dataRange=this.dataRange;return Promise.all(e)}async getFeatures(t,e,n,i){if(this.tracks){const s=this.tracks.map((o=>o.getFeatures(t,e,n,i)));return Promise.all(s)}}getScaleFactor(t,e,n,i){return i?n/(Math.log10(e+1)-(t<=0?0:Math.log10(t+1))):n/(e-t)}computeYPixelValue(t,e){return(this.flipAxis?t-this.dataRange.min:this.dataRange.max-t)*e}computeYPixelValueInLogScale(t,e){let n=this.dataRange.max,i=this.dataRange.min;return n<=0?0:(i<=-1&&(i=0),i=i<=0?0:Math.log10(i+1),n=Math.log10(n+1),t=Math.log10(t+1),(this.flipAxis?t-i:n-t)*e)}draw(t){const e=t.features;if(!e)return;if(this.defaultScale&&(this.signal_name=="rd_snp"?this.dataRange={min:this.config.min||this.dataRange.min||-2,max:this.config.max||this.dataRange.max||6}:this.signal_name=="rd"?this.dataRange={min:this.config.min||this.dataRange.min||0,max:this.config.max||this.dataRange.max||6}:this.signal_name=="snp"&&(this.dataRange={min:this.config.min||this.dataRange.min||-2,max:this.config.max||this.dataRange.max||0})),this.autoscale&&(this.dataRange=(function(s,o){let a=0,l=-Number.MAX_VALUE;for(let h of o)for(let c of h)c.value===void 0||Number.isNaN(c.value)||(a=Math.min(a,c.value),l=Math.max(l,c.value));return{min:a,max:l}})(t.referenceFrame.chr,e)),this.tracks)for(let s=0,o=this.tracks.length;s<o;s++){const a=Object.assign({},t);a.features=e[s],this.tracks[s].dataRange=this.dataRange,this.tracks[s].flipAxis=this.flipAxis,this.tracks[s].logScale=this.logScale,this.graphType&&(this.tracks[s].graphType=this.graphType),this.tracks[s].draw(a)}const n=this.getScaleFactor(this.dataRange.min,this.dataRange.max,t.pixelHeight,this.logScale),i=s=>this.logScale?this.computeYPixelValueInLogScale(s,n):this.computeYPixelValue(s,n);if(this.config.hasOwnProperty("guideLines")){for(let s of this.config.guideLines)if(s.hasOwnProperty("color")&&s.hasOwnProperty("y")&&s.hasOwnProperty("dotted")){let o=i(s.y),a={strokeStyle:s.color,strokeWidth:1};s.dotted?at.dashedLine(t.context,0,o,t.pixelWidth,o,5,a):at.strokeLine(t.context,0,o,t.pixelWidth,o,a)}}}popupData(t,e){const n=e||t.viewport.cachedFeatures;if(n&&n.length===this.tracks.length){const i=[];for(let s=0;s<this.tracks.length;s++){s>0&&i.push("<hr/>"),i.push(`<div style=background-color:rgb(245,245,245);border-bottom-style:dashed;border-bottom-width:1px;padding-bottom:5px;padding-top:10px;font-weight:bold;font-size:larger >${this.tracks[s].name}</div>`);const o=this.tracks[s].popupData(t,n[s]);i.push(...o)}return i}}}const Ea=new Map([["ideogram",(r,t)=>new Qu(r,t)],["sequence",(r,t)=>new uc(r,t)],["feature",(r,t)=>new ra(r,t)],["seg",(r,t)=>new la(r,t)],["mut",(r,t)=>new la(r,t)],["maf",(r,t)=>new la(r,t)],["wig",(r,t)=>
830new Uu(r,t)],["merged",(r,t)=>new Nb(r,t)],["alignment",(r,t)=>new Pu(r,t)],["interaction",(r,t)=>new ha(r,t)],["interact",(r,t)=>new ha(r,t)],["variant",(r,t)=>new Gu(r,t)],["eqtl",(r,t)=>new zb(r,t)],["gwas",(r,t)=>new Ub(r,t)],["arc",(r,t)=>new jb(r,t)],["gcnv",(r,t)=>new Vb(r,t)],["junction",(r,t)=>new Gb(r,t)],["blat",(r,t)=>new vb(r,t)],["cnvpytor",(r,t)=>new ww(r,t)]]);var vw=function(r,t){Ea.set(r,t)},yw=function(r,t,e){let n;switch(r){case"annotation":case"genes":case"fusionjuncspan":case"snp":n="feature";break;case"seg":case"maf":case"mut":n="seg";break;case"junctions":case"splicejunctions":n="junction";break;default:n=r}return Ea.has(n)?Ea.get(n)(t,e):void 0};class _w{constructor(t,e){const n=new DOMParser().parseFromString(t,"text/xml");this.processRootNode(n,e);const i=n.getElementsByTagName("Resource"),s=n.getElementsByTagName("Track"),o=s&&s.length>0,a=[];this.tracks=a;const l=new Map;Array.from(i).forEach((function(h,c){var u={url:h.getAttribute("path"),indexURL:h.getAttribute("index"),order:c};l.set(u.url,u),o||a.push(u)})),o&&Array.from(s).forEach((function(h){const c=h.getElementsByTagName("Track");if(c&&c.length>0){const u={type:"merged",tracks:[]};Ta(h,u),a.push(u),Array.from(c).forEach((function(p){p.processed=!0;const d=p.getAttribute("id"),w=l.get(d);w&&(u.tracks.push(w),Ta(p,w),w.autoscale=!1,u.height=w.height)}))}else if(!h.processed){const u=h.getAttribute("id"),p=l.get(u);p&&(a.push(p),Ta(h,p))}}))}processRootNode(t,e){const n=t.getElementsByTagName("Session");!n||n.length;const i=n.item(0),s=i.getAttribute("genome"),o=i.getAttribute("locus"),a=i.getAttribute("ucscID");e&&e.hasOwnProperty(s)?this.genome=s:(this.reference={fastaURL:s},a&&(this.reference.id=a)),o&&(this.locus=o)}}function Ta(r,t){t.name=r.getAttribute("name");const e=r.getAttribute("color");e&&(t.color="rgb("+e+")");const n=r.getAttribute("altColor");e&&(t.altColor="rgb("+n+")");const i=r.getAttribute("height");i&&(t.height=parseInt(i));const s=r.getAttribute("autoScale");s&&(t.autoscale=s==="true");const o=r.getAttribute("autoscaleGroup");o&&(t.autoscaleGroup=o);const a=r.getAttribute("windowFunction");a&&(t.windowFunction=a);const l=r.getAttribute("visibilityWindow")||r.getAttribute("featureVisibilityWindow");l&&(t.visibilityWindow=l);const h=r.getAttribute("indexed");h&&(t.indexed=h==="true");const c=r.getAttribute("normalize");c&&(t.normalize=c==="true");const u=r.getElementsByTagName("DataRange");if(u.length>0){const p=u.item(0);t.min=Number(p.getAttribute("minimum")),t.max=Number(p.getAttribute("maximum")),t.logScale=p.getAttribute("type")==="LOG"}}const xw=Fr;class kw{constructor(){this.attributes={},this.plinkLoaded=!1}async loadPlinkFile(t,e){e||(e={});var n=Ft(e);const i=await Ct.loadString(t,n);var s=xw(i);for(let a of s){var o=a.split(" ");this.attributes[o[1]]={familyId:o[0],fatherId:o[2],motherId:o[3],sex:o[4],phenotype:o[5]}}return this.plinkLoaded=!0,this}getAttributes(t){return this.attributes[t]}getAttributeNames(){return this.hasAttributes()?Object.keys(this.attributes[Object.keys(this.attributes)[0]]):[]}hasAttributes(){return Object.keys(this.attributes).length>0}}class ff{constructor(t,e){this.geneColors={},this.gene=null,this.snp=null,this.genesCount=0,t&&(this.gene=t.toUpperCase(),this.geneColors[this.gene]=Zt[this.genesCount++]),e&&(this.snp=e.toUpperCase())}addGene(t){this.geneColors[t.toUpperCase()]||(this.geneColors[t.toUpperCase()]=Zt[this.genesCount++])}colorForGene(t){return this.geneColors[t.toUpperCase()]}}var Zt=[];Zt.push("rgb(228,26,28)"),Zt.push("rgb(55,126,184)"),Zt.push("rgb(77,175,74)"),Zt.push("rgb(166,86,40)"),Zt.push("rgb(152,78,163)"),Zt.push("rgb(255,127,0)"),Zt.push("rgb(247,129,191)"),Zt.push("rgb(153,153,153)"),Zt.push("rgb(255,255,51)"),Zt.push("rgb(102, 194, 165"),Zt.push("rgb(252, 141, 98"),Zt.push("rgb(141, 160, 203"),Zt.push("rgb(231, 138, 195"),Zt.push("rgb(166, 216, 84"),Zt.push("rgb(255, 217, 47"),Zt.push("rgb(229, 196, 148"),Zt.push("rgb(179, 179, 179"),Zt.push("rgb( 141, 211, 199"),Zt.push("rgb(255, 255, 179"),Zt.push("rgb(190, 186, 218"),Zt.push("rgb(251, 128, 114"),Zt.push("rgb(128, 177, 211"),Zt.push("rgb(253, 180, 98"),Zt.push("rgb(179, 222, 105"),Zt.push("rgb(252, 205, 229"),Zt.push("rgb(217, 217, 217"),Zt.push("rgb(188, 128, 189"),Zt.push("rgb(204, 235, 197"),Zt.push("rgb(255, 237, 111");class pf{constructor(t,e,n,i,s){this.genome=t,this.chr=e,this.start=n,this.end=i,this.bpPerPixel=s,this.id=ut.guid()}extend(t){const e=Math.min(t.start,this.start),n=Math.max(t.end,this.end),i=(n-e)/(this.end-this.start);this.start=e,this.end=n,this.bpPerPixel*=i}calculateEnd(t){return this.start+this.bpPerPixel*t}calculateBPP(t,e){return(t-this.start)/e}set(t){this.chr=t.chr,this.start=t.start,this.bpPerPixel=t.bpPerPixel}toPixels(t){return t/this.bpPerPixel}toBP(t){return this.bpPerPixel*t}shiftPixels(t,e,n){const i=this.start,s=t*this.bpPerPixel;return this.start+=s,n&&this.clampStart(e),this.end=this.start+e*this.bpPerPixel,i!==this.start}clampStart(t){const e=this.genome.getChromosome(this.chr).bpStart||0;if(this.start=Math.max(e,this.start),t){const{bpLength:n}=this.genome.getChromosome(this.chr),i=n-t*this.bpPerPixel;this.start>i&&(this.start=i)}}async zoomWithScaleFactor(t,e,n,i){const s=i===void 0?this.start+this.toBP(n/2):i,{start:o,bpPerPixel:a}=this.start,{bpLength:l}=this.getChromosome(),h=e<1?t.minimumBases()/n:l/n;this.bpPerPixel=e<1?Math.max(this.bpPerPixel*e,h):Math.min(this.bpPerPixel*e,h);const c=this.bpPerPixel*n;this.start=s-.5*c,this.clampStart(n),this.end=this.start+c,(o!==this.start||a!==this.bpPerPixel)&&await t.updateViews(!0)}getChromosome(){return this.genome.getChromosome(this.chr)}getMultiLocusLabelBPLengthOnly(t){const e=" ",n=Math.floor(this.start)+1,i=Math.round(this.start+this.bpPerPixel*t);return`${e}${this.chr}${e}${ko(i-n)}${e}`}getMultiLocusLabelLocusOnly(t){const e=" ",{chr:n,start:i,end:s}=this.getPresentationLocusComponents(t);return`${e}${n}:${i}-${s}${e}`}getMultiLocusLabel(t){const e=" ",{chr:n,start:i,end:s}=this.getPresentationLocusComponents(t),o=Math.floor(this.start)+1;return`${e}${n}:${i}-${s}${e}${e}(${ko(Math.round(this.start+this.bpPerPixel*t)-o)})${e}`}getPresentationLocusComponents(t){if(this.chr==="all")return{chr:this.chr};{const e=Ot(Math.floor(this.start)+1),n=Ot(Math.round(this.start+this.bpPerPixel*t));return{chr:this.chr,start:e,end:n}}}getLocusString(){if(this.chr==="all")return"all";{const t=Ot(Math.floor(this.start)+1),e=Ot(Math.round(this.end));return`${this.chr}:${t}-${e}`}}description(t){}}
830const Cw={timeout:5e3,type:"plain",url:"https://igv.org/genomes/locus.php?genome=$GENOME$&name=$FEATURE$",coords:0,chromosomeField:"chromosome",startField:"start",endField:"end",geneField:"gene",snpField:"snp"};async function Sw(r,t){if(t===void 0||t.trim()==="")return;(t&&t.trim().toLowerCase()==="all"||t==="*")&&(t="all");const e=t.split(" ");let n=r.searchConfig||Cw,i=[];const s=async o=>{let a=(function(l,h){const c=h.split(" ");if(c.length>=3)try{const d=l.genome.getChromosomeName(c[0]),w=parseInt(c[1].replace(/,/g,""),10)-1,m=parseInt(c[2].replace(/,/g,""),10);if(!isNaN(w)&&!isNaN(m))return{chr:d,start:w,end:m}}catch{}const u=h.split(":"),p=u[0];if(p==="all"&&l.genome.getChromosome(p))return{chr:p,start:0,end:l.genome.getChromosome(p).bpLength};if(l.genome.getChromosome(p)!==void 0){const d={chr:l.genome.getChromosomeName(p),start:0,end:l.genome.getChromosome(p).bpLength};if(u.length>1){let w,m=u[1].split("-");if(m.length>2){if(!u[1].startsWith("-"))return;{const g=u[1].indexOf("-",1);g>0&&(m=[u[1].substring(0,g),u[1].substring(g+1)])}}if(w=m[0].replace(/,/g,""),isNaN(w))return;if(d.start=parseInt(w,10)-1,d.end=d.start+1,m.length===1&&(d.start-=20,d.end+=20),m.length===2){if(w=m[1].replace(/,/g,""),isNaN(w))return;if(d.end=parseInt(w,10),d.start<0&&!l.isSoftclipped()){const g=-d.start;d.start+=g,d.end+=g}}}return d}})(r,o);if(!a){const l=r.genome.featureDB.get(o.toUpperCase());l&&(a={chr:l.chr,start:l.start,end:l.end,gene:l.name,locusSearchString:t})}if(!a&&r.config&&r.config.search!==!1)try{a=await(async function(l,h,c){let u=c.url.replace("$FEATURE$",h.toUpperCase());u.indexOf("$GENOME$")>-1&&(u=u.replace("$GENOME$",l.genome.id?l.genome.id:"hg19"));const p=c.timeout?{timeout:c.timeout}:void 0,d=await Ct.loadString(u,p),w=(function(m,g,f){let b;if(b=f.type==="plain"?(function(v,_){const A=[],S=[];return Fr(_).forEach((function(C){C===""||A.push(C)})),A.forEach((function(C){var R,x,T,y,E=C.split(" ");E.length>=3&&(T=(x=E[1].split(":"))[1].split("-"),R=E[2].trim(),y={gene:E[0],chromosome:v.genome.getChromosomeName(x[0].trim()),start:parseInt(T[0].replace(/,/g,"")),end:parseInt(T[1].replace(/,/g,"")),type:R==="gtex"?"snp":"gene"},S.push(y))})),S})(m,g):JSON.parse(g),f.resultsField&&(b=b[f.resultsField]),b&&b.length!==0){const v=f.chromosomeField||"chromosome",_=f.startField||"start",A=f.endField||"end",S=f.coords||1;let C;C=Array.isArray(b)?b[0]:b,C.hasOwnProperty(v)&&C.hasOwnProperty(_);const R=C[v],x=m.genome.getChromosome(R);if(!x)return;const T=x.name;let y=C[_]-S,E=C[A];E===void 0&&(E=y+1);const L={chr:T,start:y,end:E},N=C.type?C.type:"gene";return f.geneField&&N==="gene"&&(L.gene=C[f.geneField]),f.snpField&&N==="snp"&&(L.snp=C[f.snpField]),L}})(l,d,c);return w&&(w.locusSearchString=h),w})(r,o,n)}catch{throw Error("Search service currently unavailable.")}return a};for(let o of e){const a=await s(o);a&&(a.locusSearchString=o,i.push(a))}if(i.length===0){const o=await s(t);o&&(o.locusSearchString=t,i.push(o))}return i.length===0?void 0:i}class Aw{constructor(t){this.browser=t}navbarDidResize(t){this.updateNavbar(this.createResponsiveClassSchedule(t))}updateNavbar(t){this.browser.$toggle_button_container.removeClass(),this.browser.$toggle_button_container.addClass(t.$toggle_button_container),pt(this.browser.zoomWidget.zoomContainer).removeClass(),pt(this.browser.zoomWidget.zoomContainer).addClass(t.zoomContainer)}createResponsiveClassSchedule(t){let e={};const n=this.browser.isMultiLocusWholeGenomeView()||this.browser.referenceFrameList&&be.isWholeGenomeView(this.browser.referenceFrameList[0].chr);return n?this.browser.windowSizePanel.hide():this.browser.windowSizePanel.show(),t>990?(e.$toggle_button_container="igv-navbar-toggle-button-container",e.zoomContainer="igv-zoom-widget"):t>860?(e.$toggle_button_container="igv-navbar-toggle-button-container",e.zoomContainer="igv-zoom-widget-900"):t>540?(e.$toggle_button_container="igv-navbar-toggle-button-container-750",e.zoomContainer="igv-zoom-widget-900"):(e.$toggle_button_container="igv-navbar-toggle-button-container-750",e.zoomContainer="igv-zoom-widget-900",this.browser.windowSizePanel.hide()),n&&(e.zoomContainer="igv-zoom-widget-hidden"),e}}const ks=function(r,t){this.container=ut.div({class:"igv-chromosome-select-widget-container"}),t.appendChild(this.container),this.select=document.createElement("select"),this.select.setAttribute("name","chromosome-select-widget"),this.container.appendChild(this.select),this.select.addEventListener("change",(()=>{this.select.blur(),this.select.value!==""&&r.search(this.select.value)})),this.showAllChromosomes=r.config.showAllChromosomes!==!1};ks.prototype.show=function(){this.container.style.display="flex"},ks.prototype.hide=function(){this.container.style.display="none"},ks.prototype.update=function(r){const t=this.showAllChromosomes?r.chromosomeNames.slice():r.wgChromosomeNames.slice();r.showWholeGenomeView()&&(t.unshift("all"),t.unshift("")),this.select.innerHTML="";for(let e of t){const n=document.createElement("option");n.setAttribute("value",e),n.innerText=e,this.select.appendChild(n)}};class Ew{constructor(t,e){this.container=ut.div({class:"igv-windowsize-panel-container"}),t.appendChild(this.container),e.on("locuschange",(n=>{this.updatePanel(n)})),this.browser=e}show(){this.container.style.display="block"}hide(){this.container.style.display="none"}updatePanel(t){const e=this.browser.calculateViewportWidth(this.browser.referenceFrameList.length);this.container.innerText=t.length===1?ko(Math.round(e*t[0].bpPerPixel)):""}}class Tw{constructor(t,e){this.browser=e,this.columnContainer=t,this.horizontalGuide=ut.div({class:"igv-cursor-guide-horizontal"}),t.appendChild(this.horizontalGuide),this.verticalGuide=ut.div({class:"igv-cursor-guide-vertical"}),t.appendChild(this.verticalGuide),this.addMouseHandler(e),this.setVisibility(e.config.showCursorGuide)}addMouseHandler(t){this.boundMouseMoveHandler=function(e){const{x:n,y:i}=ut.translateMouseCoordinates(e,this.columnContainer);this.horizontalGuide.style.top=`${i}px`;const s=(function(o,a){for(;o.parentElement;){if(o.parentElement.classList.contains(a))return o.parentElement;o=o.parentElement}})(document.elementFromPoint(e.clientX,e.clientY),"igv-viewport");if(s&&t.getRulerTrackView()){this.verticalGuide.style.left=`${n}px`;const o=t.root.querySelectorAll(".igv-column");let a;const l=s.parentElement;for(let c=0;c<o.length;c++)a===void 0&&l===o[c]&&(a=c);const h=t.getRulerTrackView().viewports[a].mouseMove(e);
830if(h){const{start:c,bp:u,end:p}=h,d=(u-c)/(p-c);this.customMouseHandler&&this.customMouseHandler({start:c,bp:u,end:p,interpolant:d})}}}.bind(this),this.columnContainer.addEventListener("mousemove",this.boundMouseMoveHandler)}removeMouseHandler(){this.columnContainer.removeEventListener("mousemove",this.boundMouseMoveHandler)}setVisibility(t){t===!0?this.show():this.hide()}show(){this.verticalGuide.style.display="block",this.horizontalGuide.style.display="block"}hide(){if(this.verticalGuide.style.display="none",this.horizontalGuide.style.display="none",this.browser.getRulerTrackView())for(let t of this.browser.getRulerTrackView().viewports)t.$tooltip.hide()}}class Mw{constructor(t,e){this.browser=t,this.button=ut.div({class:"igv-navbar-button"}),e.appendChild(this.button),this.button.textContent="cursor guide",this.button.addEventListener("click",(()=>{t.cursorGuideVisible=!t.cursorGuideVisible,t.setCursorGuideVisibility(t.cursorGuideVisible),this.setButtonState(t.cursorGuideVisible)})),this.setButtonState(t.cursorGuideVisible),t.config.showCursorTrackingGuideButton?this.show():this.hide()}setButtonState(t){t===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}show(){this.button.style.display="block",this.setButtonState(this.browser.cursorGuideVisible)}hide(){this.button.style.display="none"}}class Rw{constructor(t,e){this.browser=t,this.button=ut.div({class:"igv-navbar-button"}),e.appendChild(this.button),this.button.textContent="center line",this.button.addEventListener("click",(()=>{t.isCenterLineVisible=!t.isCenterLineVisible,t.setCenterLineVisibility(t.isCenterLineVisible),this.setButtonState(t.isCenterLineVisible)})),this.setButtonState(t.isCenterLineVisible),t.config.showCenterGuideButton?this.show():this.hide()}setButtonState(t){t===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}show(){this.isVisible=!0,this.button.style.display="block",this.setButtonState(this.browser.isCenterLineVisible)}hide(){this.isVisible=!1,this.button.style.display="none"}}class Lw{constructor(t,e){this.button=ut.div({class:"igv-navbar-button"}),t.appendChild(this.button),this.button.textContent="track labels",this.button.addEventListener("click",(()=>{e.trackLabelsVisible=!e.trackLabelsVisible,this.setState(e.trackLabelsVisible),e.setTrackLabelVisibility(e.trackLabelsVisible)})),this.browser=e,this.setVisibility(e.config.showTrackLabelButton),this.setState(e.trackLabelsVisible)}setVisibility(t){t===!0?this.show():this.hide()}setState(t){t===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}show(){this.button.style.display="block",this.setState(this.browser.trackLabelsVisible)}hide(){this.button.style.display="none"}}class Iw{constructor(t,e){this.button=ut.div({class:"igv-navbar-button"}),t.appendChild(this.button),this.button.innerText="Sample Names",this.setState(e.showSampleNames),this.setVisibility(e.showSampleNameButton),this.button.addEventListener("click",(()=>{e.showSampleNames=!e.showSampleNames,this.setState(e.showSampleNames);for(let{sampleNameViewport:n}of e.trackViews)e.showSampleNames===!1?n.hide():n.show();e.layoutChange()}))}setVisibility(t){t===!0?this.show():this.hide()}setState(t){t===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}hide(){this.button.style.display="none"}show(){this.button.style.display="block"}}let Ma=23,gf=0;const Tr=function(r,t){this.browser=r,this.zoomContainer=ut.div({class:"igv-zoom-widget"}),t.appendChild(this.zoomContainer),this.zoomOutButton=ut.div(),this.zoomContainer.appendChild(this.zoomOutButton),this.zoomOutButton.appendChild(Nr.createIcon("minus-circle")),this.zoomOutButton.addEventListener("click",(()=>{r.zoomOut()}));const e=ut.div();this.zoomContainer.appendChild(e),this.slider=document.createElement("input"),this.slider.type="range",this.slider.min="0",this.slider.max=`${Ma}`,e.appendChild(this.slider),this.slider.addEventListener("change",(n=>{n.preventDefault(),n.stopPropagation();const i=r.referenceFrameList[0],{bpLength:s}=i.genome.getChromosome(i.chr),{end:o,start:a}=i,l=o-a,h=s/Math.pow(2,n.target.valueAsNumber);r.zoomWithScaleFactor(h/l)}
830)),this.zoomInButton=ut.div(),this.zoomContainer.appendChild(this.zoomInButton),this.zoomInButton.appendChild(Nr.createIcon("plus-circle")),this.zoomInButton.addEventListener("click",(()=>{r.zoomIn()})),r.on("locuschange",(n=>{this.browser.isMultiLocusMode()?this.disable():(this.enable(),this.update(n))}))};Tr.prototype.update=function(r){const t=r[0],{bpLength:e}=t.genome.getChromosome(t.chr),{start:n,end:i}=t;Ma=Math.ceil(Math.log2(e/this.browser.minimumBases())),this.slider.max=`${Ma}`;const s=e/(i-n);gf=Math.log2(s),this.slider.value=`${Math.round(gf)}`},Tr.prototype.enable=function(){this.slider.disabled=!1},Tr.prototype.disable=function(){this.slider.disabled=!0},Tr.prototype.hide=function(){this.zoomContainer.style.display="none"},Tr.prototype.show=function(){this.zoomContainer.style.display="block"},Tr.prototype.hideSlider=function(){this.slider.style.display="none"},Tr.prototype.showSlider=function(){this.slider.style.display="block"};const Nw=function(r,t){const e=ut.div({class:"igv-navbar-button"});r.append(e),e.textContent="Save SVG",e.addEventListener("click",(()=>t.saveSVGtoFile({})))},Bw=(r,t)=>{const e=r===0?t.nextElementSibling:t.previousElementSibling;t.remove(),e.remove()},Fw=r=>{const t=ut.div({class:"igv-column-shim"});tc(t,r);const e=ut.div({class:"igv-column"});return tc(e,t),e},Ow=(r,t)=>{for(let e=0;e<t;e++){const n=ut.div({class:"igv-column"});Jh(n,r),t>1&&e>0&&Jh(ut.div({class:"igv-column-shim"}),n)}};class Dw{constructor(t,e,n){this.browser=t,this.referenceFrame=e,this.column=n,this.container=ut.div({class:"igv-center-line"}),n.appendChild(this.container),t.isCenterLineVisible?this.show():this.hide()}repaint(){if(this.referenceFrame)if(1/this.referenceFrame.bpPerPixel>1){const t=Math.floor(this.referenceFrame.toPixels(1));this.container.style.width=`${t}px`,this.container.classList.remove("igv-center-line-thin"),this.container.classList.add("igv-center-line-wide")}else this.container.style.width="1px",this.container.classList.remove("igv-center-line-wide"),this.container.classList.add("igv-center-line-thin")}show(){this.isVisible=!0,this.container.style.display="block",this.repaint()}hide(){this.isVisible=!1,this.container.style.display="none"}resize(){this.repaint()}}const Tv=Ot;class Pw{constructor(t){this.browser=t,this.height=40,this.name="",this.id="ruler",this.disableButtons=!0,this.ignoreTrackMenu=!0,this.order=.01*Number.MIN_SAFE_INTEGER,this.removable=!1,this.type="ruler"}async getFeatures(t,e,n){return[]}computePixelHeight(t){return this.height}draw({context:t,referenceFrame:e,pixelWidth:n,pixelHeight:i,bpPerPixel:s,bpStart:o}){be.isWholeGenomeView(e.chr)?this.drawWholeGenome({context:t,pixelWidth:n,pixelHeight:i,bpPerPixel:s}):this.doDraw({context:t,referenceFrame:e,pixelWidth:n,pixelHeight:i,bpStart:o})}drawWholeGenome({context:t,pixelWidth:e,pixelHeight:n,bpPerPixel:i}){t.save(),at.fillRect(t,0,0,e,n,{fillStyle:"white"});for(let s of this.browser.genome.wgChromosomeNames){let o=this.browser.genome.getCumulativeOffset(s),a=this.browser.genome.getChromosome(s).bpLength,l=Math.round(o/i),h=Math.round(a/i);this.renderChromosomeRect(t,l,0,h,n,s)}t.restore()}doDraw({context:t,referenceFrame:e,pixelWidth:n,pixelHeight:i,bpStart:s}){t.clearRect(0,0,n,i);const o=(function(w,m){if(w<10)return new mf(1,"bp",1);const g=Math.floor(Math.log10(w));let f="bp",b=1;g>9?(f="gb",b=1e9):g>6?(f="mb",b=1e6):g>3&&(f="kb",b=1e3);const v=Math.pow(10,g-1),_=w/v,A=75,S=Math.pow(10,g-1),C=Math.pow(10,g)/2;return new mf(_<A&&m!==!0?S:C,f,b)})(Math.floor(e.toBP(n)),t.isSVG);let a=Math.floor(s/o.majorTick)-1;const{tickDelta:l,labelLength:h}=(function(w,m,g,f,b){const v=C(m,S(1+f,b),g)-C(m,S(f,b),g),_=`${Ot(Math.floor(S(f,b)/b.unitMultiplier))} ${b.majorUnit}`,A=Math.floor(w.measureText(_).width);return{tickDelta:v,labelLength:A};function S(R,x){return Math.floor(R*x.majorTick)}function C(R,x,T){return Math.round(R.toPixels(x-1-T+.5))}})(t,e,s,a,o);let c,u;this.browser.referenceFrameList.indexOf(e);let p=l;const d=.25*h;do{u=Math.floor(a*o.majorTick);const w=`${Ot(Math.floor(u/o.unitMultiplier))} ${o.majorUnit}`;c=Math.round(e.toPixels(u-1-s+.5));const m=Math.round(c-t.measureText(w).width/2);m>
8300&&d+h<=p&&(at.fillText(t,w,m,this.height-8),p=0),c>0&&at.strokeLine(t,c,this.height-6,c,this.height-2),u=Math.floor((1+a)*o.majorTick);let g=c+(Math.round(e.toPixels(u-1-s+.5))-c)/2;g>0&&at.strokeLine(t,g,this.height-6,g,this.height-2),++a,p+=l}while(c<n);at.strokeLine(t,0,this.height-2,n,this.height-2)}renderChromosomeRect(t,e,n,i,s,o){t.textAlign="center",t.textBaseline="middle",t.font="12px sans-serif",at.strokeLine(t,e+i,n,e+i,n+s,{strokeStyle:qt.greyScale(191)});const a=o.startsWith("chr")?o.substring(3):o;i>t.measureText(a).width&&at.fillText(t,a,e+i/2,n+s/2,{fillStyle:qt.greyScale(68)})}get supportsWholeGenome(){return!0}dispose(){}}class mf{constructor(t,e,n){this.majorTick=t,this.minorTick=t/10,this.majorUnit=e,this.unitMultiplier=n}description(t){}}const fi=function(r,t){this.button=ut.div({class:"igv-navbar-button"}),r.appendChild(this.button),this.button.textContent="circular view",this.button.addEventListener("click",(()=>{t.circularViewVisible=!t.circularViewVisible})),this.browser=t,this.setVisibility(t.config.showCircularViewButton),this.setState(t.circularViewVisible)};fi.prototype.setVisibility=function(r){r===!0?this.show():this.hide()},fi.prototype.setState=function(r){r===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")},fi.prototype.show=function(){this.button.style.display="block",this.setState(this.browser.circularViewVisible)},fi.prototype.hide=function(){this.button.style.display="none"};const zw=function(r,t,e){const n=ut.div({class:"igv-navbar-button"});r.append(n),n.textContent=e.label,n.addEventListener("click",(()=>e.callback(t)))};class bf{constructor(t,e,n,i,s){this.browser=t,this.roiMenu=e,this.roiTable=n,this.top=i,this.roiSets=s||[],this.boundLocusChangeHandler=Hw.bind(this),t.on("locuschange",this.boundLocusChangeHandler)}async initialize(){this.roiSets.length>0&&(this.browser.showROITableButton=!0,this.browser.roiTableControl.setVisibility(this.browser.showROITableButton));const t=this.roiSets.map((n=>this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:n})));t.length>0&&await Promise.all(t);const e=await this.getTableRecords();this.roiTable.renderTable(e)}async loadROI(t,e){const n=Array.isArray(t)?t:[t];for(let i of n)this.roiSets.push(new Vo(i,e));await this.initialize()}clearROIs(){this.roiTable.clearTable();const t=this.browser.columnContainer.querySelectorAll(".igv-roi-region");for(let e of t)e.remove();for(let e of this.roiSets)e.dispose();this.roiSets=[]}async getTableRecords(){const t=[];for(let e of this.roiSets){const n=e.isUserDefined?"":e.name||"",i=await e.getAllFeatures();for(let s of Object.keys(i))for(let o of i[s])t.push({setName:n,feature:o})}return t}presentTable(){this.roiTable.present()}async repaintTable(){const t=await this.getTableRecords();this.roiTable.renderTable(t)}dismissTable(){this.roiTable.dismiss()}async updateUserDefinedROISet(t){let e=await this.getUserDefinedROISet();e===void 0&&(e=this.initializeUserDefinedROISet()),e.addFeature(t),this.browser.showROITableButton===!1&&this.setROITableButtonVisibility(!0),await this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:e});const n=await this.getTableRecords();this.roiTable.renderTable(n)}setROITableButtonVisibility(t){this.browser.showROITableButton=t,this.browser.roiTableControl.setVisibility(this.browser.showROITableButton)}async renderAllROISets(){for(let t of this.roiSets)await this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:t})}async renderROISet({browser:t,pixelTop:e,roiSet:n}){const i=t.columnContainer.querySelectorAll(".igv-column");for(let s=0;s<i.length;s++){let{chr:o,start:a,end:l,bpPerPixel:h}=t.referenceFrameList[s];const c=i[s].querySelectorAll(".igv-roi-region");for(let p of c){const d=p.dataset.region,{chr:w,start:m,end:g}=Ra(d);(w!==o||g<a||m>l)&&p.remove()}const u=await n.getFeatures(o,a,l);if(u)for(let p of u){const d=wf(o,p.start,p.end),{x:w,width:m}=cu(Math.max(a,p.start),Math.min(l,p.end),a,h),g=i[s].querySelector(vf(d));if(g)g.style.left=`${w}px`,g.style.width=`${m}px`;else{const f=this.createRegionElement(t.columnContainer,e,w,m,n,d,p.name);i[s].appendChild(f)}}}}createRegionElement(t,e,n,i,s,o,a){const l=ut.div({class:"igv-roi-region"});l.style.top=`${e}px`,l.style.left=`${n}px`,l.style.width=`${i}px`,l.style.backgroundColor=s.color,l.dataset.region=o;const h=ut.div();return l.appendChild(h),h.style.backgroundColor=s.headerColor,s.isUserDefined===!0?h.addEventListener("click",(c=>{c.preventDefault(),c.stopPropagation();const{x:u,y:p}=ut.translateMouseCoordinates(c,t);this.roiMenu.present(u,p,this,t,l)})):a?h.addEventListener("click",(c=>{c.preventDefault(),c.stopPropagation(),this.popover&&this.popover.dispose(),this.popover=new qs(t,s.name),this.popover.presentContentWithEvent(c,a)})):h.style.pointerEvents="none",l}renderSVGContext(t,{deltaX:e,deltaY:n}){for(const i of document.querySelectorAll(".igv-roi-region")){const{x:s,y:o,width:a,height:l}=i.getBoundingClientRect();t.fillStyle=i.style.backgroundColor,t.fillRect(s+e,o+n,a,l);const h=i.querySelector("div"),{x:c,y:u,width:p,height:d}=h.getBoundingClientRect();t.fillStyle=h.style.backgroundColor,t.fillRect(c+e,u+n,p,d)}}async getUserDefinedROISet(){return this.roiSets.find((t=>t.isUserDefined===!0))}initializeUserDefinedROISet(){const t=new Vo({isUserDefined:!0,features:[]},this.browser.genome);return this.roiSets.push(t),t}
830async deleteUserDefinedRegionWithKey(t,e){e.querySelectorAll(vf(t)).forEach((s=>s.remove()));const n=await this.findUserDefinedRegionWithKey(t),i=await this.getUserDefinedROISet();i&&i.removeFeature(n),(await this.getTableRecords()).length===0&&(this.browser.roiTableControl.buttonHandler(!1),this.setROITableButtonVisibility(!1))}async findUserDefinedRegionWithKey(t){const{chr:e,start:n,end:i}=Ra(t),s=await this.getUserDefinedROISet();if(s){const o=await s.getFeatures(e,n,i);for(let a of o)if(a.chr===e&&a.start>=n&&a.end<=i)return a}}toJSON(){return this.roiSets.map((t=>t.toJSON()))}dispose(){this.browser.off("locuschange",this.boundLocusChangeHandler);const t=this.browser.columnContainer.querySelectorAll(".igv-roi-region");for(let e of t)e.remove();this.roiMenu&&this.roiMenu.dispose(),this.roiTable&&this.roiTable.dispose();for(let e of this.roiSets)e.dispose();for(let e of Object.keys(this))this[e]=void 0}}function Hw(){this.renderAllROISets()}function wf(r,t,e){return`${r}-${t}-${e}`}function vf(r){return`[data-region="${r}"]`}function Ra(r){let[t,e,n]=r.split("-");return e=parseInt(e),n=parseInt(n),{chr:t,start:e,end:n,locus:`${t}:${e}-${n}`,bedRecord:`${t} ${e} ${n}`}}class pi extends Ou{constructor(t){super(Object.assign({width:"512px"},t))}tableRowDOM(t){const e=ut.div({class:"igv-roi-table-row"}),{setName:n,feature:i}=t;e.dataset.region=wf(i.chr,i.start,i.end);let s=[i.chr,Ot(i.start),Ot(i.end),i.name||"",n];this.columnFormat.length===4&&(s=s.slice(0,4));for(let o=0;o<s.length;o++){const a=ut.div();e.appendChild(a),a.style.width=this.columnFormat[o].width,a.innerText=s[o]}return this.tableRowDOMHelper(e),e}renderTable(t){if(Array.from(this.tableRowContainer.querySelectorAll(".igv-roi-table-row")).forEach((e=>e.remove())),t.length>0){const e=t.sort(((n,i)=>n.feature.chr.localeCompare(i.feature.chr)||n.feature.start-i.feature.start||n.feature.end-i.feature.end));for(let n of e){const i=this.tableRowDOM(n);this.tableRowContainer.appendChild(i)}}}dispose(){document.removeEventListener("click",this.boundGotoButtonHandler),this.browser.roiTableControl.buttonHandler(!1),super.dispose()}static getColumnFormatConfiguration(t){return t===!0?[{label:"Chr",width:"20%"},{label:"Start",width:"15%"},{label:"End",width:"15%"},{label:"Description",width:"30%"},{label:"ROI Set",width:"20%"}]:[{label:"Chr",width:"25%"},{label:"Start",width:"20%"},{label:"End",width:"20%"},{label:"Description",width:"35%"}]}static gotoButtonHandler(t){t.stopPropagation();const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected"),n=[];for(let i of e){const{locus:s}=Ra(i.dataset.region);n.push(s)}for(let i of this.tableDOM.querySelectorAll(".igv-roi-table-row"))i.classList.remove("igv-roi-table-row-selected");this.setTableRowSelectionState(!1),n.length>0&&this.browser.search(n.join(" "))}}class Uw{constructor(t,e){this.browser=t,this.container=ut.div({class:"igv-roi-menu-next-gen"}),e.appendChild(this.container);const n=ut.div();this.container.appendChild(n),Vs.attachDialogCloseHandlerWithParent(n,(()=>this.container.style.display="none")),this.body=ut.div(),this.container.appendChild(this.body),this.container.style.display="none"}async present(t,e,n,i,s){yf(this.body);const o=await this.browser.roiManager.findUserDefinedRegionWithKey(s.dataset.region),a=ut.div();this.body.appendChild(a);const l="Description",h=o.name||l;a.innerText=h,a.setAttribute("title",h),l===h?a.classList.add("igv-roi-placeholder"):a.classList.remove("igv-roi-placeholder");const c=ut.div();this.body.appendChild(c),c.innerText="Set Description",c.addEventListener("click",(p=>{p.stopPropagation(),this.container.style.display="none";const d={label:"Description",value:o.name||"",callback:()=>{const w=this.browser.inputDialog.value||"";o.name=w.trim(),this.container.style.display="none",this.browser.roiManager.repaintTable()}};this.browser.inputDialog.present(d,p)}));const u=ut.div();this.body.appendChild(u),u.innerText="Delete Region",u.addEventListener("click",(p=>{p.stopPropagation(),this.container.style.display="none",this.browser.roiManager.deleteUserDefinedRegionWithKey(s.dataset.region,this.browser.columnContainer)})),this.container.style.left=`${t}px`,this.container.style.top=`${e}px`,this.container.style.display="flex"}async __present(t,e,n,i,s){yf(this.container);
830const o=await this.browser.roiManager.findUserDefinedRegionWithKey(s.dataset.region);let a;a=ut.div({class:"igv-roi-menu-row-edit-description"}),this.container.appendChild(a),a.addEventListener("click",(u=>{u.stopPropagation()}));const l="description-input",h=document.createElement("label");a.appendChild(h),h.setAttribute("for",l),h.innerText="Description:";const c=document.createElement("input");a.appendChild(c),c.setAttribute("type","text"),c.setAttribute("name",l),c.setAttribute("placeholder",""),c.value=o.name||"",c.addEventListener("change",(async u=>{u.stopPropagation(),(await this.browser.roiManager.findUserDefinedRegionWithKey(s.dataset.region)).name=c.value,c.blur(),this.container.style.display="none",await this.browser.roiManager.repaintTable()})),a=ut.div({class:"igv-roi-menu-row"}),a.innerText="Delete region",this.container.appendChild(a),a.addEventListener("click",(u=>{u.stopPropagation(),this.container.style.display="none",this.browser.roiManager.deleteUserDefinedRegionWithKey(s.dataset.region,this.browser.columnContainer)})),this.container.style.left=`${t}px`,this.container.style.top=`${e}px`,this.container.style.display="flex",i.addEventListener("click",(u=>{u.stopPropagation(),this.container.style.display="none"}))}dispose(){this.container.innerHTML=""}}function yf(r){for(;r.firstChild;)r.removeChild(r.firstChild)}class Vw{constructor(t,e){this.name=t.name,this.featureSource=t.featureSource||He(t,e),this.color=t.color||Uo}async getFeatures(t,e,n){return this.featureSource.getFeatures({chr:t,start:e,end:n})}draw(t){const{context:e,bpPerPixel:n,bpStart:i,pixelTop:s,pixelHeight:o,pixelWidth:a,features:l}=t;if(!l)return;const h=i+a*n+1;for(let{start:c,end:u}of l){if(u<i)continue;if(c>h)break;const{x:p,width:d}=cu(c,u,i,n);at.fillRect(e,p,s,d,o,{fillStyle:this.color})}}}class qw{constructor(t,e){this.browser=e,this.button=ut.div({class:"igv-navbar-button"}),t.appendChild(this.button),this.button.textContent="ROI Table",this.button.addEventListener("click",(()=>{this.buttonHandler(!e.roiTableVisible)})),this.browser=e,this.setVisibility(e.showROITableButton),this.setState(e.roiTableVisible)}buttonHandler(t){this.browser.roiTableVisible=t,this.setState(this.browser.roiTableVisible),this.browser.setROITableVisibility(this.browser.roiTableVisible)}setVisibility(t){t===!0?this.show():this.hide()}setState(t){t===!0?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}show(){this.button.style.display="block",this.setState(this.browser.roiTableVisible)}hide(){this.button.style.display="none"}}class Cs{constructor(t,e){this.config=t,this.guid=ut.guid(),this.namespace=".browser_"+this.guid,this.parent=e,this.root=ut.div({class:"igv-container"}),e.appendChild(this.root),this.alert=new Gg(this.root),this.columnContainer=ut.div({class:"igv-column-container"}),this.root.appendChild(this.columnContainer),this.menuPopup=new yn(this.columnContainer),this.initialize(t),this.trackViews=[],this.constants={dragThreshold:3,scrollThreshold:5,defaultColor:"rgb(0,0,150)",doubleClickDelay:t.doubleClickDelay||500},this.eventHandlers={},this.addMouseHandlers(),this.setControls(t)}initialize(t){t.gtex&&(ta.gtexLoaded=!0),this.flanking=t.flanking,this.crossDomainProxy=t.crossDomainProxy,this.formats=t.formats,this.trackDefaults=t.trackDefaults,this.nucleotideColors=t.nucleotideColors||hc;for(let e of Object.keys(this.nucleotideColors))this.nucleotideColors[e.toLowerCase()]=this.nucleotideColors[e];this.trackLabelsVisible=t.showTrackLabels,this.roiTableVisible=t.showROITable,this.showROITableButton=t.showROITableButton,this.isCenterLineVisible=t.showCenterGuide,this.cursorGuideVisible=t.showCursorGuide,this.showSampleNames=t.showSampleNames,this.showSampleNameButton=t.showSampleNameButton,this.sampleNameViewportWidth=t.sampleNameViewportWidth||200,t.search&&(this.searchConfig={type:"json",url:t.search.url,coords:t.search.coords===void 0?1:t.search.coords,chromosomeField:t.search.chromosomeField||"chromosome",startField:t.search.startField||"start",endField:t.search.endField||"end",geneField:t.search.geneField||"gene",snpField:t.search.snpField||"snp",resultsField:t.search.resultsField})}setControls(t){const e=this.createStandardControls(t);e.insertBefore(pt(this.columnContainer)),this.$navigation=e,t.showControls===!1&&e.hide()}createStandardControls(t){this.navbarManager=new Aw(this);const e=pt("<div>",{class:"igv-navbar"});this.$navigation=e;const n=pt("<div>",{class:"igv-navbar-left-container"});e.append(n);const i=pt("<div>",{class:"igv-logo"});n.append(i);const s=pt('<svg width="690px" height="324px" viewBox="0 0 690 324" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>IGV</title><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="IGV" fill="#666666"><polygon id="Path" points="379.54574 8.00169252 455.581247 8.00169252 515.564813 188.87244 532.884012 253.529506 537.108207 253.529506 554.849825 188.87244 614.833392 8.00169252 689.60164 8.00169252 582.729511 320.722144 486.840288 320.722144"></polygon><path d="M261.482414,323.793286 C207.975678,323.793286 168.339046,310.552102 142.571329,284.069337 C116.803612,257.586572 103.919946,217.158702 103.919946,162.784513 C103.919946,108.410325 117.437235,67.8415913 144.472217,41.0770945 C171.507199,14.3125977 212.903894,0.930550071 268.663545,0.930550071 C283.025879,0.930550071 298.232828,1.84616386 3
83014.284849,3.6774189 C330.33687,5.50867394 344.839793,7.97378798 357.794056,11.072835 L357.794056,68.968378 C339.48912,65.869331 323.578145,63.5450806 310.060654,61.9955571 C296.543163,60.4460336 284.574731,59.6712835 274.154998,59.6712835 C255.850062,59.6712835 240.502308,61.4320792 228.111274,64.9537236 C215.720241,68.4753679 205.793482,74.2507779 198.330701,82.2801269 C190.867919,90.309476 185.587729,100.87425 182.48997,113.974767 C179.392212,127.075284 177.843356,143.345037 177.843356,162.784513 C177.843356,181.942258 179.251407,198.000716 182.067551,210.960367 C184.883695,223.920018 189.671068,234.41436 196.429813,242.443709 C203.188559,250.473058 212.059279,256.178037 223.042241,259.558815 C234.025202,262.939594 247.683295,264.629958 264.01693,264.629958 C268.241146,264.629958 273.098922,264.489094 278.590403,264.207362 C284.081883,263.925631 289.643684,263.50304 295.275972,262.939577 L295.275972,159.826347 L361.595831,159.826347 L361.595831,308.579859 C344.698967,313.087564 327.239137,316.750019 309.215815,319.567334 C291.192494,322.38465 275.281519,323.793286 261.482414,323.793286 L261.482414,323.793286 L261.482414,323.793286 Z" id="Path"></path>;<polygon id="Path" points="0.81355666 5.00169252 73.0472883 5.00169252 73.0472883 317.722144 0.81355666 317.722144"></polygon></g> </g> </svg>');s.css("width","34px"),s.css("height","32px"),i.append(s),this.$current_genome=pt("<div>",{class:"igv-current-genome"}),n.append(this.$current_genome),this.$current_genome.text("");const o=pt("<div>",{class:"igv-navbar-genomic-location"});n.append(o),this.chromosomeSelectWidget=new ks(this,o.get(0)),t.showChromosomeWidget===void 0&&(t.showChromosomeWidget=!0),t.showChromosomeWidget===!0?this.chromosomeSelectWidget.show():this.chromosomeSelectWidget.hide();const a=pt("<div>",{class:"igv-locus-size-group"});o.append(a);const l=pt("<div>",{class:"igv-search-container"});a.append(l),this.$searchInput=pt("<input>",{class:"igv-search-input",type:"text",placeholder:"Locus Search"}),l.append(this.$searchInput),this.$searchInput.change((()=>this.doSearch(this.$searchInput.val())));const h=ut.div({class:"igv-search-icon-container"});l.append(pt(h)),h.appendChild(Nr.createIcon("search")),h.addEventListener("click",(()=>this.doSearch(this.$searchInput.val()))),this.windowSizePanel=new Ew(a.get(0),this);const c=pt("<div>",{class:"igv-navbar-right-container"});e.append(c);const u=pt('<div class="igv-navbar-toggle-button-container">');if(c.append(u),this.$toggle_button_container=u,this.cursorGuide=new Tw(this.columnContainer,this),this.cursorGuideButton=new Mw(this,u.get(0)),this.centerLineButton=new Rw(this,u.get(0)),this.setTrackLabelVisibility(t.showTrackLabels),this.trackLabelControl=new Lw(u.get(0),this),this.roiTableControl=new qw(u.get(0),this),this.sampleNameControl=new Iw(u.get(0),this),t.showSVGButton===!0&&(this.svgSaveControl=new Nw(u.get(0),this)),t.customButtons)for(let p of t.customButtons)new zw(u.get(0),this,p);return this.zoomWidget=new Tr(this,c.get(0)),t.showNavigation===!1&&this.$navigation.hide(),this.inputDialog=new Ap(this.root),this.inputDialog.container.id=`igv-input-dialog-${ut.guid()}`,this.dataRangeDialog=new Gl(this,pt(this.root)),this.dataRangeDialog.$container.get(0).id=`igv-data-range-dialog-${ut.guid()}`,this.genericColorPicker=new Wl({parent:this.columnContainer,width:432}),this.genericColorPicker.container.id=`igv-track-color-picker-${ut.guid()}`,e}getSampleNameViewportWidth(){return this.showSampleNames===!1?0:this.sampleNameViewportWidth}isMultiLocusMode(){return this.referenceFrameList&&this.referenceFrameList.length>1}addTrackToFactory(t,e){vw(t,e)}isMultiLocusWholeGenomeView(){if(this.referenceFrameList===void 0||this.referenceFrameList.length===1)return!1;for(let t of this.referenceFrameList)if(t.chr.toLowerCase()==="all")return!0;return!1}currentLoci(){const t=e=>`${e.chr}:${e.start+1}-${e.end}`;return this.referenceFrameList===void 0||this.referenceFrameList.length===0?"":this.referenceFrameList.length===1?t(this.referenceFrameList[0]):this.referenceFrameList.map((e=>t(e)))}toSVG(){const{y:t,width:e,height:n}=this.columnContainer.getBoundingClientRect(),i=new Gr({width:e,height:8e3,backdropColor:"white",multiLocusGap:0,viewbox:{x:0,y:0,width:e,height:8e3}}),s={deltaX:0,deltaY:-t};for(let o of this.trackViews)o.renderSVGContext(i,s);return this.roiManager.renderSVGContext(i,s),i.setHeight(n),i.getSerializedSvg(!0)}renderSVG(t){const e=this.toSVG();return t.empty(),t.append(e),e}saveSVGtoFile(t){let e=this.toSVG();t.$container&&(t.$container.empty(),t.$container.append(e)),Ws(t.filename||"igvjs.svg",URL.createObjectURL(new Blob([e],{type:"application/octet-stream"})))}async loadSession(t){let e;return this.roiSets=[],e=t.url||t.file?await(async function(n){const i=n.url||n.file;if(n.url&&(n.url.startsWith("blob:")||n.url.startsWith("data:"))){const s=Cs.uncompressSe
830ssion(n.url);return JSON.parse(s)}{let s=n.filename;if(s||(s=n.url?await xo(n.url):n.file.name),s.endsWith(".xml")){const o=be.KNOWN_GENOMES,a=await Ct.loadString(i);return new _w(a,o)}return s.endsWith(".json")?Ct.loadJson(i):void 0}})(t):t,this.loadSessionObject(e)}async loadSessionObject(t){this.cleanHouseForSession(),this.showSampleNames=t.showSampleNames||!1,this.sampleNameControl.setState(this.showSampleNames===!0),t.sampleNameViewportWidth&&(this.sampleNameViewportWidth=t.sampleNameViewportWidth),ni(this.columnContainer,"igv-axis-column"),ni(this.columnContainer,"igv-sample-name-column"),ni(this.columnContainer,"igv-scrollbar-column"),ni(this.columnContainer,"igv-track-drag-column"),ni(this.columnContainer,"igv-gear-menu-column");const e=t.reference||t.genome;if(!e)return;const n=await be.expandReference(this.alert,e);await this.loadReference(n,t.locus),this.centerLineList=this.createCenterLineList(this.columnContainer);let i=0;if(t.showIdeogram!==!1){const c=new Qu(this);c.id="ideogram";const u=new oa(this,this.columnContainer,c),{$viewport:p}=u.viewports[0];i=(function(d){d=typeof d=="string"?document.querySelector(d):d;const w=window.getComputedStyle(d),m=parseFloat(w.marginTop)+parseFloat(w.marginBottom),g=d.offsetHeight;return Math.ceil(m+g)})(p.get(0)),this.trackViews.push(u)}if(t.showRuler!==!1&&this.trackViews.push(new oa(this,this.columnContainer,new Pw(this))),t.gtexSelections)for(let c of this.referenceFrameList)for(let u of Object.keys(t.gtexSelections)){const p=t.gtexSelections[u].gene,d=t.gtexSelections[u].snp;c.selection=new ff(p,d)}this.roiManager&&this.roiManager.dispose();const s=new Uw(this,this.columnContainer),o={browser:this,parent:this.columnContainer,headerTitle:"Regions of Interest",dismissHandler:()=>this.roiTableControl.buttonHandler(!1),gotoButtonHandler:pi.gotoButtonHandler};if(t.roi){const c=t.roi.map((d=>new Vo(d,this.genome))),u=c.filter((({name:d})=>d!==void 0&&d.length>0));o.columnFormat=pi.getColumnFormatConfiguration(u.length>0);const p=new pi(o);this.roiManager=new bf(this,s,p,i,c)}else{o.columnFormat=pi.getColumnFormatConfiguration(!1);const c=new pi(o);this.roiManager=new bf(this,s,c,i,void 0)}await this.roiManager.initialize();const a=n.tracks||[],l=t.tracks?a.concat(t.tracks):a;l.filter((c=>c.type==="sequence"&&!c.url&&!c.fastaURL)).length===0&&l.push({type:"sequence",order:Ji});let h=1;for(let c of l)c.order===void 0&&(c.order=h++);await this.loadTrackList(l);for(let c of this.trackViews.filter((u=>u.track.type==="ruler"||u.track.type==="ideogram")))c.updateViews();this.updateUIWithReferenceFrameList()}createCenterLineList(t){const e=t.querySelectorAll(".igv-center-line");for(let s=0;s<e.length;s++)e[s].remove();const n=[],i=t.querySelectorAll(".igv-column");for(let s=0;s<i.length;s++)n.push(new Dw(this,this.referenceFrameList[s],i[s]));return n}async loadReference(t,e){const n=await be.loadGenome(t),i=this.genome===void 0||this.genome.id!==n.id;this.genome=n,this.updateNavbarDOMWithGenome(n),i&&this.removeAllTracks();let s=(function(o,a){return o?Array.isArray(o)?o.join(" "):o:a.getHomeChromosomeName()})(e,n);if(!await this.search(s,!0)&&(s=n.getHomeChromosomeName(),!await this.search(s,!0)))throw new Error("Cannot set initial locus");i&&this.circularView&&this.circularView.setAssembly({name:this.genome.id,id:this.genome.id,chromosomes:Nu(this.genome)})}cleanHouseForSession(){for(let t of this.trackViews)t.removeDOMFromColumnContainer();this.columnContainer.querySelectorAll(".igv-axis-column, .igv-column-shim, .igv-column, .igv-sample-name-column, .igv-scrollbar-column, .igv-track-drag-column, .igv-gear-menu-column").forEach((t=>t.remove())),this.trackViews=[],this.circularView&&this.circularView.clearChords()}updateNavbarDOMWithGenome(t){let e=t.id&&t.id.length<10?t.id:"";this.$current_genome.text(e),this.$current_genome.attr("title",t.id||""),this.chromosomeSelectWidget.update(t)}async loadGenome(t){const e=await be.expandReference(this.alert,t);await this.loadReference(e,void 0);const n=e.tracks||[];return n.filter((i=>i.type==="sequence")).length===0&&n.push({type:"sequence",order:Ji}),await this.loadTrackList(n),await this.updateViews(),this.genome}updateUIWithReferenceFrameList(){const t=this.referenceFrameList;this.updateLocusSearchWidget();const e=this.isMultiLocusWholeGenomeView()||be.isWholeGenomeView(t[0].chr);this.navbarManager.navbarDidResize(this.$navigation.width(),e),Ia(this.trackViews,this.trackLabelsVisible),this.setCenterLineAndCenterLineButtonVisibility(!be.isWholeGenomeView(t[0].chr))}setTrackLabelVisibility(t){Ia(this.trackViews,t)}setROITableVisibility(t){t===!0?this.roiManager.presentTable():this.roiManager.dismissTable()}setCursorGuideVisibility(t){t?this.cursorGuide.show():this.cursorGuide.hide()}setCustomCursorGuideMouseHandler(t){this.cursorGuide.customMouseHandler=t}setCenterLineVisibility(t){for(let e of this.centerLineList)t===!0?(e.show(),e.repaint()):e.hide()}setCenterLineAndCenterLineButtonVisibility(t){for(let e of this.centerLineList)t&&e.isVisible?e.show():e.container.style.display="none";t&&this.centerLineButton.isVisible?this.centerLineButton.show():this.centerLineButton.button.style.display="none"}async loadTrackList(t){const e=[];for(let i of t)e.push(this._loadTrack(i));const n=await Promise.all(e);return this.trackViews.filter((function(i){return i.track.autoscaleGroup})).length>0&&this.updateViews(),n}async loadTrack(t){const e=this._loadTrack(t);return t.autoscaleGroup&&(await e,this.updateViews()),e}async _loadTrack(t){ve(t)&&(t=JSON.parse(t));try{const e=await this.createTrack(t);if(e===void 0)return;e.order===void 0&&(e.order=this.trackViews.length);const n=new oa(this,this.columnContainer,e);if(this.trackViews.push(n),Ia(this.trackViews,this.trackLabelsVisible),this.reorderTracks(),this.fireEvent("trackorderchanged",[this.getTrackOrder()]),typeof e.postInit=="function")try{n.startSpinner(),await e.postInit()}finally{n.stopSpinner()}return e.autoscaleGroup||(t.sync?await n.updateViews():n.updateViews()),typeof e.hasSamples=="function"&&e.hasSamples()&&this.config.showSampleNameButton!==!1&&this.sampleNameControl.show(),e}catch(e){const n={401:"Access unauthorized",403:"Access forbidden",404:"Not found"};let i=e.message||e.error||e.toString();n.hasOwnProperty(i)&&(i=n[i]),i+=": "+t.url,this.alert.present(new Error(i),void 0)}}async loadROI(t){await this.roiManager.loadROI(t,this.genome)}clearROIs(){this.roiManager.clearROIs()}async getUserDefinedROIs(){if(this.roiManager){const t=await this.roiManager.getUserDefinedROISet();if(t===void 0)return[];const e=await t.getAllFeatures(),n=[];for(let i of Object.values(e))n.push(...i);return n}return[]}getRulerTrackView(){const t=this.trackViews.filter((({track:e})=>e.id==="ruler"));return t.length>0?t[0]:void 0}async createTrack(t){let e=await(async function(s){return typeof s=="function"?s():s})(t.url||t.fastaURL);if(ve(e)&&(e=e.trim()),e)if(t.format)t.format=t.format.toLowerCase();else if(t.fastaURL)t.format="fasta";else{let s=t.filename;s||(s=await xo(e));const o=Ao(s);o==="tsv"?t.format=await oc(t):o?t.format=o:t.sourceType==="htsget"&&await Po.inferFormat(t)}let n=t.type?t.type.toLowerCase():void 0;
830if(!n){if(n=sc(t),n==="bedtype"){const s=He(t,this.genome);t._featureSource=s,n=await s.trackType()||"annotation"}t.type=n}if(this.trackDefaults&&n){const s=this.trackDefaults[n];if(s)for(let o in s)s.hasOwnProperty(o)&&t[o]===void 0&&(t[o]=s[o])}const i=yw(n,t,this);if(i!==void 0)return t.roi&&t.roi.length>0&&(i.roiSets=t.roi.map((s=>new Vw(s,this.genome)))),i;this.alert.present(new Error(`Error creating track. Could not determine track type for file: ${t.url||t}`),void 0)}reorderTracks(){this.trackViews.sort((function(e,n){const i=a=>a.track.id==="ideogram"?1:a.track.id==="ruler"?2:3,s=i(e),o=i(n);return s===o?(e.track.order||0)-(n.track.order||0):s-o}));for(let{axis:e,viewports:n,sampleNameViewport:i,outerScroll:s,dragHandle:o,gearContainer:a}of this.trackViews){e.remove();for(let{$viewport:l}of n)l.detach();i.viewport.remove(),s.remove(),o.remove(),a.remove()}const t=this.columnContainer.querySelectorAll(".igv-column");for(let{axis:e,viewports:n,sampleNameViewport:i,outerScroll:s,dragHandle:o,gearContainer:a}of this.trackViews){this.columnContainer.querySelector(".igv-axis-column").appendChild(e);for(let l=0;l<t.length;l++){const{$viewport:h}=n[l];t[l].appendChild(h.get(0))}this.columnContainer.querySelector(".igv-sample-name-column").appendChild(i.viewport),this.columnContainer.querySelector(".igv-scrollbar-column").appendChild(s),this.columnContainer.querySelector(".igv-track-drag-column").appendChild(o),this.columnContainer.querySelector(".igv-gear-menu-column").appendChild(a)}}getTrackOrder(){return this.trackViews.filter((t=>t.track&&t.track.name)).map((t=>t.track.name))}removeTrackByName(t){const e=this.trackViews.slice();for(let n of e)t===n.track.name&&this.removeTrack(n.track)}removeTrack(t){for(let e of this.trackViews)if(t===e.track){this._removeTrack(e.track);break}}_removeTrack(t){t.disposed||(this.trackViews.splice(this.trackViews.indexOf(t.trackView),1),this.fireEvent("trackremoved",[t]),this.fireEvent("trackorderchanged",[this.getTrackOrder()]),t.trackView&&t.trackView.dispose())}removeAllTracks(){const t=[];for(let e of this.trackViews)e.track.id!=="ruler"&&e.track.id!=="ideogram"?(this.fireEvent("trackremoved",[e.track]),e.dispose()):t.push(e);this.trackViews=t}findTracks(t,e){let n=typeof t=="function"?i=>t(i.track):i=>e===i.track[t];return this.trackViews.filter(n).map((i=>i.track))}setTrackHeight(t){this.trackHeight=t,this.trackViews.forEach((function(e){e.setTrackHeight(t)}))}async visibilityChange(){this.layoutChange()}async layoutChange(){if(this.referenceFrameList.find((t=>t.bpPerPixel<0))){const t=this.calculateViewportWidth(this.referenceFrameList.length);for(let e of this.referenceFrameList)e.bpPerPixel=(e.end-e.start)/t}if(this.referenceFrameList){const t=this.isMultiLocusWholeGenomeView()||be.isWholeGenomeView(this.referenceFrameList[0].chr);this.navbarManager.navbarDidResize(this.$navigation.width(),t)}La.call(this),await this.updateViews()}async updateViews(){const t=this.trackViews;this.updateLocusSearchWidget();for(let s of this.centerLineList)s.repaint();if(this.dragObject)for(let s of t)await s.updateViews();else{const s={},o=[];for(let a of t){const l=a.track.autoscaleGroup;if(l){var e=s[l];e||(e=[],s[l]=e),e.push(a)}else o.push(a)}if(Object.entries(s).length>0){const a=Object.keys(s);for(let l of a){const h=s[l],c=[];for(let d of h)c.push(d.getInViewFeatures());const u=await Promise.all(c);var n,i=[];for(let d of u)i=i.concat(d);n=_o(i);const p=[];for(let d of h)d.track.dataRange=n,d.track.autoscale=!1,p.push(d.updateViews());await Promise.all(p)}}await Promise.all(o.map((a=>a.updateViews())))}}repaintViews(){for(let t of this.trackViews)t.repaintViews()}updateLocusSearchWidget(){if(!this.referenceFrameList)return;const t=this.referenceFrameList,e=this.calculateViewportWidth(this.referenceFrameList.length);for(let i of t)i.end=i.start+i.bpPerPixel*e;this.chromosomeSelectWidget.select.value=t.length===1?this.referenceFrameList[0].chr:"";const n=this.referenceFrameList.map((i=>i.getLocusString())).join(" ");this.$searchInput.val(n),this.fireEvent("locuschange",[this.referenceFrameList])}calculateViewportWidth(t){let{width:e}=this.columnContainer.getBoundingClientRect();return e-=50+this.getSampleNameViewportWidth()+14+12+28,e-=5*(t-1),Math.floor(e/t)}getCenterLineXOffset(){let{width:t}=this.columnContainer.getBoundingClientRect();return t-=50+this.getSampleNameViewportWidth()+14+12+28,Math.floor(t/2+50)}minimumBases(){return this.config.minimumBases}zoomIn(){this.zoomWithScaleFactor(.5)}zoomOut(){this.zoomWithScaleFactor(2)}async zoomWithScaleFactor(t,e,n){if(!this.referenceFrameList)return;const i=this.calculateViewportWidth(this.referenceFrameList.length);let s=n?[n]:this.referenceFrameList;for(let o of s)o.zoomWithScaleFactor(this,t,i,e)}async addMultiLocusPanel(t,e,n,i){if(!this.referenceFrameList)return;const s=this.calculateViewportWidth(1+this.referenceFrameList.length),o=this.calculateViewportWidth(this.referenceFrameList.length)/this.calculateViewportWidth(1+this.referenceFrameList.length);for(let d of this.referenceFrameList)d.bpPerPixel*=o;const a=(n-e)/s,l=new pf(this.genome,t,e,n,a),h=i?this.referenceFrameList.indexOf(i):this.referenceFrameList.length-1,c=1+h,{$viewport:u}=this.trackViews[0].viewports[h],p=Fw(u.get(0).parentElement);if(c===this.referenceFrameList.length){this.referenceFrameList.push(l);for(let d of this.trackViews){const w=sa(d,p,l);d.viewports.push(w)}}else{this.referenceFrameList.splice(c,0,l);for(let d of this.trackViews){const w=sa(d,p,l);d.viewports.splice(c,0,w)}}this.centerLineList=this.createCenterLineList(this.columnContainer),La.call(this),await this.updateViews(!0)}async removeMultiLocusPanel(t){const e=this.referenceFrameList.indexOf(t),{$viewport:n}=this.trackViews[0].viewports[e];Bw(e,n.parent().get(0));for(let{viewports:s}of this.trackViews)s[e].dispose(),s.splice(e,1);if(this.referenceFrameList.splice(e,1),this.referenceFrameList.length===1&&this.getRulerTrackView())for(let s of this.getRulerTrackView().viewports)s.dismissLocusLabel();const i=this.calculateViewportWidth(1+this.referenceFrameList.length)/this.calculateViewportWidth(this.referenceFrameList.length);await this.rescaleForMultiLocus(i)}async gotoMultilocusPanel(t){const e=this.referenceFrameList.indexOf(t);this.columnContainer.querySelectorAll(".igv-column").forEach(((i,s)=>{s===e||i.remove()})),this.columnContainer.querySelectorAll(".igv-column-shim").forEach((i=>i.remove()));for(let i of this.trackViews){const s=i.viewports[e];i.viewports.filter(((o,a)=>
830a!==e)).forEach((o=>o.dispose())),i.viewports=[s]}const n=this.calculateViewportWidth(1);t.bpPerPixel=(t.end-t.start)/n,this.referenceFrameList=[t],this.trackViews.forEach((({viewports:i})=>i.forEach((s=>s.setWidth(n))))),this.centerLineList=this.createCenterLineList(this.columnContainer),this.updateUIWithReferenceFrameList(),await this.updateViews(!0)}async rescaleForMultiLocus(t){const e=this.calculateViewportWidth(this.referenceFrameList.length);for(let n of this.referenceFrameList)n.bpPerPixel*=t;for(let{viewports:n}of this.trackViews)for(let i of n)i.setWidth(e);this.centerLineList=this.createCenterLineList(this.columnContainer),this.updateUIWithReferenceFrameList(),await this.updateViews()}async goto(t,e,n){await this.search(t+":"+e+"-"+n)}async doSearch(t,e){const n=await this.search(t,e);return n||this.alert.present(new Error(`Unrecognized locus: <b> ${t} </b>`)),n}async search(t,e){const n=await Sw(this,t);if(n&&n.length>0){this.referenceFrameList=(function(i,s,o,a,l,h){return i.map((c=>{if(o&&c.gene&&(c.start=Math.max(0,c.start-o),c.end+=o),!h){const p=s.getChromosome(c.chr);Kh(p.bpLength,c,a)}const u=new pf(s,c.chr,c.start,c.end,(c.end-c.start)/l);return u.locusSearchString=c.locusSearchString,(c.gene||c.snp)&&(u.selection=new ff(c.gene,c.snp)),u}))})(n,this.genome,this.flanking,this.minimumBases(),this.calculateViewportWidth(n.length),this.isSoftclipped());for(let i of this.trackViews)i.removeDOMFromColumnContainer();this.columnContainer.querySelectorAll(".igv-column-shim, .igv-column").forEach((i=>i.remove())),Ow(this.columnContainer.querySelector(".igv-sample-name-column"),this.referenceFrameList.length),this.centerLineList=this.createCenterLineList(this.columnContainer);for(let i of this.trackViews)i.addDOMToColumnContainer(this,this.columnContainer,this.referenceFrameList);return this.updateUIWithReferenceFrameList(),e||await this.updateViews(),!0}return!1}async loadSampleInformation(t){var e=t;xr(t)&&(e=t.name),e.substr(e.lastIndexOf(".")+1)==="fam"&&(this.sampleInformation=await(function(n,i){return new kw().loadPlinkFile(n,i)})(t))}on(t,e){this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)}un(t,e){this.off(t,e)}off(t,e){if(t)if(e){const n=this.eventHandlers[t];if(n&&n.length!==0){const i=n.indexOf(e);i!==-1&&this.eventHandlers[t].splice(i,1)}}else this.eventHandlers[t]=[];else this.eventHandlers={}}fireEvent(t,e,n){const i=this.eventHandlers[t];if(i===void 0||i.length===0)return;const s=n||window;return i.map((function(o){return o.apply(s,e)}))[0]}dispose(){this.removeMouseHandlers();for(let t of this.trackViews)t.dispose()}toJSON(){const t={version:"2.15.13"};if(this.showSampleNames!==void 0&&(t.showSampleNames=this.showSampleNames),this.sampleNameViewportWidth!==200&&(t.sampleNameViewportWidth=this.sampleNameViewportWidth),t.reference=this.genome.toJSON(),t.reference.fastaURL instanceof File)throw new Error(`Error. Sessions cannot include local file references ${t.reference.fastaURL.name}.`);if(t.reference.indexURL instanceof File)throw new Error(`Error. Sessions cannot include local file references ${t.reference.indexURL.name}.`);const e=[],n={};let i=!1,s=this.trackViews[0];for(let{referenceFrame:l}of s.viewports){const h=l.getLocusString();if(e.push(h),l.selection){const c={gene:l.selection.gene,snp:l.selection.snp};n[h]=c,i=!0}}t.locus=e.length===1?e[0]:e,i&&(t.gtexSelections=n),t.roi=this.roiManager.toJSON();const o=[],a=[];for(let{track:l}of this.trackViews)try{let h;h=typeof l.getState=="function"?l.getState():l.config,h&&(h.browser&&delete h.browser,h.order=l.order,o.push(h))}catch(h){a.push(`Track: ${l.name}: ${h}`)}if(a.length>0){let l=1,h="Errors encountered saving session: </br>";for(let c of a)h+=` (${l++}) ${c.toString()} <br/>`;throw Error(h)}return t.tracks=o,t}compressedSession(){return(function(t){const e=new Uint8Array(t.length);for(var n=0;n<t.length;n++)e[n]=t.charCodeAt(n);const i=new Ig(e),s=String.fromCharCode.apply(null,i);return btoa(s).replace(/\+/g,".").replace(/\//g,"_").replace(/=/g,"-")})(JSON.stringify(this.toJSON()))}sessionURL(){const t=window.location.href.slice(),e=t.indexOf("?");return(e>0?t.substring(0,e):t)+"?sessionURL=blob:"+this.compressedSession()}mouseDownOnViewport(t,e){var n;n=ut.pageCoordinates(t),this.vpMouseDown={viewport:e,lastMouseX:n.x,mouseDownX:n.x,lastMouseY:n.y,mouseDownY:n.y,referenceFrame:e.referenceFrame}}cancelTrackPan(){const t=this.dragObject;this.dragObject=void 0,this.isScrolling=!1,this.vpMouseDown=void 0,t&&t.viewport.referenceFrame.start!==t.start&&(this.updateViews(),this.fireEvent("trackdragend"))}isTrackPanning(){return this.dragObject}isSoftclipped(){return this.trackViews.find((t=>t.track.showSoftClips===!0))!==void 0}startTrackDrag(t){this.dragTrack=t}updateTrackDrag(t){if(t&&this.dragTrack){const e=this.dragTrack,n=this.trackViews.indexOf(t),i=this.trackViews.indexOf(e),s=this.trackViews;s[n]=e,s[i]=t;const o=this.trackViews[n].track.order;this.trackViews[i].track.order=o;const a=s.length;let l=o;if(n<i)for(let h=n+1;h<a;h++){const c=s[h].track;if(!(c.order<=l))break;c.order=Math.min(Number.MAX_SAFE_INTEGER,l+1),l=c.order}else for(let h=n-1;h>0;h--){const c=s[h].track;if(!(c.order>=l))break;c.order=Math.max(-Number.MAX_SAFE_INTEGER,l-1),l=c.order}this.reorderTracks()}}endTrackDrag(){this.dragTrack?(this.dragTrack=void 0,this.fireEvent("trackorderchanged",[this.getTrackOrder()])):this.dragTrack=void 0}
830addMouseHandlers(){this.addWindowResizeHandler(),this.addRootMouseUpHandler(),this.addRootMouseLeaveHandler(),this.addColumnContainerEventHandlers()}removeMouseHandlers(){this.removeWindowResizeHandler(),this.removeRootMouseUpHandler(),this.removeRootMouseLeaveHandler(),this.removeColumnContainerEventHandlers()}addWindowResizeHandler(){this.boundWindowResizeHandler=La.bind(this),window.addEventListener("resize",this.boundWindowResizeHandler)}removeWindowResizeHandler(){window.removeEventListener("resize",this.boundWindowResizeHandler)}addRootMouseUpHandler(){this.boundRootMouseUpHandler=gi.bind(this),this.root.addEventListener("mouseup",this.boundRootMouseUpHandler)}removeRootMouseUpHandler(){this.root.removeEventListener("mouseup",this.boundRootMouseUpHandler)}addRootMouseLeaveHandler(){this.boundRootMouseLeaveHandler=gi.bind(this),this.root.addEventListener("mouseleave",this.boundRootMouseLeaveHandler)}removeRootMouseLeaveHandler(){this.root.removeEventListener("mouseleave",this.boundRootMouseLeaveHandler)}addColumnContainerEventHandlers(){this.boundColumnContainerMouseMoveHandler=_f.bind(this),this.boundColumnContainerTouchMoveHandler=_f.bind(this),this.boundColumnContainerMouseLeaveHandler=gi.bind(this),this.boundColumnContainerMouseUpHandler=gi.bind(this),this.boundColumnContainerTouchEndHandler=gi.bind(this),this.columnContainer.addEventListener("mousemove",this.boundColumnContainerMouseMoveHandler),this.columnContainer.addEventListener("touchmove",this.boundColumnContainerTouchMoveHandler),this.columnContainer.addEventListener("mouseleave",this.boundColumnContainerMouseLeaveHandler),this.columnContainer.addEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.columnContainer.addEventListener("touchend",this.boundColumnContainerTouchEndHandler)}removeColumnContainerEventHandlers(){this.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler),this.columnContainer.removeEventListener("touchmove",this.boundColumnContainerTouchMoveHandler),this.columnContainer.removeEventListener("mouseleave",this.boundColumnContainerMouseLeaveHandler),this.columnContainer.removeEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.columnContainer.removeEventListener("touchend",this.boundColumnContainerTouchEndHandler)}static uncompressSession(t){let e;if(t.indexOf("/gzip;base64")>0){e=Vr(t);let n="";for(let i of e)n+=String.fromCharCode(i);return n}return(function(n){n=n.replace(/\./g,"+").replace(/_/g,"/").replace(/-/g,"=");const i=atob(n),s=[];for(let l=0;l<i.length;l++)s.push(i.charCodeAt(l));const o=fo(s);let a="";for(let l of o)a+=String.fromCharCode(l);return a})(t.substring(5))}createCircularView(t,e){var n;return e=e===!0,this.circularView=(n=this,new Ko(t,{onChordClick:(i,s,o)=>{const a=i.data,l=a.mate;function h(c){c.chr=n.genome.getChromosomeName(c.refName);let u=!1;for(let p of n.referenceFrameList){const d=hs.fromLocusString(p.getLocusString());if(d.contains(c)){u=!0;break}if(d.overlaps(c)){p.extend(c),u=!0;break}}if(!u){const d=(c.start+c.end)/2;n.addMultiLocusPanel(c.chr,d-2e3,d+2e3)}}h(a),h(l)}})),this.circularViewControl=new fi(this.$toggle_button_container.get(0),this),this.circularView.setAssembly({name:this.genome.id,id:this.genome.id,chromosomes:Nu(this.genome)}),this.circularViewVisible=e,this.circularView}get circularViewVisible(){return this.circularView!==void 0&&this.circularView.visible}set circularViewVisible(t){this.circularView&&(this.circularView.visible=t,this.circularViewControl.setState(t))}}async function La(){if(!this.referenceFrameList)return;const r=this.calculateViewportWidth(this.referenceFrameList.length);for(let t of this.referenceFrameList){const e=this.referenceFrameList.indexOf(t),{chr:n,genome:i}=t,{bpLength:s}=i.getChromosome(t.chr),o=t.toBP(r);be.isWholeGenomeView(n)||o>s?t.bpPerPixel=s/r:t.end=t.start+t.toBP(r);for(let{viewports:a}of this.trackViews)a[e].setWidth(r)}this.updateUIWithReferenceFrameList(),await this.updateViews(!0)}function _f(r){r.preventDefault();const{x:t,y:e}=ut.pageCoordinates(r);if(this.vpMouseDown){const{viewport:n,referenceFrame:i}
830=this.vpMouseDown,s=Math.abs(t-this.vpMouseDown.mouseDownX)>Math.abs(e-this.vpMouseDown.mouseDownY);if(!this.dragObject&&!this.isScrolling){if(s)this.vpMouseDown.mouseDownX&&Math.abs(t-this.vpMouseDown.mouseDownX)>this.constants.dragThreshold&&(this.dragObject={viewport:n,start:i.start});else if(this.vpMouseDown.mouseDownY&&Math.abs(e-this.vpMouseDown.mouseDownY)>this.constants.scrollThreshold){this.isScrolling=!0;const o=n.$viewport.height(),a=n.trackView.maxViewportContentHeight();this.vpMouseDown.r=o/a}}if(this.dragObject){const o=!this.isSoftclipped();let a=this.vpMouseDown.lastMouseX-t;i.shiftPixels(a,n.$viewport.width(),o)&&this.updateViews(),this.fireEvent("trackdrag")}if(this.isScrolling){const o=this.vpMouseDown.r*(this.vpMouseDown.lastMouseY-e);n.trackView.moveScroller(o)}this.vpMouseDown.lastMouseX=t,this.vpMouseDown.lastMouseY=e}}function gi(r){this.cancelTrackPan(),this.endTrackDrag()}function Ia(r,t){for(let{viewports:e}of r)for(let n of e)n.$trackLabel&&(e.indexOf(n)===0&&t===!0?n.$trackLabel.show():n.$trackLabel.hide())}let Cn=[];const jw=Ct.setApiKey;(function(){var r=document.createElement("style");r.setAttribute("type","text/css"),r.innerHTML=`.igv-navbar { 831 display: flex; 832 flex-flow: row; 833 flex-wrap: nowrap; 834 justify-content: space-between; 835 align-items: center; 836 box-sizing: border-box; 837 width: 100%; 838 color: #444; 839 font-size: 12px; 840 font-family: "Open Sans", sans-serif; 841 font-weight: 400; 842 line-height: 32px; 843 padding-left: 8px; 844 padding-right: 8px; 845 margin-top: 2px; 846 margin-bottom: 6px; 847 height: 32px; 848 border-style: solid; 849 border-radius: 3px; 850 border-width: thin; 851 border-color: #bfbfbf; 852 background-color: #f3f3f3; 853} 854.igv-navbar .igv-navbar-left-container { 855 display: flex; 856 flex-flow: row; 857 flex-wrap: nowrap; 858 justify-content: space-between; 859 align-items: center; 860 height: 32px; 861 line-height: 32px; 862} 863.igv-navbar .igv-navbar-left-container .igv-logo { 864 width: 34px; 865 height: 32px; 866 margin-right: 8px; 867} 868.igv-navbar .igv-navbar-left-container .igv-current-genome { 869 height: 32px; 870 margin-left: 4px; 871 margin-right: 4px; 872 user-select: none; 873 line-height: 32px; 874 vertical-align: middle; 875 text-align: center; 876} 877.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location { 878 display: flex; 879 flex-flow: row; 880 flex-wrap: nowrap; 881 justify-content: space-between; 882 align-items: center; 883 height: 100%; 884} 885.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-chromosome-select-widget-container { 886 display: flex; 887 flex-flow: column; 888 flex-wrap: nowrap; 889 justify-content: space-around; 890 align-items: center; 891 height: 100%; 892 width: 125px; 893 margin-right: 4px; 894} 895.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-chromosome-select-widget-container select { 896 display: block; 897 cursor: pointer; 898 width: 100px; 899 height: 75%; 900 outline: none; 901 font-size: 12px; 902 font-family: "Open Sans", sans-serif; 903 font-weight: 400; 904} 905.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group { 906 display: flex; 907 flex-flow: row; 908 flex-wrap: nowrap; 909 justify-content: space-between; 910 align-items: center; 911 margin-left: 8px; 912 height: 22px; 913} 914.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container { 915 display: flex; 916 flex-flow: row; 917 flex-wrap: nowrap; 918 justify-content: flex-start; 919 align-items: center; 920 width: 210px; 921 height: 22px; 922 line-height: 22px; 923} 924.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container input.igv-search-input { 925 cursor: text; 926 width: 85%; 927 height: 22px; 928 line-height: 22px; 929 font-size: 12px; 930 font-family: "Open Sans", sans-serif; 931 font-weight: 400; 932 text-align: left; 933 padding-left: 8px; 934 margin-right: 8px; 935 outline: none; 936 border-style: solid; 937 border-radius: 3px; 938 border-width: thin; 939 border-color: #bfbfbf; 940 background-color: white; 941} 942.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container .igv-search-icon-container { 943 cursor: pointer; 944 height: 16px; 945 width: 16px; 946} 947.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-windowsize-panel-container { 948 margin-left: 4px; 949 user-select: none; 950} 951.igv-navbar .igv-navbar-right-container { 952 display: flex; 953 flex-flow: row; 954 flex-wrap: nowrap; 955 justify-content: space-between; 956 align-items: center; 957 height: 32px; 958 line-height: 32px; 959} 960.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container { 961 display: flex; 962 flex-flow: row; 963 flex-wrap: nowrap; 964 justify-content: space-between; 965 align-items: center; 966 height: 100%; 967} 968.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container div { 969 margin-left: 0; 970 margin-right: 4px; 971} 972.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container div:last-child { 973 margin-left: 0; 974 margin-right: 0; 975} 976.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container-750 { 977 display: none; 978} 979.igv-navbar .igv-navbar-right-container .igv-zoom-widget { 980 color: #737373; 981 font-size: 18px; 982 height: 32px; 983 line-height: 32px; 984 margin-left: 8px; 985 user-select: none; 986 display: flex; 987 flex-flow: row; 988 flex-wrap: nowrap; 989 justify-content: flex-end; 990 align-items: center; 991} 992.igv-navbar .igv-navbar-right-container .igv-zoom-widget div { 993 cursor: pointer; 994 margin-left: unset; 995 margin-right: unset; 996} 997.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:first-child { 998 height: 24px; 999 width: 24px; 1000 margin-left: unset; 1001 margin-right: 8px; 1002} 1003.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:last-child { 1004 height: 24px; 1005 width: 24px; 1006 margin-left: 8px; 1007 margin-right: unset; 1008} 1009.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:nth-child(even) { 1010 display: block; 1011 height: fit-content; 1012} 1013.igv-navbar .igv-navbar-right-container .igv-zoom-widget input { 1014 display: block; 1015 width: 125px; 1016} 1017.igv-navbar .igv-navbar-right-container .igv-zoom-widget svg { 1018 display: block; 1019} 1020.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 { 1021 color: #737373; 1022 font-size: 18px; 1023 height: 32px; 1024 line-height: 32px; 1025 margin-left: 8px; 1026 user-select: none; 1027 display: flex; 1028 flex-flow: row; 1029 flex-wrap: nowrap; 1030 justify-content: flex-end; 1031 align-items: center; 1032} 1033.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div { 1034 cursor: pointer; 1035 margin-left: unset; 1036 margin-right: unset; 1037} 1038.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:first-child { 1039 height: 24px; 1040 width: 24px; 1041 margin-left: unset; 1042 margin-right: 8px; 1043} 1044.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:last-child { 1045 height: 24px; 1046 width: 24px; 1047 margin-left: 8px; 1048 margin-right: unset; 1049} 1050.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:nth-child(even) { 1051 width: 0; 1052 height: 0; 1053 display: none; 1054} 1055.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 input { 1056 width: 0; 1057 height: 0; 1058 display: none; 1059} 1060.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 svg { 1061 display: block; 1062} 1063.igv-navbar .igv-navbar-right-container .igv-zoom-widget-hidden { 1064 display: none; 1065} 1066 1067.igv-navbar-button { 1068 display: block; 1069 box-sizing: unset; 1070 padding-left: 6px; 1071 padding-right: 6px; 1072 height: 18px; 1073 text-transform: capitalize; 1074 user-select: none; 1075 line-height: 18px; 1076 text-align: center; 1077 vertical-align: middle; 1078 font-family: "Open Sans", sans-serif; 1079 font-size: 11px; 1080 font-weight: 200; 1081 color: #737373; 1082 background-color: #f3f3f3; 1083 border-color: #737373; 1084 border-style: solid; 1085 border-width: thin; 1086 border-radius: 6px; 1087} 1088 1089.igv-navbar-button-clicked { 1090 color: white; 1091 background-color: #737373; 1092} 1093 1094.igv-navbar-button:hover {
1095 cursor: pointer; 1096} 1097 1098.igv-zoom-in-notice-container { 1099 z-index: 1024; 1100 position: absolute; 1101 top: 8px; 1102 left: 50%; 1103 transform: translate(-50%, 0%); 1104 display: flex; 1105 flex-direction: row; 1106 flex-wrap: nowrap; 1107 justify-content: center; 1108 align-items: center; 1109 background-color: white; 1110} 1111.igv-zoom-in-notice-container > div { 1112 padding-left: 4px; 1113 padding-right: 4px; 1114 padding-top: 2px; 1115 padding-bottom: 2px; 1116 width: 100%; 1117 height: 100%; 1118 font-family: "Open Sans", sans-serif; 1119 font-size: 14px; 1120 font-weight: 400; 1121 color: #3f3f3f; 1122} 1123 1124.igv-zoom-in-notice { 1125 position: absolute; 1126 top: 10px; 1127 left: 50%; 1128} 1129.igv-zoom-in-notice div { 1130 position: relative; 1131 left: -50%; 1132 font-family: "Open Sans", sans-serif; 1133 font-size: medium; 1134 font-weight: 400; 1135 color: #3f3f3f; 1136 background-color: rgba(255, 255, 255, 0.51); 1137 z-index: 64; 1138} 1139 1140.igv-container-spinner { 1141 position: absolute; 1142 top: 90%; 1143 left: 50%; 1144 transform: translate(-50%, -50%); 1145 z-index: 1024; 1146 width: 24px; 1147 height: 24px; 1148 pointer-events: none; 1149 color: #737373; 1150} 1151 1152.igv-multi-locus-close-button { 1153 position: absolute; 1154 top: 2px; 1155 right: 0; 1156 padding-left: 2px; 1157 padding-right: 2px; 1158 width: 12px; 1159 height: 12px; 1160 color: #666666; 1161 background-color: white; 1162 z-index: 1000; 1163} 1164.igv-multi-locus-close-button > svg { 1165 vertical-align: top; 1166} 1167 1168.igv-multi-locus-close-button:hover { 1169 cursor: pointer; 1170 color: #434343; 1171} 1172 1173.igv-multi-locus-ruler-label { 1174 z-index: 64; 1175 position: absolute; 1176 top: 2px; 1177 left: 0; 1178 width: 100%; 1179 height: 12px; 1180 display: flex; 1181 flex-flow: row; 1182 flex-wrap: nowrap; 1183 justify-content: center; 1184 align-items: center; 1185} 1186.igv-multi-locus-ruler-label > div { 1187 font-family: "Open Sans", sans-serif; 1188 font-size: 12px; 1189 color: rgb(16, 16, 16); 1190 background-color: white; 1191} 1192.igv-multi-locus-ruler-label > div { 1193 cursor: pointer; 1194} 1195 1196.igv-multi-locus-ruler-label-square-dot { 1197 z-index: 64; 1198 position: absolute; 1199 left: 50%; 1200 top: 5%; 1201 transform: translate(-50%, 0%); 1202 background-color: white; 1203 display: flex; 1204 flex-flow: row; 1205 flex-wrap: nowrap; 1206 justify-content: flex-start; 1207 align-items: center; 1208} 1209.igv-multi-locus-ruler-label-square-dot > div:first-child { 1210 width: 14px; 1211 height: 14px; 1212} 1213.igv-multi-locus-ruler-label-square-dot > div:last-child { 1214 margin-left: 16px; 1215 font-family: "Open Sans", sans-serif; 1216 font-size: 14px; 1217 font-weight: 400; 1218 color: rgb(16, 16, 16); 1219} 1220 1221.igv-ruler-sweeper { 1222 display: none; 1223 pointer-events: none; 1224 position: absolute; 1225 top: 26px; 1226 bottom: 0; 1227 left: 0; 1228 width: 0; 1229 z-index: 99999; 1230 background-color: rgba(68, 134, 247, 0.25); 1231} 1232 1233.igv-ruler-tooltip { 1234 pointer-events: none; 1235 z-index: 128; 1236 position: absolute; 1237 top: 0; 1238 left: 0; 1239 width: 1px; 1240 height: 32px; 1241 background-color: transparent; 1242 display: flex; 1243 flex-flow: row; 1244 flex-wrap: nowrap; 1245 justify-content: flex-start; 1246 align-items: center; 1247} 1248.igv-ruler-tooltip > div { 1249 pointer-events: none; 1250 width: 128px; 1251 height: auto; 1252 padding: 1px; 1253 color: #373737; 1254 font-size: 10px; 1255 font-family: "Open Sans", sans-serif; 1256 font-weight: 400; 1257 background-color: white; 1258 border-style: solid; 1259 border-width: thin; 1260 border-color: #373737; 1261} 1262 1263.igv-track-label { 1264 position: absolute; 1265 left: 8px; 1266 top: 8px; 1267 width: auto; 1268 height: auto; 1269 max-width: 50%; 1270 padding-left: 4px; 1271 padding-right: 4px; 1272 white-space: nowrap; 1273 overflow: hidden; 1274 text-overflow: ellipsis; 1275 font-family: "Open Sans", sans-serif; 1276 font-size: small; 1277 font-weight: 400; 1278 text-align: center; 1279 user-select: none; 1280 -moz-user-select: none; 1281 -webkit-user-select: none; 1282 border-color: #444; 1283 border-radius: 2px; 1284 border-style: solid; 1285 border-width: thin; 1286 background-color: white; 1287 z-index: 128; 1288 cursor: pointer; 1289} 1290 1291.igv-track-label:hover, 1292.igv-track-label:focus, 1293.igv-track-label:active { 1294 background-color: #e8e8e8; 1295} 1296 1297.igv-track-label-popup-shim { 1298 padding-left: 8px; 1299 padding-right: 8px; 1300 padding-top: 4px; 1301} 1302 1303.igv-center-line { 1304 display: none; 1305 pointer-events: none; 1306 position: absolute; 1307 top: 0; 1308 bottom: 0; 1309 left: 50%; 1310 transform: translateX(-50%); 1311 z-index: 8; 1312 user-select: none; 1313 -moz-user-select: none; 1314 -webkit-user-select: none; 1315 border-left-style: dashed; 1316 border-left-width: thin; 1317 border-right-style: dashed; 1318 border-right-width: thin; 1319} 1320 1321.igv-center-line-wide { 1322 background-color: rgba(0, 0, 0, 0); 1323 border-left-color: rgba(127, 127, 127, 0.51); 1324 border-right-color: rgba(127, 127, 127, 0.51); 1325} 1326 1327.igv-center-line-thin { 1328 background-color: rgba(0, 0, 0, 0); 1329 border-left-color: rgba(127, 127, 127, 0.51); 1330 border-right-color: rgba(0, 0, 0, 0); 1331} 1332 1333.igv-cursor-guide-horizontal { 1334 display: none; 1335 pointer-events: none; 1336 user-select: none; 1337 -moz-user-select: none; 1338 -webkit-user-select: none; 1339 position: absolute; 1340 left: 0; 1341 right: 0; 1342 top: 50%; 1343 height: 1px; 1344 z-index: 1; 1345 margin-left: 50px; 1346 margin-right: 54px; 1347 border-top-style: dotted; 1348 border-top-width: thin; 1349 border-top-color: rgba(127, 127, 127, 0.76); 1350} 1351 1352.igv-cursor-guide-vertical { 1353 pointer-events: none; 1354 user-select: none; 1355 -moz-user-select: none; 1356 -webkit-user-select: none; 1357 position: absolute; 1358 top: 0; 1359 bottom: 0; 1360 left: 50%; 1361 width: 1px; 1362 z-index: 1; 1363 border-left-style: dotted; 1364 border-left-width: thin; 1365 border-left-color: rgba(127, 127, 127, 0.76); 1366 display: none; 1367} 1368 1369.igv-user-feedback { 1370 position: fixed; 1371 top: 50%; 1372 left: 50%; 1373 transform: translate(-50%, -50%); 1374 width: 512px; 1375 height: 360px; 1376 z-index: 2048; 1377 background-color: white; 1378 border-color: #a2a2a2; 1379 border-style: solid; 1380 border-width: thin; 1381 font-family: "Open Sans", sans-serif; 1382 font-size: medium; 1383 font-weight: 400; 1384 color: #444; 1385 display: flex; 1386 flex-direction: column; 1387 flex-wrap: nowrap; 1388 justify-content: flex-start; 1389 align-items: center; 1390} 1391.igv-user-feedback div:first-child { 1392 position: relative; 1393 height: 24px; 1394 width: 100%; 1395 background-color: white; 1396 border-bottom-color: #a2a2a2; 1397 border-bottom-style: solid; 1398 border-bottom-width: thin; 1399} 1400.igv-user-feedback div:first-child div { 1401 position: absolute; 1402 top: 2px; 1403 width: 16px; 1404 height: 16px; 1405 background-color: transparent; 1406} 1407.igv-user-feedback div:first-child div:first-child { 1408 left: 8px; 1409} 1410.igv-user-feedback div:first-child div:last-child { 1411 cursor: pointer; 1412 right: 8px; 1413} 1414.igv-user-feedback div:last-child { 1415 width: 100%; 1416 height: calc(100% - 24px); 1417 border-width: 0; 1418} 1419.igv-user-feedback div:last-child div { 1420 width: auto; 1421 height: auto; 1422 margin: 8px; 1423} 1424 1425.igv-generic-dialog-container { 1426 position: absolute; 1427 top: 0; 1428 left: 0; 1429 width: 300px; 1430 height: 200px; 1431 border-color: #7F7F7F; 1432 border-radius: 4px; 1433 border-style: solid; 1434 border-width: thin; 1435 font-family: "Open Sans", sans-serif; 1436 font-size: medium; 1437 font-weight: 400;
1438 z-index: 2048; 1439 background-color: white; 1440 display: flex; 1441 flex-flow: column; 1442 flex-wrap: nowrap; 1443 justify-content: flex-start; 1444 align-items: center; 1445} 1446.igv-generic-dialog-container .igv-generic-dialog-header { 1447 display: flex; 1448 flex-flow: row; 1449 flex-wrap: nowrap; 1450 justify-content: flex-end; 1451 align-items: center; 1452 width: 100%; 1453 height: 24px; 1454 cursor: move; 1455 border-top-left-radius: 4px; 1456 border-top-right-radius: 4px; 1457 border-bottom-color: #7F7F7F; 1458 border-bottom-style: solid; 1459 border-bottom-width: thin; 1460 background-color: #eee; 1461} 1462.igv-generic-dialog-container .igv-generic-dialog-header div { 1463 margin-right: 4px; 1464 margin-bottom: 2px; 1465 height: 12px; 1466 width: 12px; 1467 color: #7F7F7F; 1468} 1469.igv-generic-dialog-container .igv-generic-dialog-header div:hover { 1470 cursor: pointer; 1471 color: #444; 1472} 1473.igv-generic-dialog-container .igv-generic-dialog-one-liner { 1474 color: #373737; 1475 width: 95%; 1476 height: 24px; 1477 line-height: 24px; 1478 text-align: left; 1479 margin-top: 8px; 1480 padding-left: 8px; 1481 overflow-wrap: break-word; 1482 background-color: white; 1483} 1484.igv-generic-dialog-container .igv-generic-dialog-label-input { 1485 margin-top: 8px; 1486 width: 95%; 1487 height: 24px; 1488 color: #373737; 1489 line-height: 24px; 1490 padding-left: 8px; 1491 background-color: white; 1492 display: flex; 1493 flex-flow: row; 1494 flex-wrap: nowrap; 1495 justify-content: flex-start; 1496 align-items: center; 1497} 1498.igv-generic-dialog-container .igv-generic-dialog-label-input div { 1499 width: 30%; 1500 height: 100%; 1501 font-size: 16px; 1502 text-align: right; 1503 padding-right: 8px; 1504 background-color: white; 1505} 1506.igv-generic-dialog-container .igv-generic-dialog-label-input input { 1507 display: block; 1508 height: 100%; 1509 width: 100%; 1510 padding-left: 4px; 1511 font-family: "Open Sans", sans-serif; 1512 font-weight: 400; 1513 color: #373737; 1514 text-align: left; 1515 outline: none; 1516 border-style: solid; 1517 border-width: thin; 1518 border-color: #7F7F7F; 1519 background-color: white; 1520} 1521.igv-generic-dialog-container .igv-generic-dialog-label-input input { 1522 width: 50%; 1523 font-size: 16px; 1524} 1525.igv-generic-dialog-container .igv-generic-dialog-input { 1526 margin-top: 8px; 1527 width: calc(100% - 16px); 1528 height: 24px; 1529 color: #373737; 1530 line-height: 24px; 1531 display: flex; 1532 flex-flow: row; 1533 flex-wrap: nowrap; 1534 justify-content: space-around; 1535 align-items: center; 1536} 1537.igv-generic-dialog-container .igv-generic-dialog-input input { 1538 display: block; 1539 height: 100%; 1540 width: 100%; 1541 padding-left: 4px; 1542 font-family: "Open Sans", sans-serif; 1543 font-weight: 400; 1544 color: #373737; 1545 text-align: left; 1546 outline: none; 1547 border-style: solid; 1548 border-width: thin; 1549 border-color: #7F7F7F; 1550 background-color: white; 1551} 1552.igv-generic-dialog-container .igv-generic-dialog-input input { 1553 font-size: 16px; 1554} 1555.igv-generic-dialog-container .igv-generic-dialog-ok-cancel { 1556 width: 100%; 1557 height: 28px; 1558 display: flex; 1559 flex-flow: row; 1560 flex-wrap: nowrap; 1561 justify-content: space-around; 1562 align-items: center; 1563} 1564.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div { 1565 margin-top: 32px; 1566 color: white; 1567 font-family: "Open Sans", sans-serif; 1568 font-size: 14px; 1569 font-weight: 400; 1570 width: 75px; 1571 height: 28px; 1572 line-height: 28px; 1573 text-align: center; 1574 border-color: transparent; 1575 border-style: solid; 1576 border-width: thin; 1577 border-radius: 2px; 1578} 1579.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:first-child { 1580 margin-left: 32px; 1581 margin-right: 0; 1582 background-color: #5ea4e0; 1583} 1584.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:last-child { 1585 margin-left: 0; 1586 margin-right: 32px; 1587 background-color: #c4c4c4; 1588} 1589.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:first-child:hover { 1590 cursor: pointer; 1591 background-color: #3b5c7f; 1592} 1593.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:last-child:hover { 1594 cursor: pointer; 1595 background-color: #7f7f7f; 1596} 1597.igv-generic-dialog-container .igv-generic-dialog-ok { 1598 width: 100%; 1599 height: 36px; 1600 margin-top: 32px; 1601 display: flex; 1602 flex-flow: row; 1603 flex-wrap: nowrap; 1604 justify-content: space-around; 1605 align-items: center; 1606} 1607.igv-generic-dialog-container .igv-generic-dialog-ok div { 1608 width: 98px; 1609 height: 36px; 1610 line-height: 36px; 1611 text-align: center; 1612 color: white; 1613 font-family: "Open Sans", sans-serif; 1614 font-size: medium; 1615 font-weight: 400; 1616 border-color: white; 1617 border-style: solid; 1618 border-width: thin; 1619 border-radius: 4px; 1620 background-color: #2B81AF; 1621} 1622.igv-generic-dialog-container .igv-generic-dialog-ok div:hover {
1623 cursor: pointer; 1624 background-color: #25597f; 1625} 1626 1627.igv-generic-container { 1628 position: absolute; 1629 top: 0; 1630 left: 0; 1631 z-index: 2048; 1632 background-color: white; 1633 cursor: pointer; 1634 display: flex; 1635 flex-direction: row; 1636 flex-wrap: wrap; 1637 justify-content: flex-start; 1638 align-items: center; 1639} 1640.igv-generic-container div:first-child { 1641 cursor: move; 1642 display: flex; 1643 flex-flow: row; 1644 flex-wrap: nowrap; 1645 justify-content: flex-end; 1646 align-items: center; 1647 height: 24px; 1648 width: 100%; 1649 background-color: #dddddd; 1650} 1651.igv-generic-container div:first-child i { 1652 display: block; 1653 color: #5f5f5f; 1654 cursor: pointer; 1655 width: 14px; 1656 height: 14px; 1657 margin-right: 8px; 1658 margin-bottom: 4px; 1659} 1660 1661.igv-menu-popup { 1662 position: absolute; 1663 top: 0; 1664 left: 0; 1665 width: max-content; 1666 z-index: 4096; 1667 cursor: pointer; 1668 font-family: "Open Sans", sans-serif; 1669 font-size: small; 1670 font-weight: 400; 1671 color: #4b4b4b; 1672 background: white; 1673 border-radius: 4px; 1674 border-color: #7F7F7F; 1675 border-style: solid; 1676 border-width: thin; 1677 display: flex; 1678 flex-flow: column; 1679 flex-wrap: nowrap; 1680 justify-content: flex-start; 1681 align-items: flex-end; 1682 text-align: left; 1683} 1684.igv-menu-popup > div:not(:first-child) { 1685 width: 100%; 1686} 1687.igv-menu-popup > div:not(:first-child) > div { 1688 background: white; 1689} 1690.igv-menu-popup > div:not(:first-child) > div.context-menu { 1691 padding-left: 4px; 1692 padding-right: 4px; 1693} 1694.igv-menu-popup > div:not(:first-child) > div:last-child { 1695 border-bottom-left-radius: 4px; 1696 border-bottom-right-radius: 4px; 1697 border-bottom-color: transparent; 1698 border-bottom-style: solid; 1699 border-bottom-width: thin; 1700} 1701.igv-menu-popup > div:not(:first-child) > div:hover { 1702 background: #efefef; 1703} 1704 1705.igv-menu-popup-shim { 1706 padding-left: 8px; 1707 padding-right: 8px; 1708 padding-bottom: 1px; 1709 padding-top: 1px; 1710} 1711 1712.igv-menu-popup-header { 1713 position: relative; 1714 width: 100%; 1715 height: 24px; 1716 cursor: move; 1717 border-top-color: transparent; 1718 border-top-left-radius: 4px; 1719 border-top-right-radius: 4px; 1720 border-bottom-color: #7F7F7F; 1721 border-bottom-style: solid; 1722 border-bottom-width: thin; 1723 background-color: #eee; 1724 display: flex; 1725 flex-flow: row; 1726 flex-wrap: nowrap; 1727 justify-content: flex-end; 1728 align-items: center; 1729} 1730.igv-menu-popup-header div { 1731 margin-right: 4px; 1732 height: 12px; 1733 width: 12px; 1734 color: #7F7F7F; 1735} 1736.igv-menu-popup-header div:hover { 1737 cursor: pointer; 1738 color: #444; 1739} 1740 1741.igv-menu-popup-check-container { 1742 display: flex; 1743 flex-flow: row; 1744 flex-wrap: nowrap; 1745 justify-content: flex-start; 1746 align-items: center; 1747 width: 100%; 1748 height: 20px; 1749 margin-right: 4px; 1750 background-color: transparent; 1751} 1752.igv-menu-popup-check-container div { 1753 padding-top: 2px; 1754 padding-left: 8px; 1755} 1756.igv-menu-popup-check-container div:first-child { 1757 position: relative; 1758 width: 12px; 1759 height: 12px; 1760} 1761.igv-menu-popup-check-container div:first-child svg { 1762 position: absolute; 1763 width: 12px; 1764 height: 12px; 1765} 1766 1767.igv-user-feedback { 1768 position: fixed; 1769 top: 50%; 1770 left: 50%; 1771 transform: translate(-50%, -50%); 1772 width: 512px; 1773 height: 360px; 1774 z-index: 2048; 1775 background-color: white; 1776 border-color: #a2a2a2; 1777 border-style: solid; 1778 border-width: thin; 1779 font-family: "Open Sans", sans-serif; 1780 font-size: medium; 1781 font-weight: 400; 1782 color: #444; 1783 display: flex; 1784 flex-direction: column; 1785 flex-wrap: nowrap; 1786 justify-content: flex-start; 1787 align-items: center; 1788} 1789.igv-user-feedback div:first-child { 1790 position: relative; 1791 height: 24px; 1792 width: 100%; 1793 background-color: white; 1794 border-bottom-color: #a2a2a2; 1795 border-bottom-style: solid; 1796 border-bottom-width: thin; 1797} 1798.igv-user-feedback div:first-child div { 1799 position: absolute; 1800 top: 2px; 1801 width: 16px; 1802 height: 16px; 1803 background-color: transparent; 1804} 1805.igv-user-feedback div:first-child div:first-child { 1806 left: 8px; 1807} 1808.igv-user-feedback div:first-child div:last-child { 1809 cursor: pointer; 1810 right: 8px; 1811} 1812.igv-user-feedback div:last-child { 1813 width: 100%; 1814 height: calc(100% - 24px); 1815 border-width: 0; 1816} 1817.igv-user-feedback div:last-child div { 1818 width: auto; 1819 height: auto; 1820 margin: 8px; 1821} 1822 1823.igv-loading-spinner-container { 1824 z-index: 1024; 1825 position: absolute; 1826 top: 50%; 1827 left: 50%; 1828 transform: translate(-50%, -50%); 1829 width: 32px; 1830 height: 32px; 1831 display: flex; 1832 flex-direction: row; 1833 flex-wrap: nowrap; 1834 justify-content: center; 1835 align-items: center; 1836} 1837.igv-loading-spinner-container > div { 1838 box-sizing: border-box; 1839 width: 100%; 1840 height: 100%; 1841 border-radius: 50%; 1842 border: 4px solid rgba(128, 128, 128, 0.5); 1843 border-top-color: rgb(255, 255, 255); 1844 animation: spin 1s ease-in-out infinite; 1845 -webkit-animation: spin 1s ease-in-out infinite; 1846} 1847 1848@keyframes spin { 1849 to { 1850 -webkit-transform: rotate(360deg); 1851 transform: rotate(360deg); 1852 } 1853} 1854@-webkit-keyframes spin { 1855 to { 1856 -webkit-transform: rotate(360deg); 1857 transform: rotate(360deg); 1858 } 1859} 1860.igv-roi-menu-next-gen { 1861 position: absolute; 1862 z-index: 512; 1863 font-family: "Open Sans", sans-serif; 1864 font-size: small; 1865 font-weight: 400; 1866 color: #4b4b4b; 1867 background-color: white; 1868 width: 192px; 1869 border-radius: 4px; 1870 border-color: #7F7F7F; 1871 border-style: solid; 1872 border-width: thin; 1873 display: flex; 1874 flex-direction: column; 1875 flex-wrap: nowrap; 1876 justify-content: flex-start; 1877 align-items: stretch; 1878} 1879.igv-roi-menu-next-gen > div:first-child { 1880 height: 24px; 1881 border-top-color: transparent; 1882 border-top-left-radius: 4px; 1883 border-top-right-radius: 4px; 1884 border-bottom-color: #7F7F7F; 1885 border-bottom-style: solid; 1886 border-bottom-width: thin; 1887 background-color: #eee; 1888 display: flex; 1889 flex-flow: row; 1890 flex-wrap: nowrap; 1891 justify-content: flex-end; 1892 align-items: center; 1893} 1894.igv-roi-menu-next-gen > div:first-child > div { 1895 margin-right: 4px; 1896 height: 12px; 1897 width: 12px; 1898 color: #7F7F7F; 1899} 1900.igv-roi-menu-next-gen > div:first-child > div:hover {
1901 cursor: pointer; 1902 color: #444; 1903} 1904.igv-roi-menu-next-gen > div:last-child { 1905 background-color: white; 1906 border-bottom-left-radius: 4px; 1907 border-bottom-right-radius: 4px; 1908 border-bottom-color: transparent; 1909 border-bottom-style: solid; 1910 border-bottom-width: 0; 1911 display: flex; 1912 flex-direction: column; 1913 flex-wrap: nowrap; 1914 justify-content: flex-start; 1915 align-items: stretch; 1916 text-align: start; 1917 vertical-align: middle; 1918} 1919.igv-roi-menu-next-gen > div:last-child > div { 1920 height: 24px; 1921 padding-left: 4px; 1922 border-bottom-style: solid; 1923 border-bottom-width: thin; 1924 border-bottom-color: #7f7f7f; 1925} 1926.igv-roi-menu-next-gen > div:last-child > div:not(:first-child):hover { 1927 background-color: rgba(127, 127, 127, 0.1); 1928} 1929.igv-roi-menu-next-gen > div:last-child div:first-child { 1930 font-style: italic; 1931 text-align: center; 1932 padding-right: 4px; 1933 white-space: nowrap; 1934 overflow: hidden; 1935 text-overflow: ellipsis; 1936} 1937.igv-roi-menu-next-gen > div:last-child > div:last-child { 1938 border-bottom-width: 0; 1939 border-bottom-color: transparent; 1940} 1941 1942.igv-roi-placeholder { 1943 font-style: normal; 1944 color: rgba(75, 75, 75, 0.6); 1945} 1946 1947.igv-roi-table { 1948 position: absolute; 1949 z-index: 1024; 1950 width: min-content; 1951 max-width: 1600px; 1952 border-color: #7f7f7f; 1953 border-radius: 4px; 1954 border-style: solid; 1955 border-width: thin; 1956 font-family: "Open Sans", sans-serif; 1957 font-size: 12px; 1958 font-weight: 400; 1959 background-color: white; 1960 display: flex; 1961 flex-flow: column; 1962 flex-wrap: nowrap; 1963 justify-content: flex-start; 1964 align-items: stretch; 1965 cursor: default; 1966} 1967.igv-roi-table > div { 1968 height: 24px; 1969 font-size: 14px; 1970 text-align: start; 1971 vertical-align: middle; 1972 line-height: 24px; 1973} 1974.igv-roi-table > div:first-child { 1975 border-color: transparent; 1976 border-top-left-radius: 4px; 1977 border-top-right-radius: 4px; 1978 border-top-width: 0; 1979 border-bottom-color: #7f7f7f; 1980 border-bottom-style: solid; 1981 border-bottom-width: thin; 1982 background-color: #eee; 1983 cursor: move; 1984 display: flex; 1985 flex-flow: row; 1986 flex-wrap: nowrap; 1987 justify-content: space-between; 1988 align-items: center; 1989} 1990.igv-roi-table > div:first-child > div:first-child { 1991 text-align: center; 1992 white-space: nowrap; 1993 text-overflow: ellipsis; 1994 overflow: hidden; 1995 margin-left: 4px; 1996 margin-right: 4px; 1997 width: calc(100% - 4px - 12px); 1998} 1999.igv-roi-table > div:first-child > div:last-child { 2000 margin-right: 4px; 2001 margin-bottom: 2px; 2002 height: 12px; 2003 width: 12px; 2004 color: #7f7f7f; 2005} 2006.igv-roi-table > div:first-child > div:last-child > svg { 2007 display: block; 2008} 2009.igv-roi-table > div:first-child > div:last-child:hover { 2010 cursor: pointer; 2011 color: #444; 2012} 2013.igv-roi-table > .igv-roi-table-description { 2014 padding: 4px; 2015 margin-left: 4px; 2016 word-break: break-all; 2017 overflow-y: auto; 2018 display: flex; 2019 flex-flow: row; 2020 flex-wrap: nowrap; 2021 background-color: transparent; 2022} 2023.igv-roi-table > .igv-roi-table-goto-explainer { 2024 margin-top: 5px; 2025 margin-left: 4px; 2026 color: #7F7F7F; 2027 font-style: italic; 2028 height: 24px; 2029 border-top: solid lightgray; 2030 background-color: transparent; 2031} 2032.igv-roi-table > .igv-roi-table-column-titles { 2033 height: 24px; 2034 display: flex; 2035 flex-flow: row; 2036 flex-wrap: nowrap; 2037 justify-content: stretch; 2038 align-items: stretch; 2039 padding-right: 16px; 2040 background-color: white; 2041 border-top-color: #7f7f7f; 2042 border-top-style: solid; 2043 border-top-width: thin; 2044 border-bottom-color: #7f7f7f; 2045 border-bottom-style: solid; 2046 border-bottom-width: thin; 2047} 2048.igv-roi-table > .igv-roi-table-column-titles > div { 2049 font-size: 14px; 2050 vertical-align: middle; 2051 line-height: 24px; 2052 text-align: left; 2053 margin-left: 4px; 2054 height: 24px; 2055 overflow: hidden; 2056 text-overflow: ellipsis; 2057 border-right-color: #7f7f7f; 2058 border-right-style: solid; 2059 border-right-width: thin; 2060} 2061.igv-roi-table > .igv-roi-table-column-titles > div:last-child { 2062 border-right: unset; 2063} 2064.igv-roi-table > .igv-roi-table-row-container { 2065 overflow: auto; 2066 resize: both; 2067 max-width: 1600px; 2068 height: 360px; 2069 background-color: transparent; 2070 display: flex; 2071 flex-flow: column; 2072 flex-wrap: nowrap; 2073 justify-content: flex-start; 2074 align-items: stretch; 2075} 2076.igv-roi-table > .igv-roi-table-row-container > .igv-roi-table-row { 2077 height: 24px; 2078 display: flex; 2079 flex-flow: row; 2080 flex-wrap: nowrap; 2081 justify-content: stretch; 2082 align-items: stretch; 2083} 2084.igv-roi-table > .igv-roi-table-row-container > .igv-roi-table-row > div { 2085 font-size: 14px; 2086 vertical-align: middle; 2087 line-height: 24px; 2088 text-align: left; 2089 margin-left: 4px; 2090 height: 24px; 2091 white-space: nowrap; 2092 overflow: hidden; 2093 text-overflow: ellipsis; 2094 border-right-color: transparent; 2095 border-right-style: solid; 2096 border-right-width: thin; 2097} 2098.igv-roi-table > .igv-roi-table-row-container > .igv-roi-table-row > div:last-child { 2099 border-right: unset; 2100} 2101.igv-roi-table > .igv-roi-table-row-container > .igv-roi-table-row-hover { 2102 background-color: rgba(0, 0, 0, 0.04); 2103} 2104.igv-roi-table >
2104 div:last-child { 2105 height: 32px; 2106 line-height: 32px; 2107 border-top-color: #7f7f7f; 2108 border-top-style: solid; 2109 border-top-width: thin; 2110 border-bottom-color: transparent; 2111 border-bottom-left-radius: 4px; 2112 border-bottom-right-radius: 4px; 2113 border-bottom-width: 0; 2114 background-color: #eee; 2115 display: flex; 2116 flex-flow: row; 2117 flex-wrap: nowrap; 2118 justify-content: space-around; 2119 align-items: center; 2120} 2121 2122.igv-roi-table-row-selected { 2123 background-color: rgba(0, 0, 0, 0.125); 2124} 2125 2126.igv-roi-table-button { 2127 cursor: pointer; 2128 height: 20px; 2129 user-select: none; 2130 line-height: 20px; 2131 text-align: center; 2132 vertical-align: middle; 2133 font-family: "Open Sans", sans-serif; 2134 font-size: 13px; 2135 font-weight: 400; 2136 color: black; 2137 padding-left: 6px; 2138 padding-right: 6px; 2139 background-color: rgb(239, 239, 239); 2140 border-color: black; 2141 border-style: solid; 2142 border-width: thin; 2143 border-radius: 3px; 2144} 2145 2146.igv-roi-table-button:hover { 2147 font-weight: 400; 2148 background-color: rgba(0, 0, 0, 0.13); 2149} 2150 2151.igv-roi-region { 2152 z-index: 64; 2153 position: absolute; 2154 top: 0; 2155 bottom: 0; 2156 pointer-events: none; 2157 overflow: visible; 2158 margin-top: 44px; 2159 display: flex; 2160 flex-direction: column; 2161 flex-wrap: nowrap; 2162 justify-content: flex-start; 2163 align-items: stretch; 2164} 2165.igv-roi-region > div { 2166 position: relative; 2167 width: 100%; 2168 height: 8px; 2169 pointer-events: auto; 2170} 2171 2172.igv-roi-menu { 2173 position: absolute; 2174 z-index: 1024; 2175 width: 144px; 2176 border-color: #7f7f7f; 2177 border-radius: 4px; 2178 border-style: solid; 2179 border-width: thin; 2180 font-family: "Open Sans", sans-serif; 2181 background-color: white; 2182 display: flex; 2183 flex-flow: column; 2184 flex-wrap: nowrap; 2185 justify-content: flex-start; 2186 align-items: stretch; 2187} 2188.igv-roi-menu > div:not(:last-child) { 2189 border-bottom-color: rgba(128, 128, 128, 0.5); 2190 border-bottom-style: solid; 2191 border-bottom-width: thin; 2192} 2193.igv-roi-menu > div:first-child { 2194 border-top-left-radius: 4px; 2195 border-top-right-radius: 4px; 2196 border-top-color: transparent; 2197 border-top-style: solid; 2198 border-top-width: 0; 2199} 2200.igv-roi-menu > div:last-child { 2201 border-bottom-left-radius: 4px; 2202 border-bottom-right-radius: 4px; 2203 border-bottom-color: transparent; 2204 border-bottom-style: solid; 2205 border-bottom-width: 0; 2206} 2207 2208.igv-roi-menu-row { 2209 height: 24px; 2210 padding-left: 8px; 2211 font-size: small; 2212 text-align: start; 2213 vertical-align: middle; 2214 line-height: 24px; 2215 background-color: white; 2216} 2217 2218.igv-roi-menu-row-edit-description { 2219 width: -webkit-fill-available; 2220 font-size: small; 2221 text-align: start; 2222 vertical-align: middle; 2223 background-color: white; 2224 padding-left: 4px; 2225 padding-right: 4px; 2226 padding-bottom: 4px; 2227 display: flex; 2228 flex-direction: column; 2229 flex-wrap: nowrap; 2230 justify-content: stretch; 2231 align-items: stretch; 2232} 2233.igv-roi-menu-row-edit-description > label { 2234 margin-left: 2px; 2235 margin-bottom: 0; 2236 display: block; 2237 width: -webkit-fill-available; 2238} 2239.igv-roi-menu-row-edit-description > input { 2240 display: block; 2241 margin-left: 2px; 2242 margin-right: 2px; 2243 margin-bottom: 1px; 2244 width: -webkit-fill-available; 2245} 2246 2247.igv-container { 2248 position: relative; 2249 display: flex; 2250 flex-direction: column; 2251 flex-wrap: nowrap; 2252 justify-content: flex-start; 2253 align-items: flex-start; 2254 padding-top: 4px; 2255 user-select: none; 2256 -webkit-user-select: none; 2257 -ms-user-select: none; 2258} 2259 2260.igv-viewport { 2261 position: relative; 2262 margin-top: 5px; 2263 line-height: 1; 2264 overflow-x: hidden; 2265 overflow-y: hidden; 2266} 2267 2268.igv-viewport-content { 2269 position: relative; 2270 width: 100%; 2271} 2272.igv-viewport-content > canvas { 2273 position: relative; 2274 display: block; 2275} 2276 2277.igv-column-container { 2278 position: relative; 2279 display: flex; 2280 flex-direction: row; 2281 flex-wrap: nowrap; 2282 justify-content: flex-start; 2283 align-items: stretch; 2284 width: 100%; 2285} 2286 2287.igv-column-shim { 2288 width: 1px; 2289 margin-left: 2px; 2290 margin-right: 2px; 2291 background-color: #545453; 2292} 2293 2294.igv-column { 2295 position: relative; 2296 position: relative; 2297 display: flex; 2298 flex-direction: column; 2299 flex-wrap: nowrap; 2300 justify-content: flex-start; 2301 align-items: flex-start; 2302 box-sizing: border-box; 2303 height: 100%; 2304} 2305 2306.igv-axis-column { 2307 position: relative; 2308 display: flex; 2309 flex-direction: column; 2310 flex-wrap: nowrap; 2311 justify-content: flex-start; 2312 align-items: flex-start; 2313 box-sizing: border-box; 2314 height: 100%; 2315 width: 50px; 2316} 2317.igv-axis-column > div { 2318 margin-top: 5px; 2319 width: 100%; 2320} 2321 2322.igv-sample-name-column { 2323 position: relative; 2324 display: flex; 2325 flex-direction: column; 2326 flex-wrap: nowrap; 2327 justify-content: flex-start; 2328 align-items: flex-start; 2329 box-sizing: border-box; 2330 height: 100%; 2331} 2332 2333.igv-scrollbar-column { 2334 position: relative; 2335 display: flex; 2336 flex-direction: column; 2337 flex-wrap: nowrap; 2338 justify-content: flex-start; 2339 align-items: flex-start; 2340 box-sizing: border-box; 2341 height: 100%; 2342 width: 14px; 2343} 2344.igv-scrollbar-column > div { 2345 position: relative; 2346 margin-top: 5px; 2347 width: 14px; 2348} 2349.igv-scrollbar-column > div > div { 2350 cursor: pointer; 2351 position: absolute; 2352 top: 0; 2353 left: 2px; 2354 width: 8px; 2355 border-width: 1px; 2356 border-style: solid; 2357 border-color: #c4c4c4; 2358 border-top-left-radius: 4px; 2359 border-top-right-radius: 4px; 2360 border-bottom-left-radius: 4px; 2361 border-bottom-right-radius: 4px; 2362} 2363.igv-scrollbar-column > div > div:hover { 2364 background-color: #c4c4c4; 2365} 2366 2367.igv-track-drag-column { 2368 position: relative; 2369 display: flex; 2370 flex-direction: column; 2371 flex-wrap: nowrap; 2372 justify-content: flex-start; 2373 align-items: flex-start; 2374 box-sizing: border-box; 2375 height: 100%; 2376 width: 12px; 2377 background-color: white; 2378} 2379.igv-track-drag-column > .igv-track-drag-handle { 2380 z-index: 512; 2381 position: relative; 2382 cursor: pointer; 2383 margin-top: 5px; 2384 width: 100%; 2385 border-style: solid; 2386 border-width: 0; 2387 border-top-right-radius: 6px; 2388 border-bottom-right-radius: 6px; 2389 background-color: #c4c4c4; 2390} 2391.igv-track-drag-column .igv-track-drag-handle-hover { 2392 background-color: #787878; 2393} 2394.igv-track-drag-column > .igv-track-drag-shim { 2395 position: relative; 2396 margin-top: 5px; 2397 width: 100%; 2398 border-style: solid; 2399 border-width: 0; 2400} 2401 2402.igv-gear-menu-column { 2403 position: relative; 2404 display: flex; 2405 flex-direction: column; 2406 flex-wrap: nowrap; 2407 justify-content: flex-start; 2408 align-items: flex-start; 2409 box-sizing: border-box; 2410 height: 100%; 2411 width: 28px; 2412} 2413.igv-gear-menu-column > div { 2414 display: flex; 2415 flex-direction: column; 2416 flex-wrap: nowrap; 2417 justify-content: flex-start; 2418 align-items: center; 2419 margin-top: 5px; 2420 width: 100%; 2421 background: white; 2422} 2423.igv-gear-menu-column > div > div { 2424 position: relative; 2425 margin-top: 4px; 2426 width: 16px; 2427 height: 16px; 2428 color: #7F7F7F; 2429} 2430.igv-gear-menu-column > div > div:hover {
2431 cursor: pointer; 2432 color: #444; 2433} 2434 2435/*# sourceMappingURL=dom.css.map */ 2436`,document.head.append(r)})();const Ww=Ct.oauth;var $w={TrackUtils:Qg,IGVGraphics:at,MenuUtils:Xe,DataRangeDialog:Gl,createTrack:async function(r,t){return await Cs.prototype.createTrack.call(t,r)},createBrowser:async function(r,t){t===void 0&&(t={}),be.KNOWN_GENOMES||await be.initializeGenomes(t),(function(n){n.minimumBases===void 0&&(n.minimumBases=40),n.showIdeogram===void 0&&(n.showIdeogram=!0),n.showCircularView===void 0&&(n.showCircularView=!1),n.showCircularViewButton===void 0&&(n.showCircularViewButton=!1),n.showTrackLabelButton===void 0&&(n.showTrackLabelButton=!0),n.showTrackLabels===void 0&&(n.showTrackLabels=!0),n.showROITableButton===void 0&&(n.showROITableButton=!1),n.showROITable===void 0&&(n.showROITable=!1),n.showCursorTrackingGuideButton===void 0&&(n.showCursorTrackingGuideButton=!0),n.showCursorGuide===void 0&&(n.showCursorGuide=n.showCursorTrackingGuide||!1),n.showCenterGuideButton===void 0&&(n.showCenterGuideButton=!0),n.showCenterGuide===void 0&&(n.showCenterGuide=!1),n.showSampleNames===void 0&&(n.showSampleNames=!1),n.showSVGButton===void 0&&(n.showSVGButton=!0),n.showControls===void 0&&(n.showControls=!0),n.showNavigation===void 0&&(n.showNavigation=!0),n.showRuler===void 0&&(n.showRuler=!0),n.flanking===void 0&&(n.flanking=1e3),n.pairsSupported===void 0&&(n.pairsSupported=!0),n.tracks||(n.tracks=[])})(t),t.queryParametersSupported&&(function(n){var i,s,o,a,l,h,c,u;let p,d,w;if(h=window.location.href,i=h.indexOf("?"),s=h.lastIndexOf("#"),i>=0)for(s<0&&(s=h.length),o=i+1;o<s;)(a=h.indexOf("&",o))<0&&(a=s),(l=h.substring(o,a).split("=",2)).length===2?(c=l[0],u=decodeURIComponent(l[1]),c==="file"?p=u.split(","):c==="index"?d=u.split(","):c==="name"?w=u.split(","):c!=="genome"||!u.startsWith("https://")&&!u.startsWith("http://")||u.endsWith(".json")?n[c]=u:n.reference={fastaURL:u,indexURL:u+".fai"},o=a+1):o++;if(p){n.tracks||(n.tracks=[]);for(let m=0;m<p.length;m++){if(p[m].endsWith(".xml")||p[m].endsWith(".json")){n.sessionURL=p[m];break}const g={url:p[m]};d&&d.length>m&&(g.indexURL=d[m]),w&&w.length>m&&(g.name=w[m]),n.tracks.push(g)}}})(t),t.apiKey&&Ct.setApiKey(t.apiKey),t.oauthToken&&Ct.setOauthToken(t.oauthToken),t.clientId&&!jr()&&await(async function(n){if(!google.accounts.oauth2.initTokenClient)throw new Error("Google accounts token client not loaded (https://accounts.google.com/gsi/client)");if(jr())throw new Error("Google client is already initialized");const i={client_id:n.client_id||n.clientId,scope:n.scope||"https://www.googleapis.com/auth/userinfo.profile",state:n.state||"igv",error:o=>{throw new Error(o.type)},hint:n.hint,hosted_domain:n.hosted_domain},s=google.accounts.oauth2.initTokenClient(i);google.igv={tokenClient:s,apiKey:n.apiKey}})({clientId:t.clientId,apiKey:t.apiKey,scope:"https://www.googleapis.com/auth/userinfo.profile"});const e=new Cs(t,r);return Cn.push(e),t.sessionURL?await e.loadSession({url:t.sessionURL}):await e.loadSessionObject(t),e.navbarManager.navbarDidResize(e.$navigation.width()),e},removeBrowser:function(r){r.dispose(),r.root.remove(),Cn=Cn.filter((t=>t!==r))},removeAllBrowsers:function(){for(let r of Cn)r.dispose(),r.root.remove();Cn=[]},visibilityChange:async function(){for(let r of Cn)await r.visibilityChange()},setGoogleOauthToken:function(r){return Ct.setOauthToken(r)},setOauthToken:function(r,t){return Ct.setOauthToken(r,t)},oauth:Ww,version:um,setApiKey:jw,registerFileFormats:ac};return $w}))})(Ss)),Ss.exports}var sv=iv();const ov="/assets/genome_browser_demo-JOKWIUNT.png",av={components:{Upsell30x:rv},mounted(){document.title="Genome Browser - "+this.$config.subText},data(){return{loading:!0,restoreInitiated:!1,isArchived:!1,isRestoring:!1,hasCram:!1,url:null,indexURL:null,s3Key:null,igvLoaded:!1}},async created(){await this.$store.dispatch("userReporting/getUserSnpMarker"),await this.loadLinks(),this.loading=!1},async updated(){await this.loadIgv()},methods:{...Yw(["setModal"]),async loadIgv(){const{url:ue,indexURL:Bt}=this;if(!this.loading&&!this.igvLoaded&&["bgi","g42","prph"].includes(this.snpSource)&&!this.isArchived&&ue&&Bt){this.igvLoaded=!0;const Wt={genome:"hg38_1kg",tracks:[{name:"Your Genes",format:"cram",url:ue,indexURL:Bt}]};await sv.createBrowser(this.$refs.igv,Wt)}},async loadLinks(){if(["bgi","g42","prph"].includes(this.snpSource)){let{data:ue}=await Sf.getUserDownloadLinks30x();if(!ue.length)return;ue=ue.filter(Wt=>typeof Wt=="object"?!0:typeof Wt=="string"?!Wt.includes(".md5"):!0);const Bt=ev.chain(ue).filter(Wt=>
2436typeof Wt=="string"&&Wt.includes(".cram")||typeof Wt=="object"&&Wt.fileType&&Wt.fileType.includes(".cram")).reduce((Wt,Dt)=>(typeof Dt=="string"&&Dt.includes(".cram.crai")?Wt.indexURL=Dt:typeof Dt=="string"?Wt.url=Dt:Wt={...Wt,...Dt,isArchived:!0,isRestoring:Dt.status==="restore-initiated"},Wt),{isArchived:!1,isRestoring:!1,url:null,indexURL:null}).value();this.isArchived=Bt.isArchived,this.isRestoring=Bt.isRestoring,this.url=Bt.url,this.indexURL=Bt.indexURL,this.s3Key=Bt.s3Key,this.hasCram=!!(Bt.url||Bt.isArchived)}},async restoreFile(){if(window.confirm("Restore the file?"))try{this.loading=!0,this.restoreInitiated=!0,await Sf.postArchiveRestoreRequest(this.s3Key,this.snpSource),await this.loadLinks()}catch{window.alert("File restore request failed!")}finally{this.loading=!1,this.restoreInitiated=!1}}},computed:{...Xw("userReporting",["snpSource"]),isFileError(){return["bgi","g42","prph"].includes(this.snpSource)&&this.hasCram&&!this.url&&!this.isArchived&&!this.isRestoring}}},lv={key:0,class:"spinner text-center"},hv={key:0},cv={key:1},uv={key:2,class:"maintenance-banner container"},dv={key:3,class:"container body"},fv={class:"component traits"},pv={class:"component-body"},gv={key:0,class:"only-30x"},mv={key:1,class:"only-30x"},bv={key:2,class:"restore-container"},wv={key:0},vv={class:"text-center"},yv={key:1,class:"disclaimer"},_v={key:3},xv={class:"col-12 text-center p-4 mb-4"},kv={class:"error"},Cv={class:"error-text"},Sv={key:4,class:"igv",ref:"igv"};function Av(ue,Bt,Wt,Dt,Re,Ke){const mi=Kw("Upsell30x");return Be(),Ve("div",null,[Re.loading?(Be(),Ve("div",lv,[Bt[2]||(Bt[2]=Ae("img",{src:tv,width:"100",height:"100"},null,-1)),Re.restoreInitiated?(Be(),Ve("p",hv,"Requesting restore ...")):(Be(),Ve("p",cv,"Loading your report ..."))])):yr("",!0),Re.loading?yr("",!0):(Be(),Jw(mi,{key:1})),!Re.loading&&!Re.hasCram?(Be(),Ve("div",uv,[...Bt[3]||(Bt[3]=[Ae("img",{src:kf,width:"50",height:"50"},null,-1),Ae("h4",null,"Genome Browser â Under Maintenance",-1),Ae("p",null," The Genome Browser is temporarily unavailable. We apologize for the inconvenience and will restore this feature as soon as possible. ",-1)])])):yr("",!0),!Re.loading&&Re.hasCram?(Be(),Ve("div",dv,[Ae("div",fv,[Ae("div",pv,[["bgi","g42","prph"].includes(ue.snpSource)?yr("",!0):(Be(),Ve("div",gv,[...Bt[4]||(Bt[4]=[Ba(" Genome Browser is available with 30x Whole Genomce Sequencing data only! ",-1),Ae("a",{href:"https://nebula.org/whole-genome-sequencing/?utm_source=nebula&utm_medium=expand_04x_portal&utm_campaign=internal_30x_promotion"},"click to learn more!",-1)])])),Bt[11]||(Bt[11]=Cf('<div class="header" data-v-12a56b19><div class="important" data-v-12a56b19> IMPORTANT: Please switch to a larger screen in order to use the Genome Browser. For the best experience, we recommend using a laptop/desktop computer. </div><h1 data-v-12a56b19>Genome Browser</h1><p class="page-description" data-v-12a56b19> Welcome to our genome browser. It is a tool that enables you to take a direct look at the sequencing data that is stored in your CRAM (compressed BAM) file. Here, we briefly explain some of the core functionalities step-by-step to help you get started. </p></div><div class="section" data-v-12a56b19><div class="title" data-v-12a56b19>Searching for Genes and Variants</div><div class="subtitle" data-v-12a56b19> Letâs start by searching for something interesting. In the top left corner of the genome browser, you can find a search bar. Here you can type in gene names and genome locations. </div><div class="points" data-v-12a56b19><span class="bold" data-v-12a56b19>Search using gene names:</span> Type in âAPOEâ and press enter. The genome browser will move through your genome to the location of the APOE gene. You should be able to see the gene name in the bottom part of the genome browser. APOE is an important gene because some genetic variants in the APOE gene are known to increase the risk of Alzheimerâs disease. We have written a blog post about the APOE gene that you can <a href="https://blog.nebula.org/apolipoprotein-e-apoe/" target="_blank" data-v-12a56b19>read here</a>. </div><div class="points" data-v-12a56b19><span class="bold" data-v-12a56b19>Search using genome locations:</span>
2436 The two variants in the APOE gene that are linked to Alzheimerâs risk are rs7412 and rs429358. Their coordinates are â19:44908822â and â19:44908684â respectively. The format of these queries is â[chromosome number]:[chromosome position]â. You can find variant coordinates by searching for a variant in the <a href="https://www.ncbi.nlm.nih.gov/snp/?term=rs429358" target="_blank" data-v-12a56b19>dbSNP database</a> (use the GRCh38 coordinates). Copy-paste one of these two locations into the search bar and press enter. The genome browser will now zoom in to these locations. Activate the âCenter Lineâ in the bar at the top to better see the location that you are looking at. </div></div><div class="section" data-v-12a56b19><div class="title" data-v-12a56b19>Viewing your Sequencing Data</div><div class="subtitle" data-v-12a56b19> Now letâs take a look at the results of your search. After searching for one of the variants in the APOE gene, you should now see in front of you stacked, grey stripes. Those are your personal DNA sequencing reads that are aligned to a reference genome sequence (colored letters above). If your DNA sequence matches the reference, then the stripes are grey. If the sequence is somehow different from the reference, then you will be shown various letters and symbols in different colors. You might wonder why are there are so many sequencing reads. Thatâs because sequencing is an error-prone process. We read every position on average 30 times to make sure that we determine your DNA sequence correctly. Now read out your genotype at position 19:44908822. You will see one of three things: </div><div class="points" data-v-12a56b19><span class="bold" data-v-12a56b19>2 reference alleles:</span> If your DNA at the 19:44908822 location matches the reference genome, which is a C at this position, all you will see are grey stripes. Your genotype at this position is CC. </div><div class="points" data-v-12a56b19><span class="bold" data-v-12a56b19>2 variant alleles:</span> If your DNA differs from the reference sequence at the 19:44908822 position, you will see a column of the letter T. Your genotype is TT. </div><div class="points" data-v-12a56b19><span class="bold" data-v-12a56b19>1 reference allele and 1 variant allele:</span> If you inherited a C from one parent and a T from the other parent, then approximately half of the sequencing reads will be grey at the 19:44908822 position, while the other half will have the letter C. </div></div>',3)),["bgi","g42","prph"].includes(ue.snpSource)?yr("",!0):(Be(),Ve("div",mv,[...Bt[5]||(Bt[5]=[Ae("img",{class:"genome-broswer-screenshot",src:ov},null,-1)])])),Bt[12]||(Bt[12]=Cf('<div class="section" data-v-12a56b19><div class="subtitle links" data-v-12a56b19> Our genome browser is based on the Interactive Genome Viewer (IGV) that was developed at the Broad Institute of MIT and Harvard. Here are some additional resources that you can use: </div><div class="points links" data-v-12a56b19><a href="https://software.broadinstitute.org/software/igv/UserGuide" target="_blank" data-v-12a56b19>IGV User Guide</a><a href="https://www.youtube.com/channel/UCb5W5WqauDOwubZHb-IA_rA" target="_blank" data-v-12a56b19>IGV Tutorial Videos</a></div></div>',1)),["bgi","g42","prph"].includes(ue.snpSource)&&Re.isArchived&&Re.hasCram?(Be(),Ve("div",bv,[Re.isRestoring?(Be(),Ve("div",yv," The CRAM file is being restored. The file restore will be complete within 48 hours and you will receive an email notification once completed. ")):(Be(),Ve("div",wv,[Bt[6]||(Bt[6]=Ae("div",{class:"disclaimer"}," The data (CRAM file) used to power the Genome Browser has been archived. If you wish to restore the CRAM file to use Genome browser, please click the 'Restore CRAM File' button below. The file will be ready within 48 hours and you will receive an email notification once completed. ",-1)),Ae("div",vv,[Ae("button",{onClick:Bt[0]||(Bt[0]=Rn=>Ke.restoreFile()),class:"btn btn-primary restore-btn"}," Restore CRAM File ")])]))])):yr("",!0),Ke.isFileError?(Be(),Ve("div",_v,[Ae("div",xv,[Ae("div",kv,[Bt[9]||(Bt[9]=Ae("img",{src:kf,width:"50",height:"50",class:"error-icon"},null,-1)),Bt[10]||(Bt[10]=Ae("h4",{class:"modal-title"}," Unfortunately there is an issue while loading your files ",-1)),Ae("div",Cv,[Bt[7]||(Bt[7]=Ba(" Unfortunately there is an issue while loading your files for Genome browser. Please ",-1)),Ae("a",{href:"javascript:void(0);",onClick:Bt[1]||(Bt[1]=Rn=>ue.setModal({name:"SupportModal",active:!0}))}," contact support team"),Bt[8]||(Bt[8]=Ba(" with your email address and kit ID. ",-1))])])])])):yr("",!0)])])])):yr("",!0),["bgi","g42","prph"].includes(ue.snpSource)&&!Re.isArchived&&Re.hasCram?(Be(),Ve("div",Sv,null,512)):yr("",!0)])}const Bv=Qw(av,[["render",Av],["__scopeId","data-v-12a56b19"]]);export{Bv as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.