jbrowse-plugin-graphgenomeviewer 8.3.2 → 8.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/chunks/GbzBaseSyntenyAdapter-GX3NGJHG.js +2 -0
  2. package/dist/chunks/GbzBaseSyntenyAdapter-GX3NGJHG.js.map +7 -0
  3. package/dist/chunks/{GraphGenomeView-NLPWMIBS.js → GraphGenomeView-JJNU2432.js} +2 -2
  4. package/dist/chunks/{GraphTrackSettingsDialog-7LHAOYX3.js → GraphTrackSettingsDialog-7NGUPDUJ.js} +2 -2
  5. package/dist/chunks/{HighlightColorDialog-YQEMRPZ6.js → HighlightColorDialog-KFXSZXTC.js} +2 -2
  6. package/dist/chunks/{LinearGraphDisplay-BEU7V4JU.js → LinearGraphDisplay-K3AT3S7J.js} +2 -2
  7. package/dist/chunks/{MinigraphBubbleAdapter-FZZLY3ZI.js → MinigraphBubbleAdapter-XYAUUM35.js} +2 -2
  8. package/dist/chunks/{RgfaTabixAdapter-DXBQEVFS.js → RgfaTabixAdapter-SBIUUIRI.js} +2 -2
  9. package/dist/chunks/{WalkFormsAdapter-ZKZ5PUYO.js → WalkFormsAdapter-ANELMZU4.js} +2 -2
  10. package/dist/chunks/{WalkTabixSyntenyAdapter-HEGPYGKB.js → WalkTabixSyntenyAdapter-I3MGWUQ5.js} +2 -2
  11. package/dist/chunks/{chunk-Y7VFVMQI.js → chunk-3HS6N7WB.js} +2 -2
  12. package/dist/chunks/{chunk-Y7VFVMQI.js.map → chunk-3HS6N7WB.js.map} +1 -1
  13. package/dist/chunks/{chunk-KM2INI7Q.js → chunk-3S33TTXF.js} +2 -2
  14. package/dist/chunks/{chunk-KM2INI7Q.js.map → chunk-3S33TTXF.js.map} +1 -1
  15. package/dist/chunks/{chunk-IQQOJGX3.js → chunk-4B3GQTHX.js} +2 -2
  16. package/dist/chunks/{chunk-IQQOJGX3.js.map → chunk-4B3GQTHX.js.map} +1 -1
  17. package/dist/chunks/chunk-C5YAQNOO.js +4 -0
  18. package/dist/chunks/chunk-C5YAQNOO.js.map +7 -0
  19. package/dist/chunks/chunk-CNFMSSE2.js +3 -0
  20. package/dist/chunks/chunk-CNFMSSE2.js.map +7 -0
  21. package/dist/chunks/chunk-DKQFTMWL.js +2 -0
  22. package/dist/chunks/chunk-DKQFTMWL.js.map +7 -0
  23. package/dist/chunks/{chunk-JTOW3TOE.js → chunk-EENENDGZ.js} +3 -3
  24. package/dist/chunks/{chunk-NB4X56M3.js → chunk-EVKN4Y3R.js} +2 -2
  25. package/dist/chunks/{chunk-NB4X56M3.js.map → chunk-EVKN4Y3R.js.map} +1 -1
  26. package/dist/chunks/{chunk-MNFL7BAC.js → chunk-HICKAMKK.js} +2 -2
  27. package/dist/chunks/{chunk-MNFL7BAC.js.map → chunk-HICKAMKK.js.map} +1 -1
  28. package/dist/chunks/{chunk-MFMAQO3W.js → chunk-HQ7FQACT.js} +2 -2
  29. package/dist/chunks/{chunk-MFMAQO3W.js.map → chunk-HQ7FQACT.js.map} +1 -1
  30. package/dist/chunks/{chunk-OMF5XFKR.js → chunk-L372SDUG.js} +1 -1
  31. package/dist/chunks/{chunk-OMF5XFKR.js.map → chunk-L372SDUG.js.map} +1 -1
  32. package/dist/chunks/{chunk-2FCFK2B5.js → chunk-LD6RX4AZ.js} +1 -1
  33. package/dist/chunks/{chunk-2FCFK2B5.js.map → chunk-LD6RX4AZ.js.map} +1 -1
  34. package/dist/chunks/chunk-NBS4FGQ6.js +4 -0
  35. package/dist/chunks/{chunk-D6NFDQQI.js.map → chunk-NBS4FGQ6.js.map} +3 -3
  36. package/dist/chunks/{chunk-HM7XSNBN.js → chunk-NFPLX56S.js} +1 -1
  37. package/dist/chunks/{chunk-HM7XSNBN.js.map → chunk-NFPLX56S.js.map} +1 -1
  38. package/dist/chunks/{chunk-5X3OZSDO.js → chunk-OHQ3WIPI.js} +2 -2
  39. package/dist/chunks/{chunk-VP6AGIRF.js → chunk-OXU7F4BR.js} +2 -2
  40. package/dist/chunks/{chunk-TNEXOJ5F.js → chunk-QB5JERW4.js} +1 -1
  41. package/dist/chunks/{chunk-TNEXOJ5F.js.map → chunk-QB5JERW4.js.map} +1 -1
  42. package/dist/chunks/chunk-SYKOZDP6.js +2 -0
  43. package/dist/chunks/{chunk-YMK7HFJV.js → chunk-WANYNRGU.js} +2 -2
  44. package/dist/chunks/{chunk-EKIQ3ATV.js → chunk-YS3R3J2I.js} +2 -2
  45. package/dist/chunks/{chunk-EKIQ3ATV.js.map → chunk-YS3R3J2I.js.map} +2 -2
  46. package/dist/chunks/{renderSvg-XIEGA5N5.js → renderSvg-2YULK24A.js} +2 -2
  47. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
  48. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +2 -2
  49. package/package.json +9 -9
  50. package/src/GraphGenomeView/components/LabelLayer.tsx +9 -4
  51. package/src/RgfaTabixAdapter/configSchema.ts +1 -1
  52. package/src/WalkFormsAdapter/configSchema.ts +1 -1
  53. package/src/WalkTabixSyntenyAdapter/configSchema.ts +1 -1
  54. package/src/version.ts +1 -1
  55. package/dist/chunks/GbzBaseSyntenyAdapter-W5J3E5VT.js +0 -2
  56. package/dist/chunks/GbzBaseSyntenyAdapter-W5J3E5VT.js.map +0 -7
  57. package/dist/chunks/chunk-D6NFDQQI.js +0 -4
  58. package/dist/chunks/chunk-D7MOOK6H.js +0 -4
  59. package/dist/chunks/chunk-D7MOOK6H.js.map +0 -7
  60. package/dist/chunks/chunk-EINURNZ6.js +0 -2
  61. package/dist/chunks/chunk-XBZ4C4R3.js +0 -3
  62. package/dist/chunks/chunk-XBZ4C4R3.js.map +0 -7
  63. package/dist/chunks/chunk-ZWRAQSXC.js +0 -2
  64. package/dist/chunks/chunk-ZWRAQSXC.js.map +0 -7
  65. /package/dist/chunks/{GraphGenomeView-NLPWMIBS.js.map → GraphGenomeView-JJNU2432.js.map} +0 -0
  66. /package/dist/chunks/{GraphTrackSettingsDialog-7LHAOYX3.js.map → GraphTrackSettingsDialog-7NGUPDUJ.js.map} +0 -0
  67. /package/dist/chunks/{HighlightColorDialog-YQEMRPZ6.js.map → HighlightColorDialog-KFXSZXTC.js.map} +0 -0
  68. /package/dist/chunks/{LinearGraphDisplay-BEU7V4JU.js.map → LinearGraphDisplay-K3AT3S7J.js.map} +0 -0
  69. /package/dist/chunks/{MinigraphBubbleAdapter-FZZLY3ZI.js.map → MinigraphBubbleAdapter-XYAUUM35.js.map} +0 -0
  70. /package/dist/chunks/{RgfaTabixAdapter-DXBQEVFS.js.map → RgfaTabixAdapter-SBIUUIRI.js.map} +0 -0
  71. /package/dist/chunks/{WalkFormsAdapter-ZKZ5PUYO.js.map → WalkFormsAdapter-ANELMZU4.js.map} +0 -0
  72. /package/dist/chunks/{WalkTabixSyntenyAdapter-HEGPYGKB.js.map → WalkTabixSyntenyAdapter-I3MGWUQ5.js.map} +0 -0
  73. /package/dist/chunks/{chunk-JTOW3TOE.js.map → chunk-EENENDGZ.js.map} +0 -0
  74. /package/dist/chunks/{chunk-5X3OZSDO.js.map → chunk-OHQ3WIPI.js.map} +0 -0
  75. /package/dist/chunks/{chunk-VP6AGIRF.js.map → chunk-OXU7F4BR.js.map} +0 -0
  76. /package/dist/chunks/{chunk-EINURNZ6.js.map → chunk-SYKOZDP6.js.map} +0 -0
  77. /package/dist/chunks/{chunk-YMK7HFJV.js.map → chunk-WANYNRGU.js.map} +0 -0
  78. /package/dist/chunks/{renderSvg-XIEGA5N5.js.map → renderSvg-2YULK24A.js.map} +0 -0
