wuepgg3-track 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/dist/CanvasPool-BD4ZA6VU.mjs +46 -0
  2. package/dist/SharedSystems-BNa57PRW.mjs +2521 -0
  3. package/dist/WebGLRenderer-DWCYIsx2.mjs +2624 -0
  4. package/dist/WebGPURenderer-BxRqKjyD.mjs +1613 -0
  5. package/dist/browserAll-CQks4WgI.mjs +2134 -0
  6. package/dist/colorToUniform-BcHZBaJ_.mjs +218 -0
  7. package/dist/components/GenomeView/GenomeRoot.d.ts +5 -0
  8. package/dist/components/GenomeView/ToolComponents/HighlightMenu.d.ts +20 -0
  9. package/dist/components/GenomeView/ToolComponents/MetadataHeader.d.ts +9 -0
  10. package/dist/components/GenomeView/ToolComponents/MetadataSelectionMenu.d.ts +10 -0
  11. package/dist/components/GenomeView/ToolComponents/Tools.d.ts +32 -0
  12. package/dist/components/GenomeView/TrackComponents/3dmol/ArrowList.d.ts +9 -0
  13. package/dist/components/GenomeView/TrackComponents/3dmol/BigwigSource.d.ts +7 -0
  14. package/dist/components/GenomeView/TrackComponents/3dmol/CategoryLegend.d.ts +7 -0
  15. package/dist/components/GenomeView/TrackComponents/3dmol/ColorPicker.d.ts +12 -0
  16. package/dist/components/GenomeView/TrackComponents/3dmol/FrameListMenu.d.ts +6 -0
  17. package/dist/components/GenomeView/TrackComponents/3dmol/HoverInfo.d.ts +20 -0
  18. package/dist/components/GenomeView/TrackComponents/3dmol/Legend.d.ts +6 -0
  19. package/dist/components/GenomeView/TrackComponents/3dmol/ModelListMenu.d.ts +7 -0
  20. package/dist/components/GenomeView/TrackComponents/3dmol/OpacityThickness.d.ts +4 -0
  21. package/dist/components/GenomeView/TrackComponents/3dmol/ResolutionList.d.ts +8 -0
  22. package/dist/components/GenomeView/TrackComponents/3dmol/ShapeList.d.ts +10 -0
  23. package/dist/components/GenomeView/TrackComponents/3dmol/StaticLegend.d.ts +6 -0
  24. package/dist/components/GenomeView/TrackComponents/3dmol/ThreedmolContainer.d.ts +261 -0
  25. package/dist/components/GenomeView/TrackComponents/3dmol/binning.d.ts +36 -0
  26. package/dist/components/GenomeView/TrackComponents/3dmol/helpers-3dmol.d.ts +68 -0
  27. package/dist/components/GenomeView/TrackComponents/BamComponents/BamAnnotation.d.ts +45 -0
  28. package/dist/components/GenomeView/TrackComponents/CategoricalComponents/CategoricalAnnotation.d.ts +48 -0
  29. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/cacheFetchedData.d.ts +23 -0
  30. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getDataAfterConfigChange.d.ts +11 -0
  31. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getTrackPixelXOffset.d.ts +3 -0
  32. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/trackGlobalState.d.ts +6 -0
  33. package/dist/components/GenomeView/TrackComponents/DynseqComponents/DynseqTrackComponents.d.ts +80 -0
  34. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/AlignmentCoordinate.d.ts +19 -0
  35. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/GenomeAlignComponents.d.ts +45 -0
  36. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/HorizontalFragment.d.ts +20 -0
  37. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/MultiAlignmentViewCalculator.d.ts +112 -0
  38. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/Sequence.d.ts +39 -0
  39. package/dist/components/GenomeView/TrackComponents/GroupedTrackManager.d.ts +54 -0
  40. package/dist/components/GenomeView/TrackComponents/InteractionComponents/ArcDisplay.d.ts +37 -0
  41. package/dist/components/GenomeView/TrackComponents/InteractionComponents/CubicCurveDisplay.d.ts +22 -0
  42. package/dist/components/GenomeView/TrackComponents/InteractionComponents/Heatmap.d.ts +40 -0
  43. package/dist/components/GenomeView/TrackComponents/InteractionComponents/InteractionTrackComponent.d.ts +74 -0
  44. package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiArc.d.ts +60 -0
  45. package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiHeatmap.d.ts +78 -0
  46. package/dist/components/GenomeView/TrackComponents/InteractionComponents/SquareDisplay.d.ts +32 -0
  47. package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +71 -0
  48. package/dist/components/GenomeView/TrackComponents/QBedComponents/QBedTrackComponents.d.ts +74 -0
  49. package/dist/components/GenomeView/TrackComponents/RulerComponents/Ruler.d.ts +17 -0
  50. package/dist/components/GenomeView/TrackComponents/RulerComponents/RulerComponent.d.ts +19 -0
  51. package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpAnnotation.d.ts +17 -0
  52. package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpDetail.d.ts +7 -0
  53. package/dist/components/GenomeView/TrackComponents/TrackFactory.d.ts +4 -0
  54. package/dist/components/GenomeView/TrackComponents/VcfComponents/Vcf.d.ts +22 -0
  55. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfAnnotation.d.ts +41 -0
  56. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfDetail.d.ts +14 -0
  57. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfTrack.d.ts +69 -0
  58. package/dist/components/GenomeView/TrackComponents/bedComponents/BedAnnotation.d.ts +33 -0
  59. package/dist/components/GenomeView/TrackComponents/bedComponents/Bedcolor.d.ts +13 -0
  60. package/dist/components/GenomeView/TrackComponents/bedComponents/BedcolorTrack.d.ts +6 -0
  61. package/dist/components/GenomeView/TrackComponents/bedComponents/DynamicBedTrackComponents.d.ts +28 -0
  62. package/dist/components/GenomeView/TrackComponents/bedComponents/FiberAnnotation.d.ts +33 -0
  63. package/dist/components/GenomeView/TrackComponents/bedComponents/FiberTrackComponent.d.ts +90 -0
  64. package/dist/components/GenomeView/TrackComponents/commonComponents/CopyToClipboard.d.ts +11 -0
  65. package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/GenomicCoordinates.d.ts +23 -0
  66. package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/HoverToolTip.d.ts +89 -0
  67. package/dist/components/GenomeView/TrackComponents/commonComponents/MetadataIndicator.d.ts +11 -0
  68. package/dist/components/GenomeView/TrackComponents/commonComponents/OutsideClickDetector.d.ts +8 -0
  69. package/dist/components/GenomeView/TrackComponents/commonComponents/Resize.d.ts +6 -0
  70. package/dist/components/GenomeView/TrackComponents/commonComponents/TrackLegend.d.ts +39 -0
  71. package/dist/components/GenomeView/TrackComponents/commonComponents/TrackMessage.d.ts +33 -0
  72. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationArrows.d.ts +28 -0
  73. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationTrack.d.ts +25 -0
  74. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FeatureDetail.d.ts +20 -0
  75. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FullDisplayMode.d.ts +45 -0
  76. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/JasparDetail.d.ts +12 -0
  77. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/PixiAnnotation.d.ts +67 -0
  78. package/dist/components/GenomeView/TrackComponents/commonComponents/art/DesignRenderer.d.ts +30 -0
  79. package/dist/components/GenomeView/TrackComponents/commonComponents/art/RulerDesigner.d.ts +102 -0
  80. package/dist/components/GenomeView/TrackComponents/commonComponents/check-obj-dupe.d.ts +8 -0
  81. package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableItem.d.ts +11 -0
  82. package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableTrack.d.ts +17 -0
  83. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicNumericalTrack.d.ts +37 -0
  84. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicplotTrackComponent.d.ts +80 -0
  85. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/GenomicCoordinates.d.ts +23 -0
  86. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/MatplotTrackComponent.d.ts +65 -0
  87. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalAggregator.d.ts +5 -0
  88. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalTrack.d.ts +39 -0
  89. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/PixiScene.d.ts +66 -0
  90. package/dist/components/GenomeView/TrackComponents/commonComponents/stats/BoxplotTrackComponents.d.ts +106 -0
  91. package/dist/components/GenomeView/TrackComponents/defaultOptionsMap.d.ts +3 -0
  92. package/dist/components/GenomeView/TrackComponents/displayModeComponentMap.d.ts +9 -0
  93. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/BackgroundedText.d.ts +50 -0
  94. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotation.d.ts +33 -0
  95. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotationScaffold.d.ts +26 -0
  96. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneDetail.d.ts +19 -0
  97. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/TranslatableG.d.ts +15 -0
  98. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroHtmlVisualizer.d.ts +41 -0
  99. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroSvgVisualizer.d.ts +35 -0
  100. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroTrackComponents.d.ts +33 -0
  101. package/dist/components/GenomeView/TrackManager.d.ts +31 -0
  102. package/dist/components/GenomeView/genomeNavigator/Chromosomes.d.ts +94 -0
  103. package/dist/components/GenomeView/genomeNavigator/DragAcrossDiv.d.ts +71 -0
  104. package/dist/components/GenomeView/genomeNavigator/GeneSearchBox.d.ts +15 -0
  105. package/dist/components/GenomeView/genomeNavigator/GeneSearchBox3D.d.ts +22 -0
  106. package/dist/components/GenomeView/genomeNavigator/GeneSearchBoxBase.d.ts +18 -0
  107. package/dist/components/GenomeView/genomeNavigator/GenomeNavigator.d.ts +87 -0
  108. package/dist/components/GenomeView/genomeNavigator/IsoformSelection.d.ts +11 -0
  109. package/dist/components/GenomeView/genomeNavigator/MainPane.d.ts +68 -0
  110. package/dist/components/GenomeView/genomeNavigator/Ruler.d.ts +23 -0
  111. package/dist/components/GenomeView/genomeNavigator/SelectableGenomeArea.d.ts +34 -0
  112. package/dist/components/GenomeView/genomeNavigator/SelectedRegionBox.d.ts +48 -0
  113. package/dist/components/GenomeView/genomeNavigator/SnpSearchBox.d.ts +14 -0
  114. package/dist/components/GenomeView/genomeNavigator/TrackRegionController.d.ts +19 -0
  115. package/dist/genome-hub/GenomeHubManager.d.ts +15 -0
  116. package/dist/genome-hub/GenomeSerializer.d.ts +13 -0
  117. package/dist/genome-hub/LocalGenomeRepository.d.ts +15 -0
  118. package/dist/genome-hub/genome-schema.d.ts +198 -0
  119. package/dist/genome-hub/index.d.ts +3 -0
  120. package/dist/getLocalData/BedTextSource.d.ts +22 -0
  121. package/dist/getLocalData/LocalBigSourceGmod.d.ts +28 -0
  122. package/dist/getLocalData/LongrangeAndreaTextSource.d.ts +11 -0
  123. package/dist/getLocalData/localFetchData.d.ts +6 -0
  124. package/dist/getLocalData/localTabixSource.d.ts +50 -0
  125. package/dist/getLocalData/localTextSource.d.ts +13 -0
  126. package/dist/getRemoteData/BamSource.d.ts +10 -0
  127. package/dist/getRemoteData/BigSourceWorker.d.ts +47 -0
  128. package/dist/getRemoteData/BigSourceWorkerGmod.d.ts +25 -0
  129. package/dist/getRemoteData/GenomeInteraction.d.ts +20 -0
  130. package/dist/getRemoteData/HicDataModes.d.ts +19 -0
  131. package/dist/getRemoteData/JasparSource.d.ts +8 -0
  132. package/dist/getRemoteData/RepeatSource.d.ts +8 -0
  133. package/dist/getRemoteData/TwoBitSource.d.ts +31 -0
  134. package/dist/getRemoteData/VcfSource.d.ts +10 -0
  135. package/dist/getRemoteData/fetchDataWorker.d.ts +61 -0
  136. package/dist/getRemoteData/fetchGenomeAlignWorker.d.ts +64 -0
  137. package/dist/getRemoteData/fetchTrackData.d.ts +4 -0
  138. package/dist/getRemoteData/g3dFileV2.d.ts +15 -0
  139. package/dist/getRemoteData/hicSource.d.ts +83 -0
  140. package/dist/getRemoteData/io/browserLocalFile.d.ts +6 -0
  141. package/dist/getRemoteData/io/remoteFile.d.ts +7 -0
  142. package/dist/getRemoteData/tabixSource.d.ts +46 -0
  143. package/dist/getRemoteData/vendor/bbi-js/main/bigwig.d.ts +1 -0
  144. package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +1 -0
  145. package/dist/getRemoteData/vendor/bbi-js/utils/das.d.ts +6 -0
  146. package/dist/getRemoteData/vendor/bbi-js/utils/jszlib.d.ts +1 -0
  147. package/dist/getRemoteData/vendor/bbi-js/utils/sha1.d.ts +1 -0
  148. package/dist/getRemoteData/vendor/bbi-js/utils/spans.d.ts +13 -0
  149. package/dist/index-Cs2whU2f.mjs +417589 -0
  150. package/dist/index.d.ts +5 -0
  151. package/dist/index.es.js +68 -0
  152. package/dist/index.umd.js +1644 -0
  153. package/dist/init-Afno6ASC.mjs +2871 -0
  154. package/dist/models/AlignmentRecord.d.ts +20 -0
  155. package/dist/models/AlignmentSegment.d.ts +51 -0
  156. package/dist/models/AlignmentStringUtils.d.ts +73 -0
  157. package/dist/models/AppSaveLoad.d.ts +76 -0
  158. package/dist/models/BamAlignment.d.ts +81 -0
  159. package/dist/models/BamRecord.d.ts +96 -0
  160. package/dist/models/BedRecord.d.ts +13 -0
  161. package/dist/models/BinIndexer.d.ts +28 -0
  162. package/dist/models/Chromosome.d.ts +24 -0
  163. package/dist/models/ChromosomeInterval.d.ts +107 -0
  164. package/dist/models/DataHubParser.d.ts +4 -0
  165. package/dist/models/DisplayedRegionModel.d.ts +114 -0
  166. package/dist/models/DownsamplingChoices.d.ts +4 -0
  167. package/dist/models/Feature.d.ts +156 -0
  168. package/dist/models/FeatureAggregator.d.ts +67 -0
  169. package/dist/models/FeatureArranger.d.ts +48 -0
  170. package/dist/models/FeatureSegment.d.ts +63 -0
  171. package/dist/models/FlankingStrategy.d.ts +72 -0
  172. package/dist/models/Gene.d.ts +56 -0
  173. package/dist/models/Genome.d.ts +48 -0
  174. package/dist/models/GraphNode.d.ts +46 -0
  175. package/dist/models/ImageRecord.d.ts +12 -0
  176. package/dist/models/Json5Fetcher.d.ts +10 -0
  177. package/dist/models/LinearDrawingModel.d.ts +75 -0
  178. package/dist/models/LogChoices.d.ts +4 -0
  179. package/dist/models/MethylCRecord.d.ts +41 -0
  180. package/dist/models/NavContextBuilder.d.ts +17 -0
  181. package/dist/models/NavigationContext.d.ts +168 -0
  182. package/dist/models/OpenInterval.d.ts +57 -0
  183. package/dist/models/QBed.d.ts +15 -0
  184. package/dist/models/RegionExpander.d.ts +51 -0
  185. package/dist/models/RegionSet.d.ts +85 -0
  186. package/dist/models/RepeatMaskerFeature.d.ts +61 -0
  187. package/dist/models/ScaleChoices.d.ts +4 -0
  188. package/dist/models/SequenceData.d.ts +6 -0
  189. package/dist/models/Snp.d.ts +34 -0
  190. package/dist/models/SortItemsOptions.d.ts +6 -0
  191. package/dist/models/TrackModel.d.ts +142 -0
  192. package/dist/models/binning.d.ts +29 -0
  193. package/dist/models/genomes/Creinhardtii506/Creinhardtii506.d.ts +18 -0
  194. package/dist/models/genomes/CytobandTypes.d.ts +17 -0
  195. package/dist/models/genomes/GRCg7b/GRCg7b.d.ts +17 -0
  196. package/dist/models/genomes/GRCg7w/GRCg7w.d.ts +17 -0
  197. package/dist/models/genomes/GenomeConfig.d.ts +16 -0
  198. package/dist/models/genomes/allGenomes.d.ts +201 -0
  199. package/dist/models/genomes/aplCal3/aplCal3.d.ts +18 -0
  200. package/dist/models/genomes/araTha1/araTha1.d.ts +18 -0
  201. package/dist/models/genomes/bosTau8/bosTau8.d.ts +18 -0
  202. package/dist/models/genomes/brapa/brara_chiifu_v3.0.d.ts +17 -0
  203. package/dist/models/genomes/calJac3/calJac3.d.ts +17 -0
  204. package/dist/models/genomes/calJac4/calJac4.d.ts +18 -0
  205. package/dist/models/genomes/canFam2/canFam2.d.ts +16 -0
  206. package/dist/models/genomes/canFam3/canFam3.d.ts +18 -0
  207. package/dist/models/genomes/canFam6/canFam6.d.ts +18 -0
  208. package/dist/models/genomes/ce11/ce11.d.ts +18 -0
  209. package/dist/models/genomes/danRer10/danRer10.d.ts +17 -0
  210. package/dist/models/genomes/danRer10/scaffolds.d.ts +3 -0
  211. package/dist/models/genomes/danRer11/danRer11.d.ts +35 -0
  212. package/dist/models/genomes/danRer7/danRer7.d.ts +18 -0
  213. package/dist/models/genomes/dm6/dm6.d.ts +35 -0
  214. package/dist/models/genomes/galGal5/galGal5.d.ts +35 -0
  215. package/dist/models/genomes/galGal6/galGal6.d.ts +18 -0
  216. package/dist/models/genomes/gorGor3/gorGor3.d.ts +17 -0
  217. package/dist/models/genomes/gorGor4/gorGor4.d.ts +18 -0
  218. package/dist/models/genomes/hg19/hg19.d.ts +65 -0
  219. package/dist/models/genomes/hg38/hg38.d.ts +103 -0
  220. package/dist/models/genomes/lepOcu1/lepOcu1.d.ts +17 -0
  221. package/dist/models/genomes/mm10/mm10.d.ts +94 -0
  222. package/dist/models/genomes/mm39/mm39.d.ts +27 -0
  223. package/dist/models/genomes/mm9/mm9.d.ts +18 -0
  224. package/dist/models/genomes/monDom5/monDom5.d.ts +18 -0
  225. package/dist/models/genomes/nomLeu3/nomLeu3.d.ts +17 -0
  226. package/dist/models/genomes/oryCun2/oryCun2.d.ts +18 -0
  227. package/dist/models/genomes/oviAri4/oviAri4.d.ts +18 -0
  228. package/dist/models/genomes/panTro4/panTro4.d.ts +17 -0
  229. package/dist/models/genomes/panTro5/panTro5.d.ts +18 -0
  230. package/dist/models/genomes/panTro6/panTro6.d.ts +18 -0
  231. package/dist/models/genomes/papAnu2/papAnu2.d.ts +17 -0
  232. package/dist/models/genomes/pfal3d7/pfal3d7.d.ts +39 -0
  233. package/dist/models/genomes/phaw5/phaw5.d.ts +17 -0
  234. package/dist/models/genomes/rheMac10/rheMac10.d.ts +18 -0
  235. package/dist/models/genomes/rheMac2/rheMac2.d.ts +17 -0
  236. package/dist/models/genomes/rheMac3/rheMac3.d.ts +17 -0
  237. package/dist/models/genomes/rheMac8/rheMac8.d.ts +18 -0
  238. package/dist/models/genomes/rn4/rn4.d.ts +18 -0
  239. package/dist/models/genomes/rn6/rn6.d.ts +18 -0
  240. package/dist/models/genomes/rn7/rn7.d.ts +18 -0
  241. package/dist/models/genomes/sacCer3/sacCer3.d.ts +30 -0
  242. package/dist/models/genomes/susScr11/susScr11.d.ts +18 -0
  243. package/dist/models/genomes/susScr3/susScr3.d.ts +18 -0
  244. package/dist/models/genomes/t2t-chm13-v1.1/chm13.d.ts +17 -0
  245. package/dist/models/genomes/t2t-chm13-v2.0/chm13v2.d.ts +18 -0
  246. package/dist/models/genomes/trypanosome/TbruceiLister427.d.ts +32 -0
  247. package/dist/models/genomes/trypanosome/TbruceiTREU927.d.ts +32 -0
  248. package/dist/models/genomes/virus/ebola.d.ts +47 -0
  249. package/dist/models/genomes/virus/hpv16.d.ts +28 -0
  250. package/dist/models/genomes/virus/mers.d.ts +54 -0
  251. package/dist/models/genomes/virus/nCoV2019.d.ts +382 -0
  252. package/dist/models/genomes/virus/sars.d.ts +53 -0
  253. package/dist/models/genomes/xenTro10/xenTro10.d.ts +18 -0
  254. package/dist/models/getXSpan/FeaturePlacer.d.ts +86 -0
  255. package/dist/models/index.d.ts +28 -0
  256. package/dist/models/layoutUtils.d.ts +39 -0
  257. package/dist/models/trackModels/trackProps.d.ts +40 -0
  258. package/dist/models/util.d.ts +102 -0
  259. package/dist/style.css +1 -0
  260. package/dist/track-container/index.d.ts +9 -0
  261. package/dist/trackConfigs/config-menu-components.tsx/AlwaysDrawLabelConfig.d.ts +8 -0
  262. package/dist/trackConfigs/config-menu-components.tsx/ArrayAggregateConfig.d.ts +6 -0
  263. package/dist/trackConfigs/config-menu-components.tsx/BothAnchorsInViewConfig.d.ts +8 -0
  264. package/dist/trackConfigs/config-menu-components.tsx/CategoryColorConfig.d.ts +15 -0
  265. package/dist/trackConfigs/config-menu-components.tsx/ClampHeightConfig.d.ts +8 -0
  266. package/dist/trackConfigs/config-menu-components.tsx/Collapsible.d.ts +7 -0
  267. package/dist/trackConfigs/config-menu-components.tsx/ColorConfig.d.ts +102 -0
  268. package/dist/trackConfigs/config-menu-components.tsx/ColorPicker.d.ts +9 -0
  269. package/dist/trackConfigs/config-menu-components.tsx/CombineStrandConfig.d.ts +8 -0
  270. package/dist/trackConfigs/config-menu-components.tsx/DisplayModeConfig.d.ts +21 -0
  271. package/dist/trackConfigs/config-menu-components.tsx/EnsemblStyleConfig.d.ts +8 -0
  272. package/dist/trackConfigs/config-menu-components.tsx/FetchViewWindowConfig.d.ts +8 -0
  273. package/dist/trackConfigs/config-menu-components.tsx/HeightConfig.d.ts +8 -0
  274. package/dist/trackConfigs/config-menu-components.tsx/HicDataConfig.d.ts +14 -0
  275. package/dist/trackConfigs/config-menu-components.tsx/HiddenPixelsConfig.d.ts +8 -0
  276. package/dist/trackConfigs/config-menu-components.tsx/HideMinimalItemsConfig.d.ts +8 -0
  277. package/dist/trackConfigs/config-menu-components.tsx/HorizontalLineValueConfig.d.ts +8 -0
  278. package/dist/trackConfigs/config-menu-components.tsx/ItalicizeTextConfig.d.ts +8 -0
  279. package/dist/trackConfigs/config-menu-components.tsx/LabelConfig.d.ts +7 -0
  280. package/dist/trackConfigs/config-menu-components.tsx/LineWidthConfig.d.ts +8 -0
  281. package/dist/trackConfigs/config-menu-components.tsx/LogScaleConfig.d.ts +8 -0
  282. package/dist/trackConfigs/config-menu-components.tsx/MarkerSizeConfig.d.ts +8 -0
  283. package/dist/trackConfigs/config-menu-components.tsx/MaxMethylAndDepthFilterConfig.d.ts +8 -0
  284. package/dist/trackConfigs/config-menu-components.tsx/MaxRowsConfig.d.ts +8 -0
  285. package/dist/trackConfigs/config-menu-components.tsx/MaxValueFilterConfig.d.ts +8 -0
  286. package/dist/trackConfigs/config-menu-components.tsx/MethylColorConfig.d.ts +16 -0
  287. package/dist/trackConfigs/config-menu-components.tsx/MinValueFilterConfig.d.ts +8 -0
  288. package/dist/trackConfigs/config-menu-components.tsx/NumberConfig.d.ts +43 -0
  289. package/dist/trackConfigs/config-menu-components.tsx/OmeroImageHeightConfig.d.ts +8 -0
  290. package/dist/trackConfigs/config-menu-components.tsx/OpacitySilderConfig.d.ts +8 -0
  291. package/dist/trackConfigs/config-menu-components.tsx/PixelsPaddingConfig.d.ts +8 -0
  292. package/dist/trackConfigs/config-menu-components.tsx/PlayingConfig.d.ts +8 -0
  293. package/dist/trackConfigs/config-menu-components.tsx/RowHeightConfig.d.ts +8 -0
  294. package/dist/trackConfigs/config-menu-components.tsx/ScalePercentileConfig.d.ts +8 -0
  295. package/dist/trackConfigs/config-menu-components.tsx/ScoreConfig.d.ts +8 -0
  296. package/dist/trackConfigs/config-menu-components.tsx/SelectConfig.d.ts +11 -0
  297. package/dist/trackConfigs/config-menu-components.tsx/ShowHorizontalLineConfig.d.ts +8 -0
  298. package/dist/trackConfigs/config-menu-components.tsx/SingleInputConfig.d.ts +14 -0
  299. package/dist/trackConfigs/config-menu-components.tsx/SliderConfig.d.ts +51 -0
  300. package/dist/trackConfigs/config-menu-components.tsx/SmoothConfig.d.ts +8 -0
  301. package/dist/trackConfigs/config-menu-components.tsx/SortItemsConfig.d.ts +2 -0
  302. package/dist/trackConfigs/config-menu-components.tsx/SpeedConfig.d.ts +8 -0
  303. package/dist/trackConfigs/config-menu-components.tsx/TrackConfigMenu.d.ts +2 -0
  304. package/dist/trackConfigs/config-menu-components.tsx/TrackContextMenu.d.ts +6 -0
  305. package/dist/trackConfigs/config-menu-components.tsx/UseDynamicColorsConfig.d.ts +8 -0
  306. package/dist/trackConfigs/config-menu-components.tsx/WindowSizeConfig.d.ts +8 -0
  307. package/dist/trackConfigs/config-menu-components.tsx/YscaleConfig.d.ts +8 -0
  308. package/dist/trackConfigs/config-menu-models.tsx/AggregateConfig.d.ts +6 -0
  309. package/dist/trackConfigs/config-menu-models.tsx/AnnotationTrackConfig.d.ts +16 -0
  310. package/dist/trackConfigs/config-menu-models.tsx/BamTrackConfig.d.ts +6 -0
  311. package/dist/trackConfigs/config-menu-models.tsx/BedGraphTrackConfig.d.ts +3 -0
  312. package/dist/trackConfigs/config-menu-models.tsx/BedTrackConfig.d.ts +10 -0
  313. package/dist/trackConfigs/config-menu-models.tsx/BedcolorTrackConfig.d.ts +4 -0
  314. package/dist/trackConfigs/config-menu-models.tsx/BigBedTrackConfig.d.ts +4 -0
  315. package/dist/trackConfigs/config-menu-models.tsx/BigInteractTrackConfig.d.ts +12 -0
  316. package/dist/trackConfigs/config-menu-models.tsx/BigWigTrackConfig.d.ts +7 -0
  317. package/dist/trackConfigs/config-menu-models.tsx/BoxplotTrackConfig.d.ts +8 -0
  318. package/dist/trackConfigs/config-menu-models.tsx/CategoricalTrackConfig.d.ts +12 -0
  319. package/dist/trackConfigs/config-menu-models.tsx/DisplayModes.d.ts +49 -0
  320. package/dist/trackConfigs/config-menu-models.tsx/DynamicBedGraphTrackConfig.d.ts +5 -0
  321. package/dist/trackConfigs/config-menu-models.tsx/DynamicBedTrackConfig.d.ts +5 -0
  322. package/dist/trackConfigs/config-menu-models.tsx/DynamicHicTrackConfig.d.ts +5 -0
  323. package/dist/trackConfigs/config-menu-models.tsx/DynamicLongrangeTrackConfig.d.ts +5 -0
  324. package/dist/trackConfigs/config-menu-models.tsx/DynamicplotTrackConfig.d.ts +4 -0
  325. package/dist/trackConfigs/config-menu-models.tsx/DynseqTrackConfig.d.ts +7 -0
  326. package/dist/trackConfigs/config-menu-models.tsx/FiberTrackConfig.d.ts +4 -0
  327. package/dist/trackConfigs/config-menu-models.tsx/GeneAnnotationTrackConfig.d.ts +4 -0
  328. package/dist/trackConfigs/config-menu-models.tsx/GenomeAlignTrackConfig.d.ts +4 -0
  329. package/dist/trackConfigs/config-menu-models.tsx/HicTrackConfig.d.ts +7 -0
  330. package/dist/trackConfigs/config-menu-models.tsx/JasparTrackConfig.d.ts +4 -0
  331. package/dist/trackConfigs/config-menu-models.tsx/LongRangeTrackConfig.d.ts +6 -0
  332. package/dist/trackConfigs/config-menu-models.tsx/MatplotTrackConfig.d.ts +4 -0
  333. package/dist/trackConfigs/config-menu-models.tsx/MethylCTrackConfig.d.ts +4 -0
  334. package/dist/trackConfigs/config-menu-models.tsx/NumericalTrackConfig.d.ts +4 -0
  335. package/dist/trackConfigs/config-menu-models.tsx/OmeroTrackConfig.d.ts +5 -0
  336. package/dist/trackConfigs/config-menu-models.tsx/OmeroidrTrackConfig.d.ts +5 -0
  337. package/dist/trackConfigs/config-menu-models.tsx/QBedTrackConfig.d.ts +4 -0
  338. package/dist/trackConfigs/config-menu-models.tsx/RefBedTrackConfig.d.ts +4 -0
  339. package/dist/trackConfigs/config-menu-models.tsx/RepeatMaskerTrackConfig.d.ts +4 -0
  340. package/dist/trackConfigs/config-menu-models.tsx/RulerTrackConfig.d.ts +4 -0
  341. package/dist/trackConfigs/config-menu-models.tsx/SnpTrackConfig.d.ts +4 -0
  342. package/dist/trackConfigs/config-menu-models.tsx/TrackConfig.d.ts +11 -0
  343. package/dist/trackConfigs/config-menu-models.tsx/VcfTrackConfig.d.ts +5 -0
  344. package/dist/trackConfigs/config-menu-models.tsx/aggregateOptions.d.ts +12 -0
  345. package/dist/trackConfigs/config-menu-models.tsx/getTrackConfig.d.ts +76 -0
  346. package/dist/types/genome-hub.d.ts +24 -0
  347. package/dist/types/index.d.ts +2 -0
  348. package/dist/types/track-container.d.ts +99 -0
  349. package/dist/webworkerAll-CTtTToDi.mjs +2 -0
  350. package/package.json +104 -0
