jbrowse-plugin-graphgenomeviewer 8.2.0 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddTrackWorkflow-7CXTSSMR.js → AddTrackWorkflow-JAIB6H2T.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-EJIR3HZM.js → GbzBaseSyntenyAdapter-Y5VUDFZP.js} +2 -2
- package/dist/chunks/{GbzBaseSyntenyAdapter-EJIR3HZM.js.map → GbzBaseSyntenyAdapter-Y5VUDFZP.js.map} +1 -1
- package/dist/chunks/{GraphGenomeView-2AKRM74B.js → GraphGenomeView-VW3PEHFP.js} +2 -2
- package/dist/chunks/{GraphTrackSettingsDialog-7XRZQW6T.js → GraphTrackSettingsDialog-TT5TXM5I.js} +2 -2
- package/dist/chunks/{HighlightColorDialog-LCBGD2ZA.js → HighlightColorDialog-R3EIOO2M.js} +2 -2
- package/dist/chunks/{LinearGraphDisplay-WWQ73BO5.js → LinearGraphDisplay-OBD4R5G3.js} +2 -2
- package/dist/chunks/{MinigraphBubbleAdapter-4OOBJ44C.js → MinigraphBubbleAdapter-QXISPSHM.js} +2 -2
- package/dist/chunks/{RgfaTabixAdapter-CEGFN2QY.js → RgfaTabixAdapter-SVZ5SSEY.js} +2 -2
- package/dist/chunks/{WalkFormsAdapter-LTAKACZD.js → WalkFormsAdapter-6LK2XCHQ.js} +2 -2
- package/dist/chunks/{WalkTabixSyntenyAdapter-B6V3YNW7.js → WalkTabixSyntenyAdapter-LA22PX4I.js} +2 -2
- package/dist/chunks/{chunk-MCBYBZZJ.js → chunk-5ZGRAPN5.js} +2 -2
- package/dist/chunks/{chunk-NOXHIOIM.js → chunk-73B6AYVV.js} +2 -2
- package/dist/chunks/{chunk-W7IHIVSE.js → chunk-AUQISDXJ.js} +2 -2
- package/dist/chunks/{chunk-W7IHIVSE.js.map → chunk-AUQISDXJ.js.map} +1 -1
- package/dist/chunks/{chunk-VKZALU57.js → chunk-B2MJV7HN.js} +1 -1
- package/dist/chunks/{chunk-VKZALU57.js.map → chunk-B2MJV7HN.js.map} +1 -1
- package/dist/chunks/{chunk-CNCYMJ5E.js → chunk-DL2S7QKE.js} +2 -2
- package/dist/chunks/{chunk-CNCYMJ5E.js.map → chunk-DL2S7QKE.js.map} +1 -1
- package/dist/chunks/{chunk-OGXVDZPS.js → chunk-DSKPOCCE.js} +2 -2
- package/dist/chunks/{chunk-OGXVDZPS.js.map → chunk-DSKPOCCE.js.map} +1 -1
- package/dist/chunks/{chunk-UHV6XIDG.js → chunk-EKGY6PG2.js} +2 -2
- package/dist/chunks/{chunk-UHV6XIDG.js.map → chunk-EKGY6PG2.js.map} +1 -1
- package/dist/chunks/{chunk-QWG7NASD.js → chunk-G3L2L62S.js} +2 -2
- package/dist/chunks/{chunk-OLZZDBQJ.js → chunk-GIIUVBOH.js} +2 -2
- package/dist/chunks/{chunk-OLZZDBQJ.js.map → chunk-GIIUVBOH.js.map} +2 -2
- package/dist/chunks/{chunk-CZXJXNZN.js → chunk-HAVM67SF.js} +2 -2
- package/dist/chunks/{chunk-UECOGSWM.js → chunk-IUBWMYUA.js} +2 -2
- package/dist/chunks/{chunk-UECOGSWM.js.map → chunk-IUBWMYUA.js.map} +1 -1
- package/dist/chunks/{chunk-SL4JJJQJ.js → chunk-MHIKXNVU.js} +3 -3
- package/dist/chunks/{chunk-SL4JJJQJ.js.map → chunk-MHIKXNVU.js.map} +2 -2
- package/dist/chunks/{chunk-IK3MQ4ZJ.js → chunk-NAC3EXT4.js} +2 -2
- package/dist/chunks/{chunk-IK3MQ4ZJ.js.map → chunk-NAC3EXT4.js.map} +1 -1
- package/dist/chunks/{chunk-CVHKXFVS.js → chunk-NSBH4FIW.js} +2 -2
- package/dist/chunks/{chunk-CVHKXFVS.js.map → chunk-NSBH4FIW.js.map} +1 -1
- package/dist/chunks/{chunk-BJHWGRMP.js → chunk-PEE2MP7K.js} +1 -1
- package/dist/chunks/{chunk-BJHWGRMP.js.map → chunk-PEE2MP7K.js.map} +1 -1
- package/dist/chunks/{chunk-T2VC3EEL.js → chunk-PMM6BEKY.js} +1 -1
- package/dist/chunks/{chunk-T2VC3EEL.js.map → chunk-PMM6BEKY.js.map} +1 -1
- package/dist/chunks/chunk-QATGAV57.js +2 -0
- package/dist/chunks/chunk-QATGAV57.js.map +7 -0
- package/dist/chunks/{chunk-PTOKTIQG.js → chunk-TMFUYJFG.js} +2 -2
- package/dist/chunks/{chunk-WUOXZAGN.js → chunk-WA7FCDLQ.js} +1 -1
- package/dist/chunks/{chunk-WUOXZAGN.js.map → chunk-WA7FCDLQ.js.map} +1 -1
- package/dist/chunks/chunk-WO3MEQ25.js +2 -0
- package/dist/chunks/chunk-ZEE3HTOT.js +2 -0
- package/dist/chunks/chunk-ZEE3HTOT.js.map +7 -0
- package/dist/chunks/{renderSvg-E5Q7MLCH.js → renderSvg-2DPRP5UX.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/GraphAddTrackWorkflow/buildTrackConfig.test.ts +18 -0
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +10 -0
- package/src/GraphAddTrackWorkflow/graphManifest.test.ts +12 -0
- package/src/GraphAddTrackWorkflow/graphManifest.ts +10 -2
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-5FNGR33G.js +0 -2
- package/dist/chunks/chunk-5FNGR33G.js.map +0 -7
- package/dist/chunks/chunk-CZI7IP5S.js +0 -2
- package/dist/chunks/chunk-CZI7IP5S.js.map +0 -7
- package/dist/chunks/chunk-HAAABGE7.js +0 -2
- /package/dist/chunks/{AddTrackWorkflow-7CXTSSMR.js.map → AddTrackWorkflow-JAIB6H2T.js.map} +0 -0
- /package/dist/chunks/{GraphGenomeView-2AKRM74B.js.map → GraphGenomeView-VW3PEHFP.js.map} +0 -0
- /package/dist/chunks/{GraphTrackSettingsDialog-7XRZQW6T.js.map → GraphTrackSettingsDialog-TT5TXM5I.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-LCBGD2ZA.js.map → HighlightColorDialog-R3EIOO2M.js.map} +0 -0
- /package/dist/chunks/{LinearGraphDisplay-WWQ73BO5.js.map → LinearGraphDisplay-OBD4R5G3.js.map} +0 -0
- /package/dist/chunks/{MinigraphBubbleAdapter-4OOBJ44C.js.map → MinigraphBubbleAdapter-QXISPSHM.js.map} +0 -0
- /package/dist/chunks/{RgfaTabixAdapter-CEGFN2QY.js.map → RgfaTabixAdapter-SVZ5SSEY.js.map} +0 -0
- /package/dist/chunks/{WalkFormsAdapter-LTAKACZD.js.map → WalkFormsAdapter-6LK2XCHQ.js.map} +0 -0
- /package/dist/chunks/{WalkTabixSyntenyAdapter-B6V3YNW7.js.map → WalkTabixSyntenyAdapter-LA22PX4I.js.map} +0 -0
- /package/dist/chunks/{chunk-MCBYBZZJ.js.map → chunk-5ZGRAPN5.js.map} +0 -0
- /package/dist/chunks/{chunk-NOXHIOIM.js.map → chunk-73B6AYVV.js.map} +0 -0
- /package/dist/chunks/{chunk-QWG7NASD.js.map → chunk-G3L2L62S.js.map} +0 -0
- /package/dist/chunks/{chunk-CZXJXNZN.js.map → chunk-HAVM67SF.js.map} +0 -0
- /package/dist/chunks/{chunk-PTOKTIQG.js.map → chunk-TMFUYJFG.js.map} +0 -0
- /package/dist/chunks/{chunk-HAAABGE7.js.map → chunk-WO3MEQ25.js.map} +0 -0
- /package/dist/chunks/{renderSvg-E5Q7MLCH.js.map → renderSvg-2DPRP5UX.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Z,b as $,f as L,h as M}from"./chunk-
|
|
1
|
+
import{a as Z,b as $,f as L,h as M}from"./chunk-QATGAV57.js";import{b as O,g as G,p as T}from"./chunk-NAC3EXT4.js";import{a as y,b as I,c as C,d as v}from"./chunk-B2MJV7HN.js";var q=new Map([["hg38","GRCh38"],["hg19","GRCh37"],["hs1","CHM13"],["t2t-chm13","CHM13"],["chm13v2","CHM13"]]);function F(t){return q.get(t.toLowerCase())}function z(t){let s=t.includes("#")?y(t):void 0;return s===void 0||I(s)?void 0:s}function P(t){return C(t)??y(t)}function _(t){let s=new Set((t.anchorPaths??[]).map(n=>n.name));for(let n of t.nodes)n.stable&&s.add(n.stable.refName);let e=new Map;for(let n of s){let r=z(n);r!==void 0&&O(e,r,P(n))}return e}function B(t,s){let e=new Set(t.map(f=>z(f.refName))),[n]=e;if(e.size!==1||n===void 0)return{contigs:t,prefixes:[],named:!1};let r=new Set(t.map(f=>P(f.refName))),i=[...s.get(n)??[]].every(f=>r.has(f)),a=new Set(t.map(f=>C(f.refName))),[o]=a;return{contigs:t,prefixes:[...i?[n]:[],...a.size===1&&o?[o]:[]],named:!0}}function U(t){let s=new Map;for(let n of t.nodes)if(G(n)){let{refName:r,start:i}=n.stable,a=i+n.length,o=s.get(r);o?(o.start=Math.min(o.start,i),o.end=Math.max(o.end,a)):s.set(r,{refName:r,contig:v(r),start:i,end:a})}let e=[...s.values()];return e.length?B(e,_(t)):void 0}function de(t,s){let e=U(t),n=s?v(s.refName):e?.contigs.length===1?e.contigs[0].contig:void 0,r=e?.named?y(e.contigs[0].refName):void 0;return n&&(r?`${r} ${n}`:n)}function H(t,s){let e=a=>[a.name,...a.aliases??[]],n=a=>o=>e(o).some(f=>f.toLowerCase()===a.toLowerCase()),r=[...t?.prefixes??[]].reverse(),i=t?.prefixes.find(a=>!a.includes("#"))?.toLowerCase();for(let a of r){let o=s.find(n(a));if(o)return o}return i===void 0?void 0:s.find(a=>e(a).some(o=>F(o)?.toLowerCase()===i))}function pe(t,s){let e=_(t);return t.anchorPaths?.find(n=>H(B([{refName:n.name,contig:v(n.name),start:n.start,end:n.start+n.length}],e),[s]))}function D(t){let s=t.replace(/^chr/i,""),e=s?/^(M|MT)$/i.test(s)?["M","MT"]:[s]:[];return[...new Set([t,...e.flatMap(n=>[n,`chr${n}`])])]}function K(t,s={}){let e=new Set(t),n=new Map;for(let r of e){let i=v(r),a=s[i];for(let o of new Set([...D(i),...a?[a]:[]]))n.set(o,n.has(o)?void 0:r)}return r=>e.has(r)?r:n.get(r)}function me(t,s,e){let n=K(s.contigs.map(r=>r.refName),e);return t.flatMap(r=>{let i=n(r.refName);return i===void 0?[]:[i===r.refName?r:{...r,refName:i}]})}var Q=62,R=60,j=9,k=48,J=57,V=/^(?:LN:i|SN:Z|SO:i|SR:i):/,X=/^[PEOUFG]\t/,W=t=>t.endsWith("\r")?t.slice(0,-1):t;function Y(){return{nodes:new T(new Int32Array(65536)),reversed:new T(new Uint8Array(65536))}}var ee=class{constructor(){this.names=[],this.byName=new Map,this.byNumber=new Map}has(t){return this.byName.has(t)}add(t){let s=this.names.length;this.byName.set(t,s),this.names.push(t);let e=+t;return Number.isSafeInteger(e)&&String(e)===t&&this.byNumber.set(e,s),s}of(t){return this.byName.get(t)??this.add(t)}ofNumber(t){return this.byNumber.get(t)}};function te(t){let[,s,e="*",...n]=t.split(" ");if(!s||/^\d+$/.test(e))return;let r=e==="*"?0:e.length,i,a,o;for(let u of n){if(!V.test(u))return;let c=u.slice(5),p=u.slice(0,2);p==="LN"?r=+c:p==="SN"?i=c:p==="SO"?a=+c:o=+c}return{name:s,length:r,stable:i!==void 0&&a!==void 0&&o!==void 0?{refName:i,start:a,rank:o}:void 0}}function se(t,s,e,n){let r=0,i=-1,a=0,o=!0,f=c=>{if(i>=0&&c>i){let p=o&&c-i<16&&(c-i===1||t.charCodeAt(i)!==k)?e.ofNumber(a):void 0;n.nodes.push(p??e.of(t.slice(i,c))),n.reversed.push(r)}},u=s;for(;u<t.length;u++){let c=t.charCodeAt(u);if(c===Q||c===R)f(u),r=c===R?1:0,i=u+1,a=0,o=!0;else{if(c===j)break;o&&c>=k&&c<=J?a=a*10+c-k:o=!1}}return f(u),u}function ne(t){let s=[],e=0;for(;s.length<6;){let f=t.indexOf(" ",e);if(f===-1)return;s.push(t.slice(e,f)),e=f+1}let[,n,r,i,a,o]=s;return n&&r&&i&&a&&o&&e<t.length?{sample:n,haplotype:r,contig:i,start:a,end:o,body:e}:void 0}function Ne(t){let s=t.split(`
|
|
2
2
|
`),e=new ee,n=[],r=[],i=[],a=[],o=[],f=new Map;for(let d of s){if(X.test(d))return;if(d.startsWith("S ")){let l=te(W(d));if(!l||e.has(l.name))return;e.add(l.name),n.push(l.length);let h=-1;l.stable&&(h=f.get(l.stable.refName)??o.length,h===o.length&&(o.push(l.stable.refName),f.set(l.stable.refName,h))),r.push(h),i.push(l.stable?.start??0),a.push(l.stable?.rank??0)}}let u=[],c=[],p=[],b=[],x=[],E=[],S=[0],g=Y(),w=new M,A=new M;for(let d of s)if(d.startsWith("L ")){let[,l,h,N,m]=W(d).split(" ");l&&N&&m&&(u.push(e.of(l)),c.push(e.of(N)),p.push((h==="-"?1:0)|(m==="-"?2:0)))}else if(d.startsWith("W ")){let l=W(d),h=ne(l);if(h){b.push(`${h.sample}#${h.haplotype}#${h.contig}`),x.push(h.start==="*"?0:+h.start),E.push(h.end==="*"?-1:+h.end);let N=se(l,h.body,e,g),m=re(l,N);if(m===void 0||(m.before&&w.push(m.before),m.after&&A.push(m.after),g.nodes.length===S.at(-1)))return;S.push(g.nodes.length)}}if(![w.kinds.length,A.kinds.length].some(d=>d>0&&d<b.length))return{nodes:{names:e.names,lengths:Int32Array.from(n),refs:Int32Array.from(r),starts:Float64Array.from(i),ranks:Int32Array.from(a),refNames:o},links:{from:Int32Array.from(u),to:Int32Array.from(c),strands:Uint8Array.from(p)},walks:{names:b,starts:Float64Array.from(x),ends:Float64Array.from(E),offsets:Int32Array.from(S),steps:g.nodes.data.slice(0,g.nodes.length),reversed:g.reversed.data.slice(0,g.reversed.length),...oe(b.length,w,A)}}}function re(t,s){let e={};for(let n of s<t.length?t.slice(s+1).split(" "):[]){let r=n.slice(5);if(n.startsWith(`${Z}:Z:`)){if(e.before=L(r),!e.before)return}else if(n.startsWith(`${$}:Z:`)&&(e.after=L(r),!e.after))return}return e}function oe(t,s,e){return{...s.kinds.length===t&&t>0?{before:s.table()}:{},...e.kinds.length===t&&t>0?{after:e.table()}:{}}}var ae=/([><])([^><]+)/g;function ie(t){if(!t.startsWith(">")&&!t.startsWith("<"))return;let s=[];for(let[,e,n]of t.matchAll(ae))s.push({name:n,strand:e===">"?"+":"-"});return s}function fe(t){let s=t.trimEnd(),e=s.split(" ");if(e.length<12||s.startsWith("#"))return;let n=ie(e[5]);if(!n)return;let r,i=!1;for(let a=12;a<e.length;a++){let o=e[a];o.startsWith("cs:Z:")?r=o.slice(5):o==="tp:A:S"&&(i=!0)}return{name:e[0],queryLength:+e[1],queryStart:+e[2],queryEnd:+e[3],strand:e[4]==="-"?"-":"+",path:n,pathLength:+e[6],pathStart:+e[7],pathEnd:+e[8],matches:+e[9],blockLength:+e[10],mappingQuality:+e[11],secondary:i,...r===void 0?{}:{cs:r}}}function we(t){let s=[];for(let e of t.split(`
|
|
3
3
|
`)){let n=fe(e);n&&s.push(n)}return s}var ce=/:(\d+)|=([A-Za-z]+)|\*[a-zA-Z]([a-zA-Z])|\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\d+)[a-z]{2}/g;function Ae(t){let s=[];for(let e of t.matchAll(ce))e[1]!==void 0?s.push({op:"match",length:+e[1]}):e[2]!==void 0?s.push({op:"match",length:e[2].length}):e[3]!==void 0?s.push({op:"substitution",seq:e[3].toUpperCase()}):e[4]!==void 0?s.push({op:"insertion",seq:e[4].toUpperCase()}):e[5]!==void 0?s.push({op:"deletion",length:e[5].length}):e[6]!==void 0&&s.push({op:"match",length:+e[6]});return s}export{F as a,U as b,de as c,H as d,pe as e,me as f,Ne as g,fe as h,we as i,Ae as j};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-DSKPOCCE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@12.1.
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@12.1.2/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-5ORP7EFJ.js", "../../node_modules/.pnpm/@jbrowse+bandage-core@12.1.2/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-JQVS4DRW.js", "../../node_modules/.pnpm/@jbrowse+bandage-core@12.1.2/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-5OJZV6YT.js"],
|
|
4
4
|
"sourcesContent": ["import {\n addTo\n} from \"./chunk-BSOZW3FC.js\";\nimport {\n isBackbone\n} from \"./chunk-RJWPJCIB.js\";\nimport {\n isGenericSample,\n panSNContig,\n panSNHaplotype,\n panSNSample\n} from \"./chunk-2JL2JVZ2.js\";\n\n// src/reference.ts\nvar WELL_KNOWN_SAMPLES = /* @__PURE__ */ new Map([\n [\"hg38\", \"GRCh38\"],\n [\"hg19\", \"GRCh37\"],\n [\"hs1\", \"CHM13\"],\n [\"t2t-chm13\", \"CHM13\"],\n [\"chm13v2\", \"CHM13\"]\n]);\nfunction wellKnownSample(assemblyName) {\n return WELL_KNOWN_SAMPLES.get(assemblyName.toLowerCase());\n}\nfunction sampleOf(refName) {\n const sample = refName.includes(\"#\") ? panSNSample(refName) : void 0;\n return sample === void 0 || isGenericSample(sample) ? void 0 : sample;\n}\nfunction haplotypeOf(refName) {\n return panSNHaplotype(refName) ?? panSNSample(refName);\n}\nfunction graphHaplotypes(graph) {\n const refNames = new Set((graph.anchorPaths ?? []).map((p) => p.name));\n for (const node of graph.nodes) {\n if (node.stable) {\n refNames.add(node.stable.refName);\n }\n }\n const bySample = /* @__PURE__ */ new Map();\n for (const refName of refNames) {\n const sample = sampleOf(refName);\n if (sample !== void 0) {\n addTo(bySample, sample, haplotypeOf(refName));\n }\n }\n return bySample;\n}\nfunction backboneFrom(contigs, haplotypes) {\n const samples = new Set(contigs.map((c) => sampleOf(c.refName)));\n const [sample] = samples;\n if (samples.size !== 1 || sample === void 0) {\n return { contigs, prefixes: [], named: false };\n }\n const own = new Set(contigs.map((c) => haplotypeOf(c.refName)));\n const unique = [...haplotypes.get(sample) ?? []].every((h) => own.has(h));\n const shared = new Set(contigs.map((c) => panSNHaplotype(c.refName)));\n const [haplotype] = shared;\n return {\n contigs,\n prefixes: [\n ...unique ? [sample] : [],\n ...shared.size === 1 && haplotype ? [haplotype] : []\n ],\n named: true\n };\n}\nfunction graphBackbone(graph) {\n const spans = /* @__PURE__ */ new Map();\n for (const node of graph.nodes) {\n if (isBackbone(node)) {\n const { refName, start } = node.stable;\n const end = start + node.length;\n const span = spans.get(refName);\n if (span) {\n span.start = Math.min(span.start, start);\n span.end = Math.max(span.end, end);\n } else {\n spans.set(refName, {\n refName,\n contig: panSNContig(refName),\n start,\n end\n });\n }\n }\n }\n const contigs = [...spans.values()];\n return contigs.length ? backboneFrom(contigs, graphHaplotypes(graph)) : void 0;\n}\nfunction referenceLabel(graph, region) {\n const backbone = graphBackbone(graph);\n const contig = region ? panSNContig(region.refName) : backbone?.contigs.length === 1 ? backbone.contigs[0].contig : void 0;\n const sample = backbone?.named ? panSNSample(backbone.contigs[0].refName) : void 0;\n return contig && (sample ? `${sample} ${contig}` : contig);\n}\nfunction backboneAssembly(backbone, assemblies) {\n const names = (a) => [a.name, ...a.aliases ?? []];\n const naming = (prefix) => (a) => names(a).some((n) => n.toLowerCase() === prefix.toLowerCase());\n const prefixes = [...backbone?.prefixes ?? []].reverse();\n const sample = backbone?.prefixes.find((p) => !p.includes(\"#\"))?.toLowerCase();\n for (const prefix of prefixes) {\n const assembly = assemblies.find(naming(prefix));\n if (assembly) {\n return assembly;\n }\n }\n return sample === void 0 ? void 0 : assemblies.find(\n (a) => names(a).some((n) => wellKnownSample(n)?.toLowerCase() === sample)\n );\n}\nfunction assemblyWalk(graph, assembly) {\n const haplotypes = graphHaplotypes(graph);\n return graph.anchorPaths?.find(\n (walk) => backboneAssembly(\n backboneFrom(\n [\n {\n refName: walk.name,\n contig: panSNContig(walk.name),\n start: walk.start,\n end: walk.start + walk.length\n }\n ],\n haplotypes\n ),\n [assembly]\n )\n );\n}\nfunction contigNames(contig) {\n const bare = contig.replace(/^chr/i, \"\");\n const forms = !bare ? [] : /^(M|MT)$/i.test(bare) ? [\"M\", \"MT\"] : [bare];\n return [.../* @__PURE__ */ new Set([contig, ...forms.flatMap((f) => [f, `chr${f}`])])];\n}\nfunction refNameBinding(refNames, aliases = {}) {\n const exact = new Set(refNames);\n const byName = /* @__PURE__ */ new Map();\n for (const refName of exact) {\n const contig = panSNContig(refName);\n const alias = aliases[contig];\n for (const name of /* @__PURE__ */ new Set([\n ...contigNames(contig),\n ...alias ? [alias] : []\n ])) {\n byName.set(name, byName.has(name) ? void 0 : refName);\n }\n }\n return (name) => exact.has(name) ? name : byName.get(name);\n}\nfunction featuresOnBackbone(features, backbone, aliases) {\n const bind = refNameBinding(\n backbone.contigs.map((c) => c.refName),\n aliases\n );\n return features.flatMap((f) => {\n const refName = bind(f.refName);\n return refName === void 0 ? [] : [refName === f.refName ? f : { ...f, refName }];\n });\n}\n\nexport {\n WELL_KNOWN_SAMPLES,\n wellKnownSample,\n graphBackbone,\n referenceLabel,\n backboneAssembly,\n assemblyWalk,\n contigNames,\n refNameBinding,\n featuresOnBackbone\n};\n", "import {\n END_STOP_TAG,\n START_STOP_TAG,\n StopColumns,\n parseStopTag\n} from \"./chunk-VA5U4F23.js\";\nimport {\n Column\n} from \"./chunk-BEUTROKU.js\";\n\n// src/gfa/gfaTables.ts\nvar GT = 62;\nvar LT = 60;\nvar TAB = 9;\nvar ZERO = 48;\nvar NINE = 57;\nvar TABLE_TAG = /^(?:LN:i|SN:Z|SO:i|SR:i):/;\nvar UNTABLED_RECORD = /^[PEOUFG]\\t/;\nvar trimCR = (line) => line.endsWith(\"\\r\") ? line.slice(0, -1) : line;\nfunction stepColumns() {\n return {\n nodes: new Column(new Int32Array(1 << 16)),\n reversed: new Column(new Uint8Array(1 << 16))\n };\n}\nvar SegmentIndex = class {\n constructor() {\n this.names = [];\n this.byName = /* @__PURE__ */ new Map();\n // ids that are plain decimal, so a walk step finds its segment without\n // slicing a string out of the body\n this.byNumber = /* @__PURE__ */ new Map();\n }\n has(name) {\n return this.byName.has(name);\n }\n add(name) {\n const i = this.names.length;\n this.byName.set(name, i);\n this.names.push(name);\n const n = +name;\n if (Number.isSafeInteger(n) && String(n) === name) {\n this.byNumber.set(n, i);\n }\n return i;\n }\n of(name) {\n return this.byName.get(name) ?? this.add(name);\n }\n ofNumber(n) {\n return this.byNumber.get(n);\n }\n};\nfunction readSegment(line) {\n const [, name, sequence = \"*\", ...tags] = line.split(\"\t\");\n if (!name || /^\\d+$/.test(sequence)) {\n return void 0;\n }\n let length = sequence === \"*\" ? 0 : sequence.length;\n let refName;\n let start;\n let rank;\n for (const tag of tags) {\n if (!TABLE_TAG.test(tag)) {\n return void 0;\n }\n const value = tag.slice(5);\n const key = tag.slice(0, 2);\n if (key === \"LN\") {\n length = +value;\n } else if (key === \"SN\") {\n refName = value;\n } else if (key === \"SO\") {\n start = +value;\n } else {\n rank = +value;\n }\n }\n const stable = refName !== void 0 && start !== void 0 && rank !== void 0 ? { refName, start, rank } : void 0;\n return { name, length, stable };\n}\nfunction readWalkBody(line, from, segments, steps) {\n let reversed = 0;\n let start = -1;\n let value = 0;\n let decimal = true;\n const finish = (end) => {\n if (start >= 0 && end > start) {\n const node = decimal && end - start < 16 && (end - start === 1 || line.charCodeAt(start) !== ZERO) ? segments.ofNumber(value) : void 0;\n steps.nodes.push(node ?? segments.of(line.slice(start, end)));\n steps.reversed.push(reversed);\n }\n };\n let i = from;\n for (; i < line.length; i++) {\n const ch = line.charCodeAt(i);\n if (ch === GT || ch === LT) {\n finish(i);\n reversed = ch === LT ? 1 : 0;\n start = i + 1;\n value = 0;\n decimal = true;\n } else if (ch === TAB) {\n break;\n } else if (decimal && ch >= ZERO && ch <= NINE) {\n value = value * 10 + ch - ZERO;\n } else {\n decimal = false;\n }\n }\n finish(i);\n return i;\n}\nfunction walkFields(line) {\n const fields = [];\n let at = 0;\n while (fields.length < 6) {\n const tab = line.indexOf(\"\t\", at);\n if (tab === -1) {\n return void 0;\n }\n fields.push(line.slice(at, tab));\n at = tab + 1;\n }\n const [, sample, haplotype, contig, start, end] = fields;\n return sample && haplotype && contig && start && end && at < line.length ? { sample, haplotype, contig, start, end, body: at } : void 0;\n}\nfunction gfaTables(text) {\n const lines = text.split(\"\\n\");\n const segments = new SegmentIndex();\n const lengths = [];\n const refs = [];\n const starts = [];\n const ranks = [];\n const refNames = [];\n const refIndex = /* @__PURE__ */ new Map();\n for (const raw of lines) {\n if (UNTABLED_RECORD.test(raw)) {\n return void 0;\n }\n if (raw.startsWith(\"S\t\")) {\n const s = readSegment(trimCR(raw));\n if (!s || segments.has(s.name)) {\n return void 0;\n }\n segments.add(s.name);\n lengths.push(s.length);\n let ref = -1;\n if (s.stable) {\n ref = refIndex.get(s.stable.refName) ?? refNames.length;\n if (ref === refNames.length) {\n refNames.push(s.stable.refName);\n refIndex.set(s.stable.refName, ref);\n }\n }\n refs.push(ref);\n starts.push(s.stable?.start ?? 0);\n ranks.push(s.stable?.rank ?? 0);\n }\n }\n const from = [];\n const to = [];\n const strands = [];\n const names = [];\n const walkStarts = [];\n const walkEnds = [];\n const offsets = [0];\n const steps = stepColumns();\n const before = new StopColumns();\n const after = new StopColumns();\n for (const raw of lines) {\n if (raw.startsWith(\"L\t\")) {\n const [, source, strand1, target, strand2] = trimCR(raw).split(\"\t\");\n if (source && target && strand2) {\n from.push(segments.of(source));\n to.push(segments.of(target));\n strands.push((strand1 === \"-\" ? 1 : 0) | (strand2 === \"-\" ? 2 : 0));\n }\n } else if (raw.startsWith(\"W\t\")) {\n const line = trimCR(raw);\n const w = walkFields(line);\n if (w) {\n names.push(`${w.sample}#${w.haplotype}#${w.contig}`);\n walkStarts.push(w.start === \"*\" ? 0 : +w.start);\n walkEnds.push(w.end === \"*\" ? -1 : +w.end);\n const end = readWalkBody(line, w.body, segments, steps);\n const tags = walkTags(line, end);\n if (tags === void 0) {\n return void 0;\n }\n if (tags.before) {\n before.push(tags.before);\n }\n if (tags.after) {\n after.push(tags.after);\n }\n if (steps.nodes.length === offsets.at(-1)) {\n return void 0;\n }\n offsets.push(steps.nodes.length);\n }\n }\n }\n if ([before.kinds.length, after.kinds.length].some(\n (n) => n > 0 && n < names.length\n )) {\n return void 0;\n }\n return {\n nodes: {\n names: segments.names,\n lengths: Int32Array.from(lengths),\n refs: Int32Array.from(refs),\n starts: Float64Array.from(starts),\n ranks: Int32Array.from(ranks),\n refNames\n },\n links: {\n from: Int32Array.from(from),\n to: Int32Array.from(to),\n strands: Uint8Array.from(strands)\n },\n walks: {\n names,\n starts: Float64Array.from(walkStarts),\n ends: Float64Array.from(walkEnds),\n offsets: Int32Array.from(offsets),\n steps: steps.nodes.data.slice(0, steps.nodes.length),\n reversed: steps.reversed.data.slice(0, steps.reversed.length),\n ...stopColumns(names.length, before, after)\n }\n };\n}\nfunction walkTags(line, from) {\n const out = {};\n for (const tag of from < line.length ? line.slice(from + 1).split(\"\t\") : []) {\n const value = tag.slice(5);\n if (tag.startsWith(`${START_STOP_TAG}:Z:`)) {\n out.before = parseStopTag(value);\n if (!out.before) {\n return void 0;\n }\n } else if (tag.startsWith(`${END_STOP_TAG}:Z:`)) {\n out.after = parseStopTag(value);\n if (!out.after) {\n return void 0;\n }\n }\n }\n return out;\n}\nfunction stopColumns(walks, before, after) {\n return {\n ...before.kinds.length === walks && walks > 0 ? { before: before.table() } : {},\n ...after.kinds.length === walks && walks > 0 ? { after: after.table() } : {}\n };\n}\n\nexport {\n gfaTables\n};\n", "// src/gaf/parseGaf.ts\nvar STEP = /([><])([^><]+)/g;\nfunction parseGafPath(column) {\n if (!column.startsWith(\">\") && !column.startsWith(\"<\")) {\n return void 0;\n }\n const steps = [];\n for (const [, arrow, name] of column.matchAll(STEP)) {\n steps.push({ name, strand: arrow === \">\" ? \"+\" : \"-\" });\n }\n return steps;\n}\nfunction parseGafLine(text) {\n const line = text.trimEnd();\n const columns = line.split(\"\t\");\n if (columns.length < 12 || line.startsWith(\"#\")) {\n return void 0;\n }\n const path = parseGafPath(columns[5]);\n if (!path) {\n return void 0;\n }\n let cs;\n let secondary = false;\n for (let i = 12; i < columns.length; i++) {\n const tag = columns[i];\n if (tag.startsWith(\"cs:Z:\")) {\n cs = tag.slice(5);\n } else if (tag === \"tp:A:S\") {\n secondary = true;\n }\n }\n return {\n name: columns[0],\n queryLength: +columns[1],\n queryStart: +columns[2],\n queryEnd: +columns[3],\n strand: columns[4] === \"-\" ? \"-\" : \"+\",\n path,\n pathLength: +columns[6],\n pathStart: +columns[7],\n pathEnd: +columns[8],\n matches: +columns[9],\n blockLength: +columns[10],\n mappingQuality: +columns[11],\n secondary,\n ...cs === void 0 ? {} : { cs }\n };\n}\nfunction parseGaf(text) {\n const records = [];\n for (const line of text.split(\"\\n\")) {\n const record = parseGafLine(line);\n if (record) {\n records.push(record);\n }\n }\n return records;\n}\nvar CS_OP = /:(\\d+)|=([A-Za-z]+)|\\*[a-zA-Z]([a-zA-Z])|\\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\\d+)[a-z]{2}/g;\nfunction parseCs(cs) {\n const ops = [];\n for (const m of cs.matchAll(CS_OP)) {\n if (m[1] !== void 0) {\n ops.push({ op: \"match\", length: +m[1] });\n } else if (m[2] !== void 0) {\n ops.push({ op: \"match\", length: m[2].length });\n } else if (m[3] !== void 0) {\n ops.push({ op: \"substitution\", seq: m[3].toUpperCase() });\n } else if (m[4] !== void 0) {\n ops.push({ op: \"insertion\", seq: m[4].toUpperCase() });\n } else if (m[5] !== void 0) {\n ops.push({ op: \"deletion\", length: m[5].length });\n } else if (m[6] !== void 0) {\n ops.push({ op: \"match\", length: +m[6] });\n }\n }\n return ops;\n}\n\nexport {\n parseGafPath,\n parseGafLine,\n parseGaf,\n parseCs\n};\n"],
|
|
5
5
|
"mappings": "gLAcA,I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K,CAAE,GAAI,QAAS,OAAQ,CAACC,EAAE,CAAC,CAAE,CAAC,EAC9BA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,QAAS,OAAQC,EAAE,CAAC,EAAE,MAAO,CAAC,EACpCA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,eAAgB,IAAKC,EAAE,CAAC,EAAE,YAAY,CAAE,CAAC,EAC/CA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,YAAa,IAAKC,EAAE,CAAC,EAAE,YAAY,CAAE,CAAC,EAC5CA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,WAAY,OAAQC,EAAE,CAAC,EAAE,MAAO,CAAC,EACvCA,EAAE,CAAC,IAAM,QAClBD,EAAI,KAAK,CAAE,GAAI,QAAS,OAAQ,CAACC,EAAE,CAAC,CAAE,CAAC,EAG3C,OAAOD,CACT",
|
|
6
6
|
"names": ["WELL_KNOWN_SAMPLES", "wellKnownSample", "assemblyName", "sampleOf", "refName", "sample", "panSNSample", "isGenericSample", "haplotypeOf", "panSNHaplotype", "graphHaplotypes", "graph", "refNames", "p", "node", "bySample", "addTo", "backboneFrom", "contigs", "haplotypes", "samples", "c", "own", "unique", "h", "shared", "haplotype", "graphBackbone", "spans", "isBackbone", "start", "end", "span", "panSNContig", "referenceLabel", "region", "backbone", "contig", "backboneAssembly", "assemblies", "names", "naming", "prefix", "a", "n", "prefixes", "assembly", "assemblyWalk", "walk", "contigNames", "bare", "forms", "f", "refNameBinding", "aliases", "exact", "byName", "alias", "name", "featuresOnBackbone", "features", "bind", "GT", "LT", "TAB", "ZERO", "NINE", "TABLE_TAG", "UNTABLED_RECORD", "trimCR", "line", "stepColumns", "Column", "SegmentIndex", "name", "i", "n", "readSegment", "sequence", "tags", "length", "refName", "start", "rank", "tag", "value", "key", "readWalkBody", "from", "segments", "steps", "reversed", "decimal", "finish", "end", "node", "ch", "walkFields", "fields", "at", "tab", "sample", "haplotype", "contig", "gfaTables", "text", "lines", "lengths", "refs", "starts", "ranks", "refNames", "refIndex", "raw", "s", "ref", "to", "strands", "names", "walkStarts", "walkEnds", "offsets", "before", "StopColumns", "after", "source", "strand1", "target", "strand2", "w", "walkTags", "stopColumns", "out", "START_STOP_TAG", "parseStopTag", "END_STOP_TAG", "walks", "STEP", "parseGafPath", "column", "steps", "arrow", "name", "parseGafLine", "text", "line", "columns", "path", "cs", "secondary", "i", "tag", "parseGaf", "records", "record", "CS_OP", "parseCs", "ops", "m"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as W,b as vt}from"./chunk-UECOGSWM.js";import{B as St,C as xt,a as tt,b as nt,c as ee,d as ot,e as rt,f as te,h as at,i as it,j as st,k as lt,l as ct,m as pt,o as ne,p as ut,q as oe,r as dt,t as ue,u as ft,v as ht,w as yt,x as bt,z as wt}from"./chunk-MCBYBZZJ.js";import{N as Je,O as Qe,R as pe,T as et,U as mt,V as gt,a as x,c as He,f as J,g as Ae,h as _e,q as ze,r as Oe,t as $e,u as je,v as Ke,w as qe}from"./chunk-OLZZDBQJ.js";import{p as z}from"./chunk-WUOXZAGN.js";import{Ca as Ye,Fb as A,J as se,Ja as Ze,Jb as le,Lb as ce,N as Q,Nb as F,R as Xe,T as Be,a as X,b as be,ca as Fe,gc as Ue,q as We,r as Ne,va as Ve}from"./chunk-SL4JJJQJ.js";import{n as De}from"./chunk-W7IHIVSE.js";import{e as T}from"./chunk-3WG3GF2A.js";import{j as K}from"./chunk-J5RMHLFJ.js";import{a as Ie,e as H,f as Ge,g as Te,h as k,i as C}from"./chunk-NIEZKWQV.js";import{D as Ee,G as U,H as B,b as we,c as Se,e as ie,k as xe,o as Pe,p as Me,s as ke,v as q,w as Re,y as Ce,z as Le}from"./chunk-5Z4VIKXZ.js";import{a as G,b as n,c as f,d as h}from"./chunk-JMBDTNUR.js";function Pt(t){return Promise.resolve(new A(t))}var _=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>_!=null&&t in Object(_)?_[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Mt=hn("useRenderingBackend"),bo=_&&_.__esModule?_.default:_;var de=nt(1);function fe({model:t}){let[e,o]=C(null);return H(()=>{if(!e)return;let i=new A(e),r=X(()=>{Fe(Ue()),i.resize(t.paneWidth,t.canvasHeight),t.paintHover(i,t.drawnBatch)});return()=>{r(),i.dispose()}},[e,t]),n("canvas",{ref:o,"data-testid":"graph-hover-layer",style:de})}function re({row:t,at:e,hint:o,after:i,column:r}){let c=r===void 0?void 0:{paddingLeft:r+5};return t.swatch?f("div",{title:[t.title,o].filter(Boolean).join(" \xB7 ")||void 0,children:[f("div",{style:oe,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:r},children:n(ne,{swatch:t.swatch})}),f("span",{children:[t.strong?n("strong",{children:t.strong}):null,t.label]}),i]}),e?n("div",{style:c,"data-testid":"graph-walk-at",children:e}):t.under?n("div",{style:c,children:t.under}):null]}):n("div",{style:dt,children:t.label})}var mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=h(function({model:e}){let o=pt(e);if(o.length===0)return null;let i=o.flatMap(l=>l.rows),r=it(i),c=at(i);return n("div",{style:{...ut,lineHeight:`${r}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},m)=>f(Ie,{children:[s?n("div",{style:{...ft,paddingTop:m===0?0:ue},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>n(re,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?n("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:We,lineHeight:"normal"},vn={height:Ne,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Qe,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=h(function({model:e,lift:o,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),S=o.walks[0];H(()=>{if(!s||!m)return;let I=new A(s),O=new A(m),D=be(()=>e.buildDrawing(o,!1)),Z,$=[X(()=>{let R=e.facetGrid;R&&I.resize(R.width,R.height);let L=D.get();L&&(L!==Z&&(I.uploadGeometry(L.batch),Z=L),e.applySelection(I),e.paint(I))}),X(()=>{let R=e.facetGrid;R&&O.resize(R.width,R.height);let L=D.get();L&&e.paintHover(O,L.batch)})];return()=>{for(let R of $)R();I.dispose(),O.dispose()}},[s,m,e,o]);let N=e.walkLabel(S.name);return f("div",{style:c,children:[n("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([S.name]),e.setFacet("")},children:n(re,{row:lt(e,S),hint:`click to lift ${N} alone`,at:e.hoveredOn(S)})}),f("div",{style:yn,children:[n("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),n("canvas",{ref:w,style:de})]})]})}),Sn=h(function({model:e,handlers:o,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return f("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:Q},children:[r.map((m,w)=>n(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:o,canvasStyle:i},m.walks[0].name)),n("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:ct(e).map(m=>n(re,{row:m},m.key))})]})}),Rt=Sn;var Ct=x(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Lt=x([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=x(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var xn=h(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:ze.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=z()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function he(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=h(function({model:e}){let{classes:o}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?f(B,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",he(i)," \xB7 layout ",he(r)," \xB7 geom"," ",he(c)]}):null}),Mn=h(function({model:e}){let{classes:o}=Gt();return f("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[f(B,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Pn,{model:e})]})}),Tt=Mn;var kn=h(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:He.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:o?!l(o):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=h(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),At=Rn;var _t=x(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=x(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Cn=h(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(we,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:mt,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Oe,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:gt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[vt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:n(zt,{})})}),Wt=Cn;var Ln=z()({formControl:{minWidth:130,maxWidth:260}}),En=h(function({model:e}){let{classes:o}=Ln(),i=Ge(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Be?n(Pe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Xe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):f(ke,{size:"small",className:o.formControl,children:[n(Re,{id:i,children:"Highlight"}),n(Ee,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>f(Le,{value:s,dense:!0,children:[n(Me,{size:"small",checked:p.includes(s)}),n(Ce,{primary:u})]},s))})]})}),Nt=En;var In=z()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=h(function({model:e}){return n(B,{variant:"body2",children:e.zoomPercent})}),Tn=h(function({model:e}){let{classes:o}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return f("div",{className:o.toolbar,children:[n(Ht,{model:e}),n(It,{model:e}),n(Nt,{model:e}),n(At,{model:e}),n(U,{title:"Zoom in",children:n(q,{size:"small",onClick:()=>{i(1.5)},children:n(Lt,{})})}),n(U,{title:"Zoom out",children:n(q,{size:"small",onClick:()=>{i(1/1.5)},children:n(Et,{})})}),n(U,{title:"Zoom to fit",children:n(q,{size:"small",onClick:()=>{e.refitView()},children:n(Ct,{})})}),n(Gn,{model:e}),n(Tt,{model:e}),n(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Je,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function me({label:t,readout:e}){return f(G,{children:[n("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:me(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=t.hoverDrawing?.members.get(o.id),p=_e(o);return{body:f(G,{children:[n("strong",{children:o.name}),l?` and ${l.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),p?f(G,{children:[n("br",{}),p.sample," ",J(p)," (rank ",o.stable?.rank,")"]}):null,o.moved?f(G,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=Ae(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?f(G,{children:[n("strong",{children:"Deletion"})," ",l.deletion.bp,n("br",{}),l.deletion.where]}):f(G,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:me(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:me(c)}:void 0}var _n=h(function({model:e,chip:o}){let i=An(e,o);return i?n("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=x(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=x(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=x(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var zn={x:0,y:0};function Wn(t,e){let{own:o,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...et({own:o,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,o){let i=o??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!o&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${J(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}function V({model:t,at:e,onClose:o}){return n(Se,{anchor:e,offset:zn,onClose:o,menuItems:()=>e===void 0?[]:"nodeId"in e?Wn(t,e.nodeId):On(t,e.row,e.bars)})}var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},Bn=h(function({bars:e,frame:o,ramp:i,rowGenes:r}){let c=rt(),l=Te(()=>Ze(e,o,{ramp:i,rowGenes:r,idPrefix:c}),[e,o,i,r,c]);return n(te,{el:l})}),Fn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=o?[o.reference,...o.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!o||!i||i.labelled||!r||!p)return null;let s=(o.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return f("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",Ve(p,l===0?void 0:o.reference)]})}),Vn=h(function({model:e,bars:o,frame:i}){return n(te,{el:je(o,i,e.walkStripMarks)})}),Yn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!o||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return $e(o,i,s.clientX-u.left,s.clientY-u.top)},p=Ye(o,{ramp:e.referenceRampDomain,rampCss:De,genes:qe(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return f("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[f("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(Bn,{bars:o,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),n(Vn,{model:e,bars:o,frame:i}),n(te,{el:Ke(o,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(Fn,{model:e}),f("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>f("div",{style:oe,children:[n(ne,{swatch:st(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(V,{model:e,at:r&&{...r,bars:o},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=h(function({model:e}){let o=e.walkStripLocator;return o?f(ee,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function ge(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),o=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,o))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let o=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(o)<.001?t:t-o}function no(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function qt(t,e,o){H(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,T(o)&&o.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<o.referenceStripZonePx)return;let w=no(p,o.host);if(w!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let S=p.deltaMode===1?Jn:1;o.setTransform(o.scale,o.translateX-p.deltaX*S,o.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(ge(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var jt=3,ve="data-gesture-owner",Y=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Ut(t){let e=k({x:0,y:0}),o=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),S=k({frame:0,pan:null,hover:null,pinch:!1});H(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[N,I]=C(),[O,D]=C(!1),[Z,$]=C(void 0);function R(a){let d=a.currentTarget.getBoundingClientRect();return{x:a.clientX-d.left,y:a.clientY-d.top}}function L(a,d){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,d);let g=t.referenceStripNodeAt(a,d);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,d){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let d=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&d.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),d.set(a.pointerId,Y(a)),s.current=Kt(d),i.current=!0);return}i.current=!1,o.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ve);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,d.clear(),d.set(a.pointerId,Y(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,P=t.layoutResult?.tubeMap||b?null:L(v,y);g&&P&&a.currentTarget.setAttribute(ve,""),w.current=g,u.current=b&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ye(){let a=s.current,d=p.current;if(!a||!d)return;let g=Kt(l.current),v=d.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=S.current,{pan:d,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ye(),d&&u.current?t.host?.horizontalScroll(-d.dx):d&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+d.dy):d&&t.setTransform(t.scale,t.translateX+d.dx,t.translateY+d.dy),!g)return;let{x:y,y:b}=g,P=t.facetPanels?void 0:yt(t.overlayLabels,y,b);$(M=>M?.label===P?.label&&M?.readout===P?.readout?M:P);let E=t.walkRowBars;if(E){let M=t.walkRowAt(y,b);t.setHoveredWalkRow(M===void 0?null:[E.reference,...E.rows][M].name)}if(t.nodePositions&&t.graph){let M=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(M,{x:y,y:b}),D(M!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(M===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(M||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(on))}function rn(){let a=S.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let d=l.current;if(s.current&&d.has(a.pointerId)){d.set(a.pointerId,Y(a)),S.current.pinch=!0,j();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-o.current.x,a.clientY-o.current.y)>jt&&(i.current=!0);let y=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},j();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},j()}}function ae(a){let d=l.current;if(s.current&&d.has(a.pointerId)){S.current.pinch&&(S.current.pinch=!1,ye()),d.delete(a.pointerId),s.current=null;let[[g,v]]=[...d];r.current=g,e.current=v;return}c(a)||(r.current=void 0,d.clear(),T(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),$(void 0),D(!1),T(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:d,y:g}=R(a),v=L(d,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),I({clientX:y,clientY:b,nodeId:v});return}let P=t.walkRowAt(d,g);P!==void 0&&(a.preventDefault(),I({clientX:y,clientY:b,row:P}))}function cn(a){if(!i.current){let{x:d,y:g}=R(a),v=L(d,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}H(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${tt}]`))return;m.current?.end(),u.current=!1,w.current=!1;let d=a.pointerId,g=Y(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),y.moved&&T(t)&&t.stopDragging()}};function b(E){if(E.pointerId!==d)return;if(!y.moved){if(Math.hypot(E.clientX-g.x,E.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let M=S.current;M.pan={dx:(M.pan?.dx??0)+E.clientX-v.x,dy:(M.pan?.dy??0)+E.clientY-v.y},v=Y(E),j()}function P(E){E.pointerId===d&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":O?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:ae,onPointerCancel:ae,onLostPointerCapture:ae,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:N,hoveredChip:Z,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{I(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},lo=h(function({model:e}){return n(G,{children:e.visibleRowLabels.map(({label:o,y:i,top:r})=>n("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:o},i))})}),co={position:"absolute",top:F,right:F,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},po={...Jt,color:"#18181c",fontWeight:600},uo=h(function({model:e}){let o=k(null),i=e.legendAtRest;return H(()=>{let r=o.current;if(!r||!i)return;let c=()=>{T(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),n("div",{ref:o,style:{...co,top:F+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*F-e.referenceStripZonePx},children:n(kt,{model:e})})}),fo=h(function({model:e}){let o=e.overlayLabels.sizes,i=o.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return f(G,{children:[i.length>0?n(ee,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>n("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,o.map(({key:r,text:c,x:l,y:p,kind:s})=>n("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=h(function({model:e,handle:{canvasRef:o,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[S,N]=C(null);qt(S,i,e);let I=e.facetPanels!==void 0;return f("div",{style:oo,...p,children:[r?n(Ot,{model:e}):null,f("div",{ref:N,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...ao,top:e.referenceStripZonePx,background:Q}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),I?n(Rt,{model:e,handlers:c,canvasStyle:l}):f(G,{children:[n(St,{model:e}),n(fe,{model:e}),n(wt,{model:e}),n(lo,{model:e}),n(fo,{model:e}),n(ot,{model:e}),n(ht,{model:e}),n(bt,{model:e}),n(xt,{model:e}),n(Yt,{model:e}),n(uo,{model:e})]}),r?n("div",{style:io,children:n(xe,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Dt,{model:e,chip:w})]}),e.walkStripShown?n(Vt,{model:e}):null,n(V,{model:e,at:u,onClose:m}),r?.renderError?n(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=h(function({model:e}){let{canvasRef:o,canvas:i,error:r,retry:c}=Mt(Pt,e);return n(Qt,{model:e,handle:{canvasRef:o,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=h(function({model:e,handle:o}){return o?n(Qt,{model:e,handle:o}):n(ho,{model:e})}),$i=mo;export{Pt as a,$i as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as W,b as vt}from"./chunk-IUBWMYUA.js";import{B as St,C as xt,a as tt,b as nt,c as ee,d as ot,e as rt,f as te,h as at,i as it,j as st,k as lt,l as ct,m as pt,o as ne,p as ut,q as oe,r as dt,t as ue,u as ft,v as ht,w as yt,x as bt,z as wt}from"./chunk-5ZGRAPN5.js";import{N as Je,O as Qe,R as pe,T as et,U as mt,V as gt,a as x,c as He,f as J,g as Ae,h as _e,q as ze,r as Oe,t as $e,u as je,v as Ke,w as qe}from"./chunk-GIIUVBOH.js";import{p as z}from"./chunk-WA7FCDLQ.js";import{Ca as Ye,Fb as A,J as se,Ja as Ze,Jb as le,Lb as ce,N as Q,Nb as F,R as Xe,T as Be,a as X,b as be,ca as Fe,gc as Ue,q as We,r as Ne,va as Ve}from"./chunk-MHIKXNVU.js";import{n as De}from"./chunk-AUQISDXJ.js";import{e as T}from"./chunk-3WG3GF2A.js";import{j as K}from"./chunk-J5RMHLFJ.js";import{a as Ie,e as H,f as Ge,g as Te,h as k,i as C}from"./chunk-NIEZKWQV.js";import{D as Ee,G as U,H as B,b as we,c as Se,e as ie,k as xe,o as Pe,p as Me,s as ke,v as q,w as Re,y as Ce,z as Le}from"./chunk-5Z4VIKXZ.js";import{a as G,b as n,c as f,d as h}from"./chunk-JMBDTNUR.js";function Pt(t){return Promise.resolve(new A(t))}var _=JBrowseExports["@jbrowse/render-core/useRenderingBackend"],hn=t=>_!=null&&t in Object(_)?_[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/useRenderingBackend' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Mt=hn("useRenderingBackend"),bo=_&&_.__esModule?_.default:_;var de=nt(1);function fe({model:t}){let[e,o]=C(null);return H(()=>{if(!e)return;let i=new A(e),r=X(()=>{Fe(Ue()),i.resize(t.paneWidth,t.canvasHeight),t.paintHover(i,t.drawnBatch)});return()=>{r(),i.dispose()}},[e,t]),n("canvas",{ref:o,"data-testid":"graph-hover-layer",style:de})}function re({row:t,at:e,hint:o,after:i,column:r}){let c=r===void 0?void 0:{paddingLeft:r+5};return t.swatch?f("div",{title:[t.title,o].filter(Boolean).join(" \xB7 ")||void 0,children:[f("div",{style:oe,children:[n("span",{style:{display:"flex",flex:"none",justifyContent:"center",width:r},children:n(ne,{swatch:t.swatch})}),f("span",{children:[t.strong?n("strong",{children:t.strong}):null,t.label]}),i]}),e?n("div",{style:c,"data-testid":"graph-walk-at",children:e}):t.under?n("div",{style:c,children:t.under}):null]}):n("div",{style:dt,children:t.label})}var mn={pointerEvents:"auto",cursor:"pointer",border:"none",background:"none",padding:"0 2px",font:"inherit",textDecoration:"underline"},kt=h(function({model:e}){let o=pt(e);if(o.length===0)return null;let i=o.flatMap(l=>l.rows),r=it(i),c=at(i);return n("div",{style:{...ut,lineHeight:`${r}px`},children:o.map(({testid:l,rows:p,heading:s,spaced:u},m)=>f(Ie,{children:[s?n("div",{style:{...ft,paddingTop:m===0?0:ue},children:s}):null,n("div",{"data-testid":l,style:u?{paddingTop:ue}:void 0,children:p.map(w=>n(re,{row:w,column:c,at:w.walk?e.hoveredOn(w.walk):void 0,after:w.closesBubble?n("button",{type:"button",style:mn,"data-testid":"graph-close-bubble",onClick:()=>{e.closeBubbles()},children:"close"}):null},w.key))})]},l))})});var gn={position:"absolute",left:0,top:0,zIndex:4,display:"grid",gap:We,lineHeight:"normal"},vn={height:Ne,padding:"2px 6px",boxSizing:"border-box",fontFamily:"inherit",fontSize:11,color:"inherit",cursor:"pointer",border:"none",background:"none",textAlign:"left",display:"block"},yn={position:"relative"},bn={gridColumn:"1 / -1",height:Qe,padding:"2px 6px",boxSizing:"border-box",display:"flex",gap:14,fontSize:11,lineHeight:"15px"},wn=h(function({model:e,lift:o,width:i,height:r,cell:c,handlers:l,canvasStyle:p}){let[s,u]=C(null),[m,w]=C(null),S=o.walks[0];H(()=>{if(!s||!m)return;let I=new A(s),O=new A(m),D=be(()=>e.buildDrawing(o,!1)),Z,$=[X(()=>{let R=e.facetGrid;R&&I.resize(R.width,R.height);let L=D.get();L&&(L!==Z&&(I.uploadGeometry(L.batch),Z=L),e.applySelection(I),e.paint(I))}),X(()=>{let R=e.facetGrid;R&&O.resize(R.width,R.height);let L=D.get();L&&e.paintHover(O,L.batch)})];return()=>{for(let R of $)R();I.dispose(),O.dispose()}},[s,m,e,o]);let N=e.walkLabel(S.name);return f("div",{style:c,children:[n("button",{type:"button",style:vn,"data-testid":"graph-facet-title",onClick:()=>{e.liftWalks([S.name]),e.setFacet("")},children:n(re,{row:lt(e,S),hint:`click to lift ${N} alone`,at:e.hoveredOn(S)})}),f("div",{style:yn,children:[n("canvas",{ref:u,"data-testid":"graph-facet-canvas",style:{...p,width:i,height:r,display:"block"},...l}),n("canvas",{ref:w,style:de})]})]})}),Sn=h(function({model:e,handlers:o,canvasStyle:i}){let r=e.facetPanels,c=e.facetGrid,l=e.facetPlacement;if(!r||!c||!l)return null;let{columns:p,width:s,height:u}=c;return f("div",{"data-testid":"graph-facet-panels",style:{...gn,width:e.paneWidth,minHeight:e.canvasHeight,gridTemplateColumns:`repeat(${p}, ${s}px)`,background:Q},children:[r.map((m,w)=>n(wn,{model:e,lift:m,width:s,height:u,cell:{gridRow:Math.floor(l.cells[w]/p)+1,gridColumn:l.cells[w]%p+1},handlers:o,canvasStyle:i},m.walks[0].name)),n("div",{style:{...bn,gridRow:Math.floor(l.cells.reduce((m,w)=>Math.max(m,w),-1/0)/p)+2},"data-testid":"graph-facet-key",children:ct(e).map(m=>n(re,{row:m},m.key))})]})}),Rt=Sn;var Ct=x(n("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2m2 10H3v4c0 1.1.9 2 2 2h4v-2H5zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2"}),"CropFree");var Lt=x([n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"},"0"),n("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2z"},"1")],"ZoomIn");var Et=x(n("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14M7 9h5v1H7z"}),"ZoomOut");var xn=h(function({model:e}){let o=e.colorSchemeLock;return n(W,{label:"Color",size:"small",sx:{minWidth:100},disabled:o!==void 0,title:o?.why,shown:o?.value,value:e.chosenColorScheme,options:ze.map(({value:i})=>({value:i,label:e.colorSchemeLabel(i)})),testId:"graph-color-select",onChange:i=>{e.setColorScheme(i)}})}),It=xn;var Gt=z()({stats:{marginLeft:"auto"},perf:{color:"#888",fontVariantNumeric:"tabular-nums"}});function he(t){return t===void 0?"\u2013":`${Math.round(t)}ms`}var Pn=h(function({model:e}){let{classes:o}=Gt(),{lastFetchMs:i,lastLayoutMs:r,lastGeometryMs:c}=e,l=i!==void 0||r!==void 0||c!==void 0;return e.showPerf&&l?f(B,{variant:"caption",className:o.perf,"data-testid":"graph-perf-stats",children:["fetch ",he(i)," \xB7 layout ",he(r)," \xB7 geom"," ",he(c)]}):null}),Mn=h(function({model:e}){let{classes:o}=Gt();return f("div",{className:o.stats,"data-testid":"graph-stats","data-node-count":e.nodeCount,"data-edge-count":e.edgeCount,"data-path-count":e.pathCount,"data-fetch-ms":e.lastFetchMs??"","data-layout-ms":e.lastLayoutMs??"","data-geometry-ms":e.lastGeometryMs??"","data-geometry-strokes":e.lastGeometryStrokeCount??"",children:[f(B,{variant:"body2",component:"span",children:[e.nodeCount," nodes, ",e.edgeCount," edges",e.pathCount>0?`, ${e.pathCount} paths`:""]})," ",n(Pn,{model:e})]})}),Tt=Mn;var kn=h(function({model:e}){let{graph:o}=e;return n(W,{label:"Layout",size:"small",sx:{minWidth:140},testId:"graph-layout-select",value:e.chosenLayoutMode,options:He.map(({value:i,label:r,description:c,available:l})=>({value:i,label:r,description:c,disabled:o?!l(o):!1})),onChange:i=>{e.switchLayout(i)}})}),Ht=kn;var Rn=h(function({model:e}){return e.chosenLayoutMode!=="walkrows"||e.repeatChoices.length===0?null:n(W,{label:"Repeat",size:"small",sx:{minWidth:130,maxWidth:260},testId:"graph-repeat-select",value:e.selectedRepeat?.key??"",options:e.repeatOptions,onChange:o=>{e.setRepeatKey(o)}})}),At=Rn;var _t=x(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var zt=x(n("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var Cn=h(function({model:e}){let o=e.highlightMenuItems({picks:!1});return n(we,{size:"small",tooltip:"Graph options",menuItems:[...o.length>0?[{label:"Haplotypes",icon:mt,subMenu:o}]:[],...e.layoutOptionMenuItems({repeat:!1}),{label:"Show",icon:Oe,subMenu:[...e.showMenuItems(),...e.modeDrawsNodes&&e.walkChoices.length>1?[{type:"checkbox",label:"Show walk rows under the graph",checked:e.walkStrip,onClick:()=>{e.setWalkStrip(!e.walkStrip)}}]:[],{type:"checkbox",label:"Show timings",checked:e.showPerf,onClick:()=>{e.setShowPerf(!e.showPerf)}}]},{type:"divider"},{label:"Graph settings...",icon:gt,helpText:"Subgraph node limit; node width and path colors; the force-directed layout engine",onClick:()=>{K(e).queueDialog(i=>[vt,{model:e,onClose:i}])}},{type:"divider"},{label:"Close graph",icon:_t,onClick:()=>{e.clearGraph()}}],children:n(zt,{})})}),Wt=Cn;var Ln=z()({formControl:{minWidth:130,maxWidth:260}}),En=h(function({model:e}){let{classes:o}=Ln(),i=Ge(),{walkChoices:r}=e;if(r.length===0||!e.liftsWalks)return null;let c=new Set(r.map(s=>s.name)),l=new Map(r.map(s=>[s.name,s.label])),p=e.walkLayers.map(s=>s.walk).filter(s=>c.has(s));return r.length>Be?n(Pe,{size:"small",variant:"outlined",color:"inherit","data-testid":"graph-walk-choose",onClick:()=>{K(e).queueDialog(s=>[Xe,{model:e,onClose:s}])},children:p.length>0?`${p.length} of ${r.length} haplotypes`:"Highlight haplotypes..."}):f(ke,{size:"small",className:o.formControl,children:[n(Re,{id:i,children:"Highlight"}),n(Ee,{labelId:i,multiple:!0,value:p,label:"Highlight","data-testid":"graph-walk-select",renderValue:s=>s.map(u=>l.get(u)).join(", "),onChange:s=>{let{value:u}=s.target;e.liftAmongChoices(typeof u=="string"?u.split(","):u)},children:r.map(({name:s,label:u})=>f(Le,{value:s,dense:!0,children:[n(Me,{size:"small",checked:p.includes(s)}),n(Ce,{primary:u})]},s))})]})}),Nt=En;var In=z()({toolbar:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #ddd"}}),Gn=h(function({model:e}){return n(B,{variant:"body2",children:e.zoomPercent})}),Tn=h(function({model:e}){let{classes:o}=In(),i=r=>{e.zoom(r,e.viewBox.width/2,e.viewBox.height/2)};return f("div",{className:o.toolbar,children:[n(Ht,{model:e}),n(It,{model:e}),n(Nt,{model:e}),n(At,{model:e}),n(U,{title:"Zoom in",children:n(q,{size:"small",onClick:()=>{i(1.5)},children:n(Lt,{})})}),n(U,{title:"Zoom out",children:n(q,{size:"small",onClick:()=>{i(1/1.5)},children:n(Et,{})})}),n(U,{title:"Zoom to fit",children:n(q,{size:"small",onClick:()=>{e.refitView()},children:n(Ct,{})})}),n(Gn,{model:e}),n(Tt,{model:e}),n(Wt,{model:e})]})}),Ot=Tn;var Hn={position:"absolute",bottom:Je,lineHeight:"normal",background:"rgba(0,0,0,0.75)",color:"white",padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",zIndex:6};function me({label:t,readout:e}){return f(G,{children:[n("strong",{children:t})," \u2014 ",e]})}function An(t,e){if(e)return{testId:"graph-chip-tooltip",body:me(e)};let o=t.hoveredNode?t.hoverNodeById?.get(t.hoveredNode):void 0;if(o){let l=t.hoverDrawing?.members.get(o.id),p=_e(o);return{body:f(G,{children:[n("strong",{children:o.name}),l?` and ${l.length-1} more`:""," \u2014"," ",o.length.toLocaleString()," bp, depth ",o.depth.toFixed(1),p?f(G,{children:[n("br",{}),p.sample," ",J(p)," (rank ",o.stable?.rank,")"]}):null,o.moved?f(G,{children:[n("br",{}),"End of a component too large to draw here"]}):null]})}}let i=t.hoveredEdge===null?void 0:t.graph?.edges[t.hoveredEdge];if(i){let l=Ae(i,t.deletions.find(p=>p.edgeIndex===t.hoveredEdge),p=>t.nodeById?.get(p)?.name??p);return{body:l.deletion?f(G,{children:[n("strong",{children:"Deletion"})," ",l.deletion.bp,n("br",{}),l.deletion.where]}):f(G,{children:["Edge: ",l.ends]})}}let r=t.hoveredWalkRowText;if(r)return{testId:"graph-walk-row-tooltip",body:me(r)};let c=t.hoveredTubeText;return c?{testId:"graph-tube-tooltip",body:me(c)}:void 0}var _n=h(function({model:e,chip:o}){let i=An(e,o);return i?n("div",{style:{...Hn,right:e.tooltipRightPx},"data-testid":i.testId,children:i.body}):null}),Dt=_n;var Xt=x(n("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList");var Bt=x(n("path",{d:"M10.83 8H21V6H8.83zm5 5H18v-2h-4.17zM14 16.83V18h-4v-2h3.17l-3-3H6v-2h2.17l-3-3H3V6h.17L1.39 4.22 2.8 2.81l18.38 18.38-1.41 1.41z"}),"FilterListOff");var Ft=x(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info");var zn={x:0,y:0};function Wn(t,e){let{own:o,reference:i,highlight:r}=t.nodeLaunchTargets(e);return[{label:"Node details",icon:Ft,onClick:()=>{t.showNodeDetails(e)}},...et({own:o,reference:i,highlight:r,onShowLinear:c=>{t.showInLinearView(c)},onHighlight:t.canHighlightInLinearView?c=>{t.highlightInLinearView(c)}:void 0})]}function Nn(t){return t>=1e3?`${Math.round(t/1e3)} k`:`${t}`}function On(t,e,o){let i=o??t.walkRowBars,r=t.walkRowLaunchTarget(e,i),c=r?.assembly,l=e>0?i?.rows[e-1]:void 0,p=l?.sample,s=!o&&t.walkRowBars,u=t.walkRowSamples;return[r&&c?{label:`Linear genome view \u2014 ${c} ${J(r.location)}`,icon:pe,onClick:()=>{t.showInLinearView({location:r.location,assembly:c})}}:{label:"Linear genome view",icon:pe,disabled:!0,disabledHelpText:r?`No assembly in this session is ${r.location.haplotype??r.label}`:"This walk states no contig coordinates",onClick:()=>{}},...l?.abridgedSteps?[{label:`Load the ${Nn(l.abridgedSteps)} abridged steps`,onClick:()=>{t.expandWalk(l.name)}}]:[],...l&&t.liftsWalks&&t.modeDrawsNodes?[{type:"checkbox",label:`Highlight ${l.label}`,checked:t.walkLayers.some(m=>m.walk===l.name),onClick:()=>{t.toggleWalk(l.name)}}]:[],...s&&p&&!(u?.length===1&&u[0]===p)?[{label:`Show only ${p}`,icon:Xt,onClick:()=>{t.setWalkRowSamples([p])}}]:[],...s&&u?[{label:"Show every sample",icon:Bt,onClick:()=>{t.setWalkRowSamples(void 0)}}]:[]]}function V({model:t,at:e,onClose:o}){return n(Se,{anchor:e,offset:zn,onClose:o,menuItems:()=>e===void 0?[]:"nodeId"in e?Wn(t,e.nodeId):On(t,e.row,e.bars)})}var Dn={display:"flex",flexWrap:"wrap",gap:"2px 14px",padding:"2px 8px 6px",fontSize:11,color:"#333"},Xn={position:"absolute",pointerEvents:"none",background:"rgba(255,255,255,0.92)",border:"1px solid #ccc",borderRadius:3,padding:"1px 6px",fontSize:11,whiteSpace:"nowrap",zIndex:4},Bn=h(function({bars:e,frame:o,ramp:i,rowGenes:r}){let c=rt(),l=Te(()=>Ze(e,o,{ramp:i,rowGenes:r,idPrefix:c}),[e,o,i,r,c]);return n(te,{el:l})}),Fn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,r=e.stripHover,c=o?[o.reference,...o.rows]:[],l=r?c.findIndex(m=>m.name===r.row):-1,p=c[l];if(!o||!i||i.labelled||!r||!p)return null;let s=(o.origin+r.offset)*i.scaleX+i.translateX,u=s>i.width/2?{right:i.width-s+12}:{left:s+12};return f("div",{"data-testid":"graph-walk-strip-tip",style:{...Xn,...u,top:l*i.rowPx+i.translateY-18},children:[p.label," \xB7"," ",Ve(p,l===0?void 0:o.reference)]})}),Vn=h(function({model:e,bars:o,frame:i}){return n(te,{el:je(o,i,e.walkStripMarks)})}),Yn=h(function({model:e}){let o=e.walkStripRows,i=e.walkStripFrame,[r,c]=C();if(!o||!i)return null;let l=s=>{let u=s.currentTarget.getBoundingClientRect();return $e(o,i,s.clientX-u.left,s.clientY-u.top)},p=Ye(o,{ramp:e.referenceRampDomain,rampCss:De,genes:qe(i,e.walkRowGenes,e.walkRowGeneGaps),annotation:e.walkRowAnnotation});return f("div",{"data-testid":"graph-walk-strip",style:{position:"relative",borderTop:"1px solid #ddd"},onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&(e.setPointerInPane(!1),e.setStripHover(null))},children:[f("svg",{width:i.width,height:i.height,style:{display:"block"},onMouseMove:s=>{let u=l(s);s.currentTarget.style.cursor=u&&u.index>0?"pointer":"",e.setStripHover(u?{row:u.row.name,offset:u.offset}:null)},onClick:s=>{let u=l(s);u&&u.index>0&&e.toggleWalk(u.row.name)},onContextMenu:s=>{let u=l(s);u&&(s.preventDefault(),c({clientX:s.clientX,clientY:s.clientY,row:u.index}))},children:[n(Bn,{bars:o,frame:i,ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes}),n(Vn,{model:e,bars:o,frame:i}),n(te,{el:Ke(o,i,new Set(e.walkLayers.map(s=>s.walk)))})]}),n(Fn,{model:e}),f("div",{style:Dn,"data-testid":"graph-walk-strip-key",children:[p.map(s=>f("div",{style:oe,children:[n(ne,{swatch:st(s.swatch)}),n("span",{children:s.label})]},s.label)),n("span",{style:{color:"#777"},children:"Ticks mark where each walk passes the node under the pointer; click a haplotype's bar to lift its walk"})]}),n(V,{model:e,at:r&&{...r,bars:o},onClose:()=>{c(void 0)}})]})}),Vt=Yn;var Zn=h(function({model:e}){let o=e.walkStripLocator;return o?f(ee,{model:e,zIndex:4,overflow:"visible",testId:"graph-walk-strip-locator",children:[n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"white",strokeWidth:4}),n("circle",{cx:o.x,cy:o.y,r:11,fill:"none",stroke:"#111",strokeWidth:1.75})]}):null}),Yt=Zn;var $n=1.1,jn=100,Kn=40,qn=800,Un=10,Zt=2;function ge(t){let e=t.deltaY*(t.deltaMode===1?Kn:t.deltaMode===2?qn:1),o=(t.ctrlKey?Un:1)*e/jn;return $n**-Math.max(-Zt,Math.min(Zt,o))}var Jn=40,Qn=100,eo=24,$t=Math.log(16);function to(t,e){let o=t*Math.exp(-Math.max(0,e)/eo);return Math.abs(o)<.001?t:t-o}function no(t,e){let o=Math.abs(t.deltaX)>Math.abs(t.deltaY);return t.ctrlKey||t.metaKey||!o&&(!e||e.scrollZoom)?"zoom":o?"pan":"page"}function qt(t,e,o){H(()=>{if(!t)return;let i=-1/0,r={backlog:0,x:0,y:0,frame:0,last:0},c=p=>{let s=to(r.backlog,Math.min(100,p-r.last));r.backlog-=s,r.last=p,r.frame=r.backlog?requestAnimationFrame(c):0,T(o)&&o.zoom(Math.exp(s),r.x,r.y)},l=p=>{if(o.hostPlacesX||o.followsHostView)return;let m=((p.target instanceof Element?p.target.closest("canvas"):null)??(o.facetPanels?null:e))?.getBoundingClientRect();if(m&&p.clientY-m.top<o.referenceStripZonePx)return;let w=no(p,o.host);if(w!=="page"){if(o.host&&p.stopPropagation(),p.preventDefault(),w==="pan"){if(p.timeStamp-i>Qn){let S=p.deltaMode===1?Jn:1;o.setTransform(o.scale,o.translateX-p.deltaX*S,o.translateY)}return}i=p.timeStamp,m&&(r.x=p.clientX-m.left,r.y=p.clientY-m.top,r.backlog=Math.max(-$t,Math.min($t,r.backlog+Math.log(ge(p)))),r.frame||(r.last=performance.now()-1e3/60,r.frame=requestAnimationFrame(c)))}};return t.addEventListener("wheel",l,{passive:!1}),()=>{cancelAnimationFrame(r.frame),t.removeEventListener("wheel",l)}},[t,e,o])}var jt=3,ve="data-gesture-owner",Y=t=>({x:t.clientX,y:t.clientY});function Kt(t){let[e,o]=[...t.values()];return{spread:Math.hypot(e.x-o.x,e.y-o.y),mid:{x:(e.x+o.x)/2,y:(e.y+o.y)/2}}}function Ut(t){let e=k({x:0,y:0}),o=k({x:0,y:0}),i=k(!1),r=k(void 0),c=a=>r.current!==void 0&&a.pointerId!==r.current,l=k(new Map),p=k(null),s=k(null),u=k(!1),m=k(null),w=k(!1),S=k({frame:0,pan:null,hover:null,pinch:!1});H(()=>()=>{cancelAnimationFrame(S.current.frame)},[]);let[N,I]=C(),[O,D]=C(!1),[Z,$]=C(void 0);function R(a){let d=a.currentTarget.getBoundingClientRect();return{x:a.clientX-d.left,y:a.clientY-d.top}}function L(a,d){if(t.layoutResult?.tubeMap)return t.tubeMapNodeAt(a,d);let g=t.referenceStripNodeAt(a,d);if(g)return g;let{nodePositions:v}=t;if(!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return le(v,y,b,t.axisScale,t.positionsVersion,t.nodeInk)}function en(a,d){let{nodePositions:g,graph:v}=t;if(!g||!v)return null;let{x:y,y:b}=se(a,d,t,t.axisScale);return ce(g,v,y,b,t.axisScale,t.effectiveDrawPaths&&!t.facetPanels,t.positionsVersion,t.deletionEdgeIndexes,t.hiddenEdgeIndexes,t.deletionRoutes,t.layoutResult?.stranded)}function tn(a){a.button===0&&a.preventDefault()}function nn(a){if(a.button!==0)return;let d=l.current;if(c(a)){t.isPanning&&!w.current&&a.pointerType==="touch"&&d.size===1&&(a.currentTarget.setPointerCapture(a.pointerId),d.set(a.pointerId,Y(a)),s.current=Kt(d),i.current=!0);return}i.current=!1,o.current={x:a.clientX,y:a.clientY},a.currentTarget.removeAttribute(ve);let g=t.followsHostView;if(t.hostPlacesX||g&&a.shiftKey)return;a.currentTarget.setPointerCapture(a.pointerId),r.current=a.pointerId,p.current=a.currentTarget,d.clear(),d.set(a.pointerId,Y(a));let{x:v,y}=R(a),b=y<t.referenceStripZonePx,P=t.layoutResult?.tubeMap||b?null:L(v,y);g&&P&&a.currentTarget.setAttribute(ve,""),w.current=g,u.current=b&&!g,P?t.setDraggingNode(P):t.setPanning(!0),e.current={x:a.clientX,y:a.clientY}}function ye(){let a=s.current,d=p.current;if(!a||!d)return;let g=Kt(l.current),v=d.getBoundingClientRect();a.spread>0&&g.spread>0&&t.zoom(g.spread/a.spread,a.mid.x-v.left,a.mid.y-v.top),t.setTransform(t.scale,t.translateX+g.mid.x-a.mid.x,t.translateY+g.mid.y-a.mid.y),s.current=g}function on(){let a=S.current,{pan:d,hover:g,pinch:v}=a;if(a.frame=0,a.pan=null,a.hover=null,a.pinch=!1,v&&ye(),d&&u.current?t.host?.horizontalScroll(-d.dx):d&&w.current?t.setTransform(t.scale,t.translateX,t.translateY+d.dy):d&&t.setTransform(t.scale,t.translateX+d.dx,t.translateY+d.dy),!g)return;let{x:y,y:b}=g,P=t.facetPanels?void 0:yt(t.overlayLabels,y,b);$(M=>M?.label===P?.label&&M?.readout===P?.readout?M:P);let E=t.walkRowBars;if(E){let M=t.walkRowAt(y,b);t.setHoveredWalkRow(M===void 0?null:[E.reference,...E.rows][M].name)}if(t.nodePositions&&t.graph){let M=L(y,b);t.setHoveredPanel(t.tubeMapPanelAt(b)),t.setHoveredNode(M,{x:y,y:b}),D(M!==null&&!t.hostPlacesX&&!t.layoutResult?.tubeMap&&b>=t.referenceStripZonePx),t.setHoveredTube(M===null&&t.layoutResult?.tubeMap?t.tubeAt(y,b):null),t.setHoveredEdge(M||t.layoutResult?.tubeMap||!t.hoverLightsEverything?null:en(y,b))}}function j(){S.current.frame||(S.current.frame=requestAnimationFrame(on))}function rn(){let a=S.current;cancelAnimationFrame(a.frame),a.frame=0,a.pan=null,a.hover=null,a.pinch=!1}function an(a){let d=l.current;if(s.current&&d.has(a.pointerId)){d.set(a.pointerId,Y(a)),S.current.pinch=!0,j();return}if(c(a)||m.current)return;let g=a.clientX-e.current.x,v=a.clientY-e.current.y;e.current={x:a.clientX,y:a.clientY},Math.hypot(a.clientX-o.current.x,a.clientY-o.current.y)>jt&&(i.current=!0);let y=S.current;if(t.draggingNode)t.moveNode(t.draggingNode,g/t.scaleX,v/t.scaleY);else if(t.isPanning)y.pan={dx:(y.pan?.dx??0)+g,dy:(y.pan?.dy??0)+v},j();else{let b=a.currentTarget.getBoundingClientRect();y.hover={x:a.clientX-b.left,y:a.clientY-b.top},j()}}function ae(a){let d=l.current;if(s.current&&d.has(a.pointerId)){S.current.pinch&&(S.current.pinch=!1,ye()),d.delete(a.pointerId),s.current=null;let[[g,v]]=[...d];r.current=g,e.current=v;return}c(a)||(r.current=void 0,d.clear(),T(t)&&t.stopDragging())}function sn(a){c(a)||(r.current=void 0,l.current.clear(),s.current=null,rn(),$(void 0),D(!1),T(t)&&(t.stopDragging(),t.clearHover()))}function ln(a){let{x:d,y:g}=R(a),v=L(d,g),{clientX:y,clientY:b}=a;if(v){a.preventDefault(),I({clientX:y,clientY:b,nodeId:v});return}let P=t.walkRowAt(d,g);P!==void 0&&(a.preventDefault(),I({clientX:y,clientY:b,row:P}))}function cn(a){if(!i.current){let{x:d,y:g}=R(a),v=L(d,g);t.setSelectedNode(v),v&&t.showNodeDetails(v)}}H(()=>()=>{m.current?.end()},[]);function pn(a){if(a.button!==0||t.hostPlacesX||t.followsHostView||!(a.target instanceof Element)||!a.target.closest(`[${tt}]`))return;m.current?.end(),u.current=!1,w.current=!1;let d=a.pointerId,g=Y(a),v=g,y={moved:!1,end:()=>{window.removeEventListener("pointermove",b,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0),y.moved&&T(t)&&t.stopDragging()}};function b(E){if(E.pointerId!==d)return;if(!y.moved){if(Math.hypot(E.clientX-g.x,E.clientY-g.y)<=jt)return;y.moved=!0,t.setPanning(!0)}let M=S.current;M.pan={dx:(M.pan?.dx??0)+E.clientX-v.x,dy:(M.pan?.dy??0)+E.clientY-v.y},v=Y(E),j()}function P(E){E.pointerId===d&&(y.end(),setTimeout(()=>{m.current===y&&(m.current=null)},0))}m.current=y,window.addEventListener("pointermove",b,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)}function un(a){m.current?.moved&&(m.current=null,a.stopPropagation())}let dn={cursor:t.isPanning||t.draggingNode?"grabbing":O?"move":"grab",touchAction:t.hostPlacesX?"auto":"none",overscrollBehavior:"contain"},fn=t.host!==void 0&&!t.hostPlacesX&&!t.followsHostView?{[ve]:"",onMouseDown:a=>{a.stopPropagation()}}:{};return{canvasStyle:dn,surfaceProps:fn,handlers:{onMouseDown:tn,onPointerDown:nn,onPointerMove:an,onPointerUp:ae,onPointerCancel:ae,onLostPointerCapture:ae,onPointerLeave:sn,onClick:cn,onContextMenu:ln},contextMenu:N,hoveredChip:Z,labelHandlers:{onPointerDown:pn,onClickCapture:un},closeContextMenu:()=>{I(void 0)}}}var oo={position:"relative"},ro={position:"relative",lineHeight:0,isolation:"isolate"},ao={position:"absolute",left:0,right:0,bottom:0,zIndex:0},io={position:"absolute",inset:0,zIndex:10,lineHeight:"normal",pointerEvents:"none"},so={position:"absolute",left:6,transform:"translateY(-50%)",background:"rgba(255,255,255,0.82)",padding:"0 4px",borderRadius:3,fontSize:11,lineHeight:"16px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:4},lo=h(function({model:e}){return n(G,{children:e.visibleRowLabels.map(({label:o,y:i,top:r})=>n("div",{"data-testid":"graph-row-label",style:{...so,top:r},children:o},i))})}),co={position:"absolute",top:F,right:F,display:"flex",flexDirection:"column",borderRadius:3,overflowX:"hidden",overflowY:"auto",zIndex:4},Jt={position:"absolute",transform:"translate(-50%, -50%)",background:"rgba(255,255,255,0.78)",padding:"0 3px",borderRadius:3,fontSize:10,lineHeight:"13px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:3},po={...Jt,color:"#18181c",fontWeight:600},uo=h(function({model:e}){let o=k(null),i=e.legendAtRest;return H(()=>{let r=o.current;if(!r||!i)return;let c=()=>{T(e)&&e.legendAtRest&&e.setLegendSize({width:r.offsetWidth,height:r.scrollHeight})};c();let l=new ResizeObserver(c);return l.observe(r),r.firstElementChild&&l.observe(r.firstElementChild),()=>{l.disconnect()}},[e,i]),n("div",{ref:o,style:{...co,top:F+e.referenceStripZonePx,maxHeight:e.canvasHeight-2*F-e.referenceStripZonePx},children:n(kt,{model:e})})}),fo=h(function({model:e}){let o=e.overlayLabels.sizes,i=o.flatMap(({key:r,leader:c})=>c?[{key:r,...c}]:[]);return f(G,{children:[i.length>0?n(ee,{model:e,zIndex:2,overflow:"visible",children:i.map(({key:r,arcX:c,arcY:l,labelX:p,labelY:s})=>n("line",{"data-testid":"graph-label-leader",x1:c,y1:l,x2:p,y2:s,stroke:"#18181c",strokeWidth:1},r))}):null,o.map(({key:r,text:c,x:l,y:p,kind:s})=>n("div",{"data-testid":"graph-size-label",style:{...s==="deletion"?po:Jt,left:l,top:p},children:c},r))]})}),Qt=h(function({model:e,handle:{canvasRef:o,canvas:i},ownChrome:r}){let{handlers:c,canvasStyle:l,surfaceProps:p,labelHandlers:s,contextMenu:u,closeContextMenu:m,hoveredChip:w}=Ut(e),[S,N]=C(null);qt(S,i,e);let I=e.facetPanels!==void 0;return f("div",{style:oo,...p,children:[r?n(Ot,{model:e}):null,f("div",{ref:N,style:ro,...s,onMouseEnter:()=>{e.setPointerInPane(!0)},onMouseLeave:()=>{T(e)&&e.setPointerInPane(!1)},children:[e.referenceStripShown?n("div",{style:{...ao,top:e.referenceStripZonePx,background:Q}}):null,n("canvas",{ref:o,"data-testid":"graph-genome-canvas",style:{...l,width:e.paneWidth,height:e.canvasHeight,display:"block",position:"relative",zIndex:1},...c}),I?n(Rt,{model:e,handlers:c,canvasStyle:l}):f(G,{children:[n(St,{model:e}),n(fe,{model:e}),n(wt,{model:e}),n(lo,{model:e}),n(fo,{model:e}),n(ot,{model:e}),n(ht,{model:e}),n(bt,{model:e}),n(xt,{model:e}),n(Yt,{model:e}),n(uo,{model:e})]}),r?n("div",{style:io,children:n(xe,{isVisible:e.isLoading,immediate:!e.layoutResult,statusMessage:e.statusMessage,onCancel:e.canCancelLoad?()=>{e.cancelLoad()}:void 0})}):null,n(Dt,{model:e,chip:w})]}),e.walkStripShown?n(Vt,{model:e}):null,n(V,{model:e,at:u,onClose:m}),r?.renderError?n(ie,{error:r.renderError,onReset:r.retryRender}):null,r&&e.error?n(ie,{error:e.error,onReset:e.canRetryLoad?()=>{e.retryLoad()}:void 0}):null]})}),ho=h(function({model:e}){let{canvasRef:o,canvas:i,error:r,retry:c}=Mt(Pt,e);return n(Qt,{model:e,handle:{canvasRef:o,canvas:i},ownChrome:{renderError:r,retryRender:c}})}),mo=h(function({model:e,handle:o}){return o?n(Qt,{model:e,handle:o}):n(ho,{model:e})}),$i=mo;export{Pt as a,$i as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EKGY6PG2.js.map
|