@jbrowse/core 2.16.1 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +1 -2
  2. package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +4 -8
  3. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +1 -1
  4. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +1 -2
  5. package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +2 -3
  6. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +1 -1
  7. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +2 -3
  8. package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +22 -25
  9. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +2 -2
  10. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +6 -8
  11. package/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +1 -1
  12. package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +1 -1
  13. package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +1 -1
  14. package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +3 -4
  15. package/BaseFeatureWidget/BaseFeatureDetail/index.js +5 -9
  16. package/BaseFeatureWidget/BaseFeatureDetail/util.js +0 -5
  17. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -2
  18. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +0 -7
  19. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +2 -2
  20. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -7
  21. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +3 -3
  22. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +24 -33
  23. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +1 -2
  24. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +2 -2
  25. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +3 -4
  26. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +2 -2
  27. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +3 -6
  28. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +1 -1
  29. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +1 -1
  30. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +2 -2
  31. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.d.ts +2 -2
  32. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
  33. package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +2 -35
  34. package/BaseFeatureWidget/SequenceFeatureDetails/model.js +19 -44
  35. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +3 -3
  36. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +2 -2
  37. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +5 -6
  38. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +2 -2
  39. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +0 -1
  40. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +2 -2
  41. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +0 -2
  42. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +1 -1
  43. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +1 -3
  44. package/BaseFeatureWidget/SequenceFeatureDetails/util.js +1 -5
  45. package/BaseFeatureWidget/stateModelFactory.d.ts +3 -94
  46. package/BaseFeatureWidget/stateModelFactory.js +3 -73
  47. package/BaseFeatureWidget/types.d.ts +3 -3
  48. package/BaseFeatureWidget/util.js +0 -4
  49. package/CorePlugin.d.ts +1 -1
  50. package/CorePlugin.js +2 -5
  51. package/Plugin.d.ts +2 -5
  52. package/Plugin.js +0 -3
  53. package/PluginLoader.d.ts +1 -1
  54. package/PluginLoader.js +2 -19
  55. package/PluginManager.d.ts +15 -31
  56. package/PluginManager.js +11 -39
  57. package/ReExports/DataGrid.js +0 -1
  58. package/ReExports/list.d.ts +0 -5
  59. package/ReExports/list.js +0 -5
  60. package/ReExports/modules.d.ts +22 -20
  61. package/ReExports/modules.js +16 -25
  62. package/TextSearch/BaseResults.d.ts +3 -3
  63. package/TextSearch/TextSearchManager.d.ts +4 -16
  64. package/TextSearch/TextSearchManager.js +1 -13
  65. package/assemblyManager/assembly.d.ts +5 -100
  66. package/assemblyManager/assembly.js +27 -143
  67. package/assemblyManager/assemblyConfigSchema.d.ts +1 -34
  68. package/assemblyManager/assemblyConfigSchema.js +12 -46
  69. package/assemblyManager/assemblyManager.d.ts +7 -57
  70. package/assemblyManager/assemblyManager.js +2 -57
  71. package/configuration/configurationSchema.d.ts +4 -4
  72. package/configuration/configurationSchema.js +2 -14
  73. package/configuration/configurationSlot.d.ts +1 -12
  74. package/configuration/configurationSlot.js +2 -32
  75. package/configuration/index.d.ts +2 -2
  76. package/configuration/index.js +2 -2
  77. package/configuration/types.d.ts +2 -3
  78. package/configuration/util.d.ts +1 -25
  79. package/configuration/util.js +19 -56
  80. package/data_adapters/BaseAdapter/BaseAdapter.d.ts +4 -14
  81. package/data_adapters/BaseAdapter/BaseAdapter.js +1 -10
  82. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +10 -114
  83. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +13 -79
  84. package/data_adapters/BaseAdapter/BaseOptions.d.ts +2 -2
  85. package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +2 -2
  86. package/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +3 -6
  87. package/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +3 -3
  88. package/data_adapters/BaseAdapter/RegionsAdapter.d.ts +3 -3
  89. package/data_adapters/BaseAdapter/index.d.ts +4 -4
  90. package/data_adapters/BaseAdapter/types.d.ts +2 -2
  91. package/data_adapters/BaseAdapter/util.d.ts +6 -6
  92. package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +2 -1
  93. package/data_adapters/CytobandAdapter/CytobandAdapter.js +11 -12
  94. package/data_adapters/CytobandAdapter/configSchema.d.ts +0 -3
  95. package/data_adapters/CytobandAdapter/configSchema.js +1 -7
  96. package/data_adapters/CytobandAdapter/index.d.ts +1 -1
  97. package/data_adapters/CytobandAdapter/index.js +1 -1
  98. package/data_adapters/dataAdapterCache.d.ts +4 -21
  99. package/data_adapters/dataAdapterCache.js +0 -19
  100. package/package.json +4 -5
  101. package/pluggableElementTypes/AdapterType.d.ts +2 -2
  102. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  103. package/pluggableElementTypes/ConnectionType.d.ts +3 -3
  104. package/pluggableElementTypes/DisplayType.d.ts +3 -9
  105. package/pluggableElementTypes/InternetAccountType.d.ts +2 -2
  106. package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
  107. package/pluggableElementTypes/PluggableElementBase.js +2 -2
  108. package/pluggableElementTypes/RpcMethodType.d.ts +5 -11
  109. package/pluggableElementTypes/RpcMethodType.js +7 -19
  110. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +9 -0
  111. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +35 -0
  112. package/pluggableElementTypes/TextSearchAdapterType.d.ts +2 -2
  113. package/pluggableElementTypes/TrackType.d.ts +3 -3
  114. package/pluggableElementTypes/ViewType.d.ts +3 -3
  115. package/pluggableElementTypes/WidgetType.d.ts +4 -3
  116. package/pluggableElementTypes/index.d.ts +11 -11
  117. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +2 -29
  118. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -28
  119. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -83
  120. package/pluggableElementTypes/models/BaseDisplayModel.js +2 -69
  121. package/pluggableElementTypes/models/BaseTrackModel.d.ts +4 -46
  122. package/pluggableElementTypes/models/BaseTrackModel.js +0 -58
  123. package/pluggableElementTypes/models/BaseViewModel.d.ts +2 -42
  124. package/pluggableElementTypes/models/BaseViewModel.js +2 -38
  125. package/pluggableElementTypes/models/InternetAccountModel.d.ts +3 -119
  126. package/pluggableElementTypes/models/InternetAccountModel.js +3 -123
  127. package/pluggableElementTypes/models/baseConnectionConfig.d.ts +0 -6
  128. package/pluggableElementTypes/models/baseConnectionConfig.js +1 -13
  129. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -15
  130. package/pluggableElementTypes/models/baseInternetAccountConfig.js +1 -23
  131. package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -53
  132. package/pluggableElementTypes/models/baseTrackConfig.js +1 -58
  133. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +7 -15
  134. package/pluggableElementTypes/renderers/BoxRendererType.js +3 -14
  135. package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +3 -2
  136. package/pluggableElementTypes/renderers/CircularChordRendererType.js +1 -6
  137. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -21
  138. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -25
  139. package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -47
  140. package/pluggableElementTypes/renderers/FeatureRendererType.js +15 -68
  141. package/pluggableElementTypes/renderers/RendererType.d.ts +4 -8
  142. package/pluggableElementTypes/renderers/RendererType.js +1 -5
  143. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +2 -2
  144. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +3 -12
  145. package/pluggableElementTypes/renderers/ServerSideRenderedContent.d.ts +1 -1
  146. package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +6 -14
  147. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +9 -49
  148. package/pluggableElementTypes/renderers/ServerSideRendererType.js +7 -57
  149. package/pluggableElementTypes/renderers/index.d.ts +1 -1
  150. package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -3
  151. package/rpc/BaseRpcDriver.d.ts +3 -4
  152. package/rpc/BaseRpcDriver.js +20 -80
  153. package/rpc/MainThreadRpcDriver.d.ts +3 -7
  154. package/rpc/MainThreadRpcDriver.js +0 -5
  155. package/rpc/RpcManager.d.ts +3 -3
  156. package/rpc/RpcManager.js +2 -4
  157. package/rpc/WebWorkerRpcDriver.d.ts +3 -2
  158. package/rpc/WebWorkerRpcDriver.js +2 -13
  159. package/rpc/baseRpcConfig.d.ts +0 -3
  160. package/rpc/baseRpcConfig.js +1 -7
  161. package/rpc/configSchema.d.ts +0 -6
  162. package/rpc/configSchema.js +2 -11
  163. package/rpc/mainThreadRpcConfig.js +1 -7
  164. package/rpc/methods/CoreFreeResources.d.ts +0 -6
  165. package/rpc/methods/CoreFreeResources.js +2 -9
  166. package/rpc/methods/CoreGetFeatureDensityStats.d.ts +4 -5
  167. package/rpc/methods/CoreGetFeatureDensityStats.js +1 -1
  168. package/rpc/methods/CoreGetFeatureDetails.d.ts +2 -7
  169. package/rpc/methods/CoreGetFeatureDetails.js +0 -5
  170. package/rpc/methods/CoreGetFeatures.d.ts +5 -5
  171. package/rpc/methods/CoreGetFeatures.js +4 -5
  172. package/rpc/methods/CoreGetFileInfo.d.ts +1 -2
  173. package/rpc/methods/CoreGetFileInfo.js +1 -1
  174. package/rpc/methods/CoreGetMetadata.d.ts +1 -2
  175. package/rpc/methods/CoreGetMetadata.js +1 -1
  176. package/rpc/methods/CoreGetRefNames.d.ts +1 -2
  177. package/rpc/methods/CoreGetRefNames.js +1 -1
  178. package/rpc/methods/CoreRender.d.ts +2 -6
  179. package/rpc/methods/CoreRender.js +5 -7
  180. package/rpc/methods/util.d.ts +3 -3
  181. package/rpc/methods/util.js +0 -1
  182. package/rpc/webWorkerRpcConfig.js +1 -7
  183. package/stories/JBrowseCore.stories.d.ts +1 -1
  184. package/stories/JBrowseCore.stories.js +3 -3
  185. package/stories/examples/WithSequencePanel.d.ts +1 -1
  186. package/stories/examples/WithSequencePanel.js +3 -3
  187. package/tsconfig.build.tsbuildinfo +1 -1
  188. package/ui/AppLogo.d.ts +1 -1
  189. package/ui/AppLogo.js +0 -2
  190. package/ui/AssemblySelector.d.ts +2 -2
  191. package/ui/AssemblySelector.js +5 -5
  192. package/ui/BaseTooltip.js +2 -6
  193. package/ui/CascadingMenu.d.ts +2 -2
  194. package/ui/CascadingMenu.js +3 -4
  195. package/ui/CascadingMenuButton.d.ts +1 -1
  196. package/ui/CascadingMenuButton.js +1 -1
  197. package/ui/ColorPicker.js +1 -7
  198. package/ui/Dialog.d.ts +1 -1
  199. package/ui/Dialog.js +2 -6
  200. package/ui/DropDownMenu.d.ts +1 -1
  201. package/ui/DropDownMenu.js +2 -2
  202. package/ui/EditableTypography.d.ts +1 -1
  203. package/ui/EditableTypography.js +1 -5
  204. package/ui/ErrorBoundary.d.ts +2 -1
  205. package/ui/ErrorMessage.js +2 -9
  206. package/ui/ErrorMessageStackTraceDialog.js +2 -10
  207. package/ui/FactoryResetDialog.js +1 -1
  208. package/ui/FatalErrorDialog.js +1 -1
  209. package/ui/FileSelector/FileSelector.d.ts +4 -3
  210. package/ui/FileSelector/FileSelector.js +40 -40
  211. package/ui/FileSelector/LocalFileChooser.d.ts +1 -1
  212. package/ui/FileSelector/LocalFileChooser.js +0 -1
  213. package/ui/FileSelector/UrlChooser.d.ts +4 -3
  214. package/ui/FileSelector/UrlChooser.js +6 -2
  215. package/ui/Icons.d.ts +1 -1
  216. package/ui/Icons.js +1 -7
  217. package/ui/LoadingEllipses.d.ts +1 -1
  218. package/ui/LoadingEllipses.js +3 -3
  219. package/ui/Menu.d.ts +1 -1
  220. package/ui/Menu.js +3 -10
  221. package/ui/MenuButton.d.ts +1 -1
  222. package/ui/ResizeHandle.js +2 -2
  223. package/ui/ReturnToImportFormDialog.js +1 -1
  224. package/ui/SanitizedHTML.js +2 -19
  225. package/ui/Snackbar.d.ts +2 -2
  226. package/ui/Snackbar.js +1 -2
  227. package/ui/SnackbarModel.d.ts +1 -26
  228. package/ui/SnackbarModel.js +2 -30
  229. package/ui/colors.d.ts +1 -1
  230. package/ui/colors.js +1 -1
  231. package/ui/react-colorful.js +0 -3
  232. package/ui/theme.d.ts +1 -1
  233. package/ui/theme.js +24 -84
  234. package/util/Base1DUtils.d.ts +1 -1
  235. package/util/Base1DUtils.js +0 -12
  236. package/util/Base1DViewModel.d.ts +4 -81
  237. package/util/Base1DViewModel.js +4 -108
  238. package/util/QuickLRU.js +0 -9
  239. package/util/TimeTraveller.js +0 -4
  240. package/util/aborting.d.ts +0 -20
  241. package/util/aborting.js +0 -31
  242. package/util/analytics.js +1 -12
  243. package/util/blockTypes.d.ts +0 -11
  244. package/util/blockTypes.js +0 -13
  245. package/util/calculateDynamicBlocks.d.ts +1 -20
  246. package/util/calculateDynamicBlocks.js +1 -22
  247. package/util/calculateStaticBlocks.d.ts +2 -2
  248. package/util/calculateStaticBlocks.js +0 -2
  249. package/util/color/cssColorsLevel4.js +0 -1
  250. package/util/color/index.d.ts +0 -19
  251. package/util/color/index.js +0 -30
  252. package/util/compositeMap.js +0 -2
  253. package/util/dedupe.js +0 -1
  254. package/util/formatFastaStrings.d.ts +0 -13
  255. package/util/formatFastaStrings.js +0 -13
  256. package/util/idMaker.d.ts +1 -1
  257. package/util/idMaker.js +16 -12
  258. package/util/index.d.ts +25 -173
  259. package/util/index.js +87 -326
  260. package/util/io/RemoteFileWithRangeCache.d.ts +3 -2
  261. package/util/io/RemoteFileWithRangeCache.js +6 -10
  262. package/util/io/index.d.ts +3 -4
  263. package/util/io/index.js +3 -17
  264. package/util/jexl.js +3 -13
  265. package/util/jexlStrings.d.ts +0 -6
  266. package/util/jexlStrings.js +0 -8
  267. package/util/layouts/BaseLayout.d.ts +1 -1
  268. package/util/layouts/GranularRectLayout.d.ts +1 -17
  269. package/util/layouts/GranularRectLayout.js +4 -81
  270. package/util/layouts/MultiLayout.d.ts +1 -6
  271. package/util/layouts/MultiLayout.js +0 -6
  272. package/util/layouts/PrecomputedLayout.d.ts +1 -4
  273. package/util/layouts/PrecomputedLayout.js +0 -5
  274. package/util/layouts/PrecomputedMultiLayout.js +0 -2
  275. package/util/layouts/SceneGraph.d.ts +0 -12
  276. package/util/layouts/SceneGraph.js +0 -13
  277. package/util/makeAbortableReaction.d.ts +2 -0
  278. package/util/makeAbortableReaction.js +50 -0
  279. package/util/map-obj.js +0 -4
  280. package/util/mst-reflection.d.ts +1 -14
  281. package/util/mst-reflection.js +1 -28
  282. package/util/nanoid.js +0 -31
  283. package/util/nextTick.d.ts +1 -0
  284. package/util/nextTick.js +6 -0
  285. package/util/offscreenCanvasPonyfill.d.ts +0 -1
  286. package/util/offscreenCanvasPonyfill.js +1 -9
  287. package/util/offscreenCanvasUtils.js +1 -8
  288. package/util/range.d.ts +0 -25
  289. package/util/range.js +0 -34
  290. package/util/rxjs.d.ts +3 -7
  291. package/util/rxjs.js +2 -9
  292. package/util/simpleFeature.d.ts +0 -58
  293. package/util/simpleFeature.js +0 -35
  294. package/util/stats.d.ts +4 -34
  295. package/util/stats.js +0 -60
  296. package/util/stopToken.d.ts +3 -0
  297. package/util/stopToken.js +29 -0
  298. package/util/tracks.d.ts +3 -25
  299. package/util/tracks.js +0 -30
  300. package/util/types/index.d.ts +14 -30
  301. package/util/types/index.js +5 -14
  302. package/util/types/mst.js +0 -9
  303. package/util/types/util.d.ts +2 -9
  304. package/util/useMeasure.js +0 -1
  305. package/util/when.d.ts +1 -15
  306. package/util/when.js +3 -70
  307. package/rpc/remoteAbortSignals.d.ts +0 -36
  308. package/rpc/remoteAbortSignals.js +0 -79