@@ -0,0 +1,1613 @@
1
+ import { g as R, E as f, f as oe, D as T, S as C, B as P, b as ae, c as E, d as U, w as A, h as y, i as ue, j as ce, k as L, M as k, l as D, m as de, o as he, p as H, q as pe, s as z, t as M, A as le, R as fe, e as B } from "./index-Cs2whU2f.mjs";
2
+ import { S as F, l as ge, a as me } from "./colorToUniform-BcHZBaJ_.mjs";
3
+ import { c as _e, u as be, U as ye, B as xe, G as Ge, e as Be, R as Se, t as Pe, S as Te, a as Ce } from "./SharedSystems-BNa57PRW.mjs";
4
+ import { C as w } from "./CanvasPool-BD4ZA6VU.mjs";
5
+ const x = F.for2d();
6
+ class O {
7
+ start(e, t, r) {
8
+ const s = e.renderer, i = s.encoder, n = r.gpuProgram;
9
+ this._shader = r, this._geometry = t, i.setGeometry(t, n), x.blendMode = "normal", s.pipeline.getPipeline(
10
+ t,
11
+ n,
12
+ x
13
+ );
14
+ const o = s.globalUniforms.bindGroup;
15
+ i.resetBindGroup(1), i.setBindGroup(0, o, n);
16
+ }
17
+ execute(e, t) {
18
+ const r = this._shader.gpuProgram, s = e.renderer, i = s.encoder;
19
+ if (!t.bindGroup) {
20
+ const u = t.textures;
21
+ t.bindGroup = R(u.textures, u.count);
22
+ }
23
+ x.blendMode = t.blendMode;
24
+ const n = s.bindGroup.getBindGroup(
25
+ t.bindGroup,
26
+ r,
27
+ 1
28
+ ), o = s.pipeline.getPipeline(
29
+ this._geometry,
30
+ r,
31
+ x,
32
+ t.topology
33
+ );
34
+ t.bindGroup._touch(s.textureGC.count), i.setPipeline(o), i.renderPassEncoder.setBindGroup(1, n), i.renderPassEncoder.drawIndexed(t.size, 1, t.start);
35
+ }
36
+ }
37
+ O.extension = {
38
+ type: [
39
+ f.WebGPUPipesAdaptor
40
+ ],
41
+ name: "batch"
42
+ };
43
+ class I {
44
+ constructor(e) {
45
+ this._hash = /* @__PURE__ */ Object.create(null), this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_hash");
46
+ }
47
+ contextChange(e) {
48
+ this._gpu = e;
49
+ }
50
+ getBindGroup(e, t, r) {
51
+ return e._updateKey(), this._hash[e._key] || this._createBindGroup(e, t, r);
52
+ }
53
+ _createBindGroup(e, t, r) {
54
+ const s = this._gpu.device, i = t.layout[r], n = [], o = this._renderer;
55
+ for (const p in i) {
56
+ const h = e.resources[p] ?? e.resources[i[p]];
57
+ let l;
58
+ if (h._resourceType === "uniformGroup") {
59
+ const d = h;
60
+ o.ubo.updateUniformGroup(d);
61
+ const _ = d.buffer;
62
+ l = {
63
+ buffer: o.buffer.getGPUBuffer(_),
64
+ offset: 0,
65
+ size: _.descriptor.size
66
+ };
67
+ } else if (h._resourceType === "buffer") {
68
+ const d = h;
69
+ l = {
70
+ buffer: o.buffer.getGPUBuffer(d),
71
+ offset: 0,
72
+ size: d.descriptor.size
73
+ };
74
+ } else if (h._resourceType === "bufferResource") {
75
+ const d = h;
76
+ l = {
77
+ buffer: o.buffer.getGPUBuffer(d.buffer),
78
+ offset: d.offset,
79
+ size: d.size
80
+ };
81
+ } else if (h._resourceType === "textureSampler") {
82
+ const d = h;
83
+ l = o.texture.getGpuSampler(d);
84
+ } else if (h._resourceType === "textureSource") {
85
+ const d = h;
86
+ l = o.texture.getGpuSource(d).createView({});
87
+ }
88
+ n.push({
89
+ binding: i[p],
90
+ resource: l
91
+ });
92
+ }
93
+ const u = o.shader.getProgramData(t).bindGroups[r], c = s.createBindGroup({
94
+ layout: u,
95
+ entries: n
96
+ });
97
+ return this._hash[e._key] = c, c;
98
+ }
99
+ destroy() {
100
+ for (const e of Object.keys(this._hash))
101
+ this._hash[e] = null;
102
+ this._hash = null, this._renderer = null;
103
+ }
104
+ }
105
+ I.extension = {
106
+ type: [
107
+ f.WebGPUSystem
108
+ ],
109
+ name: "bindGroup"
110
+ };
111
+ class W {
112
+ constructor(e) {
113
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null), this._managedBuffers = [], e.renderableGC.addManagedHash(this, "_gpuBuffers");
114
+ }
115
+ contextChange(e) {
116
+ this._gpu = e;
117
+ }
118
+ getGPUBuffer(e) {
119
+ return this._gpuBuffers[e.uid] || this.createGPUBuffer(e);
120
+ }
121
+ updateBuffer(e) {
122
+ const t = this._gpuBuffers[e.uid] || this.createGPUBuffer(e), r = e.data;
123
+ return e._updateID && r && (e._updateID = 0, this._gpu.device.queue.writeBuffer(
124
+ t,
125
+ 0,
126
+ r.buffer,
127
+ 0,
128
+ // round to the nearest 4 bytes
129
+ (e._updateSize || r.byteLength) + 3 & -4
130
+ )), t;
131
+ }
132
+ /** dispose all WebGL resources of all managed buffers */
133
+ destroyAll() {
134
+ for (const e in this._gpuBuffers)
135
+ this._gpuBuffers[e].destroy();
136
+ this._gpuBuffers = {};
137
+ }
138
+ createGPUBuffer(e) {
139
+ this._gpuBuffers[e.uid] || (e.on("update", this.updateBuffer, this), e.on("change", this.onBufferChange, this), e.on("destroy", this.onBufferDestroy, this), this._managedBuffers.push(e));
140
+ const t = this._gpu.device.createBuffer(e.descriptor);
141
+ return e._updateID = 0, e.data && (oe(e.data.buffer, t.getMappedRange()), t.unmap()), this._gpuBuffers[e.uid] = t, t;
142
+ }
143
+ onBufferChange(e) {
144
+ this._gpuBuffers[e.uid].destroy(), e._updateID = 0, this._gpuBuffers[e.uid] = this.createGPUBuffer(e);
145
+ }
146
+ /**
147
+ * Disposes buffer
148
+ * @param buffer - buffer with data
149
+ */
150
+ onBufferDestroy(e) {
151
+ this._managedBuffers.splice(this._managedBuffers.indexOf(e), 1), this._destroyBuffer(e);
152
+ }
153
+ destroy() {
154
+ this._managedBuffers.forEach((e) => this._destroyBuffer(e)), this._managedBuffers = null, this._gpuBuffers = null;
155
+ }
156
+ _destroyBuffer(e) {
157
+ this._gpuBuffers[e.uid].destroy(), e.off("update", this.updateBuffer, this), e.off("change", this.onBufferChange, this), e.off("destroy", this.onBufferDestroy, this), this._gpuBuffers[e.uid] = null;
158
+ }
159
+ }
160
+ W.extension = {
161
+ type: [
162
+ f.WebGPUSystem
163
+ ],
164
+ name: "buffer"
165
+ };
166
+ class ve {
167
+ constructor({ minUniformOffsetAlignment: e }) {
168
+ this._minUniformOffsetAlignment = 256, this.byteIndex = 0, this._minUniformOffsetAlignment = e, this.data = new Float32Array(65535);
169
+ }
170
+ clear() {
171
+ this.byteIndex = 0;
172
+ }
173
+ addEmptyGroup(e) {
174
+ if (e > this._minUniformOffsetAlignment / 4)
175
+ throw new Error(`UniformBufferBatch: array is too large: ${e * 4}`);
176
+ const t = this.byteIndex;
177
+ let r = t + e * 4;
178
+ if (r = Math.ceil(r / this._minUniformOffsetAlignment) * this._minUniformOffsetAlignment, r > this.data.length * 4)
179
+ throw new Error("UniformBufferBatch: ubo batch got too big");
180
+ return this.byteIndex = r, t;
181
+ }
182
+ addGroup(e) {
183
+ const t = this.addEmptyGroup(e.length);
184
+ for (let r = 0; r < e.length; r++)
185
+ this.data[t / 4 + r] = e[r];
186
+ return t;
187
+ }
188
+ destroy() {
189
+ this.data = null;
190
+ }
191
+ }
192
+ class V {
193
+ constructor(e) {
194
+ this._colorMaskCache = 15, this._renderer = e;
195
+ }
196
+ setMask(e) {
197
+ this._colorMaskCache !== e && (this._colorMaskCache = e, this._renderer.pipeline.setColorMask(e));
198
+ }
199
+ destroy() {
200
+ this._renderer = null, this._colorMaskCache = null;
201
+ }
202
+ }
203
+ V.extension = {
204
+ type: [
205
+ f.WebGPUSystem
206
+ ],
207
+ name: "colorMask"
208
+ };
209
+ class v {
210
+ /**
211
+ * @param {WebGPURenderer} renderer - The renderer this System works for.
212
+ */
213
+ constructor(e) {
214
+ this._renderer = e;
215
+ }
216
+ async init(e) {
217
+ return this._initPromise ? this._initPromise : (this._initPromise = this._createDeviceAndAdaptor(e).then((t) => {
218
+ this.gpu = t, this._renderer.runners.contextChange.emit(this.gpu);
219
+ }), this._initPromise);
220
+ }
221
+ /**
222
+ * Handle the context change event
223
+ * @param gpu
224
+ */
225
+ contextChange(e) {
226
+ this._renderer.gpu = e;
227
+ }
228
+ /**
229
+ * Helper class to create a WebGL Context
230
+ * @param {object} options - An options object that gets passed in to the canvas element containing the
231
+ * context attributes
232
+ * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext
233
+ * @returns {WebGLRenderingContext} the WebGL context
234
+ */
235
+ async _createDeviceAndAdaptor(e) {
236
+ const t = await T.get().getNavigator().gpu.requestAdapter({
237
+ powerPreference: e.powerPreference,
238
+ forceFallbackAdapter: e.forceFallbackAdapter
239
+ }), r = [
240
+ "texture-compression-bc",
241
+ "texture-compression-astc",
242
+ "texture-compression-etc2"
243
+ ].filter((i) => t.features.has(i)), s = await t.requestDevice({
244
+ requiredFeatures: r
245
+ });
246
+ return { adapter: t, device: s };
247
+ }
248
+ destroy() {
249
+ this.gpu = null, this._renderer = null;
250
+ }
251
+ }
252
+ v.extension = {
253
+ type: [
254
+ f.WebGPUSystem
255
+ ],
256
+ name: "device"
257
+ };
258
+ v.defaultOptions = {
259
+ /**
260
+ * {@link WebGPUOptions.powerPreference}
261
+ * @default default
262
+ */
263
+ powerPreference: void 0,
264
+ /**
265
+ * Force the use of the fallback adapter
266
+ * @default false
267
+ */
268
+ forceFallbackAdapter: !1
269
+ };
270
+ class N {
271
+ constructor(e) {
272
+ this._boundBindGroup = /* @__PURE__ */ Object.create(null), this._boundVertexBuffer = /* @__PURE__ */ Object.create(null), this._renderer = e;
273
+ }
274
+ renderStart() {
275
+ this.commandFinished = new Promise((e) => {
276
+ this._resolveCommandFinished = e;
277
+ }), this.commandEncoder = this._renderer.gpu.device.createCommandEncoder();
278
+ }
279
+ beginRenderPass(e) {
280
+ this.endRenderPass(), this._clearCache(), this.renderPassEncoder = this.commandEncoder.beginRenderPass(e.descriptor);
281
+ }
282
+ endRenderPass() {
283
+ this.renderPassEncoder && this.renderPassEncoder.end(), this.renderPassEncoder = null;
284
+ }
285
+ setViewport(e) {
286
+ this.renderPassEncoder.setViewport(e.x, e.y, e.width, e.height, 0, 1);
287
+ }
288
+ setPipelineFromGeometryProgramAndState(e, t, r, s) {
289
+ const i = this._renderer.pipeline.getPipeline(e, t, r, s);
290
+ this.setPipeline(i);
291
+ }
292
+ setPipeline(e) {
293
+ this._boundPipeline !== e && (this._boundPipeline = e, this.renderPassEncoder.setPipeline(e));
294
+ }
295
+ _setVertexBuffer(e, t) {
296
+ this._boundVertexBuffer[e] !== t && (this._boundVertexBuffer[e] = t, this.renderPassEncoder.setVertexBuffer(e, this._renderer.buffer.updateBuffer(t)));
297
+ }
298
+ _setIndexBuffer(e) {
299
+ if (this._boundIndexBuffer === e)
300
+ return;
301
+ this._boundIndexBuffer = e;
302
+ const t = e.data.BYTES_PER_ELEMENT === 2 ? "uint16" : "uint32";
303
+ this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e), t);
304
+ }
305
+ resetBindGroup(e) {
306
+ this._boundBindGroup[e] = null;
307
+ }
308
+ setBindGroup(e, t, r) {
309
+ if (this._boundBindGroup[e] === t)
310
+ return;
311
+ this._boundBindGroup[e] = t, t._touch(this._renderer.textureGC.count);
312
+ const s = this._renderer.bindGroup.getBindGroup(t, r, e);
313
+ this.renderPassEncoder.setBindGroup(e, s);
314
+ }
315
+ setGeometry(e, t) {
316
+ const r = this._renderer.pipeline.getBufferNamesToBind(e, t);
317
+ for (const s in r)
318
+ this._setVertexBuffer(s, e.attributes[r[s]].buffer);
319
+ e.indexBuffer && this._setIndexBuffer(e.indexBuffer);
320
+ }
321
+ _setShaderBindGroups(e, t) {
322
+ for (const r in e.groups) {
323
+ const s = e.groups[r];
324
+ t || this._syncBindGroup(s), this.setBindGroup(r, s, e.gpuProgram);
325
+ }
326
+ }
327
+ _syncBindGroup(e) {
328
+ for (const t in e.resources) {
329
+ const r = e.resources[t];
330
+ r.isUniformGroup && this._renderer.ubo.updateUniformGroup(r);
331
+ }
332
+ }
333
+ draw(e) {
334
+ const { geometry: t, shader: r, state: s, topology: i, size: n, start: o, instanceCount: u, skipSync: c } = e;
335
+ this.setPipelineFromGeometryProgramAndState(t, r.gpuProgram, s, i), this.setGeometry(t, r.gpuProgram), this._setShaderBindGroups(r, c), t.indexBuffer ? this.renderPassEncoder.drawIndexed(
336
+ n || t.indexBuffer.data.length,
337
+ u ?? t.instanceCount,
338
+ o || 0
339
+ ) : this.renderPassEncoder.draw(n || t.getSize(), u ?? t.instanceCount, o || 0);
340
+ }
341
+ finishRenderPass() {
342
+ this.renderPassEncoder && (this.renderPassEncoder.end(), this.renderPassEncoder = null);
343
+ }
344
+ postrender() {
345
+ this.finishRenderPass(), this._gpu.device.queue.submit([this.commandEncoder.finish()]), this._resolveCommandFinished(), this.commandEncoder = null;
346
+ }
347
+ // restores a render pass if finishRenderPass was called
348
+ // not optimised as really used for debugging!
349
+ // used when we want to stop drawing and log a texture..
350
+ restoreRenderPass() {
351
+ const e = this._renderer.renderTarget.adaptor.getDescriptor(
352
+ this._renderer.renderTarget.renderTarget,
353
+ !1,
354
+ [0, 0, 0, 1]
355
+ );
356
+ this.renderPassEncoder = this.commandEncoder.beginRenderPass(e);
357
+ const t = this._boundPipeline, r = { ...this._boundVertexBuffer }, s = this._boundIndexBuffer, i = { ...this._boundBindGroup };
358
+ this._clearCache();
359
+ const n = this._renderer.renderTarget.viewport;
360
+ this.renderPassEncoder.setViewport(n.x, n.y, n.width, n.height, 0, 1), this.setPipeline(t);
361
+ for (const o in r)
362
+ this._setVertexBuffer(o, r[o]);
363
+ for (const o in i)
364
+ this.setBindGroup(o, i[o], null);
365
+ this._setIndexBuffer(s);
366
+ }
367
+ _clearCache() {
368
+ for (let e = 0; e < 16; e++)
369
+ this._boundBindGroup[e] = null, this._boundVertexBuffer[e] = null;
370
+ this._boundIndexBuffer = null, this._boundPipeline = null;
371
+ }
372
+ destroy() {
373
+ this._renderer = null, this._gpu = null, this._boundBindGroup = null, this._boundVertexBuffer = null, this._boundIndexBuffer = null, this._boundPipeline = null;
374
+ }
375
+ contextChange(e) {
376
+ this._gpu = e;
377
+ }
378
+ }
379
+ N.extension = {
380
+ type: [f.WebGPUSystem],
381
+ name: "encoder",
382
+ priority: 1
383
+ };
384
+ class j {
385
+ constructor(e) {
386
+ this._renderTargetStencilState = /* @__PURE__ */ Object.create(null), this._renderer = e, e.renderTarget.onRenderTargetChange.add(this);
387
+ }
388
+ onRenderTargetChange(e) {
389
+ let t = this._renderTargetStencilState[e.uid];
390
+ t || (t = this._renderTargetStencilState[e.uid] = {
391
+ stencilMode: C.DISABLED,
392
+ stencilReference: 0
393
+ }), this._activeRenderTarget = e, this.setStencilMode(t.stencilMode, t.stencilReference);
394
+ }
395
+ setStencilMode(e, t) {
396
+ const r = this._renderTargetStencilState[this._activeRenderTarget.uid];
397
+ r.stencilMode = e, r.stencilReference = t;
398
+ const s = this._renderer;
399
+ s.pipeline.setStencilMode(e), s.encoder.renderPassEncoder.setStencilReference(t);
400
+ }
401
+ destroy() {
402
+ this._renderer.renderTarget.onRenderTargetChange.remove(this), this._renderer = null, this._activeRenderTarget = null, this._renderTargetStencilState = null;
403
+ }
404
+ }
405
+ j.extension = {
406
+ type: [
407
+ f.WebGPUSystem
408
+ ],
409
+ name: "stencil"
410
+ };
411
+ const G = {
412
+ i32: { align: 4, size: 4 },
413
+ u32: { align: 4, size: 4 },
414
+ f32: { align: 4, size: 4 },
415
+ f16: { align: 2, size: 2 },
416
+ "vec2<i32>": { align: 8, size: 8 },
417
+ "vec2<u32>": { align: 8, size: 8 },
418
+ "vec2<f32>": { align: 8, size: 8 },
419
+ "vec2<f16>": { align: 4, size: 4 },
420
+ "vec3<i32>": { align: 16, size: 12 },
421
+ "vec3<u32>": { align: 16, size: 12 },
422
+ "vec3<f32>": { align: 16, size: 12 },
423
+ "vec3<f16>": { align: 8, size: 6 },
424
+ "vec4<i32>": { align: 16, size: 16 },
425
+ "vec4<u32>": { align: 16, size: 16 },
426
+ "vec4<f32>": { align: 16, size: 16 },
427
+ "vec4<f16>": { align: 8, size: 8 },
428
+ "mat2x2<f32>": { align: 8, size: 16 },
429
+ "mat2x2<f16>": { align: 4, size: 8 },
430
+ "mat3x2<f32>": { align: 8, size: 24 },
431
+ "mat3x2<f16>": { align: 4, size: 12 },
432
+ "mat4x2<f32>": { align: 8, size: 32 },
433
+ "mat4x2<f16>": { align: 4, size: 16 },
434
+ "mat2x3<f32>": { align: 16, size: 32 },
435
+ "mat2x3<f16>": { align: 8, size: 16 },
436
+ "mat3x3<f32>": { align: 16, size: 48 },
437
+ "mat3x3<f16>": { align: 8, size: 24 },
438
+ "mat4x3<f32>": { align: 16, size: 64 },
439
+ "mat4x3<f16>": { align: 8, size: 32 },
440
+ "mat2x4<f32>": { align: 16, size: 32 },
441
+ "mat2x4<f16>": { align: 8, size: 16 },
442
+ "mat3x4<f32>": { align: 16, size: 48 },
443
+ "mat3x4<f16>": { align: 8, size: 24 },
444
+ "mat4x4<f32>": { align: 16, size: 64 },
445
+ "mat4x4<f16>": { align: 8, size: 32 }
446
+ };
447
+ function Ue(a) {
448
+ const e = a.map((r) => ({
449
+ data: r,
450
+ offset: 0,
451
+ size: 0
452
+ }));
453
+ let t = 0;
454
+ for (let r = 0; r < e.length; r++) {
455
+ const s = e[r];
456
+ let i = G[s.data.type].size;
457
+ const n = G[s.data.type].align;
458
+ if (!G[s.data.type])
459
+ throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);
460
+ s.data.size > 1 && (i = Math.max(i, n) * s.data.size), t = Math.ceil(t / n) * n, s.size = i, s.offset = t, t += i;
461
+ }
462
+ return t = Math.ceil(t / 16) * 16, { uboElements: e, size: t };
463
+ }
464
+ function Me(a, e) {
465
+ const { size: t, align: r } = G[a.data.type], s = (r - t) / 4, i = a.data.type.indexOf("i32") >= 0 ? "dataInt32" : "data";
466
+ return `
467
+ v = uv.${a.data.name};
468
+ ${e !== 0 ? `offset += ${e};` : ""}
469
+
470
+ arrayOffset = offset;
471
+
472
+ t = 0;
473
+
474
+ for(var i=0; i < ${a.data.size * (t / 4)}; i++)
475
+ {
476
+ for(var j = 0; j < ${t / 4}; j++)
477
+ {
478
+ ${i}[arrayOffset++] = v[t++];
479
+ }
480
+ ${s !== 0 ? `arrayOffset += ${s};` : ""}
481
+ }
482
+ `;
483
+ }
484
+ function we(a) {
485
+ return _e(
486
+ a,
487
+ "uboWgsl",
488
+ Me,
489
+ be
490
+ );
491
+ }
492
+ class K extends ye {
493
+ constructor() {
494
+ super({
495
+ createUboElements: Ue,
496
+ generateUboSync: we
497
+ });
498
+ }
499
+ }
500
+ K.extension = {
501
+ type: [f.WebGPUSystem],
502
+ name: "ubo"
503
+ };
504
+ const b = 128;
505
+ class q {
506
+ constructor(e) {
507
+ this._bindGroupHash = /* @__PURE__ */ Object.create(null), this._buffers = [], this._bindGroups = [], this._bufferResources = [], this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_bindGroupHash"), this._batchBuffer = new ve({ minUniformOffsetAlignment: b });
508
+ const t = 256 / b;
509
+ for (let r = 0; r < t; r++) {
510
+ let s = P.UNIFORM | P.COPY_DST;
511
+ r === 0 && (s |= P.COPY_SRC), this._buffers.push(new ae({
512
+ data: this._batchBuffer.data,
513
+ usage: s
514
+ }));
515
+ }
516
+ }
517
+ renderEnd() {
518
+ this._uploadBindGroups(), this._resetBindGroups();
519
+ }
520
+ _resetBindGroups() {
521
+ for (const e in this._bindGroupHash)
522
+ this._bindGroupHash[e] = null;
523
+ this._batchBuffer.clear();
524
+ }
525
+ // just works for single bind groups for now
526
+ getUniformBindGroup(e, t) {
527
+ if (!t && this._bindGroupHash[e.uid])
528
+ return this._bindGroupHash[e.uid];
529
+ this._renderer.ubo.ensureUniformGroup(e);
530
+ const r = e.buffer.data, s = this._batchBuffer.addEmptyGroup(r.length);
531
+ return this._renderer.ubo.syncUniformGroup(e, this._batchBuffer.data, s / 4), this._bindGroupHash[e.uid] = this._getBindGroup(s / b), this._bindGroupHash[e.uid];
532
+ }
533
+ getUboResource(e) {
534
+ this._renderer.ubo.updateUniformGroup(e);
535
+ const t = e.buffer.data, r = this._batchBuffer.addGroup(t);
536
+ return this._getBufferResource(r / b);
537
+ }
538
+ getArrayBindGroup(e) {
539
+ const t = this._batchBuffer.addGroup(e);
540
+ return this._getBindGroup(t / b);
541
+ }
542
+ getArrayBufferResource(e) {
543
+ const r = this._batchBuffer.addGroup(e) / b;
544
+ return this._getBufferResource(r);
545
+ }
546
+ _getBufferResource(e) {
547
+ if (!this._bufferResources[e]) {
548
+ const t = this._buffers[e % 2];
549
+ this._bufferResources[e] = new xe({
550
+ buffer: t,
551
+ offset: (e / 2 | 0) * 256,
552
+ size: b
553
+ });
554
+ }
555
+ return this._bufferResources[e];
556
+ }
557
+ _getBindGroup(e) {
558
+ if (!this._bindGroups[e]) {
559
+ const t = new E({
560
+ 0: this._getBufferResource(e)
561
+ });
562
+ this._bindGroups[e] = t;
563
+ }
564
+ return this._bindGroups[e];
565
+ }
566
+ _uploadBindGroups() {
567
+ const e = this._renderer.buffer, t = this._buffers[0];
568
+ t.update(this._batchBuffer.byteIndex), e.updateBuffer(t);
569
+ const r = this._renderer.gpu.device.createCommandEncoder();
570
+ for (let s = 1; s < this._buffers.length; s++) {
571
+ const i = this._buffers[s];
572
+ r.copyBufferToBuffer(
573
+ e.getGPUBuffer(t),
574
+ b,
575
+ e.getGPUBuffer(i),
576
+ 0,
577
+ this._batchBuffer.byteIndex
578
+ );
579
+ }
580
+ this._renderer.gpu.device.queue.submit([r.finish()]);
581
+ }
582
+ destroy() {
583
+ for (let e = 0; e < this._bindGroups.length; e++)
584
+ this._bindGroups[e].destroy();
585
+ this._bindGroups = null, this._bindGroupHash = null;
586
+ for (let e = 0; e < this._buffers.length; e++)
587
+ this._buffers[e].destroy();
588
+ this._buffers = null;
589
+ for (let e = 0; e < this._bufferResources.length; e++)
590
+ this._bufferResources[e].destroy();
591
+ this._bufferResources = null, this._batchBuffer.destroy(), this._bindGroupHash = null, this._renderer = null;
592
+ }
593
+ }
594
+ q.extension = {
595
+ type: [
596
+ f.WebGPUPipes
597
+ ],
598
+ name: "uniformBatch"
599
+ };
600
+ const Re = {
601
+ "point-list": 0,
602
+ "line-list": 1,
603
+ "line-strip": 2,
604
+ "triangle-list": 3,
605
+ "triangle-strip": 4
606
+ };
607
+ function Ee(a, e, t, r, s) {
608
+ return a << 24 | e << 16 | t << 10 | r << 5 | s;
609
+ }
610
+ function Ae(a, e, t, r) {
611
+ return t << 6 | a << 3 | r << 1 | e;
612
+ }
613
+ class Y {
614
+ constructor(e) {
615
+ this._moduleCache = /* @__PURE__ */ Object.create(null), this._bufferLayoutsCache = /* @__PURE__ */ Object.create(null), this._bindingNamesCache = /* @__PURE__ */ Object.create(null), this._pipeCache = /* @__PURE__ */ Object.create(null), this._pipeStateCaches = /* @__PURE__ */ Object.create(null), this._colorMask = 15, this._multisampleCount = 1, this._renderer = e;
616
+ }
617
+ contextChange(e) {
618
+ this._gpu = e, this.setStencilMode(C.DISABLED), this._updatePipeHash();
619
+ }
620
+ setMultisampleCount(e) {
621
+ this._multisampleCount !== e && (this._multisampleCount = e, this._updatePipeHash());
622
+ }
623
+ setRenderTarget(e) {
624
+ this._multisampleCount = e.msaaSamples, this._depthStencilAttachment = e.descriptor.depthStencilAttachment ? 1 : 0, this._updatePipeHash();
625
+ }
626
+ setColorMask(e) {
627
+ this._colorMask !== e && (this._colorMask = e, this._updatePipeHash());
628
+ }
629
+ setStencilMode(e) {
630
+ this._stencilMode !== e && (this._stencilMode = e, this._stencilState = Ge[e], this._updatePipeHash());
631
+ }
632
+ setPipeline(e, t, r, s) {
633
+ const i = this.getPipeline(e, t, r);
634
+ s.setPipeline(i);
635
+ }
636
+ getPipeline(e, t, r, s) {
637
+ e._layoutKey || (Be(e, t.attributeData), this._generateBufferKey(e)), s || (s = e.topology);
638
+ const i = Ee(
639
+ e._layoutKey,
640
+ t._layoutKey,
641
+ r.data,
642
+ r._blendModeId,
643
+ Re[s]
644
+ );
645
+ return this._pipeCache[i] ? this._pipeCache[i] : (this._pipeCache[i] = this._createPipeline(e, t, r, s), this._pipeCache[i]);
646
+ }
647
+ _createPipeline(e, t, r, s) {
648
+ const i = this._gpu.device, n = this._createVertexBufferLayouts(e, t), o = this._renderer.state.getColorTargets(r);
649
+ o[0].writeMask = this._stencilMode === C.RENDERING_MASK_ADD ? 0 : this._colorMask;
650
+ const u = this._renderer.shader.getProgramData(t).pipeline, c = {
651
+ // TODO later check if its helpful to create..
652
+ // layout,
653
+ vertex: {
654
+ module: this._getModule(t.vertex.source),
655
+ entryPoint: t.vertex.entryPoint,
656
+ // geometry..
657
+ buffers: n
658
+ },
659
+ fragment: {
660
+ module: this._getModule(t.fragment.source),
661
+ entryPoint: t.fragment.entryPoint,
662
+ targets: o
663
+ },
664
+ primitive: {
665
+ topology: s,
666
+ cullMode: r.cullMode
667
+ },
668
+ layout: u,
669
+ multisample: {
670
+ count: this._multisampleCount
671
+ },
672
+ // depthStencil,
673
+ label: "PIXI Pipeline"
674
+ };
675
+ return this._depthStencilAttachment && (c.depthStencil = {
676
+ ...this._stencilState,
677
+ format: "depth24plus-stencil8",
678
+ depthWriteEnabled: r.depthTest,
679
+ depthCompare: r.depthTest ? "less" : "always"
680
+ }), i.createRenderPipeline(c);
681
+ }
682
+ _getModule(e) {
683
+ return this._moduleCache[e] || this._createModule(e);
684
+ }
685
+ _createModule(e) {
686
+ const t = this._gpu.device;
687
+ return this._moduleCache[e] = t.createShaderModule({
688
+ code: e
689
+ }), this._moduleCache[e];
690
+ }
691
+ _generateBufferKey(e) {
692
+ const t = [];
693
+ let r = 0;
694
+ const s = Object.keys(e.attributes).sort();
695
+ for (let n = 0; n < s.length; n++) {
696
+ const o = e.attributes[s[n]];
697
+ t[r++] = o.offset, t[r++] = o.format, t[r++] = o.stride, t[r++] = o.instance;
698
+ }
699
+ const i = t.join("|");
700
+ return e._layoutKey = U(i, "geometry"), e._layoutKey;
701
+ }
702
+ _generateAttributeLocationsKey(e) {
703
+ const t = [];
704
+ let r = 0;
705
+ const s = Object.keys(e.attributeData).sort();
706
+ for (let n = 0; n < s.length; n++) {
707
+ const o = e.attributeData[s[n]];
708
+ t[r++] = o.location;
709
+ }
710
+ const i = t.join("|");
711
+ return e._attributeLocationsKey = U(i, "programAttributes"), e._attributeLocationsKey;
712
+ }
713
+ /**
714
+ * Returns a hash of buffer names mapped to bind locations.
715
+ * This is used to bind the correct buffer to the correct location in the shader.
716
+ * @param geometry - The geometry where to get the buffer names
717
+ * @param program - The program where to get the buffer names
718
+ * @returns An object of buffer names mapped to the bind location.
719
+ */
720
+ getBufferNamesToBind(e, t) {
721
+ const r = e._layoutKey << 16 | t._attributeLocationsKey;
722
+ if (this._bindingNamesCache[r])
723
+ return this._bindingNamesCache[r];
724
+ const s = this._createVertexBufferLayouts(e, t), i = /* @__PURE__ */ Object.create(null), n = t.attributeData;
725
+ for (let o = 0; o < s.length; o++) {
726
+ const c = Object.values(s[o].attributes)[0].shaderLocation;
727
+ for (const p in n)
728
+ if (n[p].location === c) {
729
+ i[o] = p;
730
+ break;
731
+ }
732
+ }
733
+ return this._bindingNamesCache[r] = i, i;
734
+ }
735
+ _createVertexBufferLayouts(e, t) {
736
+ t._attributeLocationsKey || this._generateAttributeLocationsKey(t);
737
+ const r = e._layoutKey << 16 | t._attributeLocationsKey;
738
+ if (this._bufferLayoutsCache[r])
739
+ return this._bufferLayoutsCache[r];
740
+ const s = [];
741
+ return e.buffers.forEach((i) => {
742
+ const n = {
743
+ arrayStride: 0,
744
+ stepMode: "vertex",
745
+ attributes: []
746
+ }, o = n.attributes;
747
+ for (const u in t.attributeData) {
748
+ const c = e.attributes[u];
749
+ (c.divisor ?? 1) !== 1 && A(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`), c.buffer === i && (n.arrayStride = c.stride, n.stepMode = c.instance ? "instance" : "vertex", o.push({
750
+ shaderLocation: t.attributeData[u].location,
751
+ offset: c.offset,
752
+ format: c.format
753
+ }));
754
+ }
755
+ o.length && s.push(n);
756
+ }), this._bufferLayoutsCache[r] = s, s;
757
+ }
758
+ _updatePipeHash() {
759
+ const e = Ae(
760
+ this._stencilMode,
761
+ this._multisampleCount,
762
+ this._colorMask,
763
+ this._depthStencilAttachment
764
+ );
765
+ this._pipeStateCaches[e] || (this._pipeStateCaches[e] = /* @__PURE__ */ Object.create(null)), this._pipeCache = this._pipeStateCaches[e];
766
+ }
767
+ destroy() {
768
+ this._renderer = null, this._bufferLayoutsCache = null;
769
+ }
770
+ }
771
+ Y.extension = {
772
+ type: [f.WebGPUSystem],
773
+ name: "pipeline"
774
+ };
775
+ class Le {
776
+ constructor() {
777
+ this.contexts = [], this.msaaTextures = [], this.msaaSamples = 1;
778
+ }
779
+ }
780
+ class ke {
781
+ init(e, t) {
782
+ this._renderer = e, this._renderTargetSystem = t;
783
+ }
784
+ copyToTexture(e, t, r, s, i) {
785
+ const n = this._renderer, o = this._getGpuColorTexture(
786
+ e
787
+ ), u = n.texture.getGpuSource(
788
+ t.source
789
+ );
790
+ return n.encoder.commandEncoder.copyTextureToTexture(
791
+ {
792
+ texture: o,
793
+ origin: r
794
+ },
795
+ {
796
+ texture: u,
797
+ origin: i
798
+ },
799
+ s
800
+ ), t;
801
+ }
802
+ startRenderPass(e, t = !0, r, s) {
803
+ const n = this._renderTargetSystem.getGpuRenderTarget(e), o = this.getDescriptor(e, t, r);
804
+ n.descriptor = o, this._renderer.pipeline.setRenderTarget(n), this._renderer.encoder.beginRenderPass(n), this._renderer.encoder.setViewport(s);
805
+ }
806
+ finishRenderPass() {
807
+ this._renderer.encoder.endRenderPass();
808
+ }
809
+ /**
810
+ * returns the gpu texture for the first color texture in the render target
811
+ * mainly used by the filter manager to get copy the texture for blending
812
+ * @param renderTarget
813
+ * @returns a gpu texture
814
+ */
815
+ _getGpuColorTexture(e) {
816
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
817
+ return t.contexts[0] ? t.contexts[0].getCurrentTexture() : this._renderer.texture.getGpuSource(
818
+ e.colorTextures[0].source
819
+ );
820
+ }
821
+ getDescriptor(e, t, r) {
822
+ typeof t == "boolean" && (t = t ? y.ALL : y.NONE);
823
+ const s = this._renderTargetSystem, i = s.getGpuRenderTarget(e), n = e.colorTextures.map(
824
+ (c, p) => {
825
+ const h = i.contexts[p];
826
+ let l, d;
827
+ h ? l = h.getCurrentTexture().createView() : l = this._renderer.texture.getGpuSource(c).createView({
828
+ mipLevelCount: 1
829
+ }), i.msaaTextures[p] && (d = l, l = this._renderer.texture.getTextureView(
830
+ i.msaaTextures[p]
831
+ ));
832
+ const _ = t & y.COLOR ? "clear" : "load";
833
+ return r ?? (r = s.defaultClearColor), {
834
+ view: l,
835
+ resolveTarget: d,
836
+ clearValue: r,
837
+ storeOp: "store",
838
+ loadOp: _
839
+ };
840
+ }
841
+ );
842
+ let o;
843
+ if ((e.stencil || e.depth) && !e.depthStencilTexture && (e.ensureDepthStencilTexture(), e.depthStencilTexture.source.sampleCount = i.msaa ? 4 : 1), e.depthStencilTexture) {
844
+ const c = t & y.STENCIL ? "clear" : "load", p = t & y.DEPTH ? "clear" : "load";
845
+ o = {
846
+ view: this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),
847
+ stencilStoreOp: "store",
848
+ stencilLoadOp: c,
849
+ depthClearValue: 1,
850
+ depthLoadOp: p,
851
+ depthStoreOp: "store"
852
+ };
853
+ }
854
+ return {
855
+ colorAttachments: n,
856
+ depthStencilAttachment: o
857
+ };
858
+ }
859
+ clear(e, t = !0, r, s) {
860
+ if (!t)
861
+ return;
862
+ const { gpu: i, encoder: n } = this._renderer, o = i.device;
863
+ if (n.commandEncoder === null) {
864
+ const c = o.createCommandEncoder(), p = this.getDescriptor(e, t, r), h = c.beginRenderPass(p);
865
+ h.setViewport(s.x, s.y, s.width, s.height, 0, 1), h.end();
866
+ const l = c.finish();
867
+ o.queue.submit([l]);
868
+ } else
869
+ this.startRenderPass(e, t, r, s);
870
+ }
871
+ initGpuRenderTarget(e) {
872
+ e.isRoot = !0;
873
+ const t = new Le();
874
+ return e.colorTextures.forEach((r, s) => {
875
+ if (ue.test(r.resource)) {
876
+ const i = r.resource.getContext(
877
+ "webgpu"
878
+ ), n = r.transparent ? "premultiplied" : "opaque";
879
+ try {
880
+ i.configure({
881
+ device: this._renderer.gpu.device,
882
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
883
+ format: "bgra8unorm",
884
+ alphaMode: n
885
+ });
886
+ } catch (o) {
887
+ console.error(o);
888
+ }
889
+ t.contexts[s] = i;
890
+ }
891
+ if (t.msaa = r.source.antialias, r.source.antialias) {
892
+ const i = new ce({
893
+ width: 0,
894
+ height: 0,
895
+ sampleCount: 4
896
+ });
897
+ t.msaaTextures[s] = i;
898
+ }
899
+ }), t.msaa && (t.msaaSamples = 4, e.depthStencilTexture && (e.depthStencilTexture.source.sampleCount = 4)), t;
900
+ }
901
+ destroyGpuRenderTarget(e) {
902
+ e.contexts.forEach((t) => {
903
+ t.unconfigure();
904
+ }), e.msaaTextures.forEach((t) => {
905
+ t.destroy();
906
+ }), e.msaaTextures.length = 0, e.contexts.length = 0;
907
+ }
908
+ ensureDepthStencilTexture(e) {
909
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
910
+ e.depthStencilTexture && t.msaa && (e.depthStencilTexture.source.sampleCount = 4);
911
+ }
912
+ resizeGpuRenderTarget(e) {
913
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
914
+ t.width = e.width, t.height = e.height, t.msaa && e.colorTextures.forEach((r, s) => {
915
+ const i = t.msaaTextures[s];
916
+ i == null || i.resize(
917
+ r.source.width,
918
+ r.source.height,
919
+ r.source._resolution
920
+ );
921
+ });
922
+ }
923
+ }
924
+ class $ extends Se {
925
+ constructor(e) {
926
+ super(e), this.adaptor = new ke(), this.adaptor.init(e, this);
927
+ }
928
+ }
929
+ $.extension = {
930
+ type: [f.WebGPUSystem],
931
+ name: "renderTarget"
932
+ };
933
+ class X {
934
+ constructor() {
935
+ this._gpuProgramData = /* @__PURE__ */ Object.create(null);
936
+ }
937
+ contextChange(e) {
938
+ this._gpu = e, this.maxTextures = e.device.limits.maxSampledTexturesPerShaderStage;
939
+ }
940
+ getProgramData(e) {
941
+ return this._gpuProgramData[e._layoutKey] || this._createGPUProgramData(e);
942
+ }
943
+ _createGPUProgramData(e) {
944
+ const t = this._gpu.device, r = e.gpuLayout.map((i) => t.createBindGroupLayout({ entries: i })), s = { bindGroupLayouts: r };
945
+ return this._gpuProgramData[e._layoutKey] = {
946
+ bindGroups: r,
947
+ pipeline: t.createPipelineLayout(s)
948
+ }, this._gpuProgramData[e._layoutKey];
949
+ }
950
+ destroy() {
951
+ this._gpu = null, this._gpuProgramData = null;
952
+ }
953
+ }
954
+ X.extension = {
955
+ type: [
956
+ f.WebGPUSystem
957
+ ],
958
+ name: "shader"
959
+ };
960
+ const g = {};
961
+ g.normal = {
962
+ alpha: {
963
+ srcFactor: "one",
964
+ dstFactor: "one-minus-src-alpha",
965
+ operation: "add"
966
+ },
967
+ color: {
968
+ srcFactor: "one",
969
+ dstFactor: "one-minus-src-alpha",
970
+ operation: "add"
971
+ }
972
+ };
973
+ g.add = {
974
+ alpha: {
975
+ srcFactor: "src-alpha",
976
+ dstFactor: "one-minus-src-alpha",
977
+ operation: "add"
978
+ },
979
+ color: {
980
+ srcFactor: "one",
981
+ dstFactor: "one",
982
+ operation: "add"
983
+ }
984
+ };
985
+ g.multiply = {
986
+ alpha: {
987
+ srcFactor: "one",
988
+ dstFactor: "one-minus-src-alpha",
989
+ operation: "add"
990
+ },
991
+ color: {
992
+ srcFactor: "dst",
993
+ dstFactor: "one-minus-src-alpha",
994
+ operation: "add"
995
+ }
996
+ };
997
+ g.screen = {
998
+ alpha: {
999
+ srcFactor: "one",
1000
+ dstFactor: "one-minus-src-alpha",
1001
+ operation: "add"
1002
+ },
1003
+ color: {
1004
+ srcFactor: "one",
1005
+ dstFactor: "one-minus-src",
1006
+ operation: "add"
1007
+ }
1008
+ };
1009
+ g.overlay = {
1010
+ alpha: {
1011
+ srcFactor: "one",
1012
+ dstFactor: "one-minus-src-alpha",
1013
+ operation: "add"
1014
+ },
1015
+ color: {
1016
+ srcFactor: "one",
1017
+ dstFactor: "one-minus-src",
1018
+ operation: "add"
1019
+ }
1020
+ };
1021
+ g.none = {
1022
+ alpha: {
1023
+ srcFactor: "one",
1024
+ dstFactor: "one-minus-src-alpha",
1025
+ operation: "add"
1026
+ },
1027
+ color: {
1028
+ srcFactor: "zero",
1029
+ dstFactor: "zero",
1030
+ operation: "add"
1031
+ }
1032
+ };
1033
+ g["normal-npm"] = {
1034
+ alpha: {
1035
+ srcFactor: "one",
1036
+ dstFactor: "one-minus-src-alpha",
1037
+ operation: "add"
1038
+ },
1039
+ color: {
1040
+ srcFactor: "src-alpha",
1041
+ dstFactor: "one-minus-src-alpha",
1042
+ operation: "add"
1043
+ }
1044
+ };
1045
+ g["add-npm"] = {
1046
+ alpha: {
1047
+ srcFactor: "one",
1048
+ dstFactor: "one",
1049
+ operation: "add"
1050
+ },
1051
+ color: {
1052
+ srcFactor: "src-alpha",
1053
+ dstFactor: "one",
1054
+ operation: "add"
1055
+ }
1056
+ };
1057
+ g["screen-npm"] = {
1058
+ alpha: {
1059
+ srcFactor: "one",
1060
+ dstFactor: "one-minus-src-alpha",
1061
+ operation: "add"
1062
+ },
1063
+ color: {
1064
+ srcFactor: "src-alpha",
1065
+ dstFactor: "one-minus-src",
1066
+ operation: "add"
1067
+ }
1068
+ };
1069
+ g.erase = {
1070
+ alpha: {
1071
+ srcFactor: "zero",
1072
+ dstFactor: "one-minus-src-alpha",
1073
+ operation: "add"
1074
+ },
1075
+ color: {
1076
+ srcFactor: "zero",
1077
+ dstFactor: "one-minus-src",
1078
+ operation: "add"
1079
+ }
1080
+ };
1081
+ g.min = {
1082
+ alpha: {
1083
+ srcFactor: "one",
1084
+ dstFactor: "one",
1085
+ operation: "min"
1086
+ },
1087
+ color: {
1088
+ srcFactor: "one",
1089
+ dstFactor: "one",
1090
+ operation: "min"
1091
+ }
1092
+ };
1093
+ g.max = {
1094
+ alpha: {
1095
+ srcFactor: "one",
1096
+ dstFactor: "one",
1097
+ operation: "max"
1098
+ },
1099
+ color: {
1100
+ srcFactor: "one",
1101
+ dstFactor: "one",
1102
+ operation: "max"
1103
+ }
1104
+ };
1105
+ class Z {
1106
+ constructor() {
1107
+ this.defaultState = new F(), this.defaultState.blend = !0;
1108
+ }
1109
+ contextChange(e) {
1110
+ this.gpu = e;
1111
+ }
1112
+ /**
1113
+ * Gets the blend mode data for the current state
1114
+ * @param state - The state to get the blend mode from
1115
+ */
1116
+ getColorTargets(e) {
1117
+ return [
1118
+ {
1119
+ format: "bgra8unorm",
1120
+ writeMask: 0,
1121
+ blend: g[e.blendMode] || g.normal
1122
+ }
1123
+ ];
1124
+ }
1125
+ destroy() {
1126
+ this.gpu = null;
1127
+ }
1128
+ }
1129
+ Z.extension = {
1130
+ type: [
1131
+ f.WebGPUSystem
1132
+ ],
1133
+ name: "state"
1134
+ };
1135
+ const De = {
1136
+ type: "image",
1137
+ upload(a, e, t) {
1138
+ const r = a.resource, s = (a.pixelWidth | 0) * (a.pixelHeight | 0), i = r.byteLength / s;
1139
+ t.device.queue.writeTexture(
1140
+ { texture: e },
1141
+ r,
1142
+ {
1143
+ offset: 0,
1144
+ rowsPerImage: a.pixelHeight,
1145
+ bytesPerRow: a.pixelHeight * i
1146
+ },
1147
+ {
1148
+ width: a.pixelWidth,
1149
+ height: a.pixelHeight,
1150
+ depthOrArrayLayers: 1
1151
+ }
1152
+ );
1153
+ }
1154
+ }, J = {
1155
+ "bc1-rgba-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
1156
+ "bc2-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1157
+ "bc3-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1158
+ "bc7-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1159
+ "etc1-rgb-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
1160
+ "etc2-rgba8unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1161
+ "astc-4x4-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }
1162
+ }, He = { blockBytes: 4, blockWidth: 1, blockHeight: 1 }, ze = {
1163
+ type: "compressed",
1164
+ upload(a, e, t) {
1165
+ let r = a.pixelWidth, s = a.pixelHeight;
1166
+ const i = J[a.format] || He;
1167
+ for (let n = 0; n < a.resource.length; n++) {
1168
+ const o = a.resource[n], u = Math.ceil(r / i.blockWidth) * i.blockBytes;
1169
+ t.device.queue.writeTexture(
1170
+ {
1171
+ texture: e,
1172
+ mipLevel: n
1173
+ },
1174
+ o,
1175
+ {
1176
+ offset: 0,
1177
+ bytesPerRow: u
1178
+ },
1179
+ {
1180
+ width: Math.ceil(r / i.blockWidth) * i.blockWidth,
1181
+ height: Math.ceil(s / i.blockHeight) * i.blockHeight,
1182
+ depthOrArrayLayers: 1
1183
+ }
1184
+ ), r = Math.max(r >> 1, 1), s = Math.max(s >> 1, 1);
1185
+ }
1186
+ }
1187
+ }, Q = {
1188
+ type: "image",
1189
+ upload(a, e, t) {
1190
+ const r = a.resource;
1191
+ if (!r)
1192
+ return;
1193
+ const s = Math.min(e.width, a.resourceWidth || a.pixelWidth), i = Math.min(e.height, a.resourceHeight || a.pixelHeight), n = a.alphaMode === "premultiply-alpha-on-upload";
1194
+ t.device.queue.copyExternalImageToTexture(
1195
+ { source: r },
1196
+ { texture: e, premultipliedAlpha: n },
1197
+ {
1198
+ width: s,
1199
+ height: i
1200
+ }
1201
+ );
1202
+ }
1203
+ }, Fe = {
1204
+ type: "video",
1205
+ upload(a, e, t) {
1206
+ Q.upload(a, e, t);
1207
+ }
1208
+ };
1209
+ class Oe {
1210
+ constructor(e) {
1211
+ this.device = e, this.sampler = e.createSampler({ minFilter: "linear" }), this.pipelines = {};
1212
+ }
1213
+ _getMipmapPipeline(e) {
1214
+ let t = this.pipelines[e];
1215
+ return t || (this.mipmapShaderModule || (this.mipmapShaderModule = this.device.createShaderModule({
1216
+ code: (
1217
+ /* wgsl */
1218
+ `
1219
+ var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
1220
+ vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
1221
+
1222
+ struct VertexOutput {
1223
+ @builtin(position) position : vec4<f32>,
1224
+ @location(0) texCoord : vec2<f32>,
1225
+ };
1226
+
1227
+ @vertex
1228
+ fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
1229
+ var output : VertexOutput;
1230
+ output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
1231
+ output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
1232
+ return output;
1233
+ }
1234
+
1235
+ @group(0) @binding(0) var imgSampler : sampler;
1236
+ @group(0) @binding(1) var img : texture_2d<f32>;
1237
+
1238
+ @fragment
1239
+ fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
1240
+ return textureSample(img, imgSampler, texCoord);
1241
+ }
1242
+ `
1243
+ )
1244
+ })), t = this.device.createRenderPipeline({
1245
+ layout: "auto",
1246
+ vertex: {
1247
+ module: this.mipmapShaderModule,
1248
+ entryPoint: "vertexMain"
1249
+ },
1250
+ fragment: {
1251
+ module: this.mipmapShaderModule,
1252
+ entryPoint: "fragmentMain",
1253
+ targets: [{ format: e }]
1254
+ }
1255
+ }), this.pipelines[e] = t), t;
1256
+ }
1257
+ /**
1258
+ * Generates mipmaps for the given GPUTexture from the data in level 0.
1259
+ * @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.
1260
+ * @returns {module:External.GPUTexture} - The originally passed texture
1261
+ */
1262
+ generateMipmap(e) {
1263
+ const t = this._getMipmapPipeline(e.format);
1264
+ if (e.dimension === "3d" || e.dimension === "1d")
1265
+ throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");
1266
+ let r = e;
1267
+ const s = e.depthOrArrayLayers || 1, i = e.usage & GPUTextureUsage.RENDER_ATTACHMENT;
1268
+ if (!i) {
1269
+ const u = {
1270
+ size: {
1271
+ width: Math.ceil(e.width / 2),
1272
+ height: Math.ceil(e.height / 2),
1273
+ depthOrArrayLayers: s
1274
+ },
1275
+ format: e.format,
1276
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
1277
+ mipLevelCount: e.mipLevelCount - 1
1278
+ };
1279
+ r = this.device.createTexture(u);
1280
+ }
1281
+ const n = this.device.createCommandEncoder({}), o = t.getBindGroupLayout(0);
1282
+ for (let u = 0; u < s; ++u) {
1283
+ let c = e.createView({
1284
+ baseMipLevel: 0,
1285
+ mipLevelCount: 1,
1286
+ dimension: "2d",
1287
+ baseArrayLayer: u,
1288
+ arrayLayerCount: 1
1289
+ }), p = i ? 1 : 0;
1290
+ for (let h = 1; h < e.mipLevelCount; ++h) {
1291
+ const l = r.createView({
1292
+ baseMipLevel: p++,
1293
+ mipLevelCount: 1,
1294
+ dimension: "2d",
1295
+ baseArrayLayer: u,
1296
+ arrayLayerCount: 1
1297
+ }), d = n.beginRenderPass({
1298
+ colorAttachments: [{
1299
+ view: l,
1300
+ storeOp: "store",
1301
+ loadOp: "clear",
1302
+ clearValue: { r: 0, g: 0, b: 0, a: 0 }
1303
+ }]
1304
+ }), _ = this.device.createBindGroup({
1305
+ layout: o,
1306
+ entries: [{
1307
+ binding: 0,
1308
+ resource: this.sampler
1309
+ }, {
1310
+ binding: 1,
1311
+ resource: c
1312
+ }]
1313
+ });
1314
+ d.setPipeline(t), d.setBindGroup(0, _), d.draw(3, 1, 0, 0), d.end(), c = l;
1315
+ }
1316
+ }
1317
+ if (!i) {
1318
+ const u = {
1319
+ width: Math.ceil(e.width / 2),
1320
+ height: Math.ceil(e.height / 2),
1321
+ depthOrArrayLayers: s
1322
+ };
1323
+ for (let c = 1; c < e.mipLevelCount; ++c)
1324
+ n.copyTextureToTexture({
1325
+ texture: r,
1326
+ mipLevel: c - 1
1327
+ }, {
1328
+ texture: e,
1329
+ mipLevel: c
1330
+ }, u), u.width = Math.ceil(u.width / 2), u.height = Math.ceil(u.height / 2);
1331
+ }
1332
+ return this.device.queue.submit([n.finish()]), i || r.destroy(), e;
1333
+ }
1334
+ }
1335
+ class ee {
1336
+ constructor(e) {
1337
+ this.managedTextures = [], this._gpuSources = /* @__PURE__ */ Object.create(null), this._gpuSamplers = /* @__PURE__ */ Object.create(null), this._bindGroupHash = /* @__PURE__ */ Object.create(null), this._textureViewHash = /* @__PURE__ */ Object.create(null), this._uploads = {
1338
+ image: Q,
1339
+ buffer: De,
1340
+ video: Fe,
1341
+ compressed: ze
1342
+ }, this._renderer = e, e.renderableGC.addManagedHash(this, "_gpuSources"), e.renderableGC.addManagedHash(this, "_gpuSamplers"), e.renderableGC.addManagedHash(this, "_bindGroupHash"), e.renderableGC.addManagedHash(this, "_textureViewHash");
1343
+ }
1344
+ contextChange(e) {
1345
+ this._gpu = e;
1346
+ }
1347
+ initSource(e) {
1348
+ if (e.autoGenerateMipmaps) {
1349
+ const u = Math.max(e.pixelWidth, e.pixelHeight);
1350
+ e.mipLevelCount = Math.floor(Math.log2(u)) + 1;
1351
+ }
1352
+ let t = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
1353
+ e.uploadMethodId !== "compressed" && (t |= GPUTextureUsage.RENDER_ATTACHMENT, t |= GPUTextureUsage.COPY_SRC);
1354
+ const r = J[e.format] || { blockWidth: 1, blockHeight: 1 }, s = Math.ceil(e.pixelWidth / r.blockWidth) * r.blockWidth, i = Math.ceil(e.pixelHeight / r.blockHeight) * r.blockHeight, n = {
1355
+ label: e.label,
1356
+ size: { width: s, height: i },
1357
+ format: e.format,
1358
+ sampleCount: e.sampleCount,
1359
+ mipLevelCount: e.mipLevelCount,
1360
+ dimension: e.dimension,
1361
+ usage: t
1362
+ }, o = this._gpu.device.createTexture(n);
1363
+ return this._gpuSources[e.uid] = o, this.managedTextures.includes(e) || (e.on("update", this.onSourceUpdate, this), e.on("resize", this.onSourceResize, this), e.on("destroy", this.onSourceDestroy, this), e.on("unload", this.onSourceUnload, this), e.on("updateMipmaps", this.onUpdateMipmaps, this), this.managedTextures.push(e)), this.onSourceUpdate(e), o;
1364
+ }
1365
+ onSourceUpdate(e) {
1366
+ const t = this.getGpuSource(e);
1367
+ t && (this._uploads[e.uploadMethodId] && this._uploads[e.uploadMethodId].upload(e, t, this._gpu), e.autoGenerateMipmaps && e.mipLevelCount > 1 && this.onUpdateMipmaps(e));
1368
+ }
1369
+ onSourceUnload(e) {
1370
+ const t = this._gpuSources[e.uid];
1371
+ t && (this._gpuSources[e.uid] = null, t.destroy());
1372
+ }
1373
+ onUpdateMipmaps(e) {
1374
+ this._mipmapGenerator || (this._mipmapGenerator = new Oe(this._gpu.device));
1375
+ const t = this.getGpuSource(e);
1376
+ this._mipmapGenerator.generateMipmap(t);
1377
+ }
1378
+ onSourceDestroy(e) {
1379
+ e.off("update", this.onSourceUpdate, this), e.off("unload", this.onSourceUnload, this), e.off("destroy", this.onSourceDestroy, this), e.off("resize", this.onSourceResize, this), e.off("updateMipmaps", this.onUpdateMipmaps, this), this.managedTextures.splice(this.managedTextures.indexOf(e), 1), this.onSourceUnload(e);
1380
+ }
1381
+ onSourceResize(e) {
1382
+ const t = this._gpuSources[e.uid];
1383
+ t ? (t.width !== e.pixelWidth || t.height !== e.pixelHeight) && (this._textureViewHash[e.uid] = null, this._bindGroupHash[e.uid] = null, this.onSourceUnload(e), this.initSource(e)) : this.initSource(e);
1384
+ }
1385
+ _initSampler(e) {
1386
+ return this._gpuSamplers[e._resourceId] = this._gpu.device.createSampler(e), this._gpuSamplers[e._resourceId];
1387
+ }
1388
+ getGpuSampler(e) {
1389
+ return this._gpuSamplers[e._resourceId] || this._initSampler(e);
1390
+ }
1391
+ getGpuSource(e) {
1392
+ return this._gpuSources[e.uid] || this.initSource(e);
1393
+ }
1394
+ /**
1395
+ * this returns s bind group for a specific texture, the bind group contains
1396
+ * - the texture source
1397
+ * - the texture style
1398
+ * - the texture matrix
1399
+ * This is cached so the bind group should only be created once per texture
1400
+ * @param texture - the texture you want the bindgroup for
1401
+ * @returns the bind group for the texture
1402
+ */
1403
+ getTextureBindGroup(e) {
1404
+ return this._bindGroupHash[e.uid] ?? this._createTextureBindGroup(e);
1405
+ }
1406
+ _createTextureBindGroup(e) {
1407
+ const t = e.source;
1408
+ return this._bindGroupHash[e.uid] = new E({
1409
+ 0: t,
1410
+ 1: t.style,
1411
+ 2: new L({
1412
+ uTextureMatrix: { type: "mat3x3<f32>", value: e.textureMatrix.mapCoord }
1413
+ })
1414
+ }), this._bindGroupHash[e.uid];
1415
+ }
1416
+ getTextureView(e) {
1417
+ const t = e.source;
1418
+ return this._textureViewHash[t.uid] ?? this._createTextureView(t);
1419
+ }
1420
+ _createTextureView(e) {
1421
+ return this._textureViewHash[e.uid] = this.getGpuSource(e).createView(), this._textureViewHash[e.uid];
1422
+ }
1423
+ generateCanvas(e) {
1424
+ const t = this._renderer, r = t.gpu.device.createCommandEncoder(), s = T.get().createCanvas();
1425
+ s.width = e.source.pixelWidth, s.height = e.source.pixelHeight;
1426
+ const i = s.getContext("webgpu");
1427
+ return i.configure({
1428
+ device: t.gpu.device,
1429
+ usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,
1430
+ format: T.get().getNavigator().gpu.getPreferredCanvasFormat(),
1431
+ alphaMode: "premultiplied"
1432
+ }), r.copyTextureToTexture({
1433
+ texture: t.texture.getGpuSource(e.source),
1434
+ origin: {
1435
+ x: 0,
1436
+ y: 0
1437
+ }
1438
+ }, {
1439
+ texture: i.getCurrentTexture()
1440
+ }, {
1441
+ width: s.width,
1442
+ height: s.height
1443
+ }), t.gpu.device.queue.submit([r.finish()]), s;
1444
+ }
1445
+ getPixels(e) {
1446
+ const t = this.generateCanvas(e), r = w.getOptimalCanvasAndContext(t.width, t.height), s = r.context;
1447
+ s.drawImage(t, 0, 0);
1448
+ const { width: i, height: n } = t, o = s.getImageData(0, 0, i, n), u = new Uint8ClampedArray(o.data.buffer);
1449
+ return w.returnCanvasAndContext(r), { pixels: u, width: i, height: n };
1450
+ }
1451
+ destroy() {
1452
+ this.managedTextures.slice().forEach((e) => this.onSourceDestroy(e)), this.managedTextures = null;
1453
+ for (const e of Object.keys(this._bindGroupHash)) {
1454
+ const t = Number(e), r = this._bindGroupHash[t];
1455
+ r == null || r.destroy(), this._bindGroupHash[t] = null;
1456
+ }
1457
+ this._gpu = null, this._mipmapGenerator = null, this._gpuSources = null, this._bindGroupHash = null, this._textureViewHash = null, this._gpuSamplers = null;
1458
+ }
1459
+ }
1460
+ ee.extension = {
1461
+ type: [
1462
+ f.WebGPUSystem
1463
+ ],
1464
+ name: "texture"
1465
+ };
1466
+ class te {
1467
+ init() {
1468
+ const e = new L({
1469
+ uTransformMatrix: { value: new k(), type: "mat3x3<f32>" },
1470
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
1471
+ uRound: { value: 0, type: "f32" }
1472
+ }), t = D({
1473
+ name: "graphics",
1474
+ bits: [
1475
+ de,
1476
+ he(pe()),
1477
+ ge,
1478
+ H
1479
+ ]
1480
+ });
1481
+ this.shader = new z({
1482
+ gpuProgram: t,
1483
+ resources: {
1484
+ // added on the fly!
1485
+ localUniforms: e
1486
+ }
1487
+ });
1488
+ }
1489
+ execute(e, t) {
1490
+ const r = t.context, s = r.customShader || this.shader, i = e.renderer, n = i.graphicsContext, {
1491
+ batcher: o,
1492
+ instructions: u
1493
+ } = n.getContextRenderData(r), c = i.encoder;
1494
+ c.setGeometry(o.geometry, s.gpuProgram);
1495
+ const p = i.globalUniforms.bindGroup;
1496
+ c.setBindGroup(0, p, s.gpuProgram);
1497
+ const h = i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms, !0);
1498
+ c.setBindGroup(2, h, s.gpuProgram);
1499
+ const l = u.instructions;
1500
+ let d = null;
1501
+ for (let _ = 0; _ < u.instructionSize; _++) {
1502
+ const m = l[_];
1503
+ if (m.topology !== d && (d = m.topology, c.setPipelineFromGeometryProgramAndState(
1504
+ o.geometry,
1505
+ s.gpuProgram,
1506
+ e.state,
1507
+ m.topology
1508
+ )), s.groups[1] = m.bindGroup, !m.gpuBindGroup) {
1509
+ const S = m.textures;
1510
+ m.bindGroup = R(S.textures, S.count), m.gpuBindGroup = i.bindGroup.getBindGroup(
1511
+ m.bindGroup,
1512
+ s.gpuProgram,
1513
+ 1
1514
+ );
1515
+ }
1516
+ c.setBindGroup(1, m.bindGroup, s.gpuProgram), c.renderPassEncoder.drawIndexed(m.size, 1, m.start);
1517
+ }
1518
+ }
1519
+ destroy() {
1520
+ this.shader.destroy(!0), this.shader = null;
1521
+ }
1522
+ }
1523
+ te.extension = {
1524
+ type: [
1525
+ f.WebGPUPipesAdaptor
1526
+ ],
1527
+ name: "graphics"
1528
+ };
1529
+ class re {
1530
+ init() {
1531
+ const e = D({
1532
+ name: "mesh",
1533
+ bits: [
1534
+ me,
1535
+ Pe,
1536
+ H
1537
+ ]
1538
+ });
1539
+ this._shader = new z({
1540
+ gpuProgram: e,
1541
+ resources: {
1542
+ uTexture: M.EMPTY._source,
1543
+ uSampler: M.EMPTY._source.style,
1544
+ textureUniforms: {
1545
+ uTextureMatrix: { type: "mat3x3<f32>", value: new k() }
1546
+ }
1547
+ }
1548
+ });
1549
+ }
1550
+ execute(e, t) {
1551
+ const r = e.renderer;
1552
+ let s = t._shader;
1553
+ if (!s)
1554
+ s = this._shader, s.groups[2] = r.texture.getTextureBindGroup(t.texture);
1555
+ else if (!s.gpuProgram) {
1556
+ A("Mesh shader has no gpuProgram", t.shader);
1557
+ return;
1558
+ }
1559
+ const i = s.gpuProgram;
1560
+ if (i.autoAssignGlobalUniforms && (s.groups[0] = r.globalUniforms.bindGroup), i.autoAssignLocalUniforms) {
1561
+ const n = e.localUniforms;
1562
+ s.groups[1] = r.renderPipes.uniformBatch.getUniformBindGroup(n, !0);
1563
+ }
1564
+ r.encoder.draw({
1565
+ geometry: t._geometry,
1566
+ shader: s,
1567
+ state: t.state
1568
+ });
1569
+ }
1570
+ destroy() {
1571
+ this._shader.destroy(!0), this._shader = null;
1572
+ }
1573
+ }
1574
+ re.extension = {
1575
+ type: [
1576
+ f.WebGPUPipesAdaptor
1577
+ ],
1578
+ name: "mesh"
1579
+ };
1580
+ const Ie = [
1581
+ ...Te,
1582
+ K,
1583
+ N,
1584
+ v,
1585
+ W,
1586
+ ee,
1587
+ $,
1588
+ X,
1589
+ Z,
1590
+ Y,
1591
+ V,
1592
+ j,
1593
+ I
1594
+ ], We = [...Ce, q], Ve = [O, re, te], se = [], ie = [], ne = [];
1595
+ B.handleByNamedList(f.WebGPUSystem, se);
1596
+ B.handleByNamedList(f.WebGPUPipes, ie);
1597
+ B.handleByNamedList(f.WebGPUPipesAdaptor, ne);
1598
+ B.add(...Ie, ...We, ...Ve);
1599
+ class Ye extends le {
1600
+ constructor() {
1601
+ const e = {
1602
+ name: "webgpu",
1603
+ type: fe.WEBGPU,
1604
+ systems: se,
1605
+ renderPipes: ie,
1606
+ renderPipeAdaptors: ne
1607
+ };
1608
+ super(e);
1609
+ }
1610
+ }
1611
+ export {
1612
+ Ye as WebGPURenderer
1613
+ };