@sjcrh/proteinpaint-client 2.63.0 → 2.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/{2dmaf-70c0b6bb.js → 2dmaf-0cabb4a4.js} +1 -1
- package/dist/{ColorScale-b44d51ef.js → ColorScale-9800a609.js} +1 -1
- package/dist/{DEanalysis-b86d0874.js → DEanalysis-567989ff.js} +1 -1
- package/dist/{Disco-16cd51c0.js → Disco-5d1404ce.js} +1 -1
- package/dist/{Disco.UI-a38a12e6.js → Disco.UI-54228bb6.js} +1 -1
- package/dist/{DragControls-0c173a20.js → DragControls-a05737c2.js} +1 -1
- package/dist/{DziViewer-5c2d68e7.js → DziViewer-3f466d90.js} +2 -2
- package/dist/{FilterRxComp-0e75dd8d.js → FilterRxComp-fc769f34.js} +1 -1
- package/dist/{FilterStateless-ad3df967.js → FilterStateless-8f30f856.js} +1 -1
- package/dist/{HicApp-bcf8330c.js → HicApp-aac413df.js} +1 -1
- package/dist/{OrbitControls-c33cf781.js → OrbitControls-8b7f91ca.js} +1 -1
- package/dist/app-59194db0.js +1 -0
- package/dist/{app-f91922b4.js → app-71453429.js} +1 -1
- package/dist/{app-bfce9bf5.js → app-fb676934.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{bam-95f36008.js → bam-e7f6baea.js} +1 -1
- package/dist/{barchart-e2af00a8.js → barchart-ef4874c8.js} +1 -1
- package/dist/{barchart.events-272fd122.js → barchart.events-e24facf7.js} +1 -1
- package/dist/{bars.renderer-f0e5af5a.js → bars.renderer-c46d3f44.js} +1 -1
- package/dist/{block-ec76524e.js → block-4f585abe.js} +1 -1
- package/dist/block.lazyload-6f83d057.js +1 -0
- package/dist/{block.legend-f8cad7e4.js → block.legend-cec87c6f.js} +1 -1
- package/dist/{block.mds-20655637.js → block.mds-f5a11c42.js} +1 -1
- package/dist/{block.mds.cnv-5feb86a0.js → block.mds.cnv-25423c1e.js} +1 -1
- package/dist/{block.mds.expressionrank-c7043f35.js → block.mds.expressionrank-fc1996d5.js} +1 -1
- package/dist/{block.mds.expressionstat-4bf457f3.js → block.mds.expressionstat-45b6bf47.js} +1 -1
- package/dist/{block.mds.geneboxplot-132e5fe6.js → block.mds.geneboxplot-037df46d.js} +1 -1
- package/dist/{block.mds.junction-1f9810df.js → block.mds.junction-00161de6.js} +1 -1
- package/dist/{block.mds.svcnv-094c416f.js → block.mds.svcnv-0c257af4.js} +1 -1
- package/dist/{block.mds.svcnv.share-bb976e02.js → block.mds.svcnv.share-c0b9dfad.js} +1 -1
- package/dist/{block.mds2-7045e32c.js → block.mds2-9009f8d8.js} +1 -1
- package/dist/{block.svg-d8d76ba7.js → block.svg-86bbfcb0.js} +1 -1
- package/dist/{block.tk.aicheck-317d04bd.js → block.tk.aicheck-a5697794.js} +1 -1
- package/dist/{block.tk.ase-d1577ec1.js → block.tk.ase-ad1be47c.js} +1 -1
- package/dist/{block.tk.bam-3cdc13a0.js → block.tk.bam-14339d16.js} +1 -1
- package/dist/{block.tk.bedgraphdot-5304e06c.js → block.tk.bedgraphdot-efe19e56.js} +1 -1
- package/dist/{block.tk.bigwig.ui-0c96dce5.js → block.tk.bigwig.ui-a92f286b.js} +1 -1
- package/dist/{block.tk.hicstraw-39d89269.js → block.tk.hicstraw-57fbbe61.js} +1 -1
- package/dist/{block.tk.junction-b45b3a95.js → block.tk.junction-64c39cd5.js} +1 -1
- package/dist/{block.tk.junction.textmatrixui-6ec019e1.js → block.tk.junction.textmatrixui-09e5e02f.js} +1 -1
- package/dist/{block.tk.ld-5c54e58b.js → block.tk.ld-f681d099.js} +1 -1
- package/dist/{block.tk.menu-30a2c3a5.js → block.tk.menu-2563364c.js} +1 -1
- package/dist/{block.tk.pgv-7ff2dfaf.js → block.tk.pgv-9dfc00c0.js} +1 -1
- package/dist/{boxplot-7de25274.js → boxplot-a2e1ace0.js} +1 -1
- package/dist/brainImaging-21701238.js +1 -0
- package/dist/{brush-db0ed33a.js → brush-bb4566a3.js} +1 -1
- package/dist/{categorical-bc309399.js → categorical-a00f4ffc.js} +1 -1
- package/dist/{condition-f0eb2343.js → condition-2034db37.js} +1 -1
- package/dist/{controls-8d4972c8.js → controls-0467d2ec.js} +1 -1
- package/dist/{controls.btns-bad9e4cf.js → controls.btns-ad7b28a2.js} +1 -1
- package/dist/{controls.config-e0f394cb.js → controls.config-6cf816fb.js} +1 -1
- package/dist/{controls.divide-d8ac5a9b.js → controls.divide-3c0d52d7.js} +1 -1
- package/dist/{controls.overlay-3ac8773d.js → controls.overlay-3a55c2ec.js} +1 -1
- package/dist/{controls.term1-008f4be4.js → controls.term1-59f4cd60.js} +1 -1
- package/dist/cuminc-8d21132b.js +1 -0
- package/dist/{customdata.inputui-58cd9b32.js → customdata.inputui-40ba6d7f.js} +1 -1
- package/dist/{dataDownload-91da6dd6.js → dataDownload-bfa92dad.js} +1 -1
- package/dist/{databrowser.ui-c50862e4.js → databrowser.ui-4799f04d.js} +1 -1
- package/dist/{density-7c3f91eb.js → density-4c2b53f6.js} +1 -1
- package/dist/{dictionary-48a38837.js → dictionary-89e860ee.js} +1 -1
- package/dist/{drag-c354e2c6.js → drag-88d451b4.js} +1 -1
- package/dist/{e2pca-3bba91fa.js → e2pca-8a3f2566.js} +1 -1
- package/dist/{ep-144d8973.js → ep-5399c5cc.js} +1 -1
- package/dist/{fusion.parse-ae1253f4.js → fusion.parse-fc25e5bd.js} +1 -1
- package/dist/{geneExpClustering-96d09008.js → geneExpClustering-a916ebda.js} +1 -1
- package/dist/{geneExpression-d6494fd3.js → geneExpression-501e95c0.js} +1 -1
- package/dist/{geneExpression-9ca2da4f.js → geneExpression-9047481a.js} +1 -1
- package/dist/{geneExpression-be9b5da2.js → geneExpression-da4b50f0.js} +1 -1
- package/dist/{geneORA-85850143.js → geneORA-ffb2497e.js} +1 -1
- package/dist/{geneVariant-3df05e0c.js → geneVariant-7ab521d6.js} +1 -1
- package/dist/{geneVariant-3d674865.js → geneVariant-d79431a2.js} +1 -1
- package/dist/{genefusion.ui-3e2a3a73.js → genefusion.ui-3ce190c7.js} +1 -1
- package/dist/{geneset-3b761b2c.js → geneset-3522bcda.js} +1 -1
- package/dist/{genomeBrowser-2105a98f.js → genomeBrowser-9b72eb22.js} +1 -1
- package/dist/{genomeBrowser.controls-f9b9bf42.js → genomeBrowser.controls-bef8bf99.js} +1 -1
- package/dist/{groupsetting-4901d033.js → groupsetting-574ad150.js} +1 -1
- package/dist/{hierCluster-a7ff7f5a.js → hierCluster-3b14b2b3.js} +1 -1
- package/dist/{hierCluster.config-3d124abf.js → hierCluster.config-f8686a30.js} +1 -1
- package/dist/{hierCluster.interactivity-3463cc0b.js → hierCluster.interactivity-3b5f1e81.js} +1 -1
- package/dist/{hierCluster.renderers-668d0075.js → hierCluster.renderers-9f9a7cad.js} +1 -1
- package/dist/{html.legend-3e428f9e.js → html.legend-ef8066dd.js} +1 -1
- package/dist/{imagePlot-6d89200c.js → imagePlot-095b9a92.js} +1 -1
- package/dist/{lasso-393c1570.js → lasso-ef63631b.js} +1 -1
- package/dist/{launch.adhoc-9c59874e.js → launch.adhoc-1b356f97.js} +1 -1
- package/dist/{legacyDataset-26ead9cc.js → legacyDataset-056e9d4c.js} +1 -1
- package/dist/{log-4d74231e.js → log-ca1e2a74.js} +1 -1
- package/dist/{lollipop-59f65024.js → lollipop-6ad9ec3c.js} +1 -1
- package/dist/{maf-72e5b7da.js → maf-dfada1c8.js} +1 -1
- package/dist/{maftimeline-ed8aaae8.js → maftimeline-1b715a01.js} +1 -1
- package/dist/{matrix-3d09a31f.js → matrix-3fae58f8.js} +1 -1
- package/dist/matrix.cells-3620eb3a.js +1 -0
- package/dist/{matrix.cluster-acdfc6a7.js → matrix.cluster-15b8a865.js} +1 -1
- package/dist/{matrix.config-cd01ebbd.js → matrix.config-8247bea5.js} +1 -1
- package/dist/{matrix.controls-86eb8d5c.js → matrix.controls-dea65894.js} +1 -1
- package/dist/{matrix.data-e2d7ac16.js → matrix.data-121a1a8c.js} +1 -1
- package/dist/{matrix.dom-e5f91cc0.js → matrix.dom-83c5fa39.js} +1 -1
- package/dist/{matrix.groups-f1969b5c.js → matrix.groups-2e1202ef.js} +1 -1
- package/dist/{matrix.interactivity-92bc8332.js → matrix.interactivity-2b076155.js} +1 -1
- package/dist/{matrix.layout-29a8f334.js → matrix.layout-8dc54c05.js} +1 -1
- package/dist/{matrix.legend-8c28039e.js → matrix.legend-e0078739.js} +1 -1
- package/dist/matrix.renderers-0c8eddc9.js +1 -0
- package/dist/{matrix.serieses-e079f04a.js → matrix.serieses-2898da6b.js} +1 -1
- package/dist/{matrix.sort-e1f83454.js → matrix.sort-249d4a35.js} +1 -1
- package/dist/{matrix.sorterUi-2025f39d.js → matrix.sorterUi-d26208c8.js} +1 -1
- package/dist/{mavb-37fffd68.js → mavb-9a6fa2e9.js} +1 -1
- package/dist/{mds.fimo-68f0eaf5.js → mds.fimo-ce97371c.js} +1 -1
- package/dist/{mds.samplescatterplot-362f3591.js → mds.samplescatterplot-a54b9e93.js} +1 -1
- package/dist/{mds.survivalplot-f5bda05a.js → mds.survivalplot-c5093f73.js} +1 -1
- package/dist/{mdsjsonform-7f0b6cc7.js → mdsjsonform-09b4e1cb.js} +1 -1
- package/dist/metaboliteIntensity-eeb5ad12.js +1 -0
- package/dist/niceNumLabels-ddb76164.js +1 -0
- package/dist/{nodrag-777a34a5.js → nodrag-bed2488c.js} +1 -1
- package/dist/{numeric-2eb8c25b.js → numeric-d5536b1c.js} +1 -1
- package/dist/numeric.binary-d67da945.js +1 -0
- package/dist/numeric.continuous-9a0c88bc.js +1 -0
- package/dist/numeric.discrete-921f7097.js +1 -0
- package/dist/numeric.spline-649308d5.js +1 -0
- package/dist/{numeric.toggle-5316211b.js → numeric.toggle-52789fd2.js} +1 -1
- package/dist/{oncomatrix-cd9fa01b.js → oncomatrix-6950c48c.js} +1 -1
- package/dist/{parseData-1bfa9946.js → parseData-480d1ff3.js} +1 -1
- package/dist/{plot.2dvaf-1ed153c1.js → plot.2dvaf-1ecc4bbc.js} +1 -1
- package/dist/plot.app-c841507a.js +1 -0
- package/dist/{plot.barplot-61742e94.js → plot.barplot-24140b0f.js} +1 -1
- package/dist/{plot.boxplot-fe966ac3.js → plot.boxplot-87fe8ab2.js} +1 -1
- package/dist/{plot.brainImaging-d2c23bb7.js → plot.brainImaging-325ebded.js} +1 -1
- package/dist/{plot.disco-70d493f4.js → plot.disco-621d1b8e.js} +1 -1
- package/dist/{plot.dzi-14e6fdc4.js → plot.dzi-3a7e478e.js} +1 -1
- package/dist/{plot.ssgq-9d364d41.js → plot.ssgq-1949c207.js} +1 -1
- package/dist/{plot.vaf2cov-4d28015b.js → plot.vaf2cov-d03c6409.js} +1 -1
- package/dist/{profileBarchart-c104f8e2.js → profileBarchart-11755d7c.js} +1 -1
- package/dist/{profileHome-a555583d.js → profileHome-9c5e266b.js} +1 -1
- package/dist/{profilePlot-5ce5b6a0.js → profilePlot-8ee3034a.js} +1 -1
- package/dist/{profilePolar-610213d4.js → profilePolar-9fe70c32.js} +1 -1
- package/dist/{profileRadar-fddb18f7.js → profileRadar-0e744181.js} +1 -1
- package/dist/{profileRadarFacility-2c2db1dd.js → profileRadarFacility-102544c5.js} +1 -1
- package/dist/{recover-a08c8d01.js → recover-b1ec4fed.js} +1 -1
- package/dist/{regression.inputs-5718cf72.js → regression.inputs-ad548745.js} +1 -1
- package/dist/{regression.inputs.values.table-d587c1cf.js → regression.inputs.values.table-1618447a.js} +1 -1
- package/dist/{regression.results-748024be.js → regression.results-25008028.js} +1 -1
- package/dist/{renderPvalueTable-c435aefd.js → renderPvalueTable-46056189.js} +1 -1
- package/dist/sampleScatter-47dd82cb.js +1 -0
- package/dist/{sampleScatter.interactivity-e9c30652.js → sampleScatter.interactivity-cfa3451d.js} +1 -1
- package/dist/{sampleScatter.rendererThree-3e6c032e.js → sampleScatter.rendererThree-c5321d24.js} +2 -2
- package/dist/{sampleView-d6a91293.js → sampleView-30b97c7d.js} +1 -1
- package/dist/{samplelst-821ec148.js → samplelst-2bdc1b9d.js} +1 -1
- package/dist/{samplematrix-7aa0a780.js → samplematrix-4f0ec523.js} +1 -1
- package/dist/{scatter-2e2c76f4.js → scatter-8a337eeb.js} +1 -1
- package/dist/{selectGenomeWithTklst-51cd21a4.js → selectGenomeWithTklst-895106fb.js} +1 -1
- package/dist/{singleCellPlot-c7347a27.js → singleCellPlot-360eaec6.js} +1 -1
- package/dist/{singlecell-a668bb17.js → singlecell-29c1cbb1.js} +1 -1
- package/dist/{singlecell-7c851ef8.js → singlecell-75f8af89.js} +1 -1
- package/dist/{snplocus-fe6f4ba1.js → snplocus-0cafa73c.js} +1 -1
- package/dist/{snplst-751cea95.js → snplst-2284d5ce.js} +1 -1
- package/dist/{spliceevent.a53ss.diagram-b157f95d.js → spliceevent.a53ss.diagram-44ccabf9.js} +1 -1
- package/dist/{spliceevent.exonskip.diagram-071a3467.js → spliceevent.exonskip.diagram-c8d1bdf0.js} +1 -1
- package/dist/spliceevent.exonskip.getdefault-9fe16119.js +1 -0
- package/dist/{spliceevent.noeventdiagram-1c731f35.js → spliceevent.noeventdiagram-5e244090.js} +1 -1
- package/dist/{spliceevent.phrase-7a3bfb00.js → spliceevent.phrase-186eb050.js} +1 -1
- package/dist/{stattable-a7713026.js → stattable-886f7dad.js} +1 -1
- package/dist/{style.gdc-40ec2784.js → style.gdc-4ac9b96b.js} +1 -1
- package/dist/{summary-592d8f81.js → summary-ee2045a5.js} +1 -1
- package/dist/{sunburst-452df940.js → sunburst-bbff8818.js} +1 -1
- package/dist/survival-04e279f8.js +1 -0
- package/dist/{survival-450b6df4.js → survival-d7bd3c6b.js} +1 -1
- package/dist/{svg.download-56529955.js → svg.download-54c99186.js} +1 -1
- package/dist/{svg.legend-c82b153f.js → svg.legend-28652faa.js} +1 -1
- package/dist/{svgraph-3c5cd8d2.js → svgraph-a12d89da.js} +1 -1
- package/dist/{svmr-3dd531ef.js → svmr-248055c8.js} +1 -1
- package/dist/{table-d6c411fd.js → table-1dae543a.js} +1 -1
- package/dist/{table-bf604c50.js → table-b4a61573.js} +1 -1
- package/dist/{termInfo-96285f4a.js → termInfo-4c759483.js} +1 -1
- package/dist/{termsetting-9a7511e6.js → termsetting-636d2271.js} +1 -1
- package/dist/{tk-6a8e5bb0.js → tk-741d4674.js} +1 -1
- package/dist/{tp.ui-221efed6.js → tp.ui-23151bb1.js} +1 -1
- package/dist/{tvs.density-9fdae0cc.js → tvs.density-9fe0c7fd.js} +1 -1
- package/dist/{tvs.geneVariant-149e25b7.js → tvs.geneVariant-1b179327.js} +1 -1
- package/dist/tvs.numeric-b4cfc975.js +1 -0
- package/dist/{tvs.samplelst-a38e9c2b.js → tvs.samplelst-681358bc.js} +1 -1
- package/dist/{uiUtils-a6de7f14.js → uiUtils-74700a01.js} +1 -1
- package/dist/{variantBrowser-05375469.js → variantBrowser-910b4bcd.js} +1 -1
- package/dist/{vcf-58904308.js → vcf-16ba1e06.js} +1 -1
- package/dist/{violin-c1b78717.js → violin-a41b2e2b.js} +1 -1
- package/dist/{violin.interactivity-534d6993.js → violin.interactivity-bcf0ccc2.js} +1 -1
- package/dist/{violin.renderer-16540fb8.js → violin.renderer-149310eb.js} +1 -1
- package/dist/{violinRenderer-688abcb2.js → violinRenderer-71c9f3ab.js} +1 -1
- package/dist/{viridis-d3cf2713.js → viridis-81de7bcd.js} +1 -1
- package/dist/{y-2d48b9e4.js → y-76c7da8c.js} +1 -1
- package/dist/{zoom-2d4ede33.js → zoom-a40839cf.js} +1 -1
- package/package.json +7 -7
- package/dist/app-de19f41c.js +0 -1
- package/dist/block.lazyload-ebd949e4.js +0 -1
- package/dist/brainImaging-007edaa3.js +0 -1
- package/dist/cuminc-72257faf.js +0 -1
- package/dist/matrix.cells-a5157233.js +0 -1
- package/dist/matrix.renderers-3b8dfd04.js +0 -1
- package/dist/metaboliteIntensity-512257f3.js +0 -1
- package/dist/niceNumLabels-8fdc6507.js +0 -1
- package/dist/numeric.binary-0a3b17d2.js +0 -1
- package/dist/numeric.continuous-f77038de.js +0 -1
- package/dist/numeric.discrete-b977e88f.js +0 -1
- package/dist/numeric.spline-d64b1abe.js +0 -1
- package/dist/plot.app-91a1d78d.js +0 -1
- package/dist/sampleScatter-031f47de.js +0 -1
- package/dist/spliceevent.exonskip.getdefault-93feb627.js +0 -1
- package/dist/survival-6a4c4f12.js +0 -1
- package/dist/tvs.numeric-f9ce58bc.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t===void 0)t={};var n=t.insertAt;if(!e||typeof document==="undefined"){return}var o=document.head||document.getElementsByTagName("head")[0];var i=document.createElement("style");i.type="text/css";if(n==="top"){if(o.firstChild){o.insertBefore(i,o.firstChild)}else{o.appendChild(i)}}else{o.appendChild(i)}if(i.styleSheet){i.styleSheet.cssText=e}else{i.appendChild(document.createTextNode(e))}}var t='\n/**\n * Render the `main` element consistently in IE.\n */\n\n.sja_root_holder main, .sja_menu_div main, .sja_pane main {\n display: block;\n}\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Firefox, and Safari.\n */\n\n.sja_root_holder h1, .sja_menu_div h1, .sja_pane h1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\n.sja_root_holder hr, .sja_menu_div hr, .sja_pane hr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\n.sja_root_holder pre, .sja_menu_div pre, .sja_pane pre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\n.sja_root_holder a, .sja_menu_div a, .sja_pane a {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\n.sja_root_holder abbr[title], .sja_menu_div abbr[title], .sja_pane abbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\n.sja_root_holder b, .sja_menu_div b, .sja_pane b,\n.sja_root_holder strong, .sja_menu_div strong, .sja_pane strong {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\n.sja_root_holder code, .sja_menu_div code, .sja_pane code,\n.sja_root_holder kbd, .sja_menu_div kbd, .sja_pane kbd,\n.sja_root_holder samp, .sja_menu_div samp, .sja_pane samp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\n.sja_root_holder small, .sja_menu_div small, .sja_pane small {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` elements from affecting the line height in\n * all browsers.\n */\n\n.sja_root_holder sub, .sja_menu_div sub, .sja_pane sub,\n.sja_root_holder sup, .sja_menu_div sup, .sja_pane sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\n.sja_root_holder sub, .sja_menu_div sub, .sja_pane sub {\n bottom: -0.25em;\n}\n\n.sja_root_holder sup, .sja_menu_div sup, .sja_pane sup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\n.sja_root_holder img, .sja_menu_div img, .sja_pane img {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder input, .sja_menu_div input, .sja_pane input,\n.sja_root_holder optgroup, .sja_menu_div optgroup, .sja_pane optgroup,\n.sja_root_holder select, .sja_menu_div select, .sja_pane select,\n.sja_root_holder textarea, .sja_menu_div textarea, .sja_pane textarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder input /* 1 */, .sja_menu_div input /* 1 */, .sja_pane input /* 1 */ {\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder select /* 1 */, .sja_menu_div select /* 1 */, .sja_pane select /* 1 */ {\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder [type="button"], .sja_menu_div [type="button"], .sja_pane [type="button"],\n.sja_root_holder [type="reset"], .sja_menu_div [type="reset"], .sja_pane [type="reset"],\n.sja_root_holder [type="submit"], .sja_menu_div [type="submit"], .sja_pane [type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\n.sja_root_holder button::-moz-focus-inner, .sja_menu_div button::-moz-focus-inner, .sja_pane button::-moz-focus-inner,\n.sja_root_holder [type="button"]::-moz-focus-inner, .sja_menu_div [type="button"]::-moz-focus-inner, .sja_pane [type="button"]::-moz-focus-inner,\n.sja_root_holder [type="reset"]::-moz-focus-inner, .sja_menu_div [type="reset"]::-moz-focus-inner, .sja_pane [type="reset"]::-moz-focus-inner,\n.sja_root_holder [type="submit"]::-moz-focus-inner, .sja_menu_div [type="submit"]::-moz-focus-inner, .sja_pane [type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\n.sja_root_holder button:-moz-focusring, .sja_menu_div button:-moz-focusring, .sja_pane button:-moz-focusring,\n.sja_root_holder [type="button"]:-moz-focusring, .sja_menu_div [type="button"]:-moz-focusring, .sja_pane [type="button"]:-moz-focusring,\n.sja_root_holder [type="reset"]:-moz-focusring, .sja_menu_div [type="reset"]:-moz-focusring, .sja_pane [type="reset"]:-moz-focusring,\n.sja_root_holder [type="submit"]:-moz-focusring, .sja_menu_div [type="submit"]:-moz-focusring, .sja_pane [type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\n.sja_root_holder fieldset, .sja_menu_div fieldset, .sja_pane fieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n\n.sja_root_holder legend, .sja_menu_div legend, .sja_pane legend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\n.sja_root_holder progress, .sja_menu_div progress, .sja_pane progress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\n.sja_root_holder textarea, .sja_menu_div textarea, .sja_pane textarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n.sja_root_holder [type="checkbox"], .sja_menu_div [type="checkbox"], .sja_pane [type="checkbox"],\n.sja_root_holder [type="radio"], .sja_menu_div [type="radio"], .sja_pane [type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n.sja_root_holder [type="number"]::-webkit-inner-spin-button, .sja_menu_div [type="number"]::-webkit-inner-spin-button, .sja_pane [type="number"]::-webkit-inner-spin-button,\n.sja_root_holder [type="number"]::-webkit-outer-spin-button, .sja_menu_div [type="number"]::-webkit-outer-spin-button, .sja_pane [type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n.sja_root_holder [type="search"], .sja_menu_div [type="search"], .sja_pane [type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n.sja_root_holder [type="search"]::-webkit-search-decoration, .sja_menu_div [type="search"]::-webkit-search-decoration, .sja_pane [type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n.sja_root_holder ::-webkit-file-upload-button, .sja_menu_div ::-webkit-file-upload-button, .sja_pane ::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\n.sja_root_holder details, .sja_menu_div details, .sja_pane details {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\n.sja_root_holder summary, .sja_menu_div summary, .sja_pane summary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\n.sja_root_holder template, .sja_menu_div template, .sja_pane template {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n.sja_root_holder [hidden], .sja_menu_div [hidden], .sja_pane [hidden] {\n display: none;\n}';e(t);var n="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}";e(n);var o="/*\n see client/generateScopedCss.js on how to generate style-normalize-*.css\n\n also see a TODO comment in client/src/app.js, of dynamically importing\n style-normalize-unscoped.css only if it's known to not conflict in\n the embedder portal\n*/\n/* directly import these in src/app.js so that they will be processed as CSSStyleSheet\n@import './style-normalize-scoped.css';\n@import 'highlight.js/styles/github.css';\n*/\n/*\nhtml {\n height:100%;\n}\nbody {\n min-height:100%;\n}\ntable {\n font-size:1em;\n border-spacing:1px;\n border-collapse:separate;\n}\n*/\n/*\n !!! NOTE !!!\n FireFox does not support the @scope (selector) syntax\n that can enclose all affected rules inside a nested block,\n so for now, will need to prepend the .sja_root_holder scope for each selector\n*/\n/***************************************\nCSS properties that are not covered \nby normalize.css are covered here\n\n!!! make sure to scope to sja_root_holder\n****************************************/\n.sja_root_holder h2 {\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n}\n/***************************************\n tag-based styles\n\n prevent embedder styles from overriding\n the styles within pp-controlled divs\n****************************************/\n/* use default browser styles within pp-controlled divs */\n/* using the !important flag:\n- this flag is used to override conflicting styles\n- this flag will override both embedder styling and inline styling\n- it is not necessary to use this flag to prevent embedder styles from overriding pp styles, because specifying styles within pp-specific classes will usually prevent this issue\n- the only time when it is necessary to use this flag is when (1) the conflicting styling also has an !important flag or (2) the conflicting styling is also specified in this same file\n*/\n.sja_root_holder {\n /*background-color: #fff;*/\n}\n.sja_root_holder,\n.sja_menu_div,\n.sja_pane {\n all: initial;\n /* block inheritance for all properties */\n}\n.sja_root_holder table,\n.sja_menu_div table,\n.sja_pane table {\n border-collapse: separate;\n border-spacing: 2px;\n}\n.sja_root_holder svg {\n display: inline-block;\n}\n/*\n override the thicker button border\n that results when a button's \n border-radius: 0 which seems to override\n all associated styles of \n -webkit-appearance: button;\n*/\n.sja_root_holder button,\n.sja_menu_div button,\n.sja_pane button {\n padding: 2px 3px;\n border-width: 1px;\n border-style: solid;\n border-radius: 3px;\n box-shadow: inset 0 0 0 99999px rgba(255, 255, 255, 0.3);\n font-family: Arial;\n color: black;\n background-color: buttonface;\n border-color: buttonborder;\n}\n.sja_root_holder button:disabled,\n.sja_menu_div button:disabled,\n.sja_pane button:disabled {\n background-color: rgba(239, 239, 239, 0.3);\n color: rgba(16, 16, 16, 0.3);\n border-color: rgba(118, 118, 118, 0.3);\n}\n.sja_root_holder button:hover,\n.sja_menu_div button:hover,\n.sja_pane button:hover {\n box-shadow: none;\n}\n.sja_root_holder label,\n.sja_menu_div label,\n.sja_pane label {\n margin-bottom: 0;\n}\n.sja_root_holder a,\n.sja_menu_div a,\n.sja_pane a,\n.linkText {\n color: rgb(0, 0, 238);\n cursor: pointer;\n text-decoration: underline;\n}\n.sja_root_holder input,\n.sja_menu_div input,\n.sja_pane input {\n padding: 1px 3px;\n margin: 2px 5px;\n border: 1px solid #ccc;\n}\n.sja_root_holder select,\n.sja_menu_div select,\n.sja_pane select {\n padding: 1px 3px;\n padding-right: 30px; /* padding between text and arrow */\n background-size: auto;\n background-position: right;\n border: 1px solid #ccc;\n}\n.sja_root_holder textarea,\n.sja_menu_div textarea,\n.sja_pane textarea {\n padding: 2px;\n}\n.sja_root_holder input[type=\"search\"].tree_search {\n -webkit-appearance: searchfield;\n}\n.sja_root_holder ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: 40px;\n}\n.sja_root_holder ul ul {\n list-style-type: circle;\n}\n.sja_root_holder li {\n display: list-item;\n text-align: -webkit-match-parent;\n}\n/*************************\n class-specific styles\n*************************/\n.sja_errorbar {\n position: relative;\n padding: 5px 50px 5px 10px;\n background-color: rgba(200, 0, 0, .1);\n color: rgba(190, 0, 0, .5);\n border: solid 1px rgba(200, 0, 0, .2);\n /*border-width: 1px 0px;*/\n}\n.sja_errorbar>:nth-child(2) {\n position: absolute;\n padding: 5px 10px;\n cursor: default;\n top: 0px;\n right: 10px;\n}\n.sja_inset_a {\n background-color: #ebedeb;\n box-shadow: inset 0px 0px 14px 0px #858585;\n padding: 5px 10px;\n}\n.sja_menu,\n.sja_menu_persist,\n.sja_tooltip {\n position: absolute;\n background-color: white;\n font-family: Arial;\n z-index: 1000;\n}\n/* /client/src/app.js start */\n.sja_menuoption {\n color: black;\n padding: 5px 10px;\n cursor: default;\n background-color: #f2f2f2;\n margin: 1px;\n border-radius: 5px;\n}\n.sja_menuoption_not_interactive {\n padding: 5px 10px;\n cursor: default;\n margin: 1px;\n}\n.sja_sharp_border {\n border-radius: 0px;\n}\n.sja_menuoption:hover {\n background-color: #e6e6e6\n}\n.sja_menuoption:active {\n color: #cc0000;\n background-color: #FCE2E1;\n}\n/* /client/src/app.js end */\n.sja_filter_tag_btn {\n display: inline-block;\n color: black;\n padding: 5px 8px;\n background-color: #cfe2f3;\n cursor: default;\n}\n/* .sja_filter_tag_btn:hover { opacity: 0.8; cursor:default} */\n.sja_filter_tag_btn:active {\n color: #cc0000;\n opacity: 0.6;\n}\n.ts_pill:hover,\n.tvs_pill:hover {\n opacity: 0.8;\n cursor: default\n}\n.sjpp_apply_btn {\n background-color: #d0e0e3;\n border-radius: 13px !important; \n padding: 7px 15px !important;\n border: 0px !important;\n}\n.sjpp_delete_btn,\n.remove_btn {\n background-color: #f4cccc;\n}\n.ts_summary_btn {\n background-color: #d9d2e9;\n}\n/* mostly for table tr */\n.sja_clb {\n padding: 5px 10px;\n cursor: default;\n}\n.sja_clb:hover {\n background: #ffff99;\n}\n.sja_clb:active {\n background: #ffcc99;\n}\n.sja_clb_selected {\n padding: 5px 10px;\n cursor: default;\n background: #FAF0C8;\n border-bottom: solid 2px #E3CA64;\n}\n.sja_clb_selected:hover {\n background: #FCE68B\n}\n.sja_clb_selected:active {\n background: #ffcc99\n}\n/* table tr, gray highlight */\n.sja_clb_gray {\n padding: 5px 10px;\n cursor: default;\n}\n.sja_clb_gray:hover {\n background-color: #f1f1f1;\n}\n.sja_clb_gray:active {\n background-color: #ffffcc;\n}\n.sja_hideable_legend {\n cursor: default;\n}\n.sja_hideable_legend:hover {\n background: #ffff99;\n}\n.sja_legend_more_btn {\n padding: 3px;\n text-align: center;\n font-size: 0.7em;\n opacity: 0.5;\n cursor: default;\n}\n.sja_legend_more_btn:hover {\n text-decoration: underline;\n}\n/* text only */\n.sja_clbtext2 {\n cursor: default;\n text-decoration: none;\n}\n.sja_clbtext2:hover {\n text-decoration: underline;\n}\n.sja_clbtext2:active {\n fill: #CC0000;\n color: #CC0000;\n}\n.sja_clbtext {\n cursor: default;\n color: black;\n fill: black;\n border-bottom: solid 1px transparent;\n}\n.sja_clbtext:hover {\n color: #631318;\n fill: #631318;\n border-color: black;\n}\n.sja_clbtext:active {\n color: #CC0000;\n border-color: #cc0000;\n fill: #cc0000;\n}\n.sja_clbtextbold {\n cursor: default;\n color: black;\n fill: black;\n font-weight: normal;\n}\n.sja_clbtextbold:hover {\n color: #631318;\n fill: #631318;\n font-weight: bold;\n}\n.sja_clbtextbold:active {\n color: #CC0000;\n fill: #cc0000;\n font-weight: bold;\n}\n.sja_opaque6 {\n opacity: .6;\n cursor: default;\n}\n.sja_opaque6:hover {\n opacity: .9;\n}\n.sja_opaque8 {\n opacity: .8;\n cursor: default;\n}\n.sja_opaque8:hover {\n opacity: 1;\n}\n.sja_simpletable tr td {\n border-bottom: solid 1px #ededed;\n}\n.sja_mcdot {\n cursor: default;\n border-radius: 8px;\n padding: 1px 2px;\n margin-right: 1px;\n color: white;\n font-size: .8em;\n}\n.sja_variantpagesnv {\n cursor: default;\n display: inline-block;\n border-radius: 3px;\n padding: 3px 10px;\n margin-right: 2px;\n color: white;\n background-color: #0099FF;\n opacity: .6;\n}\n.sja_variantpagesnv:hover {\n opacity: 1;\n}\n.sja_variantpagesnv:active {\n background-color: #3366FF;\n}\n.sja_selectsample {\n cursor: default;\n display: inline-block;\n border-radius: 2px;\n border: solid 1px #545454;\n padding: 3px 10px;\n margin-right: 2px;\n color: #545454;\n background-color: white;\n font-size: .8em;\n}\n.sja_selectsample:hover {\n background-color: #f1f1f1;\n}\n.sja_selectsample:active {\n background-color: #F2E1E3;\n}\n.sja_pane {\n position: absolute;\n /*border:solid 1px #ccc;\n */\n box-shadow: 0px 2px 4px 1px #999;\n background-color: white;\n}\n.sja_pane>:first-child {\n padding-right: 10px;\n cursor: move;\n background-color: #f0f0f0;\n}\n.sja_pane>:nth-child(2) {\n padding: 0px 10px 10px 10px;\n font-family: Arial;\n}\n.sja_cursor_hmove {\n cursor: ew-resize;\n}\n.sja_svgtext {\n cursor: default;\n fill-opacity: .8\n}\n.sja_svgtext2 {\n cursor: default;\n fill: black;\n}\n.sja_svgtext2:hover {\n fill: #B30000\n}\n.sja_clb5 {\n /* tree button */\n cursor: default;\n display: inline-block;\n border: solid 1px #006600;\n color: #006600;\n background-color: white;\n margin-left: 6px;\n padding: 0px 4px;\n font-size: 80%;\n}\n.sja_clb5:hover {\n background-color: #006600;\n color: white;\n}\n.sja_clb5:active {\n background-color: #009900;\n}\n.sja_clb2 {\n color: black;\n font-family: Courier;\n display: inline-block;\n padding: 1px 5px;\n cursor: default;\n}\n.sja_clb2:hover {\n background-color: #ffff99;\n}\n.sja_clb2:active {\n background-color: #ccff99;\n}\n.sja_clbb {\n /* highlight border */\n border: solid 1px transparent;\n cursor: default;\n}\n.sja_clbb:hover {\n border-color: #ccc;\n}\n.sja_clbbox {\n cursor: default;\n padding: 2px 5px;\n color: white;\n font-size: .7em;\n font-weight: normal;\n}\n.sja_clbbox:hover {\n font-weight: bold;\n}\n.sja_tr {\n cursor: default;\n background-color: #f1f1f1;\n}\n.sja_tr:hover {\n background-color: white;\n}\n.sja_tr:active {\n background-color: #ffffcc;\n}\n.sja_tr2 {\n cursor: default;\n}\n.sja_tr2:hover {\n background-color: #ffffcc;\n}\n.sja_tr2:active {\n background-color: #ffff00;\n}\n.sja_aa_disclabel {\n cursor: default;\n}\n.sja_aa_discnum {\n cursor: default;\n text-rendering: geometricPrecision;\n}\n.sja_aa_skkick:hover {\n stroke: #858585;\n}\n.sja_aa_disckick:hover {\n stroke-opacity: 1;\n}\n.sja_menuoption_y {\n display: inline-block;\n color: black;\n padding: 2px 4px;\n cursor: default;\n background-color: #E6E5C5;\n margin: 2px;\n}\n.sja_menuoption_y:hover {\n background-color: #DEDCA9\n}\n.sja_menuoption_y:active {\n background-color: #FFFF99\n}\n.sja_menuoption_r {\n display: inline-block;\n color: black;\n padding: 2px 4px;\n cursor: default;\n background-color: #EDDDDE;\n margin: 2px;\n}\n.sja_menuoption_r:hover {\n background-color: #E8CFD1\n}\n.sja_menuoption_r:active {\n background-color: #FCD9DD\n}\n.sja_error2 {\n display: inline-block;\n padding: 5px 50px 5px 10px;\n margin: 10px 20px;\n background-color: rgba(200, 0, 0, .5);\n color: white;\n border-radius: 6px;\n}\n.sja_paint {\n position: relative;\n}\n.sja_paint>:first-child {}\n.sja_paint>:nth-child(2) {\n position: absolute;\n padding: 3px 6px;\n cursor: default;\n top: 10px;\n right: 30px;\n font-size: 80%;\n}\n.sja_tree_ul {\n list-style-type: none;\n padding-left: 25px;\n line-height: 1.4;\n}\n.sja_input {\n display: inline-block;\n padding: 2px 6px;\n}\n.sja_bulkcell {\n display: inline-block;\n width: 3px;\n height: 9px;\n margin: 1px 1px 0px 0px;\n}\n.sja_tag {\n display: inline-block;\n margin-left: 10px;\n padding: 1px 3px;\n background-color: #858585;\n color: white;\n font-size: 80%;\n}\n.sja_bgbox {\n cursor: default;\n fill: yellow;\n fill-opacity: 0;\n}\n.sja_bgbox:hover {\n fill-opacity: .2;\n}\n.sja_diseasehm_search_item {\n display: inline-block;\n margin: 3px;\n padding: 2px;\n}\n.sja_pulse {\n animation: pulse .5s alternate infinite;\n}\n@keyframes pulse {\n from {\n opacity: .2;\n }\n to {\n opacity: 1;\n }\n}\n.sja_hm-edittool-table td {\n padding: 0 2px;\n cursor: pointer;\n text-align: center;\n font-size: 14px;\n}\n.sja_hm-edittool-table td:hover {\n opacity: 1;\n font-weight: 600;\n}\n.sja_tinylogo_head {\n display: inline-block;\n background-color: #858585;\n color: white;\n font-size: .6em;\n padding: 1px 3px;\n}\n.sja_tinylogo_body {\n display: inline-block;\n margin-left: 10px;\n background-color: #ededed;\n font-size: .9em;\n color: black;\n padding: 1px 5px;\n}\n.sja_handle_green {\n display: inline-block;\n font-size: .9em;\n padding: 3px 6px;\n background-color: #f0f7f1;\n color: #146E17;\n cursor: default;\n}\n.sja_handle_green:hover {\n background-color: #D5F0D8;\n}\n.sja_handle_green:active {\n background-color: #BAD1BC;\n color: black;\n}\n.sja_handle_red {\n display: inline-block;\n font-size: .9em;\n padding: 3px 6px;\n background-color: #F5EBEC;\n color: #991F1F;\n cursor: default;\n}\n.sja_handle_red:hover {\n background-color: #F2D8DB;\n}\n.sja_handle_red:active {\n background-color: #E3B1B7;\n color: black;\n}\n.sja_btn {\n -webkit-appearance: button;\n -moz-appearance: button;\n appearance: button;\n text-decoration: none;\n color: initial;\n}\n.sja_button {\n display: inline-block;\n background: white;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button:hover {\n opacity: 1;\n}\n.sja_button_open {\n display: inline-block;\n background: #ddd;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button_open:hover {\n opacity: 1;\n}\n.sja_button_fold {\n display: inline-block;\n background: #aaa;\n color: white;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button_fold:hover {\n opacity: 1;\n}\n.sja-termdb-config-row-label {\n padding: 5px;\n text-align: left;\n vertical-align: middle;\n}\n.sjpp-controls-table {\n margin-bottom: 10px;\n}\n.sjpp-controls-table > tr:hover {\n /*font-weight: 600;*/\n text-shadow:0px 0px 0.5px black;\n background-color: rgba(239, 236, 149, 0.389);\n}\n.sja_edit_btn {\n display: inline-block;\n color: black;\n background-color: #f2f2f2;\n border-radius: 5px;\n border: solid 1px #aaa;\n padding: 5px 10px;\n cursor: default;\n margin: 1px;\n font-size: 0.8em;\n margin-left: 20px;\n}\n.sja_edit_btn:hover {\n background-color: #e6e6e6\n}\n.sja_edit_btn:active {\n color: #cc0000;\n background-color: #FCE2E1;\n}\n/* App Drawer style */\n.sjpp-appdrawer-cols {\n font-family: Verdana, Geneva, Tahoma, sans-serif;\n font-weight: 500;\n font-size: 17px;\n text-align: left;\n color: #324870;\n margin: 10px 10px 0px 10px;\n}\n.sjpp-track, .sjpp-track li {\n display: grid !important;\n grid-template-columns: 2fr 4fr 40px;\n grid-template-areas: 'image header' 'image blurb';\n gap: 5px;\n}\n.sjpp-app-drawer-card,\n.sjpp-track {\n background-color: white;\n max-width: 400px;\n /* min-width: 320px; */\n border-radius: 5px;\n padding: 0px;\n align-items: center;\n justify-items: left;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n}\n.sjpp-app-drawer-card::after,\n.sjpp-track::after {\n content: \"\";\n border-radius: 8px;\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);\n opacity: 0;\n -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n}\n.sjpp-app-drawer-card:hover,\n.sjpp-track:hover {\n -webkit-transform: scale(1, 1);\n transform: scale(1, 1);\n}\n.sjpp-app-drawer-card:hover::after,\n.sjpp-track:hover::after {\n opacity: 1;\n}\n.sjpp-track-image {\n grid-area: image;\n width: 75px;\n height: 75px;\n align-self: start;\n justify-self: start;\n}\n.sjpp-track-image img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 5px 0px 0px 5px;\n}\n.sjpp-app-drawer-card-ribbon{\n grid-area: image;\n overflow: hidden;\n width: 100%;\n height: 100%;\n}\n.sjpp-app-drawer-card-ribbon::before,\n.sjpp-app-drawer-card-ribbon::after {\n position: relative;\n z-index: -1;\n content: '';\n display: block;\n border-top-color: transparent;\n border-left-color: transparent;\n}\n.sjpp-app-drawer-card-ribbon span {\n position: relative;\n display: block;\n width: 100%;\n padding: 1px 0;\n border-color: transparent transparent transparent darkgray;\n box-shadow: 0 2px 7.5px rgba(0, 0, 0, 0.3);\n opacity: 1;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n transform: rotate(-45deg);\n}\n.sjpp-app-drawer-card-ribbon::before {\n top: 0;\n right: 0;\n}\n.sjpp-app-drawer-card-ribbon::after {\n bottom: 0;\n left: 0;\n}\n.sjpp-track-h {\n grid-area: header;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n margin-left: 5px;\n padding: 0px;\n}\n.sjpp-track-blurb {\n grid-area: blurb;\n font-size: 13px;\n font-weight: 300;\n margin-left: 5px;\n justify-content: center;\n font-style: oblique;\n color: #403f3f;\n}\n/* client/src/block.js start */\n.sjpp-active-tiny-button {\n\tdisplay: inline-block;\n\tbackground-color: #1C5E86;\n\tfont-size: .8em;\n\tcolor: white;\n\tpadding: 1px 5px;\n\tmargin-right: 5px;\n\tborder-radius: 4px;\n}\n.sjpp-plus-button\n{\n display: inline-block;\n margin: 1px;\n border: solid 1px #545454;\n font-size: .9em;\n cursor: default;\n padding: 2px 5px;\n}\n.sjpp-dshandleholder\n{\n display: inline-block;\n margin: 1px;\n border: solid 1px #545454;\n font-size: .9em;\n cursor: default;\n}\n.sjpp-dslabel\n{\n display: inline-block;\n color: black;\n padding: 2px 4px;\n\n}\n/* client/src/block.js end */\n/* client/src/app.js start */\n.sjpp-input-div-gene-pos\n{\n display: inline-block;\n padding-right: 5px;\n}\n.sjpp-input-gene-pos\n{\n border: solid 1px #545454;\n padding: 6px 10px;\n border-radius: 5px;\n}\n.sjpp-genome-select-div\n{\n display: inline-block;\n padding-left: 5px;\n}\n.sjpp-genome-select\n{\n border-radius: 5px;\n margin: 1px 20px 1px 10px;\n}\n.sjpp-output-sandbox-title\n{\n border-radius:4px; \n color:white; \n background-color: #969696; \n padding: 1px 5px; \n display:inline-block; \n font-size:0.8em; \n margin-left:4px;\n}\n/* client/src/app.js end */\n/* client/dom/sandbox.ts start */\n.sjpp-output-sandbox-header\n{\n display: inline-block;\n margin: 5px 10px;\n padding-right: 8px;\n margin-bottom: 0px;\n /* box-shadow:2px 0px 2px #f2f2f2; */\n border-radius: 5px 5px 0 0;\n /* background-color: #f2f2f2; */\n z-index: 99;\n}\n.sjpp-output-sandbox-content\n{\n margin: 5px 10px;\n margin-top: 0px;\n padding-right: 8px;\n display: inline-block;\n /* box-shadow: 2px 2px 10px #f2f2f2; */\n border: solid 1px #ccc;\n border-top: solid 1px white;\n border-radius: 0 0 5px 5px;\n}\n.sjpp-output-sandbox-collapse-btn,\n.sjpp-output-sandbox-expand-btn,\n.sjpp-output-sandbox-close-bt\n{\n /* display: inline-block; */\n /* margin: 0px; */\n /* border-right: solid 2px white; */\n font-size: 16px;\n cursor: default;\n}\n.sjpp-output-sandbox-close-bt {\n border-radius: 5px 0 0 0;\n}\n/* \nSeparated padding for sandbox buttons to fix close button's\nright, white border not extending to total height of\nsandbox header\n*/\n.sjpp-output-sandbox-collapse-btn,\n.sjpp-output-sandbox-expand-btn {\n padding: 4px 10px;\n}\n.sjpp-output-sandbox-close-bt {\n padding: 8px 10px;\n}\n/* client/dom/sandbox.ts end */\n.sjpp_row_wrapper:hover {\n background: #fcfcca !important; \n}\n/*.sjpp_row_wrapper:nth-child(odd) {background: rgb(237, 237, 237)}*/\n.sjpp_table_header {\n font-family: 'Arial';\n font-size: 1em;\n text-align: left;\n position: sticky;\n top: 0;\n opacity: 0.7;\n font-weight: normal;\n}\n.sjpp_table_item {\n padding: 3px 5px;\n font-size: 1em;\n text-align: left;\n}\n.sjpp_show_scrollbar{\n\t/* set to \"auto\" to avoid showing a gray track as non-functional scrollbar when contents don't scroll at all, since scrollbar track is now gray and no longer white */\n overflow-y: auto;\n overflow-x: auto;\n}\n.sjpp_show_scrollbar::-webkit-scrollbar{\n background-color: #f1f1f1; /* use non-white track color so the presence of scrollbar is apparent (gdc requirement) */\n border-radius: 7px;\n width: 14px;\n}\n/* This will handle the thumb (scrolling part) */\n.sjpp_show_scrollbar::-webkit-scrollbar-thumb{\n background-color: #858585;\n border-radius: 7px;\n border: 1px solid white;\n}\n.sjpp_show_scrollbar::-webkit-scrollbar-thumb:vertical{\n height: 14px!important;\n width: 14px;\n}\n.sjpp-matrix-series-group-label-g text,\n.sjpp-matrix-series-label-g text,\n.sjpp-matrix-term-group-label-g text,\n.sjpp-matrix-term-label-g text,\n.sjpp-matrix-label text {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -user-select: none;\n}\n.sjpp-nav\n{\n position: sticky;\n background-color: white;\n width: 100%;\n z-index: 10;\n top: 0px;\n left: 0px;\n padding: 0px 0px 15px 0px;\n}\n.add_term_btn {\n border-radius: 6px;\n}\n#sjpp-loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color:rgba(255, 255, 255, 0.8);\n}\n.sjpp-spinner {\n position: absolute;\n left: 50%;\n top: 30%;\n height: 60px;\n width: 60px;\n margin: 0px auto;\n -webkit-animation: rotation .6s infinite linear;\n -moz-animation: rotation .6s infinite linear;\n -o-animation: rotation .6s infinite linear;\n animation: rotation .6s infinite linear;\n border-left: 6px solid rgba(0, 174, 239, .15);\n border-right: 6px solid rgba(0, 174, 239, .15);\n border-bottom: 6px solid rgba(0, 174, 239, .15);\n border-top: 6px solid rgba(0, 174, 239, .8);\n border-radius: 100%;\n}\n@-webkit-keyframes rotation {\n from {-webkit-transform: rotate(0deg);}\n to {-webkit-transform: rotate(359deg);}\n }\n@-moz-keyframes rotation {\n from {-moz-transform: rotate(0deg);}\n to {-moz-transform: rotate(359deg);}\n }\n@-o-keyframes rotation {\n from {-o-transform: rotate(0deg);}\n to {-o-transform: rotate(359deg);}\n }\n@keyframes rotation {\n from {transform: rotate(0deg);}\n to {transform: rotate(359deg);}\n }\n";e(o);var i="http://www.w3.org/1999/xhtml";var s={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(e){var t=e+="",n=t.indexOf(":");if(n>=0&&(t=e.slice(0,n))!=="xmlns")e=e.slice(n+1);return s.hasOwnProperty(t)?{space:s[t],local:e}:e}function a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===i&&t.documentElement.namespaceURI===i?t.createElement(e):t.createElementNS(n,e)}}function l(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function c(e){var t=r(e);return(t.local?l:a)(t)}function d(){}function f(e){return e==null?d:function(){return this.querySelector(e)}}function p(e){if(typeof e!=="function")e=f(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=new Array(r),l,c,d=0;d<r;++d){if((l=s[d])&&(c=e.call(l,l.__data__,d,s))){if("__data__"in l)c.__data__=l.__data__;a[d]=c}}}return new et(o,this._parents)}function u(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function h(){return[]}function m(e){return e==null?h:function(){return this.querySelectorAll(e)}}function g(e){return function(){return u(e.apply(this,arguments))}}function b(e){if(typeof e==="function")e=g(e);else e=m(e);for(var t=this._groups,n=t.length,o=[],i=[],s=0;s<n;++s){for(var r=t[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){o.push(e.call(l,l.__data__,c,r));i.push(l)}}}return new et(o,i)}function y(e){return function(){return this.matches(e)}}function v(e){return function(t){return t.matches(e)}}var w=Array.prototype.find;function x(e){return function(){return w.call(this.children,e)}}function _(){return this.firstElementChild}function k(e){return this.select(e==null?_:x(typeof e==="function"?e:v(e)))}var j=Array.prototype.filter;function N(){return Array.from(this.children)}function S(e){return function(){return j.call(this.children,e)}}function A(e){return this.selectAll(e==null?N:S(typeof e==="function"?e:v(e)))}function C(e){if(typeof e!=="function")e=y(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=[],l,c=0;c<r;++c){if((l=s[c])&&e.call(l,l.__data__,c,s)){a.push(l)}}}return new et(o,this._parents)}function E(e){return new Array(e.length)}function O(){return new et(this._enter||this._groups.map(E),this._parents)}function M(e,t){this.ownerDocument=e.ownerDocument;this.namespaceURI=e.namespaceURI;this._next=null;this._parent=e;this.__data__=t}M.prototype={constructor:M,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function I(e){return function(){return e}}function T(e,t,n,o,i,s){var r=0,a,l=t.length,c=s.length;for(;r<c;++r){if(a=t[r]){a.__data__=s[r];o[r]=a}else{n[r]=new M(e,s[r])}}for(;r<l;++r){if(a=t[r]){i[r]=a}}}function R(e,t,n,o,i,s,r){var a,l,c=new Map,d=t.length,f=s.length,p=new Array(d),u;for(a=0;a<d;++a){if(l=t[a]){p[a]=u=r.call(l,l.__data__,a,t)+"";if(c.has(u)){i[a]=l}else{c.set(u,l)}}}for(a=0;a<f;++a){u=r.call(e,s[a],a,s)+"";if(l=c.get(u)){o[a]=l;l.__data__=s[a];c.delete(u)}else{n[a]=new M(e,s[a])}}for(a=0;a<d;++a){if((l=t[a])&&c.get(p[a])===l){i[a]=l}}}function L(e){return e.__data__}function $(e,t){if(!arguments.length)return Array.from(this,L);var n=t?R:T,o=this._parents,i=this._groups;if(typeof e!=="function")e=I(e);for(var s=i.length,r=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var d=o[c],f=i[c],p=f.length,u=z(e.call(d,d&&d.__data__,c,o)),h=u.length,m=a[c]=new Array(h),g=r[c]=new Array(h),b=l[c]=new Array(p);n(d,f,m,g,b,u,t);for(var y=0,v=0,w,x;y<h;++y){if(w=m[y]){if(y>=v)v=y+1;while(!(x=g[v])&&++v<h);w._next=x||null}}}r=new et(r,o);r._enter=a;r._exit=l;return r}function z(e){return typeof e==="object"&&"length"in e?e:Array.from(e)}function P(){return new et(this._exit||this._groups.map(E),this._parents)}function D(e,t,n){var o=this.enter(),i=this,s=this.exit();if(typeof e==="function"){o=e(o);if(o)o=o.selection()}else{o=o.append(e+"")}if(t!=null){i=t(i);if(i)i=i.selection()}if(n==null)s.remove();else n(s);return o&&i?o.merge(i).order():i}function U(e){var t=e.selection?e.selection():e;for(var n=this._groups,o=t._groups,i=n.length,s=o.length,r=Math.min(i,s),a=new Array(i),l=0;l<r;++l){for(var c=n[l],d=o[l],f=c.length,p=a[l]=new Array(f),u,h=0;h<f;++h){if(u=c[h]||d[h]){p[h]=u}}}for(;l<i;++l){a[l]=n[l]}return new et(a,this._parents)}function B(){for(var e=this._groups,t=-1,n=e.length;++t<n;){for(var o=e[t],i=o.length-1,s=o[i],r;--i>=0;){if(r=o[i]){if(s&&r.compareDocumentPosition(s)^4)s.parentNode.insertBefore(r,s);s=r}}}return this}function F(e){if(!e)e=q;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,o=n.length,i=new Array(o),s=0;s<o;++s){for(var r=n[s],a=r.length,l=i[s]=new Array(a),c,d=0;d<a;++d){if(c=r[d]){l[d]=c}}l.sort(t)}return new et(i,this._parents).order()}function q(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function H(){var e=arguments[0];arguments[0]=this;e.apply(null,arguments);return this}function G(){return Array.from(this)}function J(){for(var e=this._groups,t=0,n=e.length;t<n;++t){for(var o=e[t],i=0,s=o.length;i<s;++i){var r=o[i];if(r)return r}}return null}function V(){let e=0;for(const t of this)++e;return e}function W(){return!this.node()}function X(e){for(var t=this._groups,n=0,o=t.length;n<o;++n){for(var i=t[n],s=0,r=i.length,a;s<r;++s){if(a=i[s])e.call(a,a.__data__,s,i)}}return this}function Y(e){return function(){this.removeAttribute(e)}}function Z(e){return function(){this.removeAttributeNS(e.space,e.local)}}function K(e,t){return function(){this.setAttribute(e,t)}}function Q(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ee(e,t){return function(){var n=t.apply(this,arguments);if(n==null)this.removeAttribute(e);else this.setAttribute(e,n)}}function te(e,t){return function(){var n=t.apply(this,arguments);if(n==null)this.removeAttributeNS(e.space,e.local);else this.setAttributeNS(e.space,e.local,n)}}function ne(e,t){var n=r(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Z:Y:typeof t==="function"?n.local?te:ee:n.local?Q:K)(n,t))}function oe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ie(e){return function(){this.style.removeProperty(e)}}function se(e,t,n){return function(){this.style.setProperty(e,t,n)}}function re(e,t,n){return function(){var o=t.apply(this,arguments);if(o==null)this.style.removeProperty(e);else this.style.setProperty(e,o,n)}}function ae(e,t,n){return arguments.length>1?this.each((t==null?ie:typeof t==="function"?re:se)(e,t,n==null?"":n)):le(this.node(),e)}function le(e,t){return e.style.getPropertyValue(t)||oe(e).getComputedStyle(e,null).getPropertyValue(t)}function ce(e){return function(){delete this[e]}}function de(e,t){return function(){this[e]=t}}function fe(e,t){return function(){var n=t.apply(this,arguments);if(n==null)delete this[e];else this[e]=n}}function pe(e,t){return arguments.length>1?this.each((t==null?ce:typeof t==="function"?fe:de)(e,t)):this.node()[e]}function ue(e){return e.trim().split(/^|\s+/)}function he(e){return e.classList||new me(e)}function me(e){this._node=e;this._names=ue(e.getAttribute("class")||"")}me.prototype={add:function(e){var t=this._names.indexOf(e);if(t<0){this._names.push(e);this._node.setAttribute("class",this._names.join(" "))}},remove:function(e){var t=this._names.indexOf(e);if(t>=0){this._names.splice(t,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(e){return this._names.indexOf(e)>=0}};function ge(e,t){var n=he(e),o=-1,i=t.length;while(++o<i)n.add(t[o])}function be(e,t){var n=he(e),o=-1,i=t.length;while(++o<i)n.remove(t[o])}function ye(e){return function(){ge(this,e)}}function ve(e){return function(){be(this,e)}}function we(e,t){return function(){(t.apply(this,arguments)?ge:be)(this,e)}}function xe(e,t){var n=ue(e+"");if(arguments.length<2){var o=he(this.node()),i=-1,s=n.length;while(++i<s)if(!o.contains(n[i]))return false;return true}return this.each((typeof t==="function"?we:t?ye:ve)(n,t))}function _e(){this.textContent=""}function ke(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ne(e){return arguments.length?this.each(e==null?_e:(typeof e==="function"?je:ke)(e)):this.node().textContent}function Se(){this.innerHTML=""}function Ae(e){return function(){this.innerHTML=e}}function Ce(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Ee(e){return arguments.length?this.each(e==null?Se:(typeof e==="function"?Ce:Ae)(e)):this.node().innerHTML}function Oe(){if(this.nextSibling)this.parentNode.appendChild(this)}function Me(){return this.each(Oe)}function Ie(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Te(){return this.each(Ie)}function Re(e){var t=typeof e==="function"?e:c(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))}function Le(){return null}function $e(e,t){var n=typeof e==="function"?e:c(e),o=t==null?Le:typeof t==="function"?t:f(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))}function ze(){var e=this.parentNode;if(e)e.removeChild(this)}function Pe(){return this.each(ze)}function De(){var e=this.cloneNode(false),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ue(){var e=this.cloneNode(true),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Be(e){return this.select(e?Ue:De)}function Fe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qe(e){return function(t){e.call(this,t,this.__data__)}}function He(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0)t=e.slice(n+1),e=e.slice(0,n);return{type:e,name:t}}))}function Ge(e){return function(){var t=this.__on;if(!t)return;for(var n=0,o=-1,i=t.length,s;n<i;++n){if(s=t[n],(!e.type||s.type===e.type)&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options)}else{t[++o]=s}}if(++o)t.length=o;else delete this.__on}}function Je(e,t,n){return function(){var o=this.__on,i,s=qe(t);if(o)for(var r=0,a=o.length;r<a;++r){if((i=o[r]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options);this.addEventListener(i.type,i.listener=s,i.options=n);i.value=t;return}}this.addEventListener(e.type,s,n);i={type:e.type,name:e.name,value:t,listener:s,options:n};if(!o)this.__on=[i];else o.push(i)}}function Ve(e,t,n){var o=He(e+""),i,s=o.length,r;if(arguments.length<2){var a=this.node().__on;if(a)for(var l=0,c=a.length,d;l<c;++l){for(i=0,d=a[l];i<s;++i){if((r=o[i]).type===d.type&&r.name===d.name){return d.value}}}return}a=t?Je:Ge;for(i=0;i<s;++i)this.each(a(o[i],t,n));return this}function We(e,t,n){var o=oe(e),i=o.CustomEvent;if(typeof i==="function"){i=new i(t,n)}else{i=o.document.createEvent("Event");if(n)i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail;else i.initEvent(t,false,false)}e.dispatchEvent(i)}function Xe(e,t){return function(){return We(this,e,t)}}function Ye(e,t){return function(){return We(this,e,t.apply(this,arguments))}}function Ze(e,t){return this.each((typeof t==="function"?Ye:Xe)(e,t))}function*Ke(){for(var e=this._groups,t=0,n=e.length;t<n;++t){for(var o=e[t],i=0,s=o.length,r;i<s;++i){if(r=o[i])yield r}}}var Qe=[null];function et(e,t){this._groups=e;this._parents=t}function tt(){return new et([[document.documentElement]],Qe)}function nt(){return this}et.prototype=tt.prototype={constructor:et,select:p,selectAll:b,selectChild:k,selectChildren:A,filter:C,data:$,enter:O,exit:P,join:D,merge:U,selection:nt,order:B,sort:F,call:H,nodes:G,node:J,size:V,empty:W,each:X,attr:ne,style:ae,property:pe,classed:xe,text:Ne,html:Ee,raise:Me,lower:Te,append:Re,insert:$e,remove:Pe,clone:Be,datum:Fe,on:Ve,dispatch:Ze,[Symbol.iterator]:Ke};function ot(e){return typeof e==="string"?new et([[document.querySelector(e)]],[document.documentElement]):new et([[e]],Qe)}function it(e){return typeof e==="string"?new et([document.querySelectorAll(e)],[document.documentElement]):new et([u(e)],Qe)}function st(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rt(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function at(e){let t,n,o;if(e.length!==2){t=st;n=(t,n)=>st(e(t),n);o=(t,n)=>e(t)-n}else{t=e===st||e===rt?e:lt;n=e;o=e}function i(e,o,i=0,s=e.length){if(i<s){if(t(o,o)!==0)return s;do{const t=i+s>>>1;if(n(e[t],o)<0)i=t+1;else s=t}while(i<s)}return i}function s(e,o,i=0,s=e.length){if(i<s){if(t(o,o)!==0)return s;do{const t=i+s>>>1;if(n(e[t],o)<=0)i=t+1;else s=t}while(i<s)}return i}function r(e,t,n=0,s=e.length){const r=i(e,t,n,s-1);return r>n&&o(e[r-1],t)>-o(e[r],t)?r-1:r}return{left:i,center:r,right:s}}function lt(){return 0}function ct(e){return e===null?NaN:+e}const dt=at(st);const ft=dt.right;at(ct).center;var pt=ft;class ut extends Map{constructor(e,t=bt){super();Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}});if(e!=null)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(ht(this,e))}has(e){return super.has(ht(this,e))}set(e,t){return super.set(mt(this,e),t)}delete(e){return super.delete(gt(this,e))}}function ht({_intern:e,_key:t},n){const o=t(n);return e.has(o)?e.get(o):n}function mt({_intern:e,_key:t},n){const o=t(n);if(e.has(o))return e.get(o);e.set(o,n);return n}function gt({_intern:e,_key:t},n){const o=t(n);if(e.has(o)){n=e.get(o);e.delete(o)}return n}function bt(e){return e!==null&&typeof e==="object"?e.valueOf():e}var yt=Math.sqrt(50),vt=Math.sqrt(10),wt=Math.sqrt(2);function xt(e,t,n){var o,i=-1,s,r,a;t=+t,e=+e,n=+n;if(e===t&&n>0)return[e];if(o=t<e)s=e,e=t,t=s;if((a=_t(e,t,n))===0||!isFinite(a))return[];if(a>0){let n=Math.round(e/a),o=Math.round(t/a);if(n*a<e)++n;if(o*a>t)--o;r=new Array(s=o-n+1);while(++i<s)r[i]=(n+i)*a}else{a=-a;let n=Math.round(e*a),o=Math.round(t*a);if(n/a<e)++n;if(o/a>t)--o;r=new Array(s=o-n+1);while(++i<s)r[i]=(n+i)/a}if(o)r.reverse();return r}function _t(e,t,n){var o=(t-e)/Math.max(0,n),i=Math.floor(Math.log(o)/Math.LN10),s=o/Math.pow(10,i);return i>=0?(s>=yt?10:s>=vt?5:s>=wt?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=yt?10:s>=vt?5:s>=wt?2:1)}function kt(e,t,n){var o=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(o)/Math.LN10)),s=o/i;if(s>=yt)i*=10;else if(s>=vt)i*=5;else if(s>=wt)i*=2;return t<e?-i:i}function jt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Nt(e,t){switch(arguments.length){case 0:break;case 1:{if(typeof e==="function")this.interpolator(e);else this.range(e);break}default:{this.domain(e);if(typeof t==="function")this.interpolator(t);else this.range(t);break}}return this}const St=Symbol("implicit");function At(){var e=new ut,t=[],n=[],o=St;function i(i){let s=e.get(i);if(s===undefined){if(o!==St)return o;e.set(i,s=t.push(i)-1)}return n[s%n.length]}i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new ut;for(const o of n){if(e.has(o))continue;e.set(o,t.push(o)-1)}return i};i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()};i.unknown=function(e){return arguments.length?(o=e,i):o};i.copy=function(){return At(t,n).unknown(o)};jt.apply(i,arguments);return i}function Ct(e,t,n){e.prototype=t.prototype=n;n.constructor=e}function Et(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ot(){}var Mt=.7;var It=1/Mt;var Tt="\\s*([+-]?\\d+)\\s*",Rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$t=/^#([0-9a-f]{3,8})$/,zt=new RegExp(`^rgb\\(${Tt},${Tt},${Tt}\\)$`),Pt=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),Dt=new RegExp(`^rgba\\(${Tt},${Tt},${Tt},${Rt}\\)$`),Ut=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Rt}\\)$`),Bt=new RegExp(`^hsl\\(${Rt},${Lt},${Lt}\\)$`),Ft=new RegExp(`^hsla\\(${Rt},${Lt},${Lt},${Rt}\\)$`);var qt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ct(Ot,Wt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ht,formatHex:Ht,formatHex8:Gt,formatHsl:Jt,formatRgb:Vt,toString:Vt});function Ht(){return this.rgb().formatHex()}function Gt(){return this.rgb().formatHex8()}function Jt(){return ln(this).formatHsl()}function Vt(){return this.rgb().formatRgb()}function Wt(e){var t,n;e=(e+"").trim().toLowerCase();return(t=$t.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Xt(t):n===3?new Qt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=zt.exec(e))?new Qt(t[1],t[2],t[3],1):(t=Pt.exec(e))?new Qt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Dt.exec(e))?Yt(t[1],t[2],t[3],t[4]):(t=Ut.exec(e))?Yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Bt.exec(e))?an(t[1],t[2]/100,t[3]/100,1):(t=Ft.exec(e))?an(t[1],t[2]/100,t[3]/100,t[4]):qt.hasOwnProperty(e)?Xt(qt[e]):e==="transparent"?new Qt(NaN,NaN,NaN,0):null}function Xt(e){return new Qt(e>>16&255,e>>8&255,e&255,1)}function Yt(e,t,n,o){if(o<=0)e=t=n=NaN;return new Qt(e,t,n,o)}function Zt(e){if(!(e instanceof Ot))e=Wt(e);if(!e)return new Qt;e=e.rgb();return new Qt(e.r,e.g,e.b,e.opacity)}function Kt(e,t,n,o){return arguments.length===1?Zt(e):new Qt(e,t,n,o==null?1:o)}function Qt(e,t,n,o){this.r=+e;this.g=+t;this.b=+n;this.opacity=+o}Ct(Qt,Kt,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qt(sn(this.r),sn(this.g),sn(this.b),on(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&(-.5<=this.g&&this.g<255.5)&&(-.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:en,formatHex:en,formatHex8:tn,formatRgb:nn,toString:nn}));function en(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}`}function tn(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}${rn((isNaN(this.opacity)?1:this.opacity)*255)}`}function nn(){const e=on(this.opacity);return`${e===1?"rgb(":"rgba("}${sn(this.r)}, ${sn(this.g)}, ${sn(this.b)}${e===1?")":`, ${e})`}`}function on(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rn(e){e=sn(e);return(e<16?"0":"")+e.toString(16)}function an(e,t,n,o){if(o<=0)e=t=n=NaN;else if(n<=0||n>=1)e=t=NaN;else if(t<=0)e=NaN;return new dn(e,t,n,o)}function ln(e){if(e instanceof dn)return new dn(e.h,e.s,e.l,e.opacity);if(!(e instanceof Ot))e=Wt(e);if(!e)return new dn;if(e instanceof dn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),s=Math.max(t,n,o),r=NaN,a=s-i,l=(s+i)/2;if(a){if(t===s)r=(n-o)/a+(n<o)*6;else if(n===s)r=(o-t)/a+2;else r=(t-n)/a+4;a/=l<.5?s+i:2-s-i;r*=60}else{a=l>0&&l<1?0:r}return new dn(r,a,l,e.opacity)}function cn(e,t,n,o){return arguments.length===1?ln(e):new dn(e,t,n,o==null?1:o)}function dn(e,t,n,o){this.h=+e;this.s=+t;this.l=+n;this.opacity=+o}Ct(dn,cn,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new dn(this.h,this.s,this.l*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new dn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new Qt(un(e>=240?e-240:e+120,i,o),un(e,i,o),un(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new dn(fn(this.h),pn(this.s),pn(this.l),on(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){const e=on(this.opacity);return`${e===1?"hsl(":"hsla("}${fn(this.h)}, ${pn(this.s)*100}%, ${pn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fn(e){e=(e||0)%360;return e<0?e+360:e}function pn(e){return Math.max(0,Math.min(1,e||0))}function un(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const hn=Math.PI/180;const mn=180/Math.PI;var gn=-.14861,bn=+1.78277,yn=-.29227,vn=-.90649,wn=+1.97294,xn=wn*vn,_n=wn*bn,kn=bn*yn-vn*gn;function jn(e){if(e instanceof Sn)return new Sn(e.h,e.s,e.l,e.opacity);if(!(e instanceof Qt))e=Zt(e);var t=e.r/255,n=e.g/255,o=e.b/255,i=(kn*o+xn*t-_n*n)/(kn+xn-_n),s=o-i,r=(wn*(n-i)-yn*s)/vn,a=Math.sqrt(r*r+s*s)/(wn*i*(1-i)),l=a?Math.atan2(r,s)*mn-120:NaN;return new Sn(l<0?l+360:l,a,i,e.opacity)}function Nn(e,t,n,o){return arguments.length===1?jn(e):new Sn(e,t,n,o==null?1:o)}function Sn(e,t,n,o){this.h=+e;this.s=+t;this.l=+n;this.opacity=+o}Ct(Sn,Nn,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new Sn(this.h,this.s,this.l*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new Sn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*hn,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),o=Math.cos(e),i=Math.sin(e);return new Qt(255*(t+n*(gn*o+bn*i)),255*(t+n*(yn*o+vn*i)),255*(t+n*(wn*o)),this.opacity)}}));function An(e,t,n,o,i){var s=e*e,r=s*e;return((1-3*e+3*s-r)*t+(4-6*s+3*r)*n+(1+3*e+3*s-3*r)*o+r*i)/6}function Cn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[o],s=e[o+1],r=o>0?e[o-1]:2*i-s,a=o<t-1?e[o+2]:2*s-i;return An((n-o/t)*t,r,i,s,a)}}var En=e=>()=>e;function On(e,t){return function(n){return e+n*t}}function Mn(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function In(e,t){var n=t-e;return n?On(e,n>180||n<-180?n-360*Math.round(n/360):n):En(isNaN(e)?t:e)}function Tn(e){return(e=+e)===1?Rn:function(t,n){return n-t?Mn(t,n,e):En(isNaN(t)?n:t)}}function Rn(e,t){var n=t-e;return n?On(e,n):En(isNaN(e)?t:e)}var Ln=function e(t){var n=Tn(t);function o(e,t){var o=n((e=Kt(e)).r,(t=Kt(t)).r),i=n(e.g,t.g),s=n(e.b,t.b),r=Rn(e.opacity,t.opacity);return function(t){e.r=o(t);e.g=i(t);e.b=s(t);e.opacity=r(t);return e+""}}o.gamma=e;return o}(1);function $n(e){return function(t){var n=t.length,o=new Array(n),i=new Array(n),s=new Array(n),r,a;for(r=0;r<n;++r){a=Kt(t[r]);o[r]=a.r||0;i[r]=a.g||0;s[r]=a.b||0}o=e(o);i=e(i);s=e(s);a.opacity=1;return function(e){a.r=o(e);a.g=i(e);a.b=s(e);return a+""}}}var zn=$n(Cn);function Pn(e,t){if(!t)t=[];var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(s){for(i=0;i<n;++i)o[i]=e[i]*(1-s)+t[i]*s;return o}}function Dn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Un(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),s=new Array(n),r;for(r=0;r<o;++r)i[r]=Xn(e[r],t[r]);for(;r<n;++r)s[r]=t[r];return function(e){for(r=0;r<o;++r)s[r]=i[r](e);return s}}function Bn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Fn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function qn(e,t){var n={},o={},i;if(e===null||typeof e!=="object")e={};if(t===null||typeof t!=="object")t={};for(i in t){if(i in e){n[i]=Xn(e[i],t[i])}else{o[i]=t[i]}}return function(e){for(i in n)o[i]=n[i](e);return o}}var Hn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gn=new RegExp(Hn.source,"g");function Jn(e){return function(){return e}}function Vn(e){return function(t){return e(t)+""}}function Wn(e,t){var n=Hn.lastIndex=Gn.lastIndex=0,o,i,s,r=-1,a=[],l=[];e=e+"",t=t+"";while((o=Hn.exec(e))&&(i=Gn.exec(t))){if((s=i.index)>n){s=t.slice(n,s);if(a[r])a[r]+=s;else a[++r]=s}if((o=o[0])===(i=i[0])){if(a[r])a[r]+=i;else a[++r]=i}else{a[++r]=null;l.push({i:r,x:Fn(o,i)})}n=Gn.lastIndex}if(n<t.length){s=t.slice(n);if(a[r])a[r]+=s;else a[++r]=s}return a.length<2?l[0]?Vn(l[0].x):Jn(t):(t=l.length,function(e){for(var n=0,o;n<t;++n)a[(o=l[n]).i]=o.x(e);return a.join("")})}function Xn(e,t){var n=typeof t,o;return t==null||n==="boolean"?En(t):(n==="number"?Fn:n==="string"?(o=Wt(t))?(t=o,Ln):Wn:t instanceof Wt?Ln:t instanceof Date?Bn:Dn(t)?Pn:Array.isArray(t)?Un:typeof t.valueOf!=="function"&&typeof t.toString!=="function"||isNaN(t)?qn:Fn)(e,t)}function Yn(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Zn=180/Math.PI;var Kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qn(e,t,n,o,i,s){var r,a,l;if(r=Math.sqrt(e*e+t*t))e/=r,t/=r;if(l=e*n+t*o)n-=e*l,o-=t*l;if(a=Math.sqrt(n*n+o*o))n/=a,o/=a,l/=a;if(e*o<t*n)e=-e,t=-t,l=-l,r=-r;return{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Zn,skewX:Math.atan(l)*Zn,scaleX:r,scaleY:a}}var eo;function to(e){const t=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kn:Qn(t.a,t.b,t.c,t.d,t.e,t.f)}function no(e){if(e==null)return Kn;if(!eo)eo=document.createElementNS("http://www.w3.org/2000/svg","g");eo.setAttribute("transform",e);if(!(e=eo.transform.baseVal.consolidate()))return Kn;e=e.matrix;return Qn(e.a,e.b,e.c,e.d,e.e,e.f)}function oo(e,t,n,o){function i(e){return e.length?e.pop()+" ":""}function s(e,o,i,s,r,a){if(e!==i||o!==s){var l=r.push("translate(",null,t,null,n);a.push({i:l-4,x:Fn(e,i)},{i:l-2,x:Fn(o,s)})}else if(i||s){r.push("translate("+i+t+s+n)}}function r(e,t,n,s){if(e!==t){if(e-t>180)t+=360;else if(t-e>180)e+=360;s.push({i:n.push(i(n)+"rotate(",null,o)-2,x:Fn(e,t)})}else if(t){n.push(i(n)+"rotate("+t+o)}}function a(e,t,n,s){if(e!==t){s.push({i:n.push(i(n)+"skewX(",null,o)-2,x:Fn(e,t)})}else if(t){n.push(i(n)+"skewX("+t+o)}}function l(e,t,n,o,s,r){if(e!==n||t!==o){var a=s.push(i(s)+"scale(",null,",",null,")");r.push({i:a-4,x:Fn(e,n)},{i:a-2,x:Fn(t,o)})}else if(n!==1||o!==1){s.push(i(s)+"scale("+n+","+o+")")}}return function(t,n){var o=[],i=[];t=e(t),n=e(n);s(t.translateX,t.translateY,n.translateX,n.translateY,o,i);r(t.rotate,n.rotate,o,i);a(t.skewX,n.skewX,o,i);l(t.scaleX,t.scaleY,n.scaleX,n.scaleY,o,i);t=n=null;return function(e){var t=-1,n=i.length,s;while(++t<n)o[(s=i[t]).i]=s.x(e);return o.join("")}}}var io=oo(to,"px, ","px)","deg)");var so=oo(no,", ",")",")");function ro(e){return function t(n){n=+n;function o(t,o){var i=e((t=Nn(t)).h,(o=Nn(o)).h),s=Rn(t.s,o.s),r=Rn(t.l,o.l),a=Rn(t.opacity,o.opacity);return function(e){t.h=i(e);t.s=s(e);t.l=r(Math.pow(e,n));t.opacity=a(e);return t+""}}o.gamma=t;return o}(1)}ro(In);var ao=ro(Rn);function lo(e){return function(){return e}}function co(e){return+e}var fo=[0,1];function po(e){return e}function uo(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:lo(isNaN(t)?NaN:.5)}function ho(e,t){var n;if(e>t)n=e,e=t,t=n;return function(n){return Math.max(e,Math.min(t,n))}}function mo(e,t,n){var o=e[0],i=e[1],s=t[0],r=t[1];if(i<o)o=uo(i,o),s=n(r,s);else o=uo(o,i),s=n(s,r);return function(e){return s(o(e))}}function go(e,t,n){var o=Math.min(e.length,t.length)-1,i=new Array(o),s=new Array(o),r=-1;if(e[o]<e[0]){e=e.slice().reverse();t=t.slice().reverse()}while(++r<o){i[r]=uo(e[r],e[r+1]);s[r]=n(t[r],t[r+1])}return function(t){var n=pt(e,t,1,o)-1;return s[n](i[n](t))}}function bo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function yo(){var e=fo,t=fo,n=Xn,o,i,s,r=po,a,l,c;function d(){var n=Math.min(e.length,t.length);if(r!==po)r=ho(e[0],e[n-1]);a=n>2?go:mo;l=c=null;return f}function f(i){return i==null||isNaN(i=+i)?s:(l||(l=a(e.map(o),t,n)))(o(r(i)))}f.invert=function(n){return r(i((c||(c=a(t,e.map(o),Fn)))(n)))};f.domain=function(t){return arguments.length?(e=Array.from(t,co),d()):e.slice()};f.range=function(e){return arguments.length?(t=Array.from(e),d()):t.slice()};f.rangeRound=function(e){return t=Array.from(e),n=Yn,d()};f.clamp=function(e){return arguments.length?(r=e?true:po,d()):r!==po};f.interpolate=function(e){return arguments.length?(n=e,d()):n};f.unknown=function(e){return arguments.length?(s=e,f):s};return function(e,t){o=e,i=t;return d()}}function vo(){return yo()(po,po)}function wo(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function xo(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,o=e.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+e.slice(n+1)]}function _o(e){return e=xo(Math.abs(e)),e?e[1]:NaN}function ko(e,t){return function(n,o){var i=n.length,s=[],r=0,a=e[0],l=0;while(i>0&&a>0){if(l+a+1>o)a=Math.max(1,o-l);s.push(n.substring(i-=a,i+a));if((l+=a+1)>o)break;a=e[r=(r+1)%e.length]}return s.reverse().join(t)}}function jo(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}var No=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function So(e){if(!(t=No.exec(e)))throw new Error("invalid format: "+e);var t;return new Ao({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}So.prototype=Ao.prototype;function Ao(e){this.fill=e.fill===undefined?" ":e.fill+"";this.align=e.align===undefined?">":e.align+"";this.sign=e.sign===undefined?"-":e.sign+"";this.symbol=e.symbol===undefined?"":e.symbol+"";this.zero=!!e.zero;this.width=e.width===undefined?undefined:+e.width;this.comma=!!e.comma;this.precision=e.precision===undefined?undefined:+e.precision;this.trim=!!e.trim;this.type=e.type===undefined?"":e.type+""}Ao.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Co(e){e:for(var t=e.length,n=1,o=-1,i;n<t;++n){switch(e[n]){case".":o=i=n;break;case"0":if(o===0)o=n;i=n;break;default:if(!+e[n])break e;if(o>0)o=0;break}}return o>0?e.slice(0,o)+e.slice(i+1):e}var Eo;function Oo(e,t){var n=xo(e,t);if(!n)return e+"";var o=n[0],i=n[1],s=i-(Eo=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,r=o.length;return s===r?o:s>r?o+new Array(s-r+1).join("0"):s>0?o.slice(0,s)+"."+o.slice(s):"0."+new Array(1-s).join("0")+xo(e,Math.max(0,t+s-1))[0]}function Mo(e,t){var n=xo(e,t);if(!n)return e+"";var o=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+o:o.length>i+1?o.slice(0,i+1)+"."+o.slice(i+1):o+new Array(i-o.length+2).join("0")}var Io={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:wo,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Mo(e*100,t),r:Mo,s:Oo,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function To(e){return e}var Ro=Array.prototype.map,Lo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function $o(e){var t=e.grouping===undefined||e.thousands===undefined?To:ko(Ro.call(e.grouping,Number),e.thousands+""),n=e.currency===undefined?"":e.currency[0]+"",o=e.currency===undefined?"":e.currency[1]+"",i=e.decimal===undefined?".":e.decimal+"",s=e.numerals===undefined?To:jo(Ro.call(e.numerals,String)),r=e.percent===undefined?"%":e.percent+"",a=e.minus===undefined?"−":e.minus+"",l=e.nan===undefined?"NaN":e.nan+"";function c(e){e=So(e);var c=e.fill,d=e.align,f=e.sign,p=e.symbol,u=e.zero,h=e.width,m=e.comma,g=e.precision,b=e.trim,y=e.type;if(y==="n")m=true,y="g";else if(!Io[y])g===undefined&&(g=12),b=true,y="g";if(u||c==="0"&&d==="=")u=true,c="0",d="=";var v=p==="$"?n:p==="#"&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w=p==="$"?o:/[%p]/.test(y)?r:"";var x=Io[y],_=/[defgprs%]/.test(y);g=g===undefined?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g));function k(e){var n=v,o=w,r,p,k;if(y==="c"){o=x(e)+o;e=""}else{e=+e;var j=e<0||1/e<0;e=isNaN(e)?l:x(Math.abs(e),g);if(b)e=Co(e);if(j&&+e===0&&f!=="+")j=false;n=(j?f==="("?f:a:f==="-"||f==="("?"":f)+n;o=(y==="s"?Lo[8+Eo/3]:"")+o+(j&&f==="("?")":"");if(_){r=-1,p=e.length;while(++r<p){if(k=e.charCodeAt(r),48>k||k>57){o=(k===46?i+e.slice(r+1):e.slice(r))+o;e=e.slice(0,r);break}}}}if(m&&!u)e=t(e,Infinity);var N=n.length+e.length+o.length,S=N<h?new Array(h-N+1).join(c):"";if(m&&u)e=t(S+e,S.length?h-o.length:Infinity),S="";switch(d){case"<":e=n+e+o+S;break;case"=":e=n+S+e+o;break;case"^":e=S.slice(0,N=S.length>>1)+n+e+o+S.slice(N);break;default:e=S+n+e+o;break}return s(e)}k.toString=function(){return e+""};return k}function d(e,t){var n=c((e=So(e),e.type="f",e)),o=Math.max(-8,Math.min(8,Math.floor(_o(t)/3)))*3,i=Math.pow(10,-o),s=Lo[8+o/3];return function(e){return n(i*e)+s}}return{format:c,formatPrefix:d}}var zo;var Po;var Do;Uo({thousands:",",grouping:[3],currency:["$",""]});function Uo(e){zo=$o(e);Po=zo.format;Do=zo.formatPrefix;return zo}function Bo(e){return Math.max(0,-_o(Math.abs(e)))}function Fo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(_o(t)/3)))*3-_o(Math.abs(e)))}function qo(e,t){e=Math.abs(e),t=Math.abs(t)-e;return Math.max(0,_o(t)-_o(e))+1}function Ho(e,t,n,o){var i=kt(e,t,n),s;o=So(o==null?",f":o);switch(o.type){case"s":{var r=Math.max(Math.abs(e),Math.abs(t));if(o.precision==null&&!isNaN(s=Fo(i,r)))o.precision=s;return Do(o,r)}case"":case"e":case"g":case"p":case"r":{if(o.precision==null&&!isNaN(s=qo(i,Math.max(Math.abs(e),Math.abs(t)))))o.precision=s-(o.type==="e");break}case"f":case"%":{if(o.precision==null&&!isNaN(s=Bo(i)))o.precision=s-(o.type==="%")*2;break}}return Po(o)}function Go(e){var t=e.domain;e.ticks=function(e){var n=t();return xt(n[0],n[n.length-1],e==null?10:e)};e.tickFormat=function(e,n){var o=t();return Ho(o[0],o[o.length-1],e==null?10:e,n)};e.nice=function(n){if(n==null)n=10;var o=t();var i=0;var s=o.length-1;var r=o[i];var a=o[s];var l;var c;var d=10;if(a<r){c=r,r=a,a=c;c=i,i=s,s=c}while(d-- >0){c=_t(r,a,n);if(c===l){o[i]=r;o[s]=a;return t(o)}else if(c>0){r=Math.floor(r/c)*c;a=Math.ceil(a/c)*c}else if(c<0){r=Math.ceil(r*c)/c;a=Math.floor(a*c)/c}else{break}l=c}return e};return e}function Jo(){var e=vo();e.copy=function(){return bo(e,Jo())};jt.apply(e,arguments);return Go(e)}var Vo={value:()=>{}};function Wo(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Xo(n)}function Xo(e){this._=e}function Yo(e,t){return e.trim().split(/^|\s+/).map((function(e){var n="",o=e.indexOf(".");if(o>=0)n=e.slice(o+1),e=e.slice(0,o);if(e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}Xo.prototype=Wo.prototype={constructor:Xo,on:function(e,t){var n=this._,o=Yo(e+"",n),i,s=-1,r=o.length;if(arguments.length<2){while(++s<r)if((i=(e=o[s]).type)&&(i=Zo(n[i],e.name)))return i;return}if(t!=null&&typeof t!=="function")throw new Error("invalid callback: "+t);while(++s<r){if(i=(e=o[s]).type)n[i]=Ko(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ko(n[i],e.name,null)}return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Xo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,s;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,i=s.length;o<i;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,s=o.length;i<s;++i)o[i].value.apply(t,n)}};function Zo(e,t){for(var n=0,o=e.length,i;n<o;++n){if((i=e[n]).name===t){return i.value}}}function Ko(e,t,n){for(var o=0,i=e.length;o<i;++o){if(e[o].name===t){e[o]=Vo,e=e.slice(0,o).concat(e.slice(o+1));break}}if(n!=null)e.push({name:t,value:n});return e}var Qo=0,ei=0,ti=0,ni=1e3,oi,ii,si=0,ri=0,ai=0,li=typeof performance==="object"&&performance.now?performance:Date,ci=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function di(){return ri||(ci(fi),ri=li.now()+ai)}function fi(){ri=0}function pi(){this._call=this._time=this._next=null}pi.prototype=ui.prototype={constructor:pi,restart:function(e,t,n){if(typeof e!=="function")throw new TypeError("callback is not a function");n=(n==null?di():+n)+(t==null?0:+t);if(!this._next&&ii!==this){if(ii)ii._next=this;else oi=this;ii=this}this._call=e;this._time=n;yi()},stop:function(){if(this._call){this._call=null;this._time=Infinity;yi()}}};function ui(e,t,n){var o=new pi;o.restart(e,t,n);return o}function hi(){di();++Qo;var e=oi,t;while(e){if((t=ri-e._time)>=0)e._call.call(undefined,t);e=e._next}--Qo}function mi(){ri=(si=li.now())+ai;Qo=ei=0;try{hi()}finally{Qo=0;bi();ri=0}}function gi(){var e=li.now(),t=e-si;if(t>ni)ai-=t,si=e}function bi(){var e,t=oi,n,o=Infinity;while(t){if(t._call){if(o>t._time)o=t._time;e=t,t=t._next}else{n=t._next,t._next=null;t=e?e._next=n:oi=n}}ii=e;yi(o)}function yi(e){if(Qo)return;if(ei)ei=clearTimeout(ei);var t=e-ri;if(t>24){if(e<Infinity)ei=setTimeout(mi,e-li.now()-ai);if(ti)ti=clearInterval(ti)}else{if(!ti)si=li.now(),ti=setInterval(gi,ni);Qo=1,ci(mi)}}function vi(e,t,n){var o=new pi;t=t==null?0:+t;o.restart((n=>{o.stop();e(n+t)}),t,n);return o}var wi=Wo("start","end","cancel","interrupt");var xi=[];var _i=0;var ki=1;var ji=2;var Ni=3;var Si=4;var Ai=5;var Ci=6;function Ei(e,t,n,o,i,s){var r=e.__transition;if(!r)e.__transition={};else if(n in r)return;Ti(e,n,{name:t,index:o,group:i,on:wi,tween:xi,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:_i})}function Oi(e,t){var n=Ii(e,t);if(n.state>_i)throw new Error("too late; already scheduled");return n}function Mi(e,t){var n=Ii(e,t);if(n.state>Ni)throw new Error("too late; already running");return n}function Ii(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ti(e,t,n){var o=e.__transition,i;o[t]=n;n.timer=ui(s,0,n.time);function s(e){n.state=ki;n.timer.restart(r,n.delay,n.time);if(n.delay<=e)r(e-n.delay)}function r(s){var c,d,f,p;if(n.state!==ki)return l();for(c in o){p=o[c];if(p.name!==n.name)continue;if(p.state===Ni)return vi(r);if(p.state===Si){p.state=Ci;p.timer.stop();p.on.call("interrupt",e,e.__data__,p.index,p.group);delete o[c]}else if(+c<t){p.state=Ci;p.timer.stop();p.on.call("cancel",e,e.__data__,p.index,p.group);delete o[c]}}vi((function(){if(n.state===Ni){n.state=Si;n.timer.restart(a,n.delay,n.time);a(s)}}));n.state=ji;n.on.call("start",e,e.__data__,n.index,n.group);if(n.state!==ji)return;n.state=Ni;i=new Array(f=n.tween.length);for(c=0,d=-1;c<f;++c){if(p=n.tween[c].value.call(e,e.__data__,n.index,n.group)){i[++d]=p}}i.length=d+1}function a(t){var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=Ai,1),s=-1,r=i.length;while(++s<r){i[s].call(e,o)}if(n.state===Ai){n.on.call("end",e,e.__data__,n.index,n.group);l()}}function l(){n.state=Ci;n.timer.stop();delete o[t];for(var i in o)return;delete e.__transition}}function Ri(e,t){var n=e.__transition,o,i,s=true,r;if(!n)return;t=t==null?null:t+"";for(r in n){if((o=n[r]).name!==t){s=false;continue}i=o.state>ji&&o.state<Ai;o.state=Ci;o.timer.stop();o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group);delete n[r]}if(s)delete e.__transition}function Li(e){return this.each((function(){Ri(this,e)}))}function $i(e,t){var n,o;return function(){var i=Mi(this,e),s=i.tween;if(s!==n){o=n=s;for(var r=0,a=o.length;r<a;++r){if(o[r].name===t){o=o.slice();o.splice(r,1);break}}}i.tween=o}}function zi(e,t,n){var o,i;if(typeof n!=="function")throw new Error;return function(){var s=Mi(this,e),r=s.tween;if(r!==o){i=(o=r).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l){if(i[l].name===t){i[l]=a;break}}if(l===c)i.push(a)}s.tween=i}}function Pi(e,t){var n=this._id;e+="";if(arguments.length<2){var o=Ii(this.node(),n).tween;for(var i=0,s=o.length,r;i<s;++i){if((r=o[i]).name===e){return r.value}}return null}return this.each((t==null?$i:zi)(n,e,t))}function Di(e,t,n){var o=e._id;e.each((function(){var e=Mi(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}));return function(e){return Ii(e,o).value[t]}}function Ui(e,t){var n;return(typeof t==="number"?Fn:t instanceof Wt?Ln:(n=Wt(t))?(t=n,Ln):Wn)(e,t)}function Bi(e){return function(){this.removeAttribute(e)}}function Fi(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qi(e,t,n){var o,i=n+"",s;return function(){var r=this.getAttribute(e);return r===i?null:r===o?s:s=t(o=r,n)}}function Hi(e,t,n){var o,i=n+"",s;return function(){var r=this.getAttributeNS(e.space,e.local);return r===i?null:r===o?s:s=t(o=r,n)}}function Gi(e,t,n){var o,i,s;return function(){var r,a=n(this),l;if(a==null)return void this.removeAttribute(e);r=this.getAttribute(e);l=a+"";return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function Ji(e,t,n){var o,i,s;return function(){var r,a=n(this),l;if(a==null)return void this.removeAttributeNS(e.space,e.local);r=this.getAttributeNS(e.space,e.local);l=a+"";return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function Vi(e,t){var n=r(e),o=n==="transform"?so:Ui;return this.attrTween(e,typeof t==="function"?(n.local?Ji:Gi)(n,o,Di(this,"attr."+e,t)):t==null?(n.local?Fi:Bi)(n):(n.local?Hi:qi)(n,o,t))}function Wi(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Xi(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yi(e,t){var n,o;function i(){var i=t.apply(this,arguments);if(i!==o)n=(o=i)&&Xi(e,i);return n}i._value=t;return i}function Zi(e,t){var n,o;function i(){var i=t.apply(this,arguments);if(i!==o)n=(o=i)&&Wi(e,i);return n}i._value=t;return i}function Ki(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=="function")throw new Error;var o=r(e);return this.tween(n,(o.local?Yi:Zi)(o,t))}function Qi(e,t){return function(){Oi(this,e).delay=+t.apply(this,arguments)}}function es(e,t){return t=+t,function(){Oi(this,e).delay=t}}function ts(e){var t=this._id;return arguments.length?this.each((typeof e==="function"?Qi:es)(t,e)):Ii(this.node(),t).delay}function ns(e,t){return function(){Mi(this,e).duration=+t.apply(this,arguments)}}function os(e,t){return t=+t,function(){Mi(this,e).duration=t}}function is(e){var t=this._id;return arguments.length?this.each((typeof e==="function"?ns:os)(t,e)):Ii(this.node(),t).duration}function ss(e,t){if(typeof t!=="function")throw new Error;return function(){Mi(this,e).ease=t}}function rs(e){var t=this._id;return arguments.length?this.each(ss(t,e)):Ii(this.node(),t).ease}function as(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=="function")throw new Error;Mi(this,e).ease=n}}function ls(e){if(typeof e!=="function")throw new Error;return this.each(as(this._id,e))}function cs(e){if(typeof e!=="function")e=y(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=[],l,c=0;c<r;++c){if((l=s[c])&&e.call(l,l.__data__,c,s)){a.push(l)}}}return new Ps(o,this._parents,this._name,this._id)}function ds(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,s=Math.min(o,i),r=new Array(o),a=0;a<s;++a){for(var l=t[a],c=n[a],d=l.length,f=r[a]=new Array(d),p,u=0;u<d;++u){if(p=l[u]||c[u]){f[u]=p}}}for(;a<o;++a){r[a]=t[a]}return new Ps(r,this._parents,this._name,this._id)}function fs(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");if(t>=0)e=e.slice(0,t);return!e||e==="start"}))}function ps(e,t,n){var o,i,s=fs(t)?Oi:Mi;return function(){var r=s(this,e),a=r.on;if(a!==o)(i=(o=a).copy()).on(t,n);r.on=i}}function us(e,t){var n=this._id;return arguments.length<2?Ii(this.node(),n).on.on(e):this.each(ps(n,e,t))}function hs(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;if(t)t.removeChild(this)}}function ms(){return this.on("end.remove",hs(this._id))}function gs(e){var t=this._name,n=this._id;if(typeof e!=="function")e=f(e);for(var o=this._groups,i=o.length,s=new Array(i),r=0;r<i;++r){for(var a=o[r],l=a.length,c=s[r]=new Array(l),d,p,u=0;u<l;++u){if((d=a[u])&&(p=e.call(d,d.__data__,u,a))){if("__data__"in d)p.__data__=d.__data__;c[u]=p;Ei(c[u],t,n,u,c,Ii(d,n))}}}return new Ps(s,this._parents,t,n)}function bs(e){var t=this._name,n=this._id;if(typeof e!=="function")e=m(e);for(var o=this._groups,i=o.length,s=[],r=[],a=0;a<i;++a){for(var l=o[a],c=l.length,d,f=0;f<c;++f){if(d=l[f]){for(var p=e.call(d,d.__data__,f,l),u,h=Ii(d,n),g=0,b=p.length;g<b;++g){if(u=p[g]){Ei(u,t,n,g,p,h)}}s.push(p);r.push(d)}}}return new Ps(s,r,t,n)}var ys=tt.prototype.constructor;function vs(){return new ys(this._groups,this._parents)}function ws(e,t){var n,o,i;return function(){var s=le(this,e),r=(this.style.removeProperty(e),le(this,e));return s===r?null:s===n&&r===o?i:i=t(n=s,o=r)}}function xs(e){return function(){this.style.removeProperty(e)}}function _s(e,t,n){var o,i=n+"",s;return function(){var r=le(this,e);return r===i?null:r===o?s:s=t(o=r,n)}}function ks(e,t,n){var o,i,s;return function(){var r=le(this,e),a=n(this),l=a+"";if(a==null)l=a=(this.style.removeProperty(e),le(this,e));return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function js(e,t){var n,o,i,s="style."+t,r="end."+s,a;return function(){var l=Mi(this,e),c=l.on,d=l.value[s]==null?a||(a=xs(t)):undefined;if(c!==n||i!==d)(o=(n=c).copy()).on(r,i=d);l.on=o}}function Ns(e,t,n){var o=(e+="")==="transform"?io:Ui;return t==null?this.styleTween(e,ws(e,o)).on("end.style."+e,xs(e)):typeof t==="function"?this.styleTween(e,ks(e,o,Di(this,"style."+e,t))).each(js(this._id,e)):this.styleTween(e,_s(e,o,t),n).on("end.style."+e,null)}function Ss(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function As(e,t,n){var o,i;function s(){var s=t.apply(this,arguments);if(s!==i)o=(i=s)&&Ss(e,s,n);return o}s._value=t;return s}function Cs(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!=="function")throw new Error;return this.tween(o,As(e,t,n==null?"":n))}function Es(e){return function(){this.textContent=e}}function Os(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Ms(e){return this.tween("text",typeof e==="function"?Os(Di(this,"text",e)):Es(e==null?"":e+""))}function Is(e){return function(t){this.textContent=e.call(this,t)}}function Ts(e){var t,n;function o(){var o=e.apply(this,arguments);if(o!==n)t=(n=o)&&Is(o);return t}o._value=e;return o}function Rs(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=="function")throw new Error;return this.tween(t,Ts(e))}function Ls(){var e=this._name,t=this._id,n=Ds();for(var o=this._groups,i=o.length,s=0;s<i;++s){for(var r=o[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){var d=Ii(l,t);Ei(l,e,n,c,r,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}}}return new Ps(o,this._parents,e,n)}function $s(){var e,t,n=this,o=n._id,i=n.size();return new Promise((function(s,r){var a={value:r},l={value:function(){if(--i===0)s()}};n.each((function(){var n=Mi(this,o),i=n.on;if(i!==e){t=(e=i).copy();t._.cancel.push(a);t._.interrupt.push(a);t._.end.push(l)}n.on=t}));if(i===0)s()}))}var zs=0;function Ps(e,t,n,o){this._groups=e;this._parents=t;this._name=n;this._id=o}function Ds(){return++zs}var Us=tt.prototype;Ps.prototype={constructor:Ps,select:gs,selectAll:bs,selectChild:Us.selectChild,selectChildren:Us.selectChildren,filter:cs,merge:ds,selection:vs,transition:Ls,call:Us.call,nodes:Us.nodes,node:Us.node,size:Us.size,empty:Us.empty,each:Us.each,on:us,attr:Vi,attrTween:Ki,style:Ns,styleTween:Cs,text:Ms,textTween:Rs,remove:ms,tween:Pi,delay:ts,duration:is,ease:rs,easeVarying:ls,end:$s,[Symbol.iterator]:Us[Symbol.iterator]};function Bs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Fs={time:null,delay:0,duration:250,ease:Bs};function qs(e,t){var n;while(!(n=e.__transition)||!(n=n[t])){if(!(e=e.parentNode)){throw new Error(`transition ${t} not found`)}}return n}function Hs(e){var t,n;if(e instanceof Ps){t=e._id,e=e._name}else{t=Ds(),(n=Fs).time=di(),e=e==null?null:e+""}for(var o=this._groups,i=o.length,s=0;s<i;++s){for(var r=o[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){Ei(l,e,t,c,r,n||qs(l,t))}}}return new Ps(o,this._parents,e,t)}tt.prototype.interrupt=Li;tt.prototype.transition=Hs;function Gs(e){var t=0,n=e.children,o=n&&n.length;if(!o)t=1;else while(--o>=0)t+=n[o].value;e.value=t}function Js(){return this.eachAfter(Gs)}function Vs(e,t){let n=-1;for(const o of this){e.call(t,o,++n,this)}return this}function Ws(e,t){var n=this,o=[n],i,s,r=-1;while(n=o.pop()){e.call(t,n,++r,this);if(i=n.children){for(s=i.length-1;s>=0;--s){o.push(i[s])}}}return this}function Xs(e,t){var n=this,o=[n],i=[],s,r,a,l=-1;while(n=o.pop()){i.push(n);if(s=n.children){for(r=0,a=s.length;r<a;++r){o.push(s[r])}}}while(n=i.pop()){e.call(t,n,++l,this)}return this}function Ys(e,t){let n=-1;for(const o of this){if(e.call(t,o,++n,this)){return o}}}function Zs(e){return this.eachAfter((function(t){var n=+e(t.data)||0,o=t.children,i=o&&o.length;while(--i>=0)n+=o[i].value;t.value=n}))}function Ks(e){return this.eachBefore((function(t){if(t.children){t.children.sort(e)}}))}function Qs(e){var t=this,n=er(t,e),o=[t];while(t!==n){t=t.parent;o.push(t)}var i=o.length;while(e!==n){o.splice(i,0,e);e=e.parent}return o}function er(e,t){if(e===t)return e;var n=e.ancestors(),o=t.ancestors(),i=null;e=n.pop();t=o.pop();while(e===t){i=e;e=n.pop();t=o.pop()}return i}function tr(){var e=this,t=[e];while(e=e.parent){t.push(e)}return t}function nr(){return Array.from(this)}function or(){var e=[];this.eachBefore((function(t){if(!t.children){e.push(t)}}));return e}function ir(){var e=this,t=[];e.each((function(n){if(n!==e){t.push({source:n.parent,target:n})}}));return t}function*sr(){var e=this,t,n=[e],o,i,s;do{t=n.reverse(),n=[];while(e=t.pop()){yield e;if(o=e.children){for(i=0,s=o.length;i<s;++i){n.push(o[i])}}}}while(n.length)}function rr(e,t){if(e instanceof Map){e=[undefined,e];if(t===undefined)t=cr}else if(t===undefined){t=lr}var n=new pr(e),o,i=[n],s,r,a,l;while(o=i.pop()){if((r=t(o.data))&&(l=(r=Array.from(r)).length)){o.children=r;for(a=l-1;a>=0;--a){i.push(s=r[a]=new pr(r[a]));s.parent=o;s.depth=o.depth+1}}}return n.eachBefore(fr)}function ar(){return rr(this).eachBefore(dr)}function lr(e){return e.children}function cr(e){return Array.isArray(e)?e[1]:null}function dr(e){if(e.data.value!==undefined)e.value=e.data.value;e.data=e.data.data}function fr(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function pr(e){this.data=e;this.depth=this.height=0;this.parent=null}pr.prototype=rr.prototype={constructor:pr,count:Js,each:Vs,eachAfter:Xs,eachBefore:Ws,find:Ys,sum:Zs,sort:Ks,path:Qs,ancestors:tr,descendants:nr,leaves:or,links:ir,copy:ar,[Symbol.iterator]:sr};function ur(e){return e==null?null:hr(e)}function hr(e){if(typeof e!=="function")throw new Error;return e}var mr={depth:-1},gr={},br={};function yr(e){return e.id}function vr(e){return e.parentId}function wr(){var e=yr,t=vr,n;function o(o){var i=Array.from(o),s=e,r=t,a,l,c,d,f,p,u,h,m=new Map;if(n!=null){const e=i.map(((e,t)=>xr(n(e,t,o))));const t=e.map(_r);const a=new Set(e).add("");for(const n of t){if(!a.has(n)){a.add(n);e.push(n);t.push(_r(n));i.push(br)}}s=(t,n)=>e[n];r=(e,n)=>t[n]}for(c=0,a=i.length;c<a;++c){l=i[c],p=i[c]=new pr(l);if((u=s(l,c,o))!=null&&(u+="")){h=p.id=u;m.set(h,m.has(h)?gr:p)}if((u=r(l,c,o))!=null&&(u+="")){p.parent=u}}for(c=0;c<a;++c){p=i[c];if(u=p.parent){f=m.get(u);if(!f)throw new Error("missing: "+u);if(f===gr)throw new Error("ambiguous: "+u);if(f.children)f.children.push(p);else f.children=[p];p.parent=f}else{if(d)throw new Error("multiple roots");d=p}}if(!d)throw new Error("no root");if(n!=null){while(d.data===br&&d.children.length===1){d=d.children[0],--a}for(let e=i.length-1;e>=0;--e){p=i[e];if(p.data!==br)break;p.data=null}}d.parent=mr;d.eachBefore((function(e){e.depth=e.parent.depth+1;--a})).eachBefore(fr);d.parent=null;if(a>0)throw new Error("cycle");return d}o.id=function(t){return arguments.length?(e=ur(t),o):e};o.parentId=function(e){return arguments.length?(t=ur(e),o):t};o.path=function(e){return arguments.length?(n=ur(e),o):n};return o}function xr(e){e=`${e}`;let t=e.length;if(kr(e,t-1)&&!kr(e,t-2))e=e.slice(0,-1);return e[0]==="/"?e:`/${e}`}function _r(e){let t=e.length;if(t<2)return"";while(--t>1)if(kr(e,t))break;return e.slice(0,t)}function kr(e,t){if(e[t]==="/"){let n=0;while(t>0&&e[--t]==="\\")++n;if((n&1)===0)return true}return false}function jr(e){var t=e.length/6|0,n=new Array(t),o=0;while(o<t)n[o]="#"+e.slice(o*6,++o*6);return n}var Nr=jr("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var Sr=jr("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var Ar=jr("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");ao(Nn(-100,.75,.35),Nn(80,1.5,.8));ao(Nn(260,.75,.35),Nn(80,1.5,.8));var Cr=Nn();function Er(e){if(e<0||e>1)e-=Math.floor(e);var t=Math.abs(e-.5);Cr.h=360*e-100;Cr.s=1.5-1.5*t;Cr.l=.8-.9*t;return Cr+""}function Or(e,t,n){this.k=e;this.x=t;this.y=n}Or.prototype={constructor:Or,scale:function(e){return e===1?this:new Or(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Or(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Mr=new Or(1,0,0);Or.prototype;const Ir=Kt("#8AB1D4").darker();const Tr=Kt("#aaa").darker().darker();const Rr="#4F8053";const Lr="#ce768e";const $r=true;const zr=false;const Pr=1;const Dr=2;const Ur=3;const Br=4;const Fr=5;const qr=6;const Hr=7;const Gr=8;const Jr=9;const Vr=10;const Wr=11;const Xr={[Pr]:"SNV/indel",[Dr]:"Fusion RNA",[Br]:"CNV",[Fr]:"SV",[qr]:"ITD",[Hr]:"Deletion",[Gr]:"N-loss",[Jr]:"C-loss",[Vr]:"LOH",[Ur]:"Gene Expression",[Wr]:"Metabolite Intensity"};const Yr={M:{label:"MISSENSE",color:"#3987CC",dt:Pr,desc:"A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",key:"M"},E:{label:"EXON",color:"#bcbd22",dt:Pr,desc:"A variant in the exon of a non-coding RNA.",key:"E"},F:{label:"FRAMESHIFT",color:"#db3d3d",dt:Pr,desc:"A sequence variant which causes a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three",key:"F"},N:{label:"NONSENSE",color:"#ff7f0e",dt:Pr,desc:"A sequence variant whereby at least one base of a codon is changed, resulting in a premature stop codon, leading to a shortened transcript",key:"N"},S:{label:"SILENT",color:"#2ca02c",dt:Pr,desc:"A sequence variant where there is no resulting change to the encoded amino acid",key:"S"},D:{label:"PROTEINDEL",color:"#7f7f7f",dt:Pr,desc:"An inframe non synonymous variant that deletes bases from the coding sequence",key:"D"},I:{label:"PROTEININS",color:"#8c564b",dt:Pr,desc:"An inframe non synonymous variant that inserts bases into in the coding sequence",key:"I"},ProteinAltering:{label:"PROTEINALTERING",color:"#b3523e",dt:Pr,desc:"An inframe complex change to the coding sequence",key:"ProteinAltering"},P:{label:"SPLICE_REGION",color:"#9467bd",dt:Pr,desc:"A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron",key:"P"},L:{label:"SPLICE",color:"#6633FF",dt:Pr,desc:"A variant near an exon edge that may affect splicing functionality",key:"L"},Intron:{label:"INTRON",color:"#656565",dt:Pr,desc:"An intronic variant.",key:"Intron"},Blank:{label:"Not tested",color:"#fff",dt:Pr,desc:"This gene is not tested.",key:"Blank"},WT:{label:"Wildtype",color:"#D3D3D3",dt:Pr,desc:"Wildtype",key:"WT"}};const Zr="ITD";Yr[Zr]={label:"ITD",color:"#ff70ff",dt:qr,desc:"In-frame internal tandem duplication.",key:Zr};const Kr="DEL";Yr[Kr]={label:"DELETION, intragenic",color:"#858585",dt:Hr,desc:"Intragenic deletion.",key:Kr};const Qr="NLOSS";Yr[Qr]={label:"N-terminus loss",color:"#545454",dt:Gr,desc:"N-terminus loss due to translocation",key:Qr};const ea="CLOSS";Yr[ea]={label:"C-terminus loss",color:"#545454",dt:Jr,desc:"C-terminus loss due to translocation",key:ea};const ta="Utr3";Yr[ta]={label:"UTR_3",color:"#998199",dt:Pr,desc:"A variant in the 3' untranslated region.",key:ta};const na="Utr5";Yr[na]={label:"UTR_5",color:"#819981",dt:Pr,desc:"A variant in the 5' untranslated region.",key:na};const oa="X";Yr[oa]={label:"NONSTANDARD",color:"black",dt:Pr,desc:"A mutation class that either does not match our notation, or is unspecified.",key:oa};const ia="noncoding";Yr[ia]={label:"NONCODING",color:"black",dt:Pr,desc:"Noncoding mutation.",key:ia};function sa(e){switch(e.toLowerCase()){case"missense_mutation":return"M";case"nonsense_mutation":return"N";case"splice_site":return"L";case"rna":return ia;case"frame_shift_del":return"F";case"frame_shift_ins":return"F";case"in_frame_del":return"D";case"in_frame_ins":return"I";case"protein_altering_variant":return"ProteinAltering";case"translation_start_site":return oa;case"nonstop_mutation":return"N";case"3'utr":return ta;case"3'flank":return ia;case"5'utr":return na;case"5'flank":return ia;case"blank":return"Blank";default:return null}}const ra="Fuserna";Yr[ra]={label:"Fusion transcript",color:"#545454",dt:Dr,desc:"Marks the break points leading to fusion transcripts.<br>"+"<span style=\"font-size:150%\">◐</span> - 3' end of the break point is fused to the 5' end of another break point in a different gene.<br>"+"<span style=\"font-size:150%\">◑</span> - 5' end of the break point is fused to the 3' end of another break point in a different gene.",key:ra};const aa="SV";Yr[aa]={label:"Structural variation",color:"#858585",dt:Fr,desc:"Structural variation detected in genomic DNA.",key:aa};const la="CNV_amp";Yr[la]={label:"Copy number gain",color:"#e9a3c9",dt:Br,desc:"Copy number gain",key:la};const ca="CNV_loss";Yr[ca]={label:"Copy number loss",color:"#a1d76a",dt:Br,desc:"Copy number loss",key:ca};const da="CNV_loh";Yr[da]={label:"LOH",color:"#12EDFC",dt:Br,desc:"Loss of heterozygosity",key:da};const fa="snv";Yr[fa]={label:"SNV",color:"#92a2d4",dt:Pr,desc:"Single nucleotide variation",key:fa};const pa="mnv";Yr[pa]={label:"MNV",color:"#92a2d4",dt:Pr,desc:"Multiple nucleotide variation",key:pa};const ua="insertion";Yr[ua]={label:"Sequence insertion",color:"#bd8e91",dt:Pr,desc:"Sequence insertion",key:ua};const ha="deletion";Yr[ha]={label:"Sequence deletion",color:"#b5a174",dt:Pr,desc:"Sequence deletion",key:ha};const ma={[Pr]:Yr.M.color};function ga(e={}){if(e.mclass){for(const t in e.mclass){if(!Yr[t])Yr[t]={};for(const n in e.mclass[t]){Yr[t][n]=e.mclass[t][n]}}}}const ba=function(e){const t=e.toLowerCase().split(",");let n=1;if(t.indexOf("transcript_ablation")!=-1){return[Hr,Kr,n]}n++;if(t.indexOf("splice_acceptor_variant")!=-1)return[Pr,"L",n];n++;if(t.indexOf("splice_donor_variant")!=-1)return[Pr,"L",n];n++;if(t.indexOf("stop_gained")!=-1)return[Pr,"N",n];n++;if(t.indexOf("frameshift_variant")!=-1)return[Pr,"F",n];n++;if(t.indexOf("stop_lost")!=-1)return[Pr,"N",n];n++;if(t.indexOf("start_lost")!=-1)return[Pr,"N",n];n++;if(t.indexOf("transcript_amplification")!=-1){return[Pr,oa,n]}n++;if(t.indexOf("inframe_insertion")!=-1||t.indexOf("conservative_inframe_insertion")!=-1||t.indexOf("disruptive_inframe_insertion")!=-1)return[Pr,"I",n];n++;if(t.indexOf("inframe_deletion")!=-1||t.indexOf("conservative_inframe_deletion")!=-1||t.indexOf("disruptive_inframe_deletion")!=-1)return[Pr,"D",n];n++;if(t.indexOf("missense_variant")!=-1)return[Pr,"M",n];n++;if(t.indexOf("protein_altering_variant")!=-1)return[Pr,"ProteinAltering",n];n++;if(t.indexOf("splice_region_variant")!=-1)return[Pr,"P",n];n++;if(t.indexOf("incomplete_terminal_codon_variant")!=-1)return[Pr,"N",n];n++;if(t.indexOf("stop_retained_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("synonymous_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("coding_sequence_variant")!=-1)return[Pr,oa,n];n++;if(t.indexOf("mature_mirna_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("5_prime_utr_variant")!=-1)return[Pr,na,n];n++;if(t.indexOf("3_prime_utr_variant")!=-1)return[Pr,ta,n];n++;if(t.indexOf("non_coding_transcript_exon_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("intron_variant")!=-1)return[Pr,"Intron",n];n++;if(t.indexOf("nmd_transcript_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("non_coding_transcript_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("upstream_gene_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("downstream_gene_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tfbs_ablation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tfbs_amplification")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tf_binding_site_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_ablation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_amplification")!=-1)return[Pr,ia,n];n++;if(t.indexOf("feature_elongation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("feature_truncation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("intergenic_variant")!=-1)return[Pr,ia,n];n++;return[Pr,oa,n]};const ya='<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="#858585" stroke="none"></path>';const va={};const wa="S";va[wa]={label:"Somatic",desc:"A variant found only in a tumor sample. The proportion is indicated by lack of any arc.",legend:'<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>'};const xa="G";va[xa]={label:"Germline",desc:"A constitutional variant found in a normal sample. The proportion is indicated by the span of the solid arc within the whole circle.",legend:ya};va.germline=va[xa];va.somatic=va[wa];const _a="R";va[_a]={label:"Relapse",desc:"A somatic variant found only in a relapse sample. The proportion is indicated by the span of the hollow arc within the whole circle.",legend:'<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="none" stroke="#858585"></path>'};const ka="GP";va[ka]={label:"Germline pathogenic",desc:"A constitutional variant with pathogenic allele.",legend:ya};const ja="GNP";va[ja]={label:"Germline non-pathogenic",desc:"A constitutional variant with non-pathogenic allele.",legend:ya,hidden:true};const Na={usegm:"usegm",ds:"dataset",bigwig:"bigwig",bigwigstranded:"bigwigstranded",junction:"junction",mdsjunction:"mdsjunction",mdscnv:"mdscnv",mdssvcnv:"mdssvcnv",mdsexpressionrank:"mdsexpressionrank",mdsvcf:"mdsvcf",bedj:"bedj",pgv:"profilegenevalue",bampile:"bampile",hicstraw:"hicstraw",expressionrank:"expressionrank",aicheck:"aicheck",ase:"ase",mds2:"mds2",mds3:"mds3",bedgraphdot:"bedgraphdot",bam:"bam",ld:"ld"};function Sa(e){for(const t in Na){if(e==Na[t]){return true}}return false}const Aa={vcf:"vcf"};const Ca={vcf:"vcf",svcnvitd:"svcnvitd",geneexpression:"geneexpression"};const Ea={GCT:"A",GCC:"A",GCA:"A",GCG:"A",CGT:"R",CGC:"R",CGA:"R",CGG:"R",AGA:"R",AGG:"R",AAT:"N",AAC:"N",GAT:"D",GAC:"D",TGT:"C",TGC:"C",CAA:"Q",CAG:"Q",GAA:"E",GAG:"E",GGT:"G",GGC:"G",GGA:"G",GGG:"G",CAT:"H",CAC:"H",ATT:"I",ATC:"I",ATA:"I",TTA:"L",TTG:"L",CTT:"L",CTC:"L",CTA:"L",CTG:"L",AAA:"K",AAG:"K",ATG:"M",TTT:"F",TTC:"F",CCT:"P",CCC:"P",CCA:"P",CCG:"P",TCT:"S",TCC:"S",TCA:"S",TCG:"S",AGT:"S",AGC:"S",ACT:"T",ACC:"T",ACA:"T",ACG:"T",TGG:"W",TAT:"Y",TAC:"Y",GTT:"V",GTC:"V",GTA:"V",GTG:"V"};const Oa="*";function Ma(e){if(!e.genomicseq)return undefined;const t=[];if(e.coding){for(const[n,o]of e.coding.entries()){const n=e.genomicseq.substr(o[0]-e.start,o[1]-o[0]);if(e.strand=="-"){t.push(La(n))}else{t.push(n)}}}const n=t.join("");const o=[];const i=e.startCodonFrame?3-e.startCodonFrame:0;for(let e=i;e<n.length;e+=3){const t=Ea[n.substr(e,3)];o.push(t||Oa)}e.cdseq=n;return o.join("")}function Ia(e,t){if(e>=1e9)return(e/1e9).toFixed(1)+" Gb";if(e>=1e7)return Math.ceil(e/1e6)+" Mb";if(e>=1e6)return(e/1e6).toFixed(1)+" Mb";if(e>=1e4)return Math.ceil(e/1e3)+" Kb";if(e>=1e3)return(e/1e3).toFixed(1)+" Kb";return e+(t?"bytes":" bp")}const Ta={A:"#ca0020",T:"#f4a582",C:"#92c5de",G:"#0571b0"};function Ra(e){switch(e){case"A":return"T";case"T":return"A";case"C":return"G";case"G":return"C";case"a":return"t";case"t":return"a";case"c":return"g";case"g":return"c";default:return e}}function La(e){const t=[];for(let n=e.length-1;n>=0;n--){t.push(Ra(e[n]))}return t.join("")}function $a(e,t){const n={chr:e.chr,start:e.start,stop:e.stop,strand:e.strand,coding:[]};if(t.isskipexon||t.isaltexon){for(let o=0;o<e.exon.length;o++){const i=Math.max(e.codingstart,e.exon[o][0]);const s=Math.min(e.codingstop,e.exon[o][1]);if(i>s){continue}if(t.skippedexon.indexOf(o)==-1){n.coding.push([i,s])}}}else if(t.a5ss||t.a3ss){const o=e.exon.map((e=>[e[0],e[1]]));const i=e.strand=="+";if(t.a5ss){if(i){o[t.exon5idx][1]=t.junctionB.start}else{o[t.exon5idx+1][0]=t.junctionB.stop}}else{if(i){o[t.exon5idx+1][0]=t.junctionB.stop}else{o[t.exon5idx][1]=t.junctionB.start}}for(const t of o){const o=Math.max(e.codingstart,t[0]);const i=Math.min(e.codingstop,t[1]);if(o>i){continue}n.coding.push([o,i])}}return n}function za(e,t){const n=t.split("\n");n.shift();e.genomicseq=n.join("").toUpperCase();const o=Ma(e);let i=zr;const s=o.indexOf(Oa);if(s==o.length-1){i=$r}return i}function Pa(e){if(!e.lst)return".lst missing";if(!Array.isArray(e.lst))return"input is not an array";for(const t of e.lst){if(!t.name)return"name missing from a set of .vcfinfofilter.lst";if(t.autocategory||t.categories){if(!t.autocategory){for(const e in t.categories){const n=t.categories[e];if(!t.autocolor&&!n.color)return".color missing for class "+e+" from .categories of set "+t.name;if(!n.label){n.label=e}}}if(t.categoryhidden){for(const e in t.categoryhidden){if(!t.categories[e])return"unknown hidden-by-default category "+e+" from set "+t.name}}else{t.categoryhidden={}}}else if(t.numericfilter){const e=[];for(const n of t.numericfilter){if(typeof n=="number"){e.push({side:"<",value:n})}else{e.push({side:n.side||"<",value:n.value})}}t.numericfilter=e}if(t.altalleleinfo){if(!t.altalleleinfo.key){return".key missing from .altalleleinfo from set "+t.name}}else if(t.locusinfo){if(!t.locusinfo.key){return".key missing from .locusinfo from set "+t.name}}else{return"neither .altalleleinfo or .locusinfo is available from set "+t.name}}}function Da(e,t){for(const n in e.majorchr){if(t.indexOf(n.replace("chr",""))!=-1){return true}}if(e.minorchr){for(const n in e.minorchr){if(t.indexOf(n.replace("chr",""))!=-1){return true}}}return false}function Ua(e,t){let n=0,o=0;for(const i in e.majorchr){if(t.includes(i)){o++}else if(t.includes(i.replace("chr",""))){n++}}if(e.minorchr){for(const i in e.minorchr){if(t.includes(i)){o++}else if(t.includes(i.replace("chr",""))){n++}}}return[n,o]}function Ba(e,t){if(e.length==0)return t;e.sort(((e,t)=>e-t));const n=e[e.length-1];if(e.length<=5)return n;const o=e[Math.floor(e.length/4)];const i=e[Math.floor(e.length*3/4)];return Math.min(i+(i-o)*1.5,n)}function Fa(e,t){if(!e)return false;if(e.indexOf("/")!=-1){return e.split("/").indexOf(t)!=-1}return e.split("|").indexOf(t)!=-1}const qa={genomic:"genomic",splicingrna:"splicing RNA",exononly:"exon only",protein:"protein",gmsum:"aggregated exons"};function Ha(e,t){if(e.csq){let n;if(t.usegm){n=e.csq.find((e=>e._isoform==t.usegm.isoform))}if(!n){n=e.csq.find((e=>e.CANONICAL));if(!n){n=e.csq[0];for(const t of e.csq){if(t._csqrank<n._csqrank){n=t}}}}if(n){e.gene=n._gene;e.isoform=n._isoform;e.class=n._class;e.dt=n._dt;e.mname=n._mname;if(e.class==ia){delete e.class}}}else if(e.ann){let n=null;if(t.usegm){for(const o of e.ann){if(o._isoform!=t.usegm.isoform)continue;if(n){if(o._csqrank<n._csqrank){n=o}}else{n=o}}if(!n&&t.gmmode==qa.genomic){n=e.ann[0]}}else{n=e.ann[0];for(const t of e.ann){if(t._csqrank<n._csqrank){n=t}}}if(n){e.gene=n._gene;e.isoform=n._isoform;e.class=n._class;e.dt=n._dt;e.mname=n._mname;if(e.class==ia){delete e.class}}}if(e.class==undefined){if(Yr[e.type]){e.class=e.type;e.dt=Yr[e.type].dt;e.mname=e.id&&e.id!="."?e.id:e.ref+">"+e.alt;if(e.mname.length>15){e.mname=e.type}}else{e.class=oa;e.dt=Pr;e.mname=e.type}}delete e.type}const Ga="Unannotated";function Ja(e,t){return function(n){return t.map((t=>[t,n.map((n=>e(t-n))).reduce(((e,t)=>e+t),0)/n.length]))}}function Va(e){return function(t){return Math.abs(t/=e)<=1?.75*(1-t*t)/e:0}}const Wa=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];const Xa=["#e75480","blue"];function Ya(e){if(e>20){const t=[];for(let n=0;n<e;n++)t.push(Er(n/e));return t}if(e>12)return Wa;else if(e>8)return Ar;else if(e>2)return Sr;else return Xa}function Za(e){const t=Ya(e);return At(t)}const Ka=["F","N","L","P"];const Qa=["F","N","L","P","D","I","ProteinAltering","M"];const el=["S","Intron","Utr3","Utr5","noncoding","E"];const tl=Object.values(Yr).filter((e=>e.dt==Pr)).map((e=>e.key));const nl=Object.values(Yr).filter((e=>e.dt==Br)).map((e=>e.key));var ol=Object.freeze({__proto__:null,defaultcolor:Ir,default_text_color:Tr,exoncolor:Rr,plotColor:Lr,IN_frame:$r,OUT_frame:zr,dtsnvindel:Pr,dtfusionrna:Dr,dtgeneexpression:Ur,dtcnv:Br,dtsv:Fr,dtitd:qr,dtdel:Hr,dtnloss:Gr,dtcloss:Jr,dtloh:Vr,dtmetaboliteintensity:Wr,dt2label:Xr,mclass:Yr,mclassitd:Zr,mclassdel:Kr,mclassnloss:Qr,mclasscloss:ea,mclassutr3:ta,mclassutr5:na,mclassnonstandard:oa,mclassnoncoding:ia,mclasstester:sa,mclassfusionrna:ra,mclasssv:aa,mclasscnvgain:la,mclasscnvloss:ca,mclasscnvloh:da,mclasssnv:fa,mclassmnv:pa,mclassinsertion:ua,mclassdeletion:ha,dt2color:ma,applyOverrides:ga,vepinfo:ba,germlinelegend:ya,morigin:va,moriginsomatic:wa,morigingermline:xa,moriginrelapse:_a,morigingermlinepathogenic:ka,morigingermlinenonpathogenic:ja,tkt:Na,validtkt:Sa,mdsvcftype:Aa,custommdstktype:Ca,codon:Ea,codon_stop:Oa,nt2aa:Ma,bplen:Ia,basecolor:Ta,basecompliment:Ra,reversecompliment:La,spliceeventchangegmexon:$a,fasta2gmframecheck:za,validate_vcfinfofilter:Pa,contigNameNoChr:Da,contigNameNoChr2:Ua,getMax_byiqr:Ba,alleleInGenotypeStr:Fa,gmmode:qa,vcfcopymclass:Ha,not_annotated:Ga,kernelDensityEstimator:Ja,kernelEpanechnikov:Va,schemeCategory20:Wa,schemeCategory2:Xa,getColorScheme:Ya,getColors:Za,truncatingMutations:Ka,proteinChangingMutations:Qa,synonymousMutations:el,mutationClasses:tl,CNVClasses:nl});let il=100;function sl(){return il}function rl(e){il=e}function al(e){return t=>{const n=new e(t);if(!n.api&&n.type){if(n.type=="app")bl(n,t);else if(n.type=="store")hl(n,t);else vl(n,t)}const o=n.api||n;if(n.debug||n.opts&&n.opts.debug)o.Inner=n;if(typeof n.preApiFreeze=="function")n.preApiFreeze(o);Object.freeze(o);if(n.init){return n.init().then((()=>{if(n.bus)n.bus.emit("postInit");return o})).catch((e=>{if(n.printError)n.printError(e);if(n.bus)n.bus.emit("postInit",null,0,e);else throw e}))}else{if(n.bus)n.bus.emit("postInit");return o}}}function ll(e){return fl(e,bl)}function cl(e){return fl(e,hl)}function dl(e){return fl(e,vl)}function fl(e,t){if(typeof t!="function")throw"prepFxn must be a function";return async n=>{let o;try{o=new e(n);t(o,n);const i=o.api||o;if(o.debug||o.opts&&o.opts.debug)i.Inner=o;if(o.preApiFreeze)await o.preApiFreeze(i);Object.freeze(i);if(o.init){if(o.app&&o.app!=o)await o.init(o.app.getState());else await o.init();if(o.type!="app"&&o.type!="store"&&o.state&&!o.hasStatePreMain){delete o.state;console.warn(`${o.type}: rx deleted this.state after init()`+`to avoid confusing behavior, such as the component not rendering initially `+`because this.state would not have changed between init() and the first time `+`main() is called. To skip this warning and retain this.state after init(), `+`set this.hasStatePreMain = true in the ${o.type} constructor.`)}}if(o.bus)o.bus.emit("postInit");return i}catch(e){console.log("error:",e);if(o&&o.bus)o.bus.emit("postInit",null,0,e);if(!o||!o.printError)throw e}}}function pl(e,t){const n=Object.assign({},t.opts||{},e);if(!t.app)return n;if(t.type in t.app.opts){const e=t.app.opts[t.type];if(t.validateOpts)t.validateOpts(e);jl(n,e)}if("debug"in t.app)n.debug=t.app.debug;else if(t.app.opts&&"debug"in t.app.opts)n.debug=t.app.opts.debug;return n}async function ul(e){const t={};try{await Promise.all(Object.values(e));for(const n in e){t[n]=await e[n]}return t}catch(e){throw e}}function hl(e,t){if(e.validateOpts)e.validateOpts(t);e.app=t.app;e.opts=pl(t,e);e.api=gl(e);e.copyMerge=jl;e.deepFreeze=Al;if(!e.fromJson)e.fromJson=Nl;if(!e.toJson)e.toJson=Sl;e.state=jl(e.toJson(e.defaultState),t.state);if(e.validateState)e.validateState()}let ml=0;function gl(e){e.history=[];e.currIndex=-1;let t=0;const n={async write(o){o.sequenceId=ml++;const i=e.constructor.prototype.actions;if(!i){throw`no store actions specified`}if(!i.hasOwnProperty(o.type)){throw`Action=${o.type} must be declared in an "actions" property of a class.`}if(typeof i[o.type]!=="function"){throw`invalid action type=${o.type}`}await i[o.type].call(e,o);e.state._scope_=o._scope_;if(!e.opts.debounceInterval)return n.copyState();t+=1;let s=-1;return new Promise(((o,i)=>{const r=setInterval((()=>{t+=s;s=0;if(t>0)return;clearInterval(r);o(n.copyState())}),e.opts.debounceInterval)}))},async copyState(){const t=e.fromJson(e.toJson(e.state));e.deepFreeze(t);return t}};return n}function bl(e,t){try{if(e.validateOpts)e.validateOpts(t);if("id"in t)e.id=t[e.type].id;e.opts=t;e.api=yl(e)}catch(t){console.error(t);if(e.printError)e.printError(t);else alert(t)}}function yl(e){const t={};const n=[];let o;const i={type:e.type,opts:e.opts,async dispatch(t){e.bus.emit("preDispatch");try{if(n.length){for(const e of n.slice()){const o=await e(t);if(o){if(o.cancel)return;if(o.error)throw o.error;if(o.deactivate){n.splice(n.indexOf(e),1)}}}}if(t)e.state=await e.store.write(t);o=t?.sequenceId;if(e.main)await e.main();const i={action:t,appState:e.state};await _l(i.action?._notificationRoot_||e.components,i)}catch(n){if(e.bus&&o==t?.sequenceId)e.bus.emit("error");if(e.printError)e.printError(n);else console.log(n)}if(e.bus&&o==t?.sequenceId)e.bus.emit("postRender")},async save(n){e.state=await e.store.write(n);if(t.recover){for(const n in t.recover){const o=t.recover[n];o.replaceLastState(e.state)}}},getState(){return e.state},middle(e){if(typeof e!=="function")throw`a middleware must be a function`;if(n.includes(e))throw`the function is already in the middlewares array`;n.push(e);return i},on(t,n){if(!e.eventTypes)throw`no eventTypes[] for ${e.type} component`;e.bus.on(t,n);return i},getComponents(t=""){return kl(e.components,t)},register(e){if(!t[e.type])t[e.type]={};t[e.type][e.id]=e},deregister(e){if(t[e.type]?.[e.id])delete t[e.type][e.id]},destroy(){for(const t in e.components){const n=e.components[t];if(typeof n.destroy=="function"){n.destroy()}else if(n.holder){n.holder.selectAll("*").remove()}delete e.components[t]}if(typeof e.destroy=="function")e.destroy();if(e.dom){if(e.dom.holder)e.dom.holder.selectAll("*").remove();for(const t in e.dom){delete e.dom[t]}}if(e.bus)e.bus.destroy();delete e.store;if(e.api)delete e.api;e.wasDestroyed=true}};if(e.opts.debugName)window[e.opts.debugName]=i;if(!e.bus){if(!e.eventTypes)e.eventTypes=["preDispatch","postInit","postRender","firstRender","error"];if(e.customEvents)e.eventTypes.push(...e.customEvents);const t=e.opts.app&&e.opts.app.callbacks||e.opts.callbacks||{};e.bus=new xl(i,e.eventTypes,t)}return i}function vl(e,t){if(!t.app)throw`missing self.opts.app in prepComponent(${e.type})`;e.app=t.app;e.opts=pl(t,e);if(e.validateOpts)e.validateOpts(t);if("id"in t)e.id=e.opts.id;e.api=wl(e)}function wl(e){if(!("type"in e)){throw`The component's type must be set before calling this.getComponentApi(this).`}let t;const n={type:e.type,id:e.id,async update(o){if(o.action&&e.reactsTo&&!e.reactsTo(o.action))return;const i=e.getState?e.getState(o.appState):o.appState;if(!i)return;if(!o.action||!Cl(i,e.state)){if(o.action)t=o.action.sequenceId;if(e.mainArg=="state"){await e.main(i)}else{e.state=i;if(e.main){try{await e.main()}catch(t){if(e.bus)e.bus.emit("error");throw t}}}}await _l(e.components,o);if(e.bus&&(!o.action||o.action.sequenceId===t))e.bus.emit("postRender");return n},on(t,o){if(!e.eventTypes)throw`no eventTypes[] for ${e.type} component`;e.bus.on(t,o);return n},getComponents(t=""){return kl(e.components,t)},async detectStale(e,n={}){try{const o=t;const i=[];let s,r;if(n.abortCtrl){i.push(new Promise(((e,i)=>{r=e;s=setInterval((()=>{if(o!==t){clearInterval(s);try{n.abortCtrl.abort();throw`stale sequenceId`}catch(e){i(e)}}}),n.wait||100)})))}i.push(e());const a=await Promise.race(i);if(s)clearInterval(s);if(r)r();if(t!==o){console.warn("aborted state update, the returned data corresponds to a stale action.sequenceId");if(n.abortCtrl)n.abortCtrl.abort();return[a,true]}return[a]}catch(e){if(typeof e=="string"&&e.includes("sequenceId"))console.warn(e);throw e}},destroy(){e.app.deregister(e.api);for(const t in e.components){const n=e.components[t];if(typeof n.destroy=="function"){n.destroy()}else if(n.holder){n.holder.selectAll("*").remove()}delete e.components[t]}if(typeof e.destroy=="function")e.destroy();if(e.dom){if(e.dom.holder)e.dom.holder.selectAll("*").remove();for(const t in e.dom){if(typeof e.dom[t]?.remove=="function")e.dom[t].remove();delete e.dom[t]}}if(e.bus)e.bus.destroy();if(e.api)delete e.api}};if(!e.bus){if(!e.eventTypes)e.eventTypes=["postInit","postRender","postPrintError","firstRender","error"];if(e.customEvents)e.eventTypes.push(...e.customEvents);e.bus=new xl(n,e.eventTypes,e.opts&&e.opts.callbacks||{})}return n}class xl{constructor(e,t,n){this.name=e.type+(e.id===undefined||e.id===null?"":"#"+e.id);this.eventTypes=t;this.events={};this.defaultArg=e;if(n){for(const e in n){this.on(e,n[e])}}}on(e,t,n={}){const[o,i]=e.split(".");if(!this.eventTypes.includes(o)){throw`Unknown bus event '${o}' for component ${this.name}`}else if(!t){delete this.events[e]}else if(typeof t=="function"){if(e in this.events&&!e.includes(".")){console.log(`Warning: replacing ${this.name} ${e} callback - use event.name?`)}this.events[e]=n.wait?e=>setTimeout((()=>t(e)),n.wait):t}else{throw`invalid callback for ${this.name} eventType=${e}`}return this}emit(e,t=null,n=0,o=null){setTimeout((()=>{for(const n in this.events){if(e=="postRender"&&n.startsWith("firstRender")){this.events[n](t||this.defaultArg,o);delete this.events[n]}if(n==e||n.startsWith(e+".")){this.events[n](t||this.defaultArg,o);if(e=="postInit")delete this.events[n]}}}),n);return this}destroy(){for(const e in this.events){delete this.events[e]}}}async function _l(e,t){if(!e)return;const n=[];for(const o in e){const i=e[o];if(Array.isArray(i)){for(const e of i)n.push(e.update(t))}else if(i.hasOwnProperty("update")){n.push(i.update(t))}else if(i&&typeof i=="object"&&!i.main){for(const e in i){if(i.hasOwnProperty(e)&&typeof i[e].update=="function"){n.push(i[e].update(t))}}}}return Promise.all(n)}function kl(e,t){if(!t)return Object.assign({},e);const n=t.split(".");let o=e;while(n.length){let e=n.shift();if(Array.isArray(o))e=Number(e);if(!n.length)o=o[e];else if(o[e]&&o[e].components)o=o[e].components;else if(o[e]&&o[e].getComponents)o=o[e].getComponents();else o=o[e];if(!o)break}return o}function jl(e,...t){const n=typeof e=="string"?Nl(e):e;for(const o of t){if(o){const t=typeof e=="string"?Nl(Sl(o)):o;for(const e in t){if(!n[e]||Array.isArray(n[e])||typeof n[e]!=="object"||t===null||t===undefined||t.isAtomic||n?.isAtomic||n[e]?.isAtomic)n[e]=t[e];else jl(n[e],t[e])}}}return n}function Nl(e){return JSON.parse(e)}function Sl(e=null){return JSON.stringify(e?e:this.state)}function Al(e){Object.freeze(e);for(const t in e){if(typeof e=="object")Al(e[t])}}function Cl(e,t){if(e===t){return true}else if(typeof e=="object"&&e!=null&&typeof t=="object"&&t!=null){if(Object.keys(e).length!=Object.keys(t).length){return false}for(var n in e){if(t.hasOwnProperty(n)){if(!Cl(e[n],t[n]))return false}else{return false}}return true}else return false}const El=["false","true","null","undefined"];const Ol=['"',"{","["];function Ml(e){const t=[];for(const[n,o]of Object.entries(e)){if(typeof o=="string"&&!Il(o)&&!El.includes(o)&&!Ol.includes(o[0])){t.push(`${n}=${encodeURIComponent(o)}`)}else if(o!==undefined){t.push(`${n}=${encodeURIComponent(JSON.stringify(o))}`)}}return t.join("&")}function Il(e){return!isNaN(parseFloat(e))&&isFinite(e)&&e!==""}const Tl=localStorage.getItem("jwtByDsRoute")||`{}`;const Rl=JSON.parse(Tl);function Ll(e,t,n=null){if(n&&typeof n=="object"){if(n.serverData&&typeof n.serverData=="object"){if(!Ll.serverData){Ll.serverData=n.serverData}else if(!n.serverData){n.serverData=Ll.serverData}}return Pl(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)},n)}else{if(e[0]=="/"){e=e.slice(1)}const n=sessionStorage.getItem("jwt");if(n){t.jwt=n}let o=e;const i=sessionStorage.getItem("hostURL")||window.testHost||"";if(i){if(i.endsWith("/")){o=i+e}else{o=i+"/"+e}}return fetch(new Request(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).then((e=>e.json()))}}const $l=[];const zl=360;function Pl(e,t={},n={}){if(e[0]=="/"){e=e.slice(1)}let o=e;const i=sessionStorage.getItem("hostURL")||window.testHost||"";if(i){if(i.endsWith("/")){o=i+e}else{o=i+"/"+e}}const s=t.body||{};o=ql(o,t);if(!t.headers){t.headers={}}if(!t.headers["content-type"]&&t.body){t.headers["content-type"]="application/json"}const r=sessionStorage.getItem("jwt");if(r){t.headers.authorization="Bearer "+r}return Zl(t,o).then((async()=>{if(!r)Ql(t,s,o);const e=o+" | "+t.method+" | "+t.body;if(n.serverData){let i;if(n.serverData[e]){i=n.serverData[e].clone?await Dl(n.serverData[e].clone()):structuredClone(n.serverData[e])}if(!i||typeof i!="object"||i instanceof Promise){delete n.serverData[e];i=undefined}if(!i){try{const s=await fetch(o,t);i=await Dl(s.clone());if(typeof i=="object"&&!(i instanceof Promise)){if(n.cacheAs=="decoded"){Al(i);n.serverData[e]=i;i=structuredClone(i)}else{n.serverData[e]=s}}}catch(t){delete n.serverData[e];throw t}}const s=$l.indexOf(e);if(s!==-1)$l.splice(s,1);$l.unshift(e);if($l.length>zl){const e=$l.pop();delete n.serverData[e]}return i}else{return fetch(o,t).then(Dl)}}))}function Dl(e){const t=e.headers.get("content-type");if(!t)throw`missing response.header['content-type']`;if(t.includes("/json")){return e.json()}if(t.includes("/text")){return e.text()}return e.blob()}const Ul={};function Bl(e,t={},n={}){n.serverData=Ul;return Pl(e,t,n)}const Fl=2e3;function ql(e,t){const n=window.location.hostname;const o=t.method&&t.method.toUpperCase()||"GET";if(o=="POST"){if(typeof t.body=="string")t.body=JSON.parse(t.body);if(!t.body.embedder&&Wl)t.body.embedder=n;t.body=JSON.stringify(t.body);return e}if(o!="GET"&&o!="DELETE"){throw`unsupported init.method='${o}': must be undefined or GET or POST or DELETE`}if(t.body){if(!t.body.embedder&&Wl)t.body.embedder=n;const o=Ml(t.body);if(!e.includes("?"))e+="?";e+=o}if(!e.includes("embedder=")&&Wl){const t=e.includes("?")?"&":"?";e+=`${t}embedder=${n}`}if(e.length<Fl){if(t.body)delete t.body;return e}t.method="POST";const[i,s]=e.split("?");if(t.body){t.body=JSON.stringify(t.body)}else{const e={};if(s)s.split("&").forEach((t=>{const[n,o]=t.split("=");const i=decodeURIComponent(o);try{e[n]=JSON.parse(i)}catch{e[n]=i}}));if(!e.embedder&&Wl)e.embedder=n;t.body=JSON.stringify(e)}return i}const Hl=new Set;let Gl,Jl,Vl,Wl=false;function Xl(e){Gl=e.dsAuth;Jl=e.ui||Kl;Vl=e.holder||ot("body");for(const e of Gl){if(e.insession)Hl.add(e)}Wl=e.dsAuth?.length>0||false}function Yl(e,t){return e&&[...Hl].find((n=>n.dslabel==e&&n.route==t))}async function Zl(e,t){const n={status:"ok"};if(!Gl)return n;for(const o of Gl){const i=JSON.parse(e.body||`{}`);const s=(t.split("?")[1]||"").split("&").reduce(((e,t)=>{const[n,o]=t.split("=");e[n]=o;return e}),{});const r=Object.assign({},i,s);const a=((t.split("?")[0]||"").split("//")[1]||"").split("/").slice(1).join("/");if(r.dslabel==o.dslabel&&(o.route=="/**"||a==o.route)){if(Hl.has(o))return n;else if(o.route!="/**")return n;else if(o.type=="basic")return await Jl(o.dslabel,o);else if(o.type=="jwt");else if(o.type=="forbidden"){alert("Forbidden access")}else throw`unsupported dsAuth type='${o.type}'`}}return n}async function Kl(e,t){const n=Vl.append("div").style("position","fixed").style("top",0).style("left",0).style("height","100%").style("width","100%").style("margin",0).style("padding","20px").style("background-color","rgb(150,150,150)");const o=n.append("div").style("opacity",1);o.append("div").html(`Restricted dataset '${e}'`);o.append("span").html("Please enter password ");const i=o.append("input").attr("type","password");i.node().focus();const s=o.append("button").html("Submit");return new Promise(((o,r)=>{function a(){fetch("/dslogin",{method:"POST",headers:{authorization:`Basic ${btoa(i.property("value"))}`},body:JSON.stringify({dslabel:e,route:t.route,embedder:window.location.hostname})}).then((e=>e.json())).then((i=>{if(i.error)throw i.error;n.remove();Hl.add(t);if(i.jwt){if(!Rl[e])Rl[e]={};Rl[e][i.route]=i.jwt;localStorage.setItem("jwtByDsRoute",JSON.stringify(Rl))}o(e)})).catch((e=>{alert("login error: "+e)}))}s.on("click",a);i.on("change",a)}))}function Ql(e,t,n){if(e.headers.authorization)return;let o=t?.dslabel;if(!o){const e=n.split("?")[1]?.split("&").find((e=>e.includes("dslabel")));if(!e)return;let t=decodeURIComponent(e.split("=")[1]);if(t.startsWith("{")&&t.endsWith("}")){t=JSON.parse(t);o=t.dslabel||t.mass?.vocab.dslabel||t.tracks?.find((e=>e.dslabel))?.dslabel}else{o=t}}if(!o||!Rl[o])return;const i=n.split("//");const s=(i[1]||i[0]).split("/").find((e=>e!="")).split("?")[0];const r=Rl[o][s]||Rl[o]["/**"];if(r)e.headers.authorization="Bearer "+btoa(r)}class ec{constructor(e={}){this.typename=Math.random().toString();const t=ot(document.body);this.d=t.append("div").attr("class","sja_menu_div").style("display","none").style("position","absolute").style("background-color","white").style("font-family","Arial").on("mousedown.menu"+this.typename,(e=>{const t=ot(e.target);if(t.on("mousedown")||t.on("click")||["INPUT","SELECT","TEXTAREA"].includes(e.target.tagName.toUpperCase())){e.stopPropagation()}})).on("keyup",(e=>{if(e.key=="Escape")this.hide()}));this.dnode=this.d.node();if(Object.values(this.d._groups[0]).length)this.dnode.parent_menu=e.parent_menu;t.on("mousedown.menu"+this.typename,(e=>{if(this.dnode.contains(e.target))return;if(e.target.parent_menu===this.dnode)return;const t=e.target.closest(".sja_menu_div");if(t&&t.parent_menu===this.dnode)return;this.hide()}));const n=sl();if(n){this.d.style("z-index",n+1)}this.d.style("padding","padding"in e?e.padding:"10px");if(e.border){this.d.style("border",e.border)}else{this.d.style("box-shadow","0px 2px 4px 1px #999")}this.offsetX=Number.isInteger(e.offsetX)?e.offsetX:20;this.offsetY=Number.isInteger(e.offsetY)?e.offsetY:20;this.hideXmute=Number.isInteger(e.hideXmute)?e.hideXmute:0;this.hideYmute=Number.isInteger(e.hideYmute)?e.hideYmute:0;this.prevX=-1;this.prevY=-1;this.clearSelector=e.clearSelector}clear(){if(this.clearSelector)this.d.select(this.clearSelector).selectAll("*").remove();else this.d.selectAll("*").remove();return this}show(e,t,n=true,o=true,i=true){let s=e;let r=t;this.prevX=e;this.prevY=t;document.body.appendChild(this.dnode);this.d.style("display","block");if(i){s=s+window.scrollX;r=r+window.scrollY}if(n){s=s+this.offsetX;r=r+this.offsetY}const a=window.innerWidth;const l=window.innerHeight;const c=a/2;const d=l/2;const f=this.dnode.getBoundingClientRect();if(a-s<c&&s+f.width>a)this.d.style("left",null).style("right",a-s+"px");else this.d.style("left",s+"px").style("right",null);if(!o&&l-r<d&&r-window.scrollY-f.height>0)this.d.style("top",null).style("bottom",l-r+"px");else this.d.style("top",r+"px").style("bottom",null);this.d.transition().style("opacity",1);return this}show2(e,t){let n=e;let o=t;this.prevX=e;this.prevY=t;document.body.appendChild(this.dnode);this.d.style("display","block");n=n+window.scrollX+this.offsetX;o=o+window.scrollY+this.offsetY;const i=window.innerWidth;const s=this.dnode.getBoundingClientRect();if(n+s.width>i)this.d.style("left","").style("right","5px");else this.d.style("left",n+"px").style("right","");this.d.style("top",o+"px").style("bottom","");this.d.transition().style("opacity",1);return this}showunder(e){const t=e.getBoundingClientRect();const n=t.left+window.scrollX;const o=t.top+t.height+window.scrollY+5;return this.show(n,o,false,true,false)}showunderoffset(e){const t=e.getBoundingClientRect();const n=t.top+t.height+window.scrollY+5;return this.show(t.left,n,true,true,false)}hide(e){if(e){if(Math.abs(this.prevX-e.clientX)<this.hideXmute&&Math.abs(this.prevY-e.clientY)<this.hideYmute)return}if(!this.fadeTimeout)this.d.style("display","none").style("opacity",0);if(this.onHide)this.onHide();return this}fadeout(){this.d.transition().style("opacity",0).on("end",(()=>this.d.style("display","none")));return this}confirm({html:e,timeout:t}){this.d.selectAll("*").remove();this.d.append("div").style("padding","5px").html(e);if(t)this.fadeTimeout=setTimeout((()=>{this.fadeout();delete this.fadeTimeout}),3e3)}toggle(){if(!this.hidden){this.hide();this.hidden=true}else{this.d.style("opacity",1).style("display","block");this.hidden=false}return this}getCustomApi(e={}){const t=Object.create(this);Object.assign(t,e);return t}destroy(){this.d.remove()}}function tc(e,t){if(!e.tracks)return;for(const n of e.tracks){if(n.__isgene){t.push(n);return}}}function nc(e){const t=e.holder.append("div").style("max-width","80vw");const n=t.append("table").style("margin","5px 8px").attr("class","sja_simpletable").attr("data-testid","sja_simpletable");return{scrollDiv:t,table:n,addRow:()=>{if(n.node().offsetHeight>500){t.style("height","450px").style("resize","both").style("overflow-y","scroll").attr("class","sjpp_show_scrollbar")}const e=n.append("tr");const o=e.append("td").style("padding","3px").style("color","#555");const i=e.append("td");return[o,i]}}}function oc(e,t,n){const o="#9e9e9e";const i=e.append("table").style("margin","5px 8px").style("font-size","inherit").attr("class","sja_simpletable");for(const e of t){const t=i.append("tr");if(e.kvlst){t.append("td").attr("rowspan",e.kvlst.length).style("padding","3px").style("color",o).html(e.k);t.append("td").style("padding","3px").style("color",o).html(e.kvlst[0].k);t.append("td").style("padding","3px").html(e.kvlst[0].v);for(let t=1;t<e.kvlst.length;t++){const n=i.append("tr");n.append("td").style("padding","3px").style("color",o).html(e.kvlst[t].k);n.append("td").style("padding","3px").html(e.kvlst[t].v)}}else{t.append("td").attr("colspan",2).style("padding","3px").style("color",o).html(e.k);const i=t.append("td").style("padding","3px");if(n&&e.v.length>n){i.html(e.v.substr(0,n-3)+" ...»").attr("class","sja_clbtext").on("click",(()=>{i.html(e.v).classed("sja_clbtext",false).on("click",null)}))}else{i.html(e.v)}}}return i}function ic(e,t,n){if(!n)n={};const o=n.width||40;const i=n.height||12;let s;if(e){e.attr("title",(t.f*100).toFixed(0)+"%"+(t.v1!=undefined?" ("+t.v1+"/"+t.v2+")":""));s=e.append("svg").attr("width",o).attr("height",i)}else{s=ot(document.body).append("svg")}let r=0;s.append("rect").attr("y",r).attr("width",o).attr("height",i).attr("fill",n.fillbg||"#CBE2F5");s.append("rect").attr("y",r).attr("width",o*t.f).attr("height",i).attr("fill",n.fill||"#69A1D1");if(n.readcountcredible&&t.v2<n.readcountcredible){const e="#545454";const t=.3;s.append("rect").attr("y",r).attr("width",o).attr("height",i).attr("fill",e).attr("fill-opacity",t)}if(e)return s;s.remove();return"<svg width="+o+" height="+i+">"+s.node().innerHTML+"</svg>"}const sc="Arial";const rc="Unspecified";const ac="green";const lc="#858585";const cc="#FCE3B8";const dc="#D2E2FC";const fc="red";const pc="#DE3336";const uc=.6;let hc=null;const mc=Na;const gc=qa;const bc=["#8dd3c7","#bebada","#fb8072","#80b1d3","#E8E89E","#a6d854","#fdb462","#ffd92f","#e5c494","#b3b3b3"];function yc(e,t){e.style("opacity",0).style("display",t||"block").transition().style("opacity",1)}function vc(e,t){e.style("opacity",1).transition().style("opacity",0).call((()=>{if(t){e.remove()}else{e.style("display","none").style("opacity",1)}}))}const wc=new ec({padding:""});wc.d.style("z-index",1e3);function xc(e,t){const n=e.append("div").attr("class","sja_errorbar");n.append("div").text(t);n.append("div").html("✕").on("click",(()=>{vc(n,true)}))}function _c(e){if(!e||!e.axis)return;if(!e.color){e.color="#545454"}e.axis.selectAll("line").attr("stroke",e.color).attr("shape-rendering","crispEdges");e.axis.selectAll("path").attr("fill","none").attr("stroke",e.showline?e.color:"none").attr("stroke-width",e.showline?1:0).attr("shape-rendering","crispEdges");e.axis.selectAll("text").style("cursor","default").attr("font-family",sc).attr("font-size",e.fontsize?e.fontsize+"px":"12px").attr("fill",e.color)}function kc(e){if(e.setzindex){hc=e.setzindex;rl(e.setzindex);return}const t=300;const n={};const o=ot(document.body);n.pane=o.append("div").attr("class","sja_pane").style("left",e.x+window.pageXOffset+"px").style("top",e.y+window.pageYOffset+"px").style("opacity",0);if(e.$id){n.pane.attr("id",e.$id)}if(hc){n.pane.style("z-index",hc)}n.pane.transition().duration(t).style("opacity",1);const i=n.pane.append("div").on("mousedown",(e=>{e.preventDefault();e.stopPropagation();const t=Number.parseInt(n.pane.style("left")),i=Number.parseInt(n.pane.style("top"));const s=e.clientX,r=e.clientY;o.on("mousemove",(e=>{n.pane.style("left",t+e.clientX-s+"px").style("top",i+e.clientY-r+"px")}));o.on("mouseup",(function(){o.on("mouseup",null).on("mousemove",null)}));document.body.appendChild(n.pane.node())}));const s=i.append("div").attr("class","sja_menuoption").style("display","inline-block").style("padding","4px 10px").style("margin","0px").style("border-right","solid 1px white").style("cursor","default").style("font-size","1.5em").on("mousedown",(e=>{document.body.dispatchEvent(new Event("mousedown"));e.stopPropagation()}));if(e.toshrink){n.mini=false;s.html("━").on("click",(()=>{s.html(n.mini?"━":"◽");if(n.mini){yc(n.body)}else{vc(n.body)}n.mini=!n.mini}))}else{s.html("×");if(e.close){s.on("click",e.close)}else if(e.closekeep){s.on("click",(()=>{n.pane.transition().duration(t).style("opacity",0).call((()=>n.pane.style("display","none")))}))}else{s.on("click",(()=>{n.pane.transition().duration(t).style("opacity",0).call((()=>n.pane.remove()))}))}}n.header=i.append("div").style("display","inline-block").style("font-family",sc).style("padding",e.headpad||"5px 10px");n.body=n.pane.append("div").style("font-family",sc);return n}function jc(e){if(!e.pdomains)return[];const t=new Map;for(const n of e.pdomains){const e=n.name+n.description;if(t.has(e)){t.get(e).start=Math.min(t.get(e).start,n.start)}else{t.set(e,{name:n.name,description:n.description,color:n.color,start:n.start,iscustom:n.iscustom,url:n.url,pmid:n.pmid,CDD:n.CDD,Pfam:n.Pfam,SMART:n.SMART,COG:n.COG,PRK:n.PRK,Curated_at_NCBI:n.Curated_at_NCBI})}}const n=[];for(const[e,o]of t){o.key=e;o.fill=o.color;o.stroke=Kt(o.color).darker(1).toString();delete o.color;n.push(o)}n.sort(((e,t)=>e.start-t.start));return n}function Nc(e,t,n,o){let i=10;if(i*(t.exon.length-1)>n*.3){i=Math.max(2,n*.3/(t.exon.length-1))}let s=0;for(const e of t.exon){s+=e[1]-e[0]}const r=i*(t.exon.length-1);const a=(n-(r>n*.4?0:r))/s;n=a*s+r;const l=e.append("canvas").node();l.width=n;const c=20;const d=4;l.height=c;const f=l.getContext("2d");f.strokeStyle=o;f.beginPath();f.moveTo(0,Math.floor(c/2)-.5);f.lineTo(n,Math.floor(c/2)-.5);f.stroke();const p=t.strand=="-";let u=0;for(const e of t.exon){let n=null,s=null,r=null;if(p){const o=e[1],i=e[0],a=t.codingstop,l=t.codingstart;if(i>=a){n=e}else if(i>=l){if(o>=a){n=[a,o];s=[i,a]}else{s=e}}else{if(o>=a){n=[a,o];r=[i,l];s=[l,a]}else if(o>=l){r=[i,l];s=[l,o]}else{r=e}}}else{if(e[1]<=t.codingstart){n=e}else if(e[1]<=t.codingstop){if(e[0]<=t.codingstart){n=[e[0],t.codingstart];s=[t.codingstart,e[1]]}else{s=e}}else{if(e[0]<=t.codingstart){n=[e[0],t.codingstart];r=[t.codingstop,e[1]];s=[t.codingstart,t.codingstop]}else if(e[0]<t.codingstop){r=[t.codingstop,e[1]];s=[e[0],t.codingstop]}else{r=e}}}if(n){f.fillStyle="#aaa";const e=Math.max(1,(n[1]-n[0])*a);f.fillRect(u,d,e,c-d*2);u+=e}if(s){f.fillStyle=o;const e=Math.max(1,(s[1]-s[0])*a);f.fillRect(u,0,e,c);u+=e}if(r){f.fillStyle="#aaa";const e=Math.max(1,(r[1]-r[0])*a);f.fillRect(u,d,e,c-d*2);u+=e}u+=i}}function Sc(e,t,n,o,i,s,r,a){const l=e.append("canvas").node();l.width=s;l.height=r;const c=Math.ceil(r/5);const d=l.getContext("2d");let f;let p=0;for(const e of t){if(e.chr!=n.chr){p+=e.width+i;continue}if(n.start>=e.start&&n.start<=e.stop){f=p+(e.reverse?e.stop-n.start:n.start-e.start)*o;break}p+=e.width+i}let u;p=0;for(const e of t){if(e.chr!=n.chr){p+=e.width+i;continue}if(n.stop>=e.start&&n.stop<=e.stop){u=p+(e.reverse?e.stop-n.stop:n.stop-e.start)*o;break}p+=e.width+i}d.strokeStyle=a;d.beginPath();d.moveTo(f,Math.floor(r/2)+.5);d.lineTo(u,Math.floor(r/2)+.5);d.stroke();const h=[];if(n.utr5)h.push(...n.utr5);if(n.utr3)h.push(...n.utr3);if(!n.cdslen)h.push(...n.exon);for(const e of h){let s=0;for(const a of t){if(a.chr!=n.chr){s+=a.width+i;continue}const t=Math.max(e[0],a.start);const l=Math.min(e[1],a.stop);if(t>=l){s+=a.width+i;continue}d.fillStyle="#aaa";d.fillRect(s+(a.reverse?(a.stop-l)*o:(t-a.start)*o),c,Math.max(1,(l-t)*o),r-c*2);s+=a.width+i}}if(n.coding){for(const e of n.coding){let s=0;for(const l of t){if(l.chr!=n.chr){s+=l.width+i;continue}const t=Math.max(e[0],l.start);const c=Math.min(e[1],l.stop);if(t>=c){s+=l.width+i;continue}d.fillStyle=a;d.fillRect(s+(l.reverse?(l.stop-c)*o:(t-l.start)*o),0,Math.max(1,(c-t)*o),r);s+=l.width+i}}}}function Ac(e,t,n,o){const i=e.append("canvas").node();i.width=n;const s=20;const r=4;i.height=s;const a=i.getContext("2d");if(!t.cdslen){a.fillStyle="#aaa";a.fillRect(0,r,n,s-r*2);return}const l=n/t.rnalen;let c=0;if(t.utr5){let e=0;for(const n of t.utr5)e+=n[1]-n[0];a.fillStyle="#aaa";a.fillRect(0,r,l*e,s-r*2);c=l*e}if(t.pdomains&&t.pdomains.length){a.fillStyle="white";a.fillRect(c,0,t.cdslen*l,s);t.pdomains.sort(((e,t)=>t.stop-t.start-e.stop+e.start));for(const e of t.pdomains){a.fillStyle=e.color;a.fillRect(c+e.start*3*l,0,(e.stop-e.start+1)*3*l,s)}a.strokeStyle="black";a.strokeRect(c,0,t.cdslen*l,s)}else{a.fillStyle=o;a.fillRect(c,0,t.cdslen*l,s)}c+=t.cdslen*l;if(t.utr3){let e=0;for(const n of t.utr3)e+=n[1]-n[0];a.fillStyle="#aaa";a.fillRect(c,r,l*e,s-r*2)}}function Cc(e,t,n){const o=e.append("canvas").node();o.width=n;const i=20;o.height=i;const s=o.getContext("2d");const r=n/(t.cdslen/3);t.pdomains.sort(((e,t)=>t.stop-t.start-e.stop+e.start));s.fillStyle="white";s.fillRect(0,0,n,i);for(const e of t.pdomains){s.fillStyle=e.color;s.fillRect(e.start*r,0,(e.stop-e.start+1)*r,i)}s.strokeStyle="black";s.strokeRect(0,0,n,i)}function Ec(e,t,n,o,i,s,r,a,l){const c=e.append("canvas").node();c.width=n;c.height=o;const d=c.getContext("2d");const f=Jo().range([1,n]);if(l){f.domain([s,i])}else{f.domain([i,s])}d.strokeStyle=r;d.fillStyle=r;u(d,t.start,t.stop,i,s,o/2,1);const p=Math.ceil(o/5);if(t.utr3){for(const e of t.utr3){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(t.utr5){for(const e of t.utr5){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(t.coding){for(const e of t.coding){u(d,e[0],e[1],i,s,1,o)}}if(t.codingstart==t.codingstop){for(const e of t.exon){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(!a&&t.strand){const e=3;if(t.coding){for(const n of t.coding){h(d,t.strand,n[0],n[1],i,s,1+e,o-e*2-1,"white")}}if(t.intron){for(const n of t.intron){h(d,t.strand,n[0],n[1],i,s,1+e,o-e*2-1,r?r:"black")}}}function u(e,t,n,o,i,s,r){const a=Math.max(t,o);const c=Math.min(n,i);if(a>=c)return;e.fillRect(Math.floor(f(l?c:a)),s,Math.max(1,Math.abs(f(c)-f(a))),r)}function h(e,t,n,o,i,s,r,a,l){const c=Math.max(n,i);const d=Math.min(o,s);if(c>=d)return;const p=2,u=a/2,h=f(d)-f(c);if(h<=p*2+a/2)return;e.strokeStyle=l;const m=Math.floor((h-p*2)/(a/2+u));let g=Math.floor(f(c)+(h-m*(a/2+u))/2)+.5;e.beginPath();for(let n=0;n<m;n++){if(t=="+"){e.moveTo(g,r);e.lineTo(g+a/2,r+a/2);e.lineTo(g,r+a)}else{e.moveTo(g+a/2,r);e.lineTo(g,r+a/2);e.lineTo(g+a/2,r+a)}g+=a/2+u}e.stroke()}}function Oc(e,t,n){let o=-1;if(t.cdslen){o=t.cdslen/3}return e.append("span").html(" "+(o>0?Math.ceil(o)+" AA"+(Number.isInteger(o)?"":" (incomplete CDS)"):"noncoding"))}function Mc(e,t,n){const o=kc({x:e,y:t});const i=o.body.append("div").style("margin","40px 20px 20px 20px");const s=i.append("p");s.append("span").html("Genome ");const r=s.append("select");for(const e in n){r.append("option").text(e)}const a=i.append("div").style("margin","20px 0px");const l=o.body.append("div").style("margin","10px 20px");const c=o.body.append("div").style("margin","20px");return[o,i,r.node(),a,l,c]}function Ic(e,t,n={}){if(n.apply_dom_styles){n.svgClone=e.cloneNode(true);const t=ot(n.svgClone);for(const e of n.svgClone.querySelectorAll(".sjpp-exclude-svg-download")){e.remove()}const o=window.getComputedStyle(e);for(const e of o){t.style(e,o.getPropertyValue(e))}}const o=document.createElement("a");document.body.appendChild(o);o.addEventListener("click",(function(){const i=new XMLSerializer;const s=new Blob([i.serializeToString(n.svgClone?n.svgClone:e)],{type:"image/svg+xml"});o.download=t+".svg";o.href=URL.createObjectURL(s);document.body.removeChild(o)}),false);o.click()}function Tc(e){const t=e.append("select");t.append("option").text("SNV and indel");t.append("option").text("SV (tabular format)");t.append("option").text("Fusion gene (tabular format)");t.append("option").text("ITD");t.append("option").text("Deletion, intragenic");t.append("option").text("Truncation");t.append("option").text("CNV, gene-level");return t}function Rc(e,t,n=1,o=1,i=10,s=100,r=null){let a;if(!r){const t=kc({x:(window.innerWidth/2-200)*n,y:(window.innerHeight/2-150)*o});t.header.text(e);a=t.body}else{r.append("p").text(e);a=r.append("div")}for(const e of t){const t=a.append("div").style("margin-top","10px");if(e.label){t.append("div").text(e.label).style("margin","5px")}a.append("textarea").text(e.text).attr("readonly",1).attr("rows",i).attr("cols",s)}a.append("p").style("font-size",".7em").text("Click on the text box above and press Ctrl-A to select all text for copy-pasting.")}function Lc(e,t){const n=e.node().getBoundingClientRect();const o=t.node().getBoundingClientRect();const i=ot(document.body).append("div").style("position","absolute").style("border","solid 1px black").style("left",n.left+window.pageXOffset+"px").style("top",n.top+window.pageYOffset+"px").style("width",n.width+"px").style("height",n.height+"px");if(hc){i.style("z-index",hc+3)}i.transition().duration(500).style("left",o.left+window.pageXOffset+"px").style("top",o.top+window.pageYOffset+"px").style("width",o.width+"px").style("height",o.height+"px").on("end",(()=>i.remove()))}function $c(e){const t=16;if(!e.color){e.color="#ccc"}const n=e.holder.append("div").style("position","relative").style("padding-top",t/2+"px");if(e.margin){n.style("margin",e.margin)}const o=n.append("div").style("border","solid 1px "+e.color).style("padding",t+"px").style("padding-bottom",t/2+"px");n.append("div").text(e.label).style("position","absolute").style("left","15px").style("top","0px").style("background-color","white").style("color",e.color).style("font-family",sc).style("font-size",t+"px").style("padding","0px 10px");return o}function zc(e,t){t.selectAll("*").remove();for(const n in e){const o=e[n];const i=t.append("div").style("display","inline-block").style("white-space","nowrap").style("padding","5px 20px 5px 0px");i.append("div").style("display","inline-block").style("background-color",o.color).style("margin-right","5px").style("padding","0px 4px").html(" ");i.append("div").style("display","inline-block").style("color",o.color).text(o.label)}}function Pc(e,t){if(window.location.hostname=="viz.stjude.cloud"||window.location.hostname=="pecan.stjude.cloud")return;if(window.sessionStorage.getItem("suppressErrors")?.includes(`"bulk-bad-lines"`))return;const n=kc({x:400,y:60});n.body.style("margin","20px 10px 10px 10px");n.header.text(t.length+" line"+(t.length>1?"s":"")+" rejected, click to check");if(t.length<=50){for(const[o,i,s]of t){n.body.append("div").classed("sja_clbtext",true).style("margin","3px").text("Line "+o+": "+i).on("click",(()=>{const t=kc({x:500,y:60});t.header.text("Line "+o);t.body.style("margin","10px");const n=t.body.append("table").style("border-spacing","1px").style("border-collapse","separate");let i=true;for(let t=0;t<e.length;t++){const o=n.append("tr");if(i){o.style("background-color","#ededed")}i=!i;o.append("td").text(e[t]);o.append("td").text(s[t]==undefined?"":s[t])}}))}return}const o=new Map;for(const[e,n,i]of t){if(!o.has(n)){o.set(n,[])}o.get(n).push({number:e,line:i})}const i=[...o];i.sort(((e,t)=>t[1].length-e[1].length));for(const[t,o]of i){const i=o[0];n.body.append("div").classed("sja_menuoption",true).style("margin","5px").text("Line "+i.number+": "+t+(o.length>1?" (total "+o.length+" lines)":"")).on("click",(()=>{const t=kc({x:500,y:60});t.header.text("Line "+i.number);const n=t.body.style("margin","10px").append("table");let o=true;for(let t=0;t<e.length;t++){const s=n.append("tr");if(o){s.style("background-color","#ededed")}o=!o;s.append("td").text(e[t]);s.append("td").text(i.line[t]==undefined?"":i.line[t])}}))}}function Dc(e){if(!e)return"No Block{} object given";if(typeof e!="object")return"Block is not an object";if(!e.error)return"method block.error() missing";if(!e.genome)return"block.genome missing";return null}function Uc(e){e.d.append("p").html('<span style="color:#858585;font-size:.7em">EXAMPLE</span> M ; red');const t=e.d.append("textarea").attr("cols",25).attr("rows",5).attr("placeholder","One class per line, join color and class code by semicolon.");const n=e.d.append("div");n.append("button").text("Submit").on("click",(()=>{const e=t.property("value").trim();if(!e)return;o.text("");const n=[];for(const t of e.split("\n")){const e=t.split(";");if(e.length!=2)return o.text("no separator in line: "+t);const i=e[0].trim();const s=e[1].trim();if(!i||!s)return o.text("wrong line: "+t);if(!Yr[i])return o.text("wrong class: "+i);n.push([i,s])}if(n.length){for(const[e,t]of n){Yr[e].color=t}Bc(i);o.text("New color set!")}}));n.append("button").text("Clear").on("click",(()=>{t.property("value","");o.text("")}));const o=n.append("span").style("margin-left","10px");const i=e.d.append("div").style("margin-top","5px");Bc(i);e.d.append("p").style("font-size",".8em").html("<a href=https://en.wikipedia.org/wiki/Web_colors target=_blank>Use color names</a>, or #ff0000 or rgb(255,0,0)")}function Bc(e,t){e.style("border-spacing","3px").selectAll("*").remove();const n=e.append("tr").style("color","#858585").style("font-size",".7em");n.append("td").text("CLASS");n.append("td").attr("colspan",2).text("LABEL, COLOR");for(const n in Yr){const o=Yr[n];if(t&&o.dt!=Pr)continue;const i=e.append("tr");i.append("td").text(n);{const e=i.append("td").append("span").attr("class","sja_mcdot").style("background-color",o.color).html(" ");if(n=="Blank")e.style("border","solid 1px #eee")}i.append("td").text(o.label).style("color",n=="Blank"?"#ddd":o.color)}}const Fc={height:1,pcolor:2,ncolor:3,pcolor2:4,ncolor2:5,autoscale:6,fixedscale:7,percentilescale:8,nodotplot:9,usedotplot:10,usedividefactor:11,nodividefactor:12};function qc(e,t){for(const n of t){if(n.type!=e.type)continue;switch(e.type){case mc.bigwig:case mc.bedj:case mc.junction:case mc.mdsjunction:case mc.mdscnv:case mc.bampile:case mc.hicstraw:case mc.expressionrank:if(e.file&&e.file==n.file||e.url&&e.url==n.url){return n}break;case mc.bigwigstranded:if(e.strand1&&n.strand1&&e.strand1.file==n.strand1.file&&e.strand1.url==n.strand1.url){if(e.strand2&&n.strand2&&e.strand2.file==n.strand2.file&&e.strand2.url==n.strand2.url){return n}}break}}return null}function Hc(e){if(e>=100)return"HIGHEST";if(e>=90)return"HIGH "+e+"%";if(e>=70)return"high "+e+"%";if(e>=30)return e+"%";if(e>=10)return"low "+e+"%";if(e>0)return"LOW "+e+"%";return"LOWEST"}function Gc(e){if(e[0]=="#")return e;const t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return t&&t.length===4?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""}function Jc(e){return e.code=="Enter"||e.code=="NumpadEnter"}function Vc(e,t,n,o){if(!n||!n.hasSNP)return;const i={byCoord:true,genome:n.name,chr:e,ranges:[],alleleLst:o};for(const e of t){if(Number.isFinite(e)){i.ranges.push({start:e,stop:e+1})}else if(e.start&&e.stop){i.ranges.push(e)}}return Ll("snp",i).then((e=>{if(e.error)throw e.error;return e.results}))}function Wc(e,t){t.append("a").text(e.name).attr("href","https://www.ncbi.nlm.nih.gov/snp/"+e.name).attr("target","_blank");t.append("div").attr("class","sja_tinylogo_body").text(e.observed);t.append("div").attr("class","sja_tinylogo_head").text("ALLELE")}function Xc(e,t){t.append("div").style("display","inline-block").style("background",e.bg).style("padding","3px").append("a").attr("href","https://www.ncbi.nlm.nih.gov/clinvar/variation/"+e.id).attr("target","_blank").style("color",e.textcolor).text(e.value).style("font-size",".9em").style("text-decoration","none")}function Yc(e){const t=[];for(const n of e){let e=true;for(const o of t){if(n.chr==o.chr&&Math.max(n.start,o.start)<Math.min(n.stop,o.stop)){o.start=Math.min(o.start,n.start);o.stop=Math.max(o.stop,n.stop);e=false}}if(e){t.push({name:n.isoform,chr:n.chr,start:n.start,stop:n.stop})}}return t}function Zc(e,t,n,o){const i=e.append("table").style("border-spacing","0px").style("border-collapse","separate").append("tr");const s=i.append("td").style("vertical-align","top").style("padding","10px 0px 10px 10px");const r=i.append("td").style("vertical-align","top").style("border-left","solid 1px #aaa").style("padding","10px");const a=t.findIndex((e=>e.active))==-1?false:true;if(o){s.append("div").style("padding","5px 10px").style("margin","5px 5px 10px 5px").style("font-weight","550").text(o)}for(let e=0;e<t.length;e++){const o=t[e];o.tab=s.append("div").style("padding","5px 10px").style("margin","0px").style("border-top","solid 1px #ddd").style("border-radius","0px").classed("sja_menuoption",!a&&e!=0).html(o.label);o.box=r.append("div").style("padding","3px").style("display",!a&&e==0||o.active?"block":"none");if(n&&o.callback||!a&&e==0&&o.callback||o.active){o.callback(o.box);delete o.callback}if(a)o.tab.classed("sja_menuoption",!o.active);o.tab.on("click",(()=>{if(o.box.style("display")!="none"){o.tab.classed("sja_menuoption",true);o.box.style("display","none")}else{o.tab.classed("sja_menuoption",false);yc(o.box);for(let n=0;n<t.length;n++){if(e!=n){t[n].tab.classed("sja_menuoption",true);t[n].box.style("display","none")}}}if(o.callback){o.callback(o.box);delete o.callback}}))}}function Kc(e){return e.append("div").style("margin","30px").text("Loading...")}var Qc=Object.freeze({__proto__:null,dofetch:Ll,dofetch2:Pl,dofetch3:Bl,Menu:ec,first_genetrack_tolist:tc,make_table_2col:oc,fillbar:ic,font:sc,unspecified:rc,colorinframe:ac,coloroutframe:lc,colorbgleft:cc,colorbgright:dc,colorantisense:fc,colorctx:pc,textlensf:uc,get base_zindex(){return hc},tkt:mc,gmmode:gc,domaincolorlst:bc,appear:yc,disappear:vc,tip:wc,sayerror:xc,axisstyle:_c,newpane:kc,getdomaintypes:jc,sketchSplicerna:Nc,sketchGmsum:Sc,sketchRna:Ac,sketchProtein2:Cc,sketchGene:Ec,sketchProtein:Oc,newpane3:Mc,to_svg:Ic,filetypeselect:Tc,export_data:Rc,flyindi:Lc,labelbox:$c,category2legend:zc,bulk_badline:Pc,ensureisblock:Dc,mclasscolorchangeui:Uc,mclasscolor2table:Bc,bwSetting:Fc,tkexists:qc,ranksays:Hc,rgb2hex:Gc,keyupEnter:Jc,may_findmatchingsnp:Vc,snp_printhtml:Wc,clinvar_printhtml:Xc,gmlst2loci:Yc,tab2box:Zc,tab_wait:Kc});function ed(e,t,n){var o,i,s,r,a;if(null==t)t=100;function l(){var c=Date.now()-r;if(c<t&&c>=0){o=setTimeout(l,t-c)}else{o=null;if(!n){a=e.apply(s,i);s=i=null}}}var c=function(){s=this;i=arguments;r=Date.now();var c=n&&!o;if(!o)o=setTimeout(l,t);if(c){a=e.apply(s,i);s=i=null}return a};c.clear=function(){if(o){clearTimeout(o);o=null}};c.flush=function(){if(o){a=e.apply(s,i);s=i=null;clearTimeout(o);o=null}};return c}ed.debounce=ed;var td=ed;function nd(e){const t=e.div.append("input").attr("placeholder","Search gene").style("width",e.width||"100px");const n=e.resultdiv||(e.tip?e.tip.d:wc.d);function o(){if(e.resultdiv){e.resultdiv.selectAll("*").remove()}else if(e.tip){e.tip.hide()}else{wc.hide()}}t.on("keyup",(t=>{const i=t.target.value;if(i.length<=1){o();return}if(Jc(t)){const t=n.select(".sja_menuoption");if(t.size()>0){e.callback(t.text());o()}return}s()}));t.node().focus();function i(){Ll("genelookup",{genome:e.genome,input:t.property("value")}).then((i=>{if(i.error)throw i.error;if(!i.hits)throw".hits[] missing";if(e.resultdiv){e.resultdiv.selectAll("*").remove()}else if(e.tip){e.tip.clear().showunder(t.node())}else{wc.clear().showunder(t.node())}for(const t of i.hits){n.append("div").attr("class","sja_menuoption").text(t).on("click",(()=>{e.callback(t);o()}))}})).catch((e=>{n.append("div").text(e.message||e);if(e.stack)console.log(e.stack)}))}const s=td.debounce(i,300)}function od(e,t){return Bl("genelookup",{body:{deep:1,input:t,genome:e}}).then((e=>{if(e.error)throw e.error;if(!e.gmlst||e.gmlst.length==0)return null;return e.gmlst})).catch((e=>{throw e}))}function id(e){if(!e){return null}const t={};for(const e in Yr){t[Yr[e].label.toUpperCase()]=e}return{genome:e,mclasslabel2key:t,data:{},sample2disease:{},patient2st:{},good:0,geneToUpper:true,snv:{loaded:false,header:null,badlines:[],missense:0,silent:0},svjson:{loaded:false,header:null,badlines:[]},fusion:{loaded:false,header:null,badlines:[],original:[]},sv:{loaded:false,header:null,badlines:[],original:[]},cnv:{loaded:false,header:null,badlines:[]},itd:{loaded:false,header:null,badlines:[]},del:{loaded:false,header:null,badlines:[]},truncation:{loaded:false,header:null,badlines:[]}}}function sd(e,t,n,o,i){let s=wa;if(e.sampletype){const t=e.sampletype.toLowerCase();switch(t){case"relapse":s=_a;break;case"germline":s=xa;break}if(e.sample){if(e.patient);else{e.patient=e.sample+" "+e.sampletype}}else{if(e.patient){e.sample=e.patient+" "+e.sampletype}}}else{if(e.patient){if(e.sample){e.sampletype=e.sample}else{e.sample=e.sampletype=e.patient}}else{if(e.sample){e.sampletype=e.sample}}}if(e.origin){const t=e.origin.toLowerCase();switch(t){case"r":case"relapse":s=_a;e.isrim2=true;break;case"g":case"germline":s=xa;e.isrim1=true;break;case"gp":case"germline pathogenic":s=ka;e.isrim1=true;break;case"gnp":case"germline nonpathogenic":case"germline non-pathogenic":s=ja;e.isrim1=true;break;case"s":case"somatic":case"diagnosis":s=wa;break}}e.origin=s;if(!e.sample&&!e.patient){return}const r="no patient/individual name";if(e.patient){if(!t.patient2st[e.patient]){t.patient2st[e.patient]={}}t.patient2st[e.patient][e.sampletype]=e.sample}else{if(!t.patient2st[r]){t.patient2st[r]={}}t.patient2st[r][e.sampletype]=e.sample}if(e.sample){if(e.disease){if(e.sample in t.sample2disease){if(e.disease!=t.sample2disease[e.sample]){t.snv.badlines.push([n,'conflict of disease types for sample "'+e.sample+'": '+e.disease+", "+t.sample2disease[e.sample],o]);return true}}else{t.sample2disease[e.sample]=e.disease}}}return false}function rd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for snv/indel";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("annovar_gene","annovar_sj_gene","gene","genename","gene_symbol","hugo_symbol");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_aachange","amino_acid_change","annovar_sj_aachange","aachange","protein_change","variant");if(i==-1)return"amino_acid_change missing from header";n[i]="mname";i=o("annovar_class","class","mclass","variant_class","variant_classification","annovar_sj_class");if(i==-1)return"variant_class missing from header";n[i]="class";i=o("chromosome","chr");if(i==-1)return"chromosome missing from header";n[i]="chr";i=o("wu_hg19_pos","start","start_position","chr_position","position");if(i==-1)return"start missing from header";n[i]="pos";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("quantitative_measurements");if(i!=-1)n[i]="qmset";i=o("mutant_reads_in_case","mutant_in_tumor","tumor_readcount_alt");if(i!=-1)n[i]="maf_tumor_v1";i=o("total_reads_in_case","total_in_tumor","tumor_readcount_total");if(i!=-1)n[i]="maf_tumor_v2";i=o("mutant_reads_in_control","mutant_in_normal","normal_readcount_alt");if(i!=-1)n[i]="maf_normal_v1";i=o("total_reads_in_control","total_in_normal","normal_readcount_total");if(i!=-1)n[i]="maf_normal_v2";i=o("cdna_change");if(i!=-1)n[i]="cdna_change";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";i=o("origin");if(i!=-1)n[i]="origin";i=o("cancer","disease","diagnosis");if(i!=-1)n[i]="disease";t.snv.header=n;t.snv.loaded=true;return false}function ad(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.snv.header.length;e++){if(o[e]==undefined)break;i[n.snv.header[e]]=o[e]}if(!i.gene){n.snv.badlines.push([e,"missing gene",o]);return}if(i.gene.toUpperCase()=="UNKNOWN"){n.snv.badlines.push([e,"gene name is UNKNOWN",o]);return}if(!i.isoform){n.snv.badlines.push([e,"missing isoform",o]);return}if(!i.mname){i.mname=i.cdna_change;if(!i.mname){n.snv.badlines.push([e,"missing amino acid change",o]);return}}else{if(i.mname.indexOf("p.")==0){i.mname=i.mname.replace(/^p\./,"")}}if(!i.class){n.snv.badlines.push([e,"missing mutation class",o]);return}let s=n.mclasslabel2key[i.class.toUpperCase()];if(s){i.class=s}else{s=sa(i.class);if(s){i.class=s}else{n.snv.badlines.push([e,"wrong mutation class: "+i.class,o]);return}}if(sd(i,n,e,o,n.snv.badlines)){return}if(!i.chr){n.snv.badlines.push([e,"missing chromosome",o]);return}if(i.chr.toLowerCase().indexOf("chr")!=0){i.chr="chr"+i.chr}if(!i.pos){n.snv.badlines.push([e,"missing chromosome position",o]);return}const r=Number.parseInt(i.pos);if(Number.isNaN(r)){n.snv.badlines.push([e,"invalid chromosome position",o]);return}i.pos=r-1;if(i.maf_tumor_v2!=undefined&&i.maf_tumor_v1!=undefined){if(i.maf_tumor_v2=="");else{let t=Number.parseInt(i.maf_tumor_v1),s=Number.parseInt(i.maf_tumor_v2);if(Number.isNaN(t)||Number.isNaN(s)){n.snv.badlines.push([e,"invalid maf_tumor mutant and/or total read count",o]);return}i.maf_tumor={f:t/s,v1:t,v2:s}}delete i.maf_tumor_v1;delete i.maf_tumor_v2}if(i.maf_normal_v1!=undefined&&i.maf_normal_v2!=undefined){if(i.maf_normal_v2=="");else{let t=Number.parseInt(i.maf_normal_v1),s=Number.parseInt(i.maf_normal_v2);if(Number.isNaN(t)||Number.isNaN(s)){n.snv.badlines.push([e,"invalid maf_normal mutant and/or total read count",o]);return}i.maf_normal={f:t/s,v1:t,v2:s}}delete i.maf_normal_v1;delete i.maf_normal_v2}n.good++;if(i.class=="M"){n.snv.missense++}else if(i.class=="S"){n.snv.silent++}const a=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!n.data[a]){n.data[a]=[]}i.dt=Pr;n.data[a].push(i)}function ld(e,t,n){const o=e.toLowerCase().split("\t");if(o.length<=1)return"invalid file header for fusions";const i=(...e)=>{for(const t of e){const e=o.indexOf(t);if(e!=-1)return e}return-1};let s=i("gene_a","gene1","genea");if(s==-1)return"gene_a missing from header";o[s]="gene1";s=i("gene_b","gene2","geneb");if(s==-1)return"gene_b missing from header";o[s]="gene2";s=i("chr_a","chr1","chra");if(s==-1)return"chr_a missing from header";o[s]="chr1";s=i("chr_b","chr2","chrb");if(s==-1)return"chr_b missing from header";o[s]="chr2";s=i("pos_a","position_a","position1","posa");if(s==-1)return"pos_a missing from header";o[s]="position1";s=i("pos_b","position_b","position2","posb");if(s==-1)return"pos_b missing from header";o[s]="position2";s=i("isoform_a","refseq_a","refseq1","isoform1","sv_refseqa");if(s==-1)return"isoform_a missing from header";o[s]="isoform1";s=i("isoform_b","refseq_b","refseq2","isoform2","sv_refseqb");if(s==-1)return"isoform_b missing from header";o[s]="isoform2";s=i("strand_a","orta");if(s==-1)return"strand_a missing from header";o[s]="strand1";s=i("strand_b","ortb");if(s==-1)return"strand_b missing from header";o[s]="strand2";s=i("sample","sample_name","tumor_sample_barcode");if(s!=-1)o[s]="sample";s=i("patient","donor","target_case_id");if(s!=-1)o[s]="patient";s=i("sampletype","sample type","sample_type");if(s!=-1)o[s]="sampletype";s=i("disease");if(s!=-1)o[s]="disease";s=i("origin");if(s!=-1)o[s]="origin";if(n){t.sv.loaded=true;t.sv.header=o}else{t.fusion.loaded=true;t.fusion.header=o}return false}function cd(e,t,n,o){if(t==""||t[0]=="#")return;const i=t.split("\t");const s={};const r=o?n.sv.header:n.fusion.header;const a=o?n.sv.badlines:n.fusion.badlines;for(let e=0;e<r.length;e++){s[r[e]]=i[e]}if(!s.chr1){a.push([e,"missing chr1",i]);return}if(s.chr1.toLowerCase().indexOf("chr")!=0){s.chr1="chr"+s.chr1}if(!s.chr2){a.push([e,"missing chr2",i]);return}if(s.chr2.toLowerCase().indexOf("chr")!=0){s.chr2="chr"+s.chr2}let l=s.position1;if(!l){a.push([e,"missing position1",i]);return}let c=Number.parseInt(l);if(Number.isNaN(c)||c<=0){a.push([e,"invalid value for position1",i]);return}s.position1=c;l=s.position2;if(!l){a.push([e,"missing position2",i]);return}c=Number.parseInt(l);if(Number.isNaN(c)||c<=0){a.push([e,"invalid value for position2",i]);return}s.position2=c;if(sd(s,n,e,i)){return}if(s.isoform1&&s.isoform1.indexOf(",")!=-1){const e=s.isoform1.split(",");s.isoform1=undefined;for(const t of e){if(t!="")s.isoform1=t}}if(s.isoform2&&s.isoform2.indexOf(",")!=-1){const e=s.isoform2.split(",");s.isoform2=undefined;for(const t of e){if(t!="")s.isoform2=t}}if(!s.gene1){s.isoform1=undefined}if(!s.gene2){s.isoform2=undefined}if(s.gene1){n.good++;const e={dt:o?Fr:Dr,class:o?aa:ra,isoform:s.isoform1,mname:s.gene2||s.chr2,sample:s.sample,patient:s.patient,sampletype:s.sampletype,origin:s.origin,disease:s.disease,pairlst:[{a:{name:s.gene1,isoform:s.isoform1,strand:s.strand1,chr:s.chr1,position:s.position1},b:{name:s.gene2,isoform:s.isoform2,strand:s.strand2,chr:s.chr2,position:s.position2}}]};const t=n.geneToUpper?s.gene1.toUpperCase():s.gene1;if(!n.data[t]){n.data[t]=[]}n.data[t].push(e)}if(s.gene2&&s.gene2!=s.gene1){n.good++;const e={dt:o?Fr:Dr,class:o?aa:ra,isoform:s.isoform2,mname:s.gene1||s.chr1,sample:s.sample,patient:s.patient,sampletype:s.sampletype,origin:s.origin,disease:s.disease,pairlst:[{a:{name:s.gene1,isoform:s.isoform1,strand:s.strand1,chr:s.chr1,position:s.position1},b:{name:s.gene2,isoform:s.isoform2,strand:s.strand2,chr:s.chr2,position:s.position2}}]};const t=n.geneToUpper?s.gene2.toUpperCase():s.gene2;if(!n.data[t]){n.data[t]=[]}n.data[t].push(e)}}function dd(e){const t={};for(const n in e){if(n=="pairlst")continue;const o=e[n];const i=typeof o;if(i=="object"){continue}t[n]=o}if(e.pairlst){t.pairlst=[];for(const n of e.pairlst){const e={};for(const t in n){if(t=="a"||t=="b"||t=="interstitial"){continue}e[t]=n[t]}if(n.a){e.a={};for(const t in n.a){const o=n.a[t];if(typeof o=="object"){continue}e.a[t]=o}}if(n.b){e.b={};for(const t in n.b){const o=n.b[t];if(typeof o=="object"){continue}e.b[t]=o}}if(n.interstitial){e.interstitial={};for(const t in n.interstitial){const o=n.interstitial[t];if(typeof o=="object"){continue}e.interstitial[t]=o}}t.pairlst.push(e)}}return t}function fd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for svjson";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("sample");if(i!=-1)n[i]="sample";i=o("sampletype");if(i!=-1)n[i]="sampletype";i=o("patient");if(i!=-1)n[i]="patient";i=o("json","jsontext");if(i==-1)return["json missing from header"];n[i]="jsontext";return[null,n]}function pd(e,t,n,o){if(t==""||t[0]=="#")return;const i=t.split("\t");const s={};const r=n.svjson.badlines;for(let e=0;e<o.length;e++){s[o[e]]=i[e]}if(!s.jsontext){r.push([e,"missing jsontext",i]);return}if(sd(s,n,e,i)){return}let a;try{a=JSON.parse(s.jsontext)}catch(t){r.push([e,"invalid JSON text",i]);return}if(Array.isArray(a)){for(const e of a){if(e.a&&e.a.name&&e.a.isoform){n.good++;const t={dt:Dr,class:ra,isoform:e.a.isoform,mname:e.b.name};for(const e in s){if(e!="jsontext")t[e]=s[e]}t.pairlst=ud(a);const o=e.a.name.toUpperCase();if(!n.data[o]){n.data[o]=[]}n.data[o].push(t)}if(e.b&&e.b.name&&e.b.isoform){n.good++;const t={dt:Dr,class:ra,isoform:e.b.isoform,mname:e.a.name};for(const e in s){if(e!="jsontext")t[e]=s[e]}t.pairlst=ud(a);const o=e.b.name.toUpperCase();if(!n.data[o]){n.data[o]=[]}n.data[o].push(t)}}}else{a.dt=a.typecode;delete a.typecode;switch(a.dt){case qr:a.class=Zr;a.mname="ITD";break;case Gr:a.class=Qr;a.mname="N-loss";break;case Jr:a.class=ea;a.mname="C-loss";break;case Hr:a.class=Kr;a.mname="Del";break;case Fr:a.class=aa;a.mname="SV";break;default:r.push([e,"unknown datatype",i]);return}if(!a.gene){r.push([e,"json.gene missing",i]);return}n.good++;for(const e in s){if(e!="jsontext"){a[e]=s[e]}}const t=n.geneToUpper?a.gene.toUpperCase():a.gene.toUpperCase();if(!n.data[t]){n.data[t]=[]}n.data[t].push(a)}}function ud(e){const t=[];for(const n of e){const e={a:{},b:{}};for(const t in n){if(t!="a"&&t!="b")e[t]=n[t]}for(const t in n.a){e.a[t]=n.a[t]}for(const t in n.b){e.b[t]=n.b[t]}t.push(e)}return t}function hd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for CNV";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("cnv");if(i==-1)return"CNV missing from header";n[i]="cnv";i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.cnv.header=n;t.cnv.loaded=true;return false}function md(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.cnv.header.length;e++){i[n.cnv.header[e]]=o[e]}if(!i.gene){n.cnv.badlines.push([e,"missing gene",o]);return}if(!i.cnv){n.cnv.badlines.push([e,"missing cnv value",o]);return}const s=i.cnv.toLowerCase();switch(s){case"amplification":case"gain":i.class=la;break;case"deletion":case"loss":i.class=ca;break;case"loh":i.class=da;break;default:n.cnv.badlines.push([e,"invalid cnv value: "+i.cnv,o]);i.class=null}if(!i.class){return}if(sd(i,n,e,o,n.cnv.badlines)){return}i.dt=Br;n.good++;const r=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(r in n.data)){n.data[r]=[]}n.data[r].push(i)}function gd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for ITD";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("rnaposition");if(i!=-1){n[i]="rnaposition";i=o("rnaduplength");if(i==-1)return"rnaduplength is required when rnaposition is present";n[i]="rnaduplength"}i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("chr_start");if(i==-1)return"chr_start is required when chr is present";n[i]="chrpos1";i=o("chr_stop");if(i==-1)return"chr_stop is required when chr is present";n[i]="chrpos2"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.itd.header=n;t.itd.loaded=true;return false}function bd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.itd.header.length;e++){if(o[e]==undefined)break;i[n.itd.header[e]]=o[e]}if(!i.gene){n.itd.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){let t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t;if(!i.rnaduplength){n.itd.badlines.push([e,"missing rnaDuplength value",o]);return}t=Number.parseInt(i.rnaduplength);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid rnaDuplength value",o]);return}i.rnaduplength=t}if(i.chr){let t=Number.parseInt(i.chrpos1);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid chr_start value",o]);return}i.chrpos1=t;t=Number.parseInt(i.chrpos2);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid chr_stop value",o]);return}i.chrpos2=t}if(sd(i,n,e,o,n.itd.badlines)){return}i.dt=qr;i.class=Zr;i.mname="ITD";n.good++;var s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}function yd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for intragenic deletion";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("rnaposition");if(i!=-1){n[i]="rnaposition";i=o("rnadellength");if(i==-1)return"rnadellength is required when rnaPosition is used";n[i]="rnadellength"}i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("chr_start");if(i==-1)return"chr_start is required when chr is used";n[i]="chrpos1";i=o("chr_stop");if(i==-1)return"chr_stop is required when chr is used";n[i]="chrpos2"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.del.header=n;t.del.loaded=true;return false}function vd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.del.header.length;e++){if(o[e]==undefined)break;i[n.del.header[e]]=o[e]}if(!i.gene){n.del.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){let t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t;if(!i.rnadellength){n.del.badlines.push([e,"missing rnaDellength value",o]);return}t=Number.parseInt(i.rnadellength);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid rnaDellength value",o]);return}i.rnadellength=t}if(i.chr){let t=Number.parseInt(i.chrpos1);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid chr_start value",o]);return}i.chrpos1=t;t=Number.parseInt(i.chrpos2);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid chr_stop value",o]);return}i.chrpos2=t}if(sd(i,n,e,o,n.del.badlines)){return}i.dt=Hr;i.class=Kr;i.mname="DEL";n.good++;var s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}function wd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for truncation";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";let s=false;i=o("rnaposition");if(i!=-1){n[i]="rnaposition";s=true}i=o("losstype");if(i==-1)return"lossType missing from header";n[i]="losstype";let r=false;i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("start","start_position","wu_hg19_pos","chr_position","position");if(i==-1){return"genomic position missing from header"}n[i]="pos";r=true}if(!s&&!r){return"neither rnaposition nor genomic position is given"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.truncation.header=n;t.truncation.loaded=true;return false}function xd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.truncation.header.length;e++){i[n.truncation.header[e]]=o[e]}if(!i.gene){n.truncation.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){const t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.truncation.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t}if(i.pos){const t=Number.parseInt(i.pos);if(Number.isNaN(t)||t<0){n.truncation.badlines.push([e,"invalid genomic position",o]);return}i.pos=t}if(!i.losstype){n.truncation.badlines.push([e,"missing lossType value",o]);return}if(i.losstype!="n"&&i.losstype!="c"){n.truncation.badlines.push([e,'lossType value not "n" or "c"',o]);return}if(sd(i,n,e,o,n.truncation.badlines)){return}if(i.losstype=="n"){i.dt=Gr;i.class=Qr;i.mname="N-loss"}else{i.dt=Jr;i.class=ea;i.mname="C-loss"}n.good++;const s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}const _d=["heatmapJSON","piebarJSON","survivalJSON","discoJSON","riverJSON"];const kd={snvindel:0,si:0,sv:1,fusion:2,itd:3,deletion:4,truncation:5,cnv:6};let jd=false;class Nd{constructor(e){this.bt=e;this.err=this.errHandler();if(!jd){const e=Sd();if(e.project){this.getData(e.project);jd=true}}if(e.filediv){this.projectByInput(e.filediv)}}processData(e){const t=e.files.pop();const n=e.expectedFileNames.indexOf(t.name);if(n==-1){if(e.files.length)setTimeout((()=>{this.processData(e)}),1);return}e.expectedFileNames.splice(n,1);this.cohort={name:"project",genome:this.bt.genomes[this.bt.gselect.options[this.bt.gselect.selectedIndex].innerHTML]};if(!this.flag){this.flag=this.bt.init_bulk_flag(this.cohort.genome)}const o=this.bt.content2flag(t.content,t.type,this.flag);if(o){this.err(o);this.processData(e)}else if(!e.files.length){if(e.expectedFileNames.length){this.err('These referenced files were not found: "'+e.expectedFileNames.join('", "')+'".')}this.bt.flag2tp(this.flag,{name:"project"},Object.assign(this.cohort,e.schema),this.ds);return}else{if(!this.ds){for(const e in this.cohort.dsset){this.ds=this.cohort.dsset[e];break}}const n=this.bt.bulkin({flag:this.flag,cohort:this.cohort,flag2thisds:this.ds,filename:"project"},(()=>{this.processData(e)}));if(n){this.err("Error with "+t.name+": "+n);return}if(this.flag.good===0){this.err(t.name+": no data loaded");return}}}getData(e){const[t,n]=e.split("/");const o=n&&n.trim()?n.trim():"ref.txt";this.gettext("/data/projects/"+t+"/"+o,(e=>{const n={};const o={};const i={schema:{},files:[],expectedFileNames:[]};let s=0;e.trim().split("\n").forEach((e=>{const[t,i]=e.trim().split("\t");if(_d.includes(t)){o[i]=t;s+=1}else if(!kd[t]&&kd[t]!==0){this.err("Unrecognized type "+t+" for file "+i+" in reference.txt.")}else{n[i]=kd[t];s+=1}}));i.expectedFileNames=Object.keys(n);const r=this.getTracker(s,(()=>this.processData(i)));Object.keys(o).forEach((e=>{this.getjson("/data/projects/"+t+"/"+e,(t=>{i.schema[o[e]]=t;r()}))}));Object.keys(n).forEach((e=>{this.gettext("/data/projects/"+t+"/"+e,(t=>{i.files.push({name:e,type:n[e],content:t});r()}))}))}))}gettext(e,t){fetch(e).then((t=>{if(t.ok)return t.text();else this.err("File request error: "+e)})).then(t).catch((t=>this.err("File request error: "+e+" "+t)))}getjson(e,t){fetch(e).then((t=>{if(t.ok)return t.json();else this.err("Network error for "+e)})).then(t).catch((t=>this.err("file request error: "+e+" "+t)))}getTracker(e,t){let n=0;return function o(){n+=1;if(n==e){t()}}}projectByInput(e){this.tp=null;const t=e.append("div");t.append("span").html("Project: reference ");this.refNameInput=t.append("input").attr("type","text").property("value","ref.txt").style("margin-right","20px").style("padding-left","7px");t.append("label").attr("for","sja-pp-bulk-ui-project-btn").attr("class","sja_btn").style("padding","3px 5px").html("Choose folder");t.append("input").attr("type","file").attr("id","sja-pp-bulk-ui-project-btn").property("multiple",true).property("webkitdirectory",true).property("directory",true).on("change",(e=>this.readFiles(e)));t.append("div").style("margin","10px 10px 10px 0").html(`<a href="https://docs.google.com/document/d/1wlfGzyhxFYtWu9Fyf3FK7pgvS3rVb9_vrfYUBUOUrw4/edit?usp=sharing" target="new">Project user guide</a> | \n\t\t\t<a href='https://proteinpaint.stjude.org/ppdemo/projects/target-tall-project/ref.txt' target=_blank>Example project reference file</a>`);t.append("div").style("margin","20px").style("width","100%").html("-- OR --")}readFiles(e){const t=this;const n=t.refNameInput.property("value");const o=Array.from(e.target.files);const i=o.filter((e=>e.name==n))[0];if(!i){t.err("Missing reference file='"+n+"'.");return}const s={};const r={};const a={schema:{},files:[],expectedFileNames:[]};const l=new FileReader;let c="";let d=0;l.onload=e=>{e.target.result.trim().split("\n").forEach((e=>{const[n,o]=e.trim().split("\t");if(_d.includes(n)){r[o]=n}else if(!kd[n]&&kd[n]!==0){t.err("Unrecognized type "+n+" for file "+o+" in reference.txt.")}else{s[o]=kd[n]}}));a.expectedFileNames=Object.keys(s);const n=o.filter((e=>e.name in r));let i=0;if(!n.length){o.forEach(l)}else{n.forEach((e=>{const s=new FileReader;s.onload=s=>{const c=JSON.parse(s.target.result);i+=1;if(!c){t.err('Unable to parse schema file="'+e.name+'".')}else{a.schema[r[e.name]]=c}if(i==n.length){o.forEach(l)}};s.onerror=()=>{t.err("Error reading schema.txt.")};s.readAsText(e,"utf8")}))}function l(e){if(!a.expectedFileNames.includes(e.name)){d+=1;return}if(!e){t.err("Error reading file.");d+=1;return}if(e.size==0){t.err("Wrong file: "+e.name);d+=1;return}if(!s[e.name]&&s[e.name]!==0&&e.name!=c){t.err("Missing or invalid type assigned to file "+e.name+".");d+=1;return}const n=new FileReader;n.onload=n=>{d+=1;a.files.push({name:e.name,type:s[e.name],content:n.target.result});if(d==o.length){t.processData(a)}};n.onerror=()=>{d+=1;t.err("Error reading file "+e.name);if(d==o.length){t.processData(a)}};n.readAsText(e,"utf8")}};l.onerror=()=>{t.err("Error reading reference.txt.")};l.readAsText(i,"utf8")}errHandler(){const e=ot("body").append("div");return function(t){if(!t)return;xc(e,t)}}}function Sd(){const e={};window.location.search.substr(1).split("&").forEach((t=>{const[n,o]=t.split("=");e[n]=o}));return e}const Ad="root";const Cd="...";function Ed(e,t){const n=Object.create(null);const o=Object.create(null);const i=Object.create(null);for(const s of e){for(const[e,r]of t.entries()){const a=Od(s,e,t);const l=Od(s,e-1,t);if(!s[r.k]){if(e>0){i[l]+=1}break}n[a]=l;if(!(a in i)){i[a]=0}if(!(a in o)){const n={lst:[]};if(r.full){n.full=s[r.full]}n.id0=t[0].k;n.v0=s[t[0].k];if(e==1){n.id1=t[1].k;n.v1=s[t[1].k]}if(e==2){n.id2=t[2].k;n.v1=s[t[2].k]}o[a]=n}o[a].lst.push(s);if(e==t.length-1){i[a]+=1}}}const s=[{id:Ad,name:Ad}];for(const e in n){const t=n[e];const r=o[e];const a=e.split(Cd);s.push({id:e,parentId:t,lst:r.lst,value:i[e],name:a[a.length-1],full:r.full,id0:r.id0,v0:r.v0,id1:r.id1,v1:r.v1,id2:r.id2,v2:r.v2})}return s}function Od(e,t,n){const o=[Ad];for(let i=0;i<t;i++){o.push(e[n[i].k])}if(t>=0){o.push(e[n[t].k])}return o.join(Cd)}function Md(e){const t={id2vcf:{},label:e.name||"Unnamed VCF file"};let n;if(e.file){const o=Math.random().toString();n={file:e.file,indexURL:e.indexURL,vcfid:o};t.id2vcf[o]=n}else if(e.url){const o=Math.random().toString();n={url:e.url,indexURL:e.indexURL,vcfid:o};t.id2vcf[o]=n}else{return["no .file or .url"]}n.headernotloaded=true;if(e.samplenamemap){n.samplenamemap=e.samplenamemap}if(e.variant2img){if(!e.variant2img.path)return[".path missing from .variant2img{}"]}const o={type:mc.ds,isvcf:true,name:t.label,ds:t,populationfrequencyfilter:e.populationfrequencyfilter,vcfinfofilter:e.vcfinfofilter,itemlabelname:e.itemlabelname,viewrangeupperlimit:e.viewrangeupperlimit,variant2img:e.variant2img,axisheight:e.axisheight};if(e.url4variant){const t=Id(e.url4variant);if(t)return[".url4variant error: "+t];o.url4variant=e.url4variant}if(e.button4variant){const t=Td(e.button4variant);if(t)return[".button4variant error: "+t];o.button4variant=e.button4variant}if(e.sampleannotation){const t=e.sampleannotation;if(!t.annotation)return[".annotation{} missing from .sampleannotation"];if(t.levels){if(!Array.isArray(t.levels))return[".sampleannotation.levels should be array"];const e=[];for(const n in t.annotation){const o={sample_name:n};for(const e in t.annotation[n]){o[e]=t.annotation[n][e]}e.push(o)}const n=Ed(e,t.levels);t.root=wr()(n);t.root.sum((e=>e.value))}if(t.variantsunburst){if(!t.levels)return[".levels missing when .variantsunburst is on from .sampleannotation"]}o.ds.cohort=t}if(e.vcfcohorttrack){if(!e.vcfcohorttrack.file&&!e.vcfcohorttrack.url)return["no .file or .url provided from .vcfcohorttrack"];o.ds.vcfcohorttrack=e.vcfcohorttrack}if(e.germline2dvafplot){if(!e.germline2dvafplot.individualkey)return[".individualkey missing from germline2dvafplot"];if(!e.germline2dvafplot.sampletypekey)return[".sampletypekey missing from germline2dvafplot"];if(!e.germline2dvafplot.xsampletype)return[".xsampletype missing from germline2dvafplot"];if(!e.germline2dvafplot.yleftsampletype)return[".yleftsampletype missing from germline2dvafplot"];if(e.germline2dvafplot.yrightsampletype){if(e.germline2dvafplot.yrightsampletype==e.germline2dvafplot.yleftsampletype)return[".yrightsampletype should not be same as yleftsampletype"]}o.ds.germline2dvafplot=e.germline2dvafplot}if(e.vaf2coverageplot){if(e.vaf2coverageplot.categorykey){if(!e.vaf2coverageplot.categories)return[".categories missing when .categorykey is in use for .vaf2coverageplot"]}o.ds.vaf2coverageplot=e.vaf2coverageplot}if(e.genotype2boxplot){if(e.genotype2boxplot.boxplotvaluekey);else if(e.genotype2boxplot.sampleannotationkey){if(!o.ds.cohort)return["sampleannotation missing when using genotype2boxplot.sampleannotationkey"];if(!o.ds.cohort.annotation)return["sampleannotation.annotation missing when using genotype2boxplot.sampleannotationkey"];let t=false;for(const n in o.ds.cohort.annotation){if(e.genotype2boxplot.sampleannotationkey in o.ds.cohort.annotation[n]){t=true;break}}if(!t)return[e.genotype2boxplot.sampleannotationkey+" not found in any sample annotation"]}else{return["incomplete instruction for genotype2boxplot"]}o.ds.genotype2boxplot=e.genotype2boxplot}if(e.discardsymbolicallele){o.ds.discardsymbolicallele=true}if(e.samplebynumericvalue){if(!e.samplebynumericvalue.attrkey)return["attrkey missing from samplebynumericvalue"];if(!o.ds.cohort)return["sampleannotation missing when using samplebynumericvalue"];if(!o.ds.cohort.annotation)return["sampleannotation.annotation missing when using samplebynumericvalue"];let t=false;for(const n in o.ds.cohort.annotation){if(Number.isFinite(o.ds.cohort.annotation[n][e.samplebynumericvalue.attrkey])){t=true;break}}if(!t)return["samplebynumericvalue.attrkey not found in any sample annotation"];o.ds.samplebynumericvalue=e.samplebynumericvalue}{const t=e.genotypebynumericvalue;if(t){if(!t.refref)return[o.name+": refref missing from genotypebynumericvalue"];if(!t.refalt)return[o.name+": refalt missing from genotypebynumericvalue"];if(!t.altalt)return[o.name+": altalt missing from genotypebynumericvalue"];if(!t.refref.infokey)return[o.name+": refref.infokey missing from genotypebynumericvalue"];if(!t.refalt.infokey)return[o.name+": refalt.infokey missing from genotypebynumericvalue"];if(!t.altalt.infokey)return[o.name+": altalt.infokey missing from genotypebynumericvalue"];if(t.refref.genotypeCountInfokey||t.refalt.genotypeCountInfokey||t.altalt.genotypeCountInfokey){if(!t.refref.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.refref{}"];if(!t.refalt.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.refalt{}"];if(!t.altalt.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.altalt{}"]}o.ds.genotypebynumericvalue=t}}if(e.pointdown){o.aboveprotein=false}if(e.dstk_novcferror){o.dstk_novcferror=true}return[null,o]}function Id(e){if(!Array.isArray(e))return"value is not an array";for(const t of e){if(!t.makeurl){return".makeurl missing"}if(typeof t.makeurl!="function"){return".makeurl must be a function"}}return false}function Td(e){if(!Array.isArray(e))return"value is not an array";for(const t of e){if(!t.makebutton){return".makebutton missing"}if(typeof t.makebutton!="function"){return".makebutton must be a function"}}return false}function Rd(e,t,n,o){if(!e)return"no genome";if(!t)return"no chr name";const i=e.chrlookup[t.toUpperCase()];if(!i)return"Invalid chromosome name: "+i;if(!Number.isInteger(n))return"Non-numerical position: "+n;if(n<0||n>=i.len)return"Position out of range: "+n;if(!Number.isInteger(o))return"Non-numerical position: "+o;if(o<0||o>i.len)return"Position out of range: "+o;if(n>o)return"Start position is greater than stop";return false}function Ld(e,t,n){e=e.replace(/,/g,"");const o=t.chrlookup[e.toUpperCase()];if(o){return{chr:o.name,chrlen:o.len,start:Math.max(0,Math.ceil(o.len/2)-1e4),stop:Math.min(o.len,Math.ceil(o.len/2)+1e4)}}{const n=e.split(".");if(n.length>=2){const e=t.chrlookup[n[0].toUpperCase()];const o=Number.parseInt(n[1]);const i=Rd(t,n[0],o,o+1);if(!i){const t=400;return{chr:e.name,chrlen:e.len,start:Math.max(0,o-Math.ceil(t/2)),stop:Math.min(e.len,o+Math.ceil(t/2)),actualposition:{position:o,len:1}}}}}const i=e.split(/[-:\s]+/);if(i.length==2){const e=Number.parseInt(i[1]);const n=Rd(t,i[0],e,e+1);if(n){return null}const o=t.chrlookup[i[0].toUpperCase()];const s=400;return{chr:o.name,chrlen:o.len,start:Math.max(0,e-Math.ceil(s/2)),stop:Math.min(o.len,e+Math.ceil(s/2)),actualposition:{position:e,len:1}}}if(i.length==3){let e=Number.parseInt(i[1]),o=Number.parseInt(i[2]);const s=Rd(t,i[0],e,o);if(s){return null}const r={position:e,len:o-e};const a=t.chrlookup[i[0].toUpperCase()];if(!n){const t=400;if(o-e<t){let n=Math.ceil((e+o)/2);if(n+t/2>=a.len){n=a.len-Math.ceil(t/2)}e=Math.max(0,n-Math.ceil(t/2));o=e+t}}return{chr:a.name,chrlen:a.len,start:e,stop:o,actualposition:r}}return null}function $d(e,t,n=0){const o=t.strand=="-";const i={};if(e<t.start){if(o){i.atdownstream={off:t.start-e};i.rnapos=t.rnalen;if(t.cdslen){i.aapos=t.cdslen/3}}else{i.atupstream={off:t.start-e};i.rnapos=0;if(t.cdslen){i.aapos=0}}return i}if(e>=t.stop){if(o){i.atupstream={off:e-t.stop+1};i.rnapos=0;if(t.cdslen){i.aapos=0}}else{i.atdownstream={off:e-t.stop+1};i.rnapos=t.rnalen;if(t.cdslen){i.aapos=t.cdslen/3}}return i}if(e>=t.start&&e<t.stop){for(let s=0;s<t.exon.length;s++){const r=t.exon[s];if(o){if(r[1]+n<=e){i.atexon=s+1;i.atintron=s;break}if(r[0]-n<=e){i.atexon=s+1;break}}else{if(r[0]-n>e){i.atexon=s+1;i.atintron=s;break}if(r[1]+n>e){i.atexon=s+1;break}}}}let s=0;for(const n of t.exon){if(o){if(e>=n[1]){s+=.5;break}if(e<n[0]){s+=n[1]-n[0];continue}s+=n[1]-e;break}else{if(e<n[0]){s+=.5;break}if(e>=n[1]){s+=n[1]-n[0];continue}s+=e-n[0]+1;break}}i.rnapos=s;if(t.coding){let n=0;if(t.utr5){n=t.utr5.reduce(((e,t)=>e+t[1]-t[0]),0)}let r=0;if(t.utr3){r=t.utr3.reduce(((e,t)=>e+t[1]-t[0]),0)}if(s<=n){i.aapos=0}else if(s>n+t.cdslen){i.aapos=t.cdslen/3}else{i.aapos=Math.ceil((s-n)/3)}if(e<t.codingstart){let s=0;if(o){if(t.utr3){for(const n of t.utr3){s+=Math.max(n[1],e)-Math.max(n[0],e)}i.atutr3={total:r,off:s}}}else{if(t.utr5){for(const n of t.utr5){s+=Math.min(n[1],e)-Math.min(n[0],e)}i.atutr5={total:n,off:s}}}}else if(e>t.codingstop){let s=0;if(o){if(t.utr5){for(const n of t.utr5){s+=Math.max(n[1],e)-Math.max(n[0],e)}i.atutr5={total:n,off:s}}}else{if(t.utr3){for(const n of t.utr3){s+=Math.min(n[1],e)-Math.min(n[0],e)}i.atutr3={total:r,off:s}}}}}return i}function zd(e,t){if(!Number.isInteger(e))return null;if(!t.coding)return null;let n=0;for(const o of t.coding){if(n+o[1]-o[0]>=(e-1)*3){if(t.strand=="+"){return o[0]+(e-1)*3-n}return o[1]-1-((e-1)*3-n)}n+=o[1]-o[0]}if(t.strand=="+")return t.codingstop;return t.codingstart}function Pd(e,t){if(!Number.isFinite(e))return null;if(!t.exon)return null;let n=0;for(const o of t.exon){if(n+o[1]-o[0]>=e){if(t.strand=="+"){return o[0]+e-n}return o[1]-1-e+n}n+=o[1]-o[0]}if(t.strand=="+")return t.stop;return t.start}let Dd;function Ud(){if(window.sjcharts){return Promise.resolve(window.sjcharts)}else if(Dd){return Dd}else{Dd=new Promise(((e,t)=>{const n=window.location.hostname.split(".")[0];const o=["pp-test","pecan-test","ppr"].includes(n)?`${n}.stjude.org`:"proteinpaint.stjude.org";const i=`https://${o}/sjcharts/bin/sjcharts.js`;const s=document.createElement("script");s.setAttribute("type","text/javascript");s.setAttribute("src",i);document.getElementsByTagName("head")[0].appendChild(s);s.onload=()=>{e(window.sjcharts)};s.onerror=()=>{const e="Unable to load SJCharts from "+i;alert(e);t(e)}}));return Dd}}function Bd(e){if(!e.p2st){e.p2st={}}if(!e.assays){e.assays=[]}if(!Array.isArray(e.assays)){return".assays should be an array"}e.assaylst=[];let t=0;for(const n of e.assays){const o=e[n];if(!o){return'Assay "'+n+'" not found in cohort'}const i=o.config;if(!i){return'.config object missing for assay "'+n+'"'}delete o.config;if(!i.type){return'.config.type missing for assay "'+n+'"'}if(i.type.toLowerCase()=="vcf"){i.type=mc.ds;i.isvcf=true}else{if(!Sa(i.type)){return'unknown .config.type "'+i.type+'" for assay "'+n+'"'}}i.id=(++t).toString();if(!i.name){i.name=n}if(i.type==mc.junction){if(i.readcountcutoff){if(!Number.isInteger(i.readcountcutoff)||i.readcountcutoff<0){return'invalid .config.readcountcutoff for assay "'+n+'"'}}}e.assaylst.push(i);for(const t in o){if(!e.p2st[t]){e.p2st[t]={}}for(const s in o[t]){if(!e.p2st[t][s]){e.p2st[t][s]={tktemplate:[]}}if(i.type==mc.vafs1){for(const r in o[t][s]){const a=o[t][s][r];if(!a.file&&!a.url){return"no file or URL for "+r+" vafs1 of "+t+", "+s}a.type=mc.vafs1;a.patient=t;a.sampletype=s;a.assayname=n;a.id=i.id;a.tkid=Math.random().toString();if(!a.name){a.name=r+" vaf"}e.p2st[t][s].tktemplate.push(a)}continue}let r=[];if(Array.isArray(o[t][s])){r=o[t][s]}else{r.push(o[t][s])}for(const o of r){let r=o;if(!r.file&&!r.url){return"track has no file or url (sample: "+t+", assay: "+n+")"}if(r.name);else if(r.partname){r.name=t+(s==t?"":" "+s)+" "+n+" "+r.partname}else{r.name=t+(s==t?"":" "+s)+" "+n}if(i.isvcf){const[e,t]=Md({name:r.name,file:r.file,url:r.url});if(e){return"VCF track error: "+e}r=t}else{if(r.type){if(!Sa(r.type)){return'invalid track type "'+r.type+'" (sample: '+t+", assay: "+n+")"}}else{r.type=i.type}}r.patient=t;r.sampletype=s;r.assayname=n;r.id=i.id;r.tkid=Math.random().toString();e.p2st[t][s].tktemplate.push(r);switch(i.type){case mc.bigwig:const e=qd(r,i);if(e){return"Assay "+n+": "+i.type+" track error: "+e}break;case mc.junction:r.categories=i.categories;r.readcountcutoff=i.readcountcutoff;break}}}}}delete e.assays;{const t=Hd(e);if(t){return"Error: "+t}}if(e.patientannotation){const t=Jd(e);if(t)return t}if(e.browserview){const t=Gd(e);if(t)return t}if(e.e2pca){if(!e.e2pca.list)return".list missing from e2pca";if(!Array.isArray(e.e2pca.list))return"e2pca.list should be an array";if(e.e2pca.list.length==0)return"e2pca.list[] length 0";if(!e.e2pca.label){e.e2pca.label="Expression - PCA"}for(const t of e.e2pca.list){if(!t.vectorfile)return"vectorfile missing from e2pca";if(!t.dbfile)return"dbfile missing from e2pca"}}return}function Fd(e,t,n,o,i,s,r){const a=n.append("div").style("color","#858585");a.text("Loading "+t+" ...");return fetch(o+"/study",{method:"POST",body:JSON.stringify({file:t,jwt:i})}).then((e=>e.json())).then((l=>{if(!l){a.text("Server error!");return}if(l.error){a.text("Error loading study: "+l.error);return}const c=l.cohort;if(!c){a.text(".cohort missing");return}if(!c.genome){a.text("No genome specified in the cohort JSON content");return}const d=e[c.genome];if(!d){a.text("Invalid genome from cohort: "+c.genome);return}c.genome=d;c.jwt=i;if(!l.flagset){a.text(".flagset missing");return}a.text("");c.dsset={};for(const e in l.flagset){const n=l.flagset[e];n.genome=d;nf({flag:n,filename:t,cohort:c,err:e=>xc(a,e)})}const f=Bd(c);if(f){xc(a,f)}if(!s){return import("./tp.ui-221efed6.js").then((function(e){return e.t})).then((async e=>{Ud().catch(console.error);e.default(c,n,o,r);return r}))}}))}function qd(e,t){if(!t){t={}}if(!e.file&&!e.url){return"no file or url"}if(!e.pcolor){e.pcolor=t.pcolor||"#0066CC"}if(!e.pcolor2){e.pcolor2=t.pcolor2||"#CC0000"}if(!e.ncolor){e.ncolor=t.ncolor||"#FF850A"}if(!e.ncolor2){e.ncolor2=t.ncolor2||"#0A85FF"}if(!e.height){e.height=t.height||50}const n={};if(t.scale){for(const e in t.scale){n[e]=t.scale[e]}}if(e.scale){for(const t in e.scale){n[t]=e.scale[t]}}n.auto=true;if(Number.isFinite(n.min)&&Number.isFinite(n.max)){delete n.auto}else if(Number.isFinite(n.percentile)){delete n.auto}e.scale=n}function Hd(e){const t=[];for(const n in e.p2st){for(const o in e.p2st[n]){const i=e.p2st[n][o].tktemplate;if(!i)continue;for(const e of i){t.push(e)}}}if(e.browserview&&e.browserview.assays){for(const n in e.browserview.assays){const o=e.browserview.assays[n];if(o.combined&&o.combinetk){t.push(o.combinetk)}}}if(!e.genome.tkset){e.genome.tkset=[]}const n={name:e.name,tklst:t};if(e.trackfacets){if(!Array.isArray(e.trackfacets)){return".trackfacets is not an array"}const t=[];for(const n of e.trackfacets){if(!n.samples){return"trackfacets: .samples missing from facet "+n.name}if(!Array.isArray(n.samples)){return"trackfacets: .samples is not array from facet "+n.name}if(!n.assays){return"trackfacets: .assays missing from a facet "+n.name}if(!Array.isArray(n.assays)){return"trackfacets: .assays is not array from a facet "+n.name}t.push(n)}if(t.length){n.facetlst=t}}e.genome.tkset.push(n);return null}function Gd(e){if(e.browserview.position){let t;if(typeof e.browserview.position=="string"){t=Ld(e.browserview.position,e.genome);if(!t){return".browserview.position invalid value"}}else{t=e.browserview.position}const n=Rd(e.genome,t.chr,t.start,t.stop);if(n){return".browserview.position error: "+n}e.browserview.position=t}else{e.browserview.position={chr:e.genome.defaultcoord.chr,start:e.genome.defaultcoord.start,stop:e.genome.defaultcoord.stop}}if(e.browserview.assays){for(const t in e.browserview.assays){if(typeof e.browserview.assays[t]!="object"){e.browserview.assays[t]={}}const n=e.browserview.assays[t];for(const o of e.assaylst){if(o.name==t){n.assayobj=o;break}}if(!n.assayobj){console.log("missing assayobj for assayview of "+t);continue}if(n.sum_view){delete n.sum_view;n.combined=true}if(n.combined){const o={};for(const e in n.assayobj){o[e]=n.assayobj[e]}for(const e in n){if(e=="assayobj")continue;o[e]=n[e]}if(!o.name){o.name=t}o.tracks=[];for(const t in e.p2st){for(const i in e.p2st[t]){for(const s of e.p2st[t][i].tktemplate){if(s.id==n.assayobj.id){s.patient=t;s.sampletype=i;o.tracks.push(s)}}}}if(o.isvcf){o.ds={id2vcf:{},label:o.name};for(const e of o.tracks){for(const t in e.ds.id2vcf){e.__vcfobj=e.ds.id2vcf[t]}o.ds.id2vcf[e.__vcfobj.vcfid]=e.__vcfobj}}n.combinetk=o}}}if(e.browserview.defaultassaytracks){if(!Array.isArray(e.browserview.defaultassaytracks))return".browserview.defaultassaytracks must be array";for(let t=0;t<e.browserview.defaultassaytracks.length;t++){const n=e.browserview.defaultassaytracks[t];if(!n.assay)return".assay missing from .defaultassaytracks #"+(t+1);if(!e[n.assay])return"unknown assay name from .defaultassaytracks #"+(t+1)+": "+n.assay;if(!n.level1)return".level1 missing from .defaultassaytracks #"+(t+1);if(!e[n.assay][n.level1])return"level1 not exist in assay from .defaultassaytracks #"+(t+1)+": "+n.level1;if(n.level2){if(!e[n.assay][n.level1][n.level2])return"level2 not exist in assay from .defaultassaytracks #"+(t+1)+": "+n.level2}}}return null}function Jd(e){if(!e.patientannotation.annotation){return".patientannotation.annotation missing"}if(!e.patientannotation.metadata){return".patientannotation.metadata missing"}if(!Array.isArray(e.patientannotation.metadata)){return".patientannotation.metadata should be an array"}const t={};for(const n of e.patientannotation.metadata){if(n.key==undefined){return"patientannotation: key missing for a metadata term"}if(!n.values){return"patientannotation: values missing for metadata term "+n.key}if(!Array.isArray(n.values)){return"patientannotation: .values not an array for metadata term "+n.key}if(!n.label){n.label=n.key}t[n.key]={label:n.label,values:{}};const e=At(Nr);for(const o of n.values){if(o.key==undefined){return"key missing for an attribute of term "+n.key}if(!o.label){o.label=o.key}if(!o.color){o.color=e(o.key)}t[n.key].values[o.key]=o}}e.patientannotation.mdh=t;return null}const Vd={color:"#ccc"};const Wd={x:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(255,100,100)").style("opacity",.9).style("font-weight",700).style("font-size","18px").style("transform","rotate(-45deg)").style("cursor","pointer").html("⊕").on("click",t.handler),plus:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","18px").html("⊕").on("click",t.handler),combine:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","12px").style("color","rgb(100,100,255)").style("cursor","pointer").html("[]+[]").on("click",t.handler),divide:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","12px").style("color","rgb(100,100,255)").style("cursor","pointer").html("[÷]").on("click",t.handler),expand:(e,t)=>{const n="color"in t?t.color:"rgb(100,100,255)";return e.attr("title",t.title).style("height","auto").style("color",n).style("opacity",.9).style("font-size","fontSize"in t?t.fontSize:"16px").style("padding","padding"in t?t.padding:"0 2px").style("display","display"in t?t.display:"inline-block").style("cursor","pointer").html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${n}" class="bi bi-square" viewBox="0 0 16 16" >\n\t\t\t\t\t <path stroke='${n}' stroke-width='1' d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>\n\t\t\t\t\t</svg>`).on("click",t.handler)},collapse:(e,t)=>{const n="color"in t?t.color:"rgb(100,100,255)";return e.attr("title",t.title).style("height","auto").style("color",n).style("opacity",.9).style("font-size","fontSize"in t?t.fontSize:"16px").style("padding","padding"in t?t.padding:"0 2px").style("display","display"in t?t.display:"inline-block").style("cursor","pointer").html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${n}" class="bi bi-dash-lg" viewBox="0 0 16 16">\n\t\t\t\t\t <path stroke='${n}' stroke-width='1' fill-rule="evenodd" d="M2 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11A.5.5 0 0 1 2 8Z"/>\n\t\t\t\t\t</svg>`).on("click",t.handler)},corner:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color",t.disabled?Vd.color:"rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html("⇱").on("click",t.handler),left:(e,t)=>{const n=t.fill?t.fill:t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("color",t.disabled?Vd.color:"rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M0,6L12,0L12,12Z' style='fill:${n}'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler)},right:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding-top","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,0)'>\n\t\t\t\t\t<path d='M0,0L12,6L0,12Z' style='fill:rgb(100,100,255)'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),up:(e,t)=>{const n=t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<path d='M6,0L12,12L0,12Z' style='fill:${n}'></path>\n\t\t\t</svg>`).on("click",t.handler)},down:(e,t)=>{const n=t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M0,0L12,0L6,12Z' style='fill:${n}'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler)},updown:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("text-decoration","underline").style("cursor","pointer").html("⇵").on("click",t.handler),seHookArrow:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("cursor","pointer").html("⤥").on("click",t.handler),swHookArrow:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("cursor","pointer").html("⤦").on("click",t.handler),unlock:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t<g transform="scale(0.045)" fill="rgb(100,100,255)">\n\t\t\t\t<path d="m299.02 161.26h-185.84v-46.28c0-41.34 33.635-74.979 74.979-74.979 33.758 0 63.51 22.716 72.36 55.24 2.898 10.657 13.888 16.946 24.547 14.05 10.659-2.898 16.949-13.889 14.05-24.548-13.57-49.896-59.2-84.74-110.96-84.74-63.4 0-114.98 51.58-114.98 114.98v46.715c-9.06 1.902-15.888 9.952-15.888 19.571v175.05c0 11.03 8.972 20 20 20h221.73c11.03 0 20-8.972 20-20v-175.05c0-11.03-8.972-20-20-20"/>\n\t\t\t</g>\n\t\t</svg>`).on("click",t.handler),leftBorder:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M1,6L11,1L11,11Z' style='stroke:rgb(100,100,255); stroke-width:1px; fill:#ececec'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),leftCrossedOut:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M1,6L11,1L11,11Z' style='stroke:rgb(100,100,255); stroke-width:1px; fill:#ececec'></path>\n\t\t\t\t\t<text x='3' y='10' style='font-size:12; fill:#f00; font-weight:bold'>X</text>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),filter:(e,t)=>{e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").on("click",t.handler);e.iconPath=e.append("svg").attr("width",16).attr("height",12).append("g").attr("transform","translate(8,1)").append("path").attr("d","M8,0L2,6L2,12L-2,12L-2,6L-8,0Z").style("fill","rgb(100,100,255)");return e},colorScale:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t\t<defs>\n\t\t\t\t\t<linearGradient id='`+t.linearGradientId+`'>\n\t\t\t\t\t\t<stop offset='0' stop-color='red'></stop>\n\t\t\t\t\t\t<stop offset='1' stop-color='blue'></stop>\n\t\t\t\t\t</linearGradient>\n\t\t\t\t</defs>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x='0' y='1' width='10' height='10' fill='url(#`+t.linearGradientId+`)'></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),bar:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x='0' y='0' width='3' height='11' fill='rgb(100,100,255)'></rect>\n\t\t\t\t\t<rect x='4' y='6' width='3' height='5' fill='rgb(100,100,255)'></rect>\n\t\t\t\t\t<rect x='8' y='3' width='3' height='8' fill='rgb(100,100,255)'></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),rect:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("stroke","rgb(100,100,255)").style("fill","fill"in t?t.fill:"none").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x="0" y="1" width="10" height="10"></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),text:(e,t)=>{const n=e.append("div").style("display","none");const o=n.append("input");o.attr("type","text").style("width",t.width+"px").style("margin","0 0 1px 2px").style("border","1px solid #aaa").style("border-spacing",0).style("height","21px").style("padding",0).style("background-color","#fff").style("cursor","pointer").on("change",t.handler).on("click.tphm2",(e=>e.stopPropagation()));n.append("button").style("margin",0).style("border-spacing",0).style("padding","2px").html("add").on("click",t.handler);return{wrapper:n,input:o}},html:(e,t)=>{select(e.node().parentNode).append("span").html(t.html);if(t.styles){for(const t in styles){e.style(t,styles[t])}}return e},restart:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-house-fill" viewBox="0 0 16 16">\n\t\t<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>\n\t\t<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},zoomIn:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>\n\t<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>\n\t<path fill-rule="evenodd" d="M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5z"/>\n\t</svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},zoomOut:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t\t<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>\n\t\t<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>\n\t\t<path fill-rule="evenodd" d="M3 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},lasso:(e,t)=>{const n={color:"black",width:18,height:18};const o=!t.enabled?"transparent":"rgb(207, 226, 243)";Object.assign(n,t);const i=`<button style="cursor:pointer;border:none;background-color:${o};"><svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t\t<path d="M15.825.12a.5.5 0 0 1 .132.584c-1.53 3.43-4.743 8.17-7.095 10.64a6.067 6.067 0 0 1-2.373 1.534c-.018.227-.06.538-.16.868-.201.659-.667 1.479-1.708 1.74a8.118 8.118 0 0 1-3.078.132 3.659 3.659 0 0 1-.562-.135 1.382 1.382 0 0 1-.466-.247.714.714 0 0 1-.204-.288.622.622 0 0 1 .004-.443c.095-.245.316-.38.461-.452.394-.197.625-.453.867-.826.095-.144.184-.297.287-.472l.117-.198c.151-.255.326-.54.546-.848.528-.739 1.201-.925 1.746-.896.126.007.243.025.348.048.062-.172.142-.38.238-.608.261-.619.658-1.419 1.187-2.069 2.176-2.67 6.18-6.206 9.117-8.104a.5.5 0 0 1 .596.04zM4.705 11.912a1.23 1.23 0 0 0-.419-.1c-.246-.013-.573.05-.879.479-.197.275-.355.532-.5.777l-.105.177c-.106.181-.213.362-.32.528a3.39 3.39 0 0 1-.76.861c.69.112 1.736.111 2.657-.12.559-.139.843-.569.993-1.06a3.122 3.122 0 0 0 .126-.75l-.793-.792zm1.44.026c.12-.04.277-.1.458-.183a5.068 5.068 0 0 0 1.535-1.1c1.9-1.996 4.412-5.57 6.052-8.631-2.59 1.927-5.566 4.66-7.302 6.792-.442.543-.795 1.243-1.042 1.826-.121.288-.214.54-.275.72v.001l.575.575zm-4.973 3.04.007-.005a.031.031 0 0 1-.007.004zm3.582-3.043.002.001h-.002z"/>\n\t\t</svg></button>`;e.html(i).on("click",t.handler)},download:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-download" viewBox="0 0 16 16">\n\t\t<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/>\n\t\t<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},help:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-question-circle" viewBox="0 0 16 16">\n\t\t<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n\t\t<path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286zm1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},search:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-search" viewBox="0 0 16 16">\n\t\t<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},crosshair:(e,t={})=>{const n={color:"black",width:18,height:18,d:2};const o=n.width;const i=n.height;const s=n.d;Object.assign(n,t);const r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" style='vertical-align: middle'>\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path d="M${o/2},${s}L${o/2},${i-s}Z" stroke='${n.color}'/>\n\t\t<path d="M${s},${i/2}L${o-s},${i/2}Z" stroke='${n.color}'/>\n\t\t</svg>`;e.html(r).on("click",t.handler).style("cursor","pointer")},grab:(e,t={})=>{const n={color:"black",width:18,height:18,transform:""};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" viewBox="0 0 448 512">\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path transform='${n.transform}' d="M144 64c0-8.8 7.2-16 16-16s16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16V264c0 31.3-20 58-48 67.9c-9.6 3.4-16 12.5-16 22.6V488c0 13.3 10.7 24 24 24s24-10.7 24-24V370.2c38-20.1 64-60.1 64-106.2V160c0-35.3-28.7-64-64-64c-2.8 0-5.6 .2-8.3 .5C332.8 77.1 311.9 64 288 64c-2.8 0-5.6 .2-8.3 .5C268.8 45.1 247.9 32 224 32c-2.8 0-5.6 .2-8.3 .5C204.8 13.1 183.9 0 160 0C124.7 0 96 28.7 96 64v64.3c-11.7 7.4-22.5 16.4-32 26.9l17.8 16.1L64 155.2l-9.4 10.5C40 181.8 32 202.8 32 224.6v12.8c0 49.6 24.2 96.1 64.8 124.5l13.8-19.7L96.8 361.9l8.9 6.2c6.9 4.8 14.4 8.6 22.3 11.3V488c0 13.3 10.7 24 24 24s24-10.7 24-24V359.9c0-12.6-9.8-23.1-22.4-23.9c-7.3-.5-14.3-2.9-20.3-7.1l-13.1 18.7 13.1-18.7-8.9-6.2C96.6 303.1 80 271.3 80 237.4V224.6c0-9.9 3.7-19.4 10.3-26.8l9.4-10.5c3.8-4.2 7.9-8.1 12.3-11.6V208c0 8.8 7.2 16 16 16s16-7.2 16-16V142.3 128 64z"/>\n\t\t</svg>`;e.html(o).style("cursor","pointer");if(t.handler)e.on("click",t.handler)},arrowPointer:(e,t={})=>{const n={color:"black",width:18,height:18,transform:""};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" viewBox="0 0 320 512">\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path transform='${n.transform}' d="M0 55.2V426c0 12.2 9.9 22 22 22c6.3 0 12.4-2.7 16.6-7.5L121.2 346l58.1 116.3c7.9 15.8 27.1 22.2 42.9 14.3s22.2-27.1 14.3-42.9L179.8 320H297.9c12.2 0 22.1-9.9 22.1-22.1c0-6.3-2.7-12.3-7.4-16.5L38.6 37.9C34.3 34.1 28.9 32 23.2 32C10.4 32 0 42.4 0 55.2z"/>\n\t\t</svg>`;e.html(o).style("cursor","pointer");if(t.handler)e.on("click",t.handler)}};function Xd(e,t){e.classed("sjpp-sandbox-form",true);const n=e.append("div").style("margin","40px 20px 20px 20px").classed("sjpp-sandbox-form-inputDiv",true);const o=n.append("p").classed("sjpp-sandbox-form-gselect",true);o.append("span").html("Genome ");const i=o.append("select");for(const e in t){i.append("option").text(e)}const s=n.append("div").style("margin","20px 0px").classed("sjpp-sandbox-form-fileDiv",true);const r=e.append("div").style("margin","10px 20px").classed("sjpp-sandbox-form-sayDiv",true);const a=e.append("div").style("margin","20px").classed("sjpp-sandbox-form-visualDiv",true);return[n,i.node(),s,r,a]}const Yd={};const Zd=Math.random().toString().slice(-6)+"-"+(+new Date).toString().slice(-8);let Kd=0;function Qd(e,t={}){var n,o;const i=t.beforePlotId?"#"+Yd[t.beforePlotId]:":first-child";const s=e.insert("div",i).attr("class","sjpp-sandbox");let r;if(t.plotId){r=`sjpp-sandbox-${Zd}-${Kd++}`;s.attr("id",r);Yd[t.plotId]=r}const a=s.append("div").attr("class","sjpp-output-sandbox-header").style("width",((n=t.style)===null||n===void 0?void 0:n.width)||"95vw").style("border","1px solid #ccc").style("display","flex").style("align-items","center").style("justify-content","left");const l="blue";const c="black";const d=a.append("div").classed("sjpp-output-sandbox-close-bt",true).style("cursor","pointer").style("vertical-align","middle").on("mouseenter",(()=>{const e=d.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=d.select("path");e.attr("stroke",c)})).html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#000" class="bi bi-x-lg" viewBox="0 0 16 16">\n\t\t <path stroke='#000' d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>\n\t\t</svg>`).on("mousedown",(e=>{document.body.dispatchEvent(new Event("mousedown"));e.stopPropagation()})).on("click",(()=>{a.on("click",null).on("mousedown",null);s.selectAll("*").remove();if(typeof t.close==="function")t.close()}));const f=a.append("div").classed("sjpp-output-sandbox-collapse-btn",true);const p=a.append("div").classed("sjpp-output-sandbox-expand-btn",true).style("display","none");const u=a.append("div").style("display","inline-flex").style("align-items","center").style("justify-content","left").style("padding","5px 10px");const h=s.append("div").attr("class","sjpp-output-sandbox-content").style("width",((o=t.style)===null||o===void 0?void 0:o.width)||"95vw");let m=true;Wd["collapse"](f,{fontSize:"1.5em",padding:"4px 10px",color:"black",handler:g});Wd["expand"](p,{fontSize:"1.5em",padding:"4px 10px",color:"black",display:"none",handler:g});f.on("mouseenter",(()=>{const e=f.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=f.select("path");e.attr("stroke",c)}));p.on("mouseenter",(()=>{const e=p.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=p.select("path");e.attr("stroke",c)}));function g(){m=!m;f.style("display",m==true?"inline-block":"none");p.style("display",m==true?"none":"inline-block");h.style("display",m==true?"block":"none")}return{header_row:a,header:u,body:h,app_div:s,id:r}}function ef(e,t,n,o,i,s){let r,a,l,c,d,f;if(i!==undefined)[a,l,c,d,f]=Xd(i,n);else{[r,a,l,c,d,f]=Mc(e,t,n);r.header.text("Load mutation from text files")}a.append("div").style("margin","20px 0px").style("color","#858585").html(`\n\t<p>Choose one file and upload to initiate the display panel.<br>From there you can add additional files.</p>\n\t<div>Supported data types:</div>\n\t<ul>\n\t <li>SNV and indel</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1OJ9aXq2_-a3BfIQdKLYCYzrJRTpu4_9i3gephTY-Z38 target=_blank>Format</a>,\n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.snvindel.txt target=_blank>example file</a></li>\n\t </ul>\n\t <li>SV or fusion transcript</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1klDZ0MHVkQTW2-lCu_AvpRE4_FcbhdB-yI17wNdPaOM target=_blank>Tabular format</a>,\n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.svfusion.txt target=_blank>example file</a>\n\t\t</li>\n\t\t<li>JSON-format, to come</li>\n\t </ul>\n\t <li>CNV, gene-level</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1WHptqOWNf96V0bYEDpj-EsKZGYnbBNc9aQIrhzdEJaU target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.cnv.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>ITD</li>\n\t <ul>\n\t \t<li>Internal tandem duplication, in-frame</li>\n\t <li><a href=https://drive.google.com/open?id=1Bh9awBsraoHbV8iWXv_3oDeXMsjIAHaOKHr973IJyZc target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.itd.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>Intragenic deletion, in-frame</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1tWbf3rg3BmVIZPGGPk023P0aBkDw_ry5XuZLGyGodyg target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.deletion.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>Truncation</li>\n\t <ul>\n\t \t<li>Either N-terminus loss or C-terminus loss</li>\n\t <li><a href=https://drive.google.com/open?id=1P1g-Y8r30pSKfan1BhYZcsUtSk7wRb4plaO1S-JCJr4 target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.truncation.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t</ul>`);const p=()=>{c.selectAll("*").remove();new Nd({bulkin:nf,genomes:n,gselect:l,content2flag:tf,flag2tp:h,filediv:c,init_bulk_flag:id});c.append("span").html("Select data type ");const e=Tc(c).style("margin-right","20px");const t=c.append("input").attr("type","file").on("change",(t=>{const o=id(n[l.options[l.selectedIndex].innerHTML]);o.geneToUpper=u.property("checked");d.text("");const i=t.target.files[0];if(!i){p();return}if(i.size==0){d.text("Wrong file: "+i.name);p();return}const s=new FileReader;s.onload=t=>{const n=tf(t.target.result,e.node().selectedIndex,o);if(n){d.text("Error: "+n);p();return}h(o,i)};s.onerror=function(){d.text("Error reading file "+i.name);p();return};d.text("Parsing file "+i.name+" ...");s.readAsText(i,"utf8")}));setTimeout((()=>t.node().focus()),1100)};p();c.append("span").html("<br/>Convert gene name to uppercase ");const u=c.append("span").append("input").attr("type","checkbox").property("checked",true);function h(e,t,n=null,s=null){if(typeof e=="string"){d.text(e);p();return}d.text("");p();const l=n?n:Object.assign({genome:e.genome,name:t.name});const c=nf({flag:e,filename:t.name,cohort:l,flag2thisds:s});if(c){d.text("Error with "+t.name+": "+c);return}if(e.good==0){d.text("No mutations can be loaded");return}let u;if(r){vc(r.pane);const e=kc({x:100,y:100,toshrink:true});e.header.html('<span style="opacity:.5">FILE</span> '+t.name);u=e.body}if(i!==undefined){u=f.append("div").html('<span style="opacity:.5">FILE</span> '+t.name)}a.selectAll("*").remove();import("./tp.ui-221efed6.js").then((function(e){return e.t})).then((e=>{e.default(l,u,o)}));return l}return function e(t,n){const o=tf(t.content,n,flag);if(o){d.text("Error: "+o);p();return}h(flag,t)}}function tf(e,t,n){if(!n)return"should not happen!";let o;switch(t){case 0:o=sf(e,n);if(o)return o;break;case 1:o=ff(e,n,true);if(o)return o;break;case 2:o=ff(e,n,false);if(o)return o;break;case 3:o=lf(e,n);if(o)return o;break;case 4:o=cf(e,n);if(o)return o;break;case 5:o=df(e,n);if(o)return o;break;case 6:o=af(e,n);if(o)return o;break;default:return"unknown option array index from file type <select>: "+t}}function nf(e,t=null){const n=e.flag;const o=e.cohort;if(!o.p2st){o.p2st={}}if(!o.dsset){o.dsset={}}if(!o.assaylst){o.assaylst=[]}if(n.variantgene){if(o.variantgene){return"variantgene already set for this cohort"}o.variantgene=n.variantgene}if(n.snv.badlines.length>0){Pc(n.snv.header,n.snv.badlines)}if(n.fusion.badlines.length>0){Pc(n.fusion.header,n.fusion.badlines)}if(n.sv.badlines.length>0){Pc(n.sv.header,n.sv.badlines)}if(n.cnv.badlines.length>0){Pc(n.cnv.header,n.cnv.badlines)}if(n.itd.badlines.length>0){Pc(n.itd.header,n.itd.badlines)}if(n.del.badlines.length>0){Pc(n.del.header,n.del.badlines)}if(n.truncation.badlines.length>0){Pc(n.truncation.header,n.truncation.badlines)}if(n.good==0){return false}const i={};let s=false;if(n.snv.loaded){for(const e of n.snv.header){i[e]=1}if("maf_tumor_v1"in i&&"maf_tumor_v2"in i){s=true}}if(n.cnv.loaded){for(const e of n.cnv.header){i[e]=1}}if(n.fusion.loaded){for(const e of n.fusion.header){i[e]=1}}if(n.sv.loaded){for(const e of n.sv.header){i[e]=1}}if(n.itd.loaded){for(const e of n.itd.header){i[e]=1}}if(n.del.loaded){for(const e of n.del.header){i[e]=1}}if(n.truncation.loaded){for(const e of n.truncation.header){i[e]=1}}const r="sample"in i||"patient"in i;const a="disease"in i;const l="sampletype"in i;let c;if(e.flag2thisds){c=e.flag2thisds;if(r&&!c.hassample){return'"sample" column found in new data but not in existing data'}if(!r&&c.hassample){return'"sample" column found in existing data but not in new data'}if(a&&!c.hasdisease){return'"disease" column found in new data but not in existing data'}if(!a&&c.hasdisease){return'"disease" column found in existing data but not in new data'}if(l&&!c.hasst){return'"sampletype" column found in new data but not in existing data'}if(!l&&c.hasst){return'"sampletype" column found in existing data but not in new data'}for(const e in n.data){const t=c.bulkdata[e];if(t){c.bulkdata[e]=t.concat(n.data[e])}else{c.bulkdata[e]=n.data[e]}}}else{let t=e.filename+(n.tpsetname?"_"+n.tpsetname:"");if(t in n.genome.datasets){let e=1;let o=t+" "+e;while(o in n.genome.datasets){e++;o=t+" "+e}t=o}c={label:t,bulkdata:n.data,hassample:r,hasdisease:a,hastumormaf:s,hasst:l,genome:o.genome,import:{},imported:{},importsilent:n.snv.silent==0?false:n.snv.missense/n.snv.silent>=5?false:true};n.genome.datasets[t]=c;o.dsset[t]=c;if(o.dbexpression){if(o.dbexpression.tidy){try{o.dbexpression.tidy=new Function(o.dbexpression.tidy)}catch(e){err("invalid JavaScript for dbexpression.tidy");delete o.dbexpression}}c.dbexpression=o.dbexpression}if(a){c.stratify=[{label:"disease",attr1:{k:"disease",label:"disease"}}]}}if(r){for(const e in n.data){for(const t of n.data[e]){let e=t.patient;if(!e){e=t.sample;if(!e){continue}}if(!o.p2st[e]){o.p2st[e]={}}let n=t.sampletype;if(!n){n=e}if(!o.p2st[e][n]){o.p2st[e][n]={dsset:{},tktemplate:[]}}if(!o.p2st[e][n].dsset[c.label]){o.p2st[e][n].dsset[c.label]=[]}o.p2st[e][n].dsset[c.label].push(t)}}}if(t)t();return false}function of(e){if(!e.name)e.name="Unnamed dataset";let t=e.holder;if(!t){const e=kc({x:100,y:100});t=e.body}const n=t.append("div");new Promise(((t,n)=>{const o={dsset:{}};for(const t in e){if(t=="snvindel"||t=="svjson"||t=="cnv"||t=="sv"||t=="mutationset"){continue}o[t]=e[t]}t(o)})).then((t=>{if(!e.snvindel&&!e.svjson&&!e.cnv&&!e.sv)return t;const n=id(t.genome);if(e.snvindel){const t=sf(e.snvindel,n);if(t)throw{message:"error in snvindel data: "+t};delete e.snvindel}if(e.svjson){const t=rf(e.svjson,n);if(t)throw{message:"error in svjson data: "+t};delete e.svjson}if(e.sv){const t=ff(e.sv,n);if(t)throw{message:"error in svjson data: "+t};delete e.sv}if(e.cnv){const t=af(e.cnv,n);if(t)throw{message:"error in cnv data: "+t};delete e.cnv}const o=nf({flag:n,filename:e.name,cohort:t});if(o)throw{message:"Error parsing data: "+o};return t})).then((t=>{if(!e.mutationset)return t;if(!Array.isArray(e.mutationset))throw{message:"mutationset is not an array"};const n=[];for(const o of e.mutationset){const i=id(t.genome);const s=[];if(o.snvindel){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.snvindel+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with snvindel file: "+e.error};const t=sf(e.text,i);if(t)throw{message:"error with snvindel file: "+t}}));s.push(n)}if(o.snvindel_url){s.push(Ll("urltextfile",{url:o.snvindel_url}).then((e=>{if(e.error)throw{message:"cannot get snvindel file from url"};const t=sf(e.text,i);if(t)throw{message:"error with snvindel file: "+t}})))}if(o.cnv){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.cnv+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with cnv file: "+e.error};const t=af(e.text,i);if(t)throw{message:"error with cnv file: "+t}}));s.push(n)}if(o.cnv_url){s.push(Ll("urltextfile",{url:o.cnv_url}).then((e=>{if(e.error)throw{message:"cannot get cnv file from url"};const t=af(e.text,i);if(t)throw{message:"error with cnv file: "+t}})))}if(o.sv){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.sv+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with sv file: "+e.error};const t=ff(e.text,i,true);if(t)throw{message:"error with sv file: "+t}}));s.push(n)}if(o.sv_url){s.push(Ll("urltextfile",{url:o.sv_url}).then((e=>{if(e.error)throw{message:"cannot get sv file from url"};const t=ff(e.text,i);if(t)throw{message:"error with sv file: "+t}})))}if(o.fusion){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.fusion+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with fusion file: "+e.error};const t=ff(e.text,i,false);if(t)throw{message:"error with fusion file: "+t}}));s.push(n)}if(o.svjson){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.svjson+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with svjson file: "+e.error};const t=rf(e.text,i);if(t)throw{message:"error with svjson file: "+t}}));s.push(n)}if(o.deletion){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.deletion+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with deletion file: "+e.error};const t=cf(e.text,i);if(t)throw{message:"error with deletion file: "+t}}));s.push(n)}if(o.deletion_url){s.push(Ll("urltextfile",{url:o.deletion_url}).then((e=>{if(e.error)throw{message:"cannot get deletion file from url"};const t=cf(e.text,i);if(t)throw{message:"error with deletion file: "+t}})))}if(o.truncation){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.truncation+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with truncation file: "+e.error};const t=df(e.text,i);if(t)throw{message:"error with truncation file: "+t}}));s.push(n)}if(o.truncation_url){s.push(Ll("urltextfile",{url:o.truncation_url}).then((e=>{if(e.error)throw{message:"cannot get truncation file from url"};const t=df(e.text,i);if(t)throw{message:"error with truncation file: "+t}})))}if(o.itd){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.itd+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with itd file: "+e.error};const t=lf(e.text,i);if(t)throw{message:"error with itd file: "+t}}));s.push(n)}if(o.itd_url){s.push(Ll("urltextfile",{url:o.itd_url}).then((e=>{if(e.error)throw{message:"cannot get itd file from url"};const t=lf(e.text,i);if(t)throw{message:"error with itd file: "+t}})))}const r=Promise.all(s).then((n=>{const s=nf({flag:i,filename:e.name,cohort:t});if(s)throw{message:"Error parsing data from "+o.name+": "+s}}));n.push(r)}return Promise.all(n).then((e=>t))})).then((o=>{const i=Bd(o);if(i)throw{message:"Error parsing study: "+i};n.text("");import("./tp.ui-221efed6.js").then((function(e){return e.t})).then((n=>{n.default(o,t,e.hostURL)}))})).catch((e=>{n.text(e.message);if(e.stack){console.log(e.stack)}}))}function sf(e,t){const n=e.trim().split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=rd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;ad(e,n[e],t)}}function rf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const[s,r]=fd(o);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;pd(e,n[e],t,r)}}function af(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=hd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;md(e,n[e],t)}}function lf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=gd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;bd(e,n[e],t)}}function cf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=yd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;vd(e,n[e],t)}}function df(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=wd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;xd(e,n[e],t)}}function ff(e,t,n){const o=e.split(/\r?\n/);let i=o[0];let s=0;while(i[0]=="#"){s++;i=o[s]}if(!i)return"no header line";const r=ld(i,t,n);if(r)return"header error: "+r;for(let e=s+1;e<o.length;e++){if(o[e]=="")continue;if(o[e][0]=="#")continue;cd(e,o[e],t,n)}}function pf(e,t){e.style("opacity",0).style("display",t||"block").transition().style("opacity",1)}function uf(e,t){e.style("opacity",1).transition().style("opacity",0).call((()=>{if(t){e.remove()}else{e.style("display","none").style("opacity",1)}}))}function hf(e,t){let n;if(typeof t=="string"){n=t}else{n=t.message||t.error;if(t.stack)console.log(t.stack)}const o=e.append("div").attr("class","sja_errorbar");o.append("div").text(n);o.append("div").html("✕").on("click",(()=>{uf(o,true)}))}function mf(e){try{throw new Error}catch(t){const n=t.stack.split("\n");const o=n[2].trim();const i=/\s*at\s+(.*)\s+\((.*).proteinpaint.js:(\d+):(\d+)\)/;const s=o.match(i);if(s){const t=s[1];const n=s[2].replace(/^.*\/bin\//,"").replace(/_([^_]+)$/,".$1").replaceAll(/_/g,"/");const o=`${e} [${n} ${t}()]`;throw new Error(o)}else{throw new Error(e)}}}function gf(e,t){if(typeof e=="string")return hf(t,e);if(e.length===0)return;if(e.length===1)return hf(t,e[0]);let n=false;const o=t.append("div").attr("class","sja_errorbar").on("click",(()=>{n=!n;s.style("display",n?"block":"none")}));const i=o.append("div").style("display","inline-block");i.append("div").style("display","inline-block").style("color","white").style("background-color","red").style("border-radius","100px").style("padding","1px 4px").text(e.length);i.append("div").text("errors found.").style("padding","3px").style("display","inline-block");o.append("div").style("display","inline-block").style("float","right").html("✕").on("click",(()=>{uf(o,true)}));const s=o.append("div").style("display","none").style("margin-left","10px");for(const t of e){s.append("div").text(t)}}async function bf(e,t){const n=await Bl("snp",{method:"POST",body:JSON.stringify({byName:true,genome:e.name,lst:[t]})});if(n.error)throw n.error;if(!n.results||n.results.length==0)throw t+": not a SNP";for(const t of n.results){const n=e.chrlookup[t.chrom.toUpperCase()];if(n&&n.major){return{chr:t.chrom,start:t.chromStart,stop:t.chromEnd}}}const o=n.results[0];return{chr:o.chrom,start:o.chromStart,stop:o.chromEnd}}async function yf(e){if(!e.holder)throw"No holder for block.init";if(!e.genome)throw"no genome";if(e.holder instanceof Element)e.holder=ot(e.holder);if(!e.tklst)e.tklst=[];if(e.query){await vf(e);return}if(e.model&&e.allmodels){await wf(e);return}}async function vf(e){const t=e.holder.append("p").style("font-size","2em").style("color","#858585").text("Searching for "+e.query+" ...");const n=await Bl("genelookup",{body:{deep:1,input:e.query,genome:e.genome.name}});if(!n)throw"querying genes: server error";if(n.error)throw"error querying genes: "+n.error;if(!n.gmlst||n.gmlst.length==0){if(e.genome.hasSNP){try{const n=await bf(e.genome,e.query);t.remove();const o={genome:e.genome,holder:e.holder,chr:n.chr,start:Math.max(0,n.start-300),stop:n.start+300,nobox:true,tklst:e.tklst,debugmode:e.debugmode};tc(e.genome,o.tklst);const i=await import("./block-ec76524e.js").then((function(e){return e.c}));const s=new i.Block(o);s.addhlregion(n.chr,n.start,n.stop-1)}catch(n){t.text("Not a gene or SNP: "+e.query)}}else{t.text("No match to gene: "+e.query)}return}t.remove();e.allmodels=n.gmlst;for(const t of e.allmodels){if(t.isoform.toUpperCase()==(n.found_isoform?n.found_isoform.toUpperCase():e.query.toUpperCase())){e.model=t;await wf(e);return}}const o=[];for(const t of e.allmodels){if(!t.isoform)throw"isoform missing from one gene model: "+JSON.stringify(t);const n=t.isoform.toUpperCase();if(e.genome.isoformcache.has(n)){let o=true;for(const i of e.genome.isoformcache.get(n)){if(i.chr==t.chr&&i.start==t.start&&i.stop==t.stop&&i.strand==t.strand){o=false;break}}if(o){e.genome.isoformcache.get(n).push(t)}}else{e.genome.isoformcache.set(n,[t])}if(t.isoform.toUpperCase()==e.query.toUpperCase()){o.push(t);break}if(t.isdefault){o.push(t)}}if(o.length==1){e.model=o[0]}else if(o.length>1){for(const t of o){if(t.chr=="chrY"){continue}const n=e.genome.chrlookup[t.chr.toUpperCase()];if(!n){continue}if(!n.major){continue}e.model=t;break}if(!e.model){e.model=o[0]}}if(!e.model){e.model=e.allmodels[0]}await wf(e)}async function wf(e){if(e.model.genomicseq){o();xf(e);return}const t={genome:e.genome.name,coord:e.model.chr+":"+(e.model.start+1)+"-"+e.model.stop};const n=await Bl("ntseq",{method:"POST",body:JSON.stringify(t)});if(!n)throw"getting sequence: server error";if(n.error)throw"getting sequence: "+n.error;if(!n.seq)throw"no nt seq???";e.model.genomicseq=n.seq.toUpperCase();e.model.aaseq=Ma(e.model);o();await xf(e);function o(){if(e.model.aaseq){const t=e.model.aaseq.indexOf(Oa);const n=e.model.cdslen-(e.model.startCodonFrame?3-e.model.startCodonFrame:0);if(t!=-1&&t<n/3-1){hf(e.holder,"Translating "+e.model.isoform+" ends at "+t+" AA, expecting "+n/3)}}}}async function xf(e){const t=new Map;for(const n of e.allmodels){if(!n.pdomains){n.pdomains=[];n.domain_hidden={};if(!t.has(n.isoform))t.set(n.isoform,[]);t.get(n.isoform).push(n)}}if(t.size==0){await _f(e);return}const n=await Bl("pdomain",{method:"POST",body:JSON.stringify({genome:e.genome.name,isoforms:[...t.keys()]})});if(n.error)throw"error getting protein domain: "+n.error;if(n.lst){const e=At().range(bc);for(const o of n.lst){for(const e of t.get(o.name)){e.pdomains=o.pdomains}for(const t of o.pdomains){if(!t.color){t.color=e(t.name+t.description)}}}}await _f(e)}async function _f(e){let t=e.gmmode;if(!t){if(e.model.cdslen){t=gc.protein}else{t=gc.exononly}}if(e.dataset){if(!Array.isArray(e.dataset))throw"dataset is not array";for(const t of e.dataset){if(e.genome.datasets[t]&&!e.genome.datasets[t].legacyDsIsUninitiated)continue;const n=await Bl(`getDataset?genome=${e.genome.name}&dsname=${t}`);if(n.error)throw`invalid name from dataset[]: ${n.error}`;if(!n.ds)throw".ds missing";const o=e.genome.datasets[n.ds.label];Object.assign(o,n.ds);const i=await import("./legacyDataset-26ead9cc.js");i.validate_oldds(o);delete o.legacyDsIsUninitiated}}const n=await import("./block-ec76524e.js").then((function(e){return e.c}));e.__blockInstance=new n.Block({genome:e.genome,holder:e.holder,nobox:true,usegm:e.model,gmstackheight:37,allgm:e.allmodels,datasetlst:e.dataset,legacyDsFilter:e.legacyDsFilter,mset:e.mset,hlaachange:e.hlaachange,hlvariants:e.hlvariants,hlregions:e.hlregions,gmmode:t,hidedatasetexpression:e.hidedatasetexpression,hidegenecontrol:e.hidegenecontrol,hidegenelegend:e.hidegenelegend,variantPageCall_snv:e.variantPageCall_snv,datasetqueries:e.datasetqueries,samplecart:e.samplecart,debugmode:e.debugmode,tklst:e.tklst,mclassOverride:e.mclassOverride,hide_dsHandles:e.hide_dsHandles,onloadalltk_always:e.onloadalltk_always})}var kf=Object.freeze({__proto__:null,default:yf});async function jf(e,t){let n=[],o=[];if(e&&e.includes(","))n=e.split(",");else if(e)n.push(e);else if(t&&t.includes(","))o=t.split(",");else if(t)o.push(t);const i=[];if(n.length){const e=undefined;for(const t of n){i.push(await Nf(t,e))}}else if(o.length){const e=undefined;for(const t of o){i.push(await Nf(e,t))}}return i}async function Nf(e,t){const n=await Sf(e,t);Af(n);const o=Cf(n);return o}async function Sf(e,t){if(e!==undefined&&e=="")throw".jsonfile missing";if(t!==undefined&&t=="")throw".jsonurl missing";let n;if(e!==undefined)n=await Ll("textfile",{file:e});else if(t!==undefined)n=await Ll("urltextfile",{url:t});if(n.error){throw n.error}return JSON.parse(n.text)}function Af(e){if(!e)throw"file is missing";if(!e.type)throw"dataset type is missing";const t=e.svcnvfile||e.svcnvurl;const n=e.vcffile||e.vcfurl;if(!t&&!n)throw"vcf or cnv file/url is required";if(Object.keys(e).filter((e=>e.includes("expression"))).length){if(!e.expressionfile&&!e.expressionurl)throw"expression file/url is missing"}if(Object.keys(e).filter((e=>e.includes("rnabam"))).length){if(!e.rnabamfile&&!e.rnabamurl)throw"rnabam file/url is missing"}if(e.sampleset){for(const t of e.sampleset){if(e.sampleset.length!=1&&!t.name)throw"sampleset name is missing";if(!t.samples)throw"sampleset samples[] is missing"}}if(e.sample2assaytrack){for(const[t,n]of Object.entries(e.sample2assaytrack)){if(!n.length)throw"assay[] missing for "+t;for(const e of n){if(!e.name)throw"assay name is missing for "+t;if(!e.type)throw"assay type is missing for "+t}}}if(e.groupsamplebyattr){if(!e.groupsamplebyattr.attrlst)return".attrlst[] missing from groupsamplebyattr";if(e.groupsamplebyattr.attrlst.length==0)return"groupsamplebyattr.attrlst[] empty array";for(const t of e.groupsamplebyattr.attrlst){if(!t.k)return"k missing from one of groupsamplebyattr.attrlst[]"}if(e.groupsamplebyattr.sortgroupby){if(!e.groupsamplebyattr.sortgroupby.key)return".key missing from .sortgroupby";if(!e.groupsamplebyattr.sortgroupby.order)return".order[] missing from .sortgroupby";if(!Array.isArray(e.groupsamplebyattr.sortgroupby.order))return".order must be an array"}if(!e.groupsamplebyattr.attrnamespacer)e.groupsamplebyattr.attrnamespacer=", "}if(e.fixedgeneexpression){for(const t of e.fixedgeneexpression){if(!t.gene)throw"gene missing in fixedgeneexpression array"}}if(e.vcf){if(!e.vcf.hiddenclass)throw"hiddenclasses[] missing from .vcf"}}function Cf(e){const t={type:e.type,name:e.name};if(e.isdense=="true"||e.isdense==true||e.isfull===false)t.isdense=true;else if(e.isfull)t.isfull=true;if(e.svcnvfile)t.file=e.svcnvfile;else if(e.svcnvurl)t.url=e.svcnvurl;if(Object.keys(e).filter((e=>e.includes("expression"))).length){t.checkexpressionrank={file:e.expressionfile,url:e.expressionurl}}if(Object.keys(e).filter((e=>e.includes("vcf"))).length){t.checkvcf={file:e.vcffile,url:e.vcfurl}}if(e.vcf){if(e.vcf.hiddenclass){t.vcf=[];t.vcf.hiddenclass=e.vcf.hiddenclass}}if(Object.keys(e).filter((e=>e.includes("rnabam"))).length){t.checkrnabam={file:e.rnabamfile,url:e.rnabamurl}}if(e.sampleset){t.sampleset=e.sampleset}if(e.sample2assaytrack){t.sample2assaytrack=e.sample2assaytrack}if(e.groupsamplebyattr){t.groupsamplebyattr=e.groupsamplebyattr}t.fixedgeneexpression=e.fixedgeneexpression;t.getallsamples=e.getallsamples;t.valueCutoff=e.cnvValueCutoff!==undefined?e.cnvValueCutoff:undefined;t.bplengthUpperLimit=e.cnvLengthUpperLimit!==undefined?e.cnvLengthUpperLimit:undefined;t.segmeanValueCutoff=e.segmeanValueCutoff!==undefined?e.segmeanValueCutoff:undefined;t.lohLengthUpperLimit=e.lohLengthUpperLimit!==undefined?e.lohLengthUpperLimit:undefined;t.multihidelabel_vcf=e.multihidelabel_vcf!==undefined?e.multihidelabel_vcf:undefined;t.multihidelabel_fusion=e.multihidelabel_fusion!==undefined?e.multihidelabel_fusion:undefined;t.multihidelabel_sv=e.multihidelabel_sv!==undefined?e.multihidelabel_sv:undefined;t.legend_vorigin=e.legend_vorigin;return t}async function Ef(e,t){let n={};const o=await Sf(e,t);n.mdssamplescatterplot=o;return n}function Of(e){return!isNaN(parseFloat(e))&&isFinite(e)}function Mf(e,t,n,o,i){if(o>=1){const t=Math.floor(e*o);if(i)return`${t}${n.charAt(0)}`;return`${t} ${t>1?n+"s":""}`}const s=Math.floor(e*o);const r=Math.ceil(e%(1/o));if(r==0){if(i)return`${s}${n.charAt(0)}`;return`${s} ${s>1?n+"s":""}`}if(i)return`${s}${n.charAt(0)}${r}${t.charAt(0)}`;return`${s} ${s>1?n+"s":""} ${r} ${r>1?t+"s":""}`}function If(e="",t=console.warn){const n=e?{search:e}:window.location;const o=new Map;for(const e of n.search.substr(1).split("&")){if(!e)continue;const n=e.split("=");if(n.length==2&&n[0]!=""&&n[1]!=""){let e=decodeURIComponent(n[1]);if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")){try{e=JSON.parse(e)}catch(e){t(e)}}else if(Of(e)){e=Number(e)}o.set(n[0].toLowerCase(),e)}else if(n.length>2){t(`unexpected '=' character in the URL parameter value for '${n[0]}'`)}else{t(`Invalid url parameter: '${e}'`)}}return o}function Tf(e,t=""){const n=e.state?.embedder;const o=t=>{if(t.origin!==n.origin)return;if(t.data=="getActiveMassSession"){window.removeEventListener("message",o);i.postMessage({state:e.state},n.origin);if(n.origin!=window.location.origin){setTimeout((()=>{try{window.close()}catch(e){console.log(e);window.open(window.location,"_self").close()}}),500)}}};window.addEventListener("message",o,false);setTimeout((()=>window.removeEventListener("message",o)),8e3);if(n.origin!=window.location.origin){confirm(`Another window will open to recover the saved session. When the next window opens,`+`\n- You may need to allow popups.`+`\n- You may have to refresh it.`+`\n- After the session is recovered, this browser window should automatically close.`);document.body.innerHTML=`\n\t\t\t<div style='margin: 20px; padding: 20px; font-size: 24px'>\n\t\t\t\tPlease close this browser tab. The recovered session should visible in another browser tab.\n\t\t\t</div>\n\t\t`}const i=window.open(n.href,"_blank")}async function Rf(e){const t=If();if(t.has("appcard")){const n=await Promise.resolve().then((function(){return ih}));const o=t.get("appcard");const i=await Pl("/cards/index.json");e.app.drawer.opts.genomes=e.genomes;e.app.drawer.opts.fromApp=true;e.app.drawer.opts.app={cardsPath:"cards"};const s=i.elements.findIndex((e=>e.sandboxJson==o||e.sandboxHtml==o));if(s<=0){const t=[...i.elements.filter((e=>e.type=="nestedCard"))];let s,r;t.findIndex((e=>{for(const[t,n]of e.children.entries()){if(n.sandboxJson==o||n.sandboxHtml==o){s=e;r=t}}}));n.openSandbox(s.children[r],e.app.drawer.opts)}else{n.openSandbox(i.elements[s],e.app.drawer.opts)}return}if(t.has("gdcbamslice")){const n=await import("./bam-95f36008.js");n.bamsliceui({genomes:e.genomes,holder:e.holder,debugmode:e.debugmode,stream2download:t.has("stream2download")});return}if(t.has("gdcmaf")){const t=await import("./maf-72e5b7da.js");t.gdcMAFui({holder:e.holder,debugmode:e.debugmode});return}if(t.has("gdcsinglecell")){const t=await import("./singlecell-7c851ef8.js");t.gdcSinglecellUi({holder:e.holder,debugmode:e.debugmode});return}if(t.has("mdsjsonform")){const t=await import("./mdsjsonform-7f0b6cc7.js");await t.init_mdsjsonform(e);return}if(t.has("termdb")){const n=t.get("termdb");const o=typeof n==="string"?JSON.parse(n):n;const i={holder:e.holder,state:o};const s=await import("./app-bfce9bf5.js");s.appInit(i);return}if(t.has("massnative")){const n=t.get("massnative");const[o,i]=n.split(",");if(!o||!i)throw'value is not "genome,dslabel"';const s={holder:e.holder,genome:e.genomes[o],state:{genome:o,dslabel:i}};if(!s.genome)throw"invalid genome";const r=await import("./app-de19f41c.js");r.appInit(s);return}if(t.has("mass")){const n=t.get("mass");const o=typeof n==="string"?JSON.parse(n):n;const i={holder:e.holder,state:o};if(o.genome){i.genome=e.genomes[o.genome]}else if(o?.vocab?.genome){i.genome=e.genomes[o.vocab.genome]}const s=await import("./app-de19f41c.js");s.appInit(i);return}if(t.has("mass-session-file")||t.has("mass-session-url")){let n;if(t.has("mass-session-file")){const o=t.get("mass-session-file");const i=await Bl(`/textfile`,{method:"POST",body:JSON.stringify({file:o})});const s=JSON.parse(i.text);n={holder:e.holder,state:s,genome:e.genomes[s.vocab.genome]}}if(t.has("mass-session-url")){const o=t.get("mass-session-url");const i=await Bl("/urltextfile",{method:"POST",body:JSON.stringify({url:o})});const s=JSON.parse(i.text);n={holder:e.holder,state:s,genome:e.genomes[s.vocab.genome]}}const o=await import("./app-de19f41c.js");o.appInit(n);return}if(t.has("mass-session-id")){const n=t.get("mass-session-id");const o=t.get("src");let i;if(o=="browser"){const e=localStorage.getItem("savedMassSessions");const t=JSON.parse(e);i={state:t[n]}}else{const e={headers:{},body:{id:n}};if(o=="cred"){const n=t.get("dslabel");const o=t.get("route");e.body.dslabel=n;e.body.route=o;e.body.route=o;const i=localStorage.getItem("jwtByDsRoute")||`{}`;this.jwtByDsRoute=JSON.parse(i);const s=this.jwtByDsRoute[n][o];e.headers.authorization=`Bearer ${btoa(s)}`}i=await Bl(`/massSession`,e);if(i.error)throw i.error}const s=i.state?.embedder;if(s&&s.origin!=window.location.origin){Tf(i);return}const r={holder:e.holder,state:i.state,genome:e.genomes[i.state.vocab.genome],sessionDaysLeft:i.sessionDaysLeft,sessionId:n};const a=await import("./app-de19f41c.js");a.appInit(r);return}if(t.has("genome")&&e.selectgenome){const n=t.get("genome");const o=[...e.selectgenome.node().childNodes];const i=o.findIndex((e=>e.value==n));if(i==-1){hf(e.holder,`Invalid genome: ${n}. Please provide an available genome from this list: ${o.map((e=>e.value)).join(", ").replace(/,(?=[^,]*$)/,", or")}`);return}e.selectgenome.node().selectedIndex=i;e.selectgenome.node().dispatchEvent(new Event("change"))}if(t.has("hicfile")||t.has("hicurl")){let n,o,i;if(t.has("hicfile")){n=t.get("hicfile");i=n.split("/").pop()}else{o=t.get("hicurl");i=o.split("/").pop()}const s=t.get("genome");if(!s)throw"genome is required for hic";const r=e.genomes[s];if(!r)throw"invalid genome";const a={genome:r,file:n,url:o,name:i,hostURL:e.hostURL,enzyme:t.get("enzyme"),holder:e.holder};const l=await import("./HicApp-bcf8330c.js");await l.hicInit(a);return}if(t.has("singlecell")){if(!t.has("genome"))throw'"genome" is required for "singlecell"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./singlecell-a668bb17.js");i.init({genome:o,jsonfile:t.get("singlecell")},e.holder);return}if(t.has("mavbfile")){if(!t.has("genome"))throw'"genome" is required for "mavb"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./mavb-37fffd68.js");i.mavbparseinput({genome:o,hostURL:e.hostURL,file:t.get("mavbfile")},(()=>{}),e.holder,e.jwt);return}if(t.has("mavburl")){if(!t.has("genome"))throw'"genome" is required for "mavb"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./mavb-37fffd68.js");i.mavbparseinput({genome:o,hostURL:e.hostURL,url:t.get("mavburl")},(()=>{}),e.holder,e.jwt);return}if(t.has("scatterplot")){if(!t.has("genome"))throw'"genome" is required for "scatterplot"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;let i;if(t.has("mdsjson")||t.has("mdsjsonurl")){const e=t.get("mdsjsonurl");const n=t.get("mdsjson");i=await Ef(n,e)}if(t.has("tsnejson")){const e=t.get("tsnejson");const n=await Ll("textfile",{file:e});if(n.error)throw n.error;else if(n.text){i={mdssamplescatterplot:{analysisdata:JSON.parse(n.text)}}}}i.mdssamplescatterplot.genome=o;const s=await import("./mds.samplescatterplot-362f3591.js");s.init(i.mdssamplescatterplot,e.holder,false);return}if(t.has("block")){if(!t.has("genome"))throw"missing genome for block";const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i={nobox:1,hostURL:e.hostURL,jwt:e.jwt,holder:e.holder,genome:o,dogtag:n,debugmode:e.debugmode};let s=null;let r=null;if(t.has("position")){const e=t.get("position").split(";");if(e[0]){const t=e[0].split(/[:-]/);const n=t[0];const o=Number.parseInt(t[1]);const i=Number.parseInt(t[2]);if(!n)throw"chr missing";if(Number.isNaN(o)||Number.isNaN(i))throw"Invalid start/stop value in position";s={chr:n,start:o,stop:i}}const n=[];for(let t=1;t<e.length;t++){if(!e[t])continue;const o=e[t].split(/[:-]/);const i=o[0];const s=Number.parseInt(o[1]);const r=Number.parseInt(o[2]);if(!i)throw"subpanel chr missing";if(Number.isNaN(s)||Number.isNaN(r))throw"Invalid start/stop value in subpanel position";n.push({chr:i,start:s,stop:r,width:600,leftborder:"rgba(200,0,0,.1)",leftpad:5})}if(n.length){i.subpanels=n}}if(t.has("regions")){r=[];for(const e of t.get("regions").split(",")){const t=e.split(/[:-]/);t[0];const n=Number.parseInt(t[1]);const o=Number.parseInt(t[2]);if(Number.isNaN(n)||Number.isNaN(o))throw"Invalid start/stop value in regions";r.push({chr:t[0],start:n,stop:o})}}if(!s&&!r){if(o.defaultcoord){s={chr:o.defaultcoord.chr,start:o.defaultcoord.start,stop:o.defaultcoord.stop}}}if(s){i.chr=s.chr;i.start=s.start;i.stop=s.stop}else if(r){i.rglst=r}if(t.has("hlregion")){const e=[];for(const n of t.get("hlregion").split(",")){const t=Ld(n,o,true);if(t)e.push(t)}if(e.length)i.hlregions=e}i.datasetqueries=Lf(t);i.tklst=await $f(t,o);tc(e.genomes[n],i.tklst);zf(t,i.tklst);const a=await import("./block-ec76524e.js").then((function(e){return e.c}));new a.Block(i);return}if(t.has("gene")){const n=t.get("gene");if(n.length==0)throw"zero length query string";const o={hostURL:e.hostURL,query:n,holder:e.holder,variantPageCall_snv:e.variantPageCall_snv,samplecart:e.samplecart,debugmode:e.debugmode};{let n;for(let t in e.genomes){if(e.genomes[t].isdefault){n=t;break}}if(t.has("genome")){n=t.get("genome")}if(!n)throw"No genome, and none set as default";o.genome=e.genomes[n];if(!o.genome)throw"invalid genome: "+n}if(t.has("dataset")){o.dataset=t.get("dataset").split(",")}if(t.has("hlaachange")){o.hlaachange=new Map;for(const e of t.get("hlaachange").split(",")){o.hlaachange.set(e,false)}}if(t.has("hlregion")){const e=[];for(const n of t.get("hlregion").split(",")){const t=Ld(n,o.genome,true);if(t)e.push(t)}if(e.length)o.hlregions=e}o.tklst=await $f(t,o.genome);zf(t,o.tklst);o.datasetqueries=Lf(t);await yf(o);return}if(t.has("disco")){const n=t.get("genome");const o=e.genomes[n];if(!o)throw"genome missing";const i=t.get("dslabel");if(!i)throw"dslabel missing";const s=t.get("sample");if(!s)throw"sample_id missing";const r=(await import("./FilterRxComp-0e75dd8d.js").then((function(e){return e.z}))).vocabInit({state:{genome:n,dslabel:i}});const a=await r.getTermdbConfig();await(await import("./plot.disco-70d493f4.js")).default(a,i,{sample_id:s},e.holder,o);return}if(t.has("study")){const n=t.get("study");if(n!=""){Fd(e.genomes,n,e.holder,e.hostURL,undefined,false,e.app||{debugmode:e.debugmode,instanceTracker:e.instanceTracker||{},callbacks:e.callbacks||{}})}}}function Lf(e){if(!e.has("mds"))return;const t=e.get("mds").split(",");if(t[0]&&t[1]){const n={dataset:t[0],querykey:t[1]};if(e.has("sample")){n.singlesample={name:e.get("sample")};n.getsampletrackquickfix=true}return[n]}return}async function $f(e,t){const n=[];if(e.has("mds3")){const t=e.get("mds3").split(",");for(const o of t){const t={type:mc.mds3,dslabel:o};if(e.has("token"))t.token=e.get("token");if(e.has("filterobj"))t.filterObj=e.get("filterobj");n.push(t)}}if(e.has("mds3bcffile")){const[t,o]=e.get("mds3bcffile").split(",");if(t&&o){n.push({type:mc.mds3,name:t,bcf:{file:o}})}}if(e.has("mds3bcfurl")){const[t,o,i]=e.get("mds3bcfurl").split(",");if(t&&o){n.push({type:mc.mds3,name:t,bcf:{url:o,indexURL:i}})}}if(e.has("arcfile")){const t=e.get("arcfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.hicstraw,name:t[e],bedfile:t[e+1],mode_hm:false,mode_arc:true})}}}if(e.has("mdsjsoncache")){const t=await Pl("mdsjsonform",{method:"POST",body:JSON.stringify({draw:e.get("mdsjsoncache")})});if(t.error)throw t.error;Af(t.json);const o=Cf(t.json);n.push(o)}if(e.has("mdsjson")||e.has("mdsjsonurl")){const t=e.get("mdsjsonurl");const o=e.get("mdsjson");const i=await jf(o,t);n.push(...i)}if(e.has("tkjsonfile")){const o=await Ll("textfile",{file:e.get("tkjsonfile")});if(o.error)throw o.error;if(!o.text)throw".text missing";const i=JSON.parse(o.text);for(const e of i){if(e.isfacet){if(!t.tkset)t.tkset=[];if(!e.tracks)throw".tracks[] missing from a facet table";if(!Array.isArray(e.tracks))throw".tracks[] not an array from a facet table";e.tklst=e.tracks;delete e.tracks;for(const t of e.tklst){if(!t.assay)throw".assay missing from a facet track";if(!t.sample)throw".sample missing from a facet track";t.tkid=Math.random().toString()}t.tkset.push(e)}else{n.push(e)}}}if(e.has("bamfile")){const t=e.get("bamfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bam,name:t[e],file:t[e+1]})}}}if(e.has("bamurl")){const t=e.get("bamurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bam,name:t[e],url:t[e+1]})}}}if(e.has("bedjfile")){const t=e.get("bedjfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bedj,name:t[e],file:t[e+1]})}}}if(e.has("bedjurl")){const t=e.get("bedjurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bedj,name:t[e],url:t[e+1]})}}}if(e.has("hictkfile")||e.has("hictkurl")){const t=e.has("hictkfile");const o=e.get(t?"hictkfile":"hictkurl").split(",");const i=e.has("hictknorm")?e.get("hictknorm").split(","):null;for(let e=0;e<o.length;e+=3){if(o[e]&&o[e+1]&&o[e+2]){const s={type:mc.hicstraw,name:o[e],enzyme:o[e+1],normalizationmethod:i?i[e/3]:null};if(t){s.file=o[e+2]}else{s.url=o[e+2]}n.push(s)}}}if(e.has("ldfile")){const t=e.get("ldfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.ld,name:t[e],file:t[e+1]})}}}if(e.has("bigwigfile")){const t=e.get("bigwigfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bigwig,name:t[e],file:t[e+1],scale:{auto:1}})}}}if(e.has("bigwigurl")){const t=e.get("bigwigurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bigwig,name:t[e],url:t[e+1],scale:{auto:1}})}}}if(e.has("junctionfile")){const t=e.get("junctionfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{file:t[e+1]}]})}}}if(e.has("junctionurl")){const t=e.get("junctionurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{url:t[e+1]}]})}}}if(e.has("vcffile")){const t=e.get("vcffile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"vcf",name:t[e],file:t[e+1]})}}}if(e.has("vcfurl")){const t=e.get("vcfurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"vcf",name:t[e],url:t[e+1]})}}}if(e.has("aicheckfile")){const t=e.get("aicheckfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"aicheck",name:t[e],file:t[e+1]})}}}if(e.has("bampilefile")){const t=e.get("bampilefile").split(",");let o=null;if(e.has("bampilelink")){o=e.get("bampilelink").split(",").map(decodeURIComponent)}for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){const i={type:mc.bampile,name:t[e],file:t[e+1]};if(o&&o[e/2]){i.link=o[e/2]}n.push(i)}}}if(e.has("svcnvfpkmurl")){const t=e.get("svcnvfpkmurl").split(",");const o=t[0];const i={};for(let e=1;e<t.length;e+=2){i[t[e]]=t[e+1]}if(i.svcnv||i.vcf){const e={type:mc.mdssvcnv,name:o};if(i.svcnv){e.url=i.svcnv}if(i.vcf){e.checkvcf={url:i.vcf,indexURL:i.vcfindex}}if(i.fpkm){e.checkexpressionrank={datatype:"FPKM",url:i.fpkm,indexURL:i.fpkmindex}}n.push(e)}}if(e.has("svcnvfpkmfile")){const t=e.get("svcnvfpkmfile").split(",");const o=t[0];const i={};for(let e=1;e<t.length;e+=2){i[t[e]]=t[e+1]}if(i.svcnv||i.vcf){const e={type:mc.mdssvcnv,name:o};if(i.svcnv){e.file=i.svcnv}if(i.vcf){e.checkvcf={file:i.vcf}}if(i.fpkm){e.checkexpressionrank={datatype:"FPKM",file:i.fpkm}}n.push(e)}}if(e.has("mdsjunctionfile")){const t=e.get("mdsjunctionfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"mdsjunction",name:t[e],file:t[e+1]})}}}if(e.has("junctionmatrix")){const t=e.get("junctionmatrix").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"mdsjunction",name:t[e],file2:t[e+1]})}}}if(e.has("junctionrnapeg")){const t=e.get("junctionrnapeg").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{rnapegfile:t[e+1]}]})}}}for(const e of n){if(e.type=="mds3"&&e.dslabel)continue;e.iscustom=true}if(e.has("isdense")){n.filter((e=>e.type==mc.mdssvcnv)).forEach((e=>{e.isdense=true;e.isfull=false}))}if(e.has("sample")){n.filter((e=>e.type==mc.mdssvcnv)).forEach((t=>{t.singlesample={name:e.get("sample")};t.getsampletrackquickfix=true}))}return n}function zf(e,t){if(e.has("bedjfilterbyname")){for(const n of t){if(n.type=="bedj")n.filterByName=e.get("bedjfilterbyname")}}}function Pf(e){const t=e.div.append("button").attr("type","submit").style("background-color",e.backgroundColor?e.backgroundColor:"#cfe2f3").style("margin",e.margin?e.margin:"20px 20px 0px 20px").style("padding","8px").style("border","none").style("border-radius","3px").style("display","inline-block").text(e.text);return t}function Df(e){const t=e.tip,n=e.row;let o,i=150;if("placeholder"in e){o=e.placeholder}else if(e.geneOnly){o="Gene";i=100}else{o="Gene, position";if(e.genome.hasSNP){o+=", dbSNP";i+=40}if(e.allowVariant){o+=", variant";i+=40}}const s=n.append("input").attr("type","text").attr("placeholder",o).attr("aria-label","Gene symbol, position, or alias").attr("class","sja_genesearchinput").style("width",i+"px").on("focus",(e=>{e.target.select()})).on("keyup",(async n=>{const o=n.target;const i=o.value.trim();if(i.length<=1)return t.hide();r.mark.html("");r.word.style("font-size","0.7em");if(e.hideHelp){r.word.text("")}else{r.word.text("Press ENTER to search, ESC to cancel")}if(Jc(n)){o.blur();t.hide();if(e.geneOnly){const e=t.d.select(".sja_menuoption");if(e.size()>0&&e.attr("isgene")){const t=e.text();p({geneSymbol:t},i)}else{p(null,"not a gene")}return}if(e.allowVariant){const t=await Uf(i,e.genome);if(t){p(t,"Valid variant");return}}const n=Ld(i,e.genome);if(n){p(n,"Valid coordinate");return}o.disabled=true;const s=t.d.select(".sja_menuoption");if(s.size()>0&&s.attr("isgene")){await c(s.text())}else{await c(i)}o.disabled=false;return}if(n.code=="Escape"){t.hide();if(f.chr){p(f,f.fromWhat)}else if(e.defaultCoord){const t=e.defaultCoord;o.value=t.chr+(t.isVariant?"."+t.pos+"."+t.ref+"."+t.alt:":"+t.start+"-"+t.stop)}o.blur();return}if(n.key=="ArrowDown"){t.d.selectAll(".sja_menuoption").attr("tabindex",0).on("keyup",(e=>{if(e.key=="Enter"){e.target.click()}else if(e.key=="ArrowDown"){if(e.target.nextSibling)e.target.nextSibling.focus()}else if(e.key=="ArrowUp"){if(e.target.previousSibling)e.target.previousSibling.focus()}}));t.d.select(".sja_menuoption").node().focus();return}l()}));if(!e.focusOff)s.node().focus();const r={mark:n.append("span").style("margin-left","5px"),word:n.append("span").style("margin-left","5px").style("font-size",".8em").style("opacity",.6)};async function a(){const n=s.property("value").trim();if(!n)return;if(e.allowVariant){const t=await Uf(n,e.genome);if(t){return}}const o=Ld(n,e.genome,true);if(o){return}t.showunder(s.node()).clear();try{const o=await Bl("genelookup",{body:{genome:e.genome.name,input:n}});if(o.error)throw o.error;if(!o.hits||o.hits.length==0)return t.hide();for(const n of o.hits){t.d.append("div").text(n).attr("class","sja_menuoption").style("border-radius","0px").attr("isgene",1).on("click",(()=>{if(e.geneOnly){p({geneSymbol:n},n);t.hide()}else{c(n)}}))}}catch(e){t.d.append("div").text(e.message||e)}}const l=td.debounce(a,500);async function c(n){t.hide();try{const o=await Bl("genelookup",{body:{genome:e.genome.name,input:n,deep:1}});if(o.error)throw o.error;if(!o.gmlst||o.gmlst.length==0){if(e.genome.hasSNP){if(n.toLowerCase().startsWith("rs")){await d(n)}else{p(null,"Not a gene or SNP")}}else{p(null,"No match to gene name")}return}const i=Yc(o.gmlst);if(i.length==1){const e=o.gmlst[0].name||n;p(i[0],n,e);return}t.showunder(s.node()).clear();for(const e of i){t.d.append("div").attr("class","sja_menuoption").style("border-radius","0px").text(e.name+" "+e.chr+":"+e.start+"-"+e.stop).on("click",(()=>{t.hide();p(e,n+", "+e.name,e.name)}))}}catch(e){p(null,e.message||e)}}async function d(t){const n=await Bl("snp",{body:{byName:true,genome:e.genome.name,lst:[t]}});if(n.error)throw n.error;if(!n.results||n.results.length==0)throw"Not a gene or SNP";const o=n.results[0];p({chr:o.chrom,start:o.chromStart,stop:o.chromEnd},t)}const f={};if(e.defaultCoord){const t=e.defaultCoord;if(t.isVariant){s.property("value",t.chr+"."+t.pos+"."+t.ref+"."+t.alt);f.pos=t.pos;f.ref=t.ref;f.alt=t.alt}else{s.property("value",t.chr+":"+t.start+"-"+t.stop);f.start=t.start;f.stop=t.stop}f.chr=t.chr}async function p(t,n,o){if(t){for(const e in f)delete f[e];if(t.isVariant){f.chr=t.chr;f.pos=t.pos;f.ref=t.ref;f.alt=t.alt}else if(t.chr){s.property("value",t.chr+":"+t.start+"-"+t.stop);f.chr=t.chr;f.start=t.start;f.stop=t.stop}else if(t.geneSymbol){s.property("value",t.geneSymbol);f.geneSymbol=t.geneSymbol}r.mark.style("color","green").html("✓");if(o){f.geneSymbol=o}}else{r.mark.style("color","red").html("✗")}r.word.text(n||"");f.fromWhat=n;if(t&&e.callback){await e.callback()}}if(e.geneSymbol){s.property("value",e.geneSymbol);setTimeout((()=>p({geneSymbol:e.geneSymbol},e.geneSymbol)),10)}return f}async function Uf(e,t){const n=Bf(e,t);if(n){return n}return await Ff(e,t)}function Bf(e,t){const n=e.split(".");if(n.length!=4)return;const o=n[0];const i=Number(n[1]);const s=Rd(t,o,i,i);if(s)return;return{isVariant:true,chr:o,pos:i,ref:n[2],alt:n[3]}}async function Ff(e,t){const n=e.split(":g.");if(n.length!=2){return}const o=n[0];if(n[1].includes("delins")){return await Jf(o,n[1],t)}if(n[1].includes("del")){return await Gf(o,n[1],t)}if(n[1].includes("ins")){return Hf(o,n[1])}return qf(o,n[1])}function qf(e,t){const n=t.match(/^(\d+)([ATCG])>([ATCG])$/);if(!n||n.length!=4){return}const o=Number(n[1]);if(!Number.isInteger(o))return;return{isVariant:true,chr:e,pos:o,ref:n[2],alt:n[3]}}function Hf(e,t){const[n,o]=t.split("ins");if(!o)return;const i=Number(n.split("_")[0]);if(!Number.isInteger(i))return;return{isVariant:true,chr:e,pos:i+1,ref:"-",alt:o}}async function Gf(e,t,n){const[o,i]=t.split("del");if(i){const t=Number(o.split("_")[0]);if(!Number.isInteger(t))return;return{isVariant:true,chr:e,pos:t,ref:i,alt:"-"}}const[s,r]=o.split("_");const a=Number(s);const l=r?Number(r):a+1;if(!Number.isInteger(a)||!Number.isInteger(l))return;const c=await Vf(e,a,l,n);return{isVariant:true,chr:e,pos:pos,ref:c,alt:"-"}}async function Jf(e,t,n){const o=t.match(/^(\d+)_(\d+)delins([ATCG]+)$/);if(!o||o.length!=4){return}const i=Number(o[1]),s=Number(o[2]),r=o[3];if(!Number.isInteger(i)||!Number.isInteger(s))return;const a=await Vf(e,i,s,n);return{isVariant:true,chr:e,pos:i,ref:a,alt:r}}async function Vf(e,t,n,o){const i={coord:e+":"+t+"-"+n,genome:o.name};const s=await Bl("ntseq",{body:i});return s.seq}function Wf(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function r(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):i(e.value).then(r,a)}l((o=o.apply(e,t||[])).next())}))}class Xf{constructor(e){this.opts=this.validateOpts(e);this.tabs=e.tabs;this.dom={holder:e.holder};this.defaultTabWidth=90;Yf(this)}validateOpts(e){if(!e.holder)throw`missing opts.holder for Tabs()`;if(!Array.isArray(e.tabs))throw`invalid opts.tabs array for Tabs()`;if(!e.linePosition)e.linePosition="bottom";if(e.linePosition!="bottom"&&e.linePosition!="top"&&e.linePosition!="right"&&e.linePosition!="left")throw`Invalid .linePosition arg. Must be either bottom, top, right, or left`;if(!e.tabsPosition)e.tabsPosition="horizontal";if(e.tabsPosition!="horizontal"&&e.tabsPosition!="vertical")throw`Invalid .tabsPosition arg. Must be either vertical or horizontal`;return e}main(){return Wf(this,void 0,void 0,(function*(){try{yield this.render()}catch(e){if(e.stack)console.log(e.stack);else throw e}}))}}function Yf(e){e.render=()=>Wf(this,void 0,void 0,(function*(){const t=e.tabs.find((e=>e.active));if(!t)e.tabs[0].active=true;const n=e.opts.linePosition=="bottom"||e.opts.linePosition=="top"?"center":e.opts.linePosition;e.dom.tabsHolder=e.dom.holder.append("div").style(`border-${e.opts.linePosition}`,"0.5px solid #1575ad");if(!e.opts.contentHolder&&!e.opts.noContent){e.dom.contentHolder=e.dom.holder.append("div")}else e.dom.contentHolder=e.opts.contentHolder;if(e.opts.tabsPosition=="vertical"){e.dom.tabsHolder.style("display","inline-grid").style("align-items","start").style("gap",e.opts.gap||"");e.dom.contentHolder.style("display","inline-block").style("vertical-align","top").style("position","relative")}else e.dom.tabsHolder.style("display","inline-block");yield e.dom.tabsHolder.selectAll("button").data(e.tabs).enter().append("button").attr("data-testid","sja_toggle_button").attr("class","sj-toggle-button").classed("sjpp-active",(e=>e.active)).style("padding","0px").style("width",(e=>e.width?`${e.width}px`:"fit-content")).style("min-width",(t=>t.width?null:Math.max(e.defaultTabWidth))).style("border","none").style("background-color","transparent").style("display",e.opts.tabsPosition=="vertical"?"flex":"inline-grid").property("disabled",(e=>e.disabled?e.disabled():false)).each((function(t){return Wf(this,void 0,void 0,(function*(){t.wrapper=ot(this);if(e.opts.linePosition=="right")t.wrapper.style("justify-self","end");if(e.opts.linePosition=="left")t.wrapper.style("justify-self","start");if(e.opts.linePosition=="top"||e.opts.linePosition=="left"){t.line=t.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-flex":"flex");t.tab=t.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-block":"block")}else{t.tab=t.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-block":"block");t.line=t.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-flex":"flex")}if(t.disabled&&t.isVisible){t.wrapper.style("cursor",t.disabled()==true&&t.isVisible()==true?"not-allowed":"pointer")}t.tab.style("color",t.active?"#1575ad":"#757373").style("text-align",n).style("padding","5px").html(t.label);t.line.style("background-color","#1575ad").style("visibility",t.active?"visible":"hidden");if(e.opts.linePosition=="top"||e.opts.linePosition=="bottom"){t.line.style("height","8px").style("padding","0px 5px")}else{t.line.style("align-self","stretch").style("padding","5px 0px").html('<span style="width: 8px";> </span>')}if(e.dom.contentHolder){t.contentHolder=e.dom.contentHolder.append("div").style("display",t.active?"block":"none");if(e.opts.tabsPosition=="horizontal"&&!e.opts.noTopContentStyle){t.contentHolder.style("padding-top","10px").style("margin-top","10px")}}if(t.active&&t.callback)yield t.callback(event,t);t.wrapper.on("mouseenter",(()=>{t.tab.style("color",t.active?"#757373":"#1575ad")})).on("mouseleave",(()=>{t.tab.style("color",t.active?"#1575ad":"#757373")}))}))})).on("click",((t,n)=>Wf(this,void 0,void 0,(function*(){for(const t of e.tabs){t.active=t===n}const o=e.tabs.findIndex((e=>e.active));e.update(o);if(n.callback)yield n.callback(t,n)}))));const o=e.tabs.findIndex((e=>e.active));e.update(o)}));e.update=(t=0,n={})=>{e.tabs.forEach(((e,n)=>{e.active=t===n}));e.dom.tabsHolder.selectAll("button").data(e.tabs).classed("sjpp-active",(e=>e.active)).each((e=>{e.wrapper.classed("sjpp-active",e.active);if(e.isVisible)e.wrapper.style("display",(e=>n&&e.isVisible()?"":"none"));if(e.contentHolder)e.contentHolder.style("display",e.active?"block":"none");e.tab.style("color",e.active?"#1575ad":"#757373");e.line.style("visibility",e.active?"visible":"hidden")}))}}class Zf{constructor(e){this.opts=e;this.dom={holder:e.holder,trailDiv:e.trailDiv||e.holder.append("div")};Kf(this)}async main(e={}){try{return await this.render()}catch(e){if(e.stack)console.log(e.stack);else throw e}}}function Kf(e){e.render=async()=>{e.crumbs=e.opts.crumbs;for(const t of e.crumbs){t.label=t.label||t.name}const t=e.crumbs.find((e=>e.inTrail));if(!t)e.crumbs[0].inTrail=true;await e.dom.trailDiv.style("margin-left","5px").style("font-size",".75em").style("display","inline-block").classed("sjpp-breadcrumb-trail",true).selectAll("span").data(e.crumbs).enter().append("span").classed("sjpp-breadcrumb",true).html((e=>` > ${e.label}`)).style("display",(e=>e.inTrail?"inline-block":"none")).each((async function(e){if(!e.inTrail)e.inTrail=false;e.crumb=ot(this)}));e.update()};e.update=(t=0)=>{e.crumbs.forEach(((e,n)=>{e.inTrail=t===n}));e.dom.trailDiv.selectAll("span").data(e.crumbs).each((async e=>{e.crumb.style("display",e.inTrail?"inline-block":"none")}))}}var Qf={exports:{}};function ep(e){if(e instanceof Map){e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}}else if(e instanceof Set){e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}}Object.freeze(e);Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];if(typeof n=="object"&&!Object.isFrozen(n)){ep(n)}}));return e}Qf.exports=ep;Qf.exports.default=ep;var tp=Qf.exports;class np{constructor(e){if(e.data===undefined)e.data={};this.data=e.data;this.isMatchIgnored=false}ignoreMatch(){this.isMatchIgnored=true}}function op(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ip(e,...t){const n=Object.create(null);for(const t in e){n[t]=e[t]}t.forEach((function(e){for(const t in e){n[t]=e[t]}}));return n}const sp="</span>";const rp=e=>!!e.kind;const ap=(e,{prefix:t})=>{if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`};class lp{constructor(e,t){this.buffer="";this.classPrefix=t.classPrefix;e.walk(this)}addText(e){this.buffer+=op(e)}openNode(e){if(!rp(e))return;let t=e.kind;if(e.sublanguage){t=`language-${t}`}else{t=ap(t,{prefix:this.classPrefix})}this.span(t)}closeNode(e){if(!rp(e))return;this.buffer+=sp}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class cp{constructor(){this.rootNode={children:[]};this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t);this.stack.push(t)}closeNode(){if(this.stack.length>1){return this.stack.pop()}return undefined}closeAllNodes(){while(this.closeNode());}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){if(typeof t==="string"){e.addText(t)}else if(t.children){e.openNode(t);t.children.forEach((t=>this._walk(e,t)));e.closeNode(t)}return e}static _collapse(e){if(typeof e==="string")return;if(!e.children)return;if(e.children.every((e=>typeof e==="string"))){e.children=[e.children.join("")]}else{e.children.forEach((e=>{cp._collapse(e)}))}}}class dp extends cp{constructor(e){super();this.options=e}addKeyword(e,t){if(e===""){return}this.openNode(t);this.addText(e);this.closeNode()}addText(e){if(e===""){return}this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t;n.sublanguage=true;this.add(n)}toHTML(){const e=new lp(this,this.options);return e.value()}finalize(){return true}}function fp(e){if(!e)return null;if(typeof e==="string")return e;return e.source}function pp(e){return up("(?=",e,")")}function up(...e){const t=e.map((e=>fp(e))).join("");return t}function hp(e){const t=e[e.length-1];if(typeof t==="object"&&t.constructor===Object){e.splice(e.length-1,1);return t}else{return{}}}function mp(...e){const t=hp(e);const n="("+(t.capture?"":"?:")+e.map((e=>fp(e))).join("|")+")";return n}function gp(e){return new RegExp(e.toString()+"|").exec("").length-1}function bp(e,t){const n=e&&e.exec(t);return n&&n.index===0}const yp=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function vp(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let o=fp(e);let i="";while(o.length>0){const e=yp.exec(o);if(!e){i+=o;break}i+=o.substring(0,e.index);o=o.substring(e.index+e[0].length);if(e[0][0]==="\\"&&e[1]){i+="\\"+String(Number(e[1])+t)}else{i+=e[0];if(e[0]==="("){n++}}}return i})).map((e=>`(${e})`)).join(t)}const wp=/\b\B/;const xp="[a-zA-Z]\\w*";const _p="[a-zA-Z_]\\w*";const kp="\\b\\d+(\\.\\d+)?";const jp="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";const Np="\\b(0b[01]+)";const Sp="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";const Ap=(e={})=>{const t=/^#![ ]*\//;if(e.binary){e.begin=up(t,/.*\b/,e.binary,/\b.*/)}return ip({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{if(e.index!==0)t.ignoreMatch()}},e)};const Cp={begin:"\\\\[\\s\\S]",relevance:0};const Ep={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Cp]};const Op={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Cp]};const Mp={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/};const Ip=function(e,t,n={}){const o=ip({scope:"comment",begin:e,end:t,contains:[]},n);o.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:true,relevance:0});const i=mp("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);o.contains.push({begin:up(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")});return o};const Tp=Ip("//","$");const Rp=Ip("/\\*","\\*/");const Lp=Ip("#","$");const $p={scope:"number",begin:kp,relevance:0};const zp={scope:"number",begin:jp,relevance:0};const Pp={scope:"number",begin:Np,relevance:0};const Dp={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[Cp,{begin:/\[/,end:/\]/,relevance:0,contains:[Cp]}]}]};const Up={scope:"title",begin:xp,relevance:0};const Bp={scope:"title",begin:_p,relevance:0};const Fp={begin:"\\.\\s*"+_p,relevance:0};const qp=function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{if(t.data._beginMatch!==e[1])t.ignoreMatch()}})};var Hp=Object.freeze({__proto__:null,MATCH_NOTHING_RE:wp,IDENT_RE:xp,UNDERSCORE_IDENT_RE:_p,NUMBER_RE:kp,C_NUMBER_RE:jp,BINARY_NUMBER_RE:Np,RE_STARTERS_RE:Sp,SHEBANG:Ap,BACKSLASH_ESCAPE:Cp,APOS_STRING_MODE:Ep,QUOTE_STRING_MODE:Op,PHRASAL_WORDS_MODE:Mp,COMMENT:Ip,C_LINE_COMMENT_MODE:Tp,C_BLOCK_COMMENT_MODE:Rp,HASH_COMMENT_MODE:Lp,NUMBER_MODE:$p,C_NUMBER_MODE:zp,BINARY_NUMBER_MODE:Pp,REGEXP_MODE:Dp,TITLE_MODE:Up,UNDERSCORE_TITLE_MODE:Bp,METHOD_GUARD:Fp,END_SAME_AS_BEGIN:qp});function Gp(e,t){const n=e.input[e.index-1];if(n==="."){t.ignoreMatch()}}function Jp(e,t){if(e.className!==undefined){e.scope=e.className;delete e.className}}function Vp(e,t){if(!t)return;if(!e.beginKeywords)return;e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)";e.__beforeBegin=Gp;e.keywords=e.keywords||e.beginKeywords;delete e.beginKeywords;if(e.relevance===undefined)e.relevance=0}function Wp(e,t){if(!Array.isArray(e.illegal))return;e.illegal=mp(...e.illegal)}function Xp(e,t){if(!e.match)return;if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match;delete e.match}function Yp(e,t){if(e.relevance===undefined)e.relevance=1}const Zp=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]}));e.keywords=n.keywords;e.begin=up(n.beforeMatch,pp(n.begin));e.starts={relevance:0,contains:[Object.assign(n,{endsParent:true})]};e.relevance=0;delete n.beforeMatch};const Kp=["of","and","for","in","not","or","if","then","parent","list","value"];const Qp="keyword";function eu(e,t,n=Qp){const o=Object.create(null);if(typeof e==="string"){i(n,e.split(" "))}else if(Array.isArray(e)){i(n,e)}else{Object.keys(e).forEach((function(n){Object.assign(o,eu(e[n],t,n))}))}return o;function i(e,n){if(t){n=n.map((e=>e.toLowerCase()))}n.forEach((function(t){const n=t.split("|");o[n[0]]=[e,tu(n[0],n[1])]}))}}function tu(e,t){if(t){return Number(t)}return nu(e)?0:1}function nu(e){return Kp.includes(e.toLowerCase())}const ou={};const iu=e=>{console.error(e)};const su=(e,...t)=>{console.log(`WARN: ${e}`,...t)};const ru=(e,t)=>{if(ou[`${e}/${t}`])return;console.log(`Deprecated as of ${e}. ${t}`);ou[`${e}/${t}`]=true};const au=new Error;function lu(e,t,{key:n}){let o=0;const i=e[n];const s={};const r={};for(let e=1;e<=t.length;e++){r[e+o]=i[e];s[e+o]=true;o+=gp(t[e-1])}e[n]=r;e[n]._emit=s;e[n]._multi=true}function cu(e){if(!Array.isArray(e.begin))return;if(e.skip||e.excludeBegin||e.returnBegin){iu("skip, excludeBegin, returnBegin not compatible with beginScope: {}");throw au}if(typeof e.beginScope!=="object"||e.beginScope===null){iu("beginScope must be object");throw au}lu(e,e.begin,{key:"beginScope"});e.begin=vp(e.begin,{joinWith:""})}function du(e){if(!Array.isArray(e.end))return;if(e.skip||e.excludeEnd||e.returnEnd){iu("skip, excludeEnd, returnEnd not compatible with endScope: {}");throw au}if(typeof e.endScope!=="object"||e.endScope===null){iu("endScope must be object");throw au}lu(e,e.end,{key:"endScope"});e.end=vp(e.end,{joinWith:""})}function fu(e){if(e.scope&&typeof e.scope==="object"&&e.scope!==null){e.beginScope=e.scope;delete e.scope}}function pu(e){fu(e);if(typeof e.beginScope==="string"){e.beginScope={_wrap:e.beginScope}}if(typeof e.endScope==="string"){e.endScope={_wrap:e.endScope}}cu(e);du(e)}function uu(e){function t(t,n){return new RegExp(fp(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={};this.regexes=[];this.matchAt=1;this.position=0}addRule(e,t){t.position=this.position++;this.matchIndexes[this.matchAt]=t;this.regexes.push([t,e]);this.matchAt+=gp(e)+1}compile(){if(this.regexes.length===0){this.exec=()=>null}const e=this.regexes.map((e=>e[1]));this.matcherRe=t(vp(e,{joinWith:"|"}),true);this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t){return null}const n=t.findIndex(((e,t)=>t>0&&e!==undefined));const o=this.matchIndexes[n];t.splice(0,n);return Object.assign(t,o)}}class o{constructor(){this.rules=[];this.multiRegexes=[];this.count=0;this.lastIndex=0;this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n)));t.compile();this.multiRegexes[e]=t;return t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]);if(t.type==="begin")this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()){if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1;n=t.exec(e)}}if(n){this.regexIndex+=n.position+1;if(this.regexIndex===this.count){this.considerAll()}}return n}}function i(e){const t=new o;e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"})));if(e.terminatorEnd){t.addRule(e.terminatorEnd,{type:"end"})}if(e.illegal){t.addRule(e.illegal,{type:"illegal"})}return t}function s(n,o){const r=n;if(n.isCompiled)return r;[Jp,Xp,pu,Zp].forEach((e=>e(n,o)));e.compilerExtensions.forEach((e=>e(n,o)));n.__beforeBegin=null;[Vp,Wp,Yp].forEach((e=>e(n,o)));n.isCompiled=true;let a=null;if(typeof n.keywords==="object"&&n.keywords.$pattern){n.keywords=Object.assign({},n.keywords);a=n.keywords.$pattern;delete n.keywords.$pattern}a=a||/\w+/;if(n.keywords){n.keywords=eu(n.keywords,e.case_insensitive)}r.keywordPatternRe=t(a,true);if(o){if(!n.begin)n.begin=/\B|\b/;r.beginRe=t(n.begin);if(!n.end&&!n.endsWithParent)n.end=/\B|\b/;if(n.end)r.endRe=t(n.end);r.terminatorEnd=fp(n.end)||"";if(n.endsWithParent&&o.terminatorEnd){r.terminatorEnd+=(n.end?"|":"")+o.terminatorEnd}}if(n.illegal)r.illegalRe=t(n.illegal);if(!n.contains)n.contains=[];n.contains=[].concat(...n.contains.map((function(e){return mu(e==="self"?n:e)})));n.contains.forEach((function(e){s(e,r)}));if(n.starts){s(n.starts,o)}r.matcher=i(r);return r}if(!e.compilerExtensions)e.compilerExtensions=[];if(e.contains&&e.contains.includes("self")){throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")}e.classNameAliases=ip(e.classNameAliases||{});return s(e)}function hu(e){if(!e)return false;return e.endsWithParent||hu(e.starts)}function mu(e){if(e.variants&&!e.cachedVariants){e.cachedVariants=e.variants.map((function(t){return ip(e,{variants:null},t)}))}if(e.cachedVariants){return e.cachedVariants}if(hu(e)){return ip(e,{starts:e.starts?ip(e.starts):null})}if(Object.isFrozen(e)){return ip(e)}return e}var gu="11.2.0";const bu=op;const yu=ip;const vu=Symbol("nomatch");const wu=7;const xu=function(e){const t=Object.create(null);const n=Object.create(null);const o=[];let i=true;const s="Could not find the language '{}', did you forget to load/include a language module?";const r={disableAutodetect:true,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:false,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:dp};function l(e){return a.noHighlightRe.test(e)}function c(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=a.languageDetectRe.exec(t);if(n){const t=N(n[1]);if(!t){su(s.replace("{}",n[1]));su("Falling back to no-highlight mode for this block.",e)}return t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>l(e)||N(e)))}function d(e,t,n){let o="";let i="";if(typeof t==="object"){o=e;n=t.ignoreIllegals;i=t.language}else{ru("10.7.0","highlight(lang, code, ...args) has been deprecated.");ru("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");i=e;o=t}if(n===undefined){n=true}const s={code:o,language:i};O("before:highlight",s);const r=s.result?s.result:f(s.language,s.code,n);r.code=s.code;O("after:highlight",r);return r}function f(e,n,o,r){const l=Object.create(null);function c(e,t){return e.keywords[t]}function d(){if(!C.keywords){O.addText(M);return}let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(M);let n="";while(t){n+=M.substring(e,t.index);const o=j.case_insensitive?t[0].toLowerCase():t[0];const i=c(C,o);if(i){const[e,s]=i;O.addText(n);n="";l[o]=(l[o]||0)+1;if(l[o]<=wu)I+=s;if(e.startsWith("_")){n+=t[0]}else{const n=j.classNameAliases[e]||e;O.addKeyword(t[0],n)}}else{n+=t[0]}e=C.keywordPatternRe.lastIndex;t=C.keywordPatternRe.exec(M)}n+=M.substr(e);O.addText(n)}function p(){if(M==="")return;let e=null;if(typeof C.subLanguage==="string"){if(!t[C.subLanguage]){O.addText(M);return}e=f(C.subLanguage,M,true,E[C.subLanguage]);E[C.subLanguage]=e._top}else{e=u(M,C.subLanguage.length?C.subLanguage:null)}if(C.relevance>0){I+=e.relevance}O.addSublanguage(e._emitter,e.language)}function h(){if(C.subLanguage!=null){p()}else{d()}M=""}function m(e,t){let n=1;while(t[n]!==undefined){if(!e._emit[n]){n++;continue}const o=j.classNameAliases[e[n]]||e[n];const i=t[n];if(o){O.addKeyword(i,o)}else{M=i;d();M=""}n++}}function g(e,t){if(e.scope&&typeof e.scope==="string"){O.openNode(j.classNameAliases[e.scope]||e.scope)}if(e.beginScope){if(e.beginScope._wrap){O.addKeyword(M,j.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap);M=""}else if(e.beginScope._multi){m(e.beginScope,t);M=""}}C=Object.create(e,{parent:{value:C}});return C}function b(e,t,n){let o=bp(e.endRe,n);if(o){if(e["on:end"]){const n=new np(e);e["on:end"](t,n);if(n.isMatchIgnored)o=false}if(o){while(e.endsParent&&e.parent){e=e.parent}return e}}if(e.endsWithParent){return b(e.parent,t,n)}}function y(e){if(C.matcher.regexIndex===0){M+=e[0];return 1}else{L=true;return 0}}function v(e){const t=e[0];const n=e.rule;const o=new np(n);const i=[n.__beforeBegin,n["on:begin"]];for(const n of i){if(!n)continue;n(e,o);if(o.isMatchIgnored)return y(t)}if(n.skip){M+=t}else{if(n.excludeBegin){M+=t}h();if(!n.returnBegin&&!n.excludeBegin){M=t}}g(n,e);return n.returnBegin?0:t.length}function w(e){const t=e[0];const o=n.substr(e.index);const i=b(C,e,o);if(!i){return vu}const s=C;if(C.endScope&&C.endScope._wrap){h();O.addKeyword(t,C.endScope._wrap)}else if(C.endScope&&C.endScope._multi){h();m(C.endScope,e)}else if(s.skip){M+=t}else{if(!(s.returnEnd||s.excludeEnd)){M+=t}h();if(s.excludeEnd){M=t}}do{if(C.scope){O.closeNode()}if(!C.skip&&!C.subLanguage){I+=C.relevance}C=C.parent}while(C!==i.parent);if(i.starts){g(i.starts,e)}return s.returnEnd?0:t.length}function x(){const e=[];for(let t=C;t!==j;t=t.parent){if(t.scope){e.unshift(t.scope)}}e.forEach((e=>O.openNode(e)))}let _={};function k(t,s){const r=s&&s[0];M+=t;if(r==null){h();return 0}if(_.type==="begin"&&s.type==="end"&&_.index===s.index&&r===""){M+=n.slice(s.index,s.index+1);if(!i){const t=new Error(`0 width match regex (${e})`);t.languageName=e;t.badRule=_.rule;throw t}return 1}_=s;if(s.type==="begin"){return v(s)}else if(s.type==="illegal"&&!o){const e=new Error('Illegal lexeme "'+r+'" for mode "'+(C.scope||"<unnamed>")+'"');e.mode=C;throw e}else if(s.type==="end"){const e=w(s);if(e!==vu){return e}}if(s.type==="illegal"&&r===""){return 1}if(R>1e5&&R>s.index*3){const e=new Error("potential infinite loop, way more iterations than matches");throw e}M+=r;return r.length}const j=N(e);if(!j){iu(s.replace("{}",e));throw new Error('Unknown language: "'+e+'"')}const S=uu(j);let A="";let C=r||S;const E={};const O=new a.__emitter(a);x();let M="";let I=0;let T=0;let R=0;let L=false;try{C.matcher.considerAll();for(;;){R++;if(L){L=false}else{C.matcher.considerAll()}C.matcher.lastIndex=T;const e=C.matcher.exec(n);if(!e)break;const t=n.substring(T,e.index);const o=k(t,e);T=e.index+o}k(n.substr(T));O.closeAllNodes();O.finalize();A=O.toHTML();return{language:e,value:A,relevance:I,illegal:false,_emitter:O,_top:C}}catch(t){if(t.message&&t.message.includes("Illegal")){return{language:e,value:bu(n),illegal:true,relevance:0,_illegalBy:{message:t.message,index:T,context:n.slice(T-100,T+100),mode:t.mode,resultSoFar:A},_emitter:O}}else if(i){return{language:e,value:bu(n),illegal:false,relevance:0,errorRaised:t,_emitter:O,_top:C}}else{throw t}}}function p(e){const t={value:bu(e),illegal:false,relevance:0,_top:r,_emitter:new a.__emitter(a)};t._emitter.addText(e);return t}function u(e,n){n=n||a.languages||Object.keys(t);const o=p(e);const i=n.filter(N).filter(A).map((t=>f(t,e,false)));i.unshift(o);const s=i.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language){return 1}else if(N(t.language).supersetOf===e.language){return-1}}return 0}));const[r,l]=s;const c=r;c.secondBest=l;return c}function h(e,t,o){const i=t&&n[t]||o;e.classList.add("hljs");e.classList.add(`language-${i}`)}function m(e){let t=null;const n=c(e);if(l(n))return;O("before:highlightElement",{el:e,language:n});if(!a.ignoreUnescapedHTML&&e.children.length>0){console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");console.warn("https://github.com/highlightjs/highlight.js/issues/2886");console.warn(e)}t=e;const o=t.textContent;const i=n?d(o,{language:n,ignoreIllegals:true}):u(o);e.innerHTML=i.value;h(e,n,i.language);e.result={language:i.language,re:i.relevance,relevance:i.relevance};if(i.secondBest){e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}}O("after:highlightElement",{el:e,result:i,text:o})}function g(e){a=yu(a,e)}const b=()=>{w();ru("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){w();ru("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let v=false;function w(){if(document.readyState==="loading"){v=true;return}const e=document.querySelectorAll(a.cssSelector);e.forEach(m)}function x(){if(v)w()}if(typeof window!=="undefined"&&window.addEventListener){window.addEventListener("DOMContentLoaded",x,false)}function _(n,o){let s=null;try{s=o(e)}catch(e){iu("Language definition for '{}' could not be registered.".replace("{}",n));if(!i){throw e}else{iu(e)}s=r}if(!s.name)s.name=n;t[n]=s;s.rawDefinition=o.bind(null,e);if(s.aliases){S(s.aliases,{languageName:n})}}function k(e){delete t[e];for(const t of Object.keys(n)){if(n[t]===e){delete n[t]}}}function j(){return Object.keys(t)}function N(e){e=(e||"").toLowerCase();return t[e]||t[n[e]]}function S(e,{languageName:t}){if(typeof e==="string"){e=[e]}e.forEach((e=>{n[e.toLowerCase()]=t}))}function A(e){const t=N(e);return t&&!t.disableAutodetect}function C(e){if(e["before:highlightBlock"]&&!e["before:highlightElement"]){e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}}if(e["after:highlightBlock"]&&!e["after:highlightElement"]){e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))}}}function E(e){C(e);o.push(e)}function O(e,t){const n=e;o.forEach((function(e){if(e[n]){e[n](t)}}))}function M(e){ru("10.7.0","highlightBlock will be removed entirely in v12.0");ru("10.7.0","Please use highlightElement now.");return m(e)}Object.assign(e,{highlight:d,highlightAuto:u,highlightAll:w,highlightElement:m,highlightBlock:M,configure:g,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:_,unregisterLanguage:k,listLanguages:j,getLanguage:N,registerAliases:S,autoDetection:A,inherit:yu,addPlugin:E});e.debugMode=function(){i=false};e.safeMode=function(){i=true};e.versionString=gu;for(const e in Hp){if(typeof Hp[e]==="object"){tp(Hp[e])}}Object.assign(e,Hp);return e};var _u=xu({});var ku=_u;const ju="[A-Za-z$_][0-9A-Za-z$_]*";const Nu=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"];const Su=["true","false","null","undefined","NaN","Infinity"];const Au=["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer","BigInt64Array","BigUint64Array","BigInt"];const Cu=["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"];const Eu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"];const Ou=["arguments","this","super","console","window","document","localStorage","module","global"];const Mu=[].concat(Eu,Au,Cu);function Iu(e){if(!e)return null;if(typeof e==="string")return e;return e.source}function Tu(e){return Ru("(?=",e,")")}function Ru(...e){const t=e.map((e=>Iu(e))).join("");return t}function Lu(e){const t=(e,{after:t})=>{const n="</"+e[0].slice(1);const o=e.input.indexOf(n,t);return o!==-1};const n=ju;const o={begin:"<>",end:"</>"};const i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const o=e[0].length+e.index;const i=e.input[o];if(i==="<"){n.ignoreMatch();return}if(i===">"){if(!t(e,{after:o})){n.ignoreMatch()}}}};const s={$pattern:ju,keyword:Nu,literal:Su,built_in:Mu,"variable.language":Ou};const r="[0-9](_?[0-9])*";const a=`\\.(${r})`;const l=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;const c={className:"number",variants:[{begin:`(\\b(${l})((${a})|\\.)?|(${a}))`+`[eE][+-]?(${r})\\b`},{begin:`\\b(${l})\\b((${a})\\b|\\.)?|(${a})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0};const d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]};const f={begin:"html`",end:"",starts:{end:"`",returnEnd:false,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}};const p={begin:"css`",end:"",starts:{end:"`",returnEnd:false,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}};const u={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]};const h=e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:true,excludeBegin:true,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:true,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]});const m={className:"comment",variants:[h,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]};const g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,u,c,e.REGEXP_MODE];d.contains=g.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(g)});const b=[].concat(m,d.contains);const y=b.concat([{begin:/\(/,end:/\)/,keywords:s,contains:["self"].concat(b)}]);const v={className:"params",begin:/\(/,end:/\)/,excludeBegin:true,excludeEnd:true,keywords:s,contains:y};const w={variants:[{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}},{match:[/extends/,/\s+/,Ru(n,"(",Ru(/\./,n),")*")],scope:{1:"keyword",3:"title.class.inherited"}}]};const x={relevance:0,match:/\b[A-Z][a-z]+([A-Z][a-z]+)*/,className:"title.class",keywords:{_:[...Au,...Cu]}};const _={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/};const k={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/};const j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function N(e){return Ru("(?!",e.join("|"),")")}const S={match:Ru(/\b/,N([...Eu,"super"]),n,Tu(/\(/)),className:"title.function",relevance:0};const A={begin:Ru(/\./,Tu(Ru(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:true,keywords:"prototype",className:"property",relevance:0};const C={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]};const E="(\\("+"[^()]*(\\("+"[^()]*(\\("+"[^()]*"+"\\)[^()]*)*"+"\\)[^()]*)*"+"\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>";const O={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,Tu(E)],className:{1:"keyword",3:"title.function"},contains:[v]};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:y},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),_,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,u,m,c,x,{className:"attr",begin:n+Tu(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:true,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:true},{begin:/\(/,end:/\)/,excludeBegin:true,excludeEnd:true,keywords:s,contains:y}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:true,contains:["self"]}]}]},k,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\("+"[^()]*(\\("+"[^()]*(\\("+"[^()]*"+"\\)[^()]*)*"+"\\)[^()]*)*"+"\\)\\s*\\{",returnBegin:true,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},S,j,w,C,{match:/\$[(.]/}]}}function $u(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01};const n={match:/[{}[\],:]/,className:"punctuation",relevance:0};const o={beginKeywords:["true","false","null"].join(" ")};return{name:"JSON",contains:[t,n,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}ku.registerLanguage("javascript",Lu);ku.registerLanguage("json",$u);async function zu(e,t){const n=Qd(t.sandboxDiv);n.header_row;n.header.append("span").text(e.name);n.body.style("overflow","hidden").style("background-color","white");if(e.type=="nestedCard")return Pu(e,n,t);const o=e.sandboxJson?await Bl(`${t.app.cardsPath}/${e.sandboxJson}.json`):await Bl(`${t.app.cardsPath}/${e.sandboxHtml}.txt`);if(o.error){xc(n.body.insert("div","div"),o.error);return}if(e.type=="card")return Du(e,o,n,t);if(e.type=="dsButton")return th(t,o,n)}async function Pu(e,t,n){t.body.style("justify-content","center").style("background-color","#f2ebdc");const o=t.body.append("ul").style("list-style","none").style("display","grid").style("grid-template-columns","40vw 40vw").style("grid-template-rows","repeat(1, auto)").style("gap","5px");const i=e.children.filter((e=>!e.hidden));t.header.trail=new Zf({holder:t.header,crumbs:i});i.forEach((e=>{const s=o.append("li");s.attr("class","sjpp-app-drawer-card").style("padding","10px").style("margin","5px").html(`<p style="margin-left: 12px; font-size:14.5px;font-weight:500; display: block;">${e.name}</p>\n\t\t\t<p style="display: block; font-size: 13px; font-weight: 300; margin-left: 20px; justify-content: center; font-style:oblique; color: #403f3f;">${e.description}</p>`).on("click",(async s=>{s.stopPropagation();o.selectAll("*").remove();const r=e.sandboxJson?await Bl(`${n.app.cardsPath}/${e.sandboxJson}.json`):await Bl(`${n.app.cardsPath}/${e.sandboxHtml}.txt`);if(r.error){xc(t.body.insert("div","div"),r.error);return}if(e.type=="card"){t.header.trail.main();const o=i.findIndex((t=>t==e));t.header.trail.update(o);Du(e,r,t,n)}if(e.type=="dsButton")return th(n.app.opts,r,t)}));return JSON.stringify(s)}))}async function Du(e,t,n,o){if(e.sandboxHtml){const e=await t.text();return n.body.append("div").style("padding","0vw 0vw 2vw 0vw").append("div").style("background-color","white").style("margin","0vw 10vw").style("padding","10px").append("div").style("margin","0vw 5vw").html(e)}n.body.style("background-color","white");const i={intro:t.intro,ppcalls:t.ppcalls.filter((e=>!e.hidden)),buttons:t.buttons,arrowButtons:t.arrowButtons,ribbonMessage:t.ribbonMessage,citation:t.citation_id};Hu(i.intro,n.body);if(e.ribbon)Hu(i.ribbonMessage,n.body,e.ribbon);const s=n.body.append("div");const r=n.body.append("div");Gu(i.buttons,s);Vu(i,"main",s,r,o);if(e.disableTopTabs)Uu(i.ppcalls[0],n.body,e,o);else{const t=n.body.append("div").style("display","flex").style("align-content","end").style("justify-content","center").style("border","none").style("border-bottom","1px solid lightgray").style("width","100%").style("font-size","20px");const s=n.body.append("div");Fu(i.ppcalls,e,t,s,n,o)}}function Uu(e,t,n,o){Hu(e.message,t);const i=t.append("div").style("margin-bottom","20px");const s=t.append("div");Gu(e.buttons,i);Xu(e.download,i,n.section);Wu(e.urlparam,i,n.section);Vu(e,"call",i,s,o);if(!n.disableTopTabs){t.append("hr").style("border","0").style("border-top","1px dashed #e3e3e6").style("width","100%")}const r={holder:t.append("div").style("margin","20px").node(),host:window.location.origin};const a=JSON.parse(JSON.stringify(e.runargs));runproteinpaint(Object.assign(r,a))}function Bu(e,t,n,o){const i=[];const s=e.findIndex((e=>e.isUi==true));const r=e.findIndex((e=>e.isUi==undefined));const a=s!=-1?true:false;if(a==true){i.push({label:"Add Your Data",active:false,callback:async(t,n)=>{try{const t={holder:n.contentHolder.append("div").style("margin","20px").node(),sandbox_header:n.contentHolder,host:window.location.origin};const o=JSON.parse(JSON.stringify(e[s].runargs));runproteinpaint(Object.assign(t,o));delete n.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}if(e.length==1&&a!=true||e.length==2&&a==true){i.push({label:"Example",active:false,callback:async(n,i)=>{try{Uu(e[r],i.contentHolder,t,o);delete i.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}if(e.length>1&&a==false||e.length>2&&a==true){i.push({label:"Examples",active:false,callback:async(i,s)=>{try{const i=e.filter((e=>e.isUi!=true));qu(t,s.contentHolder,i,n,o);delete s.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}return i}function Fu(e,t,n,o,i,s){const r=Bu(e,t,i,s);new Xf({holder:n,contentHolder:o,tabs:r}).main()}async function qu(e,t,n,o,i){const s=n.map(((t,n)=>r(t,n,e.section)));o.header.trail=await new Zf({holder:o.header,crumbs:s});function r(e,t,n){return{active:t===0,label:e.label,callback:async(t,r)=>{const a=Kc(r.contentHolder);try{if(!r.rendered){yc(r.contentHolder);Uu(e,r.contentHolder,n,i);a.remove()}r.rendered=true;const t=s.findIndex((e=>e==r));o.header.trail.update(t)}catch(e){a.text("Error: "+(e.message||e))}}}}o.header.trail.main();const a=t.append("div").style("display","grid").style("grid-template-columns","minmax(min-content, 10vw) minmax(60vw, 1fr)").classed("sjpp-vertical-tab-menu",true).style("word-break","break-word");const l=a.append("div").classed("sjpp-tabs-div",true).style("border-right","1px solid lightgray");const c=a.append("div").classed("sjpp-content-div",true);new Xf({holder:l,contentHolder:c,tabs:s,linePosition:"right",tabsPosition:"vertical",gap:"10px"}).main()}function Hu(e,t,n){if(n&&n.expireDate){const o=new Date;const i=new Date(n.expireDate);if(i>o&&e!=undefined&&e){function s(){const e=n.text.toLowerCase();return e[0].toUpperCase()+e.slice(1)}t.append("div").style("margin","20px").html(`<p style="display:inline-block;font-weight:bold">${s()}:  </p>${e}`)}}else if(e!=undefined&&e){t.append("div").style("margin","20px").html(e)}}function Gu(e,t){if(e){e.forEach((e=>{const n=Pf({div:t,text:e.name});n.on("click",(t=>{t.stopPropagation();if(e.download)window.open(`${e.download}`,"_self","download");else window.open(`${e.link}`,`${e.name}`)}))}))}}function Ju(e,t){if(e){e.forEach((e=>{const n=`<div style="margin:10px;" class="sjpp-arrow-content">\n\t\t\t\t${e.message?`<div style="margin: 1vw;">${e.message}</div>`:""}\n\t\t\t\t${e.links?e.links.map((e=>{if(!e)return"";if(e.download){return`<a style="cursor:pointer; margin-left:20px;" onclick="event.stopPropagation();" href="${e.download}", target="_self" download>${e.name}</a>`}if(e.link){return`<a style="cursor:pointer; margin-left:20px;" onclick="event.stopPropagation();" href="${e.link}", target="_blank">${e.name}</a>`}})).join(""):""}</div>`;t.push({name:e.name,callback:async e=>{try{e.append("div").html(n)}catch(e){alert("Error: "+e)}}})}))}}async function Vu(e,t,n,o,i){let s=[];if(t=="call")Yu(e,s);if(e.datapreview)eh(s,e.datapreview);if(t=="main"&&e.citation){const t=await Bl(`/${i.app.cardsPath}/citations.json`);if(t.error){console.log(`Error: ${t.error}`);return}for(const n of t.publications){if(e.citation==n.id)Ku(s,n)}}Ju(e.arrowButtons,s);const r=s.findIndex((e=>e.active))==-1?false:true;for(let e=0;e<s.length;e++){const t=s[e];t.btn=Pf({div:n,text:t.name+" ▼"});t.c=o.append("div").style("margin","20px 0px 10px 20px").style("display",r&&e==0||t.active?"block":"none");if(r&&e==0&&t.callback||t.active){t.callback(t.c);delete t.callback}t.btn.on("click",(()=>{if(t.c.style("display")!="none"){t.btn.text(t.name+" ▼").style("color","black").style("background-color","#cfe2f3");t.c.style("display","none")}else{t.btn.text(t.name+" ▲").style("color","whitesmoke").style("background-color","#487ba8");yc(t.c);for(let t=0;t<s.length;t++){if(e!=t){s[t].btn.text(s[t].name+" ▼").style("color","black").style("background-color","#cfe2f3");s[t].c.style("display","none")}}}if(t.callback){t.callback(t.c);delete t.callback}}))}}function Wu(e,t,n){if(e){const o=Pf({div:t,text:n=="apps"?"Run app from URL":"Run track from URL"});o.on("click",(t=>{const n=oh();t.stopPropagation();window.open(`${n}${e}`,"_blank")}))}}function Xu(e,t,n){if(e){const o=Pf({div:t,text:n=="apps"?"Download App File(s)":"Download Track File(s)"});o.on("click",(t=>{t.stopPropagation();window.open(`${e}`,"_self","download")}))}}async function Yu(e,t){if(e.isUi==true)return;const n=ku.highlight(`runproteinpaint({\n host: "${window.location.origin}",\n holder: document.getElementById('a'),\n `+JSON.stringify(e.runargs,"",4).replaceAll(/"(.+)"\s*:/g,"$1:").replaceAll(/\\t/g,"\t").replaceAll(/\\n/g,"\r\t").slice(1,-1).trim()+`\r})`,{language:"javascript"}).value;const o=`<pre style="border: 1px solid #d7d7d9; align-items: center; justify-content: center; margin: 0px 10px 5px 30px; overflow:auto; max-height:400px; ${e.jsonpath?`min-height:400px;`:`min-height: auto;`}">\n\t<code style="font-size:14px; display:block;">${n}</code></pre>`;t.push({name:"Code",callback:async t=>{try{if(e.jsonpath){const n=await Zu(e);const i="<p style='margin:20px 5px 20px 25px;'>ProteinPaint JS code</p>";const s=t.append("div").style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(100px, 1fr))").style("gap","5px");s.append("div").style("display","block").html(i+o);s.append("div").style("display","block").html(n)}else{t.append("div").html(o)}}catch(e){alert("Error: "+e)}}})}async function Zu(e){const t=await Ll("textfile",{file:e.jsonpath});const n=JSON.parse(t.text);const o=e.jsonpath.split("/");const i=o[o.length-1];let s=JSON.stringify(n,"",4).split("\n");let r;if(s.length>120){s=s.slice(0,100);r=true}const a=ku.highlight(s.join("\n"),{language:"json"}).value;const l=`<div>\n\t\t\t<p style="margin: 20px 5px 20px 25px; display: inline-block;">JSON code </p>\n\t\t\t<p style="display: inline-block; color: #696969; font-style:oblique;"> (contents of ${i})</p>\n\t\t</div> \n\t\t<pre style="border: 1px solid #d7d7d9; align-items: center; justify-content: center; margin: 0px 10px 5px 10px; max-height:400px; min-height:400px; overflow:auto;">\n\t\t\t<code class="sjpp-json-code" style="font-size:14px; display:block;">${r==true?`${a} ...<br><p style='margin:20px 25px; justify-content:center;'>Showing first 100 lines. To see the entire JSON, download ${i} from the button above.</p>`:`${a}`}\n\t\t\t</code>\n\t\t</pre>`;return l}function Ku(e,t){e.push({name:"Citation",callback:async e=>{try{e.append("div").style("margin-left","5w").html(`<p style="display: inline-block;">${t.title}. <em>${t.journal}</em>, ${t.year}. </p>\n\t\t\t\t\t\t${t.pmid?`<p style="display: inline-block;">PMID: <a href="${t.pmidURL}" target="_blank">${t.pmid}</a></p>`:`<p>doi: <a href="${t.doi}" target="_blank style="display: inline-block;">${t.doi}</a></p>`}`)}catch(e){alert("Error: "+e)}}})}function Qu(e,t,n,o,i){n.append("div").html(`\n\t\t${i?`<p style="display:block;">${i}<p>`:""}\n\t\t<p style="display: inline-block;">Data preview <span style="color: #696969; font-style:oblique;"> \n\t\t${t>10?`(first ${e.length} rows of ${o})</span></p>`:`(content of ${o})</span></p>`} \n\t`);const s=n.append("div").style("display","grid").style("grid-template-columns","1fr").style("max-width","80%").style("margin-left","10px").style("border","1px solid rgb(227, 227, 230)").style("white-space","pre").style("overflow-x","scroll").style("opacity","0.65").style("padding","1vw");e.forEach((e=>{s.append("code").html(e)}))}async function eh(e,t,n){e.push({name:"View Data",callback:async e=>{try{for(const n of t){const t=await Bl(`/cardsjson?datafile=${n.file}&tabixCoord=${n.tabixQueryCoord}`);if(t.error){console.log(`Error: ${t.error}`);return}const o=t.file;const i=o.length;const s=o.slice(0,10);const r=n.file.split("/");const a=r[r.length-1];Qu(s,i,e,a,n.message)}}catch(e){alert("Error: "+e)}}})}async function th(e,t,n){const o=e?.fromApp?e.genomes[t.button.availableGenomes[0]]:e.app.opts.genomes[t.button.availableGenomes[0]];const i=e?.fromApp?e.genomes:e.app.opts.genomes;const s={availableGenomes:t.button.availableGenomes,genome:o,intro:t.button.intro,name:t.button.name,runargs:t.button.runargs,searchBar:t.button.searchBar,dsURLparam:t.button.dsURLparam};const r=n.body.append("div").style("padding","1em").style("border-bottom","1px solid #d0e3ff");if(s.intro){r.append("div").style("line-height","1.5em").style("padding","0.5em 0.5em 1em 0.5em").html(s.intro)}if(s.searchBar=="none"){const e={holder:n.body.append("div").style("margin","20px").style("overflow-x","auto").node(),host:s.runargs.host||window.location.origin};const t=JSON.parse(JSON.stringify(s.runargs));runproteinpaint(Object.assign(e,t));return}d(r,i);const a=r.append("div").style("display","inline-block").style("padding","0.5em");const l=n.body.append("div").style("max-width","90vw");const c=Df({genome:s.genome,tip:new ec({padding:""}),row:a,geneOnly:s.searchBar=="gene"?true:false,focusOff:true,callback:async e=>{const t=l.insert("div",":first-child").style("max-width","90vw").style("margin","1vw");t.append("div").style("display","inline-block").style("cursor","default").style("margin","0px").style("font-size","1.5em").html("×").on("click",(()=>{t.selectAll("*").remove()}));nh(t,c,s);const n={holder:t.append("div").style("margin","20px").node(),host:window.location.origin,genome:s.genome.name};s.runargs.block==true?(n.position=`${c.chr}:${c.start}-${c.stop}`)&&(n.nativetracks="Refgene"):n.gene=c.geneSymbol;const o=JSON.parse(JSON.stringify(s.runargs));runproteinpaint(Object.assign(n,o))}});function d(e,t){e.append("div").style("display","inline-block").style("padding","10px 10px 0px 20px");const n=[];if(s.availableGenomes.length==1){n.push({label:s.availableGenomes[0],disabled:()=>true,isVisible:()=>true})}else{s.availableGenomes.forEach((e=>{n.push({label:e,callback:(n,o)=>{s.genome=t[e]}})}))}new Xf({holder:e,tabs:n,noContent:true}).main()}}function nh(e,t,n){const o=Pf({div:e,text:"Run Result from URL"});const i=n.runargs.block==true?`position=${t.chr}:${t.start}-${t.stop}`:`gene=${t.geneSymbol}`;o.on("click",(e=>{e.stopPropagation();const t=oh();window.open(`${t}/?genome=${n.genome.name}&${i}&${n.dsURLparam}`,"_blank")}))}function oh(){const e=sessionStorage.getItem("hostURL");if(e.startsWith("http://localhost")||e.startsWith("https://pp")){return e}else return"https://proteinpaint.stjude.org"}var ih=Object.freeze({__proto__:null,openSandbox:zu});class sh{constructor(e){this.type="card";this.opts=this.validateOpts(e);this.holder=e.holder;this.dom=e.dom;this.sandboxDiv=e.sandboxDiv;ah(this)}validateOpts(e){if(!e.element.name)throw`Card .name is missing`;if(e.element.type=="card"){if(!e.element.sandboxJson&&!e.element.sandboxHtml)throw`Either .sandboxJson or .sandboxHtml is missing for card=${e.element.name}`}if(e.element.type=="nestedCard"){if(!e.element.children||e.element.children.length==0)throw`Missing .children for nested card = ${e.element.name}`}if(e.element.ribbon){if(!e.element.ribbon.text)throw`Missing ribbon .text for ${e.element.type} = ${e.element.name}`;if((e.element.ribbon.text.toUpperCase()=="NEW"||e.element.ribbon.text.toUpperCase()=="UPDATED")&&!e.element.ribbon.expireDate)throw`${e.element.type} = ${e.element.name} ribbon is ${e.element.ribbon.text.toUpperCase()} but .expireDate is missing. Please provide`;if(e.element.ribbon.expireDate){if(e.element.ribbon.expireDate>=0){throw`Flag for ${e.element.type} = ${e.element.name} is not a valid date`}}}return e}main(){}}const rh=dl(sh);function ah(e){const t=e.holder.append("li");if(e.opts.element.type=="card"){t.classed("sjpp-track",true).html(`<div class="sjpp-track-h"><span style="font-size:14.5px;font-weight:500;">${e.opts.element.name}</span></div>\n\t\t\t\t${e.opts.element.description?`<span class="sjpp-track-blurb" style="cursor:default">${e.opts.element.description}</span></div>`:" "}\n\t\t\t\t<span class="sjpp-track-image"><img src="${e.opts.element.image}" alt="${e.opts.element.description}"></img></span>\n\t\t\t\t</div>`)}else if(e.opts.element.type=="nestedCard"){t.classed("sjpp-app-drawer-card",true).html(`<p style="margin-left: 12px; font-size:14.5px;font-weight:500; display: block;">${e.opts.element.name}</p>\n\t\t\t<p style="display: block; font-size: 13px; font-weight: 300; margin-left: 20px; justify-content: center; font-style:oblique; color: #403f3f;">${e.opts.element.description}</p>`)}e.makeRibbon=function(e){const n=t.append("div").classed("sjpp-app-drawer-card-ribbon",true).style("align-items","center").style("justify-content","center");const o=e.text.toUpperCase();const i=o=="BETA"?"#418cb5":o=="NEW"?"#1ba176":o=="UPDATED"?"orange":e.color?e.color:"red";n.append("span").text(o).style("color","white").style("background-color",Kt(i).darker()).style("height","auto").style("width","100%").style("top","15%").style("left","-30%").style("font-size","11.5px").style("text-transform","uppercase").style("text-align","center")};if(e.opts.element.ribbon){const t=new Date;const n=new Date(e.opts.element.ribbon.expireDate);if(n>t||n=="Invalid Date")e.makeRibbon(e.opts.element.ribbon)}t.on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active",value:false});vh(e);await zu(e.opts.element,e.opts)}))}class lh{constructor(e){this.type="button";this.opts=this.validateOpts(e);this.holder=e.holder;this.dom=e.dom;this.sandboxDiv=e.sandboxDiv;dh(this)}validateOpts(e){if(!e.element.name)throw`Button name is missing`;if(!e.element.sandboxJson&&!e.element.sandboxHtml)throw`Either .sandboxJson or .sandboxHtml is missing for button=${e.element.name}`;return e}main(){}}const ch=al(lh);function dh(e){const t=Pf({div:e.holder,text:e.opts.element.name,margin:"20px 20px 0px"});t.attr("class","sjpp-appdrawer-dataset-btn").on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active",value:false});vh(e);await zu(e.opts.element,e.opts)}))}class fh{constructor(e){this.type="layout";this.dom={holder:e.dom.drawerDiv,wrapper:e.dom.wrapper,sandboxDiv:e.dom.sandboxDiv};this.state=e.state;this.hasStatePreMain=true}async validateIndexJson(){const e=await this.getIndexJson();if(!e.elements)throw`Missing elements array`;if(!e.elements.length)throw`No element objects provided`;if(e.columnsLayout){if(e.columnsLayout.length==0)throw`Missing column objects`;const t=e.columnsLayout.map((e=>e.gridarea));if(t.length!=new Set(t).size)throw`Duplicate values for .gridarea found`;const n=[];for(const t of e.columnsLayout){if(!t.gridarea)throw`Missing column .gridarea for column = ${t.name}`;if(!t.sections||t.sections.length==0)throw`Missing section objects for column = ${t.name}`;for(const e of t.sections){if(!e.id)throw`Missing section .id in ${e.name?`section = ${e.name}`:`column = ${t.name} array`}`;n.push(e.id)}if(t.sections.length!=new Set(t.sections).size){throw`Non-unique levels in line ${lineNum}: ${JSON.stringify(levelNames)}`}}if(n.length!=new Set(n).size)throw`Duplicate values for section.id found`;for(const t of e.elements){if(!t.section)throw`.section is missing for ${t.type} = ${t.name}`;if(!n.some((e=>e==t.section)))throw`section = ${t.section} for ${t.type} = ${t.name} is not a column section`}}return e}async getIndexJson(){const e=await Bl(this.app.cardsPath+"/index.json");if(e.error){xc(this.dom.holder.append("div"),e.error);return}return e}async init(){this.index=await this.validateIndexJson();this.elementsRendered=false;uh(this);this.elements=this.index.elements.filter((e=>!e.hidden));this.layout=this.index.columnsLayout?this.index.columnsLayout:null;this.components={elements:[]}}async main(){if(this.elementsRendered==true)return;this.elementsRendered=true;for(const e of this.elements){const t=ot(this.layout?`#${e.section} > .sjpp-element-list`:`.sjpp-element-list`);if(e.type=="card"||e.type=="nestedCard"){this.components.elements.push(await rh({app:this.app,holder:t.style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(320px, 1fr))").style("gap","10px").style("list-style","none").style("margin","15px 0px"),element:e,dom:this.opts.dom,state:this.state,sandboxDiv:this.dom.sandboxDiv}))}else if(e.type=="dsButton"){this.components.elements.push(await ch({app:this.app,holder:t,element:e,dom:this.opts.dom,state:this.state,sandboxDiv:this.dom.sandboxDiv}))}}}}const ph=dl(fh);function uh(e){if(!e.index.columnsLayout)hh(e);if(e.index.columnsLayout)mh(e)}function hh(e){const t=e.dom.wrapper.append("div").style("display","flex").style("padding","10px").classed("sjpp-element-list",true);return t}function mh(e){const t=e.dom.wrapper.append("div").style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(425px, 1fr))").style("gap","10px").style("padding","10px").style("text-align","left");const n=[];for(const t of e.index.columnsLayout)n.push(t.gridarea);t.style("grid-template-areas",`"${n.toString().replace(","," ")}"`);for(const n of e.index.columnsLayout){const e=t.append("div").style("grid-area",n.gridarea).classed(".sjpp-track-cols",true);for(const t of n.sections)o(t,e)}function o(e,t){const n=t.append("div").attr("id",e.id);if(e.name)n.append("h5").classed("sjpp-appdrawer-cols",true).style("color",Kt(Ir).darker()).text(e.name);n.append("div").classed("sjpp-element-list",true).style("padding","10px");return n}}class gh{constructor(e){this.type="mainBtn";this.opts=this.validateOpts(e);this.dom=e.dom;this.state=e.state;this.hasStatePreMain=true;yh(this)}validateOpts(e){return e.app.opts}getState(e){return{appBtnActive:e.appBtnActive}}async init(){this.btnRendered=false;this.drawerFullHeight="";try{if(window.location.pathname=="/"&&!window.location.search.length)await this.app.dispatch({type:"is_apps_btn_active",value:true});this.components={layout:[]}}catch(e){throw e}}async main(e){if(this.app.getState(e).appBtnActive==true&&this.btnRendered==false){this.dom.drawerDiv.style("background-color","#f5f5f5");this.components.layout.push(await ph({app:this.app,dom:this.dom,state:this.state}));setTimeout((()=>{this.drawerFullHeight=this.dom.drawerDiv.node().getBoundingClientRect().height+5}),this.state.duration+5);vh(this);this.btnRendered=true}if(this.state.appBtnActive==false&&this.btnRendered==true)vh(this)}}const bh=dl(gh);function yh(e){e.dom.btnWrapper.style("background-color",e.state.appBtnActive?"#b2b2b2":"#f2f2f2").style("color",e.state.appBtnActive?"#fff":"#000").on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active"});vh(e);if(e.state.appBtnActive){setTimeout((()=>{e.drawerFullHeight=e.dom.drawerDiv.node().getBoundingClientRect().height+5}),e.state.duration+5)}}));e.dom.btn.attr("class","sja_menuoption").style("display","inline-block").style("background-color","transparent").style("color",e.state.appBtnActive?"#fff":"#000").style("padding",e.opts.padw_sm).style("margin","0px 5px").style("cursor","pointer").text("Apps");e.dom.drawerHint.style("position","relative").style("display","inline-block").style("height",e.state.arrowSize.closed+"px").style("width",e.state.appBtnActive?e.state.hintWidth.open:e.state.hintWidth.closed).style("background-color","transparent").style("text-align","center").style("cursor","pointer");e.dom.drawerArrow.style("position","absolute").style("font-size",e.state.arrowSize.closed+"px").style("right",e.state.hintPos.closed.rt+"px").style("bottom",e.state.hintPos.closed.btm+"px").style("background-color","transparent").style("color",e.state.arrowColor.closed).style("opacity",e.state.appBtnActive?0:1).style("cursor","pointer").html("▼");e.dom.drawerArrowOpen.style("position","absolute").style("font-size",e.state.arrowSize.open+"px").style("left",e.state.hintPos.open.left+"px").style("bottom",e.state.hintPos.open.btm+"px").style("transform","rotate(180deg)").style("background-color","transparent").style("color",e.state.arrowColor.open).style("opacity",e.state.appBtnActive?1:0).style("cursor","pointer").style("pointer-events",e.state.appBtnActive?"auto":"none").html("▼");e.drawerFullHeight=e.dom.drawerRow.node().getBoundingClientRect().height+5}async function vh(e){e.dom.btnWrapper.transition().duration(e.opts.state.duration).style("background-color",e.state.appBtnActive?"#b2b2b2":"#f2f2f2").style("color",e.state.appBtnActive?"#fff":"#000");e.dom.btn.transition().duration(e.opts.state.duration).style("color",e.state.appBtnActive?"#fff":"#000");e.dom.drawerDiv.style("display","inline-block").transition().duration(e.opts.state.duration).style("top",e.state.appBtnActive?"0px":"-"+e.drawerFullHeight+"px");e.dom.drawerRow.transition().duration(e.opts.state.duration).style("height",e.state.appBtnActive?e.drawerFullHeight+"px":"0px");e.dom.drawerHint.transition().duration(e.opts.state.duration).style("width",e.state.appBtnActive?e.opts.state.hintWidth.open:e.opts.state.hintWidth.closed);e.dom.drawerArrow.transition().duration(e.opts.state.duration).style("opacity",e.state.appBtnActive?0:1);e.dom.drawerArrowOpen.style("pointer-events",e.state.appBtnActive?"auto":"none").transition().duration(e.opts.state.duration).style("opacity",e.state.appBtnActive?1:0)}class wh{constructor(e){this.type="store";this.defaultState={duration:500,hintPos:{open:{btm:-42,left:13},closed:{btm:3,rt:5}},hintWidth:{open:"0px",closed:"18px"},arrowSize:{open:42,closed:20},arrowColor:{open:"rgb(242,242,242)",closed:"rgb(85,85,85)"},appBtnActive:false}}async init(){}}const xh=cl(wh);wh.prototype.actions={is_apps_btn_active(e){this.state.appBtnActive="value"in e?e.value:!this.state.appBtnActive}};class _h{constructor(e){this.type="app";const t=e.drawerRow.append("div").style("position","relative").style("margin","0 20px").style("padding",`0 ${e.padw_sm}`).style("display","inline-block").style("overflow","hidden").style("border-radius","0px 0px 5px 5px").style("width","93vw").classed("sjpp-drawer-div",true);const n=e.headbox.append("div").style("position","relative").style("display","inline-block").style("margin-left","5px").style("margin-right","5px").style("border-radius","5px").classed("sjpp-apps-btn-wrapper",true);this.dom={drawerRow:e.drawerRow,drawerDiv:t,sandboxDiv:e.sandboxDiv,btnWrapper:n,btn:n.append("div"),drawerHint:n.append("div"),drawerArrow:n.append("div"),drawerArrowOpen:n.append("div"),wrapper:t.append("div")}}preApiFreeze(e){e.cardsPath=this.opts.cardsPath}async init(){try{this.store=await xh({app:this.api,state:this.opts.state});this.state=await this.store.copyState();this.components={mainBtn:await bh({app:this.api,dom:this.dom,state:this.state,indexJson:this.indexJson})};await this.api.dispatch()}catch(e){throw e}}main(){}}const kh=ll(_h);class jh{constructor(e){this.holder=e.holder;this.input=e.holder.append("input");this.tip=e.tip||new ec({border:"",padding:"0px"});this.style=e.style||{};this.size=e.size||20;this.placeholder=e.placeholder||"";this.title=e.title||"";this.searchItems=e.searchItems;this.app=e.app}initUI(){this.holder.style("padding","padding"in this.style?this.style.padding:"5px").style("display","inline-block");this.input.attr("class","sjpp-input-search").style("border","border"in this.style?this.style.border:"5px").attr("size",this.size).attr("placeholder",this.placeholder).attr("title",this.title).on("keyup",(e=>Wf(this,void 0,void 0,(function*(){if(Jc(e))yield this.enterSearch();td.debounce(this.addSearchItems(),400)}))))}addSearchItems(){return Wf(this,void 0,void 0,(function*(){if(!this.input.property("value").trim()){this.tip.hide();return}try{this.tip.clear().showunder(this.input.node());const e=this.tip.d.append("div");const t=yield this.searchItems();yield e.append("div").style("display","flex").selectAll().data(t.filter((e=>e.items.length>=1))).enter().append("div").style("display","block").style("border-left","0.5px solid lightgrey").each(this.showResultsList)}catch(e){if(e.stack)console.log(e.stack);else mf(e)}}))}showResultsList(e){return Wf(this,void 0,void 0,(function*(){e.wrapper=ot(this);e.wrapper.style("padding","5px");e.titleDiv=e.wrapper.append("span").style("padding","3px 0px 5px").style("opacity",.65).style("font-size","0.8em").text(e.title);yield e.wrapper.append("div").classed("sjpp-result-wrapper",true).selectAll("div").data(e.items).enter().append("div").classed("sja_menuoption",true).classed("sjpp-search-result",true).style("display","block").style("padding-left","10px").style("background-color",e.color||"").text((e=>e.name||e.label||e)).on("click",((t,n)=>{t.stopPropagation();e.callback(n)}))}))}enterSearch(){return Wf(this,void 0,void 0,(function*(){if(!this.input.property("value").trim())return;const e=this.tip.d.select(".sjpp-result-wrapper").node();const t=this.tip.d.select(".sjpp-search-result").node();if(t!=null&&t.__data__)e.__data__.callback(t.__data__);else{const e=yield this.searchItems();const t=e.filter((e=>e.default));t[0].callback(this.input.property("value"))}this.input.property("value","");this.tip.hide()}))}updatePlaceholder(e){this.input.attr("placeholder",e)}}async function Nh(e,t,n,o){const i=await Bl(e.cardsPath+"/index.json");if(i.error)mf(`Problem retrieving cards/index.json`);const s=t.toLowerCase().trim();const r=[...i.elements];let a;if(s.length>2){await Sh(r,e);a=Ah(r,s)}else{a=Ah(r,s)}const l={app:e.drawer.opts,sandboxDiv:e.drawer.opts.sandboxDiv,genomes:e.genomes,fromApp:true};n.push({title:"Tracks and Apps",items:a.filter((e=>e.type=="card")),color:"#e1edf7",callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});o.hide();zu(t,l)}},{title:"Datasets",items:a.filter((e=>e.type=="dsButton")),color:"#e5f5e4",callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});o.hide();zu(t,l)}});return n}async function Sh(e,t){const n=e.map((async e=>{if(e.hidden||e.type!="card"||!e.sandboxJson)return e;const n=await Bl(t.cardsPath+`/${e.sandboxJson}.json`);if(n?.ppcalls.length>0){for(const t of n.ppcalls){if(t.isUI)return;if(t?.label)e.searchterms.push(t.label)}}}));await Promise.all(n)}function Ah(e,t){return e.filter((e=>{if(e.hidden)return false;let n=(e.searchterms||[]).reduce(((e,n)=>{if(e)return true;return n.toLowerCase().includes(t)}),false);return n||e.name.toLowerCase().includes(t)})).sort(((e,t)=>e.name.localeCompare(t.name)))}async function Ch(e,t,n){if(e.length==0)return;try{const o=await Bl("/genelookup",{body:{input:e,genome:t,jwt:n}});if(o.error)throw o.error;if(!o.hits)throw".hits[] missing";return o.hits}catch(e){}}async function Eh(e,t,n,o){const i=t.genomes[n];if(!i){console.error("unknown genome "+n);return}const s=Qd(t.drawer.opts.sandboxDiv);s.header.html('<div style="display:inline-block;">'+e+'</div><div class="sjpp-output-sandbox-title">'+n+"</div>");const r=If();const a=await $f(r,i);const l=Ld(e,i);if(l){const e={hostURL:t.hostURL,jwt:o,holder:s.body,genome:i,nobox:true,chr:l.chr,start:l.start,stop:l.stop,dogtag:n,tklst:a,debugmode:t.debugmode};tc(i,e.tklst);import("./block-ec76524e.js").then((function(e){return e.c})).then((t=>new t.Block(e))).catch((e=>{t.error0(e)}));return}const c={hostURL:t.hostURL,jwt:o,query:e,genome:i,holder:s.body,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,tklst:a,debugmode:t.debugmode};const d=sessionStorage.getItem("urlp_mds");if(d){const e=d.split(",");if(e.length==2){c.datasetqueries=[{dataset:e[0],querykey:e[1]}]}}await yf(c)}const Oh=new ec({padding:"0px",offsetX:0,offsetY:0});Oh.d.style("z-index",5555);function Mh(e){if(!window.structuredClone)window.structuredClone=e=>JSON.parse(JSON.stringify(e));const t={error0(e){xc(t.holder0,e)},debugmode:false,callbacks:e.callbacks||{sjcharts:{}},instanceTracker:e.instanceTracker||{sjcharts:{}}};Ih(e,t);if(!t.instanceTracker.sjcharts){t.instanceTracker.sjcharts={}}if(!t.callbacks.sjcharts){t.callbacks.sjcharts={}}if(e.clear){it(".sja_pane").remove();return}t.holder=ot(e.holder?e.holder:document.body).append("div").attr("class","sja_root_holder").attr("data-ppclientversion",`2.63.0`).style("font","1em Arial, sans-serif").style("color","black");t.sandbox_header=e.sandbox_header||undefined;if(e.jwt){sessionStorage.setItem("jwt",e.jwt)}sessionStorage.setItem("suppressErrors",JSON.stringify(e.suppressErrors));if(e.variantPageCall_snv){t.variantPageCall_snv=e.variantPageCall_snv}if(e.samplecart){t.samplecart=e.samplecart}if(e.base_zindex){kc({setzindex:e.base_zindex})}const n=e.serverData||e.termdb&&e.termdb.serverData;const o=Bl("genomes",{},{serverData:n});return o.then((async n=>{if(n.error)throw{message:"Cannot get genomes: "+n.error};if(!n.genomes)throw{message:"no genome data!?"};if(n.base_zindex){kc({setzindex:n.base_zindex})}if(n.features){sessionStorage.setItem("optionalFeatures",JSON.stringify(n.features))}t.genomes=n.genomes;t.cardsPath=n.cardsPath;if(n.debugmode){t.debugmode=true}Xl({dsAuth:n.dsAuth,holder:t.holder});if(n.commonOverrides||e.commonOverrides){ga(Object.assign(n.commonOverrides||{},e.commonOverrides||{}))}if(n.targetPortal&&n.targetPortal=="gdc")await import("./style.gdc-40ec2784.js");for(const e in t.genomes){const n=cm(t.genomes[e]);if(n){throw{message:"Error with "+e+" genome: "+n}}}if(!e.noheader&&!window.location.search.includes("noheader")&&!window.location.search.includes("mass-session-id")&&!window.location.search.includes("mass-session-file")&&!window.location.search.includes("mass-session-url")){Th(t,n,e.jwt)}t.holder0=t.holder.append("div").style("margin","20px");const o=await $h(e,t);return o||t})).catch((e=>{t.holder.text(e.message||e);if(e.stack)console.log(e.stack)}))}Mh.getStatus=async function e(t=""){return await fetch("/healthcheck").then((e=>e.json())).then((e=>{const n={clientVersion:document.querySelector(".sja_root_holder")?.dataset.ppclientversion,versionInfo:e.versionInfo};if(t=="log")console.info(n);else if(t=="json")return JSON.stringify(n);else return n})).catch(console.error)};function Ih(e,t){if(e.host){t.hostURL=e.host}else if(window.location.hostname=="localhost"){const e=If();if(e.has("hosturl"))t.hostURL=e.get("hosturl");else if(window.testHost){t.hostURL=window.testHost}else{const n=e.get("hostname");const o=e.get("hostport");const i=window.location.protocol+"//";if(n&&o)t.hostURL=i+n+":"+o;else if(n)t.hostURL=i+n;else if(o)t.hostURL=i+window.location.hostname+":"+o}}if(!t.hostURL){t.hostURL=import.meta.url.split("/bin/dist")[0]}if(t.hostURL.endsWith("/"))t.hostURL=t.hostURL.slice(0,-1);sessionStorage.setItem("hostURL",t.hostURL)}async function Th(e,t,n){const o=Kt(Ir);const i="13px";const s="5px 10px";const r="7px 10px";document.documentElement.clientWidth;const a=e.holder.append("div").style("white-space","nowrap").style("border-bottom","solid 1px rgba("+o.r+","+o.g+","+o.b+",.3)");const l=a.append("div").style("margin","10px").style("padding","8px").style("padding-bottom","12px").style("display","inline-block").style("border-bottom","");const c=a.append("div").style("display","inline-block").style("padding",r).style("padding-left","25px").style("font-size",".8em").style("color",Kt(Ir).darker());{const e=c.append("div").style("padding-left","15px");e.append("span").text("Code updated: "+(t.codedate||"??")+", server launched: "+(t.launchdate||"??")+".");if(t.hasblat){e.append("a").style("margin-left","10px").text("Running BLAT").on("click",(async e=>{Oh.clear().showunder(e.target);const t=Oh.d.append("div").style("margin","10px");const n=t.append("div").text("Loading...");try{const e=await Pl("blat?serverstat=1");if(e.error)throw e.error;if(!e.lst)throw"invalid response";n.remove();for(const n of e.lst){t.append("div").text(n)}}catch(e){n.text(e.message||e);if(e.stack)console.log(e.stack)}}))}}if(t.headermessage){c.append("div").html(t.headermessage)}l.append("div").text("ProteinPaint").style("display","inline-block").style("padding",i).style("color",Ir).style("font-size","1.3em").style("font-weight","bold");const d=new ec({border:"",padding:"0px"});const f=async()=>{const t=ot("input").property("value").trim();const o=[{title:"Genes",default:true,items:await Ch(t,e.selectgenome.property("value"),n),callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});d.hide();Eh(t,e,e.selectgenome.property("value"),n)}}];await Nh(e,t,o,d);o.push({title:"Help",items:m.filter((e=>e.label.toLowerCase().includes(t.toLowerCase()))),color:"#faebd9",callback:e=>{window.open(e.link,e.label)}});return o};const p=new jh({holder:l,tip:d,style:{padding:r,border:`'solid 1px ${Ir}`},size:32,placeholder:"Gene, position, SNP, app, or dataset",title:"Search by gene, SNP, position, app, or dataset",searchItems:f});p.initUI();const u=l.append("div").attr("class","sjpp-genome-select-div").style("padding",r);const h=()=>{const t=e.genomes[e.selectgenome.property("value")];const n=["Gene","position","app"];if(t.hasSNP)n.splice(2,0,"SNP");if(Object.keys(t.datasets).length)n.push("dataset");const o=n.join(", ").replace(/,(?=[^,]*$)/,", or");return o};e.selectgenome=u.append("select").attr("title","Select a genome").attr("class","sjpp-genome-select").style("padding",s).style("border","solid 1px "+Ir).on("change",(()=>{Lh(e);p.updatePlaceholder(h())}));for(const t in e.genomes){e.selectgenome.append("option").attr("n",t).text(e.genomes[t].species+" "+t).property("value",t)}e.genome_browser_btn=Rh(e,l,n);e.drawer=await kh({holder:e.holder,genomes:e.genomes,drawerRow:e.holder.append("div").style("position","relative").style("overflow-x","visible").style("overflow-y","hidden").classed("sjpp-drawer-row",true),sandboxDiv:e.holder.append("div").style("margin-top","15px").classed("sjpp-drawer-sandbox",true),genome_browser_btn:e.genome_browser_btn,debugmode:e.debugmode,headbox:l,padw_sm:r,cardsPath:e.cardsPath});const m=[{label:"Embed in your website",link:"https://docs.google.com/document/d/1KNx4pVCKd4wgoHI4pjknBRTLrzYp6AL_D-j6MjcQSvQ/edit?usp=sharing"},{label:"URL parameters",link:"https://github.com/stjude/proteinpaint/wiki/URL-parameters"},{label:"All tutorials",link:"https://github.com/stjude/proteinpaint/wiki/"},{label:"User community",link:"https://groups.google.com/g/proteinpaint"},{label:"License ProteinPaint",link:"https://www.stjude.org/research/why-st-jude/shared-resources/technology-licensing/technologies/proteinpaint-web-application-for-visualizing-genomic-data-sj-15-0021.html",onlySearch:true},{label:"Our Team",link:"https://proteinpaint.stjude.org/team/",onlySearch:true}];l.append("span").classed("sja_menuoption",true).style("padding",r).text("Help").on("click",(async e=>{const t=e.target.getBoundingClientRect();const n=Oh.clear().show(t.left-0,t.top+t.height+5);await n.d.append("div").style("padding","5px 20px").selectAll("p").data(m.filter((e=>!e.onlySearch))).enter().append("p").html((e=>`<a href=${e.link} target=_blank>${e.label}</a>`))}))}function Rh(e,t,n){const o="8px";const i=t.append("span");const s=e.selectgenome.node().options[e.selectgenome.property("selectedIndex")].value;const r=i.attr("class","sja_menuoption").attr("id","genome_btn").style("padding",o).datum(s).text(s+" genome browser").on("click",((t,o)=>{const i=e.genomes[o];if(!i){alert("Invalid genome name: "+o);return}const s=Qd(e.drawer.opts.sandboxDiv);s.header.text(o+" genome browser");const r={hostURL:e.hostURL,jwt:n,holder:s.body,genome:i,chr:i.defaultcoord.chr,start:i.defaultcoord.start,stop:i.defaultcoord.stop,nobox:true,tklst:[],debugmode:e.debugmode};tc(i,r.tklst);import("./block-ec76524e.js").then((function(e){return e.c})).then((e=>new e.Block(r)));e.drawer.dispatch({type:"is_apps_btn_active",value:false})}));return r}function Lh(e){e.genome_browser_btn.text(e.selectgenome.node().value+" genome browser");e.genome_browser_btn.datum(e.selectgenome.node().value)}async function $h(e,t){if(e.genome&&t.selectgenome){for(let n=0;n<t.selectgenome.node().childNodes.length;n++){if(t.selectgenome.node().childNodes[n].value==e.genome){t.selectgenome.property("selectedIndex",n);break}}}if(e.mclassOverride){if(!e.mclassOverride.mclassName)e.mclassOverride.mclassName="Class";for(const t in e.mclassOverride.classes){const n=Yr[t];if(n){Object.assign(n,e.mclassOverride.classes[t])}}}if(e.singlecell){om(e.singlecell,t);return t}if(e.fimo){Uh(e.fimo,t);return t}if(e.mdssurvivalplot){if(e.genome)e.mdssurvivalplot.genome=e.genome;Dh(e.mdssurvivalplot,t);return t}if(e.mdssamplescatterplot){if(e.genome)e.mdssamplescatterplot.genome=e.genome;Ph(e.mdssamplescatterplot,t);return t}if(e.samplematrix){e.samplematrix.jwt=e.jwt;Fh(e.samplematrix,t);return t}if(e.hic){e.hic.jwt=e.jwt;Bh(e.hic,t);return t}if(e.block){return Hh(e,t)}if(e.study){Fd(t.genomes,e.study,t.holder0,t.hostURL,e.jwt,false,t);return t}if(e.studyview){const n=e.studyview;n.hostURL=e.host;const o=n.genome||e.genome;n.genome=t.genomes[o];n.hostURL=t.hostURL;n.jwt=e.jwt;n.holder=t.holder0;of(n);return t}if(await zh(e,t)){return t}if(e.fusioneditor){Gh(e,t);return t}if(e.genefusion){rm(e,t);return t}if(e.mavolcanoplot){Qh(e,t);return t}if(e.twodmaf){em(e,t);return t}if(e.junctionbymatrix){nm(e,t);return}if(e.mdsjsonform){await Jh(e,t);return}if(e.selectGenomeWithTklst){await Vh(e,t);return}if(e.disco){return await dm(e,t)}if(e.geneSearch4GDCmds3){return await Wh(e,t)}if(e.launchGdcMatrix){return await Xh(e,t)}if(e.launchGdcHierCluster){return await Yh(e,t)}if(e.launchGdcMaf){return await Zh(e,t)}if(e.parseurl&&location.search.length){try{await Rf({app:t,genomes:t.genomes,hostURL:t.hostURL,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,holder:t.holder,selectgenome:t.selectgenome,genome_browser_btn:t.genome_browser_btn,debugmode:t.debugmode})}catch(e){t.error0(e);console.error(e.stack||e)}}if(e.project){let n=undefined;if(e.project.uionly)n=t.holder0;ef(0,0,t.genomes,t.hostURL,n,t.sandbox_header)}if(e.termdb){await sm(e.termdb,t)}if(e.maftimeline){tm(e,t)}if(e.gdcbamslice){return await Kh(e,t)}if(e.mass){return await lm(e,t)}if(e.tkui){im(e,t)}if(e.massSessionId){const n=await Bl(`/massSession?id=${e.massSessionId}`);if(n.error)throw n.error;const o={holder:t.holder0,state:n.state,genome:t.genomes[n.state.vocab.genome],massSessionDuration:n.massSessionDuration,getDatasetAccessToken:e.getDatasetAccessToken,addLoginCallback:e.addLoginCallback};const i=await import("./app-de19f41c.js");i.appInit(o);return}if(e.massSessionFile||e.massSessionURL){let n;if(e.massSessionFile){const t=e.massSessionFile;const o=await Bl(`/textfile`,{method:"POST",body:JSON.stringify({file:t})});if(o.error)throw o.error;n=JSON.parse(o.text)}else{const t=e.massSessionURL;const o=await Bl(`/urltextfile`,{method:"POST",body:JSON.stringify({url:t})});if(o.error)throw o.error;n=JSON.parse(o.text)}const o={holder:t.holder0,state:n,genome:t.genomes[n.vocab.genome]};const i=await import("./app-de19f41c.js");i.appInit(o);return}if(e.profileHome){const t=await import("./profileHome-a555583d.js");t.init(e);return}}async function zh(e,t){if(e.p){e.gene=e.p;delete e.p}if(e.gene2canonicalisoform){if(!e.genome)throw".genome missing for gene2canonicalisoform";const t=await Pl("gene2canonicalisoform?genome="+e.genome+"&gene="+e.gene2canonicalisoform);if(t.error)throw t.error;if(!t.isoform)throw"no canonical isoform for given gene accession";e.gene=t.isoform}if(e.mds3_ssm2canonicalisoform){if(!e.genome)throw".genome missing";if(!e.mds3_ssm2canonicalisoform.ssm_id)throw".ssm_id missing from mds3_ssm2canonicalisoform";if(!e.mds3_ssm2canonicalisoform.dslabel)throw".dslabel missing from mds3_ssm2canonicalisoform";const t=await Pl("mds3?"+"genome="+e.genome+"&dslabel="+e.mds3_ssm2canonicalisoform.dslabel+"&ssm2canonicalisoform=1"+"&ssm_id="+e.mds3_ssm2canonicalisoform.ssm_id);if(t.error)throw t.error;if(!t.isoform)throw"no isoform found for given ssm_id";e.gene=t.isoform;if(e.tracks){const t=e.tracks.find((t=>t.dslabel==e.mds3_ssm2canonicalisoform.dslabel));if(t){t.hlssmid=e.mds3_ssm2canonicalisoform.ssm_id}}}if(e.gene){qh(e,t);return true}return false}async function Ph(e,t){if(!e.genome){t.error0("missing genome for mdssamplescatterplot");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for mdssamplescatterplot");return}e.genome=n;if(e.dataset){e.mds=n.datasets[e.dataset];if(!e.mds){t.error0("invalid dataset for mdssamplescatterplot");return}e.dslabel=e.dataset;delete e.dataset;if(e.mds.mdsIsUninitiated){const t=await Bl(`getDataset?genome=${e.genome.name}&dsname=${e.dslabel}`);if(t.error)throw t.error;if(!t.ds)throw"ds missing";Object.assign(e.mds,t.ds);delete e.mds.mdsIsUninitiated}}else if(e.analysisdata);else if(e.analysisdata_file){try{const t=await Ll("textfile",{file:e.analysisdata_file});if(t.error)throw tmp.error;else if(t.text)e.analysisdata=JSON.parse(t.text)}catch(e){t.error0(e);return}}else{t.error0("neither .dataset or .analysisdata is given");return}import("./mds.samplescatterplot-362f3591.js").then((n=>{n.init(e,t.holder0,t.debugmode)}))}function Dh(e,t){if(!e.genome){t.error0("missing genome for mdssurvivalplot");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for mdssurvivalplot");return}e.genome=n;if(!e.dataset){t.error0("missing dataset for mdssurvivalplot");return}e.mds=n.datasets[e.dataset];if(!e.mds){t.error0("invalid dataset for mdssurvivalplot");return}delete e.dataset;if(e.plotlist){for(const t of e.plotlist){t.renderplot=1}}import("./mds.survivalplot-f5bda05a.js").then((n=>{n.init(e,t.holder0,t.debugmode)}))}function Uh(e,t){if(!e.genome){t.error0("missing genome for fimo");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for fimo");return}e.genome=n;e.div=t.holder0;import("./mds.fimo-68f0eaf5.js").then((t=>{t.init(e)}))}function Bh(e,t){if(!e.genome){t.error0("missing genome for hic");return}e.genome=t.genomes[e.genome];if(!e.genome){t.error0("invalid genome for hic");return}if(!e.file){t.error0("missing file for hic");return}e.hostURL=t.hostURL;e.holder=t.holder0;import("./HicApp-bcf8330c.js").then((async n=>{await n.hicInit(e,t.debugmode)}))}function Fh(e,t){if(!e.genome){t.error0("missing genome for launching samplematrix");return}e.genome=t.genomes[e.genome];if(!e.genome){t.error0("invalid genome for samplematrix");return}e.hostURL=t.hostURL;e.holder=t.holder0;e.debugmode=t.debugmode;import("./samplematrix-7aa0a780.js").then((t=>{new t.Samplematrix(e)}))}async function qh(e,t){if(!e.genome){t.error0("Cannot embed: must specify reference genome");return}if(e.tracks){for(const t of e.tracks){if(t.type=="mds3"&&t.dslabel)continue;t.iscustom=true}}if(e.tkjsonfile){if(!e.tracks)e.tracks=[];const t=new Map([["tkjsonfile",e.tkjsonfile]]);const n=await $f(t,genomeobj);for(const t of n){e.tracks.push(t)}}const n={jwt:e.jwt,hostURL:t.hostURL,query:e.gene,genome:t.genomes[e.genome],holder:t.holder0,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,debugmode:t.debugmode,datasetqueries:e.datasetqueries,mset:e.mset,tklst:e.tracks,gmmode:e.gmmode,mclassOverride:e.mclassOverride,hide_dsHandles:e.hide_dsHandles,onloadalltk_always:e.onloadalltk_always};if(e.dataset){n.dataset=e.dataset.split(",");n.legacyDsFilter=e.legacyDsFilter;if(e.hidedatasetexpression){n.hidedatasetexpression=true}}if(e.hidegenecontrol){n.hidegenecontrol=true}if(e.hidegenelegend){n.hidegenelegend=true}let o=null;if(e.hlaachange){o=new Map;if(Array.isArray(e.hlaachange)){for(const t of e.hlaachange){if(t.name){o.set(t.name,t)}}}else{for(const t of e.hlaachange.split(",")){o.set(t,false)}}if(o.size){n.hlaachange=o}}if(e.hlvariants){n.hlvariants=e.hlvariants}await yf(n)}async function Hh(e,t){if(!e.genome){t.error0("Cannot embed: must specify reference genome");return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}if(e.study){Fd(t.genomes,e.study,t.holder0,t.hostURL,e.jwt,true,t)}if(e.studyview);if(e.tracks){for(const n of e.tracks){if(n.type==mc.mds3&&n.dslabel)continue;if(n.mdsjsonfile||n.mdsjsonurl){try{const t=await jf(n.mdsjsonfile,n.mdsjsonurl);e.tracks=e.tracks.filter((e=>e!=n));e.tracks.push(...t)}catch(e){hf(t.holder0,e)}}n.iscustom=true}}if(e.tkjsonfile){if(!e.tracks)e.tracks=[];const t=new Map([["tkjsonfile",e.tkjsonfile]]);const o=await $f(t,n);for(const t of o){e.tracks.push(t)}}const o={genome:n,hostURL:t.hostURL,jwt:e.jwt,holder:t.holder0,nativetracks:e.nativetracks,tklst:e.tracks,debugmode:t.debugmode,legendimg:e.legendimg};if(e.width){const n=Number.parseInt(e.width);if(Number.isNaN(n))return t.error0("browser width must be integer");o.width=n}if(e.subpanels){if(!Array.isArray(e.subpanels))return t.error0("subpanels is not array");const n=[];for(const o of e.subpanels){if(!o.chr){t.error0("missing chr in one subpanel");continue}if(!o.start||!o.stop){t.error0("missing start or stop in one subpanel");continue}if(!o.width){o.width=400}if(!o.leftpad){o.leftpad=5}n.push(o)}if(n.length){o.subpanels=n}}if(e.nobox){o.nobox=true}else{o.dogtag=e.dogtag||e.genome}if(e.chr&&Number.isInteger(e.start)){o.chr=e.chr;o.start=e.start;o.stop=Number.isInteger(e.stop)?e.stop:e.start+1}else if(e.position){const t=Ld(e.position,n);if(t){o.chr=t.chr;o.start=t.start;o.stop=t.stop}}else if(e.positionbygene){try{const t=await od(e.genome,e.positionbygene);if(t&&t[0]){const e=t[0];o.chr=e.chr;o.start=e.start;o.stop=e.stop}}catch(e){t.error0(e)}}if(!o.chr){o.chr=n.defaultcoord.chr;o.start=n.defaultcoord.start;o.stop=n.defaultcoord.stop}if(e.datasetqueries){o.datasetqueries=e.datasetqueries}if(e.hlregions){const t=[];for(const o of e.hlregions){const e=Ld(o,n,true);if(e)t.push(e)}if(t.length)o.hlregions=t}const i=If();if(i){if(i.has("position")){const e=Ld(i.get("position"),n);if(e){o.chr=e.chr;o.start=e.start;o.stop=e.stop}}if(i.has("hlregion")){const e=[];for(const t of i.get("hlregion").split(",")){const o=Ld(t,n,true);if(o){e.push(o)}}if(e.length){o.hlregions=e}}if(i.has("bedgraphdotfile")){if(!o.tklst)o.tklst=[];const e=i.get("bedgraphdotfile").split(",");for(let t=0;t<e.length;t+=2){if(e[t]&&e[t+1]){o.tklst.push({type:mc.bedgraphdot,name:e[t],file:e[t+1]})}}}}return import("./block-ec76524e.js").then((function(e){return e.c})).then((e=>{t.block=new e.Block(o);return t}))}function Gh(e,t){if(e.fusioneditor.uionly){const[n,o,i,s,r]=Xd(t.holder0,t.genomes);import("./svmr-3dd531ef.js").then((a=>{a.svmrui([null,n,o,i,s,r],t.genomes,t.hostURL,e.jwt)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}import("./svmr-3dd531ef.js").then((o=>{o.svmrparseinput(e.fusioneditor,t.error0,n,t.holder0,t.hostURL,e.jwt)}))}async function Jh(e,t){if(e.mdsjsonform.uionly){const e=await import("./mdsjsonform-7f0b6cc7.js");await e.init_mdsjsonform({holder:t.holder0,genomes:t.genomes})}}async function Vh(e,t){const n=await import("./selectGenomeWithTklst-51cd21a4.js");await n.init(e,t.holder0,t.genomes)}async function Wh(e,t){const n=await import("./lollipop-59f65024.js");return await n.init(e,t.holder0,t.genomes)}async function Xh(e,t){const n=await import("./oncomatrix-cd9fa01b.js");return await n.init(e,t.holder0,t.genomes)}async function Yh(e,t){const n=await import("./geneExpClustering-96d09008.js");return await n.init(e,t.holder0,t.genomes)}async function Zh(e,t){const n=await import("./maf-72e5b7da.js");return await n.gdcMAFui({holder:t.holder0,filter0:e.filter0,callbacks:e.callbacks||{},debugmode:e.debugmode})}function Kh(e,t){return import("./bam-95f36008.js").then((n=>n.bamsliceui({genomes:t.genomes,holder:t.holder0,hideTokenInput:e.gdcbamslice.hideTokenInput,callbacks:e.gdcbamslice.callbacks||{},filter0:e.filter0,stream2download:e.gdcbamslice.stream2download,inputValue:e.gdcbamslice.inputValue})))}function Qh(e,t){if(e.mavolcanoplot.uionly){import("./mavb-37fffd68.js").then((n=>{n.mavbui(t.genomes,t.hostURL,e.jwt,t.holder0,t.sandbox_header)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}e.mavolcanoplot.hostURL=t.hostURL;e.mavolcanoplot.genome=n;import("./mavb-37fffd68.js").then((n=>{n.mavbparseinput(e.mavolcanoplot,t.error0,t.holder0,e.jwt)}))}function em(e,t){if(e.twodmaf.uionly){import("./2dmaf-70c0b6bb.js").then((e=>{e.d2mafui(t.genomes,t.holder0)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}e.twodmaf.hostURL=t.hostURL;e.twodmaf.genome=n;import("./2dmaf-70c0b6bb.js").then((n=>{n.d2mafparseinput(e.twodmaf,t.holder0)}))}function tm(e,t){if(e.maftimeline.uionly){import("./maftimeline-ed8aaae8.js").then((e=>{e.default(t.genomes,t.holder0,t.sandbox_header)}))}}function nm(e,t){if(e.junctionbymatrix.uionly){import("./block.tk.junction.textmatrixui-6ec019e1.js").then((n=>{n.default(t.genomes,t.hostURL,e.jwt,t.holder0)}))}}async function om(e,t){try{const n=t.genomes[e.genome];if(!n)throw"Invalid genome: "+e.genome;e.genome=n;const o=await import("./singlecell-a668bb17.js");await o.init(e,t.holder0)}catch(e){t.error0("Error launching single cell viewer: "+e);if(e.stack)console.log(e.stack)}}async function im(e,t){if(e.tkui=="bigwig"){const e=await import("./block.tk.bigwig.ui-0c96dce5.js");e.bigwigUI(t.genomes,t.holder)}if(e.tkui=="databrowser"){const e=await import("./databrowser.ui-c50862e4.js");e.init_databrowserUI(t.holder,t.debugmode)}if(e.tkui=="genefusion"){const e=await import("./genefusion.ui-3e2a3a73.js");e.init_geneFusionUI(t.holder,t.genomes,t.debugmode)}if(e.tkui=="disco"){const e=await import("./Disco.UI-a38a12e6.js");e.init_discoplotUI(t.holder,t.genomes,t.debugmode)}}async function sm(e,t){if(!e.holder)e.holder=t.holder0;import("./app-bfce9bf5.js").then((t=>{t.appInit(e)}))}async function rm(e,t){try{const n=t.genomes[e.genome];if(!n)throw"Invalid genome: "+e.genome;const o=await import("./fusion.parse-ae1253f4.js");const i=await o.parseFusion({line:e.genefusion.text,genome:n,positionType:e.genefusion.positionType});await am(i.pairlst[0].a,n);await am(i.pairlst[0].b,n);const s=await import("./svgraph-3c5cd8d2.js");s.default({pairlst:i.pairlst,genome:n,holder:t.holder})}catch(e){t.error0(e)}}async function am(e,t){const n=await Bl("genelookup",{body:{genome:t.name,input:e.isoform,deep:1}});if(n.error)throw n.error;if(!Array.isArray(n.gmlst))throw"gmlst not array";const o=n.gmlst.find((t=>t.isoform==e.isoform));if(!o)throw"no match to isoform";e.chr=o.chr;e.name=o.name;e.gm={isoform:o.isoform}}async function lm(e,t){const n=e.mass;if(!n.holder)n.holder=t.holder0;if(n.state){if(n.state.genome){n.genome=t.genomes[n.state.genome]}else if(n.state?.vocab?.genome){n.genome=t.genomes[n.state.vocab.genome]}}n.getDatasetAccessToken=e.getDatasetAccessToken;n.addLoginCallback=e.addLoginCallback;const o=sessionStorage.getItem("hostURL");if(window.opener&&o!=window.location.origin){n.embeddedSessionState=JSON.parse(sessionStorage.getItem("embeddedSessionState")||`{}`);const e=t=>{if(t.origin!=window.location.origin&&t.origin!==o)return;if(t.data.state){window.removeEventListener("message",e);Object.assign(n.embeddedSessionState,t.data.state);sessionStorage.setItem("embeddedSessionState",JSON.stringify(n.embeddedSessionState))}};window.addEventListener("message",e,false);setTimeout((()=>window.removeEventListener("message",e)),1e3);let t;try{if(window.opener.origin){t=window.opener.origin}else{t=o}}catch(e){t=o}try{window.opener.postMessage("getActiveMassSession",t)}catch(e){console.log(e)}}const i=await import("./app-de19f41c.js");return await i.appInit(n)}function cm(e){e.tkset=[];e.isoformcache=new Map;e.junctionframecache=new Map;e.isoformmatch=(t,n,o)=>{if(!t)return null;const i=t.toUpperCase();if(!e.isoformcache.has(i))return null;const s=e.isoformcache.get(i);if(s.length==1)return s[0];if(!n){console.log("no chr provided for matching with "+i);return s[0]}let r=null;for(const e of s){if(e.chr.toUpperCase()==n.toUpperCase()&&e.start<=o&&e.stop>=o){r=e}}if(r)return r;for(const e of s){if(e.chr.toUpperCase()==n.toUpperCase())return e}return null};e.chrlookup={};for(const t in e.majorchr){e.chrlookup[t.toUpperCase()]={name:t,len:e.majorchr[t],major:true}}if(e.minorchr){for(const t in e.minorchr){e.chrlookup[t.toUpperCase()]={name:t,len:e.minorchr[t]}}}if(!e.tracks){e.tracks=[]}for(const t of e.tracks){t.tkid=Math.random().toString()}for(const t in e.datasets){const n=e.datasets[t];if(n.isMds);else if(n.isMds3){if(!n.label)return"ds.label missing"}}return null}async function dm(e,t){if(!e.genome)throw'"genome" parameter missing';const n=t.genomes[e.genome];if(!n)throw"unknown genome";const o=await import("./launch.adhoc-9c59874e.js");return await o.launch(e.disco,n,t.holder0)}export{it as $,Ed as A,ic as B,mc as C,Pa as D,Yr as E,Hr as F,Jr as G,Gr as H,qr as I,Dr as J,Fr as K,Pr as L,ec as M,Rc as N,Xr as O,Rd as P,uf as Q,pf as R,Bl as S,Ir as T,Md as U,qc as V,uc as W,Ld as X,Yc as Y,bf as Z,oc as _,_c as a,Ri as a$,kc as a0,Qd as a1,Na as a2,yf as a3,Ec as a4,Rr as a5,Nc as a6,Ac as a7,Cc as a8,Ma as a9,ll as aA,al as aB,Df as aC,Wf as aD,ma as aE,Za as aF,cl as aG,Al as aH,Cl as aI,Ur as aJ,Wr as aK,Yl as aL,mf as aM,Mf as aN,Of as aO,Tf as aP,ul as aQ,Xf as aR,jl as aS,Lr as aT,Ic as aU,Wd as aV,Mr as aW,xl as aX,hl as aY,Wo as aZ,Xn as a_,Sc as aa,Oc as ab,hf as ac,Uc as ad,td as ae,Br as af,Vc as ag,Wc as ah,Da as ai,lc as aj,ac as ak,Ha as al,At as am,Nr as an,va as ao,zd as ap,dd as aq,qa as ar,Fa as as,ba as at,ha as au,fa as av,pa as aw,ua as ax,oa as ay,dl as az,Ta as b,tl as b$,yo as b0,bo as b1,jt as b2,xt as b3,So as b4,Or as b5,Kc as b6,Ud as b7,tc as b8,gf as b9,od as bA,jr as bB,bc as bC,fc as bD,ui as bE,aa as bF,ca as bG,la as bH,ta as bI,na as bJ,Tc as bK,id as bL,tf as bM,nf as bN,Bc as bO,Ln as bP,$r as bQ,$a as bR,zr as bS,Lc as bT,Qc as bU,ol as bV,Hc as bW,rr as bX,Ka as bY,Qa as bZ,el as b_,Ua as ba,Sa as bb,Zr as bc,Ba as bd,Vr as be,Qr as bf,ea as bg,ra as bh,cc as bi,dc as bj,pc as bk,Pc as bl,Zc as bm,If as bn,nc as bo,Uf as bp,Xd as bq,Mc as br,at as bs,kt as bt,vo as bu,Go as bv,po as bw,Nt as bx,Yn as by,nd as bz,Ll as c,nl as c0,zn as c1,Mh as c2,kf as c3,Pl as d,Fc as e,Po as f,yc as g,vc as h,$c as i,zc as j,Jc as k,Jo as l,Ia as m,gc as n,xc as o,sc as p,ot as q,Gc as r,e as s,$d as t,jc as u,Tr as v,Pd as w,Kt as x,Ra as y,wr as z};
|
|
1
|
+
function e(e,t){if(t===void 0)t={};var n=t.insertAt;if(!e||typeof document==="undefined"){return}var o=document.head||document.getElementsByTagName("head")[0];var i=document.createElement("style");i.type="text/css";if(n==="top"){if(o.firstChild){o.insertBefore(i,o.firstChild)}else{o.appendChild(i)}}else{o.appendChild(i)}if(i.styleSheet){i.styleSheet.cssText=e}else{i.appendChild(document.createTextNode(e))}}var t='\n/**\n * Render the `main` element consistently in IE.\n */\n\n.sja_root_holder main, .sja_menu_div main, .sja_pane main {\n display: block;\n}\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Firefox, and Safari.\n */\n\n.sja_root_holder h1, .sja_menu_div h1, .sja_pane h1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\n.sja_root_holder hr, .sja_menu_div hr, .sja_pane hr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\n.sja_root_holder pre, .sja_menu_div pre, .sja_pane pre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\n.sja_root_holder a, .sja_menu_div a, .sja_pane a {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\n.sja_root_holder abbr[title], .sja_menu_div abbr[title], .sja_pane abbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\n.sja_root_holder b, .sja_menu_div b, .sja_pane b,\n.sja_root_holder strong, .sja_menu_div strong, .sja_pane strong {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\n.sja_root_holder code, .sja_menu_div code, .sja_pane code,\n.sja_root_holder kbd, .sja_menu_div kbd, .sja_pane kbd,\n.sja_root_holder samp, .sja_menu_div samp, .sja_pane samp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\n.sja_root_holder small, .sja_menu_div small, .sja_pane small {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` elements from affecting the line height in\n * all browsers.\n */\n\n.sja_root_holder sub, .sja_menu_div sub, .sja_pane sub,\n.sja_root_holder sup, .sja_menu_div sup, .sja_pane sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\n.sja_root_holder sub, .sja_menu_div sub, .sja_pane sub {\n bottom: -0.25em;\n}\n\n.sja_root_holder sup, .sja_menu_div sup, .sja_pane sup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\n.sja_root_holder img, .sja_menu_div img, .sja_pane img {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder input, .sja_menu_div input, .sja_pane input,\n.sja_root_holder optgroup, .sja_menu_div optgroup, .sja_pane optgroup,\n.sja_root_holder select, .sja_menu_div select, .sja_pane select,\n.sja_root_holder textarea, .sja_menu_div textarea, .sja_pane textarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder input /* 1 */, .sja_menu_div input /* 1 */, .sja_pane input /* 1 */ {\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder select /* 1 */, .sja_menu_div select /* 1 */, .sja_pane select /* 1 */ {\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\n.sja_root_holder button, .sja_menu_div button, .sja_pane button,\n.sja_root_holder [type="button"], .sja_menu_div [type="button"], .sja_pane [type="button"],\n.sja_root_holder [type="reset"], .sja_menu_div [type="reset"], .sja_pane [type="reset"],\n.sja_root_holder [type="submit"], .sja_menu_div [type="submit"], .sja_pane [type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\n.sja_root_holder button::-moz-focus-inner, .sja_menu_div button::-moz-focus-inner, .sja_pane button::-moz-focus-inner,\n.sja_root_holder [type="button"]::-moz-focus-inner, .sja_menu_div [type="button"]::-moz-focus-inner, .sja_pane [type="button"]::-moz-focus-inner,\n.sja_root_holder [type="reset"]::-moz-focus-inner, .sja_menu_div [type="reset"]::-moz-focus-inner, .sja_pane [type="reset"]::-moz-focus-inner,\n.sja_root_holder [type="submit"]::-moz-focus-inner, .sja_menu_div [type="submit"]::-moz-focus-inner, .sja_pane [type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\n.sja_root_holder button:-moz-focusring, .sja_menu_div button:-moz-focusring, .sja_pane button:-moz-focusring,\n.sja_root_holder [type="button"]:-moz-focusring, .sja_menu_div [type="button"]:-moz-focusring, .sja_pane [type="button"]:-moz-focusring,\n.sja_root_holder [type="reset"]:-moz-focusring, .sja_menu_div [type="reset"]:-moz-focusring, .sja_pane [type="reset"]:-moz-focusring,\n.sja_root_holder [type="submit"]:-moz-focusring, .sja_menu_div [type="submit"]:-moz-focusring, .sja_pane [type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\n.sja_root_holder fieldset, .sja_menu_div fieldset, .sja_pane fieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n\n.sja_root_holder legend, .sja_menu_div legend, .sja_pane legend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\n.sja_root_holder progress, .sja_menu_div progress, .sja_pane progress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\n.sja_root_holder textarea, .sja_menu_div textarea, .sja_pane textarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n.sja_root_holder [type="checkbox"], .sja_menu_div [type="checkbox"], .sja_pane [type="checkbox"],\n.sja_root_holder [type="radio"], .sja_menu_div [type="radio"], .sja_pane [type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n.sja_root_holder [type="number"]::-webkit-inner-spin-button, .sja_menu_div [type="number"]::-webkit-inner-spin-button, .sja_pane [type="number"]::-webkit-inner-spin-button,\n.sja_root_holder [type="number"]::-webkit-outer-spin-button, .sja_menu_div [type="number"]::-webkit-outer-spin-button, .sja_pane [type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n.sja_root_holder [type="search"], .sja_menu_div [type="search"], .sja_pane [type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n.sja_root_holder [type="search"]::-webkit-search-decoration, .sja_menu_div [type="search"]::-webkit-search-decoration, .sja_pane [type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n.sja_root_holder ::-webkit-file-upload-button, .sja_menu_div ::-webkit-file-upload-button, .sja_pane ::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\n.sja_root_holder details, .sja_menu_div details, .sja_pane details {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\n.sja_root_holder summary, .sja_menu_div summary, .sja_pane summary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\n.sja_root_holder template, .sja_menu_div template, .sja_pane template {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n.sja_root_holder [hidden], .sja_menu_div [hidden], .sja_pane [hidden] {\n display: none;\n}';e(t);var n="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}";e(n);var o="/*\n see client/generateScopedCss.js on how to generate style-normalize-*.css\n\n also see a TODO comment in client/src/app.js, of dynamically importing\n style-normalize-unscoped.css only if it's known to not conflict in\n the embedder portal\n*/\n/* directly import these in src/app.js so that they will be processed as CSSStyleSheet\n@import './style-normalize-scoped.css';\n@import 'highlight.js/styles/github.css';\n*/\n/*\nhtml {\n height:100%;\n}\nbody {\n min-height:100%;\n}\ntable {\n font-size:1em;\n border-spacing:1px;\n border-collapse:separate;\n}\n*/\n/*\n !!! NOTE !!!\n FireFox does not support the @scope (selector) syntax\n that can enclose all affected rules inside a nested block,\n so for now, will need to prepend the .sja_root_holder scope for each selector\n*/\n/***************************************\nCSS properties that are not covered \nby normalize.css are covered here\n\n!!! make sure to scope to sja_root_holder\n****************************************/\n.sja_root_holder h2 {\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n}\n/***************************************\n tag-based styles\n\n prevent embedder styles from overriding\n the styles within pp-controlled divs\n****************************************/\n/* use default browser styles within pp-controlled divs */\n/* using the !important flag:\n- this flag is used to override conflicting styles\n- this flag will override both embedder styling and inline styling\n- it is not necessary to use this flag to prevent embedder styles from overriding pp styles, because specifying styles within pp-specific classes will usually prevent this issue\n- the only time when it is necessary to use this flag is when (1) the conflicting styling also has an !important flag or (2) the conflicting styling is also specified in this same file\n*/\n.sja_root_holder {\n /*background-color: #fff;*/\n}\n.sja_root_holder,\n.sja_menu_div,\n.sja_pane {\n all: initial;\n /* block inheritance for all properties */\n}\n.sja_root_holder table,\n.sja_menu_div table,\n.sja_pane table {\n border-collapse: separate;\n border-spacing: 2px;\n}\n.sja_root_holder svg {\n display: inline-block;\n}\n/*\n override the thicker button border\n that results when a button's \n border-radius: 0 which seems to override\n all associated styles of \n -webkit-appearance: button;\n*/\n.sja_root_holder button,\n.sja_menu_div button,\n.sja_pane button {\n padding: 2px 3px;\n border-width: 1px;\n border-style: solid;\n border-radius: 3px;\n box-shadow: inset 0 0 0 99999px rgba(255, 255, 255, 0.3);\n font-family: Arial;\n color: black;\n background-color: buttonface;\n border-color: buttonborder;\n}\n.sja_root_holder button:disabled,\n.sja_menu_div button:disabled,\n.sja_pane button:disabled {\n background-color: rgba(239, 239, 239, 0.3);\n color: rgba(16, 16, 16, 0.3);\n border-color: rgba(118, 118, 118, 0.3);\n}\n.sja_root_holder button:hover,\n.sja_menu_div button:hover,\n.sja_pane button:hover {\n box-shadow: none;\n}\n.sja_root_holder label,\n.sja_menu_div label,\n.sja_pane label {\n margin-bottom: 0;\n}\n.sja_root_holder a,\n.sja_menu_div a,\n.sja_pane a,\n.linkText {\n color: rgb(0, 0, 238);\n cursor: pointer;\n text-decoration: underline;\n}\n.sja_root_holder input,\n.sja_menu_div input,\n.sja_pane input {\n padding: 1px 3px;\n margin: 2px 5px;\n border: 1px solid #ccc;\n}\n.sja_root_holder select,\n.sja_menu_div select,\n.sja_pane select {\n padding: 1px 3px;\n padding-right: 30px; /* padding between text and arrow */\n background-size: auto;\n background-position: right;\n border: 1px solid #ccc;\n}\n.sja_root_holder textarea,\n.sja_menu_div textarea,\n.sja_pane textarea {\n padding: 2px;\n}\n.sja_root_holder input[type=\"search\"].tree_search {\n -webkit-appearance: searchfield;\n}\n.sja_root_holder ul {\n display: block;\n list-style-type: disc;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: 40px;\n}\n.sja_root_holder ul ul {\n list-style-type: circle;\n}\n.sja_root_holder li {\n display: list-item;\n text-align: -webkit-match-parent;\n}\n/*************************\n class-specific styles\n*************************/\n.sja_errorbar {\n position: relative;\n padding: 5px 50px 5px 10px;\n background-color: rgba(200, 0, 0, .1);\n color: rgba(190, 0, 0, .5);\n border: solid 1px rgba(200, 0, 0, .2);\n /*border-width: 1px 0px;*/\n}\n.sja_errorbar>:nth-child(2) {\n position: absolute;\n padding: 5px 10px;\n cursor: default;\n top: 0px;\n right: 10px;\n}\n.sja_inset_a {\n background-color: #ebedeb;\n box-shadow: inset 0px 0px 14px 0px #858585;\n padding: 5px 10px;\n}\n.sja_menu,\n.sja_menu_persist,\n.sja_tooltip {\n position: absolute;\n background-color: white;\n font-family: Arial;\n z-index: 1000;\n}\n/* /client/src/app.js start */\n.sja_menuoption {\n color: black;\n padding: 5px 10px;\n cursor: default;\n background-color: #f2f2f2;\n margin: 1px;\n border-radius: 5px;\n}\n.sja_menuoption_not_interactive {\n padding: 5px 10px;\n cursor: default;\n margin: 1px;\n}\n.sja_sharp_border {\n border-radius: 0px;\n}\n.sja_menuoption:hover {\n background-color: #e6e6e6\n}\n.sja_menuoption:active {\n color: #cc0000;\n background-color: #FCE2E1;\n}\n/* /client/src/app.js end */\n.sja_filter_tag_btn {\n display: inline-block;\n color: black;\n padding: 5px 8px;\n background-color: #cfe2f3;\n cursor: default;\n}\n/* .sja_filter_tag_btn:hover { opacity: 0.8; cursor:default} */\n.sja_filter_tag_btn:active {\n color: #cc0000;\n opacity: 0.6;\n}\n.ts_pill:hover,\n.tvs_pill:hover {\n opacity: 0.8;\n cursor: default\n}\n.sjpp_apply_btn {\n background-color: #d0e0e3;\n border-radius: 13px !important; \n padding: 7px 15px !important;\n border: 0px !important;\n}\n.sjpp_delete_btn,\n.remove_btn {\n background-color: #f4cccc;\n}\n.ts_summary_btn {\n background-color: #d9d2e9;\n}\n/* mostly for table tr */\n.sja_clb {\n padding: 5px 10px;\n cursor: default;\n}\n.sja_clb:hover {\n background: #ffff99;\n}\n.sja_clb:active {\n background: #ffcc99;\n}\n.sja_clb_selected {\n padding: 5px 10px;\n cursor: default;\n background: #FAF0C8;\n border-bottom: solid 2px #E3CA64;\n}\n.sja_clb_selected:hover {\n background: #FCE68B\n}\n.sja_clb_selected:active {\n background: #ffcc99\n}\n/* table tr, gray highlight */\n.sja_clb_gray {\n padding: 5px 10px;\n cursor: default;\n}\n.sja_clb_gray:hover {\n background-color: #f1f1f1;\n}\n.sja_clb_gray:active {\n background-color: #ffffcc;\n}\n.sja_hideable_legend {\n cursor: default;\n}\n.sja_hideable_legend:hover {\n background: #ffff99;\n}\n.sja_legend_more_btn {\n padding: 3px;\n text-align: center;\n font-size: 0.7em;\n opacity: 0.5;\n cursor: default;\n}\n.sja_legend_more_btn:hover {\n text-decoration: underline;\n}\n/* text only */\n.sja_clbtext2 {\n cursor: default;\n text-decoration: none;\n}\n.sja_clbtext2:hover {\n text-decoration: underline;\n}\n.sja_clbtext2:active {\n fill: #CC0000;\n color: #CC0000;\n}\n.sja_clbtext {\n cursor: default;\n color: black;\n fill: black;\n border-bottom: solid 1px transparent;\n}\n.sja_clbtext:hover {\n color: #631318;\n fill: #631318;\n border-color: black;\n}\n.sja_clbtext:active {\n color: #CC0000;\n border-color: #cc0000;\n fill: #cc0000;\n}\n.sja_clbtextbold {\n cursor: default;\n color: black;\n fill: black;\n font-weight: normal;\n}\n.sja_clbtextbold:hover {\n color: #631318;\n fill: #631318;\n font-weight: bold;\n}\n.sja_clbtextbold:active {\n color: #CC0000;\n fill: #cc0000;\n font-weight: bold;\n}\n.sja_opaque6 {\n opacity: .6;\n cursor: default;\n}\n.sja_opaque6:hover {\n opacity: .9;\n}\n.sja_opaque8 {\n opacity: .8;\n cursor: default;\n}\n.sja_opaque8:hover {\n opacity: 1;\n}\n.sja_simpletable tr td {\n border-bottom: solid 1px #ededed;\n}\n.sja_mcdot {\n cursor: default;\n border-radius: 8px;\n padding: 1px 2px;\n margin-right: 1px;\n color: white;\n font-size: .8em;\n}\n.sja_variantpagesnv {\n cursor: default;\n display: inline-block;\n border-radius: 3px;\n padding: 3px 10px;\n margin-right: 2px;\n color: white;\n background-color: #0099FF;\n opacity: .6;\n}\n.sja_variantpagesnv:hover {\n opacity: 1;\n}\n.sja_variantpagesnv:active {\n background-color: #3366FF;\n}\n.sja_selectsample {\n cursor: default;\n display: inline-block;\n border-radius: 2px;\n border: solid 1px #545454;\n padding: 3px 10px;\n margin-right: 2px;\n color: #545454;\n background-color: white;\n font-size: .8em;\n}\n.sja_selectsample:hover {\n background-color: #f1f1f1;\n}\n.sja_selectsample:active {\n background-color: #F2E1E3;\n}\n.sja_pane {\n position: absolute;\n /*border:solid 1px #ccc;\n */\n box-shadow: 0px 2px 4px 1px #999;\n background-color: white;\n}\n.sja_pane>:first-child {\n padding-right: 10px;\n cursor: move;\n background-color: #f0f0f0;\n}\n.sja_pane>:nth-child(2) {\n padding: 0px 10px 10px 10px;\n font-family: Arial;\n}\n.sja_cursor_hmove {\n cursor: ew-resize;\n}\n.sja_svgtext {\n cursor: default;\n fill-opacity: .8\n}\n.sja_svgtext2 {\n cursor: default;\n fill: black;\n}\n.sja_svgtext2:hover {\n fill: #B30000\n}\n.sja_clb5 {\n /* tree button */\n cursor: default;\n display: inline-block;\n border: solid 1px #006600;\n color: #006600;\n background-color: white;\n margin-left: 6px;\n padding: 0px 4px;\n font-size: 80%;\n}\n.sja_clb5:hover {\n background-color: #006600;\n color: white;\n}\n.sja_clb5:active {\n background-color: #009900;\n}\n.sja_clb2 {\n color: black;\n font-family: Courier;\n display: inline-block;\n padding: 1px 5px;\n cursor: default;\n}\n.sja_clb2:hover {\n background-color: #ffff99;\n}\n.sja_clb2:active {\n background-color: #ccff99;\n}\n.sja_clbb {\n /* highlight border */\n border: solid 1px transparent;\n cursor: default;\n}\n.sja_clbb:hover {\n border-color: #ccc;\n}\n.sja_clbbox {\n cursor: default;\n padding: 2px 5px;\n color: white;\n font-size: .7em;\n font-weight: normal;\n}\n.sja_clbbox:hover {\n font-weight: bold;\n}\n.sja_tr {\n cursor: default;\n background-color: #f1f1f1;\n}\n.sja_tr:hover {\n background-color: white;\n}\n.sja_tr:active {\n background-color: #ffffcc;\n}\n.sja_tr2 {\n cursor: default;\n}\n.sja_tr2:hover {\n background-color: #ffffcc;\n}\n.sja_tr2:active {\n background-color: #ffff00;\n}\n.sja_aa_disclabel {\n cursor: default;\n}\n.sja_aa_discnum {\n cursor: default;\n text-rendering: geometricPrecision;\n}\n.sja_aa_skkick:hover {\n stroke: #858585;\n}\n.sja_aa_disckick:hover {\n stroke-opacity: 1;\n}\n.sja_menuoption_y {\n display: inline-block;\n color: black;\n padding: 2px 4px;\n cursor: default;\n background-color: #E6E5C5;\n margin: 2px;\n}\n.sja_menuoption_y:hover {\n background-color: #DEDCA9\n}\n.sja_menuoption_y:active {\n background-color: #FFFF99\n}\n.sja_menuoption_r {\n display: inline-block;\n color: black;\n padding: 2px 4px;\n cursor: default;\n background-color: #EDDDDE;\n margin: 2px;\n}\n.sja_menuoption_r:hover {\n background-color: #E8CFD1\n}\n.sja_menuoption_r:active {\n background-color: #FCD9DD\n}\n.sja_error2 {\n display: inline-block;\n padding: 5px 50px 5px 10px;\n margin: 10px 20px;\n background-color: rgba(200, 0, 0, .5);\n color: white;\n border-radius: 6px;\n}\n.sja_paint {\n position: relative;\n}\n.sja_paint>:first-child {}\n.sja_paint>:nth-child(2) {\n position: absolute;\n padding: 3px 6px;\n cursor: default;\n top: 10px;\n right: 30px;\n font-size: 80%;\n}\n.sja_tree_ul {\n list-style-type: none;\n padding-left: 25px;\n line-height: 1.4;\n}\n.sja_input {\n display: inline-block;\n padding: 2px 6px;\n}\n.sja_bulkcell {\n display: inline-block;\n width: 3px;\n height: 9px;\n margin: 1px 1px 0px 0px;\n}\n.sja_tag {\n display: inline-block;\n margin-left: 10px;\n padding: 1px 3px;\n background-color: #858585;\n color: white;\n font-size: 80%;\n}\n.sja_bgbox {\n cursor: default;\n fill: yellow;\n fill-opacity: 0;\n}\n.sja_bgbox:hover {\n fill-opacity: .2;\n}\n.sja_diseasehm_search_item {\n display: inline-block;\n margin: 3px;\n padding: 2px;\n}\n.sja_pulse {\n animation: pulse .5s alternate infinite;\n}\n@keyframes pulse {\n from {\n opacity: .2;\n }\n to {\n opacity: 1;\n }\n}\n.sja_hm-edittool-table td {\n padding: 0 2px;\n cursor: pointer;\n text-align: center;\n font-size: 14px;\n}\n.sja_hm-edittool-table td:hover {\n opacity: 1;\n font-weight: 600;\n}\n.sja_tinylogo_head {\n display: inline-block;\n background-color: #858585;\n color: white;\n font-size: .6em;\n padding: 1px 3px;\n}\n.sja_tinylogo_body {\n display: inline-block;\n margin-left: 10px;\n background-color: #ededed;\n font-size: .9em;\n color: black;\n padding: 1px 5px;\n}\n.sja_handle_green {\n display: inline-block;\n font-size: .9em;\n padding: 3px 6px;\n background-color: #f0f7f1;\n color: #146E17;\n cursor: default;\n}\n.sja_handle_green:hover {\n background-color: #D5F0D8;\n}\n.sja_handle_green:active {\n background-color: #BAD1BC;\n color: black;\n}\n.sja_handle_red {\n display: inline-block;\n font-size: .9em;\n padding: 3px 6px;\n background-color: #F5EBEC;\n color: #991F1F;\n cursor: default;\n}\n.sja_handle_red:hover {\n background-color: #F2D8DB;\n}\n.sja_handle_red:active {\n background-color: #E3B1B7;\n color: black;\n}\n.sja_btn {\n -webkit-appearance: button;\n -moz-appearance: button;\n appearance: button;\n text-decoration: none;\n color: initial;\n}\n.sja_button {\n display: inline-block;\n background: white;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button:hover {\n opacity: 1;\n}\n.sja_button_open {\n display: inline-block;\n background: #ddd;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button_open:hover {\n opacity: 1;\n}\n.sja_button_fold {\n display: inline-block;\n background: #aaa;\n color: white;\n padding: 3px 5px;\n border: solid 1px black;\n opacity: .8;\n cursor: default;\n}\n.sja_button_fold:hover {\n opacity: 1;\n}\n.sja-termdb-config-row-label {\n padding: 5px;\n text-align: left;\n vertical-align: middle;\n}\n.sjpp-controls-table {\n margin-bottom: 10px;\n}\n.sjpp-controls-table > tr:hover {\n /*font-weight: 600;*/\n text-shadow:0px 0px 0.5px black;\n background-color: rgba(239, 236, 149, 0.389);\n}\n.sja_edit_btn {\n display: inline-block;\n color: black;\n background-color: #f2f2f2;\n border-radius: 5px;\n border: solid 1px #aaa;\n padding: 5px 10px;\n cursor: default;\n margin: 1px;\n font-size: 0.8em;\n margin-left: 20px;\n}\n.sja_edit_btn:hover {\n background-color: #e6e6e6\n}\n.sja_edit_btn:active {\n color: #cc0000;\n background-color: #FCE2E1;\n}\n/* App Drawer style */\n.sjpp-appdrawer-cols {\n font-family: Verdana, Geneva, Tahoma, sans-serif;\n font-weight: 500;\n font-size: 17px;\n text-align: left;\n color: #324870;\n margin: 10px 10px 0px 10px;\n}\n.sjpp-track, .sjpp-track li {\n display: grid !important;\n grid-template-columns: 2fr 4fr 40px;\n grid-template-areas: 'image header' 'image blurb';\n gap: 5px;\n}\n.sjpp-app-drawer-card,\n.sjpp-track {\n background-color: white;\n max-width: 400px;\n /* min-width: 320px; */\n border-radius: 5px;\n padding: 0px;\n align-items: center;\n justify-items: left;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n}\n.sjpp-app-drawer-card::after,\n.sjpp-track::after {\n content: \"\";\n border-radius: 8px;\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);\n opacity: 0;\n -webkit-transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);\n}\n.sjpp-app-drawer-card:hover,\n.sjpp-track:hover {\n -webkit-transform: scale(1, 1);\n transform: scale(1, 1);\n}\n.sjpp-app-drawer-card:hover::after,\n.sjpp-track:hover::after {\n opacity: 1;\n}\n.sjpp-track-image {\n grid-area: image;\n width: 75px;\n height: 75px;\n align-self: start;\n justify-self: start;\n}\n.sjpp-track-image img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 5px 0px 0px 5px;\n}\n.sjpp-app-drawer-card-ribbon{\n grid-area: image;\n overflow: hidden;\n width: 100%;\n height: 100%;\n}\n.sjpp-app-drawer-card-ribbon::before,\n.sjpp-app-drawer-card-ribbon::after {\n position: relative;\n z-index: -1;\n content: '';\n display: block;\n border-top-color: transparent;\n border-left-color: transparent;\n}\n.sjpp-app-drawer-card-ribbon span {\n position: relative;\n display: block;\n width: 100%;\n padding: 1px 0;\n border-color: transparent transparent transparent darkgray;\n box-shadow: 0 2px 7.5px rgba(0, 0, 0, 0.3);\n opacity: 1;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n transform: rotate(-45deg);\n}\n.sjpp-app-drawer-card-ribbon::before {\n top: 0;\n right: 0;\n}\n.sjpp-app-drawer-card-ribbon::after {\n bottom: 0;\n left: 0;\n}\n.sjpp-track-h {\n grid-area: header;\n font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;\n margin-left: 5px;\n padding: 0px;\n}\n.sjpp-track-blurb {\n grid-area: blurb;\n font-size: 13px;\n font-weight: 300;\n margin-left: 5px;\n justify-content: center;\n font-style: oblique;\n color: #403f3f;\n}\n/* client/src/block.js start */\n.sjpp-active-tiny-button {\n\tdisplay: inline-block;\n\tbackground-color: #1C5E86;\n\tfont-size: .8em;\n\tcolor: white;\n\tpadding: 1px 5px;\n\tmargin-right: 5px;\n\tborder-radius: 4px;\n}\n.sjpp-plus-button\n{\n display: inline-block;\n margin: 1px;\n border: solid 1px #545454;\n font-size: .9em;\n cursor: default;\n padding: 2px 5px;\n}\n.sjpp-dshandleholder\n{\n display: inline-block;\n margin: 1px;\n border: solid 1px #545454;\n font-size: .9em;\n cursor: default;\n}\n.sjpp-dslabel\n{\n display: inline-block;\n color: black;\n padding: 2px 4px;\n\n}\n/* client/src/block.js end */\n/* client/src/app.js start */\n.sjpp-input-div-gene-pos\n{\n display: inline-block;\n padding-right: 5px;\n}\n.sjpp-input-gene-pos\n{\n border: solid 1px #545454;\n padding: 6px 10px;\n border-radius: 5px;\n}\n.sjpp-genome-select-div\n{\n display: inline-block;\n padding-left: 5px;\n}\n.sjpp-genome-select\n{\n border-radius: 5px;\n margin: 1px 20px 1px 10px;\n}\n.sjpp-output-sandbox-title\n{\n border-radius:4px; \n color:white; \n background-color: #969696; \n padding: 1px 5px; \n display:inline-block; \n font-size:0.8em; \n margin-left:4px;\n}\n/* client/src/app.js end */\n/* client/dom/sandbox.ts start */\n.sjpp-output-sandbox-header\n{\n display: inline-block;\n margin: 5px 10px;\n padding-right: 8px;\n margin-bottom: 0px;\n /* box-shadow:2px 0px 2px #f2f2f2; */\n border-radius: 5px 5px 0 0;\n /* background-color: #f2f2f2; */\n z-index: 99;\n}\n.sjpp-output-sandbox-content\n{\n margin: 5px 10px;\n margin-top: 0px;\n padding-right: 8px;\n display: inline-block;\n /* box-shadow: 2px 2px 10px #f2f2f2; */\n border: solid 1px #ccc;\n border-top: solid 1px white;\n border-radius: 0 0 5px 5px;\n}\n.sjpp-output-sandbox-collapse-btn,\n.sjpp-output-sandbox-expand-btn,\n.sjpp-output-sandbox-close-bt\n{\n /* display: inline-block; */\n /* margin: 0px; */\n /* border-right: solid 2px white; */\n font-size: 16px;\n cursor: default;\n}\n.sjpp-output-sandbox-close-bt {\n border-radius: 5px 0 0 0;\n}\n/* \nSeparated padding for sandbox buttons to fix close button's\nright, white border not extending to total height of\nsandbox header\n*/\n.sjpp-output-sandbox-collapse-btn,\n.sjpp-output-sandbox-expand-btn {\n padding: 4px 10px;\n}\n.sjpp-output-sandbox-close-bt {\n padding: 8px 10px;\n}\n/* client/dom/sandbox.ts end */\n.sjpp_row_wrapper:hover {\n background: #fcfcca !important; \n}\n/*.sjpp_row_wrapper:nth-child(odd) {background: rgb(237, 237, 237)}*/\n.sjpp_table_header {\n font-family: 'Arial';\n font-size: 1em;\n text-align: left;\n position: sticky;\n top: 0;\n opacity: 0.7;\n font-weight: normal;\n}\n.sjpp_table_item {\n padding: 3px 5px;\n font-size: 1em;\n text-align: left;\n}\n.sjpp_show_scrollbar{\n\t/* set to \"auto\" to avoid showing a gray track as non-functional scrollbar when contents don't scroll at all, since scrollbar track is now gray and no longer white */\n overflow-y: auto;\n overflow-x: auto;\n}\n.sjpp_show_scrollbar::-webkit-scrollbar{\n background-color: #f1f1f1; /* use non-white track color so the presence of scrollbar is apparent (gdc requirement) */\n border-radius: 7px;\n width: 14px;\n}\n/* This will handle the thumb (scrolling part) */\n.sjpp_show_scrollbar::-webkit-scrollbar-thumb{\n background-color: #858585;\n border-radius: 7px;\n border: 1px solid white;\n}\n.sjpp_show_scrollbar::-webkit-scrollbar-thumb:vertical{\n height: 14px!important;\n width: 14px;\n}\n.sjpp-matrix-series-group-label-g text,\n.sjpp-matrix-series-label-g text,\n.sjpp-matrix-term-group-label-g text,\n.sjpp-matrix-term-label-g text,\n.sjpp-matrix-label text {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -user-select: none;\n}\n.sjpp-nav\n{\n position: sticky;\n background-color: white;\n width: 100%;\n z-index: 10;\n top: 0px;\n left: 0px;\n padding: 0px 0px 15px 0px;\n}\n.add_term_btn {\n border-radius: 6px;\n}\n#sjpp-loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color:rgba(255, 255, 255, 0.8);\n}\n.sjpp-spinner {\n position: absolute;\n left: 50%;\n top: 30%;\n height: 60px;\n width: 60px;\n margin: 0px auto;\n -webkit-animation: rotation .6s infinite linear;\n -moz-animation: rotation .6s infinite linear;\n -o-animation: rotation .6s infinite linear;\n animation: rotation .6s infinite linear;\n border-left: 6px solid rgba(0, 174, 239, .15);\n border-right: 6px solid rgba(0, 174, 239, .15);\n border-bottom: 6px solid rgba(0, 174, 239, .15);\n border-top: 6px solid rgba(0, 174, 239, .8);\n border-radius: 100%;\n}\n@-webkit-keyframes rotation {\n from {-webkit-transform: rotate(0deg);}\n to {-webkit-transform: rotate(359deg);}\n }\n@-moz-keyframes rotation {\n from {-moz-transform: rotate(0deg);}\n to {-moz-transform: rotate(359deg);}\n }\n@-o-keyframes rotation {\n from {-o-transform: rotate(0deg);}\n to {-o-transform: rotate(359deg);}\n }\n@keyframes rotation {\n from {transform: rotate(0deg);}\n to {transform: rotate(359deg);}\n }\n";e(o);var i="http://www.w3.org/1999/xhtml";var s={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(e){var t=e+="",n=t.indexOf(":");if(n>=0&&(t=e.slice(0,n))!=="xmlns")e=e.slice(n+1);return s.hasOwnProperty(t)?{space:s[t],local:e}:e}function a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===i&&t.documentElement.namespaceURI===i?t.createElement(e):t.createElementNS(n,e)}}function l(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function c(e){var t=r(e);return(t.local?l:a)(t)}function d(){}function f(e){return e==null?d:function(){return this.querySelector(e)}}function p(e){if(typeof e!=="function")e=f(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=new Array(r),l,c,d=0;d<r;++d){if((l=s[d])&&(c=e.call(l,l.__data__,d,s))){if("__data__"in l)c.__data__=l.__data__;a[d]=c}}}return new et(o,this._parents)}function u(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function h(){return[]}function m(e){return e==null?h:function(){return this.querySelectorAll(e)}}function g(e){return function(){return u(e.apply(this,arguments))}}function b(e){if(typeof e==="function")e=g(e);else e=m(e);for(var t=this._groups,n=t.length,o=[],i=[],s=0;s<n;++s){for(var r=t[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){o.push(e.call(l,l.__data__,c,r));i.push(l)}}}return new et(o,i)}function y(e){return function(){return this.matches(e)}}function v(e){return function(t){return t.matches(e)}}var w=Array.prototype.find;function x(e){return function(){return w.call(this.children,e)}}function _(){return this.firstElementChild}function k(e){return this.select(e==null?_:x(typeof e==="function"?e:v(e)))}var j=Array.prototype.filter;function N(){return Array.from(this.children)}function S(e){return function(){return j.call(this.children,e)}}function A(e){return this.selectAll(e==null?N:S(typeof e==="function"?e:v(e)))}function C(e){if(typeof e!=="function")e=y(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=[],l,c=0;c<r;++c){if((l=s[c])&&e.call(l,l.__data__,c,s)){a.push(l)}}}return new et(o,this._parents)}function E(e){return new Array(e.length)}function O(){return new et(this._enter||this._groups.map(E),this._parents)}function M(e,t){this.ownerDocument=e.ownerDocument;this.namespaceURI=e.namespaceURI;this._next=null;this._parent=e;this.__data__=t}M.prototype={constructor:M,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function I(e){return function(){return e}}function T(e,t,n,o,i,s){var r=0,a,l=t.length,c=s.length;for(;r<c;++r){if(a=t[r]){a.__data__=s[r];o[r]=a}else{n[r]=new M(e,s[r])}}for(;r<l;++r){if(a=t[r]){i[r]=a}}}function R(e,t,n,o,i,s,r){var a,l,c=new Map,d=t.length,f=s.length,p=new Array(d),u;for(a=0;a<d;++a){if(l=t[a]){p[a]=u=r.call(l,l.__data__,a,t)+"";if(c.has(u)){i[a]=l}else{c.set(u,l)}}}for(a=0;a<f;++a){u=r.call(e,s[a],a,s)+"";if(l=c.get(u)){o[a]=l;l.__data__=s[a];c.delete(u)}else{n[a]=new M(e,s[a])}}for(a=0;a<d;++a){if((l=t[a])&&c.get(p[a])===l){i[a]=l}}}function L(e){return e.__data__}function $(e,t){if(!arguments.length)return Array.from(this,L);var n=t?R:T,o=this._parents,i=this._groups;if(typeof e!=="function")e=I(e);for(var s=i.length,r=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var d=o[c],f=i[c],p=f.length,u=z(e.call(d,d&&d.__data__,c,o)),h=u.length,m=a[c]=new Array(h),g=r[c]=new Array(h),b=l[c]=new Array(p);n(d,f,m,g,b,u,t);for(var y=0,v=0,w,x;y<h;++y){if(w=m[y]){if(y>=v)v=y+1;while(!(x=g[v])&&++v<h);w._next=x||null}}}r=new et(r,o);r._enter=a;r._exit=l;return r}function z(e){return typeof e==="object"&&"length"in e?e:Array.from(e)}function P(){return new et(this._exit||this._groups.map(E),this._parents)}function D(e,t,n){var o=this.enter(),i=this,s=this.exit();if(typeof e==="function"){o=e(o);if(o)o=o.selection()}else{o=o.append(e+"")}if(t!=null){i=t(i);if(i)i=i.selection()}if(n==null)s.remove();else n(s);return o&&i?o.merge(i).order():i}function U(e){var t=e.selection?e.selection():e;for(var n=this._groups,o=t._groups,i=n.length,s=o.length,r=Math.min(i,s),a=new Array(i),l=0;l<r;++l){for(var c=n[l],d=o[l],f=c.length,p=a[l]=new Array(f),u,h=0;h<f;++h){if(u=c[h]||d[h]){p[h]=u}}}for(;l<i;++l){a[l]=n[l]}return new et(a,this._parents)}function B(){for(var e=this._groups,t=-1,n=e.length;++t<n;){for(var o=e[t],i=o.length-1,s=o[i],r;--i>=0;){if(r=o[i]){if(s&&r.compareDocumentPosition(s)^4)s.parentNode.insertBefore(r,s);s=r}}}return this}function F(e){if(!e)e=q;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,o=n.length,i=new Array(o),s=0;s<o;++s){for(var r=n[s],a=r.length,l=i[s]=new Array(a),c,d=0;d<a;++d){if(c=r[d]){l[d]=c}}l.sort(t)}return new et(i,this._parents).order()}function q(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function H(){var e=arguments[0];arguments[0]=this;e.apply(null,arguments);return this}function G(){return Array.from(this)}function J(){for(var e=this._groups,t=0,n=e.length;t<n;++t){for(var o=e[t],i=0,s=o.length;i<s;++i){var r=o[i];if(r)return r}}return null}function V(){let e=0;for(const t of this)++e;return e}function W(){return!this.node()}function X(e){for(var t=this._groups,n=0,o=t.length;n<o;++n){for(var i=t[n],s=0,r=i.length,a;s<r;++s){if(a=i[s])e.call(a,a.__data__,s,i)}}return this}function Y(e){return function(){this.removeAttribute(e)}}function Z(e){return function(){this.removeAttributeNS(e.space,e.local)}}function K(e,t){return function(){this.setAttribute(e,t)}}function Q(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ee(e,t){return function(){var n=t.apply(this,arguments);if(n==null)this.removeAttribute(e);else this.setAttribute(e,n)}}function te(e,t){return function(){var n=t.apply(this,arguments);if(n==null)this.removeAttributeNS(e.space,e.local);else this.setAttributeNS(e.space,e.local,n)}}function ne(e,t){var n=r(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Z:Y:typeof t==="function"?n.local?te:ee:n.local?Q:K)(n,t))}function oe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ie(e){return function(){this.style.removeProperty(e)}}function se(e,t,n){return function(){this.style.setProperty(e,t,n)}}function re(e,t,n){return function(){var o=t.apply(this,arguments);if(o==null)this.style.removeProperty(e);else this.style.setProperty(e,o,n)}}function ae(e,t,n){return arguments.length>1?this.each((t==null?ie:typeof t==="function"?re:se)(e,t,n==null?"":n)):le(this.node(),e)}function le(e,t){return e.style.getPropertyValue(t)||oe(e).getComputedStyle(e,null).getPropertyValue(t)}function ce(e){return function(){delete this[e]}}function de(e,t){return function(){this[e]=t}}function fe(e,t){return function(){var n=t.apply(this,arguments);if(n==null)delete this[e];else this[e]=n}}function pe(e,t){return arguments.length>1?this.each((t==null?ce:typeof t==="function"?fe:de)(e,t)):this.node()[e]}function ue(e){return e.trim().split(/^|\s+/)}function he(e){return e.classList||new me(e)}function me(e){this._node=e;this._names=ue(e.getAttribute("class")||"")}me.prototype={add:function(e){var t=this._names.indexOf(e);if(t<0){this._names.push(e);this._node.setAttribute("class",this._names.join(" "))}},remove:function(e){var t=this._names.indexOf(e);if(t>=0){this._names.splice(t,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(e){return this._names.indexOf(e)>=0}};function ge(e,t){var n=he(e),o=-1,i=t.length;while(++o<i)n.add(t[o])}function be(e,t){var n=he(e),o=-1,i=t.length;while(++o<i)n.remove(t[o])}function ye(e){return function(){ge(this,e)}}function ve(e){return function(){be(this,e)}}function we(e,t){return function(){(t.apply(this,arguments)?ge:be)(this,e)}}function xe(e,t){var n=ue(e+"");if(arguments.length<2){var o=he(this.node()),i=-1,s=n.length;while(++i<s)if(!o.contains(n[i]))return false;return true}return this.each((typeof t==="function"?we:t?ye:ve)(n,t))}function _e(){this.textContent=""}function ke(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ne(e){return arguments.length?this.each(e==null?_e:(typeof e==="function"?je:ke)(e)):this.node().textContent}function Se(){this.innerHTML=""}function Ae(e){return function(){this.innerHTML=e}}function Ce(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Ee(e){return arguments.length?this.each(e==null?Se:(typeof e==="function"?Ce:Ae)(e)):this.node().innerHTML}function Oe(){if(this.nextSibling)this.parentNode.appendChild(this)}function Me(){return this.each(Oe)}function Ie(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Te(){return this.each(Ie)}function Re(e){var t=typeof e==="function"?e:c(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))}function Le(){return null}function $e(e,t){var n=typeof e==="function"?e:c(e),o=t==null?Le:typeof t==="function"?t:f(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))}function ze(){var e=this.parentNode;if(e)e.removeChild(this)}function Pe(){return this.each(ze)}function De(){var e=this.cloneNode(false),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ue(){var e=this.cloneNode(true),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Be(e){return this.select(e?Ue:De)}function Fe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qe(e){return function(t){e.call(this,t,this.__data__)}}function He(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0)t=e.slice(n+1),e=e.slice(0,n);return{type:e,name:t}}))}function Ge(e){return function(){var t=this.__on;if(!t)return;for(var n=0,o=-1,i=t.length,s;n<i;++n){if(s=t[n],(!e.type||s.type===e.type)&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options)}else{t[++o]=s}}if(++o)t.length=o;else delete this.__on}}function Je(e,t,n){return function(){var o=this.__on,i,s=qe(t);if(o)for(var r=0,a=o.length;r<a;++r){if((i=o[r]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options);this.addEventListener(i.type,i.listener=s,i.options=n);i.value=t;return}}this.addEventListener(e.type,s,n);i={type:e.type,name:e.name,value:t,listener:s,options:n};if(!o)this.__on=[i];else o.push(i)}}function Ve(e,t,n){var o=He(e+""),i,s=o.length,r;if(arguments.length<2){var a=this.node().__on;if(a)for(var l=0,c=a.length,d;l<c;++l){for(i=0,d=a[l];i<s;++i){if((r=o[i]).type===d.type&&r.name===d.name){return d.value}}}return}a=t?Je:Ge;for(i=0;i<s;++i)this.each(a(o[i],t,n));return this}function We(e,t,n){var o=oe(e),i=o.CustomEvent;if(typeof i==="function"){i=new i(t,n)}else{i=o.document.createEvent("Event");if(n)i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail;else i.initEvent(t,false,false)}e.dispatchEvent(i)}function Xe(e,t){return function(){return We(this,e,t)}}function Ye(e,t){return function(){return We(this,e,t.apply(this,arguments))}}function Ze(e,t){return this.each((typeof t==="function"?Ye:Xe)(e,t))}function*Ke(){for(var e=this._groups,t=0,n=e.length;t<n;++t){for(var o=e[t],i=0,s=o.length,r;i<s;++i){if(r=o[i])yield r}}}var Qe=[null];function et(e,t){this._groups=e;this._parents=t}function tt(){return new et([[document.documentElement]],Qe)}function nt(){return this}et.prototype=tt.prototype={constructor:et,select:p,selectAll:b,selectChild:k,selectChildren:A,filter:C,data:$,enter:O,exit:P,join:D,merge:U,selection:nt,order:B,sort:F,call:H,nodes:G,node:J,size:V,empty:W,each:X,attr:ne,style:ae,property:pe,classed:xe,text:Ne,html:Ee,raise:Me,lower:Te,append:Re,insert:$e,remove:Pe,clone:Be,datum:Fe,on:Ve,dispatch:Ze,[Symbol.iterator]:Ke};function ot(e){return typeof e==="string"?new et([[document.querySelector(e)]],[document.documentElement]):new et([[e]],Qe)}function it(e){return typeof e==="string"?new et([document.querySelectorAll(e)],[document.documentElement]):new et([u(e)],Qe)}function st(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rt(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function at(e){let t,n,o;if(e.length!==2){t=st;n=(t,n)=>st(e(t),n);o=(t,n)=>e(t)-n}else{t=e===st||e===rt?e:lt;n=e;o=e}function i(e,o,i=0,s=e.length){if(i<s){if(t(o,o)!==0)return s;do{const t=i+s>>>1;if(n(e[t],o)<0)i=t+1;else s=t}while(i<s)}return i}function s(e,o,i=0,s=e.length){if(i<s){if(t(o,o)!==0)return s;do{const t=i+s>>>1;if(n(e[t],o)<=0)i=t+1;else s=t}while(i<s)}return i}function r(e,t,n=0,s=e.length){const r=i(e,t,n,s-1);return r>n&&o(e[r-1],t)>-o(e[r],t)?r-1:r}return{left:i,center:r,right:s}}function lt(){return 0}function ct(e){return e===null?NaN:+e}const dt=at(st);const ft=dt.right;at(ct).center;var pt=ft;class ut extends Map{constructor(e,t=bt){super();Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}});if(e!=null)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(ht(this,e))}has(e){return super.has(ht(this,e))}set(e,t){return super.set(mt(this,e),t)}delete(e){return super.delete(gt(this,e))}}function ht({_intern:e,_key:t},n){const o=t(n);return e.has(o)?e.get(o):n}function mt({_intern:e,_key:t},n){const o=t(n);if(e.has(o))return e.get(o);e.set(o,n);return n}function gt({_intern:e,_key:t},n){const o=t(n);if(e.has(o)){n=e.get(o);e.delete(o)}return n}function bt(e){return e!==null&&typeof e==="object"?e.valueOf():e}var yt=Math.sqrt(50),vt=Math.sqrt(10),wt=Math.sqrt(2);function xt(e,t,n){var o,i=-1,s,r,a;t=+t,e=+e,n=+n;if(e===t&&n>0)return[e];if(o=t<e)s=e,e=t,t=s;if((a=_t(e,t,n))===0||!isFinite(a))return[];if(a>0){let n=Math.round(e/a),o=Math.round(t/a);if(n*a<e)++n;if(o*a>t)--o;r=new Array(s=o-n+1);while(++i<s)r[i]=(n+i)*a}else{a=-a;let n=Math.round(e*a),o=Math.round(t*a);if(n/a<e)++n;if(o/a>t)--o;r=new Array(s=o-n+1);while(++i<s)r[i]=(n+i)/a}if(o)r.reverse();return r}function _t(e,t,n){var o=(t-e)/Math.max(0,n),i=Math.floor(Math.log(o)/Math.LN10),s=o/Math.pow(10,i);return i>=0?(s>=yt?10:s>=vt?5:s>=wt?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(s>=yt?10:s>=vt?5:s>=wt?2:1)}function kt(e,t,n){var o=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(o)/Math.LN10)),s=o/i;if(s>=yt)i*=10;else if(s>=vt)i*=5;else if(s>=wt)i*=2;return t<e?-i:i}function jt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Nt(e,t){switch(arguments.length){case 0:break;case 1:{if(typeof e==="function")this.interpolator(e);else this.range(e);break}default:{this.domain(e);if(typeof t==="function")this.interpolator(t);else this.range(t);break}}return this}const St=Symbol("implicit");function At(){var e=new ut,t=[],n=[],o=St;function i(i){let s=e.get(i);if(s===undefined){if(o!==St)return o;e.set(i,s=t.push(i)-1)}return n[s%n.length]}i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new ut;for(const o of n){if(e.has(o))continue;e.set(o,t.push(o)-1)}return i};i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()};i.unknown=function(e){return arguments.length?(o=e,i):o};i.copy=function(){return At(t,n).unknown(o)};jt.apply(i,arguments);return i}function Ct(e,t,n){e.prototype=t.prototype=n;n.constructor=e}function Et(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ot(){}var Mt=.7;var It=1/Mt;var Tt="\\s*([+-]?\\d+)\\s*",Rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$t=/^#([0-9a-f]{3,8})$/,zt=new RegExp(`^rgb\\(${Tt},${Tt},${Tt}\\)$`),Pt=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),Dt=new RegExp(`^rgba\\(${Tt},${Tt},${Tt},${Rt}\\)$`),Ut=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Rt}\\)$`),Bt=new RegExp(`^hsl\\(${Rt},${Lt},${Lt}\\)$`),Ft=new RegExp(`^hsla\\(${Rt},${Lt},${Lt},${Rt}\\)$`);var qt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ct(Ot,Wt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ht,formatHex:Ht,formatHex8:Gt,formatHsl:Jt,formatRgb:Vt,toString:Vt});function Ht(){return this.rgb().formatHex()}function Gt(){return this.rgb().formatHex8()}function Jt(){return ln(this).formatHsl()}function Vt(){return this.rgb().formatRgb()}function Wt(e){var t,n;e=(e+"").trim().toLowerCase();return(t=$t.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Xt(t):n===3?new Qt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=zt.exec(e))?new Qt(t[1],t[2],t[3],1):(t=Pt.exec(e))?new Qt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Dt.exec(e))?Yt(t[1],t[2],t[3],t[4]):(t=Ut.exec(e))?Yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Bt.exec(e))?an(t[1],t[2]/100,t[3]/100,1):(t=Ft.exec(e))?an(t[1],t[2]/100,t[3]/100,t[4]):qt.hasOwnProperty(e)?Xt(qt[e]):e==="transparent"?new Qt(NaN,NaN,NaN,0):null}function Xt(e){return new Qt(e>>16&255,e>>8&255,e&255,1)}function Yt(e,t,n,o){if(o<=0)e=t=n=NaN;return new Qt(e,t,n,o)}function Zt(e){if(!(e instanceof Ot))e=Wt(e);if(!e)return new Qt;e=e.rgb();return new Qt(e.r,e.g,e.b,e.opacity)}function Kt(e,t,n,o){return arguments.length===1?Zt(e):new Qt(e,t,n,o==null?1:o)}function Qt(e,t,n,o){this.r=+e;this.g=+t;this.b=+n;this.opacity=+o}Ct(Qt,Kt,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qt(sn(this.r),sn(this.g),sn(this.b),on(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&(-.5<=this.g&&this.g<255.5)&&(-.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:en,formatHex:en,formatHex8:tn,formatRgb:nn,toString:nn}));function en(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}`}function tn(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}${rn((isNaN(this.opacity)?1:this.opacity)*255)}`}function nn(){const e=on(this.opacity);return`${e===1?"rgb(":"rgba("}${sn(this.r)}, ${sn(this.g)}, ${sn(this.b)}${e===1?")":`, ${e})`}`}function on(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rn(e){e=sn(e);return(e<16?"0":"")+e.toString(16)}function an(e,t,n,o){if(o<=0)e=t=n=NaN;else if(n<=0||n>=1)e=t=NaN;else if(t<=0)e=NaN;return new dn(e,t,n,o)}function ln(e){if(e instanceof dn)return new dn(e.h,e.s,e.l,e.opacity);if(!(e instanceof Ot))e=Wt(e);if(!e)return new dn;if(e instanceof dn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),s=Math.max(t,n,o),r=NaN,a=s-i,l=(s+i)/2;if(a){if(t===s)r=(n-o)/a+(n<o)*6;else if(n===s)r=(o-t)/a+2;else r=(t-n)/a+4;a/=l<.5?s+i:2-s-i;r*=60}else{a=l>0&&l<1?0:r}return new dn(r,a,l,e.opacity)}function cn(e,t,n,o){return arguments.length===1?ln(e):new dn(e,t,n,o==null?1:o)}function dn(e,t,n,o){this.h=+e;this.s=+t;this.l=+n;this.opacity=+o}Ct(dn,cn,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new dn(this.h,this.s,this.l*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new dn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new Qt(un(e>=240?e-240:e+120,i,o),un(e,i,o),un(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new dn(fn(this.h),pn(this.s),pn(this.l),on(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)},formatHsl(){const e=on(this.opacity);return`${e===1?"hsl(":"hsla("}${fn(this.h)}, ${pn(this.s)*100}%, ${pn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fn(e){e=(e||0)%360;return e<0?e+360:e}function pn(e){return Math.max(0,Math.min(1,e||0))}function un(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const hn=Math.PI/180;const mn=180/Math.PI;var gn=-.14861,bn=+1.78277,yn=-.29227,vn=-.90649,wn=+1.97294,xn=wn*vn,_n=wn*bn,kn=bn*yn-vn*gn;function jn(e){if(e instanceof Sn)return new Sn(e.h,e.s,e.l,e.opacity);if(!(e instanceof Qt))e=Zt(e);var t=e.r/255,n=e.g/255,o=e.b/255,i=(kn*o+xn*t-_n*n)/(kn+xn-_n),s=o-i,r=(wn*(n-i)-yn*s)/vn,a=Math.sqrt(r*r+s*s)/(wn*i*(1-i)),l=a?Math.atan2(r,s)*mn-120:NaN;return new Sn(l<0?l+360:l,a,i,e.opacity)}function Nn(e,t,n,o){return arguments.length===1?jn(e):new Sn(e,t,n,o==null?1:o)}function Sn(e,t,n,o){this.h=+e;this.s=+t;this.l=+n;this.opacity=+o}Ct(Sn,Nn,Et(Ot,{brighter(e){e=e==null?It:Math.pow(It,e);return new Sn(this.h,this.s,this.l*e,this.opacity)},darker(e){e=e==null?Mt:Math.pow(Mt,e);return new Sn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*hn,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),o=Math.cos(e),i=Math.sin(e);return new Qt(255*(t+n*(gn*o+bn*i)),255*(t+n*(yn*o+vn*i)),255*(t+n*(wn*o)),this.opacity)}}));function An(e,t,n,o,i){var s=e*e,r=s*e;return((1-3*e+3*s-r)*t+(4-6*s+3*r)*n+(1+3*e+3*s-3*r)*o+r*i)/6}function Cn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[o],s=e[o+1],r=o>0?e[o-1]:2*i-s,a=o<t-1?e[o+2]:2*s-i;return An((n-o/t)*t,r,i,s,a)}}var En=e=>()=>e;function On(e,t){return function(n){return e+n*t}}function Mn(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function In(e,t){var n=t-e;return n?On(e,n>180||n<-180?n-360*Math.round(n/360):n):En(isNaN(e)?t:e)}function Tn(e){return(e=+e)===1?Rn:function(t,n){return n-t?Mn(t,n,e):En(isNaN(t)?n:t)}}function Rn(e,t){var n=t-e;return n?On(e,n):En(isNaN(e)?t:e)}var Ln=function e(t){var n=Tn(t);function o(e,t){var o=n((e=Kt(e)).r,(t=Kt(t)).r),i=n(e.g,t.g),s=n(e.b,t.b),r=Rn(e.opacity,t.opacity);return function(t){e.r=o(t);e.g=i(t);e.b=s(t);e.opacity=r(t);return e+""}}o.gamma=e;return o}(1);function $n(e){return function(t){var n=t.length,o=new Array(n),i=new Array(n),s=new Array(n),r,a;for(r=0;r<n;++r){a=Kt(t[r]);o[r]=a.r||0;i[r]=a.g||0;s[r]=a.b||0}o=e(o);i=e(i);s=e(s);a.opacity=1;return function(e){a.r=o(e);a.g=i(e);a.b=s(e);return a+""}}}var zn=$n(Cn);function Pn(e,t){if(!t)t=[];var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(s){for(i=0;i<n;++i)o[i]=e[i]*(1-s)+t[i]*s;return o}}function Dn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Un(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),s=new Array(n),r;for(r=0;r<o;++r)i[r]=Xn(e[r],t[r]);for(;r<n;++r)s[r]=t[r];return function(e){for(r=0;r<o;++r)s[r]=i[r](e);return s}}function Bn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Fn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function qn(e,t){var n={},o={},i;if(e===null||typeof e!=="object")e={};if(t===null||typeof t!=="object")t={};for(i in t){if(i in e){n[i]=Xn(e[i],t[i])}else{o[i]=t[i]}}return function(e){for(i in n)o[i]=n[i](e);return o}}var Hn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gn=new RegExp(Hn.source,"g");function Jn(e){return function(){return e}}function Vn(e){return function(t){return e(t)+""}}function Wn(e,t){var n=Hn.lastIndex=Gn.lastIndex=0,o,i,s,r=-1,a=[],l=[];e=e+"",t=t+"";while((o=Hn.exec(e))&&(i=Gn.exec(t))){if((s=i.index)>n){s=t.slice(n,s);if(a[r])a[r]+=s;else a[++r]=s}if((o=o[0])===(i=i[0])){if(a[r])a[r]+=i;else a[++r]=i}else{a[++r]=null;l.push({i:r,x:Fn(o,i)})}n=Gn.lastIndex}if(n<t.length){s=t.slice(n);if(a[r])a[r]+=s;else a[++r]=s}return a.length<2?l[0]?Vn(l[0].x):Jn(t):(t=l.length,function(e){for(var n=0,o;n<t;++n)a[(o=l[n]).i]=o.x(e);return a.join("")})}function Xn(e,t){var n=typeof t,o;return t==null||n==="boolean"?En(t):(n==="number"?Fn:n==="string"?(o=Wt(t))?(t=o,Ln):Wn:t instanceof Wt?Ln:t instanceof Date?Bn:Dn(t)?Pn:Array.isArray(t)?Un:typeof t.valueOf!=="function"&&typeof t.toString!=="function"||isNaN(t)?qn:Fn)(e,t)}function Yn(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Zn=180/Math.PI;var Kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qn(e,t,n,o,i,s){var r,a,l;if(r=Math.sqrt(e*e+t*t))e/=r,t/=r;if(l=e*n+t*o)n-=e*l,o-=t*l;if(a=Math.sqrt(n*n+o*o))n/=a,o/=a,l/=a;if(e*o<t*n)e=-e,t=-t,l=-l,r=-r;return{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Zn,skewX:Math.atan(l)*Zn,scaleX:r,scaleY:a}}var eo;function to(e){const t=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kn:Qn(t.a,t.b,t.c,t.d,t.e,t.f)}function no(e){if(e==null)return Kn;if(!eo)eo=document.createElementNS("http://www.w3.org/2000/svg","g");eo.setAttribute("transform",e);if(!(e=eo.transform.baseVal.consolidate()))return Kn;e=e.matrix;return Qn(e.a,e.b,e.c,e.d,e.e,e.f)}function oo(e,t,n,o){function i(e){return e.length?e.pop()+" ":""}function s(e,o,i,s,r,a){if(e!==i||o!==s){var l=r.push("translate(",null,t,null,n);a.push({i:l-4,x:Fn(e,i)},{i:l-2,x:Fn(o,s)})}else if(i||s){r.push("translate("+i+t+s+n)}}function r(e,t,n,s){if(e!==t){if(e-t>180)t+=360;else if(t-e>180)e+=360;s.push({i:n.push(i(n)+"rotate(",null,o)-2,x:Fn(e,t)})}else if(t){n.push(i(n)+"rotate("+t+o)}}function a(e,t,n,s){if(e!==t){s.push({i:n.push(i(n)+"skewX(",null,o)-2,x:Fn(e,t)})}else if(t){n.push(i(n)+"skewX("+t+o)}}function l(e,t,n,o,s,r){if(e!==n||t!==o){var a=s.push(i(s)+"scale(",null,",",null,")");r.push({i:a-4,x:Fn(e,n)},{i:a-2,x:Fn(t,o)})}else if(n!==1||o!==1){s.push(i(s)+"scale("+n+","+o+")")}}return function(t,n){var o=[],i=[];t=e(t),n=e(n);s(t.translateX,t.translateY,n.translateX,n.translateY,o,i);r(t.rotate,n.rotate,o,i);a(t.skewX,n.skewX,o,i);l(t.scaleX,t.scaleY,n.scaleX,n.scaleY,o,i);t=n=null;return function(e){var t=-1,n=i.length,s;while(++t<n)o[(s=i[t]).i]=s.x(e);return o.join("")}}}var io=oo(to,"px, ","px)","deg)");var so=oo(no,", ",")",")");function ro(e){return function t(n){n=+n;function o(t,o){var i=e((t=Nn(t)).h,(o=Nn(o)).h),s=Rn(t.s,o.s),r=Rn(t.l,o.l),a=Rn(t.opacity,o.opacity);return function(e){t.h=i(e);t.s=s(e);t.l=r(Math.pow(e,n));t.opacity=a(e);return t+""}}o.gamma=t;return o}(1)}ro(In);var ao=ro(Rn);function lo(e){return function(){return e}}function co(e){return+e}var fo=[0,1];function po(e){return e}function uo(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:lo(isNaN(t)?NaN:.5)}function ho(e,t){var n;if(e>t)n=e,e=t,t=n;return function(n){return Math.max(e,Math.min(t,n))}}function mo(e,t,n){var o=e[0],i=e[1],s=t[0],r=t[1];if(i<o)o=uo(i,o),s=n(r,s);else o=uo(o,i),s=n(s,r);return function(e){return s(o(e))}}function go(e,t,n){var o=Math.min(e.length,t.length)-1,i=new Array(o),s=new Array(o),r=-1;if(e[o]<e[0]){e=e.slice().reverse();t=t.slice().reverse()}while(++r<o){i[r]=uo(e[r],e[r+1]);s[r]=n(t[r],t[r+1])}return function(t){var n=pt(e,t,1,o)-1;return s[n](i[n](t))}}function bo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function yo(){var e=fo,t=fo,n=Xn,o,i,s,r=po,a,l,c;function d(){var n=Math.min(e.length,t.length);if(r!==po)r=ho(e[0],e[n-1]);a=n>2?go:mo;l=c=null;return f}function f(i){return i==null||isNaN(i=+i)?s:(l||(l=a(e.map(o),t,n)))(o(r(i)))}f.invert=function(n){return r(i((c||(c=a(t,e.map(o),Fn)))(n)))};f.domain=function(t){return arguments.length?(e=Array.from(t,co),d()):e.slice()};f.range=function(e){return arguments.length?(t=Array.from(e),d()):t.slice()};f.rangeRound=function(e){return t=Array.from(e),n=Yn,d()};f.clamp=function(e){return arguments.length?(r=e?true:po,d()):r!==po};f.interpolate=function(e){return arguments.length?(n=e,d()):n};f.unknown=function(e){return arguments.length?(s=e,f):s};return function(e,t){o=e,i=t;return d()}}function vo(){return yo()(po,po)}function wo(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function xo(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,o=e.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+e.slice(n+1)]}function _o(e){return e=xo(Math.abs(e)),e?e[1]:NaN}function ko(e,t){return function(n,o){var i=n.length,s=[],r=0,a=e[0],l=0;while(i>0&&a>0){if(l+a+1>o)a=Math.max(1,o-l);s.push(n.substring(i-=a,i+a));if((l+=a+1)>o)break;a=e[r=(r+1)%e.length]}return s.reverse().join(t)}}function jo(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}var No=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function So(e){if(!(t=No.exec(e)))throw new Error("invalid format: "+e);var t;return new Ao({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}So.prototype=Ao.prototype;function Ao(e){this.fill=e.fill===undefined?" ":e.fill+"";this.align=e.align===undefined?">":e.align+"";this.sign=e.sign===undefined?"-":e.sign+"";this.symbol=e.symbol===undefined?"":e.symbol+"";this.zero=!!e.zero;this.width=e.width===undefined?undefined:+e.width;this.comma=!!e.comma;this.precision=e.precision===undefined?undefined:+e.precision;this.trim=!!e.trim;this.type=e.type===undefined?"":e.type+""}Ao.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===undefined?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===undefined?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Co(e){e:for(var t=e.length,n=1,o=-1,i;n<t;++n){switch(e[n]){case".":o=i=n;break;case"0":if(o===0)o=n;i=n;break;default:if(!+e[n])break e;if(o>0)o=0;break}}return o>0?e.slice(0,o)+e.slice(i+1):e}var Eo;function Oo(e,t){var n=xo(e,t);if(!n)return e+"";var o=n[0],i=n[1],s=i-(Eo=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,r=o.length;return s===r?o:s>r?o+new Array(s-r+1).join("0"):s>0?o.slice(0,s)+"."+o.slice(s):"0."+new Array(1-s).join("0")+xo(e,Math.max(0,t+s-1))[0]}function Mo(e,t){var n=xo(e,t);if(!n)return e+"";var o=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+o:o.length>i+1?o.slice(0,i+1)+"."+o.slice(i+1):o+new Array(i-o.length+2).join("0")}var Io={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:wo,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Mo(e*100,t),r:Mo,s:Oo,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function To(e){return e}var Ro=Array.prototype.map,Lo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function $o(e){var t=e.grouping===undefined||e.thousands===undefined?To:ko(Ro.call(e.grouping,Number),e.thousands+""),n=e.currency===undefined?"":e.currency[0]+"",o=e.currency===undefined?"":e.currency[1]+"",i=e.decimal===undefined?".":e.decimal+"",s=e.numerals===undefined?To:jo(Ro.call(e.numerals,String)),r=e.percent===undefined?"%":e.percent+"",a=e.minus===undefined?"−":e.minus+"",l=e.nan===undefined?"NaN":e.nan+"";function c(e){e=So(e);var c=e.fill,d=e.align,f=e.sign,p=e.symbol,u=e.zero,h=e.width,m=e.comma,g=e.precision,b=e.trim,y=e.type;if(y==="n")m=true,y="g";else if(!Io[y])g===undefined&&(g=12),b=true,y="g";if(u||c==="0"&&d==="=")u=true,c="0",d="=";var v=p==="$"?n:p==="#"&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w=p==="$"?o:/[%p]/.test(y)?r:"";var x=Io[y],_=/[defgprs%]/.test(y);g=g===undefined?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g));function k(e){var n=v,o=w,r,p,k;if(y==="c"){o=x(e)+o;e=""}else{e=+e;var j=e<0||1/e<0;e=isNaN(e)?l:x(Math.abs(e),g);if(b)e=Co(e);if(j&&+e===0&&f!=="+")j=false;n=(j?f==="("?f:a:f==="-"||f==="("?"":f)+n;o=(y==="s"?Lo[8+Eo/3]:"")+o+(j&&f==="("?")":"");if(_){r=-1,p=e.length;while(++r<p){if(k=e.charCodeAt(r),48>k||k>57){o=(k===46?i+e.slice(r+1):e.slice(r))+o;e=e.slice(0,r);break}}}}if(m&&!u)e=t(e,Infinity);var N=n.length+e.length+o.length,S=N<h?new Array(h-N+1).join(c):"";if(m&&u)e=t(S+e,S.length?h-o.length:Infinity),S="";switch(d){case"<":e=n+e+o+S;break;case"=":e=n+S+e+o;break;case"^":e=S.slice(0,N=S.length>>1)+n+e+o+S.slice(N);break;default:e=S+n+e+o;break}return s(e)}k.toString=function(){return e+""};return k}function d(e,t){var n=c((e=So(e),e.type="f",e)),o=Math.max(-8,Math.min(8,Math.floor(_o(t)/3)))*3,i=Math.pow(10,-o),s=Lo[8+o/3];return function(e){return n(i*e)+s}}return{format:c,formatPrefix:d}}var zo;var Po;var Do;Uo({thousands:",",grouping:[3],currency:["$",""]});function Uo(e){zo=$o(e);Po=zo.format;Do=zo.formatPrefix;return zo}function Bo(e){return Math.max(0,-_o(Math.abs(e)))}function Fo(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(_o(t)/3)))*3-_o(Math.abs(e)))}function qo(e,t){e=Math.abs(e),t=Math.abs(t)-e;return Math.max(0,_o(t)-_o(e))+1}function Ho(e,t,n,o){var i=kt(e,t,n),s;o=So(o==null?",f":o);switch(o.type){case"s":{var r=Math.max(Math.abs(e),Math.abs(t));if(o.precision==null&&!isNaN(s=Fo(i,r)))o.precision=s;return Do(o,r)}case"":case"e":case"g":case"p":case"r":{if(o.precision==null&&!isNaN(s=qo(i,Math.max(Math.abs(e),Math.abs(t)))))o.precision=s-(o.type==="e");break}case"f":case"%":{if(o.precision==null&&!isNaN(s=Bo(i)))o.precision=s-(o.type==="%")*2;break}}return Po(o)}function Go(e){var t=e.domain;e.ticks=function(e){var n=t();return xt(n[0],n[n.length-1],e==null?10:e)};e.tickFormat=function(e,n){var o=t();return Ho(o[0],o[o.length-1],e==null?10:e,n)};e.nice=function(n){if(n==null)n=10;var o=t();var i=0;var s=o.length-1;var r=o[i];var a=o[s];var l;var c;var d=10;if(a<r){c=r,r=a,a=c;c=i,i=s,s=c}while(d-- >0){c=_t(r,a,n);if(c===l){o[i]=r;o[s]=a;return t(o)}else if(c>0){r=Math.floor(r/c)*c;a=Math.ceil(a/c)*c}else if(c<0){r=Math.ceil(r*c)/c;a=Math.floor(a*c)/c}else{break}l=c}return e};return e}function Jo(){var e=vo();e.copy=function(){return bo(e,Jo())};jt.apply(e,arguments);return Go(e)}var Vo={value:()=>{}};function Wo(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Xo(n)}function Xo(e){this._=e}function Yo(e,t){return e.trim().split(/^|\s+/).map((function(e){var n="",o=e.indexOf(".");if(o>=0)n=e.slice(o+1),e=e.slice(0,o);if(e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}Xo.prototype=Wo.prototype={constructor:Xo,on:function(e,t){var n=this._,o=Yo(e+"",n),i,s=-1,r=o.length;if(arguments.length<2){while(++s<r)if((i=(e=o[s]).type)&&(i=Zo(n[i],e.name)))return i;return}if(t!=null&&typeof t!=="function")throw new Error("invalid callback: "+t);while(++s<r){if(i=(e=o[s]).type)n[i]=Ko(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ko(n[i],e.name,null)}return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Xo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,s;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,i=s.length;o<i;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,s=o.length;i<s;++i)o[i].value.apply(t,n)}};function Zo(e,t){for(var n=0,o=e.length,i;n<o;++n){if((i=e[n]).name===t){return i.value}}}function Ko(e,t,n){for(var o=0,i=e.length;o<i;++o){if(e[o].name===t){e[o]=Vo,e=e.slice(0,o).concat(e.slice(o+1));break}}if(n!=null)e.push({name:t,value:n});return e}var Qo=0,ei=0,ti=0,ni=1e3,oi,ii,si=0,ri=0,ai=0,li=typeof performance==="object"&&performance.now?performance:Date,ci=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function di(){return ri||(ci(fi),ri=li.now()+ai)}function fi(){ri=0}function pi(){this._call=this._time=this._next=null}pi.prototype=ui.prototype={constructor:pi,restart:function(e,t,n){if(typeof e!=="function")throw new TypeError("callback is not a function");n=(n==null?di():+n)+(t==null?0:+t);if(!this._next&&ii!==this){if(ii)ii._next=this;else oi=this;ii=this}this._call=e;this._time=n;yi()},stop:function(){if(this._call){this._call=null;this._time=Infinity;yi()}}};function ui(e,t,n){var o=new pi;o.restart(e,t,n);return o}function hi(){di();++Qo;var e=oi,t;while(e){if((t=ri-e._time)>=0)e._call.call(undefined,t);e=e._next}--Qo}function mi(){ri=(si=li.now())+ai;Qo=ei=0;try{hi()}finally{Qo=0;bi();ri=0}}function gi(){var e=li.now(),t=e-si;if(t>ni)ai-=t,si=e}function bi(){var e,t=oi,n,o=Infinity;while(t){if(t._call){if(o>t._time)o=t._time;e=t,t=t._next}else{n=t._next,t._next=null;t=e?e._next=n:oi=n}}ii=e;yi(o)}function yi(e){if(Qo)return;if(ei)ei=clearTimeout(ei);var t=e-ri;if(t>24){if(e<Infinity)ei=setTimeout(mi,e-li.now()-ai);if(ti)ti=clearInterval(ti)}else{if(!ti)si=li.now(),ti=setInterval(gi,ni);Qo=1,ci(mi)}}function vi(e,t,n){var o=new pi;t=t==null?0:+t;o.restart((n=>{o.stop();e(n+t)}),t,n);return o}var wi=Wo("start","end","cancel","interrupt");var xi=[];var _i=0;var ki=1;var ji=2;var Ni=3;var Si=4;var Ai=5;var Ci=6;function Ei(e,t,n,o,i,s){var r=e.__transition;if(!r)e.__transition={};else if(n in r)return;Ti(e,n,{name:t,index:o,group:i,on:wi,tween:xi,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:_i})}function Oi(e,t){var n=Ii(e,t);if(n.state>_i)throw new Error("too late; already scheduled");return n}function Mi(e,t){var n=Ii(e,t);if(n.state>Ni)throw new Error("too late; already running");return n}function Ii(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ti(e,t,n){var o=e.__transition,i;o[t]=n;n.timer=ui(s,0,n.time);function s(e){n.state=ki;n.timer.restart(r,n.delay,n.time);if(n.delay<=e)r(e-n.delay)}function r(s){var c,d,f,p;if(n.state!==ki)return l();for(c in o){p=o[c];if(p.name!==n.name)continue;if(p.state===Ni)return vi(r);if(p.state===Si){p.state=Ci;p.timer.stop();p.on.call("interrupt",e,e.__data__,p.index,p.group);delete o[c]}else if(+c<t){p.state=Ci;p.timer.stop();p.on.call("cancel",e,e.__data__,p.index,p.group);delete o[c]}}vi((function(){if(n.state===Ni){n.state=Si;n.timer.restart(a,n.delay,n.time);a(s)}}));n.state=ji;n.on.call("start",e,e.__data__,n.index,n.group);if(n.state!==ji)return;n.state=Ni;i=new Array(f=n.tween.length);for(c=0,d=-1;c<f;++c){if(p=n.tween[c].value.call(e,e.__data__,n.index,n.group)){i[++d]=p}}i.length=d+1}function a(t){var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=Ai,1),s=-1,r=i.length;while(++s<r){i[s].call(e,o)}if(n.state===Ai){n.on.call("end",e,e.__data__,n.index,n.group);l()}}function l(){n.state=Ci;n.timer.stop();delete o[t];for(var i in o)return;delete e.__transition}}function Ri(e,t){var n=e.__transition,o,i,s=true,r;if(!n)return;t=t==null?null:t+"";for(r in n){if((o=n[r]).name!==t){s=false;continue}i=o.state>ji&&o.state<Ai;o.state=Ci;o.timer.stop();o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group);delete n[r]}if(s)delete e.__transition}function Li(e){return this.each((function(){Ri(this,e)}))}function $i(e,t){var n,o;return function(){var i=Mi(this,e),s=i.tween;if(s!==n){o=n=s;for(var r=0,a=o.length;r<a;++r){if(o[r].name===t){o=o.slice();o.splice(r,1);break}}}i.tween=o}}function zi(e,t,n){var o,i;if(typeof n!=="function")throw new Error;return function(){var s=Mi(this,e),r=s.tween;if(r!==o){i=(o=r).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l){if(i[l].name===t){i[l]=a;break}}if(l===c)i.push(a)}s.tween=i}}function Pi(e,t){var n=this._id;e+="";if(arguments.length<2){var o=Ii(this.node(),n).tween;for(var i=0,s=o.length,r;i<s;++i){if((r=o[i]).name===e){return r.value}}return null}return this.each((t==null?$i:zi)(n,e,t))}function Di(e,t,n){var o=e._id;e.each((function(){var e=Mi(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}));return function(e){return Ii(e,o).value[t]}}function Ui(e,t){var n;return(typeof t==="number"?Fn:t instanceof Wt?Ln:(n=Wt(t))?(t=n,Ln):Wn)(e,t)}function Bi(e){return function(){this.removeAttribute(e)}}function Fi(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qi(e,t,n){var o,i=n+"",s;return function(){var r=this.getAttribute(e);return r===i?null:r===o?s:s=t(o=r,n)}}function Hi(e,t,n){var o,i=n+"",s;return function(){var r=this.getAttributeNS(e.space,e.local);return r===i?null:r===o?s:s=t(o=r,n)}}function Gi(e,t,n){var o,i,s;return function(){var r,a=n(this),l;if(a==null)return void this.removeAttribute(e);r=this.getAttribute(e);l=a+"";return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function Ji(e,t,n){var o,i,s;return function(){var r,a=n(this),l;if(a==null)return void this.removeAttributeNS(e.space,e.local);r=this.getAttributeNS(e.space,e.local);l=a+"";return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function Vi(e,t){var n=r(e),o=n==="transform"?so:Ui;return this.attrTween(e,typeof t==="function"?(n.local?Ji:Gi)(n,o,Di(this,"attr."+e,t)):t==null?(n.local?Fi:Bi)(n):(n.local?Hi:qi)(n,o,t))}function Wi(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Xi(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yi(e,t){var n,o;function i(){var i=t.apply(this,arguments);if(i!==o)n=(o=i)&&Xi(e,i);return n}i._value=t;return i}function Zi(e,t){var n,o;function i(){var i=t.apply(this,arguments);if(i!==o)n=(o=i)&&Wi(e,i);return n}i._value=t;return i}function Ki(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=="function")throw new Error;var o=r(e);return this.tween(n,(o.local?Yi:Zi)(o,t))}function Qi(e,t){return function(){Oi(this,e).delay=+t.apply(this,arguments)}}function es(e,t){return t=+t,function(){Oi(this,e).delay=t}}function ts(e){var t=this._id;return arguments.length?this.each((typeof e==="function"?Qi:es)(t,e)):Ii(this.node(),t).delay}function ns(e,t){return function(){Mi(this,e).duration=+t.apply(this,arguments)}}function os(e,t){return t=+t,function(){Mi(this,e).duration=t}}function is(e){var t=this._id;return arguments.length?this.each((typeof e==="function"?ns:os)(t,e)):Ii(this.node(),t).duration}function ss(e,t){if(typeof t!=="function")throw new Error;return function(){Mi(this,e).ease=t}}function rs(e){var t=this._id;return arguments.length?this.each(ss(t,e)):Ii(this.node(),t).ease}function as(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=="function")throw new Error;Mi(this,e).ease=n}}function ls(e){if(typeof e!=="function")throw new Error;return this.each(as(this._id,e))}function cs(e){if(typeof e!=="function")e=y(e);for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i){for(var s=t[i],r=s.length,a=o[i]=[],l,c=0;c<r;++c){if((l=s[c])&&e.call(l,l.__data__,c,s)){a.push(l)}}}return new Ps(o,this._parents,this._name,this._id)}function ds(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,s=Math.min(o,i),r=new Array(o),a=0;a<s;++a){for(var l=t[a],c=n[a],d=l.length,f=r[a]=new Array(d),p,u=0;u<d;++u){if(p=l[u]||c[u]){f[u]=p}}}for(;a<o;++a){r[a]=t[a]}return new Ps(r,this._parents,this._name,this._id)}function fs(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");if(t>=0)e=e.slice(0,t);return!e||e==="start"}))}function ps(e,t,n){var o,i,s=fs(t)?Oi:Mi;return function(){var r=s(this,e),a=r.on;if(a!==o)(i=(o=a).copy()).on(t,n);r.on=i}}function us(e,t){var n=this._id;return arguments.length<2?Ii(this.node(),n).on.on(e):this.each(ps(n,e,t))}function hs(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;if(t)t.removeChild(this)}}function ms(){return this.on("end.remove",hs(this._id))}function gs(e){var t=this._name,n=this._id;if(typeof e!=="function")e=f(e);for(var o=this._groups,i=o.length,s=new Array(i),r=0;r<i;++r){for(var a=o[r],l=a.length,c=s[r]=new Array(l),d,p,u=0;u<l;++u){if((d=a[u])&&(p=e.call(d,d.__data__,u,a))){if("__data__"in d)p.__data__=d.__data__;c[u]=p;Ei(c[u],t,n,u,c,Ii(d,n))}}}return new Ps(s,this._parents,t,n)}function bs(e){var t=this._name,n=this._id;if(typeof e!=="function")e=m(e);for(var o=this._groups,i=o.length,s=[],r=[],a=0;a<i;++a){for(var l=o[a],c=l.length,d,f=0;f<c;++f){if(d=l[f]){for(var p=e.call(d,d.__data__,f,l),u,h=Ii(d,n),g=0,b=p.length;g<b;++g){if(u=p[g]){Ei(u,t,n,g,p,h)}}s.push(p);r.push(d)}}}return new Ps(s,r,t,n)}var ys=tt.prototype.constructor;function vs(){return new ys(this._groups,this._parents)}function ws(e,t){var n,o,i;return function(){var s=le(this,e),r=(this.style.removeProperty(e),le(this,e));return s===r?null:s===n&&r===o?i:i=t(n=s,o=r)}}function xs(e){return function(){this.style.removeProperty(e)}}function _s(e,t,n){var o,i=n+"",s;return function(){var r=le(this,e);return r===i?null:r===o?s:s=t(o=r,n)}}function ks(e,t,n){var o,i,s;return function(){var r=le(this,e),a=n(this),l=a+"";if(a==null)l=a=(this.style.removeProperty(e),le(this,e));return r===l?null:r===o&&l===i?s:(i=l,s=t(o=r,a))}}function js(e,t){var n,o,i,s="style."+t,r="end."+s,a;return function(){var l=Mi(this,e),c=l.on,d=l.value[s]==null?a||(a=xs(t)):undefined;if(c!==n||i!==d)(o=(n=c).copy()).on(r,i=d);l.on=o}}function Ns(e,t,n){var o=(e+="")==="transform"?io:Ui;return t==null?this.styleTween(e,ws(e,o)).on("end.style."+e,xs(e)):typeof t==="function"?this.styleTween(e,ks(e,o,Di(this,"style."+e,t))).each(js(this._id,e)):this.styleTween(e,_s(e,o,t),n).on("end.style."+e,null)}function Ss(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function As(e,t,n){var o,i;function s(){var s=t.apply(this,arguments);if(s!==i)o=(i=s)&&Ss(e,s,n);return o}s._value=t;return s}function Cs(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!=="function")throw new Error;return this.tween(o,As(e,t,n==null?"":n))}function Es(e){return function(){this.textContent=e}}function Os(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Ms(e){return this.tween("text",typeof e==="function"?Os(Di(this,"text",e)):Es(e==null?"":e+""))}function Is(e){return function(t){this.textContent=e.call(this,t)}}function Ts(e){var t,n;function o(){var o=e.apply(this,arguments);if(o!==n)t=(n=o)&&Is(o);return t}o._value=e;return o}function Rs(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=="function")throw new Error;return this.tween(t,Ts(e))}function Ls(){var e=this._name,t=this._id,n=Ds();for(var o=this._groups,i=o.length,s=0;s<i;++s){for(var r=o[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){var d=Ii(l,t);Ei(l,e,n,c,r,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}}}return new Ps(o,this._parents,e,n)}function $s(){var e,t,n=this,o=n._id,i=n.size();return new Promise((function(s,r){var a={value:r},l={value:function(){if(--i===0)s()}};n.each((function(){var n=Mi(this,o),i=n.on;if(i!==e){t=(e=i).copy();t._.cancel.push(a);t._.interrupt.push(a);t._.end.push(l)}n.on=t}));if(i===0)s()}))}var zs=0;function Ps(e,t,n,o){this._groups=e;this._parents=t;this._name=n;this._id=o}function Ds(){return++zs}var Us=tt.prototype;Ps.prototype={constructor:Ps,select:gs,selectAll:bs,selectChild:Us.selectChild,selectChildren:Us.selectChildren,filter:cs,merge:ds,selection:vs,transition:Ls,call:Us.call,nodes:Us.nodes,node:Us.node,size:Us.size,empty:Us.empty,each:Us.each,on:us,attr:Vi,attrTween:Ki,style:Ns,styleTween:Cs,text:Ms,textTween:Rs,remove:ms,tween:Pi,delay:ts,duration:is,ease:rs,easeVarying:ls,end:$s,[Symbol.iterator]:Us[Symbol.iterator]};function Bs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Fs={time:null,delay:0,duration:250,ease:Bs};function qs(e,t){var n;while(!(n=e.__transition)||!(n=n[t])){if(!(e=e.parentNode)){throw new Error(`transition ${t} not found`)}}return n}function Hs(e){var t,n;if(e instanceof Ps){t=e._id,e=e._name}else{t=Ds(),(n=Fs).time=di(),e=e==null?null:e+""}for(var o=this._groups,i=o.length,s=0;s<i;++s){for(var r=o[s],a=r.length,l,c=0;c<a;++c){if(l=r[c]){Ei(l,e,t,c,r,n||qs(l,t))}}}return new Ps(o,this._parents,e,t)}tt.prototype.interrupt=Li;tt.prototype.transition=Hs;function Gs(e){var t=0,n=e.children,o=n&&n.length;if(!o)t=1;else while(--o>=0)t+=n[o].value;e.value=t}function Js(){return this.eachAfter(Gs)}function Vs(e,t){let n=-1;for(const o of this){e.call(t,o,++n,this)}return this}function Ws(e,t){var n=this,o=[n],i,s,r=-1;while(n=o.pop()){e.call(t,n,++r,this);if(i=n.children){for(s=i.length-1;s>=0;--s){o.push(i[s])}}}return this}function Xs(e,t){var n=this,o=[n],i=[],s,r,a,l=-1;while(n=o.pop()){i.push(n);if(s=n.children){for(r=0,a=s.length;r<a;++r){o.push(s[r])}}}while(n=i.pop()){e.call(t,n,++l,this)}return this}function Ys(e,t){let n=-1;for(const o of this){if(e.call(t,o,++n,this)){return o}}}function Zs(e){return this.eachAfter((function(t){var n=+e(t.data)||0,o=t.children,i=o&&o.length;while(--i>=0)n+=o[i].value;t.value=n}))}function Ks(e){return this.eachBefore((function(t){if(t.children){t.children.sort(e)}}))}function Qs(e){var t=this,n=er(t,e),o=[t];while(t!==n){t=t.parent;o.push(t)}var i=o.length;while(e!==n){o.splice(i,0,e);e=e.parent}return o}function er(e,t){if(e===t)return e;var n=e.ancestors(),o=t.ancestors(),i=null;e=n.pop();t=o.pop();while(e===t){i=e;e=n.pop();t=o.pop()}return i}function tr(){var e=this,t=[e];while(e=e.parent){t.push(e)}return t}function nr(){return Array.from(this)}function or(){var e=[];this.eachBefore((function(t){if(!t.children){e.push(t)}}));return e}function ir(){var e=this,t=[];e.each((function(n){if(n!==e){t.push({source:n.parent,target:n})}}));return t}function*sr(){var e=this,t,n=[e],o,i,s;do{t=n.reverse(),n=[];while(e=t.pop()){yield e;if(o=e.children){for(i=0,s=o.length;i<s;++i){n.push(o[i])}}}}while(n.length)}function rr(e,t){if(e instanceof Map){e=[undefined,e];if(t===undefined)t=cr}else if(t===undefined){t=lr}var n=new pr(e),o,i=[n],s,r,a,l;while(o=i.pop()){if((r=t(o.data))&&(l=(r=Array.from(r)).length)){o.children=r;for(a=l-1;a>=0;--a){i.push(s=r[a]=new pr(r[a]));s.parent=o;s.depth=o.depth+1}}}return n.eachBefore(fr)}function ar(){return rr(this).eachBefore(dr)}function lr(e){return e.children}function cr(e){return Array.isArray(e)?e[1]:null}function dr(e){if(e.data.value!==undefined)e.value=e.data.value;e.data=e.data.data}function fr(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function pr(e){this.data=e;this.depth=this.height=0;this.parent=null}pr.prototype=rr.prototype={constructor:pr,count:Js,each:Vs,eachAfter:Xs,eachBefore:Ws,find:Ys,sum:Zs,sort:Ks,path:Qs,ancestors:tr,descendants:nr,leaves:or,links:ir,copy:ar,[Symbol.iterator]:sr};function ur(e){return e==null?null:hr(e)}function hr(e){if(typeof e!=="function")throw new Error;return e}var mr={depth:-1},gr={},br={};function yr(e){return e.id}function vr(e){return e.parentId}function wr(){var e=yr,t=vr,n;function o(o){var i=Array.from(o),s=e,r=t,a,l,c,d,f,p,u,h,m=new Map;if(n!=null){const e=i.map(((e,t)=>xr(n(e,t,o))));const t=e.map(_r);const a=new Set(e).add("");for(const n of t){if(!a.has(n)){a.add(n);e.push(n);t.push(_r(n));i.push(br)}}s=(t,n)=>e[n];r=(e,n)=>t[n]}for(c=0,a=i.length;c<a;++c){l=i[c],p=i[c]=new pr(l);if((u=s(l,c,o))!=null&&(u+="")){h=p.id=u;m.set(h,m.has(h)?gr:p)}if((u=r(l,c,o))!=null&&(u+="")){p.parent=u}}for(c=0;c<a;++c){p=i[c];if(u=p.parent){f=m.get(u);if(!f)throw new Error("missing: "+u);if(f===gr)throw new Error("ambiguous: "+u);if(f.children)f.children.push(p);else f.children=[p];p.parent=f}else{if(d)throw new Error("multiple roots");d=p}}if(!d)throw new Error("no root");if(n!=null){while(d.data===br&&d.children.length===1){d=d.children[0],--a}for(let e=i.length-1;e>=0;--e){p=i[e];if(p.data!==br)break;p.data=null}}d.parent=mr;d.eachBefore((function(e){e.depth=e.parent.depth+1;--a})).eachBefore(fr);d.parent=null;if(a>0)throw new Error("cycle");return d}o.id=function(t){return arguments.length?(e=ur(t),o):e};o.parentId=function(e){return arguments.length?(t=ur(e),o):t};o.path=function(e){return arguments.length?(n=ur(e),o):n};return o}function xr(e){e=`${e}`;let t=e.length;if(kr(e,t-1)&&!kr(e,t-2))e=e.slice(0,-1);return e[0]==="/"?e:`/${e}`}function _r(e){let t=e.length;if(t<2)return"";while(--t>1)if(kr(e,t))break;return e.slice(0,t)}function kr(e,t){if(e[t]==="/"){let n=0;while(t>0&&e[--t]==="\\")++n;if((n&1)===0)return true}return false}function jr(e){var t=e.length/6|0,n=new Array(t),o=0;while(o<t)n[o]="#"+e.slice(o*6,++o*6);return n}var Nr=jr("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var Sr=jr("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var Ar=jr("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");ao(Nn(-100,.75,.35),Nn(80,1.5,.8));ao(Nn(260,.75,.35),Nn(80,1.5,.8));var Cr=Nn();function Er(e){if(e<0||e>1)e-=Math.floor(e);var t=Math.abs(e-.5);Cr.h=360*e-100;Cr.s=1.5-1.5*t;Cr.l=.8-.9*t;return Cr+""}function Or(e,t,n){this.k=e;this.x=t;this.y=n}Or.prototype={constructor:Or,scale:function(e){return e===1?this:new Or(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Or(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Mr=new Or(1,0,0);Or.prototype;const Ir=Kt("#8AB1D4").darker();const Tr=Kt("#aaa").darker().darker();const Rr="#4F8053";const Lr="#ce768e";const $r=true;const zr=false;const Pr=1;const Dr=2;const Ur=3;const Br=4;const Fr=5;const qr=6;const Hr=7;const Gr=8;const Jr=9;const Vr=10;const Wr=11;const Xr={[Pr]:"SNV/indel",[Dr]:"Fusion RNA",[Br]:"CNV",[Fr]:"SV",[qr]:"ITD",[Hr]:"Deletion",[Gr]:"N-loss",[Jr]:"C-loss",[Vr]:"LOH",[Ur]:"Gene Expression",[Wr]:"Metabolite Intensity"};const Yr={M:{label:"MISSENSE",color:"#3987CC",dt:Pr,desc:"A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",key:"M"},E:{label:"EXON",color:"#bcbd22",dt:Pr,desc:"A variant in the exon of a non-coding RNA.",key:"E"},F:{label:"FRAMESHIFT",color:"#db3d3d",dt:Pr,desc:"A sequence variant which causes a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three",key:"F"},N:{label:"NONSENSE",color:"#ff7f0e",dt:Pr,desc:"A sequence variant whereby at least one base of a codon is changed, resulting in a premature stop codon, leading to a shortened transcript",key:"N"},S:{label:"SILENT",color:"#2ca02c",dt:Pr,desc:"A sequence variant where there is no resulting change to the encoded amino acid",key:"S"},D:{label:"PROTEINDEL",color:"#7f7f7f",dt:Pr,desc:"An inframe non synonymous variant that deletes bases from the coding sequence",key:"D"},I:{label:"PROTEININS",color:"#8c564b",dt:Pr,desc:"An inframe non synonymous variant that inserts bases into in the coding sequence",key:"I"},ProteinAltering:{label:"PROTEINALTERING",color:"#b3523e",dt:Pr,desc:"An inframe complex change to the coding sequence",key:"ProteinAltering"},P:{label:"SPLICE_REGION",color:"#9467bd",dt:Pr,desc:"A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron",key:"P"},L:{label:"SPLICE",color:"#6633FF",dt:Pr,desc:"A variant near an exon edge that may affect splicing functionality",key:"L"},Intron:{label:"INTRON",color:"#656565",dt:Pr,desc:"An intronic variant.",key:"Intron"},Blank:{label:"Not tested",color:"#fff",dt:Pr,desc:"This gene is not tested.",key:"Blank"},WT:{label:"Wildtype",color:"#D3D3D3",dt:Pr,desc:"Wildtype",key:"WT"}};const Zr="ITD";Yr[Zr]={label:"ITD",color:"#ff70ff",dt:qr,desc:"In-frame internal tandem duplication.",key:Zr};const Kr="DEL";Yr[Kr]={label:"DELETION, intragenic",color:"#858585",dt:Hr,desc:"Intragenic deletion.",key:Kr};const Qr="NLOSS";Yr[Qr]={label:"N-terminus loss",color:"#545454",dt:Gr,desc:"N-terminus loss due to translocation",key:Qr};const ea="CLOSS";Yr[ea]={label:"C-terminus loss",color:"#545454",dt:Jr,desc:"C-terminus loss due to translocation",key:ea};const ta="Utr3";Yr[ta]={label:"UTR_3",color:"#998199",dt:Pr,desc:"A variant in the 3' untranslated region.",key:ta};const na="Utr5";Yr[na]={label:"UTR_5",color:"#819981",dt:Pr,desc:"A variant in the 5' untranslated region.",key:na};const oa="X";Yr[oa]={label:"NONSTANDARD",color:"black",dt:Pr,desc:"A mutation class that either does not match our notation, or is unspecified.",key:oa};const ia="noncoding";Yr[ia]={label:"NONCODING",color:"black",dt:Pr,desc:"Noncoding mutation.",key:ia};function sa(e){switch(e.toLowerCase()){case"missense_mutation":return"M";case"nonsense_mutation":return"N";case"splice_site":return"L";case"rna":return ia;case"frame_shift_del":return"F";case"frame_shift_ins":return"F";case"in_frame_del":return"D";case"in_frame_ins":return"I";case"protein_altering_variant":return"ProteinAltering";case"translation_start_site":return oa;case"nonstop_mutation":return"N";case"3'utr":return ta;case"3'flank":return ia;case"5'utr":return na;case"5'flank":return ia;case"blank":return"Blank";default:return null}}const ra="Fuserna";Yr[ra]={label:"Fusion transcript",color:"#545454",dt:Dr,desc:"Marks the break points leading to fusion transcripts.<br>"+"<span style=\"font-size:150%\">◐</span> - 3' end of the break point is fused to the 5' end of another break point in a different gene.<br>"+"<span style=\"font-size:150%\">◑</span> - 5' end of the break point is fused to the 3' end of another break point in a different gene.",key:ra};const aa="SV";Yr[aa]={label:"Structural variation",color:"#858585",dt:Fr,desc:"Structural variation detected in genomic DNA.",key:aa};const la="CNV_amp";Yr[la]={label:"Copy number gain",color:"#e9a3c9",dt:Br,desc:"Copy number gain",key:la};const ca="CNV_loss";Yr[ca]={label:"Copy number loss",color:"#a1d76a",dt:Br,desc:"Copy number loss",key:ca};const da="CNV_loh";Yr[da]={label:"LOH",color:"#12EDFC",dt:Br,desc:"Loss of heterozygosity",key:da};const fa="snv";Yr[fa]={label:"SNV",color:"#92a2d4",dt:Pr,desc:"Single nucleotide variation",key:fa};const pa="mnv";Yr[pa]={label:"MNV",color:"#92a2d4",dt:Pr,desc:"Multiple nucleotide variation",key:pa};const ua="insertion";Yr[ua]={label:"Sequence insertion",color:"#bd8e91",dt:Pr,desc:"Sequence insertion",key:ua};const ha="deletion";Yr[ha]={label:"Sequence deletion",color:"#b5a174",dt:Pr,desc:"Sequence deletion",key:ha};const ma={[Pr]:Yr.M.color};function ga(e={}){if(e.mclass){for(const t in e.mclass){if(!Yr[t])Yr[t]={};for(const n in e.mclass[t]){Yr[t][n]=e.mclass[t][n]}}}}const ba=function(e){const t=e.toLowerCase().split(",");let n=1;if(t.indexOf("transcript_ablation")!=-1){return[Hr,Kr,n]}n++;if(t.indexOf("splice_acceptor_variant")!=-1)return[Pr,"L",n];n++;if(t.indexOf("splice_donor_variant")!=-1)return[Pr,"L",n];n++;if(t.indexOf("stop_gained")!=-1)return[Pr,"N",n];n++;if(t.indexOf("frameshift_variant")!=-1)return[Pr,"F",n];n++;if(t.indexOf("stop_lost")!=-1)return[Pr,"N",n];n++;if(t.indexOf("start_lost")!=-1)return[Pr,"N",n];n++;if(t.indexOf("transcript_amplification")!=-1){return[Pr,oa,n]}n++;if(t.indexOf("inframe_insertion")!=-1||t.indexOf("conservative_inframe_insertion")!=-1||t.indexOf("disruptive_inframe_insertion")!=-1)return[Pr,"I",n];n++;if(t.indexOf("inframe_deletion")!=-1||t.indexOf("conservative_inframe_deletion")!=-1||t.indexOf("disruptive_inframe_deletion")!=-1)return[Pr,"D",n];n++;if(t.indexOf("missense_variant")!=-1)return[Pr,"M",n];n++;if(t.indexOf("protein_altering_variant")!=-1)return[Pr,"ProteinAltering",n];n++;if(t.indexOf("splice_region_variant")!=-1)return[Pr,"P",n];n++;if(t.indexOf("incomplete_terminal_codon_variant")!=-1)return[Pr,"N",n];n++;if(t.indexOf("stop_retained_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("synonymous_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("coding_sequence_variant")!=-1)return[Pr,oa,n];n++;if(t.indexOf("mature_mirna_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("5_prime_utr_variant")!=-1)return[Pr,na,n];n++;if(t.indexOf("3_prime_utr_variant")!=-1)return[Pr,ta,n];n++;if(t.indexOf("non_coding_transcript_exon_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("intron_variant")!=-1)return[Pr,"Intron",n];n++;if(t.indexOf("nmd_transcript_variant")!=-1)return[Pr,"S",n];n++;if(t.indexOf("non_coding_transcript_variant")!=-1)return[Pr,"E",n];n++;if(t.indexOf("upstream_gene_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("downstream_gene_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tfbs_ablation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tfbs_amplification")!=-1)return[Pr,ia,n];n++;if(t.indexOf("tf_binding_site_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_ablation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_amplification")!=-1)return[Pr,ia,n];n++;if(t.indexOf("feature_elongation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("regulatory_region_variant")!=-1)return[Pr,ia,n];n++;if(t.indexOf("feature_truncation")!=-1)return[Pr,ia,n];n++;if(t.indexOf("intergenic_variant")!=-1)return[Pr,ia,n];n++;return[Pr,oa,n]};const ya='<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="#858585" stroke="none"></path>';const va={};const wa="S";va[wa]={label:"Somatic",desc:"A variant found only in a tumor sample. The proportion is indicated by lack of any arc.",legend:'<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>'};const xa="G";va[xa]={label:"Germline",desc:"A constitutional variant found in a normal sample. The proportion is indicated by the span of the solid arc within the whole circle.",legend:ya};va.germline=va[xa];va.somatic=va[wa];const _a="R";va[_a]={label:"Relapse",desc:"A somatic variant found only in a relapse sample. The proportion is indicated by the span of the hollow arc within the whole circle.",legend:'<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="none" stroke="#858585"></path>'};const ka="GP";va[ka]={label:"Germline pathogenic",desc:"A constitutional variant with pathogenic allele.",legend:ya};const ja="GNP";va[ja]={label:"Germline non-pathogenic",desc:"A constitutional variant with non-pathogenic allele.",legend:ya,hidden:true};const Na={usegm:"usegm",ds:"dataset",bigwig:"bigwig",bigwigstranded:"bigwigstranded",junction:"junction",mdsjunction:"mdsjunction",mdscnv:"mdscnv",mdssvcnv:"mdssvcnv",mdsexpressionrank:"mdsexpressionrank",mdsvcf:"mdsvcf",bedj:"bedj",pgv:"profilegenevalue",bampile:"bampile",hicstraw:"hicstraw",expressionrank:"expressionrank",aicheck:"aicheck",ase:"ase",mds2:"mds2",mds3:"mds3",bedgraphdot:"bedgraphdot",bam:"bam",ld:"ld"};function Sa(e){for(const t in Na){if(e==Na[t]){return true}}return false}const Aa={vcf:"vcf"};const Ca={vcf:"vcf",svcnvitd:"svcnvitd",geneexpression:"geneexpression"};const Ea={GCT:"A",GCC:"A",GCA:"A",GCG:"A",CGT:"R",CGC:"R",CGA:"R",CGG:"R",AGA:"R",AGG:"R",AAT:"N",AAC:"N",GAT:"D",GAC:"D",TGT:"C",TGC:"C",CAA:"Q",CAG:"Q",GAA:"E",GAG:"E",GGT:"G",GGC:"G",GGA:"G",GGG:"G",CAT:"H",CAC:"H",ATT:"I",ATC:"I",ATA:"I",TTA:"L",TTG:"L",CTT:"L",CTC:"L",CTA:"L",CTG:"L",AAA:"K",AAG:"K",ATG:"M",TTT:"F",TTC:"F",CCT:"P",CCC:"P",CCA:"P",CCG:"P",TCT:"S",TCC:"S",TCA:"S",TCG:"S",AGT:"S",AGC:"S",ACT:"T",ACC:"T",ACA:"T",ACG:"T",TGG:"W",TAT:"Y",TAC:"Y",GTT:"V",GTC:"V",GTA:"V",GTG:"V"};const Oa="*";function Ma(e){if(!e.genomicseq)return undefined;const t=[];if(e.coding){for(const[n,o]of e.coding.entries()){const n=e.genomicseq.substr(o[0]-e.start,o[1]-o[0]);if(e.strand=="-"){t.push(La(n))}else{t.push(n)}}}const n=t.join("");const o=[];const i=e.startCodonFrame?3-e.startCodonFrame:0;for(let e=i;e<n.length;e+=3){const t=Ea[n.substr(e,3)];o.push(t||Oa)}e.cdseq=n;return o.join("")}function Ia(e,t){if(e>=1e9)return(e/1e9).toFixed(1)+" Gb";if(e>=1e7)return Math.ceil(e/1e6)+" Mb";if(e>=1e6)return(e/1e6).toFixed(1)+" Mb";if(e>=1e4)return Math.ceil(e/1e3)+" Kb";if(e>=1e3)return(e/1e3).toFixed(1)+" Kb";return e+(t?"bytes":" bp")}const Ta={A:"#ca0020",T:"#f4a582",C:"#92c5de",G:"#0571b0"};function Ra(e){switch(e){case"A":return"T";case"T":return"A";case"C":return"G";case"G":return"C";case"a":return"t";case"t":return"a";case"c":return"g";case"g":return"c";default:return e}}function La(e){const t=[];for(let n=e.length-1;n>=0;n--){t.push(Ra(e[n]))}return t.join("")}function $a(e,t){const n={chr:e.chr,start:e.start,stop:e.stop,strand:e.strand,coding:[]};if(t.isskipexon||t.isaltexon){for(let o=0;o<e.exon.length;o++){const i=Math.max(e.codingstart,e.exon[o][0]);const s=Math.min(e.codingstop,e.exon[o][1]);if(i>s){continue}if(t.skippedexon.indexOf(o)==-1){n.coding.push([i,s])}}}else if(t.a5ss||t.a3ss){const o=e.exon.map((e=>[e[0],e[1]]));const i=e.strand=="+";if(t.a5ss){if(i){o[t.exon5idx][1]=t.junctionB.start}else{o[t.exon5idx+1][0]=t.junctionB.stop}}else{if(i){o[t.exon5idx+1][0]=t.junctionB.stop}else{o[t.exon5idx][1]=t.junctionB.start}}for(const t of o){const o=Math.max(e.codingstart,t[0]);const i=Math.min(e.codingstop,t[1]);if(o>i){continue}n.coding.push([o,i])}}return n}function za(e,t){const n=t.split("\n");n.shift();e.genomicseq=n.join("").toUpperCase();const o=Ma(e);let i=zr;const s=o.indexOf(Oa);if(s==o.length-1){i=$r}return i}function Pa(e){if(!e.lst)return".lst missing";if(!Array.isArray(e.lst))return"input is not an array";for(const t of e.lst){if(!t.name)return"name missing from a set of .vcfinfofilter.lst";if(t.autocategory||t.categories){if(!t.autocategory){for(const e in t.categories){const n=t.categories[e];if(!t.autocolor&&!n.color)return".color missing for class "+e+" from .categories of set "+t.name;if(!n.label){n.label=e}}}if(t.categoryhidden){for(const e in t.categoryhidden){if(!t.categories[e])return"unknown hidden-by-default category "+e+" from set "+t.name}}else{t.categoryhidden={}}}else if(t.numericfilter){const e=[];for(const n of t.numericfilter){if(typeof n=="number"){e.push({side:"<",value:n})}else{e.push({side:n.side||"<",value:n.value})}}t.numericfilter=e}if(t.altalleleinfo){if(!t.altalleleinfo.key){return".key missing from .altalleleinfo from set "+t.name}}else if(t.locusinfo){if(!t.locusinfo.key){return".key missing from .locusinfo from set "+t.name}}else{return"neither .altalleleinfo or .locusinfo is available from set "+t.name}}}function Da(e,t){for(const n in e.majorchr){if(t.indexOf(n.replace("chr",""))!=-1){return true}}if(e.minorchr){for(const n in e.minorchr){if(t.indexOf(n.replace("chr",""))!=-1){return true}}}return false}function Ua(e,t){let n=0,o=0;for(const i in e.majorchr){if(t.includes(i)){o++}else if(t.includes(i.replace("chr",""))){n++}}if(e.minorchr){for(const i in e.minorchr){if(t.includes(i)){o++}else if(t.includes(i.replace("chr",""))){n++}}}return[n,o]}function Ba(e,t){if(e.length==0)return t;e.sort(((e,t)=>e-t));const n=e[e.length-1];if(e.length<=5)return n;const o=e[Math.floor(e.length/4)];const i=e[Math.floor(e.length*3/4)];return Math.min(i+(i-o)*1.5,n)}function Fa(e,t){if(!e)return false;if(e.indexOf("/")!=-1){return e.split("/").indexOf(t)!=-1}return e.split("|").indexOf(t)!=-1}const qa={genomic:"genomic",splicingrna:"splicing RNA",exononly:"exon only",protein:"protein",gmsum:"aggregated exons"};function Ha(e,t){if(e.csq){let n;if(t.usegm){n=e.csq.find((e=>e._isoform==t.usegm.isoform))}if(!n){n=e.csq.find((e=>e.CANONICAL));if(!n){n=e.csq[0];for(const t of e.csq){if(t._csqrank<n._csqrank){n=t}}}}if(n){e.gene=n._gene;e.isoform=n._isoform;e.class=n._class;e.dt=n._dt;e.mname=n._mname;if(e.class==ia){delete e.class}}}else if(e.ann){let n=null;if(t.usegm){for(const o of e.ann){if(o._isoform!=t.usegm.isoform)continue;if(n){if(o._csqrank<n._csqrank){n=o}}else{n=o}}if(!n&&t.gmmode==qa.genomic){n=e.ann[0]}}else{n=e.ann[0];for(const t of e.ann){if(t._csqrank<n._csqrank){n=t}}}if(n){e.gene=n._gene;e.isoform=n._isoform;e.class=n._class;e.dt=n._dt;e.mname=n._mname;if(e.class==ia){delete e.class}}}if(e.class==undefined){if(Yr[e.type]){e.class=e.type;e.dt=Yr[e.type].dt;e.mname=e.id&&e.id!="."?e.id:e.ref+">"+e.alt;if(e.mname.length>15){e.mname=e.type}}else{e.class=oa;e.dt=Pr;e.mname=e.type}}delete e.type}const Ga="Unannotated";function Ja(e,t){return function(n){return t.map((t=>[t,n.map((n=>e(t-n))).reduce(((e,t)=>e+t),0)/n.length]))}}function Va(e){return function(t){return Math.abs(t/=e)<=1?.75*(1-t*t)/e:0}}const Wa=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];const Xa=["#e75480","blue"];function Ya(e){if(e>20){const t=[];for(let n=0;n<e;n++)t.push(Er(n/e));return t}if(e>12)return Wa;else if(e>8)return Ar;else if(e>2)return Sr;else return Xa}function Za(e){const t=Ya(e);return At(t)}const Ka=["F","N","L","P"];const Qa=["F","N","L","P","D","I","ProteinAltering","M"];const el=["S","Intron","Utr3","Utr5","noncoding","E"];const tl=Object.values(Yr).filter((e=>e.dt==Pr)).map((e=>e.key));const nl=Object.values(Yr).filter((e=>e.dt==Br)).map((e=>e.key));var ol=Object.freeze({__proto__:null,defaultcolor:Ir,default_text_color:Tr,exoncolor:Rr,plotColor:Lr,IN_frame:$r,OUT_frame:zr,dtsnvindel:Pr,dtfusionrna:Dr,dtgeneexpression:Ur,dtcnv:Br,dtsv:Fr,dtitd:qr,dtdel:Hr,dtnloss:Gr,dtcloss:Jr,dtloh:Vr,dtmetaboliteintensity:Wr,dt2label:Xr,mclass:Yr,mclassitd:Zr,mclassdel:Kr,mclassnloss:Qr,mclasscloss:ea,mclassutr3:ta,mclassutr5:na,mclassnonstandard:oa,mclassnoncoding:ia,mclasstester:sa,mclassfusionrna:ra,mclasssv:aa,mclasscnvgain:la,mclasscnvloss:ca,mclasscnvloh:da,mclasssnv:fa,mclassmnv:pa,mclassinsertion:ua,mclassdeletion:ha,dt2color:ma,applyOverrides:ga,vepinfo:ba,germlinelegend:ya,morigin:va,moriginsomatic:wa,morigingermline:xa,moriginrelapse:_a,morigingermlinepathogenic:ka,morigingermlinenonpathogenic:ja,tkt:Na,validtkt:Sa,mdsvcftype:Aa,custommdstktype:Ca,codon:Ea,codon_stop:Oa,nt2aa:Ma,bplen:Ia,basecolor:Ta,basecompliment:Ra,reversecompliment:La,spliceeventchangegmexon:$a,fasta2gmframecheck:za,validate_vcfinfofilter:Pa,contigNameNoChr:Da,contigNameNoChr2:Ua,getMax_byiqr:Ba,alleleInGenotypeStr:Fa,gmmode:qa,vcfcopymclass:Ha,not_annotated:Ga,kernelDensityEstimator:Ja,kernelEpanechnikov:Va,schemeCategory20:Wa,schemeCategory2:Xa,getColorScheme:Ya,getColors:Za,truncatingMutations:Ka,proteinChangingMutations:Qa,synonymousMutations:el,mutationClasses:tl,CNVClasses:nl});let il=100;function sl(){return il}function rl(e){il=e}function al(e){return t=>{const n=new e(t);if(!n.api&&n.type){if(n.type=="app")bl(n,t);else if(n.type=="store")hl(n,t);else vl(n,t)}const o=n.api||n;if(n.debug||n.opts&&n.opts.debug)o.Inner=n;if(typeof n.preApiFreeze=="function")n.preApiFreeze(o);Object.freeze(o);if(n.init){return n.init().then((()=>{if(n.bus)n.bus.emit("postInit");return o})).catch((e=>{if(n.printError)n.printError(e);if(n.bus)n.bus.emit("postInit",null,0,e);else throw e}))}else{if(n.bus)n.bus.emit("postInit");return o}}}function ll(e){return fl(e,bl)}function cl(e){return fl(e,hl)}function dl(e){return fl(e,vl)}function fl(e,t){if(typeof t!="function")throw"prepFxn must be a function";return async n=>{let o;try{o=new e(n);t(o,n);const i=o.api||o;if(o.debug||o.opts&&o.opts.debug)i.Inner=o;if(o.preApiFreeze)await o.preApiFreeze(i);Object.freeze(i);if(o.init){if(o.app&&o.app!=o)await o.init(o.app.getState());else await o.init();if(o.type!="app"&&o.type!="store"&&o.state&&!o.hasStatePreMain){delete o.state;console.warn(`${o.type}: rx deleted this.state after init()`+`to avoid confusing behavior, such as the component not rendering initially `+`because this.state would not have changed between init() and the first time `+`main() is called. To skip this warning and retain this.state after init(), `+`set this.hasStatePreMain = true in the ${o.type} constructor.`)}}if(o.bus)o.bus.emit("postInit");return i}catch(e){console.log("error:",e);if(o&&o.bus)o.bus.emit("postInit",null,0,e);if(!o||!o.printError)throw e}}}function pl(e,t){const n=Object.assign({},t.opts||{},e);if(!t.app)return n;if(t.type in t.app.opts){const e=t.app.opts[t.type];if(t.validateOpts)t.validateOpts(e);jl(n,e)}if("debug"in t.app)n.debug=t.app.debug;else if(t.app.opts&&"debug"in t.app.opts)n.debug=t.app.opts.debug;return n}async function ul(e){const t={};try{await Promise.all(Object.values(e));for(const n in e){t[n]=await e[n]}return t}catch(e){throw e}}function hl(e,t){if(e.validateOpts)e.validateOpts(t);e.app=t.app;e.opts=pl(t,e);e.api=gl(e);e.copyMerge=jl;e.deepFreeze=Al;if(!e.fromJson)e.fromJson=Nl;if(!e.toJson)e.toJson=Sl;e.state=jl(e.toJson(e.defaultState),t.state);if(e.validateState)e.validateState()}let ml=0;function gl(e){e.history=[];e.currIndex=-1;let t=0;const n={async write(o){o.sequenceId=ml++;const i=e.constructor.prototype.actions;if(!i){throw`no store actions specified`}if(!i.hasOwnProperty(o.type)){throw`Action=${o.type} must be declared in an "actions" property of a class.`}if(typeof i[o.type]!=="function"){throw`invalid action type=${o.type}`}await i[o.type].call(e,o);e.state._scope_=o._scope_;if(!e.opts.debounceInterval)return n.copyState();t+=1;let s=-1;return new Promise(((o,i)=>{const r=setInterval((()=>{t+=s;s=0;if(t>0)return;clearInterval(r);o(n.copyState())}),e.opts.debounceInterval)}))},async copyState(){const t=e.fromJson(e.toJson(e.state));e.deepFreeze(t);return t}};return n}function bl(e,t){try{if(e.validateOpts)e.validateOpts(t);if("id"in t)e.id=t[e.type].id;e.opts=t;e.api=yl(e)}catch(t){console.error(t);if(e.printError)e.printError(t);else alert(t)}}function yl(e){const t={};const n=[];let o;const i={type:e.type,opts:e.opts,async dispatch(t){e.bus.emit("preDispatch");try{if(n.length){for(const e of n.slice()){const o=await e(t);if(o){if(o.cancel)return;if(o.error)throw o.error;if(o.deactivate){n.splice(n.indexOf(e),1)}}}}if(t)e.state=await e.store.write(t);o=t?.sequenceId;if(e.main)await e.main();const i={action:t,appState:e.state};await _l(i.action?._notificationRoot_||e.components,i)}catch(n){if(e.bus&&o==t?.sequenceId)e.bus.emit("error");if(e.printError)e.printError(n);else console.log(n)}if(e.bus&&o==t?.sequenceId)e.bus.emit("postRender")},async save(n){e.state=await e.store.write(n);if(t.recover){for(const n in t.recover){const o=t.recover[n];o.replaceLastState(e.state)}}},getState(){return e.state},middle(e){if(typeof e!=="function")throw`a middleware must be a function`;if(n.includes(e))throw`the function is already in the middlewares array`;n.push(e);return i},on(t,n){if(!e.eventTypes)throw`no eventTypes[] for ${e.type} component`;e.bus.on(t,n);return i},getComponents(t=""){return kl(e.components,t)},register(e){if(!t[e.type])t[e.type]={};t[e.type][e.id]=e},deregister(e){if(t[e.type]?.[e.id])delete t[e.type][e.id]},destroy(){for(const t in e.components){const n=e.components[t];if(typeof n.destroy=="function"){n.destroy()}else if(n.holder){n.holder.selectAll("*").remove()}delete e.components[t]}if(typeof e.destroy=="function")e.destroy();if(e.dom){if(e.dom.holder)e.dom.holder.selectAll("*").remove();for(const t in e.dom){delete e.dom[t]}}if(e.bus)e.bus.destroy();delete e.store;if(e.api)delete e.api;e.wasDestroyed=true}};if(e.opts.debugName)window[e.opts.debugName]=i;if(!e.bus){if(!e.eventTypes)e.eventTypes=["preDispatch","postInit","postRender","firstRender","error"];if(e.customEvents)e.eventTypes.push(...e.customEvents);const t=e.opts.app&&e.opts.app.callbacks||e.opts.callbacks||{};e.bus=new xl(i,e.eventTypes,t)}return i}function vl(e,t){if(!t.app)throw`missing self.opts.app in prepComponent(${e.type})`;e.app=t.app;e.opts=pl(t,e);if(e.validateOpts)e.validateOpts(t);if("id"in t)e.id=e.opts.id;e.api=wl(e)}function wl(e){if(!("type"in e)){throw`The component's type must be set before calling this.getComponentApi(this).`}let t;const n={type:e.type,id:e.id,async update(o){if(o.action&&e.reactsTo&&!e.reactsTo(o.action))return;const i=e.getState?e.getState(o.appState):o.appState;if(!i)return;if(!o.action||!Cl(i,e.state)){if(o.action)t=o.action.sequenceId;if(e.mainArg=="state"){await e.main(i)}else{e.state=i;if(e.main){try{await e.main()}catch(t){if(e.bus)e.bus.emit("error");throw t}}}}await _l(e.components,o);if(e.bus&&(!o.action||o.action.sequenceId===t))e.bus.emit("postRender");return n},on(t,o){if(!e.eventTypes)throw`no eventTypes[] for ${e.type} component`;e.bus.on(t,o);return n},getComponents(t=""){return kl(e.components,t)},async detectStale(e,n={}){try{const o=t;const i=[];let s,r;if(n.abortCtrl){i.push(new Promise(((e,i)=>{r=e;s=setInterval((()=>{if(o!==t){clearInterval(s);try{n.abortCtrl.abort();throw`stale sequenceId`}catch(e){i(e)}}}),n.wait||100)})))}i.push(e());const a=await Promise.race(i);if(s)clearInterval(s);if(r)r();if(t!==o){console.warn("aborted state update, the returned data corresponds to a stale action.sequenceId");if(n.abortCtrl)n.abortCtrl.abort();return[a,true]}return[a]}catch(e){if(typeof e=="string"&&e.includes("sequenceId"))console.warn(e);throw e}},destroy(){e.app.deregister(e.api);for(const t in e.components){const n=e.components[t];if(typeof n.destroy=="function"){n.destroy()}else if(n.holder){n.holder.selectAll("*").remove()}delete e.components[t]}if(typeof e.destroy=="function")e.destroy();if(e.dom){if(e.dom.holder)e.dom.holder.selectAll("*").remove();for(const t in e.dom){if(typeof e.dom[t]?.remove=="function")e.dom[t].remove();delete e.dom[t]}}if(e.bus)e.bus.destroy();if(e.api)delete e.api}};if(!e.bus){if(!e.eventTypes)e.eventTypes=["postInit","postRender","postPrintError","firstRender","error"];if(e.customEvents)e.eventTypes.push(...e.customEvents);e.bus=new xl(n,e.eventTypes,e.opts&&e.opts.callbacks||{})}return n}class xl{constructor(e,t,n){this.name=e.type+(e.id===undefined||e.id===null?"":"#"+e.id);this.eventTypes=t;this.events={};this.defaultArg=e;if(n){for(const e in n){this.on(e,n[e])}}}on(e,t,n={}){const[o,i]=e.split(".");if(!this.eventTypes.includes(o)){throw`Unknown bus event '${o}' for component ${this.name}`}else if(!t){delete this.events[e]}else if(typeof t=="function"){if(e in this.events&&!e.includes(".")){console.log(`Warning: replacing ${this.name} ${e} callback - use event.name?`)}this.events[e]=n.wait?e=>setTimeout((()=>t(e)),n.wait):t}else{throw`invalid callback for ${this.name} eventType=${e}`}return this}emit(e,t=null,n=0,o=null){setTimeout((()=>{for(const n in this.events){if(e=="postRender"&&n.startsWith("firstRender")){this.events[n](t||this.defaultArg,o);delete this.events[n]}if(n==e||n.startsWith(e+".")){this.events[n](t||this.defaultArg,o);if(e=="postInit")delete this.events[n]}}}),n);return this}destroy(){for(const e in this.events){delete this.events[e]}}}async function _l(e,t){if(!e)return;const n=[];for(const o in e){const i=e[o];if(Array.isArray(i)){for(const e of i)n.push(e.update(t))}else if(i.hasOwnProperty("update")){n.push(i.update(t))}else if(i&&typeof i=="object"&&!i.main){for(const e in i){if(i.hasOwnProperty(e)&&typeof i[e].update=="function"){n.push(i[e].update(t))}}}}return Promise.all(n)}function kl(e,t){if(!t)return Object.assign({},e);const n=t.split(".");let o=e;while(n.length){let e=n.shift();if(Array.isArray(o))e=Number(e);if(!n.length)o=o[e];else if(o[e]&&o[e].components)o=o[e].components;else if(o[e]&&o[e].getComponents)o=o[e].getComponents();else o=o[e];if(!o)break}return o}function jl(e,...t){const n=typeof e=="string"?Nl(e):e;for(const o of t){if(o){const t=typeof e=="string"?Nl(Sl(o)):o;for(const e in t){if(!n[e]||Array.isArray(n[e])||typeof n[e]!=="object"||t===null||t===undefined||t.isAtomic||n?.isAtomic||n[e]?.isAtomic)n[e]=t[e];else jl(n[e],t[e])}}}return n}function Nl(e){return JSON.parse(e)}function Sl(e=null){return JSON.stringify(e?e:this.state)}function Al(e){Object.freeze(e);for(const t in e){if(typeof e=="object")Al(e[t])}}function Cl(e,t){if(e===t){return true}else if(typeof e=="object"&&e!=null&&typeof t=="object"&&t!=null){if(Object.keys(e).length!=Object.keys(t).length){return false}for(var n in e){if(t.hasOwnProperty(n)){if(!Cl(e[n],t[n]))return false}else{return false}}return true}else return false}const El=["false","true","null","undefined"];const Ol=['"',"{","["];function Ml(e){const t=[];for(const[n,o]of Object.entries(e)){if(typeof o=="string"&&!Il(o)&&!El.includes(o)&&!Ol.includes(o[0])){t.push(`${n}=${encodeURIComponent(o)}`)}else if(o!==undefined){t.push(`${n}=${encodeURIComponent(JSON.stringify(o))}`)}}return t.join("&")}function Il(e){return!isNaN(parseFloat(e))&&isFinite(e)&&e!==""}const Tl=localStorage.getItem("jwtByDsRoute")||`{}`;const Rl=JSON.parse(Tl);function Ll(e,t,n=null){if(n&&typeof n=="object"){if(n.serverData&&typeof n.serverData=="object"){if(!Ll.serverData){Ll.serverData=n.serverData}else if(!n.serverData){n.serverData=Ll.serverData}}return Pl(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)},n)}else{if(e[0]=="/"){e=e.slice(1)}const n=sessionStorage.getItem("jwt");if(n){t.jwt=n}let o=e;const i=sessionStorage.getItem("hostURL")||window.testHost||"";if(i){if(i.endsWith("/")){o=i+e}else{o=i+"/"+e}}return fetch(new Request(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).then((e=>e.json()))}}const $l=[];const zl=360;function Pl(e,t={},n={}){if(e[0]=="/"){e=e.slice(1)}let o=e;const i=sessionStorage.getItem("hostURL")||window.testHost||"";if(i){if(i.endsWith("/")){o=i+e}else{o=i+"/"+e}}const s=t.body||{};o=ql(o,t);if(!t.headers){t.headers={}}if(!t.headers["content-type"]&&t.body){t.headers["content-type"]="application/json"}const r=sessionStorage.getItem("jwt");if(r){t.headers.authorization="Bearer "+r}return Zl(t,o).then((async()=>{if(!r)Ql(t,s,o);const e=o+" | "+t.method+" | "+t.body;if(n.serverData){let i;if(n.serverData[e]){i=n.serverData[e].clone?await Dl(n.serverData[e].clone()):structuredClone(n.serverData[e])}if(!i||typeof i!="object"||i instanceof Promise){delete n.serverData[e];i=undefined}if(!i){try{const s=await fetch(o,t);i=await Dl(s.clone());if(typeof i=="object"&&!(i instanceof Promise)){if(n.cacheAs=="decoded"){Al(i);n.serverData[e]=i;i=structuredClone(i)}else{n.serverData[e]=s}}}catch(t){delete n.serverData[e];throw t}}const s=$l.indexOf(e);if(s!==-1)$l.splice(s,1);$l.unshift(e);if($l.length>zl){const e=$l.pop();delete n.serverData[e]}return i}else{return fetch(o,t).then(Dl)}}))}function Dl(e){const t=e.headers.get("content-type");if(!t)throw`missing response.header['content-type']`;if(t.includes("/json")){return e.json()}if(t.includes("/text")){return e.text()}return e.blob()}const Ul={};function Bl(e,t={},n={}){n.serverData=Ul;return Pl(e,t,n)}const Fl=2e3;function ql(e,t){const n=window.location.hostname;const o=t.method&&t.method.toUpperCase()||"GET";if(o=="POST"){if(typeof t.body=="string")t.body=JSON.parse(t.body);if(!t.body.embedder&&Wl)t.body.embedder=n;t.body=JSON.stringify(t.body);return e}if(o!="GET"&&o!="DELETE"){throw`unsupported init.method='${o}': must be undefined or GET or POST or DELETE`}if(t.body){if(!t.body.embedder&&Wl)t.body.embedder=n;const o=Ml(t.body);if(!e.includes("?"))e+="?";e+=o}if(!e.includes("embedder=")&&Wl){const t=e.includes("?")?"&":"?";e+=`${t}embedder=${n}`}if(e.length<Fl){if(t.body)delete t.body;return e}t.method="POST";const[i,s]=e.split("?");if(t.body){t.body=JSON.stringify(t.body)}else{const e={};if(s)s.split("&").forEach((t=>{const[n,o]=t.split("=");const i=decodeURIComponent(o);try{e[n]=JSON.parse(i)}catch{e[n]=i}}));if(!e.embedder&&Wl)e.embedder=n;t.body=JSON.stringify(e)}return i}const Hl=new Set;let Gl,Jl,Vl,Wl=false;function Xl(e){Gl=e.dsAuth;Jl=e.ui||Kl;Vl=e.holder||ot("body");for(const e of Gl){if(e.insession)Hl.add(e)}Wl=e.dsAuth?.length>0||false}function Yl(e,t){return e&&[...Hl].find((n=>n.dslabel==e&&n.route==t))}async function Zl(e,t){const n={status:"ok"};if(!Gl)return n;for(const o of Gl){const i=JSON.parse(e.body||`{}`);const s=(t.split("?")[1]||"").split("&").reduce(((e,t)=>{const[n,o]=t.split("=");e[n]=o;return e}),{});const r=Object.assign({},i,s);const a=((t.split("?")[0]||"").split("//")[1]||"").split("/").slice(1).join("/");if(r.dslabel==o.dslabel&&(o.route=="/**"||a==o.route)){if(Hl.has(o))return n;else if(o.route!="/**")return n;else if(o.type=="basic")return await Jl(o.dslabel,o);else if(o.type=="jwt");else if(o.type=="forbidden"){alert("Forbidden access")}else throw`unsupported dsAuth type='${o.type}'`}}return n}async function Kl(e,t){const n=Vl.append("div").style("position","fixed").style("top",0).style("left",0).style("height","100%").style("width","100%").style("margin",0).style("padding","20px").style("background-color","rgb(150,150,150)");const o=n.append("div").style("opacity",1);o.append("div").html(`Restricted dataset '${e}'`);o.append("span").html("Please enter password ");const i=o.append("input").attr("type","password");i.node().focus();const s=o.append("button").html("Submit");return new Promise(((o,r)=>{function a(){fetch("/dslogin",{method:"POST",headers:{authorization:`Basic ${btoa(i.property("value"))}`},body:JSON.stringify({dslabel:e,route:t.route,embedder:window.location.hostname})}).then((e=>e.json())).then((i=>{if(i.error)throw i.error;n.remove();Hl.add(t);if(i.jwt){if(!Rl[e])Rl[e]={};Rl[e][i.route]=i.jwt;localStorage.setItem("jwtByDsRoute",JSON.stringify(Rl))}o(e)})).catch((e=>{alert("login error: "+e)}))}s.on("click",a);i.on("change",a)}))}function Ql(e,t,n){if(e.headers.authorization)return;let o=t?.dslabel;if(!o){const e=n.split("?")[1]?.split("&").find((e=>e.includes("dslabel")));if(!e)return;let t=decodeURIComponent(e.split("=")[1]);if(t.startsWith("{")&&t.endsWith("}")){t=JSON.parse(t);o=t.dslabel||t.mass?.vocab.dslabel||t.tracks?.find((e=>e.dslabel))?.dslabel}else{o=t}}if(!o||!Rl[o])return;const i=n.split("//");const s=(i[1]||i[0]).split("/").find((e=>e!="")).split("?")[0];const r=Rl[o][s]||Rl[o]["/**"];if(r)e.headers.authorization="Bearer "+btoa(r)}class ec{constructor(e={}){this.typename=Math.random().toString();const t=ot(document.body);this.d=t.append("div").attr("class","sja_menu_div").style("display","none").style("position","absolute").style("background-color","white").style("font-family","Arial").on("mousedown.menu"+this.typename,(e=>{const t=ot(e.target);if(t.on("mousedown")||t.on("click")||["INPUT","SELECT","TEXTAREA"].includes(e.target.tagName.toUpperCase())){e.stopPropagation()}})).on("keyup",(e=>{if(e.key=="Escape")this.hide()}));this.dnode=this.d.node();if(Object.values(this.d._groups[0]).length)this.dnode.parent_menu=e.parent_menu;t.on("mousedown.menu"+this.typename,(e=>{if(this.dnode.contains(e.target))return;if(e.target.parent_menu===this.dnode)return;const t=e.target.closest(".sja_menu_div");if(t&&t.parent_menu===this.dnode)return;this.hide()}));const n=sl();if(n){this.d.style("z-index",n+1)}this.d.style("padding","padding"in e?e.padding:"10px");if(e.border){this.d.style("border",e.border)}else{this.d.style("box-shadow","0px 2px 4px 1px #999")}this.offsetX=Number.isInteger(e.offsetX)?e.offsetX:20;this.offsetY=Number.isInteger(e.offsetY)?e.offsetY:20;this.hideXmute=Number.isInteger(e.hideXmute)?e.hideXmute:0;this.hideYmute=Number.isInteger(e.hideYmute)?e.hideYmute:0;this.prevX=-1;this.prevY=-1;this.clearSelector=e.clearSelector}clear(){if(this.clearSelector)this.d.select(this.clearSelector).selectAll("*").remove();else this.d.selectAll("*").remove();return this}show(e,t,n=true,o=true,i=true){let s=e;let r=t;this.prevX=e;this.prevY=t;document.body.appendChild(this.dnode);this.d.style("display","block");if(i){s=s+window.scrollX;r=r+window.scrollY}if(n){s=s+this.offsetX;r=r+this.offsetY}const a=window.innerWidth;const l=window.innerHeight;const c=a/2;const d=l/2;const f=this.dnode.getBoundingClientRect();if(a-s<c&&s+f.width>a)this.d.style("left",null).style("right",a-s+"px");else this.d.style("left",s+"px").style("right",null);if(!o&&l-r<d&&r-window.scrollY-f.height>0)this.d.style("top",null).style("bottom",l-r+"px");else this.d.style("top",r+"px").style("bottom",null);this.d.transition().style("opacity",1);return this}show2(e,t){let n=e;let o=t;this.prevX=e;this.prevY=t;document.body.appendChild(this.dnode);this.d.style("display","block");n=n+window.scrollX+this.offsetX;o=o+window.scrollY+this.offsetY;const i=window.innerWidth;const s=this.dnode.getBoundingClientRect();if(n+s.width>i)this.d.style("left","").style("right","5px");else this.d.style("left",n+"px").style("right","");this.d.style("top",o+"px").style("bottom","");this.d.transition().style("opacity",1);return this}showunder(e){const t=e.getBoundingClientRect();const n=t.left+window.scrollX;const o=t.top+t.height+window.scrollY+5;return this.show(n,o,false,true,false)}showunderoffset(e){const t=e.getBoundingClientRect();const n=t.top+t.height+window.scrollY+5;return this.show(t.left,n,true,true,false)}hide(e){if(e){if(Math.abs(this.prevX-e.clientX)<this.hideXmute&&Math.abs(this.prevY-e.clientY)<this.hideYmute)return}if(!this.fadeTimeout)this.d.style("display","none").style("opacity",0);if(this.onHide)this.onHide();return this}fadeout(){this.d.transition().style("opacity",0).on("end",(()=>this.d.style("display","none")));return this}confirm({html:e,timeout:t}){this.d.selectAll("*").remove();this.d.append("div").style("padding","5px").html(e);if(t)this.fadeTimeout=setTimeout((()=>{this.fadeout();delete this.fadeTimeout}),3e3)}toggle(){if(!this.hidden){this.hide();this.hidden=true}else{this.d.style("opacity",1).style("display","block");this.hidden=false}return this}getCustomApi(e={}){const t=Object.create(this);Object.assign(t,e);return t}destroy(){this.d.remove()}}function tc(e,t){if(!e.tracks)return;for(const n of e.tracks){if(n.__isgene){t.push(n);return}}}function nc(e){const t=e.holder.append("div").style("max-width","80vw");const n=t.append("table").style("margin","5px 8px").attr("class","sja_simpletable").attr("data-testid","sja_simpletable");return{scrollDiv:t,table:n,addRow:()=>{if(n.node().offsetHeight>500){t.style("height","450px").style("resize","both").style("overflow-y","scroll").attr("class","sjpp_show_scrollbar")}const e=n.append("tr");const o=e.append("td").style("padding","3px").style("color","#555");const i=e.append("td");return[o,i]}}}function oc(e,t,n){const o="#9e9e9e";const i=e.append("table").style("margin","5px 8px").style("font-size","inherit").attr("class","sja_simpletable");for(const e of t){const t=i.append("tr");if(e.kvlst){t.append("td").attr("rowspan",e.kvlst.length).style("padding","3px").style("color",o).html(e.k);t.append("td").style("padding","3px").style("color",o).html(e.kvlst[0].k);t.append("td").style("padding","3px").html(e.kvlst[0].v);for(let t=1;t<e.kvlst.length;t++){const n=i.append("tr");n.append("td").style("padding","3px").style("color",o).html(e.kvlst[t].k);n.append("td").style("padding","3px").html(e.kvlst[t].v)}}else{t.append("td").attr("colspan",2).style("padding","3px").style("color",o).html(e.k);const i=t.append("td").style("padding","3px");if(n&&e.v.length>n){i.html(e.v.substr(0,n-3)+" ...»").attr("class","sja_clbtext").on("click",(()=>{i.html(e.v).classed("sja_clbtext",false).on("click",null)}))}else{i.html(e.v)}}}return i}function ic(e,t,n){if(!n)n={};const o=n.width||40;const i=n.height||12;let s;if(e){e.attr("title",(t.f*100).toFixed(0)+"%"+(t.v1!=undefined?" ("+t.v1+"/"+t.v2+")":""));s=e.append("svg").attr("width",o).attr("height",i)}else{s=ot(document.body).append("svg")}let r=0;s.append("rect").attr("y",r).attr("width",o).attr("height",i).attr("fill",n.fillbg||"#CBE2F5");s.append("rect").attr("y",r).attr("width",o*t.f).attr("height",i).attr("fill",n.fill||"#69A1D1");if(n.readcountcredible&&t.v2<n.readcountcredible){const e="#545454";const t=.3;s.append("rect").attr("y",r).attr("width",o).attr("height",i).attr("fill",e).attr("fill-opacity",t)}if(e)return s;s.remove();return"<svg width="+o+" height="+i+">"+s.node().innerHTML+"</svg>"}const sc="Arial";const rc="Unspecified";const ac="green";const lc="#858585";const cc="#FCE3B8";const dc="#D2E2FC";const fc="red";const pc="#DE3336";const uc=.6;let hc=null;const mc=Na;const gc=qa;const bc=["#8dd3c7","#bebada","#fb8072","#80b1d3","#E8E89E","#a6d854","#fdb462","#ffd92f","#e5c494","#b3b3b3"];function yc(e,t){e.style("opacity",0).style("display",t||"block").transition().style("opacity",1)}function vc(e,t){e.style("opacity",1).transition().style("opacity",0).call((()=>{if(t){e.remove()}else{e.style("display","none").style("opacity",1)}}))}const wc=new ec({padding:""});wc.d.style("z-index",1e3);function xc(e,t){const n=e.append("div").attr("class","sja_errorbar");n.append("div").text(t);n.append("div").html("✕").on("click",(()=>{vc(n,true)}))}function _c(e){if(!e||!e.axis)return;if(!e.color){e.color="#545454"}e.axis.selectAll("line").attr("stroke",e.color).attr("shape-rendering","crispEdges");e.axis.selectAll("path").attr("fill","none").attr("stroke",e.showline?e.color:"none").attr("stroke-width",e.showline?1:0).attr("shape-rendering","crispEdges");e.axis.selectAll("text").style("cursor","default").attr("font-family",sc).attr("font-size",e.fontsize?e.fontsize+"px":"12px").attr("fill",e.color)}function kc(e){if(e.setzindex){hc=e.setzindex;rl(e.setzindex);return}const t=300;const n={};const o=ot(document.body);n.pane=o.append("div").attr("class","sja_pane").style("left",e.x+window.pageXOffset+"px").style("top",e.y+window.pageYOffset+"px").style("opacity",0);if(e.$id){n.pane.attr("id",e.$id)}if(hc){n.pane.style("z-index",hc)}n.pane.transition().duration(t).style("opacity",1);const i=n.pane.append("div").on("mousedown",(e=>{e.preventDefault();e.stopPropagation();const t=Number.parseInt(n.pane.style("left")),i=Number.parseInt(n.pane.style("top"));const s=e.clientX,r=e.clientY;o.on("mousemove",(e=>{n.pane.style("left",t+e.clientX-s+"px").style("top",i+e.clientY-r+"px")}));o.on("mouseup",(function(){o.on("mouseup",null).on("mousemove",null)}));document.body.appendChild(n.pane.node())}));const s=i.append("div").attr("class","sja_menuoption").style("display","inline-block").style("padding","4px 10px").style("margin","0px").style("border-right","solid 1px white").style("cursor","default").style("font-size","1.5em").on("mousedown",(e=>{document.body.dispatchEvent(new Event("mousedown"));e.stopPropagation()}));if(e.toshrink){n.mini=false;s.html("━").on("click",(()=>{s.html(n.mini?"━":"◽");if(n.mini){yc(n.body)}else{vc(n.body)}n.mini=!n.mini}))}else{s.html("×");if(e.close){s.on("click",e.close)}else if(e.closekeep){s.on("click",(()=>{n.pane.transition().duration(t).style("opacity",0).call((()=>n.pane.style("display","none")))}))}else{s.on("click",(()=>{n.pane.transition().duration(t).style("opacity",0).call((()=>n.pane.remove()))}))}}n.header=i.append("div").style("display","inline-block").style("font-family",sc).style("padding",e.headpad||"5px 10px");n.body=n.pane.append("div").style("font-family",sc);return n}function jc(e){if(!e.pdomains)return[];const t=new Map;for(const n of e.pdomains){const e=n.name+n.description;if(t.has(e)){t.get(e).start=Math.min(t.get(e).start,n.start)}else{t.set(e,{name:n.name,description:n.description,color:n.color,start:n.start,iscustom:n.iscustom,url:n.url,pmid:n.pmid,CDD:n.CDD,Pfam:n.Pfam,SMART:n.SMART,COG:n.COG,PRK:n.PRK,Curated_at_NCBI:n.Curated_at_NCBI})}}const n=[];for(const[e,o]of t){o.key=e;o.fill=o.color;o.stroke=Kt(o.color).darker(1).toString();delete o.color;n.push(o)}n.sort(((e,t)=>e.start-t.start));return n}function Nc(e,t,n,o){let i=10;if(i*(t.exon.length-1)>n*.3){i=Math.max(2,n*.3/(t.exon.length-1))}let s=0;for(const e of t.exon){s+=e[1]-e[0]}const r=i*(t.exon.length-1);const a=(n-(r>n*.4?0:r))/s;n=a*s+r;const l=e.append("canvas").node();l.width=n;const c=20;const d=4;l.height=c;const f=l.getContext("2d");f.strokeStyle=o;f.beginPath();f.moveTo(0,Math.floor(c/2)-.5);f.lineTo(n,Math.floor(c/2)-.5);f.stroke();const p=t.strand=="-";let u=0;for(const e of t.exon){let n=null,s=null,r=null;if(p){const o=e[1],i=e[0],a=t.codingstop,l=t.codingstart;if(i>=a){n=e}else if(i>=l){if(o>=a){n=[a,o];s=[i,a]}else{s=e}}else{if(o>=a){n=[a,o];r=[i,l];s=[l,a]}else if(o>=l){r=[i,l];s=[l,o]}else{r=e}}}else{if(e[1]<=t.codingstart){n=e}else if(e[1]<=t.codingstop){if(e[0]<=t.codingstart){n=[e[0],t.codingstart];s=[t.codingstart,e[1]]}else{s=e}}else{if(e[0]<=t.codingstart){n=[e[0],t.codingstart];r=[t.codingstop,e[1]];s=[t.codingstart,t.codingstop]}else if(e[0]<t.codingstop){r=[t.codingstop,e[1]];s=[e[0],t.codingstop]}else{r=e}}}if(n){f.fillStyle="#aaa";const e=Math.max(1,(n[1]-n[0])*a);f.fillRect(u,d,e,c-d*2);u+=e}if(s){f.fillStyle=o;const e=Math.max(1,(s[1]-s[0])*a);f.fillRect(u,0,e,c);u+=e}if(r){f.fillStyle="#aaa";const e=Math.max(1,(r[1]-r[0])*a);f.fillRect(u,d,e,c-d*2);u+=e}u+=i}}function Sc(e,t,n,o,i,s,r,a){const l=e.append("canvas").node();l.width=s;l.height=r;const c=Math.ceil(r/5);const d=l.getContext("2d");let f;let p=0;for(const e of t){if(e.chr!=n.chr){p+=e.width+i;continue}if(n.start>=e.start&&n.start<=e.stop){f=p+(e.reverse?e.stop-n.start:n.start-e.start)*o;break}p+=e.width+i}let u;p=0;for(const e of t){if(e.chr!=n.chr){p+=e.width+i;continue}if(n.stop>=e.start&&n.stop<=e.stop){u=p+(e.reverse?e.stop-n.stop:n.stop-e.start)*o;break}p+=e.width+i}d.strokeStyle=a;d.beginPath();d.moveTo(f,Math.floor(r/2)+.5);d.lineTo(u,Math.floor(r/2)+.5);d.stroke();const h=[];if(n.utr5)h.push(...n.utr5);if(n.utr3)h.push(...n.utr3);if(!n.cdslen)h.push(...n.exon);for(const e of h){let s=0;for(const a of t){if(a.chr!=n.chr){s+=a.width+i;continue}const t=Math.max(e[0],a.start);const l=Math.min(e[1],a.stop);if(t>=l){s+=a.width+i;continue}d.fillStyle="#aaa";d.fillRect(s+(a.reverse?(a.stop-l)*o:(t-a.start)*o),c,Math.max(1,(l-t)*o),r-c*2);s+=a.width+i}}if(n.coding){for(const e of n.coding){let s=0;for(const l of t){if(l.chr!=n.chr){s+=l.width+i;continue}const t=Math.max(e[0],l.start);const c=Math.min(e[1],l.stop);if(t>=c){s+=l.width+i;continue}d.fillStyle=a;d.fillRect(s+(l.reverse?(l.stop-c)*o:(t-l.start)*o),0,Math.max(1,(c-t)*o),r);s+=l.width+i}}}}function Ac(e,t,n,o){const i=e.append("canvas").node();i.width=n;const s=20;const r=4;i.height=s;const a=i.getContext("2d");if(!t.cdslen){a.fillStyle="#aaa";a.fillRect(0,r,n,s-r*2);return}const l=n/t.rnalen;let c=0;if(t.utr5){let e=0;for(const n of t.utr5)e+=n[1]-n[0];a.fillStyle="#aaa";a.fillRect(0,r,l*e,s-r*2);c=l*e}if(t.pdomains&&t.pdomains.length){a.fillStyle="white";a.fillRect(c,0,t.cdslen*l,s);t.pdomains.sort(((e,t)=>t.stop-t.start-e.stop+e.start));for(const e of t.pdomains){a.fillStyle=e.color;a.fillRect(c+e.start*3*l,0,(e.stop-e.start+1)*3*l,s)}a.strokeStyle="black";a.strokeRect(c,0,t.cdslen*l,s)}else{a.fillStyle=o;a.fillRect(c,0,t.cdslen*l,s)}c+=t.cdslen*l;if(t.utr3){let e=0;for(const n of t.utr3)e+=n[1]-n[0];a.fillStyle="#aaa";a.fillRect(c,r,l*e,s-r*2)}}function Cc(e,t,n){const o=e.append("canvas").node();o.width=n;const i=20;o.height=i;const s=o.getContext("2d");const r=n/(t.cdslen/3);t.pdomains.sort(((e,t)=>t.stop-t.start-e.stop+e.start));s.fillStyle="white";s.fillRect(0,0,n,i);for(const e of t.pdomains){s.fillStyle=e.color;s.fillRect(e.start*r,0,(e.stop-e.start+1)*r,i)}s.strokeStyle="black";s.strokeRect(0,0,n,i)}function Ec(e,t,n,o,i,s,r,a,l){const c=e.append("canvas").node();c.width=n;c.height=o;const d=c.getContext("2d");const f=Jo().range([1,n]);if(l){f.domain([s,i])}else{f.domain([i,s])}d.strokeStyle=r;d.fillStyle=r;u(d,t.start,t.stop,i,s,o/2,1);const p=Math.ceil(o/5);if(t.utr3){for(const e of t.utr3){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(t.utr5){for(const e of t.utr5){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(t.coding){for(const e of t.coding){u(d,e[0],e[1],i,s,1,o)}}if(t.codingstart==t.codingstop){for(const e of t.exon){u(d,e[0],e[1],i,s,p+1,o-p*2-1)}}if(!a&&t.strand){const e=3;if(t.coding){for(const n of t.coding){h(d,t.strand,n[0],n[1],i,s,1+e,o-e*2-1,"white")}}if(t.intron){for(const n of t.intron){h(d,t.strand,n[0],n[1],i,s,1+e,o-e*2-1,r?r:"black")}}}function u(e,t,n,o,i,s,r){const a=Math.max(t,o);const c=Math.min(n,i);if(a>=c)return;e.fillRect(Math.floor(f(l?c:a)),s,Math.max(1,Math.abs(f(c)-f(a))),r)}function h(e,t,n,o,i,s,r,a,l){const c=Math.max(n,i);const d=Math.min(o,s);if(c>=d)return;const p=2,u=a/2,h=f(d)-f(c);if(h<=p*2+a/2)return;e.strokeStyle=l;const m=Math.floor((h-p*2)/(a/2+u));let g=Math.floor(f(c)+(h-m*(a/2+u))/2)+.5;e.beginPath();for(let n=0;n<m;n++){if(t=="+"){e.moveTo(g,r);e.lineTo(g+a/2,r+a/2);e.lineTo(g,r+a)}else{e.moveTo(g+a/2,r);e.lineTo(g,r+a/2);e.lineTo(g+a/2,r+a)}g+=a/2+u}e.stroke()}}function Oc(e,t,n){let o=-1;if(t.cdslen){o=t.cdslen/3}return e.append("span").html(" "+(o>0?Math.ceil(o)+" AA"+(Number.isInteger(o)?"":" (incomplete CDS)"):"noncoding"))}function Mc(e,t,n){const o=kc({x:e,y:t});const i=o.body.append("div").style("margin","40px 20px 20px 20px");const s=i.append("p");s.append("span").html("Genome ");const r=s.append("select");for(const e in n){r.append("option").text(e)}const a=i.append("div").style("margin","20px 0px");const l=o.body.append("div").style("margin","10px 20px");const c=o.body.append("div").style("margin","20px");return[o,i,r.node(),a,l,c]}function Ic(e,t,n={}){if(n.apply_dom_styles){n.svgClone=e.cloneNode(true);const t=ot(n.svgClone);for(const e of n.svgClone.querySelectorAll(".sjpp-exclude-svg-download")){e.remove()}const o=window.getComputedStyle(e);for(const e of o){t.style(e,o.getPropertyValue(e))}}const o=document.createElement("a");document.body.appendChild(o);o.addEventListener("click",(function(){const i=new XMLSerializer;const s=new Blob([i.serializeToString(n.svgClone?n.svgClone:e)],{type:"image/svg+xml"});o.download=t+".svg";o.href=URL.createObjectURL(s);document.body.removeChild(o)}),false);o.click()}function Tc(e){const t=e.append("select");t.append("option").text("SNV and indel");t.append("option").text("SV (tabular format)");t.append("option").text("Fusion gene (tabular format)");t.append("option").text("ITD");t.append("option").text("Deletion, intragenic");t.append("option").text("Truncation");t.append("option").text("CNV, gene-level");return t}function Rc(e,t,n=1,o=1,i=10,s=100,r=null){let a;if(!r){const t=kc({x:(window.innerWidth/2-200)*n,y:(window.innerHeight/2-150)*o});t.header.text(e);a=t.body}else{r.append("p").text(e);a=r.append("div")}for(const e of t){const t=a.append("div").style("margin-top","10px");if(e.label){t.append("div").text(e.label).style("margin","5px")}a.append("textarea").text(e.text).attr("readonly",1).attr("rows",i).attr("cols",s)}a.append("p").style("font-size",".7em").text("Click on the text box above and press Ctrl-A to select all text for copy-pasting.")}function Lc(e,t){const n=e.node().getBoundingClientRect();const o=t.node().getBoundingClientRect();const i=ot(document.body).append("div").style("position","absolute").style("border","solid 1px black").style("left",n.left+window.pageXOffset+"px").style("top",n.top+window.pageYOffset+"px").style("width",n.width+"px").style("height",n.height+"px");if(hc){i.style("z-index",hc+3)}i.transition().duration(500).style("left",o.left+window.pageXOffset+"px").style("top",o.top+window.pageYOffset+"px").style("width",o.width+"px").style("height",o.height+"px").on("end",(()=>i.remove()))}function $c(e){const t=16;if(!e.color){e.color="#ccc"}const n=e.holder.append("div").style("position","relative").style("padding-top",t/2+"px");if(e.margin){n.style("margin",e.margin)}const o=n.append("div").style("border","solid 1px "+e.color).style("padding",t+"px").style("padding-bottom",t/2+"px");n.append("div").text(e.label).style("position","absolute").style("left","15px").style("top","0px").style("background-color","white").style("color",e.color).style("font-family",sc).style("font-size",t+"px").style("padding","0px 10px");return o}function zc(e,t){t.selectAll("*").remove();for(const n in e){const o=e[n];const i=t.append("div").style("display","inline-block").style("white-space","nowrap").style("padding","5px 20px 5px 0px");i.append("div").style("display","inline-block").style("background-color",o.color).style("margin-right","5px").style("padding","0px 4px").html(" ");i.append("div").style("display","inline-block").style("color",o.color).text(o.label)}}function Pc(e,t){if(window.location.hostname=="viz.stjude.cloud"||window.location.hostname=="pecan.stjude.cloud")return;if(window.sessionStorage.getItem("suppressErrors")?.includes(`"bulk-bad-lines"`))return;const n=kc({x:400,y:60});n.body.style("margin","20px 10px 10px 10px");n.header.text(t.length+" line"+(t.length>1?"s":"")+" rejected, click to check");if(t.length<=50){for(const[o,i,s]of t){n.body.append("div").classed("sja_clbtext",true).style("margin","3px").text("Line "+o+": "+i).on("click",(()=>{const t=kc({x:500,y:60});t.header.text("Line "+o);t.body.style("margin","10px");const n=t.body.append("table").style("border-spacing","1px").style("border-collapse","separate");let i=true;for(let t=0;t<e.length;t++){const o=n.append("tr");if(i){o.style("background-color","#ededed")}i=!i;o.append("td").text(e[t]);o.append("td").text(s[t]==undefined?"":s[t])}}))}return}const o=new Map;for(const[e,n,i]of t){if(!o.has(n)){o.set(n,[])}o.get(n).push({number:e,line:i})}const i=[...o];i.sort(((e,t)=>t[1].length-e[1].length));for(const[t,o]of i){const i=o[0];n.body.append("div").classed("sja_menuoption",true).style("margin","5px").text("Line "+i.number+": "+t+(o.length>1?" (total "+o.length+" lines)":"")).on("click",(()=>{const t=kc({x:500,y:60});t.header.text("Line "+i.number);const n=t.body.style("margin","10px").append("table");let o=true;for(let t=0;t<e.length;t++){const s=n.append("tr");if(o){s.style("background-color","#ededed")}o=!o;s.append("td").text(e[t]);s.append("td").text(i.line[t]==undefined?"":i.line[t])}}))}}function Dc(e){if(!e)return"No Block{} object given";if(typeof e!="object")return"Block is not an object";if(!e.error)return"method block.error() missing";if(!e.genome)return"block.genome missing";return null}function Uc(e){e.d.append("p").html('<span style="color:#858585;font-size:.7em">EXAMPLE</span> M ; red');const t=e.d.append("textarea").attr("cols",25).attr("rows",5).attr("placeholder","One class per line, join color and class code by semicolon.");const n=e.d.append("div");n.append("button").text("Submit").on("click",(()=>{const e=t.property("value").trim();if(!e)return;o.text("");const n=[];for(const t of e.split("\n")){const e=t.split(";");if(e.length!=2)return o.text("no separator in line: "+t);const i=e[0].trim();const s=e[1].trim();if(!i||!s)return o.text("wrong line: "+t);if(!Yr[i])return o.text("wrong class: "+i);n.push([i,s])}if(n.length){for(const[e,t]of n){Yr[e].color=t}Bc(i);o.text("New color set!")}}));n.append("button").text("Clear").on("click",(()=>{t.property("value","");o.text("")}));const o=n.append("span").style("margin-left","10px");const i=e.d.append("div").style("margin-top","5px");Bc(i);e.d.append("p").style("font-size",".8em").html("<a href=https://en.wikipedia.org/wiki/Web_colors target=_blank>Use color names</a>, or #ff0000 or rgb(255,0,0)")}function Bc(e,t){e.style("border-spacing","3px").selectAll("*").remove();const n=e.append("tr").style("color","#858585").style("font-size",".7em");n.append("td").text("CLASS");n.append("td").attr("colspan",2).text("LABEL, COLOR");for(const n in Yr){const o=Yr[n];if(t&&o.dt!=Pr)continue;const i=e.append("tr");i.append("td").text(n);{const e=i.append("td").append("span").attr("class","sja_mcdot").style("background-color",o.color).html(" ");if(n=="Blank")e.style("border","solid 1px #eee")}i.append("td").text(o.label).style("color",n=="Blank"?"#ddd":o.color)}}const Fc={height:1,pcolor:2,ncolor:3,pcolor2:4,ncolor2:5,autoscale:6,fixedscale:7,percentilescale:8,nodotplot:9,usedotplot:10,usedividefactor:11,nodividefactor:12};function qc(e,t){for(const n of t){if(n.type!=e.type)continue;switch(e.type){case mc.bigwig:case mc.bedj:case mc.junction:case mc.mdsjunction:case mc.mdscnv:case mc.bampile:case mc.hicstraw:case mc.expressionrank:if(e.file&&e.file==n.file||e.url&&e.url==n.url){return n}break;case mc.bigwigstranded:if(e.strand1&&n.strand1&&e.strand1.file==n.strand1.file&&e.strand1.url==n.strand1.url){if(e.strand2&&n.strand2&&e.strand2.file==n.strand2.file&&e.strand2.url==n.strand2.url){return n}}break}}return null}function Hc(e){if(e>=100)return"HIGHEST";if(e>=90)return"HIGH "+e+"%";if(e>=70)return"high "+e+"%";if(e>=30)return e+"%";if(e>=10)return"low "+e+"%";if(e>0)return"LOW "+e+"%";return"LOWEST"}function Gc(e){if(e[0]=="#")return e;const t=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return t&&t.length===4?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""}function Jc(e){return e.code=="Enter"||e.code=="NumpadEnter"}function Vc(e,t,n,o){if(!n||!n.hasSNP)return;const i={byCoord:true,genome:n.name,chr:e,ranges:[],alleleLst:o};for(const e of t){if(Number.isFinite(e)){i.ranges.push({start:e,stop:e+1})}else if(e.start&&e.stop){i.ranges.push(e)}}return Ll("snp",i).then((e=>{if(e.error)throw e.error;return e.results}))}function Wc(e,t){t.append("a").text(e.name).attr("href","https://www.ncbi.nlm.nih.gov/snp/"+e.name).attr("target","_blank");t.append("div").attr("class","sja_tinylogo_body").text(e.observed);t.append("div").attr("class","sja_tinylogo_head").text("ALLELE")}function Xc(e,t){t.append("div").style("display","inline-block").style("background",e.bg).style("padding","3px").append("a").attr("href","https://www.ncbi.nlm.nih.gov/clinvar/variation/"+e.id).attr("target","_blank").style("color",e.textcolor).text(e.value).style("font-size",".9em").style("text-decoration","none")}function Yc(e){const t=[];for(const n of e){let e=true;for(const o of t){if(n.chr==o.chr&&Math.max(n.start,o.start)<Math.min(n.stop,o.stop)){o.start=Math.min(o.start,n.start);o.stop=Math.max(o.stop,n.stop);e=false}}if(e){t.push({name:n.isoform,chr:n.chr,start:n.start,stop:n.stop})}}return t}function Zc(e,t,n,o){const i=e.append("table").style("border-spacing","0px").style("border-collapse","separate").append("tr");const s=i.append("td").style("vertical-align","top").style("padding","10px 0px 10px 10px");const r=i.append("td").style("vertical-align","top").style("border-left","solid 1px #aaa").style("padding","10px");const a=t.findIndex((e=>e.active))==-1?false:true;if(o){s.append("div").style("padding","5px 10px").style("margin","5px 5px 10px 5px").style("font-weight","550").text(o)}for(let e=0;e<t.length;e++){const o=t[e];o.tab=s.append("div").style("padding","5px 10px").style("margin","0px").style("border-top","solid 1px #ddd").style("border-radius","0px").classed("sja_menuoption",!a&&e!=0).html(o.label);o.box=r.append("div").style("padding","3px").style("display",!a&&e==0||o.active?"block":"none");if(n&&o.callback||!a&&e==0&&o.callback||o.active){o.callback(o.box);delete o.callback}if(a)o.tab.classed("sja_menuoption",!o.active);o.tab.on("click",(()=>{if(o.box.style("display")!="none"){o.tab.classed("sja_menuoption",true);o.box.style("display","none")}else{o.tab.classed("sja_menuoption",false);yc(o.box);for(let n=0;n<t.length;n++){if(e!=n){t[n].tab.classed("sja_menuoption",true);t[n].box.style("display","none")}}}if(o.callback){o.callback(o.box);delete o.callback}}))}}function Kc(e){return e.append("div").style("margin","30px").text("Loading...")}var Qc=Object.freeze({__proto__:null,dofetch:Ll,dofetch2:Pl,dofetch3:Bl,Menu:ec,first_genetrack_tolist:tc,make_table_2col:oc,fillbar:ic,font:sc,unspecified:rc,colorinframe:ac,coloroutframe:lc,colorbgleft:cc,colorbgright:dc,colorantisense:fc,colorctx:pc,textlensf:uc,get base_zindex(){return hc},tkt:mc,gmmode:gc,domaincolorlst:bc,appear:yc,disappear:vc,tip:wc,sayerror:xc,axisstyle:_c,newpane:kc,getdomaintypes:jc,sketchSplicerna:Nc,sketchGmsum:Sc,sketchRna:Ac,sketchProtein2:Cc,sketchGene:Ec,sketchProtein:Oc,newpane3:Mc,to_svg:Ic,filetypeselect:Tc,export_data:Rc,flyindi:Lc,labelbox:$c,category2legend:zc,bulk_badline:Pc,ensureisblock:Dc,mclasscolorchangeui:Uc,mclasscolor2table:Bc,bwSetting:Fc,tkexists:qc,ranksays:Hc,rgb2hex:Gc,keyupEnter:Jc,may_findmatchingsnp:Vc,snp_printhtml:Wc,clinvar_printhtml:Xc,gmlst2loci:Yc,tab2box:Zc,tab_wait:Kc});function ed(e,t,n){var o,i,s,r,a;if(null==t)t=100;function l(){var c=Date.now()-r;if(c<t&&c>=0){o=setTimeout(l,t-c)}else{o=null;if(!n){a=e.apply(s,i);s=i=null}}}var c=function(){s=this;i=arguments;r=Date.now();var c=n&&!o;if(!o)o=setTimeout(l,t);if(c){a=e.apply(s,i);s=i=null}return a};c.clear=function(){if(o){clearTimeout(o);o=null}};c.flush=function(){if(o){a=e.apply(s,i);s=i=null;clearTimeout(o);o=null}};return c}ed.debounce=ed;var td=ed;function nd(e){const t=e.div.append("input").attr("placeholder","Search gene").style("width",e.width||"100px");const n=e.resultdiv||(e.tip?e.tip.d:wc.d);function o(){if(e.resultdiv){e.resultdiv.selectAll("*").remove()}else if(e.tip){e.tip.hide()}else{wc.hide()}}t.on("keyup",(t=>{const i=t.target.value;if(i.length<=1){o();return}if(Jc(t)){const t=n.select(".sja_menuoption");if(t.size()>0){e.callback(t.text());o()}return}s()}));t.node().focus();function i(){Ll("genelookup",{genome:e.genome,input:t.property("value")}).then((i=>{if(i.error)throw i.error;if(!i.hits)throw".hits[] missing";if(e.resultdiv){e.resultdiv.selectAll("*").remove()}else if(e.tip){e.tip.clear().showunder(t.node())}else{wc.clear().showunder(t.node())}for(const t of i.hits){n.append("div").attr("class","sja_menuoption").text(t).on("click",(()=>{e.callback(t);o()}))}})).catch((e=>{n.append("div").text(e.message||e);if(e.stack)console.log(e.stack)}))}const s=td.debounce(i,300)}function od(e,t){return Bl("genelookup",{body:{deep:1,input:t,genome:e}}).then((e=>{if(e.error)throw e.error;if(!e.gmlst||e.gmlst.length==0)return null;return e.gmlst})).catch((e=>{throw e}))}function id(e){if(!e){return null}const t={};for(const e in Yr){t[Yr[e].label.toUpperCase()]=e}return{genome:e,mclasslabel2key:t,data:{},sample2disease:{},patient2st:{},good:0,geneToUpper:true,snv:{loaded:false,header:null,badlines:[],missense:0,silent:0},svjson:{loaded:false,header:null,badlines:[]},fusion:{loaded:false,header:null,badlines:[],original:[]},sv:{loaded:false,header:null,badlines:[],original:[]},cnv:{loaded:false,header:null,badlines:[]},itd:{loaded:false,header:null,badlines:[]},del:{loaded:false,header:null,badlines:[]},truncation:{loaded:false,header:null,badlines:[]}}}function sd(e,t,n,o,i){let s=wa;if(e.sampletype){const t=e.sampletype.toLowerCase();switch(t){case"relapse":s=_a;break;case"germline":s=xa;break}if(e.sample){if(e.patient);else{e.patient=e.sample+" "+e.sampletype}}else{if(e.patient){e.sample=e.patient+" "+e.sampletype}}}else{if(e.patient){if(e.sample){e.sampletype=e.sample}else{e.sample=e.sampletype=e.patient}}else{if(e.sample){e.sampletype=e.sample}}}if(e.origin){const t=e.origin.toLowerCase();switch(t){case"r":case"relapse":s=_a;e.isrim2=true;break;case"g":case"germline":s=xa;e.isrim1=true;break;case"gp":case"germline pathogenic":s=ka;e.isrim1=true;break;case"gnp":case"germline nonpathogenic":case"germline non-pathogenic":s=ja;e.isrim1=true;break;case"s":case"somatic":case"diagnosis":s=wa;break}}e.origin=s;if(!e.sample&&!e.patient){return}const r="no patient/individual name";if(e.patient){if(!t.patient2st[e.patient]){t.patient2st[e.patient]={}}t.patient2st[e.patient][e.sampletype]=e.sample}else{if(!t.patient2st[r]){t.patient2st[r]={}}t.patient2st[r][e.sampletype]=e.sample}if(e.sample){if(e.disease){if(e.sample in t.sample2disease){if(e.disease!=t.sample2disease[e.sample]){t.snv.badlines.push([n,'conflict of disease types for sample "'+e.sample+'": '+e.disease+", "+t.sample2disease[e.sample],o]);return true}}else{t.sample2disease[e.sample]=e.disease}}}return false}function rd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for snv/indel";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("annovar_gene","annovar_sj_gene","gene","genename","gene_symbol","hugo_symbol");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_aachange","amino_acid_change","annovar_sj_aachange","aachange","protein_change","variant");if(i==-1)return"amino_acid_change missing from header";n[i]="mname";i=o("annovar_class","class","mclass","variant_class","variant_classification","annovar_sj_class");if(i==-1)return"variant_class missing from header";n[i]="class";i=o("chromosome","chr");if(i==-1)return"chromosome missing from header";n[i]="chr";i=o("wu_hg19_pos","start","start_position","chr_position","position");if(i==-1)return"start missing from header";n[i]="pos";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("quantitative_measurements");if(i!=-1)n[i]="qmset";i=o("mutant_reads_in_case","mutant_in_tumor","tumor_readcount_alt");if(i!=-1)n[i]="maf_tumor_v1";i=o("total_reads_in_case","total_in_tumor","tumor_readcount_total");if(i!=-1)n[i]="maf_tumor_v2";i=o("mutant_reads_in_control","mutant_in_normal","normal_readcount_alt");if(i!=-1)n[i]="maf_normal_v1";i=o("total_reads_in_control","total_in_normal","normal_readcount_total");if(i!=-1)n[i]="maf_normal_v2";i=o("cdna_change");if(i!=-1)n[i]="cdna_change";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";i=o("origin");if(i!=-1)n[i]="origin";i=o("cancer","disease","diagnosis");if(i!=-1)n[i]="disease";t.snv.header=n;t.snv.loaded=true;return false}function ad(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.snv.header.length;e++){if(o[e]==undefined)break;i[n.snv.header[e]]=o[e]}if(!i.gene){n.snv.badlines.push([e,"missing gene",o]);return}if(i.gene.toUpperCase()=="UNKNOWN"){n.snv.badlines.push([e,"gene name is UNKNOWN",o]);return}if(!i.isoform){n.snv.badlines.push([e,"missing isoform",o]);return}if(!i.mname){i.mname=i.cdna_change;if(!i.mname){n.snv.badlines.push([e,"missing amino acid change",o]);return}}else{if(i.mname.indexOf("p.")==0){i.mname=i.mname.replace(/^p\./,"")}}if(!i.class){n.snv.badlines.push([e,"missing mutation class",o]);return}let s=n.mclasslabel2key[i.class.toUpperCase()];if(s){i.class=s}else{s=sa(i.class);if(s){i.class=s}else{n.snv.badlines.push([e,"wrong mutation class: "+i.class,o]);return}}if(sd(i,n,e,o,n.snv.badlines)){return}if(!i.chr){n.snv.badlines.push([e,"missing chromosome",o]);return}if(i.chr.toLowerCase().indexOf("chr")!=0){i.chr="chr"+i.chr}if(!i.pos){n.snv.badlines.push([e,"missing chromosome position",o]);return}const r=Number.parseInt(i.pos);if(Number.isNaN(r)){n.snv.badlines.push([e,"invalid chromosome position",o]);return}i.pos=r-1;if(i.maf_tumor_v2!=undefined&&i.maf_tumor_v1!=undefined){if(i.maf_tumor_v2=="");else{let t=Number.parseInt(i.maf_tumor_v1),s=Number.parseInt(i.maf_tumor_v2);if(Number.isNaN(t)||Number.isNaN(s)){n.snv.badlines.push([e,"invalid maf_tumor mutant and/or total read count",o]);return}i.maf_tumor={f:t/s,v1:t,v2:s}}delete i.maf_tumor_v1;delete i.maf_tumor_v2}if(i.maf_normal_v1!=undefined&&i.maf_normal_v2!=undefined){if(i.maf_normal_v2=="");else{let t=Number.parseInt(i.maf_normal_v1),s=Number.parseInt(i.maf_normal_v2);if(Number.isNaN(t)||Number.isNaN(s)){n.snv.badlines.push([e,"invalid maf_normal mutant and/or total read count",o]);return}i.maf_normal={f:t/s,v1:t,v2:s}}delete i.maf_normal_v1;delete i.maf_normal_v2}n.good++;if(i.class=="M"){n.snv.missense++}else if(i.class=="S"){n.snv.silent++}const a=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!n.data[a]){n.data[a]=[]}i.dt=Pr;n.data[a].push(i)}function ld(e,t,n){const o=e.toLowerCase().split("\t");if(o.length<=1)return"invalid file header for fusions";const i=(...e)=>{for(const t of e){const e=o.indexOf(t);if(e!=-1)return e}return-1};let s=i("gene_a","gene1","genea");if(s==-1)return"gene_a missing from header";o[s]="gene1";s=i("gene_b","gene2","geneb");if(s==-1)return"gene_b missing from header";o[s]="gene2";s=i("chr_a","chr1","chra");if(s==-1)return"chr_a missing from header";o[s]="chr1";s=i("chr_b","chr2","chrb");if(s==-1)return"chr_b missing from header";o[s]="chr2";s=i("pos_a","position_a","position1","posa");if(s==-1)return"pos_a missing from header";o[s]="position1";s=i("pos_b","position_b","position2","posb");if(s==-1)return"pos_b missing from header";o[s]="position2";s=i("isoform_a","refseq_a","refseq1","isoform1","sv_refseqa");if(s==-1)return"isoform_a missing from header";o[s]="isoform1";s=i("isoform_b","refseq_b","refseq2","isoform2","sv_refseqb");if(s==-1)return"isoform_b missing from header";o[s]="isoform2";s=i("strand_a","orta");if(s==-1)return"strand_a missing from header";o[s]="strand1";s=i("strand_b","ortb");if(s==-1)return"strand_b missing from header";o[s]="strand2";s=i("sample","sample_name","tumor_sample_barcode");if(s!=-1)o[s]="sample";s=i("patient","donor","target_case_id");if(s!=-1)o[s]="patient";s=i("sampletype","sample type","sample_type");if(s!=-1)o[s]="sampletype";s=i("disease");if(s!=-1)o[s]="disease";s=i("origin");if(s!=-1)o[s]="origin";if(n){t.sv.loaded=true;t.sv.header=o}else{t.fusion.loaded=true;t.fusion.header=o}return false}function cd(e,t,n,o){if(t==""||t[0]=="#")return;const i=t.split("\t");const s={};const r=o?n.sv.header:n.fusion.header;const a=o?n.sv.badlines:n.fusion.badlines;for(let e=0;e<r.length;e++){s[r[e]]=i[e]}if(!s.chr1){a.push([e,"missing chr1",i]);return}if(s.chr1.toLowerCase().indexOf("chr")!=0){s.chr1="chr"+s.chr1}if(!s.chr2){a.push([e,"missing chr2",i]);return}if(s.chr2.toLowerCase().indexOf("chr")!=0){s.chr2="chr"+s.chr2}let l=s.position1;if(!l){a.push([e,"missing position1",i]);return}let c=Number.parseInt(l);if(Number.isNaN(c)||c<=0){a.push([e,"invalid value for position1",i]);return}s.position1=c;l=s.position2;if(!l){a.push([e,"missing position2",i]);return}c=Number.parseInt(l);if(Number.isNaN(c)||c<=0){a.push([e,"invalid value for position2",i]);return}s.position2=c;if(sd(s,n,e,i)){return}if(s.isoform1&&s.isoform1.indexOf(",")!=-1){const e=s.isoform1.split(",");s.isoform1=undefined;for(const t of e){if(t!="")s.isoform1=t}}if(s.isoform2&&s.isoform2.indexOf(",")!=-1){const e=s.isoform2.split(",");s.isoform2=undefined;for(const t of e){if(t!="")s.isoform2=t}}if(!s.gene1){s.isoform1=undefined}if(!s.gene2){s.isoform2=undefined}if(s.gene1){n.good++;const e={dt:o?Fr:Dr,class:o?aa:ra,isoform:s.isoform1,mname:s.gene2||s.chr2,sample:s.sample,patient:s.patient,sampletype:s.sampletype,origin:s.origin,disease:s.disease,pairlst:[{a:{name:s.gene1,isoform:s.isoform1,strand:s.strand1,chr:s.chr1,position:s.position1},b:{name:s.gene2,isoform:s.isoform2,strand:s.strand2,chr:s.chr2,position:s.position2}}]};const t=n.geneToUpper?s.gene1.toUpperCase():s.gene1;if(!n.data[t]){n.data[t]=[]}n.data[t].push(e)}if(s.gene2&&s.gene2!=s.gene1){n.good++;const e={dt:o?Fr:Dr,class:o?aa:ra,isoform:s.isoform2,mname:s.gene1||s.chr1,sample:s.sample,patient:s.patient,sampletype:s.sampletype,origin:s.origin,disease:s.disease,pairlst:[{a:{name:s.gene1,isoform:s.isoform1,strand:s.strand1,chr:s.chr1,position:s.position1},b:{name:s.gene2,isoform:s.isoform2,strand:s.strand2,chr:s.chr2,position:s.position2}}]};const t=n.geneToUpper?s.gene2.toUpperCase():s.gene2;if(!n.data[t]){n.data[t]=[]}n.data[t].push(e)}}function dd(e){const t={};for(const n in e){if(n=="pairlst")continue;const o=e[n];const i=typeof o;if(i=="object"){continue}t[n]=o}if(e.pairlst){t.pairlst=[];for(const n of e.pairlst){const e={};for(const t in n){if(t=="a"||t=="b"||t=="interstitial"){continue}e[t]=n[t]}if(n.a){e.a={};for(const t in n.a){const o=n.a[t];if(typeof o=="object"){continue}e.a[t]=o}}if(n.b){e.b={};for(const t in n.b){const o=n.b[t];if(typeof o=="object"){continue}e.b[t]=o}}if(n.interstitial){e.interstitial={};for(const t in n.interstitial){const o=n.interstitial[t];if(typeof o=="object"){continue}e.interstitial[t]=o}}t.pairlst.push(e)}}return t}function fd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for svjson";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("sample");if(i!=-1)n[i]="sample";i=o("sampletype");if(i!=-1)n[i]="sampletype";i=o("patient");if(i!=-1)n[i]="patient";i=o("json","jsontext");if(i==-1)return["json missing from header"];n[i]="jsontext";return[null,n]}function pd(e,t,n,o){if(t==""||t[0]=="#")return;const i=t.split("\t");const s={};const r=n.svjson.badlines;for(let e=0;e<o.length;e++){s[o[e]]=i[e]}if(!s.jsontext){r.push([e,"missing jsontext",i]);return}if(sd(s,n,e,i)){return}let a;try{a=JSON.parse(s.jsontext)}catch(t){r.push([e,"invalid JSON text",i]);return}if(Array.isArray(a)){for(const e of a){if(e.a&&e.a.name&&e.a.isoform){n.good++;const t={dt:Dr,class:ra,isoform:e.a.isoform,mname:e.b.name};for(const e in s){if(e!="jsontext")t[e]=s[e]}t.pairlst=ud(a);const o=e.a.name.toUpperCase();if(!n.data[o]){n.data[o]=[]}n.data[o].push(t)}if(e.b&&e.b.name&&e.b.isoform){n.good++;const t={dt:Dr,class:ra,isoform:e.b.isoform,mname:e.a.name};for(const e in s){if(e!="jsontext")t[e]=s[e]}t.pairlst=ud(a);const o=e.b.name.toUpperCase();if(!n.data[o]){n.data[o]=[]}n.data[o].push(t)}}}else{a.dt=a.typecode;delete a.typecode;switch(a.dt){case qr:a.class=Zr;a.mname="ITD";break;case Gr:a.class=Qr;a.mname="N-loss";break;case Jr:a.class=ea;a.mname="C-loss";break;case Hr:a.class=Kr;a.mname="Del";break;case Fr:a.class=aa;a.mname="SV";break;default:r.push([e,"unknown datatype",i]);return}if(!a.gene){r.push([e,"json.gene missing",i]);return}n.good++;for(const e in s){if(e!="jsontext"){a[e]=s[e]}}const t=n.geneToUpper?a.gene.toUpperCase():a.gene.toUpperCase();if(!n.data[t]){n.data[t]=[]}n.data[t].push(a)}}function ud(e){const t=[];for(const n of e){const e={a:{},b:{}};for(const t in n){if(t!="a"&&t!="b")e[t]=n[t]}for(const t in n.a){e.a[t]=n.a[t]}for(const t in n.b){e.b[t]=n.b[t]}t.push(e)}return t}function hd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid file header for CNV";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("cnv");if(i==-1)return"CNV missing from header";n[i]="cnv";i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.cnv.header=n;t.cnv.loaded=true;return false}function md(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.cnv.header.length;e++){i[n.cnv.header[e]]=o[e]}if(!i.gene){n.cnv.badlines.push([e,"missing gene",o]);return}if(!i.cnv){n.cnv.badlines.push([e,"missing cnv value",o]);return}const s=i.cnv.toLowerCase();switch(s){case"amplification":case"gain":i.class=la;break;case"deletion":case"loss":i.class=ca;break;case"loh":i.class=da;break;default:n.cnv.badlines.push([e,"invalid cnv value: "+i.cnv,o]);i.class=null}if(!i.class){return}if(sd(i,n,e,o,n.cnv.badlines)){return}i.dt=Br;n.good++;const r=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(r in n.data)){n.data[r]=[]}n.data[r].push(i)}function gd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for ITD";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("rnaposition");if(i!=-1){n[i]="rnaposition";i=o("rnaduplength");if(i==-1)return"rnaduplength is required when rnaposition is present";n[i]="rnaduplength"}i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("chr_start");if(i==-1)return"chr_start is required when chr is present";n[i]="chrpos1";i=o("chr_stop");if(i==-1)return"chr_stop is required when chr is present";n[i]="chrpos2"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.itd.header=n;t.itd.loaded=true;return false}function bd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.itd.header.length;e++){if(o[e]==undefined)break;i[n.itd.header[e]]=o[e]}if(!i.gene){n.itd.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){let t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t;if(!i.rnaduplength){n.itd.badlines.push([e,"missing rnaDuplength value",o]);return}t=Number.parseInt(i.rnaduplength);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid rnaDuplength value",o]);return}i.rnaduplength=t}if(i.chr){let t=Number.parseInt(i.chrpos1);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid chr_start value",o]);return}i.chrpos1=t;t=Number.parseInt(i.chrpos2);if(Number.isNaN(t)||t<0){n.itd.badlines.push([e,"invalid chr_stop value",o]);return}i.chrpos2=t}if(sd(i,n,e,o,n.itd.badlines)){return}i.dt=qr;i.class=Zr;i.mname="ITD";n.good++;var s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}function yd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for intragenic deletion";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";i=o("rnaposition");if(i!=-1){n[i]="rnaposition";i=o("rnadellength");if(i==-1)return"rnadellength is required when rnaPosition is used";n[i]="rnadellength"}i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("chr_start");if(i==-1)return"chr_start is required when chr is used";n[i]="chrpos1";i=o("chr_stop");if(i==-1)return"chr_stop is required when chr is used";n[i]="chrpos2"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.del.header=n;t.del.loaded=true;return false}function vd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.del.header.length;e++){if(o[e]==undefined)break;i[n.del.header[e]]=o[e]}if(!i.gene){n.del.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){let t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t;if(!i.rnadellength){n.del.badlines.push([e,"missing rnaDellength value",o]);return}t=Number.parseInt(i.rnadellength);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid rnaDellength value",o]);return}i.rnadellength=t}if(i.chr){let t=Number.parseInt(i.chrpos1);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid chr_start value",o]);return}i.chrpos1=t;t=Number.parseInt(i.chrpos2);if(Number.isNaN(t)||t<0){n.del.badlines.push([e,"invalid chr_stop value",o]);return}i.chrpos2=t}if(sd(i,n,e,o,n.del.badlines)){return}i.dt=Hr;i.class=Kr;i.mname="DEL";n.good++;var s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}function wd(e,t){const n=e.toLowerCase().split("\t");if(n.length<=1)return"invalid header line for truncation";const o=(...e)=>{for(const t of e){const e=n.indexOf(t);if(e!=-1)return e}return-1};let i=o("gene");if(i==-1)return"gene missing from header";n[i]="gene";i=o("annovar_isoform","mrna_accession","mrna accession","refseq_mrna_id","annovar_sj_filter_isoform","refseq","isoform");if(i==-1)return"isoform missing from header";n[i]="isoform";let s=false;i=o("rnaposition");if(i!=-1){n[i]="rnaposition";s=true}i=o("losstype");if(i==-1)return"lossType missing from header";n[i]="losstype";let r=false;i=o("chromosome","chr");if(i!=-1){n[i]="chr";i=o("start","start_position","wu_hg19_pos","chr_position","position");if(i==-1){return"genomic position missing from header"}n[i]="pos";r=true}if(!s&&!r){return"neither rnaposition nor genomic position is given"}i=o("sample","sample_name","tumor_sample_barcode");if(i!=-1)n[i]="sample";i=o("patient","donor","target_case_id");if(i!=-1)n[i]="patient";i=o("disease");if(i!=-1)n[i]="disease";i=o("origin");if(i!=-1)n[i]="origin";i=o("sampletype","sample type","sample_type");if(i!=-1)n[i]="sampletype";t.truncation.header=n;t.truncation.loaded=true;return false}function xd(e,t,n){if(t==""||t[0]=="#")return;const o=t.split("\t");const i={};for(let e=0;e<n.truncation.header.length;e++){i[n.truncation.header[e]]=o[e]}if(!i.gene){n.truncation.badlines.push([e,"missing gene",o]);return}if(i.rnaposition){const t=Number.parseInt(i.rnaposition);if(Number.isNaN(t)||t<0){n.truncation.badlines.push([e,"invalid rnaPosition value",o]);return}i.rnaposition=t}if(i.pos){const t=Number.parseInt(i.pos);if(Number.isNaN(t)||t<0){n.truncation.badlines.push([e,"invalid genomic position",o]);return}i.pos=t}if(!i.losstype){n.truncation.badlines.push([e,"missing lossType value",o]);return}if(i.losstype!="n"&&i.losstype!="c"){n.truncation.badlines.push([e,'lossType value not "n" or "c"',o]);return}if(sd(i,n,e,o,n.truncation.badlines)){return}if(i.losstype=="n"){i.dt=Gr;i.class=Qr;i.mname="N-loss"}else{i.dt=Jr;i.class=ea;i.mname="C-loss"}n.good++;const s=n.geneToUpper?i.gene.toUpperCase():i.gene;if(!(s in n.data)){n.data[s]=[]}n.data[s].push(i)}const _d=["heatmapJSON","piebarJSON","survivalJSON","discoJSON","riverJSON"];const kd={snvindel:0,si:0,sv:1,fusion:2,itd:3,deletion:4,truncation:5,cnv:6};let jd=false;class Nd{constructor(e){this.bt=e;this.err=this.errHandler();if(!jd){const e=Sd();if(e.project){this.getData(e.project);jd=true}}if(e.filediv){this.projectByInput(e.filediv)}}processData(e){const t=e.files.pop();const n=e.expectedFileNames.indexOf(t.name);if(n==-1){if(e.files.length)setTimeout((()=>{this.processData(e)}),1);return}e.expectedFileNames.splice(n,1);this.cohort={name:"project",genome:this.bt.genomes[this.bt.gselect.options[this.bt.gselect.selectedIndex].innerHTML]};if(!this.flag){this.flag=this.bt.init_bulk_flag(this.cohort.genome)}const o=this.bt.content2flag(t.content,t.type,this.flag);if(o){this.err(o);this.processData(e)}else if(!e.files.length){if(e.expectedFileNames.length){this.err('These referenced files were not found: "'+e.expectedFileNames.join('", "')+'".')}this.bt.flag2tp(this.flag,{name:"project"},Object.assign(this.cohort,e.schema),this.ds);return}else{if(!this.ds){for(const e in this.cohort.dsset){this.ds=this.cohort.dsset[e];break}}const n=this.bt.bulkin({flag:this.flag,cohort:this.cohort,flag2thisds:this.ds,filename:"project"},(()=>{this.processData(e)}));if(n){this.err("Error with "+t.name+": "+n);return}if(this.flag.good===0){this.err(t.name+": no data loaded");return}}}getData(e){const[t,n]=e.split("/");const o=n&&n.trim()?n.trim():"ref.txt";this.gettext("/data/projects/"+t+"/"+o,(e=>{const n={};const o={};const i={schema:{},files:[],expectedFileNames:[]};let s=0;e.trim().split("\n").forEach((e=>{const[t,i]=e.trim().split("\t");if(_d.includes(t)){o[i]=t;s+=1}else if(!kd[t]&&kd[t]!==0){this.err("Unrecognized type "+t+" for file "+i+" in reference.txt.")}else{n[i]=kd[t];s+=1}}));i.expectedFileNames=Object.keys(n);const r=this.getTracker(s,(()=>this.processData(i)));Object.keys(o).forEach((e=>{this.getjson("/data/projects/"+t+"/"+e,(t=>{i.schema[o[e]]=t;r()}))}));Object.keys(n).forEach((e=>{this.gettext("/data/projects/"+t+"/"+e,(t=>{i.files.push({name:e,type:n[e],content:t});r()}))}))}))}gettext(e,t){fetch(e).then((t=>{if(t.ok)return t.text();else this.err("File request error: "+e)})).then(t).catch((t=>this.err("File request error: "+e+" "+t)))}getjson(e,t){fetch(e).then((t=>{if(t.ok)return t.json();else this.err("Network error for "+e)})).then(t).catch((t=>this.err("file request error: "+e+" "+t)))}getTracker(e,t){let n=0;return function o(){n+=1;if(n==e){t()}}}projectByInput(e){this.tp=null;const t=e.append("div");t.append("span").html("Project: reference ");this.refNameInput=t.append("input").attr("type","text").property("value","ref.txt").style("margin-right","20px").style("padding-left","7px");t.append("label").attr("for","sja-pp-bulk-ui-project-btn").attr("class","sja_btn").style("padding","3px 5px").html("Choose folder");t.append("input").attr("type","file").attr("id","sja-pp-bulk-ui-project-btn").property("multiple",true).property("webkitdirectory",true).property("directory",true).on("change",(e=>this.readFiles(e)));t.append("div").style("margin","10px 10px 10px 0").html(`<a href="https://docs.google.com/document/d/1wlfGzyhxFYtWu9Fyf3FK7pgvS3rVb9_vrfYUBUOUrw4/edit?usp=sharing" target="new">Project user guide</a> | \n\t\t\t<a href='https://proteinpaint.stjude.org/ppdemo/projects/target-tall-project/ref.txt' target=_blank>Example project reference file</a>`);t.append("div").style("margin","20px").style("width","100%").html("-- OR --")}readFiles(e){const t=this;const n=t.refNameInput.property("value");const o=Array.from(e.target.files);const i=o.filter((e=>e.name==n))[0];if(!i){t.err("Missing reference file='"+n+"'.");return}const s={};const r={};const a={schema:{},files:[],expectedFileNames:[]};const l=new FileReader;let c="";let d=0;l.onload=e=>{e.target.result.trim().split("\n").forEach((e=>{const[n,o]=e.trim().split("\t");if(_d.includes(n)){r[o]=n}else if(!kd[n]&&kd[n]!==0){t.err("Unrecognized type "+n+" for file "+o+" in reference.txt.")}else{s[o]=kd[n]}}));a.expectedFileNames=Object.keys(s);const n=o.filter((e=>e.name in r));let i=0;if(!n.length){o.forEach(l)}else{n.forEach((e=>{const s=new FileReader;s.onload=s=>{const c=JSON.parse(s.target.result);i+=1;if(!c){t.err('Unable to parse schema file="'+e.name+'".')}else{a.schema[r[e.name]]=c}if(i==n.length){o.forEach(l)}};s.onerror=()=>{t.err("Error reading schema.txt.")};s.readAsText(e,"utf8")}))}function l(e){if(!a.expectedFileNames.includes(e.name)){d+=1;return}if(!e){t.err("Error reading file.");d+=1;return}if(e.size==0){t.err("Wrong file: "+e.name);d+=1;return}if(!s[e.name]&&s[e.name]!==0&&e.name!=c){t.err("Missing or invalid type assigned to file "+e.name+".");d+=1;return}const n=new FileReader;n.onload=n=>{d+=1;a.files.push({name:e.name,type:s[e.name],content:n.target.result});if(d==o.length){t.processData(a)}};n.onerror=()=>{d+=1;t.err("Error reading file "+e.name);if(d==o.length){t.processData(a)}};n.readAsText(e,"utf8")}};l.onerror=()=>{t.err("Error reading reference.txt.")};l.readAsText(i,"utf8")}errHandler(){const e=ot("body").append("div");return function(t){if(!t)return;xc(e,t)}}}function Sd(){const e={};window.location.search.substr(1).split("&").forEach((t=>{const[n,o]=t.split("=");e[n]=o}));return e}const Ad="root";const Cd="...";function Ed(e,t){const n=Object.create(null);const o=Object.create(null);const i=Object.create(null);for(const s of e){for(const[e,r]of t.entries()){const a=Od(s,e,t);const l=Od(s,e-1,t);if(!s[r.k]){if(e>0){i[l]+=1}break}n[a]=l;if(!(a in i)){i[a]=0}if(!(a in o)){const n={lst:[]};if(r.full){n.full=s[r.full]}n.id0=t[0].k;n.v0=s[t[0].k];if(e==1){n.id1=t[1].k;n.v1=s[t[1].k]}if(e==2){n.id2=t[2].k;n.v1=s[t[2].k]}o[a]=n}o[a].lst.push(s);if(e==t.length-1){i[a]+=1}}}const s=[{id:Ad,name:Ad}];for(const e in n){const t=n[e];const r=o[e];const a=e.split(Cd);s.push({id:e,parentId:t,lst:r.lst,value:i[e],name:a[a.length-1],full:r.full,id0:r.id0,v0:r.v0,id1:r.id1,v1:r.v1,id2:r.id2,v2:r.v2})}return s}function Od(e,t,n){const o=[Ad];for(let i=0;i<t;i++){o.push(e[n[i].k])}if(t>=0){o.push(e[n[t].k])}return o.join(Cd)}function Md(e){const t={id2vcf:{},label:e.name||"Unnamed VCF file"};let n;if(e.file){const o=Math.random().toString();n={file:e.file,indexURL:e.indexURL,vcfid:o};t.id2vcf[o]=n}else if(e.url){const o=Math.random().toString();n={url:e.url,indexURL:e.indexURL,vcfid:o};t.id2vcf[o]=n}else{return["no .file or .url"]}n.headernotloaded=true;if(e.samplenamemap){n.samplenamemap=e.samplenamemap}if(e.variant2img){if(!e.variant2img.path)return[".path missing from .variant2img{}"]}const o={type:mc.ds,isvcf:true,name:t.label,ds:t,populationfrequencyfilter:e.populationfrequencyfilter,vcfinfofilter:e.vcfinfofilter,itemlabelname:e.itemlabelname,viewrangeupperlimit:e.viewrangeupperlimit,variant2img:e.variant2img,axisheight:e.axisheight};if(e.url4variant){const t=Id(e.url4variant);if(t)return[".url4variant error: "+t];o.url4variant=e.url4variant}if(e.button4variant){const t=Td(e.button4variant);if(t)return[".button4variant error: "+t];o.button4variant=e.button4variant}if(e.sampleannotation){const t=e.sampleannotation;if(!t.annotation)return[".annotation{} missing from .sampleannotation"];if(t.levels){if(!Array.isArray(t.levels))return[".sampleannotation.levels should be array"];const e=[];for(const n in t.annotation){const o={sample_name:n};for(const e in t.annotation[n]){o[e]=t.annotation[n][e]}e.push(o)}const n=Ed(e,t.levels);t.root=wr()(n);t.root.sum((e=>e.value))}if(t.variantsunburst){if(!t.levels)return[".levels missing when .variantsunburst is on from .sampleannotation"]}o.ds.cohort=t}if(e.vcfcohorttrack){if(!e.vcfcohorttrack.file&&!e.vcfcohorttrack.url)return["no .file or .url provided from .vcfcohorttrack"];o.ds.vcfcohorttrack=e.vcfcohorttrack}if(e.germline2dvafplot){if(!e.germline2dvafplot.individualkey)return[".individualkey missing from germline2dvafplot"];if(!e.germline2dvafplot.sampletypekey)return[".sampletypekey missing from germline2dvafplot"];if(!e.germline2dvafplot.xsampletype)return[".xsampletype missing from germline2dvafplot"];if(!e.germline2dvafplot.yleftsampletype)return[".yleftsampletype missing from germline2dvafplot"];if(e.germline2dvafplot.yrightsampletype){if(e.germline2dvafplot.yrightsampletype==e.germline2dvafplot.yleftsampletype)return[".yrightsampletype should not be same as yleftsampletype"]}o.ds.germline2dvafplot=e.germline2dvafplot}if(e.vaf2coverageplot){if(e.vaf2coverageplot.categorykey){if(!e.vaf2coverageplot.categories)return[".categories missing when .categorykey is in use for .vaf2coverageplot"]}o.ds.vaf2coverageplot=e.vaf2coverageplot}if(e.genotype2boxplot){if(e.genotype2boxplot.boxplotvaluekey);else if(e.genotype2boxplot.sampleannotationkey){if(!o.ds.cohort)return["sampleannotation missing when using genotype2boxplot.sampleannotationkey"];if(!o.ds.cohort.annotation)return["sampleannotation.annotation missing when using genotype2boxplot.sampleannotationkey"];let t=false;for(const n in o.ds.cohort.annotation){if(e.genotype2boxplot.sampleannotationkey in o.ds.cohort.annotation[n]){t=true;break}}if(!t)return[e.genotype2boxplot.sampleannotationkey+" not found in any sample annotation"]}else{return["incomplete instruction for genotype2boxplot"]}o.ds.genotype2boxplot=e.genotype2boxplot}if(e.discardsymbolicallele){o.ds.discardsymbolicallele=true}if(e.samplebynumericvalue){if(!e.samplebynumericvalue.attrkey)return["attrkey missing from samplebynumericvalue"];if(!o.ds.cohort)return["sampleannotation missing when using samplebynumericvalue"];if(!o.ds.cohort.annotation)return["sampleannotation.annotation missing when using samplebynumericvalue"];let t=false;for(const n in o.ds.cohort.annotation){if(Number.isFinite(o.ds.cohort.annotation[n][e.samplebynumericvalue.attrkey])){t=true;break}}if(!t)return["samplebynumericvalue.attrkey not found in any sample annotation"];o.ds.samplebynumericvalue=e.samplebynumericvalue}{const t=e.genotypebynumericvalue;if(t){if(!t.refref)return[o.name+": refref missing from genotypebynumericvalue"];if(!t.refalt)return[o.name+": refalt missing from genotypebynumericvalue"];if(!t.altalt)return[o.name+": altalt missing from genotypebynumericvalue"];if(!t.refref.infokey)return[o.name+": refref.infokey missing from genotypebynumericvalue"];if(!t.refalt.infokey)return[o.name+": refalt.infokey missing from genotypebynumericvalue"];if(!t.altalt.infokey)return[o.name+": altalt.infokey missing from genotypebynumericvalue"];if(t.refref.genotypeCountInfokey||t.refalt.genotypeCountInfokey||t.altalt.genotypeCountInfokey){if(!t.refref.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.refref{}"];if(!t.refalt.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.refalt{}"];if(!t.altalt.genotypeCountInfokey)return[o.name+": genotypeCountInfokey missing from genotypebynumericvalue.altalt{}"]}o.ds.genotypebynumericvalue=t}}if(e.pointdown){o.aboveprotein=false}if(e.dstk_novcferror){o.dstk_novcferror=true}return[null,o]}function Id(e){if(!Array.isArray(e))return"value is not an array";for(const t of e){if(!t.makeurl){return".makeurl missing"}if(typeof t.makeurl!="function"){return".makeurl must be a function"}}return false}function Td(e){if(!Array.isArray(e))return"value is not an array";for(const t of e){if(!t.makebutton){return".makebutton missing"}if(typeof t.makebutton!="function"){return".makebutton must be a function"}}return false}function Rd(e,t,n,o){if(!e)return"no genome";if(!t)return"no chr name";const i=e.chrlookup[t.toUpperCase()];if(!i)return"Invalid chromosome name: "+i;if(!Number.isInteger(n))return"Non-numerical position: "+n;if(n<0||n>=i.len)return"Position out of range: "+n;if(!Number.isInteger(o))return"Non-numerical position: "+o;if(o<0||o>i.len)return"Position out of range: "+o;if(n>o)return"Start position is greater than stop";return false}function Ld(e,t,n){e=e.replace(/,/g,"");const o=t.chrlookup[e.toUpperCase()];if(o){return{chr:o.name,chrlen:o.len,start:Math.max(0,Math.ceil(o.len/2)-1e4),stop:Math.min(o.len,Math.ceil(o.len/2)+1e4)}}{const n=e.split(".");if(n.length>=2){const e=t.chrlookup[n[0].toUpperCase()];const o=Number.parseInt(n[1]);const i=Rd(t,n[0],o,o+1);if(!i){const t=400;return{chr:e.name,chrlen:e.len,start:Math.max(0,o-Math.ceil(t/2)),stop:Math.min(e.len,o+Math.ceil(t/2)),actualposition:{position:o,len:1}}}}}const i=e.split(/[-:\s]+/);if(i.length==2){const e=Number.parseInt(i[1]);const n=Rd(t,i[0],e,e+1);if(n){return null}const o=t.chrlookup[i[0].toUpperCase()];const s=400;return{chr:o.name,chrlen:o.len,start:Math.max(0,e-Math.ceil(s/2)),stop:Math.min(o.len,e+Math.ceil(s/2)),actualposition:{position:e,len:1}}}if(i.length==3){let e=Number.parseInt(i[1]),o=Number.parseInt(i[2]);const s=Rd(t,i[0],e,o);if(s){return null}const r={position:e,len:o-e};const a=t.chrlookup[i[0].toUpperCase()];if(!n){const t=400;if(o-e<t){let n=Math.ceil((e+o)/2);if(n+t/2>=a.len){n=a.len-Math.ceil(t/2)}e=Math.max(0,n-Math.ceil(t/2));o=e+t}}return{chr:a.name,chrlen:a.len,start:e,stop:o,actualposition:r}}return null}function $d(e,t,n=0){const o=t.strand=="-";const i={};if(e<t.start){if(o){i.atdownstream={off:t.start-e};i.rnapos=t.rnalen;if(t.cdslen){i.aapos=t.cdslen/3}}else{i.atupstream={off:t.start-e};i.rnapos=0;if(t.cdslen){i.aapos=0}}return i}if(e>=t.stop){if(o){i.atupstream={off:e-t.stop+1};i.rnapos=0;if(t.cdslen){i.aapos=0}}else{i.atdownstream={off:e-t.stop+1};i.rnapos=t.rnalen;if(t.cdslen){i.aapos=t.cdslen/3}}return i}if(e>=t.start&&e<t.stop){for(let s=0;s<t.exon.length;s++){const r=t.exon[s];if(o){if(r[1]+n<=e){i.atexon=s+1;i.atintron=s;break}if(r[0]-n<=e){i.atexon=s+1;break}}else{if(r[0]-n>e){i.atexon=s+1;i.atintron=s;break}if(r[1]+n>e){i.atexon=s+1;break}}}}let s=0;for(const n of t.exon){if(o){if(e>=n[1]){s+=.5;break}if(e<n[0]){s+=n[1]-n[0];continue}s+=n[1]-e;break}else{if(e<n[0]){s+=.5;break}if(e>=n[1]){s+=n[1]-n[0];continue}s+=e-n[0]+1;break}}i.rnapos=s;if(t.coding){let n=0;if(t.utr5){n=t.utr5.reduce(((e,t)=>e+t[1]-t[0]),0)}let r=0;if(t.utr3){r=t.utr3.reduce(((e,t)=>e+t[1]-t[0]),0)}if(s<=n){i.aapos=0}else if(s>n+t.cdslen){i.aapos=t.cdslen/3}else{i.aapos=Math.ceil((s-n)/3)}if(e<t.codingstart){let s=0;if(o){if(t.utr3){for(const n of t.utr3){s+=Math.max(n[1],e)-Math.max(n[0],e)}i.atutr3={total:r,off:s}}}else{if(t.utr5){for(const n of t.utr5){s+=Math.min(n[1],e)-Math.min(n[0],e)}i.atutr5={total:n,off:s}}}}else if(e>t.codingstop){let s=0;if(o){if(t.utr5){for(const n of t.utr5){s+=Math.max(n[1],e)-Math.max(n[0],e)}i.atutr5={total:n,off:s}}}else{if(t.utr3){for(const n of t.utr3){s+=Math.min(n[1],e)-Math.min(n[0],e)}i.atutr3={total:r,off:s}}}}}return i}function zd(e,t){if(!Number.isInteger(e))return null;if(!t.coding)return null;let n=0;for(const o of t.coding){if(n+o[1]-o[0]>=(e-1)*3){if(t.strand=="+"){return o[0]+(e-1)*3-n}return o[1]-1-((e-1)*3-n)}n+=o[1]-o[0]}if(t.strand=="+")return t.codingstop;return t.codingstart}function Pd(e,t){if(!Number.isFinite(e))return null;if(!t.exon)return null;let n=0;for(const o of t.exon){if(n+o[1]-o[0]>=e){if(t.strand=="+"){return o[0]+e-n}return o[1]-1-e+n}n+=o[1]-o[0]}if(t.strand=="+")return t.stop;return t.start}let Dd;function Ud(){if(window.sjcharts){return Promise.resolve(window.sjcharts)}else if(Dd){return Dd}else{Dd=new Promise(((e,t)=>{const n=window.location.hostname.split(".")[0];const o=["pp-test","pecan-test","ppr"].includes(n)?`${n}.stjude.org`:"proteinpaint.stjude.org";const i=`https://${o}/sjcharts/bin/sjcharts.js`;const s=document.createElement("script");s.setAttribute("type","text/javascript");s.setAttribute("src",i);document.getElementsByTagName("head")[0].appendChild(s);s.onload=()=>{e(window.sjcharts)};s.onerror=()=>{const e="Unable to load SJCharts from "+i;alert(e);t(e)}}));return Dd}}function Bd(e){if(!e.p2st){e.p2st={}}if(!e.assays){e.assays=[]}if(!Array.isArray(e.assays)){return".assays should be an array"}e.assaylst=[];let t=0;for(const n of e.assays){const o=e[n];if(!o){return'Assay "'+n+'" not found in cohort'}const i=o.config;if(!i){return'.config object missing for assay "'+n+'"'}delete o.config;if(!i.type){return'.config.type missing for assay "'+n+'"'}if(i.type.toLowerCase()=="vcf"){i.type=mc.ds;i.isvcf=true}else{if(!Sa(i.type)){return'unknown .config.type "'+i.type+'" for assay "'+n+'"'}}i.id=(++t).toString();if(!i.name){i.name=n}if(i.type==mc.junction){if(i.readcountcutoff){if(!Number.isInteger(i.readcountcutoff)||i.readcountcutoff<0){return'invalid .config.readcountcutoff for assay "'+n+'"'}}}e.assaylst.push(i);for(const t in o){if(!e.p2st[t]){e.p2st[t]={}}for(const s in o[t]){if(!e.p2st[t][s]){e.p2st[t][s]={tktemplate:[]}}if(i.type==mc.vafs1){for(const r in o[t][s]){const a=o[t][s][r];if(!a.file&&!a.url){return"no file or URL for "+r+" vafs1 of "+t+", "+s}a.type=mc.vafs1;a.patient=t;a.sampletype=s;a.assayname=n;a.id=i.id;a.tkid=Math.random().toString();if(!a.name){a.name=r+" vaf"}e.p2st[t][s].tktemplate.push(a)}continue}let r=[];if(Array.isArray(o[t][s])){r=o[t][s]}else{r.push(o[t][s])}for(const o of r){let r=o;if(!r.file&&!r.url){return"track has no file or url (sample: "+t+", assay: "+n+")"}if(r.name);else if(r.partname){r.name=t+(s==t?"":" "+s)+" "+n+" "+r.partname}else{r.name=t+(s==t?"":" "+s)+" "+n}if(i.isvcf){const[e,t]=Md({name:r.name,file:r.file,url:r.url});if(e){return"VCF track error: "+e}r=t}else{if(r.type){if(!Sa(r.type)){return'invalid track type "'+r.type+'" (sample: '+t+", assay: "+n+")"}}else{r.type=i.type}}r.patient=t;r.sampletype=s;r.assayname=n;r.id=i.id;r.tkid=Math.random().toString();e.p2st[t][s].tktemplate.push(r);switch(i.type){case mc.bigwig:const e=qd(r,i);if(e){return"Assay "+n+": "+i.type+" track error: "+e}break;case mc.junction:r.categories=i.categories;r.readcountcutoff=i.readcountcutoff;break}}}}}delete e.assays;{const t=Hd(e);if(t){return"Error: "+t}}if(e.patientannotation){const t=Jd(e);if(t)return t}if(e.browserview){const t=Gd(e);if(t)return t}if(e.e2pca){if(!e.e2pca.list)return".list missing from e2pca";if(!Array.isArray(e.e2pca.list))return"e2pca.list should be an array";if(e.e2pca.list.length==0)return"e2pca.list[] length 0";if(!e.e2pca.label){e.e2pca.label="Expression - PCA"}for(const t of e.e2pca.list){if(!t.vectorfile)return"vectorfile missing from e2pca";if(!t.dbfile)return"dbfile missing from e2pca"}}return}function Fd(e,t,n,o,i,s,r){const a=n.append("div").style("color","#858585");a.text("Loading "+t+" ...");return fetch(o+"/study",{method:"POST",body:JSON.stringify({file:t,jwt:i})}).then((e=>e.json())).then((l=>{if(!l){a.text("Server error!");return}if(l.error){a.text("Error loading study: "+l.error);return}const c=l.cohort;if(!c){a.text(".cohort missing");return}if(!c.genome){a.text("No genome specified in the cohort JSON content");return}const d=e[c.genome];if(!d){a.text("Invalid genome from cohort: "+c.genome);return}c.genome=d;c.jwt=i;if(!l.flagset){a.text(".flagset missing");return}a.text("");c.dsset={};for(const e in l.flagset){const n=l.flagset[e];n.genome=d;nf({flag:n,filename:t,cohort:c,err:e=>xc(a,e)})}const f=Bd(c);if(f){xc(a,f)}if(!s){return import("./tp.ui-23151bb1.js").then((function(e){return e.t})).then((async e=>{Ud().catch(console.error);e.default(c,n,o,r);return r}))}}))}function qd(e,t){if(!t){t={}}if(!e.file&&!e.url){return"no file or url"}if(!e.pcolor){e.pcolor=t.pcolor||"#0066CC"}if(!e.pcolor2){e.pcolor2=t.pcolor2||"#CC0000"}if(!e.ncolor){e.ncolor=t.ncolor||"#FF850A"}if(!e.ncolor2){e.ncolor2=t.ncolor2||"#0A85FF"}if(!e.height){e.height=t.height||50}const n={};if(t.scale){for(const e in t.scale){n[e]=t.scale[e]}}if(e.scale){for(const t in e.scale){n[t]=e.scale[t]}}n.auto=true;if(Number.isFinite(n.min)&&Number.isFinite(n.max)){delete n.auto}else if(Number.isFinite(n.percentile)){delete n.auto}e.scale=n}function Hd(e){const t=[];for(const n in e.p2st){for(const o in e.p2st[n]){const i=e.p2st[n][o].tktemplate;if(!i)continue;for(const e of i){t.push(e)}}}if(e.browserview&&e.browserview.assays){for(const n in e.browserview.assays){const o=e.browserview.assays[n];if(o.combined&&o.combinetk){t.push(o.combinetk)}}}if(!e.genome.tkset){e.genome.tkset=[]}const n={name:e.name,tklst:t};if(e.trackfacets){if(!Array.isArray(e.trackfacets)){return".trackfacets is not an array"}const t=[];for(const n of e.trackfacets){if(!n.samples){return"trackfacets: .samples missing from facet "+n.name}if(!Array.isArray(n.samples)){return"trackfacets: .samples is not array from facet "+n.name}if(!n.assays){return"trackfacets: .assays missing from a facet "+n.name}if(!Array.isArray(n.assays)){return"trackfacets: .assays is not array from a facet "+n.name}t.push(n)}if(t.length){n.facetlst=t}}e.genome.tkset.push(n);return null}function Gd(e){if(e.browserview.position){let t;if(typeof e.browserview.position=="string"){t=Ld(e.browserview.position,e.genome);if(!t){return".browserview.position invalid value"}}else{t=e.browserview.position}const n=Rd(e.genome,t.chr,t.start,t.stop);if(n){return".browserview.position error: "+n}e.browserview.position=t}else{e.browserview.position={chr:e.genome.defaultcoord.chr,start:e.genome.defaultcoord.start,stop:e.genome.defaultcoord.stop}}if(e.browserview.assays){for(const t in e.browserview.assays){if(typeof e.browserview.assays[t]!="object"){e.browserview.assays[t]={}}const n=e.browserview.assays[t];for(const o of e.assaylst){if(o.name==t){n.assayobj=o;break}}if(!n.assayobj){console.log("missing assayobj for assayview of "+t);continue}if(n.sum_view){delete n.sum_view;n.combined=true}if(n.combined){const o={};for(const e in n.assayobj){o[e]=n.assayobj[e]}for(const e in n){if(e=="assayobj")continue;o[e]=n[e]}if(!o.name){o.name=t}o.tracks=[];for(const t in e.p2st){for(const i in e.p2st[t]){for(const s of e.p2st[t][i].tktemplate){if(s.id==n.assayobj.id){s.patient=t;s.sampletype=i;o.tracks.push(s)}}}}if(o.isvcf){o.ds={id2vcf:{},label:o.name};for(const e of o.tracks){for(const t in e.ds.id2vcf){e.__vcfobj=e.ds.id2vcf[t]}o.ds.id2vcf[e.__vcfobj.vcfid]=e.__vcfobj}}n.combinetk=o}}}if(e.browserview.defaultassaytracks){if(!Array.isArray(e.browserview.defaultassaytracks))return".browserview.defaultassaytracks must be array";for(let t=0;t<e.browserview.defaultassaytracks.length;t++){const n=e.browserview.defaultassaytracks[t];if(!n.assay)return".assay missing from .defaultassaytracks #"+(t+1);if(!e[n.assay])return"unknown assay name from .defaultassaytracks #"+(t+1)+": "+n.assay;if(!n.level1)return".level1 missing from .defaultassaytracks #"+(t+1);if(!e[n.assay][n.level1])return"level1 not exist in assay from .defaultassaytracks #"+(t+1)+": "+n.level1;if(n.level2){if(!e[n.assay][n.level1][n.level2])return"level2 not exist in assay from .defaultassaytracks #"+(t+1)+": "+n.level2}}}return null}function Jd(e){if(!e.patientannotation.annotation){return".patientannotation.annotation missing"}if(!e.patientannotation.metadata){return".patientannotation.metadata missing"}if(!Array.isArray(e.patientannotation.metadata)){return".patientannotation.metadata should be an array"}const t={};for(const n of e.patientannotation.metadata){if(n.key==undefined){return"patientannotation: key missing for a metadata term"}if(!n.values){return"patientannotation: values missing for metadata term "+n.key}if(!Array.isArray(n.values)){return"patientannotation: .values not an array for metadata term "+n.key}if(!n.label){n.label=n.key}t[n.key]={label:n.label,values:{}};const e=At(Nr);for(const o of n.values){if(o.key==undefined){return"key missing for an attribute of term "+n.key}if(!o.label){o.label=o.key}if(!o.color){o.color=e(o.key)}t[n.key].values[o.key]=o}}e.patientannotation.mdh=t;return null}const Vd={color:"#ccc"};const Wd={x:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(255,100,100)").style("opacity",.9).style("font-weight",700).style("font-size","18px").style("transform","rotate(-45deg)").style("cursor","pointer").html("⊕").on("click",t.handler),plus:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","18px").html("⊕").on("click",t.handler),combine:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","12px").style("color","rgb(100,100,255)").style("cursor","pointer").html("[]+[]").on("click",t.handler),divide:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","12px").style("color","rgb(100,100,255)").style("cursor","pointer").html("[÷]").on("click",t.handler),expand:(e,t)=>{const n="color"in t?t.color:"rgb(100,100,255)";return e.attr("title",t.title).style("height","auto").style("color",n).style("opacity",.9).style("font-size","fontSize"in t?t.fontSize:"16px").style("padding","padding"in t?t.padding:"0 2px").style("display","display"in t?t.display:"inline-block").style("cursor","pointer").html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${n}" class="bi bi-square" viewBox="0 0 16 16" >\n\t\t\t\t\t <path stroke='${n}' stroke-width='1' d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>\n\t\t\t\t\t</svg>`).on("click",t.handler)},collapse:(e,t)=>{const n="color"in t?t.color:"rgb(100,100,255)";return e.attr("title",t.title).style("height","auto").style("color",n).style("opacity",.9).style("font-size","fontSize"in t?t.fontSize:"16px").style("padding","padding"in t?t.padding:"0 2px").style("display","display"in t?t.display:"inline-block").style("cursor","pointer").html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${n}" class="bi bi-dash-lg" viewBox="0 0 16 16">\n\t\t\t\t\t <path stroke='${n}' stroke-width='1' fill-rule="evenodd" d="M2 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11A.5.5 0 0 1 2 8Z"/>\n\t\t\t\t\t</svg>`).on("click",t.handler)},corner:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color",t.disabled?Vd.color:"rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html("⇱").on("click",t.handler),left:(e,t)=>{const n=t.fill?t.fill:t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("color",t.disabled?Vd.color:"rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M0,6L12,0L12,12Z' style='fill:${n}'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler)},right:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding-top","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,0)'>\n\t\t\t\t\t<path d='M0,0L12,6L0,12Z' style='fill:rgb(100,100,255)'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),up:(e,t)=>{const n=t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<path d='M6,0L12,12L0,12Z' style='fill:${n}'></path>\n\t\t\t</svg>`).on("click",t.handler)},down:(e,t)=>{const n=t.disabled?Vd.color:"rgb(100,100,255)";return e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).style("font-size","16px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M0,0L12,0L6,12Z' style='fill:${n}'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler)},updown:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("text-decoration","underline").style("cursor","pointer").html("⇵").on("click",t.handler),seHookArrow:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("cursor","pointer").html("⤥").on("click",t.handler),swHookArrow:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","18px").style("font-weight",800).style("cursor","pointer").html("⤦").on("click",t.handler),unlock:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t<g transform="scale(0.045)" fill="rgb(100,100,255)">\n\t\t\t\t<path d="m299.02 161.26h-185.84v-46.28c0-41.34 33.635-74.979 74.979-74.979 33.758 0 63.51 22.716 72.36 55.24 2.898 10.657 13.888 16.946 24.547 14.05 10.659-2.898 16.949-13.889 14.05-24.548-13.57-49.896-59.2-84.74-110.96-84.74-63.4 0-114.98 51.58-114.98 114.98v46.715c-9.06 1.902-15.888 9.952-15.888 19.571v175.05c0 11.03 8.972 20 20 20h221.73c11.03 0 20-8.972 20-20v-175.05c0-11.03-8.972-20-20-20"/>\n\t\t\t</g>\n\t\t</svg>`).on("click",t.handler),leftBorder:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M1,6L11,1L11,11Z' style='stroke:rgb(100,100,255); stroke-width:1px; fill:#ececec'></path>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),leftCrossedOut:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<path d='M1,6L11,1L11,11Z' style='stroke:rgb(100,100,255); stroke-width:1px; fill:#ececec'></path>\n\t\t\t\t\t<text x='3' y='10' style='font-size:12; fill:#f00; font-weight:bold'>X</text>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),filter:(e,t)=>{e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").on("click",t.handler);e.iconPath=e.append("svg").attr("width",16).attr("height",12).append("g").attr("transform","translate(8,1)").append("path").attr("d","M8,0L2,6L2,12L-2,12L-2,6L-8,0Z").style("fill","rgb(100,100,255)");return e},colorScale:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t\t<defs>\n\t\t\t\t\t<linearGradient id='`+t.linearGradientId+`'>\n\t\t\t\t\t\t<stop offset='0' stop-color='red'></stop>\n\t\t\t\t\t\t<stop offset='1' stop-color='blue'></stop>\n\t\t\t\t\t</linearGradient>\n\t\t\t\t</defs>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x='0' y='1' width='10' height='10' fill='url(#`+t.linearGradientId+`)'></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),bar:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("color","rgb(100,100,255)").style("opacity",.9).style("font-size","16px").style("padding","3px").style("cursor","pointer").html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x='0' y='0' width='3' height='11' fill='rgb(100,100,255)'></rect>\n\t\t\t\t\t<rect x='4' y='6' width='3' height='5' fill='rgb(100,100,255)'></rect>\n\t\t\t\t\t<rect x='8' y='3' width='3' height='8' fill='rgb(100,100,255)'></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),rect:(e,t)=>e.attr("title",t.title).style("padding","0 3px").style("stroke","rgb(100,100,255)").style("fill","fill"in t?t.fill:"none").style("opacity",.9).html(`<svg width='12' height='12'>\n\t\t\t\t<g transform='translate(0,1)'>\n\t\t\t\t\t<rect x="0" y="1" width="10" height="10"></rect>\n\t\t\t\t</g>\n\t\t\t</svg>`).on("click",t.handler),text:(e,t)=>{const n=e.append("div").style("display","none");const o=n.append("input");o.attr("type","text").style("width",t.width+"px").style("margin","0 0 1px 2px").style("border","1px solid #aaa").style("border-spacing",0).style("height","21px").style("padding",0).style("background-color","#fff").style("cursor","pointer").on("change",t.handler).on("click.tphm2",(e=>e.stopPropagation()));n.append("button").style("margin",0).style("border-spacing",0).style("padding","2px").html("add").on("click",t.handler);return{wrapper:n,input:o}},html:(e,t)=>{select(e.node().parentNode).append("span").html(t.html);if(t.styles){for(const t in styles){e.style(t,styles[t])}}return e},restart:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-house-fill" viewBox="0 0 16 16">\n\t\t<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/>\n\t\t<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},zoomIn:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>\n\t<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>\n\t<path fill-rule="evenodd" d="M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5z"/>\n\t</svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},zoomOut:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t\t<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>\n\t\t<path d="M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z"/>\n\t\t<path fill-rule="evenodd" d="M3 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},lasso:(e,t)=>{const n={color:"black",width:18,height:18};const o=!t.enabled?"transparent":"rgb(207, 226, 243)";Object.assign(n,t);const i=`<button style="cursor:pointer;border:none;background-color:${o};"><svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-zoom-in" viewBox="0 0 16 16">\n\t\t<path d="M15.825.12a.5.5 0 0 1 .132.584c-1.53 3.43-4.743 8.17-7.095 10.64a6.067 6.067 0 0 1-2.373 1.534c-.018.227-.06.538-.16.868-.201.659-.667 1.479-1.708 1.74a8.118 8.118 0 0 1-3.078.132 3.659 3.659 0 0 1-.562-.135 1.382 1.382 0 0 1-.466-.247.714.714 0 0 1-.204-.288.622.622 0 0 1 .004-.443c.095-.245.316-.38.461-.452.394-.197.625-.453.867-.826.095-.144.184-.297.287-.472l.117-.198c.151-.255.326-.54.546-.848.528-.739 1.201-.925 1.746-.896.126.007.243.025.348.048.062-.172.142-.38.238-.608.261-.619.658-1.419 1.187-2.069 2.176-2.67 6.18-6.206 9.117-8.104a.5.5 0 0 1 .596.04zM4.705 11.912a1.23 1.23 0 0 0-.419-.1c-.246-.013-.573.05-.879.479-.197.275-.355.532-.5.777l-.105.177c-.106.181-.213.362-.32.528a3.39 3.39 0 0 1-.76.861c.69.112 1.736.111 2.657-.12.559-.139.843-.569.993-1.06a3.122 3.122 0 0 0 .126-.75l-.793-.792zm1.44.026c.12-.04.277-.1.458-.183a5.068 5.068 0 0 0 1.535-1.1c1.9-1.996 4.412-5.57 6.052-8.631-2.59 1.927-5.566 4.66-7.302 6.792-.442.543-.795 1.243-1.042 1.826-.121.288-.214.54-.275.72v.001l.575.575zm-4.973 3.04.007-.005a.031.031 0 0 1-.007.004zm3.582-3.043.002.001h-.002z"/>\n\t\t</svg></button>`;e.html(i).on("click",t.handler)},download:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-download" viewBox="0 0 16 16">\n\t\t<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/>\n\t\t<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},help:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-question-circle" viewBox="0 0 16 16">\n\t\t<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n\t\t<path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286zm1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},search:(e,t)=>{const n={color:"black",width:18,height:18};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" class="bi bi-search" viewBox="0 0 16 16">\n\t\t<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>\n\t </svg>`;e.html(o).on("click",t.handler).style("cursor","pointer")},crosshair:(e,t={})=>{const n={color:"black",width:18,height:18,d:2};const o=n.width;const i=n.height;const s=n.d;Object.assign(n,t);const r=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" style='vertical-align: middle'>\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path d="M${o/2},${s}L${o/2},${i-s}Z" stroke='${n.color}'/>\n\t\t<path d="M${s},${i/2}L${o-s},${i/2}Z" stroke='${n.color}'/>\n\t\t</svg>`;e.html(r).on("click",t.handler).style("cursor","pointer")},grab:(e,t={})=>{const n={color:"black",width:18,height:18,transform:""};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" viewBox="0 0 448 512">\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path transform='${n.transform}' d="M144 64c0-8.8 7.2-16 16-16s16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16c0 9.1 5.1 17.4 13.3 21.5s17.9 3.2 25.1-2.3c2.7-2 6-3.2 9.6-3.2c8.8 0 16 7.2 16 16V264c0 31.3-20 58-48 67.9c-9.6 3.4-16 12.5-16 22.6V488c0 13.3 10.7 24 24 24s24-10.7 24-24V370.2c38-20.1 64-60.1 64-106.2V160c0-35.3-28.7-64-64-64c-2.8 0-5.6 .2-8.3 .5C332.8 77.1 311.9 64 288 64c-2.8 0-5.6 .2-8.3 .5C268.8 45.1 247.9 32 224 32c-2.8 0-5.6 .2-8.3 .5C204.8 13.1 183.9 0 160 0C124.7 0 96 28.7 96 64v64.3c-11.7 7.4-22.5 16.4-32 26.9l17.8 16.1L64 155.2l-9.4 10.5C40 181.8 32 202.8 32 224.6v12.8c0 49.6 24.2 96.1 64.8 124.5l13.8-19.7L96.8 361.9l8.9 6.2c6.9 4.8 14.4 8.6 22.3 11.3V488c0 13.3 10.7 24 24 24s24-10.7 24-24V359.9c0-12.6-9.8-23.1-22.4-23.9c-7.3-.5-14.3-2.9-20.3-7.1l-13.1 18.7 13.1-18.7-8.9-6.2C96.6 303.1 80 271.3 80 237.4V224.6c0-9.9 3.7-19.4 10.3-26.8l9.4-10.5c3.8-4.2 7.9-8.1 12.3-11.6V208c0 8.8 7.2 16 16 16s16-7.2 16-16V142.3 128 64z"/>\n\t\t</svg>`;e.html(o).style("cursor","pointer");if(t.handler)e.on("click",t.handler)},arrowPointer:(e,t={})=>{const n={color:"black",width:18,height:18,transform:""};Object.assign(n,t);const o=`<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" fill="${n.color}" viewBox="0 0 320 512">\n\t\t\x3c!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e\n\t\t<path transform='${n.transform}' d="M0 55.2V426c0 12.2 9.9 22 22 22c6.3 0 12.4-2.7 16.6-7.5L121.2 346l58.1 116.3c7.9 15.8 27.1 22.2 42.9 14.3s22.2-27.1 14.3-42.9L179.8 320H297.9c12.2 0 22.1-9.9 22.1-22.1c0-6.3-2.7-12.3-7.4-16.5L38.6 37.9C34.3 34.1 28.9 32 23.2 32C10.4 32 0 42.4 0 55.2z"/>\n\t\t</svg>`;e.html(o).style("cursor","pointer");if(t.handler)e.on("click",t.handler)}};function Xd(e,t){e.classed("sjpp-sandbox-form",true);const n=e.append("div").style("margin","40px 20px 20px 20px").classed("sjpp-sandbox-form-inputDiv",true);const o=n.append("p").classed("sjpp-sandbox-form-gselect",true);o.append("span").html("Genome ");const i=o.append("select");for(const e in t){i.append("option").text(e)}const s=n.append("div").style("margin","20px 0px").classed("sjpp-sandbox-form-fileDiv",true);const r=e.append("div").style("margin","10px 20px").classed("sjpp-sandbox-form-sayDiv",true);const a=e.append("div").style("margin","20px").classed("sjpp-sandbox-form-visualDiv",true);return[n,i.node(),s,r,a]}const Yd={};const Zd=Math.random().toString().slice(-6)+"-"+(+new Date).toString().slice(-8);let Kd=0;function Qd(e,t={}){var n,o;const i=t.beforePlotId?"#"+Yd[t.beforePlotId]:":first-child";const s=e.insert("div",i).attr("class","sjpp-sandbox");let r;if(t.plotId){r=`sjpp-sandbox-${Zd}-${Kd++}`;s.attr("id",r);Yd[t.plotId]=r}const a=s.append("div").attr("class","sjpp-output-sandbox-header").style("width",((n=t.style)===null||n===void 0?void 0:n.width)||"95vw").style("border","1px solid #ccc").style("display","flex").style("align-items","center").style("justify-content","left");const l="blue";const c="black";const d=a.append("div").classed("sjpp-output-sandbox-close-bt",true).style("cursor","pointer").style("vertical-align","middle").on("mouseenter",(()=>{const e=d.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=d.select("path");e.attr("stroke",c)})).html(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#000" class="bi bi-x-lg" viewBox="0 0 16 16">\n\t\t <path stroke='#000' d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>\n\t\t</svg>`).on("mousedown",(e=>{document.body.dispatchEvent(new Event("mousedown"));e.stopPropagation()})).on("click",(()=>{a.on("click",null).on("mousedown",null);s.selectAll("*").remove();if(typeof t.close==="function")t.close()}));const f=a.append("div").classed("sjpp-output-sandbox-collapse-btn",true);const p=a.append("div").classed("sjpp-output-sandbox-expand-btn",true).style("display","none");const u=a.append("div").style("display","inline-flex").style("align-items","center").style("justify-content","left").style("padding","5px 10px");const h=s.append("div").attr("class","sjpp-output-sandbox-content").style("width",((o=t.style)===null||o===void 0?void 0:o.width)||"95vw");let m=true;Wd["collapse"](f,{fontSize:"1.5em",padding:"4px 10px",color:"black",handler:g});Wd["expand"](p,{fontSize:"1.5em",padding:"4px 10px",color:"black",display:"none",handler:g});f.on("mouseenter",(()=>{const e=f.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=f.select("path");e.attr("stroke",c)}));p.on("mouseenter",(()=>{const e=p.select("path");e.attr("stroke",l)})).on("mouseleave",(()=>{const e=p.select("path");e.attr("stroke",c)}));function g(){m=!m;f.style("display",m==true?"inline-block":"none");p.style("display",m==true?"none":"inline-block");h.style("display",m==true?"block":"none")}return{header_row:a,header:u,body:h,app_div:s,id:r}}function ef(e,t,n,o,i,s){let r,a,l,c,d,f;if(i!==undefined)[a,l,c,d,f]=Xd(i,n);else{[r,a,l,c,d,f]=Mc(e,t,n);r.header.text("Load mutation from text files")}a.append("div").style("margin","20px 0px").style("color","#858585").html(`\n\t<p>Choose one file and upload to initiate the display panel.<br>From there you can add additional files.</p>\n\t<div>Supported data types:</div>\n\t<ul>\n\t <li>SNV and indel</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1OJ9aXq2_-a3BfIQdKLYCYzrJRTpu4_9i3gephTY-Z38 target=_blank>Format</a>,\n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.snvindel.txt target=_blank>example file</a></li>\n\t </ul>\n\t <li>SV or fusion transcript</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1klDZ0MHVkQTW2-lCu_AvpRE4_FcbhdB-yI17wNdPaOM target=_blank>Tabular format</a>,\n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.svfusion.txt target=_blank>example file</a>\n\t\t</li>\n\t\t<li>JSON-format, to come</li>\n\t </ul>\n\t <li>CNV, gene-level</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1WHptqOWNf96V0bYEDpj-EsKZGYnbBNc9aQIrhzdEJaU target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.cnv.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>ITD</li>\n\t <ul>\n\t \t<li>Internal tandem duplication, in-frame</li>\n\t <li><a href=https://drive.google.com/open?id=1Bh9awBsraoHbV8iWXv_3oDeXMsjIAHaOKHr973IJyZc target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.itd.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>Intragenic deletion, in-frame</li>\n\t <ul>\n\t <li><a href=https://drive.google.com/open?id=1tWbf3rg3BmVIZPGGPk023P0aBkDw_ry5XuZLGyGodyg target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.deletion.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t <li>Truncation</li>\n\t <ul>\n\t \t<li>Either N-terminus loss or C-terminus loss</li>\n\t <li><a href=https://drive.google.com/open?id=1P1g-Y8r30pSKfan1BhYZcsUtSk7wRb4plaO1S-JCJr4 target=_blank>Format</a>, \n\t <a href=https://proteinpaint.stjude.org/ppdemo/hg19/heatmap/exampleFiles/example.truncation.txt target=_blank>example file</a>\n\t\t</li>\n\t </ul>\n\t</ul>`);const p=()=>{c.selectAll("*").remove();new Nd({bulkin:nf,genomes:n,gselect:l,content2flag:tf,flag2tp:h,filediv:c,init_bulk_flag:id});c.append("span").html("Select data type ");const e=Tc(c).style("margin-right","20px");const t=c.append("input").attr("type","file").on("change",(t=>{const o=id(n[l.options[l.selectedIndex].innerHTML]);o.geneToUpper=u.property("checked");d.text("");const i=t.target.files[0];if(!i){p();return}if(i.size==0){d.text("Wrong file: "+i.name);p();return}const s=new FileReader;s.onload=t=>{const n=tf(t.target.result,e.node().selectedIndex,o);if(n){d.text("Error: "+n);p();return}h(o,i)};s.onerror=function(){d.text("Error reading file "+i.name);p();return};d.text("Parsing file "+i.name+" ...");s.readAsText(i,"utf8")}));setTimeout((()=>t.node().focus()),1100)};p();c.append("span").html("<br/>Convert gene name to uppercase ");const u=c.append("span").append("input").attr("type","checkbox").property("checked",true);function h(e,t,n=null,s=null){if(typeof e=="string"){d.text(e);p();return}d.text("");p();const l=n?n:Object.assign({genome:e.genome,name:t.name});const c=nf({flag:e,filename:t.name,cohort:l,flag2thisds:s});if(c){d.text("Error with "+t.name+": "+c);return}if(e.good==0){d.text("No mutations can be loaded");return}let u;if(r){vc(r.pane);const e=kc({x:100,y:100,toshrink:true});e.header.html('<span style="opacity:.5">FILE</span> '+t.name);u=e.body}if(i!==undefined){u=f.append("div").html('<span style="opacity:.5">FILE</span> '+t.name)}a.selectAll("*").remove();import("./tp.ui-23151bb1.js").then((function(e){return e.t})).then((e=>{e.default(l,u,o)}));return l}return function e(t,n){const o=tf(t.content,n,flag);if(o){d.text("Error: "+o);p();return}h(flag,t)}}function tf(e,t,n){if(!n)return"should not happen!";let o;switch(t){case 0:o=sf(e,n);if(o)return o;break;case 1:o=ff(e,n,true);if(o)return o;break;case 2:o=ff(e,n,false);if(o)return o;break;case 3:o=lf(e,n);if(o)return o;break;case 4:o=cf(e,n);if(o)return o;break;case 5:o=df(e,n);if(o)return o;break;case 6:o=af(e,n);if(o)return o;break;default:return"unknown option array index from file type <select>: "+t}}function nf(e,t=null){const n=e.flag;const o=e.cohort;if(!o.p2st){o.p2st={}}if(!o.dsset){o.dsset={}}if(!o.assaylst){o.assaylst=[]}if(n.variantgene){if(o.variantgene){return"variantgene already set for this cohort"}o.variantgene=n.variantgene}if(n.snv.badlines.length>0){Pc(n.snv.header,n.snv.badlines)}if(n.fusion.badlines.length>0){Pc(n.fusion.header,n.fusion.badlines)}if(n.sv.badlines.length>0){Pc(n.sv.header,n.sv.badlines)}if(n.cnv.badlines.length>0){Pc(n.cnv.header,n.cnv.badlines)}if(n.itd.badlines.length>0){Pc(n.itd.header,n.itd.badlines)}if(n.del.badlines.length>0){Pc(n.del.header,n.del.badlines)}if(n.truncation.badlines.length>0){Pc(n.truncation.header,n.truncation.badlines)}if(n.good==0){return false}const i={};let s=false;if(n.snv.loaded){for(const e of n.snv.header){i[e]=1}if("maf_tumor_v1"in i&&"maf_tumor_v2"in i){s=true}}if(n.cnv.loaded){for(const e of n.cnv.header){i[e]=1}}if(n.fusion.loaded){for(const e of n.fusion.header){i[e]=1}}if(n.sv.loaded){for(const e of n.sv.header){i[e]=1}}if(n.itd.loaded){for(const e of n.itd.header){i[e]=1}}if(n.del.loaded){for(const e of n.del.header){i[e]=1}}if(n.truncation.loaded){for(const e of n.truncation.header){i[e]=1}}const r="sample"in i||"patient"in i;const a="disease"in i;const l="sampletype"in i;let c;if(e.flag2thisds){c=e.flag2thisds;if(r&&!c.hassample){return'"sample" column found in new data but not in existing data'}if(!r&&c.hassample){return'"sample" column found in existing data but not in new data'}if(a&&!c.hasdisease){return'"disease" column found in new data but not in existing data'}if(!a&&c.hasdisease){return'"disease" column found in existing data but not in new data'}if(l&&!c.hasst){return'"sampletype" column found in new data but not in existing data'}if(!l&&c.hasst){return'"sampletype" column found in existing data but not in new data'}for(const e in n.data){const t=c.bulkdata[e];if(t){c.bulkdata[e]=t.concat(n.data[e])}else{c.bulkdata[e]=n.data[e]}}}else{let t=e.filename+(n.tpsetname?"_"+n.tpsetname:"");if(t in n.genome.datasets){let e=1;let o=t+" "+e;while(o in n.genome.datasets){e++;o=t+" "+e}t=o}c={label:t,bulkdata:n.data,hassample:r,hasdisease:a,hastumormaf:s,hasst:l,genome:o.genome,import:{},imported:{},importsilent:n.snv.silent==0?false:n.snv.missense/n.snv.silent>=5?false:true};n.genome.datasets[t]=c;o.dsset[t]=c;if(o.dbexpression){if(o.dbexpression.tidy){try{o.dbexpression.tidy=new Function(o.dbexpression.tidy)}catch(e){err("invalid JavaScript for dbexpression.tidy");delete o.dbexpression}}c.dbexpression=o.dbexpression}if(a){c.stratify=[{label:"disease",attr1:{k:"disease",label:"disease"}}]}}if(r){for(const e in n.data){for(const t of n.data[e]){let e=t.patient;if(!e){e=t.sample;if(!e){continue}}if(!o.p2st[e]){o.p2st[e]={}}let n=t.sampletype;if(!n){n=e}if(!o.p2st[e][n]){o.p2st[e][n]={dsset:{},tktemplate:[]}}if(!o.p2st[e][n].dsset[c.label]){o.p2st[e][n].dsset[c.label]=[]}o.p2st[e][n].dsset[c.label].push(t)}}}if(t)t();return false}function of(e){if(!e.name)e.name="Unnamed dataset";let t=e.holder;if(!t){const e=kc({x:100,y:100});t=e.body}const n=t.append("div");new Promise(((t,n)=>{const o={dsset:{}};for(const t in e){if(t=="snvindel"||t=="svjson"||t=="cnv"||t=="sv"||t=="mutationset"){continue}o[t]=e[t]}t(o)})).then((t=>{if(!e.snvindel&&!e.svjson&&!e.cnv&&!e.sv)return t;const n=id(t.genome);if(e.snvindel){const t=sf(e.snvindel,n);if(t)throw{message:"error in snvindel data: "+t};delete e.snvindel}if(e.svjson){const t=rf(e.svjson,n);if(t)throw{message:"error in svjson data: "+t};delete e.svjson}if(e.sv){const t=ff(e.sv,n);if(t)throw{message:"error in svjson data: "+t};delete e.sv}if(e.cnv){const t=af(e.cnv,n);if(t)throw{message:"error in cnv data: "+t};delete e.cnv}const o=nf({flag:n,filename:e.name,cohort:t});if(o)throw{message:"Error parsing data: "+o};return t})).then((t=>{if(!e.mutationset)return t;if(!Array.isArray(e.mutationset))throw{message:"mutationset is not an array"};const n=[];for(const o of e.mutationset){const i=id(t.genome);const s=[];if(o.snvindel){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.snvindel+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with snvindel file: "+e.error};const t=sf(e.text,i);if(t)throw{message:"error with snvindel file: "+t}}));s.push(n)}if(o.snvindel_url){s.push(Ll("urltextfile",{url:o.snvindel_url}).then((e=>{if(e.error)throw{message:"cannot get snvindel file from url"};const t=sf(e.text,i);if(t)throw{message:"error with snvindel file: "+t}})))}if(o.cnv){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.cnv+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with cnv file: "+e.error};const t=af(e.text,i);if(t)throw{message:"error with cnv file: "+t}}));s.push(n)}if(o.cnv_url){s.push(Ll("urltextfile",{url:o.cnv_url}).then((e=>{if(e.error)throw{message:"cannot get cnv file from url"};const t=af(e.text,i);if(t)throw{message:"error with cnv file: "+t}})))}if(o.sv){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.sv+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with sv file: "+e.error};const t=ff(e.text,i,true);if(t)throw{message:"error with sv file: "+t}}));s.push(n)}if(o.sv_url){s.push(Ll("urltextfile",{url:o.sv_url}).then((e=>{if(e.error)throw{message:"cannot get sv file from url"};const t=ff(e.text,i);if(t)throw{message:"error with sv file: "+t}})))}if(o.fusion){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.fusion+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with fusion file: "+e.error};const t=ff(e.text,i,false);if(t)throw{message:"error with fusion file: "+t}}));s.push(n)}if(o.svjson){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.svjson+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with svjson file: "+e.error};const t=rf(e.text,i);if(t)throw{message:"error with svjson file: "+t}}));s.push(n)}if(o.deletion){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.deletion+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with deletion file: "+e.error};const t=cf(e.text,i);if(t)throw{message:"error with deletion file: "+t}}));s.push(n)}if(o.deletion_url){s.push(Ll("urltextfile",{url:o.deletion_url}).then((e=>{if(e.error)throw{message:"cannot get deletion file from url"};const t=cf(e.text,i);if(t)throw{message:"error with deletion file: "+t}})))}if(o.truncation){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.truncation+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with truncation file: "+e.error};const t=df(e.text,i);if(t)throw{message:"error with truncation file: "+t}}));s.push(n)}if(o.truncation_url){s.push(Ll("urltextfile",{url:o.truncation_url}).then((e=>{if(e.error)throw{message:"cannot get truncation file from url"};const t=df(e.text,i);if(t)throw{message:"error with truncation file: "+t}})))}if(o.itd){const t=new Request(e.hostURL+"/textfile",{method:"POST",body:'{"file":"'+o.itd+'"}'});const n=fetch(t).then((e=>e.json())).then((e=>{if(e.error)throw{message:"error with itd file: "+e.error};const t=lf(e.text,i);if(t)throw{message:"error with itd file: "+t}}));s.push(n)}if(o.itd_url){s.push(Ll("urltextfile",{url:o.itd_url}).then((e=>{if(e.error)throw{message:"cannot get itd file from url"};const t=lf(e.text,i);if(t)throw{message:"error with itd file: "+t}})))}const r=Promise.all(s).then((n=>{const s=nf({flag:i,filename:e.name,cohort:t});if(s)throw{message:"Error parsing data from "+o.name+": "+s}}));n.push(r)}return Promise.all(n).then((e=>t))})).then((o=>{const i=Bd(o);if(i)throw{message:"Error parsing study: "+i};n.text("");import("./tp.ui-23151bb1.js").then((function(e){return e.t})).then((n=>{n.default(o,t,e.hostURL)}))})).catch((e=>{n.text(e.message);if(e.stack){console.log(e.stack)}}))}function sf(e,t){const n=e.trim().split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=rd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;ad(e,n[e],t)}}function rf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const[s,r]=fd(o);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;pd(e,n[e],t,r)}}function af(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=hd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;md(e,n[e],t)}}function lf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=gd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;bd(e,n[e],t)}}function cf(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=yd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;vd(e,n[e],t)}}function df(e,t){const n=e.split(/\r?\n/);let o=n[0];let i=0;while(o[0]=="#"){i++;o=n[i]}if(!o)return"no header line";const s=wd(o,t);if(s)return"header error: "+s;for(let e=i+1;e<n.length;e++){if(n[e]=="")continue;if(n[e][0]=="#")continue;xd(e,n[e],t)}}function ff(e,t,n){const o=e.split(/\r?\n/);let i=o[0];let s=0;while(i[0]=="#"){s++;i=o[s]}if(!i)return"no header line";const r=ld(i,t,n);if(r)return"header error: "+r;for(let e=s+1;e<o.length;e++){if(o[e]=="")continue;if(o[e][0]=="#")continue;cd(e,o[e],t,n)}}function pf(e,t){e.style("opacity",0).style("display",t||"block").transition().style("opacity",1)}function uf(e,t){e.style("opacity",1).transition().style("opacity",0).call((()=>{if(t){e.remove()}else{e.style("display","none").style("opacity",1)}}))}function hf(e,t){let n;if(typeof t=="string"){n=t}else{n=t.message||t.error;if(t.stack)console.log(t.stack)}const o=e.append("div").attr("class","sja_errorbar");o.append("div").text(n);o.append("div").html("✕").on("click",(()=>{uf(o,true)}))}function mf(e){try{throw new Error}catch(t){const n=t.stack.split("\n");const o=n[2].trim();const i=/\s*at\s+(.*)\s+\((.*).proteinpaint.js:(\d+):(\d+)\)/;const s=o.match(i);if(s){const t=s[1];const n=s[2].replace(/^.*\/bin\//,"").replace(/_([^_]+)$/,".$1").replaceAll(/_/g,"/");const o=`${e} [${n} ${t}()]`;throw new Error(o)}else{throw new Error(e)}}}function gf(e,t){if(typeof e=="string")return hf(t,e);if(e.length===0)return;if(e.length===1)return hf(t,e[0]);let n=false;const o=t.append("div").attr("class","sja_errorbar").on("click",(()=>{n=!n;s.style("display",n?"block":"none")}));const i=o.append("div").style("display","inline-block");i.append("div").style("display","inline-block").style("color","white").style("background-color","red").style("border-radius","100px").style("padding","1px 4px").text(e.length);i.append("div").text("errors found.").style("padding","3px").style("display","inline-block");o.append("div").style("display","inline-block").style("float","right").html("✕").on("click",(()=>{uf(o,true)}));const s=o.append("div").style("display","none").style("margin-left","10px");for(const t of e){s.append("div").text(t)}}async function bf(e,t){const n=await Bl("snp",{method:"POST",body:JSON.stringify({byName:true,genome:e.name,lst:[t]})});if(n.error)throw n.error;if(!n.results||n.results.length==0)throw t+": not a SNP";for(const t of n.results){const n=e.chrlookup[t.chrom.toUpperCase()];if(n&&n.major){return{chr:t.chrom,start:t.chromStart,stop:t.chromEnd}}}const o=n.results[0];return{chr:o.chrom,start:o.chromStart,stop:o.chromEnd}}async function yf(e){if(!e.holder)throw"No holder for block.init";if(!e.genome)throw"no genome";if(e.holder instanceof Element)e.holder=ot(e.holder);if(!e.tklst)e.tklst=[];if(e.query){await vf(e);return}if(e.model&&e.allmodels){await wf(e);return}}async function vf(e){const t=e.holder.append("p").style("font-size","2em").style("color","#858585").text("Searching for "+e.query+" ...");const n=await Bl("genelookup",{body:{deep:1,input:e.query,genome:e.genome.name}});if(!n)throw"querying genes: server error";if(n.error)throw"error querying genes: "+n.error;if(!n.gmlst||n.gmlst.length==0){if(e.genome.hasSNP){try{const n=await bf(e.genome,e.query);t.remove();const o={genome:e.genome,holder:e.holder,chr:n.chr,start:Math.max(0,n.start-300),stop:n.start+300,nobox:true,tklst:e.tklst,debugmode:e.debugmode};tc(e.genome,o.tklst);const i=await import("./block-4f585abe.js").then((function(e){return e.c}));const s=new i.Block(o);s.addhlregion(n.chr,n.start,n.stop-1)}catch(n){t.text("Not a gene or SNP: "+e.query)}}else{t.text("No match to gene: "+e.query)}return}t.remove();e.allmodels=n.gmlst;for(const t of e.allmodels){if(t.isoform.toUpperCase()==(n.found_isoform?n.found_isoform.toUpperCase():e.query.toUpperCase())){e.model=t;await wf(e);return}}const o=[];for(const t of e.allmodels){if(!t.isoform)throw"isoform missing from one gene model: "+JSON.stringify(t);const n=t.isoform.toUpperCase();if(e.genome.isoformcache.has(n)){let o=true;for(const i of e.genome.isoformcache.get(n)){if(i.chr==t.chr&&i.start==t.start&&i.stop==t.stop&&i.strand==t.strand){o=false;break}}if(o){e.genome.isoformcache.get(n).push(t)}}else{e.genome.isoformcache.set(n,[t])}if(t.isoform.toUpperCase()==e.query.toUpperCase()){o.push(t);break}if(t.isdefault){o.push(t)}}if(o.length==1){e.model=o[0]}else if(o.length>1){for(const t of o){if(t.chr=="chrY"){continue}const n=e.genome.chrlookup[t.chr.toUpperCase()];if(!n){continue}if(!n.major){continue}e.model=t;break}if(!e.model){e.model=o[0]}}if(!e.model){e.model=e.allmodels[0]}await wf(e)}async function wf(e){if(e.model.genomicseq){o();xf(e);return}const t={genome:e.genome.name,coord:e.model.chr+":"+(e.model.start+1)+"-"+e.model.stop};const n=await Bl("ntseq",{method:"POST",body:JSON.stringify(t)});if(!n)throw"getting sequence: server error";if(n.error)throw"getting sequence: "+n.error;if(!n.seq)throw"no nt seq???";e.model.genomicseq=n.seq.toUpperCase();e.model.aaseq=Ma(e.model);o();await xf(e);function o(){if(e.model.aaseq){const t=e.model.aaseq.indexOf(Oa);const n=e.model.cdslen-(e.model.startCodonFrame?3-e.model.startCodonFrame:0);if(t!=-1&&t<n/3-1){hf(e.holder,"Translating "+e.model.isoform+" ends at "+t+" AA, expecting "+n/3)}}}}async function xf(e){const t=new Map;for(const n of e.allmodels){if(!n.pdomains){n.pdomains=[];n.domain_hidden={};if(!t.has(n.isoform))t.set(n.isoform,[]);t.get(n.isoform).push(n)}}if(t.size==0){await _f(e);return}const n=await Bl("pdomain",{method:"POST",body:JSON.stringify({genome:e.genome.name,isoforms:[...t.keys()]})});if(n.error)throw"error getting protein domain: "+n.error;if(n.lst){const e=At().range(bc);for(const o of n.lst){for(const e of t.get(o.name)){e.pdomains=o.pdomains}for(const t of o.pdomains){if(!t.color){t.color=e(t.name+t.description)}}}}await _f(e)}async function _f(e){let t=e.gmmode;if(!t){if(e.model.cdslen){t=gc.protein}else{t=gc.exononly}}if(e.dataset){if(!Array.isArray(e.dataset))throw"dataset is not array";for(const t of e.dataset){if(e.genome.datasets[t]&&!e.genome.datasets[t].legacyDsIsUninitiated)continue;const n=await Bl(`getDataset?genome=${e.genome.name}&dsname=${t}`);if(n.error)throw`invalid name from dataset[]: ${n.error}`;if(!n.ds)throw".ds missing";const o=e.genome.datasets[n.ds.label];Object.assign(o,n.ds);const i=await import("./legacyDataset-056e9d4c.js");i.validate_oldds(o);delete o.legacyDsIsUninitiated}}const n=await import("./block-4f585abe.js").then((function(e){return e.c}));e.__blockInstance=new n.Block({genome:e.genome,holder:e.holder,nobox:true,usegm:e.model,gmstackheight:37,allgm:e.allmodels,datasetlst:e.dataset,legacyDsFilter:e.legacyDsFilter,mset:e.mset,hlaachange:e.hlaachange,hlvariants:e.hlvariants,hlregions:e.hlregions,gmmode:t,hidedatasetexpression:e.hidedatasetexpression,hidegenecontrol:e.hidegenecontrol,hidegenelegend:e.hidegenelegend,variantPageCall_snv:e.variantPageCall_snv,datasetqueries:e.datasetqueries,samplecart:e.samplecart,debugmode:e.debugmode,tklst:e.tklst,mclassOverride:e.mclassOverride,hide_dsHandles:e.hide_dsHandles,onloadalltk_always:e.onloadalltk_always})}var kf=Object.freeze({__proto__:null,default:yf});async function jf(e,t){let n=[],o=[];if(e&&e.includes(","))n=e.split(",");else if(e)n.push(e);else if(t&&t.includes(","))o=t.split(",");else if(t)o.push(t);const i=[];if(n.length){const e=undefined;for(const t of n){i.push(await Nf(t,e))}}else if(o.length){const e=undefined;for(const t of o){i.push(await Nf(e,t))}}return i}async function Nf(e,t){const n=await Sf(e,t);Af(n);const o=Cf(n);return o}async function Sf(e,t){if(e!==undefined&&e=="")throw".jsonfile missing";if(t!==undefined&&t=="")throw".jsonurl missing";let n;if(e!==undefined)n=await Ll("textfile",{file:e});else if(t!==undefined)n=await Ll("urltextfile",{url:t});if(n.error){throw n.error}return JSON.parse(n.text)}function Af(e){if(!e)throw"file is missing";if(!e.type)throw"dataset type is missing";const t=e.svcnvfile||e.svcnvurl;const n=e.vcffile||e.vcfurl;if(!t&&!n)throw"vcf or cnv file/url is required";if(Object.keys(e).filter((e=>e.includes("expression"))).length){if(!e.expressionfile&&!e.expressionurl)throw"expression file/url is missing"}if(Object.keys(e).filter((e=>e.includes("rnabam"))).length){if(!e.rnabamfile&&!e.rnabamurl)throw"rnabam file/url is missing"}if(e.sampleset){for(const t of e.sampleset){if(e.sampleset.length!=1&&!t.name)throw"sampleset name is missing";if(!t.samples)throw"sampleset samples[] is missing"}}if(e.sample2assaytrack){for(const[t,n]of Object.entries(e.sample2assaytrack)){if(!n.length)throw"assay[] missing for "+t;for(const e of n){if(!e.name)throw"assay name is missing for "+t;if(!e.type)throw"assay type is missing for "+t}}}if(e.groupsamplebyattr){if(!e.groupsamplebyattr.attrlst)return".attrlst[] missing from groupsamplebyattr";if(e.groupsamplebyattr.attrlst.length==0)return"groupsamplebyattr.attrlst[] empty array";for(const t of e.groupsamplebyattr.attrlst){if(!t.k)return"k missing from one of groupsamplebyattr.attrlst[]"}if(e.groupsamplebyattr.sortgroupby){if(!e.groupsamplebyattr.sortgroupby.key)return".key missing from .sortgroupby";if(!e.groupsamplebyattr.sortgroupby.order)return".order[] missing from .sortgroupby";if(!Array.isArray(e.groupsamplebyattr.sortgroupby.order))return".order must be an array"}if(!e.groupsamplebyattr.attrnamespacer)e.groupsamplebyattr.attrnamespacer=", "}if(e.fixedgeneexpression){for(const t of e.fixedgeneexpression){if(!t.gene)throw"gene missing in fixedgeneexpression array"}}if(e.vcf){if(!e.vcf.hiddenclass)throw"hiddenclasses[] missing from .vcf"}}function Cf(e){const t={type:e.type,name:e.name};if(e.isdense=="true"||e.isdense==true||e.isfull===false)t.isdense=true;else if(e.isfull)t.isfull=true;if(e.svcnvfile)t.file=e.svcnvfile;else if(e.svcnvurl)t.url=e.svcnvurl;if(Object.keys(e).filter((e=>e.includes("expression"))).length){t.checkexpressionrank={file:e.expressionfile,url:e.expressionurl}}if(Object.keys(e).filter((e=>e.includes("vcf"))).length){t.checkvcf={file:e.vcffile,url:e.vcfurl}}if(e.vcf){if(e.vcf.hiddenclass){t.vcf=[];t.vcf.hiddenclass=e.vcf.hiddenclass}}if(Object.keys(e).filter((e=>e.includes("rnabam"))).length){t.checkrnabam={file:e.rnabamfile,url:e.rnabamurl}}if(e.sampleset){t.sampleset=e.sampleset}if(e.sample2assaytrack){t.sample2assaytrack=e.sample2assaytrack}if(e.groupsamplebyattr){t.groupsamplebyattr=e.groupsamplebyattr}t.fixedgeneexpression=e.fixedgeneexpression;t.getallsamples=e.getallsamples;t.valueCutoff=e.cnvValueCutoff!==undefined?e.cnvValueCutoff:undefined;t.bplengthUpperLimit=e.cnvLengthUpperLimit!==undefined?e.cnvLengthUpperLimit:undefined;t.segmeanValueCutoff=e.segmeanValueCutoff!==undefined?e.segmeanValueCutoff:undefined;t.lohLengthUpperLimit=e.lohLengthUpperLimit!==undefined?e.lohLengthUpperLimit:undefined;t.multihidelabel_vcf=e.multihidelabel_vcf!==undefined?e.multihidelabel_vcf:undefined;t.multihidelabel_fusion=e.multihidelabel_fusion!==undefined?e.multihidelabel_fusion:undefined;t.multihidelabel_sv=e.multihidelabel_sv!==undefined?e.multihidelabel_sv:undefined;t.legend_vorigin=e.legend_vorigin;return t}async function Ef(e,t){let n={};const o=await Sf(e,t);n.mdssamplescatterplot=o;return n}function Of(e){return!isNaN(parseFloat(e))&&isFinite(e)}function Mf(e,t,n,o,i){if(o>=1){const t=Math.floor(e*o);if(i)return`${t}${n.charAt(0)}`;return`${t} ${t>1?n+"s":""}`}const s=Math.floor(e*o);const r=Math.ceil(e%(1/o));if(r==0){if(i)return`${s}${n.charAt(0)}`;return`${s} ${s>1?n+"s":""}`}if(i)return`${s}${n.charAt(0)}${r}${t.charAt(0)}`;return`${s} ${s>1?n+"s":""} ${r} ${r>1?t+"s":""}`}function If(e="",t=console.warn){const n=e?{search:e}:window.location;const o=new Map;for(const e of n.search.substr(1).split("&")){if(!e)continue;const n=e.split("=");if(n.length==2&&n[0]!=""&&n[1]!=""){let e=decodeURIComponent(n[1]);if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")){try{e=JSON.parse(e)}catch(e){t(e)}}else if(Of(e)){e=Number(e)}o.set(n[0].toLowerCase(),e)}else if(n.length>2){t(`unexpected '=' character in the URL parameter value for '${n[0]}'`)}else{t(`Invalid url parameter: '${e}'`)}}return o}function Tf(e,t=""){const n=e.state?.embedder;const o=t=>{if(t.origin!==n.origin)return;if(t.data=="getActiveMassSession"){window.removeEventListener("message",o);i.postMessage({state:e.state},n.origin);if(n.origin!=window.location.origin){setTimeout((()=>{try{window.close()}catch(e){console.log(e);window.open(window.location,"_self").close()}}),500)}}};window.addEventListener("message",o,false);setTimeout((()=>window.removeEventListener("message",o)),8e3);if(n.origin!=window.location.origin){confirm(`Another window will open to recover the saved session. When the next window opens,`+`\n- You may need to allow popups.`+`\n- You may have to refresh it.`+`\n- After the session is recovered, this browser window should automatically close.`);document.body.innerHTML=`\n\t\t\t<div style='margin: 20px; padding: 20px; font-size: 24px'>\n\t\t\t\tPlease close this browser tab. The recovered session should visible in another browser tab.\n\t\t\t</div>\n\t\t`}const i=window.open(n.href,"_blank")}async function Rf(e){const t=If();if(t.has("appcard")){const n=await Promise.resolve().then((function(){return ih}));const o=t.get("appcard");const i=await Pl("/cards/index.json");e.app.drawer.opts.genomes=e.genomes;e.app.drawer.opts.fromApp=true;e.app.drawer.opts.app={cardsPath:"cards"};const s=i.elements.findIndex((e=>e.sandboxJson==o||e.sandboxHtml==o));if(s<=0){const t=[...i.elements.filter((e=>e.type=="nestedCard"))];let s,r;t.findIndex((e=>{for(const[t,n]of e.children.entries()){if(n.sandboxJson==o||n.sandboxHtml==o){s=e;r=t}}}));n.openSandbox(s.children[r],e.app.drawer.opts)}else{n.openSandbox(i.elements[s],e.app.drawer.opts)}return}if(t.has("gdcbamslice")){const n=await import("./bam-e7f6baea.js");n.bamsliceui({genomes:e.genomes,holder:e.holder,debugmode:e.debugmode,stream2download:t.has("stream2download")});return}if(t.has("gdcmaf")){const t=await import("./maf-dfada1c8.js");t.gdcMAFui({holder:e.holder,debugmode:e.debugmode});return}if(t.has("gdcsinglecell")){const t=await import("./singlecell-75f8af89.js");t.gdcSinglecellUi({holder:e.holder,debugmode:e.debugmode});return}if(t.has("mdsjsonform")){const t=await import("./mdsjsonform-09b4e1cb.js");await t.init_mdsjsonform(e);return}if(t.has("termdb")){const n=t.get("termdb");const o=typeof n==="string"?JSON.parse(n):n;const i={holder:e.holder,state:o};const s=await import("./app-fb676934.js");s.appInit(i);return}if(t.has("massnative")){const n=t.get("massnative");const[o,i]=n.split(",");if(!o||!i)throw'value is not "genome,dslabel"';const s={holder:e.holder,genome:e.genomes[o],state:{genome:o,dslabel:i}};if(!s.genome)throw"invalid genome";const r=await import("./app-59194db0.js");r.appInit(s);return}if(t.has("mass")){const n=t.get("mass");const o=typeof n==="string"?JSON.parse(n):n;const i={holder:e.holder,state:o};if(o.genome){i.genome=e.genomes[o.genome]}else if(o?.vocab?.genome){i.genome=e.genomes[o.vocab.genome]}const s=await import("./app-59194db0.js");s.appInit(i);return}if(t.has("mass-session-file")||t.has("mass-session-url")){let n;if(t.has("mass-session-file")){const o=t.get("mass-session-file");const i=await Bl(`/textfile`,{method:"POST",body:JSON.stringify({file:o})});const s=JSON.parse(i.text);n={holder:e.holder,state:s,genome:e.genomes[s.vocab.genome]}}if(t.has("mass-session-url")){const o=t.get("mass-session-url");const i=await Bl("/urltextfile",{method:"POST",body:JSON.stringify({url:o})});const s=JSON.parse(i.text);n={holder:e.holder,state:s,genome:e.genomes[s.vocab.genome]}}const o=await import("./app-59194db0.js");o.appInit(n);return}if(t.has("mass-session-id")){const n=t.get("mass-session-id");const o=t.get("src");let i;if(o=="browser"){const e=localStorage.getItem("savedMassSessions");const t=JSON.parse(e);i={state:t[n]}}else{const e={headers:{},body:{id:n}};if(o=="cred"){const n=t.get("dslabel");const o=t.get("route");e.body.dslabel=n;e.body.route=o;e.body.route=o;const i=localStorage.getItem("jwtByDsRoute")||`{}`;this.jwtByDsRoute=JSON.parse(i);const s=this.jwtByDsRoute[n][o];e.headers.authorization=`Bearer ${btoa(s)}`}i=await Bl(`/massSession`,e);if(i.error)throw i.error}const s=i.state?.embedder;if(s&&s.origin!=window.location.origin){Tf(i);return}const r={holder:e.holder,state:i.state,genome:e.genomes[i.state.vocab.genome],sessionDaysLeft:i.sessionDaysLeft,sessionId:n};const a=await import("./app-59194db0.js");a.appInit(r);return}if(t.has("genome")&&e.selectgenome){const n=t.get("genome");const o=[...e.selectgenome.node().childNodes];const i=o.findIndex((e=>e.value==n));if(i==-1){hf(e.holder,`Invalid genome: ${n}. Please provide an available genome from this list: ${o.map((e=>e.value)).join(", ").replace(/,(?=[^,]*$)/,", or")}`);return}e.selectgenome.node().selectedIndex=i;e.selectgenome.node().dispatchEvent(new Event("change"))}if(t.has("hicfile")||t.has("hicurl")){let n,o,i;if(t.has("hicfile")){n=t.get("hicfile");i=n.split("/").pop()}else{o=t.get("hicurl");i=o.split("/").pop()}const s=t.get("genome");if(!s)throw"genome is required for hic";const r=e.genomes[s];if(!r)throw"invalid genome";const a={genome:r,file:n,url:o,name:i,hostURL:e.hostURL,enzyme:t.get("enzyme"),holder:e.holder};const l=await import("./HicApp-aac413df.js");await l.hicInit(a);return}if(t.has("singlecell")){if(!t.has("genome"))throw'"genome" is required for "singlecell"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./singlecell-29c1cbb1.js");i.init({genome:o,jsonfile:t.get("singlecell")},e.holder);return}if(t.has("mavbfile")){if(!t.has("genome"))throw'"genome" is required for "mavb"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./mavb-9a6fa2e9.js");i.mavbparseinput({genome:o,hostURL:e.hostURL,file:t.get("mavbfile")},(()=>{}),e.holder,e.jwt);return}if(t.has("mavburl")){if(!t.has("genome"))throw'"genome" is required for "mavb"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i=await import("./mavb-9a6fa2e9.js");i.mavbparseinput({genome:o,hostURL:e.hostURL,url:t.get("mavburl")},(()=>{}),e.holder,e.jwt);return}if(t.has("scatterplot")){if(!t.has("genome"))throw'"genome" is required for "scatterplot"';const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;let i;if(t.has("mdsjson")||t.has("mdsjsonurl")){const e=t.get("mdsjsonurl");const n=t.get("mdsjson");i=await Ef(n,e)}if(t.has("tsnejson")){const e=t.get("tsnejson");const n=await Ll("textfile",{file:e});if(n.error)throw n.error;else if(n.text){i={mdssamplescatterplot:{analysisdata:JSON.parse(n.text)}}}}i.mdssamplescatterplot.genome=o;const s=await import("./mds.samplescatterplot-a54b9e93.js");s.init(i.mdssamplescatterplot,e.holder,false);return}if(t.has("block")){if(!t.has("genome"))throw"missing genome for block";const n=t.get("genome");const o=e.genomes[n];if(!o)throw"invalid genome: "+n;const i={nobox:1,hostURL:e.hostURL,jwt:e.jwt,holder:e.holder,genome:o,dogtag:n,debugmode:e.debugmode};let s=null;let r=null;if(t.has("position")){const e=t.get("position").split(";");if(e[0]){const t=e[0].split(/[:-]/);const n=t[0];const o=Number.parseInt(t[1]);const i=Number.parseInt(t[2]);if(!n)throw"chr missing";if(Number.isNaN(o)||Number.isNaN(i))throw"Invalid start/stop value in position";s={chr:n,start:o,stop:i}}const n=[];for(let t=1;t<e.length;t++){if(!e[t])continue;const o=e[t].split(/[:-]/);const i=o[0];const s=Number.parseInt(o[1]);const r=Number.parseInt(o[2]);if(!i)throw"subpanel chr missing";if(Number.isNaN(s)||Number.isNaN(r))throw"Invalid start/stop value in subpanel position";n.push({chr:i,start:s,stop:r,width:600,leftborder:"rgba(200,0,0,.1)",leftpad:5})}if(n.length){i.subpanels=n}}if(t.has("regions")){r=[];for(const e of t.get("regions").split(",")){const t=e.split(/[:-]/);t[0];const n=Number.parseInt(t[1]);const o=Number.parseInt(t[2]);if(Number.isNaN(n)||Number.isNaN(o))throw"Invalid start/stop value in regions";r.push({chr:t[0],start:n,stop:o})}}if(!s&&!r){if(o.defaultcoord){s={chr:o.defaultcoord.chr,start:o.defaultcoord.start,stop:o.defaultcoord.stop}}}if(s){i.chr=s.chr;i.start=s.start;i.stop=s.stop}else if(r){i.rglst=r}if(t.has("hlregion")){const e=[];for(const n of t.get("hlregion").split(",")){const t=Ld(n,o,true);if(t)e.push(t)}if(e.length)i.hlregions=e}i.datasetqueries=Lf(t);i.tklst=await $f(t,o);tc(e.genomes[n],i.tklst);zf(t,i.tklst);const a=await import("./block-4f585abe.js").then((function(e){return e.c}));new a.Block(i);return}if(t.has("gene")){const n=t.get("gene");if(n.length==0)throw"zero length query string";const o={hostURL:e.hostURL,query:n,holder:e.holder,variantPageCall_snv:e.variantPageCall_snv,samplecart:e.samplecart,debugmode:e.debugmode};{let n;for(let t in e.genomes){if(e.genomes[t].isdefault){n=t;break}}if(t.has("genome")){n=t.get("genome")}if(!n)throw"No genome, and none set as default";o.genome=e.genomes[n];if(!o.genome)throw"invalid genome: "+n}if(t.has("dataset")){o.dataset=t.get("dataset").split(",")}if(t.has("hlaachange")){o.hlaachange=new Map;for(const e of t.get("hlaachange").split(",")){o.hlaachange.set(e,false)}}if(t.has("hlregion")){const e=[];for(const n of t.get("hlregion").split(",")){const t=Ld(n,o.genome,true);if(t)e.push(t)}if(e.length)o.hlregions=e}o.tklst=await $f(t,o.genome);zf(t,o.tklst);o.datasetqueries=Lf(t);await yf(o);return}if(t.has("disco")){const n=t.get("genome");const o=e.genomes[n];if(!o)throw"genome missing";const i=t.get("dslabel");if(!i)throw"dslabel missing";const s=t.get("sample");if(!s)throw"sample_id missing";const r=(await import("./FilterRxComp-fc769f34.js").then((function(e){return e.z}))).vocabInit({state:{genome:n,dslabel:i}});const a=await r.getTermdbConfig();await(await import("./plot.disco-621d1b8e.js")).default(a,i,{sample_id:s},e.holder,o);return}if(t.has("study")){const n=t.get("study");if(n!=""){Fd(e.genomes,n,e.holder,e.hostURL,undefined,false,e.app||{debugmode:e.debugmode,instanceTracker:e.instanceTracker||{},callbacks:e.callbacks||{}})}}}function Lf(e){if(!e.has("mds"))return;const t=e.get("mds").split(",");if(t[0]&&t[1]){const n={dataset:t[0],querykey:t[1]};if(e.has("sample")){n.singlesample={name:e.get("sample")};n.getsampletrackquickfix=true}return[n]}return}async function $f(e,t){const n=[];if(e.has("mds3")){const t=e.get("mds3").split(",");for(const o of t){const t={type:mc.mds3,dslabel:o};if(e.has("token"))t.token=e.get("token");if(e.has("filterobj"))t.filterObj=e.get("filterobj");n.push(t)}}if(e.has("mds3bcffile")){const[t,o]=e.get("mds3bcffile").split(",");if(t&&o){n.push({type:mc.mds3,name:t,bcf:{file:o}})}}if(e.has("mds3bcfurl")){const[t,o,i]=e.get("mds3bcfurl").split(",");if(t&&o){n.push({type:mc.mds3,name:t,bcf:{url:o,indexURL:i}})}}if(e.has("arcfile")){const t=e.get("arcfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.hicstraw,name:t[e],bedfile:t[e+1],mode_hm:false,mode_arc:true})}}}if(e.has("mdsjsoncache")){const t=await Pl("mdsjsonform",{method:"POST",body:JSON.stringify({draw:e.get("mdsjsoncache")})});if(t.error)throw t.error;Af(t.json);const o=Cf(t.json);n.push(o)}if(e.has("mdsjson")||e.has("mdsjsonurl")){const t=e.get("mdsjsonurl");const o=e.get("mdsjson");const i=await jf(o,t);n.push(...i)}if(e.has("tkjsonfile")){const o=await Ll("textfile",{file:e.get("tkjsonfile")});if(o.error)throw o.error;if(!o.text)throw".text missing";const i=JSON.parse(o.text);for(const e of i){if(e.isfacet){if(!t.tkset)t.tkset=[];if(!e.tracks)throw".tracks[] missing from a facet table";if(!Array.isArray(e.tracks))throw".tracks[] not an array from a facet table";e.tklst=e.tracks;delete e.tracks;for(const t of e.tklst){if(!t.assay)throw".assay missing from a facet track";if(!t.sample)throw".sample missing from a facet track";t.tkid=Math.random().toString()}t.tkset.push(e)}else{n.push(e)}}}if(e.has("bamfile")){const t=e.get("bamfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bam,name:t[e],file:t[e+1]})}}}if(e.has("bamurl")){const t=e.get("bamurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bam,name:t[e],url:t[e+1]})}}}if(e.has("bedjfile")){const t=e.get("bedjfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bedj,name:t[e],file:t[e+1]})}}}if(e.has("bedjurl")){const t=e.get("bedjurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bedj,name:t[e],url:t[e+1]})}}}if(e.has("hictkfile")||e.has("hictkurl")){const t=e.has("hictkfile");const o=e.get(t?"hictkfile":"hictkurl").split(",");const i=e.has("hictknorm")?e.get("hictknorm").split(","):null;for(let e=0;e<o.length;e+=3){if(o[e]&&o[e+1]&&o[e+2]){const s={type:mc.hicstraw,name:o[e],enzyme:o[e+1],normalizationmethod:i?i[e/3]:null};if(t){s.file=o[e+2]}else{s.url=o[e+2]}n.push(s)}}}if(e.has("ldfile")){const t=e.get("ldfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.ld,name:t[e],file:t[e+1]})}}}if(e.has("bigwigfile")){const t=e.get("bigwigfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bigwig,name:t[e],file:t[e+1],scale:{auto:1}})}}}if(e.has("bigwigurl")){const t=e.get("bigwigurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.bigwig,name:t[e],url:t[e+1],scale:{auto:1}})}}}if(e.has("junctionfile")){const t=e.get("junctionfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{file:t[e+1]}]})}}}if(e.has("junctionurl")){const t=e.get("junctionurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{url:t[e+1]}]})}}}if(e.has("vcffile")){const t=e.get("vcffile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"vcf",name:t[e],file:t[e+1]})}}}if(e.has("vcfurl")){const t=e.get("vcfurl").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"vcf",name:t[e],url:t[e+1]})}}}if(e.has("aicheckfile")){const t=e.get("aicheckfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"aicheck",name:t[e],file:t[e+1]})}}}if(e.has("bampilefile")){const t=e.get("bampilefile").split(",");let o=null;if(e.has("bampilelink")){o=e.get("bampilelink").split(",").map(decodeURIComponent)}for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){const i={type:mc.bampile,name:t[e],file:t[e+1]};if(o&&o[e/2]){i.link=o[e/2]}n.push(i)}}}if(e.has("svcnvfpkmurl")){const t=e.get("svcnvfpkmurl").split(",");const o=t[0];const i={};for(let e=1;e<t.length;e+=2){i[t[e]]=t[e+1]}if(i.svcnv||i.vcf){const e={type:mc.mdssvcnv,name:o};if(i.svcnv){e.url=i.svcnv}if(i.vcf){e.checkvcf={url:i.vcf,indexURL:i.vcfindex}}if(i.fpkm){e.checkexpressionrank={datatype:"FPKM",url:i.fpkm,indexURL:i.fpkmindex}}n.push(e)}}if(e.has("svcnvfpkmfile")){const t=e.get("svcnvfpkmfile").split(",");const o=t[0];const i={};for(let e=1;e<t.length;e+=2){i[t[e]]=t[e+1]}if(i.svcnv||i.vcf){const e={type:mc.mdssvcnv,name:o};if(i.svcnv){e.file=i.svcnv}if(i.vcf){e.checkvcf={file:i.vcf}}if(i.fpkm){e.checkexpressionrank={datatype:"FPKM",file:i.fpkm}}n.push(e)}}if(e.has("mdsjunctionfile")){const t=e.get("mdsjunctionfile").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"mdsjunction",name:t[e],file:t[e+1]})}}}if(e.has("junctionmatrix")){const t=e.get("junctionmatrix").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:"mdsjunction",name:t[e],file2:t[e+1]})}}}if(e.has("junctionrnapeg")){const t=e.get("junctionrnapeg").split(",");for(let e=0;e<t.length;e+=2){if(t[e]&&t[e+1]){n.push({type:mc.junction,name:t[e],tracks:[{rnapegfile:t[e+1]}]})}}}for(const e of n){if(e.type=="mds3"&&e.dslabel)continue;e.iscustom=true}if(e.has("isdense")){n.filter((e=>e.type==mc.mdssvcnv)).forEach((e=>{e.isdense=true;e.isfull=false}))}if(e.has("sample")){n.filter((e=>e.type==mc.mdssvcnv)).forEach((t=>{t.singlesample={name:e.get("sample")};t.getsampletrackquickfix=true}))}return n}function zf(e,t){if(e.has("bedjfilterbyname")){for(const n of t){if(n.type=="bedj")n.filterByName=e.get("bedjfilterbyname")}}}function Pf(e){const t=e.div.append("button").attr("type","submit").style("background-color",e.backgroundColor?e.backgroundColor:"#cfe2f3").style("margin",e.margin?e.margin:"20px 20px 0px 20px").style("padding","8px").style("border","none").style("border-radius","3px").style("display","inline-block").text(e.text);return t}function Df(e){const t=e.tip,n=e.row;let o,i=150;if("placeholder"in e){o=e.placeholder}else if(e.geneOnly){o="Gene";i=100}else{o="Gene, position";if(e.genome.hasSNP){o+=", dbSNP";i+=40}if(e.allowVariant){o+=", variant";i+=40}}const s=n.append("input").attr("type","text").attr("placeholder",o).attr("aria-label","Gene symbol, position, or alias").attr("class","sja_genesearchinput").style("width",i+"px").on("focus",(e=>{e.target.select()})).on("keyup",(async n=>{const o=n.target;const i=o.value.trim();if(i.length<=1)return t.hide();r.mark.html("");r.word.style("font-size","0.7em");if(e.hideHelp){r.word.text("")}else{r.word.text("Press ENTER to search, ESC to cancel")}if(Jc(n)){o.blur();t.hide();if(e.geneOnly){const e=t.d.select(".sja_menuoption");if(e.size()>0&&e.attr("isgene")){const t=e.text();p({geneSymbol:t},i)}else{p(null,"not a gene")}return}if(e.allowVariant){const t=await Uf(i,e.genome);if(t){p(t,"Valid variant");return}}const n=Ld(i,e.genome);if(n){p(n,"Valid coordinate");return}o.disabled=true;const s=t.d.select(".sja_menuoption");if(s.size()>0&&s.attr("isgene")){await c(s.text())}else{await c(i)}o.disabled=false;return}if(n.code=="Escape"){t.hide();if(f.chr){p(f,f.fromWhat)}else if(e.defaultCoord){const t=e.defaultCoord;o.value=t.chr+(t.isVariant?"."+t.pos+"."+t.ref+"."+t.alt:":"+t.start+"-"+t.stop)}o.blur();return}if(n.key=="ArrowDown"){t.d.selectAll(".sja_menuoption").attr("tabindex",0).on("keyup",(e=>{if(e.key=="Enter"){e.target.click()}else if(e.key=="ArrowDown"){if(e.target.nextSibling)e.target.nextSibling.focus()}else if(e.key=="ArrowUp"){if(e.target.previousSibling)e.target.previousSibling.focus()}}));t.d.select(".sja_menuoption").node().focus();return}l()}));if(!e.focusOff)s.node().focus();const r={mark:n.append("span").style("margin-left","5px"),word:n.append("span").style("margin-left","5px").style("font-size",".8em").style("opacity",.6)};async function a(){const n=s.property("value").trim();if(!n)return;if(e.allowVariant){const t=await Uf(n,e.genome);if(t){return}}const o=Ld(n,e.genome,true);if(o){return}t.showunder(s.node()).clear();try{const o=await Bl("genelookup",{body:{genome:e.genome.name,input:n}});if(o.error)throw o.error;if(!o.hits||o.hits.length==0)return t.hide();for(const n of o.hits){t.d.append("div").text(n).attr("class","sja_menuoption").style("border-radius","0px").attr("isgene",1).on("click",(()=>{if(e.geneOnly){p({geneSymbol:n},n);t.hide()}else{c(n)}}))}}catch(e){t.d.append("div").text(e.message||e)}}const l=td.debounce(a,500);async function c(n){t.hide();try{const o=await Bl("genelookup",{body:{genome:e.genome.name,input:n,deep:1}});if(o.error)throw o.error;if(!o.gmlst||o.gmlst.length==0){if(e.genome.hasSNP){if(n.toLowerCase().startsWith("rs")){await d(n)}else{p(null,"Not a gene or SNP")}}else{p(null,"No match to gene name")}return}const i=Yc(o.gmlst);if(i.length==1){const e=o.gmlst[0].name||n;p(i[0],n,e);return}t.showunder(s.node()).clear();for(const e of i){t.d.append("div").attr("class","sja_menuoption").style("border-radius","0px").text(e.name+" "+e.chr+":"+e.start+"-"+e.stop).on("click",(()=>{t.hide();p(e,n+", "+e.name,e.name)}))}}catch(e){p(null,e.message||e)}}async function d(t){const n=await Bl("snp",{body:{byName:true,genome:e.genome.name,lst:[t]}});if(n.error)throw n.error;if(!n.results||n.results.length==0)throw"Not a gene or SNP";const o=n.results[0];p({chr:o.chrom,start:o.chromStart,stop:o.chromEnd},t)}const f={};if(e.defaultCoord){const t=e.defaultCoord;if(t.isVariant){s.property("value",t.chr+"."+t.pos+"."+t.ref+"."+t.alt);f.pos=t.pos;f.ref=t.ref;f.alt=t.alt}else{s.property("value",t.chr+":"+t.start+"-"+t.stop);f.start=t.start;f.stop=t.stop}f.chr=t.chr}async function p(t,n,o){if(t){for(const e in f)delete f[e];if(t.isVariant){f.chr=t.chr;f.pos=t.pos;f.ref=t.ref;f.alt=t.alt}else if(t.chr){s.property("value",t.chr+":"+t.start+"-"+t.stop);f.chr=t.chr;f.start=t.start;f.stop=t.stop}else if(t.geneSymbol){s.property("value",t.geneSymbol);f.geneSymbol=t.geneSymbol}r.mark.style("color","green").html("✓");if(o){f.geneSymbol=o}}else{r.mark.style("color","red").html("✗")}r.word.text(n||"");f.fromWhat=n;if(t&&e.callback){await e.callback()}}if(e.geneSymbol){s.property("value",e.geneSymbol);setTimeout((()=>p({geneSymbol:e.geneSymbol},e.geneSymbol)),10)}return f}async function Uf(e,t){const n=Bf(e,t);if(n){return n}return await Ff(e,t)}function Bf(e,t){const n=e.split(".");if(n.length!=4)return;const o=n[0];const i=Number(n[1]);const s=Rd(t,o,i,i);if(s)return;return{isVariant:true,chr:o,pos:i,ref:n[2],alt:n[3]}}async function Ff(e,t){const n=e.split(":g.");if(n.length!=2){return}const o=n[0];if(n[1].includes("delins")){return await Jf(o,n[1],t)}if(n[1].includes("del")){return await Gf(o,n[1],t)}if(n[1].includes("ins")){return Hf(o,n[1])}return qf(o,n[1])}function qf(e,t){const n=t.match(/^(\d+)([ATCG])>([ATCG])$/);if(!n||n.length!=4){return}const o=Number(n[1]);if(!Number.isInteger(o))return;return{isVariant:true,chr:e,pos:o,ref:n[2],alt:n[3]}}function Hf(e,t){const[n,o]=t.split("ins");if(!o)return;const i=Number(n.split("_")[0]);if(!Number.isInteger(i))return;return{isVariant:true,chr:e,pos:i+1,ref:"-",alt:o}}async function Gf(e,t,n){const[o,i]=t.split("del");if(i){const t=Number(o.split("_")[0]);if(!Number.isInteger(t))return;return{isVariant:true,chr:e,pos:t,ref:i,alt:"-"}}const[s,r]=o.split("_");const a=Number(s);const l=r?Number(r):a+1;if(!Number.isInteger(a)||!Number.isInteger(l))return;const c=await Vf(e,a,l,n);return{isVariant:true,chr:e,pos:pos,ref:c,alt:"-"}}async function Jf(e,t,n){const o=t.match(/^(\d+)_(\d+)delins([ATCG]+)$/);if(!o||o.length!=4){return}const i=Number(o[1]),s=Number(o[2]),r=o[3];if(!Number.isInteger(i)||!Number.isInteger(s))return;const a=await Vf(e,i,s,n);return{isVariant:true,chr:e,pos:i,ref:a,alt:r}}async function Vf(e,t,n,o){const i={coord:e+":"+t+"-"+n,genome:o.name};const s=await Bl("ntseq",{body:i});return s.seq}function Wf(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function r(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):i(e.value).then(r,a)}l((o=o.apply(e,t||[])).next())}))}class Xf{constructor(e){this.opts=this.validateOpts(e);this.tabs=e.tabs;this.dom={holder:e.holder};this.defaultTabWidth=90;Yf(this)}validateOpts(e){if(!e.holder)throw`missing opts.holder for Tabs()`;if(!Array.isArray(e.tabs))throw`invalid opts.tabs array for Tabs()`;if(!e.linePosition)e.linePosition="bottom";if(e.linePosition!="bottom"&&e.linePosition!="top"&&e.linePosition!="right"&&e.linePosition!="left")throw`Invalid .linePosition arg. Must be either bottom, top, right, or left`;if(!e.tabsPosition)e.tabsPosition="horizontal";if(e.tabsPosition!="horizontal"&&e.tabsPosition!="vertical")throw`Invalid .tabsPosition arg. Must be either vertical or horizontal`;return e}main(){return Wf(this,void 0,void 0,(function*(){try{yield this.render()}catch(e){if(e.stack)console.log(e.stack);else throw e}}))}}function Yf(e){e.render=()=>Wf(this,void 0,void 0,(function*(){const t=e.tabs.find((e=>e.active));if(!t)e.tabs[0].active=true;const n=e.opts.linePosition=="bottom"||e.opts.linePosition=="top"?"center":e.opts.linePosition;e.dom.tabsHolder=e.dom.holder.append("div").style(`border-${e.opts.linePosition}`,"0.5px solid #1575ad");if(!e.opts.contentHolder&&!e.opts.noContent){e.dom.contentHolder=e.dom.holder.append("div")}else e.dom.contentHolder=e.opts.contentHolder;if(e.opts.tabsPosition=="vertical"){e.dom.tabsHolder.style("display","inline-grid").style("align-items","start").style("gap",e.opts.gap||"");e.dom.contentHolder.style("display","inline-block").style("vertical-align","top").style("position","relative")}else e.dom.tabsHolder.style("display","inline-block");yield e.dom.tabsHolder.selectAll("button").data(e.tabs).enter().append("button").attr("data-testid","sja_toggle_button").attr("class","sj-toggle-button").classed("sjpp-active",(e=>e.active)).style("padding","0px").style("width",(e=>e.width?`${e.width}px`:"fit-content")).style("min-width",(t=>t.width?null:Math.max(e.defaultTabWidth))).style("border","none").style("background-color","transparent").style("display",e.opts.tabsPosition=="vertical"?"flex":"inline-grid").property("disabled",(e=>e.disabled?e.disabled():false)).each((function(t){return Wf(this,void 0,void 0,(function*(){t.wrapper=ot(this);if(e.opts.linePosition=="right")t.wrapper.style("justify-self","end");if(e.opts.linePosition=="left")t.wrapper.style("justify-self","start");if(e.opts.linePosition=="top"||e.opts.linePosition=="left"){t.line=t.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-flex":"flex");t.tab=t.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-block":"block")}else{t.tab=t.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-block":"block");t.line=t.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-flex":"flex")}if(t.disabled&&t.isVisible){t.wrapper.style("cursor",t.disabled()==true&&t.isVisible()==true?"not-allowed":"pointer")}t.tab.style("color",t.active?"#1575ad":"#757373").style("text-align",n).style("padding","5px").html(t.label);t.line.style("background-color","#1575ad").style("visibility",t.active?"visible":"hidden");if(e.opts.linePosition=="top"||e.opts.linePosition=="bottom"){t.line.style("height","8px").style("padding","0px 5px")}else{t.line.style("align-self","stretch").style("padding","5px 0px").html('<span style="width: 8px";> </span>')}if(e.dom.contentHolder){t.contentHolder=e.dom.contentHolder.append("div").style("display",t.active?"block":"none");if(e.opts.tabsPosition=="horizontal"&&!e.opts.noTopContentStyle){t.contentHolder.style("padding-top","10px").style("margin-top","10px")}}if(t.active&&t.callback)yield t.callback(event,t);t.wrapper.on("mouseenter",(()=>{t.tab.style("color",t.active?"#757373":"#1575ad")})).on("mouseleave",(()=>{t.tab.style("color",t.active?"#1575ad":"#757373")}))}))})).on("click",((t,n)=>Wf(this,void 0,void 0,(function*(){for(const t of e.tabs){t.active=t===n}const o=e.tabs.findIndex((e=>e.active));e.update(o);if(n.callback)yield n.callback(t,n)}))));const o=e.tabs.findIndex((e=>e.active));e.update(o)}));e.update=(t=0,n={})=>{e.tabs.forEach(((e,n)=>{e.active=t===n}));e.dom.tabsHolder.selectAll("button").data(e.tabs).classed("sjpp-active",(e=>e.active)).each((e=>{e.wrapper.classed("sjpp-active",e.active);if(e.isVisible)e.wrapper.style("display",(e=>n&&e.isVisible()?"":"none"));if(e.contentHolder)e.contentHolder.style("display",e.active?"block":"none");e.tab.style("color",e.active?"#1575ad":"#757373");e.line.style("visibility",e.active?"visible":"hidden")}))}}class Zf{constructor(e){this.opts=e;this.dom={holder:e.holder,trailDiv:e.trailDiv||e.holder.append("div")};Kf(this)}async main(e={}){try{return await this.render()}catch(e){if(e.stack)console.log(e.stack);else throw e}}}function Kf(e){e.render=async()=>{e.crumbs=e.opts.crumbs;for(const t of e.crumbs){t.label=t.label||t.name}const t=e.crumbs.find((e=>e.inTrail));if(!t)e.crumbs[0].inTrail=true;await e.dom.trailDiv.style("margin-left","5px").style("font-size",".75em").style("display","inline-block").classed("sjpp-breadcrumb-trail",true).selectAll("span").data(e.crumbs).enter().append("span").classed("sjpp-breadcrumb",true).html((e=>` > ${e.label}`)).style("display",(e=>e.inTrail?"inline-block":"none")).each((async function(e){if(!e.inTrail)e.inTrail=false;e.crumb=ot(this)}));e.update()};e.update=(t=0)=>{e.crumbs.forEach(((e,n)=>{e.inTrail=t===n}));e.dom.trailDiv.selectAll("span").data(e.crumbs).each((async e=>{e.crumb.style("display",e.inTrail?"inline-block":"none")}))}}var Qf={exports:{}};function ep(e){if(e instanceof Map){e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}}else if(e instanceof Set){e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}}Object.freeze(e);Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];if(typeof n=="object"&&!Object.isFrozen(n)){ep(n)}}));return e}Qf.exports=ep;Qf.exports.default=ep;var tp=Qf.exports;class np{constructor(e){if(e.data===undefined)e.data={};this.data=e.data;this.isMatchIgnored=false}ignoreMatch(){this.isMatchIgnored=true}}function op(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ip(e,...t){const n=Object.create(null);for(const t in e){n[t]=e[t]}t.forEach((function(e){for(const t in e){n[t]=e[t]}}));return n}const sp="</span>";const rp=e=>!!e.kind;const ap=(e,{prefix:t})=>{if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`};class lp{constructor(e,t){this.buffer="";this.classPrefix=t.classPrefix;e.walk(this)}addText(e){this.buffer+=op(e)}openNode(e){if(!rp(e))return;let t=e.kind;if(e.sublanguage){t=`language-${t}`}else{t=ap(t,{prefix:this.classPrefix})}this.span(t)}closeNode(e){if(!rp(e))return;this.buffer+=sp}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class cp{constructor(){this.rootNode={children:[]};this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t={kind:e,children:[]};this.add(t);this.stack.push(t)}closeNode(){if(this.stack.length>1){return this.stack.pop()}return undefined}closeAllNodes(){while(this.closeNode());}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){if(typeof t==="string"){e.addText(t)}else if(t.children){e.openNode(t);t.children.forEach((t=>this._walk(e,t)));e.closeNode(t)}return e}static _collapse(e){if(typeof e==="string")return;if(!e.children)return;if(e.children.every((e=>typeof e==="string"))){e.children=[e.children.join("")]}else{e.children.forEach((e=>{cp._collapse(e)}))}}}class dp extends cp{constructor(e){super();this.options=e}addKeyword(e,t){if(e===""){return}this.openNode(t);this.addText(e);this.closeNode()}addText(e){if(e===""){return}this.add(e)}addSublanguage(e,t){const n=e.root;n.kind=t;n.sublanguage=true;this.add(n)}toHTML(){const e=new lp(this,this.options);return e.value()}finalize(){return true}}function fp(e){if(!e)return null;if(typeof e==="string")return e;return e.source}function pp(e){return up("(?=",e,")")}function up(...e){const t=e.map((e=>fp(e))).join("");return t}function hp(e){const t=e[e.length-1];if(typeof t==="object"&&t.constructor===Object){e.splice(e.length-1,1);return t}else{return{}}}function mp(...e){const t=hp(e);const n="("+(t.capture?"":"?:")+e.map((e=>fp(e))).join("|")+")";return n}function gp(e){return new RegExp(e.toString()+"|").exec("").length-1}function bp(e,t){const n=e&&e.exec(t);return n&&n.index===0}const yp=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function vp(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let o=fp(e);let i="";while(o.length>0){const e=yp.exec(o);if(!e){i+=o;break}i+=o.substring(0,e.index);o=o.substring(e.index+e[0].length);if(e[0][0]==="\\"&&e[1]){i+="\\"+String(Number(e[1])+t)}else{i+=e[0];if(e[0]==="("){n++}}}return i})).map((e=>`(${e})`)).join(t)}const wp=/\b\B/;const xp="[a-zA-Z]\\w*";const _p="[a-zA-Z_]\\w*";const kp="\\b\\d+(\\.\\d+)?";const jp="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";const Np="\\b(0b[01]+)";const Sp="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";const Ap=(e={})=>{const t=/^#![ ]*\//;if(e.binary){e.begin=up(t,/.*\b/,e.binary,/\b.*/)}return ip({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{if(e.index!==0)t.ignoreMatch()}},e)};const Cp={begin:"\\\\[\\s\\S]",relevance:0};const Ep={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Cp]};const Op={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Cp]};const Mp={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/};const Ip=function(e,t,n={}){const o=ip({scope:"comment",begin:e,end:t,contains:[]},n);o.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:true,relevance:0});const i=mp("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);o.contains.push({begin:up(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")});return o};const Tp=Ip("//","$");const Rp=Ip("/\\*","\\*/");const Lp=Ip("#","$");const $p={scope:"number",begin:kp,relevance:0};const zp={scope:"number",begin:jp,relevance:0};const Pp={scope:"number",begin:Np,relevance:0};const Dp={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[Cp,{begin:/\[/,end:/\]/,relevance:0,contains:[Cp]}]}]};const Up={scope:"title",begin:xp,relevance:0};const Bp={scope:"title",begin:_p,relevance:0};const Fp={begin:"\\.\\s*"+_p,relevance:0};const qp=function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{if(t.data._beginMatch!==e[1])t.ignoreMatch()}})};var Hp=Object.freeze({__proto__:null,MATCH_NOTHING_RE:wp,IDENT_RE:xp,UNDERSCORE_IDENT_RE:_p,NUMBER_RE:kp,C_NUMBER_RE:jp,BINARY_NUMBER_RE:Np,RE_STARTERS_RE:Sp,SHEBANG:Ap,BACKSLASH_ESCAPE:Cp,APOS_STRING_MODE:Ep,QUOTE_STRING_MODE:Op,PHRASAL_WORDS_MODE:Mp,COMMENT:Ip,C_LINE_COMMENT_MODE:Tp,C_BLOCK_COMMENT_MODE:Rp,HASH_COMMENT_MODE:Lp,NUMBER_MODE:$p,C_NUMBER_MODE:zp,BINARY_NUMBER_MODE:Pp,REGEXP_MODE:Dp,TITLE_MODE:Up,UNDERSCORE_TITLE_MODE:Bp,METHOD_GUARD:Fp,END_SAME_AS_BEGIN:qp});function Gp(e,t){const n=e.input[e.index-1];if(n==="."){t.ignoreMatch()}}function Jp(e,t){if(e.className!==undefined){e.scope=e.className;delete e.className}}function Vp(e,t){if(!t)return;if(!e.beginKeywords)return;e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)";e.__beforeBegin=Gp;e.keywords=e.keywords||e.beginKeywords;delete e.beginKeywords;if(e.relevance===undefined)e.relevance=0}function Wp(e,t){if(!Array.isArray(e.illegal))return;e.illegal=mp(...e.illegal)}function Xp(e,t){if(!e.match)return;if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match;delete e.match}function Yp(e,t){if(e.relevance===undefined)e.relevance=1}const Zp=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]}));e.keywords=n.keywords;e.begin=up(n.beforeMatch,pp(n.begin));e.starts={relevance:0,contains:[Object.assign(n,{endsParent:true})]};e.relevance=0;delete n.beforeMatch};const Kp=["of","and","for","in","not","or","if","then","parent","list","value"];const Qp="keyword";function eu(e,t,n=Qp){const o=Object.create(null);if(typeof e==="string"){i(n,e.split(" "))}else if(Array.isArray(e)){i(n,e)}else{Object.keys(e).forEach((function(n){Object.assign(o,eu(e[n],t,n))}))}return o;function i(e,n){if(t){n=n.map((e=>e.toLowerCase()))}n.forEach((function(t){const n=t.split("|");o[n[0]]=[e,tu(n[0],n[1])]}))}}function tu(e,t){if(t){return Number(t)}return nu(e)?0:1}function nu(e){return Kp.includes(e.toLowerCase())}const ou={};const iu=e=>{console.error(e)};const su=(e,...t)=>{console.log(`WARN: ${e}`,...t)};const ru=(e,t)=>{if(ou[`${e}/${t}`])return;console.log(`Deprecated as of ${e}. ${t}`);ou[`${e}/${t}`]=true};const au=new Error;function lu(e,t,{key:n}){let o=0;const i=e[n];const s={};const r={};for(let e=1;e<=t.length;e++){r[e+o]=i[e];s[e+o]=true;o+=gp(t[e-1])}e[n]=r;e[n]._emit=s;e[n]._multi=true}function cu(e){if(!Array.isArray(e.begin))return;if(e.skip||e.excludeBegin||e.returnBegin){iu("skip, excludeBegin, returnBegin not compatible with beginScope: {}");throw au}if(typeof e.beginScope!=="object"||e.beginScope===null){iu("beginScope must be object");throw au}lu(e,e.begin,{key:"beginScope"});e.begin=vp(e.begin,{joinWith:""})}function du(e){if(!Array.isArray(e.end))return;if(e.skip||e.excludeEnd||e.returnEnd){iu("skip, excludeEnd, returnEnd not compatible with endScope: {}");throw au}if(typeof e.endScope!=="object"||e.endScope===null){iu("endScope must be object");throw au}lu(e,e.end,{key:"endScope"});e.end=vp(e.end,{joinWith:""})}function fu(e){if(e.scope&&typeof e.scope==="object"&&e.scope!==null){e.beginScope=e.scope;delete e.scope}}function pu(e){fu(e);if(typeof e.beginScope==="string"){e.beginScope={_wrap:e.beginScope}}if(typeof e.endScope==="string"){e.endScope={_wrap:e.endScope}}cu(e);du(e)}function uu(e){function t(t,n){return new RegExp(fp(t),"m"+(e.case_insensitive?"i":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={};this.regexes=[];this.matchAt=1;this.position=0}addRule(e,t){t.position=this.position++;this.matchIndexes[this.matchAt]=t;this.regexes.push([t,e]);this.matchAt+=gp(e)+1}compile(){if(this.regexes.length===0){this.exec=()=>null}const e=this.regexes.map((e=>e[1]));this.matcherRe=t(vp(e,{joinWith:"|"}),true);this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t){return null}const n=t.findIndex(((e,t)=>t>0&&e!==undefined));const o=this.matchIndexes[n];t.splice(0,n);return Object.assign(t,o)}}class o{constructor(){this.rules=[];this.multiRegexes=[];this.count=0;this.lastIndex=0;this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n)));t.compile();this.multiRegexes[e]=t;return t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]);if(t.type==="begin")this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()){if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1;n=t.exec(e)}}if(n){this.regexIndex+=n.position+1;if(this.regexIndex===this.count){this.considerAll()}}return n}}function i(e){const t=new o;e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"})));if(e.terminatorEnd){t.addRule(e.terminatorEnd,{type:"end"})}if(e.illegal){t.addRule(e.illegal,{type:"illegal"})}return t}function s(n,o){const r=n;if(n.isCompiled)return r;[Jp,Xp,pu,Zp].forEach((e=>e(n,o)));e.compilerExtensions.forEach((e=>e(n,o)));n.__beforeBegin=null;[Vp,Wp,Yp].forEach((e=>e(n,o)));n.isCompiled=true;let a=null;if(typeof n.keywords==="object"&&n.keywords.$pattern){n.keywords=Object.assign({},n.keywords);a=n.keywords.$pattern;delete n.keywords.$pattern}a=a||/\w+/;if(n.keywords){n.keywords=eu(n.keywords,e.case_insensitive)}r.keywordPatternRe=t(a,true);if(o){if(!n.begin)n.begin=/\B|\b/;r.beginRe=t(n.begin);if(!n.end&&!n.endsWithParent)n.end=/\B|\b/;if(n.end)r.endRe=t(n.end);r.terminatorEnd=fp(n.end)||"";if(n.endsWithParent&&o.terminatorEnd){r.terminatorEnd+=(n.end?"|":"")+o.terminatorEnd}}if(n.illegal)r.illegalRe=t(n.illegal);if(!n.contains)n.contains=[];n.contains=[].concat(...n.contains.map((function(e){return mu(e==="self"?n:e)})));n.contains.forEach((function(e){s(e,r)}));if(n.starts){s(n.starts,o)}r.matcher=i(r);return r}if(!e.compilerExtensions)e.compilerExtensions=[];if(e.contains&&e.contains.includes("self")){throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")}e.classNameAliases=ip(e.classNameAliases||{});return s(e)}function hu(e){if(!e)return false;return e.endsWithParent||hu(e.starts)}function mu(e){if(e.variants&&!e.cachedVariants){e.cachedVariants=e.variants.map((function(t){return ip(e,{variants:null},t)}))}if(e.cachedVariants){return e.cachedVariants}if(hu(e)){return ip(e,{starts:e.starts?ip(e.starts):null})}if(Object.isFrozen(e)){return ip(e)}return e}var gu="11.2.0";const bu=op;const yu=ip;const vu=Symbol("nomatch");const wu=7;const xu=function(e){const t=Object.create(null);const n=Object.create(null);const o=[];let i=true;const s="Could not find the language '{}', did you forget to load/include a language module?";const r={disableAutodetect:true,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:false,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:dp};function l(e){return a.noHighlightRe.test(e)}function c(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=a.languageDetectRe.exec(t);if(n){const t=N(n[1]);if(!t){su(s.replace("{}",n[1]));su("Falling back to no-highlight mode for this block.",e)}return t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>l(e)||N(e)))}function d(e,t,n){let o="";let i="";if(typeof t==="object"){o=e;n=t.ignoreIllegals;i=t.language}else{ru("10.7.0","highlight(lang, code, ...args) has been deprecated.");ru("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");i=e;o=t}if(n===undefined){n=true}const s={code:o,language:i};O("before:highlight",s);const r=s.result?s.result:f(s.language,s.code,n);r.code=s.code;O("after:highlight",r);return r}function f(e,n,o,r){const l=Object.create(null);function c(e,t){return e.keywords[t]}function d(){if(!C.keywords){O.addText(M);return}let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(M);let n="";while(t){n+=M.substring(e,t.index);const o=j.case_insensitive?t[0].toLowerCase():t[0];const i=c(C,o);if(i){const[e,s]=i;O.addText(n);n="";l[o]=(l[o]||0)+1;if(l[o]<=wu)I+=s;if(e.startsWith("_")){n+=t[0]}else{const n=j.classNameAliases[e]||e;O.addKeyword(t[0],n)}}else{n+=t[0]}e=C.keywordPatternRe.lastIndex;t=C.keywordPatternRe.exec(M)}n+=M.substr(e);O.addText(n)}function p(){if(M==="")return;let e=null;if(typeof C.subLanguage==="string"){if(!t[C.subLanguage]){O.addText(M);return}e=f(C.subLanguage,M,true,E[C.subLanguage]);E[C.subLanguage]=e._top}else{e=u(M,C.subLanguage.length?C.subLanguage:null)}if(C.relevance>0){I+=e.relevance}O.addSublanguage(e._emitter,e.language)}function h(){if(C.subLanguage!=null){p()}else{d()}M=""}function m(e,t){let n=1;while(t[n]!==undefined){if(!e._emit[n]){n++;continue}const o=j.classNameAliases[e[n]]||e[n];const i=t[n];if(o){O.addKeyword(i,o)}else{M=i;d();M=""}n++}}function g(e,t){if(e.scope&&typeof e.scope==="string"){O.openNode(j.classNameAliases[e.scope]||e.scope)}if(e.beginScope){if(e.beginScope._wrap){O.addKeyword(M,j.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap);M=""}else if(e.beginScope._multi){m(e.beginScope,t);M=""}}C=Object.create(e,{parent:{value:C}});return C}function b(e,t,n){let o=bp(e.endRe,n);if(o){if(e["on:end"]){const n=new np(e);e["on:end"](t,n);if(n.isMatchIgnored)o=false}if(o){while(e.endsParent&&e.parent){e=e.parent}return e}}if(e.endsWithParent){return b(e.parent,t,n)}}function y(e){if(C.matcher.regexIndex===0){M+=e[0];return 1}else{L=true;return 0}}function v(e){const t=e[0];const n=e.rule;const o=new np(n);const i=[n.__beforeBegin,n["on:begin"]];for(const n of i){if(!n)continue;n(e,o);if(o.isMatchIgnored)return y(t)}if(n.skip){M+=t}else{if(n.excludeBegin){M+=t}h();if(!n.returnBegin&&!n.excludeBegin){M=t}}g(n,e);return n.returnBegin?0:t.length}function w(e){const t=e[0];const o=n.substr(e.index);const i=b(C,e,o);if(!i){return vu}const s=C;if(C.endScope&&C.endScope._wrap){h();O.addKeyword(t,C.endScope._wrap)}else if(C.endScope&&C.endScope._multi){h();m(C.endScope,e)}else if(s.skip){M+=t}else{if(!(s.returnEnd||s.excludeEnd)){M+=t}h();if(s.excludeEnd){M=t}}do{if(C.scope){O.closeNode()}if(!C.skip&&!C.subLanguage){I+=C.relevance}C=C.parent}while(C!==i.parent);if(i.starts){g(i.starts,e)}return s.returnEnd?0:t.length}function x(){const e=[];for(let t=C;t!==j;t=t.parent){if(t.scope){e.unshift(t.scope)}}e.forEach((e=>O.openNode(e)))}let _={};function k(t,s){const r=s&&s[0];M+=t;if(r==null){h();return 0}if(_.type==="begin"&&s.type==="end"&&_.index===s.index&&r===""){M+=n.slice(s.index,s.index+1);if(!i){const t=new Error(`0 width match regex (${e})`);t.languageName=e;t.badRule=_.rule;throw t}return 1}_=s;if(s.type==="begin"){return v(s)}else if(s.type==="illegal"&&!o){const e=new Error('Illegal lexeme "'+r+'" for mode "'+(C.scope||"<unnamed>")+'"');e.mode=C;throw e}else if(s.type==="end"){const e=w(s);if(e!==vu){return e}}if(s.type==="illegal"&&r===""){return 1}if(R>1e5&&R>s.index*3){const e=new Error("potential infinite loop, way more iterations than matches");throw e}M+=r;return r.length}const j=N(e);if(!j){iu(s.replace("{}",e));throw new Error('Unknown language: "'+e+'"')}const S=uu(j);let A="";let C=r||S;const E={};const O=new a.__emitter(a);x();let M="";let I=0;let T=0;let R=0;let L=false;try{C.matcher.considerAll();for(;;){R++;if(L){L=false}else{C.matcher.considerAll()}C.matcher.lastIndex=T;const e=C.matcher.exec(n);if(!e)break;const t=n.substring(T,e.index);const o=k(t,e);T=e.index+o}k(n.substr(T));O.closeAllNodes();O.finalize();A=O.toHTML();return{language:e,value:A,relevance:I,illegal:false,_emitter:O,_top:C}}catch(t){if(t.message&&t.message.includes("Illegal")){return{language:e,value:bu(n),illegal:true,relevance:0,_illegalBy:{message:t.message,index:T,context:n.slice(T-100,T+100),mode:t.mode,resultSoFar:A},_emitter:O}}else if(i){return{language:e,value:bu(n),illegal:false,relevance:0,errorRaised:t,_emitter:O,_top:C}}else{throw t}}}function p(e){const t={value:bu(e),illegal:false,relevance:0,_top:r,_emitter:new a.__emitter(a)};t._emitter.addText(e);return t}function u(e,n){n=n||a.languages||Object.keys(t);const o=p(e);const i=n.filter(N).filter(A).map((t=>f(t,e,false)));i.unshift(o);const s=i.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language){return 1}else if(N(t.language).supersetOf===e.language){return-1}}return 0}));const[r,l]=s;const c=r;c.secondBest=l;return c}function h(e,t,o){const i=t&&n[t]||o;e.classList.add("hljs");e.classList.add(`language-${i}`)}function m(e){let t=null;const n=c(e);if(l(n))return;O("before:highlightElement",{el:e,language:n});if(!a.ignoreUnescapedHTML&&e.children.length>0){console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");console.warn("https://github.com/highlightjs/highlight.js/issues/2886");console.warn(e)}t=e;const o=t.textContent;const i=n?d(o,{language:n,ignoreIllegals:true}):u(o);e.innerHTML=i.value;h(e,n,i.language);e.result={language:i.language,re:i.relevance,relevance:i.relevance};if(i.secondBest){e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}}O("after:highlightElement",{el:e,result:i,text:o})}function g(e){a=yu(a,e)}const b=()=>{w();ru("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){w();ru("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let v=false;function w(){if(document.readyState==="loading"){v=true;return}const e=document.querySelectorAll(a.cssSelector);e.forEach(m)}function x(){if(v)w()}if(typeof window!=="undefined"&&window.addEventListener){window.addEventListener("DOMContentLoaded",x,false)}function _(n,o){let s=null;try{s=o(e)}catch(e){iu("Language definition for '{}' could not be registered.".replace("{}",n));if(!i){throw e}else{iu(e)}s=r}if(!s.name)s.name=n;t[n]=s;s.rawDefinition=o.bind(null,e);if(s.aliases){S(s.aliases,{languageName:n})}}function k(e){delete t[e];for(const t of Object.keys(n)){if(n[t]===e){delete n[t]}}}function j(){return Object.keys(t)}function N(e){e=(e||"").toLowerCase();return t[e]||t[n[e]]}function S(e,{languageName:t}){if(typeof e==="string"){e=[e]}e.forEach((e=>{n[e.toLowerCase()]=t}))}function A(e){const t=N(e);return t&&!t.disableAutodetect}function C(e){if(e["before:highlightBlock"]&&!e["before:highlightElement"]){e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}}if(e["after:highlightBlock"]&&!e["after:highlightElement"]){e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))}}}function E(e){C(e);o.push(e)}function O(e,t){const n=e;o.forEach((function(e){if(e[n]){e[n](t)}}))}function M(e){ru("10.7.0","highlightBlock will be removed entirely in v12.0");ru("10.7.0","Please use highlightElement now.");return m(e)}Object.assign(e,{highlight:d,highlightAuto:u,highlightAll:w,highlightElement:m,highlightBlock:M,configure:g,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:_,unregisterLanguage:k,listLanguages:j,getLanguage:N,registerAliases:S,autoDetection:A,inherit:yu,addPlugin:E});e.debugMode=function(){i=false};e.safeMode=function(){i=true};e.versionString=gu;for(const e in Hp){if(typeof Hp[e]==="object"){tp(Hp[e])}}Object.assign(e,Hp);return e};var _u=xu({});var ku=_u;const ju="[A-Za-z$_][0-9A-Za-z$_]*";const Nu=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"];const Su=["true","false","null","undefined","NaN","Infinity"];const Au=["Intl","DataView","Number","Math","Date","String","RegExp","Object","Function","Boolean","Error","Symbol","Set","Map","WeakSet","WeakMap","Proxy","Reflect","JSON","Promise","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Float32Array","Array","Uint8Array","Uint8ClampedArray","ArrayBuffer","BigInt64Array","BigUint64Array","BigInt"];const Cu=["EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"];const Eu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"];const Ou=["arguments","this","super","console","window","document","localStorage","module","global"];const Mu=[].concat(Eu,Au,Cu);function Iu(e){if(!e)return null;if(typeof e==="string")return e;return e.source}function Tu(e){return Ru("(?=",e,")")}function Ru(...e){const t=e.map((e=>Iu(e))).join("");return t}function Lu(e){const t=(e,{after:t})=>{const n="</"+e[0].slice(1);const o=e.input.indexOf(n,t);return o!==-1};const n=ju;const o={begin:"<>",end:"</>"};const i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const o=e[0].length+e.index;const i=e.input[o];if(i==="<"){n.ignoreMatch();return}if(i===">"){if(!t(e,{after:o})){n.ignoreMatch()}}}};const s={$pattern:ju,keyword:Nu,literal:Su,built_in:Mu,"variable.language":Ou};const r="[0-9](_?[0-9])*";const a=`\\.(${r})`;const l=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;const c={className:"number",variants:[{begin:`(\\b(${l})((${a})|\\.)?|(${a}))`+`[eE][+-]?(${r})\\b`},{begin:`\\b(${l})\\b((${a})\\b|\\.)?|(${a})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0};const d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]};const f={begin:"html`",end:"",starts:{end:"`",returnEnd:false,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}};const p={begin:"css`",end:"",starts:{end:"`",returnEnd:false,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}};const u={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]};const h=e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:true,excludeBegin:true,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:true,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]});const m={className:"comment",variants:[h,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]};const g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,u,c,e.REGEXP_MODE];d.contains=g.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(g)});const b=[].concat(m,d.contains);const y=b.concat([{begin:/\(/,end:/\)/,keywords:s,contains:["self"].concat(b)}]);const v={className:"params",begin:/\(/,end:/\)/,excludeBegin:true,excludeEnd:true,keywords:s,contains:y};const w={variants:[{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}},{match:[/extends/,/\s+/,Ru(n,"(",Ru(/\./,n),")*")],scope:{1:"keyword",3:"title.class.inherited"}}]};const x={relevance:0,match:/\b[A-Z][a-z]+([A-Z][a-z]+)*/,className:"title.class",keywords:{_:[...Au,...Cu]}};const _={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/};const k={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/};const j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function N(e){return Ru("(?!",e.join("|"),")")}const S={match:Ru(/\b/,N([...Eu,"super"]),n,Tu(/\(/)),className:"title.function",relevance:0};const A={begin:Ru(/\./,Tu(Ru(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:true,keywords:"prototype",className:"property",relevance:0};const C={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]};const E="(\\("+"[^()]*(\\("+"[^()]*(\\("+"[^()]*"+"\\)[^()]*)*"+"\\)[^()]*)*"+"\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>";const O={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,Tu(E)],className:{1:"keyword",3:"title.function"},contains:[v]};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:y},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),_,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,u,m,c,x,{className:"attr",begin:n+Tu(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:true,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:true},{begin:/\(/,end:/\)/,excludeBegin:true,excludeEnd:true,keywords:s,contains:y}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:true,contains:["self"]}]}]},k,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\("+"[^()]*(\\("+"[^()]*(\\("+"[^()]*"+"\\)[^()]*)*"+"\\)[^()]*)*"+"\\)\\s*\\{",returnBegin:true,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},A,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},S,j,w,C,{match:/\$[(.]/}]}}function $u(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01};const n={match:/[{}[\],:]/,className:"punctuation",relevance:0};const o={beginKeywords:["true","false","null"].join(" ")};return{name:"JSON",contains:[t,n,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}ku.registerLanguage("javascript",Lu);ku.registerLanguage("json",$u);async function zu(e,t){const n=Qd(t.sandboxDiv);n.header_row;n.header.append("span").text(e.name);n.body.style("overflow","hidden").style("background-color","white");if(e.type=="nestedCard")return Pu(e,n,t);const o=e.sandboxJson?await Bl(`${t.app.cardsPath}/${e.sandboxJson}.json`):await Bl(`${t.app.cardsPath}/${e.sandboxHtml}.txt`);if(o.error){xc(n.body.insert("div","div"),o.error);return}if(e.type=="card")return Du(e,o,n,t);if(e.type=="dsButton")return th(t,o,n)}async function Pu(e,t,n){t.body.style("justify-content","center").style("background-color","#f2ebdc");const o=t.body.append("ul").style("list-style","none").style("display","grid").style("grid-template-columns","40vw 40vw").style("grid-template-rows","repeat(1, auto)").style("gap","5px");const i=e.children.filter((e=>!e.hidden));t.header.trail=new Zf({holder:t.header,crumbs:i});i.forEach((e=>{const s=o.append("li");s.attr("class","sjpp-app-drawer-card").style("padding","10px").style("margin","5px").html(`<p style="margin-left: 12px; font-size:14.5px;font-weight:500; display: block;">${e.name}</p>\n\t\t\t<p style="display: block; font-size: 13px; font-weight: 300; margin-left: 20px; justify-content: center; font-style:oblique; color: #403f3f;">${e.description}</p>`).on("click",(async s=>{s.stopPropagation();o.selectAll("*").remove();const r=e.sandboxJson?await Bl(`${n.app.cardsPath}/${e.sandboxJson}.json`):await Bl(`${n.app.cardsPath}/${e.sandboxHtml}.txt`);if(r.error){xc(t.body.insert("div","div"),r.error);return}if(e.type=="card"){t.header.trail.main();const o=i.findIndex((t=>t==e));t.header.trail.update(o);Du(e,r,t,n)}if(e.type=="dsButton")return th(n.app.opts,r,t)}));return JSON.stringify(s)}))}async function Du(e,t,n,o){if(e.sandboxHtml){const e=await t.text();return n.body.append("div").style("padding","0vw 0vw 2vw 0vw").append("div").style("background-color","white").style("margin","0vw 10vw").style("padding","10px").append("div").style("margin","0vw 5vw").html(e)}n.body.style("background-color","white");const i={intro:t.intro,ppcalls:t.ppcalls.filter((e=>!e.hidden)),buttons:t.buttons,arrowButtons:t.arrowButtons,ribbonMessage:t.ribbonMessage,citation:t.citation_id};Hu(i.intro,n.body);if(e.ribbon)Hu(i.ribbonMessage,n.body,e.ribbon);const s=n.body.append("div");const r=n.body.append("div");Gu(i.buttons,s);Vu(i,"main",s,r,o);if(e.disableTopTabs)Uu(i.ppcalls[0],n.body,e,o);else{const t=n.body.append("div").style("display","flex").style("align-content","end").style("justify-content","center").style("border","none").style("border-bottom","1px solid lightgray").style("width","100%").style("font-size","20px");const s=n.body.append("div");Fu(i.ppcalls,e,t,s,n,o)}}function Uu(e,t,n,o){Hu(e.message,t);const i=t.append("div").style("margin-bottom","20px");const s=t.append("div");Gu(e.buttons,i);Xu(e.download,i,n.section);Wu(e.urlparam,i,n.section);Vu(e,"call",i,s,o);if(!n.disableTopTabs){t.append("hr").style("border","0").style("border-top","1px dashed #e3e3e6").style("width","100%")}const r={holder:t.append("div").style("margin","20px").node(),host:window.location.origin};const a=JSON.parse(JSON.stringify(e.runargs));runproteinpaint(Object.assign(r,a))}function Bu(e,t,n,o){const i=[];const s=e.findIndex((e=>e.isUi==true));const r=e.findIndex((e=>e.isUi==undefined));const a=s!=-1?true:false;if(a==true){i.push({label:"Add Your Data",active:false,callback:async(t,n)=>{try{const t={holder:n.contentHolder.append("div").style("margin","20px").node(),sandbox_header:n.contentHolder,host:window.location.origin};const o=JSON.parse(JSON.stringify(e[s].runargs));runproteinpaint(Object.assign(t,o));delete n.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}if(e.length==1&&a!=true||e.length==2&&a==true){i.push({label:"Example",active:false,callback:async(n,i)=>{try{Uu(e[r],i.contentHolder,t,o);delete i.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}if(e.length>1&&a==false||e.length>2&&a==true){i.push({label:"Examples",active:false,callback:async(i,s)=>{try{const i=e.filter((e=>e.isUi!=true));qu(t,s.contentHolder,i,n,o);delete s.callback}catch(e){if(e.stack)console.log(e.stack);else throw e}}})}return i}function Fu(e,t,n,o,i,s){const r=Bu(e,t,i,s);new Xf({holder:n,contentHolder:o,tabs:r}).main()}async function qu(e,t,n,o,i){const s=n.map(((t,n)=>r(t,n,e.section)));o.header.trail=await new Zf({holder:o.header,crumbs:s});function r(e,t,n){return{active:t===0,label:e.label,callback:async(t,r)=>{const a=Kc(r.contentHolder);try{if(!r.rendered){yc(r.contentHolder);Uu(e,r.contentHolder,n,i);a.remove()}r.rendered=true;const t=s.findIndex((e=>e==r));o.header.trail.update(t)}catch(e){a.text("Error: "+(e.message||e))}}}}o.header.trail.main();const a=t.append("div").style("display","grid").style("grid-template-columns","minmax(min-content, 10vw) minmax(60vw, 1fr)").classed("sjpp-vertical-tab-menu",true).style("word-break","break-word");const l=a.append("div").classed("sjpp-tabs-div",true).style("border-right","1px solid lightgray");const c=a.append("div").classed("sjpp-content-div",true);new Xf({holder:l,contentHolder:c,tabs:s,linePosition:"right",tabsPosition:"vertical",gap:"10px"}).main()}function Hu(e,t,n){if(n&&n.expireDate){const o=new Date;const i=new Date(n.expireDate);if(i>o&&e!=undefined&&e){function s(){const e=n.text.toLowerCase();return e[0].toUpperCase()+e.slice(1)}t.append("div").style("margin","20px").html(`<p style="display:inline-block;font-weight:bold">${s()}:  </p>${e}`)}}else if(e!=undefined&&e){t.append("div").style("margin","20px").html(e)}}function Gu(e,t){if(e){e.forEach((e=>{const n=Pf({div:t,text:e.name});n.on("click",(t=>{t.stopPropagation();if(e.download)window.open(`${e.download}`,"_self","download");else window.open(`${e.link}`,`${e.name}`)}))}))}}function Ju(e,t){if(e){e.forEach((e=>{const n=`<div style="margin:10px;" class="sjpp-arrow-content">\n\t\t\t\t${e.message?`<div style="margin: 1vw;">${e.message}</div>`:""}\n\t\t\t\t${e.links?e.links.map((e=>{if(!e)return"";if(e.download){return`<a style="cursor:pointer; margin-left:20px;" onclick="event.stopPropagation();" href="${e.download}", target="_self" download>${e.name}</a>`}if(e.link){return`<a style="cursor:pointer; margin-left:20px;" onclick="event.stopPropagation();" href="${e.link}", target="_blank">${e.name}</a>`}})).join(""):""}</div>`;t.push({name:e.name,callback:async e=>{try{e.append("div").html(n)}catch(e){alert("Error: "+e)}}})}))}}async function Vu(e,t,n,o,i){let s=[];if(t=="call")Yu(e,s);if(e.datapreview)eh(s,e.datapreview);if(t=="main"&&e.citation){const t=await Bl(`/${i.app.cardsPath}/citations.json`);if(t.error){console.log(`Error: ${t.error}`);return}for(const n of t.publications){if(e.citation==n.id)Ku(s,n)}}Ju(e.arrowButtons,s);const r=s.findIndex((e=>e.active))==-1?false:true;for(let e=0;e<s.length;e++){const t=s[e];t.btn=Pf({div:n,text:t.name+" ▼"});t.c=o.append("div").style("margin","20px 0px 10px 20px").style("display",r&&e==0||t.active?"block":"none");if(r&&e==0&&t.callback||t.active){t.callback(t.c);delete t.callback}t.btn.on("click",(()=>{if(t.c.style("display")!="none"){t.btn.text(t.name+" ▼").style("color","black").style("background-color","#cfe2f3");t.c.style("display","none")}else{t.btn.text(t.name+" ▲").style("color","whitesmoke").style("background-color","#487ba8");yc(t.c);for(let t=0;t<s.length;t++){if(e!=t){s[t].btn.text(s[t].name+" ▼").style("color","black").style("background-color","#cfe2f3");s[t].c.style("display","none")}}}if(t.callback){t.callback(t.c);delete t.callback}}))}}function Wu(e,t,n){if(e){const o=Pf({div:t,text:n=="apps"?"Run app from URL":"Run track from URL"});o.on("click",(t=>{const n=oh();t.stopPropagation();window.open(`${n}${e}`,"_blank")}))}}function Xu(e,t,n){if(e){const o=Pf({div:t,text:n=="apps"?"Download App File(s)":"Download Track File(s)"});o.on("click",(t=>{t.stopPropagation();window.open(`${e}`,"_self","download")}))}}async function Yu(e,t){if(e.isUi==true)return;const n=ku.highlight(`runproteinpaint({\n host: "${window.location.origin}",\n holder: document.getElementById('a'),\n `+JSON.stringify(e.runargs,"",4).replaceAll(/"(.+)"\s*:/g,"$1:").replaceAll(/\\t/g,"\t").replaceAll(/\\n/g,"\r\t").slice(1,-1).trim()+`\r})`,{language:"javascript"}).value;const o=`<pre style="border: 1px solid #d7d7d9; align-items: center; justify-content: center; margin: 0px 10px 5px 30px; overflow:auto; max-height:400px; ${e.jsonpath?`min-height:400px;`:`min-height: auto;`}">\n\t<code style="font-size:14px; display:block;">${n}</code></pre>`;t.push({name:"Code",callback:async t=>{try{if(e.jsonpath){const n=await Zu(e);const i="<p style='margin:20px 5px 20px 25px;'>ProteinPaint JS code</p>";const s=t.append("div").style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(100px, 1fr))").style("gap","5px");s.append("div").style("display","block").html(i+o);s.append("div").style("display","block").html(n)}else{t.append("div").html(o)}}catch(e){alert("Error: "+e)}}})}async function Zu(e){const t=await Ll("textfile",{file:e.jsonpath});const n=JSON.parse(t.text);const o=e.jsonpath.split("/");const i=o[o.length-1];let s=JSON.stringify(n,"",4).split("\n");let r;if(s.length>120){s=s.slice(0,100);r=true}const a=ku.highlight(s.join("\n"),{language:"json"}).value;const l=`<div>\n\t\t\t<p style="margin: 20px 5px 20px 25px; display: inline-block;">JSON code </p>\n\t\t\t<p style="display: inline-block; color: #696969; font-style:oblique;"> (contents of ${i})</p>\n\t\t</div> \n\t\t<pre style="border: 1px solid #d7d7d9; align-items: center; justify-content: center; margin: 0px 10px 5px 10px; max-height:400px; min-height:400px; overflow:auto;">\n\t\t\t<code class="sjpp-json-code" style="font-size:14px; display:block;">${r==true?`${a} ...<br><p style='margin:20px 25px; justify-content:center;'>Showing first 100 lines. To see the entire JSON, download ${i} from the button above.</p>`:`${a}`}\n\t\t\t</code>\n\t\t</pre>`;return l}function Ku(e,t){e.push({name:"Citation",callback:async e=>{try{e.append("div").style("margin-left","5w").html(`<p style="display: inline-block;">${t.title}. <em>${t.journal}</em>, ${t.year}. </p>\n\t\t\t\t\t\t${t.pmid?`<p style="display: inline-block;">PMID: <a href="${t.pmidURL}" target="_blank">${t.pmid}</a></p>`:`<p>doi: <a href="${t.doi}" target="_blank style="display: inline-block;">${t.doi}</a></p>`}`)}catch(e){alert("Error: "+e)}}})}function Qu(e,t,n,o,i){n.append("div").html(`\n\t\t${i?`<p style="display:block;">${i}<p>`:""}\n\t\t<p style="display: inline-block;">Data preview <span style="color: #696969; font-style:oblique;"> \n\t\t${t>10?`(first ${e.length} rows of ${o})</span></p>`:`(content of ${o})</span></p>`} \n\t`);const s=n.append("div").style("display","grid").style("grid-template-columns","1fr").style("max-width","80%").style("margin-left","10px").style("border","1px solid rgb(227, 227, 230)").style("white-space","pre").style("overflow-x","scroll").style("opacity","0.65").style("padding","1vw");e.forEach((e=>{s.append("code").html(e)}))}async function eh(e,t,n){e.push({name:"View Data",callback:async e=>{try{for(const n of t){const t=await Bl(`/cardsjson?datafile=${n.file}&tabixCoord=${n.tabixQueryCoord}`);if(t.error){console.log(`Error: ${t.error}`);return}const o=t.file;const i=o.length;const s=o.slice(0,10);const r=n.file.split("/");const a=r[r.length-1];Qu(s,i,e,a,n.message)}}catch(e){alert("Error: "+e)}}})}async function th(e,t,n){const o=e?.fromApp?e.genomes[t.button.availableGenomes[0]]:e.app.opts.genomes[t.button.availableGenomes[0]];const i=e?.fromApp?e.genomes:e.app.opts.genomes;const s={availableGenomes:t.button.availableGenomes,genome:o,intro:t.button.intro,name:t.button.name,runargs:t.button.runargs,searchBar:t.button.searchBar,dsURLparam:t.button.dsURLparam};const r=n.body.append("div").style("padding","1em").style("border-bottom","1px solid #d0e3ff");if(s.intro){r.append("div").style("line-height","1.5em").style("padding","0.5em 0.5em 1em 0.5em").html(s.intro)}if(s.searchBar=="none"){const e={holder:n.body.append("div").style("margin","20px").style("overflow-x","auto").node(),host:s.runargs.host||window.location.origin};const t=JSON.parse(JSON.stringify(s.runargs));runproteinpaint(Object.assign(e,t));return}d(r,i);const a=r.append("div").style("display","inline-block").style("padding","0.5em");const l=n.body.append("div").style("max-width","90vw");const c=Df({genome:s.genome,tip:new ec({padding:""}),row:a,geneOnly:s.searchBar=="gene"?true:false,focusOff:true,callback:async e=>{const t=l.insert("div",":first-child").style("max-width","90vw").style("margin","1vw");t.append("div").style("display","inline-block").style("cursor","default").style("margin","0px").style("font-size","1.5em").html("×").on("click",(()=>{t.selectAll("*").remove()}));nh(t,c,s);const n={holder:t.append("div").style("margin","20px").node(),host:window.location.origin,genome:s.genome.name};s.runargs.block==true?(n.position=`${c.chr}:${c.start}-${c.stop}`)&&(n.nativetracks="Refgene"):n.gene=c.geneSymbol;const o=JSON.parse(JSON.stringify(s.runargs));runproteinpaint(Object.assign(n,o))}});function d(e,t){e.append("div").style("display","inline-block").style("padding","10px 10px 0px 20px");const n=[];if(s.availableGenomes.length==1){n.push({label:s.availableGenomes[0],disabled:()=>true,isVisible:()=>true})}else{s.availableGenomes.forEach((e=>{n.push({label:e,callback:(n,o)=>{s.genome=t[e]}})}))}new Xf({holder:e,tabs:n,noContent:true}).main()}}function nh(e,t,n){const o=Pf({div:e,text:"Run Result from URL"});const i=n.runargs.block==true?`position=${t.chr}:${t.start}-${t.stop}`:`gene=${t.geneSymbol}`;o.on("click",(e=>{e.stopPropagation();const t=oh();window.open(`${t}/?genome=${n.genome.name}&${i}&${n.dsURLparam}`,"_blank")}))}function oh(){const e=sessionStorage.getItem("hostURL");if(e.startsWith("http://localhost")||e.startsWith("https://pp")){return e}else return"https://proteinpaint.stjude.org"}var ih=Object.freeze({__proto__:null,openSandbox:zu});class sh{constructor(e){this.type="card";this.opts=this.validateOpts(e);this.holder=e.holder;this.dom=e.dom;this.sandboxDiv=e.sandboxDiv;ah(this)}validateOpts(e){if(!e.element.name)throw`Card .name is missing`;if(e.element.type=="card"){if(!e.element.sandboxJson&&!e.element.sandboxHtml)throw`Either .sandboxJson or .sandboxHtml is missing for card=${e.element.name}`}if(e.element.type=="nestedCard"){if(!e.element.children||e.element.children.length==0)throw`Missing .children for nested card = ${e.element.name}`}if(e.element.ribbon){if(!e.element.ribbon.text)throw`Missing ribbon .text for ${e.element.type} = ${e.element.name}`;if((e.element.ribbon.text.toUpperCase()=="NEW"||e.element.ribbon.text.toUpperCase()=="UPDATED")&&!e.element.ribbon.expireDate)throw`${e.element.type} = ${e.element.name} ribbon is ${e.element.ribbon.text.toUpperCase()} but .expireDate is missing. Please provide`;if(e.element.ribbon.expireDate){if(e.element.ribbon.expireDate>=0){throw`Flag for ${e.element.type} = ${e.element.name} is not a valid date`}}}return e}main(){}}const rh=dl(sh);function ah(e){const t=e.holder.append("li");if(e.opts.element.type=="card"){t.classed("sjpp-track",true).html(`<div class="sjpp-track-h"><span style="font-size:14.5px;font-weight:500;">${e.opts.element.name}</span></div>\n\t\t\t\t${e.opts.element.description?`<span class="sjpp-track-blurb" style="cursor:default">${e.opts.element.description}</span></div>`:" "}\n\t\t\t\t<span class="sjpp-track-image"><img src="${e.opts.element.image}" alt="${e.opts.element.description}"></img></span>\n\t\t\t\t</div>`)}else if(e.opts.element.type=="nestedCard"){t.classed("sjpp-app-drawer-card",true).html(`<p style="margin-left: 12px; font-size:14.5px;font-weight:500; display: block;">${e.opts.element.name}</p>\n\t\t\t<p style="display: block; font-size: 13px; font-weight: 300; margin-left: 20px; justify-content: center; font-style:oblique; color: #403f3f;">${e.opts.element.description}</p>`)}e.makeRibbon=function(e){const n=t.append("div").classed("sjpp-app-drawer-card-ribbon",true).style("align-items","center").style("justify-content","center");const o=e.text.toUpperCase();const i=o=="BETA"?"#418cb5":o=="NEW"?"#1ba176":o=="UPDATED"?"orange":e.color?e.color:"red";n.append("span").text(o).style("color","white").style("background-color",Kt(i).darker()).style("height","auto").style("width","100%").style("top","15%").style("left","-30%").style("font-size","11.5px").style("text-transform","uppercase").style("text-align","center")};if(e.opts.element.ribbon){const t=new Date;const n=new Date(e.opts.element.ribbon.expireDate);if(n>t||n=="Invalid Date")e.makeRibbon(e.opts.element.ribbon)}t.on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active",value:false});vh(e);await zu(e.opts.element,e.opts)}))}class lh{constructor(e){this.type="button";this.opts=this.validateOpts(e);this.holder=e.holder;this.dom=e.dom;this.sandboxDiv=e.sandboxDiv;dh(this)}validateOpts(e){if(!e.element.name)throw`Button name is missing`;if(!e.element.sandboxJson&&!e.element.sandboxHtml)throw`Either .sandboxJson or .sandboxHtml is missing for button=${e.element.name}`;return e}main(){}}const ch=al(lh);function dh(e){const t=Pf({div:e.holder,text:e.opts.element.name,margin:"20px 20px 0px"});t.attr("class","sjpp-appdrawer-dataset-btn").on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active",value:false});vh(e);await zu(e.opts.element,e.opts)}))}class fh{constructor(e){this.type="layout";this.dom={holder:e.dom.drawerDiv,wrapper:e.dom.wrapper,sandboxDiv:e.dom.sandboxDiv};this.state=e.state;this.hasStatePreMain=true}async validateIndexJson(){const e=await this.getIndexJson();if(!e.elements)throw`Missing elements array`;if(!e.elements.length)throw`No element objects provided`;if(e.columnsLayout){if(e.columnsLayout.length==0)throw`Missing column objects`;const t=e.columnsLayout.map((e=>e.gridarea));if(t.length!=new Set(t).size)throw`Duplicate values for .gridarea found`;const n=[];for(const t of e.columnsLayout){if(!t.gridarea)throw`Missing column .gridarea for column = ${t.name}`;if(!t.sections||t.sections.length==0)throw`Missing section objects for column = ${t.name}`;for(const e of t.sections){if(!e.id)throw`Missing section .id in ${e.name?`section = ${e.name}`:`column = ${t.name} array`}`;n.push(e.id)}if(t.sections.length!=new Set(t.sections).size){throw`Non-unique levels in line ${lineNum}: ${JSON.stringify(levelNames)}`}}if(n.length!=new Set(n).size)throw`Duplicate values for section.id found`;for(const t of e.elements){if(!t.section)throw`.section is missing for ${t.type} = ${t.name}`;if(!n.some((e=>e==t.section)))throw`section = ${t.section} for ${t.type} = ${t.name} is not a column section`}}return e}async getIndexJson(){const e=await Bl(this.app.cardsPath+"/index.json");if(e.error){xc(this.dom.holder.append("div"),e.error);return}return e}async init(){this.index=await this.validateIndexJson();this.elementsRendered=false;uh(this);this.elements=this.index.elements.filter((e=>!e.hidden));this.layout=this.index.columnsLayout?this.index.columnsLayout:null;this.components={elements:[]}}async main(){if(this.elementsRendered==true)return;this.elementsRendered=true;for(const e of this.elements){const t=ot(this.layout?`#${e.section} > .sjpp-element-list`:`.sjpp-element-list`);if(e.type=="card"||e.type=="nestedCard"){this.components.elements.push(await rh({app:this.app,holder:t.style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(320px, 1fr))").style("gap","10px").style("list-style","none").style("margin","15px 0px"),element:e,dom:this.opts.dom,state:this.state,sandboxDiv:this.dom.sandboxDiv}))}else if(e.type=="dsButton"){this.components.elements.push(await ch({app:this.app,holder:t,element:e,dom:this.opts.dom,state:this.state,sandboxDiv:this.dom.sandboxDiv}))}}}}const ph=dl(fh);function uh(e){if(!e.index.columnsLayout)hh(e);if(e.index.columnsLayout)mh(e)}function hh(e){const t=e.dom.wrapper.append("div").style("display","flex").style("padding","10px").classed("sjpp-element-list",true);return t}function mh(e){const t=e.dom.wrapper.append("div").style("display","grid").style("grid-template-columns","repeat(auto-fit, minmax(425px, 1fr))").style("gap","10px").style("padding","10px").style("text-align","left");const n=[];for(const t of e.index.columnsLayout)n.push(t.gridarea);t.style("grid-template-areas",`"${n.toString().replace(","," ")}"`);for(const n of e.index.columnsLayout){const e=t.append("div").style("grid-area",n.gridarea).classed(".sjpp-track-cols",true);for(const t of n.sections)o(t,e)}function o(e,t){const n=t.append("div").attr("id",e.id);if(e.name)n.append("h5").classed("sjpp-appdrawer-cols",true).style("color",Kt(Ir).darker()).text(e.name);n.append("div").classed("sjpp-element-list",true).style("padding","10px");return n}}class gh{constructor(e){this.type="mainBtn";this.opts=this.validateOpts(e);this.dom=e.dom;this.state=e.state;this.hasStatePreMain=true;yh(this)}validateOpts(e){return e.app.opts}getState(e){return{appBtnActive:e.appBtnActive}}async init(){this.btnRendered=false;this.drawerFullHeight="";try{if(window.location.pathname=="/"&&!window.location.search.length)await this.app.dispatch({type:"is_apps_btn_active",value:true});this.components={layout:[]}}catch(e){throw e}}async main(e){if(this.app.getState(e).appBtnActive==true&&this.btnRendered==false){this.dom.drawerDiv.style("background-color","#f5f5f5");this.components.layout.push(await ph({app:this.app,dom:this.dom,state:this.state}));setTimeout((()=>{this.drawerFullHeight=this.dom.drawerDiv.node().getBoundingClientRect().height+5}),this.state.duration+5);vh(this);this.btnRendered=true}if(this.state.appBtnActive==false&&this.btnRendered==true)vh(this)}}const bh=dl(gh);function yh(e){e.dom.btnWrapper.style("background-color",e.state.appBtnActive?"#b2b2b2":"#f2f2f2").style("color",e.state.appBtnActive?"#fff":"#000").on("click",(async t=>{t.stopPropagation();await e.app.dispatch({type:"is_apps_btn_active"});vh(e);if(e.state.appBtnActive){setTimeout((()=>{e.drawerFullHeight=e.dom.drawerDiv.node().getBoundingClientRect().height+5}),e.state.duration+5)}}));e.dom.btn.attr("class","sja_menuoption").style("display","inline-block").style("background-color","transparent").style("color",e.state.appBtnActive?"#fff":"#000").style("padding",e.opts.padw_sm).style("margin","0px 5px").style("cursor","pointer").text("Apps");e.dom.drawerHint.style("position","relative").style("display","inline-block").style("height",e.state.arrowSize.closed+"px").style("width",e.state.appBtnActive?e.state.hintWidth.open:e.state.hintWidth.closed).style("background-color","transparent").style("text-align","center").style("cursor","pointer");e.dom.drawerArrow.style("position","absolute").style("font-size",e.state.arrowSize.closed+"px").style("right",e.state.hintPos.closed.rt+"px").style("bottom",e.state.hintPos.closed.btm+"px").style("background-color","transparent").style("color",e.state.arrowColor.closed).style("opacity",e.state.appBtnActive?0:1).style("cursor","pointer").html("▼");e.dom.drawerArrowOpen.style("position","absolute").style("font-size",e.state.arrowSize.open+"px").style("left",e.state.hintPos.open.left+"px").style("bottom",e.state.hintPos.open.btm+"px").style("transform","rotate(180deg)").style("background-color","transparent").style("color",e.state.arrowColor.open).style("opacity",e.state.appBtnActive?1:0).style("cursor","pointer").style("pointer-events",e.state.appBtnActive?"auto":"none").html("▼");e.drawerFullHeight=e.dom.drawerRow.node().getBoundingClientRect().height+5}async function vh(e){e.dom.btnWrapper.transition().duration(e.opts.state.duration).style("background-color",e.state.appBtnActive?"#b2b2b2":"#f2f2f2").style("color",e.state.appBtnActive?"#fff":"#000");e.dom.btn.transition().duration(e.opts.state.duration).style("color",e.state.appBtnActive?"#fff":"#000");e.dom.drawerDiv.style("display","inline-block").transition().duration(e.opts.state.duration).style("top",e.state.appBtnActive?"0px":"-"+e.drawerFullHeight+"px");e.dom.drawerRow.transition().duration(e.opts.state.duration).style("height",e.state.appBtnActive?e.drawerFullHeight+"px":"0px");e.dom.drawerHint.transition().duration(e.opts.state.duration).style("width",e.state.appBtnActive?e.opts.state.hintWidth.open:e.opts.state.hintWidth.closed);e.dom.drawerArrow.transition().duration(e.opts.state.duration).style("opacity",e.state.appBtnActive?0:1);e.dom.drawerArrowOpen.style("pointer-events",e.state.appBtnActive?"auto":"none").transition().duration(e.opts.state.duration).style("opacity",e.state.appBtnActive?1:0)}class wh{constructor(e){this.type="store";this.defaultState={duration:500,hintPos:{open:{btm:-42,left:13},closed:{btm:3,rt:5}},hintWidth:{open:"0px",closed:"18px"},arrowSize:{open:42,closed:20},arrowColor:{open:"rgb(242,242,242)",closed:"rgb(85,85,85)"},appBtnActive:false}}async init(){}}const xh=cl(wh);wh.prototype.actions={is_apps_btn_active(e){this.state.appBtnActive="value"in e?e.value:!this.state.appBtnActive}};class _h{constructor(e){this.type="app";const t=e.drawerRow.append("div").style("position","relative").style("margin","0 20px").style("padding",`0 ${e.padw_sm}`).style("display","inline-block").style("overflow","hidden").style("border-radius","0px 0px 5px 5px").style("width","93vw").classed("sjpp-drawer-div",true);const n=e.headbox.append("div").style("position","relative").style("display","inline-block").style("margin-left","5px").style("margin-right","5px").style("border-radius","5px").classed("sjpp-apps-btn-wrapper",true);this.dom={drawerRow:e.drawerRow,drawerDiv:t,sandboxDiv:e.sandboxDiv,btnWrapper:n,btn:n.append("div"),drawerHint:n.append("div"),drawerArrow:n.append("div"),drawerArrowOpen:n.append("div"),wrapper:t.append("div")}}preApiFreeze(e){e.cardsPath=this.opts.cardsPath}async init(){try{this.store=await xh({app:this.api,state:this.opts.state});this.state=await this.store.copyState();this.components={mainBtn:await bh({app:this.api,dom:this.dom,state:this.state,indexJson:this.indexJson})};await this.api.dispatch()}catch(e){throw e}}main(){}}const kh=ll(_h);class jh{constructor(e){this.holder=e.holder;this.input=e.holder.append("input");this.tip=e.tip||new ec({border:"",padding:"0px"});this.style=e.style||{};this.size=e.size||20;this.placeholder=e.placeholder||"";this.title=e.title||"";this.searchItems=e.searchItems;this.app=e.app}initUI(){this.holder.style("padding","padding"in this.style?this.style.padding:"5px").style("display","inline-block");this.input.attr("class","sjpp-input-search").style("border","border"in this.style?this.style.border:"5px").attr("size",this.size).attr("placeholder",this.placeholder).attr("title",this.title).on("keyup",(e=>Wf(this,void 0,void 0,(function*(){if(Jc(e))yield this.enterSearch();td.debounce(this.addSearchItems(),400)}))))}addSearchItems(){return Wf(this,void 0,void 0,(function*(){if(!this.input.property("value").trim()){this.tip.hide();return}try{this.tip.clear().showunder(this.input.node());const e=this.tip.d.append("div");const t=yield this.searchItems();yield e.append("div").style("display","flex").selectAll().data(t.filter((e=>e.items.length>=1))).enter().append("div").style("display","block").style("border-left","0.5px solid lightgrey").each(this.showResultsList)}catch(e){if(e.stack)console.log(e.stack);else mf(e)}}))}showResultsList(e){return Wf(this,void 0,void 0,(function*(){e.wrapper=ot(this);e.wrapper.style("padding","5px");e.titleDiv=e.wrapper.append("span").style("padding","3px 0px 5px").style("opacity",.65).style("font-size","0.8em").text(e.title);yield e.wrapper.append("div").classed("sjpp-result-wrapper",true).selectAll("div").data(e.items).enter().append("div").classed("sja_menuoption",true).classed("sjpp-search-result",true).style("display","block").style("padding-left","10px").style("background-color",e.color||"").text((e=>e.name||e.label||e)).on("click",((t,n)=>{t.stopPropagation();e.callback(n)}))}))}enterSearch(){return Wf(this,void 0,void 0,(function*(){if(!this.input.property("value").trim())return;const e=this.tip.d.select(".sjpp-result-wrapper").node();const t=this.tip.d.select(".sjpp-search-result").node();if(t!=null&&t.__data__)e.__data__.callback(t.__data__);else{const e=yield this.searchItems();const t=e.filter((e=>e.default));t[0].callback(this.input.property("value"))}this.input.property("value","");this.tip.hide()}))}updatePlaceholder(e){this.input.attr("placeholder",e)}}async function Nh(e,t,n,o){const i=await Bl(e.cardsPath+"/index.json");if(i.error)mf(`Problem retrieving cards/index.json`);const s=t.toLowerCase().trim();const r=[...i.elements];let a;if(s.length>2){await Sh(r,e);a=Ah(r,s)}else{a=Ah(r,s)}const l={app:e.drawer.opts,sandboxDiv:e.drawer.opts.sandboxDiv,genomes:e.genomes,fromApp:true};n.push({title:"Tracks and Apps",items:a.filter((e=>e.type=="card")),color:"#e1edf7",callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});o.hide();zu(t,l)}},{title:"Datasets",items:a.filter((e=>e.type=="dsButton")),color:"#e5f5e4",callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});o.hide();zu(t,l)}});return n}async function Sh(e,t){const n=e.map((async e=>{if(e.hidden||e.type!="card"||!e.sandboxJson)return e;const n=await Bl(t.cardsPath+`/${e.sandboxJson}.json`);if(n?.ppcalls.length>0){for(const t of n.ppcalls){if(t.isUI)return;if(t?.label)e.searchterms.push(t.label)}}}));await Promise.all(n)}function Ah(e,t){return e.filter((e=>{if(e.hidden)return false;let n=(e.searchterms||[]).reduce(((e,n)=>{if(e)return true;return n.toLowerCase().includes(t)}),false);return n||e.name.toLowerCase().includes(t)})).sort(((e,t)=>e.name.localeCompare(t.name)))}async function Ch(e,t,n){if(e.length==0)return;try{const o=await Bl("/genelookup",{body:{input:e,genome:t,jwt:n}});if(o.error)throw o.error;if(!o.hits)throw".hits[] missing";return o.hits}catch(e){}}async function Eh(e,t,n,o){const i=t.genomes[n];if(!i){console.error("unknown genome "+n);return}const s=Qd(t.drawer.opts.sandboxDiv);s.header.html('<div style="display:inline-block;">'+e+'</div><div class="sjpp-output-sandbox-title">'+n+"</div>");const r=If();const a=await $f(r,i);const l=Ld(e,i);if(l){const e={hostURL:t.hostURL,jwt:o,holder:s.body,genome:i,nobox:true,chr:l.chr,start:l.start,stop:l.stop,dogtag:n,tklst:a,debugmode:t.debugmode};tc(i,e.tklst);import("./block-4f585abe.js").then((function(e){return e.c})).then((t=>new t.Block(e))).catch((e=>{t.error0(e)}));return}const c={hostURL:t.hostURL,jwt:o,query:e,genome:i,holder:s.body,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,tklst:a,debugmode:t.debugmode};const d=sessionStorage.getItem("urlp_mds");if(d){const e=d.split(",");if(e.length==2){c.datasetqueries=[{dataset:e[0],querykey:e[1]}]}}await yf(c)}const Oh=new ec({padding:"0px",offsetX:0,offsetY:0});Oh.d.style("z-index",5555);function Mh(e){if(!window.structuredClone)window.structuredClone=e=>JSON.parse(JSON.stringify(e));const t={error0(e){xc(t.holder0,e)},debugmode:false,callbacks:e.callbacks||{sjcharts:{}},instanceTracker:e.instanceTracker||{sjcharts:{}}};Th(e,t);if(!t.instanceTracker.sjcharts){t.instanceTracker.sjcharts={}}if(!t.callbacks.sjcharts){t.callbacks.sjcharts={}}if(e.clear){it(".sja_pane").remove();return}t.holder=ot(e.holder?e.holder:document.body).append("div").attr("class","sja_root_holder").attr("data-ppclientversion",`2.63.2`).style("font","1em Arial, sans-serif").style("color","black");t.sandbox_header=e.sandbox_header||undefined;if(e.jwt){sessionStorage.setItem("jwt",e.jwt)}sessionStorage.setItem("suppressErrors",JSON.stringify(e.suppressErrors));if(e.variantPageCall_snv){t.variantPageCall_snv=e.variantPageCall_snv}if(e.samplecart){t.samplecart=e.samplecart}if(e.base_zindex){kc({setzindex:e.base_zindex})}const n=e.serverData||e.termdb&&e.termdb.serverData;const o=Bl("genomes",{},{serverData:n});return o.then((async n=>{if(n.error)throw{message:"Cannot get genomes: "+n.error};if(!n.genomes)throw{message:"no genome data!?"};if(n.base_zindex){kc({setzindex:n.base_zindex})}if(n.features){sessionStorage.setItem("optionalFeatures",JSON.stringify(n.features))}t.genomes=n.genomes;t.cardsPath=n.cardsPath;if(n.debugmode){t.debugmode=true}Xl({dsAuth:n.dsAuth,holder:t.holder});if(n.commonOverrides||e.commonOverrides){ga(Object.assign(n.commonOverrides||{},e.commonOverrides||{}))}if(n.targetPortal&&n.targetPortal=="gdc")await import("./style.gdc-4ac9b96b.js");for(const e in t.genomes){const n=dm(t.genomes[e]);if(n){throw{message:"Error with "+e+" genome: "+n}}}if(!e.noheader&&!window.location.search.includes("noheader")&&!window.location.search.includes("mass-session-id")&&!window.location.search.includes("mass-session-file")&&!window.location.search.includes("mass-session-url")){Rh(t,n,e.jwt)}t.holder0=t.holder.append("div").style("margin","20px");const o=await zh(e,t);return o||t})).catch((e=>{t.holder.text(e.message||e);if(e.stack)console.log(e.stack)}))}Mh.getStatus=async function e(t=""){return await fetch("/healthcheck").then((e=>e.json())).then((e=>{const n={clientVersion:document.querySelector(".sja_root_holder")?.dataset.ppclientversion,versionInfo:e.versionInfo};if(t=="log")console.info(n);else if(t=="json")return JSON.stringify(n);else return n})).catch(console.error)};const Ih=document&&document.currentScript&&document.currentScript.src||"";function Th(e,t){if(e.host){t.hostURL=e.host}else if(window.location.hostname=="localhost"){const e=If();if(e.has("hosturl"))t.hostURL=e.get("hosturl");else if(window.testHost){t.hostURL=window.testHost}else{const n=e.get("hostname");const o=e.get("hostport");const i=window.location.protocol+"//";if(n&&o)t.hostURL=i+n+":"+o;else if(n)t.hostURL=i+n;else if(o)t.hostURL=i+window.location.hostname+":"+o}}if(!t.hostURL){if(Ih.includes("://")){t.hostURL=Ih.split("://")[0]+"://"+Ih.split("://")[1].split("/")[0]}else{t.hostURL=""}}if(t.hostURL.endsWith("/"))t.hostURL=t.hostURL.slice(0,-1);sessionStorage.setItem("hostURL",t.hostURL)}async function Rh(e,t,n){const o=Kt(Ir);const i="13px";const s="5px 10px";const r="7px 10px";document.documentElement.clientWidth;const a=e.holder.append("div").style("white-space","nowrap").style("border-bottom","solid 1px rgba("+o.r+","+o.g+","+o.b+",.3)");const l=a.append("div").style("margin","10px").style("padding","8px").style("padding-bottom","12px").style("display","inline-block").style("border-bottom","");const c=a.append("div").style("display","inline-block").style("padding",r).style("padding-left","25px").style("font-size",".8em").style("color",Kt(Ir).darker());{const e=c.append("div").style("padding-left","15px");e.append("span").text("Code updated: "+(t.codedate||"??")+", server launched: "+(t.launchdate||"??")+".");if(t.hasblat){e.append("a").style("margin-left","10px").text("Running BLAT").on("click",(async e=>{Oh.clear().showunder(e.target);const t=Oh.d.append("div").style("margin","10px");const n=t.append("div").text("Loading...");try{const e=await Pl("blat?serverstat=1");if(e.error)throw e.error;if(!e.lst)throw"invalid response";n.remove();for(const n of e.lst){t.append("div").text(n)}}catch(e){n.text(e.message||e);if(e.stack)console.log(e.stack)}}))}}if(t.headermessage){c.append("div").html(t.headermessage)}l.append("div").text("ProteinPaint").style("display","inline-block").style("padding",i).style("color",Ir).style("font-size","1.3em").style("font-weight","bold");const d=new ec({border:"",padding:"0px"});const f=async()=>{const t=ot("input").property("value").trim();const o=[{title:"Genes",default:true,items:await Ch(t,e.selectgenome.property("value"),n),callback:t=>{e.drawer.dispatch({type:"is_apps_btn_active",value:false});d.hide();Eh(t,e,e.selectgenome.property("value"),n)}}];await Nh(e,t,o,d);o.push({title:"Help",items:m.filter((e=>e.label.toLowerCase().includes(t.toLowerCase()))),color:"#faebd9",callback:e=>{window.open(e.link,e.label)}});return o};const p=new jh({holder:l,tip:d,style:{padding:r,border:`'solid 1px ${Ir}`},size:32,placeholder:"Gene, position, SNP, app, or dataset",title:"Search by gene, SNP, position, app, or dataset",searchItems:f});p.initUI();const u=l.append("div").attr("class","sjpp-genome-select-div").style("padding",r);const h=()=>{const t=e.genomes[e.selectgenome.property("value")];const n=["Gene","position","app"];if(t.hasSNP)n.splice(2,0,"SNP");if(Object.keys(t.datasets).length)n.push("dataset");const o=n.join(", ").replace(/,(?=[^,]*$)/,", or");return o};e.selectgenome=u.append("select").attr("title","Select a genome").attr("class","sjpp-genome-select").style("padding",s).style("border","solid 1px "+Ir).on("change",(()=>{$h(e);p.updatePlaceholder(h())}));for(const t in e.genomes){e.selectgenome.append("option").attr("n",t).text(e.genomes[t].species+" "+t).property("value",t)}e.genome_browser_btn=Lh(e,l,n);e.drawer=await kh({holder:e.holder,genomes:e.genomes,drawerRow:e.holder.append("div").style("position","relative").style("overflow-x","visible").style("overflow-y","hidden").classed("sjpp-drawer-row",true),sandboxDiv:e.holder.append("div").style("margin-top","15px").classed("sjpp-drawer-sandbox",true),genome_browser_btn:e.genome_browser_btn,debugmode:e.debugmode,headbox:l,padw_sm:r,cardsPath:e.cardsPath});const m=[{label:"Embed in your website",link:"https://docs.google.com/document/d/1KNx4pVCKd4wgoHI4pjknBRTLrzYp6AL_D-j6MjcQSvQ/edit?usp=sharing"},{label:"URL parameters",link:"https://github.com/stjude/proteinpaint/wiki/URL-parameters"},{label:"All tutorials",link:"https://github.com/stjude/proteinpaint/wiki/"},{label:"User community",link:"https://groups.google.com/g/proteinpaint"},{label:"License ProteinPaint",link:"https://www.stjude.org/research/why-st-jude/shared-resources/technology-licensing/technologies/proteinpaint-web-application-for-visualizing-genomic-data-sj-15-0021.html",onlySearch:true},{label:"Our Team",link:"https://proteinpaint.stjude.org/team/",onlySearch:true}];l.append("span").classed("sja_menuoption",true).style("padding",r).text("Help").on("click",(async e=>{const t=e.target.getBoundingClientRect();const n=Oh.clear().show(t.left-0,t.top+t.height+5);await n.d.append("div").style("padding","5px 20px").selectAll("p").data(m.filter((e=>!e.onlySearch))).enter().append("p").html((e=>`<a href=${e.link} target=_blank>${e.label}</a>`))}))}function Lh(e,t,n){const o="8px";const i=t.append("span");const s=e.selectgenome.node().options[e.selectgenome.property("selectedIndex")].value;const r=i.attr("class","sja_menuoption").attr("id","genome_btn").style("padding",o).datum(s).text(s+" genome browser").on("click",((t,o)=>{const i=e.genomes[o];if(!i){alert("Invalid genome name: "+o);return}const s=Qd(e.drawer.opts.sandboxDiv);s.header.text(o+" genome browser");const r={hostURL:e.hostURL,jwt:n,holder:s.body,genome:i,chr:i.defaultcoord.chr,start:i.defaultcoord.start,stop:i.defaultcoord.stop,nobox:true,tklst:[],debugmode:e.debugmode};tc(i,r.tklst);import("./block-4f585abe.js").then((function(e){return e.c})).then((e=>new e.Block(r)));e.drawer.dispatch({type:"is_apps_btn_active",value:false})}));return r}function $h(e){e.genome_browser_btn.text(e.selectgenome.node().value+" genome browser");e.genome_browser_btn.datum(e.selectgenome.node().value)}async function zh(e,t){if(e.genome&&t.selectgenome){for(let n=0;n<t.selectgenome.node().childNodes.length;n++){if(t.selectgenome.node().childNodes[n].value==e.genome){t.selectgenome.property("selectedIndex",n);break}}}if(e.mclassOverride){if(!e.mclassOverride.mclassName)e.mclassOverride.mclassName="Class";for(const t in e.mclassOverride.classes){const n=Yr[t];if(n){Object.assign(n,e.mclassOverride.classes[t])}}}if(e.singlecell){im(e.singlecell,t);return t}if(e.fimo){Bh(e.fimo,t);return t}if(e.mdssurvivalplot){if(e.genome)e.mdssurvivalplot.genome=e.genome;Uh(e.mdssurvivalplot,t);return t}if(e.mdssamplescatterplot){if(e.genome)e.mdssamplescatterplot.genome=e.genome;Dh(e.mdssamplescatterplot,t);return t}if(e.samplematrix){e.samplematrix.jwt=e.jwt;qh(e.samplematrix,t);return t}if(e.hic){e.hic.jwt=e.jwt;Fh(e.hic,t);return t}if(e.block){return Gh(e,t)}if(e.study){Fd(t.genomes,e.study,t.holder0,t.hostURL,e.jwt,false,t);return t}if(e.studyview){const n=e.studyview;n.hostURL=e.host;const o=n.genome||e.genome;n.genome=t.genomes[o];n.hostURL=t.hostURL;n.jwt=e.jwt;n.holder=t.holder0;of(n);return t}if(await Ph(e,t)){return t}if(e.fusioneditor){Jh(e,t);return t}if(e.genefusion){am(e,t);return t}if(e.mavolcanoplot){em(e,t);return t}if(e.twodmaf){tm(e,t);return t}if(e.junctionbymatrix){om(e,t);return}if(e.mdsjsonform){await Vh(e,t);return}if(e.selectGenomeWithTklst){await Wh(e,t);return}if(e.disco){return await fm(e,t)}if(e.geneSearch4GDCmds3){return await Xh(e,t)}if(e.launchGdcMatrix){return await Yh(e,t)}if(e.launchGdcHierCluster){return await Zh(e,t)}if(e.launchGdcMaf){return await Kh(e,t)}if(e.parseurl&&location.search.length){try{await Rf({app:t,genomes:t.genomes,hostURL:t.hostURL,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,holder:t.holder,selectgenome:t.selectgenome,genome_browser_btn:t.genome_browser_btn,debugmode:t.debugmode})}catch(e){t.error0(e);console.error(e.stack||e)}}if(e.project){let n=undefined;if(e.project.uionly)n=t.holder0;ef(0,0,t.genomes,t.hostURL,n,t.sandbox_header)}if(e.termdb){await rm(e.termdb,t)}if(e.maftimeline){nm(e,t)}if(e.gdcbamslice){return await Qh(e,t)}if(e.mass){return await cm(e,t)}if(e.tkui){sm(e,t)}if(e.massSessionId){const n=await Bl(`/massSession?id=${e.massSessionId}`);if(n.error)throw n.error;const o={holder:t.holder0,state:n.state,genome:t.genomes[n.state.vocab.genome],massSessionDuration:n.massSessionDuration,getDatasetAccessToken:e.getDatasetAccessToken,addLoginCallback:e.addLoginCallback};const i=await import("./app-59194db0.js");i.appInit(o);return}if(e.massSessionFile||e.massSessionURL){let n;if(e.massSessionFile){const t=e.massSessionFile;const o=await Bl(`/textfile`,{method:"POST",body:JSON.stringify({file:t})});if(o.error)throw o.error;n=JSON.parse(o.text)}else{const t=e.massSessionURL;const o=await Bl(`/urltextfile`,{method:"POST",body:JSON.stringify({url:t})});if(o.error)throw o.error;n=JSON.parse(o.text)}const o={holder:t.holder0,state:n,genome:t.genomes[n.vocab.genome]};const i=await import("./app-59194db0.js");i.appInit(o);return}if(e.profileHome){const t=await import("./profileHome-9c5e266b.js");t.init(e);return}}async function Ph(e,t){if(e.p){e.gene=e.p;delete e.p}if(e.gene2canonicalisoform){if(!e.genome)throw".genome missing for gene2canonicalisoform";const t=await Pl("gene2canonicalisoform?genome="+e.genome+"&gene="+e.gene2canonicalisoform);if(t.error)throw t.error;if(!t.isoform)throw"no canonical isoform for given gene accession";e.gene=t.isoform}if(e.mds3_ssm2canonicalisoform){if(!e.genome)throw".genome missing";if(!e.mds3_ssm2canonicalisoform.ssm_id)throw".ssm_id missing from mds3_ssm2canonicalisoform";if(!e.mds3_ssm2canonicalisoform.dslabel)throw".dslabel missing from mds3_ssm2canonicalisoform";const t=await Pl("mds3?"+"genome="+e.genome+"&dslabel="+e.mds3_ssm2canonicalisoform.dslabel+"&ssm2canonicalisoform=1"+"&ssm_id="+e.mds3_ssm2canonicalisoform.ssm_id);if(t.error)throw t.error;if(!t.isoform)throw"no isoform found for given ssm_id";e.gene=t.isoform;if(e.tracks){const t=e.tracks.find((t=>t.dslabel==e.mds3_ssm2canonicalisoform.dslabel));if(t){t.hlssmid=e.mds3_ssm2canonicalisoform.ssm_id}}}if(e.gene){Hh(e,t);return true}return false}async function Dh(e,t){if(!e.genome){t.error0("missing genome for mdssamplescatterplot");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for mdssamplescatterplot");return}e.genome=n;if(e.dataset){e.mds=n.datasets[e.dataset];if(!e.mds){t.error0("invalid dataset for mdssamplescatterplot");return}e.dslabel=e.dataset;delete e.dataset;if(e.mds.mdsIsUninitiated){const t=await Bl(`getDataset?genome=${e.genome.name}&dsname=${e.dslabel}`);if(t.error)throw t.error;if(!t.ds)throw"ds missing";Object.assign(e.mds,t.ds);delete e.mds.mdsIsUninitiated}}else if(e.analysisdata);else if(e.analysisdata_file){try{const t=await Ll("textfile",{file:e.analysisdata_file});if(t.error)throw tmp.error;else if(t.text)e.analysisdata=JSON.parse(t.text)}catch(e){t.error0(e);return}}else{t.error0("neither .dataset or .analysisdata is given");return}import("./mds.samplescatterplot-a54b9e93.js").then((n=>{n.init(e,t.holder0,t.debugmode)}))}function Uh(e,t){if(!e.genome){t.error0("missing genome for mdssurvivalplot");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for mdssurvivalplot");return}e.genome=n;if(!e.dataset){t.error0("missing dataset for mdssurvivalplot");return}e.mds=n.datasets[e.dataset];if(!e.mds){t.error0("invalid dataset for mdssurvivalplot");return}delete e.dataset;if(e.plotlist){for(const t of e.plotlist){t.renderplot=1}}import("./mds.survivalplot-c5093f73.js").then((n=>{n.init(e,t.holder0,t.debugmode)}))}function Bh(e,t){if(!e.genome){t.error0("missing genome for fimo");return}const n=t.genomes[e.genome];if(!n){t.error0("invalid genome for fimo");return}e.genome=n;e.div=t.holder0;import("./mds.fimo-ce97371c.js").then((t=>{t.init(e)}))}function Fh(e,t){if(!e.genome){t.error0("missing genome for hic");return}e.genome=t.genomes[e.genome];if(!e.genome){t.error0("invalid genome for hic");return}if(!e.file){t.error0("missing file for hic");return}e.hostURL=t.hostURL;e.holder=t.holder0;import("./HicApp-aac413df.js").then((async n=>{await n.hicInit(e,t.debugmode)}))}function qh(e,t){if(!e.genome){t.error0("missing genome for launching samplematrix");return}e.genome=t.genomes[e.genome];if(!e.genome){t.error0("invalid genome for samplematrix");return}e.hostURL=t.hostURL;e.holder=t.holder0;e.debugmode=t.debugmode;import("./samplematrix-4f0ec523.js").then((t=>{new t.Samplematrix(e)}))}async function Hh(e,t){if(!e.genome){t.error0("Cannot embed: must specify reference genome");return}if(e.tracks){for(const t of e.tracks){if(t.type=="mds3"&&t.dslabel)continue;t.iscustom=true}}if(e.tkjsonfile){if(!e.tracks)e.tracks=[];const t=new Map([["tkjsonfile",e.tkjsonfile]]);const n=await $f(t,genomeobj);for(const t of n){e.tracks.push(t)}}const n={jwt:e.jwt,hostURL:t.hostURL,query:e.gene,genome:t.genomes[e.genome],holder:t.holder0,variantPageCall_snv:t.variantPageCall_snv,samplecart:t.samplecart,debugmode:t.debugmode,datasetqueries:e.datasetqueries,mset:e.mset,tklst:e.tracks,gmmode:e.gmmode,mclassOverride:e.mclassOverride,hide_dsHandles:e.hide_dsHandles,onloadalltk_always:e.onloadalltk_always};if(e.dataset){n.dataset=e.dataset.split(",");n.legacyDsFilter=e.legacyDsFilter;if(e.hidedatasetexpression){n.hidedatasetexpression=true}}if(e.hidegenecontrol){n.hidegenecontrol=true}if(e.hidegenelegend){n.hidegenelegend=true}let o=null;if(e.hlaachange){o=new Map;if(Array.isArray(e.hlaachange)){for(const t of e.hlaachange){if(t.name){o.set(t.name,t)}}}else{for(const t of e.hlaachange.split(",")){o.set(t,false)}}if(o.size){n.hlaachange=o}}if(e.hlvariants){n.hlvariants=e.hlvariants}await yf(n)}async function Gh(e,t){if(!e.genome){t.error0("Cannot embed: must specify reference genome");return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}if(e.study){Fd(t.genomes,e.study,t.holder0,t.hostURL,e.jwt,true,t)}if(e.studyview);if(e.tracks){for(const n of e.tracks){if(n.type==mc.mds3&&n.dslabel)continue;if(n.mdsjsonfile||n.mdsjsonurl){try{const t=await jf(n.mdsjsonfile,n.mdsjsonurl);e.tracks=e.tracks.filter((e=>e!=n));e.tracks.push(...t)}catch(e){hf(t.holder0,e)}}n.iscustom=true}}if(e.tkjsonfile){if(!e.tracks)e.tracks=[];const t=new Map([["tkjsonfile",e.tkjsonfile]]);const o=await $f(t,n);for(const t of o){e.tracks.push(t)}}const o={genome:n,hostURL:t.hostURL,jwt:e.jwt,holder:t.holder0,nativetracks:e.nativetracks,tklst:e.tracks,debugmode:t.debugmode,legendimg:e.legendimg};if(e.width){const n=Number.parseInt(e.width);if(Number.isNaN(n))return t.error0("browser width must be integer");o.width=n}if(e.subpanels){if(!Array.isArray(e.subpanels))return t.error0("subpanels is not array");const n=[];for(const o of e.subpanels){if(!o.chr){t.error0("missing chr in one subpanel");continue}if(!o.start||!o.stop){t.error0("missing start or stop in one subpanel");continue}if(!o.width){o.width=400}if(!o.leftpad){o.leftpad=5}n.push(o)}if(n.length){o.subpanels=n}}if(e.nobox){o.nobox=true}else{o.dogtag=e.dogtag||e.genome}if(e.chr&&Number.isInteger(e.start)){o.chr=e.chr;o.start=e.start;o.stop=Number.isInteger(e.stop)?e.stop:e.start+1}else if(e.position){const t=Ld(e.position,n);if(t){o.chr=t.chr;o.start=t.start;o.stop=t.stop}}else if(e.positionbygene){try{const t=await od(e.genome,e.positionbygene);if(t&&t[0]){const e=t[0];o.chr=e.chr;o.start=e.start;o.stop=e.stop}}catch(e){t.error0(e)}}if(!o.chr){o.chr=n.defaultcoord.chr;o.start=n.defaultcoord.start;o.stop=n.defaultcoord.stop}if(e.datasetqueries){o.datasetqueries=e.datasetqueries}if(e.hlregions){const t=[];for(const o of e.hlregions){const e=Ld(o,n,true);if(e)t.push(e)}if(t.length)o.hlregions=t}const i=If();if(i){if(i.has("position")){const e=Ld(i.get("position"),n);if(e){o.chr=e.chr;o.start=e.start;o.stop=e.stop}}if(i.has("hlregion")){const e=[];for(const t of i.get("hlregion").split(",")){const o=Ld(t,n,true);if(o){e.push(o)}}if(e.length){o.hlregions=e}}if(i.has("bedgraphdotfile")){if(!o.tklst)o.tklst=[];const e=i.get("bedgraphdotfile").split(",");for(let t=0;t<e.length;t+=2){if(e[t]&&e[t+1]){o.tklst.push({type:mc.bedgraphdot,name:e[t],file:e[t+1]})}}}}return import("./block-4f585abe.js").then((function(e){return e.c})).then((e=>{t.block=new e.Block(o);return t}))}function Jh(e,t){if(e.fusioneditor.uionly){const[n,o,i,s,r]=Xd(t.holder0,t.genomes);import("./svmr-248055c8.js").then((a=>{a.svmrui([null,n,o,i,s,r],t.genomes,t.hostURL,e.jwt)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}import("./svmr-248055c8.js").then((o=>{o.svmrparseinput(e.fusioneditor,t.error0,n,t.holder0,t.hostURL,e.jwt)}))}async function Vh(e,t){if(e.mdsjsonform.uionly){const e=await import("./mdsjsonform-09b4e1cb.js");await e.init_mdsjsonform({holder:t.holder0,genomes:t.genomes})}}async function Wh(e,t){const n=await import("./selectGenomeWithTklst-895106fb.js");await n.init(e,t.holder0,t.genomes)}async function Xh(e,t){const n=await import("./lollipop-6ad9ec3c.js");return await n.init(e,t.holder0,t.genomes)}async function Yh(e,t){const n=await import("./oncomatrix-6950c48c.js");return await n.init(e,t.holder0,t.genomes)}async function Zh(e,t){const n=await import("./geneExpClustering-a916ebda.js");return await n.init(e,t.holder0,t.genomes)}async function Kh(e,t){const n=await import("./maf-dfada1c8.js");return await n.gdcMAFui({holder:t.holder0,filter0:e.filter0,callbacks:e.callbacks||{},debugmode:e.debugmode})}function Qh(e,t){return import("./bam-e7f6baea.js").then((n=>n.bamsliceui({genomes:t.genomes,holder:t.holder0,hideTokenInput:e.gdcbamslice.hideTokenInput,callbacks:e.gdcbamslice.callbacks||{},filter0:e.filter0,stream2download:e.gdcbamslice.stream2download,inputValue:e.gdcbamslice.inputValue})))}function em(e,t){if(e.mavolcanoplot.uionly){import("./mavb-9a6fa2e9.js").then((n=>{n.mavbui(t.genomes,t.hostURL,e.jwt,t.holder0,t.sandbox_header)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}e.mavolcanoplot.hostURL=t.hostURL;e.mavolcanoplot.genome=n;import("./mavb-9a6fa2e9.js").then((n=>{n.mavbparseinput(e.mavolcanoplot,t.error0,t.holder0,e.jwt)}))}function tm(e,t){if(e.twodmaf.uionly){import("./2dmaf-0cabb4a4.js").then((e=>{e.d2mafui(t.genomes,t.holder0)}));return}const n=t.genomes[e.genome];if(!n){t.error0("Invalid genome: "+e.genome);return}e.twodmaf.hostURL=t.hostURL;e.twodmaf.genome=n;import("./2dmaf-0cabb4a4.js").then((n=>{n.d2mafparseinput(e.twodmaf,t.holder0)}))}function nm(e,t){if(e.maftimeline.uionly){import("./maftimeline-1b715a01.js").then((e=>{e.default(t.genomes,t.holder0,t.sandbox_header)}))}}function om(e,t){if(e.junctionbymatrix.uionly){import("./block.tk.junction.textmatrixui-09e5e02f.js").then((n=>{n.default(t.genomes,t.hostURL,e.jwt,t.holder0)}))}}async function im(e,t){try{const n=t.genomes[e.genome];if(!n)throw"Invalid genome: "+e.genome;e.genome=n;const o=await import("./singlecell-29c1cbb1.js");await o.init(e,t.holder0)}catch(e){t.error0("Error launching single cell viewer: "+e);if(e.stack)console.log(e.stack)}}async function sm(e,t){if(e.tkui=="bigwig"){const e=await import("./block.tk.bigwig.ui-a92f286b.js");e.bigwigUI(t.genomes,t.holder)}if(e.tkui=="databrowser"){const e=await import("./databrowser.ui-4799f04d.js");e.init_databrowserUI(t.holder,t.debugmode)}if(e.tkui=="genefusion"){const e=await import("./genefusion.ui-3ce190c7.js");e.init_geneFusionUI(t.holder,t.genomes,t.debugmode)}if(e.tkui=="disco"){const e=await import("./Disco.UI-54228bb6.js");e.init_discoplotUI(t.holder,t.genomes,t.debugmode)}}async function rm(e,t){if(!e.holder)e.holder=t.holder0;import("./app-fb676934.js").then((t=>{t.appInit(e)}))}async function am(e,t){try{const n=t.genomes[e.genome];if(!n)throw"Invalid genome: "+e.genome;const o=await import("./fusion.parse-fc25e5bd.js");const i=await o.parseFusion({line:e.genefusion.text,genome:n,positionType:e.genefusion.positionType});await lm(i.pairlst[0].a,n);await lm(i.pairlst[0].b,n);const s=await import("./svgraph-a12d89da.js");s.default({pairlst:i.pairlst,genome:n,holder:t.holder})}catch(e){t.error0(e)}}async function lm(e,t){const n=await Bl("genelookup",{body:{genome:t.name,input:e.isoform,deep:1}});if(n.error)throw n.error;if(!Array.isArray(n.gmlst))throw"gmlst not array";const o=n.gmlst.find((t=>t.isoform==e.isoform));if(!o)throw"no match to isoform";e.chr=o.chr;e.name=o.name;e.gm={isoform:o.isoform}}async function cm(e,t){const n=e.mass;if(!n.holder)n.holder=t.holder0;if(n.state){if(n.state.genome){n.genome=t.genomes[n.state.genome]}else if(n.state?.vocab?.genome){n.genome=t.genomes[n.state.vocab.genome]}}n.getDatasetAccessToken=e.getDatasetAccessToken;n.addLoginCallback=e.addLoginCallback;const o=sessionStorage.getItem("hostURL");if(window.opener&&o!=window.location.origin){n.embeddedSessionState=JSON.parse(sessionStorage.getItem("embeddedSessionState")||`{}`);const e=t=>{if(t.origin!=window.location.origin&&t.origin!==o)return;if(t.data.state){window.removeEventListener("message",e);Object.assign(n.embeddedSessionState,t.data.state);sessionStorage.setItem("embeddedSessionState",JSON.stringify(n.embeddedSessionState))}};window.addEventListener("message",e,false);setTimeout((()=>window.removeEventListener("message",e)),1e3);let t;try{if(window.opener.origin){t=window.opener.origin}else{t=o}}catch(e){t=o}try{window.opener.postMessage("getActiveMassSession",t)}catch(e){console.log(e)}}const i=await import("./app-59194db0.js");return await i.appInit(n)}function dm(e){e.tkset=[];e.isoformcache=new Map;e.junctionframecache=new Map;e.isoformmatch=(t,n,o)=>{if(!t)return null;const i=t.toUpperCase();if(!e.isoformcache.has(i))return null;const s=e.isoformcache.get(i);if(s.length==1)return s[0];if(!n){console.log("no chr provided for matching with "+i);return s[0]}let r=null;for(const e of s){if(e.chr.toUpperCase()==n.toUpperCase()&&e.start<=o&&e.stop>=o){r=e}}if(r)return r;for(const e of s){if(e.chr.toUpperCase()==n.toUpperCase())return e}return null};e.chrlookup={};for(const t in e.majorchr){e.chrlookup[t.toUpperCase()]={name:t,len:e.majorchr[t],major:true}}if(e.minorchr){for(const t in e.minorchr){e.chrlookup[t.toUpperCase()]={name:t,len:e.minorchr[t]}}}if(!e.tracks){e.tracks=[]}for(const t of e.tracks){t.tkid=Math.random().toString()}for(const t in e.datasets){const n=e.datasets[t];if(n.isMds);else if(n.isMds3){if(!n.label)return"ds.label missing"}}return null}async function fm(e,t){if(!e.genome)throw'"genome" parameter missing';const n=t.genomes[e.genome];if(!n)throw"unknown genome";const o=await import("./launch.adhoc-1b356f97.js");return await o.launch(e.disco,n,t.holder0)}export{it as $,Ed as A,ic as B,mc as C,Pa as D,Yr as E,Hr as F,Jr as G,Gr as H,qr as I,Dr as J,Fr as K,Pr as L,ec as M,Rc as N,Xr as O,Rd as P,uf as Q,pf as R,Bl as S,Ir as T,Md as U,qc as V,uc as W,Ld as X,Yc as Y,bf as Z,oc as _,_c as a,Ri as a$,kc as a0,Qd as a1,Na as a2,yf as a3,Ec as a4,Rr as a5,Nc as a6,Ac as a7,Cc as a8,Ma as a9,ll as aA,al as aB,Df as aC,Wf as aD,ma as aE,Za as aF,cl as aG,Al as aH,Cl as aI,Ur as aJ,Wr as aK,Yl as aL,mf as aM,Mf as aN,Of as aO,Tf as aP,ul as aQ,Xf as aR,jl as aS,Lr as aT,Ic as aU,Wd as aV,Mr as aW,xl as aX,hl as aY,Wo as aZ,Xn as a_,Sc as aa,Oc as ab,hf as ac,Uc as ad,td as ae,Br as af,Vc as ag,Wc as ah,Da as ai,lc as aj,ac as ak,Ha as al,At as am,Nr as an,va as ao,zd as ap,dd as aq,qa as ar,Fa as as,ba as at,ha as au,fa as av,pa as aw,ua as ax,oa as ay,dl as az,Ta as b,tl as b$,yo as b0,bo as b1,jt as b2,xt as b3,So as b4,Or as b5,Kc as b6,Ud as b7,tc as b8,gf as b9,od as bA,jr as bB,bc as bC,fc as bD,ui as bE,aa as bF,ca as bG,la as bH,ta as bI,na as bJ,Tc as bK,id as bL,tf as bM,nf as bN,Bc as bO,Ln as bP,$r as bQ,$a as bR,zr as bS,Lc as bT,Qc as bU,ol as bV,Hc as bW,rr as bX,Ka as bY,Qa as bZ,el as b_,Ua as ba,Sa as bb,Zr as bc,Ba as bd,Vr as be,Qr as bf,ea as bg,ra as bh,cc as bi,dc as bj,pc as bk,Pc as bl,Zc as bm,If as bn,nc as bo,Uf as bp,Xd as bq,Mc as br,at as bs,kt as bt,vo as bu,Go as bv,po as bw,Nt as bx,Yn as by,nd as bz,Ll as c,nl as c0,zn as c1,Mh as c2,kf as c3,Pl as d,Fc as e,Po as f,yc as g,vc as h,$c as i,zc as j,Jc as k,Jo as l,Ia as m,gc as n,xc as o,sc as p,ot as q,Gc as r,e as s,$d as t,jc as u,Tr as v,Pd as w,Kt as x,Ra as y,wr as z};
|