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,2871 @@
1
+ import { E as x, U as _t, T as xe, a as bt, a0 as G, a1 as W, t as R, Z as M, M as F, a9 as yt, aa as Tt, w as I, ab as se, ac as D, O as ne, ad as vt, ae as E, af as U, k as L, c as Ae, H as k, P as wt, a3 as de, R as le, F as Ge, b as $, B as A, ag as St, y as v, ah as Ct, ai as ce, K as ae, aj as X, s as he, u as Bt, G as Pt, ak as Rt, l as ze, p as He, a4 as We, a7 as De, q as Mt, m as Ft, o as Ut, a5 as kt, a6 as At, a8 as Gt, al as zt, am as Ht, D as Oe, n as _e, e as S, an as Wt } from "./index-Cs2whU2f.mjs";
2
+ import { S as q, c as J, a as Dt, b as Ot, B as Ie } from "./colorToUniform-BcHZBaJ_.mjs";
3
+ import { C as O } from "./CanvasPool-BD4ZA6VU.mjs";
4
+ class Ee {
5
+ /**
6
+ * Initialize the plugin with scope of application instance
7
+ * @static
8
+ * @private
9
+ * @param {object} [options] - See application options
10
+ */
11
+ static init(e) {
12
+ Object.defineProperty(
13
+ this,
14
+ "resizeTo",
15
+ /**
16
+ * The HTML element or window to automatically resize the
17
+ * renderer's view element to match width and height.
18
+ * @member {Window|HTMLElement}
19
+ * @name resizeTo
20
+ * @memberof app.Application#
21
+ */
22
+ {
23
+ set(t) {
24
+ globalThis.removeEventListener("resize", this.queueResize), this._resizeTo = t, t && (globalThis.addEventListener("resize", this.queueResize), this.resize());
25
+ },
26
+ get() {
27
+ return this._resizeTo;
28
+ }
29
+ }
30
+ ), this.queueResize = () => {
31
+ this._resizeTo && (this._cancelResize(), this._resizeId = requestAnimationFrame(() => this.resize()));
32
+ }, this._cancelResize = () => {
33
+ this._resizeId && (cancelAnimationFrame(this._resizeId), this._resizeId = null);
34
+ }, this.resize = () => {
35
+ if (!this._resizeTo)
36
+ return;
37
+ this._cancelResize();
38
+ let t, r;
39
+ if (this._resizeTo === globalThis.window)
40
+ t = globalThis.innerWidth, r = globalThis.innerHeight;
41
+ else {
42
+ const { clientWidth: i, clientHeight: s } = this._resizeTo;
43
+ t = i, r = s;
44
+ }
45
+ this.renderer.resize(t, r), this.render();
46
+ }, this._resizeId = null, this._resizeTo = null, this.resizeTo = e.resizeTo || null;
47
+ }
48
+ /**
49
+ * Clean up the ticker, scoped to application
50
+ * @static
51
+ * @private
52
+ */
53
+ static destroy() {
54
+ globalThis.removeEventListener("resize", this.queueResize), this._cancelResize(), this._cancelResize = null, this.queueResize = null, this.resizeTo = null, this.resize = null;
55
+ }
56
+ }
57
+ Ee.extension = x.Application;
58
+ class Le {
59
+ /**
60
+ * Initialize the plugin with scope of application instance
61
+ * @static
62
+ * @private
63
+ * @param {object} [options] - See application options
64
+ */
65
+ static init(e) {
66
+ e = Object.assign({
67
+ autoStart: !0,
68
+ sharedTicker: !1
69
+ }, e), Object.defineProperty(
70
+ this,
71
+ "ticker",
72
+ {
73
+ set(t) {
74
+ this._ticker && this._ticker.remove(this.render, this), this._ticker = t, t && t.add(this.render, this, _t.LOW);
75
+ },
76
+ get() {
77
+ return this._ticker;
78
+ }
79
+ }
80
+ ), this.stop = () => {
81
+ this._ticker.stop();
82
+ }, this.start = () => {
83
+ this._ticker.start();
84
+ }, this._ticker = null, this.ticker = e.sharedTicker ? xe.shared : new xe(), e.autoStart && this.start();
85
+ }
86
+ /**
87
+ * Clean up the ticker, scoped to application.
88
+ * @static
89
+ * @private
90
+ */
91
+ static destroy() {
92
+ if (this._ticker) {
93
+ const e = this._ticker;
94
+ this.ticker = null, e.destroy();
95
+ }
96
+ }
97
+ }
98
+ Le.extension = x.Application;
99
+ class It extends bt {
100
+ constructor() {
101
+ super(...arguments), this.chars = /* @__PURE__ */ Object.create(null), this.lineHeight = 0, this.fontFamily = "", this.fontMetrics = { fontSize: 0, ascent: 0, descent: 0 }, this.baseLineOffset = 0, this.distanceField = { type: "none", range: 0 }, this.pages = [], this.applyFillAsTint = !0, this.baseMeasurementFontSize = 100, this.baseRenderedFontSize = 100;
102
+ }
103
+ /**
104
+ * The name of the font face.
105
+ * @deprecated since 8.0.0 Use `fontFamily` instead.
106
+ */
107
+ get font() {
108
+ return G(W, "BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."), this.fontFamily;
109
+ }
110
+ /**
111
+ * The map of base page textures (i.e., sheets of glyphs).
112
+ * @deprecated since 8.0.0 Use `pages` instead.
113
+ */
114
+ get pageTextures() {
115
+ return G(W, "BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."), this.pages;
116
+ }
117
+ /**
118
+ * The size of the font face in pixels.
119
+ * @deprecated since 8.0.0 Use `fontMetrics.fontSize` instead.
120
+ */
121
+ get size() {
122
+ return G(W, "BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."), this.fontMetrics.fontSize;
123
+ }
124
+ /**
125
+ * The kind of distance field for this font or "none".
126
+ * @deprecated since 8.0.0 Use `distanceField.type` instead.
127
+ */
128
+ get distanceFieldRange() {
129
+ return G(W, "BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."), this.distanceField.range;
130
+ }
131
+ /**
132
+ * The range of the distance field in pixels.
133
+ * @deprecated since 8.0.0 Use `distanceField.range` instead.
134
+ */
135
+ get distanceFieldType() {
136
+ return G(W, "BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."), this.distanceField.type;
137
+ }
138
+ destroy(e = !1) {
139
+ var t;
140
+ this.emit("destroy", this), this.removeAllListeners();
141
+ for (const r in this.chars)
142
+ (t = this.chars[r].texture) == null || t.destroy();
143
+ this.chars = null, e && (this.pages.forEach((r) => r.texture.destroy(!0)), this.pages = null);
144
+ }
145
+ }
146
+ const be = 1e5;
147
+ function Q(a, e, t, r = 0) {
148
+ if (a.texture === R.WHITE && !a.fill)
149
+ return M.shared.setValue(a.color).setAlpha(a.alpha ?? 1).toHexa();
150
+ if (a.fill) {
151
+ if (a.fill instanceof yt) {
152
+ const i = a.fill, s = e.createPattern(i.texture.source.resource, "repeat"), n = i.transform.copyTo(F.shared);
153
+ return n.scale(
154
+ i.texture.frame.width,
155
+ i.texture.frame.height
156
+ ), s.setTransform(n), s;
157
+ } else if (a.fill instanceof Tt) {
158
+ const i = a.fill, s = i.type === "linear", n = i.textureSpace === "local";
159
+ let o = 1, d = 1;
160
+ n && t && (o = t.width + r, d = t.height + r);
161
+ let c, h = !1;
162
+ if (s) {
163
+ const { start: l, end: u } = i;
164
+ c = e.createLinearGradient(
165
+ l.x * o,
166
+ l.y * d,
167
+ u.x * o,
168
+ u.y * d
169
+ ), h = Math.abs(u.x - l.x) < Math.abs((u.y - l.y) * 0.1);
170
+ } else {
171
+ const { center: l, innerRadius: u, outerCenter: g, outerRadius: p } = i;
172
+ c = e.createRadialGradient(
173
+ l.x * o,
174
+ l.y * d,
175
+ u * o,
176
+ g.x * o,
177
+ g.y * d,
178
+ p * o
179
+ );
180
+ }
181
+ if (h && n && t) {
182
+ const l = t.lineHeight / d;
183
+ for (let u = 0; u < t.lines.length; u++) {
184
+ const g = (u * t.lineHeight + r / 2) / d;
185
+ i.colorStops.forEach((p) => {
186
+ const f = g + p.offset * l;
187
+ c.addColorStop(
188
+ // fix to 5 decimal places to avoid floating point precision issues
189
+ Math.floor(f * be) / be,
190
+ M.shared.setValue(p.color).toHex()
191
+ );
192
+ });
193
+ }
194
+ } else
195
+ i.colorStops.forEach((l) => {
196
+ c.addColorStop(l.offset, M.shared.setValue(l.color).toHex());
197
+ });
198
+ return c;
199
+ }
200
+ } else {
201
+ const i = e.createPattern(a.texture.source.resource, "repeat"), s = a.matrix.copyTo(F.shared);
202
+ return s.scale(a.texture.frame.width, a.texture.frame.height), i.setTransform(s), i;
203
+ }
204
+ return I("FillStyle not recognised", a), "red";
205
+ }
206
+ function Ve(a) {
207
+ if (a === "")
208
+ return [];
209
+ typeof a == "string" && (a = [a]);
210
+ const e = [];
211
+ for (let t = 0, r = a.length; t < r; t++) {
212
+ const i = a[t];
213
+ if (Array.isArray(i)) {
214
+ if (i.length !== 2)
215
+ throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);
216
+ if (i[0].length === 0 || i[1].length === 0)
217
+ throw new Error("[BitmapFont]: Invalid character delimiter.");
218
+ const s = i[0].charCodeAt(0), n = i[1].charCodeAt(0);
219
+ if (n < s)
220
+ throw new Error("[BitmapFont]: Invalid character range.");
221
+ for (let o = s, d = n; o <= d; o++)
222
+ e.push(String.fromCharCode(o));
223
+ } else
224
+ e.push(...Array.from(i));
225
+ }
226
+ if (e.length === 0)
227
+ throw new Error("[BitmapFont]: Empty set when resolving characters.");
228
+ return e;
229
+ }
230
+ const $e = class Ye extends It {
231
+ /**
232
+ * @param options - The options for the dynamic bitmap font.
233
+ */
234
+ constructor(e) {
235
+ super(), this.resolution = 1, this.pages = [], this._padding = 0, this._measureCache = /* @__PURE__ */ Object.create(null), this._currentChars = [], this._currentX = 0, this._currentY = 0, this._currentPageIndex = -1, this._skipKerning = !1;
236
+ const t = { ...Ye.defaultOptions, ...e };
237
+ this._textureSize = t.textureSize, this._mipmap = t.mipmap;
238
+ const r = t.style.clone();
239
+ t.overrideFill && (r._fill.color = 16777215, r._fill.alpha = 1, r._fill.texture = R.WHITE, r._fill.fill = null), this.applyFillAsTint = t.overrideFill;
240
+ const i = r.fontSize;
241
+ r.fontSize = this.baseMeasurementFontSize;
242
+ const s = se(r);
243
+ t.overrideSize ? r._stroke && (r._stroke.width *= this.baseRenderedFontSize / i) : r.fontSize = this.baseRenderedFontSize = i, this._style = r, this._skipKerning = t.skipKerning ?? !1, this.resolution = t.resolution ?? 1, this._padding = t.padding ?? 4, this.fontMetrics = D.measureFont(s), this.lineHeight = r.lineHeight || this.fontMetrics.fontSize || r.fontSize;
244
+ }
245
+ ensureCharacters(e) {
246
+ var m, _;
247
+ const t = Ve(e).filter((w) => !this._currentChars.includes(w)).filter((w, b, y) => y.indexOf(w) === b);
248
+ if (!t.length)
249
+ return;
250
+ this._currentChars = [...this._currentChars, ...t];
251
+ let r;
252
+ this._currentPageIndex === -1 ? r = this._nextPage() : r = this.pages[this._currentPageIndex];
253
+ let { canvas: i, context: s } = r.canvasAndContext, n = r.texture.source;
254
+ const o = this._style;
255
+ let d = this._currentX, c = this._currentY;
256
+ const h = this.baseRenderedFontSize / this.baseMeasurementFontSize, l = this._padding * h;
257
+ let u = 0, g = !1;
258
+ const p = i.width / this.resolution, f = i.height / this.resolution;
259
+ for (let w = 0; w < t.length; w++) {
260
+ const b = t[w], y = D.measureText(b, o, i, !1);
261
+ y.lineHeight = y.height;
262
+ const B = y.width * h, C = Math.ceil((o.fontStyle === "italic" ? 2 : 1) * B), z = y.height * h, P = C + l * 2, V = z + l * 2;
263
+ if (g = !1, b !== `
264
+ ` && b !== "\r" && b !== " " && b !== " " && (g = !0, u = Math.ceil(Math.max(V, u))), d + P > p && (c += u, u = V, d = 0, c + u > f)) {
265
+ n.update();
266
+ const H = this._nextPage();
267
+ i = H.canvasAndContext.canvas, s = H.canvasAndContext.context, n = H.texture.source, c = 0;
268
+ }
269
+ const Y = B / h - (((m = o.dropShadow) == null ? void 0 : m.distance) ?? 0) - (((_ = o._stroke) == null ? void 0 : _.width) ?? 0);
270
+ if (this.chars[b] = {
271
+ id: b.codePointAt(0),
272
+ xOffset: -this._padding,
273
+ yOffset: -this._padding,
274
+ xAdvance: Y,
275
+ kerning: {}
276
+ }, g) {
277
+ this._drawGlyph(
278
+ s,
279
+ y,
280
+ d + l,
281
+ c + l,
282
+ h,
283
+ o
284
+ );
285
+ const H = n.width * h, T = n.height * h, Z = new ne(
286
+ d / H * n.width,
287
+ c / T * n.height,
288
+ P / H * n.width,
289
+ V / T * n.height
290
+ );
291
+ this.chars[b].texture = new R({
292
+ source: n,
293
+ frame: Z
294
+ }), d += Math.ceil(P);
295
+ }
296
+ }
297
+ n.update(), this._currentX = d, this._currentY = c, this._skipKerning && this._applyKerning(t, s);
298
+ }
299
+ /**
300
+ * @deprecated since 8.0.0
301
+ * The map of base page textures (i.e., sheets of glyphs).
302
+ */
303
+ get pageTextures() {
304
+ return G(W, "BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."), this.pages;
305
+ }
306
+ _applyKerning(e, t) {
307
+ const r = this._measureCache;
308
+ for (let i = 0; i < e.length; i++) {
309
+ const s = e[i];
310
+ for (let n = 0; n < this._currentChars.length; n++) {
311
+ const o = this._currentChars[n];
312
+ let d = r[s];
313
+ d || (d = r[s] = t.measureText(s).width);
314
+ let c = r[o];
315
+ c || (c = r[o] = t.measureText(o).width);
316
+ let h = t.measureText(s + o).width, l = h - (d + c);
317
+ l && (this.chars[s].kerning[o] = l), h = t.measureText(s + o).width, l = h - (d + c), l && (this.chars[o].kerning[s] = l);
318
+ }
319
+ }
320
+ }
321
+ _nextPage() {
322
+ this._currentPageIndex++;
323
+ const e = this.resolution, t = O.getOptimalCanvasAndContext(
324
+ this._textureSize,
325
+ this._textureSize,
326
+ e
327
+ );
328
+ this._setupContext(t.context, this._style, e);
329
+ const r = e * (this.baseRenderedFontSize / this.baseMeasurementFontSize), i = new R({
330
+ source: new vt({
331
+ resource: t.canvas,
332
+ resolution: r,
333
+ alphaMode: "premultiply-alpha-on-upload",
334
+ autoGenerateMipmaps: this._mipmap
335
+ })
336
+ }), s = {
337
+ canvasAndContext: t,
338
+ texture: i
339
+ };
340
+ return this.pages[this._currentPageIndex] = s, s;
341
+ }
342
+ // canvas style!
343
+ _setupContext(e, t, r) {
344
+ t.fontSize = this.baseRenderedFontSize, e.scale(r, r), e.font = se(t), t.fontSize = this.baseMeasurementFontSize, e.textBaseline = t.textBaseline;
345
+ const i = t._stroke, s = (i == null ? void 0 : i.width) ?? 0;
346
+ if (i && (e.lineWidth = s, e.lineJoin = i.join, e.miterLimit = i.miterLimit, e.strokeStyle = Q(i, e)), t._fill && (e.fillStyle = Q(t._fill, e)), t.dropShadow) {
347
+ const n = t.dropShadow, o = M.shared.setValue(n.color).toArray(), d = n.blur * r, c = n.distance * r;
348
+ e.shadowColor = `rgba(${o[0] * 255},${o[1] * 255},${o[2] * 255},${n.alpha})`, e.shadowBlur = d, e.shadowOffsetX = Math.cos(n.angle) * c, e.shadowOffsetY = Math.sin(n.angle) * c;
349
+ } else
350
+ e.shadowColor = "black", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
351
+ }
352
+ _drawGlyph(e, t, r, i, s, n) {
353
+ const o = t.text, d = t.fontProperties, c = n._stroke, h = ((c == null ? void 0 : c.width) ?? 0) * s, l = r + h / 2, u = i - h / 2, g = d.descent * s, p = t.lineHeight * s;
354
+ n.stroke && h && e.strokeText(o, l, u + p - g), n._fill && e.fillText(o, l, u + p - g);
355
+ }
356
+ destroy() {
357
+ super.destroy();
358
+ for (let e = 0; e < this.pages.length; e++) {
359
+ const { canvasAndContext: t, texture: r } = this.pages[e];
360
+ O.returnCanvasAndContext(t), r.destroy(!0);
361
+ }
362
+ this.pages = null;
363
+ }
364
+ };
365
+ $e.defaultOptions = {
366
+ textureSize: 512,
367
+ style: new E(),
368
+ mipmap: !0
369
+ };
370
+ let ye = $e;
371
+ function Xe(a, e, t, r) {
372
+ const i = {
373
+ width: 0,
374
+ height: 0,
375
+ offsetY: 0,
376
+ scale: e.fontSize / t.baseMeasurementFontSize,
377
+ lines: [{
378
+ width: 0,
379
+ charPositions: [],
380
+ spaceWidth: 0,
381
+ spacesIndex: [],
382
+ chars: []
383
+ }]
384
+ };
385
+ i.offsetY = t.baseLineOffset;
386
+ let s = i.lines[0], n = null, o = !0;
387
+ const d = {
388
+ width: 0,
389
+ start: 0,
390
+ index: 0,
391
+ // use index to not modify the array as we use it a lot!
392
+ positions: [],
393
+ chars: []
394
+ }, c = (p) => {
395
+ const f = s.width;
396
+ for (let m = 0; m < d.index; m++) {
397
+ const _ = p.positions[m];
398
+ s.chars.push(p.chars[m]), s.charPositions.push(_ + f);
399
+ }
400
+ s.width += p.width, o = !1, d.width = 0, d.index = 0, d.chars.length = 0;
401
+ }, h = () => {
402
+ let p = s.chars.length - 1;
403
+ if (r) {
404
+ let f = s.chars[p];
405
+ for (; f === " "; )
406
+ s.width -= t.chars[f].xAdvance, f = s.chars[--p];
407
+ }
408
+ i.width = Math.max(i.width, s.width), s = {
409
+ width: 0,
410
+ charPositions: [],
411
+ chars: [],
412
+ spaceWidth: 0,
413
+ spacesIndex: []
414
+ }, o = !0, i.lines.push(s), i.height += t.lineHeight;
415
+ }, l = t.baseMeasurementFontSize / e.fontSize, u = e.letterSpacing * l, g = e.wordWrapWidth * l;
416
+ for (let p = 0; p < a.length + 1; p++) {
417
+ let f;
418
+ const m = p === a.length;
419
+ m || (f = a[p]);
420
+ const _ = t.chars[f] || t.chars[" "];
421
+ if (/(?:\s)/.test(f) || f === "\r" || f === `
422
+ ` || m) {
423
+ if (!o && e.wordWrap && s.width + d.width - u > g ? (h(), c(d), m || s.charPositions.push(0)) : (d.start = s.width, c(d), m || s.charPositions.push(0)), f === "\r" || f === `
424
+ `)
425
+ s.width !== 0 && h();
426
+ else if (!m) {
427
+ const B = _.xAdvance + (_.kerning[n] || 0) + u;
428
+ s.width += B, s.spaceWidth = B, s.spacesIndex.push(s.charPositions.length), s.chars.push(f);
429
+ }
430
+ } else {
431
+ const y = _.kerning[n] || 0, B = _.xAdvance + y + u;
432
+ d.positions[d.index++] = d.width + y, d.chars.push(f), d.width += B;
433
+ }
434
+ n = f;
435
+ }
436
+ return h(), e.align === "center" ? Et(i) : e.align === "right" ? Lt(i) : e.align === "justify" && Vt(i), i;
437
+ }
438
+ function Et(a) {
439
+ for (let e = 0; e < a.lines.length; e++) {
440
+ const t = a.lines[e], r = a.width / 2 - t.width / 2;
441
+ for (let i = 0; i < t.charPositions.length; i++)
442
+ t.charPositions[i] += r;
443
+ }
444
+ }
445
+ function Lt(a) {
446
+ for (let e = 0; e < a.lines.length; e++) {
447
+ const t = a.lines[e], r = a.width - t.width;
448
+ for (let i = 0; i < t.charPositions.length; i++)
449
+ t.charPositions[i] += r;
450
+ }
451
+ }
452
+ function Vt(a) {
453
+ const e = a.width;
454
+ for (let t = 0; t < a.lines.length; t++) {
455
+ const r = a.lines[t];
456
+ let i = 0, s = r.spacesIndex[i++], n = 0;
457
+ const o = r.spacesIndex.length, c = (e - r.width) / o;
458
+ for (let h = 0; h < r.charPositions.length; h++)
459
+ h === s && (s = r.spacesIndex[i++], n += c), r.charPositions[h] += n;
460
+ }
461
+ }
462
+ let j = 0;
463
+ class $t {
464
+ constructor() {
465
+ this.ALPHA = [["a", "z"], ["A", "Z"], " "], this.NUMERIC = [["0", "9"]], this.ALPHANUMERIC = [["a", "z"], ["A", "Z"], ["0", "9"], " "], this.ASCII = [[" ", "~"]], this.defaultOptions = {
466
+ chars: this.ALPHANUMERIC,
467
+ resolution: 1,
468
+ padding: 4,
469
+ skipKerning: !1
470
+ };
471
+ }
472
+ /**
473
+ * Get a font for the specified text and style.
474
+ * @param text - The text to get the font for
475
+ * @param style - The style to use
476
+ */
477
+ getFont(e, t) {
478
+ var n;
479
+ let r = `${t.fontFamily}-bitmap`, i = !0;
480
+ if (t._fill.fill && !t._stroke)
481
+ r += t._fill.fill.styleKey, i = !1;
482
+ else if (t._stroke || t.dropShadow) {
483
+ let o = t.styleKey;
484
+ o = o.substring(0, o.lastIndexOf("-")), r = `${o}-bitmap`, i = !1;
485
+ }
486
+ if (!U.has(r)) {
487
+ const o = new ye({
488
+ style: t,
489
+ overrideFill: i,
490
+ overrideSize: !0,
491
+ ...this.defaultOptions
492
+ });
493
+ j++, j > 50 && I("BitmapText", `You have dynamically created ${j} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``), o.once("destroy", () => {
494
+ j--, U.remove(r);
495
+ }), U.set(
496
+ r,
497
+ o
498
+ );
499
+ }
500
+ const s = U.get(r);
501
+ return (n = s.ensureCharacters) == null || n.call(s, e), s;
502
+ }
503
+ /**
504
+ * Get the layout of a text for the specified style.
505
+ * @param text - The text to get the layout for
506
+ * @param style - The style to use
507
+ * @param trimEnd - Whether to ignore whitespaces at the end of each line
508
+ */
509
+ getLayout(e, t, r = !0) {
510
+ const i = this.getFont(e, t);
511
+ return Xe([...e], t, i, r);
512
+ }
513
+ /**
514
+ * Measure the text using the specified style.
515
+ * @param text - The text to measure
516
+ * @param style - The style to use
517
+ * @param trimEnd - Whether to ignore whitespaces at the end of each line
518
+ */
519
+ measureText(e, t, r = !0) {
520
+ return this.getLayout(e, t, r);
521
+ }
522
+ // eslint-disable-next-line max-len
523
+ install(...e) {
524
+ var c, h, l, u;
525
+ let t = e[0];
526
+ typeof t == "string" && (t = {
527
+ name: t,
528
+ style: e[1],
529
+ chars: (c = e[2]) == null ? void 0 : c.chars,
530
+ resolution: (h = e[2]) == null ? void 0 : h.resolution,
531
+ padding: (l = e[2]) == null ? void 0 : l.padding,
532
+ skipKerning: (u = e[2]) == null ? void 0 : u.skipKerning
533
+ }, G(W, "BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));
534
+ const r = t == null ? void 0 : t.name;
535
+ if (!r)
536
+ throw new Error("[BitmapFontManager] Property `name` is required.");
537
+ t = { ...this.defaultOptions, ...t };
538
+ const i = t.style, s = i instanceof E ? i : new E(i), n = s._fill.fill !== null && s._fill.fill !== void 0, o = new ye({
539
+ style: s,
540
+ overrideFill: n,
541
+ skipKerning: t.skipKerning,
542
+ padding: t.padding,
543
+ resolution: t.resolution,
544
+ overrideSize: !1
545
+ }), d = Ve(t.chars);
546
+ return o.ensureCharacters(d.join("")), U.set(`${r}-bitmap`, o), o.once("destroy", () => U.remove(`${r}-bitmap`)), o;
547
+ }
548
+ /**
549
+ * Uninstalls a bitmap font from the cache.
550
+ * @param {string} name - The name of the bitmap font to uninstall.
551
+ */
552
+ uninstall(e) {
553
+ const t = `${e}-bitmap`, r = U.get(t);
554
+ r && r.destroy();
555
+ }
556
+ }
557
+ const Yt = new $t();
558
+ class je {
559
+ constructor(e) {
560
+ this._renderer = e;
561
+ }
562
+ push(e, t, r) {
563
+ this._renderer.renderPipes.batch.break(r), r.add({
564
+ renderPipeId: "filter",
565
+ canBundle: !1,
566
+ action: "pushFilter",
567
+ container: t,
568
+ filterEffect: e
569
+ });
570
+ }
571
+ pop(e, t, r) {
572
+ this._renderer.renderPipes.batch.break(r), r.add({
573
+ renderPipeId: "filter",
574
+ action: "popFilter",
575
+ canBundle: !1
576
+ });
577
+ }
578
+ execute(e) {
579
+ e.action === "pushFilter" ? this._renderer.filter.push(e) : e.action === "popFilter" && this._renderer.filter.pop();
580
+ }
581
+ destroy() {
582
+ this._renderer = null;
583
+ }
584
+ }
585
+ je.extension = {
586
+ type: [
587
+ x.WebGLPipes,
588
+ x.WebGPUPipes,
589
+ x.CanvasPipes
590
+ ],
591
+ name: "filter"
592
+ };
593
+ function Xt(a, e) {
594
+ e.clear();
595
+ const t = e.matrix;
596
+ for (let r = 0; r < a.length; r++) {
597
+ const i = a[r];
598
+ i.globalDisplayStatus < 7 || (e.matrix = i.worldTransform, e.addBounds(i.bounds));
599
+ }
600
+ return e.matrix = t, e;
601
+ }
602
+ const jt = new de({
603
+ attributes: {
604
+ aPosition: {
605
+ buffer: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
606
+ format: "float32x2",
607
+ stride: 2 * 4,
608
+ offset: 0
609
+ }
610
+ },
611
+ indexBuffer: new Uint32Array([0, 1, 2, 0, 2, 3])
612
+ });
613
+ class Ke {
614
+ constructor(e) {
615
+ this._filterStackIndex = 0, this._filterStack = [], this._filterGlobalUniforms = new L({
616
+ uInputSize: { value: new Float32Array(4), type: "vec4<f32>" },
617
+ uInputPixel: { value: new Float32Array(4), type: "vec4<f32>" },
618
+ uInputClamp: { value: new Float32Array(4), type: "vec4<f32>" },
619
+ uOutputFrame: { value: new Float32Array(4), type: "vec4<f32>" },
620
+ uGlobalFrame: { value: new Float32Array(4), type: "vec4<f32>" },
621
+ uOutputTexture: { value: new Float32Array(4), type: "vec4<f32>" }
622
+ }), this._globalFilterBindGroup = new Ae({}), this.renderer = e;
623
+ }
624
+ /**
625
+ * The back texture of the currently active filter. Requires the filter to have `blendRequired` set to true.
626
+ * @readonly
627
+ */
628
+ get activeBackTexture() {
629
+ var e;
630
+ return (e = this._activeFilterData) == null ? void 0 : e.backTexture;
631
+ }
632
+ push(e) {
633
+ var g;
634
+ const t = this.renderer, r = e.filterEffect.filters;
635
+ this._filterStack[this._filterStackIndex] || (this._filterStack[this._filterStackIndex] = this._getFilterData());
636
+ const i = this._filterStack[this._filterStackIndex];
637
+ if (this._filterStackIndex++, r.length === 0) {
638
+ i.skip = !0;
639
+ return;
640
+ }
641
+ const s = i.bounds;
642
+ if (e.renderables ? Xt(e.renderables, s) : e.filterEffect.filterArea ? (s.clear(), s.addRect(e.filterEffect.filterArea), s.applyMatrix(e.container.worldTransform)) : e.container.getFastGlobalBounds(!0, s), e.container) {
643
+ const f = (e.container.renderGroup || e.container.parentRenderGroup).cacheToLocalTransform;
644
+ f && s.applyMatrix(f);
645
+ }
646
+ const n = t.renderTarget.renderTarget.colorTexture.source;
647
+ let o = 1 / 0, d = 0, c = !0, h = !1, l = !1, u = !0;
648
+ for (let p = 0; p < r.length; p++) {
649
+ const f = r[p];
650
+ if (o = Math.min(o, f.resolution === "inherit" ? n._resolution : f.resolution), d += f.padding, f.antialias === "off" ? c = !1 : f.antialias === "inherit" && c && (c = n.antialias), f.clipToViewport || (u = !1), !!!(f.compatibleRenderers & t.type)) {
651
+ l = !1;
652
+ break;
653
+ }
654
+ if (f.blendRequired && !(((g = t.backBuffer) == null ? void 0 : g.useBackBuffer) ?? !0)) {
655
+ I("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."), l = !1;
656
+ break;
657
+ }
658
+ l = f.enabled || l, h || (h = f.blendRequired);
659
+ }
660
+ if (!l) {
661
+ i.skip = !0;
662
+ return;
663
+ }
664
+ if (u) {
665
+ const p = t.renderTarget.rootViewPort, f = t.renderTarget.renderTarget.resolution;
666
+ s.fitBounds(0, p.width / f, 0, p.height / f);
667
+ }
668
+ if (s.scale(o).ceil().scale(1 / o).pad(d | 0), !s.isPositive) {
669
+ i.skip = !0;
670
+ return;
671
+ }
672
+ i.skip = !1, i.bounds = s, i.blendRequired = h, i.container = e.container, i.filterEffect = e.filterEffect, i.previousRenderSurface = t.renderTarget.renderSurface, i.inputTexture = k.getOptimalTexture(
673
+ s.width,
674
+ s.height,
675
+ o,
676
+ c
677
+ ), t.renderTarget.bind(i.inputTexture, !0), t.globalUniforms.push({
678
+ offset: s
679
+ });
680
+ }
681
+ pop() {
682
+ const e = this.renderer;
683
+ this._filterStackIndex--;
684
+ const t = this._filterStack[this._filterStackIndex];
685
+ if (t.skip)
686
+ return;
687
+ this._activeFilterData = t;
688
+ const r = t.inputTexture, i = t.bounds;
689
+ let s = R.EMPTY;
690
+ if (e.renderTarget.finishRenderPass(), t.blendRequired) {
691
+ const o = this._filterStackIndex > 0 ? this._filterStack[this._filterStackIndex - 1].bounds : null, d = e.renderTarget.getRenderTarget(t.previousRenderSurface);
692
+ s = this.getBackTexture(d, i, o);
693
+ }
694
+ t.backTexture = s;
695
+ const n = t.filterEffect.filters;
696
+ if (this._globalFilterBindGroup.setResource(r.source.style, 2), this._globalFilterBindGroup.setResource(s.source, 3), e.globalUniforms.pop(), n.length === 1)
697
+ n[0].apply(this, r, t.previousRenderSurface, !1), k.returnTexture(r);
698
+ else {
699
+ let o = t.inputTexture, d = k.getOptimalTexture(
700
+ i.width,
701
+ i.height,
702
+ o.source._resolution,
703
+ !1
704
+ ), c = 0;
705
+ for (c = 0; c < n.length - 1; ++c) {
706
+ n[c].apply(this, o, d, !0);
707
+ const l = o;
708
+ o = d, d = l;
709
+ }
710
+ n[c].apply(this, o, t.previousRenderSurface, !1), k.returnTexture(o), k.returnTexture(d);
711
+ }
712
+ t.blendRequired && k.returnTexture(s);
713
+ }
714
+ getBackTexture(e, t, r) {
715
+ const i = e.colorTexture.source._resolution, s = k.getOptimalTexture(
716
+ t.width,
717
+ t.height,
718
+ i,
719
+ !1
720
+ );
721
+ let n = t.minX, o = t.minY;
722
+ r && (n -= r.minX, o -= r.minY), n = Math.floor(n * i), o = Math.floor(o * i);
723
+ const d = Math.ceil(t.width * i), c = Math.ceil(t.height * i);
724
+ return this.renderer.renderTarget.copyToTexture(
725
+ e,
726
+ s,
727
+ { x: n, y: o },
728
+ { width: d, height: c },
729
+ { x: 0, y: 0 }
730
+ ), s;
731
+ }
732
+ applyFilter(e, t, r, i) {
733
+ const s = this.renderer, n = this._filterStack[this._filterStackIndex], o = n.bounds, d = wt.shared, h = n.previousRenderSurface === r;
734
+ let l = this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution, u = this._filterStackIndex - 1;
735
+ for (; u > 0 && this._filterStack[u].skip; )
736
+ --u;
737
+ u > 0 && (l = this._filterStack[u].inputTexture.source._resolution);
738
+ const g = this._filterGlobalUniforms, p = g.uniforms, f = p.uOutputFrame, m = p.uInputSize, _ = p.uInputPixel, w = p.uInputClamp, b = p.uGlobalFrame, y = p.uOutputTexture;
739
+ if (h) {
740
+ let z = this._filterStackIndex;
741
+ for (; z > 0; ) {
742
+ z--;
743
+ const P = this._filterStack[this._filterStackIndex - 1];
744
+ if (!P.skip) {
745
+ d.x = P.bounds.minX, d.y = P.bounds.minY;
746
+ break;
747
+ }
748
+ }
749
+ f[0] = o.minX - d.x, f[1] = o.minY - d.y;
750
+ } else
751
+ f[0] = 0, f[1] = 0;
752
+ f[2] = t.frame.width, f[3] = t.frame.height, m[0] = t.source.width, m[1] = t.source.height, m[2] = 1 / m[0], m[3] = 1 / m[1], _[0] = t.source.pixelWidth, _[1] = t.source.pixelHeight, _[2] = 1 / _[0], _[3] = 1 / _[1], w[0] = 0.5 * _[2], w[1] = 0.5 * _[3], w[2] = t.frame.width * m[2] - 0.5 * _[2], w[3] = t.frame.height * m[3] - 0.5 * _[3];
753
+ const B = this.renderer.renderTarget.rootRenderTarget.colorTexture;
754
+ b[0] = d.x * l, b[1] = d.y * l, b[2] = B.source.width * l, b[3] = B.source.height * l;
755
+ const C = this.renderer.renderTarget.getRenderTarget(r);
756
+ if (s.renderTarget.bind(r, !!i), r instanceof R ? (y[0] = r.frame.width, y[1] = r.frame.height) : (y[0] = C.width, y[1] = C.height), y[2] = C.isRoot ? -1 : 1, g.update(), s.renderPipes.uniformBatch) {
757
+ const z = s.renderPipes.uniformBatch.getUboResource(g);
758
+ this._globalFilterBindGroup.setResource(z, 0);
759
+ } else
760
+ this._globalFilterBindGroup.setResource(g, 0);
761
+ this._globalFilterBindGroup.setResource(t.source, 1), this._globalFilterBindGroup.setResource(t.source.style, 2), e.groups[0] = this._globalFilterBindGroup, s.encoder.draw({
762
+ geometry: jt,
763
+ shader: e,
764
+ state: e._state,
765
+ topology: "triangle-list"
766
+ }), s.type === le.WEBGL && s.renderTarget.finishRenderPass();
767
+ }
768
+ _getFilterData() {
769
+ return {
770
+ skip: !1,
771
+ inputTexture: null,
772
+ bounds: new Ge(),
773
+ container: null,
774
+ filterEffect: null,
775
+ blendRequired: !1,
776
+ previousRenderSurface: null
777
+ };
778
+ }
779
+ /**
780
+ * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.
781
+ *
782
+ * Use `outputMatrix * vTextureCoord` in the shader.
783
+ * @param outputMatrix - The matrix to output to.
784
+ * @param {Sprite} sprite - The sprite to map to.
785
+ * @returns The mapped matrix.
786
+ */
787
+ calculateSpriteMatrix(e, t) {
788
+ const r = this._activeFilterData, i = e.set(
789
+ r.inputTexture._source.width,
790
+ 0,
791
+ 0,
792
+ r.inputTexture._source.height,
793
+ r.bounds.minX,
794
+ r.bounds.minY
795
+ ), s = t.worldTransform.copyTo(F.shared), n = t.renderGroup || t.parentRenderGroup;
796
+ return n && n.cacheToLocalTransform && s.prepend(n.cacheToLocalTransform), s.invert(), i.prepend(s), i.scale(
797
+ 1 / t.texture.frame.width,
798
+ 1 / t.texture.frame.height
799
+ ), i.translate(t.anchor.x, t.anchor.y), i;
800
+ }
801
+ }
802
+ Ke.extension = {
803
+ type: [
804
+ x.WebGLSystem,
805
+ x.WebGPUSystem
806
+ ],
807
+ name: "filter"
808
+ };
809
+ const Ne = class qe extends de {
810
+ constructor(...e) {
811
+ let t = e[0] ?? {};
812
+ t instanceof Float32Array && (G(W, "use new MeshGeometry({ positions, uvs, indices }) instead"), t = {
813
+ positions: t,
814
+ uvs: e[1],
815
+ indices: e[2]
816
+ }), t = { ...qe.defaultOptions, ...t };
817
+ const r = t.positions || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
818
+ let i = t.uvs;
819
+ i || (t.positions ? i = new Float32Array(r.length) : i = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]));
820
+ const s = t.indices || new Uint32Array([0, 1, 2, 0, 2, 3]), n = t.shrinkBuffersToFit, o = new $({
821
+ data: r,
822
+ label: "attribute-mesh-positions",
823
+ shrinkToFit: n,
824
+ usage: A.VERTEX | A.COPY_DST
825
+ }), d = new $({
826
+ data: i,
827
+ label: "attribute-mesh-uvs",
828
+ shrinkToFit: n,
829
+ usage: A.VERTEX | A.COPY_DST
830
+ }), c = new $({
831
+ data: s,
832
+ label: "index-mesh-buffer",
833
+ shrinkToFit: n,
834
+ usage: A.INDEX | A.COPY_DST
835
+ });
836
+ super({
837
+ attributes: {
838
+ aPosition: {
839
+ buffer: o,
840
+ format: "float32x2",
841
+ stride: 2 * 4,
842
+ offset: 0
843
+ },
844
+ aUV: {
845
+ buffer: d,
846
+ format: "float32x2",
847
+ stride: 2 * 4,
848
+ offset: 0
849
+ }
850
+ },
851
+ indexBuffer: c,
852
+ topology: t.topology
853
+ }), this.batchMode = "auto";
854
+ }
855
+ /** The positions of the mesh. */
856
+ get positions() {
857
+ return this.attributes.aPosition.buffer.data;
858
+ }
859
+ /**
860
+ * Set the positions of the mesh.
861
+ * When setting the positions, its important that the uvs array is at least as long as the positions array.
862
+ * otherwise the geometry will not be valid.
863
+ * @param {Float32Array} value - The positions of the mesh.
864
+ */
865
+ set positions(e) {
866
+ this.attributes.aPosition.buffer.data = e;
867
+ }
868
+ /** The UVs of the mesh. */
869
+ get uvs() {
870
+ return this.attributes.aUV.buffer.data;
871
+ }
872
+ /**
873
+ * Set the UVs of the mesh.
874
+ * Its important that the uvs array you set is at least as long as the positions array.
875
+ * otherwise the geometry will not be valid.
876
+ * @param {Float32Array} value - The UVs of the mesh.
877
+ */
878
+ set uvs(e) {
879
+ this.attributes.aUV.buffer.data = e;
880
+ }
881
+ /** The indices of the mesh. */
882
+ get indices() {
883
+ return this.indexBuffer.data;
884
+ }
885
+ set indices(e) {
886
+ this.indexBuffer.data = e;
887
+ }
888
+ };
889
+ Ne.defaultOptions = {
890
+ topology: "triangle-list",
891
+ shrinkBuffersToFit: !1
892
+ };
893
+ let ue = Ne;
894
+ function Kt(a) {
895
+ const e = a._stroke, t = a._fill, i = [`div { ${[
896
+ `color: ${M.shared.setValue(t.color).toHex()}`,
897
+ `font-size: ${a.fontSize}px`,
898
+ `font-family: ${a.fontFamily}`,
899
+ `font-weight: ${a.fontWeight}`,
900
+ `font-style: ${a.fontStyle}`,
901
+ `font-variant: ${a.fontVariant}`,
902
+ `letter-spacing: ${a.letterSpacing}px`,
903
+ `text-align: ${a.align}`,
904
+ `padding: ${a.padding}px`,
905
+ `white-space: ${a.whiteSpace === "pre" && a.wordWrap ? "pre-wrap" : a.whiteSpace}`,
906
+ ...a.lineHeight ? [`line-height: ${a.lineHeight}px`] : [],
907
+ ...a.wordWrap ? [
908
+ `word-wrap: ${a.breakWords ? "break-all" : "break-word"}`,
909
+ `max-width: ${a.wordWrapWidth}px`
910
+ ] : [],
911
+ ...e ? [Je(e)] : [],
912
+ ...a.dropShadow ? [Qe(a.dropShadow)] : [],
913
+ ...a.cssOverrides
914
+ ].join(";")} }`];
915
+ return Nt(a.tagStyles, i), i.join(" ");
916
+ }
917
+ function Qe(a) {
918
+ const e = M.shared.setValue(a.color).setAlpha(a.alpha).toHexa(), t = Math.round(Math.cos(a.angle) * a.distance), r = Math.round(Math.sin(a.angle) * a.distance), i = `${t}px ${r}px`;
919
+ return a.blur > 0 ? `text-shadow: ${i} ${a.blur}px ${e}` : `text-shadow: ${i} ${e}`;
920
+ }
921
+ function Je(a) {
922
+ return [
923
+ `-webkit-text-stroke-width: ${a.width}px`,
924
+ `-webkit-text-stroke-color: ${M.shared.setValue(a.color).toHex()}`,
925
+ `text-stroke-width: ${a.width}px`,
926
+ `text-stroke-color: ${M.shared.setValue(a.color).toHex()}`,
927
+ "paint-order: stroke"
928
+ ].join(";");
929
+ }
930
+ const Te = {
931
+ fontSize: "font-size: {{VALUE}}px",
932
+ fontFamily: "font-family: {{VALUE}}",
933
+ fontWeight: "font-weight: {{VALUE}}",
934
+ fontStyle: "font-style: {{VALUE}}",
935
+ fontVariant: "font-variant: {{VALUE}}",
936
+ letterSpacing: "letter-spacing: {{VALUE}}px",
937
+ align: "text-align: {{VALUE}}",
938
+ padding: "padding: {{VALUE}}px",
939
+ whiteSpace: "white-space: {{VALUE}}",
940
+ lineHeight: "line-height: {{VALUE}}px",
941
+ wordWrapWidth: "max-width: {{VALUE}}px"
942
+ }, ve = {
943
+ fill: (a) => `color: ${M.shared.setValue(a).toHex()}`,
944
+ breakWords: (a) => `word-wrap: ${a ? "break-all" : "break-word"}`,
945
+ stroke: Je,
946
+ dropShadow: Qe
947
+ };
948
+ function Nt(a, e) {
949
+ for (const t in a) {
950
+ const r = a[t], i = [];
951
+ for (const s in r)
952
+ ve[s] ? i.push(ve[s](r[s])) : Te[s] && i.push(Te[s].replace("{{VALUE}}", r[s]));
953
+ e.push(`${t} { ${i.join(";")} }`);
954
+ }
955
+ }
956
+ class fe extends E {
957
+ constructor(e = {}) {
958
+ super(e), this._cssOverrides = [], this.cssOverrides ?? (this.cssOverrides = e.cssOverrides), this.tagStyles = e.tagStyles ?? {};
959
+ }
960
+ /** List of style overrides that will be applied to the HTML text. */
961
+ set cssOverrides(e) {
962
+ this._cssOverrides = e instanceof Array ? e : [e], this.update();
963
+ }
964
+ get cssOverrides() {
965
+ return this._cssOverrides;
966
+ }
967
+ _generateKey() {
968
+ return this._styleKey = St(this) + this._cssOverrides.join("-"), this._styleKey;
969
+ }
970
+ update() {
971
+ this._cssStyle = null, super.update();
972
+ }
973
+ /**
974
+ * Creates a new HTMLTextStyle object with the same values as this one.
975
+ * @returns New cloned HTMLTextStyle object
976
+ */
977
+ clone() {
978
+ return new fe({
979
+ align: this.align,
980
+ breakWords: this.breakWords,
981
+ dropShadow: this.dropShadow ? { ...this.dropShadow } : null,
982
+ fill: this._fill,
983
+ fontFamily: this.fontFamily,
984
+ fontSize: this.fontSize,
985
+ fontStyle: this.fontStyle,
986
+ fontVariant: this.fontVariant,
987
+ fontWeight: this.fontWeight,
988
+ letterSpacing: this.letterSpacing,
989
+ lineHeight: this.lineHeight,
990
+ padding: this.padding,
991
+ stroke: this._stroke,
992
+ whiteSpace: this.whiteSpace,
993
+ wordWrap: this.wordWrap,
994
+ wordWrapWidth: this.wordWrapWidth,
995
+ cssOverrides: this.cssOverrides
996
+ });
997
+ }
998
+ get cssStyle() {
999
+ return this._cssStyle || (this._cssStyle = Kt(this)), this._cssStyle;
1000
+ }
1001
+ /**
1002
+ * Add a style override, this can be any CSS property
1003
+ * it will override any built-in style. This is the
1004
+ * property and the value as a string (e.g., `color: red`).
1005
+ * This will override any other internal style.
1006
+ * @param {string} value - CSS style(s) to add.
1007
+ * @example
1008
+ * style.addOverride('background-color: red');
1009
+ */
1010
+ addOverride(...e) {
1011
+ const t = e.filter((r) => !this.cssOverrides.includes(r));
1012
+ t.length > 0 && (this.cssOverrides.push(...t), this.update());
1013
+ }
1014
+ /**
1015
+ * Remove any overrides that match the value.
1016
+ * @param {string} value - CSS style to remove.
1017
+ * @example
1018
+ * style.removeOverride('background-color: red');
1019
+ */
1020
+ removeOverride(...e) {
1021
+ const t = e.filter((r) => this.cssOverrides.includes(r));
1022
+ t.length > 0 && (this.cssOverrides = this.cssOverrides.filter((r) => !t.includes(r)), this.update());
1023
+ }
1024
+ set fill(e) {
1025
+ typeof e != "string" && typeof e != "number" && I("[HTMLTextStyle] only color fill is not supported by HTMLText"), super.fill = e;
1026
+ }
1027
+ set stroke(e) {
1028
+ e && typeof e != "string" && typeof e != "number" && I("[HTMLTextStyle] only color stroke is not supported by HTMLText"), super.stroke = e;
1029
+ }
1030
+ }
1031
+ const we = "http://www.w3.org/2000/svg", Se = "http://www.w3.org/1999/xhtml";
1032
+ class Ze {
1033
+ constructor() {
1034
+ this.svgRoot = document.createElementNS(we, "svg"), this.foreignObject = document.createElementNS(we, "foreignObject"), this.domElement = document.createElementNS(Se, "div"), this.styleElement = document.createElementNS(Se, "style"), this.image = new Image();
1035
+ const { foreignObject: e, svgRoot: t, styleElement: r, domElement: i } = this;
1036
+ e.setAttribute("width", "10000"), e.setAttribute("height", "10000"), e.style.overflow = "hidden", t.appendChild(e), e.appendChild(r), e.appendChild(i);
1037
+ }
1038
+ }
1039
+ let Ce;
1040
+ function qt(a, e, t, r) {
1041
+ r || (r = Ce || (Ce = new Ze()));
1042
+ const { domElement: i, styleElement: s, svgRoot: n } = r;
1043
+ i.innerHTML = `<style>${e.cssStyle};</style><div style='padding:0'>${a}</div>`, i.setAttribute("style", "transform-origin: top left; display: inline-block"), t && (s.textContent = t), document.body.appendChild(n);
1044
+ const o = i.getBoundingClientRect();
1045
+ n.remove();
1046
+ const d = e.padding * 2;
1047
+ return {
1048
+ width: o.width - d,
1049
+ height: o.height - d
1050
+ };
1051
+ }
1052
+ class et {
1053
+ constructor(e, t) {
1054
+ this.state = q.for2d(), this._graphicsBatchesHash = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this.renderer = e, this._adaptor = t, this._adaptor.init(), this.renderer.renderableGC.addManagedHash(this, "_graphicsBatchesHash");
1055
+ }
1056
+ validateRenderable(e) {
1057
+ const t = e.context, r = !!this._graphicsBatchesHash[e.uid], i = this.renderer.graphicsContext.updateGpuContext(t);
1058
+ return !!(i.isBatchable || r !== i.isBatchable);
1059
+ }
1060
+ addRenderable(e, t) {
1061
+ const r = this.renderer.graphicsContext.updateGpuContext(e.context);
1062
+ e.didViewUpdate && this._rebuild(e), r.isBatchable ? this._addToBatcher(e, t) : (this.renderer.renderPipes.batch.break(t), t.add(e));
1063
+ }
1064
+ updateRenderable(e) {
1065
+ const t = this._graphicsBatchesHash[e.uid];
1066
+ if (t)
1067
+ for (let r = 0; r < t.length; r++) {
1068
+ const i = t[r];
1069
+ i._batcher.updateElement(i);
1070
+ }
1071
+ }
1072
+ destroyRenderable(e) {
1073
+ this._graphicsBatchesHash[e.uid] && this._removeBatchForRenderable(e.uid), e.off("destroyed", this._destroyRenderableBound);
1074
+ }
1075
+ execute(e) {
1076
+ if (!e.isRenderable)
1077
+ return;
1078
+ const t = this.renderer, r = e.context;
1079
+ if (!t.graphicsContext.getGpuContext(r).batches.length)
1080
+ return;
1081
+ const s = r.customShader || this._adaptor.shader;
1082
+ this.state.blendMode = e.groupBlendMode;
1083
+ const n = s.resources.localUniforms.uniforms;
1084
+ n.uTransformMatrix = e.groupTransform, n.uRound = t._roundPixels | e._roundPixels, J(
1085
+ e.groupColorAlpha,
1086
+ n.uColor,
1087
+ 0
1088
+ ), this._adaptor.execute(this, e);
1089
+ }
1090
+ _rebuild(e) {
1091
+ const t = !!this._graphicsBatchesHash[e.uid], r = this.renderer.graphicsContext.updateGpuContext(e.context);
1092
+ t && this._removeBatchForRenderable(e.uid), r.isBatchable && this._initBatchesForRenderable(e), e.batched = r.isBatchable;
1093
+ }
1094
+ _addToBatcher(e, t) {
1095
+ const r = this.renderer.renderPipes.batch, i = this._getBatchesForRenderable(e);
1096
+ for (let s = 0; s < i.length; s++) {
1097
+ const n = i[s];
1098
+ r.addToBatch(n, t);
1099
+ }
1100
+ }
1101
+ _getBatchesForRenderable(e) {
1102
+ return this._graphicsBatchesHash[e.uid] || this._initBatchesForRenderable(e);
1103
+ }
1104
+ _initBatchesForRenderable(e) {
1105
+ const t = e.context, r = this.renderer.graphicsContext.getGpuContext(t), i = this.renderer._roundPixels | e._roundPixels, s = r.batches.map((n) => {
1106
+ const o = v.get(Ct);
1107
+ return n.copyTo(o), o.renderable = e, o.roundPixels = i, o;
1108
+ });
1109
+ return this._graphicsBatchesHash[e.uid] === void 0 && e.on("destroyed", this._destroyRenderableBound), this._graphicsBatchesHash[e.uid] = s, s;
1110
+ }
1111
+ _removeBatchForRenderable(e) {
1112
+ this._graphicsBatchesHash[e].forEach((t) => {
1113
+ v.return(t);
1114
+ }), this._graphicsBatchesHash[e] = null;
1115
+ }
1116
+ destroy() {
1117
+ this.renderer = null, this._adaptor.destroy(), this._adaptor = null, this.state = null;
1118
+ for (const e in this._graphicsBatchesHash)
1119
+ this._removeBatchForRenderable(e);
1120
+ this._graphicsBatchesHash = null;
1121
+ }
1122
+ }
1123
+ et.extension = {
1124
+ type: [
1125
+ x.WebGLPipes,
1126
+ x.WebGPUPipes,
1127
+ x.CanvasPipes
1128
+ ],
1129
+ name: "graphics"
1130
+ };
1131
+ const tt = class rt extends ue {
1132
+ constructor(...e) {
1133
+ super({});
1134
+ let t = e[0] ?? {};
1135
+ typeof t == "number" && (G(W, "PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"), t = {
1136
+ width: t,
1137
+ height: e[1],
1138
+ verticesX: e[2],
1139
+ verticesY: e[3]
1140
+ }), this.build(t);
1141
+ }
1142
+ /**
1143
+ * Refreshes plane coordinates
1144
+ * @param options - Options to be applied to plane geometry
1145
+ */
1146
+ build(e) {
1147
+ e = { ...rt.defaultOptions, ...e }, this.verticesX = this.verticesX ?? e.verticesX, this.verticesY = this.verticesY ?? e.verticesY, this.width = this.width ?? e.width, this.height = this.height ?? e.height;
1148
+ const t = this.verticesX * this.verticesY, r = [], i = [], s = [], n = this.verticesX - 1, o = this.verticesY - 1, d = this.width / n, c = this.height / o;
1149
+ for (let l = 0; l < t; l++) {
1150
+ const u = l % this.verticesX, g = l / this.verticesX | 0;
1151
+ r.push(u * d, g * c), i.push(u / n, g / o);
1152
+ }
1153
+ const h = n * o;
1154
+ for (let l = 0; l < h; l++) {
1155
+ const u = l % n, g = l / n | 0, p = g * this.verticesX + u, f = g * this.verticesX + u + 1, m = (g + 1) * this.verticesX + u, _ = (g + 1) * this.verticesX + u + 1;
1156
+ s.push(
1157
+ p,
1158
+ f,
1159
+ m,
1160
+ f,
1161
+ _,
1162
+ m
1163
+ );
1164
+ }
1165
+ this.buffers[0].data = new Float32Array(r), this.buffers[1].data = new Float32Array(i), this.indexBuffer.data = new Uint32Array(s), this.buffers[0].update(), this.buffers[1].update(), this.indexBuffer.update();
1166
+ }
1167
+ };
1168
+ tt.defaultOptions = {
1169
+ width: 100,
1170
+ height: 100,
1171
+ verticesX: 10,
1172
+ verticesY: 10
1173
+ };
1174
+ let Qt = tt;
1175
+ class pe {
1176
+ constructor() {
1177
+ this.batcherName = "default", this.packAsQuad = !1, this.indexOffset = 0, this.attributeOffset = 0, this.roundPixels = 0, this._batcher = null, this._batch = null, this._textureMatrixUpdateId = -1, this._uvUpdateId = -1;
1178
+ }
1179
+ get blendMode() {
1180
+ return this.renderable.groupBlendMode;
1181
+ }
1182
+ get topology() {
1183
+ return this._topology || this.geometry.topology;
1184
+ }
1185
+ set topology(e) {
1186
+ this._topology = e;
1187
+ }
1188
+ reset() {
1189
+ this.renderable = null, this.texture = null, this._batcher = null, this._batch = null, this.geometry = null, this._uvUpdateId = -1, this._textureMatrixUpdateId = -1;
1190
+ }
1191
+ /**
1192
+ * Sets the texture for the batchable mesh.
1193
+ * As it does so, it resets the texture matrix update ID.
1194
+ * this is to ensure that the texture matrix is recalculated when the uvs are referenced
1195
+ * @param value - The texture to set.
1196
+ */
1197
+ setTexture(e) {
1198
+ this.texture !== e && (this.texture = e, this._textureMatrixUpdateId = -1);
1199
+ }
1200
+ get uvs() {
1201
+ const t = this.geometry.getBuffer("aUV"), r = t.data;
1202
+ let i = r;
1203
+ const s = this.texture.textureMatrix;
1204
+ return s.isSimple || (i = this._transformedUvs, (this._textureMatrixUpdateId !== s._updateID || this._uvUpdateId !== t._updateID) && ((!i || i.length < r.length) && (i = this._transformedUvs = new Float32Array(r.length)), this._textureMatrixUpdateId = s._updateID, this._uvUpdateId = t._updateID, s.multiplyUvs(r, i))), i;
1205
+ }
1206
+ get positions() {
1207
+ return this.geometry.positions;
1208
+ }
1209
+ get indices() {
1210
+ return this.geometry.indices;
1211
+ }
1212
+ get color() {
1213
+ return this.renderable.groupColorAlpha;
1214
+ }
1215
+ get groupTransform() {
1216
+ return this.renderable.groupTransform;
1217
+ }
1218
+ get attributeSize() {
1219
+ return this.geometry.positions.length / 2;
1220
+ }
1221
+ get indexSize() {
1222
+ return this.geometry.indices.length;
1223
+ }
1224
+ }
1225
+ class it {
1226
+ constructor(e, t) {
1227
+ this.localUniforms = new L({
1228
+ uTransformMatrix: { value: new F(), type: "mat3x3<f32>" },
1229
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
1230
+ uRound: { value: 0, type: "f32" }
1231
+ }), this.localUniformsBindGroup = new Ae({
1232
+ 0: this.localUniforms
1233
+ }), this._meshDataHash = /* @__PURE__ */ Object.create(null), this._gpuBatchableMeshHash = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this.renderer = e, this._adaptor = t, this._adaptor.init(), e.renderableGC.addManagedHash(this, "_gpuBatchableMeshHash"), e.renderableGC.addManagedHash(this, "_meshDataHash");
1234
+ }
1235
+ validateRenderable(e) {
1236
+ const t = this._getMeshData(e), r = t.batched, i = e.batched;
1237
+ if (t.batched = i, r !== i)
1238
+ return !0;
1239
+ if (i) {
1240
+ const s = e._geometry;
1241
+ if (s.indices.length !== t.indexSize || s.positions.length !== t.vertexSize)
1242
+ return t.indexSize = s.indices.length, t.vertexSize = s.positions.length, !0;
1243
+ const n = this._getBatchableMesh(e);
1244
+ return n.texture.uid !== e._texture.uid && (n._textureMatrixUpdateId = -1), !n._batcher.checkAndUpdateTexture(
1245
+ n,
1246
+ e._texture
1247
+ );
1248
+ }
1249
+ return !1;
1250
+ }
1251
+ addRenderable(e, t) {
1252
+ const r = this.renderer.renderPipes.batch, { batched: i } = this._getMeshData(e);
1253
+ if (i) {
1254
+ const s = this._getBatchableMesh(e);
1255
+ s.setTexture(e._texture), s.geometry = e._geometry, r.addToBatch(s, t);
1256
+ } else
1257
+ r.break(t), t.add(e);
1258
+ }
1259
+ updateRenderable(e) {
1260
+ if (e.batched) {
1261
+ const t = this._gpuBatchableMeshHash[e.uid];
1262
+ t.setTexture(e._texture), t.geometry = e._geometry, t._batcher.updateElement(t);
1263
+ }
1264
+ }
1265
+ destroyRenderable(e) {
1266
+ this._meshDataHash[e.uid] = null;
1267
+ const t = this._gpuBatchableMeshHash[e.uid];
1268
+ t && (v.return(t), this._gpuBatchableMeshHash[e.uid] = null), e.off("destroyed", this._destroyRenderableBound);
1269
+ }
1270
+ execute(e) {
1271
+ if (!e.isRenderable)
1272
+ return;
1273
+ e.state.blendMode = ce(e.groupBlendMode, e.texture._source);
1274
+ const t = this.localUniforms;
1275
+ t.uniforms.uTransformMatrix = e.groupTransform, t.uniforms.uRound = this.renderer._roundPixels | e._roundPixels, t.update(), J(
1276
+ e.groupColorAlpha,
1277
+ t.uniforms.uColor,
1278
+ 0
1279
+ ), this._adaptor.execute(this, e);
1280
+ }
1281
+ _getMeshData(e) {
1282
+ return this._meshDataHash[e.uid] || this._initMeshData(e);
1283
+ }
1284
+ _initMeshData(e) {
1285
+ var t, r;
1286
+ return this._meshDataHash[e.uid] = {
1287
+ batched: e.batched,
1288
+ indexSize: (t = e._geometry.indices) == null ? void 0 : t.length,
1289
+ vertexSize: (r = e._geometry.positions) == null ? void 0 : r.length
1290
+ }, e.on("destroyed", this._destroyRenderableBound), this._meshDataHash[e.uid];
1291
+ }
1292
+ _getBatchableMesh(e) {
1293
+ return this._gpuBatchableMeshHash[e.uid] || this._initBatchableMesh(e);
1294
+ }
1295
+ _initBatchableMesh(e) {
1296
+ const t = v.get(pe);
1297
+ return t.renderable = e, t.setTexture(e._texture), t.transform = e.groupTransform, t.roundPixels = this.renderer._roundPixels | e._roundPixels, this._gpuBatchableMeshHash[e.uid] = t, t;
1298
+ }
1299
+ destroy() {
1300
+ for (const e in this._gpuBatchableMeshHash)
1301
+ this._gpuBatchableMeshHash[e] && v.return(this._gpuBatchableMeshHash[e]);
1302
+ this._gpuBatchableMeshHash = null, this._meshDataHash = null, this.localUniforms = null, this.localUniformsBindGroup = null, this._adaptor.destroy(), this._adaptor = null, this.renderer = null;
1303
+ }
1304
+ }
1305
+ it.extension = {
1306
+ type: [
1307
+ x.WebGLPipes,
1308
+ x.WebGPUPipes,
1309
+ x.CanvasPipes
1310
+ ],
1311
+ name: "mesh"
1312
+ };
1313
+ class Jt {
1314
+ execute(e, t) {
1315
+ const r = e.state, i = e.renderer, s = t.shader || e.defaultShader;
1316
+ s.resources.uTexture = t.texture._source, s.resources.uniforms = e.localUniforms;
1317
+ const n = i.gl, o = e.getBuffers(t);
1318
+ i.shader.bind(s), i.state.set(r), i.geometry.bind(o.geometry, s.glProgram);
1319
+ const c = o.geometry.indexBuffer.data.BYTES_PER_ELEMENT === 2 ? n.UNSIGNED_SHORT : n.UNSIGNED_INT;
1320
+ n.drawElements(n.TRIANGLES, t.particleChildren.length * 6, c, 0);
1321
+ }
1322
+ }
1323
+ class Zt {
1324
+ execute(e, t) {
1325
+ const r = e.renderer, i = t.shader || e.defaultShader;
1326
+ i.groups[0] = r.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms, !0), i.groups[1] = r.texture.getTextureBindGroup(t.texture);
1327
+ const s = e.state, n = e.getBuffers(t);
1328
+ r.encoder.draw({
1329
+ geometry: n.geometry,
1330
+ shader: t.shader || e.defaultShader,
1331
+ state: s,
1332
+ size: t.particleChildren.length * 6
1333
+ });
1334
+ }
1335
+ }
1336
+ function Be(a, e = null) {
1337
+ const t = a * 6;
1338
+ if (t > 65535 ? e || (e = new Uint32Array(t)) : e || (e = new Uint16Array(t)), e.length !== t)
1339
+ throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);
1340
+ for (let r = 0, i = 0; r < t; r += 6, i += 4)
1341
+ e[r + 0] = i + 0, e[r + 1] = i + 1, e[r + 2] = i + 2, e[r + 3] = i + 0, e[r + 4] = i + 2, e[r + 5] = i + 3;
1342
+ return e;
1343
+ }
1344
+ function er(a) {
1345
+ return {
1346
+ dynamicUpdate: Pe(a, !0),
1347
+ staticUpdate: Pe(a, !1)
1348
+ };
1349
+ }
1350
+ function Pe(a, e) {
1351
+ const t = [];
1352
+ t.push(`
1353
+
1354
+ var index = 0;
1355
+
1356
+ for (let i = 0; i < ps.length; ++i)
1357
+ {
1358
+ const p = ps[i];
1359
+
1360
+ `);
1361
+ let r = 0;
1362
+ for (const s in a) {
1363
+ const n = a[s];
1364
+ if (e !== n.dynamic)
1365
+ continue;
1366
+ t.push(`offset = index + ${r}`), t.push(n.code);
1367
+ const o = ae(n.format);
1368
+ r += o.stride / 4;
1369
+ }
1370
+ t.push(`
1371
+ index += stride * 4;
1372
+ }
1373
+ `), t.unshift(`
1374
+ var stride = ${r};
1375
+ `);
1376
+ const i = t.join(`
1377
+ `);
1378
+ return new Function("ps", "f32v", "u32v", i);
1379
+ }
1380
+ class tr {
1381
+ constructor(e) {
1382
+ this._size = 0, this._generateParticleUpdateCache = {};
1383
+ const t = this._size = e.size ?? 1e3, r = e.properties;
1384
+ let i = 0, s = 0;
1385
+ for (const h in r) {
1386
+ const l = r[h], u = ae(l.format);
1387
+ l.dynamic ? s += u.stride : i += u.stride;
1388
+ }
1389
+ this._dynamicStride = s / 4, this._staticStride = i / 4, this.staticAttributeBuffer = new X(t * 4 * i), this.dynamicAttributeBuffer = new X(t * 4 * s), this.indexBuffer = Be(t);
1390
+ const n = new de();
1391
+ let o = 0, d = 0;
1392
+ this._staticBuffer = new $({
1393
+ data: new Float32Array(1),
1394
+ label: "static-particle-buffer",
1395
+ shrinkToFit: !1,
1396
+ usage: A.VERTEX | A.COPY_DST
1397
+ }), this._dynamicBuffer = new $({
1398
+ data: new Float32Array(1),
1399
+ label: "dynamic-particle-buffer",
1400
+ shrinkToFit: !1,
1401
+ usage: A.VERTEX | A.COPY_DST
1402
+ });
1403
+ for (const h in r) {
1404
+ const l = r[h], u = ae(l.format);
1405
+ l.dynamic ? (n.addAttribute(l.attributeName, {
1406
+ buffer: this._dynamicBuffer,
1407
+ stride: this._dynamicStride * 4,
1408
+ offset: o * 4,
1409
+ format: l.format
1410
+ }), o += u.size) : (n.addAttribute(l.attributeName, {
1411
+ buffer: this._staticBuffer,
1412
+ stride: this._staticStride * 4,
1413
+ offset: d * 4,
1414
+ format: l.format
1415
+ }), d += u.size);
1416
+ }
1417
+ n.addIndex(this.indexBuffer);
1418
+ const c = this.getParticleUpdate(r);
1419
+ this._dynamicUpload = c.dynamicUpdate, this._staticUpload = c.staticUpdate, this.geometry = n;
1420
+ }
1421
+ getParticleUpdate(e) {
1422
+ const t = rr(e);
1423
+ return this._generateParticleUpdateCache[t] ? this._generateParticleUpdateCache[t] : (this._generateParticleUpdateCache[t] = this.generateParticleUpdate(e), this._generateParticleUpdateCache[t]);
1424
+ }
1425
+ generateParticleUpdate(e) {
1426
+ return er(e);
1427
+ }
1428
+ update(e, t) {
1429
+ e.length > this._size && (t = !0, this._size = Math.max(e.length, this._size * 1.5 | 0), this.staticAttributeBuffer = new X(this._size * this._staticStride * 4 * 4), this.dynamicAttributeBuffer = new X(this._size * this._dynamicStride * 4 * 4), this.indexBuffer = Be(this._size), this.geometry.indexBuffer.setDataWithSize(
1430
+ this.indexBuffer,
1431
+ this.indexBuffer.byteLength,
1432
+ !0
1433
+ ));
1434
+ const r = this.dynamicAttributeBuffer;
1435
+ if (this._dynamicUpload(e, r.float32View, r.uint32View), this._dynamicBuffer.setDataWithSize(
1436
+ this.dynamicAttributeBuffer.float32View,
1437
+ e.length * this._dynamicStride * 4,
1438
+ !0
1439
+ ), t) {
1440
+ const i = this.staticAttributeBuffer;
1441
+ this._staticUpload(e, i.float32View, i.uint32View), this._staticBuffer.setDataWithSize(
1442
+ i.float32View,
1443
+ e.length * this._staticStride * 4,
1444
+ !0
1445
+ );
1446
+ }
1447
+ }
1448
+ destroy() {
1449
+ this._staticBuffer.destroy(), this._dynamicBuffer.destroy(), this.geometry.destroy();
1450
+ }
1451
+ }
1452
+ function rr(a) {
1453
+ const e = [];
1454
+ for (const t in a) {
1455
+ const r = a[t];
1456
+ e.push(t, r.code, r.dynamic ? "d" : "s");
1457
+ }
1458
+ return e.join("_");
1459
+ }
1460
+ var ir = `varying vec2 vUV;
1461
+ varying vec4 vColor;
1462
+
1463
+ uniform sampler2D uTexture;
1464
+
1465
+ void main(void){
1466
+ vec4 color = texture2D(uTexture, vUV) * vColor;
1467
+ gl_FragColor = color;
1468
+ }`, sr = `attribute vec2 aVertex;
1469
+ attribute vec2 aUV;
1470
+ attribute vec4 aColor;
1471
+
1472
+ attribute vec2 aPosition;
1473
+ attribute float aRotation;
1474
+
1475
+ uniform mat3 uTranslationMatrix;
1476
+ uniform float uRound;
1477
+ uniform vec2 uResolution;
1478
+ uniform vec4 uColor;
1479
+
1480
+ varying vec2 vUV;
1481
+ varying vec4 vColor;
1482
+
1483
+ vec2 roundPixels(vec2 position, vec2 targetSize)
1484
+ {
1485
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
1486
+ }
1487
+
1488
+ void main(void){
1489
+ float cosRotation = cos(aRotation);
1490
+ float sinRotation = sin(aRotation);
1491
+ float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
1492
+ float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
1493
+
1494
+ vec2 v = vec2(x, y);
1495
+ v = v + aPosition;
1496
+
1497
+ gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
1498
+
1499
+ if(uRound == 1.0)
1500
+ {
1501
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
1502
+ }
1503
+
1504
+ vUV = aUV;
1505
+ vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
1506
+ }
1507
+ `, Re = `
1508
+ struct ParticleUniforms {
1509
+ uProjectionMatrix:mat3x3<f32>,
1510
+ uColor:vec4<f32>,
1511
+ uResolution:vec2<f32>,
1512
+ uRoundPixels:f32,
1513
+ };
1514
+
1515
+ @group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
1516
+
1517
+ @group(1) @binding(0) var uTexture: texture_2d<f32>;
1518
+ @group(1) @binding(1) var uSampler : sampler;
1519
+
1520
+ struct VSOutput {
1521
+ @builtin(position) position: vec4<f32>,
1522
+ @location(0) uv : vec2<f32>,
1523
+ @location(1) color : vec4<f32>,
1524
+ };
1525
+ @vertex
1526
+ fn mainVertex(
1527
+ @location(0) aVertex: vec2<f32>,
1528
+ @location(1) aPosition: vec2<f32>,
1529
+ @location(2) aUV: vec2<f32>,
1530
+ @location(3) aColor: vec4<f32>,
1531
+ @location(4) aRotation: f32,
1532
+ ) -> VSOutput {
1533
+
1534
+ let v = vec2(
1535
+ aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
1536
+ aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
1537
+ ) + aPosition;
1538
+
1539
+ let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
1540
+
1541
+ let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
1542
+
1543
+ return VSOutput(
1544
+ position,
1545
+ aUV,
1546
+ vColor,
1547
+ );
1548
+ }
1549
+
1550
+ @fragment
1551
+ fn mainFragment(
1552
+ @location(0) uv: vec2<f32>,
1553
+ @location(1) color: vec4<f32>,
1554
+ @builtin(position) position: vec4<f32>,
1555
+ ) -> @location(0) vec4<f32> {
1556
+
1557
+ var sample = textureSample(uTexture, uSampler, uv) * color;
1558
+
1559
+ return sample;
1560
+ }`;
1561
+ class nr extends he {
1562
+ constructor() {
1563
+ const e = Bt.from({
1564
+ vertex: sr,
1565
+ fragment: ir
1566
+ }), t = Pt.from({
1567
+ fragment: {
1568
+ source: Re,
1569
+ entryPoint: "mainFragment"
1570
+ },
1571
+ vertex: {
1572
+ source: Re,
1573
+ entryPoint: "mainVertex"
1574
+ }
1575
+ });
1576
+ super({
1577
+ glProgram: e,
1578
+ gpuProgram: t,
1579
+ resources: {
1580
+ // this will be replaced with the texture from the particle container
1581
+ uTexture: R.WHITE.source,
1582
+ // this will be replaced with the texture style from the particle container
1583
+ uSampler: new Rt({}),
1584
+ // this will be replaced with the local uniforms from the particle container
1585
+ uniforms: {
1586
+ uTranslationMatrix: { value: new F(), type: "mat3x3<f32>" },
1587
+ uColor: { value: new M(16777215), type: "vec4<f32>" },
1588
+ uRound: { value: 1, type: "f32" },
1589
+ uResolution: { value: [0, 0], type: "vec2<f32>" }
1590
+ }
1591
+ }
1592
+ });
1593
+ }
1594
+ }
1595
+ class st {
1596
+ /**
1597
+ * @param renderer - The renderer this sprite batch works for.
1598
+ * @param adaptor
1599
+ */
1600
+ constructor(e, t) {
1601
+ this.state = q.for2d(), this._gpuBufferHash = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this.localUniforms = new L({
1602
+ uTranslationMatrix: { value: new F(), type: "mat3x3<f32>" },
1603
+ uColor: { value: new Float32Array(4), type: "vec4<f32>" },
1604
+ uRound: { value: 1, type: "f32" },
1605
+ uResolution: { value: [0, 0], type: "vec2<f32>" }
1606
+ }), this.renderer = e, this.adaptor = t, this.defaultShader = new nr(), this.state = q.for2d();
1607
+ }
1608
+ validateRenderable(e) {
1609
+ return !1;
1610
+ }
1611
+ addRenderable(e, t) {
1612
+ this.renderer.renderPipes.batch.break(t), t.add(e);
1613
+ }
1614
+ getBuffers(e) {
1615
+ return this._gpuBufferHash[e.uid] || this._initBuffer(e);
1616
+ }
1617
+ _initBuffer(e) {
1618
+ return this._gpuBufferHash[e.uid] = new tr({
1619
+ size: e.particleChildren.length,
1620
+ properties: e._properties
1621
+ }), e.on("destroyed", this._destroyRenderableBound), this._gpuBufferHash[e.uid];
1622
+ }
1623
+ updateRenderable(e) {
1624
+ }
1625
+ destroyRenderable(e) {
1626
+ this._gpuBufferHash[e.uid].destroy(), this._gpuBufferHash[e.uid] = null, e.off("destroyed", this._destroyRenderableBound);
1627
+ }
1628
+ execute(e) {
1629
+ const t = e.particleChildren;
1630
+ if (t.length === 0)
1631
+ return;
1632
+ const r = this.renderer, i = this.getBuffers(e);
1633
+ e.texture || (e.texture = t[0].texture);
1634
+ const s = this.state;
1635
+ i.update(t, e._childrenDirty), e._childrenDirty = !1, s.blendMode = ce(e.blendMode, e.texture._source);
1636
+ const n = this.localUniforms.uniforms, o = n.uTranslationMatrix;
1637
+ e.worldTransform.copyTo(o), o.prepend(r.globalUniforms.globalUniformData.projectionMatrix), n.uResolution = r.globalUniforms.globalUniformData.resolution, n.uRound = r._roundPixels | e._roundPixels, J(
1638
+ e.groupColorAlpha,
1639
+ n.uColor,
1640
+ 0
1641
+ ), this.adaptor.execute(this, e);
1642
+ }
1643
+ /** Destroys the ParticleRenderer. */
1644
+ destroy() {
1645
+ this.defaultShader && (this.defaultShader.destroy(), this.defaultShader = null);
1646
+ }
1647
+ }
1648
+ class nt extends st {
1649
+ constructor(e) {
1650
+ super(e, new Jt());
1651
+ }
1652
+ }
1653
+ nt.extension = {
1654
+ type: [
1655
+ x.WebGLPipes
1656
+ ],
1657
+ name: "particle"
1658
+ };
1659
+ class at extends st {
1660
+ constructor(e) {
1661
+ super(e, new Zt());
1662
+ }
1663
+ }
1664
+ at.extension = {
1665
+ type: [
1666
+ x.WebGPUPipes
1667
+ ],
1668
+ name: "particle"
1669
+ };
1670
+ const ot = class dt extends Qt {
1671
+ constructor(e = {}) {
1672
+ e = { ...dt.defaultOptions, ...e }, super({
1673
+ width: e.width,
1674
+ height: e.height,
1675
+ verticesX: 4,
1676
+ verticesY: 4
1677
+ }), this.update(e);
1678
+ }
1679
+ /**
1680
+ * Updates the NineSliceGeometry with the options.
1681
+ * @param options - The options of the NineSliceGeometry.
1682
+ */
1683
+ update(e) {
1684
+ var t, r;
1685
+ this.width = e.width ?? this.width, this.height = e.height ?? this.height, this._originalWidth = e.originalWidth ?? this._originalWidth, this._originalHeight = e.originalHeight ?? this._originalHeight, this._leftWidth = e.leftWidth ?? this._leftWidth, this._rightWidth = e.rightWidth ?? this._rightWidth, this._topHeight = e.topHeight ?? this._topHeight, this._bottomHeight = e.bottomHeight ?? this._bottomHeight, this._anchorX = (t = e.anchor) == null ? void 0 : t.x, this._anchorY = (r = e.anchor) == null ? void 0 : r.y, this.updateUvs(), this.updatePositions();
1686
+ }
1687
+ /** Updates the positions of the vertices. */
1688
+ updatePositions() {
1689
+ const e = this.positions, {
1690
+ width: t,
1691
+ height: r,
1692
+ _leftWidth: i,
1693
+ _rightWidth: s,
1694
+ _topHeight: n,
1695
+ _bottomHeight: o,
1696
+ _anchorX: d,
1697
+ _anchorY: c
1698
+ } = this, h = i + s, l = t > h ? 1 : t / h, u = n + o, g = r > u ? 1 : r / u, p = Math.min(l, g), f = d * t, m = c * r;
1699
+ e[0] = e[8] = e[16] = e[24] = -f, e[2] = e[10] = e[18] = e[26] = i * p - f, e[4] = e[12] = e[20] = e[28] = t - s * p - f, e[6] = e[14] = e[22] = e[30] = t - f, e[1] = e[3] = e[5] = e[7] = -m, e[9] = e[11] = e[13] = e[15] = n * p - m, e[17] = e[19] = e[21] = e[23] = r - o * p - m, e[25] = e[27] = e[29] = e[31] = r - m, this.getBuffer("aPosition").update();
1700
+ }
1701
+ /** Updates the UVs of the vertices. */
1702
+ updateUvs() {
1703
+ const e = this.uvs;
1704
+ e[0] = e[8] = e[16] = e[24] = 0, e[1] = e[3] = e[5] = e[7] = 0, e[6] = e[14] = e[22] = e[30] = 1, e[25] = e[27] = e[29] = e[31] = 1;
1705
+ const t = 1 / this._originalWidth, r = 1 / this._originalHeight;
1706
+ e[2] = e[10] = e[18] = e[26] = t * this._leftWidth, e[9] = e[11] = e[13] = e[15] = r * this._topHeight, e[4] = e[12] = e[20] = e[28] = 1 - t * this._rightWidth, e[17] = e[19] = e[21] = e[23] = 1 - r * this._bottomHeight, this.getBuffer("aUV").update();
1707
+ }
1708
+ };
1709
+ ot.defaultOptions = {
1710
+ /** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
1711
+ width: 100,
1712
+ /** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */
1713
+ height: 100,
1714
+ /** The width of the left column. */
1715
+ leftWidth: 10,
1716
+ /** The height of the top row. */
1717
+ topHeight: 10,
1718
+ /** The width of the right column. */
1719
+ rightWidth: 10,
1720
+ /** The height of the bottom row. */
1721
+ bottomHeight: 10,
1722
+ /** The original width of the texture */
1723
+ originalWidth: 100,
1724
+ /** The original height of the texture */
1725
+ originalHeight: 100
1726
+ };
1727
+ let ar = ot;
1728
+ class lt {
1729
+ constructor(e) {
1730
+ this._gpuSpriteHash = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_gpuSpriteHash");
1731
+ }
1732
+ addRenderable(e, t) {
1733
+ const r = this._getGpuSprite(e);
1734
+ e.didViewUpdate && this._updateBatchableSprite(e, r), this._renderer.renderPipes.batch.addToBatch(r, t);
1735
+ }
1736
+ updateRenderable(e) {
1737
+ const t = this._gpuSpriteHash[e.uid];
1738
+ e.didViewUpdate && this._updateBatchableSprite(e, t), t._batcher.updateElement(t);
1739
+ }
1740
+ validateRenderable(e) {
1741
+ const t = this._getGpuSprite(e);
1742
+ return !t._batcher.checkAndUpdateTexture(
1743
+ t,
1744
+ e._texture
1745
+ );
1746
+ }
1747
+ destroyRenderable(e) {
1748
+ const t = this._gpuSpriteHash[e.uid];
1749
+ v.return(t.geometry), v.return(t), this._gpuSpriteHash[e.uid] = null, e.off("destroyed", this._destroyRenderableBound);
1750
+ }
1751
+ _updateBatchableSprite(e, t) {
1752
+ t.geometry.update(e), t.setTexture(e._texture);
1753
+ }
1754
+ _getGpuSprite(e) {
1755
+ return this._gpuSpriteHash[e.uid] || this._initGPUSprite(e);
1756
+ }
1757
+ _initGPUSprite(e) {
1758
+ const t = v.get(pe);
1759
+ return t.geometry = v.get(ar), t.renderable = e, t.transform = e.groupTransform, t.texture = e._texture, t.roundPixels = this._renderer._roundPixels | e._roundPixels, this._gpuSpriteHash[e.uid] = t, e.didViewUpdate || this._updateBatchableSprite(e, t), e.on("destroyed", this._destroyRenderableBound), t;
1760
+ }
1761
+ destroy() {
1762
+ for (const e in this._gpuSpriteHash)
1763
+ this._gpuSpriteHash[e].geometry.destroy();
1764
+ this._gpuSpriteHash = null, this._renderer = null;
1765
+ }
1766
+ }
1767
+ lt.extension = {
1768
+ type: [
1769
+ x.WebGLPipes,
1770
+ x.WebGPUPipes,
1771
+ x.CanvasPipes
1772
+ ],
1773
+ name: "nineSliceSprite"
1774
+ };
1775
+ const or = {
1776
+ name: "tiling-bit",
1777
+ vertex: {
1778
+ header: (
1779
+ /* wgsl */
1780
+ `
1781
+ struct TilingUniforms {
1782
+ uMapCoord:mat3x3<f32>,
1783
+ uClampFrame:vec4<f32>,
1784
+ uClampOffset:vec2<f32>,
1785
+ uTextureTransform:mat3x3<f32>,
1786
+ uSizeAnchor:vec4<f32>
1787
+ };
1788
+
1789
+ @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
1790
+ @group(2) @binding(1) var uTexture: texture_2d<f32>;
1791
+ @group(2) @binding(2) var uSampler: sampler;
1792
+ `
1793
+ ),
1794
+ main: (
1795
+ /* wgsl */
1796
+ `
1797
+ uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
1798
+
1799
+ position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
1800
+ `
1801
+ )
1802
+ },
1803
+ fragment: {
1804
+ header: (
1805
+ /* wgsl */
1806
+ `
1807
+ struct TilingUniforms {
1808
+ uMapCoord:mat3x3<f32>,
1809
+ uClampFrame:vec4<f32>,
1810
+ uClampOffset:vec2<f32>,
1811
+ uTextureTransform:mat3x3<f32>,
1812
+ uSizeAnchor:vec4<f32>
1813
+ };
1814
+
1815
+ @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
1816
+ @group(2) @binding(1) var uTexture: texture_2d<f32>;
1817
+ @group(2) @binding(2) var uSampler: sampler;
1818
+ `
1819
+ ),
1820
+ main: (
1821
+ /* wgsl */
1822
+ `
1823
+
1824
+ var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
1825
+ coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
1826
+ var unclamped = coord;
1827
+ coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
1828
+
1829
+ var bias = 0.;
1830
+
1831
+ if(unclamped.x == coord.x && unclamped.y == coord.y)
1832
+ {
1833
+ bias = -32.;
1834
+ }
1835
+
1836
+ outColor = textureSampleBias(uTexture, uSampler, coord, bias);
1837
+ `
1838
+ )
1839
+ }
1840
+ }, dr = {
1841
+ name: "tiling-bit",
1842
+ vertex: {
1843
+ header: (
1844
+ /* glsl */
1845
+ `
1846
+ uniform mat3 uTextureTransform;
1847
+ uniform vec4 uSizeAnchor;
1848
+
1849
+ `
1850
+ ),
1851
+ main: (
1852
+ /* glsl */
1853
+ `
1854
+ uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
1855
+
1856
+ position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
1857
+ `
1858
+ )
1859
+ },
1860
+ fragment: {
1861
+ header: (
1862
+ /* glsl */
1863
+ `
1864
+ uniform sampler2D uTexture;
1865
+ uniform mat3 uMapCoord;
1866
+ uniform vec4 uClampFrame;
1867
+ uniform vec2 uClampOffset;
1868
+ `
1869
+ ),
1870
+ main: (
1871
+ /* glsl */
1872
+ `
1873
+
1874
+ vec2 coord = vUV + ceil(uClampOffset - vUV);
1875
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
1876
+ vec2 unclamped = coord;
1877
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
1878
+
1879
+ outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
1880
+
1881
+ `
1882
+ )
1883
+ }
1884
+ };
1885
+ let ee, te;
1886
+ class lr extends he {
1887
+ constructor() {
1888
+ ee ?? (ee = ze({
1889
+ name: "tiling-sprite-shader",
1890
+ bits: [
1891
+ Dt,
1892
+ or,
1893
+ He
1894
+ ]
1895
+ })), te ?? (te = We({
1896
+ name: "tiling-sprite-shader",
1897
+ bits: [
1898
+ Ot,
1899
+ dr,
1900
+ De
1901
+ ]
1902
+ }));
1903
+ const e = new L({
1904
+ uMapCoord: { value: new F(), type: "mat3x3<f32>" },
1905
+ uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: "vec4<f32>" },
1906
+ uClampOffset: { value: new Float32Array([0, 0]), type: "vec2<f32>" },
1907
+ uTextureTransform: { value: new F(), type: "mat3x3<f32>" },
1908
+ uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: "vec4<f32>" }
1909
+ });
1910
+ super({
1911
+ glProgram: te,
1912
+ gpuProgram: ee,
1913
+ resources: {
1914
+ localUniforms: new L({
1915
+ uTransformMatrix: { value: new F(), type: "mat3x3<f32>" },
1916
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
1917
+ uRound: { value: 0, type: "f32" }
1918
+ }),
1919
+ tilingUniforms: e,
1920
+ uTexture: R.EMPTY.source,
1921
+ uSampler: R.EMPTY.source.style
1922
+ }
1923
+ });
1924
+ }
1925
+ updateUniforms(e, t, r, i, s, n) {
1926
+ const o = this.resources.tilingUniforms, d = n.width, c = n.height, h = n.textureMatrix, l = o.uniforms.uTextureTransform;
1927
+ l.set(
1928
+ r.a * d / e,
1929
+ r.b * d / t,
1930
+ r.c * c / e,
1931
+ r.d * c / t,
1932
+ r.tx / e,
1933
+ r.ty / t
1934
+ ), l.invert(), o.uniforms.uMapCoord = h.mapCoord, o.uniforms.uClampFrame = h.uClampFrame, o.uniforms.uClampOffset = h.uClampOffset, o.uniforms.uTextureTransform = l, o.uniforms.uSizeAnchor[0] = e, o.uniforms.uSizeAnchor[1] = t, o.uniforms.uSizeAnchor[2] = i, o.uniforms.uSizeAnchor[3] = s, n && (this.resources.uTexture = n.source, this.resources.uSampler = n.source.style);
1935
+ }
1936
+ }
1937
+ class cr extends ue {
1938
+ constructor() {
1939
+ super({
1940
+ positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
1941
+ uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
1942
+ indices: new Uint32Array([0, 1, 2, 0, 2, 3])
1943
+ });
1944
+ }
1945
+ }
1946
+ function hr(a, e) {
1947
+ const t = a.anchor.x, r = a.anchor.y;
1948
+ e[0] = -t * a.width, e[1] = -r * a.height, e[2] = (1 - t) * a.width, e[3] = -r * a.height, e[4] = (1 - t) * a.width, e[5] = (1 - r) * a.height, e[6] = -t * a.width, e[7] = (1 - r) * a.height;
1949
+ }
1950
+ function ur(a, e, t, r) {
1951
+ let i = 0;
1952
+ const s = a.length / e, n = r.a, o = r.b, d = r.c, c = r.d, h = r.tx, l = r.ty;
1953
+ for (t *= e; i < s; ) {
1954
+ const u = a[t], g = a[t + 1];
1955
+ a[t] = n * u + d * g + h, a[t + 1] = o * u + c * g + l, t += e, i++;
1956
+ }
1957
+ }
1958
+ function fr(a, e) {
1959
+ const t = a.texture, r = t.frame.width, i = t.frame.height;
1960
+ let s = 0, n = 0;
1961
+ a.applyAnchorToTexture && (s = a.anchor.x, n = a.anchor.y), e[0] = e[6] = -s, e[2] = e[4] = 1 - s, e[1] = e[3] = -n, e[5] = e[7] = 1 - n;
1962
+ const o = F.shared;
1963
+ o.copyFrom(a._tileTransform.matrix), o.tx /= a.width, o.ty /= a.height, o.invert(), o.scale(a.width / r, a.height / i), ur(e, 2, 0, o);
1964
+ }
1965
+ const K = new cr();
1966
+ class ct {
1967
+ constructor(e) {
1968
+ this._state = q.default2d, this._tilingSpriteDataHash = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_tilingSpriteDataHash");
1969
+ }
1970
+ validateRenderable(e) {
1971
+ const t = this._getTilingSpriteData(e), r = t.canBatch;
1972
+ this._updateCanBatch(e);
1973
+ const i = t.canBatch;
1974
+ if (i && i === r) {
1975
+ const { batchableMesh: s } = t;
1976
+ return !s._batcher.checkAndUpdateTexture(
1977
+ s,
1978
+ e.texture
1979
+ );
1980
+ }
1981
+ return r !== i;
1982
+ }
1983
+ addRenderable(e, t) {
1984
+ const r = this._renderer.renderPipes.batch;
1985
+ this._updateCanBatch(e);
1986
+ const i = this._getTilingSpriteData(e), { geometry: s, canBatch: n } = i;
1987
+ if (n) {
1988
+ i.batchableMesh || (i.batchableMesh = new pe());
1989
+ const o = i.batchableMesh;
1990
+ e.didViewUpdate && (this._updateBatchableMesh(e), o.geometry = s, o.renderable = e, o.transform = e.groupTransform, o.setTexture(e._texture)), o.roundPixels = this._renderer._roundPixels | e._roundPixels, r.addToBatch(o, t);
1991
+ } else
1992
+ r.break(t), i.shader || (i.shader = new lr()), this.updateRenderable(e), t.add(e);
1993
+ }
1994
+ execute(e) {
1995
+ const { shader: t } = this._tilingSpriteDataHash[e.uid];
1996
+ t.groups[0] = this._renderer.globalUniforms.bindGroup;
1997
+ const r = t.resources.localUniforms.uniforms;
1998
+ r.uTransformMatrix = e.groupTransform, r.uRound = this._renderer._roundPixels | e._roundPixels, J(
1999
+ e.groupColorAlpha,
2000
+ r.uColor,
2001
+ 0
2002
+ ), this._state.blendMode = ce(e.groupBlendMode, e.texture._source), this._renderer.encoder.draw({
2003
+ geometry: K,
2004
+ shader: t,
2005
+ state: this._state
2006
+ });
2007
+ }
2008
+ updateRenderable(e) {
2009
+ const t = this._getTilingSpriteData(e), { canBatch: r } = t;
2010
+ if (r) {
2011
+ const { batchableMesh: i } = t;
2012
+ e.didViewUpdate && this._updateBatchableMesh(e), i._batcher.updateElement(i);
2013
+ } else if (e.didViewUpdate) {
2014
+ const { shader: i } = t;
2015
+ i.updateUniforms(
2016
+ e.width,
2017
+ e.height,
2018
+ e._tileTransform.matrix,
2019
+ e.anchor.x,
2020
+ e.anchor.y,
2021
+ e.texture
2022
+ );
2023
+ }
2024
+ }
2025
+ destroyRenderable(e) {
2026
+ var r;
2027
+ const t = this._getTilingSpriteData(e);
2028
+ t.batchableMesh = null, (r = t.shader) == null || r.destroy(), this._tilingSpriteDataHash[e.uid] = null, e.off("destroyed", this._destroyRenderableBound);
2029
+ }
2030
+ _getTilingSpriteData(e) {
2031
+ return this._tilingSpriteDataHash[e.uid] || this._initTilingSpriteData(e);
2032
+ }
2033
+ _initTilingSpriteData(e) {
2034
+ const t = new ue({
2035
+ indices: K.indices,
2036
+ positions: K.positions.slice(),
2037
+ uvs: K.uvs.slice()
2038
+ });
2039
+ return this._tilingSpriteDataHash[e.uid] = {
2040
+ canBatch: !0,
2041
+ renderable: e,
2042
+ geometry: t
2043
+ }, e.on("destroyed", this._destroyRenderableBound), this._tilingSpriteDataHash[e.uid];
2044
+ }
2045
+ _updateBatchableMesh(e) {
2046
+ const t = this._getTilingSpriteData(e), { geometry: r } = t, i = e.texture.source.style;
2047
+ i.addressMode !== "repeat" && (i.addressMode = "repeat", i.update()), fr(e, r.uvs), hr(e, r.positions);
2048
+ }
2049
+ destroy() {
2050
+ for (const e in this._tilingSpriteDataHash)
2051
+ this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);
2052
+ this._tilingSpriteDataHash = null, this._renderer = null;
2053
+ }
2054
+ _updateCanBatch(e) {
2055
+ const t = this._getTilingSpriteData(e), r = e.texture;
2056
+ let i = !0;
2057
+ return this._renderer.type === le.WEBGL && (i = this._renderer.context.supports.nonPowOf2wrapping), t.canBatch = r.textureMatrix.isSimple && (i || r.source.isPowerOfTwo), t.canBatch;
2058
+ }
2059
+ }
2060
+ ct.extension = {
2061
+ type: [
2062
+ x.WebGLPipes,
2063
+ x.WebGPUPipes,
2064
+ x.CanvasPipes
2065
+ ],
2066
+ name: "tilingSprite"
2067
+ };
2068
+ const pr = {
2069
+ name: "local-uniform-msdf-bit",
2070
+ vertex: {
2071
+ header: (
2072
+ /* wgsl */
2073
+ `
2074
+ struct LocalUniforms {
2075
+ uColor:vec4<f32>,
2076
+ uTransformMatrix:mat3x3<f32>,
2077
+ uDistance: f32,
2078
+ uRound:f32,
2079
+ }
2080
+
2081
+ @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
2082
+ `
2083
+ ),
2084
+ main: (
2085
+ /* wgsl */
2086
+ `
2087
+ vColor *= localUniforms.uColor;
2088
+ modelMatrix *= localUniforms.uTransformMatrix;
2089
+ `
2090
+ ),
2091
+ end: (
2092
+ /* wgsl */
2093
+ `
2094
+ if(localUniforms.uRound == 1)
2095
+ {
2096
+ vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
2097
+ }
2098
+ `
2099
+ )
2100
+ },
2101
+ fragment: {
2102
+ header: (
2103
+ /* wgsl */
2104
+ `
2105
+ struct LocalUniforms {
2106
+ uColor:vec4<f32>,
2107
+ uTransformMatrix:mat3x3<f32>,
2108
+ uDistance: f32
2109
+ }
2110
+
2111
+ @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
2112
+ `
2113
+ ),
2114
+ main: (
2115
+ /* wgsl */
2116
+ `
2117
+ outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
2118
+ `
2119
+ )
2120
+ }
2121
+ }, gr = {
2122
+ name: "local-uniform-msdf-bit",
2123
+ vertex: {
2124
+ header: (
2125
+ /* glsl */
2126
+ `
2127
+ uniform mat3 uTransformMatrix;
2128
+ uniform vec4 uColor;
2129
+ uniform float uRound;
2130
+ `
2131
+ ),
2132
+ main: (
2133
+ /* glsl */
2134
+ `
2135
+ vColor *= uColor;
2136
+ modelMatrix *= uTransformMatrix;
2137
+ `
2138
+ ),
2139
+ end: (
2140
+ /* glsl */
2141
+ `
2142
+ if(uRound == 1.)
2143
+ {
2144
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
2145
+ }
2146
+ `
2147
+ )
2148
+ },
2149
+ fragment: {
2150
+ header: (
2151
+ /* glsl */
2152
+ `
2153
+ uniform float uDistance;
2154
+ `
2155
+ ),
2156
+ main: (
2157
+ /* glsl */
2158
+ `
2159
+ outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
2160
+ `
2161
+ )
2162
+ }
2163
+ }, mr = {
2164
+ name: "msdf-bit",
2165
+ fragment: {
2166
+ header: (
2167
+ /* wgsl */
2168
+ `
2169
+ fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
2170
+
2171
+ // MSDF
2172
+ var median = msdfColor.r + msdfColor.g + msdfColor.b -
2173
+ min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
2174
+ max(msdfColor.r, max(msdfColor.g, msdfColor.b));
2175
+
2176
+ // SDF
2177
+ median = min(median, msdfColor.a);
2178
+
2179
+ var screenPxDistance = distance * (median - 0.5);
2180
+ var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
2181
+ if (median < 0.01) {
2182
+ alpha = 0.0;
2183
+ } else if (median > 0.99) {
2184
+ alpha = 1.0;
2185
+ }
2186
+
2187
+ // Gamma correction for coverage-like alpha
2188
+ var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
2189
+ var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
2190
+ var coverage: f32 = pow(shapeColor.a * alpha, gamma);
2191
+
2192
+ return coverage;
2193
+
2194
+ }
2195
+ `
2196
+ )
2197
+ }
2198
+ }, xr = {
2199
+ name: "msdf-bit",
2200
+ fragment: {
2201
+ header: (
2202
+ /* glsl */
2203
+ `
2204
+ float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
2205
+
2206
+ // MSDF
2207
+ float median = msdfColor.r + msdfColor.g + msdfColor.b -
2208
+ min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
2209
+ max(msdfColor.r, max(msdfColor.g, msdfColor.b));
2210
+
2211
+ // SDF
2212
+ median = min(median, msdfColor.a);
2213
+
2214
+ float screenPxDistance = distance * (median - 0.5);
2215
+ float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
2216
+
2217
+ if (median < 0.01) {
2218
+ alpha = 0.0;
2219
+ } else if (median > 0.99) {
2220
+ alpha = 1.0;
2221
+ }
2222
+
2223
+ // Gamma correction for coverage-like alpha
2224
+ float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
2225
+ float gamma = mix(1.0, 1.0 / 2.2, luma);
2226
+ float coverage = pow(shapeColor.a * alpha, gamma);
2227
+
2228
+ return coverage;
2229
+ }
2230
+ `
2231
+ )
2232
+ }
2233
+ };
2234
+ let re, ie;
2235
+ class _r extends he {
2236
+ constructor() {
2237
+ const e = new L({
2238
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
2239
+ uTransformMatrix: { value: new F(), type: "mat3x3<f32>" },
2240
+ uDistance: { value: 4, type: "f32" },
2241
+ uRound: { value: 0, type: "f32" }
2242
+ }), t = Mt();
2243
+ re ?? (re = ze({
2244
+ name: "sdf-shader",
2245
+ bits: [
2246
+ Ft,
2247
+ Ut(t),
2248
+ pr,
2249
+ mr,
2250
+ He
2251
+ ]
2252
+ })), ie ?? (ie = We({
2253
+ name: "sdf-shader",
2254
+ bits: [
2255
+ kt,
2256
+ At(t),
2257
+ gr,
2258
+ xr,
2259
+ De
2260
+ ]
2261
+ })), super({
2262
+ glProgram: ie,
2263
+ gpuProgram: re,
2264
+ resources: {
2265
+ localUniforms: e,
2266
+ batchSamplers: Gt(t)
2267
+ }
2268
+ });
2269
+ }
2270
+ }
2271
+ class ht {
2272
+ constructor(e) {
2273
+ this._gpuBitmapText = {}, this._destroyRenderableBound = this.destroyRenderable.bind(this), this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_gpuBitmapText");
2274
+ }
2275
+ validateRenderable(e) {
2276
+ const t = this._getGpuBitmapText(e);
2277
+ return e._didTextUpdate && (e._didTextUpdate = !1, this._updateContext(e, t)), this._renderer.renderPipes.graphics.validateRenderable(t);
2278
+ }
2279
+ addRenderable(e, t) {
2280
+ const r = this._getGpuBitmapText(e);
2281
+ Me(e, r), e._didTextUpdate && (e._didTextUpdate = !1, this._updateContext(e, r)), this._renderer.renderPipes.graphics.addRenderable(r, t), r.context.customShader && this._updateDistanceField(e);
2282
+ }
2283
+ destroyRenderable(e) {
2284
+ e.off("destroyed", this._destroyRenderableBound), this._destroyRenderableByUid(e.uid);
2285
+ }
2286
+ _destroyRenderableByUid(e) {
2287
+ const t = this._gpuBitmapText[e].context;
2288
+ t.customShader && (v.return(t.customShader), t.customShader = null), v.return(this._gpuBitmapText[e]), this._gpuBitmapText[e] = null;
2289
+ }
2290
+ updateRenderable(e) {
2291
+ const t = this._getGpuBitmapText(e);
2292
+ Me(e, t), this._renderer.renderPipes.graphics.updateRenderable(t), t.context.customShader && this._updateDistanceField(e);
2293
+ }
2294
+ _updateContext(e, t) {
2295
+ const { context: r } = t, i = Yt.getFont(e.text, e._style);
2296
+ r.clear(), i.distanceField.type !== "none" && (r.customShader || (r.customShader = v.get(_r)));
2297
+ const s = Array.from(e.text), n = e._style;
2298
+ let o = i.baseLineOffset;
2299
+ const d = Xe(s, n, i, !0);
2300
+ let c = 0;
2301
+ const h = n.padding, l = d.scale;
2302
+ let u = d.width, g = d.height + d.offsetY;
2303
+ n._stroke && (u += n._stroke.width / l, g += n._stroke.width / l), r.translate(-e._anchor._x * u - h, -e._anchor._y * g - h).scale(l, l);
2304
+ const p = i.applyFillAsTint ? n._fill.color : 16777215;
2305
+ for (let f = 0; f < d.lines.length; f++) {
2306
+ const m = d.lines[f];
2307
+ for (let _ = 0; _ < m.charPositions.length; _++) {
2308
+ const w = s[c++], b = i.chars[w];
2309
+ b != null && b.texture && r.texture(
2310
+ b.texture,
2311
+ p || "black",
2312
+ Math.round(m.charPositions[_] + b.xOffset),
2313
+ Math.round(o + b.yOffset)
2314
+ );
2315
+ }
2316
+ o += i.lineHeight;
2317
+ }
2318
+ }
2319
+ _getGpuBitmapText(e) {
2320
+ return this._gpuBitmapText[e.uid] || this.initGpuText(e);
2321
+ }
2322
+ initGpuText(e) {
2323
+ const t = v.get(zt);
2324
+ return this._gpuBitmapText[e.uid] = t, this._updateContext(e, t), e.on("destroyed", this._destroyRenderableBound), this._gpuBitmapText[e.uid];
2325
+ }
2326
+ _updateDistanceField(e) {
2327
+ const t = this._getGpuBitmapText(e).context, r = e._style.fontFamily, i = U.get(`${r}-bitmap`), { a: s, b: n, c: o, d } = e.groupTransform, c = Math.sqrt(s * s + n * n), h = Math.sqrt(o * o + d * d), l = (Math.abs(c) + Math.abs(h)) / 2, u = i.baseRenderedFontSize / e._style.fontSize, g = l * i.distanceField.range * (1 / u);
2328
+ t.customShader.resources.localUniforms.uniforms.uDistance = g;
2329
+ }
2330
+ destroy() {
2331
+ for (const e in this._gpuBitmapText)
2332
+ this._destroyRenderableByUid(e);
2333
+ this._gpuBitmapText = null, this._renderer = null;
2334
+ }
2335
+ }
2336
+ ht.extension = {
2337
+ type: [
2338
+ x.WebGLPipes,
2339
+ x.WebGPUPipes,
2340
+ x.CanvasPipes
2341
+ ],
2342
+ name: "bitmapText"
2343
+ };
2344
+ function Me(a, e) {
2345
+ e.groupTransform = a.groupTransform, e.groupColorAlpha = a.groupColorAlpha, e.groupColor = a.groupColor, e.groupBlendMode = a.groupBlendMode, e.globalDisplayStatus = a.globalDisplayStatus, e.groupTransform = a.groupTransform, e.localDisplayStatus = a.localDisplayStatus, e.groupAlpha = a.groupAlpha, e._roundPixels = a._roundPixels;
2346
+ }
2347
+ function oe(a, e) {
2348
+ const { texture: t, bounds: r } = a;
2349
+ Ht(r, e._anchor, t);
2350
+ const i = e._style.padding;
2351
+ r.minX -= i, r.minY -= i, r.maxX -= i, r.maxY -= i;
2352
+ }
2353
+ class ut {
2354
+ constructor(e) {
2355
+ this._gpuText = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this._renderer = e, this._renderer.runners.resolutionChange.add(this), this._renderer.renderableGC.addManagedHash(this, "_gpuText");
2356
+ }
2357
+ resolutionChange() {
2358
+ for (const e in this._gpuText) {
2359
+ const t = this._gpuText[e];
2360
+ if (!t)
2361
+ continue;
2362
+ const r = t.batchableSprite.renderable;
2363
+ r._autoResolution && (r._resolution = this._renderer.resolution, r.onViewUpdate());
2364
+ }
2365
+ }
2366
+ validateRenderable(e) {
2367
+ const t = this._getGpuText(e), r = e._getKey();
2368
+ return t.textureNeedsUploading ? (t.textureNeedsUploading = !1, !0) : t.currentKey !== r;
2369
+ }
2370
+ addRenderable(e, t) {
2371
+ const i = this._getGpuText(e).batchableSprite;
2372
+ e._didTextUpdate && this._updateText(e), this._renderer.renderPipes.batch.addToBatch(i, t);
2373
+ }
2374
+ updateRenderable(e) {
2375
+ const r = this._getGpuText(e).batchableSprite;
2376
+ e._didTextUpdate && this._updateText(e), r._batcher.updateElement(r);
2377
+ }
2378
+ destroyRenderable(e) {
2379
+ e.off("destroyed", this._destroyRenderableBound), this._destroyRenderableById(e.uid);
2380
+ }
2381
+ _destroyRenderableById(e) {
2382
+ const t = this._gpuText[e];
2383
+ this._renderer.htmlText.decreaseReferenceCount(t.currentKey), v.return(t.batchableSprite), this._gpuText[e] = null;
2384
+ }
2385
+ _updateText(e) {
2386
+ const t = e._getKey(), r = this._getGpuText(e), i = r.batchableSprite;
2387
+ r.currentKey !== t && this._updateGpuText(e).catch((s) => {
2388
+ console.error(s);
2389
+ }), e._didTextUpdate = !1, oe(i, e);
2390
+ }
2391
+ async _updateGpuText(e) {
2392
+ e._didTextUpdate = !1;
2393
+ const t = this._getGpuText(e);
2394
+ if (t.generatingTexture)
2395
+ return;
2396
+ const r = e._getKey();
2397
+ this._renderer.htmlText.decreaseReferenceCount(t.currentKey), t.generatingTexture = !0, t.currentKey = r;
2398
+ const i = e.resolution ?? this._renderer.resolution, s = await this._renderer.htmlText.getManagedTexture(
2399
+ e.text,
2400
+ i,
2401
+ e._style,
2402
+ e._getKey()
2403
+ ), n = t.batchableSprite;
2404
+ n.texture = t.texture = s, t.generatingTexture = !1, t.textureNeedsUploading = !0, e.onViewUpdate(), oe(n, e);
2405
+ }
2406
+ _getGpuText(e) {
2407
+ return this._gpuText[e.uid] || this.initGpuText(e);
2408
+ }
2409
+ initGpuText(e) {
2410
+ const t = {
2411
+ texture: R.EMPTY,
2412
+ currentKey: "--",
2413
+ batchableSprite: v.get(Ie),
2414
+ textureNeedsUploading: !1,
2415
+ generatingTexture: !1
2416
+ }, r = t.batchableSprite;
2417
+ return r.renderable = e, r.transform = e.groupTransform, r.texture = R.EMPTY, r.bounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 }, r.roundPixels = this._renderer._roundPixels | e._roundPixels, e._resolution = e._autoResolution ? this._renderer.resolution : e.resolution, this._gpuText[e.uid] = t, e.on("destroyed", this._destroyRenderableBound), t;
2418
+ }
2419
+ destroy() {
2420
+ for (const e in this._gpuText)
2421
+ this._destroyRenderableById(e);
2422
+ this._gpuText = null, this._renderer = null;
2423
+ }
2424
+ }
2425
+ ut.extension = {
2426
+ type: [
2427
+ x.WebGLPipes,
2428
+ x.WebGPUPipes,
2429
+ x.CanvasPipes
2430
+ ],
2431
+ name: "htmlText"
2432
+ };
2433
+ function br() {
2434
+ const { userAgent: a } = Oe.get().getNavigator();
2435
+ return /^((?!chrome|android).)*safari/i.test(a);
2436
+ }
2437
+ const yr = new Ge();
2438
+ function ft(a, e, t, r) {
2439
+ const i = yr;
2440
+ i.minX = 0, i.minY = 0, i.maxX = a.width / r | 0, i.maxY = a.height / r | 0;
2441
+ const s = k.getOptimalTexture(
2442
+ i.width,
2443
+ i.height,
2444
+ r,
2445
+ !1
2446
+ );
2447
+ return s.source.uploadMethodId = "image", s.source.resource = a, s.source.alphaMode = "premultiply-alpha-on-upload", s.frame.width = e / r, s.frame.height = t / r, s.source.emit("update", s.source), s.updateUvs(), s;
2448
+ }
2449
+ function Tr(a, e) {
2450
+ const t = e.fontFamily, r = [], i = {}, s = /font-family:([^;"\s]+)/g, n = a.match(s);
2451
+ function o(d) {
2452
+ i[d] || (r.push(d), i[d] = !0);
2453
+ }
2454
+ if (Array.isArray(t))
2455
+ for (let d = 0; d < t.length; d++)
2456
+ o(t[d]);
2457
+ else
2458
+ o(t);
2459
+ n && n.forEach((d) => {
2460
+ const c = d.split(":")[1].trim();
2461
+ o(c);
2462
+ });
2463
+ for (const d in e.tagStyles) {
2464
+ const c = e.tagStyles[d].fontFamily;
2465
+ o(c);
2466
+ }
2467
+ return r;
2468
+ }
2469
+ async function vr(a) {
2470
+ const t = await (await Oe.get().fetch(a)).blob(), r = new FileReader();
2471
+ return await new Promise((s, n) => {
2472
+ r.onloadend = () => s(r.result), r.onerror = n, r.readAsDataURL(t);
2473
+ });
2474
+ }
2475
+ async function Fe(a, e) {
2476
+ const t = await vr(e);
2477
+ return `@font-face {
2478
+ font-family: "${a.fontFamily}";
2479
+ src: url('${t}');
2480
+ font-weight: ${a.fontWeight};
2481
+ font-style: ${a.fontStyle};
2482
+ }`;
2483
+ }
2484
+ const N = /* @__PURE__ */ new Map();
2485
+ async function wr(a, e, t) {
2486
+ const r = a.filter((i) => U.has(`${i}-and-url`)).map((i, s) => {
2487
+ if (!N.has(i)) {
2488
+ const { url: n } = U.get(`${i}-and-url`);
2489
+ s === 0 ? N.set(i, Fe({
2490
+ fontWeight: e.fontWeight,
2491
+ fontStyle: e.fontStyle,
2492
+ fontFamily: i
2493
+ }, n)) : N.set(i, Fe({
2494
+ fontWeight: t.fontWeight,
2495
+ fontStyle: t.fontStyle,
2496
+ fontFamily: i
2497
+ }, n));
2498
+ }
2499
+ return N.get(i);
2500
+ });
2501
+ return (await Promise.all(r)).join(`
2502
+ `);
2503
+ }
2504
+ function Sr(a, e, t, r, i) {
2505
+ const { domElement: s, styleElement: n, svgRoot: o } = i;
2506
+ s.innerHTML = `<style>${e.cssStyle}</style><div style='padding:0;'>${a}</div>`, s.setAttribute("style", `transform: scale(${t});transform-origin: top left; display: inline-block`), n.textContent = r;
2507
+ const { width: d, height: c } = i.image;
2508
+ return o.setAttribute("width", d.toString()), o.setAttribute("height", c.toString()), new XMLSerializer().serializeToString(o);
2509
+ }
2510
+ function Cr(a, e) {
2511
+ const t = O.getOptimalCanvasAndContext(
2512
+ a.width,
2513
+ a.height,
2514
+ e
2515
+ ), { context: r } = t;
2516
+ return r.clearRect(0, 0, a.width, a.height), r.drawImage(a, 0, 0), t;
2517
+ }
2518
+ function Br(a, e, t) {
2519
+ return new Promise(async (r) => {
2520
+ t && await new Promise((i) => setTimeout(i, 100)), a.onload = () => {
2521
+ r();
2522
+ }, a.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`, a.crossOrigin = "anonymous";
2523
+ });
2524
+ }
2525
+ class ge {
2526
+ constructor(e) {
2527
+ this._activeTextures = {}, this._renderer = e, this._createCanvas = e.type === le.WEBGPU;
2528
+ }
2529
+ getTexture(e) {
2530
+ return this._buildTexturePromise(
2531
+ e.text,
2532
+ e.resolution,
2533
+ e.style
2534
+ );
2535
+ }
2536
+ getManagedTexture(e, t, r, i) {
2537
+ if (this._activeTextures[i])
2538
+ return this._increaseReferenceCount(i), this._activeTextures[i].promise;
2539
+ const s = this._buildTexturePromise(e, t, r).then((n) => (this._activeTextures[i].texture = n, n));
2540
+ return this._activeTextures[i] = {
2541
+ texture: null,
2542
+ promise: s,
2543
+ usageCount: 1
2544
+ }, s;
2545
+ }
2546
+ async _buildTexturePromise(e, t, r) {
2547
+ const i = v.get(Ze), s = Tr(e, r), n = await wr(
2548
+ s,
2549
+ r,
2550
+ fe.defaultTextStyle
2551
+ ), o = qt(e, r, n, i), d = Math.ceil(Math.ceil(Math.max(1, o.width) + r.padding * 2) * t), c = Math.ceil(Math.ceil(Math.max(1, o.height) + r.padding * 2) * t), h = i.image, l = 2;
2552
+ h.width = (d | 0) + l, h.height = (c | 0) + l;
2553
+ const u = Sr(e, r, t, n, i);
2554
+ await Br(h, u, br() && s.length > 0);
2555
+ const g = h;
2556
+ let p;
2557
+ this._createCanvas && (p = Cr(h, t));
2558
+ const f = ft(
2559
+ p ? p.canvas : g,
2560
+ h.width - l,
2561
+ h.height - l,
2562
+ t
2563
+ );
2564
+ return this._createCanvas && (this._renderer.texture.initSource(f.source), O.returnCanvasAndContext(p)), v.return(i), f;
2565
+ }
2566
+ _increaseReferenceCount(e) {
2567
+ this._activeTextures[e].usageCount++;
2568
+ }
2569
+ decreaseReferenceCount(e) {
2570
+ const t = this._activeTextures[e];
2571
+ t && (t.usageCount--, t.usageCount === 0 && (t.texture ? this._cleanUp(t) : t.promise.then((r) => {
2572
+ t.texture = r, this._cleanUp(t);
2573
+ }).catch(() => {
2574
+ I("HTMLTextSystem: Failed to clean texture");
2575
+ }), this._activeTextures[e] = null));
2576
+ }
2577
+ _cleanUp(e) {
2578
+ k.returnTexture(e.texture), e.texture.source.resource = null, e.texture.source.uploadMethodId = "unknown";
2579
+ }
2580
+ getReferenceCount(e) {
2581
+ return this._activeTextures[e].usageCount;
2582
+ }
2583
+ destroy() {
2584
+ this._activeTextures = null;
2585
+ }
2586
+ }
2587
+ ge.extension = {
2588
+ type: [
2589
+ x.WebGLSystem,
2590
+ x.WebGPUSystem,
2591
+ x.CanvasSystem
2592
+ ],
2593
+ name: "htmlText"
2594
+ };
2595
+ ge.defaultFontOptions = {
2596
+ fontFamily: "Arial",
2597
+ fontStyle: "normal",
2598
+ fontWeight: "normal"
2599
+ };
2600
+ class pt {
2601
+ constructor(e) {
2602
+ this._gpuText = /* @__PURE__ */ Object.create(null), this._destroyRenderableBound = this.destroyRenderable.bind(this), this._renderer = e, this._renderer.runners.resolutionChange.add(this), this._renderer.renderableGC.addManagedHash(this, "_gpuText");
2603
+ }
2604
+ resolutionChange() {
2605
+ for (const e in this._gpuText) {
2606
+ const t = this._gpuText[e];
2607
+ if (!t)
2608
+ continue;
2609
+ const r = t.batchableSprite.renderable;
2610
+ r._autoResolution && (r._resolution = this._renderer.resolution, r.onViewUpdate());
2611
+ }
2612
+ }
2613
+ validateRenderable(e) {
2614
+ const t = this._getGpuText(e), r = e._getKey();
2615
+ return t.currentKey !== r;
2616
+ }
2617
+ addRenderable(e, t) {
2618
+ const i = this._getGpuText(e).batchableSprite;
2619
+ e._didTextUpdate && this._updateText(e), this._renderer.renderPipes.batch.addToBatch(i, t);
2620
+ }
2621
+ updateRenderable(e) {
2622
+ const r = this._getGpuText(e).batchableSprite;
2623
+ e._didTextUpdate && this._updateText(e), r._batcher.updateElement(r);
2624
+ }
2625
+ destroyRenderable(e) {
2626
+ e.off("destroyed", this._destroyRenderableBound), this._destroyRenderableById(e.uid);
2627
+ }
2628
+ _destroyRenderableById(e) {
2629
+ const t = this._gpuText[e];
2630
+ this._renderer.canvasText.decreaseReferenceCount(t.currentKey), v.return(t.batchableSprite), this._gpuText[e] = null;
2631
+ }
2632
+ _updateText(e) {
2633
+ const t = e._getKey(), r = this._getGpuText(e), i = r.batchableSprite;
2634
+ r.currentKey !== t && this._updateGpuText(e), e._didTextUpdate = !1, oe(i, e);
2635
+ }
2636
+ _updateGpuText(e) {
2637
+ const t = this._getGpuText(e), r = t.batchableSprite;
2638
+ t.texture && this._renderer.canvasText.decreaseReferenceCount(t.currentKey), t.texture = r.texture = this._renderer.canvasText.getManagedTexture(e), t.currentKey = e._getKey(), r.texture = t.texture;
2639
+ }
2640
+ _getGpuText(e) {
2641
+ return this._gpuText[e.uid] || this.initGpuText(e);
2642
+ }
2643
+ initGpuText(e) {
2644
+ const t = {
2645
+ texture: null,
2646
+ currentKey: "--",
2647
+ batchableSprite: v.get(Ie)
2648
+ };
2649
+ return t.batchableSprite.renderable = e, t.batchableSprite.transform = e.groupTransform, t.batchableSprite.bounds = { minX: 0, maxX: 1, minY: 0, maxY: 0 }, t.batchableSprite.roundPixels = this._renderer._roundPixels | e._roundPixels, this._gpuText[e.uid] = t, e._resolution = e._autoResolution ? this._renderer.resolution : e.resolution, this._updateText(e), e.on("destroyed", this._destroyRenderableBound), t;
2650
+ }
2651
+ destroy() {
2652
+ for (const e in this._gpuText)
2653
+ this._destroyRenderableById(e);
2654
+ this._gpuText = null, this._renderer = null;
2655
+ }
2656
+ }
2657
+ pt.extension = {
2658
+ type: [
2659
+ x.WebGLPipes,
2660
+ x.WebGPUPipes,
2661
+ x.CanvasPipes
2662
+ ],
2663
+ name: "text"
2664
+ };
2665
+ function Ue(a, e, t) {
2666
+ for (let r = 0, i = 4 * t * e; r < e; ++r, i += 4)
2667
+ if (a[i + 3] !== 0)
2668
+ return !1;
2669
+ return !0;
2670
+ }
2671
+ function ke(a, e, t, r, i) {
2672
+ const s = 4 * e;
2673
+ for (let n = r, o = r * s + 4 * t; n <= i; ++n, o += s)
2674
+ if (a[o + 3] !== 0)
2675
+ return !1;
2676
+ return !0;
2677
+ }
2678
+ function Pr(a, e = 1) {
2679
+ const { width: t, height: r } = a, i = a.getContext("2d", {
2680
+ willReadFrequently: !0
2681
+ });
2682
+ if (i === null)
2683
+ throw new TypeError("Failed to get canvas 2D context");
2684
+ const n = i.getImageData(0, 0, t, r).data;
2685
+ let o = 0, d = 0, c = t - 1, h = r - 1;
2686
+ for (; d < r && Ue(n, t, d); )
2687
+ ++d;
2688
+ if (d === r)
2689
+ return ne.EMPTY;
2690
+ for (; Ue(n, t, h); )
2691
+ --h;
2692
+ for (; ke(n, t, o, d, h); )
2693
+ ++o;
2694
+ for (; ke(n, t, c, d, h); )
2695
+ --c;
2696
+ return ++c, ++h, new ne(o / e, d / e, (c - o) / e, (h - d) / e);
2697
+ }
2698
+ class gt {
2699
+ constructor(e) {
2700
+ this._activeTextures = {}, this._renderer = e;
2701
+ }
2702
+ getTextureSize(e, t, r) {
2703
+ const i = D.measureText(e || " ", r);
2704
+ let s = Math.ceil(Math.ceil(Math.max(1, i.width) + r.padding * 2) * t), n = Math.ceil(Math.ceil(Math.max(1, i.height) + r.padding * 2) * t);
2705
+ return s = Math.ceil(s - 1e-6), n = Math.ceil(n - 1e-6), s = _e(s), n = _e(n), { width: s, height: n };
2706
+ }
2707
+ getTexture(e, t, r, i) {
2708
+ typeof e == "string" && (G("8.0.0", "CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"), e = {
2709
+ text: e,
2710
+ style: r,
2711
+ resolution: t
2712
+ }), e.style instanceof E || (e.style = new E(e.style));
2713
+ const { texture: s, canvasAndContext: n } = this.createTextureAndCanvas(
2714
+ e
2715
+ );
2716
+ return this._renderer.texture.initSource(s._source), O.returnCanvasAndContext(n), s;
2717
+ }
2718
+ createTextureAndCanvas(e) {
2719
+ const { text: t, style: r } = e, i = e.resolution ?? this._renderer.resolution, s = D.measureText(t || " ", r), n = Math.ceil(Math.ceil(Math.max(1, s.width) + r.padding * 2) * i), o = Math.ceil(Math.ceil(Math.max(1, s.height) + r.padding * 2) * i), d = O.getOptimalCanvasAndContext(n, o), { canvas: c } = d;
2720
+ this.renderTextToCanvas(t, r, i, d);
2721
+ const h = ft(c, n, o, i);
2722
+ if (r.trim) {
2723
+ const l = Pr(c, i);
2724
+ h.frame.copyFrom(l), h.updateUvs();
2725
+ }
2726
+ return { texture: h, canvasAndContext: d };
2727
+ }
2728
+ getManagedTexture(e) {
2729
+ e._resolution = e._autoResolution ? this._renderer.resolution : e.resolution;
2730
+ const t = e._getKey();
2731
+ if (this._activeTextures[t])
2732
+ return this._increaseReferenceCount(t), this._activeTextures[t].texture;
2733
+ const { texture: r, canvasAndContext: i } = this.createTextureAndCanvas(e);
2734
+ return this._activeTextures[t] = {
2735
+ canvasAndContext: i,
2736
+ texture: r,
2737
+ usageCount: 1
2738
+ }, r;
2739
+ }
2740
+ _increaseReferenceCount(e) {
2741
+ this._activeTextures[e].usageCount++;
2742
+ }
2743
+ /**
2744
+ * Returns a texture that was created wit the above `getTexture` function.
2745
+ * Handy if you are done with a texture and want to return it to the pool.
2746
+ * @param texture - The texture to be returned.
2747
+ */
2748
+ returnTexture(e) {
2749
+ const t = e.source;
2750
+ t.resource = null, t.uploadMethodId = "unknown", t.alphaMode = "no-premultiply-alpha", k.returnTexture(e);
2751
+ }
2752
+ decreaseReferenceCount(e) {
2753
+ const t = this._activeTextures[e];
2754
+ t.usageCount--, t.usageCount === 0 && (O.returnCanvasAndContext(t.canvasAndContext), this.returnTexture(t.texture), this._activeTextures[e] = null);
2755
+ }
2756
+ getReferenceCount(e) {
2757
+ return this._activeTextures[e].usageCount;
2758
+ }
2759
+ /**
2760
+ * Renders text to its canvas, and updates its texture.
2761
+ *
2762
+ * By default this is used internally to ensure the texture is correct before rendering,
2763
+ * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,
2764
+ * and then shared across multiple Sprites.
2765
+ * @param text
2766
+ * @param style
2767
+ * @param resolution
2768
+ * @param canvasAndContext
2769
+ */
2770
+ renderTextToCanvas(e, t, r, i) {
2771
+ var w, b, y, B;
2772
+ const { canvas: s, context: n } = i, o = se(t), d = D.measureText(e || " ", t), c = d.lines, h = d.lineHeight, l = d.lineWidths, u = d.maxLineWidth, g = d.fontProperties, p = s.height;
2773
+ if (n.resetTransform(), n.scale(r, r), n.textBaseline = t.textBaseline, (w = t._stroke) != null && w.width) {
2774
+ const C = t._stroke;
2775
+ n.lineWidth = C.width, n.miterLimit = C.miterLimit, n.lineJoin = C.join, n.lineCap = C.cap;
2776
+ }
2777
+ n.font = o;
2778
+ let f, m;
2779
+ const _ = t.dropShadow ? 2 : 1;
2780
+ for (let C = 0; C < _; ++C) {
2781
+ const z = t.dropShadow && C === 0, P = z ? Math.ceil(Math.max(1, p) + t.padding * 2) : 0, V = P * r;
2782
+ if (z) {
2783
+ n.fillStyle = "black", n.strokeStyle = "black";
2784
+ const T = t.dropShadow, Z = T.color, mt = T.alpha;
2785
+ n.shadowColor = M.shared.setValue(Z).setAlpha(mt).toRgbaString();
2786
+ const xt = T.blur * r, me = T.distance * r;
2787
+ n.shadowBlur = xt, n.shadowOffsetX = Math.cos(T.angle) * me, n.shadowOffsetY = Math.sin(T.angle) * me + V;
2788
+ } else {
2789
+ if (n.fillStyle = t._fill ? Q(t._fill, n, d) : null, (b = t._stroke) != null && b.width) {
2790
+ const T = t._stroke.width * t._stroke.alignment;
2791
+ n.strokeStyle = Q(t._stroke, n, d, T);
2792
+ }
2793
+ n.shadowColor = "black";
2794
+ }
2795
+ let Y = (h - g.fontSize) / 2;
2796
+ h - g.fontSize < 0 && (Y = 0);
2797
+ const H = ((y = t._stroke) == null ? void 0 : y.width) ?? 0;
2798
+ for (let T = 0; T < c.length; T++)
2799
+ f = H / 2, m = H / 2 + T * h + g.ascent + Y, t.align === "right" ? f += u - l[T] : t.align === "center" && (f += (u - l[T]) / 2), (B = t._stroke) != null && B.width && this._drawLetterSpacing(
2800
+ c[T],
2801
+ t,
2802
+ i,
2803
+ f + t.padding,
2804
+ m + t.padding - P,
2805
+ !0
2806
+ ), t._fill !== void 0 && this._drawLetterSpacing(
2807
+ c[T],
2808
+ t,
2809
+ i,
2810
+ f + t.padding,
2811
+ m + t.padding - P
2812
+ );
2813
+ }
2814
+ }
2815
+ /**
2816
+ * Render the text with letter-spacing.
2817
+ * @param text - The text to draw
2818
+ * @param style
2819
+ * @param canvasAndContext
2820
+ * @param x - Horizontal position to draw the text
2821
+ * @param y - Vertical position to draw the text
2822
+ * @param isStroke - Is this drawing for the outside stroke of the
2823
+ * text? If not, it's for the inside fill
2824
+ */
2825
+ _drawLetterSpacing(e, t, r, i, s, n = !1) {
2826
+ const { context: o } = r, d = t.letterSpacing;
2827
+ let c = !1;
2828
+ if (D.experimentalLetterSpacingSupported && (D.experimentalLetterSpacing ? (o.letterSpacing = `${d}px`, o.textLetterSpacing = `${d}px`, c = !0) : (o.letterSpacing = "0px", o.textLetterSpacing = "0px")), d === 0 || c) {
2829
+ n ? o.strokeText(e, i, s) : o.fillText(e, i, s);
2830
+ return;
2831
+ }
2832
+ let h = i;
2833
+ const l = D.graphemeSegmenter(e);
2834
+ let u = o.measureText(e).width, g = 0;
2835
+ for (let p = 0; p < l.length; ++p) {
2836
+ const f = l[p];
2837
+ n ? o.strokeText(f, h, s) : o.fillText(f, h, s);
2838
+ let m = "";
2839
+ for (let _ = p + 1; _ < l.length; ++_)
2840
+ m += l[_];
2841
+ g = o.measureText(m).width, h += u - g + d, u = g;
2842
+ }
2843
+ }
2844
+ destroy() {
2845
+ this._activeTextures = null;
2846
+ }
2847
+ }
2848
+ gt.extension = {
2849
+ type: [
2850
+ x.WebGLSystem,
2851
+ x.WebGPUSystem,
2852
+ x.CanvasSystem
2853
+ ],
2854
+ name: "canvasText"
2855
+ };
2856
+ S.add(Ee);
2857
+ S.add(Le);
2858
+ S.add(et);
2859
+ S.add(Wt);
2860
+ S.add(it);
2861
+ S.add(nt);
2862
+ S.add(at);
2863
+ S.add(gt);
2864
+ S.add(pt);
2865
+ S.add(ht);
2866
+ S.add(ge);
2867
+ S.add(ut);
2868
+ S.add(ct);
2869
+ S.add(lt);
2870
+ S.add(Ke);
2871
+ S.add(je);