wuepgg3-track 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { q as Le, G as ae, t as ne, u as He, k as ie, M as v, v as oe, E as u, e as O, x as S, y as ze, z as F, F as b, R as L, H as le, I as We, s as m, S as f, h as B, w as H, J, K as Ve, b as X, B as k, i as U, L as M, j as T, N as w, O as Ne, a as je, Q as ue, V as de, W as ce, X as he, C as P, Y as $e, Z as A, D as z, _ as qe, P as Ke, c as Ye, T as Q, $ as Z, a0 as Je, a1 as Xe, a2 as Qe } from "./index-C1Sd-2Ub.mjs";
1
+ import { q as Le, G as ae, t as ne, u as He, k as ie, M as v, v as oe, E as u, e as O, x as S, y as ze, z as F, F as b, R as L, H as le, I as We, s as m, S as f, h as B, w as H, J, K as Ve, b as X, B as k, i as U, L as M, j as T, N as w, O as Ne, a as je, Q as ue, V as de, W as ce, X as he, C as P, Y as $e, Z as A, D as z, _ as qe, P as Ke, c as Ye, T as Q, $ as Z, a0 as Je, a1 as Xe, a2 as Qe } from "./index-C4Ue5B9P.mjs";
2
2
  import { S as fe, B as pe, c as Ze } from "./colorToUniform-zJcCVLeu.mjs";
