jbrowse-plugin-graphgenomeviewer 10.4.2 → 10.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddTrackWorkflow-P5APNL32.js → AddTrackWorkflow-D4QSDNWI.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-46A4LMVD.js → GbzBaseSyntenyAdapter-RM4CXLLF.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-46A4LMVD.js.map → GbzBaseSyntenyAdapter-RM4CXLLF.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-MXRAP7QB.js → GraphGenomeView-QQFYOKM5.js} +2 -2
- package/dist/chunks/GraphSettingsDialog-D6WOU4CU.js +2 -0
- package/dist/chunks/{HighlightColorDialog-UKFUS5S4.js → HighlightColorDialog-NNQM2AER.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-OFZQJHYG.js +2 -0
- package/dist/chunks/{MinigraphBubbleAdapter-QSPPG4LG.js → MinigraphBubbleAdapter-JBYQHQRT.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-UPCOXYVG.js → RgfaTabixAdapter-6FJWPEHW.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-LHKGRYC6.js → WalkFormsAdapter-IRGWL2G4.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-ELTYD73I.js → WalkTabixSyntenyAdapter-7RQNFBIG.js} +2 -2
- package/dist/chunks/{chunk-SMZZWPRX.js → chunk-5RK2OJEU.js} +2 -2
- package/dist/chunks/{chunk-SMZZWPRX.js.map → chunk-5RK2OJEU.js.map} +3 -3
- package/dist/chunks/{chunk-43EUXRKZ.js → chunk-5VZ5HRTH.js} +2 -2
- package/dist/chunks/{chunk-43EUXRKZ.js.map → chunk-5VZ5HRTH.js.map} +1 -1
- package/dist/chunks/chunk-6GJELLIC.js +2 -0
- package/dist/chunks/chunk-6GJELLIC.js.map +7 -0
- package/dist/chunks/{chunk-TM22QR6V.js → chunk-6T2VBP7Z.js} +2 -2
- package/dist/chunks/{chunk-TM22QR6V.js.map → chunk-6T2VBP7Z.js.map} +1 -1
- package/dist/chunks/{chunk-5N4B6FEH.js → chunk-7YC64WD6.js} +2 -2
- package/dist/chunks/{chunk-52BUFQHJ.js → chunk-AYJ6SUB5.js} +6 -6
- package/dist/chunks/{chunk-52BUFQHJ.js.map → chunk-AYJ6SUB5.js.map} +2 -2
- package/dist/chunks/{chunk-RUKWE5MB.js → chunk-BPCYXZWU.js} +2 -2
- package/dist/chunks/{chunk-RDTLCMD2.js → chunk-E55FR7S6.js} +1 -1
- package/dist/chunks/{chunk-RDTLCMD2.js.map → chunk-E55FR7S6.js.map} +1 -1
- package/dist/chunks/{chunk-DZXYOIGJ.js → chunk-ESUDWLHY.js} +2 -2
- package/dist/chunks/{chunk-E3GNTGWW.js → chunk-FSBDVHNR.js} +1 -1
- package/dist/chunks/{chunk-E3GNTGWW.js.map → chunk-FSBDVHNR.js.map} +1 -1
- package/dist/chunks/{chunk-4QYWBDUL.js → chunk-G7MXYOW5.js} +2 -2
- package/dist/chunks/{chunk-4QYWBDUL.js.map → chunk-G7MXYOW5.js.map} +1 -1
- package/dist/chunks/{chunk-WBDZVWK4.js → chunk-GZROPRBI.js} +2 -2
- package/dist/chunks/{chunk-WBDZVWK4.js.map → chunk-GZROPRBI.js.map} +1 -1
- package/dist/chunks/{chunk-E5ERNAYL.js → chunk-HHK5MBID.js} +1 -1
- package/dist/chunks/{chunk-E5ERNAYL.js.map → chunk-HHK5MBID.js.map} +1 -1
- package/dist/chunks/{chunk-2TMZO3P5.js → chunk-JFNEV3BY.js} +2 -2
- package/dist/chunks/{chunk-N2TMTGYP.js → chunk-JXMFPTPM.js} +2 -2
- package/dist/chunks/{chunk-VY7G4FSX.js → chunk-LOT3BKM3.js} +2 -2
- package/dist/chunks/{chunk-VY7G4FSX.js.map → chunk-LOT3BKM3.js.map} +2 -2
- package/dist/chunks/{chunk-L7ZSEA4T.js → chunk-MX7R2F3F.js} +2 -2
- package/dist/chunks/{chunk-L7ZSEA4T.js.map → chunk-MX7R2F3F.js.map} +1 -1
- package/dist/chunks/{chunk-YIGESHTA.js → chunk-NSWRDOLS.js} +2 -2
- package/dist/chunks/{chunk-YIGESHTA.js.map → chunk-NSWRDOLS.js.map} +1 -1
- package/dist/chunks/{chunk-AC5KEN36.js → chunk-NZ7YFVK4.js} +2 -2
- package/dist/chunks/{chunk-AC5KEN36.js.map → chunk-NZ7YFVK4.js.map} +1 -1
- package/dist/chunks/chunk-PZGI7L73.js +5 -0
- package/dist/chunks/chunk-PZGI7L73.js.map +7 -0
- package/dist/chunks/{chunk-YLB6GKFG.js → chunk-S4BXLNAH.js} +2 -2
- package/dist/chunks/{chunk-YLB6GKFG.js.map → chunk-S4BXLNAH.js.map} +1 -1
- package/dist/chunks/{chunk-QOMV5OG7.js → chunk-SRA6CKRA.js} +2 -2
- package/dist/chunks/{renderSvg-4AG3PPI5.js → renderSvg-5YYSAMUL.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/version.ts +1 -1
- package/dist/chunks/GraphSettingsDialog-HIOYWTO7.js +0 -2
- package/dist/chunks/LinearGraphDisplay-KPWFPVFK.js +0 -2
- package/dist/chunks/chunk-BLE63OIT.js +0 -2
- package/dist/chunks/chunk-BLE63OIT.js.map +0 -7
- package/dist/chunks/chunk-M5XKM6D2.js +0 -5
- package/dist/chunks/chunk-M5XKM6D2.js.map +0 -7
- /package/dist/chunks/{AddTrackWorkflow-P5APNL32.js.map → AddTrackWorkflow-D4QSDNWI.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-MXRAP7QB.js.map → GraphGenomeView-QQFYOKM5.js.map} +0 -0
- /package/dist/chunks/{GraphSettingsDialog-HIOYWTO7.js.map → GraphSettingsDialog-D6WOU4CU.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-UKFUS5S4.js.map → HighlightColorDialog-NNQM2AER.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-KPWFPVFK.js.map → LinearGraphDisplay-OFZQJHYG.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-QSPPG4LG.js.map → MinigraphBubbleAdapter-JBYQHQRT.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-UPCOXYVG.js.map → RgfaTabixAdapter-6FJWPEHW.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-LHKGRYC6.js.map → WalkFormsAdapter-IRGWL2G4.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-ELTYD73I.js.map → WalkTabixSyntenyAdapter-7RQNFBIG.js.map} +0 -0
- /package/dist/chunks/{chunk-5N4B6FEH.js.map → chunk-7YC64WD6.js.map} +0 -0
- /package/dist/chunks/{chunk-RUKWE5MB.js.map → chunk-BPCYXZWU.js.map} +0 -0
- /package/dist/chunks/{chunk-DZXYOIGJ.js.map → chunk-ESUDWLHY.js.map} +0 -0
- /package/dist/chunks/{chunk-2TMZO3P5.js.map → chunk-JFNEV3BY.js.map} +0 -0
- /package/dist/chunks/{chunk-N2TMTGYP.js.map → chunk-JXMFPTPM.js.map} +0 -0
- /package/dist/chunks/{chunk-QOMV5OG7.js.map → chunk-SRA6CKRA.js.map} +0 -0
- /package/dist/chunks/{renderSvg-4AG3PPI5.js.map → renderSvg-5YYSAMUL.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-KGAZZNZC.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-RDTLCMD2.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-
|
|
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-KGAZZNZC.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-E55FR7S6.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-BPCYXZWU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var s="#";function c(n){return n.split(s)[0]}var a=new Set(["_gbwt_ref"]);function u(n){return a.has(n)}function f(n){let t=n.split(s);return t.length>=3?`${t[0]}${s}${t[1]}`:void 0}function y(n){let t=n.split(s);return t.length>=3?t.slice(2).join(s):t.length===2?t[1]:n}function N(n){let[t="",e="",...o]=n.split(s);return o.length>0&&/^\d+$/.test(e)?{sample:t,haplotype:+e,contig:o.join(s)}:void 0}function m(n){let t=n.split(s),e=t.length>=2&&t[1]!==""?Number(t[1]):Number.NaN;return{sample:t[0],haplotype:Number.isFinite(e)?e:void 0}}function S(n,t){return t!==void 0&&(n===t||n.startsWith(t+s))}var p=n=>typeof n=="object"&&n!==null&&Object.values(n).every(t=>typeof t=="string");function r(n){let t=n.getConf("assemblyNameToPanSN");return p(t)?t:{}}function g(n,t){return t===void 0?void 0:r(n)[t]??t}function l(n){let t=n.getConf("assemblyNames");return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}var i=new WeakMap;function h(n){let t=i.get(n);if(t===void 0){let e=r(n);t={};for(let o of new Set([...Object.keys(e),...l(n)]))t[e[o]??o]=o;i.set(n,t)}return t}export{c as a,u as b,f as c,y as d,N as e,m as f,S as g,g as h,h as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-E55FR7S6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.3.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.3.3/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-W6DDM47C.js"],
|
|
4
4
|
"sourcesContent": ["// src/pansn.ts\nvar SEP = \"#\";\nfunction panSNSample(refName) {\n return refName.split(SEP)[0];\n}\nvar GENERIC_SAMPLES = /* @__PURE__ */ new Set([\"_gbwt_ref\"]);\nfunction isGenericSample(sample) {\n return GENERIC_SAMPLES.has(sample);\n}\nfunction panSNHaplotype(refName) {\n const parts = refName.split(SEP);\n return parts.length >= 3 ? `${parts[0]}${SEP}${parts[1]}` : void 0;\n}\nfunction panSNContig(refName) {\n const parts = refName.split(SEP);\n return parts.length >= 3 ? parts.slice(2).join(SEP) : parts.length === 2 ? parts[1] : refName;\n}\nfunction panSNFields(name) {\n const [sample = \"\", haplotype = \"\", ...contig] = name.split(SEP);\n return contig.length > 0 && /^\\d+$/.test(haplotype) ? { sample, haplotype: +haplotype, contig: contig.join(SEP) } : void 0;\n}\nfunction parsePanSN(refName) {\n const parts = refName.split(SEP);\n const haplotype = parts.length >= 2 && parts[1] !== \"\" ? Number(parts[1]) : Number.NaN;\n return {\n sample: parts[0],\n haplotype: Number.isFinite(haplotype) ? haplotype : void 0\n };\n}\nfunction panSNMatchesPrefix(refName, prefix) {\n return prefix !== void 0 && (refName === prefix || refName.startsWith(prefix + SEP));\n}\nvar isNameMap = (value) => typeof value === \"object\" && value !== null && Object.values(value).every((v) => typeof v === \"string\");\nfunction assemblyNameToPanSN(adapter) {\n const map = adapter.getConf(\"assemblyNameToPanSN\");\n return isNameMap(map) ? map : {};\n}\nfunction resolvePanSNPrefix(adapter, name) {\n return name === void 0 ? void 0 : assemblyNameToPanSN(adapter)[name] ?? name;\n}\nfunction assemblyNames(adapter) {\n const names = adapter.getConf(\"assemblyNames\");\n return Array.isArray(names) ? names.filter((name) => typeof name === \"string\") : [];\n}\nvar asmByPrefixCache = /* @__PURE__ */ new WeakMap();\nfunction assemblyByPanSNPrefix(adapter) {\n let out = asmByPrefixCache.get(adapter);\n if (out === void 0) {\n const map = assemblyNameToPanSN(adapter);\n out = {};\n for (const asm of /* @__PURE__ */ new Set([\n ...Object.keys(map),\n ...assemblyNames(adapter)\n ])) {\n out[map[asm] ?? asm] = asm;\n }\n asmByPrefixCache.set(adapter, out);\n }\n return out;\n}\n\nexport {\n panSNSample,\n isGenericSample,\n panSNHaplotype,\n panSNContig,\n panSNFields,\n parsePanSN,\n panSNMatchesPrefix,\n resolvePanSNPrefix,\n assemblyByPanSNPrefix\n};\n"],
|
|
5
5
|
"mappings": "AACA,IAAIA,EAAM,IACV,SAASC,EAAYC,EAAS,CAC5B,OAAOA,EAAQ,MAAMF,CAAG,EAAE,CAAC,CAC7B,CACA,IAAIG,EAAkC,IAAI,IAAI,CAAC,WAAW,CAAC,EAC3D,SAASC,EAAgBC,EAAQ,CAC/B,OAAOF,EAAgB,IAAIE,CAAM,CACnC,CACA,SAASC,EAAeJ,EAAS,CAC/B,IAAMK,EAAQL,EAAQ,MAAMF,CAAG,EAC/B,OAAOO,EAAM,QAAU,EAAI,GAAGA,EAAM,CAAC,CAAC,GAAGP,CAAG,GAAGO,EAAM,CAAC,CAAC,GAAK,MAC9D,CACA,SAASC,EAAYN,EAAS,CAC5B,IAAMK,EAAQL,EAAQ,MAAMF,CAAG,EAC/B,OAAOO,EAAM,QAAU,EAAIA,EAAM,MAAM,CAAC,EAAE,KAAKP,CAAG,EAAIO,EAAM,SAAW,EAAIA,EAAM,CAAC,EAAIL,CACxF,CACA,SAASO,EAAYC,EAAM,CACzB,GAAM,CAACL,EAAS,GAAIM,EAAY,GAAI,GAAGC,CAAM,EAAIF,EAAK,MAAMV,CAAG,EAC/D,OAAOY,EAAO,OAAS,GAAK,QAAQ,KAAKD,CAAS,EAAI,CAAE,OAAAN,EAAQ,UAAW,CAACM,EAAW,OAAQC,EAAO,KAAKZ,CAAG,CAAE,EAAI,MACtH,CACA,SAASa,EAAWX,EAAS,CAC3B,IAAMK,EAAQL,EAAQ,MAAMF,CAAG,EACzBW,EAAYJ,EAAM,QAAU,GAAKA,EAAM,CAAC,IAAM,GAAK,OAAOA,EAAM,CAAC,CAAC,EAAI,OAAO,IACnF,MAAO,CACL,OAAQA,EAAM,CAAC,EACf,UAAW,OAAO,SAASI,CAAS,EAAIA,EAAY,MACtD,CACF,CACA,SAASG,EAAmBZ,EAASa,EAAQ,CAC3C,OAAOA,IAAW,SAAWb,IAAYa,GAAUb,EAAQ,WAAWa,EAASf,CAAG,EACpF,CACA,IAAIgB,EAAaC,GAAU,OAAOA,GAAU,UAAYA,IAAU,MAAQ,OAAO,OAAOA,CAAK,EAAE,MAAOC,GAAM,OAAOA,GAAM,QAAQ,EACjI,SAASC,EAAoBC,EAAS,CACpC,IAAMC,EAAMD,EAAQ,QAAQ,qBAAqB,EACjD,OAAOJ,EAAUK,CAAG,EAAIA,EAAM,CAAC,CACjC,CACA,SAASC,EAAmBF,EAASV,EAAM,CACzC,OAAOA,IAAS,OAAS,OAASS,EAAoBC,CAAO,EAAEV,CAAI,GAAKA,CAC1E,CACA,SAASa,EAAcH,EAAS,CAC9B,IAAMI,EAAQJ,EAAQ,QAAQ,eAAe,EAC7C,OAAO,MAAM,QAAQI,CAAK,EAAIA,EAAM,OAAQd,GAAS,OAAOA,GAAS,QAAQ,EAAI,CAAC,CACpF,CACA,IAAIe,EAAmC,IAAI,QAC3C,SAASC,EAAsBN,EAAS,CACtC,IAAIO,EAAMF,EAAiB,IAAIL,CAAO,EACtC,GAAIO,IAAQ,OAAQ,CAClB,IAAMN,EAAMF,EAAoBC,CAAO,EACvCO,EAAM,CAAC,EACP,QAAWC,KAAuB,IAAI,IAAI,CACxC,GAAG,OAAO,KAAKP,CAAG,EAClB,GAAGE,EAAcH,CAAO,CAC1B,CAAC,EACCO,EAAIN,EAAIO,CAAG,GAAKA,CAAG,EAAIA,EAEzBH,EAAiB,IAAIL,EAASO,CAAG,CACnC,CACA,OAAOA,CACT",
|
|
6
6
|
"names": ["SEP", "panSNSample", "refName", "GENERIC_SAMPLES", "isGenericSample", "sample", "panSNHaplotype", "parts", "panSNContig", "panSNFields", "name", "haplotype", "contig", "parsePanSN", "panSNMatchesPrefix", "prefix", "isNameMap", "value", "v", "assemblyNameToPanSN", "adapter", "map", "resolvePanSNPrefix", "assemblyNames", "names", "asmByPrefixCache", "assemblyByPanSNPrefix", "out", "asm"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-E55FR7S6.js";var n=class extends Error{constructor(t){super(`a pair query names both lanes: queryAssemblyName ${t} came without a targetAssemblyName`);this.name="PairTargetError"}};function o(r){let{lanePairs:e,queryAssemblyName:t,targetAssemblyName:a}=r;if(e?.length)return e;if(t===void 0)return[];if(a===void 0)throw new n(t);return[{queryAssemblyName:t,targetAssemblyName:a}]}function m(r){let[e]=r;return r.length===1&&e?`Reading ${e.queryAssemblyName} against ${e.targetAssemblyName}`:`Reading ${r.length} lane pairs`}function l(r,e){return r[e]??r[s(e)]??e}export{n as a,o as b,m as c,l as d};
|
|
2
|
+
//# sourceMappingURL=chunk-ESUDWLHY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function o(t){return t===void 0||t==="*"?void 0:t}function s(t){let e=t.split(" ");return{refName:e[0],start:+e[1],end:+e[2],segmentCount:+e[3],pathCount:+e[4],inversion:e[5]==="1",shortestAlleleLength:+e[6],longestAlleleLength:+e[7],segments:e[11],shortestAllele:o(e[12]),longestAllele:o(e[13])}}function u(t,e){return t.key!==void 0||e.key!==void 0?t.key===e.key:t.refName===e.refName&&t.start===e.start&&t.end===e.end}function i(t){return t.key??`${t.refName}:${t.start}-${t.end}`}function b(t){let{shortestAlleleLength:e,longestAlleleLength:n}=t;return e===n?`${n.toLocaleString()} bp`:`${e.toLocaleString()}-${n.toLocaleString()} bp`}var r=2147483647;function a(t){let{pathCount:e,segmentCount:n,inversion:l}=t;return[`${n} segments`,e===r?"more paths than gfatools counts":`up to ${e.toLocaleString()} paths`,...l?["inversion"]:[]].join(", ")}export{s as a,u as b,i as c,b as d,r as e,a as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-FSBDVHNR.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.3.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@14.3.3/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-FX4RDMDN.js"],
|
|
4
4
|
"sourcesContent": ["// src/bubbles/bubbleLine.ts\nfunction sequence(field) {\n return field === void 0 || field === \"*\" ? void 0 : field;\n}\nfunction parseBubbleLine(line) {\n const cols = line.split(\"\t\");\n return {\n refName: cols[0],\n start: +cols[1],\n end: +cols[2],\n segmentCount: +cols[3],\n pathCount: +cols[4],\n inversion: cols[5] === \"1\",\n shortestAlleleLength: +cols[6],\n longestAlleleLength: +cols[7],\n segments: cols[11],\n shortestAllele: sequence(cols[12]),\n longestAllele: sequence(cols[13])\n };\n}\nfunction sameBubble(a, b) {\n return a.key !== void 0 || b.key !== void 0 ? a.key === b.key : a.refName === b.refName && a.start === b.start && a.end === b.end;\n}\nfunction bubbleKey(b) {\n return b.key ?? `${b.refName}:${b.start}-${b.end}`;\n}\nfunction bubbleLabel(bubble) {\n const { shortestAlleleLength: min, longestAlleleLength: max } = bubble;\n return min === max ? `${max.toLocaleString()} bp` : `${min.toLocaleString()}-${max.toLocaleString()} bp`;\n}\nvar SATURATED_PATH_COUNT = 2147483647;\nfunction bubbleDescription(bubble) {\n const { pathCount, segmentCount, inversion } = bubble;\n return [\n `${segmentCount} segments`,\n pathCount === SATURATED_PATH_COUNT ? \"more paths than gfatools counts\" : `up to ${pathCount.toLocaleString()} paths`,\n ...inversion ? [\"inversion\"] : []\n ].join(\", \");\n}\n\nexport {\n parseBubbleLine,\n sameBubble,\n bubbleKey,\n bubbleLabel,\n SATURATED_PATH_COUNT,\n bubbleDescription\n};\n"],
|
|
5
5
|
"mappings": "AACA,SAASA,EAASC,EAAO,CACvB,OAAOA,IAAU,QAAUA,IAAU,IAAM,OAASA,CACtD,CACA,SAASC,EAAgBC,EAAM,CAC7B,IAAMC,EAAOD,EAAK,MAAM,GAAG,EAC3B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,aAAc,CAACA,EAAK,CAAC,EACrB,UAAW,CAACA,EAAK,CAAC,EAClB,UAAWA,EAAK,CAAC,IAAM,IACvB,qBAAsB,CAACA,EAAK,CAAC,EAC7B,oBAAqB,CAACA,EAAK,CAAC,EAC5B,SAAUA,EAAK,EAAE,EACjB,eAAgBJ,EAASI,EAAK,EAAE,CAAC,EACjC,cAAeJ,EAASI,EAAK,EAAE,CAAC,CAClC,CACF,CACA,SAASC,EAAWC,EAAGC,EAAG,CACxB,OAAOD,EAAE,MAAQ,QAAUC,EAAE,MAAQ,OAASD,EAAE,MAAQC,EAAE,IAAMD,EAAE,UAAYC,EAAE,SAAWD,EAAE,QAAUC,EAAE,OAASD,EAAE,MAAQC,EAAE,GAChI,CACA,SAASC,EAAUD,EAAG,CACpB,OAAOA,EAAE,KAAO,GAAGA,EAAE,OAAO,IAAIA,EAAE,KAAK,IAAIA,EAAE,GAAG,EAClD,CACA,SAASE,EAAYC,EAAQ,CAC3B,GAAM,CAAE,qBAAsBC,EAAK,oBAAqBC,CAAI,EAAIF,EAChE,OAAOC,IAAQC,EAAM,GAAGA,EAAI,eAAe,CAAC,MAAQ,GAAGD,EAAI,eAAe,CAAC,IAAIC,EAAI,eAAe,CAAC,KACrG,CACA,IAAIC,EAAuB,WAC3B,SAASC,EAAkBJ,EAAQ,CACjC,GAAM,CAAE,UAAAK,EAAW,aAAAC,EAAc,UAAAC,CAAU,EAAIP,EAC/C,MAAO,CACL,GAAGM,CAAY,YACfD,IAAcF,EAAuB,kCAAoC,SAASE,EAAU,eAAe,CAAC,SAC5G,GAAGE,EAAY,CAAC,WAAW,EAAI,CAAC,CAClC,EAAE,KAAK,IAAI,CACb",
|
|
6
6
|
"names": ["sequence", "field", "parseBubbleLine", "line", "cols", "sameBubble", "a", "b", "bubbleKey", "bubbleLabel", "bubble", "min", "max", "SATURATED_PATH_COUNT", "bubbleDescription", "pathCount", "segmentCount", "inversion"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as W,b as bt}from"./chunk-YLB6GKFG.js";import{A as zt,B as Bt,C as X,D as re,E as Ot,F as K,G as ve,H as ae,a as vt,b as wt,c as xt,d as St,f as kt,g as Mt,h as D,i as Pt,j as Rt,k as Ct,l as Lt,n as It,o as Et,p as be,q as Gt,r as Tt,s as Ht,t as Nt,u as At,w as oe,y as _t}from"./chunk-TM22QR6V.js";import{$ as ye,B as rt,C as st,E as lt,F as ct,G as pt,H as ut,I as dt,J as ft,X as mt,Y as gt,a as P,ba as yt,c as je,f as Qe,g as et,p as ot}from"./chunk-SMZZWPRX.js";import{q as H}from"./chunk-AC5KEN36.js";import{Ba as ge,Hb as ne,Ia as te,K as me,Ma as Ue,Oa as qe,Pb as $,Qb as tt,Rb as nt,Sb as at,T as Ze,Tb as it,Za as Je,_ as $e,a as Y,ac as _,b as Ge,d as Te,fa as Ke,gd as ht}from"./chunk-M5XKM6D2.js";import{v as Ye}from"./chunk-VY7G4FSX.js";import{S as fe,W as he}from"./chunk-BLE63OIT.js";import{c as Ie}from"./chunk-WBDZVWK4.js";import{x as Le}from"./chunk-43EUXRKZ.js";import{d as I}from"./chunk-WKD7ALOU.js";import{C as Ee}from"./chunk-KGAZZNZC.js";import{j as J}from"./chunk-5L276I7O.js";import{a as Xe,e as G,f as Fe,g as Ve,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as We,E as De,H as ee,I as Z,b as O,c as He,e as de,k as Ne,o as Ae,p as _e,t as ze,w as Q,x as Be,z as Oe}from"./chunk-H42TSPVA.js";import{a as k,b as n,c as d,d as f}from"./chunk-DUU6T2I5.js";function Wt(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Gn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Dt=Gn("useRenderingBackend"),Yo=z&&z.__esModule?z.default:z;var we=wt(1),Xt=f(function({model:e}){let[o,r]=L(null);return G(()=>{if(!o)return;let a=new _(o),p=Y(()=>{Je(ht()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{p(),a.dispose()}},[o,e]),n("canvas",{ref:r,"data-testid":"graph-hover-layer",style:{...we,clipPath:e.drawingClip}})});var ie=f(function({row:e,at:o,hint:r,after:a,column:p}){let l=p===void 0?void 0:{paddingLeft:p+5};return e.swatch?d("div",{title:[e.title,r].filter(Boolean).join(" \xB7 ")||void 0,children:[d("div",{style:re,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:p},children:n(oe,{swatch:e.swatch})}),d("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:d("span",{style:Tn,children:[n("span",{style:Hn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:be(e.sizer)}),n("span",{style:Nn,"data-testid":"graph-key-count",children:be(e.count)})]}),a]}),o?n("div",{style:l,"data-testid":"graph-walk-at",children:o}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Ot,children:e.label})}),Tn={display:"grid"},Hn={gridArea:"1 / 1",visibility:"hidden"},Nn={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},An={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Ft=f(function({model:e,sections:o}){if(o.length===0)return null;let r=o.flatMap(l=>l.rows),a=Et(r),p=It(r);return n("div",{style:{...X,lineHeight:`${a}px`},children:o.map(({testid:l,rows:c,heading:s,spaced:u},y)=>d(Xe,{children:[s?n("div",{style:{...ae,paddingTop:y===0?0:ve},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ve}:void 0,children:c.map(m=>n(ie,{row:m,column:p,at:m.walk?e.hoveredOn(m.walk):void 0,after:m.closesBubble?n("button",{type:"button",style:An,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},m.key))})]},l))})});var _n={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:at,lineHeight:"normal"},zn={height:it,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Bn={position:"relative"},On={gridColumn:"1 / -1",height:gt,padding:"2px 6px",boxSizing:"border-box",display:"flex",alignItems:"center",gap:14,fontSize:11,lineHeight:"15px"},Wn={display:"flex",gap:14,marginLeft:"auto"},Dn=f(function({model:e,lift:o,index:r,width:a,height:p,cell:l,handlers:c,canvasStyle:s}){let[u,y]=L(null),[m,w]=L(null),E=o.walks[0];G(()=>{if(!u||!m)return;let A=new _(u),B=new _(m),U=Ge(()=>e.facetDrawings?.[r]),F,V=[Y(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=U.get();T&&(T!==F&&(A.uploadGeometry(T.batch),F=T),e.applySelection(A),e.paint(A))}),Y(()=>{let R=e.facetGrid;R&&B.resize(R.width,R.height);let T=U.get();T&&e.paintHover(B,T.batch)})];return()=>{for(let R of V)R();A.dispose(),B.dispose()}},[u,m,e,r]);let N=e.walkLabel(E.name);return d("div",{style:l,children:[n("button",{type:"button",style:zn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([E.name]),e.setFacet("")},children:n(ie,{row:Tt(e,E),hint:`click to lift ${N} alone`,at:e.hoveredOn(E)})}),d("div",{style:Bn,children:[n("canvas",{ref:y,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:p,display:"block"},...c}),n("canvas",{ref:w,style:we})]})]})}),Xn=f(function({model:e,handlers:o,canvasStyle:r,controls:a}){let p=e.facetPanels,l=e.facetGrid,c=e.facetPlacement;if(!p||!l||!c)return null;let{columns:s,width:u,height:y}=l;return d("div",{"data-testid":"graph-facet-panels",style:{..._n,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${s}, ${u}px)`,background:te},children:[p.map((m,w)=>n(Dn,{model:e,lift:m,index:w,width:u,height:y,cell:{gridRow:Math.floor(c.cells[w]/s)+1,gridColumn:c.cells[w]%s+1},handlers:o,canvasStyle:r},m.walks[0].name)),d("div",{style:{...On,gridRow:Math.floor(c.cells.reduce((m,w)=>Math.max(m,w),-1/0)/s)+2},"data-testid":"graph-facet-key",children:[Ht(e).map(m=>n(ie,{row:m},m.key)),a?n("span",{style:Wn,children:a}):null]})]})}),Vt=Xn;var Yt=P(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Zt=P([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var $t=P(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var Fn=f(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:rt.map(({value:r})=>({value:r,label:e.colorSchemeLabel(r)})),testId:"graph-color-select",onChange:r=>{e.setColorScheme(r)}})}),Kt=Fn;var jt=H()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function xe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Vn=f(function({model:e}){let{classes:o}=jt(),{lastFetchMs:r,lastLayoutMs:a,lastGeometryMs:p}=e,l=r!==void 0||a!==void 0||p!==void 0;return e.showPerf&&l?d(Z,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",xe(r)," \xB7 layout ",xe(a)," \xB7 geom"," ",xe(p)]}):null}),Yn=f(function({model:e}){let{classes:o}=jt();return d("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[d(Z,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Vn,{model:e})]})}),Ut=Yn;var Zn=f(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:je.map(({value:r,label:a,description:p,available:l})=>({value:r,label:a,description:p,disabled:o?!l(o):!1})),onChange:r=>{e.switchLayout(r)}})}),qt=Zn;var $n=f(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),Jt=$n;var Qt=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var en=P(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Kn=f(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(O,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:Qe,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),...e.linksMenuItems(),{label:"Show",icon:st,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:et,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{J(e).queueDialog(r=>[bt,{model:e,onClose:r}])}},{type:"divider"},{label:"Close graph",icon:Qt,onClick:()=>{e.clearGraph()}}],children:n(en,{})})}),tn=Kn;var jn=H()({formControl:{minWidth:130,maxWidth:260}}),Un=f(function({model:e}){let{classes:o}=jn(),r=Fe(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let p=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),c=e.walkLayers.map(s=>s.walk).filter(s=>p.has(s));return a.length>qe?n(Ae,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{J(e).queueDialog(s=>[Ue,{model:e,onClose:s}])},children:c.length>0?`${c.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):d(ze,{size:"small",className:o.formControl,children:[n(Be,{id:r,children:"Highlight"}),n(De,{labelId:r,multiple:!0,value:c,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>d(We,{value:s,dense:!0,children:[n(_e,{size:"small",checked:c.includes(s)}),n(Oe,{primary:u})]},s))})]})}),nn=Un;var qn=H()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Jn=f(function({model:e}){return n(Z,{variant:"body2",children:e.zoomPercent})}),Qn=f(function({model:e}){let{classes:o}=qn(),r=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return d("div",{className:o.toolbar,children:[n(qt,{model:e}),n(Kt,{model:e}),n(nn,{model:e}),n(Jt,{model:e}),n(ee,{title:"Zoom in",children:n(Q,{size:"small",onClick:()=>{r(1.5)},children:n(Zt,{})})}),n(ee,{title:"Zoom out",children:n(Q,{size:"small",onClick:()=>{r(1/1.5)},children:n($t,{})})}),n(ee,{title:"Zoom to fit",children:n(Q,{size:"small",onClick:()=>{e.refitView()},children:n(Yt,{})})}),n(Jn,{model:e}),n(Ut,{model:e}),n(tn,{model:e})]})}),on=Qn;var eo="#1c1c22",to="#eef1f3",no="#1a56c4",se=H()({row:{...X,display:"flex",alignItems:"center",gap:6,color:eo},inline:{padding:0,background:"none"},heading:ae,joined:{display:"flex","& > button + button":{marginLeft:-1},"& > button:first-of-type":{borderRadius:"3px 0 0 3px"},"& > button:last-of-type":{borderRadius:"0 3px 3px 0"}},button:{display:"flex",alignItems:"center",gap:4,font:"inherit",color:"inherit",background:X.background,border:`1px solid ${K}`,borderRadius:3,padding:"0 6px",cursor:"pointer","&:hover":{background:to},"&:disabled":{color:K,cursor:"default"},"&:focus-visible":{outline:`2px solid ${no}`,outlineOffset:1,position:"relative",zIndex:1}},on:{color:X.background,background:K,"&:hover":{background:K}}}),le=f(function(e){return n("button",{type:"button",...e})});var oo=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),{walkChoices:p}=e,l=e.walkLayers.filter(c=>p.some(s=>s.name===c.walk)).length;return e.highlightMenuItems().length>0?d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Haplotypes","data-testid":"graph-haplotype-switch",children:[n("span",{className:r.heading,children:"Haplotypes"}),d(O,{ButtonComponent:le,menuItems:()=>e.highlightMenuItems(),className:a(r.button,l>0&&r.on),title:"Highlight haplotypes","aria-haspopup":"menu",children:[n("span",{children:l>0?`${l} of ${p.length}`:"highlight"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]}):null}),Se=oo;var ro={position:"absolute",bottom:mt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ke({label:t,readout:e}){return d(k,{children:[n("strong",{children:t})," \u2014 ",e]})}function ao(t,e){if(e)return{testId:"graph-chip-tooltip",body:ke(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=nt(o),c=t.hoverDrawing?.members.get(o.id),s=ot(o),u=t.graphRegion,y=t.hoveredSpan,m=u&&y&&!Le(o)?`${u.assemblyName} ${$({refName:u.refName,...y})}`:void 0,w=me(t.genePins,o.id),E=w.length>0?d(k,{children:[n("br",{}),n("em",{children:w.join(", ")})]}):null;return l?{body:d(k,{children:[l,E]})}:{body:d(k,{children:[n("strong",{children:o.name}),c?` and ${c.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),s?d(k,{children:[n("br",{}),s.sample," ",$(s)," (rank ",o.stable?.rank,")"]}):null,m?d(k,{children:[n("br",{}),"Reference ",m]}):null,E,o.moved?d(k,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let r=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(r){let l=tt(r,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),c=t.graph?Ie(t.graph):void 0;return{body:l.deletion?d(k,{children:[`skips ${l.deletion.bp} of ${c??"the reference"} sequence`,n("br",{}),l.deletion.where]}):d(k,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ke(a)};let p=t.hoveredTubeText;return p?{testId:"graph-tube-tooltip",body:ke(p)}:void 0}var io=f(function({model:e,chip:o}){let r=ao(e,o);return r?n("div",{style:{...ro,right:e.tooltipRightPx},"data-testid":r.testId,children:r.body}):null}),rn=io;var so=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),p=e.forceEngineRows(),l=!p.some(c=>c.row.checked);return d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Layout","data-testid":"graph-layout-switch",children:[n("span",{className:r.heading,children:"Layout"}),n("span",{className:r.joined,children:p.map(({name:c,about:s,row:u})=>n("button",{type:"button",className:a(r.button,u.checked&&r.on),"aria-pressed":u.checked,disabled:u.disabled,title:u.disabled?u.disabledHelpText:`${u.label}. ${s}`,onClick:u.onClick,children:c},c))}),d(O,{ButtonComponent:le,menuItems:()=>e.layoutMenuItems(),className:a(r.button,l&&r.on),title:"Every layout","aria-haspopup":"menu",children:[n("span",{children:l?e.layoutLabel():"more"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]})}),Me=so;var an=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var sn=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var ln=P(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var lo={x:0,y:0};function co(t,e){let{own:o,reference:r,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:ln,onClick:()=>{t.showNodeDetails(e)}},...yt({own:o,reference:r,highlight:a,onShowLinear:p=>{t.showInLinearView(p)},onHighlight:t.canHighlightInLinearView?p=>{t.highlightInLinearView(p)}:void 0})]}function po(t,e,o){let r=o??t.walkRowBars,a=t.walkRowLaunchTarget(e,r),p=a?.assembly,l=e>0?r?.rows[e-1]:void 0,c=l?.sample,s=t.abridged.find(m=>m.name===l?.name),u=!o&&t.walkRowBars,y=t.walkRowSamples;return[a&&p?{label:`Linear genome view \u2014 ${p} ${$(a.location)}`,icon:ye,onClick:()=>{t.showInLinearView({location:a.location,assembly:p})}}:{label:"Linear genome view",icon:ye,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...o&&l&&s?[{label:"Load its steps",subLabel:Ee(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&c&&!(y?.length===1&&y[0]===c)?[{label:`Show only ${c}`,icon:an,onClick:()=>{t.setWalkRowSamples([c])}}]:[],...u&&y?[{label:"Show every sample",icon:sn,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var ce=f(function({model:e,at:o,onClose:r}){return n(He,{anchor:o,offset:lo,onClose:r,menuItems:()=>o===void 0?[]:"nodeId"in o?co(e,o.nodeId):po(e,o.row,o.bars)})});var uo=f(function({model:e}){return n(k,{children:e.passBars.map(o=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:dt,style:{display:"block",borderTop:"1px solid #ddd"},children:n(D,{el:ft(o,e.walkLabel(o.walk),e.paneWidth)})},o.walk))})}),cn=uo;var fo={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},ho={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},mo=f(function({bars:e,frame:o,ramp:r,rowGenes:a,inks:p}){let l=Mt(),c=Ve(()=>Ke(e,o,{ramp:r,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:p}),[e,o,r,a,l,p]);return n(D,{el:c})}),go=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,a=e.stripHover,p=o?[o.reference,...o.rows]:[],l=a?p.findIndex(m=>m.name===a.row):-1,c=p[l],s=o&&r&&c?Ze(o,l,r):void 0;if(!o||!r||!a||!c||!s||r.labelled&&!s.cut)return null;let u=(o.origin+a.offset)*r.scaleX+r.translateX,y=u>r.width/2?{right:r.width-u+12}:{left:u+12};return d("div",{"data-testid":"graph-walk-strip-tip",style:{...ho,...y,top:l*r.rowPx+r.translateY-18},children:[c.label," \xB7 ",s.text]})}),yo=f(function({model:e,bars:o,frame:r}){return n(D,{el:ct(o,r,e.walkStripMarks)})}),bo=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,[a,p]=L();if(!o||!r)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return lt(o,r,s.clientX-u.left,s.clientY-u.top)},c=$e(o,{ramp:e.referenceRampDomain,rampCss:Ye,genes:ut(r,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return d("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[d("svg",{width:r.width,height:r.height,style:{display:"block"},onMouseLeave:()=>{I(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),p({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(mo,{bars:o,frame:r,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(yo,{model:e,bars:o,frame:r}),n(D,{el:pt(o,r,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(go,{model:e}),d("div",{style:fo,"data-testid":"graph-walk-strip-key",children:[c.map(s=>d("div",{style:re,children:[n(oe,{swatch:Gt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(ce,{model:e,at:a&&{...a,bars:o},onClose:()=>{p(void 0)}})]})}),pn=bo;var vo=f(function({model:e}){let o=e.walkStripLocator;return o?d(xt,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),un=vo;var wo=1.1,xo=100,So=40,ko=800,Mo=10,dn=2;function Pe(t){let e=t.deltaY*(t.deltaMode===1?So:t.deltaMode===2?ko:1),o=(t.ctrlKey?Mo:1)*e/xo;return wo**-Math.max(-dn,Math.min(dn,o))}var Po=40,Ro=100,Co=24,fn=Math.log(16);function Lo(t,e){let o=t*Math.exp(-Math.max(0,e)/Co);return Math.abs(o)<.001?t:t-o}function Io(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function gn(t,e,o){G(()=>{if(!t)return;let r=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},p=c=>{let s=Lo(a.backlog,Math.min(100,c-a.last));a.backlog-=s,a.last=c,a.frame=a.backlog?requestAnimationFrame(p):0,I(o)&&o.zoom(Math.exp(s),a.x,a.y)},l=c=>{if(o.hostPlacesX||o.followsHostView)return;let y=((c.target instanceof Element?c.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(y&&c.clientY-y.top<o.referenceStripZonePx)return;let m=Io(c,o.host);if(m!=="page"){if(o.host&&c.stopPropagation(),c.preventDefault(),m==="pan"){if(c.timeStamp-r>Ro){let w=c.deltaMode===1?Po:1;o.setTransform(o.scale,o.translateX-c.deltaX*w,o.translateY)}return}r=c.timeStamp,y&&(a.x=c.clientX-y.left,a.y=c.clientY-y.top,a.backlog=Math.max(-fn,Math.min(fn,a.backlog+Math.log(Pe(c)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(p)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var hn=3,Re="data-gesture-owner",j=t=>({x:t.clientX,y:t.clientY});function mn(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function yn(t){let e=C({x:0,y:0}),o=C({x:0,y:0}),r=C(!1),a=C(void 0),p=i=>a.current!==void 0&&i.pointerId!==a.current,l=C(new Map),c=C(null),s=C(null),u=C(!1),y=C(null),m=C(!1),w=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(w.current.frame)},[]);let[E,N]=L(),[A,B]=L(!1),[U,F]=L(void 0);function V(i){let h=i.currentTarget.getBoundingClientRect();return{x:i.clientX-h.left,y:i.clientY-h.top}}function R(i,h){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(i,h);let g=t.referenceStripNodeAt(i,h);if(g)return g;let{nodePositions:b}=t;if(!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return fe(b,v,x,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(i,h){let{nodePositions:g,graph:b}=t;if(!g||!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return he(g,b,v,x,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function vn(i){i.button===0&&i.preventDefault()}function wn(i){if(i.button!==0)return;let h=l.current;if(p(i)){t.isPanning&&!m.current&&i.pointerType==="touch"&&h.size===1&&(i.currentTarget.setPointerCapture(i.pointerId),h.set(i.pointerId,j(i)),s.current=mn(h),r.current=!0);return}r.current=!1,o.current={x:i.clientX,y:i.clientY},i.currentTarget.removeAttribute(Re);let g=t.followsHostView,{x:b,y:v}=V(i),x=v<t.referenceStripZonePx,M=t.hostPlacesX||t.layoutResult?.tubeMap||x?null:R(b,v);t.hostPlacesX||g&&i.shiftKey||t.followsWindow&&!M||(i.currentTarget.setPointerCapture(i.pointerId),a.current=i.pointerId,c.current=i.currentTarget,h.clear(),h.set(i.pointerId,j(i)),g&&M&&i.currentTarget.setAttribute(Re,""),m.current=g,u.current=x&&!g,M?t.setDraggingNode(M):t.setPanning(!0),e.current={x:i.clientX,y:i.clientY})}function Ce(){let i=s.current,h=c.current;if(!i||!h)return;let g=mn(l.current),b=h.getBoundingClientRect();i.spread>0&&g.spread>0&&t.zoom(g.spread/i.spread,i.mid.x-b.left,i.mid.y-b.top),t.setTransform(t.scale,t.translateX+g.mid.x-i.mid.x,t.translateY+g.mid.y-i.mid.y),s.current=g}function xn(){let i=w.current,{pan:h,hover:g,pinch:b}=i;if(i.frame=0,i.pan=null,i.hover=null,i.pinch=!1,b&&Ce(),h&&u.current?t.host?.horizontalScroll(-h.dx):h&&m.current?t.setTransform(t.scale,t.translateX,t.translateY+h.dy):h&&t.setTransform(t.scale,t.translateX+h.dx,t.translateY+h.dy),!g)return;let{x:v,y:x}=g,M=t.facetPanels?void 0:Ct(t.overlayLabels,v,x);F(S=>S?.label===M?.label&&S?.readout===M?.readout?S:M),Te(()=>{if(t.walkRowBars){let S=t.walkRowAt(v,x);t.setHoveredWalkRow(S===void 0?null:t.walkRowList[S].name)}if(t.nodePositions&&t.graph){let S=R(v,x);t.setHoveredPanel(t.tubeMapPanelAt(x)),t.setHoveredNode(S,{x:v,y:x}),B(S!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&x>=t.referenceStripZonePx),t.setHoveredTube(S===null&&t.layoutResult?.tubeMap?t.tubeAt(v,x):null),t.setHoveredEdge(S||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(v,x))}})}function q(){w.current.frame||(w.current.frame=requestAnimationFrame(xn))}function Sn(){let i=w.current;cancelAnimationFrame(i.frame),i.frame=0,i.pan=null,i.hover=null,i.pinch=!1}function kn(i){let h=l.current;if(s.current&&h.has(i.pointerId)){h.set(i.pointerId,j(i)),w.current.pinch=!0,q();return}if(p(i)||y.current)return;let g=i.clientX-e.current.x,b=i.clientY-e.current.y;e.current={x:i.clientX,y:i.clientY},Math.hypot(i.clientX-o.current.x,i.clientY-o.current.y)>hn&&(r.current=!0);let v=w.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,b/t.scaleY);else if(t.isPanning)v.pan={dx:(v.pan?.dx??0)+g,dy:(v.pan?.dy??0)+b},q();else{let x=i.currentTarget.getBoundingClientRect();v.hover={x:i.clientX-x.left,y:i.clientY-x.top},q()}}function pe(i){let h=l.current;if(s.current&&h.has(i.pointerId)){w.current.pinch&&(w.current.pinch=!1,Ce()),h.delete(i.pointerId),s.current=null;let[[g,b]]=[...h];a.current=g,e.current=b;return}p(i)||(a.current=void 0,h.clear(),I(t)&&t.stopDragging())}function Mn(i){p(i)||(F(void 0),B(!1),y.current?w.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,Sn(),I(t)&&t.stopDragging()),I(t)&&t.clearHover())}function Pn(i){let{x:h,y:g}=V(i),b=R(h,g),{clientX:v,clientY:x}=i;if(b){i.preventDefault(),N({clientX:v,clientY:x,nodeId:b});return}let M=t.walkRowAt(h,g);M!==void 0&&(i.preventDefault(),N({clientX:v,clientY:x,row:M}))}function Rn(i){if(!r.current){let{x:h,y:g}=V(i),b=R(h,g);t.setSelectedNode(b),b&&t.showNodeDetails(b)}}G(()=>()=>{y.current?.end()},[]);function Cn(i){if(i.button!==0||t.hostPlacesX||t.followsHostView||!(i.target instanceof Element)||!i.target.closest(`[${vt}]`))return;y.current?.end(),u.current=!1,m.current=!1;let h=i.pointerId,g=j(i),b=g,v={moved:!1,end:()=>{window.removeEventListener("pointermove",x,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",M,!0),v.moved&&I(t)&&t.stopDragging()}};function x(S){if(S.pointerId!==h)return;if(!v.moved){if(Math.hypot(S.clientX-g.x,S.clientY-g.y)<=hn)return;v.moved=!0,t.setPanning(!0)}let ue=w.current;ue.pan={dx:(ue.pan?.dx??0)+S.clientX-b.x,dy:(ue.pan?.dy??0)+S.clientY-b.y},b=j(S),q()}function M(S){S.pointerId===h&&(v.end(),setTimeout(()=>{y.current===v&&(y.current=null)},0))}y.current=v,window.addEventListener("pointermove",x,!0),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",M,!0)}function Ln(i){y.current?.moved&&(y.current=null,i.stopPropagation())}let In={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},En=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[Re]:"",onMouseDown:i=>{i.stopPropagation()}}:{};return{canvasStyle:In,surfaceProps:En,handlers:{onMouseDown:vn,onPointerDown:wn,onPointerMove:kn,onPointerUp:pe,onPointerCancel:pe,onLostPointerCapture:pe,onPointerLeave:Mn,onClick:Rn,onContextMenu:Pn},contextMenu:E,hoveredChip:U,labelHandlers:{onPointerDown:Cn,onClickCapture:Ln},closeContextMenu:()=>{N(void 0)}}}var Eo={position:"relative"},Go={position:"relative",lineHeight:0,isolation:"isolate"},To={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Ho={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},No={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Ao=f(function({model:e}){return n(k,{children:e.visibleRowLabels.map(({label:o,y:r,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...No,top:a},children:o},r))})}),_o={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},zo={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Bo=f(function({model:e,children:o}){let r=C(null),a=e.legendAtRest,p=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Nt(e)))},[e]),G(()=>{let l=r.current;if(!l||!a)return;let c=new ResizeObserver(()=>{s()}),s=()=>{for(let u of l.children)c.observe(u);I(e)&&e.legendAtRest&&e.setLegendSize({width:l.offsetWidth,height:l.scrollHeight},p)};return c.observe(l),s(),()=>{c.disconnect()}},[e,a,p]),d("div",{ref:r,style:{..._o,top:ne+e.referenceStripZonePx,right:ne,maxHeight:e.canvasHeight-2*ne-e.referenceStripZonePx},children:[o,n(Ft,{model:e,sections:At(e)})]})}),Oo=f(function({model:e}){return n(k,{children:e.overlayLabels.sizes.map(({key:o,node:r,text:a,x:p,y:l})=>n("div",{"data-testid":"graph-size-label",style:{...zo,left:p,top:l,opacity:e.nodeFaded(r)?Rt:void 0},children:a},o))})}),bn=f(function({model:e,handle:{canvasRef:o,canvas:r},ownChrome:a}){let{handlers:p,canvasStyle:l,surfaceProps:c,labelHandlers:s,contextMenu:u,closeContextMenu:y,hoveredChip:m}=yn(e),[w,E]=L(null);gn(w,r,e);let N=e.facetPanels!==void 0;return d("div",{style:Eo,...c,children:[a?n(on,{model:e}):null,d("div",{ref:E,style:Go,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...To,top:e.referenceStripZonePx,background:te}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...p}),N?n(Vt,{model:e,handlers:p,canvasStyle:l,controls:a?null:d(k,{children:[n(Me,{model:e,inline:!0}),n(Se,{model:e,inline:!0})]})}):d(k,{children:[n(zt,{model:e}),n(Xt,{model:e}),n(_t,{model:e}),n(kt,{model:e}),n(Ao,{model:e}),n(Oo,{model:e}),n(St,{model:e}),n(Pt,{model:e}),n(Lt,{model:e}),n(Bt,{model:e}),n(un,{model:e}),n(Bo,{model:e,children:a?null:d(k,{children:[n(Me,{model:e}),n(Se,{model:e})]})})]}),a?n("div",{style:Ho,children:n(Ne,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(rn,{model:e,chip:m})]}),n(cn,{model:e}),e.walkStripShown?n(pn,{model:e}):null,n(ce,{model:e,at:u,onClose:y}),a?.renderError?n(de,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(de,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Wo=f(function({model:e}){let{canvasRef:o,canvas:r,error:a,retry:p}=Dt(Wt,e);return n(bn,{model:e,handle:{canvasRef:o,canvas:r},ownChrome:{renderError:a,retryRender:p}})}),Do=f(function({model:e,handle:o}){return o?n(bn,{model:e,handle:o}):n(Wo,{model:e})}),gl=Do;export{Wt as a,gl as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as W,b as bt}from"./chunk-S4BXLNAH.js";import{A as zt,B as Bt,C as X,D as re,E as Ot,F as K,G as ve,H as ae,a as vt,b as wt,c as xt,d as St,f as kt,g as Mt,h as D,i as Pt,j as Rt,k as Ct,l as Lt,n as It,o as Et,p as be,q as Gt,r as Tt,s as Ht,t as Nt,u as At,w as oe,y as _t}from"./chunk-6T2VBP7Z.js";import{$ as ye,B as rt,C as st,E as lt,F as ct,G as pt,H as ut,I as dt,J as ft,X as mt,Y as gt,a as P,ba as yt,c as je,f as Qe,g as et,p as ot}from"./chunk-5RK2OJEU.js";import{q as H}from"./chunk-NZ7YFVK4.js";import{Ba as ge,Hb as ne,Ia as te,K as me,Ma as Ue,Oa as qe,Pb as $,Qb as tt,Rb as nt,Sb as at,T as Ze,Tb as it,Za as Je,_ as $e,a as Y,ac as _,b as Ge,d as Te,fa as Ke,gd as ht}from"./chunk-PZGI7L73.js";import{v as Ye}from"./chunk-LOT3BKM3.js";import{R as fe,V as he}from"./chunk-6GJELLIC.js";import{c as Ie}from"./chunk-GZROPRBI.js";import{x as Le}from"./chunk-5VZ5HRTH.js";import{d as I}from"./chunk-WKD7ALOU.js";import{C as Ee}from"./chunk-KGAZZNZC.js";import{j as J}from"./chunk-5L276I7O.js";import{a as Xe,e as G,f as Fe,g as Ve,h as C,i as L}from"./chunk-J2PN6CG3.js";import{A as We,E as De,H as ee,I as Z,b as O,c as He,e as de,k as Ne,o as Ae,p as _e,t as ze,w as Q,x as Be,z as Oe}from"./chunk-H42TSPVA.js";import{a as k,b as n,c as d,d as f}from"./chunk-DUU6T2I5.js";function Wt(t){return Promise.resolve(new _(t))}var z=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],Gn=t=>z!=null&&t in Object(z)?z[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Dt=Gn("useRenderingBackend"),Yo=z&&z.__esModule?z.default:z;var we=wt(1),Xt=f(function({model:e}){let[o,r]=L(null);return G(()=>{if(!o)return;let a=new _(o),p=Y(()=>{Je(ht()),a.resize(e.paneWidth,e.canvasHeight),e.paintHover(a,e.drawnBatch)});return()=>{p(),a.dispose()}},[o,e]),n("canvas",{ref:r,"data-testid":"graph-hover-layer",style:{...we,clipPath:e.drawingClip}})});var ie=f(function({row:e,at:o,hint:r,after:a,column:p}){let l=p===void 0?void 0:{paddingLeft:p+5};return e.swatch?d("div",{title:[e.title,r].filter(Boolean).join(" \xB7 ")||void 0,children:[d("div",{style:re,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:p},children:n(oe,{swatch:e.swatch})}),d("span",{children:[e.strong?n("strong",{children:e.strong}):null,e.label]}),e.sizer===void 0?null:d("span",{style:Tn,children:[n("span",{style:Hn,"aria-hidden":!0,"data-testid":"graph-key-sizer",children:be(e.sizer)}),n("span",{style:Nn,"data-testid":"graph-key-count",children:be(e.count)})]}),a]}),o?n("div",{style:l,"data-testid":"graph-walk-at",children:o}):e.under?n("div",{style:l,children:e.under}):null]}):n("div",{style:Ot,children:e.label})}),Tn={display:"grid"},Hn={gridArea:"1 / 1",visibility:"hidden"},Nn={gridArea:"1 / 1",width:0,minWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},An={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},Ft=f(function({model:e,sections:o}){if(o.length===0)return null;let r=o.flatMap(l=>l.rows),a=Et(r),p=It(r);return n("div",{style:{...X,lineHeight:`${a}px`},children:o.map(({testid:l,rows:c,heading:s,spaced:u},y)=>d(Xe,{children:[s?n("div",{style:{...ae,paddingTop:y===0?0:ve},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ve}:void 0,children:c.map(m=>n(ie,{row:m,column:p,at:m.walk?e.hoveredOn(m.walk):void 0,after:m.closesBubble?n("button",{type:"button",style:An,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},m.key))})]},l))})});var _n={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:at,lineHeight:"normal"},zn={height:it,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},Bn={position:"relative"},On={gridColumn:"1 / -1",height:gt,padding:"2px 6px",boxSizing:"border-box",display:"flex",alignItems:"center",gap:14,fontSize:11,lineHeight:"15px"},Wn={display:"flex",gap:14,marginLeft:"auto"},Dn=f(function({model:e,lift:o,index:r,width:a,height:p,cell:l,handlers:c,canvasStyle:s}){let[u,y]=L(null),[m,w]=L(null),E=o.walks[0];G(()=>{if(!u||!m)return;let A=new _(u),B=new _(m),U=Ge(()=>e.facetDrawings?.[r]),F,V=[Y(()=>{let R=e.facetGrid;R&&A.resize(R.width,R.height);let T=U.get();T&&(T!==F&&(A.uploadGeometry(T.batch),F=T),e.applySelection(A),e.paint(A))}),Y(()=>{let R=e.facetGrid;R&&B.resize(R.width,R.height);let T=U.get();T&&e.paintHover(B,T.batch)})];return()=>{for(let R of V)R();A.dispose(),B.dispose()}},[u,m,e,r]);let N=e.walkLabel(E.name);return d("div",{style:l,children:[n("button",{type:"button",style:zn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([E.name]),e.setFacet("")},children:n(ie,{row:Tt(e,E),hint:`click to lift ${N} alone`,at:e.hoveredOn(E)})}),d("div",{style:Bn,children:[n("canvas",{ref:y,"data-testid":"graph-facet-canvas",style:{...s,width:a,height:p,display:"block"},...c}),n("canvas",{ref:w,style:we})]})]})}),Xn=f(function({model:e,handlers:o,canvasStyle:r,controls:a}){let p=e.facetPanels,l=e.facetGrid,c=e.facetPlacement;if(!p||!l||!c)return null;let{columns:s,width:u,height:y}=l;return d("div",{"data-testid":"graph-facet-panels",style:{..._n,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${s}, ${u}px)`,background:te},children:[p.map((m,w)=>n(Dn,{model:e,lift:m,index:w,width:u,height:y,cell:{gridRow:Math.floor(c.cells[w]/s)+1,gridColumn:c.cells[w]%s+1},handlers:o,canvasStyle:r},m.walks[0].name)),d("div",{style:{...On,gridRow:Math.floor(c.cells.reduce((m,w)=>Math.max(m,w),-1/0)/s)+2},"data-testid":"graph-facet-key",children:[Ht(e).map(m=>n(ie,{row:m},m.key)),a?n("span",{style:Wn,children:a}):null]})]})}),Vt=Xn;var Yt=P(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Zt=P([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var $t=P(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var Fn=f(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:rt.map(({value:r})=>({value:r,label:e.colorSchemeLabel(r)})),testId:"graph-color-select",onChange:r=>{e.setColorScheme(r)}})}),Kt=Fn;var jt=H()(t=>({stats:{marginLeft:"auto"},perf:{color:t.palette.text.secondary,fontVariantNumeric:"tabular-nums"}}));function xe(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Vn=f(function({model:e}){let{classes:o}=jt(),{lastFetchMs:r,lastLayoutMs:a,lastGeometryMs:p}=e,l=r!==void 0||a!==void 0||p!==void 0;return e.showPerf&&l?d(Z,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",xe(r)," \xB7 layout ",xe(a)," \xB7 geom"," ",xe(p)]}):null}),Yn=f(function({model:e}){let{classes:o}=jt();return d("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[d(Z,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Vn,{model:e})]})}),Ut=Yn;var Zn=f(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:je.map(({value:r,label:a,description:p,available:l})=>({value:r,label:a,description:p,disabled:o?!l(o):!1})),onChange:r=>{e.switchLayout(r)}})}),qt=Zn;var $n=f(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),Jt=$n;var Qt=P(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var en=P(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Kn=f(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(O,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:Qe,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),...e.linksMenuItems(),{label:"Show",icon:st,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:et,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{J(e).queueDialog(r=>[bt,{model:e,onClose:r}])}},{type:"divider"},{label:"Close graph",icon:Qt,onClick:()=>{e.clearGraph()}}],children:n(en,{})})}),tn=Kn;var jn=H()({formControl:{minWidth:130,maxWidth:260}}),Un=f(function({model:e}){let{classes:o}=jn(),r=Fe(),{walkChoices:a}=e;if(a.length===0||!e.liftsWalks)return null;let p=new Set(a.map(s=>s.name)),l=new Map(a.map(s=>[s.name,s.label])),c=e.walkLayers.map(s=>s.walk).filter(s=>p.has(s));return a.length>qe?n(Ae,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{J(e).queueDialog(s=>[Ue,{model:e,onClose:s}])},children:c.length>0?`${c.length} of ${a.length} haplotypes`:"Highlight haplotypes..."}):d(ze,{size:"small",className:o.formControl,children:[n(Be,{id:r,children:"Highlight"}),n(De,{labelId:r,multiple:!0,value:c,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:a.map(({name:s,label:u})=>d(We,{value:s,dense:!0,children:[n(_e,{size:"small",checked:c.includes(s)}),n(Oe,{primary:u})]},s))})]})}),nn=Un;var qn=H()(t=>({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:`1px solid ${t.palette.divider}`}})),Jn=f(function({model:e}){return n(Z,{variant:"body2",children:e.zoomPercent})}),Qn=f(function({model:e}){let{classes:o}=qn(),r=a=>{e.zoom(a,e.viewBox.width/2,e.viewBox.height/2)};return d("div",{className:o.toolbar,children:[n(qt,{model:e}),n(Kt,{model:e}),n(nn,{model:e}),n(Jt,{model:e}),n(ee,{title:"Zoom in",children:n(Q,{size:"small",onClick:()=>{r(1.5)},children:n(Zt,{})})}),n(ee,{title:"Zoom out",children:n(Q,{size:"small",onClick:()=>{r(1/1.5)},children:n($t,{})})}),n(ee,{title:"Zoom to fit",children:n(Q,{size:"small",onClick:()=>{e.refitView()},children:n(Yt,{})})}),n(Jn,{model:e}),n(Ut,{model:e}),n(tn,{model:e})]})}),on=Qn;var eo="#1c1c22",to="#eef1f3",no="#1a56c4",se=H()({row:{...X,display:"flex",alignItems:"center",gap:6,color:eo},inline:{padding:0,background:"none"},heading:ae,joined:{display:"flex","& > button + button":{marginLeft:-1},"& > button:first-of-type":{borderRadius:"3px 0 0 3px"},"& > button:last-of-type":{borderRadius:"0 3px 3px 0"}},button:{display:"flex",alignItems:"center",gap:4,font:"inherit",color:"inherit",background:X.background,border:`1px solid ${K}`,borderRadius:3,padding:"0 6px",cursor:"pointer","&:hover":{background:to},"&:disabled":{color:K,cursor:"default"},"&:focus-visible":{outline:`2px solid ${no}`,outlineOffset:1,position:"relative",zIndex:1}},on:{color:X.background,background:K,"&:hover":{background:K}}}),le=f(function(e){return n("button",{type:"button",...e})});var oo=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),{walkChoices:p}=e,l=e.walkLayers.filter(c=>p.some(s=>s.name===c.walk)).length;return e.highlightMenuItems().length>0?d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Haplotypes","data-testid":"graph-haplotype-switch",children:[n("span",{className:r.heading,children:"Haplotypes"}),d(O,{ButtonComponent:le,menuItems:()=>e.highlightMenuItems(),className:a(r.button,l>0&&r.on),title:"Highlight haplotypes","aria-haspopup":"menu",children:[n("span",{children:l>0?`${l} of ${p.length}`:"highlight"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]}):null}),Se=oo;var ro={position:"absolute",bottom:mt,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function ke({label:t,readout:e}){return d(k,{children:[n("strong",{children:t})," \u2014 ",e]})}function ao(t,e){if(e)return{testId:"graph-chip-tooltip",body:ke(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=nt(o),c=t.hoverDrawing?.members.get(o.id),s=ot(o),u=t.graphRegion,y=t.hoveredSpan,m=u&&y&&!Le(o)?`${u.assemblyName} ${$({refName:u.refName,...y})}`:void 0,w=me(t.genePins,o.id),E=w.length>0?d(k,{children:[n("br",{}),n("em",{children:w.join(", ")})]}):null;return l?{body:d(k,{children:[l,E]})}:{body:d(k,{children:[n("strong",{children:o.name}),c?` and ${c.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),s?d(k,{children:[n("br",{}),s.sample," ",$(s)," (rank ",o.stable?.rank,")"]}):null,m?d(k,{children:[n("br",{}),"Reference ",m]}):null,E,o.moved?d(k,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let r=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(r){let l=tt(r,t.deletions.find(s=>s.edgeIndex===t.hoveredEdge),s=>t.nodeById?.get(s)?.name??s),c=t.graph?Ie(t.graph):void 0;return{body:l.deletion?d(k,{children:[`skips ${l.deletion.bp} of ${c??"the reference"} sequence`,n("br",{}),l.deletion.where]}):d(k,{children:["Edge: ",l.ends]})}}let a=t.hoveredWalkRowText;if(a)return{testId:"graph-walk-row-tooltip",body:ke(a)};let p=t.hoveredTubeText;return p?{testId:"graph-tube-tooltip",body:ke(p)}:void 0}var io=f(function({model:e,chip:o}){let r=ao(e,o);return r?n("div",{style:{...ro,right:e.tooltipRightPx},"data-testid":r.testId,children:r.body}):null}),rn=io;var so=f(function({model:e,inline:o=!1}){let{classes:r,cx:a}=se(),p=e.forceEngineRows(),l=!p.some(c=>c.row.checked);return d("div",{className:a(r.row,o&&r.inline),role:"group","aria-label":"Layout","data-testid":"graph-layout-switch",children:[n("span",{className:r.heading,children:"Layout"}),n("span",{className:r.joined,children:p.map(({name:c,about:s,row:u})=>n("button",{type:"button",className:a(r.button,u.checked&&r.on),"aria-pressed":u.checked,disabled:u.disabled,title:u.disabled?u.disabledHelpText:`${u.label}. ${s}`,onClick:u.onClick,children:c},c))}),d(O,{ButtonComponent:le,menuItems:()=>e.layoutMenuItems(),className:a(r.button,l&&r.on),title:"Every layout","aria-haspopup":"menu",children:[n("span",{children:l?e.layoutLabel():"more"}),n("span",{"aria-hidden":!0,children:"\u25BE"})]})]})}),Me=so;var an=P(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var sn=P(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var ln=P(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var lo={x:0,y:0};function co(t,e){let{own:o,reference:r,highlight:a}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:ln,onClick:()=>{t.showNodeDetails(e)}},...yt({own:o,reference:r,highlight:a,onShowLinear:p=>{t.showInLinearView(p)},onHighlight:t.canHighlightInLinearView?p=>{t.highlightInLinearView(p)}:void 0})]}function po(t,e,o){let r=o??t.walkRowBars,a=t.walkRowLaunchTarget(e,r),p=a?.assembly,l=e>0?r?.rows[e-1]:void 0,c=l?.sample,s=t.abridged.find(m=>m.name===l?.name),u=!o&&t.walkRowBars,y=t.walkRowSamples;return[a&&p?{label:`Linear genome view \u2014 ${p} ${$(a.location)}`,icon:ye,onClick:()=>{t.showInLinearView({location:a.location,assembly:p})}}:{label:"Linear genome view",icon:ye,disabled:!0,disabledHelpText:a?`No assembly in this session is ${a.location.haplotype??a.label}`:"This walk states no contig coordinates",onClick:()=>{}},...o&&l&&s?[{label:"Load its steps",subLabel:Ee(s,l.label),onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...u&&c&&!(y?.length===1&&y[0]===c)?[{label:`Show only ${c}`,icon:an,onClick:()=>{t.setWalkRowSamples([c])}}]:[],...u&&y?[{label:"Show every sample",icon:sn,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}var ce=f(function({model:e,at:o,onClose:r}){return n(He,{anchor:o,offset:lo,onClose:r,menuItems:()=>o===void 0?[]:"nodeId"in o?co(e,o.nodeId):po(e,o.row,o.bars)})});var uo=f(function({model:e}){return n(k,{children:e.passBars.map(o=>n("svg",{"data-testid":"graph-pass-bar",width:e.paneWidth,height:dt,style:{display:"block",borderTop:"1px solid #ddd"},children:n(D,{el:ft(o,e.walkLabel(o.walk),e.paneWidth)})},o.walk))})}),cn=uo;var fo={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},ho={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},mo=f(function({bars:e,frame:o,ramp:r,rowGenes:a,inks:p}){let l=Mt(),c=Ve(()=>Ke(e,o,{ramp:r,rowGenes:a,idPrefix:l,markUnloaded:!0,inks:p}),[e,o,r,a,l,p]);return n(D,{el:c})}),go=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,a=e.stripHover,p=o?[o.reference,...o.rows]:[],l=a?p.findIndex(m=>m.name===a.row):-1,c=p[l],s=o&&r&&c?Ze(o,l,r):void 0;if(!o||!r||!a||!c||!s||r.labelled&&!s.cut)return null;let u=(o.origin+a.offset)*r.scaleX+r.translateX,y=u>r.width/2?{right:r.width-u+12}:{left:u+12};return d("div",{"data-testid":"graph-walk-strip-tip",style:{...ho,...y,top:l*r.rowPx+r.translateY-18},children:[c.label," \xB7 ",s.text]})}),yo=f(function({model:e,bars:o,frame:r}){return n(D,{el:ct(o,r,e.walkStripMarks)})}),bo=f(function({model:e}){let o=e.walkStripRows,r=e.walkStripFrame,[a,p]=L();if(!o||!r)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return lt(o,r,s.clientX-u.left,s.clientY-u.top)},c=$e(o,{ramp:e.referenceRampDomain,rampCss:Ye,genes:ut(r,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation,markUnloaded:!0,inks:e.walkStripInks});return d("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[d("svg",{width:r.width,height:r.height,style:{display:"block"},onMouseLeave:()=>{I(e)&&e.setStripHover(null)},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),p({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(mo,{bars:o,frame:r,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,inks:e.walkStripInks}),n(yo,{model:e,bars:o,frame:r}),n(D,{el:pt(o,r,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(go,{model:e}),d("div",{style:fo,"data-testid":"graph-walk-strip-key",children:[c.map(s=>d("div",{style:re,children:[n(oe,{swatch:Gt(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(ce,{model:e,at:a&&{...a,bars:o},onClose:()=>{p(void 0)}})]})}),pn=bo;var vo=f(function({model:e}){let o=e.walkStripLocator;return o?d(xt,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),un=vo;var wo=1.1,xo=100,So=40,ko=800,Mo=10,dn=2;function Pe(t){let e=t.deltaY*(t.deltaMode===1?So:t.deltaMode===2?ko:1),o=(t.ctrlKey?Mo:1)*e/xo;return wo**-Math.max(-dn,Math.min(dn,o))}var Po=40,Ro=100,Co=24,fn=Math.log(16);function Lo(t,e){let o=t*Math.exp(-Math.max(0,e)/Co);return Math.abs(o)<.001?t:t-o}function Io(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function gn(t,e,o){G(()=>{if(!t)return;let r=-1/0,a={backlog:0,x:0,y:0,frame:0,last:0},p=c=>{let s=Lo(a.backlog,Math.min(100,c-a.last));a.backlog-=s,a.last=c,a.frame=a.backlog?requestAnimationFrame(p):0,I(o)&&o.zoom(Math.exp(s),a.x,a.y)},l=c=>{if(o.hostPlacesX||o.followsHostView)return;let y=((c.target instanceof Element?c.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(y&&c.clientY-y.top<o.referenceStripZonePx)return;let m=Io(c,o.host);if(m!=="page"){if(o.host&&c.stopPropagation(),c.preventDefault(),m==="pan"){if(c.timeStamp-r>Ro){let w=c.deltaMode===1?Po:1;o.setTransform(o.scale,o.translateX-c.deltaX*w,o.translateY)}return}r=c.timeStamp,y&&(a.x=c.clientX-y.left,a.y=c.clientY-y.top,a.backlog=Math.max(-fn,Math.min(fn,a.backlog+Math.log(Pe(c)))),a.frame||(a.last=performance.now()-1e3/60,a.frame=requestAnimationFrame(p)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(a.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var hn=3,Re="data-gesture-owner",j=t=>({x:t.clientX,y:t.clientY});function mn(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function yn(t){let e=C({x:0,y:0}),o=C({x:0,y:0}),r=C(!1),a=C(void 0),p=i=>a.current!==void 0&&i.pointerId!==a.current,l=C(new Map),c=C(null),s=C(null),u=C(!1),y=C(null),m=C(!1),w=C({frame:0,pan:null,hover:null,pinch:!1});G(()=>()=>{cancelAnimationFrame(w.current.frame)},[]);let[E,N]=L(),[A,B]=L(!1),[U,F]=L(void 0);function V(i){let h=i.currentTarget.getBoundingClientRect();return{x:i.clientX-h.left,y:i.clientY-h.top}}function R(i,h){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(i,h);let g=t.referenceStripNodeAt(i,h);if(g)return g;let{nodePositions:b}=t;if(!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return fe(b,v,x,t.axisScale,t.positionsVersion,t.nodeInk,t.drawnFold)}function T(i,h){let{nodePositions:g,graph:b}=t;if(!g||!b)return null;let{x:v,y:x}=ge(i,h,t,t.axisScale);return he(g,b,v,x,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded,t.drawnFold)}function vn(i){i.button===0&&i.preventDefault()}function wn(i){if(i.button!==0)return;let h=l.current;if(p(i)){t.isPanning&&!m.current&&i.pointerType==="touch"&&h.size===1&&(i.currentTarget.setPointerCapture(i.pointerId),h.set(i.pointerId,j(i)),s.current=mn(h),r.current=!0);return}r.current=!1,o.current={x:i.clientX,y:i.clientY},i.currentTarget.removeAttribute(Re);let g=t.followsHostView,{x:b,y:v}=V(i),x=v<t.referenceStripZonePx,M=t.hostPlacesX||t.layoutResult?.tubeMap||x?null:R(b,v);t.hostPlacesX||g&&i.shiftKey||t.followsWindow&&!M||(i.currentTarget.setPointerCapture(i.pointerId),a.current=i.pointerId,c.current=i.currentTarget,h.clear(),h.set(i.pointerId,j(i)),g&&M&&i.currentTarget.setAttribute(Re,""),m.current=g,u.current=x&&!g,M?t.setDraggingNode(M):t.setPanning(!0),e.current={x:i.clientX,y:i.clientY})}function Ce(){let i=s.current,h=c.current;if(!i||!h)return;let g=mn(l.current),b=h.getBoundingClientRect();i.spread>0&&g.spread>0&&t.zoom(g.spread/i.spread,i.mid.x-b.left,i.mid.y-b.top),t.setTransform(t.scale,t.translateX+g.mid.x-i.mid.x,t.translateY+g.mid.y-i.mid.y),s.current=g}function xn(){let i=w.current,{pan:h,hover:g,pinch:b}=i;if(i.frame=0,i.pan=null,i.hover=null,i.pinch=!1,b&&Ce(),h&&u.current?t.host?.horizontalScroll(-h.dx):h&&m.current?t.setTransform(t.scale,t.translateX,t.translateY+h.dy):h&&t.setTransform(t.scale,t.translateX+h.dx,t.translateY+h.dy),!g)return;let{x:v,y:x}=g,M=t.facetPanels?void 0:Ct(t.overlayLabels,v,x);F(S=>S?.label===M?.label&&S?.readout===M?.readout?S:M),Te(()=>{if(t.walkRowBars){let S=t.walkRowAt(v,x);t.setHoveredWalkRow(S===void 0?null:t.walkRowList[S].name)}if(t.nodePositions&&t.graph){let S=R(v,x);t.setHoveredPanel(t.tubeMapPanelAt(x)),t.setHoveredNode(S,{x:v,y:x}),B(S!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&x>=t.referenceStripZonePx),t.setHoveredTube(S===null&&t.layoutResult?.tubeMap?t.tubeAt(v,x):null),t.setHoveredEdge(S||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:T(v,x))}})}function q(){w.current.frame||(w.current.frame=requestAnimationFrame(xn))}function Sn(){let i=w.current;cancelAnimationFrame(i.frame),i.frame=0,i.pan=null,i.hover=null,i.pinch=!1}function kn(i){let h=l.current;if(s.current&&h.has(i.pointerId)){h.set(i.pointerId,j(i)),w.current.pinch=!0,q();return}if(p(i)||y.current)return;let g=i.clientX-e.current.x,b=i.clientY-e.current.y;e.current={x:i.clientX,y:i.clientY},Math.hypot(i.clientX-o.current.x,i.clientY-o.current.y)>hn&&(r.current=!0);let v=w.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,b/t.scaleY);else if(t.isPanning)v.pan={dx:(v.pan?.dx??0)+g,dy:(v.pan?.dy??0)+b},q();else{let x=i.currentTarget.getBoundingClientRect();v.hover={x:i.clientX-x.left,y:i.clientY-x.top},q()}}function pe(i){let h=l.current;if(s.current&&h.has(i.pointerId)){w.current.pinch&&(w.current.pinch=!1,Ce()),h.delete(i.pointerId),s.current=null;let[[g,b]]=[...h];a.current=g,e.current=b;return}p(i)||(a.current=void 0,h.clear(),I(t)&&t.stopDragging())}function Mn(i){p(i)||(F(void 0),B(!1),y.current?w.current.hover=null:(a.current=void 0,l.current.clear(),s.current=null,Sn(),I(t)&&t.stopDragging()),I(t)&&t.clearHover())}function Pn(i){let{x:h,y:g}=V(i),b=R(h,g),{clientX:v,clientY:x}=i;if(b){i.preventDefault(),N({clientX:v,clientY:x,nodeId:b});return}let M=t.walkRowAt(h,g);M!==void 0&&(i.preventDefault(),N({clientX:v,clientY:x,row:M}))}function Rn(i){if(!r.current){let{x:h,y:g}=V(i),b=R(h,g);t.setSelectedNode(b),b&&t.showNodeDetails(b)}}G(()=>()=>{y.current?.end()},[]);function Cn(i){if(i.button!==0||t.hostPlacesX||t.followsHostView||!(i.target instanceof Element)||!i.target.closest(`[${vt}]`))return;y.current?.end(),u.current=!1,m.current=!1;let h=i.pointerId,g=j(i),b=g,v={moved:!1,end:()=>{window.removeEventListener("pointermove",x,!0),window.removeEventListener("pointerup",M,!0),window.removeEventListener("pointercancel",M,!0),v.moved&&I(t)&&t.stopDragging()}};function x(S){if(S.pointerId!==h)return;if(!v.moved){if(Math.hypot(S.clientX-g.x,S.clientY-g.y)<=hn)return;v.moved=!0,t.setPanning(!0)}let ue=w.current;ue.pan={dx:(ue.pan?.dx??0)+S.clientX-b.x,dy:(ue.pan?.dy??0)+S.clientY-b.y},b=j(S),q()}function M(S){S.pointerId===h&&(v.end(),setTimeout(()=>{y.current===v&&(y.current=null)},0))}y.current=v,window.addEventListener("pointermove",x,!0),window.addEventListener("pointerup",M,!0),window.addEventListener("pointercancel",M,!0)}function Ln(i){y.current?.moved&&(y.current=null,i.stopPropagation())}let In={cursor:t.isPanning||t.draggingNode?"grabbing":A?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},En=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[Re]:"",onMouseDown:i=>{i.stopPropagation()}}:{};return{canvasStyle:In,surfaceProps:En,handlers:{onMouseDown:vn,onPointerDown:wn,onPointerMove:kn,onPointerUp:pe,onPointerCancel:pe,onLostPointerCapture:pe,onPointerLeave:Mn,onClick:Rn,onContextMenu:Pn},contextMenu:E,hoveredChip:U,labelHandlers:{onPointerDown:Cn,onClickCapture:Ln},closeContextMenu:()=>{N(void 0)}}}var Eo={position:"relative"},Go={position:"relative",lineHeight:0,isolation:"isolate"},To={position:"absolute",left:0,right:0,bottom:0,zIndex:0},Ho={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},No={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},Ao=f(function({model:e}){return n(k,{children:e.visibleRowLabels.map(({label:o,y:r,top:a})=>n("div",{"data-testid":"graph-row-label",style:{...No,top:a},children:o},r))})}),_o={position:"absolute",display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},zo={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},Bo=f(function({model:e,children:o}){let r=C(null),a=e.legendAtRest,p=e.keyShape;return G(()=>{e.setKeyShapeOf(()=>JSON.stringify(Nt(e)))},[e]),G(()=>{let l=r.current;if(!l||!a)return;let c=new ResizeObserver(()=>{s()}),s=()=>{for(let u of l.children)c.observe(u);I(e)&&e.legendAtRest&&e.setLegendSize({width:l.offsetWidth,height:l.scrollHeight},p)};return c.observe(l),s(),()=>{c.disconnect()}},[e,a,p]),d("div",{ref:r,style:{..._o,top:ne+e.referenceStripZonePx,right:ne,maxHeight:e.canvasHeight-2*ne-e.referenceStripZonePx},children:[o,n(Ft,{model:e,sections:At(e)})]})}),Oo=f(function({model:e}){return n(k,{children:e.overlayLabels.sizes.map(({key:o,node:r,text:a,x:p,y:l})=>n("div",{"data-testid":"graph-size-label",style:{...zo,left:p,top:l,opacity:e.nodeFaded(r)?Rt:void 0},children:a},o))})}),bn=f(function({model:e,handle:{canvasRef:o,canvas:r},ownChrome:a}){let{handlers:p,canvasStyle:l,surfaceProps:c,labelHandlers:s,contextMenu:u,closeContextMenu:y,hoveredChip:m}=yn(e),[w,E]=L(null);gn(w,r,e);let N=e.facetPanels!==void 0;return d("div",{style:Eo,...c,children:[a?n(on,{model:e}):null,d("div",{ref:E,style:Go,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{I(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...To,top:e.referenceStripZonePx,background:te}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,clipPath:e.drawingClip,display:"block",position:"relative",zIndex:1},...p}),N?n(Vt,{model:e,handlers:p,canvasStyle:l,controls:a?null:d(k,{children:[n(Me,{model:e,inline:!0}),n(Se,{model:e,inline:!0})]})}):d(k,{children:[n(zt,{model:e}),n(Xt,{model:e}),n(_t,{model:e}),n(kt,{model:e}),n(Ao,{model:e}),n(Oo,{model:e}),n(St,{model:e}),n(Pt,{model:e}),n(Lt,{model:e}),n(Bt,{model:e}),n(un,{model:e}),n(Bo,{model:e,children:a?null:d(k,{children:[n(Me,{model:e}),n(Se,{model:e})]})})]}),a?n("div",{style:Ho,children:n(Ne,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(rn,{model:e,chip:m})]}),n(cn,{model:e}),e.walkStripShown?n(pn,{model:e}):null,n(ce,{model:e,at:u,onClose:y}),a?.renderError?n(de,{error:a.renderError,onReset:a.retryRender}):null,a&&e.error?n(de,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),Wo=f(function({model:e}){let{canvasRef:o,canvas:r,error:a,retry:p}=Dt(Wt,e);return n(bn,{model:e,handle:{canvasRef:o,canvas:r},ownChrome:{renderError:a,retryRender:p}})}),Do=f(function({model:e,handle:o}){return o?n(bn,{model:e,handle:o}):n(Wo,{model:e})}),gl=Do;export{Wt as a,gl as b};
|
|
2
|
+
//# sourceMappingURL=chunk-G7MXYOW5.js.map
|