@@ -1,2 +1,2 @@
1
1
  import{d as A}from"./chunk-ROZPEXN4.js";import{a as x,d as O}from"./chunk-3VGXCEMQ.js";import{f as I}from"./chunk-6VNDP3UB.js";function G(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function se(e){let t=x(e).slice(1);return t.length>0?t:void 0}function M(e){return e.type==="WalkTabixSyntenyAdapter"||e.type==="RgfaTabixAdapter"&&(typeof e.walksUri=="string"&&e.walksUri!==""||I(e.walksLocation))}function oe(e){return e.type==="GbzBaseSyntenyAdapter"||M(e)}function ie(e){let{defaultHaplotypes:t}=e;return M(e)&&G(t)&&t.length>0?t:void 0}function ae(e){return x(e)[0]}function ce(e){return O(e).adapter}function ue(e,t){return e===void 0||e===t?void 0:`The graph is cut on its reference, ${e}: open it from a view of ${e}`}function i(e,t){return typeof e.get=="function"?e.get(t):e[t]}function b(e,t){return e.find(n=>n.trackId===t)}function l(e){return`${e.trackId} ${e.name??""}`}var U=new Set(["BedAdapter","BedTabixAdapter","BigBedAdapter","VcfAdapter","VcfTabixAdapter"]),R=/repeat|tandem|\bstr\b|vntr|trf|trgt|vamos|expansion|microsat/i;function Ge(e,t){let n=t?b(e,t):void 0;return n||e.filter(s=>U.has(s.adapterType)).find(s=>R.test(l(s)))}var B=/^\w+=[^;]*(;\w+=[^;]*)*$/;function H(e){let t=i(e,"name");if(!(typeof t!="string"||!B.test(t)))return Object.fromEntries(t.split(";").map(n=>{let r=n.indexOf("=");return[n.slice(0,r),n.slice(r+1)]}))}function d(e,t){let n=i(e,t);return n!==void 0?n:i(e,"INFO")?.[t]??H(e)?.[t]}var P=["RUS","MOTIFS","RU","motifs","motif","sequence","consensus"],v=["RUL","period","PERIOD","consensusSize","unit","unitLength"],j=["TRID","REPID","VARID","ID","name","id"];function h(e,t){for(let n of t){let r=d(e,n),s=String((Array.isArray(r)?r[0]:r)??"").split(",")[0].trim();if(s!==""&&s!==".")return s}}var $=/^[ACGTURYSWKMBDHVN]+$/i;function V(e){let t=Number(h(e,v));if(Number.isFinite(t)&&t>0)return Math.round(t);let n=h(e,P);return n&&$.test(n)?n.length:void 0}function m(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=n===""||n===null||n===void 0?NaN:Number(n);return Number.isFinite(r)?r:void 0})}function N(e){return(Array.isArray(e)?e:String(e??"").split(",")).map(n=>{let r=String(n??"").trim();return r===""||r==="."?void 0:r})}var w="<CNV:TR>";function K(e){let t=N(i(e,"ALT"));if(!t.includes(w))return;let n=m(d(e,"RN")),r=N(d(e,"RUS")),s=m(d(e,"RUL")),o=m(d(e,"RUC")),a=m(d(e,"RB")),c=0;return t.map((u,f)=>{let p=n[f]??(u===w?1:0),k=0,S=0;for(let F=0;F<p;F++,c++){let y=r[c],L=s[c]??(y&&$.test(y)?y.length:void 0),_=o[c],C=a[c]??(L&&_!==void 0?Math.round(L*_):void 0);C!==void 0&&(k+=C,S++)}return u===w&&p>0&&S===p?k:void 0})}function Y(e,t,n){let r=e?.includes("|");return(e??"").split(/[/|]/).flatMap((s,o)=>{let a=s===""?NaN:Number(s),c=a>0?t[a-1]:n;return!Number.isInteger(a)||c===void 0?[]:[{bp:c,...r?{haplotype:o+1}:{}}]})}function W(e,t,n){let r=i(e,"samples"),s={};for(let[o,a]of Object.entries(r??{})){let c=m(a.SD),u=m(a.AL).flatMap((p,k)=>p!==void 0&&p>0?[c[k]===void 0?{bp:p}:{bp:p,spanningReads:c[k]}]:[]),f=u.length>0||!t?u:Y(N(a.GT)[0],t,n);f.length>0&&(s[o]=f)}return Object.keys(s).length>0?s:void 0}function J(e,t){let n=d(e,"start"),r=d(e,"end"),s=m(d(e,"SVLEN"))[0];return t&&s!==void 0?{start:n+1,end:n+1+s}:{start:n,end:r}}function Ue(e){let t=[];for(let n of e){let r=K(n),{start:s,end:o}=J(n,r!==void 0),a=V(n);if(!(o>s)||a===void 0)continue;let c=d(n,"refName"),u=h(n,P),f=h(n,j);t.push({key:`${c}:${s}-${o}`,name:(f&&!B.test(f)?f:void 0)??(u&&u.length<=12?`(${u})n`:`${c}:${(s+1).toLocaleString("en-US")}-${o.toLocaleString("en-US")}`),refName:c,start:s,end:o,unit:a,motif:u,calls:W(n,r,o-s)})}return t.sort((n,r)=>n.start-r.start)}function T(e){let t=[];for(let n of[...e].sort((r,s)=>r.start-s.start)){let r=t.at(-1);r&&n.start<=r.end?r.end=Math.max(r.end,n.end):t.push({...n})}return t}function E(e){let t=[],n=new Map;for(let r of[...e].sort((s,o)=>s.start-o.start)){let s=`${r.refName} ${r.strand} ${r.name}`,o=n.get(s);if(o&&r.start<o.end)o.end=Math.max(o.end,r.end),o.exons=T([...o.exons,...r.exons]);else{let a={...r,exons:T(r.exons)};t.push(a),n.set(s,a)}}return t}var q=new Set(["Gff3TabixAdapter","Gff3Adapter","BedTabixAdapter","BedAdapter","GtfTabixAdapter","GtfAdapter","BigBedAdapter","NCListAdapter"]),z=/gene|refseq|gencode|ensembl|annotation/i,X=new Set(["BedTabixAdapter","BedAdapter"]);function Qe(e,t){let n=t?b(e,t):void 0;if(n)return n;let r=e.filter(s=>q.has(s.adapterType)&&!R.test(l(s)));return r.find(s=>z.test(l(s)))??r.find(s=>!X.has(s.adapterType))}var Q=/\bTEs?\b|transpos/i;function Ze(e){return e&&Q.test(l(e))?"TE":"gene"}function en(e,t){let n=e.tracks?.find(r=>A(r.configuration,"trackId")===t)?.displays[0];return n?A(n.configuration,"filter")??[]:[]}var Z=new Set(["chromosome","region","contig","supercontig","scaffold"]),ee=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR"]);function D(e,t){let n=i(e,"type");typeof n=="string"&&ee.has(n)&&t.push({start:i(e,"start"),end:i(e,"end")});let r=i(e,"subfeatures");for(let s of r??[])D(s,t)}function nn(e){let t=[];for(let n of e){let r=i(n,"gene_name")??i(n,"name")??i(n,"gene")??i(n,"gene_id"),s=i(n,"start"),o=i(n,"end");if(!r||!(o>s)||Z.has(i(n,"type")))continue;let a=[];D(n,a),t.push({name:r,refName:i(n,"refName"),start:s,end:o,strand:i(n,"strand")??0,exons:a.length?T(a):[{start:s,end:o}]})}return E(t)}var g=JBrowseExports["tss-react/mui"],ne=e=>g!=null&&e in Object(g)?g[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from 'tss-react/mui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var rn=ne("makeStyles"),sn=g&&g.__esModule?g.default:g;export{se as a,M as b,oe as c,ie as d,ae as e,ce as f,ue as g,U as h,Ge as i,Ue as j,q as k,Qe as l,Ze as m,en as n,nn as o,rn as p};
