@jbrowse/core 4.3.0 → 5.0.0-beta.10

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 (1265) hide show
  1. package/README.md +1994 -0
  2. package/esm/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.d.ts +14 -3
  3. package/esm/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +36 -23
  4. package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.d.ts +10 -7
  5. package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +124 -21
  6. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseAttributes.d.ts +2 -8
  7. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseAttributes.js +4 -4
  8. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +1 -1
  9. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +2 -5
  10. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseCoreDetails.d.ts +1 -1
  11. package/esm/BaseFeatureWidget/BaseFeatureDetail/BaseCoreDetails.js +4 -4
  12. package/esm/BaseFeatureWidget/BaseFeatureDetail/BasicValue.d.ts +12 -1
  13. package/esm/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +19 -5
  14. package/esm/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +1 -1
  15. package/esm/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +18 -23
  16. package/esm/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.d.ts +1 -1
  17. package/esm/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +19 -40
  18. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +9 -6
  19. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +33 -30
  20. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetailsFrame.d.ts +11 -0
  21. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetailsFrame.js +11 -0
  22. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureWash.d.ts +20 -0
  23. package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureWash.js +66 -0
  24. package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldActionsButton.d.ts +8 -0
  25. package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldActionsButton.js +24 -0
  26. package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldName.d.ts +1 -1
  27. package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldName.js +2 -2
  28. package/esm/BaseFeatureWidget/BaseFeatureDetail/Formatter.d.ts +3 -0
  29. package/esm/BaseFeatureWidget/BaseFeatureDetail/Formatter.js +19 -0
  30. package/esm/BaseFeatureWidget/BaseFeatureDetail/ParentFeatureLine.d.ts +4 -0
  31. package/esm/BaseFeatureWidget/BaseFeatureDetail/ParentFeatureLine.js +17 -0
  32. package/esm/BaseFeatureWidget/BaseFeatureDetail/SimpleField.d.ts +5 -3
  33. package/esm/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +8 -6
  34. package/esm/BaseFeatureWidget/BaseFeatureDetail/UriField.d.ts +3 -2
  35. package/esm/BaseFeatureWidget/BaseFeatureDetail/UriField.js +7 -14
  36. package/esm/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +7 -2
  37. package/esm/BaseFeatureWidget/BaseFeatureDetail/index.js +15 -20
  38. package/esm/BaseFeatureWidget/BaseFeatureDetail/jexlFilterActions.d.ts +16 -0
  39. package/esm/BaseFeatureWidget/BaseFeatureDetail/jexlFilterActions.js +50 -0
  40. package/esm/BaseFeatureWidget/BaseFeatureDetail/util.d.ts +0 -1
  41. package/esm/BaseFeatureWidget/BaseFeatureDetail/util.js +9 -10
  42. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceBody.d.ts +18 -0
  43. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceBody.js +10 -0
  44. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceContents.d.ts +7 -4
  45. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceContents.js +35 -24
  46. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +10 -5
  47. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +64 -41
  48. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +3 -3
  49. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +17 -8
  50. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceLegend.d.ts +6 -0
  51. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceLegend.js +19 -0
  52. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceName.d.ts +5 -4
  53. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceName.js +15 -18
  54. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +1 -1
  55. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +33 -17
  56. package/esm/BaseFeatureWidget/SequenceFeatureDetails/consts.d.ts +3 -3
  57. package/esm/BaseFeatureWidget/SequenceFeatureDetails/consts.js +7 -3
  58. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.d.ts +11 -0
  59. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.js +29 -0
  60. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.d.ts +1 -1
  61. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +4 -6
  62. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +18 -6
  63. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +11 -29
  64. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +9 -2
  65. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +63 -58
  66. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +7 -3
  67. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.js +38 -51
  68. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +1 -1
  69. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +19 -27
  70. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/TranscriptSelector.d.ts +6 -0
  71. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/TranscriptSelector.js +20 -0
  72. package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.d.ts +12 -0
  73. package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.js +97 -0
  74. package/esm/BaseFeatureWidget/SequenceFeatureDetails/index.js +1 -1
  75. package/esm/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +62 -63
  76. package/esm/BaseFeatureWidget/SequenceFeatureDetails/model.js +69 -59
  77. package/esm/BaseFeatureWidget/SequenceFeatureDetails/panelAssemblyName.d.ts +21 -0
  78. package/esm/BaseFeatureWidget/SequenceFeatureDetails/panelAssemblyName.js +24 -0
  79. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +5 -3
  80. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +93 -75
  81. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +1 -1
  82. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +4 -11
  83. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +5 -2
  84. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +21 -48
  85. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/PlainSequence.d.ts +8 -0
  86. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/PlainSequence.js +20 -0
  87. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +6 -3
  88. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +33 -13
  89. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +7 -4
  90. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +67 -11
  91. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/renderSequenceSegments.d.ts +14 -0
  92. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/renderSequenceSegments.js +42 -0
  93. package/esm/BaseFeatureWidget/SequenceFeatureDetails/types.d.ts +8 -1
  94. package/esm/BaseFeatureWidget/SequenceFeatureDetails/useSequenceData.d.ts +9 -9
  95. package/esm/BaseFeatureWidget/SequenceFeatureDetails/useSequenceData.js +28 -44
  96. package/esm/BaseFeatureWidget/SequenceFeatureDetails/useSequenceFetch.d.ts +23 -0
  97. package/esm/BaseFeatureWidget/SequenceFeatureDetails/useSequenceFetch.js +31 -0
  98. package/esm/BaseFeatureWidget/SequenceFeatureDetails/util.d.ts +90 -1
  99. package/esm/BaseFeatureWidget/SequenceFeatureDetails/util.js +145 -23
  100. package/esm/BaseFeatureWidget/configSchema.d.ts +1 -1
  101. package/esm/BaseFeatureWidget/configSchema.js +1 -1
  102. package/esm/BaseFeatureWidget/formatDetails.d.ts +22 -0
  103. package/esm/BaseFeatureWidget/formatDetails.js +82 -0
  104. package/esm/BaseFeatureWidget/index.d.ts +4 -1
  105. package/esm/BaseFeatureWidget/index.js +2 -2
  106. package/esm/BaseFeatureWidget/stateModelFactory.d.ts +102 -71
  107. package/esm/BaseFeatureWidget/stateModelFactory.js +162 -63
  108. package/esm/BaseFeatureWidget/types.d.ts +15 -8
  109. package/esm/BaseFeatureWidget/util.d.ts +2 -37
  110. package/esm/BaseFeatureWidget/util.js +4 -85
  111. package/esm/CorePlugin.js +12 -7
  112. package/esm/PhasedScheduler.d.ts +4 -2
  113. package/esm/PhasedScheduler.js +18 -2
  114. package/esm/Plugin.d.ts +6 -1
  115. package/esm/Plugin.js +7 -0
  116. package/esm/PluginLoader.d.ts +55 -44
  117. package/esm/PluginLoader.js +290 -90
  118. package/esm/PluginManager.d.ts +476 -57
  119. package/esm/PluginManager.js +480 -91
  120. package/esm/ReExports/MuiDataGridReExports.d.ts +3 -2
  121. package/esm/ReExports/MuiDataGridReExports.js +58 -130
  122. package/esm/ReExports/MuiReExports.d.ts +3 -134
  123. package/esm/ReExports/MuiReExports.js +43 -16
  124. package/esm/ReExports/MuiStylesReExports.d.ts +66 -0
  125. package/esm/ReExports/MuiStylesReExports.js +55 -0
  126. package/esm/ReExports/coreModules.generated.d.ts +2 -0
  127. package/esm/ReExports/coreModules.generated.js +528 -0
  128. package/esm/ReExports/coreWorkerModules.generated.d.ts +2 -0
  129. package/esm/ReExports/coreWorkerModules.generated.js +488 -0
  130. package/esm/ReExports/frameworkModules.d.ts +2 -0
  131. package/esm/ReExports/frameworkModules.js +68 -0
  132. package/esm/ReExports/frameworkShared.d.ts +12 -0
  133. package/esm/ReExports/frameworkShared.js +16 -0
  134. package/esm/ReExports/frameworkWorkerModules.generated.d.ts +2 -0
  135. package/esm/ReExports/frameworkWorkerModules.generated.js +130 -0
  136. package/esm/ReExports/lazify.d.ts +2 -2
  137. package/esm/ReExports/lazify.js +16 -3
  138. package/esm/ReExports/list.js +433 -160
  139. package/esm/ReExports/modules.d.ts +1 -1
  140. package/esm/ReExports/modules.js +10 -146
  141. package/esm/ReExports/muiComponentNames.d.ts +18 -0
  142. package/esm/ReExports/muiComponentNames.js +130 -0
  143. package/esm/ReExports/registry.d.ts +3 -0
  144. package/esm/ReExports/registry.js +46 -0
  145. package/esm/ReExports/uiStub.d.ts +3 -0
  146. package/esm/ReExports/uiStub.js +33 -0
  147. package/esm/ReExports/workerModules.d.ts +2 -0
  148. package/esm/ReExports/workerModules.js +11 -0
  149. package/esm/TextSearch/BaseResults.d.ts +20 -21
  150. package/esm/TextSearch/BaseResults.js +8 -33
  151. package/esm/TextSearch/TextSearchManager.d.ts +30 -36
  152. package/esm/TextSearch/TextSearchManager.js +138 -44
  153. package/esm/TextSearch/places.d.ts +12 -0
  154. package/esm/TextSearch/places.js +94 -0
  155. package/esm/assemblyManager/assembly.d.ts +310 -35
  156. package/esm/assemblyManager/assembly.js +554 -263
  157. package/esm/assemblyManager/assemblyAdapters.d.ts +12 -0
  158. package/esm/assemblyManager/assemblyAdapters.js +24 -0
  159. package/esm/assemblyManager/assemblyConfigSchema.d.ts +135 -19
  160. package/esm/assemblyManager/assemblyConfigSchema.js +205 -23
  161. package/esm/assemblyManager/assemblyManager.d.ts +586 -323
  162. package/esm/assemblyManager/assemblyManager.js +352 -51
  163. package/esm/assemblyManager/expandAssemblyConfigShorthand.d.ts +39 -0
  164. package/esm/assemblyManager/expandAssemblyConfigShorthand.js +114 -0
  165. package/esm/assemblyManager/geneticCodes.d.ts +21 -0
  166. package/esm/assemblyManager/geneticCodes.js +44 -0
  167. package/esm/assemblyManager/getSequenceAdapterConfig.d.ts +19 -0
  168. package/esm/assemblyManager/getSequenceAdapterConfig.js +22 -0
  169. package/esm/assemblyManager/index.d.ts +1 -1
  170. package/esm/assemblyManager/index.js +2 -2
  171. package/esm/assemblyManager/indexAssemblyNames.d.ts +9 -0
  172. package/esm/assemblyManager/indexAssemblyNames.js +22 -0
  173. package/esm/assemblyManager/loadRefNameMap.d.ts +5 -0
  174. package/esm/assemblyManager/loadRefNameMap.js +75 -0
  175. package/esm/assemblyManager/refNameColors.d.ts +1 -0
  176. package/esm/assemblyManager/refNameColors.js +32 -0
  177. package/esm/assemblyManager/refNameMapKey.d.ts +7 -0
  178. package/esm/assemblyManager/refNameMapKey.js +12 -0
  179. package/esm/assemblyManager/refNameMaps.d.ts +26 -0
  180. package/esm/assemblyManager/refNameMaps.js +87 -0
  181. package/esm/assemblyManager/refNameMismatch.d.ts +54 -0
  182. package/esm/assemblyManager/refNameMismatch.js +66 -0
  183. package/esm/checkPlugins.d.ts +13 -0
  184. package/esm/checkPlugins.js +98 -0
  185. package/esm/configuration/bamIndexFields.d.ts +49 -0
  186. package/esm/configuration/bamIndexFields.js +41 -0
  187. package/esm/configuration/configurationSchema.d.ts +194 -29
  188. package/esm/configuration/configurationSchema.js +439 -145
  189. package/esm/configuration/configurationSchemaUnion.d.ts +39 -0
  190. package/esm/configuration/configurationSchemaUnion.js +56 -0
  191. package/esm/configuration/configurationSlot.d.ts +373 -30
  192. package/esm/configuration/configurationSlot.js +231 -224
  193. package/esm/configuration/fillLocations.d.ts +14 -0
  194. package/esm/configuration/fillLocations.js +14 -0
  195. package/esm/configuration/formatAboutConfigSchema.d.ts +41 -0
  196. package/esm/configuration/formatAboutConfigSchema.js +58 -0
  197. package/esm/configuration/formatDetailsConfigSchema.d.ts +54 -0
  198. package/esm/configuration/formatDetailsConfigSchema.js +87 -0
  199. package/esm/configuration/fullConfSnapshot.d.ts +13 -0
  200. package/esm/configuration/fullConfSnapshot.js +44 -0
  201. package/esm/configuration/getConf.d.ts +92 -0
  202. package/esm/configuration/getConf.js +141 -0
  203. package/esm/configuration/index.d.ts +32 -3
  204. package/esm/configuration/index.js +27 -2
  205. package/esm/configuration/indexType.d.ts +26 -0
  206. package/esm/configuration/indexType.js +38 -0
  207. package/esm/configuration/mergeFormatCallbacks.d.ts +14 -0
  208. package/esm/configuration/mergeFormatCallbacks.js +27 -0
  209. package/esm/configuration/readConfObject.d.ts +34 -0
  210. package/esm/configuration/readConfObject.js +118 -0
  211. package/esm/configuration/requirements.d.ts +37 -0
  212. package/esm/configuration/requirements.js +88 -0
  213. package/esm/configuration/schemaRegistry.d.ts +52 -0
  214. package/esm/configuration/schemaRegistry.js +48 -0
  215. package/esm/configuration/schemaTypes.d.ts +39 -0
  216. package/esm/configuration/schemaTypes.js +105 -0
  217. package/esm/configuration/slotFacade.d.ts +65 -0
  218. package/esm/configuration/slotFacade.js +110 -0
  219. package/esm/configuration/slotValueUtils.d.ts +17 -0
  220. package/esm/configuration/slotValueUtils.js +25 -0
  221. package/esm/configuration/snapshotPreprocess.d.ts +43 -0
  222. package/esm/configuration/snapshotPreprocess.js +161 -0
  223. package/esm/configuration/tabixIndexFields.d.ts +70 -0
  224. package/esm/configuration/tabixIndexFields.js +62 -0
  225. package/esm/configuration/tabixShorthand.d.ts +51 -0
  226. package/esm/configuration/tabixShorthand.js +72 -0
  227. package/esm/configuration/types.d.ts +315 -13
  228. package/esm/configuration/uriShorthand.d.ts +9 -0
  229. package/esm/configuration/uriShorthand.js +16 -0
  230. package/esm/data_adapters/BaseAdapter/BaseAdapter.d.ts +19 -11
  231. package/esm/data_adapters/BaseAdapter/BaseAdapter.js +19 -18
  232. package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +158 -7
  233. package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +164 -29
  234. package/esm/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +1 -0
  235. package/esm/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +13 -5
  236. package/esm/data_adapters/BaseAdapter/BaseSequenceAdapter.js +9 -7
  237. package/esm/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +2 -1
  238. package/esm/data_adapters/BaseAdapter/CytobandAdapter.d.ts +7 -0
  239. package/esm/data_adapters/BaseAdapter/RegionsAdapter.d.ts +2 -1
  240. package/esm/data_adapters/BaseAdapter/featureDensity.d.ts +40 -0
  241. package/esm/data_adapters/BaseAdapter/featureDensity.js +31 -0
  242. package/esm/data_adapters/BaseAdapter/getAdapterId.d.ts +2 -0
  243. package/esm/data_adapters/BaseAdapter/getAdapterId.js +9 -0
  244. package/esm/data_adapters/BaseAdapter/index.d.ts +28 -6
  245. package/esm/data_adapters/BaseAdapter/index.js +6 -5
  246. package/esm/data_adapters/BaseAdapter/rowSources.d.ts +37 -0
  247. package/esm/data_adapters/BaseAdapter/rowSources.js +7 -0
  248. package/esm/data_adapters/BaseAdapter/stats.d.ts +37 -5
  249. package/esm/data_adapters/BaseAdapter/stats.js +89 -24
  250. package/esm/data_adapters/BaseAdapter/types.d.ts +11 -13
  251. package/esm/data_adapters/BaseAdapter/types.js +1 -0
  252. package/esm/data_adapters/BaseAdapter/util.d.ts +5 -1
  253. package/esm/data_adapters/BaseAdapter/util.js +14 -3
  254. package/esm/data_adapters/BaseAdapter/zoomRange.d.ts +10 -0
  255. package/esm/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +1 -1
  256. package/esm/data_adapters/CytobandAdapter/CytobandAdapter.js +5 -5
  257. package/esm/data_adapters/CytobandAdapter/configSchema.d.ts +34 -6
  258. package/esm/data_adapters/CytobandAdapter/configSchema.js +47 -17
  259. package/esm/data_adapters/CytobandAdapter/index.js +3 -3
  260. package/esm/data_adapters/adapterSessionRefcount.d.ts +61 -0
  261. package/esm/data_adapters/adapterSessionRefcount.js +96 -0
  262. package/esm/data_adapters/dataAdapterCache.d.ts +53 -2
  263. package/esm/data_adapters/dataAdapterCache.js +99 -25
  264. package/esm/data_adapters/getFeatureAdapter.d.ts +24 -0
  265. package/esm/data_adapters/getFeatureAdapter.js +27 -0
  266. package/esm/data_adapters/getSequenceSubAdapter.d.ts +19 -0
  267. package/esm/data_adapters/getSequenceSubAdapter.js +42 -0
  268. package/esm/pluggableElementTypes/AdapterType.d.ts +57 -7
  269. package/esm/pluggableElementTypes/AdapterType.js +44 -5
  270. package/esm/pluggableElementTypes/AddTrackWorkflowType.d.ts +6 -1
  271. package/esm/pluggableElementTypes/AddTrackWorkflowType.js +3 -1
  272. package/esm/pluggableElementTypes/ConnectionType.d.ts +5 -5
  273. package/esm/pluggableElementTypes/ConnectionType.js +1 -1
  274. package/esm/pluggableElementTypes/DisplayType.d.ts +54 -14
  275. package/esm/pluggableElementTypes/DisplayType.js +30 -7
  276. package/esm/pluggableElementTypes/InternetAccountType.js +1 -1
  277. package/esm/pluggableElementTypes/LazyStateModelElement.d.ts +32 -0
  278. package/esm/pluggableElementTypes/LazyStateModelElement.js +77 -0
  279. package/esm/pluggableElementTypes/PluggableElementBase.d.ts +11 -0
  280. package/esm/pluggableElementTypes/PluggableElementBase.js +11 -0
  281. package/esm/pluggableElementTypes/RpcMethodType.d.ts +142 -12
  282. package/esm/pluggableElementTypes/RpcMethodType.js +279 -98
  283. package/esm/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +18 -9
  284. package/esm/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +26 -20
  285. package/esm/pluggableElementTypes/RpcMethodTypeWithRenameRegion.d.ts +5 -0
  286. package/esm/pluggableElementTypes/RpcMethodTypeWithRenameRegion.js +18 -0
  287. package/esm/pluggableElementTypes/RpcMethodTypeWithRenameRegions.d.ts +5 -0
  288. package/esm/pluggableElementTypes/RpcMethodTypeWithRenameRegions.js +10 -0
  289. package/esm/pluggableElementTypes/TextSearchAdapterType.d.ts +7 -7
  290. package/esm/pluggableElementTypes/TextSearchAdapterType.js +3 -1
  291. package/esm/pluggableElementTypes/TrackType.d.ts +2 -1
  292. package/esm/pluggableElementTypes/TrackType.js +1 -1
  293. package/esm/pluggableElementTypes/ViewType.d.ts +22 -5
  294. package/esm/pluggableElementTypes/ViewType.js +40 -5
  295. package/esm/pluggableElementTypes/WidgetType.d.ts +2 -2
  296. package/esm/pluggableElementTypes/WidgetType.js +1 -1
  297. package/esm/pluggableElementTypes/addMenuItems.d.ts +88 -0
  298. package/esm/pluggableElementTypes/addMenuItems.js +82 -0
  299. package/esm/pluggableElementTypes/extendElementType.d.ts +29 -0
  300. package/esm/pluggableElementTypes/extendElementType.js +72 -0
  301. package/esm/pluggableElementTypes/index.d.ts +8 -7
  302. package/esm/pluggableElementTypes/index.js +24 -14
  303. package/esm/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +80 -15
  304. package/esm/pluggableElementTypes/models/BaseConnectionModelFactory.js +90 -10
  305. package/esm/pluggableElementTypes/models/BaseDisplayModel.d.ts +643 -84
  306. package/esm/pluggableElementTypes/models/BaseDisplayModel.js +230 -60
  307. package/esm/pluggableElementTypes/models/BaseTrackModel.d.ts +246 -37
  308. package/esm/pluggableElementTypes/models/BaseTrackModel.js +416 -107
  309. package/esm/pluggableElementTypes/models/BaseViewModel.d.ts +236 -16
  310. package/esm/pluggableElementTypes/models/BaseViewModel.js +154 -16
  311. package/esm/pluggableElementTypes/models/InternetAccountModel.d.ts +169 -25
  312. package/esm/pluggableElementTypes/models/InternetAccountModel.js +218 -48
  313. package/esm/pluggableElementTypes/models/assertDisplayContract.d.ts +178 -0
  314. package/esm/pluggableElementTypes/models/assertDisplayContract.js +239 -0
  315. package/esm/pluggableElementTypes/models/baseConnectionConfig.d.ts +26 -8
  316. package/esm/pluggableElementTypes/models/baseConnectionConfig.js +18 -2
  317. package/esm/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +31 -17
  318. package/esm/pluggableElementTypes/models/baseInternetAccountConfig.js +23 -2
  319. package/esm/pluggableElementTypes/models/baseTrackConfig.d.ts +142 -65
  320. package/esm/pluggableElementTypes/models/baseTrackConfig.js +215 -90
  321. package/esm/pluggableElementTypes/models/components/SaveTrackData.d.ts +3 -8
  322. package/esm/pluggableElementTypes/models/components/SaveTrackData.js +111 -139
  323. package/esm/pluggableElementTypes/models/components/fetchTrackData.d.ts +54 -0
  324. package/esm/pluggableElementTypes/models/components/fetchTrackData.js +83 -0
  325. package/esm/pluggableElementTypes/models/expandTrackConfigShorthand.d.ts +50 -0
  326. package/esm/pluggableElementTypes/models/expandTrackConfigShorthand.js +147 -0
  327. package/esm/pluggableElementTypes/models/index.d.ts +5 -3
  328. package/esm/pluggableElementTypes/models/index.js +9 -8
  329. package/esm/pluggableElementTypes/models/migrateTrackConfig.d.ts +48 -0
  330. package/esm/pluggableElementTypes/models/migrateTrackConfig.js +114 -0
  331. package/esm/pluggableElementTypes/models/saveTrackFileTypes/bed.js +75 -7
  332. package/esm/pluggableElementTypes/models/saveTrackFileTypes/genbank.d.ts +10 -3
  333. package/esm/pluggableElementTypes/models/saveTrackFileTypes/genbank.js +272 -100
  334. package/esm/pluggableElementTypes/models/saveTrackFileTypes/gff3.d.ts +6 -1
  335. package/esm/pluggableElementTypes/models/saveTrackFileTypes/gff3.js +70 -74
  336. package/esm/pluggableElementTypes/models/saveTrackFileTypes/types.d.ts +9 -1
  337. package/esm/pluggableElementTypes/models/saveTrackFileTypes/util.d.ts +21 -0
  338. package/esm/pluggableElementTypes/models/saveTrackFileTypes/util.js +51 -0
  339. package/esm/pluggableElementTypes/models/uriMatchesDomains.d.ts +29 -0
  340. package/esm/pluggableElementTypes/models/uriMatchesDomains.js +62 -0
  341. package/esm/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +5 -4
  342. package/esm/pluggableElementTypes/renderers/util/serializableFilterChain.js +20 -10
  343. package/esm/pluginDefinitions.d.ts +225 -0
  344. package/esm/pluginDefinitions.js +254 -0
  345. package/esm/rpc/BaseRpcDriver.d.ts +27 -35
  346. package/esm/rpc/BaseRpcDriver.js +68 -106
  347. package/esm/rpc/MainThreadRpcDriver.d.ts +9 -10
  348. package/esm/rpc/MainThreadRpcDriver.js +23 -29
  349. package/esm/rpc/RpcClient.d.ts +50 -0
  350. package/esm/rpc/RpcClient.js +189 -0
  351. package/esm/rpc/RpcManager.d.ts +120 -27
  352. package/esm/rpc/RpcManager.js +187 -50
  353. package/esm/rpc/RpcRegistry.d.ts +298 -0
  354. package/esm/rpc/RpcServer.d.ts +43 -0
  355. package/esm/rpc/RpcServer.js +242 -0
  356. package/esm/rpc/WebWorkerRpcDriver.d.ts +78 -24
  357. package/esm/rpc/WebWorkerRpcDriver.js +311 -30
  358. package/esm/rpc/byteBudget.d.ts +64 -0
  359. package/esm/rpc/byteBudget.js +61 -0
  360. package/esm/rpc/configSchema.d.ts +13 -5
  361. package/esm/rpc/configSchema.js +40 -16
  362. package/esm/rpc/coreRpcMethods.d.ts +6 -5
  363. package/esm/rpc/coreRpcMethods.js +13 -12
  364. package/esm/rpc/explainTransferError.d.ts +35 -0
  365. package/esm/rpc/explainTransferError.js +158 -0
  366. package/esm/rpc/methods/CoreFreeResources.d.ts +19 -4
  367. package/esm/rpc/methods/CoreFreeResources.js +17 -6
  368. package/esm/rpc/methods/CoreGetEncodedFeature.d.ts +13 -0
  369. package/esm/rpc/methods/CoreGetEncodedFeature.js +32 -0
  370. package/esm/rpc/methods/CoreGetEncodedLayers.d.ts +16 -0
  371. package/esm/rpc/methods/CoreGetEncodedLayers.js +59 -0
  372. package/esm/rpc/methods/CoreGetExportData.d.ts +5 -18
  373. package/esm/rpc/methods/CoreGetExportData.js +25 -15
  374. package/esm/rpc/methods/CoreGetFeatureDensity.d.ts +11 -0
  375. package/esm/rpc/methods/CoreGetFeatureDensity.js +22 -0
  376. package/esm/rpc/methods/CoreGetFeatures.d.ts +6 -15
  377. package/esm/rpc/methods/CoreGetFeatures.js +14 -18
  378. package/esm/rpc/methods/CoreGetInfo.d.ts +6 -0
  379. package/esm/rpc/methods/CoreGetInfo.js +12 -0
  380. package/esm/rpc/methods/CoreGetMetadata.d.ts +4 -7
  381. package/esm/rpc/methods/CoreGetMetadata.js +6 -9
  382. package/esm/rpc/methods/CoreGetRefNames.d.ts +4 -8
  383. package/esm/rpc/methods/CoreGetRefNames.js +16 -15
  384. package/esm/rpc/methods/CoreGetRegionByteEstimate.d.ts +6 -0
  385. package/esm/rpc/methods/CoreGetRegionByteEstimate.js +19 -0
  386. package/esm/rpc/methods/CoreGetRegions.d.ts +4 -6
  387. package/esm/rpc/methods/CoreGetRegions.js +6 -9
  388. package/esm/rpc/methods/CoreGetSequence.d.ts +4 -11
  389. package/esm/rpc/methods/CoreGetSequence.js +12 -13
  390. package/esm/rpc/methods/CoreLoadAdapterCode.d.ts +13 -0
  391. package/esm/rpc/methods/CoreLoadAdapterCode.js +16 -0
  392. package/esm/rpc/methods/layerFeatures.d.ts +33 -0
  393. package/esm/rpc/methods/layerFeatures.js +29 -0
  394. package/esm/rpc/serializeError/index.d.ts +9 -0
  395. package/esm/rpc/serializeError/index.js +86 -0
  396. package/esm/svg/SvgExport.d.ts +30 -0
  397. package/esm/svg/SvgExport.js +52 -0
  398. package/esm/svg/SvgThemeProviders.d.ts +12 -0
  399. package/esm/svg/SvgThemeProviders.js +15 -0
  400. package/esm/svg/constants.d.ts +1 -0
  401. package/esm/svg/constants.js +5 -0
  402. package/esm/svg/exportViewSvg.d.ts +28 -0
  403. package/esm/svg/exportViewSvg.js +13 -0
  404. package/esm/svg/normalizeSvgMarkup.d.ts +7 -0
  405. package/esm/svg/normalizeSvgMarkup.js +99 -0
  406. package/esm/svg/saveSvgAsImage.d.ts +6 -0
  407. package/esm/svg/saveSvgAsImage.js +90 -0
  408. package/esm/svg/serializeSvg.d.ts +7 -0
  409. package/esm/svg/serializeSvg.js +11 -0
  410. package/esm/svg/svgId.d.ts +42 -0
  411. package/esm/svg/svgId.js +84 -0
  412. package/esm/svg/svgReady.d.ts +138 -0
  413. package/esm/svg/svgReady.js +165 -0
  414. package/esm/svg/trackNames.d.ts +29 -0
  415. package/esm/svg/trackNames.js +34 -0
  416. package/esm/svg/wrapSvgExport.d.ts +12 -0
  417. package/esm/svg/wrapSvgExport.js +10 -0
  418. package/esm/ui/ActionLink.d.ts +7 -0
  419. package/esm/ui/ActionLink.js +9 -0
  420. package/esm/ui/AddCustomPluginDialog.d.ts +14 -0
  421. package/esm/ui/AddCustomPluginDialog.js +56 -0
  422. package/esm/ui/AddGenomePane.d.ts +8 -0
  423. package/esm/ui/AddGenomePane.js +228 -0
  424. package/esm/ui/AdvancedOptions.d.ts +6 -0
  425. package/esm/ui/AdvancedOptions.js +17 -0
  426. package/esm/ui/AppLogo.d.ts +1 -1
  427. package/esm/ui/AppLogo.js +2 -2
  428. package/esm/ui/AppReadyMarker.d.ts +45 -0
  429. package/esm/ui/AppReadyMarker.js +89 -0
  430. package/esm/ui/AssemblySelector.d.ts +5 -8
  431. package/esm/ui/AssemblySelector.js +8 -26
  432. package/esm/ui/BaseExportSvgDialog.d.ts +16 -0
  433. package/esm/ui/BaseExportSvgDialog.js +84 -0
  434. package/esm/ui/BaseTooltip.d.ts +14 -3
  435. package/esm/ui/BaseTooltip.js +151 -34
  436. package/esm/ui/CascadingMenu.d.ts +9 -18
  437. package/esm/ui/CascadingMenu.js +446 -42
  438. package/esm/ui/CascadingMenuButton.d.ts +9 -11
  439. package/esm/ui/CascadingMenuButton.js +36 -18
  440. package/esm/ui/CascadingMenuHelpDialog.d.ts +2 -2
  441. package/esm/ui/CascadingMenuHelpDialog.js +4 -5
  442. package/esm/ui/CascadingMenuHelpIconButton.d.ts +2 -1
  443. package/esm/ui/CascadingMenuHelpIconButton.js +18 -9
  444. package/esm/ui/ColorPicker.d.ts +6 -9
  445. package/esm/ui/ColorPicker.js +36 -39
  446. package/esm/ui/ConfirmDialog.d.ts +2 -9
  447. package/esm/ui/ConfirmDialog.js +6 -9
  448. package/esm/ui/ContextMenu.d.ts +50 -0
  449. package/esm/ui/ContextMenu.js +55 -0
  450. package/esm/ui/CopyToClipboardButton.d.ts +10 -0
  451. package/esm/ui/CopyToClipboardButton.js +14 -0
  452. package/esm/ui/Crosshairs.d.ts +10 -0
  453. package/esm/ui/Crosshairs.js +15 -0
  454. package/esm/ui/DOMPurifySanitizedHTML.d.ts +1 -1
  455. package/esm/ui/DOMPurifySanitizedHTML.js +5 -5
  456. package/esm/ui/DataGridFlexContainer.d.ts +9 -2
  457. package/esm/ui/DataGridFlexContainer.js +4 -3
  458. package/esm/ui/Dialog.d.ts +5 -2
  459. package/esm/ui/Dialog.js +35 -27
  460. package/esm/ui/DraggableDialog.d.ts +3 -3
  461. package/esm/ui/DraggableDialog.js +50 -12
  462. package/esm/ui/DropDownMenu.d.ts +4 -2
  463. package/esm/ui/DropDownMenu.js +6 -5
  464. package/esm/ui/EditableTypography.d.ts +3 -1
  465. package/esm/ui/EditableTypography.js +34 -26
  466. package/esm/ui/ErrorActions.d.ts +24 -0
  467. package/esm/ui/ErrorActions.js +20 -0
  468. package/esm/ui/ErrorBanner.d.ts +7 -0
  469. package/esm/ui/ErrorBanner.js +35 -0
  470. package/esm/ui/ErrorBar.d.ts +6 -0
  471. package/esm/ui/ErrorBar.js +35 -0
  472. package/esm/ui/ErrorBoundary.d.ts +29 -5
  473. package/esm/ui/ErrorBoundary.js +32 -2
  474. package/esm/ui/ErrorMessage.d.ts +2 -4
  475. package/esm/ui/ErrorMessage.js +17 -52
  476. package/esm/ui/ErrorMessageStackTraceContents.d.ts +1 -1
  477. package/esm/ui/ErrorMessageStackTraceContents.js +5 -4
  478. package/esm/ui/ErrorMessageStackTraceDialog.d.ts +1 -1
  479. package/esm/ui/ErrorMessageStackTraceDialog.js +51 -96
  480. package/esm/ui/ErrorOverlay.d.ts +8 -0
  481. package/esm/ui/ErrorOverlay.js +5 -0
  482. package/esm/ui/ExportSvgDialog.d.ts +7 -0
  483. package/esm/ui/ExportSvgDialog.js +9 -0
  484. package/esm/ui/ExternalLink.d.ts +1 -1
  485. package/esm/ui/FactoryResetDialog.d.ts +1 -1
  486. package/esm/ui/FactoryResetDialog.js +6 -15
  487. package/esm/ui/FatalErrorDialog.d.ts +3 -2
  488. package/esm/ui/FatalErrorDialog.js +6 -5
  489. package/esm/ui/FileDropZone.d.ts +25 -0
  490. package/esm/ui/FileDropZone.js +129 -0
  491. package/esm/ui/FileSelector/FileSelector.d.ts +1 -1
  492. package/esm/ui/FileSelector/FileSelector.js +59 -30
  493. package/esm/ui/FileSelector/LocalFileChooser.d.ts +7 -2
  494. package/esm/ui/FileSelector/LocalFileChooser.js +61 -47
  495. package/esm/ui/FileSelector/LocationInput.d.ts +1 -1
  496. package/esm/ui/FileSelector/LocationInput.js +8 -12
  497. package/esm/ui/FileSelector/SourceTypeSelector.d.ts +5 -5
  498. package/esm/ui/FileSelector/SourceTypeSelector.js +9 -7
  499. package/esm/ui/FileSelector/UrlChooser.d.ts +1 -1
  500. package/esm/ui/FileSelector/UrlChooser.js +26 -2
  501. package/esm/ui/FileSelector/emptySourceType.d.ts +2 -0
  502. package/esm/ui/FileSelector/emptySourceType.js +14 -0
  503. package/esm/ui/FileSelector/useInternetAccounts.d.ts +436 -64
  504. package/esm/ui/FileSelector/useInternetAccounts.js +13 -6
  505. package/esm/ui/FileSelector/util.d.ts +58 -3
  506. package/esm/ui/FileSelector/util.js +128 -11
  507. package/esm/ui/GpuFallbackButton.d.ts +12 -0
  508. package/esm/ui/GpuFallbackButton.js +20 -0
  509. package/esm/ui/HoverMenu.d.ts +11 -3
  510. package/esm/ui/HoverMenu.js +34 -9
  511. package/esm/ui/HoverTooltip.d.ts +27 -0
  512. package/esm/ui/HoverTooltip.js +24 -0
  513. package/esm/ui/Icons.d.ts +6 -4
  514. package/esm/ui/Icons.js +9 -0
  515. package/esm/ui/InfoDialog.d.ts +7 -0
  516. package/esm/ui/InfoDialog.js +16 -0
  517. package/esm/ui/InlineMenuControls.d.ts +6 -0
  518. package/esm/ui/InlineMenuControls.js +17 -0
  519. package/esm/ui/JexlFilterDialog.d.ts +26 -0
  520. package/esm/ui/JexlFilterDialog.js +167 -0
  521. package/esm/ui/JexlFilterRowEditors.d.ts +15 -0
  522. package/esm/ui/JexlFilterRowEditors.js +90 -0
  523. package/esm/ui/LabeledCheckbox.d.ts +9 -0
  524. package/esm/ui/LabeledCheckbox.js +7 -0
  525. package/esm/ui/LazyBaseTooltip.d.ts +4 -0
  526. package/esm/ui/LazyBaseTooltip.js +9 -0
  527. package/esm/ui/LegendSwatchGlyph.d.ts +7 -0
  528. package/esm/ui/LegendSwatchGlyph.js +30 -0
  529. package/esm/ui/LoadingDots.d.ts +1 -0
  530. package/esm/ui/LoadingDots.js +30 -0
  531. package/esm/ui/LoadingEllipses.d.ts +17 -1
  532. package/esm/ui/LoadingEllipses.js +20 -29
  533. package/esm/ui/LoadingOverlay.d.ts +23 -0
  534. package/esm/ui/LoadingOverlay.js +139 -0
  535. package/esm/ui/LoadingProgress.d.ts +16 -0
  536. package/esm/ui/LoadingProgress.js +16 -0
  537. package/esm/ui/Logo.d.ts +2 -2
  538. package/esm/ui/Logo.js +23 -24
  539. package/esm/ui/Menu.js +1 -1
  540. package/esm/ui/MenuItemChevron.d.ts +3 -0
  541. package/esm/ui/MenuItemChevron.js +19 -0
  542. package/esm/ui/MenuItemEndDecoration.d.ts +4 -0
  543. package/esm/ui/MenuItemEndDecoration.js +28 -0
  544. package/esm/ui/MenuItemTrailing.d.ts +12 -0
  545. package/esm/ui/MenuItemTrailing.js +42 -0
  546. package/esm/ui/MenuTypes.d.ts +95 -5
  547. package/esm/ui/MenuTypes.js +16 -1
  548. package/esm/ui/MonospaceTextField.d.ts +10 -0
  549. package/esm/ui/MonospaceTextField.js +40 -0
  550. package/esm/ui/NumberTextField.d.ts +31 -0
  551. package/esm/ui/NumberTextField.js +33 -0
  552. package/esm/ui/PaletteContext.d.ts +90 -0
  553. package/esm/ui/PaletteContext.js +142 -0
  554. package/esm/ui/PluggableComponent.d.ts +10 -0
  555. package/esm/ui/PluggableComponent.js +19 -0
  556. package/esm/ui/PluggableComponents.d.ts +29 -0
  557. package/esm/ui/PluggableComponents.js +28 -0
  558. package/esm/ui/PluggableElements.d.ts +23 -0
  559. package/esm/ui/PluggableElements.js +24 -0
  560. package/esm/ui/PluginStoreCard.d.ts +17 -0
  561. package/esm/ui/PluginStoreCard.js +45 -0
  562. package/esm/ui/PopoverPicker.d.ts +6 -0
  563. package/esm/ui/PopoverPicker.js +25 -0
  564. package/esm/ui/PrerenderedCanvas.d.ts +1 -1
  565. package/esm/ui/PrerenderedCanvas.js +5 -4
  566. package/esm/ui/ProgressChip.d.ts +37 -0
  567. package/esm/ui/ProgressChip.js +66 -0
  568. package/esm/ui/RedErrorMessageBox.d.ts +1 -1
  569. package/esm/ui/RedErrorMessageBox.js +9 -3
  570. package/esm/ui/RefNameAutocomplete/EndAdornment.d.ts +5 -0
  571. package/esm/ui/RefNameAutocomplete/EndAdornment.js +31 -0
  572. package/esm/ui/RefNameAutocomplete/HelpDialog.d.ts +3 -0
  573. package/esm/ui/RefNameAutocomplete/HelpDialog.js +7 -0
  574. package/esm/ui/RefNameAutocomplete/SearchOption.d.ts +13 -0
  575. package/esm/ui/RefNameAutocomplete/SearchOption.js +45 -0
  576. package/esm/ui/RefNameAutocomplete/index.d.ts +21 -0
  577. package/esm/ui/RefNameAutocomplete/index.js +84 -0
  578. package/esm/ui/RefNameAutocomplete/util.d.ts +62 -0
  579. package/esm/ui/RefNameAutocomplete/util.js +209 -0
  580. package/esm/ui/ReplaceCurrentViewButton.d.ts +19 -0
  581. package/esm/ui/ReplaceCurrentViewButton.js +22 -0
  582. package/esm/ui/ResizeHandle.d.ts +15 -7
  583. package/esm/ui/ResizeHandle.js +73 -53
  584. package/esm/ui/ReturnToImportFormDialog.d.ts +1 -1
  585. package/esm/ui/ReturnToImportFormDialog.js +7 -9
  586. package/esm/ui/SanitizedHTML.d.ts +6 -1
  587. package/esm/ui/SanitizedHTML.js +7 -47
  588. package/esm/ui/ScrollChrome.d.ts +13 -0
  589. package/esm/ui/ScrollChrome.js +11 -0
  590. package/esm/ui/ScrollEdgeShadow.d.ts +41 -0
  591. package/esm/ui/ScrollEdgeShadow.js +77 -0
  592. package/esm/ui/ScrollZoomToggle.d.ts +15 -0
  593. package/esm/ui/ScrollZoomToggle.js +75 -0
  594. package/esm/ui/SequenceAdapterInputs.d.ts +9 -0
  595. package/esm/ui/SequenceAdapterInputs.js +30 -0
  596. package/esm/ui/SessionJsonPanel.d.ts +3 -0
  597. package/esm/ui/SessionJsonPanel.js +14 -0
  598. package/esm/ui/SettingsChangesTable.d.ts +15 -0
  599. package/esm/ui/SettingsChangesTable.js +87 -0
  600. package/esm/ui/ShareLinkField.d.ts +4 -0
  601. package/esm/ui/ShareLinkField.js +15 -0
  602. package/esm/ui/SingleSlider.d.ts +8 -0
  603. package/esm/ui/SingleSlider.js +11 -0
  604. package/esm/ui/SizeSliderRow.d.ts +14 -0
  605. package/esm/ui/SizeSliderRow.js +48 -0
  606. package/esm/ui/SliderTooltip.d.ts +2 -0
  607. package/esm/ui/SliderTooltip.js +17 -0
  608. package/esm/ui/Snackbar.d.ts +4 -2
  609. package/esm/ui/Snackbar.js +11 -8
  610. package/esm/ui/SnackbarContents.d.ts +1 -1
  611. package/esm/ui/SnackbarContents.js +21 -3
  612. package/esm/ui/SnackbarModel.d.ts +40 -0
  613. package/esm/ui/SnackbarModel.js +96 -52
  614. package/esm/ui/StackTraceButton.d.ts +5 -0
  615. package/esm/ui/StackTraceButton.js +16 -0
  616. package/esm/ui/StatusProgressBar.d.ts +37 -0
  617. package/esm/ui/StatusProgressBar.js +76 -0
  618. package/esm/ui/SubmitDialog.d.ts +6 -0
  619. package/esm/ui/SubmitDialog.js +9 -0
  620. package/esm/ui/SubmitForm.d.ts +23 -0
  621. package/esm/ui/SubmitForm.js +23 -0
  622. package/esm/ui/SvgColorLegend.d.ts +18 -0
  623. package/esm/ui/SvgColorLegend.js +106 -0
  624. package/esm/ui/TagTextField.d.ts +40 -0
  625. package/esm/ui/TagTextField.js +32 -0
  626. package/esm/ui/VerticalScrollbar.d.ts +24 -0
  627. package/esm/ui/VerticalScrollbar.js +104 -0
  628. package/esm/ui/ViewLoadingScreen.d.ts +25 -0
  629. package/esm/ui/ViewLoadingScreen.js +52 -0
  630. package/esm/ui/addExtensionElement.d.ts +18 -0
  631. package/esm/ui/addExtensionElement.js +23 -0
  632. package/esm/ui/buildExtraTrackMenuItems.d.ts +22 -0
  633. package/esm/ui/buildExtraTrackMenuItems.js +14 -0
  634. package/esm/ui/colorScale.d.ts +92 -0
  635. package/esm/ui/colorScale.js +72 -0
  636. package/esm/ui/colorSwatchStyle.d.ts +9 -0
  637. package/esm/ui/colorSwatchStyle.js +11 -0
  638. package/esm/ui/colors.d.ts +125 -8
  639. package/esm/ui/colors.js +364 -1
  640. package/esm/ui/extensionSelectors.d.ts +38 -0
  641. package/esm/ui/extensionSelectors.js +49 -0
  642. package/esm/ui/filterMenuItems.d.ts +112 -0
  643. package/esm/ui/filterMenuItems.js +86 -0
  644. package/esm/ui/formatErrorStack.d.ts +1 -0
  645. package/esm/ui/formatErrorStack.js +56 -0
  646. package/esm/ui/gpuFallback.d.ts +33 -0
  647. package/esm/ui/gpuFallback.js +39 -0
  648. package/esm/ui/hoverBoxStyle.d.ts +23 -0
  649. package/esm/ui/hoverBoxStyle.js +28 -0
  650. package/esm/ui/index.d.ts +77 -5
  651. package/esm/ui/index.js +83 -20
  652. package/esm/ui/inlineMenuRowWidth.d.ts +1 -0
  653. package/esm/ui/inlineMenuRowWidth.js +8 -0
  654. package/esm/ui/launchTargetsMenuItem.d.ts +18 -0
  655. package/esm/ui/launchTargetsMenuItem.js +24 -0
  656. package/esm/ui/launchViewMenu.d.ts +4 -0
  657. package/esm/ui/launchViewMenu.js +46 -0
  658. package/esm/ui/legendMenuItem.d.ts +16 -0
  659. package/esm/ui/legendMenuItem.js +17 -0
  660. package/esm/ui/legendSpec.d.ts +69 -0
  661. package/esm/ui/legendSpec.js +69 -0
  662. package/esm/ui/loadingDotKeyframes.d.ts +18 -0
  663. package/esm/ui/loadingDotKeyframes.js +17 -0
  664. package/esm/ui/makeSizeMenu.d.ts +24 -0
  665. package/esm/ui/makeSizeMenu.js +58 -0
  666. package/esm/ui/mapStackTrace.d.ts +8 -0
  667. package/esm/ui/mapStackTrace.js +108 -0
  668. package/esm/ui/measureLegendText.d.ts +1 -0
  669. package/esm/ui/measureLegendText.js +8 -0
  670. package/esm/ui/menuItemAdornment.d.ts +22 -0
  671. package/esm/ui/menuItemAdornment.js +28 -0
  672. package/esm/ui/menuItems.d.ts +23 -0
  673. package/esm/ui/menuItems.js +21 -0
  674. package/esm/ui/menuLabels.d.ts +41 -0
  675. package/esm/ui/menuLabels.js +43 -0
  676. package/esm/ui/multiTrackMenuItems.d.ts +25 -0
  677. package/esm/ui/multiTrackMenuItems.js +15 -0
  678. package/esm/ui/palette.d.ts +561 -0
  679. package/esm/ui/palette.js +785 -0
  680. package/esm/ui/parseError.d.ts +4 -0
  681. package/esm/ui/parseError.js +18 -0
  682. package/esm/ui/persistentScrollbarStyle.d.ts +49 -0
  683. package/esm/ui/persistentScrollbarStyle.js +53 -0
  684. package/esm/ui/radioSubMenu.d.ts +33 -0
  685. package/esm/ui/radioSubMenu.js +32 -0
  686. package/esm/ui/react-colorful.js +5 -1
  687. package/esm/ui/replaceViewAction.d.ts +31 -0
  688. package/esm/ui/replaceViewAction.js +39 -0
  689. package/esm/ui/rewriteExternalAnchors.d.ts +1 -0
  690. package/esm/ui/rewriteExternalAnchors.js +8 -0
  691. package/esm/ui/scrollZoomLabels.d.ts +17 -0
  692. package/esm/ui/scrollZoomLabels.js +22 -0
  693. package/esm/ui/showSubMenu.d.ts +19 -0
  694. package/esm/ui/showSubMenu.js +30 -0
  695. package/esm/ui/sliderScale.d.ts +6 -0
  696. package/esm/ui/sliderScale.js +30 -0
  697. package/esm/ui/statusProgressKeyframes.d.ts +6 -0
  698. package/esm/ui/statusProgressKeyframes.js +14 -0
  699. package/esm/ui/stripStackTraceMessage.d.ts +1 -0
  700. package/esm/ui/stripStackTraceMessage.js +9 -0
  701. package/esm/ui/styleTheme.d.ts +158 -0
  702. package/esm/ui/styleTheme.js +115 -0
  703. package/esm/ui/submenuAim.d.ts +30 -0
  704. package/esm/ui/submenuAim.js +37 -0
  705. package/esm/ui/theme.d.ts +268 -30
  706. package/esm/ui/theme.js +250 -350
  707. package/esm/ui/toggleMenuItems.d.ts +42 -0
  708. package/esm/ui/toggleMenuItems.js +61 -0
  709. package/esm/ui/useAssemblySelection.d.ts +153 -0
  710. package/esm/ui/useAssemblySelection.js +54 -0
  711. package/esm/ui/useCoalescedPointer.d.ts +36 -0
  712. package/esm/ui/useCoalescedPointer.js +60 -0
  713. package/esm/ui/useCopyToClipboard.d.ts +15 -0
  714. package/esm/ui/useCopyToClipboard.js +41 -0
  715. package/esm/ui/useExportSvgPreference.d.ts +1 -0
  716. package/esm/ui/useExportSvgPreference.js +4 -0
  717. package/esm/ui/useMouseTracking.d.ts +71 -0
  718. package/esm/ui/useMouseTracking.js +179 -0
  719. package/esm/ui/useRecentLocations.d.ts +28 -0
  720. package/esm/ui/useRecentLocations.js +31 -0
  721. package/esm/ui/viewHeaderHeight.d.ts +1 -0
  722. package/esm/ui/viewHeaderHeight.js +1 -0
  723. package/esm/ui/wrapComponent.d.ts +47 -0
  724. package/esm/ui/wrapComponent.js +58 -0
  725. package/esm/ui/zIndexes.d.ts +28 -0
  726. package/esm/ui/zIndexes.js +38 -0
  727. package/esm/util/Base1DUtils.d.ts +207 -17
  728. package/esm/util/Base1DUtils.js +316 -173
  729. package/esm/util/Base1DViewModel.d.ts +99 -21
  730. package/esm/util/Base1DViewModel.js +151 -41
  731. package/esm/util/FileSaver/index.d.ts +1 -0
  732. package/esm/util/FileSaver/index.js +27 -0
  733. package/esm/util/IntervalTree.d.ts +18 -39
  734. package/esm/util/IntervalTree.js +63 -244
  735. package/esm/util/SvgCanvas.d.ts +83 -0
  736. package/esm/util/SvgCanvas.js +520 -0
  737. package/esm/util/TimeTraveller.d.ts +12 -0
  738. package/esm/util/TimeTraveller.js +130 -27
  739. package/esm/util/aborting.d.ts +56 -4
  740. package/esm/util/aborting.js +112 -25
  741. package/esm/util/adapterMetadata.d.ts +20 -0
  742. package/esm/util/adapterMetadata.js +40 -0
  743. package/esm/util/addAndShowTrack.d.ts +19 -0
  744. package/esm/util/addAndShowTrack.js +27 -0
  745. package/esm/util/addRelativeUris.d.ts +29 -0
  746. package/esm/util/addRelativeUris.js +78 -0
  747. package/esm/util/addTrackComponent.d.ts +72 -0
  748. package/esm/util/addTrackComponent.js +53 -0
  749. package/esm/util/addTrackFromWidget.d.ts +91 -0
  750. package/esm/util/addTrackFromWidget.js +91 -0
  751. package/esm/util/aggregateFieldName.d.ts +10 -0
  752. package/esm/util/aggregateFieldName.js +8 -0
  753. package/esm/util/analytics.d.ts +32 -3
  754. package/esm/util/analytics.js +135 -49
  755. package/esm/util/animationAllowed.d.ts +26 -0
  756. package/esm/util/animationAllowed.js +35 -0
  757. package/esm/util/applyRowResizeWheel.d.ts +15 -0
  758. package/esm/util/applyRowResizeWheel.js +23 -0
  759. package/esm/util/assemblyConfigUtils.d.ts +144 -0
  760. package/esm/util/assemblyConfigUtils.js +498 -0
  761. package/esm/util/bandHeight.d.ts +63 -0
  762. package/esm/util/bandHeight.js +85 -0
  763. package/esm/util/bandLayout.d.ts +51 -0
  764. package/esm/util/bandLayout.js +36 -0
  765. package/esm/util/bezierConnector.d.ts +15 -0
  766. package/esm/util/bezierConnector.js +101 -0
  767. package/esm/util/bgzfWorkerPool.d.ts +24 -0
  768. package/esm/util/bgzfWorkerPool.js +27 -0
  769. package/esm/util/binnedAggregate.d.ts +17 -0
  770. package/esm/util/binnedAggregate.js +275 -0
  771. package/esm/util/blockTypes.d.ts +64 -45
  772. package/esm/util/blockTypes.js +67 -74
  773. package/esm/util/bpUtils.d.ts +81 -0
  774. package/esm/util/bpUtils.js +103 -0
  775. package/esm/util/cacheBudgets.d.ts +55 -0
  776. package/esm/util/cacheBudgets.js +55 -0
  777. package/esm/util/cachedSetup.d.ts +51 -0
  778. package/esm/util/cachedSetup.js +87 -0
  779. package/esm/util/calculateDynamicBlocks.d.ts +5 -0
  780. package/esm/util/calculateDynamicBlocks.js +85 -82
  781. package/esm/util/calculateStaticBlocks.d.ts +2 -3
  782. package/esm/util/calculateStaticBlocks.js +48 -71
  783. package/esm/util/categoricalField.d.ts +56 -0
  784. package/esm/util/categoricalField.js +73 -0
  785. package/esm/util/chooseGridPitch.d.ts +9 -0
  786. package/esm/util/chooseGridPitch.js +31 -0
  787. package/esm/util/clampToContig.d.ts +43 -0
  788. package/esm/util/clampToContig.js +47 -0
  789. package/esm/util/cmpStr.d.ts +1 -0
  790. package/esm/util/cmpStr.js +7 -0
  791. package/esm/util/coarseStripHTML.js +2 -15
  792. package/esm/util/color/cssColorsLevel4.d.ts +1 -0
  793. package/esm/util/color/cssColorsLevel4.js +7 -2
  794. package/esm/util/color/index.d.ts +84 -3
  795. package/esm/util/color/index.js +197 -25
  796. package/esm/util/color-bits/bit.d.ts +4 -0
  797. package/esm/util/color-bits/bit.js +37 -0
  798. package/esm/util/color-bits/convert.d.ts +23 -0
  799. package/esm/util/color-bits/convert.js +294 -0
  800. package/esm/util/color-bits/core.d.ts +34 -0
  801. package/esm/util/color-bits/core.js +67 -0
  802. package/esm/util/color-bits/format.d.ts +24 -0
  803. package/esm/util/color-bits/format.js +82 -0
  804. package/esm/util/color-bits/functions.d.ts +33 -0
  805. package/esm/util/color-bits/functions.js +70 -0
  806. package/esm/util/color-bits/index.d.ts +5 -0
  807. package/esm/util/color-bits/index.js +4 -0
  808. package/esm/util/color-bits/parse.d.ts +17 -0
  809. package/esm/util/color-bits/parse.js +382 -0
  810. package/esm/util/colorBits.d.ts +39 -0
  811. package/esm/util/colorBits.js +155 -0
  812. package/esm/util/colorRamp.d.ts +81 -0
  813. package/esm/util/colorRamp.js +244 -0
  814. package/esm/util/colorScale.d.ts +156 -0
  815. package/esm/util/colorScale.js +243 -0
  816. package/esm/util/colorSchemes.d.ts +21 -0
  817. package/esm/util/colorSchemes.js +30 -0
  818. package/esm/util/colord.d.ts +8 -0
  819. package/esm/util/colord.js +43 -191
  820. package/esm/util/convertCodingSequenceToPeptides.d.ts +17 -3
  821. package/esm/util/convertCodingSequenceToPeptides.js +51 -4
  822. package/esm/util/copyText.d.ts +18 -0
  823. package/esm/util/copyText.js +30 -0
  824. package/esm/util/copyToClipboard.d.ts +4 -0
  825. package/esm/util/copyToClipboard.js +58 -0
  826. package/esm/util/createAbortRotation.d.ts +115 -0
  827. package/esm/util/createAbortRotation.js +116 -0
  828. package/esm/util/createSvgRasterCanvas.d.ts +17 -0
  829. package/esm/util/createSvgRasterCanvas.js +22 -0
  830. package/esm/util/crypto.d.ts +24 -0
  831. package/esm/util/crypto.js +85 -2
  832. package/esm/util/cssColorParse.d.ts +15 -0
  833. package/esm/util/cssColorParse.js +53 -0
  834. package/esm/util/dataGridUtils.d.ts +9 -0
  835. package/esm/util/dataGridUtils.js +36 -0
  836. package/esm/util/dedupe.js +1 -0
  837. package/esm/util/deepEqual.d.ts +8 -0
  838. package/esm/util/deepEqual.js +22 -0
  839. package/esm/util/deepMerge.d.ts +20 -0
  840. package/esm/util/deepMerge.js +44 -0
  841. package/esm/util/diagonalizeRegions.d.ts +22 -0
  842. package/esm/util/diagonalizeRegions.js +187 -0
  843. package/esm/util/environment.d.ts +4 -0
  844. package/esm/util/environment.js +43 -0
  845. package/esm/util/eventPoint.d.ts +32 -0
  846. package/esm/util/eventPoint.js +28 -0
  847. package/esm/util/expandLooseSearchIndex.d.ts +19 -0
  848. package/esm/util/expandLooseSearchIndex.js +29 -0
  849. package/esm/util/featureTable.d.ts +224 -0
  850. package/esm/util/featureTable.js +366 -0
  851. package/esm/util/featureTransforms.d.ts +80 -0
  852. package/esm/util/featureTransforms.js +1579 -0
  853. package/esm/util/featureTypes.d.ts +24 -0
  854. package/esm/util/featureTypes.js +35 -0
  855. package/esm/util/fetchAndMaybeUnzip.d.ts +6 -0
  856. package/esm/util/fetchAndMaybeUnzip.js +71 -0
  857. package/esm/util/fetchContext.d.ts +81 -0
  858. package/esm/util/fetchContext.js +59 -0
  859. package/esm/util/fetchHub.d.ts +17 -0
  860. package/esm/util/fetchHub.js +31 -0
  861. package/esm/util/fetchJson.d.ts +1 -0
  862. package/esm/util/fetchJson.js +7 -0
  863. package/esm/util/fetchPhases.d.ts +77 -0
  864. package/esm/util/fetchPhases.js +1 -0
  865. package/esm/util/fetchSeq.d.ts +4 -1
  866. package/esm/util/fetchSeq.js +18 -6
  867. package/esm/util/fieldReader.d.ts +17 -0
  868. package/esm/util/fieldReader.js +62 -0
  869. package/esm/util/fileHandleStore.d.ts +19 -2
  870. package/esm/util/fileHandleStore.js +95 -35
  871. package/esm/util/flatbush/index.d.ts +27 -6
  872. package/esm/util/flatbush/index.js +194 -218
  873. package/esm/util/formatBytes.d.ts +9 -0
  874. package/esm/util/formatBytes.js +18 -0
  875. package/esm/util/formatFastaStrings.d.ts +13 -0
  876. package/esm/util/formatFastaStrings.js +13 -0
  877. package/esm/util/formatGuessers.d.ts +30 -0
  878. package/esm/util/formatGuessers.js +69 -0
  879. package/esm/util/formatRelativeTime.d.ts +1 -0
  880. package/esm/util/formatRelativeTime.js +25 -0
  881. package/esm/util/frameCoalescer.d.ts +30 -0
  882. package/esm/util/frameCoalescer.js +22 -0
  883. package/esm/util/freezeDeep.d.ts +26 -0
  884. package/esm/util/freezeDeep.js +39 -0
  885. package/esm/util/geneticCodes.d.ts +56 -0
  886. package/esm/util/geneticCodes.js +371 -0
  887. package/esm/util/getFileName.d.ts +11 -0
  888. package/esm/util/getFileName.js +34 -0
  889. package/esm/util/getLocationUri.d.ts +49 -0
  890. package/esm/util/getLocationUri.js +63 -0
  891. package/esm/util/getRelativeX.d.ts +4 -0
  892. package/esm/util/getRelativeX.js +7 -0
  893. package/esm/util/getStr.d.ts +6 -0
  894. package/esm/util/getStr.js +15 -0
  895. package/esm/util/groupKeys.d.ts +77 -0
  896. package/esm/util/groupKeys.js +155 -0
  897. package/esm/util/highlights.d.ts +25 -0
  898. package/esm/util/highlights.js +87 -0
  899. package/esm/util/hooks.d.ts +189 -0
  900. package/esm/util/hooks.js +485 -0
  901. package/esm/util/htmlText.d.ts +13 -0
  902. package/esm/util/htmlText.js +66 -0
  903. package/esm/util/idMaker.d.ts +1 -1
  904. package/esm/util/idMaker.js +31 -18
  905. package/esm/util/index.d.ts +82 -268
  906. package/esm/util/index.js +137 -853
  907. package/esm/util/indexCandidates.d.ts +20 -0
  908. package/esm/util/indexCandidates.js +43 -0
  909. package/esm/util/installClearHoverOnSurfaceMove.d.ts +40 -0
  910. package/esm/util/installClearHoverOnSurfaceMove.js +41 -0
  911. package/esm/util/installFetch.d.ts +234 -0
  912. package/esm/util/installFetch.js +205 -0
  913. package/esm/util/installInitAutorun.d.ts +63 -0
  914. package/esm/util/installInitAutorun.js +107 -0
  915. package/esm/util/installPrerequisiteFetch.d.ts +115 -0
  916. package/esm/util/installPrerequisiteFetch.js +111 -0
  917. package/esm/util/intervals.d.ts +20 -0
  918. package/esm/util/intervals.js +37 -0
  919. package/esm/util/io/RemoteFileWithRangeCache.d.ts +10 -11
  920. package/esm/util/io/RemoteFileWithRangeCache.js +10 -148
  921. package/esm/util/io/index.d.ts +39 -2
  922. package/esm/util/io/index.js +120 -12
  923. package/esm/util/isDataCurrent.d.ts +9 -0
  924. package/esm/util/isDataCurrent.js +12 -0
  925. package/esm/util/isTextEntryFocused.d.ts +7 -0
  926. package/esm/util/isTextEntryFocused.js +16 -0
  927. package/esm/util/isWebWorker.js +1 -2
  928. package/esm/util/iupac.d.ts +4 -0
  929. package/esm/util/iupac.js +59 -0
  930. package/esm/util/jexl.js +146 -19
  931. package/esm/util/jexlFilterRows.d.ts +89 -0
  932. package/esm/util/jexlFilterRows.js +252 -0
  933. package/esm/util/jexlFilters.d.ts +68 -0
  934. package/esm/util/jexlFilters.js +61 -0
  935. package/esm/util/jexlStrings.d.ts +21 -1
  936. package/esm/util/jexlStrings.js +20 -14
  937. package/esm/util/layouts/GranularRectLayout.d.ts +20 -25
  938. package/esm/util/layouts/GranularRectLayout.js +116 -356
  939. package/esm/util/layouts/index.d.ts +1 -7
  940. package/esm/util/layouts/index.js +2 -6
  941. package/esm/util/layouts/intervalUtils.d.ts +12 -1
  942. package/esm/util/layouts/intervalUtils.js +13 -31
  943. package/esm/util/layouts/placeRect.d.ts +50 -0
  944. package/esm/util/layouts/placeRect.js +97 -0
  945. package/esm/util/lazyAfterAttach.d.ts +13 -0
  946. package/esm/util/lazyAfterAttach.js +31 -0
  947. package/esm/util/lazyWithPreload.d.ts +19 -0
  948. package/esm/util/lazyWithPreload.js +27 -0
  949. package/esm/util/leadingEdgeAutorun.d.ts +40 -0
  950. package/esm/util/leadingEdgeAutorun.js +51 -0
  951. package/esm/util/legendCandidates.d.ts +72 -0
  952. package/esm/util/legendCandidates.js +138 -0
  953. package/esm/util/librpc.d.ts +5 -2
  954. package/esm/util/librpc.js +6 -1
  955. package/esm/util/linkify.js +2 -0
  956. package/esm/util/locString.d.ts +72 -0
  957. package/esm/util/locString.js +178 -7
  958. package/esm/util/locStringsToRegions.d.ts +10 -0
  959. package/esm/util/locStringsToRegions.js +35 -0
  960. package/esm/util/localStorage.d.ts +36 -0
  961. package/esm/util/localStorage.js +137 -0
  962. package/esm/util/makeAssembly.d.ts +54 -0
  963. package/esm/util/makeAssembly.js +52 -0
  964. package/esm/util/makeTrackId.d.ts +14 -0
  965. package/esm/util/makeTrackId.js +14 -0
  966. package/esm/util/markEncoding.d.ts +150 -0
  967. package/esm/util/markEncoding.js +845 -0
  968. package/esm/util/markEncodingTypes.d.ts +588 -0
  969. package/esm/util/markEncodingTypes.js +8 -0
  970. package/esm/util/matchTrackId.d.ts +11 -0
  971. package/esm/util/matchTrackId.js +14 -0
  972. package/esm/util/measureText.d.ts +24 -0
  973. package/esm/util/measureText.js +51 -0
  974. package/esm/util/mst-reflection.d.ts +3 -11
  975. package/esm/util/mst-reflection.js +3 -52
  976. package/esm/util/mstUtils.d.ts +97 -0
  977. package/esm/util/mstUtils.js +137 -0
  978. package/esm/util/nanoid.d.ts +0 -4
  979. package/esm/util/nanoid.js +10 -20
  980. package/esm/util/numericUtils.d.ts +27 -0
  981. package/esm/util/numericUtils.js +143 -0
  982. package/esm/util/numericValue.d.ts +14 -0
  983. package/esm/util/numericValue.js +34 -0
  984. package/esm/util/objectUtils.d.ts +2 -0
  985. package/esm/util/objectUtils.js +9 -0
  986. package/esm/util/offscreenCanvasPonyfill.d.ts +5 -4
  987. package/esm/util/offscreenCanvasPonyfill.js +5 -47
  988. package/esm/util/openFeatureWidget.d.ts +38 -0
  989. package/esm/util/openFeatureWidget.js +64 -0
  990. package/esm/util/openViews.d.ts +17 -0
  991. package/esm/util/openViews.js +22 -0
  992. package/esm/util/paintLayer.d.ts +32 -0
  993. package/esm/util/paintLayer.js +33 -0
  994. package/esm/util/parentWalk.d.ts +32 -0
  995. package/esm/util/parentWalk.js +84 -0
  996. package/esm/util/parseLineByLine.d.ts +44 -2
  997. package/esm/util/parseLineByLine.js +150 -15
  998. package/esm/util/parseMotifList.d.ts +17 -0
  999. package/esm/util/parseMotifList.js +69 -0
  1000. package/esm/util/pluginStore.d.ts +111 -0
  1001. package/esm/util/pluginStore.js +254 -0
  1002. package/esm/util/pointerPresence.d.ts +5 -0
  1003. package/esm/util/pointerPresence.js +21 -0
  1004. package/esm/util/preloadComponent.d.ts +5 -0
  1005. package/esm/util/preloadComponent.js +11 -0
  1006. package/esm/util/progress.d.ts +459 -0
  1007. package/esm/util/progress.js +821 -0
  1008. package/esm/util/quantileExtent.d.ts +49 -0
  1009. package/esm/util/quantileExtent.js +162 -0
  1010. package/esm/util/range.d.ts +46 -1
  1011. package/esm/util/range.js +68 -2
  1012. package/esm/util/renameRegions.d.ts +41 -0
  1013. package/esm/util/renameRegions.js +143 -0
  1014. package/esm/util/renderToStaticMarkup.d.ts +2 -0
  1015. package/esm/util/renderToStaticMarkup.js +60 -0
  1016. package/esm/util/reorder.d.ts +35 -0
  1017. package/esm/util/reorder.js +83 -0
  1018. package/esm/util/resolveRowHeight.d.ts +27 -0
  1019. package/esm/util/resolveRowHeight.js +30 -0
  1020. package/esm/util/revlist.d.ts +13 -0
  1021. package/esm/util/revlist.js +14 -0
  1022. package/esm/util/rowStackGeometry.d.ts +66 -0
  1023. package/esm/util/rowStackGeometry.js +70 -0
  1024. package/esm/util/rpc.d.ts +16 -1
  1025. package/esm/util/rpc.js +12 -1
  1026. package/esm/util/rxjs.d.ts +30 -2
  1027. package/esm/util/rxjs.js +85 -10
  1028. package/esm/util/sameStrings.d.ts +16 -0
  1029. package/esm/util/sameStrings.js +20 -0
  1030. package/esm/util/samplesTsv.d.ts +49 -0
  1031. package/esm/util/samplesTsv.js +86 -0
  1032. package/esm/util/scheduleDetachedDestroy.d.ts +18 -0
  1033. package/esm/util/scheduleDetachedDestroy.js +24 -0
  1034. package/esm/util/scrollLatch.d.ts +5 -0
  1035. package/esm/util/scrollLatch.js +67 -0
  1036. package/esm/util/selectEncodedFeature.d.ts +16 -0
  1037. package/esm/util/selectEncodedFeature.js +34 -0
  1038. package/esm/util/selectNamedRegions.d.ts +136 -0
  1039. package/esm/util/selectNamedRegions.js +222 -0
  1040. package/esm/util/seqUtils.d.ts +17 -0
  1041. package/esm/util/seqUtils.js +80 -0
  1042. package/esm/util/sessionServices.d.ts +29 -0
  1043. package/esm/util/sessionServices.js +46 -0
  1044. package/esm/util/sessionSharing.d.ts +40 -0
  1045. package/esm/util/sessionSharing.js +154 -0
  1046. package/esm/util/sessionStorage.d.ts +1 -0
  1047. package/esm/util/sessionStorage.js +15 -0
  1048. package/esm/util/setStackTraceLimit.d.ts +6 -0
  1049. package/esm/util/setStackTraceLimit.js +20 -0
  1050. package/esm/util/shapeNameList.d.ts +2 -0
  1051. package/esm/util/shapeNameList.js +6 -0
  1052. package/esm/util/shapeNames.d.ts +7 -0
  1053. package/esm/util/shapeNames.js +11 -0
  1054. package/esm/util/simpleFeature.d.ts +111 -4
  1055. package/esm/util/simpleFeature.js +181 -29
  1056. package/esm/util/springAnimate.d.ts +20 -0
  1057. package/esm/util/springAnimate.js +80 -0
  1058. package/esm/util/starFusion.d.ts +26 -0
  1059. package/esm/util/starFusion.js +37 -0
  1060. package/esm/util/stats.d.ts +25 -2
  1061. package/esm/util/stats.js +39 -8
  1062. package/esm/util/stepTables.d.ts +82 -0
  1063. package/esm/util/stepTables.js +243 -0
  1064. package/esm/util/stringUtils.d.ts +5 -0
  1065. package/esm/util/stringUtils.js +34 -0
  1066. package/esm/util/svAlt.d.ts +145 -0
  1067. package/esm/util/svAlt.js +364 -0
  1068. package/esm/util/svgColorProps.d.ts +18 -0
  1069. package/esm/util/svgColorProps.js +55 -0
  1070. package/esm/util/systemColorScheme.d.ts +12 -0
  1071. package/esm/util/systemColorScheme.js +27 -0
  1072. package/esm/util/tabix.d.ts +125 -0
  1073. package/esm/util/tabix.js +148 -0
  1074. package/esm/util/tags.d.ts +2 -0
  1075. package/esm/util/tags.js +5 -0
  1076. package/esm/util/temporaryAssembly.d.ts +21 -0
  1077. package/esm/util/temporaryAssembly.js +29 -0
  1078. package/esm/util/thresholdScale.d.ts +91 -0
  1079. package/esm/util/thresholdScale.js +166 -0
  1080. package/esm/util/tickLabels.d.ts +36 -0
  1081. package/esm/util/tickLabels.js +45 -0
  1082. package/esm/util/timeGate.d.ts +25 -0
  1083. package/esm/util/timeGate.js +78 -0
  1084. package/esm/util/trackConfigDelta.d.ts +84 -0
  1085. package/esm/util/trackConfigDelta.js +206 -0
  1086. package/esm/util/tracks.d.ts +431 -30
  1087. package/esm/util/tracks.js +952 -185
  1088. package/esm/util/translateTranscript.d.ts +44 -0
  1089. package/esm/util/translateTranscript.js +102 -0
  1090. package/esm/util/tss-react/cssAndCx.js +11 -66
  1091. package/esm/util/tss-react/index.d.ts +11 -2
  1092. package/esm/util/tss-react/index.js +9 -2
  1093. package/esm/util/tss-react/makeStyles.js +7 -4
  1094. package/esm/util/tss-react/mergeClasses.js +1 -0
  1095. package/esm/util/tss-react/tools/classnames.d.ts +3 -0
  1096. package/esm/util/tss-react/tools/classnames.js +3 -0
  1097. package/esm/util/tss-react/tools/getDependencyArrayRef.d.ts +18 -0
  1098. package/esm/util/tss-react/tools/getDependencyArrayRef.js +19 -0
  1099. package/esm/util/tss-react/types.d.ts +1 -1
  1100. package/esm/util/tss-react/types.js +1 -6
  1101. package/esm/util/types/ElementId.js +1 -1
  1102. package/esm/util/types/data.d.ts +73 -0
  1103. package/esm/util/types/data.js +41 -0
  1104. package/esm/util/types/index.d.ts +459 -121
  1105. package/esm/util/types/index.js +96 -64
  1106. package/esm/util/types/isAny.d.ts +11 -0
  1107. package/esm/util/types/isAny.js +1 -0
  1108. package/esm/util/types/mst.d.ts +74 -47
  1109. package/esm/util/types/mst.js +31 -22
  1110. package/esm/util/types/predicate.d.ts +9 -0
  1111. package/esm/util/types/predicate.js +1 -0
  1112. package/esm/util/types/renameIds.d.ts +1 -0
  1113. package/esm/util/types/renameIds.js +29 -0
  1114. package/esm/util/types/renderingServices.d.ts +16 -0
  1115. package/esm/util/types/renderingServices.js +1 -0
  1116. package/esm/util/types/services.d.ts +55 -0
  1117. package/esm/util/types/services.js +10 -0
  1118. package/esm/util/types/util.d.ts +8 -2
  1119. package/esm/util/unknownSnapshotKeys.d.ts +51 -0
  1120. package/esm/util/unknownSnapshotKeys.js +82 -0
  1121. package/esm/util/unzip.d.ts +1 -0
  1122. package/esm/util/unzip.js +6 -0
  1123. package/esm/util/useEventCallback.d.ts +1 -0
  1124. package/esm/util/useEventCallback.js +16 -0
  1125. package/esm/util/useFeatureSequence.d.ts +13 -7
  1126. package/esm/util/useFeatureSequence.js +55 -77
  1127. package/esm/util/useFetch.d.ts +55 -0
  1128. package/esm/util/useFetch.js +197 -0
  1129. package/esm/util/useFetchPlugins.d.ts +16 -0
  1130. package/esm/util/useFetchPlugins.js +18 -0
  1131. package/esm/util/useMeasure.d.ts +11 -1
  1132. package/esm/util/useMeasure.js +20 -6
  1133. package/esm/util/usePanZoom.d.ts +75 -0
  1134. package/esm/util/usePanZoom.js +175 -0
  1135. package/esm/util/usePanelVirtualScroll.d.ts +9 -0
  1136. package/esm/util/usePanelVirtualScroll.js +15 -0
  1137. package/esm/util/usePointerDrag.d.ts +37 -0
  1138. package/esm/util/usePointerDrag.js +61 -0
  1139. package/esm/util/useRafCommit.d.ts +4 -0
  1140. package/esm/util/useRafCommit.js +50 -0
  1141. package/esm/util/useResizeDrag.d.ts +91 -0
  1142. package/esm/util/useResizeDrag.js +105 -0
  1143. package/esm/util/useRowVirtualScroll.d.ts +9 -0
  1144. package/esm/util/useRowVirtualScroll.js +22 -0
  1145. package/esm/util/useVirtualScrollWheel.d.ts +23 -0
  1146. package/esm/util/useVirtualScrollWheel.js +74 -0
  1147. package/esm/util/viewHighlights.d.ts +3 -0
  1148. package/esm/util/viewHighlights.js +5 -0
  1149. package/esm/util/viewStatus.d.ts +90 -0
  1150. package/esm/util/viewStatus.js +54 -0
  1151. package/esm/util/virtualRange.d.ts +36 -0
  1152. package/esm/util/virtualRange.js +26 -0
  1153. package/esm/util/webStorage.d.ts +26 -0
  1154. package/esm/util/webStorage.js +92 -0
  1155. package/esm/util/wheelZoom.d.ts +65 -0
  1156. package/esm/util/wheelZoom.js +297 -0
  1157. package/esm/util/whenViewSettled.d.ts +74 -0
  1158. package/esm/util/whenViewSettled.js +77 -0
  1159. package/esm/util/withFeatureDetails.d.ts +34 -0
  1160. package/esm/util/withFeatureDetails.js +59 -0
  1161. package/esm/util/withLaunchInput.d.ts +174 -0
  1162. package/esm/util/withLaunchInput.js +274 -0
  1163. package/package.json +290 -820
  1164. package/esm/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +0 -2
  1165. package/esm/BaseFeatureWidget/BaseFeatureDetail/Position.js +0 -14
  1166. package/esm/BaseFeatureWidget/BaseFeatureDetail/types.d.ts +0 -7
  1167. package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/DLGAP3.d.ts +0 -80
  1168. package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/DLGAP3.js +0 -583
  1169. package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/NCDN.d.ts +0 -141
  1170. package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/NCDN.js +0 -1116
  1171. package/esm/ReExports/BaseFeatureDetails.d.ts +0 -1
  1172. package/esm/ReExports/BaseFeatureDetails.js +0 -9
  1173. package/esm/ReExports/DataGrid.d.ts +0 -1
  1174. package/esm/ReExports/DataGrid.js +0 -1
  1175. package/esm/ReExports/index.d.ts +0 -1
  1176. package/esm/ReExports/index.js +0 -1
  1177. package/esm/configuration/util.d.ts +0 -10
  1178. package/esm/configuration/util.js +0 -123
  1179. package/esm/data_adapters/BaseAdapter/BaseOptions.d.ts +0 -18
  1180. package/esm/data_adapters/util.d.ts +0 -1
  1181. package/esm/data_adapters/util.js +0 -6
  1182. package/esm/pluggableElementTypes/GlyphType.d.ts +0 -43
  1183. package/esm/pluggableElementTypes/GlyphType.js +0 -18
  1184. package/esm/pluggableElementTypes/models/saveTrackFileTypes/fetchSequence.d.ts +0 -5
  1185. package/esm/pluggableElementTypes/models/saveTrackFileTypes/fetchSequence.js +0 -17
  1186. package/esm/pluggableElementTypes/renderers/BoxRendererType.d.ts +0 -52
  1187. package/esm/pluggableElementTypes/renderers/BoxRendererType.js +0 -78
  1188. package/esm/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +0 -4
  1189. package/esm/pluggableElementTypes/renderers/CircularChordRendererType.js +0 -4
  1190. package/esm/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -58
  1191. package/esm/pluggableElementTypes/renderers/FeatureRendererType.js +0 -77
  1192. package/esm/pluggableElementTypes/renderers/LayoutSession.d.ts +0 -31
  1193. package/esm/pluggableElementTypes/renderers/LayoutSession.js +0 -40
  1194. package/esm/pluggableElementTypes/renderers/RendererType.d.ts +0 -28
  1195. package/esm/pluggableElementTypes/renderers/RendererType.js +0 -20
  1196. package/esm/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +0 -58
  1197. package/esm/pluggableElementTypes/renderers/ServerSideRendererType.js +0 -108
  1198. package/esm/pluggableElementTypes/renderers/index.d.ts +0 -6
  1199. package/esm/pluggableElementTypes/renderers/index.js +0 -6
  1200. package/esm/pluggableElementTypes/renderers/util.d.ts +0 -3
  1201. package/esm/pluggableElementTypes/renderers/util.js +0 -14
  1202. package/esm/rpc/baseRpcConfig.d.ts +0 -8
  1203. package/esm/rpc/baseRpcConfig.js +0 -10
  1204. package/esm/rpc/mainThreadRpcConfig.d.ts +0 -8
  1205. package/esm/rpc/mainThreadRpcConfig.js +0 -8
  1206. package/esm/rpc/methods/CoreGetFeatureDensityStats.d.ts +0 -17
  1207. package/esm/rpc/methods/CoreGetFeatureDensityStats.js +0 -25
  1208. package/esm/rpc/methods/CoreGetFeatureDetails.d.ts +0 -11
  1209. package/esm/rpc/methods/CoreGetFeatureDetails.js +0 -24
  1210. package/esm/rpc/methods/CoreGetFileInfo.d.ts +0 -9
  1211. package/esm/rpc/methods/CoreGetFileInfo.js +0 -15
  1212. package/esm/rpc/methods/CoreRender.d.ts +0 -14
  1213. package/esm/rpc/methods/CoreRender.js +0 -40
  1214. package/esm/rpc/methods/CoreSaveFeatureData.d.ts +0 -16
  1215. package/esm/rpc/methods/CoreSaveFeatureData.js +0 -32
  1216. package/esm/rpc/methods/util.d.ts +0 -15
  1217. package/esm/rpc/methods/util.js +0 -7
  1218. package/esm/rpc/webWorkerRpcConfig.d.ts +0 -8
  1219. package/esm/rpc/webWorkerRpcConfig.js +0 -8
  1220. package/esm/ui/MenuButton.d.ts +0 -1
  1221. package/esm/ui/MenuButton.js +0 -1
  1222. package/esm/ui/MenuItems.d.ts +0 -15
  1223. package/esm/ui/MenuItems.js +0 -59
  1224. package/esm/ui/useEvent.d.ts +0 -1
  1225. package/esm/ui/useEvent.js +0 -10
  1226. package/esm/util/blobToDataURL.d.ts +0 -1
  1227. package/esm/util/blobToDataURL.js +0 -14
  1228. package/esm/util/compositeMap.d.ts +0 -11
  1229. package/esm/util/compositeMap.js +0 -59
  1230. package/esm/util/flatqueue/index.d.ts +0 -11
  1231. package/esm/util/flatqueue/index.js +0 -61
  1232. package/esm/util/layouts/BaseLayout.d.ts +0 -30
  1233. package/esm/util/layouts/MultiLayout.d.ts +0 -12
  1234. package/esm/util/layouts/MultiLayout.js +0 -40
  1235. package/esm/util/layouts/PileupLayout.d.ts +0 -41
  1236. package/esm/util/layouts/PileupLayout.js +0 -202
  1237. package/esm/util/layouts/PrecomputedLayout.d.ts +0 -30
  1238. package/esm/util/layouts/PrecomputedLayout.js +0 -71
  1239. package/esm/util/layouts/SceneGraph.d.ts +0 -31
  1240. package/esm/util/layouts/SceneGraph.js +0 -121
  1241. package/esm/util/makeAbortableReaction.d.ts +0 -3
  1242. package/esm/util/makeAbortableReaction.js +0 -47
  1243. package/esm/util/map-obj/index.d.ts +0 -13
  1244. package/esm/util/map-obj/index.js +0 -92
  1245. package/esm/util/nextTick.d.ts +0 -1
  1246. package/esm/util/nextTick.js +0 -3
  1247. package/esm/util/offscreenCanvasGetSerializingSvg.d.ts +0 -5
  1248. package/esm/util/offscreenCanvasGetSerializingSvg.js +0 -9
  1249. package/esm/util/offscreenCanvasUtils.d.ts +0 -12
  1250. package/esm/util/offscreenCanvasUtils.js +0 -19
  1251. package/esm/util/renderToAbstractCanvas.d.ts +0 -17
  1252. package/esm/util/renderToAbstractCanvas.js +0 -53
  1253. package/esm/util/stopToken.d.ts +0 -19
  1254. package/esm/util/stopToken.js +0 -90
  1255. package/esm/util/transferables.d.ts +0 -2
  1256. package/esm/util/transferables.js +0 -35
  1257. package/esm/util/tss-react/mui/index.d.ts +0 -1
  1258. package/esm/util/tss-react/mui/index.js +0 -1
  1259. package/esm/util/tss-react/mui/mui.d.ts +0 -10
  1260. package/esm/util/tss-react/mui/mui.js +0 -5
  1261. package/esm/util/when.d.ts +0 -1
  1262. package/esm/util/when.js +0 -1
  1263. /package/esm/{BaseFeatureWidget/BaseFeatureDetail/types.js → data_adapters/BaseAdapter/CytobandAdapter.js} +0 -0
  1264. /package/esm/data_adapters/BaseAdapter/{BaseOptions.js → zoomRange.js} +0 -0
  1265. /package/esm/{util/layouts/BaseLayout.js → rpc/RpcRegistry.js} +0 -0