package/util/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.blobToDataURL = exports.isFeature = exports.SimpleFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.complement = exports.isElectron = void 0;
20
+ exports.makeAbortableReaction = exports.blobToDataURL = exports.isFeature = exports.SimpleFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.complementTable = exports.isElectron = void 0;
21
21
  exports.useDebounce = useDebounce;
22
22
  exports.useWidthSetter = useWidthSetter;
23
23
  exports.useDebouncedCallback = useDebouncedCallback;
@@ -45,7 +45,6 @@ exports.bpSpanPx = bpSpanPx;
45
45
  exports.iterMap = iterMap;
46
46
  exports.findLastIndex = findLastIndex;
47
47
  exports.findLast = findLast;
48
- exports.makeAbortableReaction = makeAbortableReaction;
49
48
  exports.renameRegionIfNeeded = renameRegionIfNeeded;
50
49
  exports.renameRegionsIfNeeded = renameRegionsIfNeeded;
51
50
  exports.minmax = minmax;
@@ -53,10 +52,12 @@ exports.shorten = shorten;
53
52
  exports.stringify = stringify;
54
53
  exports.revcom = revcom;
55
54
  exports.reverse = reverse;
55
+ exports.complement = complement;
56
56
  exports.measureText = measureText;
57
57
  exports.getFrame = getFrame;
