@sjcrh/proteinpaint-client 2.42.0 → 2.42.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/{2dmaf-4c8115cb.js → 2dmaf-7f12f347.js} +1 -1
  2. package/dist/{DEanalysis-ae8b793e.js → DEanalysis-4e97eae7.js} +1 -1
  3. package/dist/{Disco-4ead6c6f.js → Disco-2910f321.js} +1 -1
  4. package/dist/{Disco.UI-a765390e.js → Disco.UI-266c3c98.js} +1 -1
  5. package/dist/{DragControls-03718ca8.js → DragControls-934cfddb.js} +1 -1
  6. package/dist/{OrbitControls-0a1bcd3b.js → OrbitControls-379215f5.js} +1 -1
  7. package/dist/{app-db79376c.js → app-53b444fe.js} +1 -1
  8. package/dist/{app-64537b0c.js → app-9ef9a482.js} +1 -1
  9. package/dist/{app-f70d9a0b.js → app-f73edb78.js} +1 -1
  10. package/dist/app.js +1 -1
  11. package/dist/{barchart-a4a6b4b4.js → barchart-5755e4b5.js} +1 -1
  12. package/dist/{barchart.events-3fd64094.js → barchart.events-cb8547bb.js} +1 -1
  13. package/dist/{bars.renderer-7c9358aa.js → bars.renderer-ffddf5f5.js} +1 -1
  14. package/dist/{block-ec15b4b6.js → block-06e306e9.js} +1 -1
  15. package/dist/{block.ds.gmcustomdata-4944ece7.js → block.ds.gmcustomdata-a0f1fd3e.js} +1 -1
  16. package/dist/block.lazyload-e9a6e4fc.js +1 -0
  17. package/dist/{block.legend-ebe13fbd.js → block.legend-ae9c9047.js} +1 -1
  18. package/dist/{block.mds-52af63e1.js → block.mds-125e263c.js} +1 -1
  19. package/dist/{block.mds.cnv-a40ea2e4.js → block.mds.cnv-80691b84.js} +1 -1
  20. package/dist/{block.mds.expressionrank-7357fa79.js → block.mds.expressionrank-8a4c69bb.js} +1 -1
  21. package/dist/{block.mds.expressionstat-4c3dcb37.js → block.mds.expressionstat-7ac00a72.js} +1 -1
  22. package/dist/{block.mds.geneboxplot-ba99239a.js → block.mds.geneboxplot-ec043226.js} +1 -1
  23. package/dist/{block.mds.junction-6b881504.js → block.mds.junction-5d744e19.js} +1 -1
  24. package/dist/{block.mds.svcnv-5bd2e65b.js → block.mds.svcnv-8aec47ec.js} +1 -1
  25. package/dist/{block.mds.svcnv.share-ebe307d2.js → block.mds.svcnv.share-eb86d7b0.js} +1 -1
  26. package/dist/{block.mds2-a039e999.js → block.mds2-08b79c5e.js} +1 -1
  27. package/dist/{block.svg-742bcd6f.js → block.svg-ca8e74f1.js} +1 -1
  28. package/dist/{block.tk.aicheck-c16f7c33.js → block.tk.aicheck-8c8c74ca.js} +1 -1
  29. package/dist/{block.tk.ase-5bd73577.js → block.tk.ase-27f2e649.js} +1 -1
  30. package/dist/{block.tk.bam-f39283bf.js → block.tk.bam-5d0cc18f.js} +1 -1
  31. package/dist/{block.tk.bam.gdc-66964f1c.js → block.tk.bam.gdc-318db418.js} +1 -1
  32. package/dist/{block.tk.bedgraphdot-d05f27a0.js → block.tk.bedgraphdot-1b5d99db.js} +1 -1
  33. package/dist/{block.tk.bigwig.ui-964986f8.js → block.tk.bigwig.ui-bc0afbf9.js} +1 -1
  34. package/dist/{block.tk.hicstraw-972dd3d4.js → block.tk.hicstraw-64610b08.js} +1 -1
  35. package/dist/{block.tk.junction-4e33561e.js → block.tk.junction-0febb7c5.js} +1 -1
  36. package/dist/{block.tk.junction.textmatrixui-e9fe9446.js → block.tk.junction.textmatrixui-11649433.js} +1 -1
  37. package/dist/{block.tk.ld-880fe55f.js → block.tk.ld-2449943d.js} +1 -1
  38. package/dist/{block.tk.menu-16e5a387.js → block.tk.menu-f4e2c9a6.js} +1 -1
  39. package/dist/{block.tk.pgv-daf6e812.js → block.tk.pgv-ac78e412.js} +1 -1
  40. package/dist/{boxplot-28751534.js → boxplot-cf99d543.js} +1 -1
  41. package/dist/{brush-bc06febc.js → brush-33697636.js} +1 -1
  42. package/dist/{categorical-c86731fd.js → categorical-024a02d0.js} +1 -1
  43. package/dist/{condition-59895ac1.js → condition-4c5195a9.js} +1 -1
  44. package/dist/{controls-cd2ff09c.js → controls-93c1b3a5.js} +1 -1
  45. package/dist/{controls.btns-86a413d5.js → controls.btns-af5280bd.js} +1 -1
  46. package/dist/{controls.config-ae99bcd1.js → controls.config-d936ea41.js} +1 -1
  47. package/dist/{controls.divide-8f26abff.js → controls.divide-e988fa36.js} +1 -1
  48. package/dist/{controls.overlay-a72d72e4.js → controls.overlay-9bfc642f.js} +1 -1
  49. package/dist/{controls.term1-3c9e55b8.js → controls.term1-62150931.js} +1 -1
  50. package/dist/{cuminc-e7326248.js → cuminc-9c7ff331.js} +1 -1
  51. package/dist/{dataDownload-f3cdbc7c.js → dataDownload-1f61a3fd.js} +1 -1
  52. package/dist/{databrowser.ui-52855244.js → databrowser.ui-0803623f.js} +1 -1
  53. package/dist/{density-33ec5f83.js → density-4ca7f14f.js} +1 -1
  54. package/dist/{dictionary-578c63d9.js → dictionary-943a4cd2.js} +1 -1
  55. package/dist/{drag-e2fbde14.js → drag-19604a2e.js} +1 -1
  56. package/dist/{e2pca-fa8ce887.js → e2pca-e18c801f.js} +1 -1
  57. package/dist/{ep-b51b82d5.js → ep-708f0514.js} +1 -1
  58. package/dist/{filter-5a5a1166.js → filter-6b0bd66e.js} +1 -1
  59. package/dist/{fusion.parse-d20a9d3d.js → fusion.parse-206fa8af.js} +1 -1
  60. package/dist/{gdc.maf-ced4bc13.js → gdc.maf-84509ef3.js} +1 -1
  61. package/dist/{gdc.singleCell-1fc3a5b9.js → gdc.singleCell-350d7e63.js} +1 -1
  62. package/dist/{geneExpression-0d0e9692.js → geneExpression-ef1eda3f.js} +1 -1
  63. package/dist/{geneSearch4GDCmds3-b3a65ff2.js → geneSearch4GDCmds3-e9196a30.js} +1 -1
  64. package/dist/{geneVariant-1100ab96.js → geneVariant-4b5d3728.js} +1 -1
  65. package/dist/genefusion.ui-31ff953e.js +1 -0
  66. package/dist/{geneset-b37a8d83.js → geneset-48feba0c.js} +1 -1
  67. package/dist/{genesetEdit-15cec871.js → genesetEdit-34f2ee5d.js} +1 -1
  68. package/dist/{genomeBrowser-10004899.js → genomeBrowser-f175f471.js} +1 -1
  69. package/dist/{genomeBrowser.controls-2d794ff1.js → genomeBrowser.controls-674775c6.js} +1 -1
  70. package/dist/{groupsetting-eaf40465.js → groupsetting-a58e1f5a.js} +1 -1
  71. package/dist/{hic.straw-1ca9ddd0.js → hic.straw-3143889c.js} +1 -1
  72. package/dist/{hierCluster-6e93c3b2.js → hierCluster-130e5722.js} +1 -1
  73. package/dist/{hierCluster.config-9b8fa78e.js → hierCluster.config-d4fdfeac.js} +1 -1
  74. package/dist/{hierCluster.interactivity-e379aa01.js → hierCluster.interactivity-4b1534bc.js} +1 -1
  75. package/dist/{hierCluster.renderers-7b35f0cc.js → hierCluster.renderers-cd618c97.js} +1 -1
  76. package/dist/{html.legend-48cf5c03.js → html.legend-f44f18ab.js} +1 -1
  77. package/dist/{lasso-afa6b87e.js → lasso-22efae36.js} +1 -1
  78. package/dist/launch.adhoc-7639eb4a.js +1 -0
  79. package/dist/{launchGdcHierCluster-ab790040.js → launchGdcHierCluster-001bc76e.js} +1 -1
  80. package/dist/{launchGdcMatrix-48c56699.js → launchGdcMatrix-6c906351.js} +1 -1
  81. package/dist/{legacyDataset-21fdc0fe.js → legacyDataset-661691af.js} +1 -1
  82. package/dist/{log-9e964794.js → log-848ca156.js} +1 -1
  83. package/dist/{maftimeline-fc71d7a0.js → maftimeline-8b2d8513.js} +1 -1
  84. package/dist/{matrix-d644b099.js → matrix-af727a11.js} +1 -1
  85. package/dist/{matrix.cells-5db8ba9e.js → matrix.cells-7ea665f3.js} +1 -1
  86. package/dist/{matrix.cluster-88a2266e.js → matrix.cluster-33321b79.js} +1 -1
  87. package/dist/{matrix.config-85132ec9.js → matrix.config-d8efc6dc.js} +1 -1
  88. package/dist/{matrix.controls-4933c41c.js → matrix.controls-b2dc0e5b.js} +1 -1
  89. package/dist/{matrix.data-b798eb7d.js → matrix.data-7feb7104.js} +1 -1
  90. package/dist/{matrix.dom-6971ecb1.js → matrix.dom-7394bd2c.js} +1 -1
  91. package/dist/{matrix.interactivity-380a57f9.js → matrix.interactivity-ff7ed88a.js} +1 -1
  92. package/dist/{matrix.layout-3165a88a.js → matrix.layout-168399d4.js} +1 -1
  93. package/dist/{matrix.legend-f0ab9a34.js → matrix.legend-10a21caa.js} +1 -1
  94. package/dist/{matrix.renderers-48826412.js → matrix.renderers-3a992e66.js} +1 -1
  95. package/dist/{matrix.serieses-610f9bc4.js → matrix.serieses-43f86542.js} +1 -1
  96. package/dist/{mavb-54aeff14.js → mavb-dc006bd3.js} +1 -1
  97. package/dist/{mds.fimo-fa2b1d1a.js → mds.fimo-fcc96802.js} +1 -1
  98. package/dist/{mds.samplescatterplot-669b4e1d.js → mds.samplescatterplot-c8732bae.js} +1 -1
  99. package/dist/{mds.survivalplot-055a1274.js → mds.survivalplot-4e72eb4b.js} +1 -1
  100. package/dist/{mdsjsonform-8d72a884.js → mdsjsonform-cd7cbed1.js} +1 -1
  101. package/dist/{nodrag-094c4b10.js → nodrag-39389c59.js} +1 -1
  102. package/dist/{numeric-939729b0.js → numeric-28b1370d.js} +1 -1
  103. package/dist/{numeric.binary-d1ada20b.js → numeric.binary-de25c5cb.js} +1 -1
  104. package/dist/{numeric.continuous-cf4fb4c0.js → numeric.continuous-78ae5f51.js} +1 -1
  105. package/dist/{numeric.discrete-ea17f823.js → numeric.discrete-7976336c.js} +1 -1
  106. package/dist/{numeric.spline-2d40b041.js → numeric.spline-1adcbe86.js} +1 -1
  107. package/dist/{numeric.toggle-7e1ae903.js → numeric.toggle-ba85b972.js} +1 -1
  108. package/dist/{plot.2dvaf-12d6ace7.js → plot.2dvaf-d8eda179.js} +1 -1
  109. package/dist/plot.app-cf29de59.js +1 -0
  110. package/dist/{plot.barplot-ab82cad5.js → plot.barplot-469de952.js} +1 -1
  111. package/dist/{plot.boxplot-d4984beb.js → plot.boxplot-29ed0bcd.js} +1 -1
  112. package/dist/{plot.disco-7efd2855.js → plot.disco-15695284.js} +1 -1
  113. package/dist/{plot.ssgq-e41ca8ac.js → plot.ssgq-ab818820.js} +1 -1
  114. package/dist/{plot.vaf2cov-0cf0bfb0.js → plot.vaf2cov-646c89ff.js} +1 -1
  115. package/dist/{polar-86a9ecb8.js → polar-57ab248e.js} +1 -1
  116. package/dist/{profileBarchart-a41a1fd8.js → profileBarchart-5eda57dd.js} +1 -1
  117. package/dist/{profileHome-1ada0bb1.js → profileHome-98d3bd09.js} +1 -1
  118. package/dist/{profilePlot-69af5e30.js → profilePlot-c1bc4e3f.js} +1 -1
  119. package/dist/{profilePolar-7446e230.js → profilePolar-d6a3ef51.js} +1 -1
  120. package/dist/{profileRadar-d23d8ebe.js → profileRadar-61cd7e72.js} +1 -1
  121. package/dist/{profileRadarFacility-9f9a324e.js → profileRadarFacility-fd292b0d.js} +1 -1
  122. package/dist/{recover-791d56f8.js → recover-97602f64.js} +1 -1
  123. package/dist/{regression.inputs-ba7b7342.js → regression.inputs-87698b93.js} +1 -1
  124. package/dist/{regression.inputs.values.table-3f6f7f0f.js → regression.inputs.values.table-be00c818.js} +1 -1
  125. package/dist/{regression.results-9bd02fe0.js → regression.results-d67d5723.js} +1 -1
  126. package/dist/{renderPvalueTable-f34371aa.js → renderPvalueTable-8ee523f4.js} +1 -1
  127. package/dist/{sampleScatter-ef4e3347.js → sampleScatter-dc8bd1d4.js} +1 -1
  128. package/dist/sampleScatter.interactivity-6b31c51d.js +1 -0
  129. package/dist/{sampleScatter.rendererThree-b0ddac07.js → sampleScatter.rendererThree-df642763.js} +2 -2
  130. package/dist/{sampleView-836462bb.js → sampleView-0d819313.js} +1 -1
  131. package/dist/{samplelst-6512a752.js → samplelst-e4224495.js} +1 -1
  132. package/dist/{samplematrix-8583e240.js → samplematrix-d77014f0.js} +1 -1
  133. package/dist/{scatter-a24646d2.js → scatter-df455b44.js} +1 -1
  134. package/dist/{selectGenomeWithTklst-c0822ac4.js → selectGenomeWithTklst-f927c08a.js} +1 -1
  135. package/dist/singleCellPlot-f4f9f8ce.js +1 -0
  136. package/dist/{singlecell-fc57d3bd.js → singlecell-d21858f6.js} +1 -1
  137. package/dist/{snplocus-502738fa.js → snplocus-cdb05467.js} +1 -1
  138. package/dist/{snplst-1b5cd5d8.js → snplst-8027603b.js} +1 -1
  139. package/dist/{spliceevent.a53ss.diagram-d6a9ec18.js → spliceevent.a53ss.diagram-305210e8.js} +1 -1
  140. package/dist/{spliceevent.exonskip.diagram-122b34c8.js → spliceevent.exonskip.diagram-b818e745.js} +1 -1
  141. package/dist/spliceevent.exonskip.getdefault-b539bbf8.js +1 -0
  142. package/dist/{spliceevent.noeventdiagram-24239df6.js → spliceevent.noeventdiagram-b8520d70.js} +1 -1
  143. package/dist/{spliceevent.phrase-3f069dbd.js → spliceevent.phrase-9e487144.js} +1 -1
  144. package/dist/{stattable-f81097a3.js → stattable-706eb093.js} +1 -1
  145. package/dist/{style.gdc-58cdad5e.js → style.gdc-0f9b5225.js} +1 -1
  146. package/dist/{summary-af438607.js → summary-e42dbeea.js} +1 -1
  147. package/dist/{sunburst-562d787b.js → sunburst-23a46601.js} +1 -1
  148. package/dist/survival-e1f95639.js +1 -0
  149. package/dist/{survival-d8c8c5b5.js → survival-fa638d4f.js} +1 -1
  150. package/dist/{svg.download-89c31ee5.js → svg.download-60935a3f.js} +1 -1
  151. package/dist/{svg.legend-5ce6961b.js → svg.legend-404a03f8.js} +1 -1
  152. package/dist/{svgraph-c326dadb.js → svgraph-22fb937c.js} +1 -1
  153. package/dist/{svmr-7de419fb.js → svmr-33a9543a.js} +1 -1
  154. package/dist/{table-141e31d7.js → table-6354b788.js} +1 -1
  155. package/dist/{table-2310e41b.js → table-dba817a9.js} +1 -1
  156. package/dist/{termInfo-3ae67507.js → termInfo-fdb502e7.js} +1 -1
  157. package/dist/{termsetting-8476b5ab.js → termsetting-720557a3.js} +1 -1
  158. package/dist/{tk-fc2e6168.js → tk-fcd7514e.js} +1 -1
  159. package/dist/{tp.ui-a59142ec.js → tp.ui-ece56c46.js} +1 -1
  160. package/dist/{tvs.density-a177d69f.js → tvs.density-411c1792.js} +1 -1
  161. package/dist/{tvs.geneVariant-68b9ca25.js → tvs.geneVariant-a6e91f37.js} +1 -1
  162. package/dist/{tvs.numeric-5c6f5524.js → tvs.numeric-358c99a0.js} +1 -1
  163. package/dist/{tvs.samplelst-3ddd4435.js → tvs.samplelst-946d4a6c.js} +1 -1
  164. package/dist/{uiUtils-60f490b2.js → uiUtils-be9b8f1b.js} +1 -1
  165. package/dist/{variantBrowser-882cd310.js → variantBrowser-91d4eb10.js} +1 -1
  166. package/dist/{vcf-ee473671.js → vcf-d8c0a17a.js} +1 -1
  167. package/dist/{violin-f96e92c7.js → violin-84138ebc.js} +1 -1
  168. package/dist/{violin.interactivity-5a9e20f2.js → violin.interactivity-31eff8d9.js} +1 -1
  169. package/dist/{violin.renderer-687d2341.js → violin.renderer-3d0d8f17.js} +1 -1
  170. package/dist/{violinRenderer-e37d4065.js → violinRenderer-ee11b031.js} +1 -1
  171. package/dist/{viridis-98237589.js → viridis-98f22f29.js} +1 -1
  172. package/dist/{y-8e1e7dad.js → y-836a433e.js} +1 -1
  173. package/dist/{zoom-eade983c.js → zoom-f044afad.js} +1 -1
  174. package/package.json +1 -1
  175. package/dist/block.lazyload-b81d268c.js +0 -1
  176. package/dist/genefusion.ui-b1264dc8.js +0 -1
  177. package/dist/launch.adhoc-50d81ba2.js +0 -1
  178. package/dist/plot.app-72083fe7.js +0 -1
  179. package/dist/sampleScatter.interactivity-22035655.js +0 -1
  180. package/dist/singleCellPlot-7caa7fdd.js +0 -1
  181. package/dist/spliceevent.exonskip.getdefault-f1bf3d40.js +0 -1
  182. package/dist/survival-e500bc6e.js +0 -1