3
3
  const me = class I extends Le {
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { E as d, B, w as m, D as S, J as K, t as Be, q as U, s as b, a3 as Ae, j as $, a4 as Ne, S as p, N as H, i as A, h as N, k as F, M as z, a5 as Y, a6 as ye, a7 as Ce, a8 as q, a9 as De, A as Ie, R as Ge, e as v } from "./index-C1Sd-2Ub.mjs";
1
+ import { E as d, B, w as m, D as S, J as K, t as Be, q as U, s as b, a3 as Ae, j as $, a4 as Ne, S as p, N as H, i as A, h as N, k as F, M as z, a5 as Y, a6 as ye, a7 as Ce, a8 as q, a9 as De, A as Ie, R as Ge, e as v } from "./index-C4Ue5B9P.mjs";
2
2
  import { S as O, b as Z } from "./colorToUniform-zJcCVLeu.mjs";
3
- import { e as Ue, G as Fe, c as Oe, b as Pe, U as Me, R as Le, B as J, d as y, f as He, S as we, a as Ve } from "./SharedSystems-gfisoPIO.mjs";
3
+ import { e as Ue, G as Fe, c as Oe, b as Pe, U as Me, R as Le, B as J, d as y, f as He, S as we, a as Ve } from "./SharedSystems-CEwenHFK.mjs";
4
4
  class Q {
5
5
  constructor() {
6
6
  this._tempState = O.for2d(), this._didUploadHash = {};
@@ -1,6 +1,6 @@
1
- import { g as E, E as p, f as ae, D as B, S as C, B as T, b as ue, c as L, d as M, w as v, h as y, i as ce, j as de, k as A, l as w, M as k, m as D, n as he, o as pe, p as H, q as z, s as R, A as le, R as fe, e as S } from "./index-C1Sd-2Ub.mjs";
1
+ import { g as E, E as p, f as ae, D as B, S as C, B as T, b as ue, c as L, d as M, w as v, h as y, i as ce, j as de, k as A, l as w, M as k, m as D, n as he, o as pe, p as H, q as z, s as R, A as le, R as fe, e as S } from "./index-C4Ue5B9P.mjs";
2
2
  import { S as F, l as ge, a as me } from "./colorToUniform-zJcCVLeu.mjs";
3
- import { c as _e, u as be, U as ye, B as xe, G as Ge, e as Be, R as Se, t as Pe, S as Te, a as Ce } from "./SharedSystems-gfisoPIO.mjs";
3
+ import { c as _e, u as be, U as ye, B as xe, G as Ge, e as Be, R as Se, t as Pe, S as Te, a as Ce } from "./SharedSystems-CEwenHFK.mjs";
4
4
  const x = F.for2d();
5
5
  class O {
6
6
  start(e, t, r) {
@@ -57,4 +57,4 @@ License: MIT
57
57
  `&&(L=`
58
58
  `);var he=0,it=!1;this.parse=function(ue,ve,ae){if(typeof ue!="string")throw new Error("Input must be a string");var ye=ue.length,be=S.length,We=L.length,kt=G.length,_e=N(J),xe=[],Ke=[],fe=[],Le=he=0;if(!ue)return gt();if(ke||ke!==!1&&ue.indexOf(oe)===-1){for(var Ye=ue.split(L),ce=0;ce<Ye.length;ce++){if(fe=Ye[ce],he+=fe.length,ce!==Ye.length-1)he+=L.length;else if(ae)return gt();if(!G||fe.substring(0,kt)!==G){if(_e){if(xe=[],vt(fe.split(S)),Je(),it)return gt()}else vt(fe.split(S));if(te&&te<=ce)return xe=xe.slice(0,te),gt(!0)}}return gt()}for(var Ee=ue.indexOf(S,he),we=ue.indexOf(L,he),Ve=new RegExp(O(Ae)+O(oe),"g"),de=ue.indexOf(oe,he);;)if(ue[he]===oe)for(de=he,he++;;){if((de=ue.indexOf(oe,de+1))===-1)return ae||Ke.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:xe.length,index:he}),pt();if(de===ye-1)return pt(ue.substring(he,de).replace(Ve,oe));if(oe===Ae&&ue[de+1]===Ae)de++;else if(oe===Ae||de===0||ue[de-1]!==Ae){Ee!==-1&&Ee<de+1&&(Ee=ue.indexOf(S,de+1));var He=ut((we=we!==-1&&we<de+1?ue.indexOf(L,de+1):we)===-1?Ee:Math.min(Ee,we));if(ue.substr(de+1+He,be)===S){fe.push(ue.substring(he,de).replace(Ve,oe)),ue[he=de+1+He+be]!==oe&&(de=ue.indexOf(oe,he)),Ee=ue.indexOf(S,he),we=ue.indexOf(L,he);break}if(He=ut(we),ue.substring(de+1+He,de+1+He+We)===L){if(fe.push(ue.substring(he,de).replace(Ve,oe)),Pt(de+1+He+We),Ee=ue.indexOf(S,he),de=ue.indexOf(oe,he),_e&&(Je(),it))return gt();if(te&&xe.length>=te)return gt(!0);break}Ke.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:xe.length,index:he}),de++}}else if(G&&fe.length===0&&ue.substring(he,he+kt)===G){if(we===-1)return gt();he=we+We,we=ue.indexOf(L,he),Ee=ue.indexOf(S,he)}else if(Ee!==-1&&(Ee<we||we===-1))fe.push(ue.substring(he,Ee)),he=Ee+be,Ee=ue.indexOf(S,he);else{if(we===-1)break;if(fe.push(ue.substring(he,we)),Pt(we+We),_e&&(Je(),it))return gt();if(te&&xe.length>=te)return gt(!0)}return pt();function vt(lt){xe.push(lt),Le=he}function ut(lt){var bt=0;return bt=lt!==-1&&(lt=ue.substring(de+1,lt))&&lt.trim()===""?lt.length:bt}function pt(lt){return ae||(lt===void 0&&(lt=ue.substring(he)),fe.push(lt),he=ye,vt(fe),_e&&Je()),gt()}function Pt(lt){he=lt,vt(fe),fe=[],we=ue.indexOf(L,he)}function gt(lt){if(A.header&&!ve&&xe.length&&!tt){var bt=xe[0],at=Object.create(null),fr=new Set(bt);let I=!1;for(let _=0;_<bt.length;_++){let v=bt[_];if(at[v=N(A.transformHeader)?A.transformHeader(v,_):v]){let C,U=at[v];for(;C=v+"_"+U,U++,fr.has(C););fr.add(C),bt[_]=C,at[v]++,I=!0,(Be=Be===null?{}:Be)[C]=v}else at[v]=1,bt[_]=v;fr.add(v)}I&&console.warn("Duplicate headers found and renamed."),tt=!0}return{data:xe,errors:Ke,meta:{delimiter:S,linebreak:L,aborted:it,truncated:!!lt,cursor:Le+(ve||0),renamedHeaders:Be}}}function Je(){J(gt()),xe=[],Ke=[]}},this.abort=function(){it=!0},this.getCharIndex=function(){return he}}function q(A){var S=A.data,L=h[S.workerId],G=!1;if(S.error)L.userError(S.error,S.file);else if(S.results&&S.results.data){var J={abort:function(){G=!0,D(S.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:R,resume:R};if(N(L.userStep)){for(var te=0;te<S.results.data.length&&(L.userStep({data:S.results.data[te],errors:S.results.errors,meta:S.results.meta},J),!G);te++);delete S.results}else N(L.userChunk)&&(L.userChunk(S.results,J,S.file),delete S.results)}S.finished&&!G&&D(S.workerId,S.results)}function D(A,S){var L=h[A];N(L.userComplete)&&L.userComplete(S),L.terminate(),delete h[A]}function R(){throw new Error("Not implemented.")}function P(A){if(typeof A!="object"||A===null)return A;var S,L=Array.isArray(A)?[]:{};for(S in A)L[S]=P(A[S]);return L}function V(A,S){return function(){A.apply(S,arguments)}}function N(A){return typeof A=="function"}return d.parse=function(A,S){var L=(S=S||{}).dynamicTyping||!1;if(N(L)&&(S.dynamicTypingFunction=L,L={}),S.dynamicTyping=L,S.transform=!!N(S.transform)&&S.transform,!S.worker||!d.WORKERS_SUPPORTED)return L=null,d.NODE_STREAM_INPUT,typeof A=="string"?(A=(G=>G.charCodeAt(0)!==65279?G:G.slice(1))(A),L=new(S.download?x:y)(S)):A.readable===!0&&N(A.read)&&N(A.on)?L=new F(S):(a.File&&A instanceof File||A instanceof Object)&&(L=new E(S)),L.stream(A);(L=(()=>{var G;return!!d.WORKERS_SUPPORTED&&(G=(()=>{var J=a.URL||a.webkitURL||null,te=n.toString();return d.BLOB_URL||(d.BLOB_URL=J.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",te,")();"],{type:"text/javascript"})))})(),(G=new a.Worker(G)).onmessage=q,G.id=w++,h[G.id]=G)})()).userStep=S.step,L.userChunk=S.chunk,L.userComplete=S.complete,L.userError=S.error,S.step=N(S.step),S.chunk=N(S.chunk),S.complete=N(S.complete),S.error=N(S.error),delete S.worker,L.postMessage({input:A,config:S,workerId:L.id})},d.unparse=function(A,S){var L=!1,G=!0,J=",",te=`\r
59
59
  `,ke='"',Be=ke+ke,tt=!1,oe=null,Ae=!1,he=((()=>{if(typeof S=="object"){if(typeof S.delimiter!="string"||d.BAD_DELIMITERS.filter(function(ve){return S.delimiter.indexOf(ve)!==-1}).length||(J=S.delimiter),typeof S.quotes!="boolean"&&typeof S.quotes!="function"&&!Array.isArray(S.quotes)||(L=S.quotes),typeof S.skipEmptyLines!="boolean"&&typeof S.skipEmptyLines!="string"||(tt=S.skipEmptyLines),typeof S.newline=="string"&&(te=S.newline),typeof S.quoteChar=="string"&&(ke=S.quoteChar),typeof S.header=="boolean"&&(G=S.header),Array.isArray(S.columns)){if(S.columns.length===0)throw new Error("Option columns is empty");oe=S.columns}S.escapeChar!==void 0&&(Be=S.escapeChar+ke),S.escapeFormulae instanceof RegExp?Ae=S.escapeFormulae:typeof S.escapeFormulae=="boolean"&&S.escapeFormulae&&(Ae=/^[=+\-@\t\r].*$/)}})(),new RegExp(O(ke),"g"));if(typeof A=="string"&&(A=JSON.parse(A)),Array.isArray(A)){if(!A.length||Array.isArray(A[0]))return it(null,A,tt);if(typeof A[0]=="object")return it(oe||Object.keys(A[0]),A,tt)}else if(typeof A=="object")return typeof A.data=="string"&&(A.data=JSON.parse(A.data)),Array.isArray(A.data)&&(A.fields||(A.fields=A.meta&&A.meta.fields||oe),A.fields||(A.fields=Array.isArray(A.data[0])?A.fields:typeof A.data[0]=="object"?Object.keys(A.data[0]):[]),Array.isArray(A.data[0])||typeof A.data[0]=="object"||(A.data=[A.data])),it(A.fields||[],A.data||[],tt);throw new Error("Unable to serialize unrecognized input");function it(ve,ae,ye){var be="",We=(typeof ve=="string"&&(ve=JSON.parse(ve)),typeof ae=="string"&&(ae=JSON.parse(ae)),Array.isArray(ve)&&0<ve.length),kt=!Array.isArray(ae[0]);if(We&&G){for(var _e=0;_e<ve.length;_e++)0<_e&&(be+=J),be+=ue(ve[_e],_e);0<ae.length&&(be+=te)}for(var xe=0;xe<ae.length;xe++){var Ke=(We?ve:ae[xe]).length,fe=!1,Le=We?Object.keys(ae[xe]).length===0:ae[xe].length===0;if(ye&&!We&&(fe=ye==="greedy"?ae[xe].join("").trim()==="":ae[xe].length===1&&ae[xe][0].length===0),ye==="greedy"&&We){for(var Ye=[],ce=0;ce<Ke;ce++){var Ee=kt?ve[ce]:ce;Ye.push(ae[xe][Ee])}fe=Ye.join("").trim()===""}if(!fe){for(var we=0;we<Ke;we++){0<we&&!Le&&(be+=J);var Ve=We&&kt?ve[we]:we;be+=ue(ae[xe][Ve],we)}xe<ae.length-1&&(!ye||0<Ke&&!Le)&&(be+=te)}}return be}function ue(ve,ae){var ye,be;return ve==null?"":ve.constructor===Date?JSON.stringify(ve).slice(1,25):(be=!1,Ae&&typeof ve=="string"&&Ae.test(ve)&&(ve="'"+ve,be=!0),ye=ve.toString().replace(he,Be),(be=be||L===!0||typeof L=="function"&&L(ve,ae)||Array.isArray(L)&&L[ae]||((We,kt)=>{for(var _e=0;_e<kt.length;_e++)if(-1<We.indexOf(kt[_e]))return!0;return!1})(ye,d.BAD_DELIMITERS)||-1<ye.indexOf(J)||ye.charAt(0)===" "||ye.charAt(ye.length-1)===" ")?ke+ye+ke:ye)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
60
- `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!o&&!!a.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=H,d.ParserHandle=B,d.NetworkStreamer=x,d.FileStreamer=E,d.StringStreamer=y,d.ReadableStreamStreamer=F,a.jQuery&&((f=a.jQuery).fn.parse=function(A){var S=A.config||{},L=[];return this.each(function(te){if(!(f(this).prop("tagName").toUpperCase()==="INPUT"&&f(this).attr("type").toLowerCase()==="file"&&a.FileReader)||!this.files||this.files.length===0)return!0;for(var ke=0;ke<this.files.length;ke++)L.push({file:this.files[ke],inputElem:this,instanceConfig:f.extend({},S)})}),G(),this;function G(){if(L.length===0)N(A.complete)&&A.complete();else{var te,ke,Be,tt,oe=L[0];if(N(A.before)){var Ae=A.before(oe.file,oe.inputElem);if(typeof Ae=="object"){if(Ae.action==="abort")return te="AbortError",ke=oe.file,Be=oe.inputElem,tt=Ae.reason,void(N(A.error)&&A.error({name:te},ke,Be,tt));if(Ae.action==="skip")return void J();typeof Ae.config=="object"&&(oe.instanceConfig=f.extend(oe.instanceConfig,Ae.config))}else if(Ae==="skip")return void J()}var he=oe.instanceConfig.complete;oe.instanceConfig.complete=function(it){N(he)&&he(it,oe.file,oe.inputElem),J()},d.parse(oe.file,oe.instanceConfig)}}function J(){L.splice(0,1),G()}}),l&&(a.onmessage=function(A){A=A.data,d.WORKER_ID===void 0&&A&&(d.WORKER_ID=A.workerId),typeof A.input=="string"?a.postMessage({workerId:d.WORKER_ID,results:d.parse(A.input,A.config),finished:!0}):(a.File&&A.input instanceof File||A.input instanceof Object)&&(A=d.parse(A.input,A.config))&&a.postMessage({workerId:d.WORKER_ID,results:A,finished:!0})}),(x.prototype=Object.create(c.prototype)).constructor=x,(E.prototype=Object.create(c.prototype)).constructor=E,(y.prototype=Object.create(y.prototype)).constructor=y,(F.prototype=Object.create(c.prototype)).constructor=F,d})})(td);var B2=td.exports,N2=Qt(B2);class $2{constructor(e){Ce(this,"config");Ce(this,"url");Ce(this,"blob");Ce(this,"init",async()=>await this.processTextFile());this.config=e,this.url="",this.blob=null,e.blob&&(this.blob=e.blob),e.url&&(this.url=e.url)}processTextFile(){let e,n;return this.url.length?(n=this.url,e={download:!0,skipEmptyLines:"greedy",worker:this.config.textConfig.isFileHuge}):this.blob?(n=this.blob,e={skipEmptyLines:"greedy",worker:this.config.textConfig.isFileHuge}):console.error("no data source for TextSource, abort..."),new Promise((a,f)=>{N2.parse(n,{config:e,error:(o,l)=>{console.error(o,l),f(o)},complete:o=>{a(o)}})})}}function*Ca(t,e,n=void 0){e===void 0&&(e=t,t=0),n===void 0&&(n=1);for(let a=t;t<e?a<e:a>e;a+=n)yield a}function O2(t,e){return e-=1,t>>14===e>>14?4681+(t>>14):t>>17===e>>17?585+(t>>17):t>>20===e>>20?73+(t>>20):t>>23===e>>23?9+(t>>23):t>>26===e>>26?1+(t>>26):0}function D2(t,e){let n=[];if(n.push(0),t>=e)return n;e>=1<<29&&(e=1<<29),e-=1;for(let a of Ca(1+(t>>26),1+(e>>26)+1))n.push(a);for(let a of Ca(9+(t>>23),9+(e>>23)+1))n.push(a);for(let a of Ca(73+(t>>20),73+(e>>20)+1))n.push(a);for(let a of Ca(585+(t>>17),585+(e>>17)+1))n.push(a);for(let a of Ca(4681+(t>>14),4681+(e>>14)+1))n.push(a);return n}class nd{constructor(e,n,a=0){Ce(this,"dataArray");Ce(this,"formatFunc");Ce(this,"dataStartIndex");Ce(this,"indexer");this.dataArray=e,this.formatFunc=n,this.dataStartIndex=a,this.indexer={}}init(){this.dataArray.forEach((e,n)=>{if(n<this.dataStartIndex)return;const a=this.formatFunc(e);Array.isArray(a)?a.forEach(f=>this.put(f)):this.put(a)})}put(e){if(!(e.chr&&e.chr.length))return;const n=O2(e.start,e.end);this.indexer.hasOwnProperty(e.chr)||(this.indexer[e.chr]={}),this.indexer[e.chr].hasOwnProperty(n)||(this.indexer[e.chr][n]=[]),this.indexer[e.chr][n].push(e)}get(e,n,a){const f=[];if(!this.indexer.hasOwnProperty(e))return f;const o=D2(n,a);for(const l of o)this.indexer[e].hasOwnProperty(l)&&this.indexer[e][l].forEach(h=>f.push(h));return f}}class rd{constructor(e){Ce(this,"source");Ce(this,"textData");Ce(this,"indexer");Ce(this,"ready");this.source=new $2(e),this.textData=null,this.indexer=null,this.ready=!1}convertToBedRecord(e){const n={chr:e[0],start:Number.parseInt(e[1],10),end:Number.parseInt(e[2],10)};for(let a=3;a<e.length;a++)n[a]=e[a];return n}async initSource(){this.textData||(this.textData=await this.source.init())}initIndex(){this.indexer=new nd(this.textData.data,this.convertToBedRecord)}async init(){await this.initSource(),this.initIndex(),this.indexer.init(),this.ready=!0}async getData(e){this.ready||await this.init();const n=e.map(a=>this.indexer.get(a.chr,a.start,a.end));return br.flatten(n)}}class L2 extends rd{convertToBedRecord(e){const n=e[0].split(/\W+/),a={chr:n[0],start:Number.parseInt(n[1],10),end:Number.parseInt(n[2],10)};return n[3],Number.parseInt(n[4],10),Number.parseInt(n[5],10),a[3]=`${n[3]}:${n[4]}-${n[5]},${e[5]}`,`${n[0]}${n[1]}${n[2]}${e[5]}`,a}initIndex(){this.indexer=new nd(this.textData.data,this.convertToBedRecord.bind(this),1)}}let Rr={};const M2={bed:async function(e){return wn(e,"bedOrTabix")},bedgraph:async function(e){return wn(e,"bedOrTabix")},qbed:async function(e){return wn(e,"bedOrTabix")},bigbed:async function(e){return wn(e,"big")},refbed:async function(e){return wn(e,"bedOrTabix")},matplot:async function(e){return wn(e,"bedOrTabix")},bigwig:async function(e){return wn(e,"big")},categorical:async function(e){return wn(e,"bedOrTabix")},longrange:async function(e){return wn(e,"bedOrTabix")},dynseq:async function(e){return wn(e,"big")},biginteract:async function(e){return wn(e,"big")},methylc:async function(e){return wn(e,"bedOrTabix")}},P2={bed:async function(e){return Ra(e)},bedgraph:async function(e){return Ra(e)},qbed:async function(e){return Ra(e)},refbed:async function(e){return Ra(e)},longrange:async function(e){return Ra(e)}};async function Ra(t){return t.trackModel.id in Rr||(t.trackModel.type==="longrange"?Rr[`${t.trackModel.id}`]=new L2({blob:t.trackModel.fileObj,textConfig:t.trackModel.textConfig,url:""}):Rr[`${t.trackModel.id}`]=new rd({blob:t.trackModel.fileObj,textConfig:t.trackModel.textConfig,url:""})),await Rr[`${t.trackModel.id}`].getData(t.nav)}async function wn(t,e){return t.trackModel.id in Rr||(e==="big"?Rr[`${t.trackModel.id}`]=new R2(t.trackModel.fileObj):e==="bedOrTabix"&&(Rr[`${t.trackModel.id}`]=new F2(t.trackModel))),await Rr[`${t.trackModel.id}`].getData(t.nav,t.trackModel.options)}const U2={geneannotation:"",bed:"",bedcolor:"",bigwig:"",dynseq:"",methylc:"",hic:"",genomealign:"",vcf:"",categorical:"",longrange:"",biginteract:"",repeatmasker:"",bigbed:"",refbed:"",matplot:"",ruler:"",modbed:"",dynamic:"",bedgraph:"",qbed:"",boxplot:"",jaspar:"",dynamichic:"",dynamicbed:"",dbedgraph:"",dynamiclongrange:"",snp:"",bam:"",omeroidr:"",error:""};async function H2(t){if(!Array.isArray(t))throw new Error(`fetchGenomicData expects an array, but received: ${typeof t}`);const e=t.map(a=>{const f=a.primaryGenName,o=a.initial,l=[],h=a.genomicLoci,w=a.regionExpandLoci?a.regionExpandLoci:a.genomicLoci,d=a.initGenomicLoci,c=a.trackModelArr,x=a.bpRegionSize,E=a.windowWidth,y=a.trackToDrawId||{},F=a.trackDataIdx,B=a.missingIdx;a.useFineModeNav;let O=a.genomicFetchCoord||{[f]:{genomicLoci:h,regionExpandLoci:w,initGenomicLoci:d,primaryVisData:a.visData}};const H=c.filter(D=>D&&D.type!=="genomealign");return Promise.all(H.map(async D=>{const R=(D==null?void 0:D.type)||(D==null?void 0:D.metadata["Track type"]),P=D.id;let V=!1;if((D.metadata.genome&&!(D.metadata.genome in O)||!(D.type in U2))&&(V=!0),V)l.push({name:R,id:P,metadata:D.metadata,trackModel:D,result:{error:"This track type is currently not supported"}});else if(R in{hic:"",dynamichic:""})l.push({name:R,id:P,metadata:D.metadata,trackModel:D});else if(R==="ruler")l.push({name:R,id:P,metadata:D.metadata,trackModel:D,result:[]});else if(R==="geneannotation"){const N=await q(D);l.push({name:R,result:N[0],id:P,metadata:D.metadata,trackModel:D})}else if(R==="bam"){let N;"genome"in D.metadata&&D.metadata.genome!==void 0&&D.metadata.genome!==f?N=O[D.metadata.genome===""?f:D.metadata.genome].queryGenomicCoord:o===1?N=d:N=Array(h),l.push({name:R,id:P,metadata:D.metadata,trackModel:D,curFetchNav:N})}else if(R in{matplot:"",dynamic:"",dynamicbed:"",dynamiclongrange:""}){let N=!1;const A=await Promise.all(D.tracks.map(async S=>{const L=(await q(S)).flat(1);return typeof L[0]=="object"&&"error"in L[0]&&(N=!0),L}));l.push({name:R,result:N?{error:"Fetch failed: data source is not valid"}:A,id:P,metadata:D.metadata,trackModel:D})}else{const N=await q(D);l.push({name:R,result:N[0],id:P,metadata:D.metadata,trackModel:D})}})).then(()=>({fetchResults:l,trackDataIdx:F,genomicFetchCoord:O,trackToDrawId:y,missingIdx:B}));async function q(D){let R=[],P;const{genome:V}=D.metadata;V&&V!==""&&V!==f?P=O[V].queryGenomicCoord:D.type==="longrange"||D.type==="biginteract"?P=Array(w):P=Array(h);const N=D.fileObj instanceof File;if(N&&D.url==="")for(let A=0;A<P.length;A++){const S=D.isText?await P2[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D}):await M2[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D});S&&typeof S=="object"&&S.hasOwnProperty("error")?R.push({error:S.message}):R.push(S)}else if(N)R.push({error:"Fetch failed: data source is not valid"});else for(let A=0;A<P.length;A++){let S;try{D.type in{geneannotation:"",snp:""}?S=await Promise.all(P[A].map(async L=>await ed[D.type]({genomeName:"genome"in D.metadata?D.metadata.genome:D.genome?D.genome:f,name:D.name,chr:L.chr,start:L.start,end:L.end,nav:L,trackModel:D,trackType:D.type}))):S=await Promise.all([ed[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D})]),R.push(br.flatten(S))}catch(L){console.error(`Error fetching data for track model type ${D.type}:`,L),R.push({error:"Data fetch failed. Reload page or change view to retry"})}}return R}});return await Promise.all(e)}typeof self<"u"&&"postMessage"in self&&"onmessage"in self&&typeof window>"u"&&(self.onmessage=async t=>{try{const e=await H2(t.data);postMessage(e)}catch(e){postMessage({error:e instanceof Error?e.message:"Unknown error"})}})})();
60
+ `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!o&&!!a.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=H,d.ParserHandle=B,d.NetworkStreamer=x,d.FileStreamer=E,d.StringStreamer=y,d.ReadableStreamStreamer=F,a.jQuery&&((f=a.jQuery).fn.parse=function(A){var S=A.config||{},L=[];return this.each(function(te){if(!(f(this).prop("tagName").toUpperCase()==="INPUT"&&f(this).attr("type").toLowerCase()==="file"&&a.FileReader)||!this.files||this.files.length===0)return!0;for(var ke=0;ke<this.files.length;ke++)L.push({file:this.files[ke],inputElem:this,instanceConfig:f.extend({},S)})}),G(),this;function G(){if(L.length===0)N(A.complete)&&A.complete();else{var te,ke,Be,tt,oe=L[0];if(N(A.before)){var Ae=A.before(oe.file,oe.inputElem);if(typeof Ae=="object"){if(Ae.action==="abort")return te="AbortError",ke=oe.file,Be=oe.inputElem,tt=Ae.reason,void(N(A.error)&&A.error({name:te},ke,Be,tt));if(Ae.action==="skip")return void J();typeof Ae.config=="object"&&(oe.instanceConfig=f.extend(oe.instanceConfig,Ae.config))}else if(Ae==="skip")return void J()}var he=oe.instanceConfig.complete;oe.instanceConfig.complete=function(it){N(he)&&he(it,oe.file,oe.inputElem),J()},d.parse(oe.file,oe.instanceConfig)}}function J(){L.splice(0,1),G()}}),l&&(a.onmessage=function(A){A=A.data,d.WORKER_ID===void 0&&A&&(d.WORKER_ID=A.workerId),typeof A.input=="string"?a.postMessage({workerId:d.WORKER_ID,results:d.parse(A.input,A.config),finished:!0}):(a.File&&A.input instanceof File||A.input instanceof Object)&&(A=d.parse(A.input,A.config))&&a.postMessage({workerId:d.WORKER_ID,results:A,finished:!0})}),(x.prototype=Object.create(c.prototype)).constructor=x,(E.prototype=Object.create(c.prototype)).constructor=E,(y.prototype=Object.create(y.prototype)).constructor=y,(F.prototype=Object.create(c.prototype)).constructor=F,d})})(td);var B2=td.exports,N2=Qt(B2);class $2{constructor(e){Ce(this,"config");Ce(this,"url");Ce(this,"blob");Ce(this,"init",async()=>await this.processTextFile());this.config=e,this.url="",this.blob=null,e.blob&&(this.blob=e.blob),e.url&&(this.url=e.url)}processTextFile(){let e,n;return this.url.length?(n=this.url,e={download:!0,skipEmptyLines:"greedy",worker:this.config.textConfig.isFileHuge}):this.blob?(n=this.blob,e={skipEmptyLines:"greedy",worker:this.config.textConfig.isFileHuge}):console.error("no data source for TextSource, abort..."),new Promise((a,f)=>{N2.parse(n,{config:e,error:(o,l)=>{console.error(o,l),f(o)},complete:o=>{a(o)}})})}}function*Ca(t,e,n=void 0){e===void 0&&(e=t,t=0),n===void 0&&(n=1);for(let a=t;t<e?a<e:a>e;a+=n)yield a}function O2(t,e){return e-=1,t>>14===e>>14?4681+(t>>14):t>>17===e>>17?585+(t>>17):t>>20===e>>20?73+(t>>20):t>>23===e>>23?9+(t>>23):t>>26===e>>26?1+(t>>26):0}function D2(t,e){let n=[];if(n.push(0),t>=e)return n;e>=1<<29&&(e=1<<29),e-=1;for(let a of Ca(1+(t>>26),1+(e>>26)+1))n.push(a);for(let a of Ca(9+(t>>23),9+(e>>23)+1))n.push(a);for(let a of Ca(73+(t>>20),73+(e>>20)+1))n.push(a);for(let a of Ca(585+(t>>17),585+(e>>17)+1))n.push(a);for(let a of Ca(4681+(t>>14),4681+(e>>14)+1))n.push(a);return n}class nd{constructor(e,n,a=0){Ce(this,"dataArray");Ce(this,"formatFunc");Ce(this,"dataStartIndex");Ce(this,"indexer");this.dataArray=e,this.formatFunc=n,this.dataStartIndex=a,this.indexer={}}init(){this.dataArray.forEach((e,n)=>{if(n<this.dataStartIndex)return;const a=this.formatFunc(e);Array.isArray(a)?a.forEach(f=>this.put(f)):this.put(a)})}put(e){if(!(e.chr&&e.chr.length))return;const n=O2(e.start,e.end);this.indexer.hasOwnProperty(e.chr)||(this.indexer[e.chr]={}),this.indexer[e.chr].hasOwnProperty(n)||(this.indexer[e.chr][n]=[]),this.indexer[e.chr][n].push(e)}get(e,n,a){const f=[];if(!this.indexer.hasOwnProperty(e))return f;const o=D2(n,a);for(const l of o)this.indexer[e].hasOwnProperty(l)&&this.indexer[e][l].forEach(h=>f.push(h));return f}}class rd{constructor(e){Ce(this,"source");Ce(this,"textData");Ce(this,"indexer");Ce(this,"ready");this.source=new $2(e),this.textData=null,this.indexer=null,this.ready=!1}convertToBedRecord(e){const n={chr:e[0],start:Number.parseInt(e[1],10),end:Number.parseInt(e[2],10)};for(let a=3;a<e.length;a++)n[a]=e[a];return n}async initSource(){this.textData||(this.textData=await this.source.init())}initIndex(){this.indexer=new nd(this.textData.data,this.convertToBedRecord)}async init(){await this.initSource(),this.initIndex(),this.indexer.init(),this.ready=!0}async getData(e){this.ready||await this.init();const n=e.map(a=>this.indexer.get(a.chr,a.start,a.end));return br.flatten(n)}}class L2 extends rd{convertToBedRecord(e){const n=e[0].split(/\W+/),a={chr:n[0],start:Number.parseInt(n[1],10),end:Number.parseInt(n[2],10)};return n[3],Number.parseInt(n[4],10),Number.parseInt(n[5],10),a[3]=`${n[3]}:${n[4]}-${n[5]},${e[5]}`,`${n[0]}${n[1]}${n[2]}${e[5]}`,a}initIndex(){this.indexer=new nd(this.textData.data,this.convertToBedRecord.bind(this),1)}}let Rr={};const M2={bed:async function(e){return wn(e,"bedOrTabix")},bedgraph:async function(e){return wn(e,"bedOrTabix")},qbed:async function(e){return wn(e,"bedOrTabix")},bigbed:async function(e){return wn(e,"big")},refbed:async function(e){return wn(e,"bedOrTabix")},matplot:async function(e){return wn(e,"bedOrTabix")},bigwig:async function(e){return wn(e,"big")},categorical:async function(e){return wn(e,"bedOrTabix")},longrange:async function(e){return wn(e,"bedOrTabix")},dynseq:async function(e){return wn(e,"big")},biginteract:async function(e){return wn(e,"big")},methylc:async function(e){return wn(e,"bedOrTabix")}},P2={bed:async function(e){return Ra(e)},bedgraph:async function(e){return Ra(e)},qbed:async function(e){return Ra(e)},refbed:async function(e){return Ra(e)},longrange:async function(e){return Ra(e)}};async function Ra(t){return t.trackModel.id in Rr||(t.trackModel.type==="longrange"?Rr[`${t.trackModel.id}`]=new L2({blob:t.trackModel.fileObj,textConfig:t.trackModel.textConfig,url:""}):Rr[`${t.trackModel.id}`]=new rd({blob:t.trackModel.fileObj,textConfig:t.trackModel.textConfig,url:""})),await Rr[`${t.trackModel.id}`].getData(t.nav)}async function wn(t,e){return t.trackModel.id in Rr||(e==="big"?Rr[`${t.trackModel.id}`]=new R2(t.trackModel.fileObj):e==="bedOrTabix"&&(Rr[`${t.trackModel.id}`]=new F2(t.trackModel))),await Rr[`${t.trackModel.id}`].getData(t.nav,t.trackModel.options)}const U2={geneannotation:"",bed:"",bedcolor:"",bigwig:"",dynseq:"",methylc:"",hic:"",genomealign:"",vcf:"",categorical:"",longrange:"",biginteract:"",repeatmasker:"",bigbed:"",refbed:"",matplot:"",ruler:"",modbed:"",dynamic:"",bedgraph:"",qbed:"",boxplot:"",jaspar:"",dynamichic:"",dynamicbed:"",dbedgraph:"",dynamiclongrange:"",snp:"",bam:"",omeroidr:"",error:""};async function H2(t){if(!Array.isArray(t))throw new Error(`fetchGenomicData expects an array, but received: ${typeof t}`);const e=t.map(a=>{const f=a.primaryGenName,o=a.initial,l=[],h=a.genomicLoci,w=a.regionExpandLoci?a.regionExpandLoci:a.genomicLoci,d=a.initGenomicLoci,c=a.trackModelArr,x=a.bpRegionSize,E=a.windowWidth,y=a.trackToDrawId||{},F=a.trackDataIdx,B=a.missingIdx;a.useFineModeNav;let O=a.genomicFetchCoord||{[f]:{genomicLoci:h,regionExpandLoci:w,initGenomicLoci:d,primaryVisData:a.visData}};const H=c.filter(D=>D&&D.type!=="genomealign");return Promise.all(H.map(async D=>{const R=(D==null?void 0:D.type)||(D==null?void 0:D.metadata["Track type"]),P=D.id;let V=!1;if((D.metadata.genome&&!(D.metadata.genome in O)||!(D.type in U2))&&(V=!0),V)l.push({name:R,id:P,metadata:D.metadata,trackModel:D,result:{error:"This track type is currently not supported"}});else if(R in{hic:"",dynamichic:""})l.push({name:R,id:P,metadata:D.metadata,trackModel:D});else if(R==="ruler")l.push({name:R,id:P,metadata:D.metadata,trackModel:D,result:[]});else if(R==="geneannotation"){const N=await q(D);l.push({name:R,result:N[0],id:P,metadata:D.metadata,trackModel:D})}else if(R==="bam"){let N;"genome"in D.metadata&&D.metadata.genome!==void 0&&D.metadata.genome!==f?N=O[D.metadata.genome===""?f:D.metadata.genome].queryGenomicCoord:o===1?N=d:N=Array(h),l.push({name:R,id:P,metadata:D.metadata,trackModel:D,curFetchNav:N})}else if(R in{matplot:"",dynamic:"",dynamicbed:"",dynamiclongrange:""}){let N=!1;const A=await Promise.all(D.tracks.map(async S=>{const L=(await q(S)).flat(1);return typeof L[0]=="object"&&"error"in L[0]&&(N=!0),L}));l.push({name:R,result:N?{error:"Fetch failed: data source is not valid"}:A,id:P,metadata:D.metadata,trackModel:D})}else{const N=await q(D);l.push({name:R,result:N[0],id:P,metadata:D.metadata,trackModel:D})}})).then(()=>({fetchResults:l,trackDataIdx:F,genomicFetchCoord:O,trackToDrawId:y,missingIdx:B}));async function q(D){let R=[],P;const{genome:V}=D.metadata;V&&V!==""&&V!==f?P=O[V].queryGenomicCoord:D.type==="longrange"||D.type==="biginteract"?P=Array(w):P=Array(h);const N=D.fileObj instanceof File;if(N&&D.url==="")for(let A=0;A<P.length;A++){const S=D.isText?await P2[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D}):await M2[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D});S&&typeof S=="object"&&S.hasOwnProperty("error")?R.push({error:S.message}):R.push(S)}else if(N)R.push({error:"Fetch failed: data source is not valid"});else for(let A=0;A<P.length;A++){let S;try{D.type in{geneannotation:"",snp:""}?S=await Promise.all(P[A].map(async L=>await ed[D.type]({genomeName:"genome"in D.metadata?D.metadata.genome:D.genome?D.genome:f,name:D.name,chr:L.chr,start:L.start,end:L.end,nav:L,trackModel:D,trackType:D.type}))):S=await Promise.all([ed[D.type]({basesPerPixel:x/E,nav:P[A],trackModel:D})]),R.push(br.flatten(S))}catch(L){console.error(`Error fetching data for track model type ${D.type}:`,L),R.push({error:"Data fetch failed. Reload page or change view to retry"})}}return R}});return await Promise.all(e)}typeof self<"u"&&"postMessage"in self&&"onmessage"in self&&typeof self.importScripts<"u"&&(self.onmessage=async t=>{try{const e=await H2(t.data);postMessage(e)}catch(e){postMessage({error:e instanceof Error?e.message:"Unknown error"})}})})();