2
- //# sourceMappingURL=chunk-HM7XSNBN.js.map
2
+ //# sourceMappingURL=chunk-NFPLX56S.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/graphTrackConfig.ts", "../../src/GraphGenomeView/trackFeatures.ts", "../../src/GraphGenomeView/repeats/repeatFeatures.ts", "../../node_modules/.pnpm/@jbrowse+bandage-core@12.2.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-EQDQ7P4Y.js", "../../src/GraphGenomeView/genes/geneFeatures.ts", "host:tss-react/mui"],
3
+ "sources": ["../../src/graphTrackConfig.ts", "../../src/GraphGenomeView/trackFeatures.ts", "../../src/GraphGenomeView/repeats/repeatFeatures.ts", "../../node_modules/.pnpm/@jbrowse+bandage-core@12.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-EQDQ7P4Y.js", "../../src/GraphGenomeView/genes/geneFeatures.ts", "host:tss-react/mui"],
4
4
  "sourcesContent": ["import {\n getConfAssemblyNamesOrNone,\n toTrackConfigEntry,\n} from '@jbrowse/core/util/tracks'\n\nimport { snapshotNamesFile } from './locationName.ts'\n\nimport type { AnyTrackConfig } from '@jbrowse/core/configuration'\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(item => typeof item === 'string')\n}\n\n// The assemblies the track names after its reference, which is what core's\n// MultiWaySyntenyDisplay opens a lane-declaring source on.\nexport function trackLanes(track: AnyTrackConfig) {\n const lanes = getConfAssemblyNamesOrNone(track).slice(1)\n return lanes.length > 0 ? lanes : undefined\n}\n\n// Whether a track names a walk file, by the `walksUri` shorthand as written\n// or the location it expands to: an rGFA track may, and a\n// WalkTabixSyntenyAdapter one does\nexport function walkIndexed(adapterConfig: Record<string, unknown>) {\n return (\n adapterConfig.type === 'WalkTabixSyntenyAdapter' ||\n (adapterConfig.type === 'RgfaTabixAdapter' &&\n ((typeof adapterConfig.walksUri === 'string' &&\n adapterConfig.walksUri !== '') ||\n snapshotNamesFile(adapterConfig.walksLocation)))\n )\n}\n\n// Whether a track's cut reads `haplotypes`: a GBZ cut does, and so does an\n// rGFA one with a walk file\nexport function cutsByHaplotype(adapterConfig: Record<string, unknown>) {\n return (\n adapterConfig.type === 'GbzBaseSyntenyAdapter' || walkIndexed(adapterConfig)\n )\n}\n\n// The haplotypes a walk-indexed track's config names to cut for until the\n// user picks others\nexport function configHaplotypes(adapterConfig: Record<string, unknown>) {\n const { defaultHaplotypes } = adapterConfig\n return walkIndexed(adapterConfig) &&\n isStringArray(defaultHaplotypes) &&\n defaultHaplotypes.length > 0\n ? defaultHaplotypes\n : undefined\n}\n\n// A graph is cut on the first assembly its track names, the rule\n// GbzBaseSyntenyAdapter states for its anchor. Every other assembly the track\n// names holds its sequence as rank>0 alleles off that reference's backbone, so\n// a window on one has no reference coordinates to frame the cut by.\nexport function graphReferenceAssembly(track: AnyTrackConfig) {\n return getConfAssemblyNamesOrNone(track)[0]\n}\n\n// A track's adapter config, from a live node or a session's frozen entry\nexport function trackAdapterSnapshot(track: AnyTrackConfig) {\n return toTrackConfigEntry(track).adapter as Record<string, unknown>\n}\n\nexport function offReferenceProblem(\n referenceAssembly: string | undefined,\n assemblyName: string,\n) {\n return referenceAssembly === undefined || referenceAssembly === assemblyName\n ? undefined\n : `The graph is cut on its reference, ${referenceAssembly}: open it from a view of ${referenceAssembly}`\n}\n", "import type { Feature } from '@jbrowse/core/util'\n\nexport type FeatureLike = Feature | Record<string, unknown>\n\nexport function ownField(f: FeatureLike, name: string): unknown {\n return typeof (f as Feature).get === 'function'\n ? (f as Feature).get(name)\n : (f as Record<string, unknown>)[name]\n}\n\nexport interface TrackChoice {\n trackId: string\n name?: string\n adapterType: string\n}\n\nexport function namedTrack<T extends TrackChoice>(tracks: T[], named: string) {\n return tracks.find(t => t.trackId === named)\n}\n\n// what a track-name hint such as /repeat|tandem/ is matched against\nexport function trackLabel(t: TrackChoice) {\n return `${t.trackId} ${t.name ?? ''}`\n}\n", "import { namedTrack, ownField, trackLabel } from '../trackFeatures'\n\nimport type { FeatureLike, TrackChoice } from '../trackFeatures'\n\nexport interface RepeatCall {\n bp: number\n // TRGT's `SD`. Zero means the allele is a copy of the one the reads did\n // support, so its length states nothing about a second haplotype; absent\n // where the genotyper writes no such field.\n spanningReads?: number\n // the PanSN haplotype a phased genotype puts this allele on\n haplotype?: number\n}\n\n// A tandem repeat array as the walk rows need it: its span on the reference,\n// which is what the bars measure between, and its unit length, which is what\n// they tile by. Read off whatever repeat annotation the session has, since the\n// tools all state the same two facts under different names: VCF 4.5's\n// `<CNV:TR>` allele gives `RUL` and `RUS` (one entry per repeat sequence,\n// grouped by `RN`), UCSC simpleRepeat and TRF give `period` and the consensus\n// `sequence`, TRGT gives `MOTIFS` and `TRID`, ExpansionHunter `RU` and `REPID`,\n// HipSTR and GangSTR `PERIOD`, vamos its `motifs`. A VCF record's INFO is\n// searched as well as its top level, and a list's first entry is the unit the\n// bars tile by: for a compound array that is the first repeat sequence, which\n// is the expanding one at every such locus in the common catalogues.\nexport interface RepeatArray {\n key: string\n name: string\n refName: string\n start: number\n end: number\n unit: number\n motif?: string\n // Each sample's genotyped alleles, from a genotyper's per-sample `AL`\n // (TRGT) or a genotype over VCF 4.5 <CNV:TR> alleles; absent from a\n // catalogue.\n calls?: Record<string, RepeatCall[]>\n}\n\nexport const REPEAT_ADAPTER_TYPES = new Set([\n 'BedAdapter',\n 'BedTabixAdapter',\n 'BigBedAdapter',\n 'VcfAdapter',\n 'VcfTabixAdapter',\n])\n\nexport const REPEAT_TRACK_HINT =\n /repeat|tandem|\\bstr\\b|vntr|trf|trgt|vamos|expansion|microsat/i\n\nexport function pickRepeatTrack<T extends TrackChoice>(\n tracks: T[],\n named: string,\n) {\n const chosen = named ? namedTrack(tracks, named) : undefined\n if (chosen) {\n return chosen\n }\n const candidates = tracks.filter(t => REPEAT_ADAPTER_TYPES.has(t.adapterType))\n return candidates.find(t => REPEAT_TRACK_HINT.test(trackLabel(t)))\n}\n\n// A TRGT repeat catalogue is a BED whose name column packs the record:\n// `ID=HTT;MOTIFS=CAG,CCG;STRUC=(CAG)nCAACAG(CCG)n`. Read as fields when it\n// has that shape.\nconst PACKED_NAME = /^\\w+=[^;]*(;\\w+=[^;]*)*$/\n\nfunction packedName(f: FeatureLike) {\n const name = ownField(f, 'name')\n if (typeof name !== 'string' || !PACKED_NAME.test(name)) {\n return undefined\n }\n return Object.fromEntries(\n name.split(';').map(pair => {\n const i = pair.indexOf('=')\n return [pair.slice(0, i), pair.slice(i + 1)]\n }),\n )\n}\n\n// A field at the feature's top level, in a VCF record's INFO, or in a packed\n// name column, in that order.\nfunction field(f: FeatureLike, name: string): unknown {\n const top = ownField(f, name)\n if (top !== undefined) {\n return top\n }\n const info = ownField(f, 'INFO') as Record<string, unknown> | undefined\n return info?.[name] ?? packedName(f)?.[name]\n}\n\nconst MOTIF_FIELDS = [\n 'RUS',\n 'MOTIFS',\n 'RU',\n 'motifs',\n 'motif',\n 'sequence',\n 'consensus',\n]\nconst PERIOD_FIELDS = [\n 'RUL',\n 'period',\n 'PERIOD',\n 'consensusSize',\n 'unit',\n 'unitLength',\n]\nconst NAME_FIELDS = ['TRID', 'REPID', 'VARID', 'ID', 'name', 'id']\n\n// The first entry of a list-valued field, whether it arrived parsed or as\n// the comma-joined text a VCF INFO or a BED column holds; VCF's missing \".\"\n// counts as absent.\nfunction first(f: FeatureLike, names: string[]) {\n for (const name of names) {\n const value = field(f, name)\n const one = String((Array.isArray(value) ? value[0] : value) ?? '')\n .split(',')[0]!\n .trim()\n if (one !== '' && one !== '.') {\n return one\n }\n }\n return undefined\n}\n\nconst IUPAC = /^[ACGTURYSWKMBDHVN]+$/i\n\n// The unit in bp: a stated period, else the length of the first motif.\nexport function repeatUnitOf(f: FeatureLike) {\n const period = Number(first(f, PERIOD_FIELDS))\n if (Number.isFinite(period) && period > 0) {\n return Math.round(period)\n }\n const motif = first(f, MOTIF_FIELDS)\n return motif && IUPAC.test(motif) ? motif.length : undefined\n}\n\n// A per-sample list field, parsed or as the comma-joined text a VCF column\n// holds. A missing entry stays missing: read as 0, an absent `SD` would make\n// every allele of every genotyper that writes no such field unspanned.\nfunction numbers(value: unknown) {\n const raw: unknown[] = Array.isArray(value)\n ? value\n : String(value ?? '').split(',')\n return raw.map(one => {\n const n =\n one === '' || one === null || one === undefined ? NaN : Number(one)\n return Number.isFinite(n) ? n : undefined\n })\n}\n\nfunction strings(value: unknown) {\n const raw: unknown[] = Array.isArray(value)\n ? value\n : String(value ?? '').split(',')\n return raw.map(one => {\n const text = String(one ?? '').trim()\n return text === '' || text === '.' ? undefined : text\n })\n}\n\nconst TANDEM_REPEAT = '<CNV:TR>'\n\n// Each ALT allele's length, off VCF 4.5's flattened list-of-lists: RN says how\n// many RUS/RUL/RUC/RB entries each allele takes, and the allele's bases are\n// its runs' RB, or unit length times count where RB is missing. An allele that\n// is not <CNV:TR>, or has a run stating neither, has none.\nfunction tandemAlleleBp(f: FeatureLike) {\n const alts = strings(ownField(f, 'ALT'))\n if (!alts.includes(TANDEM_REPEAT)) {\n return undefined\n }\n const rn = numbers(field(f, 'RN'))\n const rus = strings(field(f, 'RUS'))\n const rul = numbers(field(f, 'RUL'))\n const ruc = numbers(field(f, 'RUC'))\n const rb = numbers(field(f, 'RB'))\n let k = 0\n return alts.map((alt, i) => {\n const n = rn[i] ?? (alt === TANDEM_REPEAT ? 1 : 0)\n let bp = 0\n let known = 0\n for (let j = 0; j < n; j++, k++) {\n const motif = rus[k]\n const unitLength =\n rul[k] ?? (motif && IUPAC.test(motif) ? motif.length : undefined)\n const count = ruc[k]\n const runBp =\n rb[k] ??\n (unitLength && count !== undefined\n ? Math.round(unitLength * count)\n : undefined)\n if (runBp !== undefined) {\n bp += runBp\n known++\n }\n }\n return alt === TANDEM_REPEAT && n > 0 && known === n ? bp : undefined\n })\n}\n\n// A sample's alleles through its genotype: 0 is the reference's, an index\n// past it the ALT allele's. A phased genotype's k-th allele is PanSN\n// haplotype k, the order vg deconstruct writes an assembly's haplotypes in.\nfunction genotyped(\n gt: string | undefined,\n alleleBp: (number | undefined)[],\n referenceBp: number,\n) {\n const phased = gt?.includes('|')\n return (gt ?? '').split(/[/|]/).flatMap((index, k): RepeatCall[] => {\n const i = index === '' ? NaN : Number(index)\n const bp = i > 0 ? alleleBp[i - 1] : referenceBp\n if (!Number.isInteger(i) || bp === undefined) {\n return []\n }\n return [{ bp, ...(phased ? { haplotype: k + 1 } : {}) }]\n })\n}\n\nfunction callsOf(\n f: FeatureLike,\n alleleBp: (number | undefined)[] | undefined,\n referenceBp: number,\n) {\n const samples = ownField(f, 'samples') as\n Record<string, Record<string, unknown>> | undefined\n const called: Record<string, RepeatCall[]> = {}\n for (const [sample, fields] of Object.entries(samples ?? {})) {\n const reads = numbers(fields.SD)\n const lengths = numbers(fields.AL).flatMap((bp, i) =>\n bp !== undefined && bp > 0\n ? [reads[i] === undefined ? { bp } : { bp, spanningReads: reads[i] }]\n : [],\n )\n const calls =\n lengths.length > 0 || !alleleBp\n ? lengths\n : genotyped(strings(fields.GT)[0], alleleBp, referenceBp)\n if (calls.length > 0) {\n called[sample] = calls\n }\n }\n return Object.keys(called).length > 0 ? called : undefined\n}\n\n// A <CNV:TR> record's POS is the base before the array and SVLEN the\n// reference allele's length, while a VCF feature starts at that padding base.\nfunction spanOf(f: FeatureLike, tandem: boolean) {\n const start = field(f, 'start') as number\n const end = field(f, 'end') as number\n const svlen = numbers(field(f, 'SVLEN'))[0]\n return tandem && svlen !== undefined\n ? { start: start + 1, end: start + 1 + svlen }\n : { start, end }\n}\n\nexport function repeatArraysFrom(features: FeatureLike[]): RepeatArray[] {\n const arrays: RepeatArray[] = []\n for (const f of features) {\n const alleleBp = tandemAlleleBp(f)\n const { start, end } = spanOf(f, alleleBp !== undefined)\n const unit = repeatUnitOf(f)\n if (!(end > start) || unit === undefined) {\n continue\n }\n const refName = field(f, 'refName') as string\n const motif = first(f, MOTIF_FIELDS)\n const stated = first(f, NAME_FIELDS)\n arrays.push({\n key: `${refName}:${start}-${end}`,\n name:\n (stated && !PACKED_NAME.test(stated) ? stated : undefined) ??\n (motif && motif.length <= 12\n ? `(${motif})n`\n : `${refName}:${(start + 1).toLocaleString('en-US')}-${end.toLocaleString('en-US')}`),\n refName,\n start,\n end,\n unit,\n motif,\n calls: callsOf(f, alleleBp, end - start),\n })\n }\n return arrays.sort((a, b) => a.start - b.start)\n}\n", "// src/genes/geneFiles.ts\nvar GENE_TYPE = /(gene|gene_segment|RNA|transcript)$/i;\nvar isGene = (type) => GENE_TYPE.test(type) || type === \"CDS\" || type === \"exon\";\nfunction mergedIntervals(intervals) {\n const out = [];\n for (const iv of [...intervals].sort((a, b) => a.start - b.start)) {\n const last = out.at(-1);\n if (last && iv.start <= last.end) {\n last.end = Math.max(last.end, iv.end);\n } else {\n out.push({ ...iv });\n }\n }\n return out;\n}\nfunction strandOf(s) {\n return s === \"+\" ? 1 : s === \"-\" ? -1 : 0;\n}\nfunction unescape(value) {\n try {\n return decodeURIComponent(value);\n } catch {\n return value;\n }\n}\nfunction attributes(column) {\n const out = /* @__PURE__ */ new Map();\n for (const pair of column.split(\";\")) {\n const eq = pair.indexOf(\"=\");\n if (eq > 0) {\n out.set(pair.slice(0, eq).trim(), unescape(pair.slice(eq + 1).trim()));\n }\n }\n return out;\n}\nfunction gff3Row(line) {\n const cols = line.split(\"\t\");\n const start = Number(cols[3]);\n const end = Number(cols[4]);\n if (cols.length < 9 || !Number.isInteger(start) || !Number.isInteger(end)) {\n return void 0;\n }\n return {\n refName: cols[0],\n type: cols[2],\n start: start - 1,\n end,\n strand: strandOf(cols[6]),\n attrs: attributes(cols[8])\n };\n}\nfunction genesFromGff3Lines(lines) {\n const rows = [];\n for (const line of lines) {\n if (line.startsWith(\"##FASTA\")) {\n break;\n }\n const row = line.startsWith(\"#\") ? void 0 : gff3Row(line);\n if (row) {\n rows.push(row);\n }\n }\n const parentOf = /* @__PURE__ */ new Map();\n for (const { attrs } of rows) {\n const id = attrs.get(\"ID\");\n const parent = attrs.get(\"Parent\")?.split(\",\")[0];\n if (id && parent) {\n parentOf.set(id, parent);\n }\n }\n const rootOf = (row) => {\n let id = row.attrs.get(\"Parent\")?.split(\",\")[0] ?? row.attrs.get(\"ID\");\n if (!id) {\n return row.attrs.get(\"gene_id\");\n }\n const seen = /* @__PURE__ */ new Set();\n while (id && parentOf.has(id) && !seen.has(id)) {\n seen.add(id);\n id = parentOf.get(id);\n }\n return id;\n };\n const groups = /* @__PURE__ */ new Map();\n rows.forEach((row, i) => {\n const root = rootOf(row) ?? `#${i}`;\n const key = `${row.refName}\t${root}`;\n const group = groups.get(key) ?? groups.set(key, { rows: [] }).get(key);\n group.rows.push(row);\n if (!row.attrs.has(\"Parent\") && !group.top) {\n group.top = row;\n }\n });\n const genes = [];\n for (const [key, { top, rows: rows2 }] of groups) {\n if (top && !isGene(top.type)) {\n continue;\n }\n const first = top ?? rows2[0];\n const start = top?.start ?? Math.min(...rows2.map((r) => r.start));\n const end = top?.end ?? Math.max(...rows2.map((r) => r.end));\n const a = first.attrs;\n const spans = (type) => rows2.filter((r) => r.type === type).map((r) => ({ start: r.start, end: r.end }));\n const exons = spans(\"exon\");\n const coding = spans(\"CDS\");\n const transcribed = rows2.some(\n (r) => r !== top && r.type !== \"exon\" && r.type !== \"CDS\"\n );\n genes.push({\n name: a.get(\"Name\") ?? a.get(\"gene_name\") ?? a.get(\"gene\") ?? a.get(\"gene_id\") ?? key.split(\"\t\")[1],\n refName: first.refName,\n start,\n end,\n strand: first.strand,\n // A range read holds only the rows over its window, so a gene with\n // transcripts but no exon or CDS there is intronic in it. Only a gene\n // with no transcripts, as a bacterium's gene and CDS, is one exon.\n exons: exons.length ? mergedIntervals(exons) : transcribed ? mergedIntervals(coding) : [{ start, end }]\n });\n }\n return genes;\n}\nfunction mergeOverlappingByName(genes) {\n const out = [];\n const open = /* @__PURE__ */ new Map();\n for (const g of [...genes].sort((a, b) => a.start - b.start)) {\n const key = `${g.refName}\t${g.strand}\t${g.name}`;\n const last = open.get(key);\n if (last && g.start < last.end) {\n last.end = Math.max(last.end, g.end);\n last.exons = mergedIntervals([...last.exons, ...g.exons]);\n } else {\n const gene = { ...g, exons: mergedIntervals(g.exons) };\n out.push(gene);\n open.set(key, gene);\n }\n }\n return out;\n}\nvar BED_HEADER = /^(#|track\\s|browser\\s)/;\nfunction genesFromBed(text) {\n const rows = [];\n for (const line of text.split(\"\\n\")) {\n const cols = line.replace(/\\r$/, \"\").split(\"\t\");\n const start = Number(cols[1]);\n const end = Number(cols[2]);\n if (BED_HEADER.test(line) || cols.length < 3 || !Number.isInteger(start) || !(end > start)) {\n continue;\n }\n const refName = cols[0];\n const name = cols[3] && cols[3] !== \".\" ? cols[3] : `${refName}:${start + 1}-${end}`;\n const sizes = cols[10]?.split(\",\").filter((s) => s !== \"\").map(Number);\n const starts = cols[11]?.split(\",\").filter((s) => s !== \"\").map(Number);\n const blocks = sizes?.length && sizes.length === starts?.length ? sizes.map((size, i) => ({\n start: start + starts[i],\n end: start + starts[i] + size\n })) : [{ start, end }];\n rows.push({\n name,\n refName,\n start,\n end,\n strand: strandOf(cols[5]),\n exons: blocks\n });\n }\n return mergeOverlappingByName(rows);\n}\nfunction sniffedFormat(text) {\n const first = text.split(\"\\n\", 1e3).find((l) => l.trim() !== \"\" && !BED_HEADER.test(l));\n const cols = first?.split(\"\t\") ?? [];\n return /^\\d+$/.test(cols[1] ?? \"\") && /^\\d+$/.test(cols[2] ?? \"\") ? \"bed\" : \"gff3\";\n}\nfunction genesFromText(text, format = sniffedFormat(text)) {\n return format === \"bed\" ? genesFromBed(text) : genesFromGff3Lines(text.split(/\\r?\\n/));\n}\n\nexport {\n mergedIntervals,\n genesFromGff3Lines,\n mergeOverlappingByName,\n genesFromBed,\n genesFromText\n};\n", "import {\n mergeOverlappingByName,\n mergedIntervals,\n} from '@jbrowse/bandage-core/genes/geneFiles'\nimport { readConfObject } from '@jbrowse/core/configuration'\n\nimport { REPEAT_TRACK_HINT } from '../repeats/repeatFeatures'\nimport { namedTrack, ownField, trackLabel } from '../trackFeatures'\n\nimport type { FeatureLike, TrackChoice } from '../trackFeatures'\nimport type { GeneModel } from '@jbrowse/bandage-core/genes/genePins'\nimport type { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\n// The adapters whose tracks hold gene models, in the order the session's\n// tracks are searched when no track is named.\nexport const GENE_ADAPTER_TYPES = new Set([\n 'Gff3TabixAdapter',\n 'Gff3Adapter',\n 'BedTabixAdapter',\n 'BedAdapter',\n 'GtfTabixAdapter',\n 'GtfAdapter',\n 'BigBedAdapter',\n 'NCListAdapter',\n])\n\nconst GENE_TRACK_HINT = /gene|refseq|gencode|ensembl|annotation/i\n\n// A BED track is as often peaks or repeats as genes, so one counts only where\n// its name says it is annotation\nconst BED_ADAPTER_TYPES = new Set(['BedTabixAdapter', 'BedAdapter'])\n\n// Which of the session's tracks to read genes from: the named one while the\n// assembly has it (a saved pick can name a track since removed), else the\n// first gene-bearing track on the assembly whose name says it is annotation,\n// else the first non-BED gene-bearing track. A track whose name says repeats is\n// never picked unnamed, as \"RepeatMasker annotation\" would be.\nexport function pickGeneTrack<T extends TrackChoice>(\n tracks: T[],\n named: string,\n) {\n const chosen = named ? namedTrack(tracks, named) : undefined\n if (chosen) {\n return chosen\n }\n const candidates = tracks.filter(\n t =>\n GENE_ADAPTER_TYPES.has(t.adapterType) &&\n !REPEAT_TRACK_HINT.test(trackLabel(t)),\n )\n return (\n candidates.find(t => GENE_TRACK_HINT.test(trackLabel(t))) ??\n candidates.find(t => !BED_ADAPTER_TYPES.has(t.adapterType))\n )\n}\n\nconst TE_TRACK_HINT = /\\bTEs?\\b|transpos/i\n\n// What a walk row's boxes are, for the key: TEs where the annotation track's\n// name says so, else genes\nexport function annotationNoun(track: TrackChoice | undefined) {\n return track && TE_TRACK_HINT.test(trackLabel(track)) ? 'TE' : 'gene'\n}\n\ninterface LaneView {\n tracks?: readonly {\n configuration: AnyConfigurationModel\n displays: readonly { configuration: AnyConfigurationModel }[]\n }[]\n}\n\n// The `filter` of the gene track's lane in the view the graph is drawn in, so\n// the chips name what the lane draws. None where the view shows no such lane,\n// or has no tracks, as a graph genome view of its own.\nexport function laneFilters(view: object, trackId: string | undefined) {\n const lane = (view as LaneView).tracks?.find(\n t => readConfObject(t.configuration, 'trackId') === trackId,\n )?.displays[0]\n return lane\n ? ((readConfObject(lane.configuration, 'filter') as string[] | undefined) ??\n [])\n : []\n}\n\n// Records spanning a whole sequence, the types the GFF3 adapter declines to\n// widen a fetch for. RefSeq opens every molecule with a `region` named\n// ANONYMOUS.\nconst WHOLE_SEQUENCE_TYPES = new Set([\n 'chromosome',\n 'region',\n 'contig',\n 'supercontig',\n 'scaffold',\n])\n\n// JBrowse's BED parser splits a coding BED12 block into CDS and UTR parts and\n// keeps `exon` for non-coding ones, so all of them are exon\nconst EXON_PARTS = new Set([\n 'exon',\n 'CDS',\n 'five_prime_UTR',\n 'three_prime_UTR',\n 'UTR',\n])\n\nfunction exonsOf(f: FeatureLike, into: { start: number; end: number }[]) {\n const type = ownField(f, 'type')\n if (typeof type === 'string' && EXON_PARTS.has(type)) {\n into.push({\n start: ownField(f, 'start') as number,\n end: ownField(f, 'end') as number,\n })\n }\n const children = ownField(f, 'subfeatures') as FeatureLike[] | undefined\n for (const child of children ?? []) {\n exonsOf(child, into)\n }\n}\n\n// Genes from a track's features: every top-level feature but a whole-sequence\n// record, named by the first of gene_name, name, gene and gene_id it carries,\n// with the exons found anywhere under it merged. A feature with no exons is one exon,\n// its whole span. A BED track gives one feature per transcript, so a name's\n// overlapping features merge, while its copies down the contig stay apart.\n// UCSC's ncbiRefSeq.gff gene records carry their symbol only as gene_id. A\n// feature with none of those names is left out: its raw ID, RefSeq's\n// `id-NC_000913.3:1978503..1979270`, only restates where it is.\nexport function geneModelsFrom(features: FeatureLike[]): GeneModel[] {\n const genes: GeneModel[] = []\n for (const f of features) {\n const name =\n (ownField(f, 'gene_name') as string | undefined) ??\n (ownField(f, 'name') as string | undefined) ??\n (ownField(f, 'gene') as string | undefined) ??\n (ownField(f, 'gene_id') as string | undefined)\n const start = ownField(f, 'start') as number\n const end = ownField(f, 'end') as number\n if (\n !name ||\n !(end > start) ||\n WHOLE_SEQUENCE_TYPES.has(ownField(f, 'type') as string)\n ) {\n continue\n }\n const exons: { start: number; end: number }[] = []\n exonsOf(f, exons)\n genes.push({\n name,\n refName: ownField(f, 'refName') as string,\n start,\n end,\n strand: (ownField(f, 'strand') as number | undefined) ?? 0,\n exons: exons.length ? mergedIntervals(exons) : [{ start, end }],\n })\n }\n return mergeOverlappingByName(genes)\n}\n", "const host = JBrowseExports[\"tss-react/mui\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"tss-react/mui\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport const cx = /* @__PURE__ */ read(\"cx\")\nexport const keyframes = /* @__PURE__ */ read(\"keyframes\")\nexport const makeStyles = /* @__PURE__ */ read(\"makeStyles\")\nexport default host && host.__esModule ? host.default : host"],
5
5
  "mappings": "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",
6
6
  "names": ["isStringArray", "value", "item", "trackLanes", "track", "lanes", "getConfAssemblyNamesOrNone", "walkIndexed", "adapterConfig", "snapshotNamesFile", "cutsByHaplotype", "configHaplotypes", "defaultHaplotypes", "graphReferenceAssembly", "trackAdapterSnapshot", "toTrackConfigEntry", "offReferenceProblem", "referenceAssembly", "assemblyName", "ownField", "f", "name", "namedTrack", "tracks", "named", "t", "trackLabel", "REPEAT_ADAPTER_TYPES", "REPEAT_TRACK_HINT", "pickRepeatTrack", "tracks", "named", "chosen", "namedTrack", "t", "trackLabel", "PACKED_NAME", "packedName", "f", "name", "ownField", "pair", "i", "field", "top", "MOTIF_FIELDS", "PERIOD_FIELDS", "NAME_FIELDS", "first", "names", "value", "one", "IUPAC", "repeatUnitOf", "period", "motif", "numbers", "n", "strings", "text", "TANDEM_REPEAT", "tandemAlleleBp", "alts", "rn", "rus", "rul", "ruc", "rb", "k", "alt", "bp", "known", "j", "unitLength", "count", "runBp", "genotyped", "gt", "alleleBp", "referenceBp", "phased", "index", "callsOf", "samples", "called", "sample", "fields", "reads", "lengths", "calls", "spanOf", "tandem", "start", "end", "svlen", "repeatArraysFrom", "features", "arrays", "unit", "refName", "stated", "a", "b", "mergedIntervals", "intervals", "out", "iv", "a", "b", "last", "mergeOverlappingByName", "genes", "out", "open", "g", "a", "b", "key", "last", "mergedIntervals", "gene", "GENE_ADAPTER_TYPES", "GENE_TRACK_HINT", "BED_ADAPTER_TYPES", "pickGeneTrack", "tracks", "named", "chosen", "namedTrack", "candidates", "t", "REPEAT_TRACK_HINT", "trackLabel", "TE_TRACK_HINT", "annotationNoun", "track", "laneFilters", "view", "trackId", "lane", "readConfObject", "WHOLE_SEQUENCE_TYPES", "EXON_PARTS", "exonsOf", "f", "into", "type", "ownField", "children", "child", "geneModelsFrom", "features", "genes", "name", "start", "end", "exons", "mergedIntervals", "mergeOverlappingByName", "host", "read", "name", "makeStyles", "read", "mui_default", "host"]
@@ -1,2 +1,2 @@
1
- import{l as b,m as $,n as S,p as E,q as x,r as T}from"./chunk-JTOW3TOE.js";function A(e){let{refName:n,start:t,end:r}=e??{};return typeof n=="string"&&Number.isFinite(t)&&Number.isFinite(r)&&t<r?{refName:n,start:t,end:r}:void 0}function D(e){let n=Number(e);return e!=="auto"&&Number.isFinite(n)?n:"auto"}var w=e=>e.toLocaleString("en-US"),v=({refName:e,start:n,end:t})=>`${e}:${w(n+1)}-${w(t)}`,L=e=>`Forms of ${v(e)}: `;var C={deletion:{svType:"DEL",type:"deletion",alt:"<DEL>"},insertion:{svType:"INS",type:"insertion",alt:"<INS>"},duplication:{svType:"DUP",type:"tandem_duplication",alt:"<DUP:TANDEM>"},replacement:{svType:"CPX",type:"complex_substitution",alt:"<CPX>"},inversion:{svType:"INV",type:"inversion",alt:"<INV>",consequence:"inversion"},shift:{svType:"CPX",type:"complex_structural_alteration",alt:"<CPX>",consequence:"shift"},net:{svType:"CPX",type:"complex_structural_alteration",alt:"<CPX>",consequence:"net"}},_=e=>e.lopsided??(e.delta<0?"deletion":"insertion"),P=e=>C[e.kind].consequence??(_(e)==="deletion"?"loss":"gain"),f=e=>`F${e+1}`,O="other",l=8;function F(e,n){let t=100*e/n;return t>0&&t<1?"<1%":`${Math.round(t)}%`}var d=({forms:e},n)=>e.length>n+1?Math.max(0,n):e.length,m=e=>e.reduce((n,t)=>n+t.members.length,0);function U(e,n=l){let t=d(e,n),r=e.forms.slice(t);return[...e.forms.slice(0,t).map((s,a)=>({name:f(a),label:`${F(s.members.length,e.placed)} \xB7 ${T(s,e)}`,haplotypes:s.members.length,forms:1})),...r.length>0?[{name:O,label:`other forms \xB7 ${F(m(r),e.placed)}`,haplotypes:m(r),forms:r.length}]:[]]}var N=5;function k(e){let n=e.slice(0,N).join(", "),t=e.length-N;return t>0?`${n} and ${t} more`:n}var u=e=>`${e} haplotype${e===1?"":"s"}`;function j(e,n=l){let{abridged:t,unplaced:r,forms:s}=e,a=d(e,n),i=s.slice(a);return[...i.length>0?[`${i.length} smaller forms, ${u(m(i))}, share the empty "other forms" row; maxForms sets how many forms get a row of their own`]:[],...t.length>0?[`${u(t.length)} kept an abridged walk past the forms cut's step budget, which shows as a net change over its span: ${k(t)}`]:[],...r.length>0?[`${u(r.length)} ${r.length===1?"has":"have"} no walk over the pinned window, so no form: ${k(r)}`]:[]]}function V(e,n=l){return Object.fromEntries(e.forms.slice(0,d(e,n)).map((t,r)=>[f(r),"0"]))}function q({copied:e,refStart:n,refEnd:t}){let[r,s]=e??[n,t];return{start:r,end:Math.max(s,r+1)}}var R=(e,n)=>e===n?"1":e===$||e===S?".":"0";function K(e,n=l){let{sites:t,forms:r,placed:s}=e,a=d(e,n);return t.flatMap((i,g)=>i.edge?[]:i.states.flatMap(c=>{if(c.key===b)return[];let h=r.map(o=>x(e,o,g)),y=Object.fromEntries(h.slice(0,a).map((o,p)=>[f(p),R(o,c.key)])),M=m(r.filter((o,p)=>h[p]===c.key));return Object.values(y).includes("1")?c.marks.map((o,p)=>({id:`${g}:${c.key}:${p}`,...q(o),name:E(o),description:`${M} of ${u(s)}`,...C[o.kind],consequence:P(o),mark:o,genotypes:y})):[]}))}export{A as a,D as b,v as c,L as d,l as e,U as f,j as g,V as h,K as i};
2
- //# sourceMappingURL=chunk-5X3OZSDO.js.map
1
+ import{l as b,m as $,n as S,p as E,q as x,r as T}from"./chunk-EENENDGZ.js";function A(e){let{refName:n,start:t,end:r}=e??{};return typeof n=="string"&&Number.isFinite(t)&&Number.isFinite(r)&&t<r?{refName:n,start:t,end:r}:void 0}function D(e){let n=Number(e);return e!=="auto"&&Number.isFinite(n)?n:"auto"}var w=e=>e.toLocaleString("en-US"),v=({refName:e,start:n,end:t})=>`${e}:${w(n+1)}-${w(t)}`,L=e=>`Forms of ${v(e)}: `;var C={deletion:{svType:"DEL",type:"deletion",alt:"<DEL>"},insertion:{svType:"INS",type:"insertion",alt:"<INS>"},duplication:{svType:"DUP",type:"tandem_duplication",alt:"<DUP:TANDEM>"},replacement:{svType:"CPX",type:"complex_substitution",alt:"<CPX>"},inversion:{svType:"INV",type:"inversion",alt:"<INV>",consequence:"inversion"},shift:{svType:"CPX",type:"complex_structural_alteration",alt:"<CPX>",consequence:"shift"},net:{svType:"CPX",type:"complex_structural_alteration",alt:"<CPX>",consequence:"net"}},_=e=>e.lopsided??(e.delta<0?"deletion":"insertion"),P=e=>C[e.kind].consequence??(_(e)==="deletion"?"loss":"gain"),f=e=>`F${e+1}`,O="other",l=8;function F(e,n){let t=100*e/n;return t>0&&t<1?"<1%":`${Math.round(t)}%`}var d=({forms:e},n)=>e.length>n+1?Math.max(0,n):e.length,m=e=>e.reduce((n,t)=>n+t.members.length,0);function U(e,n=l){let t=d(e,n),r=e.forms.slice(t);return[...e.forms.slice(0,t).map((s,a)=>({name:f(a),label:`${F(s.members.length,e.placed)} \xB7 ${T(s,e)}`,haplotypes:s.members.length,forms:1})),...r.length>0?[{name:O,label:`other forms \xB7 ${F(m(r),e.placed)}`,haplotypes:m(r),forms:r.length}]:[]]}var N=5;function k(e){let n=e.slice(0,N).join(", "),t=e.length-N;return t>0?`${n} and ${t} more`:n}var u=e=>`${e} haplotype${e===1?"":"s"}`;function j(e,n=l){let{abridged:t,unplaced:r,forms:s}=e,a=d(e,n),i=s.slice(a);return[...i.length>0?[`${i.length} smaller forms, ${u(m(i))}, share the empty "other forms" row; maxForms sets how many forms get a row of their own`]:[],...t.length>0?[`${u(t.length)} kept an abridged walk past the forms cut's step budget, which shows as a net change over its span: ${k(t)}`]:[],...r.length>0?[`${u(r.length)} ${r.length===1?"has":"have"} no walk over the pinned window, so no form: ${k(r)}`]:[]]}function V(e,n=l){return Object.fromEntries(e.forms.slice(0,d(e,n)).map((t,r)=>[f(r),"0"]))}function q({copied:e,refStart:n,refEnd:t}){let[r,s]=e??[n,t];return{start:r,end:Math.max(s,r+1)}}var R=(e,n)=>e===n?"1":e===$||e===S?".":"0";function K(e,n=l){let{sites:t,forms:r,placed:s}=e,a=d(e,n);return t.flatMap((i,g)=>i.edge?[]:i.states.flatMap(c=>{if(c.key===b)return[];let h=r.map(o=>x(e,o,g)),y=Object.fromEntries(h.slice(0,a).map((o,p)=>[f(p),R(o,c.key)])),M=m(r.filter((o,p)=>h[p]===c.key));return Object.values(y).includes("1")?c.marks.map((o,p)=>({id:`${g}:${c.key}:${p}`,...q(o),name:E(o),description:`${M} of ${u(s)}`,...C[o.kind],consequence:P(o),mark:o,genotypes:y})):[]}))}export{A as a,D as b,v as c,L as d,l as e,U as f,j as g,V as h,K as i};
2
+ //# sourceMappingURL=chunk-OHQ3WIPI.js.map
@@ -1,2 +1,2 @@
1
- import{a as B}from"./chunk-EINURNZ6.js";import{h as b,i as o,k as f,z as m}from"./chunk-JTOW3TOE.js";import{h as u}from"./chunk-OMF5XFKR.js";var O={steps:"walkStepBudget",bytes:"walkByteBudget"},y=64,k=class{constructor(e,t){this.file=e;this.adapter=t;this.reader=new f(e)}async haplotypeNames(e={}){let{haplotypes:t}=await this.reader.header(e);return t.length>0?t:void 0}budgets(){return{stepBudget:this.adapter.getConf("walkStepBudget"),byteBudget:this.adapter.getConf("walkByteBudget"),budgetNames:O}}async subgraph(e,t,{signal:i,haplotypes:d,walkRows:s,expand:r,expandSamples:n}){let g=this.budgets(),p=o(d?.map(a=>u(this.adapter,a)),e),l=s&&p&&(d?.length??0)<=y?p:void 0,c=s&&n?.length&&n.length<=y?o(n.map(a=>u(this.adapter,a)),e):void 0,h=r?.length?a=>r.includes(a):void 0,{graph:w,kept:A,fragments:S,skips:x}=await this.reader.cut(e,t,{...g,stepBudget:s?1/0:g.stepBudget,signal:i,keep:p,...l||c||h?{expand:a=>!!l?.(a)||!!c?.(a)||!!h?.(a)}:{}});return B(w.tables(A,S,x),t,s)}async referenceNodes(e,t,i){let d=[];await m(this.file,e,await this.reader.queryStart(t.start,{...i,refName:e,end:t.end}),t.end,{signal:i.signal,lineCallback:r=>{let n=r.split(" ");n[3]==="ref"&&d.push(n)}});let s=new Set;return b(d).filter(r=>r.refName!==e||r.end<=t.start||r.start>=t.end||s.has(r.id)?!1:(s.add(r.id),!0))}};export{k as a};
2
- //# sourceMappingURL=chunk-VP6AGIRF.js.map
1
+ import{a as B}from"./chunk-SYKOZDP6.js";import{h as b,i as o,k as f,z as m}from"./chunk-EENENDGZ.js";import{h as u}from"./chunk-L372SDUG.js";var O={steps:"walkStepBudget",bytes:"walkByteBudget"},y=64,k=class{constructor(e,t){this.file=e;this.adapter=t;this.reader=new f(e)}async haplotypeNames(e={}){let{haplotypes:t}=await this.reader.header(e);return t.length>0?t:void 0}budgets(){return{stepBudget:this.adapter.getConf("walkStepBudget"),byteBudget:this.adapter.getConf("walkByteBudget"),budgetNames:O}}async subgraph(e,t,{signal:i,haplotypes:d,walkRows:s,expand:r,expandSamples:n}){let g=this.budgets(),p=o(d?.map(a=>u(this.adapter,a)),e),l=s&&p&&(d?.length??0)<=y?p:void 0,c=s&&n?.length&&n.length<=y?o(n.map(a=>u(this.adapter,a)),e):void 0,h=r?.length?a=>r.includes(a):void 0,{graph:w,kept:A,fragments:S,skips:x}=await this.reader.cut(e,t,{...g,stepBudget:s?1/0:g.stepBudget,signal:i,keep:p,...l||c||h?{expand:a=>!!l?.(a)||!!c?.(a)||!!h?.(a)}:{}});return B(w.tables(A,S,x),t,s)}async referenceNodes(e,t,i){let d=[];await m(this.file,e,await this.reader.queryStart(t.start,{...i,refName:e,end:t.end}),t.end,{signal:i.signal,lineCallback:r=>{let n=r.split(" ");n[3]==="ref"&&d.push(n)}});let s=new Set;return b(d).filter(r=>r.refName!==e||r.end<=t.start||r.start>=t.end||s.has(r.id)?!1:(s.add(r.id),!0))}};export{k as a};
2
+ //# sourceMappingURL=chunk-OXU7F4BR.js.map
@@ -1,2 +1,2 @@
1
1
  function o(t){return t===void 0||t==="*"?void 0:t}function s(t){let e=t.split(" ");return{refName:e[0],start:+e[1],end:+e[2],segmentCount:+e[3],pathCount:+e[4],inversion:e[5]==="1",shortestAlleleLength:+e[6],longestAlleleLength:+e[7],segments:e[11],shortestAllele:o(e[12]),longestAllele:o(e[13])}}function u(t,e){return t.key!==void 0||e.key!==void 0?t.key===e.key:t.refName===e.refName&&t.start===e.start&&t.end===e.end}function i(t){return t.key??`${t.refName}:${t.start}-${t.end}`}function b(t){let{shortestAlleleLength:e,longestAlleleLength:n}=t;return e===n?`${n.toLocaleString()} bp`:`${e.toLocaleString()}-${n.toLocaleString()} bp`}var r=2147483647;function a(t){let{pathCount:e,segmentCount:n,inversion:l}=t;return[`${n} segments`,e===r?"more paths than gfatools counts":`up to ${e.toLocaleString()} paths`,...l?["inversion"]:[]].join(", ")}export{s as a,u as b,i as c,b as d,r as e,a as f};
2
- //# sourceMappingURL=chunk-TNEXOJ5F.js.map
2
+ //# sourceMappingURL=chunk-QB5JERW4.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@12.2.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-FX4RDMDN.js"],
3
+ "sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@12.3.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-FX4RDMDN.js"],
4
4
  "sourcesContent": ["// src/bubbles/bubbleLine.ts\nfunction sequence(field) {\n return field === void 0 || field === \"*\" ? void 0 : field;\n}\nfunction parseBubbleLine(line) {\n const cols = line.split(\"\t\");\n return {\n refName: cols[0],\n start: +cols[1],\n end: +cols[2],\n segmentCount: +cols[3],\n pathCount: +cols[4],\n inversion: cols[5] === \"1\",\n shortestAlleleLength: +cols[6],\n longestAlleleLength: +cols[7],\n segments: cols[11],\n shortestAllele: sequence(cols[12]),\n longestAllele: sequence(cols[13])\n };\n}\nfunction sameBubble(a, b) {\n return a.key !== void 0 || b.key !== void 0 ? a.key === b.key : a.refName === b.refName && a.start === b.start && a.end === b.end;\n}\nfunction bubbleKey(b) {\n return b.key ?? `${b.refName}:${b.start}-${b.end}`;\n}\nfunction bubbleLabel(bubble) {\n const { shortestAlleleLength: min, longestAlleleLength: max } = bubble;\n return min === max ? `${max.toLocaleString()} bp` : `${min.toLocaleString()}-${max.toLocaleString()} bp`;\n}\nvar SATURATED_PATH_COUNT = 2147483647;\nfunction bubbleDescription(bubble) {\n const { pathCount, segmentCount, inversion } = bubble;\n return [\n `${segmentCount} segments`,\n pathCount === SATURATED_PATH_COUNT ? \"more paths than gfatools counts\" : `up to ${pathCount.toLocaleString()} paths`,\n ...inversion ? [\"inversion\"] : []\n ].join(\", \");\n}\n\nexport {\n parseBubbleLine,\n sameBubble,\n bubbleKey,\n bubbleLabel,\n SATURATED_PATH_COUNT,\n bubbleDescription\n};\n"],