58
58
  exports.generateCodonTable = generateCodonTable;
59
59
  exports.updateStatus = updateStatus;
60
+ exports.updateStatus2 = updateStatus2;
60
61
  exports.hashCode = hashCode;
61
62
  exports.objectHash = objectHash;
62
63
  exports.bytesForRegions = bytesForRegions;
@@ -88,20 +89,17 @@ exports.getStrokeProps = getStrokeProps;
88
89
  exports.getFillProps = getFillProps;
89
90
  exports.renderToStaticMarkup = renderToStaticMarkup;
90
91
  exports.isGzip = isGzip;
92
+ exports.fetchAndMaybeUnzip = fetchAndMaybeUnzip;
91
93
  const react_1 = require("react");
94
+ const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
95
+ const useMeasure_1 = __importDefault(require("@jbrowse/core/util/useMeasure"));
92
96
  const is_object_1 = __importDefault(require("is-object"));
93
97
  const mobx_state_tree_1 = require("mobx-state-tree");
94
- const mobx_1 = require("mobx");
95
- const types_1 = require("./types");
96
- const aborting_1 = require("./aborting");
97
- const types_2 = require("./types");
98
- // has to be the full path and not the relative path to get the jest mock
99
- const useMeasure_1 = __importDefault(require("@jbrowse/core/util/useMeasure"));
100
- const colord_1 = require("./colord");
101
- // eslint-disable-next-line react/no-deprecated
102
98
  const react_dom_1 = require("react-dom");