@@ -0,0 +1,1579 @@
1
+ import { binnedAggregate, fusesBinAggregate } from './binnedAggregate.js';
2
+ import { categoricalField } from './categoricalField.js';
3
+ import { DerivedTable, NO_COLUMN, WithTable, asTable, numberReaderOf, readerOf, selectRows, throughIndex, valueAt, withColumns, } from './featureTable.js';
4
+ import { fieldReader, isPlainFieldRef } from './fieldReader.js';
5
+ import { stringToJexlExpression } from './jexlStrings.js';
6
+ import SimpleFeature, { buildJexlContext } from './simpleFeature.js';
7
+ import { BIN_OVERLAP_FIELD, DEFAULT_BIN_AS, MadeTable, OpSums, binSize, groupKey, intervalsOf, isWeighted, madeGroups, stepNumberReader, stepReader, } from './stepTables.js';
8
+ import { junctionEnds, svClassOfAlt, svClassOfToken } from './svAlt.js';
9
+ export { BIN_OVERLAP_FIELD, DEFAULT_BIN_AS } from './stepTables.js';
10
+ export const DEFAULT_BIN_FIELD = 'start';
11
+ export const DEFAULT_FLATTEN_FIELD = 'subfeatures';
12
+ export const DEFAULT_CELLS_FIELD = 'seq';
13
+ export const DEFAULT_COVERAGE_AS = 'coverage';
14
+ export const DEFAULT_PILEUP_AS = 'row';
15
+ export const DEFAULT_PILEUP_FIELDS = ['start', 'end'];
16
+ function oneSection(n) {
17
+ return Uint32Array.of(0, n);
18
+ }
19
+ // Section starts through a step whose rows came from its input's in order:
20
+ // each section starts at the first row whose parent row is in it.
21
+ function boundsThrough(bounds, parentRow) {
22
+ const out = new Uint32Array(bounds.length);
23
+ let lo = 0;
24
+ for (let s = 0; s < bounds.length; s++) {
25
+ const edge = bounds[s];
26
+ let hi = parentRow.length;
27
+ while (lo < hi) {
28
+ const mid = (lo + hi) >>> 1;
29
+ if (parentRow[mid] < edge) {
30
+ lo = mid + 1;
31
+ }
32
+ else {
33
+ hi = mid;
34
+ }
35
+ }
36
+ out[s] = lo;
37
+ }
38
+ return out;
39
+ }
40
+ function expression(expr, jexl) {
41
+ if (!jexl) {
42
+ throw new Error(`a jexl transform needs a jexl instance (${expr})`);
43
+ }
44
+ return stringToJexlExpression(expr, jexl);
45
+ }
46
+ class RowsBuilder {
47
+ data = new Uint32Array(256);
48
+ length = 0;
49
+ push(v) {
50
+ if (this.length === this.data.length) {
51
+ const next = new Uint32Array(this.data.length * 2);
52
+ next.set(this.data);
53
+ this.data = next;
54
+ }
55
+ this.data[this.length++] = v;
56
+ }
57
+ finish() {
58
+ return this.data.slice(0, this.length);
59
+ }
60
+ }
61
+ function filter({ table, bounds }, expr, jexl) {
62
+ const compiled = expression(expr, jexl);
63
+ const kept = new RowsBuilder();
64
+ for (let i = 0; i < table.length; i++) {
65
+ if (compiled.eval(buildJexlContext({ feature: table.row(i) }))) {
66
+ kept.push(i);
67
+ }
68
+ }
69
+ const parentRow = kept.finish();
70
+ return {
71
+ table: selectRows(table, parentRow),
72
+ bounds: boundsThrough(bounds, parentRow),
73
+ };
74
+ }
75
+ function formula({ table, bounds }, expr, as, jexl) {
76
+ const compiled = expression(expr, jexl);
77
+ const values = new Array(table.length);
78
+ for (let i = 0; i < table.length; i++) {
79
+ values[i] = compiled.eval(buildJexlContext({ feature: table.row(i) }));
80
+ }
81
+ const column = { kind: 'value', read: i => values[i] };
82
+ return { table: new WithTable(table, new Map([[as, column]])), bounds };
83
+ }
84
+ function isFeature(item) {
85
+ return typeof item?.get === 'function';
86
+ }
87
+ // An array's elements in order, or a record's entries keyed by name; a
88
+ // feature standing in the field is neither.
89
+ function fannedEntries(items) {
90
+ if (Array.isArray(items)) {
91
+ return [...items.entries()];
92
+ }
93
+ return typeof items === 'object' && items !== null && !isFeature(items)
94
+ ? Object.entries(items)
95
+ : [];
96
+ }
97
+ /**
98
+ * The entries a `flatten` fanned out, one row each over the container row it
99
+ * came from. A container kept with nothing to fan out is a row of its own
100
+ * that reads everything off itself.
101
+ */
102
+ class FannedTable extends DerivedTable {
103
+ get madeFrom() {
104
+ return true;
105
+ }
106
+ row(i) {
107
+ return this.isKept(i) ? this.parent.row(this.parentOf(i)) : super.row(i);
108
+ }
109
+ }
110
+ /**
111
+ * The entries a `flatten` fanned out of a list or record a row holds. An
112
+ * entry answers a field it carries — a feature its own, a record its own key,
113
+ * a plain value the fanned field — and the container answers the rest,
114
+ * except the fanned field itself, so an entry never reads back its siblings.
115
+ */
116
+ class FlatTable extends FannedTable {
117
+ field;
118
+ items;
119
+ at;
120
+ position;
121
+ indexField;
122
+ keyField;
123
+ constructor(parent, parentRow, field, items, at, position, step) {
124
+ super(parent, parentRow);
125
+ this.field = field;
126
+ this.items = items;
127
+ this.at = at;
128
+ this.position = position;
129
+ this.indexField = step.index;
130
+ this.keyField = step.key;
131
+ }
132
+ isKept(i) {
133
+ return this.at[i] === undefined;
134
+ }
135
+ get hasKept() {
136
+ return this.at.includes(undefined);
137
+ }
138
+ // An entry's value for a field, `undefined` where it states none.
139
+ entryValue(i, name) {
140
+ if (this.at[i] === undefined) {
141
+ return undefined;
142
+ }
143
+ const item = this.items[i];
144
+ if (isFeature(item)) {
145
+ return item.get(name);
146
+ }
147
+ if (typeof item === 'object' && item !== null) {
148
+ return name === 'uniqueId'
149
+ ? this.id(i)
150
+ : item[name];
151
+ }
152
+ return name === this.field ? item : undefined;
153
+ }
154
+ isOwnKey(i) {
155
+ return this.keyField !== undefined && typeof this.at[i] === 'string';
156
+ }
157
+ // The key as codes into the names met, where every row is an entry keyed
158
+ // by name: a record's species or samples, which a facet then splits on
159
+ // once per name.
160
+ keyCategory() {
161
+ const codes = new Uint32Array(this.length);
162
+ const labels = [];
163
+ const codeOf = new Map();
164
+ for (let i = 0; i < this.length; i++) {
165
+ const at = this.at[i];
166
+ if (typeof at !== 'string') {
167
+ return undefined;
168
+ }
169
+ let code = codeOf.get(at);
170
+ if (code === undefined) {
171
+ code = labels.length;
172
+ codeOf.set(at, code);
173
+ labels.push(at);
174
+ }
175
+ codes[i] = code;
176
+ }
177
+ return { kind: 'category', codes, labels, at: undefined };
178
+ }
179
+ own(name) {
180
+ const read = readerOf(this.inherited(name));
181
+ const fanned = name === this.field;
182
+ const entryThenContainer = (i) => {
183
+ const v = this.entryValue(i, name);
184
+ return v === undefined && (!fanned || this.isKept(i)) ? read(i) : v;
185
+ };
186
+ if (name === this.indexField) {
187
+ const { position } = this;
188
+ return {
189
+ kind: 'value',
190
+ read: i => this.at[i] === undefined ? entryThenContainer(i) : position[i],
191
+ };
192
+ }
193
+ if (name === this.keyField) {
194
+ return (this.keyCategory() ?? {
195
+ kind: 'value',
196
+ read: i => (this.isOwnKey(i) ? this.at[i] : entryThenContainer(i)),
197
+ });
198
+ }
199
+ return { kind: 'value', read: entryThenContainer };
200
+ }
201
+ id(i) {
202
+ const at = this.at[i];
203
+ const container = this.parent.row(this.parentOf(i));
204
+ if (at === undefined) {
205
+ return container.id();
206
+ }
207
+ const item = this.items[i];
208
+ return isFeature(item) ? item.id() : `${container.id()}#${at}`;
209
+ }
210
+ json(i) {
211
+ const containerRow = this.parent.row(this.parentOf(i));
212
+ const at = this.at[i];
213
+ const own = {};
214
+ if (this.indexField !== undefined && at !== undefined) {
215
+ own[this.indexField] = this.position[i];
216
+ }
217
+ if (this.keyField !== undefined && this.isOwnKey(i)) {
218
+ own[this.keyField] = at;
219
+ }
220
+ if (at === undefined) {
221
+ return { ...containerRow.toJSON(), ...own };
222
+ }
223
+ const item = this.items[i];
224
+ if (!isFeature(item) && (typeof item !== 'object' || item === null)) {
225
+ return { ...containerRow.toJSON(), [this.field]: item, ...own };
226
+ }
227
+ const { [this.field]: _siblings, ...container } = containerRow.toJSON();
228
+ const entry = isFeature(item)
229
+ ? item.toJSON()
230
+ : new SimpleFeature({
231
+ refName: containerRow.get('refName'),
232
+ start: containerRow.get('start'),
233
+ end: containerRow.get('end'),
234
+ ...item,
235
+ uniqueId: this.id(i),
236
+ }).toJSON();
237
+ return { ...container, ...entry, ...own };
238
+ }
239
+ }
240
+ /**
241
+ * The entries a `flatten` fanned out of a list column, which are the list's
242
+ * own rows: an entry reads the fields its list holds straight off the list's
243
+ * lanes, and the container the rest. A keyed entry is a record filed under
244
+ * its name, any other a feature of its own.
245
+ */
246
+ class ListFlatTable extends FannedTable {
247
+ field;
248
+ list;
249
+ entryRow;
250
+ position;
251
+ kept;
252
+ indexField;
253
+ keyField;
254
+ constructor(parent, parentRow, field, list, entryRow, position, kept, step) {
255
+ super(parent, parentRow);
256
+ this.field = field;
257
+ this.list = list;
258
+ this.entryRow = entryRow;
259
+ this.position = position;
260
+ this.kept = kept;
261
+ this.indexField = step.index;
262
+ this.keyField = step.key;
263
+ }
264
+ isKept(i) {
265
+ return this.kept?.[i] === 1;
266
+ }
267
+ get hasKept() {
268
+ return this.kept !== undefined;
269
+ }
270
+ entryOf(i) {
271
+ return this.entryRow ? this.entryRow[i] : i;
272
+ }
273
+ throughEntries(column) {
274
+ return this.entryRow ? throughIndex(column, this.entryRow) : column;
275
+ }
276
+ entryColumn(name) {
277
+ const { keys, entries } = this.list;
278
+ if (name === this.indexField) {
279
+ return { kind: 'number', values: this.position, at: undefined };
280
+ }
281
+ if (name === this.keyField && keys) {
282
+ return this.throughEntries(keys);
283
+ }
284
+ if (name === this.field) {
285
+ return NO_COLUMN;
286
+ }
287
+ if (name === 'uniqueId' && keys) {
288
+ return { kind: 'value', read: i => this.id(i) };
289
+ }
290
+ const column = entries.column(name);
291
+ return column.kind === 'none' ? undefined : this.throughEntries(column);
292
+ }
293
+ own(name) {
294
+ const column = this.entryColumn(name);
295
+ const { kept } = this;
296
+ if (!kept || column === undefined) {
297
+ return column;
298
+ }
299
+ const entry = readerOf(column);
300
+ const container = readerOf(this.inherited(name));
301
+ return { kind: 'value', read: i => (kept[i] ? container(i) : entry(i)) };
302
+ }
303
+ id(i) {
304
+ const container = this.parent.row(this.parentOf(i));
305
+ if (this.isKept(i)) {
306
+ return container.id();
307
+ }
308
+ const { keys, entries } = this.list;
309
+ const j = this.entryOf(i);
310
+ return keys
311
+ ? `${container.id()}#${String(valueAt(keys, j))}`
312
+ : entries.id(j);
313
+ }
314
+ json(i) {
315
+ const containerRow = this.parent.row(this.parentOf(i));
316
+ if (this.isKept(i)) {
317
+ return containerRow.toJSON();
318
+ }
319
+ const { keys, entries } = this.list;
320
+ const j = this.entryOf(i);
321
+ const own = {};
322
+ if (this.indexField !== undefined) {
323
+ own[this.indexField] = this.position[i];
324
+ }
325
+ if (this.keyField !== undefined && keys) {
326
+ own[this.keyField] = valueAt(keys, j);
327
+ }
328
+ const { [this.field]: _siblings, ...container } = containerRow.toJSON();
329
+ const entry = keys
330
+ ? {
331
+ refName: containerRow.get('refName'),
332
+ start: containerRow.get('start'),
333
+ end: containerRow.get('end'),
334
+ ...entries.record(j),
335
+ uniqueId: this.id(i),
336
+ }
337
+ : entries.json(j);
338
+ return { ...container, ...entry, ...own };
339
+ }
340
+ }
341
+ // A list column fanned out: each row's entries in order, their positions and
342
+ // the entry rows they are, with no entry read.
343
+ function flattenList({ table, bounds }, step, field, list) {
344
+ const { start, at } = list;
345
+ const n = table.length;
346
+ let size = 0;
347
+ let empty = 0;
348
+ for (let i = 0; i < n; i++) {
349
+ const r = at ? at[i] : i;
350
+ const count = start[r + 1] - start[r];
351
+ size += count;
352
+ if (count === 0) {
353
+ empty++;
354
+ }
355
+ }
356
+ const total = size + (step.keepEmpty ? empty : 0);
357
+ const parentRow = new Uint32Array(total);
358
+ const position = new Uint32Array(total);
359
+ const entryRow = new Uint32Array(total);
360
+ const kept = total > size ? new Uint8Array(total) : undefined;
361
+ let k = 0;
362
+ let inOrder = true;
363
+ for (let i = 0; i < n; i++) {
364
+ const r = at ? at[i] : i;
365
+ const from = start[r];
366
+ const to = start[r + 1];
367
+ if (from === to && kept) {
368
+ parentRow[k] = i;
369
+ kept[k] = 1;
370
+ inOrder = false;
371
+ k++;
372
+ }
373
+ for (let j = from; j < to; j++) {
374
+ parentRow[k] = i;
375
+ position[k] = j - from;
376
+ entryRow[k] = j;
377
+ inOrder &&= j === k;
378
+ k++;
379
+ }
380
+ }
381
+ return {
382
+ table: new ListFlatTable(table, parentRow, field, list, inOrder ? undefined : entryRow, position, kept, step),
383
+ bounds: boundsThrough(bounds, parentRow),
384
+ };
385
+ }
386
+ function flatten(staged, step) {
387
+ const { field = DEFAULT_FLATTEN_FIELD } = step;
388
+ const column = isPlainFieldRef(field) ? staged.table.column(field) : undefined;
389
+ return column?.kind === 'list'
390
+ ? flattenList(staged, step, field, column)
391
+ : flattenValues(staged, step);
392
+ }
393
+ function flattenValues({ table, bounds }, step) {
394
+ const { field = DEFAULT_FLATTEN_FIELD, keepEmpty } = step;
395
+ const read = stepReader(table, field, 'a flatten');
396
+ const parentRow = new RowsBuilder();
397
+ const position = new RowsBuilder();
398
+ const items = [];
399
+ const at = [];
400
+ for (let i = 0; i < table.length; i++) {
401
+ const entries = fannedEntries(read(i));
402
+ if (entries.length === 0) {
403
+ if (keepEmpty) {
404
+ parentRow.push(i);
405
+ position.push(0);
406
+ items.push(undefined);
407
+ at.push(undefined);
408
+ }
409
+ continue;
410
+ }
411
+ for (const [p, [key, item]] of entries.entries()) {
412
+ parentRow.push(i);
413
+ position.push(p);
414
+ items.push(item);
415
+ at.push(key);
416
+ }
417
+ }
418
+ const rows = parentRow.finish();
419
+ return {
420
+ table: new FlatTable(table, rows, field, items, at, position.finish(), step),
421
+ bounds: boundsThrough(bounds, rows),
422
+ };
423
+ }
424
+ const DASH = 45;
425
+ const SPACE = 32;
426
+ const LOWER_BIT = 0x20;
427
+ const CELL_STATES = ['match', 'mismatch', 'gap', 'insertion'];
428
+ const MATCH = 0;
429
+ const MISMATCH = 1;
430
+ const GAP = 2;
431
+ const INSERTION = 3;
432
+ const NO_STATE = 255;
433
+ function isGapByte(b) {
434
+ return b === DASH || b === SPACE;
435
+ }
436
+ // The row a cell step reads against: past any table that only reordered or
437
+ // annotated the rows, the one they were fanned out of.
438
+ function containerOf(table) {
439
+ let at = table;
440
+ let toBase;
441
+ while (at instanceof DerivedTable && !at.madeFrom) {
442
+ toBase = at.parentRow ? compose(toBase, at.parentRow) : toBase;
443
+ at = at.parent;
444
+ }
445
+ if (!(at instanceof DerivedTable)) {
446
+ return undefined;
447
+ }
448
+ return {
449
+ made: at,
450
+ toMade: toBase,
451
+ table: at.parent,
452
+ row: at.parentRow ? compose(toBase, at.parentRow) : toBase,
453
+ };
454
+ }
455
+ function compose(outer, inner) {
456
+ if (!outer) {
457
+ return inner;
458
+ }
459
+ const out = new Uint32Array(outer.length);
460
+ for (let i = 0; i < outer.length; i++) {
461
+ out[i] = inner[outer[i]];
462
+ }
463
+ return out;
464
+ }
465
+ // Below this length a character loop copies a string faster than
466
+ // `encodeInto`, as the MAF packer measured.
467
+ const ASCII_COPY_MAX_LENGTH = 64;
468
+ const encoder = new TextEncoder();
469
+ // A column's text as bytes, one per character: an adapter's own, or the
470
+ // strings a feature holds copied into one buffer.
471
+ function textOf(column, n) {
472
+ if (column.kind === 'text') {
473
+ return column;
474
+ }
475
+ const read = readerOf(column);
476
+ const texts = new Array(n);
477
+ let total = 0;
478
+ for (let i = 0; i < n; i++) {
479
+ const v = read(i);
480
+ if (typeof v === 'string') {
481
+ texts[i] = v;
482
+ total += v.length;
483
+ }
484
+ }
485
+ const bytes = new Uint8Array(total);
486
+ const offset = new Uint32Array(n);
487
+ const length = new Uint32Array(n);
488
+ let pos = 0;
489
+ for (let i = 0; i < n; i++) {
490
+ const text = texts[i];
491
+ if (text === undefined) {
492
+ continue;
493
+ }
494
+ offset[i] = pos;
495
+ if (text.length <= ASCII_COPY_MAX_LENGTH) {
496
+ for (let c = 0; c < text.length; c++) {
497
+ bytes[pos + c] = text.charCodeAt(c);
498
+ }
499
+ length[i] = text.length;
500
+ }
501
+ else {
502
+ length[i] = encoder.encodeInto(text, bytes.subarray(pos, pos + text.length)).written;
503
+ }
504
+ pos += text.length;
505
+ }
506
+ return { kind: 'text', bytes, offset, length, at: undefined };
507
+ }
508
+ /**
509
+ * The texts a `cells` walk reads, by the row of the table it walked: each
510
+ * row's own, and the reference it is read against, which a row fanned out of
511
+ * a container reads off the container.
512
+ */
513
+ class WalkedTexts {
514
+ row;
515
+ reference;
516
+ refRow;
517
+ constructor(row, ref, refRow) {
518
+ this.row = row;
519
+ this.reference = ref;
520
+ this.refRow = refRow;
521
+ }
522
+ rowOf(r) {
523
+ const { at } = this.row;
524
+ return at ? at[r] : r;
525
+ }
526
+ refOf(r) {
527
+ const p = this.refRow ? this.refRow[r] : r;
528
+ const { at } = this.reference;
529
+ return at ? at[p] : p;
530
+ }
531
+ }
532
+ function walkedTexts(table, field) {
533
+ const row = textOf(table.column(field), table.length);
534
+ const container = containerOf(table);
535
+ const made = container?.made;
536
+ if (container && !(made instanceof FannedTable && made.hasKept)) {
537
+ const { table: base } = container;
538
+ return new WalkedTexts(row, textOf(base.column(field), base.length), container.row);
539
+ }
540
+ // A container a flatten kept with nothing to fan out is the row itself, so
541
+ // its reference is its own container's, as its `parent()` says.
542
+ const byParent = (r) => table.row(r).parent?.()?.get(field);
543
+ const readContainer = container
544
+ ? readerOf(container.table.column(field))
545
+ : undefined;
546
+ const read = readContainer && made instanceof FannedTable
547
+ ? (r) => {
548
+ const { toMade, row: refRow } = container;
549
+ return made.isKept(toMade ? toMade[r] : r)
550
+ ? byParent(r)
551
+ : readContainer(refRow ? refRow[r] : r);
552
+ }
553
+ : byParent;
554
+ return new WalkedTexts(row, textOf({ kind: 'value', read }, table.length));
555
+ }
556
+ /**
557
+ * The runs a `cells` step answers, one per stretch of one state against the
558
+ * reference, typed: each run's span, its state and the text column it starts
559
+ * at, with `base`, `match` and `length` read back out of the texts when asked
560
+ * for.
561
+ */
562
+ class CellTable extends DerivedTable {
563
+ start;
564
+ end;
565
+ state;
566
+ textAt;
567
+ texts;
568
+ firstOfRow;
569
+ derived = new Map();
570
+ constructor(parent, parentRow, lanes, texts) {
571
+ super(parent, parentRow);
572
+ this.start = lanes.start;
573
+ this.end = lanes.end;
574
+ this.state = lanes.state;
575
+ this.textAt = lanes.textAt;
576
+ this.texts = texts;
577
+ }
578
+ get madeFrom() {
579
+ return true;
580
+ }
581
+ laneOf(name, build) {
582
+ let column = this.derived.get(name);
583
+ if (!column) {
584
+ column = build();
585
+ this.derived.set(name, column);
586
+ }
587
+ return column;
588
+ }
589
+ own(name) {
590
+ switch (name) {
591
+ case 'start': {
592
+ return { kind: 'number', values: this.start, at: undefined };
593
+ }
594
+ case 'end': {
595
+ return { kind: 'number', values: this.end, at: undefined };
596
+ }
597
+ case 'state': {
598
+ return {
599
+ kind: 'category',
600
+ codes: this.state,
601
+ labels: CELL_STATES,
602
+ at: undefined,
603
+ };
604
+ }
605
+ case 'match': {
606
+ return this.laneOf(name, () => {
607
+ const values = new Float32Array(this.length);
608
+ for (let i = 0; i < this.length; i++) {
609
+ const s = this.state[i];
610
+ values[i] = s === MATCH ? 1 : s === MISMATCH ? 0 : Number.NaN;
611
+ }
612
+ return { kind: 'number', values, at: undefined, nanIsAbsent: true };
613
+ });
614
+ }
615
+ case 'length': {
616
+ return this.laneOf(name, () => {
617
+ const values = new Float32Array(this.length).fill(Number.NaN);
618
+ for (let i = 0; i < this.length; i++) {
619
+ if (this.state[i] === INSERTION) {
620
+ values[i] = this.inserted(i).length;
621
+ }
622
+ }
623
+ return { kind: 'number', values, at: undefined, nanIsAbsent: true };
624
+ });
625
+ }
626
+ case 'base': {
627
+ return this.laneOf(name, () => {
628
+ const values = new Array(this.length);
629
+ for (let i = 0; i < this.length; i++) {
630
+ const s = this.state[i];
631
+ values[i] =
632
+ s === MISMATCH
633
+ ? this.mismatched(i)
634
+ : s === INSERTION
635
+ ? this.inserted(i)
636
+ : undefined;
637
+ }
638
+ return { kind: 'value', read: i => values[i] };
639
+ });
640
+ }
641
+ default: {
642
+ return undefined;
643
+ }
644
+ }
645
+ }
646
+ mismatched(i) {
647
+ const { bytes, offset } = this.texts.row;
648
+ const k = this.texts.rowOf(this.parentOf(i));
649
+ return String.fromCharCode(bytes[offset[k] + this.textAt[i]]);
650
+ }
651
+ // The bases a row holds where the reference has none, from the column the
652
+ // insertion starts at to the reference's next base.
653
+ inserted(i) {
654
+ const { row, reference: ref } = this.texts;
655
+ const r = this.parentOf(i);
656
+ const k = this.texts.rowOf(r);
657
+ const f = this.texts.refOf(r);
658
+ const rowAt = row.offset[k];
659
+ const refAt = ref.offset[f];
660
+ const end = Math.min(row.length[k], ref.length[f]);
661
+ let out = '';
662
+ for (let col = this.textAt[i]; col < end && ref.bytes[refAt + col] === DASH; col++) {
663
+ const b = row.bytes[rowAt + col];
664
+ if (!isGapByte(b)) {
665
+ out += String.fromCharCode(b);
666
+ }
667
+ }
668
+ return out;
669
+ }
670
+ id(i) {
671
+ const p = this.parentOf(i);
672
+ this.firstOfRow ??= firstRowIndex(this.parentRow, this.parent.length);
673
+ return `${this.parent.row(p).id()}#${i - this.firstOfRow[p]}`;
674
+ }
675
+ json(i) {
676
+ const out = {
677
+ ...this.parent.row(this.parentOf(i)).toJSON(),
678
+ start: this.start[i],
679
+ end: this.end[i],
680
+ state: CELL_STATES[this.state[i]],
681
+ };
682
+ for (const name of ['base', 'match', 'length']) {
683
+ const v = valueAt(this.column(name), i);
684
+ if (v !== undefined) {
685
+ out[name] = v;
686
+ }
687
+ }
688
+ return out;
689
+ }
690
+ }
691
+ // The lanes a `cells` walk writes, doubled as a row would overrun them.
692
+ class RunLanes {
693
+ start;
694
+ end;
695
+ state;
696
+ textAt;
697
+ parentRow;
698
+ length = 0;
699
+ constructor(capacity) {
700
+ this.start = new Uint32Array(capacity);
701
+ this.end = new Uint32Array(capacity);
702
+ this.state = new Uint8Array(capacity);
703
+ this.textAt = new Uint32Array(capacity);
704
+ this.parentRow = new Uint32Array(capacity);
705
+ }
706
+ reserve(more) {
707
+ const need = this.length + more;
708
+ if (need <= this.start.length) {
709
+ return;
710
+ }
711
+ const size = Math.max(this.start.length * 2, need);
712
+ const widen = (a) => {
713
+ const next = new a.constructor(size);
714
+ next.set(a);
715
+ return next;
716
+ };
717
+ this.start = widen(this.start);
718
+ this.end = widen(this.end);
719
+ this.state = widen(this.state);
720
+ this.textAt = widen(this.textAt);
721
+ this.parentRow = widen(this.parentRow);
722
+ }
723
+ // One row's runs against its reference: a run per column is the most it
724
+ // can answer, so the lanes grow once and the walk writes through locals.
725
+ walk(r, startPos, rowBytes, rowAt, rowLen, refBytes, refAt, refLen) {
726
+ this.reserve(refLen + 1);
727
+ const { start, end, state, textAt, parentRow } = this;
728
+ let n = this.length;
729
+ let pos = startPos;
730
+ // The columns carrying the row's own sequence: a gap run reaching either
731
+ // end of the row measures where the block was cut, not the alignment, so
732
+ // it is no cell either.
733
+ let first = 0;
734
+ while (first < rowLen && isGapByte(rowBytes[rowAt + first])) {
735
+ first++;
736
+ }
737
+ let last = rowLen - 1;
738
+ while (last > first && isGapByte(rowBytes[rowAt + last])) {
739
+ last--;
740
+ }
741
+ let runStart = -1;
742
+ let runState = NO_STATE;
743
+ let runBase = -1;
744
+ let runCol = 0;
745
+ let insertAt = -1;
746
+ for (let col = 0; col < refLen; col++) {
747
+ const refByte = refBytes[refAt + col];
748
+ const rowByte = col < rowLen ? rowBytes[rowAt + col] : SPACE;
749
+ if (refByte === DASH) {
750
+ if (insertAt < 0 && col < rowLen && !isGapByte(rowByte)) {
751
+ insertAt = col;
752
+ }
753
+ continue;
754
+ }
755
+ if (insertAt >= 0) {
756
+ start[n] = pos;
757
+ end[n] = pos;
758
+ state[n] = INSERTION;
759
+ textAt[n] = insertAt;
760
+ parentRow[n] = r;
761
+ n++;
762
+ insertAt = -1;
763
+ }
764
+ const drawn = col >= first && col <= last && col < rowLen;
765
+ const st = !drawn
766
+ ? NO_STATE
767
+ : isGapByte(rowByte)
768
+ ? GAP
769
+ : (refByte | LOWER_BIT) === (rowByte | LOWER_BIT)
770
+ ? MATCH
771
+ : MISMATCH;
772
+ const base = st === MISMATCH ? rowByte : -1;
773
+ if (st !== runState || base !== runBase) {
774
+ if (runStart >= 0) {
775
+ start[n] = runStart;
776
+ end[n] = pos;
777
+ state[n] = runState;
778
+ textAt[n] = runCol;
779
+ parentRow[n] = r;
780
+ n++;
781
+ }
782
+ runStart = st === NO_STATE ? -1 : pos;
783
+ runState = st;
784
+ runBase = base;
785
+ runCol = col;
786
+ }
787
+ pos++;
788
+ }
789
+ if (runStart >= 0) {
790
+ start[n] = runStart;
791
+ end[n] = pos;
792
+ state[n] = runState;
793
+ textAt[n] = runCol;
794
+ parentRow[n] = r;
795
+ n++;
796
+ }
797
+ this.length = n;
798
+ }
799
+ }
800
+ // Where each parent row's children start, for children written parent by
801
+ // parent in order.
802
+ function firstRowIndex(parentRow, parents) {
803
+ const first = new Uint32Array(parents);
804
+ for (let i = parentRow.length - 1; i >= 0; i--) {
805
+ first[parentRow[i]] = i;
806
+ }
807
+ return first;
808
+ }
809
+ function cells({ table, bounds }, step) {
810
+ const { field = DEFAULT_CELLS_FIELD } = step;
811
+ const texts = walkedTexts(table, field);
812
+ const readStart = numberReaderOf(table.column('start'));
813
+ const { bytes: rowBytes, offset: rowOffset, length: rowLength } = texts.row;
814
+ const { bytes: refBytes, offset: refOffset, length: refLength, } = texts.reference;
815
+ // A run per reference base is the most a row can answer and far past what
816
+ // one does, so the lanes start at an eighth of it.
817
+ let bound = 0;
818
+ for (let r = 0; r < table.length; r++) {
819
+ bound += refLength[texts.refOf(r)] + 1;
820
+ }
821
+ const lanes = new RunLanes(Math.max(1024, bound >>> 3));
822
+ for (let r = 0; r < table.length; r++) {
823
+ const f = texts.refOf(r);
824
+ const refLen = refLength[f];
825
+ const pos = readStart(r);
826
+ if (refLen > 0 && pos >= 0) {
827
+ const k = texts.rowOf(r);
828
+ lanes.walk(r, pos, rowBytes, rowOffset[k], rowLength[k], refBytes, refOffset[f], refLen);
829
+ }
830
+ }
831
+ const n = lanes.length;
832
+ const rows = lanes.parentRow.subarray(0, n);
833
+ return {
834
+ table: new CellTable(table, rows, {
835
+ start: lanes.start.subarray(0, n),
836
+ end: lanes.end.subarray(0, n),
837
+ state: lanes.state.subarray(0, n),
838
+ textAt: lanes.textAt.subarray(0, n),
839
+ }, texts),
840
+ bounds: boundsThrough(bounds, rows),
841
+ };
842
+ }
843
+ function statedMate(f) {
844
+ const mate = f.get('mate');
845
+ return mate?.refName !== undefined && mate.start !== undefined
846
+ ? {
847
+ refName: mate.refName,
848
+ start: mate.start,
849
+ end: mate.end ?? mate.start + 1,
850
+ mateDirection: mate.mateDirection ?? 0,
851
+ }
852
+ : undefined;
853
+ }
854
+ function mateFields(f, alt, mate, ownDirection, alleleIndex = 0) {
855
+ const info = f.get('INFO');
856
+ const svType = alt === undefined
857
+ ? svClassOfToken(String(info?.SVTYPE?.[0] ?? ''))
858
+ : svClassOfAlt(alt, {
859
+ ref: f.get('REF'),
860
+ info,
861
+ alleleIndex,
862
+ });
863
+ return {
864
+ mate,
865
+ mateDirection: ownDirection,
866
+ ...(alt === undefined ? {} : { alt }),
867
+ ...(svType ? { svType } : {}),
868
+ };
869
+ }
870
+ /**
871
+ * #api
872
+ * How a record states its other end, or undefined where it states none: the
873
+ * `mate` a paired adapter fills (BEDPE, STAR-Fusion), or an `ALT` the breakend
874
+ * and symbolic-SV readers resolve. The `mate` step admits exactly the features
875
+ * this names one for, so a caller deciding whether links are the picture a
876
+ * track wants asks here rather than re-reading the fields.
877
+ */
878
+ export function matedBy(f) {
879
+ if (statedMate(f)) {
880
+ return 'mate';
881
+ }
882
+ const alts = f.get('ALT');
883
+ return Array.isArray(alts) &&
884
+ alts.some((alt, i) => junctionEnds(f, alt, i))
885
+ ? 'alt'
886
+ : undefined;
887
+ }
888
+ /**
889
+ * The ends a `mate` step admitted: each a row of the record it came from, with
890
+ * its mate's fields beside the record's, an allele of a record with several
891
+ * named by its position.
892
+ */
893
+ class MateTable extends DerivedTable {
894
+ fields;
895
+ ids;
896
+ constructor(parent, parentRow, fields, ids) {
897
+ super(parent, parentRow);
898
+ this.fields = fields;
899
+ this.ids = ids;
900
+ }
901
+ own(name) {
902
+ if (!this.fields.some(f => name in f)) {
903
+ return undefined;
904
+ }
905
+ const read = readerOf(this.inherited(name));
906
+ return {
907
+ kind: 'value',
908
+ read: i => (name in this.fields[i] ? this.fields[i][name] : read(i)),
909
+ };
910
+ }
911
+ id(i) {
912
+ return this.ids[i] ?? super.id(i);
913
+ }
914
+ json(i) {
915
+ return { ...super.json(i), ...this.fields[i] };
916
+ }
917
+ }
918
+ function mates({ table, bounds }) {
919
+ const parentRow = new RowsBuilder();
920
+ const fields = [];
921
+ const ids = [];
922
+ const out = new Uint32Array(bounds.length);
923
+ for (let s = 0; s + 1 < bounds.length; s++) {
924
+ out[s] = parentRow.length;
925
+ const seen = new Set();
926
+ const admit = (i, f, mate, written, id) => {
927
+ const here = `${f.get('refName')}:${f.get('start')}-${f.get('end')}`;
928
+ const there = `${mate.refName}:${mate.start}-${mate.end}`;
929
+ const key = here < there ? `${here}|${there}` : `${there}|${here}`;
930
+ if (!seen.has(key)) {
931
+ seen.add(key);
932
+ parentRow.push(i);
933
+ fields.push(written);
934
+ ids.push(id);
935
+ }
936
+ };
937
+ for (let i = bounds[s]; i < bounds[s + 1]; i++) {
938
+ const f = table.row(i);
939
+ const stated = statedMate(f);
940
+ if (stated) {
941
+ const ends = junctionEnds(f);
942
+ const mate = { ...stated, mateDirection: ends.mate.keeps };
943
+ admit(i, f, mate, mateFields(f, undefined, mate, ends.own.keeps));
944
+ continue;
945
+ }
946
+ const alts = f.get('ALT');
947
+ if (!Array.isArray(alts)) {
948
+ continue;
949
+ }
950
+ for (const [a, alt] of alts.entries()) {
951
+ const ends = junctionEnds(f, alt, a);
952
+ if (!ends) {
953
+ continue;
954
+ }
955
+ const mate = {
956
+ refName: ends.mate.refName,
957
+ start: ends.mate.pos,
958
+ end: ends.mate.pos + 1,
959
+ mateDirection: ends.mate.keeps,
960
+ };
961
+ admit(i, f, mate, mateFields(f, alt, mate, ends.own.keeps, a), alts.length > 1 ? `${f.id()}#${a}` : undefined);
962
+ }
963
+ }
964
+ }
965
+ out[bounds.length - 1] = parentRow.length;
966
+ return {
967
+ table: new MateTable(table, parentRow.finish(), fields, ids),
968
+ bounds: out,
969
+ };
970
+ }
971
+ function bin(staged, step) {
972
+ return step.fields
973
+ ? binIntervals(staged, step, step.fields)
974
+ : binPoints(staged, step);
975
+ }
976
+ function binPoints({ table, bounds }, step) {
977
+ const { field = DEFAULT_BIN_FIELD } = step;
978
+ const size = binSize(step);
979
+ const [asStart, asEnd] = step.as ?? DEFAULT_BIN_AS;
980
+ const read = stepNumberReader(table, field, 'a bin');
981
+ const n = table.length;
982
+ const starts = new Float64Array(n);
983
+ const ends = new Float64Array(n);
984
+ for (let i = 0; i < n; i++) {
985
+ const s = Math.floor(read(i) / size) * size;
986
+ starts[i] = s;
987
+ ends[i] = s + size;
988
+ }
989
+ const written = new Map([
990
+ [asStart, { kind: 'number', values: starts, at: undefined }],
991
+ [asEnd, { kind: 'number', values: ends, at: undefined }],
992
+ ]);
993
+ return { table: new WithTable(table, written), bounds };
994
+ }
995
+ function binIntervals({ table, bounds }, step, fields) {
996
+ const size = binSize(step);
997
+ const [asStart, asEnd] = step.as ?? DEFAULT_BIN_AS;
998
+ const iv = intervalsOf(table, fields, size, bounds);
999
+ const { pieces } = iv;
1000
+ const parentRow = new Uint32Array(pieces);
1001
+ const binStart = new Float64Array(pieces);
1002
+ const binEnd = new Float64Array(pieces);
1003
+ const overlap = new Float64Array(pieces);
1004
+ let k = 0;
1005
+ for (let i = 0; i < table.length; i++) {
1006
+ const first = iv.first[i];
1007
+ if (Number.isNaN(first)) {
1008
+ continue;
1009
+ }
1010
+ const s = iv.start[i];
1011
+ const e = iv.end[i];
1012
+ for (let b = first; b <= iv.last[i]; b++) {
1013
+ const lo = b * size;
1014
+ const hi = lo + size;
1015
+ parentRow[k] = i;
1016
+ binStart[k] = lo;
1017
+ binEnd[k] = hi;
1018
+ overlap[k] = Math.min(e, hi) - Math.max(s, lo);
1019
+ k++;
1020
+ }
1021
+ }
1022
+ const written = new Map([
1023
+ [asStart, { kind: 'number', values: binStart, at: undefined }],
1024
+ [asEnd, { kind: 'number', values: binEnd, at: undefined }],
1025
+ [BIN_OVERLAP_FIELD, { kind: 'number', values: overlap, at: undefined }],
1026
+ ]);
1027
+ return {
1028
+ table: new WithTable(table, written, parentRow),
1029
+ bounds: boundsThrough(bounds, parentRow),
1030
+ };
1031
+ }
1032
+ // Each row's group, numbered in the order groups are first met, a section
1033
+ // being the outermost level: the groups keyed by their raw values, one Map
1034
+ // level per groupby field, where a string key built per row was the
1035
+ // aggregate's whole cost.
1036
+ function groupRows(n, bounds, reads, normalize) {
1037
+ const groupOf = new Uint32Array(n);
1038
+ const firstRow = [];
1039
+ const sectionOf = [];
1040
+ const last = reads.length - 1;
1041
+ for (let s = 0; s + 1 < bounds.length; s++) {
1042
+ const root = new Map();
1043
+ for (let i = bounds[s]; i < bounds[s + 1]; i++) {
1044
+ let g;
1045
+ if (reads.length === 0) {
1046
+ g =
1047
+ firstRow.length > 0 && sectionOf.at(-1) === s
1048
+ ? firstRow.length - 1
1049
+ : -1;
1050
+ if (g < 0) {
1051
+ g = firstRow.length;
1052
+ firstRow.push(i);
1053
+ sectionOf.push(s);
1054
+ }
1055
+ }
1056
+ else {
1057
+ let node = root;
1058
+ for (let l = 0; l < last; l++) {
1059
+ const raw = reads[l](i);
1060
+ const v = normalize && typeof raw !== 'object' ? raw : groupKey(raw);
1061
+ let next = node.get(v);
1062
+ if (!next) {
1063
+ next = new Map();
1064
+ node.set(v, next);
1065
+ }
1066
+ node = next;
1067
+ }
1068
+ const raw = reads[last](i);
1069
+ const v = normalize && typeof raw !== 'object' ? raw : groupKey(raw);
1070
+ let at = node.get(v);
1071
+ if (at === undefined) {
1072
+ at = firstRow.length;
1073
+ node.set(v, at);
1074
+ firstRow.push(i);
1075
+ sectionOf.push(s);
1076
+ }
1077
+ g = at;
1078
+ }
1079
+ groupOf[i] = g;
1080
+ }
1081
+ }
1082
+ return { groupOf, firstRow, sectionOf };
1083
+ }
1084
+ function aggregate({ table, bounds }, step) {
1085
+ const { groupby = [], ops } = step;
1086
+ const n = table.length;
1087
+ const keyed = groupby.some(field => !isPlainFieldRef(field));
1088
+ const reads = groupby.map(field => keyed
1089
+ ? stepReader(table, field, 'an aggregate')
1090
+ : readerOf(table.column(field)));
1091
+ const { groupOf, firstRow, sectionOf } = groupRows(n, bounds, reads, !keyed);
1092
+ const groups = firstRow.length;
1093
+ const readStart = readerOf(table.column('start'));
1094
+ const readEnd = readerOf(table.column('end'));
1095
+ const readRefName = readerOf(table.column('refName'));
1096
+ const start = new Float64Array(groups).fill(Infinity);
1097
+ const end = new Float64Array(groups).fill(-Infinity);
1098
+ for (let i = 0; i < n; i++) {
1099
+ const g = groupOf[i];
1100
+ start[g] = Math.min(start[g], readStart(i));
1101
+ end[g] = Math.max(end[g], readEnd(i));
1102
+ }
1103
+ return madeGroups({
1104
+ groups,
1105
+ keys: groupby.map((field, f) => {
1106
+ const read = reads[f];
1107
+ return [field, firstRow.map(i => groupKey(read(i)))];
1108
+ }),
1109
+ ops: ops.map(agg => aggregateColumn(table, agg, groupOf, groups)),
1110
+ step,
1111
+ refNames: firstRow.map(i => readRefName(i)),
1112
+ start,
1113
+ end,
1114
+ sectionOf,
1115
+ sections: bounds.length,
1116
+ });
1117
+ }
1118
+ function aggregateColumn(table, agg, groupOf, groups) {
1119
+ const n = table.length;
1120
+ const sums = new OpSums(agg, groups);
1121
+ const { field, weight } = agg;
1122
+ const readValue = agg.op === 'count' || field === undefined
1123
+ ? () => Number.NaN
1124
+ : stepNumberReader(table, field, 'an aggregate');
1125
+ const readWeight = weight !== undefined && isWeighted(agg)
1126
+ ? stepNumberReader(table, weight, 'an aggregate')
1127
+ : () => 1;
1128
+ for (let i = 0; i < n; i++) {
1129
+ sums.add(groupOf[i], readValue(i), readWeight(i));
1130
+ }
1131
+ return sums.column(groups);
1132
+ }
1133
+ // Rows in start order, ties in the order they came: a start and a row packed
1134
+ // into one double and sorted without a comparator, which leaves the typed
1135
+ // sort's fast path only where the packing could not be exact.
1136
+ function sortByStart(rows, starts) {
1137
+ const n = rows.length;
1138
+ let lo = Infinity;
1139
+ let hi = -Infinity;
1140
+ let whole = true;
1141
+ for (let k = 0; k < n; k++) {
1142
+ const v = starts[rows[k]];
1143
+ if (v < lo) {
1144
+ lo = v;
1145
+ }
1146
+ if (v > hi) {
1147
+ hi = v;
1148
+ }
1149
+ whole &&= Number.isInteger(v);
1150
+ }
1151
+ if (whole && (hi - lo + 1) * n < Number.MAX_SAFE_INTEGER) {
1152
+ const keys = new Float64Array(n);
1153
+ for (let k = 0; k < n; k++) {
1154
+ keys[k] = (starts[rows[k]] - lo) * n + k;
1155
+ }
1156
+ keys.sort();
1157
+ const placed = Uint32Array.from(rows);
1158
+ for (let k = 0; k < n; k++) {
1159
+ rows[k] = placed[keys[k] % n];
1160
+ }
1161
+ }
1162
+ else {
1163
+ rows.sort((a, b) => starts[a] - starts[b] || a - b);
1164
+ }
1165
+ }
1166
+ /**
1167
+ * The lowest row each row fits on, greedy first fit in start order within its
1168
+ * section, as a step in front of the encoder rather than a packer behind it.
1169
+ * The rows come out in start order, as the packing met them.
1170
+ */
1171
+ function pileup({ table, bounds }, step) {
1172
+ const as = step.as ?? DEFAULT_PILEUP_AS;
1173
+ const [startField, endField] = step.fields ?? DEFAULT_PILEUP_FIELDS;
1174
+ const padding = step.padding ?? 0;
1175
+ const n = table.length;
1176
+ const readStart = stepNumberReader(table, startField, 'a pileup');
1177
+ const readEnd = stepNumberReader(table, endField, 'a pileup');
1178
+ const starts = new Float64Array(n);
1179
+ const ends = new Float64Array(n);
1180
+ for (let i = 0; i < n; i++) {
1181
+ starts[i] = readStart(i);
1182
+ ends[i] = readEnd(i);
1183
+ }
1184
+ const order = new Uint32Array(n);
1185
+ const packed = new Float64Array(n);
1186
+ for (let s = 0; s + 1 < bounds.length; s++) {
1187
+ const lo = bounds[s];
1188
+ const hi = bounds[s + 1];
1189
+ let inOrder = true;
1190
+ for (let i = lo + 1; i < hi; i++) {
1191
+ inOrder &&= starts[i] >= starts[i - 1];
1192
+ }
1193
+ // Any unreadable start leaves the section out of order. Read as Infinity,
1194
+ // it sorts last and packs where it claims no row a readable one could
1195
+ // want, where NaN left the sort without an order and a row's end
1196
+ // unreadable.
1197
+ if (!inOrder) {
1198
+ for (let i = lo; i < hi; i++) {
1199
+ if (Number.isNaN(starts[i])) {
1200
+ starts[i] = Infinity;
1201
+ }
1202
+ }
1203
+ }
1204
+ for (let i = lo; i < hi; i++) {
1205
+ order[i] = i;
1206
+ }
1207
+ if (!inOrder) {
1208
+ sortByStart(order.subarray(lo, hi), starts);
1209
+ }
1210
+ const rowEnds = [];
1211
+ for (let k = lo; k < hi; k++) {
1212
+ const i = order[k];
1213
+ const start = starts[i];
1214
+ const end = ends[i];
1215
+ let row = 0;
1216
+ while (row < rowEnds.length && rowEnds[row] > start) {
1217
+ row++;
1218
+ }
1219
+ rowEnds[row] = (end > start ? end : start) + padding;
1220
+ packed[k] = row;
1221
+ }
1222
+ }
1223
+ const written = new Map([
1224
+ [as, { kind: 'number', values: packed, at: undefined }],
1225
+ ]);
1226
+ return { table: withColumns(table, written, order), bounds };
1227
+ }
1228
+ /**
1229
+ * Piecewise-constant depth over the rows' spans, per section: one row per run
1230
+ * of equal depth, where the depth is not zero. A sweep over the sorted edges,
1231
+ * so the input need not be sorted.
1232
+ */
1233
+ function coverage({ table, bounds }, step) {
1234
+ const as = step.as ?? DEFAULT_COVERAGE_AS;
1235
+ const readStart = numberReaderOf(table.column('start'));
1236
+ const readEnd = numberReaderOf(table.column('end'));
1237
+ const readRefName = readerOf(table.column('refName'));
1238
+ // Each edge opens or closes one run at most, so two a row bounds the runs.
1239
+ const capacity = 2 * table.length;
1240
+ const outStart = new Float64Array(capacity);
1241
+ const outEnd = new Float64Array(capacity);
1242
+ const outDepth = new Float64Array(capacity);
1243
+ const outSection = new Uint32Array(capacity);
1244
+ const sectionRef = [];
1245
+ const out = new Uint32Array(bounds.length);
1246
+ let k = 0;
1247
+ for (let s = 0; s + 1 < bounds.length; s++) {
1248
+ out[s] = k;
1249
+ const lo = bounds[s];
1250
+ const hi = bounds[s + 1];
1251
+ const spanStarts = new Float64Array(hi - lo);
1252
+ const spanEnds = new Float64Array(hi - lo);
1253
+ let n = 0;
1254
+ for (let i = lo; i < hi; i++) {
1255
+ const start = readStart(i);
1256
+ const end = readEnd(i);
1257
+ if (Number.isFinite(start) && Number.isFinite(end)) {
1258
+ spanStarts[n] = start;
1259
+ spanEnds[n] = end;
1260
+ n++;
1261
+ }
1262
+ }
1263
+ sectionRef.push(n > 0 ? readRefName(lo) : undefined);
1264
+ if (n === 0) {
1265
+ continue;
1266
+ }
1267
+ const starts = spanStarts.subarray(0, n).sort();
1268
+ const ends = spanEnds.subarray(0, n).sort();
1269
+ const first = k;
1270
+ let depth = 0;
1271
+ let runStart = starts[0];
1272
+ let si = 0;
1273
+ let ei = 0;
1274
+ while (si < n || ei < n) {
1275
+ const nextStart = si < n ? starts[si] : Infinity;
1276
+ const nextEnd = ei < n ? ends[ei] : Infinity;
1277
+ const at = Math.min(nextStart, nextEnd);
1278
+ if (depth > 0 && at > runStart) {
1279
+ if (k > first &&
1280
+ outEnd[k - 1] === runStart &&
1281
+ outDepth[k - 1] === depth) {
1282
+ outEnd[k - 1] = at;
1283
+ }
1284
+ else {
1285
+ outStart[k] = runStart;
1286
+ outEnd[k] = at;
1287
+ outDepth[k] = depth;
1288
+ outSection[k] = s;
1289
+ k++;
1290
+ }
1291
+ }
1292
+ runStart = at;
1293
+ while (si < n && starts[si] === at) {
1294
+ depth++;
1295
+ si++;
1296
+ }
1297
+ while (ei < n && ends[ei] === at) {
1298
+ depth--;
1299
+ ei++;
1300
+ }
1301
+ }
1302
+ }
1303
+ out[bounds.length - 1] = k;
1304
+ const section = outSection.slice(0, k);
1305
+ const columns = new Map([
1306
+ ['refName', { kind: 'value', read: i => sectionRef[section[i]] }],
1307
+ ['start', { kind: 'number', values: outStart.slice(0, k), at: undefined }],
1308
+ ['end', { kind: 'number', values: outEnd.slice(0, k), at: undefined }],
1309
+ [as, { kind: 'number', values: outDepth.slice(0, k), at: undefined }],
1310
+ ]);
1311
+ return {
1312
+ table: new MadeTable(k, columns, () => ''),
1313
+ bounds: out,
1314
+ };
1315
+ }
1316
+ function runStep(staged, step, jexl) {
1317
+ switch (step.type) {
1318
+ case 'filter': {
1319
+ return filter(staged, step.expr, jexl);
1320
+ }
1321
+ case 'formula': {
1322
+ return formula(staged, step.expr, step.as, jexl);
1323
+ }
1324
+ case 'flatten': {
1325
+ return flatten(staged, step);
1326
+ }
1327
+ case 'cells': {
1328
+ return cells(staged, step);
1329
+ }
1330
+ case 'bin': {
1331
+ return bin(staged, step);
1332
+ }
1333
+ case 'aggregate': {
1334
+ return aggregate(staged, step);
1335
+ }
1336
+ case 'coverage': {
1337
+ return coverage(staged, step);
1338
+ }
1339
+ case 'pileup': {
1340
+ return pileup(staged, step);
1341
+ }
1342
+ case 'mate': {
1343
+ return mates(staged);
1344
+ }
1345
+ }
1346
+ }
1347
+ function runSteps(staged, steps, jexl) {
1348
+ let current = staged;
1349
+ const list = steps ?? [];
1350
+ for (let k = 0; k < list.length; k++) {
1351
+ const step = list[k];
1352
+ const next = list[k + 1];
1353
+ const fused = step.type === 'bin' &&
1354
+ next?.type === 'aggregate' &&
1355
+ fusesBinAggregate(step, next)
1356
+ ? binnedAggregate(current, step, next)
1357
+ : undefined;
1358
+ if (fused) {
1359
+ current = fused;
1360
+ k++;
1361
+ }
1362
+ else {
1363
+ current = runStep(current, step, jexl);
1364
+ }
1365
+ }
1366
+ return current;
1367
+ }
1368
+ function rowOf(value) {
1369
+ const row = Number(value);
1370
+ return row > 0 ? Math.floor(row) : 0;
1371
+ }
1372
+ /**
1373
+ * #api
1374
+ * A faceted request's layers: the rows split on the facet's field, the
1375
+ * facet's own steps and then each layer's run over each section alone, and
1376
+ * the sections stacked — a section's rows start where the one above it ends,
1377
+ * and it is as tall as the tallest layer packed it. Every layer's rows come
1378
+ * back in section order beside their stacked rows, so a faceted display is
1379
+ * the unfaceted one drawn once per section, and a row is handed on as its
1380
+ * steps left it. A layer naming no `row` field stands on each section's first
1381
+ * row, the answer the unfaceted encoder gives it.
1382
+ *
1383
+ * The split is a counting sort into section order rather than a list per
1384
+ * section: every step runs once over the ordered rows, keeping section order,
1385
+ * and one that groups rows groups within a section.
1386
+ */
1387
+ export function facetLayers(input, facet, layers, jexl) {
1388
+ const table = asTable(input);
1389
+ const { field, transform: sectionSteps } = facet;
1390
+ const categories = categoricalField(field);
1391
+ const n = table.length;
1392
+ const sectionOfKey = new Map();
1393
+ const keyOfRow = new Uint32Array(n);
1394
+ const keys = [];
1395
+ const keyIndex = (key) => {
1396
+ let k = sectionOfKey.get(key);
1397
+ if (k === undefined) {
1398
+ k = keys.length;
1399
+ sectionOfKey.set(key, k);
1400
+ keys.push(key);
1401
+ }
1402
+ return k;
1403
+ };
1404
+ const column = isPlainFieldRef(field) ? table.column(field) : undefined;
1405
+ if (column?.kind === 'category') {
1406
+ // A label's key is filed once, and each row looks its code up.
1407
+ const { codes, labels, at } = column;
1408
+ const ofCode = new Int32Array(labels.length).fill(-1);
1409
+ for (let i = 0; i < n; i++) {
1410
+ const code = codes[at ? at[i] : i];
1411
+ let k = ofCode[code];
1412
+ if (k < 0) {
1413
+ k = keyIndex(categories.key(labels[code]));
1414
+ ofCode[code] = k;
1415
+ }
1416
+ keyOfRow[i] = k;
1417
+ }
1418
+ }
1419
+ else {
1420
+ const read = column
1421
+ ? readerOf(column)
1422
+ : (() => {
1423
+ const r = fieldReader(field, jexl);
1424
+ return (i) => r(table.row(i));
1425
+ })();
1426
+ for (let i = 0; i < n; i++) {
1427
+ keyOfRow[i] = keyIndex(categories.key(read(i)));
1428
+ }
1429
+ }
1430
+ const ordered = [...keys.keys()].sort((a, b) => categories.compare(keys[a], keys[b]));
1431
+ const sectionOf = new Uint32Array(keys.length);
1432
+ for (const [s, k] of ordered.entries()) {
1433
+ sectionOf[k] = s;
1434
+ }
1435
+ const bounds = new Uint32Array(keys.length + 1);
1436
+ for (let i = 0; i < n; i++) {
1437
+ bounds[sectionOf[keyOfRow[i]] + 1]++;
1438
+ }
1439
+ for (let s = 0; s < keys.length; s++) {
1440
+ bounds[s + 1] = bounds[s + 1] + bounds[s];
1441
+ }
1442
+ const next = bounds.slice(0, keys.length);
1443
+ const order = new Uint32Array(n);
1444
+ for (let i = 0; i < n; i++) {
1445
+ order[next[sectionOf[keyOfRow[i]]]++] = i;
1446
+ }
1447
+ const sectioned = runSteps({ table: selectRows(table, order), bounds }, sectionSteps, jexl);
1448
+ const placed = layers.map(({ transform, row }) => {
1449
+ const out = runSteps(sectioned, transform, jexl);
1450
+ const readRow = row === undefined
1451
+ ? undefined
1452
+ : isPlainFieldRef(row)
1453
+ ? readerOf(out.table.column(row))
1454
+ : (() => {
1455
+ const r = fieldReader(row, jexl);
1456
+ return (i) => r(out.table.row(i));
1457
+ })();
1458
+ const local = new Uint32Array(out.table.length);
1459
+ if (readRow) {
1460
+ for (let i = 0; i < local.length; i++) {
1461
+ local[i] = rowOf(readRow(i));
1462
+ }
1463
+ }
1464
+ return { ...out, local };
1465
+ });
1466
+ const rowCount = new Uint32Array(keys.length).fill(1);
1467
+ for (const { bounds: b, local } of placed) {
1468
+ for (let s = 0; s < keys.length; s++) {
1469
+ for (let i = b[s]; i < b[s + 1]; i++) {
1470
+ if (local[i] + 1 > rowCount[s]) {
1471
+ rowCount[s] = local[i] + 1;
1472
+ }
1473
+ }
1474
+ }
1475
+ }
1476
+ const sections = [];
1477
+ const firstRow = new Uint32Array(keys.length);
1478
+ let stacked = 0;
1479
+ for (const [s, k] of ordered.entries()) {
1480
+ firstRow[s] = stacked;
1481
+ sections.push({ key: keys[k], firstRow: stacked, rowCount: rowCount[s] });
1482
+ stacked += rowCount[s];
1483
+ }
1484
+ return {
1485
+ layers: placed.map(({ table: t, bounds: b, local }) => {
1486
+ const rows = new Uint32Array(t.length);
1487
+ for (let s = 0; s < keys.length; s++) {
1488
+ for (let i = b[s]; i < b[s + 1]; i++) {
1489
+ rows[i] = firstRow[s] + local[i];
1490
+ }
1491
+ }
1492
+ return { table: t, rows };
1493
+ }),
1494
+ sections,
1495
+ };
1496
+ }
1497
+ /**
1498
+ * #api
1499
+ * Run the transform steps over a feature list or a table, in order, in the
1500
+ * worker. The table a step answers is what the next one reads, and the last
1501
+ * one is what the encoder walks.
1502
+ */
1503
+ export function runTransforms(input, steps, jexl) {
1504
+ const table = asTable(input);
1505
+ return runSteps({ table, bounds: oneSection(table.length) }, steps, jexl)
1506
+ .table;
1507
+ }
1508
+ // The fields a step writes onto its rows, which a partition on one of them
1509
+ // has to wait for; none for a step that must see every row at once.
1510
+ function writes(step) {
1511
+ switch (step.type) {
1512
+ case 'filter': {
1513
+ return [];
1514
+ }
1515
+ case 'formula': {
1516
+ return [step.as];
1517
+ }
1518
+ case 'bin': {
1519
+ const as = step.as ?? DEFAULT_BIN_AS;
1520
+ return step.fields ? [...as, BIN_OVERLAP_FIELD] : as;
1521
+ }
1522
+ case 'cells': {
1523
+ return ['start', 'end', 'state', 'base', 'match', 'length'];
1524
+ }
1525
+ default: {
1526
+ return undefined;
1527
+ }
1528
+ }
1529
+ }
1530
+ /**
1531
+ * How many of `steps` must run before rows can be split on `field`: the rest
1532
+ * each read a row and answer rows of it in order without writing `field`, so
1533
+ * running them after the split answers the same rows in the same order. A step
1534
+ * that groups rows, fans a row out into entries that may carry their own
1535
+ * `field`, or pairs rows up must run before it, and so must everything ahead
1536
+ * of it.
1537
+ */
1538
+ function partitionPoint(steps, field) {
1539
+ if (!isPlainFieldRef(field)) {
1540
+ return steps.length;
1541
+ }
1542
+ let at = steps.length;
1543
+ while (at > 0 && writes(steps[at - 1])?.includes(field) === false) {
1544
+ at--;
1545
+ }
1546
+ return at;
1547
+ }
1548
+ /**
1549
+ * #api
1550
+ * A layered request's rows: the shared steps, the facet's split where it
1551
+ * names one, and each layer's own steps, with the row each layer's rows stand
1552
+ * in — the field it names, or under a facet each row's stacked row. The split
1553
+ * comes as early as it can: after the last shared step that must see every
1554
+ * row, so the steps that follow it read the rows already in section order.
1555
+ */
1556
+ export function layerTables(input, request, jexl) {
1557
+ const { transform = [], facet, layers } = request;
1558
+ if (!facet) {
1559
+ const shared = runTransforms(input, transform, jexl);
1560
+ return {
1561
+ layers: layers.map(layer => ({
1562
+ table: layer.transform?.length
1563
+ ? runTransforms(shared, layer.transform, jexl)
1564
+ : shared,
1565
+ row: layer.row,
1566
+ })),
1567
+ sections: undefined,
1568
+ };
1569
+ }
1570
+ const at = partitionPoint(transform, facet.field);
1571
+ const split = facetLayers(runTransforms(input, transform.slice(0, at), jexl), {
1572
+ ...facet,
1573
+ transform: [...transform.slice(at), ...(facet.transform ?? [])],
1574
+ }, layers, jexl);
1575
+ return {
1576
+ layers: split.layers.map(({ table, rows }) => ({ table, row: rows })),
1577
+ sections: split.sections,
1578
+ };
1579
+ }