5
5
  "mappings": "AACA,SAASA,EAASC,EAAO,CACvB,OAAOA,IAAU,QAAUA,IAAU,IAAM,OAASA,CACtD,CACA,SAASC,EAAgBC,EAAM,CAC7B,IAAMC,EAAOD,EAAK,MAAM,GAAG,EAC3B,MAAO,CACL,QAASC,EAAK,CAAC,EACf,MAAO,CAACA,EAAK,CAAC,EACd,IAAK,CAACA,EAAK,CAAC,EACZ,aAAc,CAACA,EAAK,CAAC,EACrB,UAAW,CAACA,EAAK,CAAC,EAClB,UAAWA,EAAK,CAAC,IAAM,IACvB,qBAAsB,CAACA,EAAK,CAAC,EAC7B,oBAAqB,CAACA,EAAK,CAAC,EAC5B,SAAUA,EAAK,EAAE,EACjB,eAAgBJ,EAASI,EAAK,EAAE,CAAC,EACjC,cAAeJ,EAASI,EAAK,EAAE,CAAC,CAClC,CACF,CACA,SAASC,EAAWC,EAAGC,EAAG,CACxB,OAAOD,EAAE,MAAQ,QAAUC,EAAE,MAAQ,OAASD,EAAE,MAAQC,EAAE,IAAMD,EAAE,UAAYC,EAAE,SAAWD,EAAE,QAAUC,EAAE,OAASD,EAAE,MAAQC,EAAE,GAChI,CACA,SAASC,EAAUD,EAAG,CACpB,OAAOA,EAAE,KAAO,GAAGA,EAAE,OAAO,IAAIA,EAAE,KAAK,IAAIA,EAAE,GAAG,EAClD,CACA,SAASE,EAAYC,EAAQ,CAC3B,GAAM,CAAE,qBAAsBC,EAAK,oBAAqBC,CAAI,EAAIF,EAChE,OAAOC,IAAQC,EAAM,GAAGA,EAAI,eAAe,CAAC,MAAQ,GAAGD,EAAI,eAAe,CAAC,IAAIC,EAAI,eAAe,CAAC,KACrG,CACA,IAAIC,EAAuB,WAC3B,SAASC,EAAkBJ,EAAQ,CACjC,GAAM,CAAE,UAAAK,EAAW,aAAAC,EAAc,UAAAC,CAAU,EAAIP,EAC/C,MAAO,CACL,GAAGM,CAAY,YACfD,IAAcF,EAAuB,kCAAoC,SAASE,EAAU,eAAe,CAAC,SAC5G,GAAGE,EAAY,CAAC,WAAW,EAAI,CAAC,CAClC,EAAE,KAAK,IAAI,CACb",