99
+ const colord_1 = require("./colord");
100
+ const stopToken_1 = require("./stopToken");
101
+ const types_1 = require("./types");
103
102
  __exportStar(require("./types"), exports);
104
- __exportStar(require("./aborting"), exports);
105
103
  __exportStar(require("./when"), exports);
106
104
  __exportStar(require("./range"), exports);
107
105
  __exportStar(require("./dedupe"), exports);
@@ -119,14 +117,10 @@ function useDebounce(value, delay) {
119
117
  }, [value, delay]);
120
118
  return debouncedValue;
121
119
  }
122
- // used in ViewContainer files to get the width
123
120
  function useWidthSetter(view, padding) {
124
121
  const [ref, { width }] = (0, useMeasure_1.default)();
125
122
  (0, react_1.useEffect)(() => {
126
123
  if (width && (0, mobx_state_tree_1.isAlive)(view)) {
127
- // sets after a requestAnimationFrame
128
- // https://stackoverflow.com/a/58701523/2129219
129
- // avoids ResizeObserver loop error being shown during development
130
124
  requestAnimationFrame(() => {
131
125
  view.setWidth(width - Number.parseInt(padding, 10) * 2);
132
126
  });
@@ -134,26 +128,19 @@ function useWidthSetter(view, padding) {
134
128
  }, [padding, view, width]);
135
129
  return ref;
136
130
  }
137
- // https://stackoverflow.com/questions/56283920/
138
131
  function useDebouncedCallback(callback, wait = 400) {
139
- // track args & timeout handle between calls
140
132
  const argsRef = (0, react_1.useRef)();
141
133
  const timeout = (0, react_1.useRef)();
142
- // make sure our timeout gets cleared if our consuming component gets
143
- // unmounted
144
134
  (0, react_1.useEffect)(() => {
145
135
  if (timeout.current) {
146
136
  clearTimeout(timeout.current);
147
137
  }
148
138
  }, []);
149
139
  return function debouncedCallback(...args) {
150
- // capture latest args
151
140
  argsRef.current = args;
152
- // clear debounce timer
153
141
  if (timeout.current) {
154
142
  clearTimeout(timeout.current);
155
143
  }
156
- // start waiting again
157
144
  timeout.current = setTimeout(() => {
158
145
  if (argsRef.current) {
159
146
  callback(...argsRef.current);
@@ -161,9 +148,6 @@ function useDebouncedCallback(callback, wait = 400) {
161
148
  }, wait);
162
149
  };
163
150
  }
164
- /**
165
- * find the first node in the hierarchy that matches the given predicate
166
- */
167
151
  function findParentThat(node, predicate) {
168
152
  if (!(0, mobx_state_tree_1.hasParent)(node)) {
169
153
  throw new Error('node does not have parent');
@@ -182,7 +166,6 @@ function findParentThat(node, predicate) {
182
166
  }
183
167
  throw new Error('no matching node found');
184
168
  }
185
- // based on https://github.com/react-spring/react-spring/blob/cd5548a987383b8023efd620f3726a981f9e18ea/src/animated/FrameLoop.ts
186
169
  function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, precision = 0, tension = 400, friction = 20, clamp = true) {
187
170
  const mass = 1;
188
171
  if (!precision) {
@@ -194,11 +177,9 @@ function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, preci
194
177
  let position = animation.lastPosition;
195
178
  let lastTime = animation.lastTime || time;
196
179
  let velocity = animation.lastVelocity || 0;
197
- // If we lost a lot of frames just jump to the end.
198
180
  if (time > lastTime + 64) {
199
181
  lastTime = time;
200
182
  }
201
- // http://gafferongames.com/game-physics/fix-your-timestep/
202
183
  const numSteps = Math.floor(time - lastTime);
203
184
  for (let i = 0; i < numSteps; ++i) {
204
185
  const force = -tension * (position - toValue);
@@ -239,17 +220,9 @@ function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, preci
239
220
  },
240
221
  ];
241
222
  }
242
- /**
243
- * find the first node in the hierarchy that matches the given 'is' typescript
244
- * type guard predicate
245
- */
246
223
  function findParentThatIs(node, predicate) {
247
224
  return findParentThat(node, predicate);
248
225
  }
249
- /**
250
- * get the current JBrowse session model, starting at any node in the state
251
- * tree
252
- */
253
226
  function getSession(node) {
254
227
  try {
255
228
  return findParentThatIs(node, types_1.isSessionModel);
@@ -258,10 +231,6 @@ function getSession(node) {
258
231
  throw new Error('no session model found!');
259
232
  }
260
233
  }
261
- /**
262
- * get the state model of the view in the state tree that contains the given
263
- * node
264
- */
265
234
  function getContainingView(node) {
266
235
  try {
267
236
  return findParentThatIs(node, types_1.isViewModel);
@@ -270,10 +239,6 @@ function getContainingView(node) {
270
239
  throw new Error('no containing view found');
271
240
  }
272
241
  }
273
- /**
274
- * get the state model of the view in the state tree that contains the given
275
- * node
276
- */
277
242
  function getContainingTrack(node) {
278
243
  try {
279
244
  return findParentThatIs(node, types_1.isTrackModel);
@@ -282,10 +247,6 @@ function getContainingTrack(node) {
282
247
  throw new Error('no containing track found');
283
248
  }
284
249
  }
285
- /**
286
- * get the state model of the display in the state tree that contains the given
287
- * node
288
- */
289
250
  function getContainingDisplay(node) {
290
251
  try {
291
252
  return findParentThatIs(node, types_1.isDisplayModel);
@@ -294,46 +255,9 @@ function getContainingDisplay(node) {
294
255
  throw new Error('no containing display found');
295
256
  }
296
257
  }
297
- /**
298
- * Assemble a 1-based "locString" from an interbase genomic location
299
- * @param region - Region
300
- * @example
301
- * ```ts
302
- * assembleLocString({ refName: 'chr1', start: 0, end: 100 })
303
- * // ↳ 'chr1:1..100'
304
- * ```
305
- * @example
306
- * ```ts
307
- * assembleLocString({ assemblyName: 'hg19', refName: 'chr1', start: 0, end: 100 })
308
- * // ↳ '{hg19}chr1:1..100'
309
- * ```
310
- * @example
311
- * ```ts
312
- * assembleLocString({ refName: 'chr1' })
313
- * // ↳ 'chr1'
314
- * ```
315
- * @example
316
- * ```ts
317
- * assembleLocString({ refName: 'chr1', start: 0 })
318
- * // ↳ 'chr1:1..'
319
- * ```
320
- * @example
321
- * ```ts
322
- * assembleLocString({ refName: 'chr1', end: 100 })
323
- * // ↳ 'chr1:1..100'
324
- * ```
325
- * @example
326
- * ```ts
327
- * assembleLocString({ refName: 'chr1', start: 0, end: 1 })
328
- * // ↳ 'chr1:1'
329
- * ```
330
- */
331
258
  function assembleLocString(region) {
332
259
  return assembleLocStringFast(region, toLocale);
333
260
  }
334
- // same as assembleLocString above, but does not perform toLocaleString which
335
- // can slow down the speed of block calculations which use assembleLocString
336
- // for block.key
337
261
  function assembleLocStringFast(region, cb = (n) => n) {
338
262
  const { assemblyName, refName, start, end, reversed } = region;
339
263
  const assemblyNameString = assemblyName ? `{${assemblyName}}` : '';
@@ -369,10 +293,7 @@ function parseLocStringOneBased(locString, isValidRefName) {
369
293
  reversed = true;
370
294
  locString = locString.replace(/\[rev]$/, '');
371
295
  }
372
- // remove any whitespace
373
296
  locString = locString.replace(/\s/, '');
374
- // refNames can have colons, refer to
375
- // https://samtools.github.io/hts-specs/SAMv1.pdf Appendix A
376
297
  const assemblyMatch = /({(.+)})?(.+)/.exec(locString);
377
298
  if (!assemblyMatch) {
378
299
  throw new Error(`invalid location string: "${locString}"`);
@@ -402,9 +323,7 @@ function parseLocStringOneBased(locString, isValidRefName) {
402
323
  }
403
324
  else if (isValidRefName(prefix, assemblyName)) {
404
325
  if (suffix) {
405
- // see if it's a range
406
326
  const rangeMatch = /^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)(-?(\d+|\d{1,3}(,\d{3})*))$/.exec(suffix);
407
- // see if it's a single point
408
327
  const singleMatch = /^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)?$/.exec(suffix);
409
328
  if (rangeMatch) {
410
329
  const [, start, , , , end] = rangeMatch;
@@ -422,7 +341,6 @@ function parseLocStringOneBased(locString, isValidRefName) {
422
341
  const [, start, , , separator] = singleMatch;
423
342
  if (start !== undefined) {
424
343
  if (separator) {
425
- // indefinite end
426
344
  return {
427
345
  assemblyName,
428
346
  refName: prefix,
@@ -460,43 +378,6 @@ function parseLocStringOneBased(locString, isValidRefName) {
460
378
  }
461
379
  throw new Error(`unknown reference sequence name in location "${locString}"`);
462
380
  }
463
- /**
464
- * Parse a 1-based location string into an interbase genomic location
465
- * @param locString - Location string
466
- * @param isValidRefName - Function that checks if a refName exists in the set
467
- * of all known refNames, or in the set of refNames for an assembly if
468
- * assemblyName is given
469
- * @example
470
- * ```ts
471
- * parseLocString('chr1:1..100', isValidRefName)
472
- * // ↳ { refName: 'chr1', start: 0, end: 100 }
473
- * ```
474
- * @example
475
- * ```ts
476
- * parseLocString('chr1:1-100', isValidRefName)
477
- * // ↳ { refName: 'chr1', start: 0, end: 100 }
478
- * ```
479
- * @example
480
- * ```ts
481
- * parseLocString(`{hg19}chr1:1..100`, isValidRefName)
482
- * // ↳ { assemblyName: 'hg19', refName: 'chr1', start: 0, end: 100 }
483
- * ```
484
- * @example
485
- * ```ts
486
- * parseLocString('chr1', isValidRefName)
487
- * // ↳ { refName: 'chr1' }
488
- * ```
489
- * @example
490
- * ```ts
491
- * parseLocString('chr1:1', isValidRefName)
492
- * // ↳ { refName: 'chr1', start: 0, end: 1 }
493
- * ```
494
- * @example
495
- * ```ts
496
- * parseLocString('chr1:1..', isValidRefName)
497
- * // ↳ { refName: 'chr1', start: 0}
498
- * ```
499
- */
500
381
  function parseLocString(locString, isValidRefName) {
501
382
  const parsed = parseLocStringOneBased(locString, isValidRefName);
502
383
  if (typeof parsed.start === 'number') {
@@ -536,13 +417,6 @@ function compareLocStrings(a, b, isValidRefName) {
536
417
  const locB = parseLocString(b, isValidRefName);
537
418
  return compareLocs(locA, locB);
538
419
  }
539
- /**
540
- * Ensure that a number is at least min and at most max.
541
- *
542
- * @param num -
543
- * @param min -
544
- * @param max -
545
- */
546
420
  function clamp(num, min, max) {
547
421
  if (num < min) {
548
422
  return min;
@@ -555,11 +429,6 @@ function clamp(num, min, max) {
555
429
  function roundToNearestPointOne(num) {
556
430
  return Math.round(num * 10) / 10;
557
431
  }
558
- /**
559
- * @param bp -
560
- * @param region -
561
- * @param bpPerPx -
562
- */
563
432
  function bpToPx(bp, { reversed, end = 0, start = 0, }, bpPerPx) {
564
433
  return roundToNearestPointOne((reversed ? end - bp : bp - start) / bpPerPx);
565
434
  }
@@ -571,17 +440,9 @@ function radToDeg(radians) {
571
440
  function degToRad(degrees) {
572
441
  return (degrees * piOverOneEighty) % (2 * Math.PI);
573
442
  }
574
- /**
575
- * @returns [x, y]
576
- */
577
443
  function polarToCartesian(rho, theta) {
578
444
  return [rho * Math.cos(theta), rho * Math.sin(theta)];
579
445
  }
580
- /**
581
- * @param x - the x
582
- * @param y - the y
583
- * @returns [rho, theta]
584
- */
585
446
  function cartesianToPolar(x, y) {
586
447
  const rho = Math.sqrt(x * x + y * y);
587
448
  const theta = Math.atan(y / x);
@@ -595,7 +456,6 @@ function bpSpanPx(leftBp, rightBp, region, bpPerPx) {
595
456
  const end = bpToPx(rightBp, region, bpPerPx);
596
457
  return region.reversed ? [end, start] : [start, end];
597
458
  }
598
- // do an array map of an iterable
599
459
  function iterMap(iter, func, sizeHint) {
600
460
  const results = Array.from({ length: sizeHint || 0 });
601
461
  let counter = 0;
@@ -605,19 +465,6 @@ function iterMap(iter, func, sizeHint) {
605
465
  }
606
466
  return results;
607
467
  }
608
- /**
609
- * Returns the index of the last element in the array where predicate is true,
610
- * and -1 otherwise.
611
- * Based on https://stackoverflow.com/a/53187807
612
- *
613
- * @param array - The source array to search in
614
- *
615
- * @param predicate - find calls predicate once for each element of the array, in
616
- * descending order, until it finds one where predicate returns true.
617
- *
618
- * @returns findLastIndex returns element index where predicate is true.
619
- * Otherwise, findLastIndex returns -1.
620
- */
621
468
  function findLastIndex(array, predicate) {
622
469
  let l = array.length;
623
470
  while (l--) {
@@ -636,87 +483,14 @@ function findLast(array, predicate) {
636
483
  }
637
484
  return undefined;
638
485
  }
639
- /**
640
- * makes a mobx reaction with the given functions, that calls actions on the
641
- * model for each stage of execution, and to abort the reaction function when
642
- * the model is destroyed.
643
- *
644
- * Will call startedFunction(signal), successFunction(result), and
645
- * errorFunction(error) when the async reaction function starts, completes, and
646
- * errors respectively.
647
- *
648
- * @param self -
649
- * @param dataFunction -
650
- * @param asyncReactionFunction -
651
- * @param reactionOptions -
652
- * @param startedFunction -
653
- * @param successFunction -
654
- * @param errorFunction -
655
- */
656
- function makeAbortableReaction(self, dataFunction, asyncReactionFunction,
657
- // @ts-expect-error
658
- reactionOptions, startedFunction, successFunction, errorFunction) {
659
- let inProgress;
660
- function handleError(error) {
661
- if (!(0, aborting_1.isAbortException)(error)) {
662
- if ((0, mobx_state_tree_1.isAlive)(self)) {
663
- errorFunction(error);
664
- }
665
- else {
666
- console.error(error);
667
- }
668
- }
669
- }
670
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.reaction)(() => {
671
- try {
672
- return dataFunction(self);
673
- }
674
- catch (e) {
675
- handleError(e);
676
- return undefined;
677
- }
678
- }, async (data, mobxReactionHandle) => {
679
- if (inProgress && !inProgress.signal.aborted) {
680
- inProgress.abort();
681
- }
682
- if (!(0, mobx_state_tree_1.isAlive)(self)) {
683
- return;
684
- }
685
- inProgress = new AbortController();
686
- const thisInProgress = inProgress;
687
- startedFunction(thisInProgress);
688
- try {
689
- const result = await asyncReactionFunction(data, thisInProgress.signal, self,
690
- // @ts-expect-error
691
- mobxReactionHandle);
692
- (0, aborting_1.checkAbortSignal)(thisInProgress.signal);
693
- if ((0, mobx_state_tree_1.isAlive)(self)) {
694
- successFunction(result);
695
- }
696
- }
697
- catch (e) {
698
- if (!thisInProgress.signal.aborted) {
699
- thisInProgress.abort();
700
- }
701
- handleError(e);
702
- }
703
- }, reactionOptions));
704
- (0, mobx_state_tree_1.addDisposer)(self, () => {
705
- if (inProgress && !inProgress.signal.aborted) {
706
- inProgress.abort();
707
- }
708
- });
709
- }
710
486
  function renameRegionIfNeeded(refNameMap, region) {
711
487
  if ((0, mobx_state_tree_1.isStateTreeNode)(region) && !(0, mobx_state_tree_1.isAlive)(region)) {
712
488
  return region;
713
489
  }
714
490
  if (refNameMap === null || refNameMap === void 0 ? void 0 : refNameMap[region.refName]) {
715
- // clone the region so we don't modify it
716
491
  region = (0, mobx_state_tree_1.isStateTreeNode)(region)
717
492
  ? { ...(0, mobx_state_tree_1.getSnapshot)(region) }
718
493
  : { ...region };
719
- // modify it directly in the container
720
494
  const newRef = refNameMap[region.refName];
721
495
  if (newRef) {
722
496
  return { ...region, refName: newRef, originalRefName: region.refName };
@@ -738,9 +512,7 @@ async function renameRegionsIfNeeded(assemblyManager, args) {
738
512
  })));
739
513
  return {
740
514
  ...args,
741
- regions: regions.map((region, i) =>
742
- // note: uses assemblyNames defined above since region could be dead now
743
- renameRegionIfNeeded(assemblyMaps[assemblyNames[i]], region)),
515
+ regions: regions.map((region, i) => renameRegionIfNeeded(assemblyMaps[assemblyNames[i]], region)),
744
516
  };
745
517
  }
746
518
  function minmax(a, b) {
@@ -759,67 +531,66 @@ function stringify({ refName, coord, assemblyName, oob, }, useAssemblyName) {
759
531
  : '',
760
532
  ].join('');
761
533
  }
762
- // this is recommended in a later comment in
763
- // https://github.com/electron/electron/issues/2288 for detecting electron in a
764
- // renderer process, which is the one that has node enabled for us
765
- //
766
- // const isElectron = process.versions.electron
767
- // const i2 = process.versions.hasOwnProperty('electron')
768
534
  exports.isElectron = /electron/i.test(typeof navigator !== 'undefined' ? navigator.userAgent : '');
769
- function revcom(seqString) {
770
- return reverse((0, exports.complement)(seqString));
771
- }
772
- function reverse(seqString) {
773
- return seqString.split('').reverse().join('');
774
- }
775
- exports.complement = (() => {
776
- const complementRegex = /[ACGT]/gi;
777
- // from bioperl: tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/
778
- // generated with:
779
- // perl -MJSON -E '@l = split "","acgtrymkswhbvdnxACGTRYMKSWHBVDNX"; print to_json({ map { my $in = $_; tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/; $in => $_ } @l})'
780
- const complementTable = {
781
- S: 'S',
782
- w: 'w',
783
- T: 'A',
784
- r: 'y',
785
- a: 't',
786
- N: 'N',
787
- K: 'M',
788
- x: 'x',
789
- d: 'h',
790
- Y: 'R',
791
- V: 'B',
792
- y: 'r',
793
- M: 'K',
794
- h: 'd',
795
- k: 'm',
796
- C: 'G',
797
- g: 'c',
798
- t: 'a',
799
- A: 'T',
800
- n: 'n',
801
- W: 'W',
802
- X: 'X',
803
- m: 'k',
804
- v: 'b',
805
- B: 'V',
806
- s: 's',
807
- H: 'D',
808
- c: 'g',
809
- D: 'H',
810
- b: 'v',
811
- R: 'Y',
812
- G: 'C',
813
- };
814
- return (seqString) => {
815
- return seqString.replaceAll(complementRegex, m => complementTable[m] || '');
816
- };
817
- })();
818
- // requires immediate execution in jest environment, because (hypothesis) it
819
- // otherwise listens for prerendered_canvas but reads empty pixels, and doesn't
820
- // get the contents of the canvas
535
+ exports.complementTable = {
536
+ S: 'S',
537
+ w: 'w',
538
+ T: 'A',
539
+ r: 'y',
540
+ a: 't',
541
+ N: 'N',
542
+ K: 'M',
543
+ x: 'x',
544
+ d: 'h',
545
+ Y: 'R',
546
+ V: 'B',
547
+ y: 'r',
548
+ M: 'K',
549
+ h: 'd',
550
+ k: 'm',
551
+ C: 'G',
552
+ g: 'c',
553
+ t: 'a',
554
+ A: 'T',
555
+ n: 'n',
556
+ W: 'W',
557
+ X: 'X',
558
+ m: 'k',
559
+ v: 'b',
560
+ B: 'V',
561
+ s: 's',
562
+ H: 'D',
563
+ c: 'g',
564
+ D: 'H',
565
+ b: 'v',
566
+ R: 'Y',
567
+ G: 'C',
568
+ };
569
+ function revcom(str) {
570
+ var _a;
571
+ let revcomped = '';
572
+ for (let i = str.length - 1; i >= 0; i--) {
573
+ revcomped += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
574
+ }
575
+ return revcomped;
576
+ }
577
+ function reverse(str) {
578
+ let reversed = '';
579
+ for (let i = str.length - 1; i >= 0; i--) {
580
+ reversed += str[i];
581
+ }
582
+ return reversed;
583
+ }
584
+ function complement(str) {
585
+ var _a;
586
+ let comp = '';
587
+ for (let i = 0; i < str.length; i++) {
588
+ comp += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
589
+ }
590
+ return comp;
591
+ }
821
592
  exports.rIC = typeof jest === 'undefined'
822
- ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
593
+ ?
823
594
  typeof window !== 'undefined' && window.requestIdleCallback
824
595
  ? window.requestIdleCallback
825
596
  : (cb) => setTimeout(() => {
@@ -828,9 +599,7 @@ exports.rIC = typeof jest === 'undefined'
828
599
  : (cb) => {
829
600
  cb();
830
601
  };
831
- // prettier-ignore
832
602
  const widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2765625, 0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625, 0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125, 0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875, 1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625, 0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625, 0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625, 0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375, 0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625, 0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5, 0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875, 0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875, 0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625];
833
- // xref https://gist.github.com/tophtucker/62f93a4658387bb61e4510c37e2e97cf
834
603
  function measureText(str, fontSize = 10) {
835
604
  var _a;
836
605
  const avg = 0.5279276315789471;
@@ -915,10 +684,6 @@ exports.defaultCodonTable = {
915
684
  GGG: 'G',
916
685
  GGT: 'G',
917
686
  };
918
- /**
919
- * take CodonTable above and generate larger codon table that includes all
920
- * permutations of upper and lower case nucleotides
921
- */
922
687
  function generateCodonTable(table) {
923
688
  const tempCodonTable = {};
924
689
  Object.keys(table).forEach(codon => {
@@ -944,13 +709,19 @@ function generateCodonTable(table) {
944
709
  });
945
710
  return tempCodonTable;
946
711
  }
947
- // call statusCallback with current status and clear when finished
948
712
  async function updateStatus(msg, cb, fn) {
949
713
  cb(msg);
950
714
  const res = await fn();
951
715
  cb('');
952
716
  return res;
953
717
  }
718
+ async function updateStatus2(msg, cb, stopToken, fn) {
719
+ cb(msg);
720
+ const res = await fn();
721
+ (0, stopToken_1.checkStopToken)(stopToken);
722
+ cb('');
723
+ return res;
724
+ }
954
725
  function hashCode(str) {
955
726
  let hash = 0;
956
727
  if (str.length === 0) {
@@ -959,7 +730,7 @@ function hashCode(str) {
959
730
  for (let i = 0; i < str.length; i++) {
960
731
  const chr = str.charCodeAt(i);
961
732
  hash = (hash << 5) - hash + chr;
962
- hash |= 0; // Convert to 32bit integer
733
+ hash |= 0;
963
734
  }
964
735
  return hash;
965
736
  }
@@ -976,8 +747,6 @@ async function bytesForRegions(regions, index) {
976
747
  }))
977
748
  .reduce((a, b) => a + b.end - b.start, 0);
978
749
  }
979
- // supported adapter types by text indexer ensure that this matches the method
980
- // found in @jbrowse/text-indexing/util
981
750
  function isSupportedIndexingAdapter(type = '') {
982
751
  return [
983
752
  'Gff3TabixAdapter',
@@ -1006,7 +775,6 @@ function getTickDisplayStr(totalBp, bpPerPx) {
1006
775
  : toLocale(Math.floor(totalBp));
1007
776
  }
1008
777
  function getViewParams(model, exportSVG) {
1009
- // @ts-expect-error
1010
778
  const { dynamicBlocks, staticBlocks, offsetPx } = getContainingView(model);
1011
779
  const b = (dynamicBlocks === null || dynamicBlocks === void 0 ? void 0 : dynamicBlocks.contentBlocks[0]) || {};
1012
780
  const staticblock = (staticBlocks === null || staticBlocks === void 0 ? void 0 : staticBlocks.contentBlocks[0]) || {};
@@ -1021,7 +789,6 @@ function getViewParams(model, exportSVG) {
1021
789
  function getLayoutId({ sessionId, layoutId, }) {
1022
790
  return `${sessionId}-${layoutId}`;
1023
791
  }
1024
- // Hook from https://usehooks.com/useLocalStorage/
1025
792
  function useLocalStorage(key, initialValue) {
1026
793
  const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
1027
794
  if (typeof window === 'undefined') {
@@ -1063,23 +830,18 @@ function getUriLink(value) {
1063
830
  }
1064
831
  function getStr(obj) {
1065
832
  return (0, is_object_1.default)(obj)
1066
- ? (0, types_2.isUriLocation)(obj)
833
+ ? (0, types_1.isUriLocation)(obj)
1067
834
  ? getUriLink(obj)
1068
835
  : JSON.stringify(obj)
1069
836
  : String(obj);
1070
837
  }
1071
- // tries to measure grid width without HTML tags included
1072
838
  function coarseStripHTML(s) {
1073
839
  return s.replaceAll(/(<([^>]+)>)/gi, '');
1074
840
  }
1075
- // based on autolink-js, license MIT
1076
- // https://github.com/bryanwoods/autolink-js/blob/1418049970152c56ced73d43dcc62d80b320fb71/autolink.js#L9
1077
841
  function linkify(s) {
1078
842
  const pattern = /(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[-A-Z0-9+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi;
1079
843
  return s.replaceAll(pattern, '$1<a href=\'$2\' target="_blank">$2</a>');
1080
844
  }
1081
- // heuristic measurement for a column of a @mui/x-data-grid, pass in
1082
- // values from a column
1083
845
  function measureGridWidth(elements, args) {
1084
846
  const { padding = 30, minWidth = 80, fontSize = 12, maxWidth = 1000, stripHTML = false, } = args || {};
1085
847
  return max(elements
@@ -1140,27 +902,18 @@ function notEmpty(value) {
1140
902
  return value !== null && value !== undefined;
1141
903
  }
1142
904
  function mergeIntervals(intervals, w = 5000) {
1143
- // test if there are at least 2 intervals
1144
905
  if (intervals.length <= 1) {
1145
906
  return intervals;
1146
907
  }
1147
908
  const stack = [];
1148
909
  let top = null;
1149
- // sort the intervals based on their start values
1150
910
  intervals = intervals.sort((a, b) => a.start - b.start);
1151
- // push the 1st interval into the stack
1152
911
  stack.push(intervals[0]);
1153
- // start from the next interval and merge if needed
1154
912
  for (let i = 1; i < intervals.length; i++) {
1155
- // get the top element
1156
913
  top = stack.at(-1);
1157
- // if the current interval doesn't overlap with the
1158
- // stack top element, push it to the stack
1159
914
  if (top.end + w < intervals[i].start - w) {
1160
915
  stack.push(intervals[i]);
1161
916
  }
1162
- // otherwise update the end value of the top element
1163
- // if end of current interval is higher
1164
917
  else if (top.end < intervals[i].end) {
1165
918
  top.end = Math.max(top.end, intervals[i].end);
1166
919
  stack.pop();
@@ -1169,7 +922,6 @@ function mergeIntervals(intervals, w = 5000) {
1169
922
  }
1170
923
  return stack;
1171
924
  }
1172
- // returns new array non-overlapping features
1173
925
  function gatherOverlaps(regions, w = 5000) {
1174
926
  const memo = {};
1175
927
  for (const x of regions) {
@@ -1197,7 +949,6 @@ function getFillProps(str) {
1197
949
  fill: c.alpha(1).toHex(),
1198
950
  };
1199
951
  }
1200
- // https://react.dev/reference/react-dom/server/renderToString#removing-rendertostring-from-the-client-code
1201
952
  function renderToStaticMarkup(node, createRootFn) {
1202
953
  const div = document.createElement('div');
1203
954
  (0, react_dom_1.flushSync)(() => {
@@ -1213,8 +964,18 @@ function renderToStaticMarkup(node, createRootFn) {
1213
964
  function isGzip(buf) {
1214
965
  return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
1215
966
  }
967
+ async function fetchAndMaybeUnzip(loc, opts) {
968
+ const { statusCallback = () => { } } = opts || {};
969
+ const buf = (await updateStatus('Downloading file', statusCallback, () => loc.readFile(opts)));
970
+ return isGzip(buf)
971
+ ? await updateStatus('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
972
+ : buf;
973
+ }
1216
974
  var simpleFeature_1 = require("./simpleFeature");
1217
975
  Object.defineProperty(exports, "SimpleFeature", { enumerable: true, get: function () { return __importDefault(simpleFeature_1).default; } });
1218
976
  Object.defineProperty(exports, "isFeature", { enumerable: true, get: function () { return simpleFeature_1.isFeature; } });
1219
977
  var blobToDataURL_1 = require("./blobToDataURL");
1220
978
  Object.defineProperty(exports, "blobToDataURL", { enumerable: true, get: function () { return blobToDataURL_1.blobToDataURL; } });
979
+ var makeAbortableReaction_1 = require("./makeAbortableReaction");
980
+ Object.defineProperty(exports, "makeAbortableReaction", { enumerable: true, get: function () { return makeAbortableReaction_1.makeAbortableReaction; } });
981
+ __exportStar(require("./aborting"), exports);