jbrowse-plugin-graphgenomeviewer 8.3.7 → 8.3.8
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/{GbzBaseSyntenyAdapter-4FATZPZG.js → GbzBaseSyntenyAdapter-Z4U7CQ6T.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-4FATZPZG.js.map → GbzBaseSyntenyAdapter-Z4U7CQ6T.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-H2Z5NQW4.js → GraphGenomeView-SIOAXXAX.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-LFFJHC7F.js → GraphTrackSettingsDialog-ZSMGGYOZ.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-76RJSXSV.js → HighlightColorDialog-MS6UZ5QH.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-VYPF26DJ.js → LinearGraphDisplay-56NPMGFE.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-WQUZTNDM.js → MinigraphBubbleAdapter-XRQSSGO7.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-K763K62E.js → RgfaTabixAdapter-2CHBK2KR.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-WJTEKIOB.js → WalkFormsAdapter-5PVAUS7M.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-PHRULBP7.js → WalkTabixSyntenyAdapter-2SXFYW5W.js} +2 -2
- package/dist/chunks/{chunk-VEI7EAE6.js → chunk-32KSITI2.js} +2 -2
- package/dist/chunks/{chunk-XK4HHKSP.js → chunk-44DOTJB7.js} +2 -2
- package/dist/chunks/{chunk-HVDE2ZKA.js → chunk-4NUDB5AY.js} +1 -1
- package/dist/chunks/{chunk-HVDE2ZKA.js.map → chunk-4NUDB5AY.js.map} +1 -1
- package/dist/chunks/{chunk-47KLT4FL.js → chunk-7CZC4GOZ.js} +2 -2
- package/dist/chunks/{chunk-47KLT4FL.js.map → chunk-7CZC4GOZ.js.map} +1 -1
- package/dist/chunks/{chunk-6NR64IXK.js → chunk-AK6XQ7XZ.js} +1 -1
- package/dist/chunks/{chunk-6NR64IXK.js.map → chunk-AK6XQ7XZ.js.map} +1 -1
- package/dist/chunks/{chunk-PVRRW4PM.js → chunk-AZUO4NZ5.js} +2 -2
- package/dist/chunks/{chunk-PVRRW4PM.js.map → chunk-AZUO4NZ5.js.map} +1 -1
- package/dist/chunks/{chunk-75WJWJ45.js → chunk-BDBFDFIM.js} +2 -2
- package/dist/chunks/{chunk-75WJWJ45.js.map → chunk-BDBFDFIM.js.map} +1 -1
- package/dist/chunks/{chunk-CI6VQ2KV.js → chunk-FUKZO5AZ.js} +2 -2
- package/dist/chunks/{chunk-CI6VQ2KV.js.map → chunk-FUKZO5AZ.js.map} +1 -1
- package/dist/chunks/{chunk-477HYXB2.js → chunk-HPEC3JDC.js} +2 -2
- package/dist/chunks/{chunk-6YK4U5LT.js → chunk-JHUQMHCO.js} +3 -3
- package/dist/chunks/{chunk-6YK4U5LT.js.map → chunk-JHUQMHCO.js.map} +3 -3
- package/dist/chunks/{chunk-3M3UH5JQ.js → chunk-JKW2OX73.js} +1 -1
- package/dist/chunks/{chunk-3M3UH5JQ.js.map → chunk-JKW2OX73.js.map} +1 -1
- package/dist/chunks/{chunk-XTEZPFP4.js → chunk-LAOGU5VK.js} +2 -2
- package/dist/chunks/{chunk-XTEZPFP4.js.map → chunk-LAOGU5VK.js.map} +1 -1
- package/dist/chunks/chunk-LVRR7SZH.js +3 -0
- package/dist/chunks/chunk-LVRR7SZH.js.map +7 -0
- package/dist/chunks/{chunk-VZNECPSI.js → chunk-LYJ4FZFC.js} +2 -2
- package/dist/chunks/chunk-NB7ZUDO4.js +2 -0
- package/dist/chunks/{chunk-DFWLOMRU.js → chunk-P6WBR5MX.js} +2 -2
- package/dist/chunks/{chunk-AILGRHTE.js → chunk-QX7UU3CV.js} +2 -2
- package/dist/chunks/{chunk-AILGRHTE.js.map → chunk-QX7UU3CV.js.map} +1 -1
- package/dist/chunks/{chunk-SVF6WK42.js → chunk-VT5BHBO6.js} +2 -2
- package/dist/chunks/{chunk-SVF6WK42.js.map → chunk-VT5BHBO6.js.map} +1 -1
- package/dist/chunks/{chunk-IICQFAGJ.js → chunk-YGTSPKS5.js} +1 -1
- package/dist/chunks/{chunk-IICQFAGJ.js.map → chunk-YGTSPKS5.js.map} +1 -1
- package/dist/chunks/{chunk-UOWS2HEQ.js → chunk-YRAIRXY6.js} +2 -2
- package/dist/chunks/{chunk-UOWS2HEQ.js.map → chunk-YRAIRXY6.js.map} +3 -3
- package/dist/chunks/{renderSvg-W2VIM3IT.js → renderSvg-IZZ2QBWS.js} +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +2 -2
- package/package.json +2 -2
- package/src/GraphGenomeView/pane/walkRowViews.ts +3 -0
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-SQBD75UZ.js +0 -2
- package/dist/chunks/chunk-YDJ6SDQM.js +0 -3
- package/dist/chunks/chunk-YDJ6SDQM.js.map +0 -7
- /package/dist/chunks/{GraphGenomeView-H2Z5NQW4.js.map → GraphGenomeView-SIOAXXAX.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-LFFJHC7F.js.map → GraphTrackSettingsDialog-ZSMGGYOZ.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-76RJSXSV.js.map → HighlightColorDialog-MS6UZ5QH.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-VYPF26DJ.js.map → LinearGraphDisplay-56NPMGFE.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-WQUZTNDM.js.map → MinigraphBubbleAdapter-XRQSSGO7.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-K763K62E.js.map → RgfaTabixAdapter-2CHBK2KR.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-WJTEKIOB.js.map → WalkFormsAdapter-5PVAUS7M.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-PHRULBP7.js.map → WalkTabixSyntenyAdapter-2SXFYW5W.js.map} +0 -0
- /package/dist/chunks/{chunk-VEI7EAE6.js.map → chunk-32KSITI2.js.map} +0 -0
- /package/dist/chunks/{chunk-XK4HHKSP.js.map → chunk-44DOTJB7.js.map} +0 -0
- /package/dist/chunks/{chunk-477HYXB2.js.map → chunk-HPEC3JDC.js.map} +0 -0
- /package/dist/chunks/{chunk-VZNECPSI.js.map → chunk-LYJ4FZFC.js.map} +0 -0
- /package/dist/chunks/{chunk-SQBD75UZ.js.map → chunk-NB7ZUDO4.js.map} +0 -0
- /package/dist/chunks/{chunk-DFWLOMRU.js.map → chunk-P6WBR5MX.js.map} +0 -0
- /package/dist/chunks/{renderSvg-W2VIM3IT.js.map → renderSvg-IZZ2QBWS.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ab as de,Da as $e,Ea as Ke,Fa as Xe,Fb as Ze,Ga as Ue,Hb as G,Ib as be,Ja as Fe,Jb as fe,Na as Ye,Nb as Qe,Oa as ie,Pb as et,Ra as ze,Rb as tt,Tb as he,Ua as Ve,Va as le,Xb as nt,Za as ce,a as Se,ac as rt,b as X,da as Ie,db as qe,f as Q,g as ee,gc as ot,ic as at,jb as je,la as P,lb as pe,ma as ae,ob as Je,sa as Be,ta as We,ua as Ge,va as se,xa as De,ya as He,zb as ue}from"./chunk-YDJ6SDQM.js";import{D as oe,f as Oe,m as I,p as re,q as Ae,r as B}from"./chunk-AILGRHTE.js";import{A as Ee,E as ne,T as Ne,U as ve,Z as Te,m as A,o as F,p as te,x as _e}from"./chunk-CI6VQ2KV.js";import{b as E,c as W}from"./chunk-IICQFAGJ.js";import{c as Z}from"./chunk-47KLT4FL.js";import{e as K}from"./chunk-3WG3GF2A.js";import{b as Pe,d as M,e as Le,f as Me,g as U,h as Ce}from"./chunk-NIEZKWQV.js";import{a as v,b as u,c as k,d as m}from"./chunk-JMBDTNUR.js";var _t="data-pans-with-drawing";function st(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var C=m(function({model:t,zIndex:n,overflow:o="hidden",testId:r,pansWithDrawing:a,children:l}){return u("svg",{style:{...st(n,o),userSelect:a?"none":void 0},width:t.paneWidth,height:t.canvasHeight,"data-testid":r,...a?{[_t]:""}:{},children:l})}),it=m(function({model:t,children:n}){let{scaleX:o,scaleY:r,translateX:a,translateY:l}=t;return u("g",{transform:`translate(${a} ${l}) scale(${o} ${r})`,children:n})});function _({model:e,zIndex:t,shown:n=!0,testId:o,paint:r}){let a=Ce(null);return Le(()=>{if(n)return Se(()=>{let l=a.current,i=l?.getContext("2d");if(l&&i){let d=e.paneWidth,c=e.canvasHeight;Ie(at());let p=Ze(l,d,c);i.setTransform(p,0,0,p,0,0),i.clearRect(0,0,d,c),r(i,p)}})},[e,n,r]),u("canvas",{ref:a,"data-testid":n?o:void 0,style:{...st(t),display:n?"block":"none"}})}var Et=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:o}=t;if(n.length===0)return null;let r=t.contigThickness*Qe;return u(C,{model:t,zIndex:2,testId:"graph-bubble-halos",children:u(it,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||o&&E(a.bubble,o))).map(a=>u("path",{d:a.path,fill:"none",stroke:P[a.kind],strokeOpacity:o&&E(a.bubble,o)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},W(a.bubble)))})})}),Gn=Et;var lt=["#d4735e","#d8a94a","#c98aa4"],Ot="#e6e6e6",Nt="#555",vt="bold 11px sans-serif";var ge=e=>lt[e]??Ot;function Y(e){let t=String.fromCharCode(65+e%26);return e<26?t:Y(Math.floor(e/26)-1)+t}var z=lt.length;function ct(e,t,n){e.font=vt,e.textAlign="center",e.textBaseline="middle";for(let{row:o,start:r,bp:a,block:l}of t){let i=n.x(r),d=n.x(r+a)-i,c=n.rowCentre(o)-n.barPx/2;e.fillStyle=ge(l),e.fillRect(i,c,d,n.barPx),e.strokeStyle=Nt,e.lineWidth=1,e.strokeRect(i+.5,c+.5,d-1,n.barPx-1),d>=12&&n.barPx>=9&&(e.fillStyle="#111",e.fillText(Y(l),i+d/2,n.rowCentre(o)))}}var R=18,me=32,dt="rgba(160, 160, 160, 0.45)",At="#18181c",It=6,bt=7,Bt="#b8b8c0",V=We-4,Wt="rgba(119, 119, 119, 0.85)",Gt=15,pt=10;function j(e){return e.kind==="fill"?e.width??R:R}var ke=e=>e.length>1?3:4;function D(e){switch(e.kind){case"fill":return e.height??8;case"bands":return ke(e.bands)*e.bands.length;case"line":return 3;case"halo":case"overhang":return 10;case"outline":case"tick":return e.height;case"glyph":return 15;case"bracket":return 7;case"blank":return 0}}function Ar(e){return e.reduce((t,n)=>n.swatch?Math.max(t,j(n.swatch)):t,0)}function Ir(e){return e.reduce((t,n)=>n.swatch?Math.max(t,Math.ceil(D(n.swatch))+3):t,Gt)}var S=e=>[{offset:0,color:e}];function q(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:S(t),width:pt,height:pt,edged:!0}}}function ut(e){return e.flatMap((t,n)=>[{offset:n/e.length,color:t},{offset:(n+1)/e.length,color:t}])}function Dt(e){let t=e.openBubble;if(!t)return[];let n=e.bubbleHalos.find(o=>E(o.bubble,t));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:P[n.kind]}:{kind:"blank"},closesBubble:!0}]}function Ht(e){let t=e.walkLift?void 0:e.referenceRampDomain;if(!t)return[];let n=Math.round(t.start),o=Math.round(t.end);return[{key:"ramp",label:`position on ${e.graph?Z(e.graph):"reference"}`,swatch:{kind:"fill",stops:I,width:me},under:`${n.toLocaleString("en-US")}-${o.toLocaleString("en-US")} (${ne(o-n)})`},...e.referenceRampDrawsOffReference?[q("off",B,"off the reference")]:[]]}function $t(e){let t=e.walkLift;if(t)return t.walks.map(r=>oe(r.encoding));if(e.effectiveColorScheme==="reference-position")return[I];let n=e.referenceStripBlocks.map(r=>r.colors[0]).filter((r,a,l)=>r!==l[a-1]),o=Math.min(It,n.length);return[o===0?S(re):Array.from({length:o},(r,a)=>({offset:o>1?a/(o-1):0,color:n[o>1?Math.round(a*(n.length-1)/(o-1)):0]}))]}function Kt(e){if(!e.referenceStripShown)return[];let t=(e.walkLift?.walks.length??0)>1;return[{key:"strip",label:`reference${t?", a row per walk":""}`,swatch:{kind:"bands",bands:$t(e)}},...e.referenceStripFaded?[q("strip-faded",re,e.walkLift?`reference not on ${t?"that row's walk":e.liftedWalksLabel}`:"reference outside the open bubble")]:[],...e.referenceStripOverhangs?[{key:"overhang",label:"graph runs past this edge",swatch:{kind:"overhang"}}]:[]]}function Xt(e){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=P[n.kind],r=t.get(o)??new Set;r.add(ae[n.kind]),t.set(o,r)}return[...t].map(([n,o])=>{let r=[...o].join(" or ");return{key:`halo-${n}`,label:r===ae.superbubble?r:`${r} bubble`,swatch:{kind:"halo",color:n}}})}function ft(e){let{graph:t}=e;return t&&Ee(e.deletions,e.walkLift).length>0?[{key:"deletion",label:_e(Z(t)),swatch:{kind:"line",color:e.walkLift?dt:At,dashed:!0}}]:[]}function we(e,t,n,o){return{key:e,label:t,swatch:{kind:"fill",stops:S(o),width:me,height:n}}}var Ut=e=>e>=10?Math.round(e):Math.round(e*10)/10;function Ft(e){let{graph:t,contigThickness:n,depthRange:o}=e;if(!t||!e.drawsNodes||e.walkRowBars)return[];if(e.nodeWidth==="frequency"){let c=t.nodes.some(p=>p.frequency!==void 0);return Ne(n).map(({label:p,widthPx:b})=>we(`width-${p}`,c?`AF ${p}`:`${p} of haplotypes`,b,B))}if(e.nodeWidth!=="depth"||!o||o.min===o.max)return[];let r=t.paths?.length??0,a=r>0,l=[...new Set([o.max,o.mean,o.min].map(a?Math.round:Ut))],i=l[0]>r,d=c=>i?`${c.toLocaleString("en-US")} walk pass${c===1?"":"es"}`:`${c.toLocaleString("en-US")} walk${c===1?"":"s"}`;return l.map(c=>we(`width-${c}`,a?d(c):`depth ${c.toLocaleString("en-US")}`,ve({depth:c},n,"depth",o.mean),B))}function Yt(e){let t=e.busiestLink;return!e.drawsNodes||e.walkRowBars||e.linkWidth!=="walks"||t===0?[]:(t>1?[t,1]:[1]).map(o=>we(`link-width-${o}`,`${o.toLocaleString("en-US")} walk${o===1?"":"s"}`,e.connectorThickness*Te(o,t,"walks"),Wt))}function zt(e){return e.genePins.some(t=>t.exonsByNode.length>0)?[{key:"exon",label:"exon",swatch:{kind:"outline",color:G,stroke:2,radius:5,height:8}}]:[]}function Vt(e){let t=e.foldNote;return t?[{key:"fold",label:t}]:[]}function qt(e){return e.pathLegend.map(({name:t,label:n,color:o})=>({key:`path-${t}`,label:n,swatch:{kind:"line",color:o}}))}function O(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:t,height:bt,square:!0}}}function jt(e){let{roles:t,haplotypeTube:n,bundled:o,values:r,logWidths:a,foldBp:l,forwardReads:i,reverseReads:d,substitution:c,insertion:p,deletion:b}=e.tubeMapKeys,h=e.readsShown,s=[];if(r){s.push(O("value-reference",S(pe),"reference"));for(let{value:f,color:g}of r)s.push(O(`value-${f}`,S(g),f))}return t&&s.push(O("ref",S(pe),"reference"),O("hap",S(n),o?"shared route, \xD7n haplotypes":"haplotype")),i&&s.push(O("fwd",ut(Q),"read on the forward strand")),d&&s.push(O("rev",ut(ee),"read on the reverse strand")),h&&h.shown<h.total&&s.push({key:"sampled",label:`${h.shown.toLocaleString("en-US")} of ${h.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),c&&s.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),p&&s.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),b&&s.push(O("del",S("grey"),"read deletion")),l!==void 0&&s.push({key:"tube-fold",label:`haplotype variant < ${ne(l)}`,swatch:{kind:"tick",color:Ve(),height:bt,backing:Bt}}),a&&s.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),s}function Jt(e){return e.kind==="gene"?{kind:"outline",color:Be,stroke:1.5,radius:0,height:V}:{kind:"fill",stops:e.kind==="bar"&&e.ramp?I:S(e.fill),height:e.kind==="gap"?e.px:V}}function Zt(e){let t=new Set(e.sharedBlocks?.map(o=>o.block)),n=o=>({kind:"fill",stops:S(ge(o)),height:V});return[...[...t].filter(o=>o<z).sort((o,r)=>o-r).map(o=>({key:`block-${o}`,label:`${Y(o)}: off the reference, walked by several rows`,swatch:n(o)})),...[...t].some(o=>o>=z)?[{key:"block-more",label:"more shared blocks",swatch:n(z)}]:[]]}function Qt(e){let t=e.walkRowBars;if(!t)return[];let n=[t.reference,...t.rows].flatMap(r=>r.call??[]),o=(r,a,l)=>({key:r,label:l,swatch:{kind:"tick",color:a,height:V}});return[...$e(t,{ramp:e.referenceRampDomain,genes:e.walkRowGeneKey,annotation:e.walkRowAnnotation}).map(r=>({key:`rows-${r.label}`,label:r.label,swatch:r.note?void 0:Jt(r.swatch)})),...Zt(e),...n.some(r=>r.spanningReads!==0)?[o("call",Ke,"allele length called for this walk")]:[],...n.some(r=>r.spanningReads===0)?[o("unbacked",Xe,"called with no read spanning it")]:[],...n.some(r=>r.agrees===!1)?[o("disagrees",Ue,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function en(e,t){let n=nt(t,e.walkReference);return{key:`walk-${t.name}`,strong:e.walkLabel(t.name),label:n.delta+n.gaps+n.reversed,swatch:{kind:"fill",stops:oe(t.encoding),width:n.shades?me:R},under:n.scale,title:n.hover,walk:t}}function ht(e,t){return[...e.liftPaintsOffReference?[q("lift-off",B,"off the reference")]:[],q("faded",dt,t)]}function tn(e){let t=e.walkLift;if(!t||e.facetPanels)return[];let n=t.walks.map(r=>en(e,r)),o=e.graph?he(e.graph,t,e.liftedWalksLabel):`not on ${e.liftedWalksLabel}`;return[...n,...ht(e,o)]}function Br(e){let{graph:t,facetPanels:n}=e;if(!t||!n)return[];let o=new Set(n.map(r=>he(t,r,"the panel's walk")));return[...ht(e,o.size===1?[...o][0]:"not on the panel's walk"),...ft(e)]}function Wr(e){let t=[{testid:"graph-open-bubble-legend",rows:Dt(e)},{testid:"graph-ramp-legend",rows:Ht(e),group:"Color"},{testid:"graph-walk-readout",rows:tn(e),group:"Walks"},{testid:"graph-width-legend",rows:Ft(e),group:"Node thickness"},{testid:"graph-link-width-legend",rows:Yt(e),group:"Link thickness"},{testid:"graph-halo-legend",rows:Xt(e),group:"Marks"},{testid:"graph-deletion-legend",rows:ft(e),group:"Marks"},{testid:"graph-gene-legend",rows:zt(e),group:"Marks"},{testid:"graph-path-legend",rows:qt(e),group:"Paths"},{testid:"graph-tube-map-legend",rows:jt(e),group:"Tube map"},{testid:"graph-walk-rows-legend",rows:Qt(e),group:"Walk rows"},{testid:"graph-reference-strip-legend",rows:Kt(e),group:"Top strip"},{testid:"graph-fold-legend",rows:Vt(e)}].filter(r=>r.rows.length>0);if(new Set(t.flatMap(r=>r.group??[])).size<2)return t;let o=new Set;return t.map((r,a)=>{let{group:l}=r;return l?o.has(l)?r:(o.add(l),{...r,heading:l}):a===0?r:{...r,spaced:!0}})}function nn(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function gt(e,t){if(typeof e=="string")return e;let n={key:t};for(let[o,r]of Object.entries(e.attrs))r!==void 0&&(n[nn(o)]=r);return Pe(e.tag,n,e.children.map(gt))}function T(){return Me().replaceAll(/[^\w-]/g,"")}function H({el:e}){return gt(e,0)}var rn="rgba(0, 0, 0, 0.28)";function wt({id:e,x:t,y:n,stops:o,width:r,height:a,square:l,edged:i}){let d=i?.5:0,c=p=>u("rect",{x:t+d,y:n+d,width:r-d*2,height:a-d*2,rx:l?0:2,fill:p,stroke:i?rn:void 0});return o.length>1?k(v,{children:[u("defs",{children:u("linearGradient",{id:e,children:o.map((p,b)=>u("stop",{offset:p.offset,stopColor:p.color},b))})}),c(`url(#${e})`)]}):c(o[0].color)}function on({swatch:e,x:t,id:n}){switch(e.kind){case"fill":{let r=D(e);return u(wt,{id:n,x:t,y:-5-r/2,stops:e.stops,width:j(e),height:r,square:e.square,edged:e.edged})}case"bands":{let r=ke(e.bands),a=-5-D(e)/2;return u(v,{children:e.bands.map((l,i)=>u(wt,{id:`${n}-${i}`,x:t,y:a+i*r,stops:l,width:R,height:r,square:!0},i))})}case"line":return e.dashed?u("line",{x1:t+1,x2:t+R,y1:-5,y2:-5,stroke:e.color,strokeWidth:3,strokeDasharray:"4 3"}):u("rect",{x:t,y:-5-1.5,width:R,height:3,rx:2,fill:e.color});case"halo":return u("line",{x1:t+5,x2:t+13,y1:-5,y2:-5,stroke:e.color,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"});case"outline":{let r=e.stroke/2;return u("rect",{x:t+r,y:-5-e.height/2+r,width:R-e.stroke,height:e.height-e.stroke,rx:Math.max(0,e.radius-r),fill:"none",stroke:e.color,strokeWidth:e.stroke})}case"overhang":return u("path",{transform:`translate(${t} -10)`,d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"});case"glyph":return u("text",{x:t+R/2,y:-1,textAnchor:"middle",fontFamily:"monospace",fontSize:12,fill:"currentColor",children:e.char});case"tick":{let r=-5-e.height/2;return k(v,{children:[e.backing?u("rect",{x:t,y:r,width:R,height:e.height,fill:e.backing}):null,u("rect",{x:t+R/2-1,y:r,width:2,height:e.height,fill:e.color})]})}case"bracket":return u("path",{transform:`translate(${t} ${-5-3.5})`,d:`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${R-.5} V6`,fill:"none",stroke:Ye()});case"blank":return null}}function Ur({swatch:e}){let t=T(),n=D(e);return u("svg",{width:j(e),height:n,overflow:"visible",style:{flex:"none"},children:u("g",{transform:`translate(0 ${n/2+5})`,children:u(on,{swatch:e,x:0,id:t})})})}var zr={background:"#fff",padding:"3px 6px",fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Vr={display:"flex",alignItems:"center",gap:5},qr={color:"#666"},an="#6b7479",jr=4,Jr={color:an,fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"};var sn=m(function({model:t}){let n=`exon-outline-${T()}`,o=U(()=>X(()=>{let{genePins:b,walkLift:h}=t,s=h?void 0:t.openBubbleFocus,f=s?b.map(g=>({...g,exonsByNode:g.exonsByNode.filter(w=>s.nodeIds.has(w.nodeId))})):b;return be(f,t.nodeInk.halfWidthPx,h)}),[t]),{scaleX:r,scaleY:a,translateX:l,translateY:i,paneWidth:d,canvasHeight:c}=t,p=fe(o.get(),{id:n,width:d,height:c,transform:`translate(${l} ${i}) scale(${r} ${a})`});return p?u(C,{model:t,zIndex:2,testId:"graph-gene-pins",children:u(H,{el:p})}):null}),ao=sn;function mt(e,t,n){return{x:e-n/2,y:t-A-F+2,width:n,height:A+F*2-2}}function kt(e,t,n){let o=mt(e.x,e.y,e.w);return t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height}function $({x:e,y:t,w:n,text:o,note:r,color:a,edge:l=a,italic:i,dimmed:d,title:c,testId:p,onClick:b,onHover:h}){return k("g",{style:{pointerEvents:b||h?"auto":"none",cursor:b?"pointer":void 0,opacity:d?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{h?.(!0)},onMouseLeave:()=>{h?.(!1)},...b&&{role:"button",tabIndex:0,"aria-label":(c??o).replaceAll(`
|
|
1
|
+
import{Ab as de,Da as $e,Ea as Ke,Fa as Xe,Fb as Ze,Ga as Ue,Hb as G,Ib as be,Ja as Fe,Jb as fe,Na as Ye,Nb as Qe,Oa as ie,Pb as et,Ra as ze,Rb as tt,Tb as he,Ua as Ve,Va as le,Xb as nt,Za as ce,a as Se,ac as rt,b as X,da as Ie,db as qe,f as Q,g as ee,gc as ot,ic as at,jb as je,la as P,lb as pe,ma as ae,ob as Je,sa as Be,ta as We,ua as Ge,va as se,xa as De,ya as He,zb as ue}from"./chunk-LVRR7SZH.js";import{D as oe,f as Oe,m as I,p as re,q as Ae,r as B}from"./chunk-QX7UU3CV.js";import{A as Ee,E as ne,T as Ne,U as ve,Z as Te,m as A,o as F,p as te,x as _e}from"./chunk-FUKZO5AZ.js";import{b as E,c as W}from"./chunk-YGTSPKS5.js";import{c as Z}from"./chunk-7CZC4GOZ.js";import{e as K}from"./chunk-3WG3GF2A.js";import{b as Pe,d as M,e as Le,f as Me,g as U,h as Ce}from"./chunk-NIEZKWQV.js";import{a as v,b as u,c as k,d as m}from"./chunk-JMBDTNUR.js";var _t="data-pans-with-drawing";function st(e,t){return{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:t,zIndex:e}}var C=m(function({model:t,zIndex:n,overflow:o="hidden",testId:r,pansWithDrawing:a,children:l}){return u("svg",{style:{...st(n,o),userSelect:a?"none":void 0},width:t.paneWidth,height:t.canvasHeight,"data-testid":r,...a?{[_t]:""}:{},children:l})}),it=m(function({model:t,children:n}){let{scaleX:o,scaleY:r,translateX:a,translateY:l}=t;return u("g",{transform:`translate(${a} ${l}) scale(${o} ${r})`,children:n})});function _({model:e,zIndex:t,shown:n=!0,testId:o,paint:r}){let a=Ce(null);return Le(()=>{if(n)return Se(()=>{let l=a.current,i=l?.getContext("2d");if(l&&i){let d=e.paneWidth,c=e.canvasHeight;Ie(at());let p=Ze(l,d,c);i.setTransform(p,0,0,p,0,0),i.clearRect(0,0,d,c),r(i,p)}})},[e,n,r]),u("canvas",{ref:a,"data-testid":n?o:void 0,style:{...st(t),display:n?"block":"none"}})}var Et=m(function({model:t}){let{bubbleHalos:n,hoveredBubble:o}=t;if(n.length===0)return null;let r=t.contigThickness*Qe;return u(C,{model:t,zIndex:2,testId:"graph-bubble-halos",children:u(it,{model:t,children:n.filter(a=>!a.whole&&(!a.tick||o&&E(a.bubble,o))).map(a=>u("path",{d:a.path,fill:"none",stroke:P[a.kind],strokeOpacity:o&&E(a.bubble,o)?.45:t.bubbleFaded(a)?.06:.22,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},W(a.bubble)))})})}),Gn=Et;var lt=["#d4735e","#d8a94a","#c98aa4"],Ot="#e6e6e6",Nt="#555",vt="bold 11px sans-serif";var ge=e=>lt[e]??Ot;function Y(e){let t=String.fromCharCode(65+e%26);return e<26?t:Y(Math.floor(e/26)-1)+t}var z=lt.length;function ct(e,t,n){e.font=vt,e.textAlign="center",e.textBaseline="middle";for(let{row:o,start:r,bp:a,block:l}of t){let i=n.x(r),d=n.x(r+a)-i,c=n.rowCentre(o)-n.barPx/2;e.fillStyle=ge(l),e.fillRect(i,c,d,n.barPx),e.strokeStyle=Nt,e.lineWidth=1,e.strokeRect(i+.5,c+.5,d-1,n.barPx-1),d>=12&&n.barPx>=9&&(e.fillStyle="#111",e.fillText(Y(l),i+d/2,n.rowCentre(o)))}}var R=18,me=32,dt="rgba(160, 160, 160, 0.45)",At="#18181c",It=6,bt=7,Bt="#b8b8c0",V=We-4,Wt="rgba(119, 119, 119, 0.85)",Gt=15,pt=10;function j(e){return e.kind==="fill"?e.width??R:R}var ke=e=>e.length>1?3:4;function D(e){switch(e.kind){case"fill":return e.height??8;case"bands":return ke(e.bands)*e.bands.length;case"line":return 3;case"halo":case"overhang":return 10;case"outline":case"tick":return e.height;case"glyph":return 15;case"bracket":return 7;case"blank":return 0}}function Ar(e){return e.reduce((t,n)=>n.swatch?Math.max(t,j(n.swatch)):t,0)}function Ir(e){return e.reduce((t,n)=>n.swatch?Math.max(t,Math.ceil(D(n.swatch))+3):t,Gt)}var S=e=>[{offset:0,color:e}];function q(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:S(t),width:pt,height:pt,edged:!0}}}function ut(e){return e.flatMap((t,n)=>[{offset:n/e.length,color:t},{offset:(n+1)/e.length,color:t}])}function Dt(e){let t=e.openBubble;if(!t)return[];let n=e.bubbleHalos.find(o=>E(o.bubble,t));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:P[n.kind]}:{kind:"blank"},closesBubble:!0}]}function Ht(e){let t=e.walkLift?void 0:e.referenceRampDomain;if(!t)return[];let n=Math.round(t.start),o=Math.round(t.end);return[{key:"ramp",label:`position on ${e.graph?Z(e.graph):"reference"}`,swatch:{kind:"fill",stops:I,width:me},under:`${n.toLocaleString("en-US")}-${o.toLocaleString("en-US")} (${ne(o-n)})`},...e.referenceRampDrawsOffReference?[q("off",B,"off the reference")]:[]]}function $t(e){let t=e.walkLift;if(t)return t.walks.map(r=>oe(r.encoding));if(e.effectiveColorScheme==="reference-position")return[I];let n=e.referenceStripBlocks.map(r=>r.colors[0]).filter((r,a,l)=>r!==l[a-1]),o=Math.min(It,n.length);return[o===0?S(re):Array.from({length:o},(r,a)=>({offset:o>1?a/(o-1):0,color:n[o>1?Math.round(a*(n.length-1)/(o-1)):0]}))]}function Kt(e){if(!e.referenceStripShown)return[];let t=(e.walkLift?.walks.length??0)>1;return[{key:"strip",label:`reference${t?", a row per walk":""}`,swatch:{kind:"bands",bands:$t(e)}},...e.referenceStripFaded?[q("strip-faded",re,e.walkLift?`reference not on ${t?"that row's walk":e.liftedWalksLabel}`:"reference outside the open bubble")]:[],...e.referenceStripOverhangs?[{key:"overhang",label:"graph runs past this edge",swatch:{kind:"overhang"}}]:[]]}function Xt(e){let t=new Map;for(let n of e.bubbleHalos)if(!n.whole){let o=P[n.kind],r=t.get(o)??new Set;r.add(ae[n.kind]),t.set(o,r)}return[...t].map(([n,o])=>{let r=[...o].join(" or ");return{key:`halo-${n}`,label:r===ae.superbubble?r:`${r} bubble`,swatch:{kind:"halo",color:n}}})}function ft(e){let{graph:t}=e;return t&&Ee(e.deletions,e.walkLift).length>0?[{key:"deletion",label:_e(Z(t)),swatch:{kind:"line",color:e.walkLift?dt:At,dashed:!0}}]:[]}function we(e,t,n,o){return{key:e,label:t,swatch:{kind:"fill",stops:S(o),width:me,height:n}}}var Ut=e=>e>=10?Math.round(e):Math.round(e*10)/10;function Ft(e){let{graph:t,contigThickness:n,depthRange:o}=e;if(!t||!e.drawsNodes||e.walkRowBars)return[];if(e.nodeWidth==="frequency"){let c=t.nodes.some(p=>p.frequency!==void 0);return Ne(n).map(({label:p,widthPx:b})=>we(`width-${p}`,c?`AF ${p}`:`${p} of haplotypes`,b,B))}if(e.nodeWidth!=="depth"||!o||o.min===o.max)return[];let r=t.paths?.length??0,a=r>0,l=[...new Set([o.max,o.mean,o.min].map(a?Math.round:Ut))],i=l[0]>r,d=c=>i?`${c.toLocaleString("en-US")} walk pass${c===1?"":"es"}`:`${c.toLocaleString("en-US")} walk${c===1?"":"s"}`;return l.map(c=>we(`width-${c}`,a?d(c):`depth ${c.toLocaleString("en-US")}`,ve({depth:c},n,"depth",o.mean),B))}function Yt(e){let t=e.busiestLink;return!e.drawsNodes||e.walkRowBars||e.linkWidth!=="walks"||t===0?[]:(t>1?[t,1]:[1]).map(o=>we(`link-width-${o}`,`${o.toLocaleString("en-US")} walk${o===1?"":"s"}`,e.connectorThickness*Te(o,t,"walks"),Wt))}function zt(e){return e.genePins.some(t=>t.exonsByNode.length>0)?[{key:"exon",label:"exon",swatch:{kind:"outline",color:G,stroke:2,radius:5,height:8}}]:[]}function Vt(e){let t=e.foldNote;return t?[{key:"fold",label:t}]:[]}function qt(e){return e.pathLegend.map(({name:t,label:n,color:o})=>({key:`path-${t}`,label:n,swatch:{kind:"line",color:o}}))}function O(e,t,n){return{key:e,label:n,swatch:{kind:"fill",stops:t,height:bt,square:!0}}}function jt(e){let{roles:t,haplotypeTube:n,bundled:o,values:r,logWidths:a,foldBp:l,forwardReads:i,reverseReads:d,substitution:c,insertion:p,deletion:b}=e.tubeMapKeys,h=e.readsShown,s=[];if(r){s.push(O("value-reference",S(pe),"reference"));for(let{value:f,color:g}of r)s.push(O(`value-${f}`,S(g),f))}return t&&s.push(O("ref",S(pe),"reference"),O("hap",S(n),o?"shared route, \xD7n haplotypes":"haplotype")),i&&s.push(O("fwd",ut(Q),"read on the forward strand")),d&&s.push(O("rev",ut(ee),"read on the reverse strand")),h&&h.shown<h.total&&s.push({key:"sampled",label:`${h.shown.toLocaleString("en-US")} of ${h.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),c&&s.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),p&&s.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),b&&s.push(O("del",S("grey"),"read deletion")),l!==void 0&&s.push({key:"tube-fold",label:`haplotype variant < ${ne(l)}`,swatch:{kind:"tick",color:Ve(),height:bt,backing:Bt}}),a&&s.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),s}function Jt(e){return e.kind==="gene"?{kind:"outline",color:Be,stroke:1.5,radius:0,height:V}:{kind:"fill",stops:e.kind==="bar"&&e.ramp?I:S(e.fill),height:e.kind==="gap"?e.px:V}}function Zt(e){let t=new Set(e.sharedBlocks?.map(o=>o.block)),n=o=>({kind:"fill",stops:S(ge(o)),height:V});return[...[...t].filter(o=>o<z).sort((o,r)=>o-r).map(o=>({key:`block-${o}`,label:`${Y(o)}: off the reference, walked by several rows`,swatch:n(o)})),...[...t].some(o=>o>=z)?[{key:"block-more",label:"more shared blocks",swatch:n(z)}]:[]]}function Qt(e){let t=e.walkRowBars;if(!t)return[];let n=[t.reference,...t.rows].flatMap(r=>r.call??[]),o=(r,a,l)=>({key:r,label:l,swatch:{kind:"tick",color:a,height:V}});return[...$e(t,{ramp:e.referenceRampDomain,genes:e.walkRowGeneKey,annotation:e.walkRowAnnotation}).map(r=>({key:`rows-${r.label}`,label:r.label,swatch:r.note?void 0:Jt(r.swatch)})),...Zt(e),...n.some(r=>r.spanningReads!==0)?[o("call",Ke,"allele length called for this walk")]:[],...n.some(r=>r.spanningReads===0)?[o("unbacked",Xe,"called with no read spanning it")]:[],...n.some(r=>r.agrees===!1)?[o("disagrees",Ue,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function en(e,t){let n=nt(t,e.walkReference);return{key:`walk-${t.name}`,strong:e.walkLabel(t.name),label:n.delta+n.gaps+n.reversed,swatch:{kind:"fill",stops:oe(t.encoding),width:n.shades?me:R},under:n.scale,title:n.hover,walk:t}}function ht(e,t){return[...e.liftPaintsOffReference?[q("lift-off",B,"off the reference")]:[],q("faded",dt,t)]}function tn(e){let t=e.walkLift;if(!t||e.facetPanels)return[];let n=t.walks.map(r=>en(e,r)),o=e.graph?he(e.graph,t,e.liftedWalksLabel):`not on ${e.liftedWalksLabel}`;return[...n,...ht(e,o)]}function Br(e){let{graph:t,facetPanels:n}=e;if(!t||!n)return[];let o=new Set(n.map(r=>he(t,r,"the panel's walk")));return[...ht(e,o.size===1?[...o][0]:"not on the panel's walk"),...ft(e)]}function Wr(e){let t=[{testid:"graph-open-bubble-legend",rows:Dt(e)},{testid:"graph-ramp-legend",rows:Ht(e),group:"Color"},{testid:"graph-walk-readout",rows:tn(e),group:"Walks"},{testid:"graph-width-legend",rows:Ft(e),group:"Node thickness"},{testid:"graph-link-width-legend",rows:Yt(e),group:"Link thickness"},{testid:"graph-halo-legend",rows:Xt(e),group:"Marks"},{testid:"graph-deletion-legend",rows:ft(e),group:"Marks"},{testid:"graph-gene-legend",rows:zt(e),group:"Marks"},{testid:"graph-path-legend",rows:qt(e),group:"Paths"},{testid:"graph-tube-map-legend",rows:jt(e),group:"Tube map"},{testid:"graph-walk-rows-legend",rows:Qt(e),group:"Walk rows"},{testid:"graph-reference-strip-legend",rows:Kt(e),group:"Top strip"},{testid:"graph-fold-legend",rows:Vt(e)}].filter(r=>r.rows.length>0);if(new Set(t.flatMap(r=>r.group??[])).size<2)return t;let o=new Set;return t.map((r,a)=>{let{group:l}=r;return l?o.has(l)?r:(o.add(l),{...r,heading:l}):a===0?r:{...r,spaced:!0}})}function nn(e){return e==="class"?"className":/^(data|aria)-/.test(e)?e:e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function gt(e,t){if(typeof e=="string")return e;let n={key:t};for(let[o,r]of Object.entries(e.attrs))r!==void 0&&(n[nn(o)]=r);return Pe(e.tag,n,e.children.map(gt))}function T(){return Me().replaceAll(/[^\w-]/g,"")}function H({el:e}){return gt(e,0)}var rn="rgba(0, 0, 0, 0.28)";function wt({id:e,x:t,y:n,stops:o,width:r,height:a,square:l,edged:i}){let d=i?.5:0,c=p=>u("rect",{x:t+d,y:n+d,width:r-d*2,height:a-d*2,rx:l?0:2,fill:p,stroke:i?rn:void 0});return o.length>1?k(v,{children:[u("defs",{children:u("linearGradient",{id:e,children:o.map((p,b)=>u("stop",{offset:p.offset,stopColor:p.color},b))})}),c(`url(#${e})`)]}):c(o[0].color)}function on({swatch:e,x:t,id:n}){switch(e.kind){case"fill":{let r=D(e);return u(wt,{id:n,x:t,y:-5-r/2,stops:e.stops,width:j(e),height:r,square:e.square,edged:e.edged})}case"bands":{let r=ke(e.bands),a=-5-D(e)/2;return u(v,{children:e.bands.map((l,i)=>u(wt,{id:`${n}-${i}`,x:t,y:a+i*r,stops:l,width:R,height:r,square:!0},i))})}case"line":return e.dashed?u("line",{x1:t+1,x2:t+R,y1:-5,y2:-5,stroke:e.color,strokeWidth:3,strokeDasharray:"4 3"}):u("rect",{x:t,y:-5-1.5,width:R,height:3,rx:2,fill:e.color});case"halo":return u("line",{x1:t+5,x2:t+13,y1:-5,y2:-5,stroke:e.color,strokeOpacity:.35,strokeWidth:8,strokeLinecap:"round"});case"outline":{let r=e.stroke/2;return u("rect",{x:t+r,y:-5-e.height/2+r,width:R-e.stroke,height:e.height-e.stroke,rx:Math.max(0,e.radius-r),fill:"none",stroke:e.color,strokeWidth:e.stroke})}case"overhang":return u("path",{transform:`translate(${t} -10)`,d:"M0,5 L8,0 L8,10 Z M18,5 L10,0 L10,10 Z",fill:"#18181c"});case"glyph":return u("text",{x:t+R/2,y:-1,textAnchor:"middle",fontFamily:"monospace",fontSize:12,fill:"currentColor",children:e.char});case"tick":{let r=-5-e.height/2;return k(v,{children:[e.backing?u("rect",{x:t,y:r,width:R,height:e.height,fill:e.backing}):null,u("rect",{x:t+R/2-1,y:r,width:2,height:e.height,fill:e.color})]})}case"bracket":return u("path",{transform:`translate(${t} ${-5-3.5})`,d:`M0.5,6 V1.5 H5.5 V6 M8.5,6 V1.5 H${R-.5} V6`,fill:"none",stroke:Ye()});case"blank":return null}}function Ur({swatch:e}){let t=T(),n=D(e);return u("svg",{width:j(e),height:n,overflow:"visible",style:{flex:"none"},children:u("g",{transform:`translate(0 ${n/2+5})`,children:u(on,{swatch:e,x:0,id:t})})})}var zr={background:"#fff",padding:"3px 6px",fontSize:11,lineHeight:"15px",whiteSpace:"nowrap"},Vr={display:"flex",alignItems:"center",gap:5},qr={color:"#666"},an="#6b7479",jr=4,Jr={color:an,fontSize:9.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"};var sn=m(function({model:t}){let n=`exon-outline-${T()}`,o=U(()=>X(()=>{let{genePins:b,walkLift:h}=t,s=h?void 0:t.openBubbleFocus,f=s?b.map(g=>({...g,exonsByNode:g.exonsByNode.filter(w=>s.nodeIds.has(w.nodeId))})):b;return be(f,t.nodeInk.halfWidthPx,h)}),[t]),{scaleX:r,scaleY:a,translateX:l,translateY:i,paneWidth:d,canvasHeight:c}=t,p=fe(o.get(),{id:n,width:d,height:c,transform:`translate(${l} ${i}) scale(${r} ${a})`});return p?u(C,{model:t,zIndex:2,testId:"graph-gene-pins",children:u(H,{el:p})}):null}),ao=sn;function mt(e,t,n){return{x:e-n/2,y:t-A-F+2,width:n,height:A+F*2-2}}function kt(e,t,n){let o=mt(e.x,e.y,e.w);return t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height}function $({x:e,y:t,w:n,text:o,note:r,color:a,edge:l=a,italic:i,dimmed:d,title:c,testId:p,onClick:b,onHover:h}){return k("g",{style:{pointerEvents:b||h?"auto":"none",cursor:b?"pointer":void 0,opacity:d?.35:1},"data-testid":p,onClick:b,onMouseEnter:()=>{h?.(!0)},onMouseLeave:()=>{h?.(!1)},...b&&{role:"button",tabIndex:0,"aria-label":(c??o).replaceAll(`
|
|
2
2
|
`,", "),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),b())},onFocus:()=>{h?.(!0)},onBlur:()=>{h?.(!1)}},children:[c?u("title",{children:c}):null,u("rect",{...mt(e,t,n),rx:3,fill:"rgba(255,255,255,0.85)",stroke:l,strokeWidth:1}),k("text",{x:e,y:t,fontSize:A,fontFamily:"sans-serif",fontStyle:i?"italic":void 0,fontWeight:i?600:void 0,fill:a,textAnchor:"middle",children:[o,r?u("tspan",{fontStyle:"normal",fontWeight:"normal",children:r}):null]})]})}var Rt="#1c1c22",Re=9,xe=3;function Co({genes:e},t,n){let o=e.find(l=>kt(l,t,n))?.item;if(!o)return;let{gene:r}=o,a=et(o);return{label:r.name,readout:`${r.refName}:${r.start.toLocaleString()}-${r.end.toLocaleString()}${a?`, ${a} in the cut`:""}`}}var ln=m(function({model:t}){let{bubbles:n,genes:o,ticks:r}=t.overlayLabels;if(n.length+o.length+r.length===0)return null;let{scaleY:a,translateY:l,contigThickness:i,hoveredBubble:d}=t,c=d?r.find(s=>E(s.item.bubble,d)):void 0,p=s=>r[Number(s.getAttribute("data-tick"))],b=s=>t.bubbleFaded(s),h=s=>t.bubbleIsOpen(s.bubble);return k(C,{model:t,zIndex:3,testId:"graph-label-layer",pansWithDrawing:!0,children:[u("g",{"data-testid":"graph-bubble-ticks",onClick:s=>{let f=p(s.target);f&&t.toggleBubble(f.item.bubble)},onMouseOver:s=>{let f=p(s.target);f&&t.setHoveredBubble(f.item.bubble)},onMouseOut:()=>{K(t)&&t.setHoveredBubble(null)},onFocus:s=>{let f=p(s.target);f&&t.setHoveredBubble(f.item.bubble)},onBlur:()=>{K(t)&&t.setHoveredBubble(null)},onKeyDown:s=>{let f=p(s.target);f&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t.toggleBubble(f.item.bubble))},children:r.map(({item:s,x:f,y:g},w)=>u("rect",{"data-tick":w,role:"button",tabIndex:0,"aria-label":`${s.label}, ${h(s)?"close":"open"} bubble`,x:f-xe/2,y:g-Re,width:xe,height:Re,rx:xe/2,fill:P[s.kind],opacity:b(s)?.35:1,style:{pointerEvents:"all",cursor:"pointer"}},W(s.bubble)))}),o.map(({item:s,x:f,y:g,w,text:L})=>{let{gene:x}=s,{y1:y,y2:Ct}=tt({y:g},s.at.y*a+l,i);return k("g",{children:[u("line",{x1:f,x2:f,y1:y,y2:Ct,stroke:Rt,strokeWidth:.8,strokeOpacity:.6}),u($,{x:f,y:g,w,text:x.name,note:L.slice(x.name.length)||void 0,color:Rt,edge:G,italic:!0,testId:"graph-gene-pin-label"})]},`${x.name}-${x.start}`)}),n.map(({item:s,x:f,y:g,w,text:L})=>u($,{x:f,y:g,w,text:L,color:P[s.kind],dimmed:b(s),title:`${s.label}
|
|
3
3
|
${s.bubble.segmentCount} segments${s.bubble.covering?"":h(s)?" \xB7 click to close":" \xB7 click to open"}`,testId:"graph-bubble-halo-label",onClick:s.bubble.covering?void 0:()=>{t.toggleBubble(s.bubble)},onHover:x=>{K(t)&&t.setHoveredBubble(x?s.bubble:null)}},W(s.bubble))),c?u($,{x:c.x,y:c.y-Re-4,w:te(c.item.label),text:c.item.label,color:P[c.item.kind],testId:"graph-bubble-tick-label"}):null]})}),_o=ln;function cn(e,t,{lit:n,dpr:o}){let r=t.hostBpFrame;r&&ot(e,t.referenceStripBlocks,r,{width:t.paneWidth,lit:n,dpr:o})}var pn=m(function({model:t}){let n=M((o,r)=>{cn(o,t,{lit:t.referenceStripLit,dpr:r})},[t]);return u(_,{model:t,zIndex:5,shown:t.referenceStripShown,testId:"graph-reference-strip",paint:n})}),Io=pn;var un=.45;function dn(e,t,{highlightNode:n}){let o=t.tubeMapPicture,r=t.tubeMapFrame;if(!o||!r)return;let a=t.paneWidth,l=t.tubeMapPanelViews;if(l){bn(e,t,l,n);return}let i={...r,width:a,highlightNode:n,tubeColors:t.tubeMapTubeColors,nodeColors:t.tubeMapNodeColors};ce(e,o,i);let d=t.layoutResult?.tubeMap;d&&(ue(e,o,d.graph,i),de(e,d,i)),le(e,t.tubeMapDeviations,i),ze(e,t.tubeMapConnectors,t.connectorZoneBottom,i);let{bounds:c}=o;rt(e,t.tubeMapGenes,i,r.y(c.minY)-2);let p=t.tubeMapRulerBoxes;p&&ie(e,p,i,r.y(c.maxY)+4,t.layoutResult?.referenceAxis)}function bn(e,t,n,o){let r=t.paneWidth;for(let i of n){if(i.bottom<0||i.titleTop>t.canvasHeight)continue;let d={...i.frame,width:r,highlightNode:o,tubeColors:i.tubeColors,nodeColors:i.nodeColors};ce(e,i.picture,d),ue(e,i.picture,i.panel.result.tubeMap.graph,d),de(e,i.panel.result.tubeMap,d),e.globalAlpha=un,le(e,i.deviations,d),e.globalAlpha=1,e.strokeStyle="rgba(0,0,0,0.15)",e.lineWidth=1,e.beginPath(),e.moveTo(0,Math.round(i.titleTop)+.5),e.lineTo(r,Math.round(i.titleTop)+.5),e.stroke(),e.font=Je,e.textAlign="left",e.textBaseline="top",e.fillStyle="rgba(0,0,0,0.85)",e.fillText(i.label,6,i.titleTop+4)}let a=n.at(-1),l=t.tubeMapPanelRulerBoxes;a&&l&&ie(e,l,{...a.frame,width:r},a.bottom+4,!0)}var fn=m(function({model:t}){let n=M(o=>{dn(o,t,{highlightNode:t.selectedNode})},[t]);return u(_,{model:t,zIndex:1,shown:!!t.tubeMapPicture,testId:"graph-tube-map",paint:n})}),zo=fn;var N=JBrowseExports["@jbrowse/render-core/marks"],hn=e=>N!=null&&e in Object(N)?N[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/render-core/marks' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var xt=hn("spanMark");var jo=N&&N.__esModule?N.default:N;function St(e){if(e.startsWith("#")){let r=Number.parseInt(e.slice(1),16);return[r>>16&255,r>>8&255,r&255]}let[t=0,n=0,o=0]=e.match(/[\d.]+/g).map(Number);return e.startsWith("hsl")?Ae(t,n/100,o/100).map(r=>r*255):[t,n,o]}var Pt=([e,t,n])=>Oe(Math.round(e),Math.round(t),Math.round(n),255),yt=new Map;function gn(e){let t=yt.get(e);return t===void 0&&(t=Pt(St(e)),yt.set(e,t)),t}function wn(e,t,n){let o=e.start+e.bp,r=He(e,t);if("fill"in r)return[[e.start,o,gn(r.fill)]];let a=r.stops.map(St),l=r.stops.map(p=>Number(/[\d.]+/.exec(p)[0])),i=Math.abs(l.at(-1)-l[0]),d=Math.max(1,Math.min(Math.ceil(e.bp*n),Math.ceil(i),e.bp)),c=[];for(let p=0;p<d;p++){let b=(p+.5)/d*(a.length-1),h=Math.min(Math.floor(b),a.length-2),s=a[h],f=a[h+1],g=b-h;c.push([Math.round(e.start+e.bp*p/d),Math.round(e.start+e.bp*(p+1)/d),Pt([0,1,2].map(w=>s[w]+(f[w]-s[w])*g))])}return c}function ye(e){return{x:new Uint32Array(e),x2:new Uint32Array(e),row:new Uint32Array(e),color:new Uint32Array(e),count:0}}function J(e,t,n){return{x:e.x.subarray(t,n),x2:e.x2.subarray(t,n),row:e.row.subarray(t,n),color:e.color.subarray(t,n),count:n-t}}function Lt(e,t,n){let o=e.map(h=>Fe(h.runs,t).map(s=>({gap:s.gap,hairline:s.gap&&De(s.cause).px===se,pieces:wn(s,n,t)}))),r=0;for(let h of o)for(let s of h)r+=s.pieces.length;let a=ye(r),l=ye(r),i=ye(r),d=new Uint32Array(e.length+1),c=new Uint32Array(e.length+1),p=new Uint32Array(e.length+1),b=1;return o.forEach((h,s)=>{for(let f of h){let g=f.hairline?i:f.gap?l:a;for(let[w,L,x]of f.pieces){let y=g.count++;g.x[y]=w,g.x2[y]=L,g.row[y]=s,g.color[y]=x,b=Math.max(b,g.x2[y])}}d[s+1]=a.count,c[s+1]=l.count,p[s+1]=i.count}),{bars:J(a,0,a.count),gaps:J(l,0,l.count),hairlines:J(i,0,i.count),barRows:d,gapRows:c,hairlineRows:p,longest:b}}function Mt(e,t,n){let{longest:o}=t,r={start:0,end:o,screenStartPx:n.origin*n.scaleX+n.translateX,screenEndPx:(n.origin+o)*n.scaleX+n.translateX,reversed:!1,displayedRegionIndex:0},a={canvasWidth:n.width,canvasHeight:n.height},l=n.rowPx*n.scaleY;for(let{first:i,count:d,rowY:c}of n.blocks){let p=l/2-n.translateY-(c-i*n.rowPx)*n.scaleY,b=(c-n.rowPx/2)*n.scaleY+n.translateY;if(!(b>n.height||b+d*l<0))for(let[h,s,f]of[[t.bars,t.barRows,n.barPx],[t.gaps,t.gapRows,Math.min(Ge,n.barPx)],[t.hairlines,t.hairlineRows,Math.min(se,n.barPx)]])xt.paintBlock(e,J(h,s[i],s[i+d]),r,a,{rowHeight:l,rowProportion:f/l,minWidthPx:1,seamPx:0,scrollTop:p})}}function mn({model:e}){let t=U(()=>X(()=>{let o=e.walkRowBars;return o?Lt([o.reference,...o.rows],e.scaleX,e.referenceRampDomain):void 0}),[e]),n=M(o=>{let r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch,i=t.get();if(!r||!a||!l||!i)return;let d=e.walkRowGroups?.sections,c=d?.length?[{first:0,count:1,rowY:a.rowY(0)},...d.map(p=>({first:p.first,count:p.count,rowY:a.rowY(p.first)}))]:[{first:0,count:r.rows.length+1,rowY:a.rowY(0)}];Mt(o,i,{...e.screenTransform,width:e.paneWidth,height:e.canvasHeight,rowPx:l.rowPx,barPx:l.barPx,origin:r.origin,blocks:c})},[e,t]);return u(_,{model:e,zIndex:3,testId:"graph-walk-rows-spans",paint:n})}var kn="rgba(160, 196, 232, 0.55)",Rn="rgba(160, 140, 220, 0.55)";function xn({model:e}){let t=M(n=>{let o=e.walkRowRibbons,r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch;if(!o||!r||!a||!l)return;let{scaleX:i,scaleY:d,translateX:c,translateY:p}=e.screenTransform,b=s=>(r.origin+s)*i+c,h=l.barPx/2;for(let{row:s,a0:f,a1:g,b0:w,b1:L}of o){let x=a.rowY(s)*d+p+h,y=a.rowY(s+1)*d+p-h;n.fillStyle=w>L?Rn:kn,n.beginPath(),n.moveTo(b(f),x),n.lineTo(b(g),x),n.lineTo(b(L),y),n.lineTo(b(w),y),n.closePath(),n.fill()}},[e]);return u(_,{model:e,zIndex:2,testId:"graph-walk-rows-ribbons",paint:t})}function yn({model:e}){let t=M(n=>{let o=e.sharedBlocks,r=e.walkRowBars,a=e.walkRowPlacement,l=e.walkRowPitch;if(!o||!r||!a||!l)return;let{scaleX:i,scaleY:d,translateX:c,translateY:p}=e.screenTransform;ct(n,o,{x:b=>(r.origin+b)*i+c,rowCentre:b=>a.rowY(b)*d+p,barPx:l.barPx})},[e]);return u(_,{model:e,zIndex:3,testId:"graph-walk-rows-blocks",paint:t})}var Sn=m(function({model:t}){let n=t.walkRowBars,o=t.walkRowPlacement,r=t.walkRowPitch;if(!n||!o||!r||!t.hoveredWalkRowText)return null;let a=[n.reference,...n.rows],l=a.findIndex(c=>c.name===t.hoveredWalkRow),i=a[l];if(!i)return null;let d=t.toScreen({x:n.origin,y:o.rowY(l)});return u("rect",{"data-testid":"graph-walk-row-hovered",x:d.x-2,y:d.y-r.rowPx/2-1,width:i.bp*t.scaleX+4,height:r.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1})}),Pn=m(function({model:t,vector:n=!1}){let o=T(),r=t.walkRowBars,a=t.walkRowPlacement,l=t.walkRowPitch;if(!r||!a||!l)return null;let{paneWidth:i,canvasHeight:d}=t,c={...t.screenTransform,width:i,height:d,...l,bars:n};return k(v,{children:[n||!t.walkRowRibbons?null:u(xn,{model:t}),n?null:u(mn,{model:t}),n||!t.sharedBlocks?null:u(yn,{model:t}),k(C,{model:t,zIndex:3,overflow:"visible",testId:"graph-walk-rows",children:[je(r,t.walkRowGroups?.sections??[],a.rowY,c,{ramp:t.referenceRampDomain,rowGenes:t.walkRowGenes,idPrefix:o}).map((p,b)=>u(H,{el:p},b)),a.headers.map(p=>u("text",{x:10,y:t.toScreen({x:0,y:p.top}).y+qe-4,fontFamily:"sans-serif",fontSize:11,fontWeight:"bold",fill:"#333","data-testid":"graph-walk-section",children:p.title},p.key)),u(Sn,{model:t})]})]})}),ua=Pn;export{_t as a,st as b,C as c,Gn as d,T as e,H as f,j as g,Ar as h,Ir as i,Jt as j,en as k,Br as l,Wr as m,on as n,Ur as o,zr as p,Vr as q,qr as r,an as s,jr as t,Jr as u,ao as v,Co as w,_o as x,cn as y,Io as z,dn as A,zo as B,ua as C};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-LYJ4FZFC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as Ve}from"./chunk-M2D7NUOY.js";import{b as ze}from"./chunk-
|
|
1
|
+
import{s as Ve}from"./chunk-M2D7NUOY.js";import{b as ze}from"./chunk-44DOTJB7.js";import{a as He}from"./chunk-JKW2OX73.js";import{a as $e,c as Ye}from"./chunk-J5RMHLFJ.js";function qe(e){let r=[],t=0,o;for(let n=0,i=e.length;n<i;n++){let a=e.charCodeAt(n);if(a>=48&&a<=57)t=t*10+a-48;else if(a===58)o=t,t=0;else{let f=e[n];f==="M"||f==="="||f==="X"?r.push({own:o===void 0?t:o,mate:t,op:"M"}):f==="I"?r.push({own:0,mate:t,op:f}):(f==="D"||f==="N")&&r.push({own:t,mate:0,op:f}),o=void 0,t=0}}return r}function Ae(e){let r="";for(let{own:t,mate:o,op:n}of qe(e))r+=n==="M"?t===0?`${o}I`:o===0?`${t}D`:`${t}M`:`${n==="I"?o:t}${n}`;return r}var Se=2**28-1;function ve(e,r,t){for(let o=r;o>0;o-=Se)e.push((Math.min(o,Se)<<4|t)>>>0)}function kr(e,r,t){if(r===t)ve(e,r,0);else{let o=Math.ceil(Math.max(r,t)/Se);for(let n=0;n<o;n++){let i=Math.floor(r*(n+1)/o)-Math.floor(r*n/o),a=Math.floor(t*(n+1)/o)-Math.floor(t*n/o);e.push((i<<4|9)>>>0,(a<<4|9)>>>0)}}}function _e(e){let r=[];for(let{own:t,mate:o,op:n}of qe(e))n==="M"?kr(r,t,o):n==="I"?ve(r,o,1):ve(r,t,n==="N"?3:2);return Uint32Array.from(r)}function Gr(e){return e>=48&&e<=57}function Dr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function Ke(e,r){let t=r;for(;t<e.length&&Dr(e[t]);)t++;return t}function Qe(e,r){let t=r,o=0;for(;t<e.length&&Gr(e.charCodeAt(t));)o=o*10+(e.charCodeAt(t)-48),t++;return{value:o,next:t}}function rr(e,r){let t=0;for(;t<e.length;){let o=e[t];if(o===":"){let{value:n,next:i}=Qe(e,t+1);r(":",n,n,t+1,i),t=i}else if(o==="="){let n=Ke(e,t+1),i=n-t-1;r("=",i,i,t+1,n),t=n}else if(o==="*")r("*",1,1,t+1,Math.min(t+3,e.length)),t+=3;else if(o==="+"||o==="-"){let n=Ke(e,t+1),i=n-t-1;r(o,o==="-"?i:0,o==="+"?i:0,t+1,n),t=n}else if(o==="~"){let{value:n,next:i}=Qe(e,t+3),a=Math.min(i+2,e.length);r("~",n,0,t+1,a),t=a}else t++}}function Ce(e,r,t,o){let n=t??Number.NEGATIVE_INFINITY,i=o??Number.POSITIVE_INFINITY,a=0;rr(e,(f,p,s,c,u)=>{if(f==="*")a>=n&&a<i&&r(88,a,1,e[c+1]??"",-1,0,0);else if(f==="+"){if(a>=n&&a<=i){let m=e.slice(c,u);r(73,a,s,m,-1,0,s)}}else(f==="-"||f==="~")&&a<i&&a+p>n&&r(f==="-"?68:78,a,p,"",-1,0,0);a+=p})}function tr(e,r,t,o){let n=0,i=0,a=[],f=t&&r;for(let p=0,s=e.length;p<s;p++){let c=e[p],u=c>>>4,m=c&15;if(m===0||m===7){if(f)for(let l=0;l<u;l++)(r.charCodeAt(i+l)|32)!==(t.charCodeAt(n+l)|32)&&a.push({start:n+l,type:"mismatch",base:r[i+l],altbase:t[n+l],length:1});i+=u,n+=u}else if(m===1)a.push({start:n,type:"insertion",insertlen:u,insertedBases:r?.slice(i,i+u),length:0}),i+=u;else if(m===2)a.push({start:n,type:"deletion",length:u}),n+=u;else if(m===3)a.push({start:n,type:"skip",length:u}),n+=u;else if(m===8){for(let l=0;l<u;l++)a.push({start:n+l,type:"mismatch",base:r?.[i+l]||"X",qual:o?.[i+l],length:1});i+=u,n+=u}else m===5?a.push({start:n,type:"hardclip",cliplen:u,length:1}):m===4&&(a.push({start:n,type:"softclip",cliplen:u,length:1}),i+=u)}return a}function or(e,r,t,o,n){if(!r)return[];let i=[],a=r.length,f=o.length,p=n!==void 0,s=t.length,c=!1;for(let b=0;b<s;b++)if(t[b].type==="skip"){c=!0;break}let u=0,m=0,l=0,y=0,d=0,x=0,g=e.length;for(;x<g;){let b=e.charCodeAt(x);if(b>=48&&b<=57){let v=0;for(;x<g;){let S=e.charCodeAt(x);if(S>=48&&S<=57)v=v*10+(S-48),x++;else break}u+=v}else if(b===94)for(x++;x<g&&e.charCodeAt(x)>=65;)x++,u++;else if(b>=65){let v=e[x];if(x++,c&&s>0)for(let I=d;I<s;I++){let R=t[I];R.type==="skip"&&u>=R.start&&(u+=R.length,d=I+1)}let S=l,C=y;for(let I=m;I<a&&C<=u;I++,m=I){let R=r[I],L=R>>>4,A=R&15;A===4||A===1?S+=L:A===2||A===6||A===3?C+=L:A!==5&&(S+=L,C+=L)}l=S,y=C;let F=S-(C-u),q=F<f?o[F]:"X";i.push({start:u,base:q,qual:p?n[F]:void 0,altbase:v,length:1,type:"mismatch"}),u++}else x++}return i}var nr={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function ir(e=""){let r=0,t=[];for(let o=0,n=e.length;o<n;o++){let i=e.charCodeAt(o);if(i>=48&&i<=57)r=r*10+(i-48);else{let a=nr[i];t.push(r<<4|a),r=0}}return t}function Te(e=""){let r=0;for(let i=0,a=e.length;i<a;i++){let f=e.charCodeAt(i);(f<48||f>57)&&r++}let t=new Uint32Array(r),o=0,n=0;for(let i=0,a=e.length;i<a;i++){let f=e.charCodeAt(i);f>=48&&f<=57?o=o*10+(f-48):(t[n++]=o<<4|nr[f],o=0)}return t}function J(e,r,t,o,n){let i=ir(e),a=e?tr(i,t,o,n):[];return r&&t?a.concat(or(r,i,a,t,n)):a}var N=class extends $e{get(r){return r==="mismatches"?J(this.walkableCigar):r==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:r==="name"?super.get("name")??this.mate?.refName:super.get(r)}get mate(){return super.get("mate")}get walkableCigar(){let r=super.get("CIGAR"),t=super.get("coarseCigar");return typeof r=="string"?r:typeof t=="string"?Ae(t):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(r,t){let o=this.get("start"),n=t?.start===void 0?void 0:t.start-o,i=t?.end===void 0?void 0:t.end-o,a=this.get("cs");if(a)Ce(a,r,n,i);else{let f=n??Number.NEGATIVE_INFINITY,p=i??Number.POSITIVE_INFINITY;for(let s of J(this.walkableCigar))(s.type==="deletion"||s.type==="skip"?s.start<p&&s.start+s.length>f:s.start>=f&&s.start<=p)&&(s.type==="mismatch"?r(88,s.start,s.length,s.base,s.qual??-1,0,0):s.type==="insertion"?r(73,s.start,s.length,s.insertedBases??"",-1,0,s.insertlen):s.type==="deletion"?r(68,s.start,s.length,"",-1,0,0):s.type==="skip"&&r(78,s.start,s.length,"",-1,0,0))}}};var we=function(e,r){return we=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},we(e,r)};function H(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");we(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function ar(e,r,t,o){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function f(c){try{s(o.next(c))}catch(u){a(u)}}function p(c){try{s(o.throw(c))}catch(u){a(u)}}function s(c){c.done?i(c.value):n(c.value).then(f,p)}s((o=o.apply(e,r||[])).next())})}function ee(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=f(0),a.throw=f(1),a.return=f(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(s){return function(c){return p([s,c])}}function p(s){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(t=0)),t;)try{if(o=1,n&&(i=s[0]&2?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,n=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(c){s=[6,c],n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function P(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],a;try{for(;(r===void 0||r-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(f){a={error:f}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return i}function j(e,r,t){if(t||arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function sr(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(e,r||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(l){return function(y){return Promise.resolve(y).then(l,u)}}function f(l,y){o[l]&&(n[l]=function(d){return new Promise(function(x,g){i.push([l,d,x,g])>1||p(l,d)})},y&&(n[l]=y(n[l])))}function p(l,y){try{s(o[l](y))}catch(d){m(i[0][3],d)}}function s(l){l.value instanceof k?Promise.resolve(l.value.v).then(c,u):m(i[0][2],l)}function c(l){p("next",l)}function u(l){p("throw",l)}function m(l,y){l(y),i.shift(),i.length&&p(i[0][0],i[0][1])}}function fr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],t;return r?r.call(e):(e=typeof P=="function"?P(e):e[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=e[i]&&function(a){return new Promise(function(f,p){a=e[i](a),n(f,p,a.done,a.value)})}}function n(i,a,f,p){Promise.resolve(p).then(function(s){i({value:s,done:f})},a)}}function h(e){return typeof e=="function"}function pr(e){var r=function(o){Error.call(o),o.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var re=pr(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
2
2
|
`+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
|
|
3
3
|
`):"",this.name="UnsubscriptionError",this.errors=t}});function Oe(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1)}}var te=(function(){function e(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var r,t,o,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=P(a),p=f.next();!p.done;p=f.next()){var s=p.value;s.remove(this)}}catch(d){r={error:d}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(r)throw r.error}}else a.remove(this);var c=this.initialTeardown;if(h(c))try{c()}catch(d){i=d instanceof re?d.errors:[d]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var m=P(u),l=m.next();!l.done;l=m.next()){var y=l.value;try{cr(y)}catch(d){i=i??[],d instanceof re?i=j(j([],D(i)),D(d.errors)):i.push(d)}}}catch(d){o={error:d}}finally{try{l&&!l.done&&(n=m.return)&&n.call(m)}finally{if(o)throw o.error}}}if(i)throw new re(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)cr(r);else{if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r)}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&Oe(t,r)},e.prototype.remove=function(r){var t=this._finalizers;t&&Oe(t,r),r instanceof e&&r._removeParent(this)},e.EMPTY=(function(){var r=new e;return r.closed=!0,r})(),e})();var Zt=te.EMPTY;function oe(e){return e instanceof te||e&&"closed"in e&&h(e.remove)&&h(e.add)&&h(e.unsubscribe)}function cr(e){h(e)?e():e.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var U={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];var n=U.delegate;return n?.setTimeout?n.setTimeout.apply(n,j([e,r],D(t))):setTimeout.apply(void 0,j([e,r],D(t)))},clearTimeout:function(e){var r=U.delegate;return(r?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ne(e){U.setTimeout(function(){var r=w.onUnhandledError;if(r)r(e);else throw e})}function Re(){}var ur=(function(){return Me("C",void 0,void 0)})();function lr(e){return Me("E",void 0,e)}function mr(e){return Me("N",e,void 0)}function Me(e,r,t){return{kind:e,value:r,error:t}}var G=null;function dr(e){if(w.useDeprecatedSynchronousErrorHandling){var r=!G;if(r&&(G={errorThrown:!1,error:null}),e(),r){var t=G,o=t.errorThrown,n=t.error;if(G=null,o)throw n}}else e()}function xr(e){w.useDeprecatedSynchronousErrorHandling&&G&&(G.errorThrown=!0,G.error=e)}var z=(function(e){H(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=!1,t?(o.destination=t,oe(t)&&t.add(o)):o.destination=Yr,o}return r.create=function(t,o,n){return new ae(t,o,n)},r.prototype.next=function(t){this.isStopped?Le(mr(t),this):this._next(t)},r.prototype.error=function(t){this.isStopped?Le(lr(t),this):(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped?Le(ur,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r})(te);var Br=Function.prototype.bind;function Fe(e,r){return Br.call(e,r)}var Wr=(function(){function e(r){this.partialObserver=r}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r)}catch(o){ie(o)}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r)}catch(o){ie(o)}else ie(r)},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(t){ie(t)}},e})(),ae=(function(e){H(r,e);function r(t,o,n){var i=e.call(this)||this,a;if(h(t)||!t)a={next:t??void 0,error:o??void 0,complete:n??void 0};else{var f;i&&w.useDeprecatedNextContext?(f=Object.create(t),f.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&Fe(t.next,f),error:t.error&&Fe(t.error,f),complete:t.complete&&Fe(t.complete,f)}):a=t}return i.destination=new Wr(a),i}return r})(z);function ie(e){w.useDeprecatedSynchronousErrorHandling?xr(e):ne(e)}function $r(e){throw e}function Le(e,r){var t=w.onStoppedNotification;t&&U.setTimeout(function(){return t(e,r)})}var Yr={closed:!0,next:Re,error:$r,complete:Re};var B=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function hr(e){return e}function yr(e){return e.length===0?hr:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var _=(function(){function e(r){r&&(this._subscribe=r)}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,o){var n=this,i=zr(r)?r:new ae(r,t,o);return dr(function(){var a=n,f=a.operator,p=a.source;i.add(f?f.call(i,p):p?n._subscribe(i):n._trySubscribe(i))}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t)}},e.prototype.forEach=function(r,t){var o=this;return t=gr(t),new t(function(n,i){var a=new ae({next:function(f){try{r(f)}catch(p){i(p),a.unsubscribe()}},error:i,complete:n});o.subscribe(a)})},e.prototype._subscribe=function(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[B]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return yr(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=gr(r),new r(function(o,n){var i;t.subscribe(function(a){return i=a},function(a){return n(a)},function(){return o(i)})})},e.create=function(r){return new e(r)},e})();function gr(e){var r;return(r=e??w.Promise)!==null&&r!==void 0?r:Promise}function Hr(e){return e&&h(e.next)&&h(e.error)&&h(e.complete)}function zr(e){return e&&e instanceof z||Hr(e)&&oe(e)}function Vr(e){return h(e?.lift)}function E(e){return function(r){if(Vr(r))return r.lift(function(t){try{return e(t,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function M(e,r,t,o,n){return new qr(e,r,t,o,n)}var qr=(function(e){H(r,e);function r(t,o,n,i,a,f){var p=e.call(this,t)||this;return p.onFinalize=a,p.shouldUnsubscribe=f,p._next=o?function(s){try{o(s)}catch(c){t.error(c)}}:e.prototype._next,p._error=i?function(s){try{i(s)}catch(c){t.error(c)}finally{this.unsubscribe()}}:e.prototype._error,p._complete=n?function(){try{n()}catch(s){t.error(s)}finally{this.unsubscribe()}}:e.prototype._complete,p}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},r})(z);var se=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function fe(e){return h(e?.then)}function pe(e){return h(e[B])}function ce(e){return Symbol.asyncIterator&&h(e?.[Symbol.asyncIterator])}function ue(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Kr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var le=Kr();function me(e){return h(e?.[le])}function de(e){return sr(this,arguments,function(){var t,o,n,i;return ee(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,k(t.read())];case 3:return o=a.sent(),n=o.value,i=o.done,i?[4,k(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,k(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function xe(e){return h(e?.getReader)}function O(e){if(e instanceof _)return e;if(e!=null){if(pe(e))return Qr(e);if(se(e))return Xr(e);if(fe(e))return Zr(e);if(ce(e))return br(e);if(me(e))return Jr(e);if(xe(e))return et(e)}throw ue(e)}function Qr(e){return new _(function(r){var t=e[B]();if(h(t.subscribe))return t.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Xr(e){return new _(function(r){for(var t=0;t<e.length&&!r.closed;t++)r.next(e[t]);r.complete()})}function Zr(e){return new _(function(r){e.then(function(t){r.closed||(r.next(t),r.complete())},function(t){return r.error(t)}).then(null,ne)})}function Jr(e){return new _(function(r){var t,o;try{for(var n=P(e),i=n.next();!i.done;i=n.next()){var a=i.value;if(r.next(a),r.closed)return}}catch(f){t={error:f}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}r.complete()})}function br(e){return new _(function(r){rt(e,r).catch(function(t){return r.error(t)})})}function et(e){return br(de(e))}function rt(e,r){var t,o,n,i;return ar(this,void 0,void 0,function(){var a,f;return ee(this,function(p){switch(p.label){case 0:p.trys.push([0,5,6,11]),t=fr(e),p.label=1;case 1:return[4,t.next()];case 2:if(o=p.sent(),!!o.done)return[3,4];if(a=o.value,r.next(a),r.closed)return[2];p.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return f=p.sent(),n={error:f},[3,11];case 6:return p.trys.push([6,,9,10]),o&&!o.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:p.sent(),p.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})}function T(e,r,t,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=r.schedule(function(){t(),n?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(i),!n)return i}function he(e,r){return r===void 0&&(r=0),E(function(t,o){t.subscribe(M(o,function(n){return T(o,e,function(){return o.next(n)},r)},function(){return T(o,e,function(){return o.complete()},r)},function(n){return T(o,e,function(){return o.error(n)},r)}))})}function ye(e,r){return r===void 0&&(r=0),E(function(t,o){o.add(e.schedule(function(){return t.subscribe(o)},r))})}function Sr(e,r){return O(e).pipe(ye(r),he(r))}function vr(e,r){return O(e).pipe(ye(r),he(r))}function Ar(e,r){return new _(function(t){var o=0;return r.schedule(function(){o===e.length?t.complete():(t.next(e[o++]),t.closed||this.schedule())})})}function _r(e,r){return new _(function(t){var o;return T(t,r,function(){o=e[le](),T(t,r,function(){var n,i,a;try{n=o.next(),i=n.value,a=n.done}catch(f){t.error(f);return}a?t.complete():t.next(i)},0,!0)}),function(){return h(o?.return)&&o.return()}})}function ge(e,r){if(!e)throw new Error("Iterable cannot be null");return new _(function(t){T(t,r,function(){var o=e[Symbol.asyncIterator]();T(t,r,function(){o.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}function Cr(e,r){return ge(de(e),r)}function Ir(e,r){if(e!=null){if(pe(e))return Sr(e,r);if(se(e))return Ar(e,r);if(fe(e))return vr(e,r);if(ce(e))return ge(e,r);if(me(e))return _r(e,r);if(xe(e))return Cr(e,r)}throw ue(e)}function Ne(e,r){return r?Ir(e,r):O(e)}function V(e,r){return E(function(t,o){var n=0;t.subscribe(M(o,function(i){o.next(e.call(r,i,n++))}))})}function Er(e,r,t,o,n,i,a,f){var p=[],s=0,c=0,u=!1,m=function(){u&&!p.length&&!s&&r.complete()},l=function(d){return s<o?y(d):p.push(d)},y=function(d){i&&r.next(d),s++;var x=!1;O(t(d,c++)).subscribe(M(r,function(g){n?.(g),i?l(g):r.next(g)},function(){x=!0},void 0,function(){if(x)try{s--;for(var g=function(){var b=p.shift();a?T(r,a,function(){return y(b)}):y(b)};p.length&&s<o;)g();m()}catch(b){r.error(b)}}))};return e.subscribe(M(r,l,function(){u=!0,m()})),function(){f?.()}}function W(e,r,t){return t===void 0&&(t=1/0),h(r)?W(function(o,n){return V(function(i,a){return r(o,i,n,a)})(O(e(o,n)))},t):(typeof r=="number"&&(t=r),E(function(o,n){return Er(o,n,e,t)}))}function Tr(e,r,t,o,n){return function(i,a){var f=t,p=r,s=0;i.subscribe(M(a,function(c){var u=s++;p=f?e(p,c,u):(f=!0,c),o&&a.next(p)},n&&(function(){f&&a.next(p),a.complete()})))}}function wr(e,r){return E(Tr(e,r,arguments.length>=2,!1,!0))}var tt=function(e,r){return e.push(r),e};function be(){return E(function(e,r){wr(tt,[])(e).subscribe(r)})}var ot=397,nt=387,it=385;function Or(e){return(1<<e&ot)!==0}function Rr(e){return(1<<e&nt)!==0}function Mr(e){return(1<<e&it)!==0}function Pe(e,r,t,o,n,i,a){let f=n===-1?-1:1,p=r,s=n===-1?o:t,c=[],u=1/0,m=-1/0,l=1/0,y=-1/0,d=(x,g)=>{l=Math.min(l,x,g),y=Math.max(y,x,g)};for(let x=0;x<e.length;x++){let g=e[x],b=g>>>4,v=g&15,S=v===9,C=S||Or(v)?b:0,F=S?e[++x]>>>4:Rr(v)?b:0,q=p+C,I=s+F*f,R=p,L=q;if(L>=i&&R<=a)if(C>0){let A=Math.max(R,i),$=Math.min(L,a);if($>A)if(u=Math.min(u,A),m=Math.max(m,$),S){let je=F/b,Ue=$-A,Be=Math.round(Ue*je),We=Math.round(s+(A-p)*je*f);c.push(Ue<<4|9,Be<<4|9),d(We,We+Be*f)}else c.push($-A<<4|v),Mr(v)?d(s+(A-p)*f,s+($-p)*f):d(s,s)}else F>0&&(S?c.push(g,e[x]):c.push(g),u=Math.min(u,p),m=Math.max(m,p),d(s,I));if(p=q,s=I,p>a)break}if(c.length!==0)return{start:u,end:m,mateStart:l,mateEnd:y,cigar:Uint32Array.from(c)}}function at(e){return e===1||e===2||e===3}function ke(e,r,t,o,n,i){let a=n===-1?-1:1,f=[],p=r,s=n===-1?o:t,c,u=!1,m=()=>{c!==void 0&&u&&c.qHi>c.qLo&&f.push({start:c.qLo,end:c.qHi,mateStart:c.tLo,mateEnd:c.tHi,cigar:Uint32Array.from(c.ops)}),c=void 0,u=!1};for(let l=0;l<e.length;l++){let y=e[l],d=y>>>4,x=y&15,g=x===9,b=g?e[++l]:void 0,v=g||Or(x)?d:0,S=b!==void 0?b>>>4:Rr(x)?d:0,C=s+S*a;at(x)&&d>=i?m():(v>0||S>0)&&(c===void 0&&(c={qLo:p,qHi:p,tLo:s,tHi:s,ops:[]}),c.qHi=p+v,c.tLo=Math.min(c.tLo,s,C),c.tHi=Math.max(c.tHi,s,C),c.ops.push(y),b!==void 0&&c.ops.push(b),u=u||g||Mr(x)),p+=v,s=C}return m(),f}function Fr(e){let r=e.get("CIGAR");return typeof r=="string"?r:void 0}function Lr(e){let r=e.get("coarseCigar");return typeof r=="string"?r:void 0}function Ge(e){let r=Fr(e),t=r===void 0?Lr(e):void 0;return r!==void 0?Te(r):t!==void 0?_e(t):void 0}var st=["CIGAR","cs","coarseCigar","cg","cr"];function ft(e){return typeof e=="object"&&e!==null&&"refName"in e&&"start"in e&&"end"in e&&typeof e.refName=="string"&&typeof e.start=="number"&&typeof e.end=="number"}function pt(e){let r=e.get("mate");return ft(r)?r:void 0}function ct(e,r,t,o){let n=Math.max(e.start,o.start),i=Math.min(e.end,o.end),a=(r.end-r.start)/Math.max(e.end-e.start,1),f=c=>t===-1?r.end-(c-e.start)*a:r.start+(c-e.start)*a,p=Math.round(f(n)),s=Math.round(f(i));return i>n?{start:n,end:i,mateStart:Math.min(p,s),mateEnd:Math.max(p,s)}:void 0}function ut(e,r,t,o,n){let i={start:e.get("start"),end:e.get("end")},a=e.get("strand")===-1?-1:1,f=i.start>=t.start&&i.end<=t.end,p=f&&o===void 0&&!n?void 0:Ge(e);if(p===void 0){let s=f?{...i,mateStart:r.start,mateEnd:r.end}:ct(i,r,a,t);return s===void 0?[]:[s]}else return(o===void 0?[{...i,mateStart:r.start,mateEnd:r.end,cigar:p}]:ke(p,i.start,r.start,r.end,a,o)).flatMap(c=>{let u=Pe(c.cigar,c.start,c.mateStart,c.mateEnd,a,t.start,t.end);return u===void 0?[]:[u]})}function lt(e,r,t,o,n,i){let a=`:${o.start}-${o.end}${n}`,f=e.toJSON(),p={...f,uniqueId:`${e.id()}${a}`,recordId:f.recordId??e.id(),start:t.start,end:t.end,mate:{...r,start:t.mateStart,end:t.mateEnd}};f.syntenyId!==void 0&&(p.syntenyId=`${String(f.syntenyId)}${a}`);for(let s of st)delete p[s];return i&&t.cigar&&(p.alignmentOps=t.cigar),new N(p)}function Nr(e,r,t,o=!1){let n=pt(e);if(n===void 0||e.get("spansWindow"))return[e];{let i=ut(e,n,r,t,o);return i.map((a,f)=>lt(e,n,a,r,i.length>1?`/${f}`:"",o))}}var Pr=class extends ze{constructor(){super(...arguments);this.recordsAreAlignments=!0}static{this.capabilities=["getFeatures","getRefNames"]}async hasDataForRefName(){return!0}getFeaturesInMultipleRegions(t,o={}){let{clipToRegion:n,splitAtGapBp:i,keepAlignment:a,...f}=o,p=n&&this.recordsAreAlignments,s=Ye(f.statusCallback);return Ne(t).pipe(W((c,u)=>this.getFeatures(c,{...f,statusCallback:s()}).pipe(W(m=>p?Nr(m,m.get("assemblyName")===c.assemblyName?c:{start:m.get("start"),end:m.get("end")},i,a):[m]),be(),V(m=>({index:u,features:m})))),be(),W(c=>c.sort((u,m)=>u.index-m.index).flatMap(u=>u.features)))}};var De=class extends Error{constructor(t){super(`a pair query names both lanes: queryAssemblyName ${t} came without a targetAssemblyName`);this.name="PairTargetError"}};function Xi(e){let{lanePairs:r,queryAssemblyName:t,targetAssemblyName:o}=e;if(r?.length)return r;if(t===void 0)return[];if(o===void 0)throw new De(t);return[{queryAssemblyName:t,targetAssemblyName:o}]}function Zi(e){let[r]=e;return e.length===1&&r?`Reading ${r.queryAssemblyName} against ${r.targetAssemblyName}`:`Reading ${e.length} lane pairs`}function Ji(e,r){return e[r]??e[He(r)]??r}function mt(e,r){let t=Math.max(1,r);return e>=10*t?Math.ceil(e/t):Math.max(11,Math.ceil(10*e/t))/10}function ta(e,r){if(Ve(e)&&e instanceof Error){let{fitsBp:t}=e;e.message=e.message.replace("to see the graph","to see lanes"),typeof t=="number"&&(e.message=e.message.replace(/^Zoom in to about [\d.,]*\d[KM]?bp/,`Zoom in about ${mt(r,t)}\xD7`))}return e}function ia({target:e,query:r,strand:t,cigar:o,matches:n,columns:i}){let a=`${e.name}:${e.start}-${e.end}|${r.name}:${r.start}-${r.end}`;return new N({uniqueId:a,assemblyName:e.assemblyName,refName:e.refName,start:e.start,end:e.end,type:"match",strand:t==="-"?-1:1,CIGAR:o,syntenyId:a,identity:n/Math.max(i,1),numMatches:n,blockLen:i,mate:{refName:r.refName,start:r.start,end:r.end,assemblyName:r.assemblyName}})}export{N as a,Pr as b,De as c,Xi as d,Zi as e,Ji as f,ta as g,ia as h};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-P6WBR5MX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as jn,H as Jn,I as un,J as dn,S as Qn,U as Qt,V as mn,Y as Zn,Z as te,d as $n,e as Kn,f as hn,h as Un,i as Yn,j as qn,k as Vn,l as $t,y as zn}from"./chunk-CI6VQ2KV.js";import{a as Bt,g as Xt}from"./chunk-PVRRW4PM.js";var Et=2,ae=1.5,Ke=4,ne=12,Ue=64,ee=24,Ye=48,oe="a thread per pass through a node",pn=t=>t.length>1&&t.some(n=>n.mostPasses>1),ce=t=>t*Et+Math.max(0,t-1)*ae,se=t=>t.reduce((n,o)=>n+o,0);function ie(t,n,o){let e=t.map((a,c)=>n[c]>1?ce(a):o*Math.min(1,a)),s=0,r=t.map(a=>{let c=Math.min(1,a),i=Ke*c*s;return s=Math.max(s,c),i});return{widths:e,gaps:r,band:se(e)+se(r)}}var gn=Et+ae;function Kt(t,n,o=t){let{widths:e,gaps:s,band:r}=ie(t,n,Et),a=-r/2;return e.map((c,i)=>{a+=s[i];let f=n[i]>1?Math.max(0,c-ce(o[i])):0,l=a+f/2+Et/2;return a+=c,l})}var nn=t=>ie(t,t,Et).band,en=t=>Math.min(1,Ye/(nn(t)||1)),is=t=>en(t.map(n=>n.mostPasses))<1?`${oe}, thinned to fit`:oe;function Zt(t,n){let o=t.stepOf[n],e=n-t.starts[o];return t.forward[o]?e:t.starts[o+1]-t.starts[o]-1-e}var Nt=(t,n)=>{let o=n.x-t.x,e=n.y-t.y;return Math.sqrt(o*o+e*e)};function Ft(t){let n=new Float64Array(t.length);for(let o=1;o<t.length;o++)n[o]=n[o-1]+Nt(t[o-1],t[o]);return n}function yn(t,n){let o=new Set;return t.map(e=>{let s=new Map;return e.map(r=>r.map(a=>{let c=s.get(a)??0;s.set(a,c+1);let i=n[a],f=!!i?.length&&!o.has(a);return f&&o.add(a),{id:a,visit:c,owned:f,segments:i}}))})}function qe(t,n,o){let e=[];return t.forEach((s,r)=>{let a=0;for(let M of s)for(let{segments:A}of M)a+=A?.length??0;let c=new Float64Array(a),i=new Float64Array(a),f=0,l=0,h=u();function u(){return{walk:r,ids:[],visits:[],forward:[],owned:[],starts:[0]}}let m=()=>{if(h.ids.length){let M=new Int32Array(f-l);for(let A=0;A<h.ids.length;A++)M.fill(A,h.starts[A],h.starts[A+1]);e.push({...h,xs:c.subarray(l,f),ys:i.subarray(l,f),stepOf:M})}h=u(),l=f},w=(M,A,R)=>{let P=R.x-M,k=R.y*n-A;return Math.sqrt(P*P+k*k)};for(let M of s)M.forEach(({id:A,visit:R,owned:P,segments:k},W)=>{if(!k?.length){m();return}let F=k[0],S=k.at(-1),_;if(f>l){let g=c[f-1],E=i[f-1],x=w(g,E,F),C=w(g,E,S);_=x<=C,Math.min(x,C)>o&&m()}else{let g=M[W+1]?.segments,E=x=>g?.length?Math.min(w(x.x,x.y*n,g[0]),w(x.x,x.y*n,g.at(-1))):0;_=E(S)<=E(F)}h.ids.push(A),h.visits.push(R),h.forward.push(_),h.owned.push(P);for(let g=0;g<k.length;g++){let E=k[_?g:k.length-1-g];c[f]=E.x,i[f]=E.y*n,f++}h.starts.push(f-l)}),m()}),e}function xn(t,n,o){let e=[];for(let s=0;s<n.length;s++){if(!n[s])continue;let r=s;for(;r+1<n.length&&n[r+1];)r++;let a=e.at(-1),c=a?a[1]:0,i=s;for(;i>c&&t[s]-t[i-1]<=o;)i--;let f=r;for(;f+1<t.length&&t[f+1]-t[r]<=o;)f++;a&&i<=a[1]+1?a[1]=f:e.push([i,f]),s=r}return e}function Ve(t,n){let o=Ft(t),e=o.at(-1),s=(c,i)=>{let f=t[i],l=t[Math.min(i+1,t.length-1)],h=o[Math.min(i+1,t.length-1)]-o[i],u=h>0?(c-o[i])/h:0;return{x:f.x+(l.x-f.x)*u,y:f.y+(l.y-f.y)*u}},r=0,a=0;return t.map((c,i)=>{let f=Math.max(0,o[i]-n/2),l=Math.min(e,o[i]+n/2);for(;r<t.length-1&&o[r+1]<=f;)r++;for(;a<t.length-1&&o[a+1]<=l;)a++;let h=s(f,r),u=s(l,a),m=Nt(h,u);return m>0?{nx:-(u.y-h.y)/m,ny:(u.x-h.x)/m}:void 0})}function ze(t,n,o){let e=Ft(t),s=t.slice(),r=[];e.forEach((c,i)=>{let f=r.at(-1);(f===void 0||c-e[f]>=n/4)&&r.push(i)}),r.at(-1)!==t.length-1&&r.push(t.length-1);let a=0;for(;a<r.length;){let c=r[a],i=-1;for(let u=a+1;u<r.length&&e[r[u]]-e[c]<=o;u++){let m=r[u];e[m]-e[c]>Math.PI*n&&Nt(t[c],t[m])<=n&&(i=u)}if(i<0){a++;continue}let f=r[i],l=t[c],h=t[f];for(let u=c+1;u<f;u++){let m=(e[u]-e[c])/(e[f]-e[c]);s[u]={...t[u],x:l.x+(h.x-l.x)*m,y:l.y+(h.y-l.y)*m}}a=i}return s}function le(t,n){let o=t.length,e=Ft(t),s=e[o-1],r=new Float64Array(o+1),a=new Float64Array(o+1),c=new Float64Array(o+1);for(let h=0;h<o;h++){let u=t[h],m=(e[Math.min(h+1,o-1)]-e[Math.max(h-1,0)])/2;r[h+1]=r[h]+m,a[h+1]=a[h]+m*u.x,c[h+1]=c[h]+m*u.y}let i=new Array(o),f=0,l=0;for(let h=0;h<o;h++){let u=t[h],m=Math.min(n,e[h],s-e[h]),w=e[h]-m,M=e[h]+m+1e-9*(1+s);for(;f<o&&e[f]<w;)f++;for(;l<o&&e[l]<M;)l++;let A=r[l]-r[f];i[h]=A>0?{x:(a[l]-a[f])/A,y:(c[l]-c[f])/A}:{x:u.x,y:u.y}}return i}function re(t,n){let o=t.length,e=Ft(t),s=e[o-1],r=new Uint8Array(o),a=(f,l)=>{let h=t[f],u=t[f+1];if(!u)return h;let m=e[f+1]-e[f],w=m>0?(l-e[f])/m:0;return{x:h.x+(u.x-h.x)*w,y:h.y+(u.y-h.y)*w}},c=0,i=0;for(let f=0;f<o;f++){if(e[f]<n||s-e[f]<n)continue;for(;c+1<o&&e[c+1]<=e[f]-n;)c++;for(;i+1<o&&e[i+1]<=e[f]+n;)i++;let l=t[f],h=a(c,e[f]-n),u=a(i,e[f]+n),m=Math.abs((u.x-h.x)*(l.y-h.y)-(u.y-h.y)*(l.x-h.x));r[f]=m>0&&Nt(h,u)*Nt(h,l)*Nt(l,u)/(2*m)<n?1:0}return{tight:r,s:e}}function je(t,n){let o=t.slice(),{tight:e,s}=re(o,n),r=xn(s,Array.from(e,a=>a>0),3*n);for(let a=0;a<8&&r.length;a++)r=r.filter(([c,i])=>{let f=o.slice(c,i+1),l=re(f,n);if(!l.tight.includes(1))return!1;let h=tn(l.s,l.tight,n),u=le(f,n);for(let m=0;m<f.length;m++){let w=Math.min(1,3*h[m]);if(w>0){let M=f[m],A=u[m];o[c+m]={x:M.x+(A.x-M.x)*w,y:M.y+(A.y-M.y)*w}}}return!0});return o}function Je(t,n,o,e,s,r){let a=n.length,c=new Float64Array(a),i=0,f=0,l=0,h=0,u=0;for(let m=0;m<a;m++){for(;i<a&&t[i]-t[m]<=r;){let w=o(i),M=n[i];c[i]=w&&M?w.nx*M.nx+w.ny*M.ny:0,l+=c[i],i++}for(;t[m]-t[f]>r;)l-=c[f++];if(Math.abs(l)>1e-9&&(h=l<0?-1:1),!!h)for(;u<=m;u++)s(u,h)}if(u<a){let m=0;for(let w=0;w<a;w++)m+=e(w)?1:-1;for(;u<a;u++)s(u,m<0?-1:1)}}function Qe(t,n,o,e,s=!0){let r=Math.max(o,2*e),a=Math.PI*e,c=s?a+3*e+r/2:r/2,i=new Map,f=new Map,l=[],h=[],u=w=>({normals:new Array(w),shifts:s?new Array(w):[]}),m=(w,M,A,R)=>{let P=i.get(w);P||(P=[],i.set(w,P)),(P[M]??=[])[A]=R};return t.forEach((w,M)=>{let{walk:A,ids:R,visits:P,owned:k,starts:W,xs:F,ys:S,stepOf:_}=w,g=R.length,E=F.length,x=new Array(g);for(let d=0;d<g;d++)k[d]&&(x[d]=u(W[d+1]-W[d]),f.set(R[d],{run:M,step:d,frame:x[d]}),m(R[d],A,P[d],x[d]));let C=new Float64Array(E);for(let d=1;d<E;d++){let I=F[d]-F[d-1],N=S[d]-S[d-1];C[d]=C[d-1]+Math.sqrt(I*I+N*N)}let J=C[E-1],D=new Int32Array(g).fill(-1),B=new Int32Array(g),Y=new Array(g);for(let d=0;d<g;d++){let I=k[d]?void 0:f.get(R[d]);I&&(D[d]=I.run,B[d]=I.step,Y[d]=I.frame)}let et=new Int32Array(g),ct=new Int32Array(g);for(let d=0;d+1<g;d++){let N=D[d]>=0&&D[d+1]===D[d]?B[d+1]-B[d]:0;et[d+1]=et[d]+(N===1?1:0),ct[d+1]=ct[d]+(N===-1?1:0)}let tt=new Array(g),b=0,L=0;for(let d=0;d<g;d++){if(!s){tt[d]=!k[d];continue}let I=C[W[d]]-c,N=C[W[d+1]-1]+c;for(;C[b]<I;)b++;for(;L+1<E&&C[L+1]<=N;)L++;let j=_[Math.max(0,b-1)],st=_[Math.min(E-1,L+1)],H=st-j,it=et[st]-et[j],gt=ct[st]-ct[j];tt[d]=!k[d]&&I>=0&&N<=J&&H>0&&(it===H||gt===H)}for(let d=0;d<g;d++){if(k[d])continue;let I=Y[d];x[d]=!s&&tt[d]?I:tt[d]?{normals:I.normals,shifts:I.shifts}:u(I.normals.length),m(R[d],A,P[d],x[d])}h.push(x);let q=new Array(E);for(let d=0;d<E;d++)q[d]=!tt[_[d]];for(let[d,I]of xn(C,q,c)){let N=[];for(let H=d;H<=I;H++)N.push({x:F[H],y:S[H]});let j=s?je(le(ze(N,e/2,a),e/2),e/2):N,st=Ve(j,r);Je(Ft(j),st,H=>{let it=_[d+H];return(k[it]?x[it]:Y[it])?.normals[Zt(w,d+H)]},H=>w.forward[_[d+H]],(H,it)=>{let gt=d+H,Lt=_[gt];if(tt[Lt])return;let Ht=Zt(w,gt),Rt=st[H];x[Lt].normals[Ht]=Rt&&(it>0?Rt:{nx:-Rt.nx,ny:-Rt.ny}),s&&(x[Lt].shifts[Ht]={dx:j[H].x-N[H].x,dy:(j[H].y-N[H].y)/n})},r)}if(!s){l.push(C);return}let ot=new Float64Array(E),G=0,V=0;for(let d=0;d<E;d++){let I=x[_[d]].shifts[Zt(w,d)],N=F[d]+(I?.dx??0),j=S[d]+(I?.dy??0)*n;ot[d]=d?ot[d-1]+Math.sqrt((N-G)**2+(j-V)**2):0,G=N,V=j}l.push(ot)}),{frames:i,arcs:l,stepFrames:h}}function fe(t,n,o,e){let s=new Array(n.length),r=[],a=0,c=0;for(let i=0;i<n.length;i++){for(;c<n.length&&t[c]-t[i]<=o;){for(;r.length>a&&e*n[r.at(-1)]<=e*n[c];)r.pop();r.push(c++)}for(;t[i]-t[r[a]]>o;)a++;s[i]=n[r[a]]}return s}function tn(t,n,o,e=()=>!0){let s=n.length,r=new Float64Array(s+1),a=new Float64Array(s+1);for(let l=0;l<s;l++){let h=e(n[l])?s>1?(t[Math.min(l+1,s-1)]-t[Math.max(l-1,0)])/2:1:0;r[l+1]=r[l]+h,a[l+1]=a[l]+h*n[l]}let c=new Float64Array(s),i=0,f=0;for(let l=0;l<s;l++){for(;t[l]-t[i]>o;)i++;for(;f<s&&t[f]-t[l]<=o;)f++;let h=r[f]-r[i];c[l]=h>0?(a[f]-a[i])/h:n[l]}return c}var Ze=[0];function to(t){for(let n of t.values())if(n>1)return!0;return!1}function no(t,n,o,e,s){if(!to(n))return{span:n,nodeThreads:new Map,threadPasses:new Map,threadAt:new Map,linkThreads:new Map};let r=new Map,a=[],c=[],i=[],f=[],l=[],h=[],u=[];for(let S of t){let _=[],g=[];for(let b of S){let L=r.get(b);L===void 0&&(L=a.length,r.set(b,L),a.push(b),c.push(0),i.push(0)),g.push(L);let q=o[b],ot=q?.[Math.floor(q.length/2)];_.push(ot?{x:ot.x,y:ot.y*e}:_.at(-1)??{x:0,y:0})}let E=Ft(_),x=S.map(b=>n.get(b)??1),C=fe(E,x,s/2,1),J=g.map(b=>++i[b]),D=S.length,B=new Int32Array(D),Y=-1;for(let b=0;b<D;b++)Y=x[b]===C[b]?b:Y,B[b]=Y;let et=new Int32Array(D);Y=-1;for(let b=D-1;b>=0;b--)Y=x[b]===C[b]?b:Y,et[b]=Y;let ct=new Array(D),tt=new Array(D).fill(NaN);for(let b=0;b<D;b++){let L=B[b],q=et[b],ot=L<0?q:q<0||E[b]-E[L]<=E[q]-E[b]?L:q,G=V=>Math.min(J[V],C[b])-1;if(ct[b]=G(ot),x[b]===1&&L>=0&&q>=0&&G(q)!==G(L)){let V=(E[b]-E[L])/(E[q]-E[L]||1);tt[b]=G(L)+(G(q)-G(L))*V}c[g[b]]=Math.max(c[g[b]],C[b])}f.push(g),l.push(J),h.push(ct),u.push(tt)}let m=[],w=[],M=(S,_)=>{let g=c[S],E=m[S]??=new Set;for(let x=0;x<g;x++)for(let C of[_-x,_+x])if(C>=0&&C<g&&!E.has(C))return C;return _},A=[];f.forEach((S,_)=>{S.forEach((g,E)=>{if(c[g]>1){let x=u[_][E],C=M(g,Number.isNaN(x)?h[_][E]:Math.round(x));m[g].add(C),(w[g]??=[])[l[_][E]]=C,Number.isNaN(x)||((A[g]??=[])[C]=x)}})});let R=new Map,P=new Map,k=new Map,W=new Map;a.forEach((S,_)=>{A[_]&&W.set(S,A[_]),R.set(S,c[_]),P.set(S,m[_]?[...m[_]].sort((E,x)=>E-x):Ze);let g=[];w[_]?.forEach((E,x)=>{g[E]=x-1}),k.set(S,g)});let F=new Map;return f.forEach((S,_)=>{let g=l[_];for(let E=1;E<S.length;E++){let x=S[E-1],C=S[E],J=[w[x]?.[g[E-1]]??0,w[C]?.[g[E]]??0],D=F.get(a[x]);D||(D=new Map,F.set(a[x],D));let B=D.get(a[C]);B?B.some(([Y,et])=>Y===J[0]&&et===J[1])||B.push(J):D.set(a[C],[J])}}),{span:R,nodeThreads:P,threadPasses:k,threadAt:W,linkThreads:F}}function eo(t,n,o,{reach:e,taper:s}){let r=new Map;return t.forEach((a,c)=>{let i=n[c],f=a.ids.map((l,h)=>{let u=a.starts[h+1]-a.starts[h],m=Math.floor(u/2);return i[a.starts[h]+(a.forward[h]?m:u-1-m)]});for(let[l,h]of xn(f,a.owned,e/2+s/2)){let u=f.slice(l,h+1),m=a.ids.slice(l,h+1),w=o.map(M=>{let A=m.map(R=>M.get(R)??0);return A.every(R=>R===A[0])?{slot:A,held:A}:{slot:tn(u,fe(u,A,e/2,1),s/2),held:tn(u,A,s/2,R=>R>0)}});m.forEach((M,A)=>{a.owned[l+A]&&r.set(M,{slot:w.map(R=>R.slot[A]),held:w.map(R=>R.held[A])})})}}),r}function oo(t,n,o,e,s,r,a){let c=Kt(s,s),i=new Map,f=l=>{let h=i.get(l);if(!h){let u=e.get(l);h=u?Kt(u.slot,s,u.held):c,i.set(l,h)}return h};t.forEach((l,h)=>{let{walk:u,ids:m,visits:w,starts:M}=l,{threadPasses:A,threadAt:R}=r[u],P=new Float64Array(l.xs.length);m.forEach((W,F)=>{let S=Math.max(0,A.get(W)?.indexOf(w[F])??0),_=R.get(W)?.[S]??S;P.fill(f(W)[u]+_*gn,M[F],M[F+1])});let k=tn(o[h],P,a);n[h].forEach((W,F)=>{let S=M[F],_=M[F+1],g=!0;for(let x=S+1;g&&x<_;x++)g=Math.abs(k[x]-k[S])<1e-9;if(g){W.offset=k[S];return}let E=new Array(_-S);for(let x=S;x<_;x++)E[Zt(l,x)]=k[x];W.offsets=E})})}function he(t,n,o,e,s=yn(t.map(r=>r.route),n)){let r=pn(t),a=t.map(M=>M.mostPasses),c=Ue*e,i=qe(s,o,ne*e),f=nn(a)*(r?en(a):1)*e,l=Qe(i,o,ne*e,f,r),h=r?t.map(M=>no(M.route,M.passes,n,o,c)):void 0,u=h?eo(i,l.arcs,h.map(M=>M.span),{reach:c,taper:ee*e}):void 0;u&&h&&oo(i,l.stepFrames,l.arcs,u,a,h,ee/2*e);let m={dx:0,dy:0},w=new Set;for(let M of l.frames.values())for(let{shifts:A}of M.flat())if(!w.has(A)){w.add(A);for(let R of A)m.dx=Math.max(m.dx,Math.abs(R?.dx??0)),m.dy=Math.max(m.dy,Math.abs(R?.dy??0))}return{lines:l,threads:h,spans:u,furthestShift:m}}function U(t,n,o,e){return(e<<24|o<<16|n<<8|t)>>>0}function wn(t){return t&255}function Mn(t){return t>>>8&255}function An(t){return t>>>16&255}function En(t){return t>>>24&255}function ue(t){return`rgba(${wn(t)},${Mn(t)},${An(t)},${En(t)/255})`}function fs(t,n){return`rgba(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)},${n})`}function vt(t,n){return U(wn(t),Mn(t),An(t),Math.round(En(t)*n))}function hs(t,n){let o=Math.max(0,1-1/n),e=s=>Math.round(s+(255-s)*o);return U(e(wn(t)),e(Mn(t)),e(An(t)),En(t))}var de=300,Ut=.7,Yt=.5;function so(t){return`hsl(${t}, ${Ut*100}%, ${Yt*100}%)`}function qt(t){return Math.max(0,Math.min(1,t))*de}function vn(t,n){return qt((t-n.start)/(n.end-n.start))}var ro=30;function ds({start:t,bp:n,reversed:o},e){let s=vn(t,e),r=vn(t+n,e);if(r-s<1)return[(s+r)/2];let a=Math.ceil((r-s)/ro);return Array.from({length:a+1},(c,i)=>vn(t+n*(o?a-i:i)/a,e))}var ao=Array.from({length:7},(t,n)=>({offset:n/6,color:so(n/6*de)})),ms=`linear-gradient(to right, ${ao.map(t=>`${t.color} ${t.offset*100}%`).join(", ")})`;var co=$t();function me(t,n,o,e,s,r,a=!1){return co(t,[n,o.scaleX,o.scaleY,e,r,a,s],()=>{let c=new Map;for(let i=0;i<n.edges.length;i++){let f=e?.get(i),l=zn(t,n.edges[i],o,f,f&&r?.[i],a);l&&c.set(i,l)}return c})}var io=4;function lo(t){let n=new Map;for(let o of t.edges)Bt(n,o.from,o.to),Bt(n,o.to,o.from);return n}function fo({nodeId:t,nodeById:n,neighbors:o}){let e=new Set([t]),s=[t],r=1/0,a=-1/0;for(let c=0;c<io&&s.length>0;c++){let i=[];for(let f of s){let l=o.get(f);if(l){for(let h of l)if(!e.has(h)){e.add(h);let u=n.get(h);u&&Xt(u)?(r=Math.min(r,u.stable.start+u.length),a=Math.max(a,u.stable.start)):i.push(h)}}}s=i}return r===1/0?void 0:{start:Math.min(r,a),end:Math.max(r,a)}}function ho({nodeId:t,nodeById:n,neighbors:o}){let e=n.get(t);return e===void 0?void 0:Xt(e)?{start:e.stable.start,end:e.stable.start+e.length}:fo({nodeId:t,nodeById:n,neighbors:o})}function pe(t){let n=new Map(t.nodes.map(s=>[s.id,s])),o=lo(t),e=new Map;for(let s of t.nodes){let r=ho({nodeId:s.id,nodeById:n,neighbors:o});r&&e.set(s.id,(r.start+r.end)/2)}return e}var uo=U(119,119,119,217),ge=U(136,136,136,217),mo=U(24,24,28,240),ye=2.2,Te=U(160,160,160,255),Vt=.18,po=.45,Ns=ue(vt(Te,Vt)),go=11,yo=1.2,xo=1e-6,wo=7,Mo=3,Ao=3,Eo=1.5,xe=3,vo=.5,_o=.45,_n=12,bo=1e-6,pt=new Float64Array(64),_t=new Float64Array(64),bt=new Float64Array(64);function Ro(t,n,o,e){let s=t.length*_n+1;pt.length<s&&(pt=new Float64Array(s),_t=new Float64Array(s),bt=new Float64Array(s));let r=t[t.length-1];pt[0]=r.x1,_t[0]=r.y1,bt[0]=0;let a=1,c=0;for(let i=t.length-1;i>=0&&c<e;i--){let f=t[i];for(let l=1;l<=_n&&c<e;l++){let h=1-(l/_n)**2,u=1-h,m=u*u*u,w=3*u*u*h,M=3*u*h*h,A=h*h*h,R=m*f.x0+w*f.cx0+M*f.cx1+A*f.x1,P=m*f.y0+w*f.cy0+M*f.cy1+A*f.y1;c+=Math.hypot(R-pt[a-1],(P-_t[a-1])*o)*n,pt[a]=R,_t[a]=P,bt[a]=c,a++}}return a}function we(t,n){let o=1;for(;o<t-1&&bt[o]<n;)o++;let e=bt[o-1],s=bt[o],r=s>e?Math.min(1,Math.max(0,(n-e)/(s-e))):0;return{x:pt[o-1]+(pt[o]-pt[o-1])*r,y:_t[o-1]+(_t[o]-_t[o-1])*r}}function So({curves:t,edgeHalfWidth:n,nodeHalfWidth:o,scale:e,yToX:s,color:r,fromSegments:a,toSegments:c}){let i=wo+Mo*n,f=Ro(t,e,s,o+xe*i),l=bt[f-1],h=l<bo,u=Math.min(o,l),m=h?Math.min(1,Vn(a,e,e*s)/i):1;if(h?m<vo:l<xe*i)return;let w=we(f,u),M=we(f,u+i*m),A=w.x-M.x,R=(w.y-M.y)*s,P=t[t.length-1];return{x:w.x,y:w.y,angle:Math.hypot(A,R)>0?Math.atan2(R,A):Wo(P,s,Oo(P,c)),length:i*m,halfWidth:(Ao+Eo*n)*m,color:r}}var Me=[[0,0]],Co=[0],Ae={dx:0,dy:0};function Oe(t,n,o){let e=s=>Math.hypot(s.x-t.x,(s.y-t.y)*o);return e(n[0])<e(n.at(-1))}function To(t,n,o,e,s){return e?Un(t).from==="start":Oe({x:o.x0,y:o.y0},n,s)}function Oo(t,n){if(n.length<2)return;let o=n[0],e=n[n.length-1];return Math.hypot(t.x1-o.x,t.y1-o.y)<=Math.hypot(t.x1-e.x,t.y1-e.y)?{from:o,to:n[1]}:{from:e,to:n[n.length-2]}}function Ee(t,n){if(!t||!n)return;let o=n.x-t.x,e=n.y-t.y,s=Math.hypot(o,e);return s>0?{nx:-e/s,ny:o/s}:void 0}var ke=.1,ko=1/Math.sqrt(ke);function ve(t,n=1){let o=n===1?t:t.map(e=>({x:e.x,y:e.y*n}));return o.map((e,s)=>{let r=Ee(o[s-1],e),a=Ee(e,o[s+1]);if(r&&a){let c=(r.nx+a.nx)/2,i=(r.ny+a.ny)/2,f=r.nx*c+r.ny*i;return f>ke?{nx:c/f,ny:i/f}:{nx:c,ny:i}}return r??a??{nx:0,ny:0}})}function _e(t,n,o,e=1){let s=new Array(t.length);for(let r=0;r<t.length;r++){let a=typeof o=="number"?o:o[r];s[r]={x:t[r].x+n[r].nx*a,y:t[r].y+n[r].ny*a/e}}return s}function Rn(t,n,o){let e=(1-Math.abs(2*o-1))*n,s=e*(1-Math.abs(t/60%2-1)),r=o-e/2,a=0,c=0,i=0;return t<60?(a=e,c=s):t<120?(a=s,c=e):t<180?(c=e,i=s):t<240?(c=s,i=e):t<300?(a=s,i=e):(a=e,i=s),[a+r,c+r,i+r]}function on(t,n,o,e=1){let[s,r,a]=Rn(t,n,o);return U(Math.round(s*255),Math.round(r*255),Math.round(a*255),Math.round(e*255))}var Io=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Po=[[237,137,44],[158,42,122]],No=[[220,50,50],[50,120,220]];function bn(t,n){let o=Math.max(0,Math.min(1,n))*(t.length-1),e=Math.min(t.length-2,Math.floor(o)),s=o-e,r=t[e],a=t[e+1];return U(Math.round(r[0]+(a[0]-r[0])*s),Math.round(r[1]+(a[1]-r[1])*s),Math.round(r[2]+(a[2]-r[2])*s),255)}function Fo(t,n){return on(jn(t),un,dn,n)}var Ie=[60,65,72],Sn=U(...Ie,255),Fs=`rgb(${Ie.join(", ")})`;function Lo(t,n){let o=n.midpoints.get(t.id);return Xt(t)&&o!==void 0?(o-n.start)/n.span:void 0}function Ls(t,n){let o=pe(t);if(n&&n.end>n.start)return{start:n.start,span:n.end-n.start,midpoints:o};let e=1/0,s=-1/0;for(let r of o.values())e=Math.min(e,r),s=Math.max(s,r);return{start:e===1/0?0:e,span:s>e?s-e:1,midpoints:o}}function Ho(t,n){let o=1/0,e=-1/0,s=1/0,r=-1/0,a=0;for(let c of t.nodes)c.stable!==void 0&&c.stable.rank>a&&(a=c.stable.rank),c.depth<o&&(o=c.depth),c.depth>e&&(e=c.depth),c.length<s&&(s=c.length),c.length>r&&(r=c.length);return{minDepth:o,maxDepth:e,minLength:s,maxLength:r,maxRank:a,nodeCount:t.nodes.length,referenceRamp:n}}function Do(t,n,o,e){switch(o){case"random":return Fo(t.id,1);case"depth":return bn(Io,e.maxDepth>e.minDepth?(t.depth-e.minDepth)/(e.maxDepth-e.minDepth):.5);case"node-length":return bn(No,e.maxLength>e.minLength?(t.length-e.minLength)/(e.maxLength-e.minLength):.5);case"stable-rank":return t.stable===void 0?U(160,160,160,255):t.stable.rank===0?U(52,152,219,255):bn(Po,e.maxRank>1?(t.stable.rank-1)/(e.maxRank-1):0);case"reference-position":{let s=e.referenceRamp;if(s===void 0)return U(160,160,160,255);let r=Lo(t,s);return r===void 0?Sn:on(qt(r),Ut,Yt)}case"grey":return U(160,160,160,255);case"rainbow":{let s=e.nodeCount>1?n/e.nodeCount*360:0;return on(s,.75,.5)}default:return U(52,152,219,255)}}function Wo(t,n=1,o){let e=[[t.cx1,t.cy1],[t.cx0,t.cy0],[t.x0,t.y0]];for(let[s,r]of e){let a=t.x1-s,c=(t.y1-r)*n;if(Math.hypot(a,c)>0)return Math.atan2(c,a)}return o?Math.atan2((o.to.y-o.from.y)*n,o.to.x-o.from.x):0}function Go(t,n){let o=!1;for(let e=0;e<t.length-1&&!o;e++){let s=t[e],r=t[e+1];o=Math.max(s.x,r.x)>=n.minX&&Math.min(s.x,r.x)<=n.maxX&&Math.max(s.y,r.y)>=n.minY&&Math.min(s.y,r.y)<=n.maxY}return o}function be(t,n,o=0,e=0){for(let s of t){let r=Math.min(s.x0,s.cx0,s.cx1,s.x1),a=Math.max(s.x0,s.cx0,s.cx1,s.x1),c=Math.min(s.y0,s.cy0,s.cy1,s.y1),i=Math.max(s.y0,s.cy0,s.cy1,s.y1);if(a>=n.minX-o&&r<=n.maxX+o&&i>=n.minY-e&&c<=n.maxY+e)return!0}return!1}var Re=new WeakMap;function Bo(t){let n=Re.get(t);if(!n){let o=[],e=new Map,s=t.paths??[];for(let r=0;r<s.length;r++)o.push(on(Jn(r,s.length),un,dn,.85)),e.has(s[r].name)||e.set(s[r].name,r);n={pathColorByIndex:o,pathIndexByName:e},Re.set(t,n)}return n}var Se=new WeakMap,Xo=new Map;function $o(t){let n=Se.get(t);if(!n){n=new Map;for(let[o,e]of(t.paths??[]).entries())for(let s of new Set(e.nodeIds))Bt(n,s,o);Se.set(t,n)}return n}var Ko=$t(),Uo=$t(),Ce=new WeakMap;function Yo(t){let n=Ce.get(t);if(!n){n=new Map;for(let{from:o,to:e}of t.edges){let s=n.get(o);s||(s=new Set,n.set(o,s)),s.add(e)}Ce.set(t,n)}return n}function Hs(t){let{nodePositions:n,graph:o,nodeById:e,colorScheme:s,contigThickness:r,connectorThickness:a,drawPaths:c,nodeWidth:i="uniform",edgeWidth:f="uniform",highlight:l,axis:h,linearLayout:u,viewportBounds:m,referenceRamp:w,deletions:M,deletionRoutes:A,stranded:R,hiddenEdges:P,version:k=0}=t,W=Qn(o,i),F=f==="walks"?Zn(o):0,S=h.scaleX,_=1/Math.max(S,xo),g=Yn(h),E=me(n,o,h,M,k,A,R),x=[],C=new Map,J=[],D=new Map,B=[],Y=new Map,et=Ho(o,w),ct=new Map;if(s==="rainbow")for(let p=0;p<o.nodes.length;p++)ct.set(o.nodes[p].id,p);let tt=o.paths?.length??0,{pathColorByIndex:b,pathIndexByName:L}=Bo(o),q=p=>b[L.get(p)??-1]??ge,ot=c&&tt>1?$o(o):Xo,G=l?.walks??[],V=pn(G),d=G.map(p=>p.mostPasses),I=V?en(d):1,N=l&&G.length>1?Ko(l,[n,k,h.scaleX,h.scaleY],()=>he(G,n,g,_,Uo(l,[n,k],()=>yn(G.map(p=>p.route),n)))):void 0,j=N?.lines,st=N?.threads,H=N?.spans,it=V?Kt(d,d):[],gt=new Map,Lt=p=>{let y=gt.get(p);if(!y){let v=H?.get(p);y=v?Kt(v.slot,d,v.held):it,gt.set(p,y)}return y},Ht=(p,y,v,T)=>V?(Lt(p)[v]+T*gn)*I:(v-(G.length-1)/2)*y,Rt=(p,y,v)=>{let T=p?.offsets?.[y]??p?.offset;return T===void 0?v:T*I},Pn=p=>V?Et/2*I:p/2,Nn=new Map,Fn=new WeakMap,Ln=(p,y,v)=>st?.[p]?.threadPasses.get(y)?.[v]??0,rn=(p,y)=>{let v=Nn.get(p);return v||(v=ve(y,g),Nn.set(p,v)),v},We=(p,y,v)=>{if(!v)return rn(p,y);let T=Fn.get(v.normals);return T||(T=rn(p,y).map((O,X)=>v.normals[X]??O),Fn.set(v.normals,T)),T},Hn=new Map,an=p=>{let y=Hn.get(p);if(y===void 0){let v=e.get(p);y=mn(v?Qt(v,r,i,W):r,G.length),Hn.set(p,y)}return y},Dn=(p,y,v,T,O,X)=>{let Q=T?0:v.length-1,z=y?.[O]?.[Ln(O,p,X)],rt=z?.offsets?.[Q]??z?.offset;return{normal:z?.normals[Q]??rn(p,v)[Q]??{nx:0,ny:0},shift:z?.shifts[Q]??Ae,offset:rt===void 0?Ht(p,an(p),O,X):rt*I}},Ge=(p,y)=>{if(!m)return!0;let v=V?nn(d)*I:(G.length-1)/2*an(y),T=ko*v*_;return be(p,m,T+(N?.furthestShift.dx??0),T/g+(N?.furthestShift.dy??0))},Be=(p,y,v)=>{let T=st?.[p]?.linkThreads;if(!T?.size)return Me;let O=T.get(y)?.get(v),X=Yo(o).get(v)?.has(y)?void 0:T.get(v)?.get(y);if(!X)return O??Me;let Q=X.map(([z,rt])=>[rt,z]);return O?[...O,...Q]:Q},cn=(p,y,v)=>G[p]?.passColors.get(y)?.[st?.[p]?.threadPasses.get(y)?.[v]??0],Wn=new WeakMap,Xe=(p,y)=>{if(!y||!V)return p;let v=Wn.get(y.shifts);if(!v){let{shifts:T}=y;v=p.map((O,X)=>{let{dx:Q,dy:z}=T[X]??Ae;return{...O,x:O.x+Q,y:O.y+z}}),Wn.set(y.shifts,v)}return v},$e=S>(u?1:_o);for(let p=0;p<o.edges.length;p++){let y=o.edges[p],v=n[y.from],T=n[y.to],O=E.get(p);if(!v?.length||!T?.length||!O||P?.has(p))continue;let X=y.pathIds?.length??0,z=M?.get(p)!==void 0,rt=l?.edgeIndexes.has(p)??!1,Dt=a/2*(z?ye:1),St=te(X,F,f),Ct=a/2*(z?f==="walks"&&F>0?Math.max(1,St):ye:St),lt=c&&X>0,Tt=z?mo:uo,yt=!l||rt?Tt:vt(Tt,Vt),ut=e.get(y.to),Wt=(ut?Qt(ut,r,i,W):r)/2,$=K=>!m||be(K,m),zt=K=>$n(K,go/S,g,m),jt=(K,Z,nt)=>{if(!z){B.push({curves:K,thickness:Z,color:nt});return}for(let mt of zt(K))B.push({curves:mt.curves,thickness:Z,color:nt})},xt=(K,Z,nt,mt,kt,Mt,It,at,Gn)=>{B.push({curves:K,thickness:Z,color:nt,walk:mt,pass:kt,normal:Mt,offsetX:It,endNormal:at,endOffsetX:Gn})},Ot=K=>{let Z=$e?So({curves:K,edgeHalfWidth:z||lt?a/2:Ct,nodeHalfWidth:Wt,scale:S,yToX:g,color:yt,fromSegments:v,toSegments:T}):void 0;Z&&J.push(Z)},dt=B.length,Gt=J.length,wt=l?.walks.length&&rt&&!lt?l.walks:void 0;if(wt&&!Ge(O,y.from))continue;if(wt){let K=To(y,v,O[0],R,g),Z=O.at(-1),nt=Oe({x:Z.x1,y:Z.y1},T,g),mt=wt.length===1,kt=Pn(an(y.from)),Mt=j?.frames.get(y.from),It=j?.frames.get(y.to);for(let at=0;at<wt.length;at++)if(wt[at].edgeIndexes.has(p))for(let[ln,Bn]of Be(at,y.from,y.to)){let ht=Dn(y.from,Mt,v,K,at,ln),Pt=V?Dn(y.to,It,T,nt,at,Bn):ht,At=mt?0:ht.offset*_,fn=V?Pt.offset*_:At,Xn=V?Kn(O,ht.shift.dx+ht.normal.nx*At,ht.shift.dy+ht.normal.ny*At/g,Pt.shift.dx+Pt.normal.nx*fn,Pt.shift.dy+Pt.normal.ny*fn/g):At===0?O:hn(O,ht.normal.nx*At,ht.normal.ny*At/g);$(Xn)&&xt(Xn,kt,cn(at,y.from,ln)??cn(at,y.to,Bn)??Tt,at,ln,ht.normal,At,Pt.normal,fn)}B.length>dt&&Ot(O)}else if(!lt)$(O)&&(jt(O,Ct,yt),Ot(O));else{let K=qn(v,T,X,h),Z=Math.floor((X-1)/2);for(let nt=0;nt<X;nt++){let{x:mt,y:kt}=K[nt],Mt=mt===0&&kt===0?O:hn(O,mt,kt);if(!$(Mt))continue;let It=q(y.pathIds[nt]);jt(Mt,Dt,l&&(l.walks.length?!l.names.has(y.pathIds[nt]):!rt)?vt(It,Vt):It),nt===Z&&Ot(Mt)}}let Jt=B.length-dt;Jt>0&&Y.set(p,{start:dt,count:Jt});let ft=J.length-Gt;ft>0&&D.set(p,{start:Gt,count:ft})}for(let[p,y]of Object.entries(n)){let v=e.get(p);if(!v||m&&!Go(y,m))continue;let T=l!==void 0&&!l.nodeIds.has(p),O=T?Te:Do(v,ct.get(p)??0,s,et),X=T?vt(O,Vt):v.moved?vt(O,po):O,Q=Qt(v,r,i,W),z=Q/2,rt=x.length,Dt=ot.get(p),St=Q/tt,Ct=y.length>=2,lt=l?.walks.length&&!T&&!Dt?.length?l.walks:void 0;if(Ct&<){let yt=mn(Q,lt.length),ut=Pn(yt),Wt=j?.frames.get(p);for(let $=0;$<lt.length;$++){let zt=lt[$].colors.get(p);if(zt===void 0)continue;let jt=st?.[$]?.nodeThreads.get(p)??Co;for(let xt of jt){let Ot=cn($,p,xt)??zt;if(lt.length===1){x.push({points:y,thickness:ut,color:Ot,walk:$,pass:xt});continue}let dt=Wt?.[$]?.[Ln($,p,xt)],Gt=We(p,y,dt),wt=Xe(y,dt),Jt=Ht(p,yt,$,xt),ft=dt?.offsets?.map(Z=>Z*I*_),K=ft?ft[Math.floor(ft.length/2)]:Rt(dt,0,Jt)*_;x.push({points:_e(wt,Gt,ft??K,g),thickness:ut,color:Ot,walk:$,pass:xt,normals:Gt,offsetX:K,...ft&&{offsets:ft}})}}}else if(Ct&&Dt?.length&&St>=yo){let yt=ve(y,g);for(let ut of Dt){let Wt=(ut-(tt-1)/2)*St*_,$=b[ut]??ge;x.push({points:_e(y,yt,Wt,g),thickness:St/2,color:T?vt($,Vt):$})}}else Ct&&x.push({points:y,thickness:z,color:X});let Tt=x.length-rt;Tt>0&&C.set(p,{start:rt,count:Tt})}return{nodeStrokes:x,nodeStrokeRuns:C,arrows:J,arrowRuns:D,edgeCurves:B,edgeCurveRuns:Y}}var Fe=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],On=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"orange",label:"Peach to rust",ends:["#ffc285","#8f3a00"]},{value:"rainbow",label:"Rainbow"}],Cn=["blue","red","purple","green"],qo=t=>Fe.some(n=>n.value===t),Vo=t=>On.some(n=>n.value===t);function zo(t,n,o,e=!0){let{field:s,scheme:r}=t.color??{},a=qo(s)?s:e?"progress":"walk",c=n?"grey":Cn[o%Cn.length],i=Vo(r)?r==="rainbow"&&a!=="reference"?c:r:c,f=Math.floor(o/Cn.length)%Pe.length;return a==="walk"&&i===c&&f>0?{field:a,scheme:i,shade:Pe[f]}:e||a==="walk"?{field:a,scheme:i}:{field:a,scheme:i,darkest:jo}}var jo=.55,kn=.5,Pe=[kn,.85,.2],Jo=.08,Ne=({field:t,scheme:n})=>t!=="walk"&&n!=="rainbow";function Qo(t){let n=new Map;for(let e of t)Ne(e)&&n.set(e.scheme,(n.get(e.scheme)??0)+1);let o=new Map;return t.map(e=>{let s=Ne(e)?n.get(e.scheme):1;if(s<2)return e;let r=o.get(e.scheme)??0;o.set(e.scheme,r+1);let a=Jo/2;return{...e,stretch:[r/s+(r>0?a:0),(r+1)/s-(r<s-1?a:0)]}})}var Le=({stretch:t},n)=>t?t[0]+(t[1]-t[0])*n:n,Zo=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,ts=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;function ns(t){let[n,o,e]=[1,3,5].map(c=>Zo(Number.parseInt(t.slice(c,c+2),16)/255)),s=Math.cbrt(.4122214708*n+.5363325363*o+.0514459929*e),r=Math.cbrt(.2119034982*n+.6806995451*o+.1073969566*e),a=Math.cbrt(.0883024619*n+.2817188376*o+.6299787005*e);return[.2104542553*s+.793617785*r-.0040720468*a,1.9779984951*s-2.428592205*r+.4505937099*a,.0259040371*s+.7827717662*r-.808675766*a]}function es([t,n,o]){let e=(t+.3963377774*n+.2158037573*o)**3,s=(t-.1055613458*n-.0638541728*o)**3,r=(t-.0894841775*n-1.291485548*o)**3;return[4.0767416621*e-3.3077115913*s+.2309699292*r,-1.2684380046*e+2.6097574011*s-.3413193965*r,-.0041960863*e-.7034186147*s+1.707614701*r].map(a=>ts(Math.max(0,Math.min(1,a)))*255)}var Tn=new Map;function os(t){if(!Tn.has(t)){let n=On.find(o=>o.value===t);Tn.set(t,n&&"ends"in n?n.ends.map(ns):void 0)}return Tn.get(t)}function In(t,n,o=0){let e=Math.max(0,Math.min(1,n)),s=os(t);if(!s)return Rn(qt(e),Ut,Yt).map(l=>l*255);let[r,a]=s,c=r[0],i=a[0],f=i<o&&c>o?(c-o)/(c-i):1;return es(r.map((l,h)=>l+(a[h]-l)*e*f))}function He(t,n,o){let[e,s,r]=In(t,n,o).map(Math.round);return`rgb(${e}, ${s}, ${r})`}function sn(t,n,o){let[e,s,r]=In(t,n,o).map(Math.round);return U(e,s,r,255)}function ss(t,n){let{field:o,scheme:e,darkest:s,shade:r=kn}=t;return o==="walk"?sn(e,r):n===void 0?De:sn(e,Le(t,n),s)}var De=Sn;function rs(t){let{field:n,scheme:o,darkest:e,shade:s=kn}=t,r=(a,c)=>({offset:a,color:He(o,c,e),abgr:sn(o,c,e)});return n==="walk"?[r(0,s)]:Array.from({length:7},(a,c)=>r(c/6,Le(t,c/6)))}export{lo as a,ho as b,Et as c,pn as d,is as e,U as f,ue as g,fs as h,vt as i,hs as j,so as k,ds as l,ao as m,ms as n,me as o,Ns as p,Rn as q,Fs as r,Lo as s,Ls as t,Ho as u,Do as v,Hs as w,Fe as x,On as y,zo as z,Qo as A,ss as B,De as C,rs as D};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{G as jn,H as Jn,I as un,J as dn,S as Qn,U as Qt,V as mn,Y as Zn,Z as te,d as $n,e as Kn,f as hn,h as Un,i as Yn,j as qn,k as Vn,l as $t,y as zn}from"./chunk-FUKZO5AZ.js";import{a as Bt,g as Xt}from"./chunk-AZUO4NZ5.js";var Et=2,ae=1.5,Ke=4,ne=12,Ue=64,ee=24,Ye=48,oe="a thread per pass through a node",pn=t=>t.length>1&&t.some(n=>n.mostPasses>1),ce=t=>t*Et+Math.max(0,t-1)*ae,se=t=>t.reduce((n,o)=>n+o,0);function ie(t,n,o){let e=t.map((a,c)=>n[c]>1?ce(a):o*Math.min(1,a)),s=0,r=t.map(a=>{let c=Math.min(1,a),i=Ke*c*s;return s=Math.max(s,c),i});return{widths:e,gaps:r,band:se(e)+se(r)}}var gn=Et+ae;function Kt(t,n,o=t){let{widths:e,gaps:s,band:r}=ie(t,n,Et),a=-r/2;return e.map((c,i)=>{a+=s[i];let f=n[i]>1?Math.max(0,c-ce(o[i])):0,l=a+f/2+Et/2;return a+=c,l})}var nn=t=>ie(t,t,Et).band,en=t=>Math.min(1,Ye/(nn(t)||1)),is=t=>en(t.map(n=>n.mostPasses))<1?`${oe}, thinned to fit`:oe;function Zt(t,n){let o=t.stepOf[n],e=n-t.starts[o];return t.forward[o]?e:t.starts[o+1]-t.starts[o]-1-e}var Nt=(t,n)=>{let o=n.x-t.x,e=n.y-t.y;return Math.sqrt(o*o+e*e)};function Ft(t){let n=new Float64Array(t.length);for(let o=1;o<t.length;o++)n[o]=n[o-1]+Nt(t[o-1],t[o]);return n}function yn(t,n){let o=new Set;return t.map(e=>{let s=new Map;return e.map(r=>r.map(a=>{let c=s.get(a)??0;s.set(a,c+1);let i=n[a],f=!!i?.length&&!o.has(a);return f&&o.add(a),{id:a,visit:c,owned:f,segments:i}}))})}function qe(t,n,o){let e=[];return t.forEach((s,r)=>{let a=0;for(let M of s)for(let{segments:A}of M)a+=A?.length??0;let c=new Float64Array(a),i=new Float64Array(a),f=0,l=0,h=u();function u(){return{walk:r,ids:[],visits:[],forward:[],owned:[],starts:[0]}}let m=()=>{if(h.ids.length){let M=new Int32Array(f-l);for(let A=0;A<h.ids.length;A++)M.fill(A,h.starts[A],h.starts[A+1]);e.push({...h,xs:c.subarray(l,f),ys:i.subarray(l,f),stepOf:M})}h=u(),l=f},w=(M,A,R)=>{let P=R.x-M,k=R.y*n-A;return Math.sqrt(P*P+k*k)};for(let M of s)M.forEach(({id:A,visit:R,owned:P,segments:k},W)=>{if(!k?.length){m();return}let F=k[0],S=k.at(-1),_;if(f>l){let g=c[f-1],E=i[f-1],x=w(g,E,F),C=w(g,E,S);_=x<=C,Math.min(x,C)>o&&m()}else{let g=M[W+1]?.segments,E=x=>g?.length?Math.min(w(x.x,x.y*n,g[0]),w(x.x,x.y*n,g.at(-1))):0;_=E(S)<=E(F)}h.ids.push(A),h.visits.push(R),h.forward.push(_),h.owned.push(P);for(let g=0;g<k.length;g++){let E=k[_?g:k.length-1-g];c[f]=E.x,i[f]=E.y*n,f++}h.starts.push(f-l)}),m()}),e}function xn(t,n,o){let e=[];for(let s=0;s<n.length;s++){if(!n[s])continue;let r=s;for(;r+1<n.length&&n[r+1];)r++;let a=e.at(-1),c=a?a[1]:0,i=s;for(;i>c&&t[s]-t[i-1]<=o;)i--;let f=r;for(;f+1<t.length&&t[f+1]-t[r]<=o;)f++;a&&i<=a[1]+1?a[1]=f:e.push([i,f]),s=r}return e}function Ve(t,n){let o=Ft(t),e=o.at(-1),s=(c,i)=>{let f=t[i],l=t[Math.min(i+1,t.length-1)],h=o[Math.min(i+1,t.length-1)]-o[i],u=h>0?(c-o[i])/h:0;return{x:f.x+(l.x-f.x)*u,y:f.y+(l.y-f.y)*u}},r=0,a=0;return t.map((c,i)=>{let f=Math.max(0,o[i]-n/2),l=Math.min(e,o[i]+n/2);for(;r<t.length-1&&o[r+1]<=f;)r++;for(;a<t.length-1&&o[a+1]<=l;)a++;let h=s(f,r),u=s(l,a),m=Nt(h,u);return m>0?{nx:-(u.y-h.y)/m,ny:(u.x-h.x)/m}:void 0})}function ze(t,n,o){let e=Ft(t),s=t.slice(),r=[];e.forEach((c,i)=>{let f=r.at(-1);(f===void 0||c-e[f]>=n/4)&&r.push(i)}),r.at(-1)!==t.length-1&&r.push(t.length-1);let a=0;for(;a<r.length;){let c=r[a],i=-1;for(let u=a+1;u<r.length&&e[r[u]]-e[c]<=o;u++){let m=r[u];e[m]-e[c]>Math.PI*n&&Nt(t[c],t[m])<=n&&(i=u)}if(i<0){a++;continue}let f=r[i],l=t[c],h=t[f];for(let u=c+1;u<f;u++){let m=(e[u]-e[c])/(e[f]-e[c]);s[u]={...t[u],x:l.x+(h.x-l.x)*m,y:l.y+(h.y-l.y)*m}}a=i}return s}function le(t,n){let o=t.length,e=Ft(t),s=e[o-1],r=new Float64Array(o+1),a=new Float64Array(o+1),c=new Float64Array(o+1);for(let h=0;h<o;h++){let u=t[h],m=(e[Math.min(h+1,o-1)]-e[Math.max(h-1,0)])/2;r[h+1]=r[h]+m,a[h+1]=a[h]+m*u.x,c[h+1]=c[h]+m*u.y}let i=new Array(o),f=0,l=0;for(let h=0;h<o;h++){let u=t[h],m=Math.min(n,e[h],s-e[h]),w=e[h]-m,M=e[h]+m+1e-9*(1+s);for(;f<o&&e[f]<w;)f++;for(;l<o&&e[l]<M;)l++;let A=r[l]-r[f];i[h]=A>0?{x:(a[l]-a[f])/A,y:(c[l]-c[f])/A}:{x:u.x,y:u.y}}return i}function re(t,n){let o=t.length,e=Ft(t),s=e[o-1],r=new Uint8Array(o),a=(f,l)=>{let h=t[f],u=t[f+1];if(!u)return h;let m=e[f+1]-e[f],w=m>0?(l-e[f])/m:0;return{x:h.x+(u.x-h.x)*w,y:h.y+(u.y-h.y)*w}},c=0,i=0;for(let f=0;f<o;f++){if(e[f]<n||s-e[f]<n)continue;for(;c+1<o&&e[c+1]<=e[f]-n;)c++;for(;i+1<o&&e[i+1]<=e[f]+n;)i++;let l=t[f],h=a(c,e[f]-n),u=a(i,e[f]+n),m=Math.abs((u.x-h.x)*(l.y-h.y)-(u.y-h.y)*(l.x-h.x));r[f]=m>0&&Nt(h,u)*Nt(h,l)*Nt(l,u)/(2*m)<n?1:0}return{tight:r,s:e}}function je(t,n){let o=t.slice(),{tight:e,s}=re(o,n),r=xn(s,Array.from(e,a=>a>0),3*n);for(let a=0;a<8&&r.length;a++)r=r.filter(([c,i])=>{let f=o.slice(c,i+1),l=re(f,n);if(!l.tight.includes(1))return!1;let h=tn(l.s,l.tight,n),u=le(f,n);for(let m=0;m<f.length;m++){let w=Math.min(1,3*h[m]);if(w>0){let M=f[m],A=u[m];o[c+m]={x:M.x+(A.x-M.x)*w,y:M.y+(A.y-M.y)*w}}}return!0});return o}function Je(t,n,o,e,s,r){let a=n.length,c=new Float64Array(a),i=0,f=0,l=0,h=0,u=0;for(let m=0;m<a;m++){for(;i<a&&t[i]-t[m]<=r;){let w=o(i),M=n[i];c[i]=w&&M?w.nx*M.nx+w.ny*M.ny:0,l+=c[i],i++}for(;t[m]-t[f]>r;)l-=c[f++];if(Math.abs(l)>1e-9&&(h=l<0?-1:1),!!h)for(;u<=m;u++)s(u,h)}if(u<a){let m=0;for(let w=0;w<a;w++)m+=e(w)?1:-1;for(;u<a;u++)s(u,m<0?-1:1)}}function Qe(t,n,o,e,s=!0){let r=Math.max(o,2*e),a=Math.PI*e,c=s?a+3*e+r/2:r/2,i=new Map,f=new Map,l=[],h=[],u=w=>({normals:new Array(w),shifts:s?new Array(w):[]}),m=(w,M,A,R)=>{let P=i.get(w);P||(P=[],i.set(w,P)),(P[M]??=[])[A]=R};return t.forEach((w,M)=>{let{walk:A,ids:R,visits:P,owned:k,starts:W,xs:F,ys:S,stepOf:_}=w,g=R.length,E=F.length,x=new Array(g);for(let d=0;d<g;d++)k[d]&&(x[d]=u(W[d+1]-W[d]),f.set(R[d],{run:M,step:d,frame:x[d]}),m(R[d],A,P[d],x[d]));let C=new Float64Array(E);for(let d=1;d<E;d++){let I=F[d]-F[d-1],N=S[d]-S[d-1];C[d]=C[d-1]+Math.sqrt(I*I+N*N)}let J=C[E-1],D=new Int32Array(g).fill(-1),B=new Int32Array(g),Y=new Array(g);for(let d=0;d<g;d++){let I=k[d]?void 0:f.get(R[d]);I&&(D[d]=I.run,B[d]=I.step,Y[d]=I.frame)}let et=new Int32Array(g),ct=new Int32Array(g);for(let d=0;d+1<g;d++){let N=D[d]>=0&&D[d+1]===D[d]?B[d+1]-B[d]:0;et[d+1]=et[d]+(N===1?1:0),ct[d+1]=ct[d]+(N===-1?1:0)}let tt=new Array(g),b=0,L=0;for(let d=0;d<g;d++){if(!s){tt[d]=!k[d];continue}let I=C[W[d]]-c,N=C[W[d+1]-1]+c;for(;C[b]<I;)b++;for(;L+1<E&&C[L+1]<=N;)L++;let j=_[Math.max(0,b-1)],st=_[Math.min(E-1,L+1)],H=st-j,it=et[st]-et[j],gt=ct[st]-ct[j];tt[d]=!k[d]&&I>=0&&N<=J&&H>0&&(it===H||gt===H)}for(let d=0;d<g;d++){if(k[d])continue;let I=Y[d];x[d]=!s&&tt[d]?I:tt[d]?{normals:I.normals,shifts:I.shifts}:u(I.normals.length),m(R[d],A,P[d],x[d])}h.push(x);let q=new Array(E);for(let d=0;d<E;d++)q[d]=!tt[_[d]];for(let[d,I]of xn(C,q,c)){let N=[];for(let H=d;H<=I;H++)N.push({x:F[H],y:S[H]});let j=s?je(le(ze(N,e/2,a),e/2),e/2):N,st=Ve(j,r);Je(Ft(j),st,H=>{let it=_[d+H];return(k[it]?x[it]:Y[it])?.normals[Zt(w,d+H)]},H=>w.forward[_[d+H]],(H,it)=>{let gt=d+H,Lt=_[gt];if(tt[Lt])return;let Ht=Zt(w,gt),Rt=st[H];x[Lt].normals[Ht]=Rt&&(it>0?Rt:{nx:-Rt.nx,ny:-Rt.ny}),s&&(x[Lt].shifts[Ht]={dx:j[H].x-N[H].x,dy:(j[H].y-N[H].y)/n})},r)}if(!s){l.push(C);return}let ot=new Float64Array(E),G=0,V=0;for(let d=0;d<E;d++){let I=x[_[d]].shifts[Zt(w,d)],N=F[d]+(I?.dx??0),j=S[d]+(I?.dy??0)*n;ot[d]=d?ot[d-1]+Math.sqrt((N-G)**2+(j-V)**2):0,G=N,V=j}l.push(ot)}),{frames:i,arcs:l,stepFrames:h}}function fe(t,n,o,e){let s=new Array(n.length),r=[],a=0,c=0;for(let i=0;i<n.length;i++){for(;c<n.length&&t[c]-t[i]<=o;){for(;r.length>a&&e*n[r.at(-1)]<=e*n[c];)r.pop();r.push(c++)}for(;t[i]-t[r[a]]>o;)a++;s[i]=n[r[a]]}return s}function tn(t,n,o,e=()=>!0){let s=n.length,r=new Float64Array(s+1),a=new Float64Array(s+1);for(let l=0;l<s;l++){let h=e(n[l])?s>1?(t[Math.min(l+1,s-1)]-t[Math.max(l-1,0)])/2:1:0;r[l+1]=r[l]+h,a[l+1]=a[l]+h*n[l]}let c=new Float64Array(s),i=0,f=0;for(let l=0;l<s;l++){for(;t[l]-t[i]>o;)i++;for(;f<s&&t[f]-t[l]<=o;)f++;let h=r[f]-r[i];c[l]=h>0?(a[f]-a[i])/h:n[l]}return c}var Ze=[0];function to(t){for(let n of t.values())if(n>1)return!0;return!1}function no(t,n,o,e,s){if(!to(n))return{span:n,nodeThreads:new Map,threadPasses:new Map,threadAt:new Map,linkThreads:new Map};let r=new Map,a=[],c=[],i=[],f=[],l=[],h=[],u=[];for(let S of t){let _=[],g=[];for(let b of S){let L=r.get(b);L===void 0&&(L=a.length,r.set(b,L),a.push(b),c.push(0),i.push(0)),g.push(L);let q=o[b],ot=q?.[Math.floor(q.length/2)];_.push(ot?{x:ot.x,y:ot.y*e}:_.at(-1)??{x:0,y:0})}let E=Ft(_),x=S.map(b=>n.get(b)??1),C=fe(E,x,s/2,1),J=g.map(b=>++i[b]),D=S.length,B=new Int32Array(D),Y=-1;for(let b=0;b<D;b++)Y=x[b]===C[b]?b:Y,B[b]=Y;let et=new Int32Array(D);Y=-1;for(let b=D-1;b>=0;b--)Y=x[b]===C[b]?b:Y,et[b]=Y;let ct=new Array(D),tt=new Array(D).fill(NaN);for(let b=0;b<D;b++){let L=B[b],q=et[b],ot=L<0?q:q<0||E[b]-E[L]<=E[q]-E[b]?L:q,G=V=>Math.min(J[V],C[b])-1;if(ct[b]=G(ot),x[b]===1&&L>=0&&q>=0&&G(q)!==G(L)){let V=(E[b]-E[L])/(E[q]-E[L]||1);tt[b]=G(L)+(G(q)-G(L))*V}c[g[b]]=Math.max(c[g[b]],C[b])}f.push(g),l.push(J),h.push(ct),u.push(tt)}let m=[],w=[],M=(S,_)=>{let g=c[S],E=m[S]??=new Set;for(let x=0;x<g;x++)for(let C of[_-x,_+x])if(C>=0&&C<g&&!E.has(C))return C;return _},A=[];f.forEach((S,_)=>{S.forEach((g,E)=>{if(c[g]>1){let x=u[_][E],C=M(g,Number.isNaN(x)?h[_][E]:Math.round(x));m[g].add(C),(w[g]??=[])[l[_][E]]=C,Number.isNaN(x)||((A[g]??=[])[C]=x)}})});let R=new Map,P=new Map,k=new Map,W=new Map;a.forEach((S,_)=>{A[_]&&W.set(S,A[_]),R.set(S,c[_]),P.set(S,m[_]?[...m[_]].sort((E,x)=>E-x):Ze);let g=[];w[_]?.forEach((E,x)=>{g[E]=x-1}),k.set(S,g)});let F=new Map;return f.forEach((S,_)=>{let g=l[_];for(let E=1;E<S.length;E++){let x=S[E-1],C=S[E],J=[w[x]?.[g[E-1]]??0,w[C]?.[g[E]]??0],D=F.get(a[x]);D||(D=new Map,F.set(a[x],D));let B=D.get(a[C]);B?B.some(([Y,et])=>Y===J[0]&&et===J[1])||B.push(J):D.set(a[C],[J])}}),{span:R,nodeThreads:P,threadPasses:k,threadAt:W,linkThreads:F}}function eo(t,n,o,{reach:e,taper:s}){let r=new Map;return t.forEach((a,c)=>{let i=n[c],f=a.ids.map((l,h)=>{let u=a.starts[h+1]-a.starts[h],m=Math.floor(u/2);return i[a.starts[h]+(a.forward[h]?m:u-1-m)]});for(let[l,h]of xn(f,a.owned,e/2+s/2)){let u=f.slice(l,h+1),m=a.ids.slice(l,h+1),w=o.map(M=>{let A=m.map(R=>M.get(R)??0);return A.every(R=>R===A[0])?{slot:A,held:A}:{slot:tn(u,fe(u,A,e/2,1),s/2),held:tn(u,A,s/2,R=>R>0)}});m.forEach((M,A)=>{a.owned[l+A]&&r.set(M,{slot:w.map(R=>R.slot[A]),held:w.map(R=>R.held[A])})})}}),r}function oo(t,n,o,e,s,r,a){let c=Kt(s,s),i=new Map,f=l=>{let h=i.get(l);if(!h){let u=e.get(l);h=u?Kt(u.slot,s,u.held):c,i.set(l,h)}return h};t.forEach((l,h)=>{let{walk:u,ids:m,visits:w,starts:M}=l,{threadPasses:A,threadAt:R}=r[u],P=new Float64Array(l.xs.length);m.forEach((W,F)=>{let S=Math.max(0,A.get(W)?.indexOf(w[F])??0),_=R.get(W)?.[S]??S;P.fill(f(W)[u]+_*gn,M[F],M[F+1])});let k=tn(o[h],P,a);n[h].forEach((W,F)=>{let S=M[F],_=M[F+1],g=!0;for(let x=S+1;g&&x<_;x++)g=Math.abs(k[x]-k[S])<1e-9;if(g){W.offset=k[S];return}let E=new Array(_-S);for(let x=S;x<_;x++)E[Zt(l,x)]=k[x];W.offsets=E})})}function he(t,n,o,e,s=yn(t.map(r=>r.route),n)){let r=pn(t),a=t.map(M=>M.mostPasses),c=Ue*e,i=qe(s,o,ne*e),f=nn(a)*(r?en(a):1)*e,l=Qe(i,o,ne*e,f,r),h=r?t.map(M=>no(M.route,M.passes,n,o,c)):void 0,u=h?eo(i,l.arcs,h.map(M=>M.span),{reach:c,taper:ee*e}):void 0;u&&h&&oo(i,l.stepFrames,l.arcs,u,a,h,ee/2*e);let m={dx:0,dy:0},w=new Set;for(let M of l.frames.values())for(let{shifts:A}of M.flat())if(!w.has(A)){w.add(A);for(let R of A)m.dx=Math.max(m.dx,Math.abs(R?.dx??0)),m.dy=Math.max(m.dy,Math.abs(R?.dy??0))}return{lines:l,threads:h,spans:u,furthestShift:m}}function U(t,n,o,e){return(e<<24|o<<16|n<<8|t)>>>0}function wn(t){return t&255}function Mn(t){return t>>>8&255}function An(t){return t>>>16&255}function En(t){return t>>>24&255}function ue(t){return`rgba(${wn(t)},${Mn(t)},${An(t)},${En(t)/255})`}function fs(t,n){return`rgba(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)},${n})`}function vt(t,n){return U(wn(t),Mn(t),An(t),Math.round(En(t)*n))}function hs(t,n){let o=Math.max(0,1-1/n),e=s=>Math.round(s+(255-s)*o);return U(e(wn(t)),e(Mn(t)),e(An(t)),En(t))}var de=300,Ut=.7,Yt=.5;function so(t){return`hsl(${t}, ${Ut*100}%, ${Yt*100}%)`}function qt(t){return Math.max(0,Math.min(1,t))*de}function vn(t,n){return qt((t-n.start)/(n.end-n.start))}var ro=30;function ds({start:t,bp:n,reversed:o},e){let s=vn(t,e),r=vn(t+n,e);if(r-s<1)return[(s+r)/2];let a=Math.ceil((r-s)/ro);return Array.from({length:a+1},(c,i)=>vn(t+n*(o?a-i:i)/a,e))}var ao=Array.from({length:7},(t,n)=>({offset:n/6,color:so(n/6*de)})),ms=`linear-gradient(to right, ${ao.map(t=>`${t.color} ${t.offset*100}%`).join(", ")})`;var co=$t();function me(t,n,o,e,s,r,a=!1){return co(t,[n,o.scaleX,o.scaleY,e,r,a,s],()=>{let c=new Map;for(let i=0;i<n.edges.length;i++){let f=e?.get(i),l=zn(t,n.edges[i],o,f,f&&r?.[i],a);l&&c.set(i,l)}return c})}var io=4;function lo(t){let n=new Map;for(let o of t.edges)Bt(n,o.from,o.to),Bt(n,o.to,o.from);return n}function fo({nodeId:t,nodeById:n,neighbors:o}){let e=new Set([t]),s=[t],r=1/0,a=-1/0;for(let c=0;c<io&&s.length>0;c++){let i=[];for(let f of s){let l=o.get(f);if(l){for(let h of l)if(!e.has(h)){e.add(h);let u=n.get(h);u&&Xt(u)?(r=Math.min(r,u.stable.start+u.length),a=Math.max(a,u.stable.start)):i.push(h)}}}s=i}return r===1/0?void 0:{start:Math.min(r,a),end:Math.max(r,a)}}function ho({nodeId:t,nodeById:n,neighbors:o}){let e=n.get(t);return e===void 0?void 0:Xt(e)?{start:e.stable.start,end:e.stable.start+e.length}:fo({nodeId:t,nodeById:n,neighbors:o})}function pe(t){let n=new Map(t.nodes.map(s=>[s.id,s])),o=lo(t),e=new Map;for(let s of t.nodes){let r=ho({nodeId:s.id,nodeById:n,neighbors:o});r&&e.set(s.id,(r.start+r.end)/2)}return e}var uo=U(119,119,119,217),ge=U(136,136,136,217),mo=U(24,24,28,240),ye=2.2,Te=U(160,160,160,255),Vt=.18,po=.45,Ns=ue(vt(Te,Vt)),go=11,yo=1.2,xo=1e-6,wo=7,Mo=3,Ao=3,Eo=1.5,xe=3,vo=.5,_o=.45,_n=12,bo=1e-6,pt=new Float64Array(64),_t=new Float64Array(64),bt=new Float64Array(64);function Ro(t,n,o,e){let s=t.length*_n+1;pt.length<s&&(pt=new Float64Array(s),_t=new Float64Array(s),bt=new Float64Array(s));let r=t[t.length-1];pt[0]=r.x1,_t[0]=r.y1,bt[0]=0;let a=1,c=0;for(let i=t.length-1;i>=0&&c<e;i--){let f=t[i];for(let l=1;l<=_n&&c<e;l++){let h=1-(l/_n)**2,u=1-h,m=u*u*u,w=3*u*u*h,M=3*u*h*h,A=h*h*h,R=m*f.x0+w*f.cx0+M*f.cx1+A*f.x1,P=m*f.y0+w*f.cy0+M*f.cy1+A*f.y1;c+=Math.hypot(R-pt[a-1],(P-_t[a-1])*o)*n,pt[a]=R,_t[a]=P,bt[a]=c,a++}}return a}function we(t,n){let o=1;for(;o<t-1&&bt[o]<n;)o++;let e=bt[o-1],s=bt[o],r=s>e?Math.min(1,Math.max(0,(n-e)/(s-e))):0;return{x:pt[o-1]+(pt[o]-pt[o-1])*r,y:_t[o-1]+(_t[o]-_t[o-1])*r}}function So({curves:t,edgeHalfWidth:n,nodeHalfWidth:o,scale:e,yToX:s,color:r,fromSegments:a,toSegments:c}){let i=wo+Mo*n,f=Ro(t,e,s,o+xe*i),l=bt[f-1],h=l<bo,u=Math.min(o,l),m=h?Math.min(1,Vn(a,e,e*s)/i):1;if(h?m<vo:l<xe*i)return;let w=we(f,u),M=we(f,u+i*m),A=w.x-M.x,R=(w.y-M.y)*s,P=t[t.length-1];return{x:w.x,y:w.y,angle:Math.hypot(A,R)>0?Math.atan2(R,A):Wo(P,s,Oo(P,c)),length:i*m,halfWidth:(Ao+Eo*n)*m,color:r}}var Me=[[0,0]],Co=[0],Ae={dx:0,dy:0};function Oe(t,n,o){let e=s=>Math.hypot(s.x-t.x,(s.y-t.y)*o);return e(n[0])<e(n.at(-1))}function To(t,n,o,e,s){return e?Un(t).from==="start":Oe({x:o.x0,y:o.y0},n,s)}function Oo(t,n){if(n.length<2)return;let o=n[0],e=n[n.length-1];return Math.hypot(t.x1-o.x,t.y1-o.y)<=Math.hypot(t.x1-e.x,t.y1-e.y)?{from:o,to:n[1]}:{from:e,to:n[n.length-2]}}function Ee(t,n){if(!t||!n)return;let o=n.x-t.x,e=n.y-t.y,s=Math.hypot(o,e);return s>0?{nx:-e/s,ny:o/s}:void 0}var ke=.1,ko=1/Math.sqrt(ke);function ve(t,n=1){let o=n===1?t:t.map(e=>({x:e.x,y:e.y*n}));return o.map((e,s)=>{let r=Ee(o[s-1],e),a=Ee(e,o[s+1]);if(r&&a){let c=(r.nx+a.nx)/2,i=(r.ny+a.ny)/2,f=r.nx*c+r.ny*i;return f>ke?{nx:c/f,ny:i/f}:{nx:c,ny:i}}return r??a??{nx:0,ny:0}})}function _e(t,n,o,e=1){let s=new Array(t.length);for(let r=0;r<t.length;r++){let a=typeof o=="number"?o:o[r];s[r]={x:t[r].x+n[r].nx*a,y:t[r].y+n[r].ny*a/e}}return s}function Rn(t,n,o){let e=(1-Math.abs(2*o-1))*n,s=e*(1-Math.abs(t/60%2-1)),r=o-e/2,a=0,c=0,i=0;return t<60?(a=e,c=s):t<120?(a=s,c=e):t<180?(c=e,i=s):t<240?(c=s,i=e):t<300?(a=s,i=e):(a=e,i=s),[a+r,c+r,i+r]}function on(t,n,o,e=1){let[s,r,a]=Rn(t,n,o);return U(Math.round(s*255),Math.round(r*255),Math.round(a*255),Math.round(e*255))}var Io=[[68,1,84],[59,82,139],[33,145,140],[94,201,98],[253,231,37]],Po=[[237,137,44],[158,42,122]],No=[[220,50,50],[50,120,220]];function bn(t,n){let o=Math.max(0,Math.min(1,n))*(t.length-1),e=Math.min(t.length-2,Math.floor(o)),s=o-e,r=t[e],a=t[e+1];return U(Math.round(r[0]+(a[0]-r[0])*s),Math.round(r[1]+(a[1]-r[1])*s),Math.round(r[2]+(a[2]-r[2])*s),255)}function Fo(t,n){return on(jn(t),un,dn,n)}var Ie=[60,65,72],Sn=U(...Ie,255),Fs=`rgb(${Ie.join(", ")})`;function Lo(t,n){let o=n.midpoints.get(t.id);return Xt(t)&&o!==void 0?(o-n.start)/n.span:void 0}function Ls(t,n){let o=pe(t);if(n&&n.end>n.start)return{start:n.start,span:n.end-n.start,midpoints:o};let e=1/0,s=-1/0;for(let r of o.values())e=Math.min(e,r),s=Math.max(s,r);return{start:e===1/0?0:e,span:s>e?s-e:1,midpoints:o}}function Ho(t,n){let o=1/0,e=-1/0,s=1/0,r=-1/0,a=0;for(let c of t.nodes)c.stable!==void 0&&c.stable.rank>a&&(a=c.stable.rank),c.depth<o&&(o=c.depth),c.depth>e&&(e=c.depth),c.length<s&&(s=c.length),c.length>r&&(r=c.length);return{minDepth:o,maxDepth:e,minLength:s,maxLength:r,maxRank:a,nodeCount:t.nodes.length,referenceRamp:n}}function Do(t,n,o,e){switch(o){case"random":return Fo(t.id,1);case"depth":return bn(Io,e.maxDepth>e.minDepth?(t.depth-e.minDepth)/(e.maxDepth-e.minDepth):.5);case"node-length":return bn(No,e.maxLength>e.minLength?(t.length-e.minLength)/(e.maxLength-e.minLength):.5);case"stable-rank":return t.stable===void 0?U(160,160,160,255):t.stable.rank===0?U(52,152,219,255):bn(Po,e.maxRank>1?(t.stable.rank-1)/(e.maxRank-1):0);case"reference-position":{let s=e.referenceRamp;if(s===void 0)return U(160,160,160,255);let r=Lo(t,s);return r===void 0?Sn:on(qt(r),Ut,Yt)}case"grey":return U(160,160,160,255);case"rainbow":{let s=e.nodeCount>1?n/e.nodeCount*360:0;return on(s,.75,.5)}default:return U(52,152,219,255)}}function Wo(t,n=1,o){let e=[[t.cx1,t.cy1],[t.cx0,t.cy0],[t.x0,t.y0]];for(let[s,r]of e){let a=t.x1-s,c=(t.y1-r)*n;if(Math.hypot(a,c)>0)return Math.atan2(c,a)}return o?Math.atan2((o.to.y-o.from.y)*n,o.to.x-o.from.x):0}function Go(t,n){let o=!1;for(let e=0;e<t.length-1&&!o;e++){let s=t[e],r=t[e+1];o=Math.max(s.x,r.x)>=n.minX&&Math.min(s.x,r.x)<=n.maxX&&Math.max(s.y,r.y)>=n.minY&&Math.min(s.y,r.y)<=n.maxY}return o}function be(t,n,o=0,e=0){for(let s of t){let r=Math.min(s.x0,s.cx0,s.cx1,s.x1),a=Math.max(s.x0,s.cx0,s.cx1,s.x1),c=Math.min(s.y0,s.cy0,s.cy1,s.y1),i=Math.max(s.y0,s.cy0,s.cy1,s.y1);if(a>=n.minX-o&&r<=n.maxX+o&&i>=n.minY-e&&c<=n.maxY+e)return!0}return!1}var Re=new WeakMap;function Bo(t){let n=Re.get(t);if(!n){let o=[],e=new Map,s=t.paths??[];for(let r=0;r<s.length;r++)o.push(on(Jn(r,s.length),un,dn,.85)),e.has(s[r].name)||e.set(s[r].name,r);n={pathColorByIndex:o,pathIndexByName:e},Re.set(t,n)}return n}var Se=new WeakMap,Xo=new Map;function $o(t){let n=Se.get(t);if(!n){n=new Map;for(let[o,e]of(t.paths??[]).entries())for(let s of new Set(e.nodeIds))Bt(n,s,o);Se.set(t,n)}return n}var Ko=$t(),Uo=$t(),Ce=new WeakMap;function Yo(t){let n=Ce.get(t);if(!n){n=new Map;for(let{from:o,to:e}of t.edges){let s=n.get(o);s||(s=new Set,n.set(o,s)),s.add(e)}Ce.set(t,n)}return n}function Hs(t){let{nodePositions:n,graph:o,nodeById:e,colorScheme:s,contigThickness:r,connectorThickness:a,drawPaths:c,nodeWidth:i="uniform",edgeWidth:f="uniform",highlight:l,axis:h,linearLayout:u,viewportBounds:m,referenceRamp:w,deletions:M,deletionRoutes:A,stranded:R,hiddenEdges:P,version:k=0}=t,W=Qn(o,i),F=f==="walks"?Zn(o):0,S=h.scaleX,_=1/Math.max(S,xo),g=Yn(h),E=me(n,o,h,M,k,A,R),x=[],C=new Map,J=[],D=new Map,B=[],Y=new Map,et=Ho(o,w),ct=new Map;if(s==="rainbow")for(let p=0;p<o.nodes.length;p++)ct.set(o.nodes[p].id,p);let tt=o.paths?.length??0,{pathColorByIndex:b,pathIndexByName:L}=Bo(o),q=p=>b[L.get(p)??-1]??ge,ot=c&&tt>1?$o(o):Xo,G=l?.walks??[],V=pn(G),d=G.map(p=>p.mostPasses),I=V?en(d):1,N=l&&G.length>1?Ko(l,[n,k,h.scaleX,h.scaleY],()=>he(G,n,g,_,Uo(l,[n,k],()=>yn(G.map(p=>p.route),n)))):void 0,j=N?.lines,st=N?.threads,H=N?.spans,it=V?Kt(d,d):[],gt=new Map,Lt=p=>{let y=gt.get(p);if(!y){let v=H?.get(p);y=v?Kt(v.slot,d,v.held):it,gt.set(p,y)}return y},Ht=(p,y,v,T)=>V?(Lt(p)[v]+T*gn)*I:(v-(G.length-1)/2)*y,Rt=(p,y,v)=>{let T=p?.offsets?.[y]??p?.offset;return T===void 0?v:T*I},Pn=p=>V?Et/2*I:p/2,Nn=new Map,Fn=new WeakMap,Ln=(p,y,v)=>st?.[p]?.threadPasses.get(y)?.[v]??0,rn=(p,y)=>{let v=Nn.get(p);return v||(v=ve(y,g),Nn.set(p,v)),v},We=(p,y,v)=>{if(!v)return rn(p,y);let T=Fn.get(v.normals);return T||(T=rn(p,y).map((O,X)=>v.normals[X]??O),Fn.set(v.normals,T)),T},Hn=new Map,an=p=>{let y=Hn.get(p);if(y===void 0){let v=e.get(p);y=mn(v?Qt(v,r,i,W):r,G.length),Hn.set(p,y)}return y},Dn=(p,y,v,T,O,X)=>{let Q=T?0:v.length-1,z=y?.[O]?.[Ln(O,p,X)],rt=z?.offsets?.[Q]??z?.offset;return{normal:z?.normals[Q]??rn(p,v)[Q]??{nx:0,ny:0},shift:z?.shifts[Q]??Ae,offset:rt===void 0?Ht(p,an(p),O,X):rt*I}},Ge=(p,y)=>{if(!m)return!0;let v=V?nn(d)*I:(G.length-1)/2*an(y),T=ko*v*_;return be(p,m,T+(N?.furthestShift.dx??0),T/g+(N?.furthestShift.dy??0))},Be=(p,y,v)=>{let T=st?.[p]?.linkThreads;if(!T?.size)return Me;let O=T.get(y)?.get(v),X=Yo(o).get(v)?.has(y)?void 0:T.get(v)?.get(y);if(!X)return O??Me;let Q=X.map(([z,rt])=>[rt,z]);return O?[...O,...Q]:Q},cn=(p,y,v)=>G[p]?.passColors.get(y)?.[st?.[p]?.threadPasses.get(y)?.[v]??0],Wn=new WeakMap,Xe=(p,y)=>{if(!y||!V)return p;let v=Wn.get(y.shifts);if(!v){let{shifts:T}=y;v=p.map((O,X)=>{let{dx:Q,dy:z}=T[X]??Ae;return{...O,x:O.x+Q,y:O.y+z}}),Wn.set(y.shifts,v)}return v},$e=S>(u?1:_o);for(let p=0;p<o.edges.length;p++){let y=o.edges[p],v=n[y.from],T=n[y.to],O=E.get(p);if(!v?.length||!T?.length||!O||P?.has(p))continue;let X=y.pathIds?.length??0,z=M?.get(p)!==void 0,rt=l?.edgeIndexes.has(p)??!1,Dt=a/2*(z?ye:1),St=te(X,F,f),Ct=a/2*(z?f==="walks"&&F>0?Math.max(1,St):ye:St),lt=c&&X>0,Tt=z?mo:uo,yt=!l||rt?Tt:vt(Tt,Vt),ut=e.get(y.to),Wt=(ut?Qt(ut,r,i,W):r)/2,$=K=>!m||be(K,m),zt=K=>$n(K,go/S,g,m),jt=(K,Z,nt)=>{if(!z){B.push({curves:K,thickness:Z,color:nt});return}for(let mt of zt(K))B.push({curves:mt.curves,thickness:Z,color:nt})},xt=(K,Z,nt,mt,kt,Mt,It,at,Gn)=>{B.push({curves:K,thickness:Z,color:nt,walk:mt,pass:kt,normal:Mt,offsetX:It,endNormal:at,endOffsetX:Gn})},Ot=K=>{let Z=$e?So({curves:K,edgeHalfWidth:z||lt?a/2:Ct,nodeHalfWidth:Wt,scale:S,yToX:g,color:yt,fromSegments:v,toSegments:T}):void 0;Z&&J.push(Z)},dt=B.length,Gt=J.length,wt=l?.walks.length&&rt&&!lt?l.walks:void 0;if(wt&&!Ge(O,y.from))continue;if(wt){let K=To(y,v,O[0],R,g),Z=O.at(-1),nt=Oe({x:Z.x1,y:Z.y1},T,g),mt=wt.length===1,kt=Pn(an(y.from)),Mt=j?.frames.get(y.from),It=j?.frames.get(y.to);for(let at=0;at<wt.length;at++)if(wt[at].edgeIndexes.has(p))for(let[ln,Bn]of Be(at,y.from,y.to)){let ht=Dn(y.from,Mt,v,K,at,ln),Pt=V?Dn(y.to,It,T,nt,at,Bn):ht,At=mt?0:ht.offset*_,fn=V?Pt.offset*_:At,Xn=V?Kn(O,ht.shift.dx+ht.normal.nx*At,ht.shift.dy+ht.normal.ny*At/g,Pt.shift.dx+Pt.normal.nx*fn,Pt.shift.dy+Pt.normal.ny*fn/g):At===0?O:hn(O,ht.normal.nx*At,ht.normal.ny*At/g);$(Xn)&&xt(Xn,kt,cn(at,y.from,ln)??cn(at,y.to,Bn)??Tt,at,ln,ht.normal,At,Pt.normal,fn)}B.length>dt&&Ot(O)}else if(!lt)$(O)&&(jt(O,Ct,yt),Ot(O));else{let K=qn(v,T,X,h),Z=Math.floor((X-1)/2);for(let nt=0;nt<X;nt++){let{x:mt,y:kt}=K[nt],Mt=mt===0&&kt===0?O:hn(O,mt,kt);if(!$(Mt))continue;let It=q(y.pathIds[nt]);jt(Mt,Dt,l&&(l.walks.length?!l.names.has(y.pathIds[nt]):!rt)?vt(It,Vt):It),nt===Z&&Ot(Mt)}}let Jt=B.length-dt;Jt>0&&Y.set(p,{start:dt,count:Jt});let ft=J.length-Gt;ft>0&&D.set(p,{start:Gt,count:ft})}for(let[p,y]of Object.entries(n)){let v=e.get(p);if(!v||m&&!Go(y,m))continue;let T=l!==void 0&&!l.nodeIds.has(p),O=T?Te:Do(v,ct.get(p)??0,s,et),X=T?vt(O,Vt):v.moved?vt(O,po):O,Q=Qt(v,r,i,W),z=Q/2,rt=x.length,Dt=ot.get(p),St=Q/tt,Ct=y.length>=2,lt=l?.walks.length&&!T&&!Dt?.length?l.walks:void 0;if(Ct&<){let yt=mn(Q,lt.length),ut=Pn(yt),Wt=j?.frames.get(p);for(let $=0;$<lt.length;$++){let zt=lt[$].colors.get(p);if(zt===void 0)continue;let jt=st?.[$]?.nodeThreads.get(p)??Co;for(let xt of jt){let Ot=cn($,p,xt)??zt;if(lt.length===1){x.push({points:y,thickness:ut,color:Ot,walk:$,pass:xt});continue}let dt=Wt?.[$]?.[Ln($,p,xt)],Gt=We(p,y,dt),wt=Xe(y,dt),Jt=Ht(p,yt,$,xt),ft=dt?.offsets?.map(Z=>Z*I*_),K=ft?ft[Math.floor(ft.length/2)]:Rt(dt,0,Jt)*_;x.push({points:_e(wt,Gt,ft??K,g),thickness:ut,color:Ot,walk:$,pass:xt,normals:Gt,offsetX:K,...ft&&{offsets:ft}})}}}else if(Ct&&Dt?.length&&St>=yo){let yt=ve(y,g);for(let ut of Dt){let Wt=(ut-(tt-1)/2)*St*_,$=b[ut]??ge;x.push({points:_e(y,yt,Wt,g),thickness:St/2,color:T?vt($,Vt):$})}}else Ct&&x.push({points:y,thickness:z,color:X});let Tt=x.length-rt;Tt>0&&C.set(p,{start:rt,count:Tt})}return{nodeStrokes:x,nodeStrokeRuns:C,arrows:J,arrowRuns:D,edgeCurves:B,edgeCurveRuns:Y}}var Fe=[{value:"progress",label:"Progress along the walk"},{value:"walk",label:"One colour for the walk"},{value:"reference",label:"Reference position"}],On=[{value:"grey",label:"Grey to black",ends:["#a3a3a3","#151515"]},{value:"blue",label:"Cyan to navy",ends:["#6ee0f0","#0b2c7a"]},{value:"red",label:"Yellow to red",ends:["#ffd24a","#b3121b"]},{value:"purple",label:"Pink to plum",ends:["#f5a3d8","#5e1a6e"]},{value:"green",label:"Lime to forest",ends:["#b6e36c","#0b5d3b"]},{value:"orange",label:"Peach to rust",ends:["#ffc285","#8f3a00"]},{value:"rainbow",label:"Rainbow"}],Cn=["blue","red","purple","green"],qo=t=>Fe.some(n=>n.value===t),Vo=t=>On.some(n=>n.value===t);function zo(t,n,o,e=!0){let{field:s,scheme:r}=t.color??{},a=qo(s)?s:e?"progress":"walk",c=n?"grey":Cn[o%Cn.length],i=Vo(r)?r==="rainbow"&&a!=="reference"?c:r:c,f=Math.floor(o/Cn.length)%Pe.length;return a==="walk"&&i===c&&f>0?{field:a,scheme:i,shade:Pe[f]}:e||a==="walk"?{field:a,scheme:i}:{field:a,scheme:i,darkest:jo}}var jo=.55,kn=.5,Pe=[kn,.85,.2],Jo=.08,Ne=({field:t,scheme:n})=>t!=="walk"&&n!=="rainbow";function Qo(t){let n=new Map;for(let e of t)Ne(e)&&n.set(e.scheme,(n.get(e.scheme)??0)+1);let o=new Map;return t.map(e=>{let s=Ne(e)?n.get(e.scheme):1;if(s<2)return e;let r=o.get(e.scheme)??0;o.set(e.scheme,r+1);let a=Jo/2;return{...e,stretch:[r/s+(r>0?a:0),(r+1)/s-(r<s-1?a:0)]}})}var Le=({stretch:t},n)=>t?t[0]+(t[1]-t[0])*n:n,Zo=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,ts=t=>t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;function ns(t){let[n,o,e]=[1,3,5].map(c=>Zo(Number.parseInt(t.slice(c,c+2),16)/255)),s=Math.cbrt(.4122214708*n+.5363325363*o+.0514459929*e),r=Math.cbrt(.2119034982*n+.6806995451*o+.1073969566*e),a=Math.cbrt(.0883024619*n+.2817188376*o+.6299787005*e);return[.2104542553*s+.793617785*r-.0040720468*a,1.9779984951*s-2.428592205*r+.4505937099*a,.0259040371*s+.7827717662*r-.808675766*a]}function es([t,n,o]){let e=(t+.3963377774*n+.2158037573*o)**3,s=(t-.1055613458*n-.0638541728*o)**3,r=(t-.0894841775*n-1.291485548*o)**3;return[4.0767416621*e-3.3077115913*s+.2309699292*r,-1.2684380046*e+2.6097574011*s-.3413193965*r,-.0041960863*e-.7034186147*s+1.707614701*r].map(a=>ts(Math.max(0,Math.min(1,a)))*255)}var Tn=new Map;function os(t){if(!Tn.has(t)){let n=On.find(o=>o.value===t);Tn.set(t,n&&"ends"in n?n.ends.map(ns):void 0)}return Tn.get(t)}function In(t,n,o=0){let e=Math.max(0,Math.min(1,n)),s=os(t);if(!s)return Rn(qt(e),Ut,Yt).map(l=>l*255);let[r,a]=s,c=r[0],i=a[0],f=i<o&&c>o?(c-o)/(c-i):1;return es(r.map((l,h)=>l+(a[h]-l)*e*f))}function He(t,n,o){let[e,s,r]=In(t,n,o).map(Math.round);return`rgb(${e}, ${s}, ${r})`}function sn(t,n,o){let[e,s,r]=In(t,n,o).map(Math.round);return U(e,s,r,255)}function ss(t,n){let{field:o,scheme:e,darkest:s,shade:r=kn}=t;return o==="walk"?sn(e,r):n===void 0?De:sn(e,Le(t,n),s)}var De=Sn;function rs(t){let{field:n,scheme:o,darkest:e,shade:s=kn}=t,r=(a,c)=>({offset:a,color:He(o,c,e),abgr:sn(o,c,e)});return n==="walk"?[r(0,s)]:Array.from({length:7},(a,c)=>r(c/6,Le(t,c/6)))}export{lo as a,ho as b,Et as c,pn as d,is as e,U as f,ue as g,fs as h,vt as i,hs as j,so as k,ds as l,ao as m,ms as n,me as o,Ns as p,Rn as q,Fs as r,Lo as s,Ls as t,Ho as u,Do as v,Hs as w,Fe as x,On as y,zo as z,Qo as A,ss as B,De as C,rs as D};
|
|
2
|
+
//# sourceMappingURL=chunk-QX7UU3CV.js.map
|