6
6
  "names": ["sequence", "field", "parseBubbleLine", "line", "cols", "sameBubble", "a", "b", "bubbleKey", "bubbleLabel", "bubble", "min", "max", "SATURATED_PATH_COUNT", "bubbleDescription", "pathCount", "segmentCount", "inversion"]
@@ -0,0 +1,2 @@
1
+ import{l as o}from"./chunk-3HS6N7WB.js";function u(a,r,e){return e?{...a,walkRowRuns:o(a,r)}:a}export{u as a};
2
+ //# sourceMappingURL=chunk-SYKOZDP6.js.map
@@ -1,4 +1,4 @@
1
- import{s as Ve}from"./chunk-M2D7NUOY.js";import{b as ze}from"./chunk-JTOW3TOE.js";import{a as He}from"./chunk-OMF5XFKR.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:
1
+ import{s as Ve}from"./chunk-M2D7NUOY.js";import{b as ze}from"./chunk-EENENDGZ.js";import{a as He}from"./chunk-L372SDUG.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)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-YMK7HFJV.js.map
4
+ //# sourceMappingURL=chunk-WANYNRGU.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-ZWRAQSXC.js";import{a as Bt,g as Xt}from"./chunk-MNFL7BAC.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&&lt){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-EKIQ3ATV.js.map
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-DKQFTMWL.js";import{a as Bt,g as Xt}from"./chunk-HICKAMKK.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&&lt){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-YS3R3J2I.js.map