jbrowse-plugin-graphgenomeviewer 10.2.0 → 10.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/chunks/{AddTrackWorkflow-BY23IVYG.js → AddTrackWorkflow-4S5QEZTJ.js} +2 -2
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-XAMRWAYZ.js → GbzBaseSyntenyAdapter-64HUHYVC.js} +2 -2
  3. package/dist/chunks/{GbzBaseSyntenyAdapter-XAMRWAYZ.js.map → GbzBaseSyntenyAdapter-64HUHYVC.js.map} +1 -1
  4. package/dist/chunks/{GraphGenomeView-7FALCHVY.js → GraphGenomeView-EGR7L5WT.js} +2 -2
  5. package/dist/chunks/GraphSettingsDialog-6VOMA2TZ.js +2 -0
  6. package/dist/chunks/{HighlightColorDialog-AD7B53ZA.js → HighlightColorDialog-FHRKHBDZ.js} +2 -2
  7. package/dist/chunks/LinearGraphDisplay-R3A64XKK.js +2 -0
  8. package/dist/chunks/{MinigraphBubbleAdapter-W7RUVFVI.js → MinigraphBubbleAdapter-LQ2NYC6O.js} +2 -2
  9. package/dist/chunks/{RgfaTabixAdapter-QOEMTN56.js → RgfaTabixAdapter-UM7L6HPH.js} +2 -2
  10. package/dist/chunks/WalkFormsAdapter-4D6MTHLE.js +2 -0
  11. package/dist/chunks/WalkFormsAdapter-4D6MTHLE.js.map +7 -0
  12. package/dist/chunks/{WalkTabixSyntenyAdapter-HEXLZ5YL.js → WalkTabixSyntenyAdapter-V5IQCHP4.js} +2 -2
  13. package/dist/chunks/{chunk-V5ZGDS4W.js → chunk-2OH3T4CR.js} +2 -2
  14. package/dist/chunks/{chunk-V5ZGDS4W.js.map → chunk-2OH3T4CR.js.map} +1 -1
  15. package/dist/chunks/{chunk-BDBERNEC.js → chunk-2XAPUOET.js} +2 -2
  16. package/dist/chunks/{chunk-BDBERNEC.js.map → chunk-2XAPUOET.js.map} +1 -1
  17. package/dist/chunks/chunk-3S24TQNP.js +5 -0
  18. package/dist/chunks/chunk-3S24TQNP.js.map +7 -0
  19. package/dist/chunks/{chunk-HT3RFCRI.js → chunk-4GC42TBO.js} +2 -2
  20. package/dist/chunks/{chunk-HT3RFCRI.js.map → chunk-4GC42TBO.js.map} +1 -1
  21. package/dist/chunks/{chunk-KFSVGH3X.js → chunk-4IPVOCXX.js} +2 -2
  22. package/dist/chunks/{chunk-KFSVGH3X.js.map → chunk-4IPVOCXX.js.map} +1 -1
  23. package/dist/chunks/{chunk-AW7U7KMG.js → chunk-4WMWSJXJ.js} +2 -2
  24. package/dist/chunks/{chunk-AW7U7KMG.js.map → chunk-4WMWSJXJ.js.map} +1 -1
  25. package/dist/chunks/{chunk-IQURFLWC.js → chunk-55PR5XJY.js} +2 -2
  26. package/dist/chunks/{chunk-7V5D6ZDX.js → chunk-5CTDN4UC.js} +1 -1
  27. package/dist/chunks/{chunk-7V5D6ZDX.js.map → chunk-5CTDN4UC.js.map} +1 -1
  28. package/dist/chunks/{chunk-FSVORNAP.js → chunk-5KWWMR7X.js} +2 -2
  29. package/dist/chunks/{chunk-4FDZC66W.js → chunk-5PMRULDS.js} +1 -1
  30. package/dist/chunks/{chunk-4FDZC66W.js.map → chunk-5PMRULDS.js.map} +1 -1
  31. package/dist/chunks/{chunk-IAN7FKQ5.js → chunk-EYNSJ5AX.js} +2 -2
  32. package/dist/chunks/{chunk-CWT6WZ3D.js → chunk-GPNGXGMH.js} +2 -2
  33. package/dist/chunks/{chunk-CWT6WZ3D.js.map → chunk-GPNGXGMH.js.map} +2 -2
  34. package/dist/chunks/{chunk-BCRRODIU.js → chunk-HE7BFKXW.js} +2 -2
  35. package/dist/chunks/{chunk-TD6XNJRC.js → chunk-HYQOBARI.js} +2 -2
  36. package/dist/chunks/{chunk-TD6XNJRC.js.map → chunk-HYQOBARI.js.map} +1 -1
  37. package/dist/chunks/{chunk-L2YRM5BR.js → chunk-L5HPUPUZ.js} +2 -2
  38. package/dist/chunks/{chunk-L2YRM5BR.js.map → chunk-L5HPUPUZ.js.map} +1 -1
  39. package/dist/chunks/{chunk-Z6IFVSZS.js → chunk-LDY26KXZ.js} +3 -3
  40. package/dist/chunks/{chunk-Z6IFVSZS.js.map → chunk-LDY26KXZ.js.map} +2 -2
  41. package/dist/chunks/{chunk-B65Y26K2.js → chunk-LOR4V6JJ.js} +2 -2
  42. package/dist/chunks/{chunk-B65Y26K2.js.map → chunk-LOR4V6JJ.js.map} +1 -1
  43. package/dist/chunks/{chunk-4JYYNBSO.js → chunk-QVQIHX2Y.js} +2 -2
  44. package/dist/chunks/{chunk-4JYYNBSO.js.map → chunk-QVQIHX2Y.js.map} +1 -1
  45. package/dist/chunks/chunk-RRQGLRKY.js +8 -0
  46. package/dist/chunks/chunk-RRQGLRKY.js.map +7 -0
  47. package/dist/chunks/{chunk-H6TKCTCB.js → chunk-SBHNFZRS.js} +2 -2
  48. package/dist/chunks/chunk-VOD5M5MV.js +2 -0
  49. package/dist/chunks/{chunk-NGTPDYX7.js → chunk-XXMAC5EP.js} +1 -1
  50. package/dist/chunks/{chunk-NGTPDYX7.js.map → chunk-XXMAC5EP.js.map} +1 -1
  51. package/dist/chunks/{chunk-CVHICHF5.js → chunk-ZMUXLTEP.js} +2 -2
  52. package/dist/chunks/{renderSvg-KEQ6NZ4A.js → renderSvg-WQ5CH3G3.js} +2 -2
  53. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
  54. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
  55. package/package.json +3 -3
  56. package/src/WalkFormsAdapter/WalkFormsAdapter.test.ts +3 -3
  57. package/src/WalkFormsAdapter/configSchema.ts +1 -1
  58. package/src/WalkFormsAdapter/formRows.test.ts +12 -13
  59. package/src/WalkFormsAdapter/formRows.ts +2 -13
  60. package/src/version.ts +1 -1
  61. package/dist/chunks/GraphSettingsDialog-XXCBW2UA.js +0 -2
  62. package/dist/chunks/LinearGraphDisplay-26MRFDXW.js +0 -2
  63. package/dist/chunks/WalkFormsAdapter-AV746ZGI.js +0 -2
  64. package/dist/chunks/WalkFormsAdapter-AV746ZGI.js.map +0 -7
  65. package/dist/chunks/chunk-3QEIRGMZ.js +0 -2
  66. package/dist/chunks/chunk-5BMTS4FH.js +0 -5
  67. package/dist/chunks/chunk-5BMTS4FH.js.map +0 -7
  68. package/dist/chunks/chunk-SMC6O3CR.js +0 -6
  69. package/dist/chunks/chunk-SMC6O3CR.js.map +0 -7
  70. /package/dist/chunks/{AddTrackWorkflow-BY23IVYG.js.map → AddTrackWorkflow-4S5QEZTJ.js.map} +0 -0
  71. /package/dist/chunks/{GraphGenomeView-7FALCHVY.js.map → GraphGenomeView-EGR7L5WT.js.map} +0 -0
  72. /package/dist/chunks/{GraphSettingsDialog-XXCBW2UA.js.map → GraphSettingsDialog-6VOMA2TZ.js.map} +0 -0
  73. /package/dist/chunks/{HighlightColorDialog-AD7B53ZA.js.map → HighlightColorDialog-FHRKHBDZ.js.map} +0 -0
  74. /package/dist/chunks/{LinearGraphDisplay-26MRFDXW.js.map → LinearGraphDisplay-R3A64XKK.js.map} +0 -0
  75. /package/dist/chunks/{MinigraphBubbleAdapter-W7RUVFVI.js.map → MinigraphBubbleAdapter-LQ2NYC6O.js.map} +0 -0
  76. /package/dist/chunks/{RgfaTabixAdapter-QOEMTN56.js.map → RgfaTabixAdapter-UM7L6HPH.js.map} +0 -0
  77. /package/dist/chunks/{WalkTabixSyntenyAdapter-HEXLZ5YL.js.map → WalkTabixSyntenyAdapter-V5IQCHP4.js.map} +0 -0
  78. /package/dist/chunks/{chunk-IQURFLWC.js.map → chunk-55PR5XJY.js.map} +0 -0
  79. /package/dist/chunks/{chunk-FSVORNAP.js.map → chunk-5KWWMR7X.js.map} +0 -0
  80. /package/dist/chunks/{chunk-IAN7FKQ5.js.map → chunk-EYNSJ5AX.js.map} +0 -0
  81. /package/dist/chunks/{chunk-BCRRODIU.js.map → chunk-HE7BFKXW.js.map} +0 -0
  82. /package/dist/chunks/{chunk-H6TKCTCB.js.map → chunk-SBHNFZRS.js.map} +0 -0
  83. /package/dist/chunks/{chunk-3QEIRGMZ.js.map → chunk-VOD5M5MV.js.map} +0 -0
  84. /package/dist/chunks/{chunk-CVHICHF5.js.map → chunk-ZMUXLTEP.js.map} +0 -0
  85. /package/dist/chunks/{renderSvg-KEQ6NZ4A.js.map → renderSvg-WQ5CH3G3.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-SMC6O3CR.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-4FDZC66W.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
2
- //# sourceMappingURL=chunk-H6TKCTCB.js.map
1
+ import{f as Y,g as X,h as De,i as He,j as Ie,k as ce,l as qe,n as $e}from"./chunk-RRQGLRKY.js";import{a as ae,b as Oe}from"./chunk-D6TY2QEG.js";import{e as Fe,j as Le}from"./chunk-EGZZ3ADM.js";import{d as ze,g as ye,h as re}from"./chunk-5PMRULDS.js";var D=JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"],Ue=i=>D!=null&&i in Object(D)?D[i]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+i+"' from '@jbrowse/core/data_adapters/BaseAdapter' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:i});var Mt=Ue("BaseFeatureDataAdapter");var je=Ue("cachedSetup");var Bt=D&&D.__esModule?D.default:D;async function Et(i,e,t,n,s){return Ie(e,t,n),i.getLines(e,t,n,s)}async function Ve(i,e,t){for(let{refName:n,start:s,end:o}of e)Ie(n,s,o);return i.bytesForRegions(e,t)}function H(i){if(i?.aborted)throw ke(i)}function ke(i){let e=i.reason;return e===void 0?new DOMException("This operation was aborted","AbortError"):e}function Ge(i){return typeof i?.addEventListener=="function"}var z=class{entries=new Map;total=0;settledCount=0;limit;shared;fill;sizeOf;toCacheKey;idleTimeoutMs;sweepTimer;constructor({fill:e,maxSize:t=1/0,sizeOf:n=()=>1,cacheKey:s=a=>String(a),idleTimeoutMs:o=0,budget:r}={}){this.fill=e,this.limit=t,this.shared=r&&{budget:r,membership:r.register(this)},this.sizeOf=n,this.toCacheKey=s,this.idleTimeoutMs=o>0&&Number.isFinite(o)?o:void 0}get size(){return this.entries.size}get totalSize(){return this.total}get maxSize(){return this.limit}set maxSize(e){this.limit=e,this.evict()}waiterCount(e){return this.entries.get(this.toCacheKey(e))?.pending?.signals.size??0}async get(e,t,n){H(t);let s=this.toCacheKey(e),o=this.entries.get(s);o&&this.isDoomed(o)&&(this.release(s),o=void 0),o?this.touch(s,o):o=this.start(s,e,n),o.pending&&this.join(o.pending,t);try{return await this.settleFor(o,t)}finally{H(t)}}settleFor(e,t){if(!e.pending||!Ge(t))return e.promise;let n,s=new Promise((r,a)=>{n=a}),o=()=>{n(ke(t))};return t.addEventListener("abort",o,{once:!0}),Promise.race([e.promise,s]).finally(()=>{t.removeEventListener("abort",o)})}getIfCached(e){let t=this.toCacheKey(e),n=this.entries.get(t);if(n){if(this.isDoomed(n)){this.release(t);return}return this.touch(t,n),n.promise}}has(e){let t=this.entries.get(this.toCacheKey(e));return t!==void 0&&!this.isDoomed(t)}delete(e){this.release(this.toCacheKey(e))}clear(){this.entries.clear(),this.shared?.budget.charge(this.shared.membership,-this.total),this.total=0,this.settledCount=0,this.stopSweep()}touch(e,t){this.entries.delete(e),this.entries.set(e,t),t.lastTouched=Date.now(),t.seq=this.stamp()}stamp(){return this.shared?.budget.nextSeq()??0}isDoomed(e){return e.pending?.controller.signal.aborted===!0}sweepIdle(){let e=this.idleTimeoutMs;if(e===void 0)return;let t=Date.now()-e;for(let[n,s]of this.entries)!s.pending&&s.lastTouched<=t&&this.release(n);this.settledCount===0&&this.stopSweep()}startSweep(){let e=this.idleTimeoutMs;if(e===void 0||this.sweepTimer!==void 0)return;let t=Math.min(2**31-1,Math.max(1e3,Math.floor(e/4))),n=new WeakRef(this),s=setInterval(()=>{let o=n.deref();o?o.sweepIdle():clearInterval(s)},t);this.sweepTimer=s,s.unref?.()}stopSweep(){this.sweepTimer!==void 0&&(clearInterval(this.sweepTimer),this.sweepTimer=void 0)}start(e,t,n){let s=n??(this.fill&&(h=>this.fill(t,h)));if(!s)throw new Error("SharedReadCache needs a fill, either on the cache or on the get() call");let o={signals:new Map,pinned:!1,controller:new AbortController},r={promise:Promise.resolve(s(o.controller.signal)),pending:o,size:0,lastTouched:Date.now(),seq:this.stamp()};this.entries.set(e,r);let a=()=>this.entries.get(e)===r,l=()=>{for(let[h,c]of o.signals)h.removeEventListener("abort",c);r.pending=void 0};return r.promise.then(h=>{let c=a()?this.weigh(h):void 0,d=a();l(),d&&(c===void 0?this.entries.delete(e):(r.lastTouched=Date.now(),r.size=c,this.settledCount++,this.total+=c,this.shared?.budget.charge(this.shared.membership,c),this.startSweep())),this.evict(),this.shared?.budget.evict()},()=>{a()&&this.release(e),l()}),r}weigh(e){try{let t=this.sizeOf(e);return Number.isFinite(t)&&t>=0?t:void 0}catch{return}}join(e,t){if(!Ge(t))e.pinned=!0;else if(!t.aborted&&!e.signals.has(t)){let n=()=>{e.signals.delete(t),!e.pinned&&e.signals.size===0&&e.controller.abort(t.reason)};e.signals.set(t,n),t.addEventListener("abort",n,{once:!0})}}release(e){let t=this.entries.get(e);t&&(this.entries.delete(e),t.pending||this.settledCount--,this.total-=t.size,this.shared?.budget.charge(this.shared.membership,-t.size))}lruSpare(e=!1){if(!(this.settledCount<=(e?0:1))){for(let[t,n]of this.entries)if(!n.pending)return{cacheKey:t,seq:n.seq,last:this.settledCount===1}}}evict(){if(!(this.total<=this.limit))for(let[e,t]of this.entries){if(this.total<=this.limit||this.settledCount<=1)break;t.pending||this.release(e)}}};var A=class{minv;maxv;bin;endPosition;constructor(e,t,n,s=t.blockPosition+65536){this.minv=e,this.maxv=t,this.bin=n,this.endPosition=s}toString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}fetchedSize(){return this.endPosition-this.minv.blockPosition}};function ve(i,e){if(!(e>0))throw new TypeError(`\`${i}\` must be a number greater than 0`)}var Q=class{#e=new Map;#t=new Map;#n;#s;#o;constructor(e){let t=e.maxAge??Number.POSITIVE_INFINITY;ve("maxSize",e.maxSize),ve("maxAge",t),this.#n=e.maxSize,this.#s=t,this.#o=e.onEviction}#r(e){let t=this.#o;if(t)for(let[n,s]of e)t(n,s.value)}#i(e,t){return t.expiry!==void 0&&t.expiry<=Date.now()?(this.#o?.(e,t.value),this.delete(e),!0):!1}#c(e,t){return this.#i(e,t)?void 0:t.value}#l(e,t){if(this.#t.delete(e),this.#e.set(e,t),this.#e.size>=this.#n){let n=this.#t;this.#t=this.#e,this.#e=new Map,this.#r(n)}}#h(e){this.#t=new Map(e),this.#e=new Map}*#a(){for(let e of[this.#t,this.#e])for(let t of e)this.#i(...t)||(yield t)}get(e){let t=this.#e.get(e);if(t)return this.#c(e,t);let n=this.#t.get(e);if(n&&!this.#i(e,n))return this.#l(e,n),n.value}set(e,t,{maxAge:n=this.#s}={}){let s={value:t,expiry:n===Number.POSITIVE_INFINITY?void 0:Date.now()+n};return this.#e.has(e)?this.#e.set(e,s):this.#l(e,s),this}has(e){let t=this.#e.get(e)??this.#t.get(e);return t!==void 0&&!this.#i(e,t)}peek(e){let t=this.#e.get(e)??this.#t.get(e);return t?this.#c(e,t):void 0}expiresIn(e){let t=this.#e.get(e)??this.#t.get(e);if(t)return t.expiry===void 0?Number.POSITIVE_INFINITY:t.expiry-Date.now()}delete(e){return this.#e.delete(e)||this.#t.delete(e)}clear(){this.#e.clear(),this.#t.clear()}resize(e){ve("maxSize",e);let t=[...this.#a()],n=t.length-e;n<0?(this.#e=new Map(t),this.#t=new Map):(this.#r(t.slice(0,n)),this.#h(t.slice(n))),this.#n=e}evict(e=1){if(!(e>0))return;let t=[...this.#a()],n=Math.trunc(Math.min(e,t.length-1));n>0&&(this.#r(t.slice(0,n)),this.#h(t.slice(n)))}get size(){return Math.min(this.#e.size+this.#t.size,this.#n)}get maxSize(){return this.#n}get maxAge(){return this.#s}*entriesAscending(){for(let[e,t]of this.#a())yield[e,t.value]}*entriesDescending(){for(let e of[this.#e,this.#t])for(let[t,n]of[...e].reverse())this.#i(t,n)||(yield[t,n.value])}entries(){return this.entriesAscending()}[Symbol.iterator](){return this.entriesAscending()}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}forEach(e,t=this){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};function We(i,e=0){let t=i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24;return((i[e+4]|i[e+5]<<8|i[e+6]<<16|i[e+7]<<24)>>>0)*4294967296+(t>>>0)}var G=class{blockPosition;dataPosition;constructor(e,t){this.blockPosition=e,this.dataPosition=t}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}};function O(i,e=0){return new G(i[e+7]*1099511627776+i[e+6]*4294967296+i[e+5]*16777216+i[e+4]*65536+i[e+3]*256+i[e+2],i[e+1]<<8|i[e])}function le(i,e){let t=i.length;if(t===0)return i;let n;if(e){let a=e.blockPosition,l=e.dataPosition;n=[];for(let h=0;h<t;h++){let c=i[h];(c.maxv.blockPosition-a||c.maxv.dataPosition-l)>0&&n.push(c)}if(n.length===0)return n}else n=i;n.sort((a,l)=>{let h=a.minv.blockPosition-l.minv.blockPosition;return h===0?a.minv.dataPosition-l.minv.dataPosition:h});let s=[n[0]],o=n[0].minv.blockPosition,r=n[0].maxv.blockPosition;for(let a=1;a<n.length;a++){let l=n[a],h=l.minv.blockPosition,c=l.maxv.blockPosition;if(h-r<65e3&&c-o<5e6){let d=s.at(-1);(c-r||l.maxv.dataPosition-d.maxv.dataPosition)>0&&(s[s.length-1]=new A(d.minv,l.maxv,d.bin,l.endPosition),r=c)}else s.push(l),o=h,r=c}return at(s)}function at(i){let e=[i[0]];for(let t=1;t<i.length;t++){let n=i[t],s=e.at(-1).maxv;if((n.minv.blockPosition-s.blockPosition||n.minv.dataPosition-s.dataPosition)>=0){e.push(n);continue}(n.maxv.blockPosition-s.blockPosition||n.maxv.dataPosition-s.dataPosition)>0&&e.push(new A(s,n.maxv,n.bin,n.endPosition))}return e}function he(i,e=[]){let t=[...e];for(let n of i)t.push(n.minv.blockPosition,n.maxv.blockPosition);t.sort((n,s)=>n-s);for(let n of i){let s=n.maxv.blockPosition,o=0,r=t.length;for(;o<r;){let a=o+r>>>1;t[a]>s?r=a:o=a+1}o<t.length&&(n.endPosition=Math.min(n.endPosition,t[o]))}}function de(i,e,t,n,s=8){let o=n?n.blockPosition:1/0,r=n?n.dataPosition:0,a=!1;for(let l=0;l<t;l++){let h=e+l*s,c=i[h+7]*1099511627776+i[h+6]*4294967296+i[h+5]*16777216+i[h+4]*65536+i[h+3]*256+i[h+2],d=i[h+1]<<8|i[h];(c<o||c===o&&d<r)&&(o=c,r=d,a=!0)}return a?new G(o,r):n}function ct(i){let e=new TextDecoder("utf-8"),t=[],n={},s=0,o=0;for(;o<i.length;){let r=i.indexOf(0,o);if(r===-1)break;if(r>o){let a=e.decode(i.subarray(o,r));t[s]=a,n[a]=s}o=r+1,s++}return{refNameToId:n,refIdToName:t}}var lt={0:"generic",1:"SAM",2:"VCF",3:"GAF"};function fe(i,e){let t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=t.getInt32(e,!0),s=n&65536?"zero-based-half-open":"1-based-closed",o=lt[n&15];if(!o)throw new Error(`invalid Tabix preset format flags ${n}`);let r={ref:t.getInt32(e+4,!0),start:t.getInt32(e+8,!0),end:t.getInt32(e+12,!0)},a=t.getInt32(e+16,!0),l=a?String.fromCharCode(a):void 0,h=t.getInt32(e+20,!0),c=t.getInt32(e+24,!0),{refIdToName:d,refNameToId:p}=ct(i.subarray(e+28,e+28+c));return{refIdToName:d,refNameToId:p,skipLines:h,metaChar:l,columnNumbers:r,format:o,coordinateType:s}}function ue(i,e){return{lineCount:We(i,e)}}function me(i,e=5){let t=new Q({maxSize:e});return n=>{let s=t.get(n);if(s!==void 0)return s;let o=i(n);return o!==void 0&&t.set(n,o),o}}function Ke(i){let e=0;for(let s of i)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of i)t.set(s,n),n+=s.length;return t}var Je=10;function Se(i,e,t){let n,s=0;for(let o of i){let r=0;if(n){let h=o.indexOf(Je);if(h===-1){n=Ke([n,o]),e+=o.length;continue}if(t(Ke([n,o.subarray(0,h+1)]),s))return!0;r=h+1,n=void 0}let a=o.lastIndexOf(Je);if(a>=r&&t(o.subarray(r,a+1),e+r))return!0;let l=Math.max(r,a+1);l<o.length&&(n=o.slice(l),s=e+l),e+=o.length}return!1}function Ye(i,e,t){let n=[],s=0;for(let o of i){let r=Math.max(e-s,0),a=Math.min(t-s,o.length);r<a&&n.push(o.subarray(r,a)),s+=o.length}return n}function Pe(i,e,t){let n=0,s=i.length-1;for(;n<s;){let r=n+s+1>>>1;i[r]<=t.blockPosition?n=r:s=r-1}return(n===0?0:e[n])-e[0]+t.dataPosition}function ht(i,e,t,n){if(e>2**(t+n*3))return;let s=(8**(n+1)-1)/7,o=(8**n-1)/7+Math.floor((e-1)/2**t)+1;for(o>=s&&(o=0);;){for(;o%8===1;)o=(o-1)/8;if(o===0)return;let r=i[o];if(r?.length){let a=r[0].minv;for(let l=1;l<r.length;l++){let h=r[l].minv;h.compareTo(a)<0&&(a=h)}return a}o++}}function Xe(i,e){return i.format==="GAF"?0:i.refNameToId[e]}var q=class{filehandle;parseCache=new z({});constructor({filehandle:e}){this.filehandle=e}async readIndexBytes(e){let t=await this.filehandle.readFile({signal:e.signal,onProgress:e.onProgress}),n=await ce(t);return{bytes:n,dataView:new DataView(n.buffer,n.byteOffset,n.byteLength)}}async lineCount(e,t={}){let n=await this.parse(t),s=Xe(n,e);return s===void 0?-1:n.indices(s)?.stats?.lineCount??-1}async getMetadata(e={}){let{indices:t,...n}=await this.parse(e);return n}async blocksForRange(e,t,n,s={}){let o=await this.parse(s),r=Xe(o,e);if(r===void 0)return[];let a=o.indices(r);if(!a)return[];o.format==="GAF"&&(t=Math.max(t-1,0));let l=[];for(let[m,f]of this.reg2bins(t,n,o))for(let x=m;x<=f;x++){let b=a.binIndex[x];if(b)for(let v of b)l.push(v)}let h=this.lowestOffset(a,t,o),c=le(l,h),d=ht(a.binIndex,n,o.minShift,o.depth);if(d){let m=c.length;for(;m>0&&c[m-1].minv.compareTo(d)>=0;)m--;c.length=m}let p=c[0];if(p&&h){let m=2**(o.minShift+3),f=this.lowestOffset(a,Math.floor(t/m)*m,o),x=f&&f.compareTo(h)<0?f:h;p.minv.compareTo(x)<0&&(c[0]=new A(x,p.maxv,p.bin,p.endPosition))}return c}parse(e={}){return this.parseCache.get("index",e.signal,t=>this._parse({...e,signal:t}))}async hasRefSeq(e,t={}){return!!(await this.parse(t)).indices(e)?.binIndex}};var dt=21582659,ft=38359875;function Qe(i,e){return i*2**e}function Te(i,e){return Math.floor(i/2**e)}var $=class extends q{async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e),s=n.getUint32(0,!0),o;if(s===dt)o=1;else if(s===ft)o=2;else throw new Error(`Not a CSI file (magic=${s})`);let r=n.getInt32(4,!0),a=n.getInt32(8,!0),l=(8**(a+1)-1)/7,h=2**(r+a*3),c=n.getInt32(12,!0),d=c>=28&&(n.getInt32(16,!0)&15)===3;if(c<30&&!d)throw new Error("CSI index has no tabix header, so it names no references; it may be a BAM or BCF index");let p=fe(t,16),m=n.getInt32(16+c,!0),f=16+c+4,x,b=[];for(let y=0;y<m;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let u=0;u<I;u++){let S=n.getUint32(f,!0);if(f+=4,S>l)f+=44;else{x=de(t,f,1,x),f+=8;let g=n.getInt32(f,!0);f+=4+16*g}}}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C={},w;for(let F=0;F<S;F++){let k=n.getUint32(u,!0);if(u+=4,k>l)w=ue(t,u+28),u+=44;else{C[k]=O(t,u),u+=8;let R=n.getInt32(u,!0);u+=4;let T=Array.from({length:R});for(let _=0;_<R;_++)T[_]=new A(O(t,u),O(t,u+8),k),u+=16;g[k]=T}}return he(Object.values(g).flat()),{binIndex:g,loffsets:C,stats:w}}return{...p,csi:!0,refCount:m,maxBlockSize:65536,firstDataLine:x,csiVersion:o,indices:me(v),minShift:r,depth:a,maxBinNumber:l,maxRefLength:h}}lowestOffset(e,t,{minShift:n,depth:s}){let{loffsets:o}=e,r;if(o){let a=(Qe(1,3*s)-1)/7+Te(Math.max(t,0),n);for(;r===void 0&&a>0;)if(r=o[a],r===void 0){let l=Math.floor((a-1)/8),h=l*8+1;a=a>h?a-1:l}r??=o[0]}return r}reg2bins(e,t,{minShift:n,depth:s,maxBinNumber:o}){e=Math.max(e,0);let r=2**(n+s*3);t>r&&(t=r),t-=1;let a=0,l=0,h=n+s*3,c=[];for(;a<=s;h-=3,l+=Qe(1,a*3),a+=1){let d=l+Te(e,h),p=l+Te(t,h);if(p-d+c.length>o)throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${n}, depth ${s}), try a smaller query or a coarser index binning scheme`);c.push([d,p])}return c}};var ut=21578324,Ae=5,_e=14,pe=2**(_e+Ae*3);function Ze(i){return Math.min(Math.max(i,0),pe)}var L=class extends q{reg2bins(e,t){e>pe&&console.warn("querying outside of possible tabix range");let n=Ze(e),s=Math.min(t,pe)-1,o=[];return n<=s&&o.push([0,0],[1+(n>>26),1+(s>>26)],[9+(n>>23),9+(s>>23)],[73+(n>>20),73+(s>>20)],[585+(n>>17),585+(s>>17)],[4681+(n>>14),4681+(s>>14)]),o}lowestOffset(e,t){let n=e.linearIndex;return n?.[Math.min(Ze(t)>>_e,n.length-1)]}async _parse(e={}){let{bytes:t,dataView:n}=await this.readIndexBytes(e);if(n.getUint32(0,!0)!==ut)throw new Error("Not a TBI file");let s=n.getUint32(4,!0),o=((1<<(Ae+1)*3)-1)/7,{refNameToId:r,refIdToName:a,coordinateType:l,format:h,columnNumbers:c,metaChar:d,skipLines:p}=fe(t,8),f=36+n.getInt32(32,!0),x,b=[];for(let y=0;y<s;y++){b.push(f);let I=n.getInt32(f,!0);f+=4;for(let S=0;S<I;S++){let g=n.getUint32(f,!0);f+=4;let C=n.getInt32(f,!0);if(f+=4,g>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");g<=o&&(x=de(t,f,C,x,16)),f+=16*C}let u=n.getInt32(f,!0);f+=4+8*u}function v(y){let I=b[y];if(I===void 0)return;let u=I,S=n.getInt32(u,!0);u+=4;let g={},C;for(let k=0;k<S;k++){let R=n.getUint32(u,!0);if(u+=4,R>o+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(R===o+1){let T=n.getInt32(u,!0);u+=4,T===2&&(C=ue(t,u+16)),u+=16*T}else{let T=n.getInt32(u,!0);u+=4;let _=Array.from({length:T});for(let U=0;U<T;U++)_[U]=new A(O(t,u),O(t,u+8),R),u+=16;g[R]=_}}let w=n.getInt32(u,!0);u+=4;let F=Array.from({length:w});for(let k=0;k<w;k++)F[k]=O(t,u),u+=8;return he(Object.values(g).flat(),F.map(k=>k.blockPosition)),{binIndex:g,linearIndex:F,stats:C}}return{indices:me(v),metaChar:d,minShift:_e,depth:Ae,maxBinNumber:o,maxRefLength:pe,skipLines:p,firstDataLine:x,columnNumbers:c,coordinateType:l,format:h,refIdToName:a,refNameToId:r,maxBlockSize:65536}}};var Me=9,xe=10,nt=13,mt=59,pt=60,gt=62,xt=6,wt=1024*2**20,bt=180*1e3;function Ct(i,e,t){if(i)return i;if(e)return new X(e);if(t)return new Y(t);throw new TypeError("must provide either filehandle, path, or url")}function yt({tbiFilehandle:i,csiFilehandle:e,tbiPath:t,csiPath:n,tbiUrl:s,csiUrl:o,path:r,url:a}){if(i)return new L({filehandle:i});if(e)return new $({filehandle:e});if(t)return new L({filehandle:new X(t)});if(n)return new $({filehandle:new X(n)});if(o)return new $({filehandle:new Y(o)});if(s)return new L({filehandle:new Y(s)});if(r)return new L({filehandle:new X(`${r}.tbi`)});if(a)return new L({filehandle:new Y(`${a}.tbi`)});throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl")}function it(i,e,t,n,s){return i[t]*256+(n-e[t])+s+1}function It(i,e,t,n,s,o,r){let a=n-t,l=e+a,h=0;if(i[s]===46)return l;let c=s;for(let d=s;d<=o;d++)if(d===o||i[d]===mt){let p=d-c;if(p>=10&&i[c]===83&&i[c+1]===86&&i[c+2]===84&&i[c+3]===89&&i[c+4]===80&&i[c+5]===69&&i[c+6]===61&&i[c+7]===84&&i[c+8]===82&&i[c+9]===65)return e+1;if(p>=4&&i[c]===69&&i[c+1]===78&&i[c+2]===68&&i[c+3]===61){let m=ge(i,c+4,d);m>e&&(l=m)}else p>=6&&i[c]===83&&i[c+1]===86&&i[c+2]===76&&i[c+3]===69&&i[c+4]===78&&i[c+5]===61&&(h=vt(i,c+6,d,n+1,r));c=d+1}return Math.max(l,e+h)}var et=44;function kt(i,e,t){if(t-e<5||i[e]!==60||i[t-1]!==62)return!1;let n=i[e+4];if(n!==62&&n!==58)return!1;let s=i[e+1],o=i[e+2],r=i[e+3];return s===67&&o===78&&r===86||s===68&&o===69&&r===76||s===68&&o===85&&r===80||s===73&&o===78&&r===86}function vt(i,e,t,n,s){let o=0,r=e,a=n;for(;r<t&&a<s;){let l=i.indexOf(et,r);(l===-1||l>t)&&(l=t);let h=i.indexOf(et,a);if((h===-1||h>s)&&(h=s),kt(i,a,h)){let c=ge(i,i[r]===45?r+1:r,l);c>o&&(o=c)}r=l+1,a=h+1}return o}var st=new TextDecoder;function tt(i,e){let t=-1,n=e.charCodeAt(0);for(let s=0,o=i.length;s<o;s++){let r=i[s];if(s===t+1&&r!==n)break;r===xe&&(t=s)}return i.subarray(0,t+1)}function St(i,e){let t=0;for(let n=0;n<e;n++){let s=i.indexOf(xe,t);if(s===-1){t=i.length;break}t=s+1}return st.decode(i.subarray(0,t)).split(/\r?\n/).slice(0,e)}function ge(i,e,t){let n=0;for(let s=e;s<t;s++){let o=i[s];if(o>=48&&o<=57)n=n*10+(o-48);else break}return n}function Pt(i,e,t,n,s,{start:o,end:r,pathCol:a,metaCharCode:l,decoder:h,callback:c}){let d=0,p=0;for(;d<i.length;){let m=i.indexOf(xe,d);if(m===-1)break;let f=d;d=m+1;let x=f+e+s;for(;p<n.length&&x>=n[p];)p++;if(i[f]===l)continue;let b=f;for(let g=1;g<a;g++){let C=i.indexOf(Me,b);if(C===-1||C>=m){b=m;break}b=C+1}let v=i[b];if(v!==gt&&v!==pt)continue;let y=i.indexOf(Me,b);(y===-1||y>m)&&(y=m);let I=1/0,u=-1,S=b;for(;S<y;){let g=0,C=S+1;for(;C<y;C++){let w=i[C]-48;if(w<0||w>9)break;g=g*10+w}g<I&&(I=g),g>u&&(u=g),S=C}if(I>=r)return!0;if(u>=o){let g=i[m-1]===nt?m-1:m;c(h.decode(i.subarray(f,g)),it(t,n,p,f+e,s),I,u+1)}}return!1}var W=class{filehandle;index;chunkCache;requested=new Map;headerCache=new z({});bgzfWorkerPool;constructor({path:e,filehandle:t,url:n,tbiPath:s,tbiUrl:o,tbiFilehandle:r,csiPath:a,csiUrl:l,csiFilehandle:h,chunkCacheSize:c=wt,chunkCacheIdleTimeoutMs:d=bt,chunkCacheBudget:p,bgzfWorkerPool:m}){this.bgzfWorkerPool=m,this.filehandle=Ct(t,e,n),this.index=yt({tbiFilehandle:r,csiFilehandle:h,tbiPath:s,csiPath:a,tbiUrl:o,csiUrl:l,path:e,url:n}),this.chunkCache=new z({maxSize:c,sizeOf:f=>{let x=0;for(let b of f.segments)x+=b.byteLength;return x},cacheKey:f=>f.toString(),idleTimeoutMs:d,budget:p,fill:(f,x)=>this.readChunk(f,{signal:x})})}clearChunkCache(){this.chunkCache.clear(),this.requested.clear()}withCachedContainers(e){if(this.requested.size>2*this.chunkCache.size)for(let[n,s]of this.requested)this.chunkCache.has(s)||this.requested.delete(n);let t=[];for(let n=0;n<e.length;n++){let s=e[n],o=t[t.length-1],r=e[n+1],a;if(!this.chunkCache.has(s))for(let l of this.requested.values())l.minv.compareTo(s.minv)<=0&&l.maxv.compareTo(s.maxv)>=0&&(!o||l.minv.compareTo(o.maxv)>=0)&&(!r||l.maxv.compareTo(r.minv)<=0)&&(!a||l.fetchedSize()<a.fetchedSize())&&this.chunkCache.has(l)&&(a=l);t.push(a??s)}return t}async bytesForRegions(e,t={}){let n=[];for(let{refName:o,start:r,end:a}of e){let l=await this.index.blocksForRange(o,r,a,t);for(let h of l)n.push(h)}let s=0;for(let o of le(n))s+=o.fetchedSize();return s}async getLines(e,t,n,s){let o,r={},a,l;typeof s=="function"?a=s:(r=s,a=s.lineCallback,o=s.signal,l=s.onProgress);let h=await this.index.getMetadata(r),c=t??0,d=n??h.maxRefLength;if(c>d)throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(c===d)return;let p=await this.index.blocksForRange(e,c,d,r),m=this.withCachedContainers(p),f=h.format==="VCF",x=h.columnNumbers.ref||0,b=h.columnNumbers.start||0,v=f?8:h.columnNumbers.end||0,y=Math.max(x,b,v),I=h.metaChar?.charCodeAt(0),u=h.coordinateType==="1-based-closed"?-1:0,S=new TextEncoder,g=new TextDecoder,C=S.encode(e),w=new Int32Array(y+1),F=h.format==="GAF"?{start:c,end:d,pathCol:b,metaCharCode:I,decoder:g,callback:a}:void 0,k=0;for(let E of m)k+=E.fetchedSize();let R=0;l?.(0,k);let T=1,_=[],U=E=>{for(;_.length<Math.min(E,m.length);){let K=m[_.length];this.requested.set(K.toString(),K);let j=this.chunkCache.get(K,o);j.catch(()=>{}),_.push(j)}};U(1);for(let E=0,K=m.length;E<K;E++){let j=m[E],Be=await _[E],{cpositions:Z,dpositions:V}=Be;R+=j.fetchedSize(),l?.(R,k);let we=j.minv.dataPosition,be=p[E],ee=Be.segments,te=0;if(be!==j){te=Pe(Z,V,be.minv);let P=Pe(Z,V,be.maxv)+1;ee=Ye(ee,te,P)}if(F){if(Se(ee,te,(P,ne)=>Pt(P,ne,Z,V,we,F)))return}else if(Se(ee,te,(P,ne)=>{let M=0,ie=0;for(;M<P.length;){let B=P.indexOf(xe,M);if(B===-1)break;let rt=M+ne+we;for(;ie<V.length&&rt>=V[ie];)ie++;if(I!==void 0&&P[M]===I){M=B+1;continue}w[0]=M-1;for(let N=0;N<y;N++){let oe=w[N],Ce=oe<B?P.indexOf(Me,oe+1):-1;w[N+1]=Ce===-1||Ce>=B?B:Ce}let Ne=w[x-1]+1,Re=w[x]-Ne;if(Re!==C.length){M=B+1;continue}let Ee=!0;for(let N=0;N<Re;N++)if(P[Ne+N]!==C[N]){Ee=!1;break}if(!Ee){M=B+1;continue}let se=ge(P,w[b-1]+1,w[b])+u;if(se>=d)return!0;let J;if(v===0||v===b?J=se+1:f?J=It(P,se,w[3]+1,w[4],w[v-1]+1,w[v],w[5]):J=ge(P,w[v-1]+1,w[v]),J>c){let N=P[B-1]===nt?B-1:B,oe=g.decode(P.subarray(M,N));a(oe,it(Z,V,ie,M+ne,we),se,J)}M=B+1}return!1}))return;T=Math.min(T*2,xt),U(E+1+T)}}async getMetadata(e={}){return this.index.getMetadata(e)}async readHeaderBytes(e){let{firstDataLine:t,maxBlockSize:n}=await this.getMetadata(e);if(t?.blockPosition===0&&t.dataPosition===0)return new Uint8Array(0);let s=(t?.blockPosition??0)+n,o=await this.filehandle.read(s,0,e);return ce(o)}async parseHeader(e){let{metaChar:t,skipLines:n=0}=await this.getMetadata(e),s=await this.readHeaderBytes(e);return{header:st.decode(t?tt(s,t):s),skippedLines:n>0?St(s,n):[]}}getParsedHeader(e={}){return this.headerCache.get("header",e.signal,t=>this.parseHeader({...e,signal:t}))}async getHeaderBuffer(e={}){let{metaChar:t}=await this.getMetadata(e),n=await this.readHeaderBytes(e);return t?tt(n,t):n}async getSkippedLines(e={}){let{skipLines:t=0}=await this.getMetadata(e);return t<=0?[]:(await this.getParsedHeader(e)).skippedLines}async getHeader(e={}){return(await this.getParsedHeader(e)).header}async getHeaderLines(e={}){let{header:t,skippedLines:n}=await this.getParsedHeader(e);return(t?t.split(/\r?\n/):n).filter(Boolean)}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}async lineCount(e,t={}){return this.index.lineCount(e,t)}async readChunk(e,t={}){let n=await this.filehandle.read(e.fetchedSize(),e.minv.blockPosition,t);H(t.signal);let s=await this.bgzfWorkerPool;return qe(n,e,s)}};function Mn(i,e,t){let n=i.pluginManager;return new W({filehandle:ae(i.getConf(e),n),...Oe(i.getConf([...t,"location"]),i.getConf([...t,"indexType"]),n)})}function Bn(i){let e=i.getConf("walksIndex");return Tt(i.getConf("walksLocation"),Fe(e)?e:void 0,i.pluginManager)}function Tt(i,e,t){return $e.fromFilehandles({data:ae(i,t),directory:ae(e??Le(i,n=>`${n}.idx`),t)})}function Nn(i){return{names:e=>i.getReferenceSequenceNames(e),bytes:(e,t)=>Ve(i,e,t)}}function At(i){return`${i.assemblyName} ${i.refName} is not in this graph's index; a graph with PanSN names (GRCh38#0#chr1) needs ${i.assemblyName} mapped to its prefix in assemblyNameToPanSN`}var ot=class{constructor(e,t){this.source=e;this.adapter=t;this.lookup=je({setup:async e=>De(await this.source.names(e))})}async assemblyRefNames(e={}){let t=await this.source.names(e),n=re(this.adapter,e.assemblyName),s=t.filter(o=>ye(o,n)).map(o=>ze(o));return s.length>0?[...new Set(s)]:t}async resolve(e,t){let n=await this.lookup(t);return He(n,re(this.adapter,e.assemblyName),e.refName)}async resolveMapped(e,t){let n=await this.resolve(e,t);if(n===void 0&&e.assemblyName){let s=await this.source.names(t),o=re(this.adapter,e.assemblyName);if(s.length>0&&s.every(r=>r.includes("#"))&&!s.some(r=>ye(r,o)))throw new Error(At(e))}return n}async resolveForCut(e,t){let n=await this.resolveMapped(e,t);if(n===void 0)throw new Error(`This graph has nothing on ${e.assemblyName} ${e.refName}`);return n}async regionBytes(e,t={}){let n=[];for(let s of e){let o=await this.resolve(s,t);o!==void 0&&n.push({refName:o,start:s.start,end:s.end})}return this.source.bytes(n,t)}};export{Mt as a,je as b,Et as c,Mn as d,Bn as e,Tt as f,Nn as g,ot as h};
2
+ //# sourceMappingURL=chunk-SBHNFZRS.js.map
@@ -0,0 +1,2 @@
1
+ import{j as o}from"./chunk-4IPVOCXX.js";import{B as e}from"./chunk-RRQGLRKY.js";function d(r,n,t){let a=e(r);return t?{...r,abridged:a,walkRowRuns:o(r,n)}:{...r,abridged:a}}export{d as a};
2
+ //# sourceMappingURL=chunk-VOD5M5MV.js.map
@@ -1,2 +1,2 @@
1
1
  var c=$=>$==="-"?"+":"-",f=$=>$==="-"?"-":"+";function l($,n,e,i){let t=`${$} ${f(n)} ${e} ${f(i)}`,o=`${e} ${c(i)} ${$} ${c(n)}`;return t<o?t:o}export{l as a};
2
- //# sourceMappingURL=chunk-NGTPDYX7.js.map
2
+ //# sourceMappingURL=chunk-XXMAC5EP.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.2.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-J5U3HYBK.js"],
3
+ "sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-J5U3HYBK.js"],
4
4
  "sourcesContent": ["// src/gfa/linkKey.ts\nvar flip = (strand) => strand === \"-\" ? \"+\" : \"-\";\nvar side = (strand) => strand === \"-\" ? \"-\" : \"+\";\nfunction linkKey(source, strand1, target, strand2) {\n const stated = `${source}\t${side(strand1)}\t${target}\t${side(strand2)}`;\n const turned = `${target}\t${flip(strand2)}\t${source}\t${flip(strand1)}`;\n return stated < turned ? stated : turned;\n}\n\nexport {\n linkKey\n};\n"],
5
5
  "mappings": "AACA,IAAIA,EAAQC,GAAWA,IAAW,IAAM,IAAM,IAC1CC,EAAQD,GAAWA,IAAW,IAAM,IAAM,IAC9C,SAASE,EAAQC,EAAQC,EAASC,EAAQC,EAAS,CACjD,IAAMC,EAAS,GAAGJ,CAAM,IAAIF,EAAKG,CAAO,CAAC,IAAIC,CAAM,IAAIJ,EAAKK,CAAO,CAAC,GAC9DE,EAAS,GAAGH,CAAM,IAAIN,EAAKO,CAAO,CAAC,IAAIH,CAAM,IAAIJ,EAAKK,CAAO,CAAC,GACpE,OAAOG,EAASC,EAASD,EAASC,CACpC",
6
6
  "names": ["flip", "strand", "side", "linkKey", "source", "strand1", "target", "strand2", "stated", "turned"]
@@ -1,4 +1,4 @@
1
- import{a as mt}from"./chunk-JM4W4PKP.js";import{a as ut}from"./chunk-H6TKCTCB.js";import{a as pt,c as lt}from"./chunk-5L276I7O.js";function dt(e){let t=[],r=0,o;for(let i=0,n=e.length;i<n;i++){let s=e.charCodeAt(i);if(s>=48&&s<=57)r=r*10+s-48;else if(s===58)o=r,r=0;else{let a=e[i];a==="M"||a==="="||a==="X"?t.push({own:o===void 0?r:o,mate:r,op:"M"}):a==="I"?t.push({own:0,mate:r,op:a}):(a==="D"||a==="N")&&t.push({own:r,mate:0,op:a}),o=void 0,r=0}}return t}function Pe(e){let t="";for(let{own:r,mate:o,op:i}of dt(e))t+=i==="M"?r===0?`${o}I`:o===0?`${r}D`:`${r}M`:`${i==="I"?o:r}${i}`;return t}var Ne=2**28-1;function Fe(e,t,r){for(let o=t;o>0;o-=Ne)e.push((Math.min(o,Ne)<<4|r)>>>0)}function mr(e,t,r){if(t===r)Fe(e,t,0);else{let o=Math.ceil(Math.max(t,r)/Ne);for(let i=0;i<o;i++){let n=Math.floor(t*(i+1)/o)-Math.floor(t*i/o),s=Math.floor(r*(i+1)/o)-Math.floor(r*i/o);e.push((n<<4|9)>>>0,(s<<4|9)>>>0)}}}function ke(e){let t=[];for(let{own:r,mate:o,op:i}of dt(e))i==="M"?mr(t,r,o):i==="I"?Fe(t,o,1):Fe(t,r,i==="N"?3:2);return Uint32Array.from(t)}function dr(e){return e>=48&&e<=57}function hr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function ht(e,t){let r=t;for(;r<e.length&&hr(e[r]);)r++;return r}function xt(e,t){let r=t,o=0;for(;r<e.length&&dr(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r++;return{value:o,next:r}}function vt(e,t){let r=0;for(;r<e.length;){let o=e[r];if(o===":"){let{value:i,next:n}=xt(e,r+1);t(":",i,i,r+1,n),r=n}else if(o==="="){let i=ht(e,r+1),n=i-r-1;t("=",n,n,r+1,i),r=i}else if(o==="*")t("*",1,1,r+1,Math.min(r+3,e.length)),r+=3;else if(o==="+"||o==="-"){let i=ht(e,r+1),n=i-r-1;t(o,o==="-"?n:0,o==="+"?n:0,r+1,i),r=i}else if(o==="~"){let{value:i,next:n}=xt(e,r+3),s=Math.min(n+2,e.length);t("~",i,0,r+1,s),r=s}else r++}}function De(e,t,r,o){let i=r??Number.NEGATIVE_INFINITY,n=o??Number.POSITIVE_INFINITY,s=0;vt(e,(a,c,f,p,l)=>{if(a==="*")s>=i&&s<n&&t(88,s,1,e[p+1]??"",-1,0,0);else if(a==="+"){if(s>=i&&s<=n){let m=e.slice(p,l);t(73,s,f,m,-1,0,f)}}else(a==="-"||a==="~")&&s<n&&s+c>i&&t(a==="-"?68:78,s,c,"",-1,0,0);s+=c})}function At(e,t,r,o){let i=0,n=0,s=[],a=r&&t;for(let c=0,f=e.length;c<f;c++){let p=e[c],l=p>>>4,m=p&15;if(m===0||m===7){if(a)for(let u=0;u<l;u++)(t.charCodeAt(n+u)|32)!==(r.charCodeAt(i+u)|32)&&s.push({start:i+u,type:"mismatch",base:t[n+u],altbase:r[i+u],length:1});n+=l,i+=l}else if(m===1)s.push({start:i,type:"insertion",insertlen:l,insertedBases:t?.slice(n,n+l),length:0}),n+=l;else if(m===2)s.push({start:i,type:"deletion",length:l}),i+=l;else if(m===3)s.push({start:i,type:"skip",length:l}),i+=l;else if(m===8){for(let u=0;u<l;u++)s.push({start:i+u,type:"mismatch",base:t?.[n+u]||"X",qual:o?.[n+u],length:1});n+=l,i+=l}else m===5?s.push({start:i,type:"hardclip",cliplen:l,length:1}):m===4&&(s.push({start:i,type:"softclip",cliplen:l,length:1}),n+=l)}return s}function It(e,t,r,o,i){if(!t)return[];let n=[],s=t.length,a=o.length,c=i!==void 0,f=r.length,p=!1;for(let b=0;b<f;b++)if(r[b].type==="skip"){p=!0;break}let l=0,m=0,u=0,h=0,x=0,y=0,S=e.length;for(;y<S;){let b=e.charCodeAt(y);if(b>=48&&b<=57){let d=0;for(;y<S;){let g=e.charCodeAt(y);if(g>=48&&g<=57)d=d*10+(g-48),y++;else break}l+=d}else if(b===94)for(y++;y<S&&e.charCodeAt(y)>=65;)y++,l++;else if(b>=65){let d=e[y];if(y++,p&&f>0)for(let M=x;M<f;M++){let _=r[M];_.type==="skip"&&l>=_.start&&(l+=_.length,x=M+1)}let g=u,v=h;for(let M=m;M<s&&v<=l;M++,m=M){let _=t[M],P=_>>>4,E=_&15;E===4||E===1?g+=P:E===2||E===6||E===3?v+=P:E!==5&&(g+=P,v+=P)}u=g,h=v;let I=g-(v-l),C=I<a?o[I]:"X";n.push({start:l,base:C,qual:c?i[I]:void 0,altbase:d,length:1,type:"mismatch"}),l++}else y++}return n}var Ct={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function _t(e=""){let t=0,r=[];for(let o=0,i=e.length;o<i;o++){let n=e.charCodeAt(o);if(n>=48&&n<=57)t=t*10+(n-48);else{let s=Ct[n];r.push(t<<4|s),t=0}}return r}function Be(e=""){let t=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);(a<48||a>57)&&t++}let r=new Uint32Array(t),o=0,i=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);a>=48&&a<=57?o=o*10+(a-48):(r[i++]=o<<4|Ct[a],o=0)}return r}function se(e,t,r,o,i){let n=_t(e),s=e?At(n,r,o,i):[];return t&&r?s.concat(It(t,n,s,r,i)):s}var j=class extends pt{get(t){return t==="mismatches"?se(this.walkableCigar):t==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:t==="name"?super.get("name")??this.mate?.refName:super.get(t)}get mate(){return super.get("mate")}get walkableCigar(){let t=super.get("CIGAR"),r=super.get("coarseCigar");return typeof t=="string"?t:typeof r=="string"?Pe(r):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(t,r){let o=this.get("start"),i=r?.start===void 0?void 0:r.start-o,n=r?.end===void 0?void 0:r.end-o,s=this.get("cs");if(s)De(s,t,i,n);else{let a=i??Number.NEGATIVE_INFINITY,c=n??Number.POSITIVE_INFINITY;for(let f of se(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<c&&f.start+f.length>a:f.start>=a&&f.start<=c)&&(f.type==="mismatch"?t(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?t(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?t(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&t(78,f.start,f.length,"",-1,0,0))}}};var je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},je(e,t)};function J(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");je(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Et(e,t,r,o){function i(n){return n instanceof r?n:new r(function(s){s(n)})}return new(r||(r=Promise))(function(n,s){function a(p){try{f(o.next(p))}catch(l){s(l)}}function c(p){try{f(o.throw(p))}catch(l){s(l)}}function f(p){p.done?n(p.value):i(p.value).then(a,c)}f((o=o.apply(e,t||[])).next())})}function ae(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,i,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(f){return function(p){return c([f,p])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(o=1,i&&(n=f[0]&2?i.return:f[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,f[1])).done)return n;switch(i=0,n&&(f=[f[0]&2,n.value]),f[0]){case 0:case 1:n=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!n||f[1]>n[0]&&f[1]<n[3])){r.label=f[1];break}if(f[0]===6&&r.label<n[1]){r.label=n[1],n=f;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(f);break}n[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(p){f=[6,p],i=0}finally{o=n=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function U(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),i,n=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)n.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return n}function z(e,t,r){if(r||arguments.length===2)for(var o=0,i=t.length,n;o<i;o++)(n||!(o in t))&&(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function wt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(e,t||[]),i,n=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(u){return function(h){return Promise.resolve(h).then(u,l)}}function a(u,h){o[u]&&(i[u]=function(x){return new Promise(function(y,S){n.push([u,x,y,S])>1||c(u,x)})},h&&(i[u]=h(i[u])))}function c(u,h){try{f(o[u](h))}catch(x){m(n[0][3],x)}}function f(u){u.value instanceof W?Promise.resolve(u.value.v).then(p,l):m(n[0][2],u)}function p(u){c("next",u)}function l(u){c("throw",u)}function m(u,h){u(h),n.shift(),n.length&&c(n[0][0],n[0][1])}}function Mt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof U=="function"?U(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(n){r[n]=e[n]&&function(s){return new Promise(function(a,c){s=e[n](s),i(a,c,s.done,s.value)})}}function i(n,s,a,c){Promise.resolve(c).then(function(f){n({value:f,done:a})},s)}}function A(e){return typeof e=="function"}function Tt(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var fe=Tt(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
1
+ import{a as mt}from"./chunk-JM4W4PKP.js";import{a as ut}from"./chunk-SBHNFZRS.js";import{a as pt,c as lt}from"./chunk-5L276I7O.js";function dt(e){let t=[],r=0,o;for(let i=0,n=e.length;i<n;i++){let s=e.charCodeAt(i);if(s>=48&&s<=57)r=r*10+s-48;else if(s===58)o=r,r=0;else{let a=e[i];a==="M"||a==="="||a==="X"?t.push({own:o===void 0?r:o,mate:r,op:"M"}):a==="I"?t.push({own:0,mate:r,op:a}):(a==="D"||a==="N")&&t.push({own:r,mate:0,op:a}),o=void 0,r=0}}return t}function Pe(e){let t="";for(let{own:r,mate:o,op:i}of dt(e))t+=i==="M"?r===0?`${o}I`:o===0?`${r}D`:`${r}M`:`${i==="I"?o:r}${i}`;return t}var Ne=2**28-1;function Fe(e,t,r){for(let o=t;o>0;o-=Ne)e.push((Math.min(o,Ne)<<4|r)>>>0)}function mr(e,t,r){if(t===r)Fe(e,t,0);else{let o=Math.ceil(Math.max(t,r)/Ne);for(let i=0;i<o;i++){let n=Math.floor(t*(i+1)/o)-Math.floor(t*i/o),s=Math.floor(r*(i+1)/o)-Math.floor(r*i/o);e.push((n<<4|9)>>>0,(s<<4|9)>>>0)}}}function ke(e){let t=[];for(let{own:r,mate:o,op:i}of dt(e))i==="M"?mr(t,r,o):i==="I"?Fe(t,o,1):Fe(t,r,i==="N"?3:2);return Uint32Array.from(t)}function dr(e){return e>=48&&e<=57}function hr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function ht(e,t){let r=t;for(;r<e.length&&hr(e[r]);)r++;return r}function xt(e,t){let r=t,o=0;for(;r<e.length&&dr(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r++;return{value:o,next:r}}function vt(e,t){let r=0;for(;r<e.length;){let o=e[r];if(o===":"){let{value:i,next:n}=xt(e,r+1);t(":",i,i,r+1,n),r=n}else if(o==="="){let i=ht(e,r+1),n=i-r-1;t("=",n,n,r+1,i),r=i}else if(o==="*")t("*",1,1,r+1,Math.min(r+3,e.length)),r+=3;else if(o==="+"||o==="-"){let i=ht(e,r+1),n=i-r-1;t(o,o==="-"?n:0,o==="+"?n:0,r+1,i),r=i}else if(o==="~"){let{value:i,next:n}=xt(e,r+3),s=Math.min(n+2,e.length);t("~",i,0,r+1,s),r=s}else r++}}function De(e,t,r,o){let i=r??Number.NEGATIVE_INFINITY,n=o??Number.POSITIVE_INFINITY,s=0;vt(e,(a,c,f,p,l)=>{if(a==="*")s>=i&&s<n&&t(88,s,1,e[p+1]??"",-1,0,0);else if(a==="+"){if(s>=i&&s<=n){let m=e.slice(p,l);t(73,s,f,m,-1,0,f)}}else(a==="-"||a==="~")&&s<n&&s+c>i&&t(a==="-"?68:78,s,c,"",-1,0,0);s+=c})}function At(e,t,r,o){let i=0,n=0,s=[],a=r&&t;for(let c=0,f=e.length;c<f;c++){let p=e[c],l=p>>>4,m=p&15;if(m===0||m===7){if(a)for(let u=0;u<l;u++)(t.charCodeAt(n+u)|32)!==(r.charCodeAt(i+u)|32)&&s.push({start:i+u,type:"mismatch",base:t[n+u],altbase:r[i+u],length:1});n+=l,i+=l}else if(m===1)s.push({start:i,type:"insertion",insertlen:l,insertedBases:t?.slice(n,n+l),length:0}),n+=l;else if(m===2)s.push({start:i,type:"deletion",length:l}),i+=l;else if(m===3)s.push({start:i,type:"skip",length:l}),i+=l;else if(m===8){for(let u=0;u<l;u++)s.push({start:i+u,type:"mismatch",base:t?.[n+u]||"X",qual:o?.[n+u],length:1});n+=l,i+=l}else m===5?s.push({start:i,type:"hardclip",cliplen:l,length:1}):m===4&&(s.push({start:i,type:"softclip",cliplen:l,length:1}),n+=l)}return s}function It(e,t,r,o,i){if(!t)return[];let n=[],s=t.length,a=o.length,c=i!==void 0,f=r.length,p=!1;for(let b=0;b<f;b++)if(r[b].type==="skip"){p=!0;break}let l=0,m=0,u=0,h=0,x=0,y=0,S=e.length;for(;y<S;){let b=e.charCodeAt(y);if(b>=48&&b<=57){let d=0;for(;y<S;){let g=e.charCodeAt(y);if(g>=48&&g<=57)d=d*10+(g-48),y++;else break}l+=d}else if(b===94)for(y++;y<S&&e.charCodeAt(y)>=65;)y++,l++;else if(b>=65){let d=e[y];if(y++,p&&f>0)for(let M=x;M<f;M++){let _=r[M];_.type==="skip"&&l>=_.start&&(l+=_.length,x=M+1)}let g=u,v=h;for(let M=m;M<s&&v<=l;M++,m=M){let _=t[M],P=_>>>4,E=_&15;E===4||E===1?g+=P:E===2||E===6||E===3?v+=P:E!==5&&(g+=P,v+=P)}u=g,h=v;let I=g-(v-l),C=I<a?o[I]:"X";n.push({start:l,base:C,qual:c?i[I]:void 0,altbase:d,length:1,type:"mismatch"}),l++}else y++}return n}var Ct={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function _t(e=""){let t=0,r=[];for(let o=0,i=e.length;o<i;o++){let n=e.charCodeAt(o);if(n>=48&&n<=57)t=t*10+(n-48);else{let s=Ct[n];r.push(t<<4|s),t=0}}return r}function Be(e=""){let t=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);(a<48||a>57)&&t++}let r=new Uint32Array(t),o=0,i=0;for(let n=0,s=e.length;n<s;n++){let a=e.charCodeAt(n);a>=48&&a<=57?o=o*10+(a-48):(r[i++]=o<<4|Ct[a],o=0)}return r}function se(e,t,r,o,i){let n=_t(e),s=e?At(n,r,o,i):[];return t&&r?s.concat(It(t,n,s,r,i)):s}var j=class extends pt{get(t){return t==="mismatches"?se(this.walkableCigar):t==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:t==="name"?super.get("name")??this.mate?.refName:super.get(t)}get mate(){return super.get("mate")}get walkableCigar(){let t=super.get("CIGAR"),r=super.get("coarseCigar");return typeof t=="string"?t:typeof r=="string"?Pe(r):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(t,r){let o=this.get("start"),i=r?.start===void 0?void 0:r.start-o,n=r?.end===void 0?void 0:r.end-o,s=this.get("cs");if(s)De(s,t,i,n);else{let a=i??Number.NEGATIVE_INFINITY,c=n??Number.POSITIVE_INFINITY;for(let f of se(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<c&&f.start+f.length>a:f.start>=a&&f.start<=c)&&(f.type==="mismatch"?t(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?t(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?t(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&t(78,f.start,f.length,"",-1,0,0))}}};var je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},je(e,t)};function J(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");je(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Et(e,t,r,o){function i(n){return n instanceof r?n:new r(function(s){s(n)})}return new(r||(r=Promise))(function(n,s){function a(p){try{f(o.next(p))}catch(l){s(l)}}function c(p){try{f(o.throw(p))}catch(l){s(l)}}function f(p){p.done?n(p.value):i(p.value).then(a,c)}f((o=o.apply(e,t||[])).next())})}function ae(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},o,i,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(f){return function(p){return c([f,p])}}function c(f){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(o=1,i&&(n=f[0]&2?i.return:f[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,f[1])).done)return n;switch(i=0,n&&(f=[f[0]&2,n.value]),f[0]){case 0:case 1:n=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!n||f[1]>n[0]&&f[1]<n[3])){r.label=f[1];break}if(f[0]===6&&r.label<n[1]){r.label=n[1],n=f;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(f);break}n[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(p){f=[6,p],i=0}finally{o=n=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function U(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),i,n=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)n.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return n}function z(e,t,r){if(r||arguments.length===2)for(var o=0,i=t.length,n;o<i;o++)(n||!(o in t))&&(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function wt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(e,t||[]),i,n=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(u){return function(h){return Promise.resolve(h).then(u,l)}}function a(u,h){o[u]&&(i[u]=function(x){return new Promise(function(y,S){n.push([u,x,y,S])>1||c(u,x)})},h&&(i[u]=h(i[u])))}function c(u,h){try{f(o[u](h))}catch(x){m(n[0][3],x)}}function f(u){u.value instanceof W?Promise.resolve(u.value.v).then(p,l):m(n[0][2],u)}function p(u){c("next",u)}function l(u){c("throw",u)}function m(u,h){u(h),n.shift(),n.length&&c(n[0][0],n[0][1])}}function Mt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof U=="function"?U(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(n){r[n]=e[n]&&function(s){return new Promise(function(a,c){s=e[n](s),i(a,c,s.done,s.value)})}}function i(n,s,a,c){Promise.resolve(c).then(function(f){n({value:f,done:a})},s)}}function A(e){return typeof e=="function"}function Tt(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var fe=Tt(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
2
2
  `+r.map(function(o,i){return i+1+") "+o.toString()}).join(`
3
3
  `):"",this.name="UnsubscriptionError",this.errors=r}});function Ue(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ce=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,o,i,n;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=U(s),c=a.next();!c.done;c=a.next()){var f=c.value;f.remove(this)}}catch(x){t={error:x}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(A(p))try{p()}catch(x){n=x instanceof fe?x.errors:[x]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var m=U(l),u=m.next();!u.done;u=m.next()){var h=u.value;try{Ot(h)}catch(x){n=n??[],x instanceof fe?n=z(z([],Y(n)),Y(x.errors)):n.push(x)}}}catch(x){o={error:x}}finally{try{u&&!u.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}}if(n)throw new fe(n)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ot(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ue(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ue(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var zo=ce.EMPTY;function pe(e){return e instanceof ce||e&&"closed"in e&&A(e.remove)&&A(e.add)&&A(e.unsubscribe)}function Ot(e){A(e)?e():e.unsubscribe()}var N={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var V={setTimeout:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var i=V.delegate;return i?.setTimeout?i.setTimeout.apply(i,z([e,t],Y(r))):setTimeout.apply(void 0,z([e,t],Y(r)))},clearTimeout:function(e){var t=V.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function le(e){V.setTimeout(function(){var t=N.onUnhandledError;if(t)t(e);else throw e})}function We(){}var Rt=(function(){return $e("C",void 0,void 0)})();function Lt(e){return $e("E",void 0,e)}function Nt(e){return $e("N",e,void 0)}function $e(e,t,r){return{kind:e,value:t,error:r}}var $=null;function Ft(e){if(N.useDeprecatedSynchronousErrorHandling){var t=!$;if(t&&($={errorThrown:!1,error:null}),e(),t){var r=$,o=r.errorThrown,i=r.error;if($=null,o)throw i}}else e()}function Pt(e){N.useDeprecatedSynchronousErrorHandling&&$&&($.errorThrown=!0,$.error=e)}var ee=(function(e){J(t,e);function t(r){var o=e.call(this)||this;return o.isStopped=!1,r?(o.destination=r,pe(r)&&r.add(o)):o.destination=vr,o}return t.create=function(r,o,i){return new me(r,o,i)},t.prototype.next=function(r){this.isStopped?Ye(Nt(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ye(Lt(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ye(Rt,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(ce);var gr=Function.prototype.bind;function He(e,t){return gr.call(e,t)}var Sr=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(o){ue(o)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(o){ue(o)}else ue(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){ue(r)}},e})(),me=(function(e){J(t,e);function t(r,o,i){var n=e.call(this)||this,s;if(A(r)||!r)s={next:r??void 0,error:o??void 0,complete:i??void 0};else{var a;n&&N.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return n.unsubscribe()},s={next:r.next&&He(r.next,a),error:r.error&&He(r.error,a),complete:r.complete&&He(r.complete,a)}):s=r}return n.destination=new Sr(s),n}return t})(ee);function ue(e){N.useDeprecatedSynchronousErrorHandling?Pt(e):le(e)}function br(e){throw e}function Ye(e,t){var r=N.onStoppedNotification;r&&V.setTimeout(function(){return r(e,t)})}var vr={closed:!0,next:We,error:br,complete:We};var K=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function kt(e){return e}function Dt(e){return e.length===0?kt:e.length===1?e[0]:function(r){return e.reduce(function(o,i){return i(o)},r)}}var T=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,o){var i=this,n=Ir(t)?t:new me(t,r,o);return Ft(function(){var s=i,a=s.operator,c=s.source;n.add(a?a.call(n,c):c?i._subscribe(n):i._trySubscribe(n))}),n},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var o=this;return r=qt(r),new r(function(i,n){var s=new me({next:function(a){try{t(a)}catch(c){n(c),s.unsubscribe()}},error:n,complete:i});o.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[K]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Dt(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=qt(t),new t(function(o,i){var n;r.subscribe(function(s){return n=s},function(s){return i(s)},function(){return o(n)})})},e.create=function(t){return new e(t)},e})();function qt(e){var t;return(t=e??N.Promise)!==null&&t!==void 0?t:Promise}function Ar(e){return e&&A(e.next)&&A(e.error)&&A(e.complete)}function Ir(e){return e&&e instanceof ee||Ar(e)&&pe(e)}function Cr(e){return A(e?.lift)}function R(e){return function(t){if(Cr(t))return t.lift(function(r){try{return e(r,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function D(e,t,r,o,i){return new _r(e,t,r,o,i)}var _r=(function(e){J(t,e);function t(r,o,i,n,s,a){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=o?function(f){try{o(f)}catch(p){r.error(p)}}:e.prototype._next,c._error=n?function(f){try{n(f)}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(ee);var de=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function he(e){return A(e?.then)}function xe(e){return A(e[K])}function ye(e){return Symbol.asyncIterator&&A(e?.[Symbol.asyncIterator])}function ge(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Er(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Se=Er();function be(e){return A(e?.[Se])}function ve(e){return wt(this,arguments,function(){var r,o,i,n;return ae(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,W(r.read())];case 3:return o=s.sent(),i=o.value,n=o.done,n?[4,W(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,W(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Ae(e){return A(e?.getReader)}function k(e){if(e instanceof T)return e;if(e!=null){if(xe(e))return wr(e);if(de(e))return Mr(e);if(he(e))return Tr(e);if(ye(e))return Gt(e);if(be(e))return Or(e);if(Ae(e))return Rr(e)}throw ge(e)}function wr(e){return new T(function(t){var r=e[K]();if(A(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Mr(e){return new T(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Tr(e){return new T(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,le)})}function Or(e){return new T(function(t){var r,o;try{for(var i=U(e),n=i.next();!n.done;n=i.next()){var s=n.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}t.complete()})}function Gt(e){return new T(function(t){Lr(e,t).catch(function(r){return t.error(r)})})}function Rr(e){return Gt(ve(e))}function Lr(e,t){var r,o,i,n;return Et(this,void 0,void 0,function(){var s,a;return ae(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Mt(e),c.label=1;case 1:return[4,r.next()];case 2:if(o=c.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),o&&!o.done&&(n=r.return)?[4,n.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function L(e,t,r,o,i){o===void 0&&(o=0),i===void 0&&(i=!1);var n=t.schedule(function(){r(),i?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(n),!i)return n}function Ie(e,t){return t===void 0&&(t=0),R(function(r,o){r.subscribe(D(o,function(i){return L(o,e,function(){return o.next(i)},t)},function(){return L(o,e,function(){return o.complete()},t)},function(i){return L(o,e,function(){return o.error(i)},t)}))})}function Ce(e,t){return t===void 0&&(t=0),R(function(r,o){o.add(e.schedule(function(){return r.subscribe(o)},t))})}function Bt(e,t){return k(e).pipe(Ce(t),Ie(t))}function jt(e,t){return k(e).pipe(Ce(t),Ie(t))}function Ut(e,t){return new T(function(r){var o=0;return t.schedule(function(){o===e.length?r.complete():(r.next(e[o++]),r.closed||this.schedule())})})}function Wt(e,t){return new T(function(r){var o;return L(r,t,function(){o=e[Se](),L(r,t,function(){var i,n,s;try{i=o.next(),n=i.value,s=i.done}catch(a){r.error(a);return}s?r.complete():r.next(n)},0,!0)}),function(){return A(o?.return)&&o.return()}})}function _e(e,t){if(!e)throw new Error("Iterable cannot be null");return new T(function(r){L(r,t,function(){var o=e[Symbol.asyncIterator]();L(r,t,function(){o.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function $t(e,t){return _e(ve(e),t)}function Ht(e,t){if(e!=null){if(xe(e))return Bt(e,t);if(de(e))return Ut(e,t);if(he(e))return jt(e,t);if(ye(e))return _e(e,t);if(be(e))return Wt(e,t);if(Ae(e))return $t(e,t)}throw ge(e)}function ze(e,t){return t?Ht(e,t):k(e)}function te(e,t){return R(function(r,o){var i=0;r.subscribe(D(o,function(n){o.next(e.call(t,n,i++))}))})}function Yt(e,t,r,o,i,n,s,a){var c=[],f=0,p=0,l=!1,m=function(){l&&!c.length&&!f&&t.complete()},u=function(x){return f<o?h(x):c.push(x)},h=function(x){n&&t.next(x),f++;var y=!1;k(r(x,p++)).subscribe(D(t,function(S){i?.(S),n?u(S):t.next(S)},function(){y=!0},void 0,function(){if(y)try{f--;for(var S=function(){var b=c.shift();s?L(t,s,function(){return h(b)}):h(b)};c.length&&f<o;)S();m()}catch(b){t.error(b)}}))};return e.subscribe(D(t,u,function(){l=!0,m()})),function(){a?.()}}function X(e,t,r){return r===void 0&&(r=1/0),A(t)?X(function(o,i){return te(function(n,s){return t(o,n,i,s)})(k(e(o,i)))},r):(typeof t=="number"&&(r=t),R(function(o,i){return Yt(o,i,e,r)}))}function zt(e,t,r,o,i){return function(n,s){var a=r,c=t,f=0;n.subscribe(D(s,function(p){var l=f++;c=a?e(c,p,l):(a=!0,p),o&&s.next(c)},i&&(function(){a&&s.next(c),s.complete()})))}}function Vt(e,t){return R(zt(e,t,arguments.length>=2,!1,!0))}var Nr=function(e,t){return e.push(t),e};function Ee(){return R(function(e,t){Vt(Nr,[])(e).subscribe(t)})}var Fr=397,Pr=387,kr=385;function Kt(e){return(1<<e&Fr)!==0}function Xt(e){return(1<<e&Pr)!==0}function Qt(e){return(1<<e&kr)!==0}function Ve(e,t,r,o,i,n,s){let a=i===-1?-1:1,c=t,f=i===-1?o:r,p=[],l=1/0,m=-1/0,u=1/0,h=-1/0,x=(y,S)=>{u=Math.min(u,y,S),h=Math.max(h,y,S)};for(let y=0;y<e.length;y++){let S=e[y],b=S>>>4,d=S&15,g=d===9,v=g||Kt(d)?b:0,I=g?e[++y]>>>4:Xt(d)?b:0,C=c+v,M=f+I*a,_=c,P=C;if(P>=n&&_<=s)if(v>0){let E=Math.max(_,n),B=Math.min(P,s);if(B>E)if(l=Math.min(l,E),m=Math.max(m,B),g){let st=I/b,at=B-E,ft=Math.round(at*st),ct=Math.round(f+(E-c)*st*a);p.push(at<<4|9,ft<<4|9),x(ct,ct+ft*a)}else p.push(B-E<<4|d),Qt(d)?x(f+(E-c)*a,f+(B-c)*a):x(f,f)}else I>0&&(g?p.push(S,e[y]):p.push(S),l=Math.min(l,c),m=Math.max(m,c),x(f,M));if(c=C,f=M,c>s)break}if(p.length!==0)return{start:l,end:m,mateStart:u,mateEnd:h,cigar:Uint32Array.from(p)}}function Dr(e){return e===1||e===2||e===3}function Ke(e,t,r,o,i,n){let s=i===-1?-1:1,a=[],c=t,f=i===-1?o:r,p,l=!1,m=()=>{p!==void 0&&l&&p.qHi>p.qLo&&a.push({start:p.qLo,end:p.qHi,mateStart:p.tLo,mateEnd:p.tHi,cigar:Uint32Array.from(p.ops)}),p=void 0,l=!1};for(let u=0;u<e.length;u++){let h=e[u],x=h>>>4,y=h&15,S=y===9,b=S?e[++u]:void 0,d=S||Kt(y)?x:0,g=b!==void 0?b>>>4:Xt(y)?x:0,v=f+g*s;Dr(y)&&x>=n?m():(d>0||g>0)&&(p===void 0&&(p={qLo:c,qHi:c,tLo:f,tHi:f,ops:[]}),p.qHi=c+d,p.tLo=Math.min(p.tLo,f,v),p.tHi=Math.max(p.tHi,f,v),p.ops.push(h),b!==void 0&&p.ops.push(b),l=l||S||Qt(y)),c+=d,f=v}return m(),a}function Zt(e){let t=e.get("CIGAR");return typeof t=="string"?t:void 0}function Jt(e){let t=e.get("coarseCigar");return typeof t=="string"?t:void 0}function Xe(e){let t=Zt(e),r=t===void 0?Jt(e):void 0;return t!==void 0?Be(t):r!==void 0?ke(r):void 0}var qr=["CIGAR","cs","coarseCigar","cg","cr"];function Gr(e){return typeof e=="object"&&e!==null&&"refName"in e&&"start"in e&&"end"in e&&typeof e.refName=="string"&&typeof e.start=="number"&&typeof e.end=="number"}function Br(e){let t=e.get("mate");return Gr(t)?t:void 0}function jr(e,t,r,o){let i=Math.max(e.start,o.start),n=Math.min(e.end,o.end),s=(t.end-t.start)/Math.max(e.end-e.start,1),a=p=>r===-1?t.end-(p-e.start)*s:t.start+(p-e.start)*s,c=Math.round(a(i)),f=Math.round(a(n));return n>i?{start:i,end:n,mateStart:Math.min(c,f),mateEnd:Math.max(c,f)}:void 0}function Ur(e,t,r,o,i){let n={start:e.get("start"),end:e.get("end")},s=e.get("strand")===-1?-1:1,a=n.start>=r.start&&n.end<=r.end,c=a&&o===void 0&&!i?void 0:Xe(e);if(c===void 0){let f=a?{...n,mateStart:t.start,mateEnd:t.end}:jr(n,t,s,r);return f===void 0?[]:[f]}else return(o===void 0?[{...n,mateStart:t.start,mateEnd:t.end,cigar:c}]:Ke(c,n.start,t.start,t.end,s,o)).flatMap(p=>{let l=Ve(p.cigar,p.start,p.mateStart,p.mateEnd,s,r.start,r.end);return l===void 0?[]:[l]})}function Wr(e,t,r,o,i,n){let s=`:${o.start}-${o.end}${i}`,a=e.toJSON(),c={...a,uniqueId:`${e.id()}${s}`,recordId:a.recordId??e.id(),start:r.start,end:r.end,mate:{...t,start:r.mateStart,end:r.mateEnd}};a.syntenyId!==void 0&&(c.syntenyId=`${String(a.syntenyId)}${s}`);for(let f of qr)delete c[f];return n&&r.cigar&&(c.alignmentOps=r.cigar),new j(c)}function er(e,t,r,o=!1){let i=Br(e);if(i===void 0||e.get("spansWindow"))return[e];{let n=Ur(e,i,t,r,o);return n.map((s,a)=>Wr(e,i,s,t,n.length>1?`/${a}`:"",o))}}var tr=class extends ut{constructor(){super(...arguments);this.recordsAreAlignments=!0}static{this.capabilities=["getFeatures","getRefNames"]}async hasDataForRefName(){return!0}getFeaturesInMultipleRegions(r,o={}){let{clipToRegion:i,splitAtGapBp:n,keepAlignment:s,...a}=o,c=i&&this.recordsAreAlignments,f=lt(a.statusCallback);return ze(r).pipe(X((p,l)=>this.getFeatures(p,{...a,statusCallback:f()}).pipe(X(m=>c?er(m,m.get("assemblyName")===p.assemblyName?p:{start:m.get("start"),end:m.get("end")},n,s):[m]),Ee(),te(m=>({index:l,features:m})))),Ee(),X(p=>p.sort((l,m)=>l.index-m.index).flatMap(l=>l.features)))}};function $r(e,t){let r=Math.max(1,t);return e>=10*r?Math.ceil(e/r):Math.max(11,Math.ceil(10*e/r))/10}function Hs(e,t){if(mt(e)&&e instanceof Error){let{fitsBp:r}=e;e.message=e.message.replace("to see the graph","to see lanes"),typeof r=="number"&&(e.message=e.message.replace(/^Zoom in to about [\d.,]*\d[KM]?bp/,`Zoom in about ${$r(t,r)}\xD7`))}return e}function Vs({target:e,query:t,strand:r,cigar:o,matches:i,columns:n}){let s=`${e.name}:${e.start}-${e.end}|${t.name}:${t.start}-${t.end}`;return new j({uniqueId:s,assemblyName:e.assemblyName,refName:e.refName,start:e.start,end:e.end,type:"match",strand:r==="-"?-1:1,CIGAR:o,syntenyId:s,identity:i/Math.max(n,1),numMatches:i,blockLen:n,mate:{refName:t.refName,start:t.start,end:t.end,assemblyName:t.assemblyName}})}function Xs(e,t){return 2*e+(t==="reverse"?1:0)}function q(e){return Math.floor(e/2)}function Qs(e){return e%2===0?"forward":"reverse"}function F(e){return e%2===1}function Zs(e){return e%2===0?e+1:e-1}function Js(e){return e==="left"?"right":"left"}function ea(e){return e==="forward"?"left":"right"}function ta(e){return e==="forward"?"right":"left"}function ra(e){return e==="left"?"forward":"reverse"}function oa(e){return e==="right"?"forward":"reverse"}function Hr(e,t){let r=q(e),o=q(t);return F(e)?o>r||o===r&&!F(t):o>=r}function na(e){return Yr(e[0],e[e.length-1])}function Yr(e,t){return e===void 0||t===void 0?!0:F(e)===F(t)?!F(e):Hr(e,t)}var zr=["","A","C","G","T","N"];function sa(e){let t=e[e.length-1];if(t===void 0)return 0;let r=t,o=0;for(let i=0;i<3&&r%6!==0;i++)r=Math.floor(r/6),o+=1;return 3*(e.length-1)+o}function aa(e){let t="";for(let r of e){let o=r;for(let i=0;i<3;i++){let n=zr[o%6];if(n==="")return t;o=Math.floor(o/6),t+=n}}return t}var Vr={A:"T",C:"G",G:"C",T:"A",N:"N"};function we(e){let t="";for(let r=e.length-1;r>=0;r--)t+=Vr[e[r]]??"N";return t}function Me(e,t){let r=0,o=e.length;for(;r<o;){let i=r+o>>1;e[i]<t?r=i+1:o=i}return r}var Te=class{ending;tree;constructor(t){this.ending=new Float64Array(t),this.tree=new Int32Array(t+1).fill(-1)}bestBefore(t){let r=-1;for(let o=t;o>0;o-=o&-o){let i=this.tree[o];i!==-1&&(r===-1||this.ending[i]>this.ending[r])&&(r=i)}return r}raise(t,r){this.ending[t]=r;for(let o=t+1;o<this.tree.length;o+=o&-o){let i=this.tree[o];(i===-1||r>this.ending[i])&&(this.tree[o]=t)}}},Qe=class{pairs=[];total=0;a;b;weight;occurrences=new Map;constructor(t,r,o){this.a=t,this.b=r,this.weight=o,r.forEach((i,n)=>{let s=this.occurrences.get(i);s?s.push(n):this.occurrences.set(i,[n])})}solve(t,r,o,i){let n=0;for(;t+n<r&&o+n<i&&this.a[t+n]===this.b[o+n];)this.match(t+n,o+n),n+=1;let s=0;for(;r-s>t+n&&i-s>o+n&&this.a[r-s-1]===this.b[i-s-1];)s+=1;this.solveMiddle(t+n,r-s,o+n,i-s);for(let a=s;a>0;a--)this.match(r-a,i-a)}match(t,r){this.pairs.push([t,r]),this.total+=this.weight(this.a[t])}solveMiddle(t,r,o,i){if(t===r||o===i)return;let n=this.matchCount(t,r,o,i);if(n===0)return;if(n<=r-t+(i-o)){this.chain(t,r,o,i,n);return}let s=t+r>>1,a=this.split(t,s,r,o,i);this.solve(t,s,o,a),this.solve(s,r,a,i)}matchCount(t,r,o,i){let n=0;for(let s=t;s<r;s++){let a=this.occurrences.get(this.a[s]);a&&(n+=Me(a,i)-Me(a,o))}return n}sweep(t,r,o,i,n,s,a){for(let c=t;c!==r;c+=o){let f=this.occurrences.get(this.a[c]);if(!f)continue;let p=this.weight(this.a[c]),l=Me(f,i),m=Me(f,n);for(let u=0;u<m-l;u++){let h=o===1?f[m-1-u]-i:n-1-f[l+u],x=s.bestBefore(h),y=(x===-1?0:s.ending[x])+p;if(y>s.ending[h]&&(s.raise(h,y),a)){let S=a.count++;a.row[S]=c,a.column[S]=h,a.previous[S]=x===-1?-1:a.endingMatch[x],a.endingMatch[h]=S}}}}chain(t,r,o,i,n){let s=new Te(i-o),a={row:new Int32Array(n),column:new Int32Array(n),previous:new Int32Array(n),endingMatch:new Int32Array(i-o),count:0};this.sweep(t,r,1,o,i,s,a);let c=s.bestBefore(i-o);if(c===-1)return;this.total+=s.ending[c];let f=[];for(let p=a.endingMatch[c];p!==-1;p=a.previous[p])f.push([a.row[p],o+a.column[p]]);for(let p=f.length-1;p>=0;p--)this.pairs.push(f[p])}frontier(t,r,o,i,n){let s=new Te(n-i);this.sweep(t,r,o,i,n,s);let a=new Float64Array(n-i+1);for(let c=0;c<n-i;c++)a[c+1]=Math.max(a[c],s.ending[c]);return a}split(t,r,o,i,n){let s=n-i,a=this.frontier(t,r,1,i,n),c=this.frontier(o-1,r-1,-1,i,n),f=0,p=-1;for(let l=0;l<=s;l++){let m=a[l]+c[s-l];m>p&&(p=m,f=l)}return i+f}};function ca(e,t,r){let o=new Qe(e,t,r);return o.solve(0,e.length,0,t.length),[o.pairs,o.total]}var Kr=100,et=4e6,Xr=5e3,O=15,Qr=64,Zr=8,fr=1,tt=-4,w=-6,G=-1,Q=-(2**30),Re=0,Ze=1,cr=2;function H(e,t,r){let o=e.at(-1);r>0&&(o?.[0]===t?o[1]+=r:e.push([t,r]))}function Oe(e,t,r){return e>=r&&e>=t?Re:r>=t?cr:Ze}function pr(e,t,r){let o=e.length,i=t.length,n=i+1,s=new Uint8Array((o+1)*n),a=new Int32Array(n).fill(Q),c=new Int32Array(n).fill(Q),f=new Int32Array(n).fill(Q);a[0]=0;for(let h=1;h<=i;h++)f[h]=w+(h-1)*G,s[h]=(h===1?Re:cr)<<4;for(let h=1;h<=o;h++){let x=new Int32Array(n).fill(Q),y=new Int32Array(n).fill(Q),S=new Int32Array(n).fill(Q);y[0]=w+(h-1)*G,s[h*n]=(h===1?Re:Ze)<<2;let b=e.charCodeAt(h-1);for(let d=1;d<=i;d++){let g=Oe(a[d-1],c[d-1],f[d-1]);x[d]=Math.max(a[d-1],c[d-1],f[d-1])+(b===t.charCodeAt(d-1)?fr:tt);let v=Oe(a[d]+w,c[d]+G,f[d]+w);y[d]=Math.max(a[d]+w,c[d]+G,f[d]+w);let I=Oe(x[d-1]+w,y[d-1]+w,S[d-1]+G);S[d]=Math.max(x[d-1]+w,y[d-1]+w,S[d-1]+G),s[h*n+d]=g|v<<2|I<<4}a=x,c=y,f=S}let p=[],l=o,m=i,u=Oe(a[i],c[i],f[i]);for(;l>0||m>0;){let h=s[l*n+m]>>2*u&3;u===Re?(p.push(e[l-1]===t[m-1]?"=":"X"),l-=1,m-=1):u===Ze?(p.push("I"),l-=1):(p.push("D"),m-=1),u=h}for(let h of p.reverse())H(r,h,1)}function Jr(e,t){let r=Math.abs(e-t);return(r===0?0:Math.min(-w-(r-1)*G,-w+10*Math.log2(r)))+(Math.min(e,t)>0?-tt:0)}function lr(e,t){let r=Math.abs(e-t);return r===0?0:.01*O*r+.5*Math.log2(r)}function rr(e,t,r){return{qs:e.qs+t,qe:e.qs+r,ts:e.flipped?e.te-r:e.ts+t,te:e.flipped?e.te-t:e.ts+r,flipped:e.flipped}}function eo(e,t,r){let o=e.qe-e.qs,i=[];for(let[a,c]of t){let f=Math.max(0,a-e.qs),p=Math.min(o,c-e.qs);f<p&&i.push([f,p])}for(let[a,c]of r){let f=Math.max(0,e.flipped?e.te-c:a-e.ts),p=Math.min(o,e.flipped?e.te-a:c-e.ts);f<p&&i.push([f,p])}if(i.length===0)return[e];i.sort((a,c)=>a[0]-c[0]);let n=[],s=0;for(let[a,c]of i)a-s>=O&&n.push(rr(e,s,a)),s=Math.max(s,c);return o-s>=O&&n.push(rr(e,s,o)),n}function rt(e,t,r,o,i=1/0){let n=[],s={query:[],target:[]},a={forward:{query:[],target:[]},flipped:{query:[],target:[]}},c=[...e].sort((f,p)=>f.qs-p.qs||f.ts-p.ts);for(;c.length>0&&n.length<i;){let f=c.map(d=>d.qe-d.qs),p=new Int32Array(c.length).fill(-1),l=new Int32Array(c.length);for(let d=0;d<c.length;d++){let g=c[d],v=g.qe-g.qs;for(let I=d-1;I>=Math.max(0,d-Xr);I--){if(f[I]+v<=f[d])continue;let C=c[I];if(C.flipped===g.flipped&&C.qs<g.qs&&(g.flipped?g.te<C.te:C.ts<g.ts)){let _=Math.max(0,C.qe-g.qs,g.flipped?g.te-C.ts:C.te-g.ts),P=g.qs+_-C.qe,E=g.flipped?C.ts-(g.te-_):g.ts+_-C.te;if(_<v&&P<=t&&E<=t){let B=f[I]+v-_-o(P,E);B>f[d]&&(f[d]=B,p[d]=I,l[d]=_)}}}}let m=new Int32Array(c.length),u=-1;for(let d=0;d<c.length;d++){let g=c[d];m[d]=(m[p[d]]??0)+g.qe-g.qs-l[d],m[d]>=r&&(u<0||f[d]>f[u])&&(u=d)}if(u<0)break;let h=[];for(let d=u;d>=0;d=p[d])h.push({run:c[d],trim:l[d]});h.reverse(),n.push(h);let x=h[0],y=h.at(-1),{flipped:S}=x.run,b=S?a.flipped:a.forward;b.query.push([x.run.qs+x.trim,y.run.qe]),b.target.push(S?[y.run.ts,x.run.te-x.trim]:[x.run.ts+x.trim,y.run.te]);for(let{run:d,trim:g}of h)s.query.push([d.qs+g,d.qe]),s.target.push(d.flipped?[d.ts,d.te-g]:[d.ts+g,d.te]);c=c.flatMap(d=>{let g=d.flipped?a.flipped:a.forward;return eo(d,[...s.query,...g.query],[...s.target,...g.target])}).sort((d,g)=>d.qs-g.qs||d.ts-g.ts)}return n}function Je(e,t){let r=new Map;for(let n=0;n+O<=t.length;n++){let s=t.slice(n,n+O),a=r.get(s);a?a.push(n):r.set(s,[n])}let o=[],i=new Map;for(let n=0;n+O<=e.length;n++){let s=r.get(e.slice(n,n+O));if(s&&s.length<=Qr)for(let a of s){let c=a-n,f=i.get(c);if(f&&n<=f.qe)f.qe=n+O,f.te=a+O;else{let p={qs:n,qe:n+O,ts:a,te:a+O,flipped:!1};i.set(c,p),o.push(p)}}}return o}function to(e,t){return[...Je(e,t),...Je(e,we(t)).map(r=>({...r,ts:t.length-r.te,te:t.length-r.ts,flipped:!0}))]}function Le(e,t,r,o,i){let n;for(let{run:s,trim:a}of e){let c=s.qs+a;if(n){let f=s.flipped?s.te-a:n.te,p=s.flipped?n.ts:s.ts+a,l=r.slice(f,p);i(t.slice(n.qe,c),s.flipped?we(l):l,o,n.qe,f)}H(o,"=",s.qe-c),n=s}}function ot(e,t,r){H(r,"I",e.length),H(r,"D",t.length)}function ur(e,t,r){e.length*t.length<=et?pr(e,t,r):ot(e,t,r)}function nt(e,t,r,o=0){let[i]=e.length*t.length>et&&o<Zr?rt(Je(e,t),1/0,O,lr,1):[];if(!i){ur(e,t,r);return}let n=(c,f,p)=>{nt(c,f,p,o+1)},s=i[0].run,a=i.at(-1).run;n(e.slice(0,s.qs),t.slice(0,s.ts),r),Le(i,e,t,r,n),n(e.slice(a.qe),t.slice(a.te),r)}function ro(e,t,r){nt(e,t,r)}function oo(e,t,r){let o=[];Le(e,t,r,o,ro);let i=e[0],n=e.at(-1),{flipped:s}=i.run;return{queryStart:i.run.qs+i.trim,queryEnd:n.run.qe,targetStart:s?n.run.ts:i.run.ts+i.trim,targetEnd:s?i.run.te-i.trim:n.run.te,strand:s?"-":"+",edits:s?o.reverse():o,sharedBases:0}}function no(e,t,r,o){let i=[];if(e.length*t.length<=et)pr(e,t,r);else{let n=rt(to(e,t),1/0,Math.max(o,O),lr),s=n.find(a=>!a[0].run.flipped);if(i=n.filter(a=>a[0].run.flipped).map(a=>oo(a,e,t)),s){let a=(p,l,m,u,h)=>{i.some(y=>u<y.queryEnd&&y.queryStart<u+p.length||h<y.targetEnd&&y.targetStart<h+l.length)?ur(p,l,m):nt(p,l,m)},c=s[0].run,f=s.at(-1).run;a(e.slice(0,c.qs),t.slice(0,c.ts),r,0,0),Le(s,e,t,r,a),a(e.slice(f.qe),t.slice(f.te),r,f.qe,f.te)}else ot(e,t,r)}return i}function it(e,t){let r=e.strand==="-",o=0,i=0;for(let[n,s]of e.edits)t(n,s,r?e.queryEnd-1-o:e.queryStart+o,e.targetStart+i),n!=="D"&&(o+=s),n!=="I"&&(i+=s)}function or(e,t,r,o){let i=t==="query"&&e.strand==="-"?-1:1,n=0;return it(e,(s,a,c,f)=>{let p=t==="query"?c:f,l=m=>{let u=p+i*m;return u>=r&&u<o};if(s==="="||s==="X")for(let m=0;m<a;m++)l(m)&&(n+=s==="="?fr:tt);else if(s==="I"==(t==="query"))for(let m=0;m<a;m++)l(m)&&(n+=m===0?w:G);else l(0)&&(n+=w+(a-1)*G)}),n}function nr(e,t){return t==="query"?[e.queryStart,e.queryEnd]:[e.targetStart,e.targetEnd]}function io(e,t){let r=e.strand==="-",o=[],i=0,n=0,s=0,a=0,c=new Uint8Array(e.queryEnd-e.queryStart);for(let[u,h]of e.shared)c.fill(1,u-e.queryStart,h-e.queryStart);let f=u=>c[u-e.queryStart]===1,p=()=>{H(o,"I",i),H(o,"D",n),i=0,n=0};it(e,(u,h,x)=>{if(u==="I")i+=h;else if(u==="D")n+=h;else{for(let y=0;y<h;y++)t[s+y]?(i+=1,n+=1,f(r?x-y:x+y)&&(a+=1)):((i>0||n>0)&&p(),H(o,u,1));s+=h}}),p();let l={I:0,D:0};for(;o[0]?.[0]==="I"||o[0]?.[0]==="D";){let[u,h]=o.shift();l[u]+=h}let m={I:0,D:0};for(;o.at(-1)?.[0]==="I"||o.at(-1)?.[0]==="D";){let[u,h]=o.pop();m[u]+=h}return o.length===0?void 0:{...e,queryStart:e.queryStart+(r?m.I:l.I),queryEnd:e.queryEnd-(r?l.I:m.I),targetStart:e.targetStart+l.D,targetEnd:e.targetEnd-m.D,edits:o,sharedBases:e.sharedBases-a}}function so(e,t,r,o){let i={query:new Uint8Array(t),target:new Uint8Array(r)},n=e.map(f=>{let p=[];it(f,(l,m,u,h)=>{if(l==="="||l==="X")for(let x=0;x<m;x++)p.push([f.strand==="-"?u-x:u+x,h+x])});for(let[l,m]of p)i.query[l]=Math.min(255,i.query[l]+1),i.target[m]=Math.min(255,i.target[m]+1);return p}),s={query:new Map,target:new Map};n.forEach((f,p)=>{for(let[l,m]of f)for(let[u,h]of[["query",l],["target",m]])if(i[u][h]>1){let x=s[u].get(h);x?x.at(-1)!==p&&x.push(p):s[u].set(h,[p])}});let a=new Map,c=(f,p,l)=>{let m=`${l}:${f}:${p}`,u=a.get(m);if(u===void 0){let[h,x]=nr(e[f],l),[y,S]=nr(e[p],l),b=Math.max(h,y),d=Math.min(x,S),[g,v]=[e[f],e[p]];u=[or(v,l,b,d)-or(g,l,b,d),v.sharedBases-g.sharedBases,f-p].find(C=>C!==0)>0,a.set(m,u)}return u};return e.flatMap((f,p)=>{let l=n[p],m=new Uint8Array(l.length);if(l.forEach(([x,y],S)=>{for(let[b,d]of[["query",x],["target",y]])!m[S]&&s[b].get(d)?.some(g=>g!==p&&c(p,g,b))&&(m[S]=1)}),!m.includes(1))return[f];let u=io(f,m),h=u?.edits.reduce((x,[y,S])=>x+(y==="="?S:0),0)??0;return u&&h>=o?[u]:[]})}function ir(e,t){return e.map(r=>{let o=t(q(r));return F(r)?we(o):o}).join("")}function sr(e,t){let r=[0];for(let o of e)r.push(r.at(-1)+t(q(o)).length);return r}function ar(e){let t=new Map,r=new Map;e.forEach((s,a)=>{let c=q(s);t.has(c)?r.set(c,a):t.set(c,a)});let o=new Int32Array(e.length+1);for(let[s,a]of r)o[t.get(s)]+=1,o[a+1]-=1;let i=new Uint8Array(e.length),n=0;for(let s=0;s<e.length;s++)n+=o[s],i[s]=n>0?1:0;return i}function ao(e,t,r,o){let i=ar(e),n=ar(t),s=new Map;t.forEach((l,m)=>{n[m]||s.set(q(l),[m])});let a=2*t.length,c=(l,m,u)=>l*a+2*m+(u?1:0),f=new Set;e.forEach((l,m)=>{for(let u of i[m]?[]:s.get(q(l))??[])f.add(c(m,u,F(l)!==F(t[u])))});let p=[];return e.forEach((l,m)=>{for(let u of i[m]?[]:s.get(q(l))??[]){let h=F(l)!==F(t[u]),x=h?-1:1,y=u-x;if(!(m>0&&y>=0&&y<t.length&&f.has(c(m-1,y,h)))){let b=m,d=u;for(;b<e.length&&d>=0&&d<t.length&&f.has(c(b,d,h));)b+=1,d+=x;let g=d-x;p.push({qs:r[m],qe:r[b],ts:o[Math.min(u,g)],te:o[Math.max(u,g)+1],flipped:h})}}}),p}function ma(e){let{query:t,target:r,sequenceOf:o}=e,i=ir(t,o),n=ir(r,o),s=ao(t,r,sr(t,o),sr(r,o)),a=e.minMatch??Kr,c=e.bases??!0,f=[];for(let p of rt(s,e.maxGap??1/0,a,Jr)){let l=[],m=p[0],u=p.at(-1),{flipped:h}=m.run;Le(p,i,n,l,c?(y,S,b,d,g)=>{for(let v of no(y,S,b,a)){let I=g+S.length;f.push({...v,queryStart:d+v.queryStart,queryEnd:d+v.queryEnd,targetStart:h?I-v.targetEnd:g+v.targetStart,targetEnd:h?I-v.targetStart:g+v.targetEnd,strand:h?"+":"-",edits:h?v.edits.reverse():v.edits,shared:[]})}}:ot),f.push({queryStart:m.run.qs+m.trim,queryEnd:u.run.qe,targetStart:h?u.run.ts:m.run.ts+m.trim,targetEnd:h?m.run.te-m.trim:u.run.te,strand:h?"-":"+",edits:h?l.reverse():l,sharedBases:p.reduce((y,{run:S,trim:b})=>y+S.qe-S.qs-b,0),shared:p.map(({run:y,trim:S})=>[y.qs+S,y.qe])})}return so(f,i.length,n.length,a).map(({shared:p,...l})=>l).sort((p,l)=>p.queryStart-l.queryStart)}function da(e){return e.map(([t,r])=>`${r}${t}`).join("")}export{Xs as a,q as b,Qs as c,F as d,Zs as e,Js as f,ea as g,ta as h,ra as i,oa as j,Hr as k,na as l,Yr as m,sa as n,aa as o,ca as p,ma as q,da as r,j as s,tr as t,Hs as u,Vs as v};
4
- //# sourceMappingURL=chunk-CVHICHF5.js.map
4
+ //# sourceMappingURL=chunk-ZMUXLTEP.js.map
@@ -1,2 +1,2 @@
1
- import{B as Z,F as q,G as C,d as W,e as j,i as z,j as F,l as O,m as _,n as X,o as I,p as $,r as J,s as K,u as N,v as Y,x as V,z as U}from"./chunk-IAN7FKQ5.js";import{Hb as D,Sb as S,Tb as R,_b as E,ac as H}from"./chunk-5BMTS4FH.js";import"./chunk-BDBERNEC.js";import"./chunk-AW7U7KMG.js";import{H as b}from"./chunk-4JYYNBSO.js";import"./chunk-7V5D6ZDX.js";import"./chunk-HT3RFCRI.js";import"./chunk-KFSVGH3X.js";import"./chunk-NGTPDYX7.js";import"./chunk-TD6XNJRC.js";import"./chunk-WKD7ALOU.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-4FDZC66W.js";import"./chunk-J2PN6CG3.js";import{a as k,b as e,c as u}from"./chunk-DUU6T2I5.js";var m=JBrowseExports["@jbrowse/display-kit/renderDisplaySvg"],it=t=>m!=null&&t in Object(m)?m[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/display-kit/renderDisplaySvg' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Q=it("renderDisplaySvg");var ft=m&&m.__esModule?m.default:m;var w=JBrowseExports["@jbrowse/core/util/paintLayer"],ot=t=>w!=null&&t in Object(w)?w[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/core/util/paintLayer' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t}),L=ot("PaintLayer"),wt=w&&w.__esModule?w.default:w;var M={fontFamily:"sans-serif",fontSize:11},tt=16,st=2,T=t=>t;function et({model:t,lift:i,drawPaths:a,width:n,height:r,rasterize:s}){let p=t.buildDrawing(i,a,t.liveBuildView);if(!p)return null;let l=s?st:1,c=s?void 0:E(n,r),d=c?.canvas??document.createElement("canvas");c||(d.width=Math.round(n*l),d.height=Math.round(r*l));let{scaleX:y,scaleY:v,translateX:h,translateY:g}=t.screenTransform,o=new H(d);return o.uploadGeometry(p.batch),o.updateTransform({scaleX:y*l,scaleY:v*l,translateX:h*l,translateY:g*l,dpr:l}),o.render([0,0,0,0]),c?e("svg",{width:n,height:r,overflow:"hidden",children:e("g",{dangerouslySetInnerHTML:{__html:c.markup()}})}):e("image",{width:n,height:r,href:d.toDataURL("image/png")})}function lt(t,i,a,n){let r=n?0:C,s=t.toUpperCase();return{key:i,width:s.length*b,height:a+r,draw:p=>e("text",{fontFamily:"sans-serif",fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",x:p,y:r,fill:q,children:s},i)}}function B(t,i,a=tt,n){if(!t.swatch)return{key:t.key,width:t.label.length*b,height:a,draw:d=>e("text",{...M,x:d,y:0,fill:"#666",children:t.label},t.key)};let r=t.swatch,s=n??_(r),p=n===void 0?0:n+5,l=(t.strong??"")+t.label,c=t.sizer===void 0?"":` ${$(t.sizer)}`;return{key:t.key,width:Math.max(s+5+(l.length+c.length)*b,p+(t.under?.length??0)*b),height:t.under?a*2:a,draw:d=>u("g",{...M,children:[t.count&&t.title?e("title",{children:t.title}):null,e(Y,{swatch:r,x:d+(s-_(r))/2,id:i}),u("text",{x:d+s+5,y:0,children:[t.strong?e("tspan",{fontWeight:"bold",children:t.strong}):null,t.label,t.count?e("tspan",{children:` ${$(t.count)}`}):null]}),t.under?e("text",{x:d+p,y:a,children:t.under}):null]},t.key)}}function pt({model:t,idPrefix:i}){let a=N(t);if(a.length===0)return null;let n=a.flatMap(o=>o.rows),r=I(n),s=X(n),p=a.flatMap(({testid:o,rows:f,heading:x,spaced:P},G)=>[...x?[lt(x,`${o}-heading`,r,G===0)]:[],...P?[{key:`${o}-gap`,width:0,height:C,draw:()=>null}]:[],...f.map((rt,at)=>B(rt,`${i}-${o}-${at}`,r,s))]),l=6,c=p.reduce((o,f)=>Math.max(o,f.width),-1/0)+l*2,d=p.reduce((o,f)=>o+f.height,0)+l,y=t.paneWidth-D-c+l,v=D+t.referenceStripZonePx,h=[],g=v+l/2+r/2+4;for(let o of p)h.push({row:o,y:g}),g+=o.height;return u("g",{"data-testid":"graph-svg-keys",children:[e("rect",{x:y-l,y:v,width:c,height:d,rx:3,fill:"#fff"}),h.map(({row:o,y:f})=>e("g",{transform:`translate(0 ${f})`,children:o.draw(y)},o.key))]})}function nt({x:t,y:i,text:a,fontSize:n,anchor:r}){let s=a.length*n*.56+6,p=r==="middle"?t-s/2:t-3;return u(k,{children:[e("rect",{x:p,y:i-n*.65,width:s,height:n*1.3,rx:3,fill:"#fff",fillOpacity:.8}),e("text",{x:t,y:i+n*.35,textAnchor:r,fontSize:n,fill:"#18181c",children:a})]})}function dt({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.overlayLabels.sizes.map(({key:i,node:a,text:n,x:r,y:s})=>e("g",{opacity:t.nodeFaded(a)?F:void 0,children:e(nt,{x:r,y:s,text:n,fontSize:10,anchor:"middle"})},i))})}function ct({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.visibleRowLabels.map(({label:i,y:a,top:n})=>e(nt,{x:10,y:n,text:i,fontSize:11,anchor:"start"},a))})}function gt({model:t,rasterize:i,idPrefix:a}){let n=t.facetPanels,r=t.facetGrid,s=t.facetPlacement;if(!n||!r||!s)return null;let{columns:p,width:l,height:c}=r,d=r.total+S+14,y=K(t).map((h,g)=>B(h,`${a}-facet-key-${g}`)),v=y.map((h,g)=>y.slice(0,g).reduce((o,f)=>o+f.width+14,6));return u(k,{children:[e("g",{transform:`translate(0 ${d})`,children:y.map((h,g)=>h.draw(v[g]))}),n.map((h,g)=>{let o=s.cells[g],f=o%p*(l+S),x=Math.floor(o/p)*(R+c+S),P=h.walks[0],G=B(J(t,P),`${a}-facet-${g}`);return u("g",{transform:`translate(${f} ${x})`,children:[e("g",{transform:`translate(0 ${tt-2})`,children:G.draw(6)}),e("g",{transform:`translate(0 ${R})`,children:e(et,{model:t,lift:h,drawPaths:!1,width:l,height:c,rasterize:i})})]},P.name)})]})}function A({model:t,rasterize:i=!1,idPrefix:a}){let n=t.paneWidth,r=t.canvasHeight,s=!!t.layoutResult?.tubeMap,p={rasterizeLayers:i},l=`${a}-drawing-clip`,c=t.drawingClip!==void 0;return u("g",{"data-testid":"graph-pane-svg",children:[c?e("defs",{children:e("clipPath",{id:l,children:e("rect",{width:t.drawingWidth,height:r})})}):null,u("g",{clipPath:c?`url(#${l})`:void 0,children:[t.facetPanels?e(gt,{model:t,rasterize:i,idPrefix:a}):s?e(L,{width:n,height:r,opts:p,paint:d=>{U(T(d),t,{highlightNode:null})}}):e(et,{model:t,lift:t.drawnHighlight,drawPaths:t.effectiveDrawPaths,width:n,height:r,rasterize:i}),t.facetPanels?null:u(k,{children:[e(W,{model:t}),e(z,{model:t}),e(dt,{model:t}),e(O,{model:t}),e(Z,{model:t,vector:!0}),e(ct,{model:t})]})]}),t.referenceStripShown?e(L,{width:n,height:r,opts:p,paint:d=>{V(T(d),t,{lit:void 0,dpr:1})}}):null,t.runsPastEdge?e(L,{width:n,height:r,opts:p,paint:d=>{j(T(d),t)}}):null,t.facetPanels?null:e(pt,{model:t,idPrefix:a})]})}function ht({model:t,opts:i}){return e(A,{model:t,rasterize:!!i?.rasterizeLayers,idPrefix:`graph-${t.id}`})}function Ft(t,i){return Q(t,i,ht)}export{Ft as renderGraphTrackSvg};
2
- //# sourceMappingURL=renderSvg-KEQ6NZ4A.js.map
1
+ import{B as Z,F as q,G as C,d as W,e as j,i as z,j as F,l as O,m as _,n as X,o as I,p as $,r as J,s as K,u as N,v as Y,x as V,z as U}from"./chunk-EYNSJ5AX.js";import{Hb as D,Sb as S,Tb as R,_b as E,ac as H}from"./chunk-3S24TQNP.js";import"./chunk-2XAPUOET.js";import"./chunk-4WMWSJXJ.js";import{H as b}from"./chunk-QVQIHX2Y.js";import"./chunk-5CTDN4UC.js";import"./chunk-4GC42TBO.js";import"./chunk-4IPVOCXX.js";import"./chunk-XXMAC5EP.js";import"./chunk-HYQOBARI.js";import"./chunk-WKD7ALOU.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-5PMRULDS.js";import"./chunk-J2PN6CG3.js";import{a as k,b as e,c as u}from"./chunk-DUU6T2I5.js";var m=JBrowseExports["@jbrowse/display-kit/renderDisplaySvg"],it=t=>m!=null&&t in Object(m)?m[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/display-kit/renderDisplaySvg' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Q=it("renderDisplaySvg");var ft=m&&m.__esModule?m.default:m;var w=JBrowseExports["@jbrowse/core/util/paintLayer"],ot=t=>w!=null&&t in Object(w)?w[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/core/util/paintLayer' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t}),L=ot("PaintLayer"),wt=w&&w.__esModule?w.default:w;var M={fontFamily:"sans-serif",fontSize:11},tt=16,st=2,T=t=>t;function et({model:t,lift:i,drawPaths:a,width:n,height:r,rasterize:s}){let p=t.buildDrawing(i,a,t.liveBuildView);if(!p)return null;let l=s?st:1,c=s?void 0:E(n,r),d=c?.canvas??document.createElement("canvas");c||(d.width=Math.round(n*l),d.height=Math.round(r*l));let{scaleX:y,scaleY:v,translateX:h,translateY:g}=t.screenTransform,o=new H(d);return o.uploadGeometry(p.batch),o.updateTransform({scaleX:y*l,scaleY:v*l,translateX:h*l,translateY:g*l,dpr:l}),o.render([0,0,0,0]),c?e("svg",{width:n,height:r,overflow:"hidden",children:e("g",{dangerouslySetInnerHTML:{__html:c.markup()}})}):e("image",{width:n,height:r,href:d.toDataURL("image/png")})}function lt(t,i,a,n){let r=n?0:C,s=t.toUpperCase();return{key:i,width:s.length*b,height:a+r,draw:p=>e("text",{fontFamily:"sans-serif",fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",x:p,y:r,fill:q,children:s},i)}}function B(t,i,a=tt,n){if(!t.swatch)return{key:t.key,width:t.label.length*b,height:a,draw:d=>e("text",{...M,x:d,y:0,fill:"#666",children:t.label},t.key)};let r=t.swatch,s=n??_(r),p=n===void 0?0:n+5,l=(t.strong??"")+t.label,c=t.sizer===void 0?"":` ${$(t.sizer)}`;return{key:t.key,width:Math.max(s+5+(l.length+c.length)*b,p+(t.under?.length??0)*b),height:t.under?a*2:a,draw:d=>u("g",{...M,children:[t.count&&t.title?e("title",{children:t.title}):null,e(Y,{swatch:r,x:d+(s-_(r))/2,id:i}),u("text",{x:d+s+5,y:0,children:[t.strong?e("tspan",{fontWeight:"bold",children:t.strong}):null,t.label,t.count?e("tspan",{children:` ${$(t.count)}`}):null]}),t.under?e("text",{x:d+p,y:a,children:t.under}):null]},t.key)}}function pt({model:t,idPrefix:i}){let a=N(t);if(a.length===0)return null;let n=a.flatMap(o=>o.rows),r=I(n),s=X(n),p=a.flatMap(({testid:o,rows:f,heading:x,spaced:P},G)=>[...x?[lt(x,`${o}-heading`,r,G===0)]:[],...P?[{key:`${o}-gap`,width:0,height:C,draw:()=>null}]:[],...f.map((rt,at)=>B(rt,`${i}-${o}-${at}`,r,s))]),l=6,c=p.reduce((o,f)=>Math.max(o,f.width),-1/0)+l*2,d=p.reduce((o,f)=>o+f.height,0)+l,y=t.paneWidth-D-c+l,v=D+t.referenceStripZonePx,h=[],g=v+l/2+r/2+4;for(let o of p)h.push({row:o,y:g}),g+=o.height;return u("g",{"data-testid":"graph-svg-keys",children:[e("rect",{x:y-l,y:v,width:c,height:d,rx:3,fill:"#fff"}),h.map(({row:o,y:f})=>e("g",{transform:`translate(0 ${f})`,children:o.draw(y)},o.key))]})}function nt({x:t,y:i,text:a,fontSize:n,anchor:r}){let s=a.length*n*.56+6,p=r==="middle"?t-s/2:t-3;return u(k,{children:[e("rect",{x:p,y:i-n*.65,width:s,height:n*1.3,rx:3,fill:"#fff",fillOpacity:.8}),e("text",{x:t,y:i+n*.35,textAnchor:r,fontSize:n,fill:"#18181c",children:a})]})}function dt({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.overlayLabels.sizes.map(({key:i,node:a,text:n,x:r,y:s})=>e("g",{opacity:t.nodeFaded(a)?F:void 0,children:e(nt,{x:r,y:s,text:n,fontSize:10,anchor:"middle"})},i))})}function ct({model:t}){return e("g",{fontFamily:M.fontFamily,children:t.visibleRowLabels.map(({label:i,y:a,top:n})=>e(nt,{x:10,y:n,text:i,fontSize:11,anchor:"start"},a))})}function gt({model:t,rasterize:i,idPrefix:a}){let n=t.facetPanels,r=t.facetGrid,s=t.facetPlacement;if(!n||!r||!s)return null;let{columns:p,width:l,height:c}=r,d=r.total+S+14,y=K(t).map((h,g)=>B(h,`${a}-facet-key-${g}`)),v=y.map((h,g)=>y.slice(0,g).reduce((o,f)=>o+f.width+14,6));return u(k,{children:[e("g",{transform:`translate(0 ${d})`,children:y.map((h,g)=>h.draw(v[g]))}),n.map((h,g)=>{let o=s.cells[g],f=o%p*(l+S),x=Math.floor(o/p)*(R+c+S),P=h.walks[0],G=B(J(t,P),`${a}-facet-${g}`);return u("g",{transform:`translate(${f} ${x})`,children:[e("g",{transform:`translate(0 ${tt-2})`,children:G.draw(6)}),e("g",{transform:`translate(0 ${R})`,children:e(et,{model:t,lift:h,drawPaths:!1,width:l,height:c,rasterize:i})})]},P.name)})]})}function A({model:t,rasterize:i=!1,idPrefix:a}){let n=t.paneWidth,r=t.canvasHeight,s=!!t.layoutResult?.tubeMap,p={rasterizeLayers:i},l=`${a}-drawing-clip`,c=t.drawingClip!==void 0;return u("g",{"data-testid":"graph-pane-svg",children:[c?e("defs",{children:e("clipPath",{id:l,children:e("rect",{width:t.drawingWidth,height:r})})}):null,u("g",{clipPath:c?`url(#${l})`:void 0,children:[t.facetPanels?e(gt,{model:t,rasterize:i,idPrefix:a}):s?e(L,{width:n,height:r,opts:p,paint:d=>{U(T(d),t,{highlightNode:null})}}):e(et,{model:t,lift:t.drawnHighlight,drawPaths:t.effectiveDrawPaths,width:n,height:r,rasterize:i}),t.facetPanels?null:u(k,{children:[e(W,{model:t}),e(z,{model:t}),e(dt,{model:t}),e(O,{model:t}),e(Z,{model:t,vector:!0}),e(ct,{model:t})]})]}),t.referenceStripShown?e(L,{width:n,height:r,opts:p,paint:d=>{V(T(d),t,{lit:void 0,dpr:1})}}):null,t.runsPastEdge?e(L,{width:n,height:r,opts:p,paint:d=>{j(T(d),t)}}):null,t.facetPanels?null:e(pt,{model:t,idPrefix:a})]})}function ht({model:t,opts:i}){return e(A,{model:t,rasterize:!!i?.rasterizeLayers,idPrefix:`graph-${t.id}`})}function Ft(t,i){return Q(t,i,ht)}export{Ft as renderGraphTrackSvg};
2
+ //# sourceMappingURL=renderSvg-WQ5CH3G3.js.map
@@ -1,2 +1,2 @@
1
- import{a as Ae,b as Ve,c as H,d as Xe,e as Ze,f as Qe}from"./chunks/chunk-Z6IFVSZS.js";import"./chunks/chunk-IK5G3JHR.js";import{L as Ke,M as Ye,d as E,h as Oe,i as Je,q as m,s as Ue,v as Z,y as $e}from"./chunks/chunk-CWT6WZ3D.js";import"./chunks/chunk-BCRRODIU.js";import{b as d,g as N,h as We,q as qe}from"./chunks/chunk-V5ZGDS4W.js";import{$a as q,Ca as j,Da as _e,Ea as M,ab as v,g as Ie,i as L,ib as De,j as V,k as Ce,l as Pe,m as Be,n as Re,p as Ne}from"./chunks/chunk-5BMTS4FH.js";import"./chunks/chunk-BDBERNEC.js";import"./chunks/chunk-AW7U7KMG.js";import"./chunks/chunk-4JYYNBSO.js";import"./chunks/chunk-7V5D6ZDX.js";import{a as Q,d as z}from"./chunks/chunk-ZQOMV674.js";import{a as x,b as B,c as Me,d as ee,e as eo,f as W,g as oo}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-IQURFLWC.js";import"./chunks/chunk-HT3RFCRI.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-KFSVGH3X.js";import"./chunks/chunk-NGTPDYX7.js";import"./chunks/chunk-TD6XNJRC.js";import{b as Ee,g as je}from"./chunks/chunk-YROUE32O.js";import{a as ve,c as ze,h as He}from"./chunks/chunk-D3QZGLZ3.js";import{d as $,e as n}from"./chunks/chunk-WKD7ALOU.js";import{a as Fe}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as K,c as T,d as Ge,g as P,h as Y,i as Le}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-4FDZC66W.js";import{f as we,g as ke,j as g,k as Te,m as xe}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as R}from"./chunks/chunk-H42TSPVA.js";import{a as Se,b as k,d as X}from"./chunks/chunk-DUU6T2I5.js";var _=JBrowseExports["@jbrowse/core/Plugin"];var to=_&&_.__esModule?_.default:_;var D=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=D&&D.__esModule?D.default:D;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:n.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Co=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:n.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:B.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:B.context,advanced:!0},nodeLimit:{type:"number",defaultValue:B.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Po(r,t)}:{}}}});function Po(e,o){let{name:t,query:r}=P(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var ro=Co;function oe(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:ro,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-XAMRWAYZ.js").then(o=>o.default)}))}var F=class extends V{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Re(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Bo=S(()=>import("./chunks/AddTrackWorkflow-BY23IVYG.js"));function te(e){e.addAddTrackWorkflowType(()=>new Ie({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Bo,stateModel:n.model({})}))}var I=class extends V{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:a,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),We({graph:r,options:a})}};var O=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var ao=O&&O.__esModule?O.default:O;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Ro=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),no=Ro("defineLaunchKeys");var Nt=f&&f.__esModule?f.default:f;var y=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var io=Vo("BaseViewModel");var jt=y&&y.__esModule?y.default:y;function re(){return n.compose("GraphGenomeView",io,Xe,n.model({type:n.literal("GraphGenomeView"),gfaLocation:n.maybe(n.frozen()),loadedRegion:n.maybe(n.frozen()),loadedTrackId:n.optional(n.string,""),layoutMode:j(E),layoutEngine:_e(N,"fmmm"),color:n.maybe(n.frozen()),size:n.maybe(n.frozen()),layers:n.maybe(n.frozen()),facet:n.maybe(n.frozen()),rows:n.maybe(n.frozen()),hover:j(H),links:j(z),walks:n.maybe(n.frozen())})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover,links:e.links,walks:e.walks}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Qe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(v(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let a=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!a)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${q(s)}) \u2014 zoom in to view graph (max ${q(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(a,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===v(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,a=g(e),{assemblyManager:s}=a,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>$(e)&&e.loadedRegion===r?t(Z(a,r)):void 0):t(r&&Z(a,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),$(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(v(o)))},showTrackInLinearView(o,t,r){let a=g(e);$e({session:a,trackId:o,assembly:t,loc:r}),xe(a)&&a.removeView(e)},afterAttach(){e.graph||e.load()}}))}var No=no()({});function ae(e){e.addViewType(()=>new ao({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:re(),launchKeys:No,ReactComponent:S(()=>import("./chunks/GraphGenomeView-7FALCHVY.js"))}))}var ne=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Eo(e){let o=e.getElementTypesInGroup("display"),t=a=>o.find(s=>s.name===a),r=(a,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[a]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...ne.map(a=>r("headerLanes",t(a)))].filter(a=>a!==void 0)}function ie(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Pe(e),explicitIdentifier:"trackId"}),t=new Ce({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Be(e,"GraphTrack",o)});for(let r of Eo(e))t.addDisplayType(r);return t})}function se(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var J=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var so=J&&J.__esModule?J.default:J;var h=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],jo=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),po=jo("heightModeConfigSchemaFields"),sr=h&&h.__esModule?h.default:h;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],vo=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),co=vo("trackHeightConfigSchemaFields"),dr=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],zo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),mo=zo("facetConfigSchema");var mr=w&&w.__esModule?w.default:w;var lo=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:mo});function uo(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:M(E,"force"),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:M(N,"fmmm"),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:lo,rows:{type:"frozen",defaultValue:{},plot:!0},walks:{type:"frozen",defaultValue:[],plot:!0},hover:{type:"stringEnum",model:M(H,"nodes"),defaultValue:"nodes"},links:{type:"stringEnum",model:M(z,Q),defaultValue:Q},...co({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...po({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:De})},{explicitlyTyped:!0,explicitIdentifier:"displayId",misnamed:{walkLayers:"walks"}})}function pe(e){e.addDisplayType(()=>{let o=uo();return Object.assign(new so({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ze(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-26MRFDXW.js"))}),{adapterCapabilities:["getSubgraph"]})})}function Ho(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var Wo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:Ho}),go=Wo;function de(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:go,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-W7RUVFVI.js").then(o=>o.default)}))}function fo(e){let{uri:o,baseUri:t,csi:r,format:a}=e;return typeof o!="string"?e:a===2?{...e,graphLocation:{uri:`${o}${K}`,baseUri:t},graphIndex:A(`${o}${K}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function _o(e){let{coarse:o,baseUri:t,csi:r}=e;return G(fo(typeof o=="object"&&o!==null?{...e,coarse:fo({baseUri:t,csi:r,...o})}:e))}var Do=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Oo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:Do},{explicitlyTyped:!0,preProcessSnapshot:_o}),yo=Oo;function ce(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:yo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-QOEMTN56.js").then(o=>o.default)}))}function ho(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var Jo=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Uo(e,o){return e?`Pinned to ${W(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function $o(e,o){let t=g(e),r=o.flatMap(a=>a?[oo(a)]:[]);for(let{message:a}of[...t.snackbarMessages??[]])r.some(s=>a.startsWith(s))&&t.removeSnackbarMessage?.(a)}function Ko(e){return e.props({formsPinned:n.maybe(n.frozen()),formsFloorBp:n.maybe(n.frozen())}).views(o=>({get configuredAdapter(){return He(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=ee(o.formsPinned??o.configuredAdapter.pinned),[r]=Fe(o.parentTrack.configuration),a=t&&r?g(o).assemblyManager.get(r):void 0;return t&&a?a.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return ee(this.adapterConfig.pinned)},get formsFloor(){return eo(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ke(o),r=Oe(t)?Je(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{$o(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(a){r(),o.formsPinned=a},setFormsFloorBp(a){r(),o.formsFloorBp=a},setSources(a,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(a,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,a=o.visibleWindow;return[{label:Uo(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!a||r!==void 0&&W(a)===W(r),onClick:()=>{a&&o.setFormsPinned(a)}},{label:"Hide changes under",subMenu:Jo.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function me(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ho(o)&&o.extendStateModel(Ko),o))}function bo(e){e.getElementTypesInGroup("display").some(t=>t instanceof L&&ho(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Yo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Me},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),wo=Yo;function le(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:wo,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-AV746ZGI.js").then(o=>o.default)}))}var Xo=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),ko=Xo;function ue(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:ko,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-HEXLZ5YL.js").then(o=>o.default)}))}var qo=".bubbles.bed.gz";function Zo(e){return Y(e).toLowerCase().endsWith(".gbz.db")}function Qo(e,o,t){let r=Y(e),a=i=>!t||t===i,s=o!==void 0||Le(e);return Zo(e)?a("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Ee(e)?a("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":a("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:a("MinigraphBubbleAdapter")&&(r.endsWith(qo)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function To(e,o,t){let r=Qo(e,o,t);return r?je({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function et(e){let o=e.adapter;return o?.type!==void 0&&Ke.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function ot({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:a}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?P(t).name:typeof r=="string"?r:typeof a=="string"?a:void 0}function tt(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&ze(o)?ot(o):void 0,a=r?Ge(r):void 0;return o&&t&&a&&a!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:a}}}:e}function ge(e){e.addToExtensionPoint("Core-preProcessTrackConfig",et),e.addToExtensionPoint("Core-preProcessTrackConfig",tt),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,a)=>To(t,r,a)??o(t,r,a)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>ve.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function fe(e){let o;if(m(e)){let{refName:t,start:r,end:a,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof a=="number"&&(o={refName:t,start:r,end:a,assemblyName:typeof s=="string"?s:void 0})}return o}function rt(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function xo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function So(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function Ao(e,o,t){let r=[],a=Ue(e),s=new Set(a.map(i=>m(i)?i.id:void 0));for(let i of a){if(m(i)&&i.id===o)for(let c of So(i)){let C=fe(c.hoverHighlight);C&&xo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...So(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Fo,Io)=>{let U=fe(Fo);U?.assemblyName!==void 0&&t?.includes(U.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Io}`,region:U})});if(m(i)&&i.type==="GraphGenomeView"&&rt(i,o,s)){let c=fe(i.hoverHighlight);c&&xo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var at=qe()(e=>({highlight:{height:"100%",position:"absolute",background:R(e.palette.primary.main,.08),borderLeft:`1px solid ${R(e.palette.primary.main,.4)}`,borderRight:`1px solid ${R(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),nt=X(function({model:o,region:t}){let{classes:r}=at(),a=o.getHighlightCoords(t);return a?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:a.left,width:a.width}}):null}),it=X(function({model:o}){let{views:t}=g(o);return k(Se,{children:Ao([...t],o.id,o.assemblyNames).map(({key:r,region:a})=>k(nt,{model:o,region:a},`graph-hover-${r}`))})}),Go=it;var st="LinearGenomeView-TracksContainerComponent";function ye(e){e.contributeToExtensionPoint(st,({model:o})=>k(Go,{model:o},"graphgenomeview-hover-highlight"))}function pt(e){return e.views(o=>({get adapterConfig(){return Ye(o,we(o).configuration)}}))}function he(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ne.includes(o.name)&&o.extendStateModel(pt),o))}var Lo="GraphGenomeView";var Mo="10.2.0";var be=class extends to{constructor(){super(...arguments);this.name=Lo;this.version=Mo}install(t){ae(t),pe(t),ie(t),se(t),ye(t),ce(t),de(t),oe(t),ue(t),le(t),me(t),te(t),ge(t),he(t),t.addRpcMethod(()=>new I(t)),t.addRpcMethod(()=>new Ne(t)),t.addRpcMethod(()=>new Ve(t)),t.addRpcMethod(()=>new F(t))}configure(t){bo(t);try{Te(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Ae,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{be as default};
1
+ import{a as Ae,b as Ve,c as H,d as Xe,e as Ze,f as Qe}from"./chunks/chunk-LDY26KXZ.js";import"./chunks/chunk-IK5G3JHR.js";import{L as Ke,M as Ye,d as E,h as Oe,i as Je,q as m,s as Ue,v as Z,y as $e}from"./chunks/chunk-GPNGXGMH.js";import"./chunks/chunk-HE7BFKXW.js";import{b as d,g as N,h as We,q as qe}from"./chunks/chunk-2OH3T4CR.js";import{$a as q,Ca as j,Da as _e,Ea as M,ab as v,g as Ie,i as L,ib as De,j as V,k as Ce,l as Pe,m as Be,n as Re,p as Ne}from"./chunks/chunk-3S24TQNP.js";import"./chunks/chunk-2XAPUOET.js";import"./chunks/chunk-4WMWSJXJ.js";import"./chunks/chunk-QVQIHX2Y.js";import"./chunks/chunk-5CTDN4UC.js";import{a as Q,d as z}from"./chunks/chunk-ZQOMV674.js";import{a as x,b as B,c as Me,d as ee,e as eo,f as W,g as oo}from"./chunks/chunk-ZVMXECJA.js";import"./chunks/chunk-JM4W4PKP.js";import"./chunks/chunk-55PR5XJY.js";import"./chunks/chunk-4GC42TBO.js";import"./chunks/chunk-YBLNN5FU.js";import"./chunks/chunk-4IPVOCXX.js";import"./chunks/chunk-XXMAC5EP.js";import"./chunks/chunk-HYQOBARI.js";import{b as Ee,g as je}from"./chunks/chunk-YROUE32O.js";import{a as ve,c as ze,h as He}from"./chunks/chunk-D3QZGLZ3.js";import{d as $,e as n}from"./chunks/chunk-WKD7ALOU.js";import{a as Fe}from"./chunks/chunk-TMM73K4C.js";import"./chunks/chunk-D6TY2QEG.js";import"./chunks/chunk-YBLNN5FU.js";import{b as K,c as T,d as Ge,g as P,h as Y,i as Le}from"./chunks/chunk-EGZZ3ADM.js";import"./chunks/chunk-5PMRULDS.js";import{f as we,g as ke,j as g,k as Te,m as xe}from"./chunks/chunk-5L276I7O.js";import{c as S}from"./chunks/chunk-J2PN6CG3.js";import{J as R}from"./chunks/chunk-H42TSPVA.js";import{a as Se,b as k,d as X}from"./chunks/chunk-DUU6T2I5.js";var _=JBrowseExports["@jbrowse/core/Plugin"];var to=_&&_.__esModule?_.default:_;var D=JBrowseExports["@jbrowse/core/pluggableElementTypes/AdapterType"];var u=D&&D.__esModule?D.default:D;var p=e=>({type:"fileLocation",defaultValue:{uri:e,locationType:"UriLocation"}}),l=(e,o="")=>d(e,{indexType:{model:n.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:p(o)});function A(e,o,t){return{indexType:t?"CSI":"TBI",location:{uri:`${e}.${t?"csi":"tbi"}`,baseUri:o}}}function G(e){let{walksUri:o,baseUri:t}=e;if(typeof o!="string")return e;let r=`${o}${T}`;return{...e,walksLocation:{uri:r,baseUri:t},walksIndex:{uri:`${r}.idx`,baseUri:t}}}var Co=d("GbzBaseSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},gbzDbLocation:p("/path/to/graph.gbz.db"),haplotypeIndexLocation:p(""),readsLocation:p(""),readsIndex:l("GbzBaseReadsIndex"),samplesTsvLocation:p(""),subgraphSnarls:{type:"stringEnum",model:n.enumeration("SnarlOutput",["none","contained","overlapping"]),defaultValue:B.snarls},referenceSample:{type:"string",defaultValue:""},assemblyNameToPanSN:{type:"frozen",defaultValue:{}},context:{type:"number",defaultValue:B.context,advanced:!0},nodeLimit:{type:"number",defaultValue:B.limit,advanced:!0}},{explicitlyTyped:!0,preProcessSnapshot:e=>{let{uri:o,baseUri:t,reads:r}=e;return{...e,...o?{gbzDbLocation:{uri:o,baseUri:t}}:{},...typeof r=="string"?{readsLocation:{uri:r,baseUri:t},...Po(r,t)}:{}}}});function Po(e,o){let{name:t,query:r}=P(e);return t.endsWith(".gz")?{readsIndex:{location:{uri:`${t}.tbi${r}`,baseUri:o}}}:{}}var ro=Co;function oe(e){e.addAdapterType(()=>new u({name:"GbzBaseSyntenyAdapter",displayName:"gbz-base pangenome adapter",configSchema:ro,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/GbzBaseSyntenyAdapter-64HUHYVC.js").then(o=>o.default)}))}var F=class extends V{constructor(){super(...arguments);this.name="GetGraphHaplotypes"}async execute(t){let{adapter:r}=await Re(this.pluginManager,t,"getHaplotypeNames");return r?.getHaplotypeNames({signal:t.signal})}};var Bo=S(()=>import("./chunks/AddTrackWorkflow-4S5QEZTJ.js"));function te(e){e.addAddTrackWorkflowType(()=>new Ie({name:"Pangenome graph track",displayName:"Add pangenome graph track",ReactComponent:Bo,stateModel:n.model({})}))}var I=class extends V{constructor(){super(...arguments);this.name="GraphComputeLayout"}async execute(t){let{graph:r,options:a,signal:s,statusCallback:i}=t;return await new Promise(c=>setTimeout(c,0)),s?.throwIfAborted(),i?.("Computing layout"),We({graph:r,options:a})}};var O=JBrowseExports["@jbrowse/core/pluggableElementTypes/ViewType"];var ao=O&&O.__esModule?O.default:O;var f=JBrowseExports["@jbrowse/core/util/withLaunchInput"],Ro=e=>f!=null&&e in Object(f)?f[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/util/withLaunchInput' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),no=Ro("defineLaunchKeys");var Nt=f&&f.__esModule?f.default:f;var y=JBrowseExports["@jbrowse/core/pluggableElementTypes/models"],Vo=e=>y!=null&&e in Object(y)?y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/pluggableElementTypes/models' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var io=Vo("BaseViewModel");var jt=y&&y.__esModule?y.default:y;function re(){return n.compose("GraphGenomeView",io,Xe,n.model({type:n.literal("GraphGenomeView"),gfaLocation:n.maybe(n.frozen()),loadedRegion:n.maybe(n.frozen()),loadedTrackId:n.optional(n.string,""),layoutMode:j(E),layoutEngine:_e(N,"fmmm"),color:n.maybe(n.frozen()),size:n.maybe(n.frozen()),layers:n.maybe(n.frozen()),facet:n.maybe(n.frozen()),rows:n.maybe(n.frozen()),hover:j(H),links:j(z),walks:n.maybe(n.frozen())})).views(e=>({get grammar(){return{layoutMode:e.layoutMode,layoutEngine:e.layoutEngine,encoding:{color:e.color},size:e.size,layers:e.layers,facet:e.facet,rows:e.rows,hover:e.hover,links:e.links,walks:e.walks}}})).actions(e=>({writeGrammar({encoding:o,...t}){Object.assign(e,o?{...t,color:o.color}:t)}})).volatile(()=>({widthMeasured:!1})).actions(e=>{let o=e.setWidth;return{setWidth(t){o(t),e.widthMeasured=!0}}}).views(e=>({get rpcSessionId(){return e.id},get paneWidth(){return e.width},get paneMeasured(){return e.widthMeasured},get sourceTrack(){return e.loadedTrackId?e.sessionTrack(e.loadedTrackId):void 0},get graphTracks(){return Qe(g(e).tracks)},get canRetryLoad(){return e.gfaLocation!==void 0||e.loadedTrackId!==""&&e.loadedRegion!==void 0}})).views(e=>({get hasPendingSource(){return e.canRetryLoad&&!e.graph&&!e.loadCanceled},menuItems(){return[...e.exportMenuItems(),...e.launchMenuItems()]}})).actions(e=>{let o=e.clearGraph;function t(r){if(e.gfaLocation)return e.displayName||e.setDisplayName(v(e.gfaLocation)),e.loadGFAFromLocation(e.gfaLocation,r);if(!e.loadedTrackId||!r)return;let a=e.sourceAdapter,s=r.end-r.start,i=e.offReference(r);if(!a)e.setError(new Error(`The track this graph was cut from, "${e.loadedTrackId}", is not in this session`));else if(i)e.setError(new Error(i));else if(s>e.maxRegionBp)e.setError(new Error(`Region too large (${q(s)}) \u2014 zoom in to view graph (max ${q(e.maxRegionBp)})`));else return e.markCut(),e.cutSubgraph(a,r,e.cutOptions)}return{clearGraph(){o(),e.gfaLocation&&e.displayName===v(e.gfaLocation)&&(e.displayName=void 0),e.gfaLocation=void 0,e.loadedRegion=void 0,e.loadedTrackId=""},load(){let r=e.loadedRegion,a=g(e),{assemblyManager:s}=a,i=r&&s.has(r.assemblyName)?s.get(r.assemblyName):void 0;return r&&i?.initialized===!1?s.waitForAssembly(r.assemblyName).catch(()=>{}).then(()=>$(e)&&e.loadedRegion===r?t(Z(a,r)):void 0):t(r&&Z(a,r))}}}).actions(e=>({retryLoad(){e.load()},setGfaLocation(o){e.gfaLocation=o},relayoutFrom(o){return e.loadedTrackId&&e.cutStale?e.load():e.recomputeLayout()},async openGfaLocation(o){await e.loadGFAFromLocation(o),$(e)&&e.hasGraph&&(this.setGfaLocation(o),e.displayName||e.setDisplayName(v(o)))},showTrackInLinearView(o,t,r){let a=g(e);$e({session:a,trackId:o,assembly:t,loc:r}),xe(a)&&a.removeView(e)},afterAttach(){e.graph||e.load()}}))}var No=no()({});function ae(e){e.addViewType(()=>new ao({name:"GraphGenomeView",displayName:"Graph genome view",stateModel:re(),launchKeys:No,ReactComponent:S(()=>import("./chunks/GraphGenomeView-EGR7L5WT.js"))}))}var ne=["MultiWaySyntenyDisplay","LinearSyntenyDisplay","DotplotDisplay","ChordSyntenyDisplay"];function Eo(e){let o=e.getElementTypesInGroup("display"),t=a=>o.find(s=>s.name===a),r=(a,s)=>s&&Object.assign(Object.create(s),{adapterCapabilities:[a]});return[t("LinearGraphDisplay"),r("referenceSegments",t("LinearBasicDisplay")),...ne.map(a=>r("headerLanes",t(a)))].filter(a=>a!==void 0)}function ie(e){e.addTrackType(()=>{let o=d("GraphTrack",{},{baseConfiguration:Pe(e),explicitIdentifier:"trackId"}),t=new Ce({name:"GraphTrack",displayName:"Pangenome graph track",configSchema:o,stateModel:Be(e,"GraphTrack",o)});for(let r of Eo(e))t.addDisplayType(r);return t})}function se(e){e.addToExtensionPoint("LaunchView-GraphGenomeView",o=>{let{session:t,...r}=o;return t.addView("GraphGenomeView",r),o})}var J=JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"];var so=J&&J.__esModule?J.default:J;var h=JBrowseExports["@jbrowse/display-kit/heightModeConfigSchemaFields"],jo=e=>h!=null&&e in Object(h)?h[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/heightModeConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),po=jo("heightModeConfigSchemaFields"),sr=h&&h.__esModule?h.default:h;var b=JBrowseExports["@jbrowse/display-kit/trackHeightConfigSchemaFields"],vo=e=>b!=null&&e in Object(b)?b[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/trackHeightConfigSchemaFields' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),co=vo("trackHeightConfigSchemaFields"),dr=b&&b.__esModule?b.default:b;var w=JBrowseExports["@jbrowse/display-kit/facetConfigSchema"],zo=e=>w!=null&&e in Object(w)?w[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-kit/facetConfigSchema' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),mo=zo("facetConfigSchema");var mr=w&&w.__esModule?w.default:w;var lo=d("GraphFacet",{columns:{type:"maybeNumber",description:"panels per row of a node layout's grid; unset fits them"}},{baseConfiguration:mo});function uo(){return d("LinearGraphDisplay",{layoutMode:{type:"stringEnum",model:M(E,"force"),defaultValue:"force"},layoutEngine:{type:"stringEnum",model:M(N,"fmmm"),defaultValue:"fmmm"},encoding:{type:"frozen",defaultValue:{},plot:!0},size:{type:"frozen",defaultValue:{field:"depth",value:6},plot:!0},layers:{type:"frozen",defaultValue:{},plot:!0},facet:lo,rows:{type:"frozen",defaultValue:{},plot:!0},walks:{type:"frozen",defaultValue:[],plot:!0},hover:{type:"stringEnum",model:M(H,"nodes"),defaultValue:"nodes"},links:{type:"stringEnum",model:M(z,Q),defaultValue:Q},...co({defaultHeight:300,height:"the height of the track the graph is drawn in"}),...po({heightMode:"how a force drawing the view's window places meets the track's height: `fit` shrinks the whole cut to the track's height; `fixed` draws it at the window's scale, so a zoom magnifies it, lowered only as far as keeps the reference the window shows inside the track, which it holds whole, and marks where what hangs off that reference runs past the top or bottom; `grow` does the same in a track grown to hold the cut, up to `growMaxHeight`",growMaxHeight:"the tallest `grow` makes the track, in px",defaultHeightMode:De})},{explicitlyTyped:!0,explicitIdentifier:"displayId",misnamed:{walkLayers:"walks"}})}function pe(e){e.addDisplayType(()=>{let o=uo();return Object.assign(new so({name:"LinearGraphDisplay",displayName:"Graph",configSchema:o,stateModel:Ze(o),trackType:"GraphTrack",viewType:"LinearGenomeView",ReactComponent:S(()=>import("./chunks/LinearGraphDisplay-R3A64XKK.js"))}),{adapterCapabilities:["getSubgraph"]})})}function Ho(e){let{uri:o,baseUri:t,csi:r}=e;return typeof o=="string"?{...e,bubblesLocation:{uri:o,baseUri:t},index:A(o,t,r)}:e}var Wo=d("MinigraphBubbleAdapter",{bubblesLocation:p("/path/to/graph.bb.bed.gz"),index:l("MinigraphBubbleIndex","/path/to/graph.bb.bed.gz.tbi"),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:Ho}),go=Wo;function de(e){e.addAdapterType(()=>new u({name:"MinigraphBubbleAdapter",displayName:"Minigraph bubble BED adapter",configSchema:go,adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/MinigraphBubbleAdapter-LQ2NYC6O.js").then(o=>o.default)}))}function fo(e){let{uri:o,baseUri:t,csi:r,format:a}=e;return typeof o!="string"?e:a===2?{...e,graphLocation:{uri:`${o}${K}`,baseUri:t},graphIndex:A(`${o}${K}`,t,r)}:{...e,segmentsLocation:{uri:`${o}.segs.bed.gz`,baseUri:t},segmentsIndex:A(`${o}.segs.bed.gz`,t,r),linksLocation:{uri:`${o}.links.bed.gz`,baseUri:t},linksIndex:A(`${o}.links.bed.gz`,t,r)}}function _o(e){let{coarse:o,baseUri:t,csi:r}=e;return G(fo(typeof o=="object"&&o!==null?{...e,coarse:fo({baseUri:t,csi:r,...o})}:e))}var Do=d("RgfaTabixCoarseTier",{uri:{type:"maybeString"},format:{type:"maybeNumber"},aboveBpPerPx:{type:"maybeNumber"},foldBelowBp:{type:"maybeNumber"},segmentsLocation:p("/path/to/graph.tier.segs.bed.gz"),segmentsIndex:l("RgfaCoarseSegmentsIndex","/path/to/graph.tier.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.tier.links.bed.gz"),linksIndex:l("RgfaCoarseLinksIndex","/path/to/graph.tier.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaCoarseGraphIndex")}),Oo=d("RgfaTabixAdapter",{segmentsLocation:p("/path/to/graph.segs.bed.gz"),segmentsIndex:l("RgfaSegmentsIndex","/path/to/graph.segs.bed.gz.tbi"),linksLocation:p("/path/to/graph.links.bed.gz"),linksIndex:l("RgfaLinksIndex","/path/to/graph.links.bed.gz.tbi"),graphLocation:p(""),graphIndex:l("RgfaGraphIndex"),walksLocation:p(""),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}},coarse:Do},{explicitlyTyped:!0,preProcessSnapshot:_o}),yo=Oo;function ce(e){e.addAdapterType(()=>new u({name:"RgfaTabixAdapter",displayName:"Indexed rGFA adapter",configSchema:yo,adapterCapabilities:["getSubgraph","referenceSegments"],adapterMetadata:{category:"Graph adapters"},getAdapterClass:()=>import("./chunks/RgfaTabixAdapter-UM7L6HPH.js").then(o=>o.default)}))}function ho(e){return e.viewType==="LinearGenomeView"&&[e.trackType].flat().includes("VariantTrack")}var Jo=[{label:"Auto",value:"auto"},{label:"50 bp",value:50},{label:"1 kb",value:1e3},{label:"10 kb",value:1e4}];function Uo(e,o){return e?`Pinned to ${W(e)}${o===void 0?"":` \xB7 ${o} form${o===1?"":"s"}`}`:"Not pinned"}function $o(e,o){let t=g(e),r=o.flatMap(a=>a?[oo(a)]:[]);for(let{message:a}of[...t.snackbarMessages??[]])r.some(s=>a.startsWith(s))&&t.removeSnackbarMessage?.(a)}function Ko(e){return e.props({formsPinned:n.maybe(n.frozen()),formsFloorBp:n.maybe(n.frozen())}).views(o=>({get configuredAdapter(){return He(o.parentTrack.configuration)},get walkForms(){return this.configuredAdapter.type==="WalkFormsAdapter"}})).views(o=>({get pinnedAliases(){let t=ee(o.formsPinned??o.configuredAdapter.pinned),[r]=Fe(o.parentTrack.configuration),a=t&&r?g(o).assemblyManager.get(r):void 0;return t&&a?a.getAliasesForRefName(t.refName):[]}})).views(o=>({get adapterConfig(){let t=o.configuredAdapter;return o.walkForms?{...t,...o.formsPinned?{pinned:o.formsPinned}:{},...o.pinnedAliases.length>0?{pinnedAliases:o.pinnedAliases}:{},...o.formsFloorBp===void 0?{}:{floorBp:o.formsFloorBp}}:t},get formsWindow(){return ee(this.adapterConfig.pinned)},get formsFloor(){return eo(this.adapterConfig.floorBp)},get formsCount(){return o.sourcesBase?.reduce((t,r)=>t+(Number(r.forms)||1),0)},get visibleWindow(){let t=ke(o),r=Oe(t)?Je(t):void 0;return r&&r.end>r.start?{refName:r.refName,start:Math.max(0,Math.floor(r.start)),end:Math.ceil(r.end)}:void 0}})).volatile(()=>({warnedWindow:void 0})).actions(o=>{let{setSources:t}=o,r=()=>{$o(o,[o.warnedWindow,o.formsWindow])};return{setFormsPinned(a){r(),o.formsPinned=a},setFormsFloorBp(a){r(),o.formsFloorBp=a},setSources(a,s){o.walkForms&&(r(),o.warnedWindow=o.formsWindow),t?.(a,s)}}}).views(o=>{let{trackMenuItems:t}=o;return{formsMenuItems(){let r=o.formsWindow,a=o.visibleWindow;return[{label:Uo(r,o.formsCount),disabled:!0,onClick:()=>{}},{label:"Re-pin to visible region",helpText:"Cut the forms from the region the view shows. Panning and zooming leave the forms alone",disabled:!a||r!==void 0&&W(a)===W(r),onClick:()=>{a&&o.setFormsPinned(a)}},{label:"Hide changes under",subMenu:Jo.map(({label:s,value:i})=>({label:s,type:"radio",checked:o.formsFloor===i,onClick:()=>{o.setFormsFloorBp(i)}}))}]},trackMenuItems(){return o.walkForms?[...t(),...this.formsMenuItems()]:t()}}})}function me(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ho(o)&&o.extendStateModel(Ko),o))}function bo(e){e.getElementTypesInGroup("display").some(t=>t instanceof L&&ho(t))||console.warn("jbrowse-plugin-graphgenomeviewer: no linear VariantTrack display is registered, so WalkFormsAdapter tracks get no pin or floor menu")}var Yo=d("WalkFormsAdapter",{walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),pinned:{type:"frozen",defaultValue:{}},pinnedAliases:{type:"stringArray",defaultValue:[]},floorBp:{type:"frozen",defaultValue:"auto"},exclude:{type:"stringArray",defaultValue:[]},maxForms:{type:"integer",defaultValue:Me},walkByteBudget:{type:"integer",defaultValue:15e5}},{explicitlyTyped:!0,preProcessSnapshot:G}),wo=Yo;function le(e){e.addAdapterType(()=>new u({name:"WalkFormsAdapter",displayName:"Walk-file structural forms adapter",configSchema:wo,adapterMetadata:{category:"Variant adapters"},getAdapterClass:()=>import("./chunks/WalkFormsAdapter-4D6MTHLE.js").then(o=>o.default)}))}var Xo=d("WalkTabixSyntenyAdapter",{assemblyNames:{type:"stringArray",defaultValue:[]},walksLocation:p("/path/to/graph.walks.gz"),walksIndex:p(""),walkStepBudget:{type:"integer",defaultValue:x.stepBudget},walkByteBudget:{type:"integer",defaultValue:x.byteBudget},defaultHaplotypes:{type:"stringArray",defaultValue:[]},samplesTsvLocation:p(""),assemblyNameToPanSN:{type:"frozen",defaultValue:{}}},{explicitlyTyped:!0,preProcessSnapshot:G}),ko=Xo;function ue(e){e.addAdapterType(()=>new u({name:"WalkTabixSyntenyAdapter",displayName:"Walk-indexed graph adapter",configSchema:ko,adapterCapabilities:["getSubgraph","headerLanes","lanePairsOnAnchor","lanePairBatches"],adapterMetadata:{category:"Synteny adapters"},getAdapterClass:()=>import("./chunks/WalkTabixSyntenyAdapter-V5IQCHP4.js").then(o=>o.default)}))}var qo=".bubbles.bed.gz";function Zo(e){return Y(e).toLowerCase().endsWith(".gbz.db")}function Qo(e,o,t){let r=Y(e),a=i=>!t||t===i,s=o!==void 0||Le(e);return Zo(e)?a("GbzBaseSyntenyAdapter")?"GbzBaseSyntenyAdapter":void 0:Ee(e)?a("RgfaTabixAdapter")?"RgfaTabixAdapter":void 0:s?r.endsWith(T)?t==="RgfaTabixAdapter"?"RgfaTabixWalks":a("WalkTabixSyntenyAdapter")?"WalkTabixSyntenyAdapter":void 0:a("MinigraphBubbleAdapter")&&(r.endsWith(qo)||t!==void 0)?"MinigraphBubbleAdapter":void 0:void 0}function To(e,o,t){let r=Qo(e,o,t);return r?je({choice:r,loc:e,indexLoc:o,assembly:"",sample:""}):void 0}function et(e){let o=e.adapter;return o?.type!==void 0&&Ke.has(o.type)&&!o.assemblyNames?.length&&Array.isArray(e.assemblyNames)&&e.assemblyNames.length>0?{...e,adapter:{...o,assemblyNames:e.assemblyNames}}:e}function ot({walksUri:e,walksLocation:o}){let{uri:t,localPath:r,name:a}=m(o)?o:{};return typeof e=="string"&&e!==""?`${e}${T}`:typeof t=="string"?P(t).name:typeof r=="string"?r:typeof a=="string"?a:void 0}function tt(e){let o=m(e.adapter)?e.adapter:void 0,[t]=Array.isArray(e.assemblyNames)?e.assemblyNames:[],r=o&&ze(o)?ot(o):void 0,a=r?Ge(r):void 0;return o&&t&&a&&a!==t&&o.assemblyNameToPanSN===void 0?{...e,adapter:{...o,assemblyNameToPanSN:{[t]:a}}}:e}function ge(e){e.addToExtensionPoint("Core-preProcessTrackConfig",et),e.addToExtensionPoint("Core-preProcessTrackConfig",tt),e.addToExtensionPoint("Core-guessAdapterForLocation",o=>(t,r,a)=>To(t,r,a)??o(t,r,a)),e.addToExtensionPoint("Core-guessTrackTypeForLocation",o=>(t,r)=>ve.has(t)?"GraphTrack":t==="MinigraphBubbleAdapter"?"FeatureTrack":o(t,r))}function fe(e){let o;if(m(e)){let{refName:t,start:r,end:a,assemblyName:s}=e;typeof t=="string"&&typeof r=="number"&&typeof a=="number"&&(o={refName:t,start:r,end:a,assemblyName:typeof s=="string"?s:void 0})}return o}function rt(e,o,t){let r=e.connectedViewId;return r===void 0||r===o||!t.has(r)}function xo(e,o){return e.assemblyName===void 0||o===void 0||o.includes(e.assemblyName)}function So(e){return(Array.isArray(e.tracks)?e.tracks:[]).flatMap(t=>m(t)&&Array.isArray(t.displays)?t.displays.filter(r=>m(r)&&r.type==="LinearGraphDisplay"):[])}function Ao(e,o,t){let r=[],a=Ue(e),s=new Set(a.map(i=>m(i)?i.id:void 0));for(let i of a){if(m(i)&&i.id===o)for(let c of So(i)){let C=fe(c.hoverHighlight);C&&xo(C,t)&&r.push({key:typeof c.id=="string"?c.id:"graph-track",region:C})}for(let c of m(i)?[...So(i),...i.type==="GraphGenomeView"?[i]:[]]:[])(Array.isArray(c.assemblyHoverHighlights)?c.assemblyHoverHighlights:[]).forEach((Fo,Io)=>{let U=fe(Fo);U?.assemblyName!==void 0&&t?.includes(U.assemblyName)&&r.push({key:`${typeof c.id=="string"?c.id:"graph"}-${Io}`,region:U})});if(m(i)&&i.type==="GraphGenomeView"&&rt(i,o,s)){let c=fe(i.hoverHighlight);c&&xo(c,t)&&r.push({key:typeof i.id=="string"?i.id:"graph",region:c})}}return r}var at=qe()(e=>({highlight:{height:"100%",position:"absolute",background:R(e.palette.primary.main,.08),borderLeft:`1px solid ${R(e.palette.primary.main,.4)}`,borderRight:`1px solid ${R(e.palette.primary.main,.4)}`,pointerEvents:"none",zIndex:10}})),nt=X(function({model:o,region:t}){let{classes:r}=at(),a=o.getHighlightCoords(t);return a?k("div",{"data-testid":"graph-node-highlight",className:r.highlight,style:{left:a.left,width:a.width}}):null}),it=X(function({model:o}){let{views:t}=g(o);return k(Se,{children:Ao([...t],o.id,o.assemblyNames).map(({key:r,region:a})=>k(nt,{model:o,region:a},`graph-hover-${r}`))})}),Go=it;var st="LinearGenomeView-TracksContainerComponent";function ye(e){e.contributeToExtensionPoint(st,({model:o})=>k(Go,{model:o},"graphgenomeview-hover-highlight"))}function pt(e){return e.views(o=>({get adapterConfig(){return Ye(o,we(o).configuration)}}))}function he(e){e.addToExtensionPoint("Core-extendPluggableElement",o=>(o instanceof L&&ne.includes(o.name)&&o.extendStateModel(pt),o))}var Lo="GraphGenomeView";var Mo="10.4.0";var be=class extends to{constructor(){super(...arguments);this.name=Lo;this.version=Mo}install(t){ae(t),pe(t),ie(t),se(t),ye(t),ce(t),de(t),oe(t),ue(t),le(t),me(t),te(t),ge(t),he(t),t.addRpcMethod(()=>new I(t)),t.addRpcMethod(()=>new Ne(t)),t.addRpcMethod(()=>new Ve(t)),t.addRpcMethod(()=>new F(t))}configure(t){bo(t);try{Te(t.rootModel)&&t.rootModel.appendToSubMenu(["Add"],{label:"Graph genome view",icon:Ae,onClick:r=>{r.addView("GraphGenomeView",{})}})}catch(r){console.warn("[GraphGenomeView] could not add the Add menu entry",r)}}};export{be as default};
2
2
  //# sourceMappingURL=jbrowse-plugin-graphgenomeviewer.esm.js.map