@@ -1 +1 @@
1
- import{bz as n,aU as t}from"./app-f70d9a0b.js";function r(n){return function(){return n}}function e(n){return(n()-.5)*1e-6}const i=1664525;const f=1013904223;const u=4294967296;function o(){let n=1;return()=>(n=(i*n+f)%u)/u}var a=10,c=Math.PI*(3-Math.sqrt(5));function l(r){var e,i=1,f=.001,u=1-Math.pow(f,1/300),l=0,h=.6,s=new Map,y=n(p),g=t("tick","end"),v=o();if(r==null)r=[];function p(){x();g.call("tick",e);if(i<f){y.stop();g.call("end",e)}}function x(n){var t,f=r.length,o;if(n===undefined)n=1;for(var a=0;a<n;++a){i+=(l-i)*u;s.forEach((function(n){n(i)}));for(t=0;t<f;++t){o=r[t];if(o.fx==null)o.x+=o.vx*=h;else o.x=o.fx,o.vx=0;if(o.fy==null)o.y+=o.vy*=h;else o.y=o.fy,o.vy=0}}return e}function N(){for(var n=0,t=r.length,e;n<t;++n){e=r[n],e.index=n;if(e.fx!=null)e.x=e.fx;if(e.fy!=null)e.y=e.fy;if(isNaN(e.x)||isNaN(e.y)){var i=a*Math.sqrt(.5+n),f=n*c;e.x=i*Math.cos(f);e.y=i*Math.sin(f)}if(isNaN(e.vx)||isNaN(e.vy)){e.vx=e.vy=0}}}function d(n){if(n.initialize)n.initialize(r,v);return n}N();return e={tick:x,restart:function(){return y.restart(p),e},stop:function(){return y.stop(),e},nodes:function(n){return arguments.length?(r=n,N(),s.forEach(d),e):r},alpha:function(n){return arguments.length?(i=+n,e):i},alphaMin:function(n){return arguments.length?(f=+n,e):f},alphaDecay:function(n){return arguments.length?(u=+n,e):+u},alphaTarget:function(n){return arguments.length?(l=+n,e):l},velocityDecay:function(n){return arguments.length?(h=1-n,e):1-h},randomSource:function(n){return arguments.length?(v=n,s.forEach(d),e):v},force:function(n,t){return arguments.length>1?(t==null?s.delete(n):s.set(n,d(t)),e):s.get(n)},find:function(n,t,e){var i=0,f=r.length,u,o,a,c,l;if(e==null)e=Infinity;else e*=e;for(i=0;i<f;++i){c=r[i];u=n-c.x;o=t-c.y;a=u*u+o*o;if(a<e)l=c,e=a}return l},on:function(n,t){return arguments.length>1?(g.on(n,t),e):g.on(n)}}}function h(n){var t=r(.1),e,i,f;if(typeof n!=="function")n=r(n==null?0:+n);function u(n){for(var t=0,r=e.length,u;t<r;++t){u=e[t],u.vx+=(f[t]-u.x)*i[t]*n}}function o(){if(!e)return;var r,u=e.length;i=new Array(u);f=new Array(u);for(r=0;r<u;++r){i[r]=isNaN(f[r]=+n(e[r],r,e))?0:+t(e[r],r,e)}}u.initialize=function(n){e=n;o()};u.strength=function(n){return arguments.length?(t=typeof n==="function"?n:r(+n),o(),u):t};u.x=function(t){return arguments.length?(n=typeof t==="function"?t:r(+t),o(),u):n};return u}function s(n){var t=r(.1),e,i,f;if(typeof n!=="function")n=r(n==null?0:+n);function u(n){for(var t=0,r=e.length,u;t<r;++t){u=e[t],u.vy+=(f[t]-u.y)*i[t]*n}}function o(){if(!e)return;var r,u=e.length;i=new Array(u);f=new Array(u);for(r=0;r<u;++r){i[r]=isNaN(f[r]=+n(e[r],r,e))?0:+t(e[r],r,e)}}u.initialize=function(n){e=n;o()};u.strength=function(n){return arguments.length?(t=typeof n==="function"?n:r(+n),o(),u):t};u.y=function(t){return arguments.length?(n=typeof t==="function"?t:r(+t),o(),u):n};return u}export{r as c,e as j,l as s,h as x,s as y};
1
+ import{bz as n,aU as t}from"./app-f73edb78.js";function r(n){return function(){return n}}function e(n){return(n()-.5)*1e-6}const i=1664525;const f=1013904223;const u=4294967296;function o(){let n=1;return()=>(n=(i*n+f)%u)/u}var a=10,c=Math.PI*(3-Math.sqrt(5));function l(r){var e,i=1,f=.001,u=1-Math.pow(f,1/300),l=0,h=.6,s=new Map,y=n(p),g=t("tick","end"),v=o();if(r==null)r=[];function p(){x();g.call("tick",e);if(i<f){y.stop();g.call("end",e)}}function x(n){var t,f=r.length,o;if(n===undefined)n=1;for(var a=0;a<n;++a){i+=(l-i)*u;s.forEach((function(n){n(i)}));for(t=0;t<f;++t){o=r[t];if(o.fx==null)o.x+=o.vx*=h;else o.x=o.fx,o.vx=0;if(o.fy==null)o.y+=o.vy*=h;else o.y=o.fy,o.vy=0}}return e}function N(){for(var n=0,t=r.length,e;n<t;++n){e=r[n],e.index=n;if(e.fx!=null)e.x=e.fx;if(e.fy!=null)e.y=e.fy;if(isNaN(e.x)||isNaN(e.y)){var i=a*Math.sqrt(.5+n),f=n*c;e.x=i*Math.cos(f);e.y=i*Math.sin(f)}if(isNaN(e.vx)||isNaN(e.vy)){e.vx=e.vy=0}}}function d(n){if(n.initialize)n.initialize(r,v);return n}N();return e={tick:x,restart:function(){return y.restart(p),e},stop:function(){return y.stop(),e},nodes:function(n){return arguments.length?(r=n,N(),s.forEach(d),e):r},alpha:function(n){return arguments.length?(i=+n,e):i},alphaMin:function(n){return arguments.length?(f=+n,e):f},alphaDecay:function(n){return arguments.length?(u=+n,e):+u},alphaTarget:function(n){return arguments.length?(l=+n,e):l},velocityDecay:function(n){return arguments.length?(h=1-n,e):1-h},randomSource:function(n){return arguments.length?(v=n,s.forEach(d),e):v},force:function(n,t){return arguments.length>1?(t==null?s.delete(n):s.set(n,d(t)),e):s.get(n)},find:function(n,t,e){var i=0,f=r.length,u,o,a,c,l;if(e==null)e=Infinity;else e*=e;for(i=0;i<f;++i){c=r[i];u=n-c.x;o=t-c.y;a=u*u+o*o;if(a<e)l=c,e=a}return l},on:function(n,t){return arguments.length>1?(g.on(n,t),e):g.on(n)}}}function h(n){var t=r(.1),e,i,f;if(typeof n!=="function")n=r(n==null?0:+n);function u(n){for(var t=0,r=e.length,u;t<r;++t){u=e[t],u.vx+=(f[t]-u.x)*i[t]*n}}function o(){if(!e)return;var r,u=e.length;i=new Array(u);f=new Array(u);for(r=0;r<u;++r){i[r]=isNaN(f[r]=+n(e[r],r,e))?0:+t(e[r],r,e)}}u.initialize=function(n){e=n;o()};u.strength=function(n){return arguments.length?(t=typeof n==="function"?n:r(+n),o(),u):t};u.x=function(t){return arguments.length?(n=typeof t==="function"?t:r(+t),o(),u):n};return u}function s(n){var t=r(.1),e,i,f;if(typeof n!=="function")n=r(n==null?0:+n);function u(n){for(var t=0,r=e.length,u;t<r;++t){u=e[t],u.vy+=(f[t]-u.y)*i[t]*n}}function o(){if(!e)return;var r,u=e.length;i=new Array(u);f=new Array(u);for(r=0;r<u;++r){i[r]=isNaN(f[r]=+n(e[r],r,e))?0:+t(e[r],r,e)}}u.initialize=function(n){e=n;o()};u.strength=function(n){return arguments.length?(t=typeof n==="function"?n:r(+n),o(),u):t};u.y=function(t){return arguments.length?(n=typeof t==="function"?t:r(+t),o(),u):n};return u}export{r as c,e as j,l as s,h as x,s as y};
@@ -1 +1 @@
1
- import{aU as t,q as e,aW as n}from"./app-f70d9a0b.js";import{i as o,T as i}from"./transform-f2cc07e6.js";import{p as r}from"./pointer-c7475677.js";import{d as u,y as a}from"./nodrag-094c4b10.js";var h=1e-12;function s(t){return((t=Math.exp(t))+1/t)/2}function c(t){return((t=Math.exp(t))-1/t)/2}function f(t){return((t=Math.exp(2*t))-1)/(t+1)}var l=function t(e,n,o){function i(t,i){var r=t[0],u=t[1],a=t[2],l=i[0],m=i[1],p=i[2],v=l-r,y=m-u,d=v*v+y*y,g,z;if(d<h){z=Math.log(p/a)/e;g=function(t){return[r+t*v,u+t*y,a*Math.exp(e*t*z)]}}else{var _=Math.sqrt(d),M=(p*p-a*a+o*d)/(2*a*n*_),x=(p*p-a*a-o*d)/(2*p*n*_),w=Math.log(Math.sqrt(M*M+1)-M),b=Math.log(Math.sqrt(x*x+1)-x);z=(b-w)/e;g=function(t){var o=t*z,i=s(w),h=a/(n*_)*(i*f(e*o+w)-c(w));return[r+h*v,u+h*y,a*i/s(e*o+w)]}}g.duration=z*1e3*e/Math.SQRT2;return g}i.rho=function(e){var n=Math.max(.001,+e),o=n*n,i=o*o;return t(n,o,i)};return i}(Math.SQRT2,2,4);var m=t=>()=>t;function p(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:true,configurable:true},sourceEvent:{value:e,enumerable:true,configurable:true},target:{value:n,enumerable:true,configurable:true},transform:{value:o,enumerable:true,configurable:true},_:{value:i}})}function v(t){t.stopImmediatePropagation()}function y(t){t.preventDefault();t.stopImmediatePropagation()}function d(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function g(){var t=this;if(t instanceof SVGElement){t=t.ownerSVGElement||t;if(t.hasAttribute("viewBox")){t=t.viewBox.baseVal;return[[t.x,t.y],[t.x+t.width,t.y+t.height]]}return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}return[[0,0],[t.clientWidth,t.clientHeight]]}function z(){return this.__zoom||o}function _(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function M(){return navigator.maxTouchPoints||"ontouchstart"in this}function x(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],u=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}function w(){var h=d,s=g,c=x,f=_,w=M,b=[0,Infinity],T=[[-Infinity,-Infinity],[Infinity,Infinity]],k=250,E=l,I=t("start","zoom","end"),q,j,V,Y=500,B=150,D=0,P=10;function S(t){t.property("__zoom",z).on("wheel.zoom",A,{passive:false}).on("mousedown.zoom",H).on("dblclick.zoom",O).filter(w).on("touchstart.zoom",U).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(t,e,n,o){var i=t.selection?t.selection():t;i.property("__zoom",z);if(t!==i){Q(t,e,n,o)}else{i.interrupt().each((function(){R(this,arguments).event(o).start().zoom(null,typeof e==="function"?e.apply(this,arguments):e).end()}))}};S.scaleBy=function(t,e,n,o){S.scaleTo(t,(function(){var t=this.__zoom.k,n=typeof e==="function"?e.apply(this,arguments):e;return t*n}),n,o)};S.scaleTo=function(t,e,n,o){S.transform(t,(function(){var t=s.apply(this,arguments),o=this.__zoom,i=n==null?G(t):typeof n==="function"?n.apply(this,arguments):n,r=o.invert(i),u=typeof e==="function"?e.apply(this,arguments):e;return c(K(X(o,u),i,r),t,T)}),n,o)};S.translateBy=function(t,e,n,o){S.transform(t,(function(){return c(this.__zoom.translate(typeof e==="function"?e.apply(this,arguments):e,typeof n==="function"?n.apply(this,arguments):n),s.apply(this,arguments),T)}),null,o)};S.translateTo=function(t,e,n,i,r){S.transform(t,(function(){var t=s.apply(this,arguments),r=this.__zoom,u=i==null?G(t):typeof i==="function"?i.apply(this,arguments):i;return c(o.translate(u[0],u[1]).scale(r.k).translate(typeof e==="function"?-e.apply(this,arguments):-e,typeof n==="function"?-n.apply(this,arguments):-n),t,T)}),i,r)};function X(t,e){e=Math.max(b[0],Math.min(b[1],e));return e===t.k?t:new i(e,t.x,t.y)}function K(t,e,n){var o=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return o===t.x&&r===t.y?t:new i(t.k,o,r)}function G(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function Q(t,e,n,o){t.on("start.zoom",(function(){R(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){R(this,arguments).event(o).end()})).tween("zoom",(function(){var t=this,r=arguments,u=R(t,r).event(o),a=s.apply(t,r),h=n==null?G(a):typeof n==="function"?n.apply(t,r):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),f=t.__zoom,l=typeof e==="function"?e.apply(t,r):e,m=E(f.invert(h).concat(c/f.k),l.invert(h).concat(c/l.k));return function(t){if(t===1)t=l;else{var e=m(t),n=c/e[2];t=new i(n,h[0]-e[0]*n,h[1]-e[1]*n)}u.zoom(null,t)}}))}function R(t,e,n){return!n&&t.__zooming||new W(t,e)}function W(t,e){this.that=t;this.args=e;this.active=0;this.sourceEvent=null;this.extent=s.apply(t,e);this.taps=0}W.prototype={event:function(t){if(t)this.sourceEvent=t;return this},start:function(){if(++this.active===1){this.that.__zooming=this;this.emit("start")}return this},zoom:function(t,e){if(this.mouse&&t!=="mouse")this.mouse[1]=e.invert(this.mouse[0]);if(this.touch0&&t!=="touch")this.touch0[1]=e.invert(this.touch0[0]);if(this.touch1&&t!=="touch")this.touch1[1]=e.invert(this.touch1[0]);this.that.__zoom=e;this.emit("zoom");return this},end:function(){if(--this.active===0){delete this.that.__zooming;this.emit("end")}return this},emit:function(t){var n=e(this.that).datum();I.call(t,this.that,new p(t,{sourceEvent:this.sourceEvent,target:S,type:t,transform:this.that.__zoom,dispatch:I}),n)}};function A(t,...e){if(!h.apply(this,arguments))return;var o=R(this,e).event(t),i=this.__zoom,u=Math.max(b[0],Math.min(b[1],i.k*Math.pow(2,f.apply(this,arguments)))),a=r(t);if(o.wheel){if(o.mouse[0][0]!==a[0]||o.mouse[0][1]!==a[1]){o.mouse[1]=i.invert(o.mouse[0]=a)}clearTimeout(o.wheel)}else if(i.k===u)return;else{o.mouse=[a,i.invert(a)];n(this);o.start()}y(t);o.wheel=setTimeout(s,B);o.zoom("mouse",c(K(X(i,u),o.mouse[0],o.mouse[1]),o.extent,T));function s(){o.wheel=null;o.end()}}function H(t,...o){if(V||!h.apply(this,arguments))return;var i=t.currentTarget,s=R(this,o,true).event(t),f=e(t.view).on("mousemove.zoom",d,true).on("mouseup.zoom",g,true),l=r(t,i),m=t.clientX,p=t.clientY;u(t.view);v(t);s.mouse=[l,this.__zoom.invert(l)];n(this);s.start();function d(t){y(t);if(!s.moved){var e=t.clientX-m,n=t.clientY-p;s.moved=e*e+n*n>D}s.event(t).zoom("mouse",c(K(s.that.__zoom,s.mouse[0]=r(t,i),s.mouse[1]),s.extent,T))}function g(t){f.on("mousemove.zoom mouseup.zoom",null);a(t.view,s.moved);y(t);s.event(t).end()}}function O(t,...n){if(!h.apply(this,arguments))return;var o=this.__zoom,i=r(t.changedTouches?t.changedTouches[0]:t,this),u=o.invert(i),a=o.k*(t.shiftKey?.5:2),f=c(K(X(o,a),i,u),s.apply(this,n),T);y(t);if(k>0)e(this).transition().duration(k).call(Q,f,i,t);else e(this).call(S.transform,f,i,t)}function U(t,...e){if(!h.apply(this,arguments))return;var o=t.touches,i=o.length,u=R(this,e,t.changedTouches.length===i).event(t),a,s,c,f;v(t);for(s=0;s<i;++s){c=o[s],f=r(c,this);f=[f,this.__zoom.invert(f),c.identifier];if(!u.touch0)u.touch0=f,a=true,u.taps=1+!!q;else if(!u.touch1&&u.touch0[2]!==f[2])u.touch1=f,u.taps=0}if(q)q=clearTimeout(q);if(a){if(u.taps<2)j=f[0],q=setTimeout((function(){q=null}),Y);n(this);u.start()}}function C(t,...e){if(!this.__zooming)return;var n=R(this,e).event(t),o=t.changedTouches,i=o.length,u,a,h,s;y(t);for(u=0;u<i;++u){a=o[u],h=r(a,this);if(n.touch0&&n.touch0[2]===a.identifier)n.touch0[0]=h;else if(n.touch1&&n.touch1[2]===a.identifier)n.touch1[0]=h}a=n.that.__zoom;if(n.touch1){var f=n.touch0[0],l=n.touch0[1],m=n.touch1[0],p=n.touch1[1],v=(v=m[0]-f[0])*v+(v=m[1]-f[1])*v,d=(d=p[0]-l[0])*d+(d=p[1]-l[1])*d;a=X(a,Math.sqrt(v/d));h=[(f[0]+m[0])/2,(f[1]+m[1])/2];s=[(l[0]+p[0])/2,(l[1]+p[1])/2]}else if(n.touch0)h=n.touch0[0],s=n.touch0[1];else return;n.zoom("touch",c(K(a,h,s),n.extent,T))}function F(t,...n){if(!this.__zooming)return;var o=R(this,n).event(t),i=t.changedTouches,u=i.length,a,h;v(t);if(V)clearTimeout(V);V=setTimeout((function(){V=null}),Y);for(a=0;a<u;++a){h=i[a];if(o.touch0&&o.touch0[2]===h.identifier)delete o.touch0;else if(o.touch1&&o.touch1[2]===h.identifier)delete o.touch1}if(o.touch1&&!o.touch0)o.touch0=o.touch1,delete o.touch1;if(o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else{o.end();if(o.taps===2){h=r(h,this);if(Math.hypot(j[0]-h[0],j[1]-h[1])<P){var s=e(this).on("dblclick.zoom");if(s)s.apply(this,arguments)}}}}S.wheelDelta=function(t){return arguments.length?(f=typeof t==="function"?t:m(+t),S):f};S.filter=function(t){return arguments.length?(h=typeof t==="function"?t:m(!!t),S):h};S.touchable=function(t){return arguments.length?(w=typeof t==="function"?t:m(!!t),S):w};S.extent=function(t){return arguments.length?(s=typeof t==="function"?t:m([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),S):s};S.scaleExtent=function(t){return arguments.length?(b[0]=+t[0],b[1]=+t[1],S):[b[0],b[1]]};S.translateExtent=function(t){return arguments.length?(T[0][0]=+t[0][0],T[1][0]=+t[1][0],T[0][1]=+t[0][1],T[1][1]=+t[1][1],S):[[T[0][0],T[0][1]],[T[1][0],T[1][1]]]};S.constrain=function(t){return arguments.length?(c=t,S):c};S.duration=function(t){return arguments.length?(k=+t,S):k};S.interpolate=function(t){return arguments.length?(E=t,S):E};S.on=function(){var t=I.on.apply(I,arguments);return t===I?S:t};S.clickDistance=function(t){return arguments.length?(D=(t=+t)*t,S):Math.sqrt(D)};S.tapDistance=function(t){return arguments.length?(P=+t,S):P};return S}export{w as d};
1
+ import{aU as t,q as e,aW as n}from"./app-f73edb78.js";import{i as o,T as i}from"./transform-f2cc07e6.js";import{p as r}from"./pointer-c7475677.js";import{d as u,y as a}from"./nodrag-39389c59.js";var h=1e-12;function s(t){return((t=Math.exp(t))+1/t)/2}function c(t){return((t=Math.exp(t))-1/t)/2}function f(t){return((t=Math.exp(2*t))-1)/(t+1)}var l=function t(e,n,o){function i(t,i){var r=t[0],u=t[1],a=t[2],l=i[0],m=i[1],p=i[2],v=l-r,y=m-u,d=v*v+y*y,g,z;if(d<h){z=Math.log(p/a)/e;g=function(t){return[r+t*v,u+t*y,a*Math.exp(e*t*z)]}}else{var _=Math.sqrt(d),M=(p*p-a*a+o*d)/(2*a*n*_),x=(p*p-a*a-o*d)/(2*p*n*_),w=Math.log(Math.sqrt(M*M+1)-M),b=Math.log(Math.sqrt(x*x+1)-x);z=(b-w)/e;g=function(t){var o=t*z,i=s(w),h=a/(n*_)*(i*f(e*o+w)-c(w));return[r+h*v,u+h*y,a*i/s(e*o+w)]}}g.duration=z*1e3*e/Math.SQRT2;return g}i.rho=function(e){var n=Math.max(.001,+e),o=n*n,i=o*o;return t(n,o,i)};return i}(Math.SQRT2,2,4);var m=t=>()=>t;function p(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:true,configurable:true},sourceEvent:{value:e,enumerable:true,configurable:true},target:{value:n,enumerable:true,configurable:true},transform:{value:o,enumerable:true,configurable:true},_:{value:i}})}function v(t){t.stopImmediatePropagation()}function y(t){t.preventDefault();t.stopImmediatePropagation()}function d(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function g(){var t=this;if(t instanceof SVGElement){t=t.ownerSVGElement||t;if(t.hasAttribute("viewBox")){t=t.viewBox.baseVal;return[[t.x,t.y],[t.x+t.width,t.y+t.height]]}return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}return[[0,0],[t.clientWidth,t.clientHeight]]}function z(){return this.__zoom||o}function _(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function M(){return navigator.maxTouchPoints||"ontouchstart"in this}function x(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],u=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}function w(){var h=d,s=g,c=x,f=_,w=M,b=[0,Infinity],T=[[-Infinity,-Infinity],[Infinity,Infinity]],k=250,E=l,I=t("start","zoom","end"),q,j,V,Y=500,B=150,D=0,P=10;function S(t){t.property("__zoom",z).on("wheel.zoom",A,{passive:false}).on("mousedown.zoom",H).on("dblclick.zoom",O).filter(w).on("touchstart.zoom",U).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(t,e,n,o){var i=t.selection?t.selection():t;i.property("__zoom",z);if(t!==i){Q(t,e,n,o)}else{i.interrupt().each((function(){R(this,arguments).event(o).start().zoom(null,typeof e==="function"?e.apply(this,arguments):e).end()}))}};S.scaleBy=function(t,e,n,o){S.scaleTo(t,(function(){var t=this.__zoom.k,n=typeof e==="function"?e.apply(this,arguments):e;return t*n}),n,o)};S.scaleTo=function(t,e,n,o){S.transform(t,(function(){var t=s.apply(this,arguments),o=this.__zoom,i=n==null?G(t):typeof n==="function"?n.apply(this,arguments):n,r=o.invert(i),u=typeof e==="function"?e.apply(this,arguments):e;return c(K(X(o,u),i,r),t,T)}),n,o)};S.translateBy=function(t,e,n,o){S.transform(t,(function(){return c(this.__zoom.translate(typeof e==="function"?e.apply(this,arguments):e,typeof n==="function"?n.apply(this,arguments):n),s.apply(this,arguments),T)}),null,o)};S.translateTo=function(t,e,n,i,r){S.transform(t,(function(){var t=s.apply(this,arguments),r=this.__zoom,u=i==null?G(t):typeof i==="function"?i.apply(this,arguments):i;return c(o.translate(u[0],u[1]).scale(r.k).translate(typeof e==="function"?-e.apply(this,arguments):-e,typeof n==="function"?-n.apply(this,arguments):-n),t,T)}),i,r)};function X(t,e){e=Math.max(b[0],Math.min(b[1],e));return e===t.k?t:new i(e,t.x,t.y)}function K(t,e,n){var o=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return o===t.x&&r===t.y?t:new i(t.k,o,r)}function G(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function Q(t,e,n,o){t.on("start.zoom",(function(){R(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){R(this,arguments).event(o).end()})).tween("zoom",(function(){var t=this,r=arguments,u=R(t,r).event(o),a=s.apply(t,r),h=n==null?G(a):typeof n==="function"?n.apply(t,r):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),f=t.__zoom,l=typeof e==="function"?e.apply(t,r):e,m=E(f.invert(h).concat(c/f.k),l.invert(h).concat(c/l.k));return function(t){if(t===1)t=l;else{var e=m(t),n=c/e[2];t=new i(n,h[0]-e[0]*n,h[1]-e[1]*n)}u.zoom(null,t)}}))}function R(t,e,n){return!n&&t.__zooming||new W(t,e)}function W(t,e){this.that=t;this.args=e;this.active=0;this.sourceEvent=null;this.extent=s.apply(t,e);this.taps=0}W.prototype={event:function(t){if(t)this.sourceEvent=t;return this},start:function(){if(++this.active===1){this.that.__zooming=this;this.emit("start")}return this},zoom:function(t,e){if(this.mouse&&t!=="mouse")this.mouse[1]=e.invert(this.mouse[0]);if(this.touch0&&t!=="touch")this.touch0[1]=e.invert(this.touch0[0]);if(this.touch1&&t!=="touch")this.touch1[1]=e.invert(this.touch1[0]);this.that.__zoom=e;this.emit("zoom");return this},end:function(){if(--this.active===0){delete this.that.__zooming;this.emit("end")}return this},emit:function(t){var n=e(this.that).datum();I.call(t,this.that,new p(t,{sourceEvent:this.sourceEvent,target:S,type:t,transform:this.that.__zoom,dispatch:I}),n)}};function A(t,...e){if(!h.apply(this,arguments))return;var o=R(this,e).event(t),i=this.__zoom,u=Math.max(b[0],Math.min(b[1],i.k*Math.pow(2,f.apply(this,arguments)))),a=r(t);if(o.wheel){if(o.mouse[0][0]!==a[0]||o.mouse[0][1]!==a[1]){o.mouse[1]=i.invert(o.mouse[0]=a)}clearTimeout(o.wheel)}else if(i.k===u)return;else{o.mouse=[a,i.invert(a)];n(this);o.start()}y(t);o.wheel=setTimeout(s,B);o.zoom("mouse",c(K(X(i,u),o.mouse[0],o.mouse[1]),o.extent,T));function s(){o.wheel=null;o.end()}}function H(t,...o){if(V||!h.apply(this,arguments))return;var i=t.currentTarget,s=R(this,o,true).event(t),f=e(t.view).on("mousemove.zoom",d,true).on("mouseup.zoom",g,true),l=r(t,i),m=t.clientX,p=t.clientY;u(t.view);v(t);s.mouse=[l,this.__zoom.invert(l)];n(this);s.start();function d(t){y(t);if(!s.moved){var e=t.clientX-m,n=t.clientY-p;s.moved=e*e+n*n>D}s.event(t).zoom("mouse",c(K(s.that.__zoom,s.mouse[0]=r(t,i),s.mouse[1]),s.extent,T))}function g(t){f.on("mousemove.zoom mouseup.zoom",null);a(t.view,s.moved);y(t);s.event(t).end()}}function O(t,...n){if(!h.apply(this,arguments))return;var o=this.__zoom,i=r(t.changedTouches?t.changedTouches[0]:t,this),u=o.invert(i),a=o.k*(t.shiftKey?.5:2),f=c(K(X(o,a),i,u),s.apply(this,n),T);y(t);if(k>0)e(this).transition().duration(k).call(Q,f,i,t);else e(this).call(S.transform,f,i,t)}function U(t,...e){if(!h.apply(this,arguments))return;var o=t.touches,i=o.length,u=R(this,e,t.changedTouches.length===i).event(t),a,s,c,f;v(t);for(s=0;s<i;++s){c=o[s],f=r(c,this);f=[f,this.__zoom.invert(f),c.identifier];if(!u.touch0)u.touch0=f,a=true,u.taps=1+!!q;else if(!u.touch1&&u.touch0[2]!==f[2])u.touch1=f,u.taps=0}if(q)q=clearTimeout(q);if(a){if(u.taps<2)j=f[0],q=setTimeout((function(){q=null}),Y);n(this);u.start()}}function C(t,...e){if(!this.__zooming)return;var n=R(this,e).event(t),o=t.changedTouches,i=o.length,u,a,h,s;y(t);for(u=0;u<i;++u){a=o[u],h=r(a,this);if(n.touch0&&n.touch0[2]===a.identifier)n.touch0[0]=h;else if(n.touch1&&n.touch1[2]===a.identifier)n.touch1[0]=h}a=n.that.__zoom;if(n.touch1){var f=n.touch0[0],l=n.touch0[1],m=n.touch1[0],p=n.touch1[1],v=(v=m[0]-f[0])*v+(v=m[1]-f[1])*v,d=(d=p[0]-l[0])*d+(d=p[1]-l[1])*d;a=X(a,Math.sqrt(v/d));h=[(f[0]+m[0])/2,(f[1]+m[1])/2];s=[(l[0]+p[0])/2,(l[1]+p[1])/2]}else if(n.touch0)h=n.touch0[0],s=n.touch0[1];else return;n.zoom("touch",c(K(a,h,s),n.extent,T))}function F(t,...n){if(!this.__zooming)return;var o=R(this,n).event(t),i=t.changedTouches,u=i.length,a,h;v(t);if(V)clearTimeout(V);V=setTimeout((function(){V=null}),Y);for(a=0;a<u;++a){h=i[a];if(o.touch0&&o.touch0[2]===h.identifier)delete o.touch0;else if(o.touch1&&o.touch1[2]===h.identifier)delete o.touch1}if(o.touch1&&!o.touch0)o.touch0=o.touch1,delete o.touch1;if(o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else{o.end();if(o.taps===2){h=r(h,this);if(Math.hypot(j[0]-h[0],j[1]-h[1])<P){var s=e(this).on("dblclick.zoom");if(s)s.apply(this,arguments)}}}}S.wheelDelta=function(t){return arguments.length?(f=typeof t==="function"?t:m(+t),S):f};S.filter=function(t){return arguments.length?(h=typeof t==="function"?t:m(!!t),S):h};S.touchable=function(t){return arguments.length?(w=typeof t==="function"?t:m(!!t),S):w};S.extent=function(t){return arguments.length?(s=typeof t==="function"?t:m([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),S):s};S.scaleExtent=function(t){return arguments.length?(b[0]=+t[0],b[1]=+t[1],S):[b[0],b[1]]};S.translateExtent=function(t){return arguments.length?(T[0][0]=+t[0][0],T[1][0]=+t[1][0],T[0][1]=+t[0][1],T[1][1]=+t[1][1],S):[[T[0][0],T[0][1]],[T[1][0],T[1][1]]]};S.constrain=function(t){return arguments.length?(c=t,S):c};S.duration=function(t){return arguments.length?(k=+t,S):k};S.interpolate=function(t){return arguments.length?(E=t,S):E};S.on=function(){var t=I.on.apply(I,arguments);return t===I?S:t};S.clickDistance=function(t){return arguments.length?(D=(t=+t)*t,S):Math.sqrt(D)};S.tapDistance=function(t){return arguments.length?(P=+t,S):P};return S}export{w as d};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-client",
3
- "version": "2.42.0",
3
+ "version": "2.42.1-0",
4
4
  "description": "a genomics visualization tool for exploring a cohort's genotype and phenotype data",
5
5
  "main": "dist/app.js",
6
6
  "module": "dist/app.js",
@@ -1 +0,0 @@
1
- let n;async function t(t){if(!n){const t=await import("./block-ec15b4b6.js").then((function(n){return n.c}));n=t.Block}return new n(t)}export{t as b};
@@ -1 +0,0 @@
1
- import{a as e,e as t,b as n,c as s}from"./uiUtils-60f490b2.js";import{o as a,q as o,R as p,aN as i}from"./app-f70d9a0b.js";import"path";function l(t,n){const s=t.append("div").style("margin","20px 20px 20px 40px").style("font-family","'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif").style("place-items","center left").style("overflow","hidden").classed("sjpp-app-ui",true);const a={};r(s,a);const o=s.append("div").style("display","flex").style("align-items","center").style("margin","10px");d(o,n,a);c(o,a);const p=s.append("div").style("display","flex").style("align-items","center").style("margin","40px 0px 40px 130px");y(p,a,t);e(p,a,".genefusion_input").style("margin","0px 10px");m(s);return a}function r(e,n){const s=t({div:e,cols:50,placeholder:"Example: PAX5,chr9,37002646,-::JAK2,chr9,5081726,+"}).style("border","1px solid rgb(138, 177, 212)").style("margin","0px 0px 0px 20px").classed("genefusion_input",true).on("keyup",(async()=>{n.data=s.property("value").trim()}))}async function d(e,t,s){const a=e.append("div").style("margin-left","40px");const o=n(a,t).style("border","1px solid rgb(138, 177, 212)");s.genome=o.node()}async function c(e,t){const n=e.append("div");const s=n.append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text("Codon position").property("value","codon");s.append("option").text("RNA position").property("value","rna");s.append("option").text("Genomic position").property("value","genomic").attr("selected",true);t.posType=s.node()}function y(e,t,n){const p=s({div:e,text:"Submit"});const i=e.append("div");p.style("display","block").on("click",(()=>{if(!t.data||t.data==undefined){const e=i.append("div").style("display","inline-block").style("max-width","20vw");a(e,"Please provide data");setTimeout((()=>e.remove()),3e3)}else{o(".sjpp-app-ui").remove();const e={host:window.location.origin,nobox:true,noheader:true,parseurl:false,genome:t.genome.options[t.genome.selectedIndex].text};u(t,n,e)}}))}function m(e){e.append("div").style("margin","10px").style("opacity","0.65").html(`Limited to two-gene fusion products.<br>\n\t\tOne product per line.<br>\n\t\tEach line has eight fields. four fields for each gene. For each gene join the following fields separated by a comma:\n\t\t<ol><li>Gene symbol</li>\n\t\t<li>Chromosome</li>\n\t\t<li>Position</li>\n\t\t<li>Strand</li>\n\t\t</ol>\n\t\tSeparate the two genes by a double colon (::). <br><br>\n\t\tExample: <br>\n\t\t<p style="margin-left: 10px">\n\t\tPAX5,chr9,37002646,-::JAK2,chr9,5081726,+<br>\n\t\tZCCHC7,chr9,37257786,-::PAX5,chr9,37024824,-<br>\n\t\tBCR,chr22,23524427,+::ABL1,chr9,133729449,+<p>`)}function u(e,t,n){if(e.data.split(/[\r\n]/).length==1){const s=e.data.trim().split("::");const a=s[0].split(",");const o=s[1].split(",");return x(t,n,a,o)}const s=t.append("div").append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text(`Select Fusion (${e.data.split(/[\r\n]/).length})`);const a=t.append("div").style("margin","20px");const o=new Map;for(const t of e.data.split(/[\r\n]/)){const e=t.trim().split("::");const n=e[0].split(",");const s=e[1].split(",");o.set(`${n[0]}-${s[0]}`,[n,s])}for(const e of o){s.append("option").property("value",e[0]).text(e[0])}s.on("change",(()=>{a.selectAll("*").remove();const e=o.get(s.property("value"));x(a,n,e[0],e[1])}))}function x(e,t,n,s){const a=[{label:n[0],callback:async(e,a)=>{p(a.contentHolder);const o={holder:a.contentHolder.append("div").style("margin","20px").node(),gene:n[0],tracks:[{type:"mds3",name:n[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,o));delete a.callback}},{label:s[0],callback:async(e,a)=>{p(a.contentHolder);const o={holder:a.contentHolder.append("div").style("margin","20px").node(),gene:s[0],tracks:[{type:"mds3",name:s[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,o));delete a.callback}}];new i({holder:e,tabs:a}).main()}export{l as init_geneFusionUI};
@@ -1 +0,0 @@
1
- import{aP as t,b4 as n,E as o}from"./app-f70d9a0b.js";import{appInit as e}from"./plot.app-72083fe7.js";import"path";import"./recover-791d56f8.js";import"./filter-5a5a1166.js";import"./table-2310e41b.js";import"./samplelst-6512a752.js";import"./termsetting-8476b5ab.js";function s(o,s,r){return t(this,void 0,void 0,(function*(){const[t,c]=yield i(o);if(c===null||c===void 0?void 0:c.length){return n(c,r)}const u={holder:r,vocabApi:{vocab:{terms:[]},main:()=>{},getTermdbConfig:()=>({})},state:{args:{data:t,genome:s},plots:[{chartType:"Disco",subfolder:"disco",extension:"ts"}]}};const l=yield e(u);return l}))}function i(n){return t(this,void 0,void 0,(function*(){if(Array.isArray(n.mlst)){return[n.mlst,null]}const t=[];const o=[];if(n.snvText)r(n.snvText,t,o);if(n.svText)c(n.svText,t,o);if(n.cnvText)u(n.cnvText,t,o);return[t,o]}))}function r(t,n,o){for(const e of t.trim().split("\n")){const t=e.trim().split("\t");if(t.length!=5){o.push("snv input not equal to 5 columns");continue}let s;try{s={dt:1,chr:t[0],position:Number(t[1]),gene:t[2],mname:t[3],class:l(t[4],o)}}catch(t){o.push(t);continue}n.push(s)}}function c(t,n,o){for(const e of t.trim().split("\n")){const t=e.trim().split("\t");if(t.length<4||t.length>6){o.push("sv input not equal to 4 or 6 columns");continue}let s;try{const n=t.length;if(n==4){s={dt:2,chrA:t[0],posA:Number(t[1]),chrB:t[2],posB:Number(t[3])}}else{s={dt:2,chrA:t[0],posA:Number(t[1]),geneA:t[2],chrB:t[3],posB:Number(t[4]),geneB:t[5]}}}catch(t){o.push(t);continue}n.push(s)}}function u(t,n,o){for(const e of t.trim().split("\n")){const t=e.trim().split("\t");if(t.length!=4){o.push("cnv input not equal to 4 columns");continue}let s;try{s={dt:4,chr:t[0],start:Number(t[1]),stop:Number(t[2]),value:Number(t[3])}}catch(t){o.push(t);continue}n.push(s)}}function l(t,n){const e=t.toLowerCase();const s=Object.values(o).find((t=>t.key.toLowerCase()===e||t.label.toLowerCase()===e));if(s){return s.key}else{n.push(`Invalid mutation class: ${t}`)}}export{s as launch};
@@ -1 +0,0 @@
1
- import{aA as t,M as s,ac as r}from"./app-f70d9a0b.js";import{s as e,r as o}from"./recover-791d56f8.js";import{v as i}from"./filter-5a5a1166.js";import"path";import"./samplelst-6512a752.js";import"./termsetting-8476b5ab.js";import"./table-2310e41b.js";function a(t){switch(t){case"../plots/DEanalysis.js":return import("./DEanalysis-ae8b793e.js");case"../plots/Disco.js":return import("./Disco-4ead6c6f.js");case"../plots/barchart.data.js":return import("./filter-5a5a1166.js").then((function(t){return t.p}));case"../plots/barchart.events.js":return import("./barchart.events-3fd64094.js");case"../plots/barchart.js":return import("./barchart-a4a6b4b4.js");case"../plots/bars.renderer.js":return import("./bars.renderer-7c9358aa.js");case"../plots/bars.settings.js":return import("./bars.settings-f7884503.js");case"../plots/boxplot.js":return import("./boxplot-28751534.js");case"../plots/controls.btns.js":return import("./controls.btns-86a413d5.js");case"../plots/controls.config.js":return import("./controls.config-ae99bcd1.js");case"../plots/controls.divide.js":return import("./controls.divide-8f26abff.js");case"../plots/controls.js":return import("./controls-cd2ff09c.js");case"../plots/controls.overlay.js":return import("./controls.overlay-a72d72e4.js");case"../plots/controls.term1.js":return import("./controls.term1-3c9e55b8.js");case"../plots/cuminc.js":return import("./cuminc-e7326248.js");case"../plots/dataDownload.js":return import("./dataDownload-f3cdbc7c.js");case"../plots/dictionary.js":return import("./dictionary-578c63d9.js");case"../plots/geneExpression.js":return import("./geneExpression-0d0e9692.js");case"../plots/geneset.js":return import("./geneset-b37a8d83.js");case"../plots/genomeBrowser.controls.js":return import("./genomeBrowser.controls-2d794ff1.js");case"../plots/genomeBrowser.js":return import("./genomeBrowser-10004899.js");case"../plots/hierCluster.config.js":return import("./hierCluster.config-9b8fa78e.js");case"../plots/hierCluster.interactivity.js":return import("./hierCluster.interactivity-e379aa01.js").then((function(t){return t.i}));case"../plots/hierCluster.js":return import("./hierCluster-6e93c3b2.js");case"../plots/hierCluster.renderers.js":return import("./hierCluster.renderers-7b35f0cc.js").then((function(t){return t.r}));case"../plots/matrix.cells.js":return import("./matrix.cells-5db8ba9e.js");case"../plots/matrix.cluster.js":return import("./matrix.cluster-88a2266e.js");case"../plots/matrix.config.js":return import("./matrix.config-85132ec9.js");case"../plots/matrix.controls.js":return import("./matrix.controls-4933c41c.js");case"../plots/matrix.data.js":return import("./matrix.data-b798eb7d.js").then((function(t){return t.m}));case"../plots/matrix.dom.js":return import("./matrix.dom-6971ecb1.js");case"../plots/matrix.groups.js":return import("./matrix.groups-8b841f67.js").then((function(t){return t.m}));case"../plots/matrix.interactivity.js":return import("./matrix.interactivity-380a57f9.js");case"../plots/matrix.js":return import("./matrix-d644b099.js");case"../plots/matrix.layout.js":return import("./matrix.layout-3165a88a.js").then((function(t){return t.m}));case"../plots/matrix.legend.js":return import("./matrix.legend-f0ab9a34.js").then((function(t){return t.m}));case"../plots/matrix.renderers.js":return import("./matrix.renderers-48826412.js");case"../plots/matrix.serieses.js":return import("./matrix.serieses-610f9bc4.js").then((function(t){return t.m}));case"../plots/matrix.sort.js":return import("./matrix.sort-c3c86759.js");case"../plots/plot.app.js":return Promise.resolve().then((function(){return c}));case"../plots/plot.disco.js":return import("./plot.disco-7efd2855.js");case"../plots/plot.ssgq.js":return import("./plot.ssgq-e41ca8ac.js");case"../plots/polar.js":return import("./polar-86a9ecb8.js");case"../plots/profileBarchart.js":return import("./profileBarchart-a41a1fd8.js");case"../plots/profilePlot.js":return import("./profilePlot-69af5e30.js");case"../plots/profilePolar.js":return import("./profilePolar-7446e230.js");case"../plots/profileRadar.js":return import("./profileRadar-d23d8ebe.js");case"../plots/profileRadarFacility.js":return import("./profileRadarFacility-9f9a324e.js");case"../plots/regression.inputs.js":return import("./regression.inputs-ba7b7342.js").then((function(t){return t.b}));case"../plots/regression.inputs.term.js":return import("./regression.inputs-ba7b7342.js").then((function(t){return t.a}));case"../plots/regression.inputs.values.table.js":return import("./regression.inputs.values.table-3f6f7f0f.js");case"../plots/regression.js":return import("./regression.inputs-ba7b7342.js").then((function(t){return t.r}));case"../plots/regression.results.js":return import("./regression.results-9bd02fe0.js").then((function(t){return t.r}));case"../plots/sampleScatter.interactivity.js":return import("./sampleScatter.interactivity-22035655.js").then((function(t){return t.d}));case"../plots/sampleScatter.js":return import("./sampleScatter-ef4e3347.js").then((function(t){return t.a}));case"../plots/sampleScatter.renderer.js":return import("./sampleScatter-ef4e3347.js").then((function(t){return t.s}));case"../plots/sampleScatter.rendererThree.js":return import("./sampleScatter.rendererThree-b0ddac07.js").then((function(t){return t.c}));case"../plots/sampleView.js":return import("./sampleView-836462bb.js");case"../plots/scatter.js":return import("./scatter-a24646d2.js");case"../plots/singleCellPlot.js":return import("./singleCellPlot-7caa7fdd.js");case"../plots/stattable.js":return import("./stattable-f81097a3.js");case"../plots/summary.js":return import("./summary-af438607.js");case"../plots/survival.js":return import("./survival-d8c8c5b5.js");case"../plots/table.js":return import("./table-141e31d7.js");case"../plots/variantBrowser.js":return import("./variantBrowser-882cd310.js");case"../plots/violin.interactivity.js":return import("./violin.interactivity-5a9e20f2.js");case"../plots/violin.js":return import("./violin-f96e92c7.js");case"../plots/violin.renderer.js":return import("./violin.renderer-687d2341.js");default:return new Promise((function(s,r){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+t)))}))}}class n{constructor(t){this.type="app";const s=t.violin?.mode=="minimal"?null:t.holder.append("div").style("white-space","nowrap");this.dom={holder:t.holder,errdiv:t.holder.append("div"),plotDiv:t.holder.append("div")};if(s){this.dom.plotControls=s.append("div").style("display","inline-block");this.dom.recoverControls=s.append("div").style("display","inline-block")}}validateOpts(t={}){if(!t.holder)throw`missing opts.holder in the MassApp constructor argument`;if(!t.callbacks)t.callbacks={};return t}async preApiFreeze(t){try{t.tip=new s({padding:"5px"});t.printError=t=>this.printError(t);const r=this.opts.state.vocab;t.vocabApi=this.opts.vocabApi?this.opts.vocabApi:await i({app:t,state:{vocab:{genome:r?.genome||this.opts.state.genome,dslabel:r?.dslabel||this.opts.state.dslabel,terms:r?.terms}},fetchOpts:this.opts.fetchOpts});this.opts.state.vocab=t.vocabApi.vocab}catch(t){throw t}}async init(){try{this.opts.state.nav={header_mode:"hidden"};this.store=await e({app:this.api,state:this.opts.state});this.state=await this.store.copyState();this.components={plots:{}};if(this.opts.app?.features?.includes("recover"))this.components.recover=await o({app:this.api,holder:this.dom.recoverControls,getState:t=>t,maxHistoryLen:10});await this.api.dispatch()}catch(t){this.printError(t);throw t}}async main(){this.api.vocabApi.main();for(const t in this.components.plots){const s=this.components.plots[t];if(!this.state.plots.find((t=>t.id===s.id))){s.destroy();delete this.components.plots[t]}}for(const[t,s]of this.state.plots.entries()){if(!this.components.plots[s.id]){const t=this.dom.holder.append("div");if(!this.dom.plotDiv)this.dom.plotDiv=t;const r=await a(`../plots/${s.chartType}.js`);const e=await r.componentInit({id:s.id,app:this.api,holder:t,controls:this.dom.plotControls});this.components.plots[s.id]=e}}}printError(t){r(this.dom.errdiv,"Error: "+(t.message||t));if(t.stack)console.log(t.stack);this.bus.emit("error")}destroy(){this.dom.holder.selectAll("*").remove()}}const p=t(n);var c=Object.freeze({__proto__:null,appInit:p});export{p as appInit};
@@ -1 +0,0 @@
1
- import{a as e,b as t,c as s,g as o,d as i,e as a}from"./filter-5a5a1166.js";import{r}from"./table-2310e41b.js";import{az as n,M as l,ae as p,q as c,ac as d,aI as h,S as m,aL as u,T as f,aM as y,E as g,a1 as b}from"./app-f70d9a0b.js";import{getSamplelstTW as v,getFilter as x}from"./samplelst-6512a752.js";import{appInit as w}from"./app-64537b0c.js";import{g as S}from"./termsetting-8476b5ab.js";import{r as j}from"./recover-791d56f8.js";import{t as C}from"./downloadTextfile-5723af95.js";class T{constructor(e){this.type="search";_(this);D(this)}async init(e){this.dom={holder:this.opts.holder,holderNode:this.opts.holder.node(),tip:new l({padding:"5px"})};this.initUI()}reactsTo(e){return e.type.startsWith("search")||e.type.startsWith("cohort")}getState(e){return{cohortStr:e.activeCohort==-1||!e.termdbConfig.selectCohort?"":e.termdbConfig.selectCohort.values[e.activeCohort].keys.slice().sort().join(","),search:e.search}}async main(){this.dom.holder.style("display",this.state.search.isVisible?"inline-block":"none")}async doSearch(e){if(!e){this.clear({hide:true});this.bus.emit("postSearch",[]);return}const t=await this.app.vocabApi.findTerm(e,this.state.cohortStr,this.opts.usecase);if(!t.lst||t.lst.length==0){this.noResult()}else{this.showTerms(t)}this.bus.emit("postSearch",t)}}const k=n(T);function _(e){e.initUI=()=>{e.dom.holder.style("display",e.search&&e.search.isVisible==false?"none":"inline-block");e.dom.input=e.dom.holder.style("text-align","center").append("input").attr("type","search").attr("class","tree_search").attr("placeholder","Search").style("width","180px").style("display","block").on("input",p.debounce(e.onInput,300));e.dom.resultDiv=e.dom.tip.d.style("border-left",e.opts.resultsHolder?"":"solid 1px rgb(133,182,225)").style("padding-left","5px")};e.noResult=()=>{e.clear();e.dom.resultDiv.append("div").text("No match").style("padding","3px 3px 3px 0px").style("opacity",.5)};e.showTerms=t=>{if(e.opts.disable_terms)t.lst.forEach((t=>{if(t.disabled)e.opts.disable_terms.push(t.id)}));e.clear({hide:!t.lst.length});if(t.lst.length){e.dom.resultDiv.append("table").selectAll().data(t.lst).enter().append("tr").each(e.showTerm)}};e.showTerm=function(t){const s=c(this);const o=s.append("td").text(t.name);if(t.type){o.style("cursor","pointer").attr("class","sja_menuoption").on("click",(()=>{e.app.dispatch({type:"plot_create",config:{chartType:t.type=="survival"?"survival":"summary",term:{id:t.id,term:t}}});e.clear({hide:true})}))}else{o.style("padding","5px 10px").style("opacity",.5)}s.append("td").text((t.__ancestorNames||[]).join(" > ")).style("opacity",.5).style("font-size",".7em")};e.clear=(t={})=>{e.dom.tip.clear();if(t.hide)e.dom.tip.hide();else e.dom.tip.showunder(e.dom.holderNode)}}function D(e){e.onInput=async()=>{const t=e.dom.input.property("value");try{await e.doSearch(t)}catch(t){e.clear();d(e.dom.resultDiv,"Error: "+(t.message||t));if(t.stack)console.log(t.stack)}}}function A(e){switch(e){case"../plots/DEanalysis.js":return import("./DEanalysis-ae8b793e.js");case"../plots/Disco.js":return import("./Disco-4ead6c6f.js");case"../plots/barchart.data.js":return import("./filter-5a5a1166.js").then((function(e){return e.p}));case"../plots/barchart.events.js":return import("./barchart.events-3fd64094.js");case"../plots/barchart.js":return import("./barchart-a4a6b4b4.js");case"../plots/bars.renderer.js":return import("./bars.renderer-7c9358aa.js");case"../plots/bars.settings.js":return import("./bars.settings-f7884503.js");case"../plots/boxplot.js":return import("./boxplot-28751534.js");case"../plots/controls.btns.js":return import("./controls.btns-86a413d5.js");case"../plots/controls.config.js":return import("./controls.config-ae99bcd1.js");case"../plots/controls.divide.js":return import("./controls.divide-8f26abff.js");case"../plots/controls.js":return import("./controls-cd2ff09c.js");case"../plots/controls.overlay.js":return import("./controls.overlay-a72d72e4.js");case"../plots/controls.term1.js":return import("./controls.term1-3c9e55b8.js");case"../plots/cuminc.js":return import("./cuminc-e7326248.js");case"../plots/dataDownload.js":return import("./dataDownload-f3cdbc7c.js");case"../plots/dictionary.js":return import("./dictionary-578c63d9.js");case"../plots/geneExpression.js":return import("./geneExpression-0d0e9692.js");case"../plots/geneset.js":return import("./geneset-b37a8d83.js");case"../plots/genomeBrowser.controls.js":return import("./genomeBrowser.controls-2d794ff1.js");case"../plots/genomeBrowser.js":return import("./genomeBrowser-10004899.js");case"../plots/hierCluster.config.js":return import("./hierCluster.config-9b8fa78e.js");case"../plots/hierCluster.interactivity.js":return import("./hierCluster.interactivity-e379aa01.js").then((function(e){return e.i}));case"../plots/hierCluster.js":return import("./hierCluster-6e93c3b2.js");case"../plots/hierCluster.renderers.js":return import("./hierCluster.renderers-7b35f0cc.js").then((function(e){return e.r}));case"../plots/matrix.cells.js":return import("./matrix.cells-5db8ba9e.js");case"../plots/matrix.cluster.js":return import("./matrix.cluster-88a2266e.js");case"../plots/matrix.config.js":return import("./matrix.config-85132ec9.js");case"../plots/matrix.controls.js":return import("./matrix.controls-4933c41c.js");case"../plots/matrix.data.js":return import("./matrix.data-b798eb7d.js").then((function(e){return e.m}));case"../plots/matrix.dom.js":return import("./matrix.dom-6971ecb1.js");case"../plots/matrix.groups.js":return import("./matrix.groups-8b841f67.js").then((function(e){return e.m}));case"../plots/matrix.interactivity.js":return import("./matrix.interactivity-380a57f9.js");case"../plots/matrix.js":return import("./matrix-d644b099.js");case"../plots/matrix.layout.js":return import("./matrix.layout-3165a88a.js").then((function(e){return e.m}));case"../plots/matrix.legend.js":return import("./matrix.legend-f0ab9a34.js").then((function(e){return e.m}));case"../plots/matrix.renderers.js":return import("./matrix.renderers-48826412.js");case"../plots/matrix.serieses.js":return import("./matrix.serieses-610f9bc4.js").then((function(e){return e.m}));case"../plots/matrix.sort.js":return import("./matrix.sort-c3c86759.js");case"../plots/plot.app.js":return import("./plot.app-72083fe7.js");case"../plots/plot.disco.js":return import("./plot.disco-7efd2855.js");case"../plots/plot.ssgq.js":return import("./plot.ssgq-e41ca8ac.js");case"../plots/polar.js":return import("./polar-86a9ecb8.js");case"../plots/profileBarchart.js":return import("./profileBarchart-a41a1fd8.js");case"../plots/profilePlot.js":return import("./profilePlot-69af5e30.js");case"../plots/profilePolar.js":return import("./profilePolar-7446e230.js");case"../plots/profileRadar.js":return import("./profileRadar-d23d8ebe.js");case"../plots/profileRadarFacility.js":return import("./profileRadarFacility-9f9a324e.js");case"../plots/regression.inputs.js":return import("./regression.inputs-ba7b7342.js").then((function(e){return e.b}));case"../plots/regression.inputs.term.js":return import("./regression.inputs-ba7b7342.js").then((function(e){return e.a}));case"../plots/regression.inputs.values.table.js":return import("./regression.inputs.values.table-3f6f7f0f.js");case"../plots/regression.js":return import("./regression.inputs-ba7b7342.js").then((function(e){return e.r}));case"../plots/regression.results.js":return import("./regression.results-9bd02fe0.js").then((function(e){return e.r}));case"../plots/sampleScatter.interactivity.js":return Promise.resolve().then((function(){return ye}));case"../plots/sampleScatter.js":return import("./sampleScatter-ef4e3347.js").then((function(e){return e.a}));case"../plots/sampleScatter.renderer.js":return import("./sampleScatter-ef4e3347.js").then((function(e){return e.s}));case"../plots/sampleScatter.rendererThree.js":return import("./sampleScatter.rendererThree-b0ddac07.js").then((function(e){return e.c}));case"../plots/sampleView.js":return import("./sampleView-836462bb.js");case"../plots/scatter.js":return import("./scatter-a24646d2.js");case"../plots/singleCellPlot.js":return import("./singleCellPlot-7caa7fdd.js");case"../plots/stattable.js":return import("./stattable-f81097a3.js");case"../plots/summary.js":return import("./summary-af438607.js");case"../plots/survival.js":return import("./survival-d8c8c5b5.js");case"../plots/table.js":return import("./table-141e31d7.js");case"../plots/variantBrowser.js":return import("./variantBrowser-882cd310.js");case"../plots/violin.interactivity.js":return import("./violin.interactivity-5a9e20f2.js");case"../plots/violin.js":return import("./violin-f96e92c7.js");case"../plots/violin.renderer.js":return import("./violin.renderer-687d2341.js");default:return new Promise((function(t,s){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}class N{constructor(e={}){this.type="charts";L(this)}async init(){this.dom={holder:this.opts.holder,tip:new l({padding:"0px"})};this.makeButtons()}getState(t){const s=O(t);const o=JSON.parse(JSON.stringify(t.termdbConfig?.supportedChartTypes||{}));const i={vocab:t.vocab,activeCohort:t.activeCohort,termfilter:t.termfilter,supportedChartTypes:o[s]||["summary"],termdbConfig:t.termdbConfig};if(t?.termfilter?.filter){i.filter=e(t.termfilter.filter)}if(!i.supportedChartTypes.includes("dictionary")){i.supportedChartTypes.push("dictionary")}return i}main(){this.dom.btns.style("display",(e=>this.state.supportedChartTypes.includes(e.chartType)?"":"none"))}}const I=n(N);function O(e){if(e?.termdbConfig?.selectCohort?.values){if(!Number.isInteger(e.activeCohort))throw"appState.activeCohort is not integer array index";const t=e.termdbConfig.selectCohort.values[e.activeCohort];if(!t)throw"appState.activeCohort array index out of bound";return[...t.keys].sort().join(",")}return""}function M(e){return[{label:"Data Dictionary",clickTo:e.prepPlot,chartType:"dictionary",config:{chartType:"dictionary"}},{label:"Sample View",clickTo:e.prepPlot,chartType:"sampleView",config:{chartType:"sampleView"}},{label:"Summary Plots",chartType:"summary",clickTo:e.showTree_select1term,usecase:{detail:"term"}},{label:"Scatter Plot",chartType:"sampleScatter",clickTo:e.loadChartSpecificMenu},{label:"Cumulative Incidence",chartType:"cuminc",clickTo:e.showTree_select1term,usecase:{target:"cuminc",detail:"term"}},{label:"Survival",chartType:"survival",clickTo:e.showTree_select1term,usecase:{target:"survival",detail:"term"}},{label:"Regression Analysis",chartType:"regression",clickTo:e.loadChartSpecificMenu},{label:"Sample Matrix",chartType:"matrix",clickTo:e.loadChartSpecificMenu},{label:"Genome Browser",chartType:"genomeBrowser",clickTo:e.loadChartSpecificMenu},{label:"Hierarchical Clustering",chartType:"hierCluster",clickTo:e.loadChartSpecificMenu},{label:"Differential Expression",chartType:"DEanalysis",clickTo:e.loadChartSpecificMenu},{label:"Profile Bar Plot",chartType:"profileBarchart",clickTo:e.showTree_select1term,usecase:{detail:"term"}},{label:"Data Download",clickTo:e.prepPlot,chartType:"dataDownload",config:{chartType:"dataDownload",terms:[]}},{label:"Single Cell Plot",clickTo:e.loadChartSpecificMenu,chartType:"singleCellPlot",config:{chartType:"singleCellPlot"}}]}function L(e){e.makeButtons=function(){const t=M(e);e.dom.btns=e.dom.holder.selectAll("button").data(t).enter().append("button").style("margin","10px").style("padding","10px 15px").style("border-radius","20px").style("border-color","#ededed").html((e=>e.label)).on("click",(function(t,s){e.dom.tip.clear().showunder(this);s.clickTo(s)}))};e.showTree_select1term=async t=>{if(t.usecase.label){e.dom.tip.d.append("div").style("margin","3px 5px").style("padding","3px 5px").style("font-weight",600).html(t.usecase.label)}const s={type:"plot_create",id:R(),config:{chartType:t.chartType}};if(t.parentId)s.parentId=t.parentId;const o=await import("./app-64537b0c.js");o.appInit({vocabApi:e.app.vocabApi,holder:e.dom.tip.d.append("div"),state:{activeCohort:e.state.activeCohort,nav:{header_mode:"search_only"},tree:{usecase:t.usecase}},tree:{click_term:o=>{const i=o.term?o:{id:o.id,term:o};s.config[t.usecase.detail]=i;e.dom.tip.hide();e.app.dispatch(s)}}})};e.showTree_selectlst=async t=>{e.dom.tip.clear();if(t.usecase.label){e.dom.tip.d.append("div").style("margin","3px 5px").style("padding","3px 5px").style("font-weight",600).html(t.usecase.label)}const s={type:"plot_create",id:R(),config:{chartType:t.chartType}};const o=await import("./app-64537b0c.js");e.dom.submenu=e.dom.tip.d.append("div");o.appInit({holder:e.dom.submenu,state:{vocab:e.state.vocab,activeCohort:e.state.activeCohort,nav:{header_mode:"search_only"},tree:{usecase:t.usecase}},tree:{submit_lst:o=>{const i=t.processSelection?t.processSelection(o):o;s.config[t.usecase.detail]=i;e.dom.tip.hide();e.app.dispatch(s)}}})};e.loadChartSpecificMenu=async t=>{e.dom.tip.clear();const s=await A(`../plots/${t.chartType}.js`);s.makeChartBtnMenu(e.dom.tip.d,e)};e.prepPlot=function(t){const s={type:"plot_prep",config:t.config,id:R()};e.app.dispatch(s)}}const $="_CHART_AUTOID_";let B=Date.now();function R(){return $+B++}const W=h(5);class G{constructor(e={}){this.type="groups";this.selectedGroupsIdx=new Set}async init(){this.dom={holder:this.opts.holder.append("div").style("margin","10px")};q(this);this.tip=new l({padding:"0px"})}getState(e){const t=O(e);const s={termfilter:e.termfilter,groups:V(e),termdbConfig:e.termdbConfig,customTerms:e.customTerms,supportedChartTypes:e.termdbConfig.supportedChartTypes[t],matrixplots:e.termdbConfig.matrixplots};return s}async main(){await P(this)}getMassFilter(){if(!this.state.termfilter.filter||this.state.termfilter.filter.lst.length==0){return{type:"tvslst",in:true,join:"",lst:[]}}const t=e(structuredClone(this.state.termfilter.filter));return t}async groups2samplelst(e){const t=[];const s=new Set,o=[];for(const i of e){const e=await this.app.vocabApi.getFilteredSampleCount(i.filter,"list");const a=[];for(const i of e){const e={sampleId:i.id};if("name"in i){e.sample=i.name}if(!s.has(i.id))a.push(e);else{for(const e of t){const t=e.items.findIndex((e=>e.sampleId===i.id));if(t!==-1)o.push(...e.items.splice(t,1))}}s.add(e.sampleId)}if(a.length)t.push({name:i.name,items:a,color:i.color})}if(o.length){const e=confirm('Overlap detected: 1 or more samples belong to >1 groups. A new group will be created for these "overlap" samples.');if(!e)return;t.push({name:"Group overlap",items:o})}const i=t.length==1?t[0].name:"Sample groups";const a=v(t,i);for(const e of a.q.groups){a.term.values[e.name].list=e.values;a.term.values[e.name].inuse=e.inuse}return a}updateLaunchButton(){this.dom.newTermSpan.style("display","none");this.dom.noGroupSelected.style("display","none");if(this.state.groups.length==0)return;if(this.state.groups.length==1){this.dom.newTermSpan.style("display","");this.dom.launchButton.text(`Create variable using "${this.state.groups[0].name}"`);this.dom.newTermNameInput.property("value",this.state.groups[0].name+" vs others");return}const e=[...this.selectedGroupsIdx];if(e.length==0){this.dom.noGroupSelected.style("display","");return}this.dom.newTermSpan.style("display","");if(e.length==1){this.dom.launchButton.text(`Create variable using "${this.state.groups[e[0]]?.name}"`);this.dom.newTermNameInput.property("value",this.state.groups[e[0]].name+" vs others");return}this.dom.launchButton.text(`Create variable using ${e.length} groups`);this.dom.newTermNameInput.property("value",e.map((e=>this.state.groups[e].name)).join(" vs "))}displayCustomTerms(){this.dom.customTermDiv.selectAll("*").remove();if(this.state.customTerms.length==0){this.dom.customTermDiv.append("div").text("No custom variables. Use above controls to create new ones. Custom variables are added to dictionary.").style("font-size",".8em");return}this.dom.customTermDiv.append("div").style("margin-bottom","10px").style("font-size",".8em").text("Following custom variables are available in all charts where variables are used. Click one to delete.");for(const{name:e,tw:t}of this.state.customTerms){const s=this.dom.customTermDiv.append("div");s.text(e).attr("class","sja_filter_tag_btn").style("padding","3px 6px").style("border-radius","6px").style("margin-right","5px").on("click",(s=>{const o=()=>this.app.vocabApi.deleteCustomTerm(e);this.showGroupsMenu(s,t,o)}))}}newId(){this.lastId=S();return this.lastId}showGroupsMenu(e,t,s){const o=JSON.parse(JSON.stringify(t));this.tip.clear();const i=this.tip.d.append("div");const a=this?.lastId;i.append("div");Q(this.tip,i,o,this.app,a,this.state,(()=>this.newId));if(this.state.supportedChartTypes.includes("DEanalysis")&&o.q.groups.length==2)U(i,this,this.state,o);if(this.state.supportedChartTypes.includes("survival"))Y("survival",i,"Compare survival",this.tip,o,a,this,true);if(this.state.supportedChartTypes.includes("cuminc"))Y("cuminc",i,"Compare cumulative incidence",this.tip,o,a,this,true);const r=i.append("div").attr("class","sja_menuoption sja_sharp_border").html("Summarize");r.insert("div").html("›").style("float","right");r.on("click",(async e=>{X(r,(e=>{J(e,o,this.app,a,(()=>this.newId))}),this.app,this.tip)}));i.append("div").attr("class","sja_menuoption sja_sharp_border").text("Delete variable").on("click",(e=>{s();this.tip.hide()}));this.tip.showunder(e.target)}}const E=n(G);function U(e,t,s,o,i){e.append("div").attr("class","sja_menuoption sja_sharp_border").text("Differential expression").on("click",(e=>{const i=[];for(const e of o.q.groups){if(e.values&&e.values.length>0){i.push(e)}else{throw"group does not contain samples for DE analysis"}}const a={chartType:"DEanalysis",state:s,samplelst:{groups:i}};t.tip.hide();t.app.dispatch({type:"plot_create",config:a})}))}function q(e){e.dom.filterTableDiv=e.dom.holder.append("div").style("margin-bottom","10px");const t=e.dom.holder.append("div");e.dom.addNewGroupBtnHolder=t.append("span").style("margin-right","20px");e.dom.newTermSpan=t.append("span");e.dom.newTermSpan.append("span").style("padding-left","15px").text("Add variable:");e.dom.newTermNameInput=e.dom.newTermSpan.append("input").attr("type","text");e.dom.launchButton=e.dom.newTermSpan.append("span").attr("class","sja_menuoption").on("click",(()=>H(e)));e.dom.noGroupSelected=t.append("span").text("No groups selected").style("opacity",.5);e.dom.customTermDiv=e.dom.holder.append("div").style("margin","20px").style("border-left","solid 1px black").style("padding","10px");e.dom.holder.on("click",(e=>z.hide()))}async function P(e){e.dom.addNewGroupBtnHolder.selectAll("*").remove();t({holder:e.dom.addNewGroupBtnHolder,vocab:e.app.opts.state.vocab,emptyLabel:"Add group",termdbConfig:e.state.termdbConfig,callback:t=>{K(e.app,t,o)}}).main(e.getMassFilter());const o=structuredClone(e.state.groups);if(!o.length){e.updateLaunchButton();e.dom.filterTableDiv.style("display","none");e.displayCustomTerms();return}e.dom.filterTableDiv.style("display","").selectAll("*").remove();const i={div:e.dom.filterTableDiv,columns:[{label:"NAME",editCallback:async(t,s)=>{const o=s.value;const i=e.state.groups.findIndex((e=>e.name==o));if(i!=-1){alert(`Group named ${o} already exists`);P(e)}else await e.app.dispatch({type:"rename_group",index:t,newName:s.value})}},{label:"COLOR",editCallback:async(t,s)=>{await e.app.dispatch({type:"change_color_group",index:t,newColor:s.color})}},{label:"#SAMPLE"},{label:"FILTER"}],columnButtons:[{text:"Delete",callback:(t,s)=>{const i=o[s];e.app.vocabApi.deleteGroup(i.name)}}],rows:[]};for(const t of o){i.rows.push([{value:t.name},{color:t.color},{value:"n="+await e.app.vocabApi.getFilteredSampleCount(t.filter)},{}])}e.selectedGroupsIdx.clear();if(o.length==1){e.selectedGroupsIdx.add(0)}else{i.noButtonCallback=(t,s)=>{if(s.checked)e.selectedGroupsIdx.add(t);else e.selectedGroupsIdx.delete(t);e.updateLaunchButton()};i.selectedRows=[];for(let t=0;t<o.length;t++){i.selectedRows.push(t);e.selectedGroupsIdx.add(t)}}r(i);for(const[t,a]of i.rows.entries()){const i=o[t];s({holder:a[3].__td,vocab:e.app.opts.state.vocab,termdbConfig:e.state.termdbConfig,callback:t=>{if(!t||t.lst.length==0){const e=o.findIndex((e=>e.name==i.name));o.splice(e,1)}else{i.filter=t}e.app.dispatch({type:"app_refresh",state:{groups:o}})}}).main(i.filter)}e.updateLaunchButton();e.displayCustomTerms()}async function H(e){const t=[];for(const s of e.selectedGroupsIdx){const o=e.state.groups[s];if(o)t.push(o)}if(t.length==0)throw"No groups, should not happen";const s=e.dom.newTermNameInput.property("value");const o=await e.groups2samplelst(t);if(!o)return;o.term.name=s;e.app.vocabApi.addCustomTerm({name:s,tw:o});e.dom.newTermSpan.style("display","none")}function V(t){if(!t.termfilter?.filter||t.termfilter.filter.lst.length==0){return t.groups}const s=[];for(const i of t.groups){const a=e(structuredClone(t.termfilter.filter));const r=o(i.filter,"filterUiRoot");if(!r){s.push(i);continue}a.lst.push(r);a.join=a.lst.length>1?"and":"";const n={name:i.name,filter:a,color:i.color};s.push(n)}return s}async function F(e,t,s,o,i,a){let r={chartType:e,term:t,term2:s};if(i)r.insertBefore=i;if(a)r.id=a();await o.dispatch({type:"plot_create",config:r})}async function J(e,t,s,o,i){const a=e.term?e:{id:e.id,term:e};let r={chartType:"summary",childType:"barchart",term:a,term2:t};if(o)r.insertBefore=o;if(i)r.id=i();await s.dispatch({type:"plot_create",config:r})}const z=new l({padding:0,offsetX:162,offsetY:-34});async function X(e,t,s,o,i={tree:{usecase:{detail:"term"}}},a=true,r=true,n=[]){z.clear();if(r)z.showunderoffset(e.node());else z.showunder(e.node());w({holder:z.d,vocabApi:s.vocabApi,state:i,tree:{disable_terms:n,click_term:e=>{t(e);z.hide();if(a)o.hide()}}})}function Y(e,t,s,o,i,a,r,n=false){const l=t.append("div").attr("class","sja_menuoption sja_sharp_border").html(`${s}&nbsp;&nbsp;›`).on("click",(t=>{const s={tree:{usecase:{target:e,detail:"term"}}};if(e=="survival")s.nav={header_mode:"hide_search"};X(l,(t=>{F(e,t,i,r.app,a,n?()=>r.newId:null)}),r.app,o,s)}))}function Q(e,t,s,o,i,a,r){if(a.matrixplots){for(const n of a.matrixplots){t.append("div").attr("class","sja_menuoption sja_sharp_border").text(n.name).on("click",(async()=>{const t=await o.vocabApi.getMatrixByName(n.name);t.divideBy=s;t.insertBefore=i;t.settings.matrix.colw=0;if(r)t.id=r();o.dispatch({type:"plot_create",config:t});e.hide()}))}}}function K(e,t,s){s=JSON.parse(JSON.stringify(s));let o="New group";let i=0;while(1){const e=o+(i==0?"":" "+i);if(!s.find((t=>t.name==e)))break;i++}o=o+(i==0?"":" "+i);const a={name:o,filter:t,color:m(W(s.length)).formatHex()};s.push(a);e.dispatch({type:"app_refresh",state:{groups:s}})}class Z{constructor(){this.type="sessionBtn";this.route="termdb";this.embedderOrigin=window.location.origin;this.hostURL=sessionStorage.getItem("hostURL")||this.embedderOrigin}async init(e){const t=new l({padding:"0px"});this.dom={button:this.opts.button,tip:t};this.dom.button.on("click",(()=>{this.dom.tip.clear();this.showMenu()}));this.dslabel=e.vocab.dslabel;this.savedSessions=JSON.parse(localStorage.getItem("savedMassSessions")||`{}`);this.requiredAuth=e.termdbConfig?.requiredAuth?.find((e=>e.route==this.route&&e.type=="jwt"))}async showMenu(){this.dom.tip.clear().d.style("padding",0);const e=[{label:`Open`,title:"Recover a saved session",callback:this.open},{label:`Save`,title:"Save the current view",callback:this.save},{label:`Share`,title:"Create a URL link to share this view",callback:this.getSessionUrl}];if(!this.serverCachedSessions)await this.setServerCachedSessions();if(Object.keys(this.savedSessions).length||Object.keys(this.serverCachedSessions).length){e.push({label:`Delete`,title:"Delete a saved session",callback:this.delete})}this.dom.tip.clear().d.selectAll(".sja_menuoption sja_sharp_border").data(e).enter().append("div").attr("class","sja_menuoption sja_sharp_border").attr("title",(e=>e.title)).html((e=>e.label)).on("click",((e,t)=>{this.dom.tip.clear().d.style("padding","10px");this.showBackBtn();t.callback.call(this)}));this.dom.tip.showunder(this.dom.button.node())}async open(){const e=`sjpp-session-open-radio-`+Math.random().toString().slice(-6);this.dom.tip.d.append("div").style("display","none").style("padding","3px 9px").html(`\n\t\t\t<b>Open in</b>\n\t\t\t<label>\n\t\t\t\t<input type='radio' name='${e}' value='new' style='margin-right: 0; vertical-align: bottom'/>\n\t\t\t\t<span>a new tab</span>\n\t\t\t</label>\n\t\t\t<label style='margin-left: 5px'>\n\t\t\t\t<input type='radio' name='${e}' value='current' checked=checked style='margin-right: 0; vertical-align: bottom'/>\n\t\t\t\t<span>current tab</span>\n\t\t\t</label>\n\t\t`);const t=await this.listSessions({trClickHandler:async(t,s)=>{const{loc:o,id:i}=s;if(!i)return;if(o.includes("browser")){this.sessionName=i;const t=this.savedSessions[i];const s=this.dom.tip.d.node().querySelector(`[name="${e}"]:checked`).value;if(s=="current"){this.app.dispatch({type:"app_refresh",state:t})}else if(window.location.origin==this.hostURL){window.open(`/?mass-session-id=${i}&src=browser`)}else{if(t.embedder)u({state:t});else{const{protocol:e,host:s,search:o,origin:i,href:a}=window.location;const r={protocol:e,host:s,search:o,origin:i,href:a};u({state:Object.assign({embedder:r},t)})}}this.dom.tip.hide()}else if(o=="server"){const t=this.app.vocabApi.mayGetAuthHeaders(this.route);const s={id:i,route:this.route,dslabel:this.dslabel,embedder:window.location.hostname};const o=await f(`/massSession?`,{headers:t,body:s});if(!o.state)throw o.error||"unable to get the cached session from the server";this.savedSessions[i]=o.state;const a=this.dom.tip.d.node().querySelector(`[name="${e}"]:checked`).value;if(a=="current"){this.app.dispatch({type:"app_refresh",state:o.state})}else if(window.location.origin==this.hostURL){window.open(`/?mass-session-id=${i}&src=cred&dslabel=${this.dslabel}&route=${this.route}`)}else{u(o)}this.dom.tip.hide()}}});t.headtr.select("th").html("Open from");const s=t.tbody.insert("tr","tr");s.append("td").style("text-align","center").style("padding","3px 9px").html("Local file");const o=s.append("td").style("text-align","left").append("label");o.append("span").style("padding","3px 9px").style("text-decoration","underline").style("cursor","pointer").html("Choose File");o.append("input").attr("type","file").attr("placeholder","file name").style("opacity",0).style("width","0.1px").style("height","0.1px").style("position","absolute").on("change",(async()=>{const t=event.target.files.item(0);const s=await t.text();let o=t.name;if(this.savedSessions[o]){o=prompt(`Leave as-is to overwrite a session with the same name, or enter a different session name.`,o)}this.sessionName=o;const i=JSON.parse(s);this.savedSessions[o]=i;localStorage.setItem("savedMassSessions",JSON.stringify(this.savedSessions));const a=this.dom.tip.d.node().querySelector(`[name="${e}"]:checked`).value;if(a=="current"){this.app.dispatch({type:"app_refresh",state:i})}else if(window.location.origin==this.hostURL){window.open(`/?mass-session-id=${o}&src=browser`)}else{if(i.embedder)u({state:i});else{const{protocol:e,host:t,search:s,origin:o,href:a}=window.location;const r={protocol:e,host:t,search:s,origin:o,href:a};u({state:Object.assign({embedder:r},i)})}}this.dom.tip.hide()}))}async listSessions(e={}){const t=this.dom.tip.d.append("table").attr("class","sjpp-controls-table");const s=t.append("thead").append("tr");s.selectAll("th").data(["Cache Location","Session ID"]).enter().append("th").style("text-align",((e,t)=>t===0?"center":"left")).style("padding","3px 9px").html((e=>e));const o=Object.keys(this.savedSessions).map((e=>({loc:"browser",id:e})));if(!this.serverCachedSessions)await this.setServerCachedSessions();o.push(...this.serverCachedSessions.map((e=>({loc:"server",id:e}))));const i=t.append("tbody");const a=i.selectAll("tr").data(o).enter().append("tr").on("click",e.trClickHandler||null);a.selectAll("td").data((e=>[e,e])).enter().append("td").style("text-align",((e,t)=>t===0?"center":"left")).style("padding","3px 9px").style("cursor","pointer").html(((e,t)=>t===0?e.loc:e.id));if(!this.serverCachedSessions.length&&this.requiredAuth&&!this.app.vocabApi.hasVerifiedToken()){t.append("tbody").append("tr").selectAll("td").data(["server","requires sign-in"]).enter().append("td").style("text-align",((e,t)=>t===0?"center":"left")).style("padding","3px 9px").html((e=>e))}return{table:t,headtr:s,tbody:i,trs:a}}async setServerCachedSessions(){const e=this.app.getState();this.requiredAuth=e.termdbConfig?.requiredAuth?.find((e=>e.route==this.route&&e.type=="jwt"));if(!this.requiredAuth){this.serverCachedSessions=[];return}const t=this.app.vocabApi.mayGetAuthHeaders(this.route);const s={route:this.route,dslabel:this.dslabel,embedder:window.location.hostname};const o=await f("/sessionIds",{headers:t,body:s});this.serverCachedSessions=o.sessionIds||[]}async save(e){const t=this.dom.tip.d;const s=t.append("div");s.append("span").html("Save as");const o=Object.keys(this.savedSessions);if(!this.serverCachedSessions)await this.setServerCachedSessions();o.push(...this.serverCachedSessions.filter((e=>!o.includes(e))));const i=this.sessionName||"unnamed-session";const a=s.append("input").attr("type","text").attr("placeholder",i).style("width","220px").on("input",(()=>{r.selectAll("*").remove();const e=a.property("value");const t=o.filter((t=>t===e));const s=o.filter((t=>t.startsWith(e)));const i=o.filter((t=>t.includes(e)&&t!==e&&!s.includes(t)));r.selectAll("div").data([...t,...s,...i]).enter().append("div").attr("class","sja_menuoption").html((e=>e)).on("click",((e,t)=>{a.property("value",t);r.selectAll("*").remove()}))}));const r=t.append("div");const n=t.append("div");n.append("span").html("Save to&nbsp;");n.append("button").style("min-width","80px").html("Browser").attr("title",`Save the session in your current browser's cache. The session can be easily recovered, but not shared among your other devices`).on("click",(()=>{this.sessionName=a.property("value")||i;this.savedSessions[this.sessionName]=this.app.getState();localStorage.setItem("savedMassSessions",JSON.stringify(this.savedSessions));this.confirmAction(`Cached '<b>${this.sessionName}</b>' in browser`)}));n.append("button").style("min-width","80px").html("File").attr("title",`Save the session into a local file. The session can be easily recoved using the 'Open from local file' option.`).on("click",(()=>{const e=a.property("value")||i;this.savedSessions[e]=this.app.getState();this.download(e);this.confirmAction(`Downloaded '<b>${e}</b>'`)}));if(this.requiredAuth){const e=this.app.vocabApi.hasVerifiedToken()?"":"Requires sign-in. ";n.append("button").style("min-width","80px").html("Server").attr("title",`${e}Save the session into a remote server. The session can be easily shared across your different devices and recovered using the 'Open from server' option.`).property("disabled",!this.app.vocabApi.hasVerifiedToken()).on("click",(async()=>{if(!this.app.vocabApi.hasVerifiedToken()){alert("Requires sign-in");return}const e=a.property("value")||i;this.savedSessions[e]=this.app.getState();const t=await this.getSessionUrl(e);if(t.id!=e)throw`error saving ${e}`;this.confirmAction(`Saved '<b>${e}</b>' on the server`)}))}}download(e=""){const t=e||this.sessionName;const s=t?.endsWith(".txt")?"":".txt";const o=`${t}${s}`;C(o,JSON.stringify(this.savedSessions[t]))}async getSessionUrl(e=""){const t=this.app.vocabApi.mayGetAuthHeaders("termdb");const s=structuredClone(this.app.getState());const{protocol:o,host:i,search:a,origin:r,href:n}=window.location;s.embedder={protocol:o,host:i,search:a,origin:r,href:n};if(e){s.__sessionFor__={route:this.route,filename:e,dslabel:this.dslabel,embedder:window.location.hostname}}const l=await f("/massSession",{headers:t,method:"POST",body:JSON.stringify(s)});if(e){return l}else{const e=`${this.hostURL}/?mass-session-id=${l.id}&noheader=1`;this.dom.tip.showunder(this.dom.button.node());const t=this.dom.tip.d.append("div").style("margin","10px");t.append("div").style("margin-bottom","12px").html(`Click the link to recover this session. Bookmark or share this link.`);const o=t.append("a").attr("href",e).attr("target","_blank").html(l.id);if(this.hostURL!=window.location.origin){o.on("click",(e=>{e.preventDefault();u({state:s},window.location.origin);return false}))}t.append("div").html(`\n\t\t\t\t\t<br>\n\t\t\t\t\t<div style="max-width: 400px; font-size: 1em; opacity:.6">\n\t\t\t\t\t<span>NOTES</span>\n\t\t\t\t\t<ul>\n\t\t\t\t\t<li>A recovered session may hide data or views to users that are not authorized to access the saved datasets or features.</li>\n\t\t\t\t\t<li>This session will be saved for ${this.opts.massSessionDuration} days.</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t</div>`);setTimeout((()=>{this.dom.button.property("disabled",false)}),1e3)}}async delete(){const e=await this.listSessions({trClickHandler:function(s){const o=this.lastChild.querySelector("input");const i=s.target==o?o.checked:!o.checked;c(this).style("text-decoration",i?"line-through":"");if(s.target!=o)o.checked=i;const a=e.table.node().querySelectorAll("input:checked");t.property("disabled",a.length?false:true)}});e.headtr.append("th").html("Delete");e.trs.each((function(e){c(this).append("td").style("text-align","center").append("input").attr("type","checkbox").attr("value",e.id)}));const t=this.dom.tip.d.append("div").style("text-align","center").append("button").html("Delete selected sessions").property("disabled",true).on("click",(async()=>{const t=e.table.node().querySelectorAll("input");const s=[];for(const e of t){if(c(e).property("checked")){const t=e.parentNode.parentNode.__data__;if(t.loc=="browser"){delete this.savedSessions[e.value]}else if(t.loc=="server"){delete this.serverCachedSessions[e.value];s.push(e.value)}else throw`unknown cache location=${t.loc}`}}localStorage.setItem("savedMassSessions",JSON.stringify(this.savedSessions));try{const e=this.app.vocabApi.mayGetAuthHeaders("termdb");const t={ids:s,route:this.route,dslabel:this.dslabel,embedder:window.location.hostname};const o=f(`/massSession?`,{method:"DELETE",headers:e,body:t})}catch(e){throw e}this.dom.tip.hide()}))}showBackBtn(){this.dom.tip.d.append("div").attr("class","sja_clbtext2").style("margin-bottom","10px").style("cursor","pointer").html(`&lt; Session Menu`).on("click",(()=>this.showMenu()))}confirmAction(e){this.dom.tip.clear().d.append("div").html(e).transition().delay(3e3).duration(1e3).style("opacity",0);setTimeout((()=>{this.dom.tip.hide()}),3500)}}const ee=n(Z);let te=0;const se="_MASS_AUTOID_"+Math.random().toString().slice(-6);let oe=(+new Date).toString().slice(-8);const ie=new l({padding:"0px",offsetX:0,offsetY:0});ie.d.style("z-index",5555);const ae={top:"COHORT",mid:"NONE",btm:"",subheader:"cohort"};const re={top:"CHARTS",mid:"NONE",btm:"",subheader:"charts"};const ne={top:"GROUPS",mid:"NONE",btm:"",subheader:"groups"};const le={top:"FILTER",mid:"NONE",btm:"",subheader:"filter"};function pe(){return se+"_"+oe++}class ce{constructor(e){this.type="nav";this.instanceNum=te++;this.activeTab=0;this.activeCohort=0;this.searching=false;this.samplecounts={};this.massSessionDuration=e.massSessionDuration;this.sessionDaysLeft=e.app.opts.sessionDaysLeft||null;this.sessionId=e.app.opts.sessionId||null;me(this);he(this)}async init(e){try{this.cohortFilter=o(e.termfilter.filter,"cohortFilter");this.initUI(e);this.initCohort(e);this.components=await y({search:k({app:this.app,holder:this.dom.searchDiv,usecase:{target:"barchart",detail:"term"}}),filter:i({app:this.app,vocabApi:this.app.vocabApi,holder:this.dom.subheader.filter.append("div"),hideLabel:this.opts.header_mode==="with_tabs",emptyLabel:"+Add new filter",callback:e=>{this.app.dispatch({type:"filter_replace",filter:e})}}),charts:I({app:this.app,holder:this.dom.subheader.charts,vocab:this.opts.vocab}),groups:E({app:this.app,holder:this.dom.subheader.groups,vocab:this.opts.vocab}),recover:j({app:this.app,holder:this.dom.recoverDiv,getState:e=>e,reactsTo:e=>e.type!="plot_edit",maxHistoryLen:5}),sessionBtn:ee({app:this.app,button:this.dom.saveBtn,massSessionDuration:this.opts.massSessionDuration,sessionDaysLeft:this.app.opts.sessionDaysLeft||null})});this.mayShowMessage_sessionDaysLeft()}catch(e){throw e}}reactsTo(e){if(e.type.includes("cache_termq"))return true;if(e.type.startsWith("filter"))return true;if(e.type.startsWith("cohort"))return true;if(e.type.startsWith("tab"))return true;if(e.type=="plot_create")return true;if(e.type=="plot_delete")return true;if(e.type=="app_refresh")return true;if(e.type.endsWith("_customTerm"))return true;if(e.type.endsWith("_group"))return true}getState(e){return{searching:this.searching,nav:e.nav,activeCohort:e.activeCohort,termdbConfig:e.termdbConfig,filter:e.termfilter.filter,plots:e.plots,groups:e.groups}}async main(){this.dom.tabDiv.style("display",this.state.nav.header_mode==="with_tabs"?"inline-block":"none");this.dom.tip.hide();this.activeTab=this.state.nav.activeTab;this.prevCohort=this.activeCohort;this.activeCohort=+this.state.activeCohort;this.filterUiRoot=o(this.state.filter,"filterUiRoot");this.cohortFilter=o(this.state.filter,"cohortFilter");if(this.cohortNames){this.activeCohortName=this.cohortNames[this.activeCohort];if(this.activeCohort!==-1)this.activeCohortLabel=this.state.termdbConfig.selectCohort.values[this.activeCohort].shortLabel}this.filterJSON=JSON.stringify(this.state.filter);this.cohortsData=await this.app.vocabApi.getCohortsData();if(this.state.nav.header_mode==="with_tabs"){if(!(this.activeCohortName in this.samplecounts)){this.samplecounts[this.activeCohortName]=await this.app.vocabApi.getCohortSampleCount(this.activeCohortName)}if(!(this.filterJSON in this.samplecounts)){if(!this.filterUiRoot||!this.filterUiRoot.lst.length){this.samplecounts[this.filterJSON]=this.samplecounts[this.activeCohortName]}else{const e=await this.app.vocabApi.getFilteredSampleCount(this.filterJSON);this.samplecounts[this.filterJSON]=e}}}this.updateUI()}}const de=n(ce);function he(e){e.initUI=t=>{const s=e.opts.holder.append("div").style("white-space","nowrap");const o=s.append("div").style("display","none").style("vertical-align","bottom");const i=s.append("div").style("vertical-align","top").style("margin","10px").style("display","inline-block");e.opts.holder.attr("class","sjpp-nav");e.dom={holder:e.opts.holder,header:s,tabDiv:o,controlsDiv:i,searchDiv:i.append("div").style("margin","10px"),sessionDiv:i.append("div").style("display","inline-block"),recoverDiv:i.append("div").style("display","inline-block"),helpDiv:i.append("div").style("display","none"),sessionElapsedMessageDiv:i.append("div").style("display","none"),subheaderDiv:e.opts.holder.append("div").style("display","block").style("padding-top","5px").style("border-bottom","1px solid #000"),messageDiv:e.opts.holder.append("div").style("margin","30px").style("display","none"),tip:new l({padding:"5px"})};if(e.opts.header_mode==="with_cohortHtmlSelect"){e.dom.cohortStandaloneDiv=s.append("div").style("display","inline-block").style("margin","10px").style("vertical-align","top");e.dom.cohortStandaloneDiv.append("label").html("Cohort: ");e.dom.cohortSelect=e.dom.cohortStandaloneDiv.append("select").on("change",(function(){e.app.dispatch({type:"cohort_set",activeCohort:+this.value})}));e.dom.cohortSelect.selectAll("option").data(t.termdbConfig.selectCohort.values).enter().append("option").attr("value",((e,t)=>t)).property("selected",((e,s)=>s===t.activeCohort)).html((e=>e.shortLabel))}e.dom.subheader=Object.freeze({search:e.dom.subheaderDiv.append("div").style("display","none"),groups:e.dom.subheaderDiv.append("div").style("display","none"),charts:e.dom.subheaderDiv.append("div").style("display","none"),cohort:e.dom.subheaderDiv.append("div").style("display","none"),filter:e.dom.subheaderDiv.append("div").style("display","none"),cart:e.dom.subheaderDiv.append("div").style("display","none").html("<br/>Cart feature under construction - work in progress<br/>&nbsp;<br/>")});e.tabs=[re,ne,le];if(t.termdbConfig.selectCohort)e.tabs.unshift(ae);const a=e.dom.tabDiv.append("table").style("border-collapse","collapse");a.selectAll("tr").data(["top","mid","btm"]).enter().append("tr").style("font-size",((e,t)=>t==1?"20px":"12px")).selectAll("td").data(((t,s)=>e.tabs.map(((e,o)=>({rowNum:s,key:t,colNum:o,label:e[t],subheader:e.subheader}))))).enter().append("td").style("display","none").style("width","100px").style("padding",(e=>e.rowNum===0?"12px 12px 3px 12px":"3px 12px")).style("text-align","center").style("border-left","1px solid #ccc").style("border-right","1px solid #ccc").style("color","#aaa").style("cursor","pointer").html((e=>e.label)).on("click",e.setTab);e.dom.trs=a.selectAll("tr");e.dom.tds=a.selectAll("td");e.subheaderKeys=e.tabs.map((e=>e.subheader));e.dom.saveBtn=e.dom.sessionDiv.append("button").style("margin","10px").text("Session ▼");if(e.sessionDaysLeft!=null){e.dom.fileBtn=e.dom.sessionDiv.append("button").style("margin","10px").text("Export Session").on("click",(t=>{e.getSessionFile(t)}))}const r=t.termdbConfig.helpPages;if(r){e.dom.helpBtn=e.dom.helpDiv.style("display","inline-block").append("button").style("margin","10px").html("Help &#9660;").on("click",(e=>{const t=e.target.getBoundingClientRect();const s=ie.clear().show(t.left-0,t.top+t.height+5).d.append("div");for(const e of r){s.append("div").style("margin","15px").append("a").attr("href",e.url).attr("target","_blank").text(e.label)}}))}};e.mayShowMessage_sessionDaysLeft=()=>{if(!Number.isFinite(e.sessionDaysLeft)){return}e.dom.sessionElapsedMessageDiv.style("display","block");e.dom.remainingDaysMessage=e.dom.sessionElapsedMessageDiv.append("div").style("display","block").style("opacity","0.65").html(`<u>${e.sessionDaysLeft} days</u> left until this session is removed. Click the "Save Session" button to create a new one.`)};e.updateUI=async(t=false)=>{if(!e.dom.subheaderDiv)return;if(e.activeTab&&e.state.termdbConfig.selectCohort&&e.activeCohort==-1){e.dom.subheaderDiv.style("display","none");e.dom.messageDiv.selectAll("text").remove();e.dom.messageDiv.style("display","").text('No cohort selected. Please select a cohort in the "COHORT" tab.')}else{let s="block";if(t){s=e.dom.subheaderDiv.style("display")=="none"?"block":"none"}if(e.dom.subheaderDiv)e.dom.subheaderDiv.style("display",s);if(e.dom.messageDiv)e.dom.messageDiv.style("display","none")}const s=e.state.termdbConfig.selectCohort;e.dom.searchDiv.style("display",s&&e.activeCohort==-1?"none":"inline-block");e.dom.header.style("border-bottom",e.state.nav.header_mode==="with_tabs"?"1px solid #000":"");e.dom.tds.style("display","").style("color",(t=>t.colNum==e.activeTab?"#000":"#aaa")).style("background-color",(t=>t.colNum==e.activeTab?"#ececec":"transparent")).html((function(t,s){if(t.key=="top")return this.innerHTML;if(t.subheader=="groups"){if(t.key=="mid")return e.state.groups.length||"NONE";return""}if(t.subheader==="charts"){const s=e.state.plots.length;if(t.key=="mid")return!s?"NONE":s;else return""}else if(t.subheader==="cohort"){if(e.activeCohortName&&e.activeCohortName in e.samplecounts){return t.key=="top"?this.innerHTML:t.key=="mid"?e.activeCohortLabel:"n="+e.samplecounts[e.activeCohortName]}else{return t.key=="mid"?"NONE":this.innerHTML}}else if(t.subheader==="filter"){const s=e.filterUiRoot?e.filterUiRoot:{lst:[]};if(s.lst.length===0){return t.key==="mid"?"NONE":e.samplecounts["undefined"]?`n=${e.samplecounts["undefined"]}`:""}else{const o=e.samplecounts[e.filterJSON]!=undefined?"n="+e.samplecounts[e.filterJSON]:"";return t.key==="mid"?s.lst.length:o}}else{return t.key==="mid"?this.innerHTML:"&nbsp;"}}));for(const t in e.dom.subheader){e.dom.subheader[t].style("display",e.tabs[e.activeTab].subheader===t?"block":"none")}e.renderCohortsTable();if(e.opts.header_mode==="with_cohort_select"){e.dom.cohortSelect.selectAll("option").property("value",appState.activeCohort)}};e.renderCohortsTable=()=>{if(!e.dom.cohortTable)return;e.dom.cohortTable.selectAll("*").remove();const t=[{label:"Feature"}];const s=[];const o=e.cohortsData;if("error"in o)throw o.error;for(const e of o.features)s.push([{value:e.name}]);for(const e of o.cohorts){t.push({label:e.cohort?`${e.name} (${e.cohort})`:e.name});for(const[t,i]of o.features.entries()){const a=o.cfeatures.find((t=>t.idfeature===i.idfeature&&t.cohort===e.cohort));if(a)s[t].push({value:a.value})}}r({rows:s,columns:t,div:e.dom.cohortTable,showLines:false,maxHeight:"60vh"});e.dom.cohortTable.select("table").style("border-collapse","collapse");e.dom.cohortTable.selectAll(`tbody > tr > td`).style("background-color","transparent");const i=e.state.termdbConfig.selectCohort;const a=i.values[e.activeCohort].keys;let n=`tbody > tr > td:nth-child(${e.activeCohort+2})`;const l=a.length>1;if(l){n="";for(const e of a){const t=o.cohorts.map((e=>e.cohort)).indexOf(e);if(n!=="")n+=",";n+=`tbody > tr > td:nth-child(${t+2})`}}const p=e.dom.cohortTable.selectAll(n);p.style("background-color","yellow");e.dom.cohortInputs.property("checked",((t,s)=>s===e.activeCohort))};e.initCohort=async t=>{const s=t.termdbConfig.selectCohort;if(!s)return;e.dom.tds.filter((e=>e.colNum===0)).style("display","");e.cohortNames=s.values.map((e=>e.keys.slice().sort().join(",")));if(s.title){e.dom.cohortTitle=e.dom.subheader.cohort.append("h2").style("margin-left","10px").text(s.title)}if(s.description){e.dom.cohortDescription=e.dom.subheader.cohort.append("div").style("margin-left","10px").html(s.description)}if(s.prompt){e.dom.cohortPrompt=e.dom.subheader.cohort.append("div").style("margin-left","10px").style("padding-top","30px").style("padding-bottom","10px").style("font-weight","bold").text(s.prompt)}e.dom.cohortOpts=e.dom.subheader.cohort.append("div").style("margin-bottom","30px").style("margin-left","10px");e.dom.cohortOpts.append("table").selectAll("tr").data(s.values).enter().append("tr").each((function(t,s){const o=c(this);const i=o.append("td");const a="sja-termdb-cohort-"+e.instanceNum;const r=a+"-"+s;i.append("input").attr("type","radio").attr("name",a).attr("id",r).attr("value",s).property("checked",s===e.activeCohort).style("margin-right","5px").style("margin-left","0px").on("click",(()=>{e.app.dispatch({type:"cohort_set",activeCohort:s})}));i.append("label").attr("for",r).attr("colspan",2).style("cursor","pointer").html((e=>e.label));o.selectAll("td").style("max-width","600px").style("padding-bottom","10px").style("padding-right","20px").style("vertical-align","top")}));e.dom.cohortInputs=e.dom.cohortOpts.selectAll("input");e.dom.cohortTable=e.dom.subheader.cohort.append("div");if(s.asterisk){e.dom.cohortAsterisk=e.dom.subheader.cohort.append("div").style("margin-left","10px").style("padding-top","20px").style("padding-bottom","20px").style("font-size","small").text(s.asterisk)}}}function me(e){e.setTab=async(t,s)=>{if(s.colNum===e.activeTab&&!e.searching){e.prevCohort=e.activeCohort;await e.updateUI(true);if(e.bus)e.bus.emit("postRender");return}e.activeTab=s.colNum;e.searching=false;e.app.dispatch({type:"tab_set",activeTab:e.activeTab});if(e.activeTab==1&&e.activeCohort!=-1&&!e.state.plots.length){e.app.dispatch({type:"plot_create",id:pe(),config:{chartType:"dictionary"}})}};e.getSessionFile=async t=>{const s=await f(`/massSession?id=${e.sessionId}`);const o=document.createElement("a");const i="data:application/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(s.state));o.setAttribute("href",i);o.download=`${e.sessionId}.json`;o.click();o.remove()}}function ue(e){e.showTooltip=function(t,s){const o=t.type=="click";e.onClick=o;if(!(t.target.tagName=="path"&&t.target.getAttribute("name")=="serie")){if(e.onClick&&o){e.onClick=false;e.dom.tooltip.hide();return}if(!o)e.dom.tooltip.hide();return}const i=t.target.__data__;const a="sample"in i;let r=10;r=r/e.zoom;const n=s.data.samples.filter((t=>{const o=fe(t.x,t.y,i.x,i.y,s);if(!("sampleId"in t)&&(!e.settings.showRef||e.settings.refSize==0))return false;return e.getOpacity(t)>0&&o<r}));n.sort(((t,s)=>{if(!("sampleId"in t))return 1;if(e.config.term){if(t.x<s.x)return-1;if(t.x>s.x)return 1;if(t.y<s.y)return-1;return 1}if(e.config.colorTW){if(e.config.colorTW.term.type=="categorical"){if(t.category.includes(g.WT.label)||t.category.includes(g.Blank.label))return 1}else{if(t.category<s.category)return-1;else if(t.category>s.category)return 1}}if(t.shape.includes(g.WT.label)||t.shape.includes(g.Blank.label))return 1;return-1}));if(n.length==0)return;const l=[];const p=e.config.term?true:false;const c=e=>`${e.x.toPrecision(2)},${e.y.toPrecision(2)}`;for(const e of n){const t=c(e);let s=l.find((e=>e.id==t));if(!s){s={id:t,parentId:null,samples:[e],level:1,category:null,children:[]};l.push(s);if(p){const o=C("x",e);const i={id:o,parentId:t,samples:[e],level:2,category:"X",children:[],value:o};l.push(i);s.children.push(i);const a=C("y",e);const r={id:`${a}${o}`,parent:i,parentId:o,samples:[e],level:3,category:"Y",children:[],value:a};i.children.push(r);l.push(r);s.xnode=i;s.ynode=r}}else{s.samples.push(e);if(p){s.xnode.samples.push(e);s.ynode.samples.push(e)}}}let d=p?4:2;let h=p?["y","x",""]:[""];if(e.config.colorTW)j("category",e.config.colorTW);if(e.config.shapeTW)j("shape",e.config.shapeTW,e.config.colorTW);if(e.config.scaleDotTW)j("scale",e.config.scaleDotTW,e.config.shapeTW);e.dom.tooltip.clear();const u=e.dom.tooltip.d.style("padding","5px");const f=e.state.termdbConfig.queries?.singleSampleGenomeQuantification;const y=e.state.termdbConfig.queries?.singleSampleMutation;if(n.length>1)u.append("div").style("color","#aaa").style("padding","3px").style("font-weight","bold").html(`${n.length} Samples`);const b=u.append("div").style("max-height","400px").style("overflow","scroll");if(n.length>3)b.attr("class","sjpp_show_scrollbar");const v=b.append("table").style("width","100%");const x=l.filter((e=>p?e.level==1:e.level==2));if(p)for(const e of x){if(n.length>1)v.append("tr").append("td").attr("colspan",3).style("border-top","1px solid #aaa");for(const t of e.children)S(t)}else for(const e of x){if(n.length>1)v.append("tr").append("td").attr("colspan",3).style("border-top","1px solid #aaa");S(e)}e.dom.tooltip.show(t.clientX,t.clientY,true,false);function w(t){const s=t=="category"?e.config.colorTW:t=="shape"?e.config.shapeTW:t=="scale"?e.config.scaleDotTW:t=="X"&&e.config.term?e.config.term:t=="Y"&&e.config.term2?e.config.term2:null;return s}function S(t){const i=w(t.category);t.added=true;let r;const l=t.samples[0];if(l.category!="Ref"){let o=v.append("tr");const r=i!=null&&(i==e.config.colorTW||i==e.config.shapeTW);let p=i?i.term.name:t.category;if(n.length>1&&!a)p=p+` (${t.samples.length})`;o.append("td").style("color","#aaa").text(p);const c=o.append("td");if(r){const o=i==e.config.colorTW?e.getColor(l,s):e.config.colorTW?"gray":e.settings.defaultColor;const a=i==e.config.colorTW?s.shapeLegend.get("Ref").shape%e.symbols.length:s.shapeLegend.get(l.shape).shape%e.symbols.length;const r=e.symbols[a].size(64)();let n="black";const p=m("white").toString();if(i?.term.type=="geneVariant"){for(const e in g){const s=g[e];if(t.value.includes(s.label)){if(m(s.color).toString()!=p)n=s.color;break}}}let d=t.value.toString().length;const h=d*9+60;const u=c.append("svg").attr("width",h).attr("height","25px");const f=u.append("g").attr("transform","translate(10, 14)");f.append("path").attr("d",r).attr("fill",o).attr("stroke","#aaa");const y=f.append("text").attr("x",12).attr("y",6);y.append("tspan").text(t.value).attr("fill",n)}else c.style("padding","2px").text(`${t.value}`)}for(const e of t.children)if(!e.added)S(e);if(t.children.length==0&&a){for(const s of t.samples){if("info"in s)for(const[e,t]of Object.entries(s.info)){r=v.append("tr");r.append("td").style("color","#aaa").text(e);r.append("td").text(t)}r=v.append("tr");r.append("td").style("color","#aaa").text("Sample");r.append("td").style("padding","2px").text(s.sample);if("sampleId"in s&&o){r.append("td").append("button").text("View").on("click",(t=>e.openSampleView(s)));if(y)r.append("td").append("button").text("Disco").on("click",(async t=>e.openDiscoPlot(s)));if(f)r.append("td").append("button").text("Met Array").on("click",(async t=>e.openMetArray(s)))}}}}function j(e,t,s){for(const o of n){const i=C(e,o,t);let a="";for(const e of h)a+=C(e,o,s);const r=i+a;let n=l.find((e=>e.id==r&&e.parentId==a));let p=l.find((e=>e.id==a));if(!n){n={id:r,parentId:a,samples:[],level:d,category:e,children:[],value:i};l.push(n)}n.samples.push(o);if(p)p.children.push(n)}d++;h.unshift(e)}function C(e,t,s){if(e=="")return"";let o=t[e];if(s?.term.type=="geneVariant"){const s=o.split(", ")[0];for(const i in g){const a=g[i];if(s==a.label){const s=t.cat_info[e].find((e=>e.class==a.key)).mname;if(s)o=`${s} ${o}`}}}if(typeof o=="number"&&o%1!=0)o=o.toPrecision(2);return o}};e.openSampleView=function(t){e.dom.tooltip.hide();e.onClick=false;e.app.dispatch({type:"plot_create",id:pe(),config:{chartType:"sampleView",sample:{sampleId:t.sampleId,sampleName:t.sample}}});e.dom.tip.hide()};e.openMetArray=async function(t){e.dom.tooltip.hide();e.onClick=false;t.sample_id=t.sample;for(const s in e.state.termdbConfig.queries.singleSampleGenomeQuantification){const o=b(e.opts.plotDiv);o.header.text(t.sample_id);const i=await import("./plot.ssgq-e41ca8ac.js");await i.plotSingleSampleGenomeQuantification(e.state.termdbConfig,e.state.vocab.dslabel,s,t,o.body.append("div").style("margin","20px"),e.app.opts.genome)}e.dom.tip.hide()};e.openDiscoPlot=async function(t){e.dom.tooltip.hide();e.onClick=false;t.sample_id=t.sample;const s=b(e.opts.plotDiv);s.header.text(t.sample_id);const o=await import("./plot.disco-7efd2855.js");o.default(e.state.termdbConfig,e.state.vocab.dslabel,t,s.body,e.app.opts.genome)};e.onLegendClick=function(t,s,o,i,a,r){const n=e.config[o];const p=n.q.hiddenValues?i in n.q.hiddenValues:false;const c=new l({padding:"0px"});const d=c.d.append("div");d.append("div").attr("class","sja_menuoption sja_sharp_border").text(p?"Show":"Hide").on("click",(()=>{e.hideCategory(s,n,i,!p);c.hide();const t={};t[o]=n;e.app.dispatch({type:"plot_edit",id:e.id,config:t})}));d.append("div").attr("class","sja_menuoption sja_sharp_border").text("Show only").on("click",(()=>{const a=o=="colorTW"?t.colorLegend:t.shapeLegend;for(const t of a.keys())e.hideCategory(s,n,t,n.term.type=="geneVariant"?!t.startsWith(i):t!=i);c.hide();const r={};r[o]=n;e.app.dispatch({type:"plot_edit",id:e.id,config:r})}));d.append("div").attr("class","sja_menuoption sja_sharp_border").text("Show all").on("click",(()=>{c.hide();const i=o=="colorTW"?t.colorLegend:t.shapeLegend;for(const t of i.keys())e.hideCategory(s,n,t,false);const a={};a[o]=n;e.app.dispatch({type:"plot_edit",id:e.id,config:a})}));if(r.color){const t=m(r.color).formatHex();const s=d.append("div").attr("class","sja_sharp_border").style("padding","0px 10px").text("Color:").append("input").attr("type","color").attr("value",t).on("change",(()=>{e.changeColor(i,s.node().value);c.hide()}))}c.showunder(a.target)};e.hideCategory=function(t,s,o,i){if(o=="Ref"){e.settings.showRef=!i;e.app.dispatch({type:"plot_edit",id:e.id,config:{settings:{sampleScatter:e.settings}}})}if(!s.q.hiddenValues)s.q.hiddenValues={};const a=s.term.type!="geneVariant"&&s.term.values[o]?s.term.values[o]:{key:o,label:o};const r=t.selectAll(`text[name="sjpp-scatter-legend-label"]`).nodes();const n=r.find((e=>o.startsWith(e.innerHTML)))?.parentElement;if(n)n.style["text-decoration"]=i?"line-through":"none";if(!i)delete s.q.hiddenValues[o];else s.q.hiddenValues[o]=a};e.changeColor=async function(t,s){const o=e.config.colorTW;if(o.term.type!="geneVariant"&&o.term.values[t])o.term.values[t].color=s;else{if(!o.term.values)o.term.values={};o.term.values[t]={key:t,label:t,color:s}}await e.app.dispatch({type:"plot_edit",id:e.id,config:{colorTW:o}})};e.searchSample=function(t){const s=new l({padding:"3px"});let o;const i=s.d.append("input").on("keyup",(t=>{if(t.code=="Escape"){if(o){e.config.groups.splice(o.index,1);e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:e.config.groups}})}s.hide();return}if(t.code=="Enter"&&o){if(o.items.length==0)a.text("Invalid group");else{const t=e.config.groups[e.config.groups.length-1];e.config.groups.splice(t.index,1);e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:e.config.groups}});t.fromSearch=false;t.showOnly=false;const o=v([t]);e.addToFilter(o);const i=x(o);K(e.app,i,e.state.groups);s.hide()}return}const r=i.node().value.toUpperCase();const n=[];for(const t of e.charts)for(const e of t.cohortSamples){if(e.sample.toUpperCase().includes(r)||e.category?.toUpperCase().includes(r)||e.shape?.toUpperCase().includes(r))n.push(e)}if(n.length==0){a.text("No samples found")}else a.text("");if(e.config.groups.length>0&&e.config.groups[e.config.groups.length-1].fromSearch){o=e.config.groups[e.config.groups.length-1];o.items=n}else{o={name:`Group ${e.config.groups.length+1}`,items:n,index:e.config.groups.length,showOnly:true,fromSearch:true};e.config.groups.push(o)}e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:e.config.groups}})}));const a=s.d.append("div").style("padding-left","5px");s.show(t.clientX,t.clientY,false)};e.getCategoryInfo=function(e,t){if(!(t in e))return"";return e[t]};e.addToFilter=function(t){const s=o(e.state.termfilter.filter,"filterUiRoot");const i=a([s,x(t)]);i.tag="filterUiRoot";e.app.dispatch({type:"filter_replace",filter:i})};e.showTable=function(t,s,o,i){let a=[];const n=[];const l=t.items[0];if("sample"in l)n.push(f("Sample","label"));if(e.config.colorTW)n.push(f(e.config.colorTW.term.name,"label"));if(e.config.shapeTW)n.push(f(e.config.shapeTW.term.name,"label"));let p=false;for(const s of t.items){const t=[];if("sample"in s)t.push(f(s.sample));if(e.config.colorTW)t.push(f(e.getCategoryInfo(s,"category")));if(e.config.shapeTW)t.push(f(e.getCategoryInfo(s,"shape")));if("info"in s){p=true;const e=[];for(const[t,o]of Object.entries(s.info))e.push(`${t}: ${o}`);t.push(f(e.join(", ")))}a.push(t)}if(p)n.push(f("Info","label"));e.dom.tip.clear();const c=e.dom.tip.d.append("div").style("padding","5px");const d=c.append("div").style("margin-top","5px");const h=d.append("div").html("&nbsp;"+t.name).style("font-size","0.9rem").on("click",(()=>{const s=h.select("input").empty();if(!s)return;h.html("");const o=h.append("input").attr("value",t.name).on("change",(async()=>{const s=o.node().value;if(s)e.renameGroup(t,s);else o.node().value=t.name;h.html("&nbsp;"+t.name)}));o.node().focus();o.node().select()}));const m=c.append("div");const u=[];if(i){const t={text:"Add to a group",callback:t=>{const s=[];for(const o of t)s.push(e.selectedItems[o].__data__);const o={name:`Group ${e.config.groups.length+1}`,items:s,index:e.config.groups.length};const i=x(v([o]));K(e.app,i,e.state.groups)}};u.push(t)}else{const a={text:"Delete samples",callback:a=>{t.items=t.items.filter(((e,t,s)=>!(t in a)));e.showTable(t,s,o,i)}};u.push(a)}r({rows:a,columns:n,div:m,showLines:true,maxWidth:n.length*"15"+"vw",maxHeight:"35vh",buttons:u,selectAll:true});e.dom.tip.show(s,o,false,false);function f(e,t="value"){let s={};s[t]=e;return s}};e.showGroupMenu=function(t,s){e.dom.tip.clear();e.dom.tip.show(t.clientX,t.clientY,false,true);const o=e.dom.tip.d.append("div");const i=e.config.name?e.config.name:"Summary scatter";const a=v([s],i+" groups");const r=o.append("div").attr("name","sjpp-group-input-div").html("&nbsp;"+s.name).style("font-size","0.9rem").on("click",(()=>{const t=r.select("input").empty();if(!t)return;r.html("");const o=r.append("input").attr("value",s.name).on("change",(async()=>{const t=o.node().value;if(t)e.renameGroup(s,t);else o.node().value=s.name;r.html("&nbsp;"+s.name)}));o.node().focus();o.node().select()}));o.append("div").attr("class","sja_menuoption sja_sharp_border").text(`Edit ${s.items.length} samples`).on("click",(o=>{e.dom.tip.hide();e.showTable(s,t.clientX,t.clientY,false)}));e.addCommonMenuItems(o,a);o.append("div").attr("class","sja_menuoption sja_sharp_border").text(`Delete group`).on("click",(async t=>{await e.app.vocabApi.deleteGroup(s.name);e.dom.tip.hide()}));o.append("div").attr("class","sja_menuoption sja_sharp_border").text("Add to filter").on("click",(()=>{e.addToFilter(a);e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:e.config.groups}})}));o.append("div").attr("class","sja_menuoption sja_sharp_border").text(s.showOnly?"Show All":"Show Only").on("click",(()=>{s.showOnly=!s.showOnly;e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:e.config.groups}})}))};e.renameGroup=async function(t,s){const o=e.config.groups.findIndex((e=>e.name==s));if(o!=-1)alert(`Group named ${s} already exists`);else await e.app.dispatch({type:"rename_group",index:t.index,newName:s})};e.addCommonMenuItems=function(t,s){Q(e.dom.tip,t,s,e.app,e.id,e.state);if(e.state.supportedChartTypes.includes("survival"))Y("survival",t,"Compare survival",e.dom.tip,s,e.id,this);if(e.state.supportedChartTypes.includes("cuminc"))Y("cuminc",t,"Compare cumulative incidence",e.dom.tip,s,e.id,this);const o=t.append("div").attr("class","sja_menuoption sja_sharp_border").html("Summarize");o.insert("div").html("›").style("float","right");o.on("click",(async t=>{X(o,(t=>{J(t,s,e.app,e.id)}),e.app,e.dom.tip)}))};e.showGroupsMenu=function(t){e.dom.tip.clear();e.dom.tip.show(t.clientX,t.clientY,false,true);const s=e.dom.tip.d.append("div");const o=e.config.name?e.config.name:"Summary scatter";const i=v(e.config.groups,o+" groups");let a=s.append("div");for(const[o,i]of e.config.groups.entries()){a=s.append("div").attr("class","sja_menuoption sja_sharp_border");a.insert("div").style("display","inline-block").text(` ${i.name}: ${i.items.length} `);a.append("div").style("display","inline-block").style("float","right").html("&nbsp;&nbsp;›");a.on("click",(s=>{e.dom.tip.clear().hide();e.showGroupMenu(t,i)}))}e.addCommonMenuItems(s,i);a=s.append("div").attr("class","sja_menuoption sja_sharp_border").text("Delete groups").on("click",(async t=>{for(const t of e.config.groups)await e.app.vocabApi.deleteGroup(t.name);e.app.dispatch({type:"plot_edit",id:e.id,config:{groups:[]}})}))}}function fe(e,t,s,o,i){const a=i.xAxisScale(s)-i.xAxisScale(e);const r=i.yAxisScale(o)-i.yAxisScale(t);const n=Math.sqrt(Math.pow(a,2)+Math.pow(r,2));return n}var ye=Object.freeze({__proto__:null,setInteractivity:ue});export{K as a,ue as b,O as c,ye as d,pe as g,de as n,V as r,X as s};
@@ -1 +0,0 @@
1
- import{T as t,ac as e,az as s,aO as o,M as i,q as l,aI as n,l as a}from"./app-f70d9a0b.js";import{d as r}from"./zoom-eade983c.js";import"./transform-f2cc07e6.js";import{r as c}from"./table-2310e41b.js";import{controlsInit as d}from"./controls-cd2ff09c.js";import{d as p}from"./svg.download-89c31ee5.js";import{c as h,b as f}from"./axis-6cb4f314.js";import"path";import"./pointer-c7475677.js";import"./nodrag-094c4b10.js";import"./controls.btns-86a413d5.js";import"./controls.config-ae99bcd1.js";import"./controls.overlay-a72d72e4.js";import"./termsetting-8476b5ab.js";import"./filter-5a5a1166.js";import"./controls.term1-3c9e55b8.js";import"./controls.divide-8f26abff.js";const g=9;const m=300;class y{constructor(){this.type="singleCellPlot";this.tip=new i({padding:"4px",offsetX:10,offsetY:0});this.tip.d.style("max-height","300px").style("overflow","scroll").style("font-size","0.9em")}async init(t){t.plots.find((t=>t.id===this.id));const e=this.opts.holder.insert("div").style("display","inline-block");this.mainDiv=this.opts.holder.insert("div").style("display","inline-block").style("vertical-align","top").style("padding","10px");this.sampleDiv=this.mainDiv.insert("div").style("display","inline-block");const s=80;this.axisOffset={x:s,y:30};const o=e.attr("class","pp-termdb-plot-controls").style("display","inline-block");this.dom={header:this.opts.header,loadingDiv:this.opts.holder.append("div").style("position","absolute").style("left","45%").style("top","60%"),tip:new i({padding:"0px"}),tooltip:new i({padding:"2px",offsetX:10,offsetY:0}),controlsHolder:o};if(t.vocab.dslabel=="GDC")await b(this.sampleDiv,this,t);this.settings={};this.table=this.mainDiv.append("div").style("padding-top","10px").append("table").style("width","95vw").style("border-collapse","collapse");await this.setControls();document.addEventListener("scroll",(t=>this.tip.hide()));l(".sjpp-output-sandbox-content").on("scroll",(t=>this.tip.hide()))}async setControls(){this.components={controls:await d({app:this.app,id:this.id,holder:this.dom.controlsHolder,inputs:[{label:"Chart width",type:"number",chartType:"singleCellPlot",settingsKey:"svgw"},{label:"Chart height",type:"number",chartType:"singleCellPlot",settingsKey:"svgh"}]})};this.components.controls.on("downloadClick.singleCellPlot",(()=>{for(const t of this.plots)p(t.svg,"plot.svg",this.opts.holder.node())}))}getState(t){const e=t.plots.find((t=>t.id===this.id));if(!e){throw`No plot with id='${this.id}' found. Did you set this.id before this.api = getComponentApi(this)?`}return{config:e,dslabel:t.vocab.dslabel,genome:t.vocab.genome}}async main(){this.config=JSON.parse(JSON.stringify(this.state.config));this.table.selectAll("*").remove();this.plots=[];o(this.settings,this.config.settings.singleCellPlot);this.headerTr=this.table.append("tr");this.tr=this.table.append("tr");let t=this.state.config.sample;if(this.state.dslabel!="GDC"){const t={genome:this.state.genome,dslabel:this.state.dslabel,sample:this.state.config.sample};this.renderPlots(t)}else{let e;if(!this.state.config.file){t=this.samples[0].sample;e=this.samples[0].files[0].fileId}else{t=this.state.config.sample;e=this.state.config.file}const s={genome:this.state.genome,dslabel:this.state.dslabel,sample:e};this.renderPlots(s)}if(this.dom.header)this.dom.header.html(`${t} Single Cell Data`)}async renderPlots(s){try{const e=await t("termdb/singlecellData",{body:s});if(e.error)throw e.error;for(const t of e.plots){for(const s in e.tid2cellvalue){t.clusterMap=e.tid2cellvalue[s];t.tid=s;this.renderPlot(t)}}}catch(t){if(t.stack)console.log(t.stack);e(this.mainDiv,t);return}}renderPlot(t){this.plots.push(t);let e=new Set(t.cells.map((t=>t.category)));e=Array.from(e).sort();const s=n(e.length);const o={};t.colorMap=o;for(const t of e)o[t]=t=="ref"?"#F2F2F2":s(t);this.initAxes(t);this.headerTr.append("td").style("font-weight","bold").style("border","1px solid #d3d3d3").style("padding","5px").text(t.name).style("background-color","#d3d3d3").style("fo");const i=this.tr.append("td").style("text-align","center").style("border","1px solid #d3d3d3");const l=i.append("svg").attr("width",this.settings.svgw).attr("height",this.settings.svgh).on("mouseover",(e=>{if(!this.onClick)this.showTooltip(e,t)})).on("click",(e=>this.showTooltip(e,t)));const a=i.append("svg").attr("width",200).attr("height",this.settings.svgh);t.svg=l;t.legendSVG=a;const c=r().scaleExtent([.5,10]).on("zoom",(e=>this.handleZoom(e,d,t))).filter((t=>{if(t.type==="wheel")return t.ctrlKey;return true}));l.call(c);const d=l.append("g");const p=a.append("g").attr("transform",`translate(20, 50)`).style("font-size","0.9em");const h=d.selectAll("path").data(t.cells);h.enter().append("g").attr("transform",(e=>`translate(${t.xAxisScale(e.x)}, ${t.yAxisScale(e.y)})`)).append("circle").attr("r",2).attr("fill",(t=>o[t.category])).style("fill-opacity",(t=>this.config.hiddenClusters.includes(t.category)?0:.7));this.renderLegend(p,t)}handleZoom(t,e,s){e.attr("transform",t.transform);s.zoom=t.transform.scale(1).k}renderLegend(t,e){if(this.sameLegend&&this.legendRendered)return;this.legendRendered=true;const s=e.colorMap;t.append("text").style("font-weight","bold").text(`${e.colorBy}`);const o=25;let i=30;let l=0;for(const a in s){const s=e.cells.filter((t=>t.category==a));const r=this.config.hiddenClusters.includes(a);const c=s.length;const d=e.colorMap[a];const p=t.append("g").attr("transform",(t=>`translate(${l}, ${i})`));p.append("circle").attr("r",3).attr("fill",d);p.append("g").attr("transform",`translate(${l+10}, ${5})`).append("text").text(`${a} n=${c}`).style("text-decoration",r?"line-through":"none").on("click",(t=>n(this,t,a)));i+=o}function n(t,e,s,o){const i=e.target;const l=i.style["text-decoration"]=="line-through";i.style["text-decoration"]=l?"none":"line-through";let n=t.config.hiddenClusters;if(!l)n.push(s);else n.splice(n.indexOf(s),1);t.app.dispatch({type:"plot_edit",id:t.id,config:{hiddenClusters:n}})}}initAxes(t){const e=t.cells[0];const[s,o,i,l]=t.cells.reduce(((t,e)=>[e.x<t[0]?e.x:t[0],e.x>t[1]?e.x:t[1],e.y<t[2]?e.y:t[2],e.y>t[3]?e.y:t[3]]),[e.x,e.x,e.y,e.y]);const n=5;t.xAxisScale=a().domain([s,o]).range([0+n,this.settings.svgh-5]);t.axisBottom=h(t.xAxisScale);t.yAxisScale=a().domain([l,i]).range([0+n,this.settings.svgh-n]);t.axisLeft=f(t.yAxisScale);t.zoom=1}distance(t,e,s,o,i){const l=i.xAxisScale(s)-i.xAxisScale(t);const n=i.yAxisScale(o)-i.yAxisScale(e);const a=Math.sqrt(Math.pow(l,2)+Math.pow(n,2));return a}showTooltip(t,e){if(this.onClick&&t.type=="click"){this.onClick=false;this.tip.hide();return}if(t.target.tagName=="circle"){this.onClick=t.type=="click";const s=t.target.__data__;let o=10;o=o/e.zoom;const i=e.cells.filter((t=>{if(this.getOpacity(t)==0)return false;const i=this.distance(t.x,t.y,s.x,s.y,e);return i<o}));const l=[];for(const t of i){const e=s.category;let o=l.find((t=>t.id==e));if(!o){o={id:e,parentId:null,samples:[t],level:1,category:null,children:[]};l.push(o)}else{o.samples.push(t)}}const n=this.tip.clear();const a=n.d.append("table");for(const t of l){let s=a.append("tr");s.append("td").style("color","#aaa").text(e.colorBy);const o=t.id;const i=s.append("td");const l=i.append("svg").attr("width",150).attr("height",20);const n=10;const r=12;const c=l.append("g").attr("transform",`translate(${n}, ${r})`);c.append("circle").attr("fill",e.colorMap[o]).attr("r",4);l.append("g").attr("transform",`translate(${n+15}, ${r+4})`).append("text").text(o);s=a.append("tr");s.append("td").style("color","#aaa").text("cells");s.append("td").text(t.samples.length)}n.show(t.clientX,t.clientY,true,true)}else this.onMouseOut(t)}onMouseOut(t){this.tip.hide()}getOpacity(t){return this.config.hiddenClusters.includes(t.category)?0:1}}async function u(t,e){const s=t.append("div").style("padding","5px");b(s,e,e.state)}async function b(s,o,i){const l={genome:i.vocab.genome,dslabel:i.vocab.dslabel};let n;try{n=await t("termdb/singlecellSamples",{body:l});if(n.error)throw n.error}catch(t){e(s,t);return}const a=n.samples;a.sort(((t,e)=>{const s=t.primarySite?.localeCompare(e.primarySite);if(s==1||s==-1)return s;else return t.sample.localeCompare(e.sample)}));const r=[];let d=[];const p=n.fields;const h=n.columnNames;for(const t of h)d.push({label:t});const f=h.length==1?0:h.length-1;d[f].width="25vw";for(const t of a){if(t.files)for(const e of t.files){const s=[];g(s,p,t);s.push({value:e.sampleType});s.push({value:e.fileId});r.push(s)}else{const e=[];g(e,p,t);r.push(e)}}function g(t,e,s){for(const o of e){t.push({value:s[o]})}}const m=[];let y="40vh";if(i.vocab.dslabel=="GDC"){m.push(0);o.samples=a;y="21vh"}c({rows:r,columns:d,resize:true,singleMode:true,div:s,maxHeight:y,noButtonCallback:t=>{const e=a[t].sample;const s=r[t][d.length-1].value;let l={chartType:"singleCellPlot",sample:e,file:s};let n="plot_edit";if(i.vocab.dslabel!="GDC"){o.dom.tip.hide();n="plot_create";o.app.dispatch({type:n,config:l})}else o.app.dispatch({type:n,id:o.id,config:l})},selectedRows:m})}const x=s(y);const v=x;async function w(t,e){try{const e=C();const s={hiddenClusters:[],settings:{controls:{isOpen:false},singleCellPlot:e}};const i=o(s,t);return i}catch(t){console.log(t);throw`${t} [singleCellPlot getPlotConfig()]`}}function C(){return{svgw:500,svgh:500,svgd:500}}export{v as componentInit,C as getDefaultSingleCellSettings,w as getPlotConfig,u as makeChartBtnMenu,m as maxDotSize,g as minDotSize,x as scatterInit};
@@ -1 +0,0 @@
1
- import{bP as e,bN as n}from"./app-f70d9a0b.js";function o(o){let t=0;for(let f=1;f<o.length;f++){const i=o[f];const a=o[t];if(i.isskipexon&&a.isaltexon){t=f;continue}if(i.frame==e&&a.framenocheck){t=f;continue}if(i.frame==n&&a.frame!=n){t=f;continue}}return t}export{o as e};
@@ -1 +0,0 @@
1
- import{a as t}from"./termsetting-8476b5ab.js";import"./app-f70d9a0b.js";import"path";import"./filter-5a5a1166.js";import"./table-2310e41b.js";function r(r){return{showEditMenu(){},getPillStatus(){},getPillName(e){return t(r,e)}}}function e(t,r){}export{e as fillTW,r as getHandler};