@kolkrabbi/design-editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/OrbitControls-BAhLQ5d8.js +11630 -0
  4. package/dist/design-editor.css +3 -0
  5. package/dist/design-editor.js +63602 -0
  6. package/dist/favicon/favicon.svg +12 -0
  7. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Black.woff2 +0 -0
  8. package/dist/fonts/Right-Grotesk/PPRightGrotesk-BlackItalic.woff2 +0 -0
  9. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Bold.woff2 +0 -0
  10. package/dist/fonts/Right-Grotesk/PPRightGrotesk-BoldItalic.woff2 +0 -0
  11. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlack.woff2 +0 -0
  12. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBlackItalic.woff2 +0 -0
  13. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBold.woff2 +0 -0
  14. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactBoldItalic.woff2 +0 -0
  15. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDark.woff2 +0 -0
  16. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactDarkItalic.woff2 +0 -0
  17. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFine.woff2 +0 -0
  18. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactFineItalic.woff2 +0 -0
  19. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLight.woff2 +0 -0
  20. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactLightItalic.woff2 +0 -0
  21. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMedium.woff2 +0 -0
  22. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactMediumItalic.woff2 +0 -0
  23. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegular.woff2 +0 -0
  24. package/dist/fonts/Right-Grotesk/PPRightGrotesk-CompactRegularItalic.woff2 +0 -0
  25. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Dark.woff2 +0 -0
  26. package/dist/fonts/Right-Grotesk/PPRightGrotesk-DarkItalic.woff2 +0 -0
  27. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Fine.woff2 +0 -0
  28. package/dist/fonts/Right-Grotesk/PPRightGrotesk-FineItalic.woff2 +0 -0
  29. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Light.woff2 +0 -0
  30. package/dist/fonts/Right-Grotesk/PPRightGrotesk-LightItalic.woff2 +0 -0
  31. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Medium.woff2 +0 -0
  32. package/dist/fonts/Right-Grotesk/PPRightGrotesk-MediumItalic.woff2 +0 -0
  33. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlack.woff2 +0 -0
  34. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBlackItalic.woff2 +0 -0
  35. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBold.woff2 +0 -0
  36. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowBoldItalic.woff2 +0 -0
  37. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDark.woff2 +0 -0
  38. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowDarkItalic.woff2 +0 -0
  39. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFine.woff2 +0 -0
  40. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowFineItalic.woff2 +0 -0
  41. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLight.woff2 +0 -0
  42. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowLightItalic.woff2 +0 -0
  43. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMedium.woff2 +0 -0
  44. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowMediumItalic.woff2 +0 -0
  45. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegular.woff2 +0 -0
  46. package/dist/fonts/Right-Grotesk/PPRightGrotesk-NarrowRegularItalic.woff2 +0 -0
  47. package/dist/fonts/Right-Grotesk/PPRightGrotesk-Regular.woff2 +0 -0
  48. package/dist/fonts/Right-Grotesk/PPRightGrotesk-RegularItalic.woff2 +0 -0
  49. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlack.woff2 +0 -0
  50. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBlackItalic.woff2 +0 -0
  51. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBold.woff2 +0 -0
  52. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialBoldItalic.woff2 +0 -0
  53. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDark.woff2 +0 -0
  54. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialDarkItalic.woff2 +0 -0
  55. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFine.woff2 +0 -0
  56. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialFineItalic.woff2 +0 -0
  57. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLight.woff2 +0 -0
  58. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialLightItalic.woff2 +0 -0
  59. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMedium.woff2 +0 -0
  60. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialMediumItalic.woff2 +0 -0
  61. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegular.woff2 +0 -0
  62. package/dist/fonts/Right-Grotesk/PPRightGrotesk-SpatialRegularItalic.woff2 +0 -0
  63. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlack.woff2 +0 -0
  64. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBlackItalic.woff2 +0 -0
  65. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBold.woff2 +0 -0
  66. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallBoldItalic.woff2 +0 -0
  67. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDark.woff2 +0 -0
  68. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallDarkItalic.woff2 +0 -0
  69. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFine.woff2 +0 -0
  70. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallFineItalic.woff2 +0 -0
  71. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLight.woff2 +0 -0
  72. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallLightItalic.woff2 +0 -0
  73. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMedium.woff2 +0 -0
  74. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallMediumItalic.woff2 +0 -0
  75. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegular.woff2 +0 -0
  76. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TallRegularItalic.woff2 +0 -0
  77. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlack.woff2 +0 -0
  78. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBlackItalic.woff2 +0 -0
  79. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBold.woff2 +0 -0
  80. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightBoldItalic.woff2 +0 -0
  81. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDark.woff2 +0 -0
  82. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightDarkItalic.woff2 +0 -0
  83. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFine.woff2 +0 -0
  84. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightFineItalic.woff2 +0 -0
  85. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLight.woff2 +0 -0
  86. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightLightItalic.woff2 +0 -0
  87. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMedium.woff2 +0 -0
  88. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightMediumItalic.woff2 +0 -0
  89. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegular.woff2 +0 -0
  90. package/dist/fonts/Right-Grotesk/PPRightGrotesk-TightRegularItalic.woff2 +0 -0
  91. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlack.woff2 +0 -0
  92. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBlackItalic.woff2 +0 -0
  93. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBold.woff2 +0 -0
  94. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideBoldItalic.woff2 +0 -0
  95. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDark.woff2 +0 -0
  96. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideDarkItalic.woff2 +0 -0
  97. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFine.woff2 +0 -0
  98. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideFineItalic.woff2 +0 -0
  99. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLight.woff2 +0 -0
  100. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideLightItalic.woff2 +0 -0
  101. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMedium.woff2 +0 -0
  102. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideMediumItalic.woff2 +0 -0
  103. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegular.woff2 +0 -0
  104. package/dist/fonts/Right-Grotesk/PPRightGrotesk-WideRegularItalic.woff2 +0 -0
  105. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Bold.woff2 +0 -0
  106. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-BoldItalic.woff2 +0 -0
  107. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Dark.woff2 +0 -0
  108. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Fine.woff2 +0 -0
  109. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-FineItalic.woff2 +0 -0
  110. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Light.woff2 +0 -0
  111. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Medium.woff2 +0 -0
  112. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-Regular.woff2 +0 -0
  113. package/dist/fonts/Right-Grotesk-Mono/PPRightGroteskMono-RegularItalic.woff2 +0 -0
  114. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLight.woff2 +0 -0
  115. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactLightItalic.woff2 +0 -0
  116. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMedium.woff2 +0 -0
  117. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-CompactMediumItalic.woff2 +0 -0
  118. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-Regular.woff2 +0 -0
  119. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-RegularItalic.woff2 +0 -0
  120. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBold.woff2 +0 -0
  121. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialBoldItalic.woff2 +0 -0
  122. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLight.woff2 +0 -0
  123. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-SpatialLightItalic.woff2 +0 -0
  124. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBold.woff2 +0 -0
  125. package/dist/fonts/Right-Grotesk-Text/PPRightGroteskText-WideBoldItalic.woff2 +0 -0
  126. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Black.ttf +0 -0
  127. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BlackItalic.ttf +0 -0
  128. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Bold.ttf +0 -0
  129. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-BoldItalic.ttf +0 -0
  130. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlack.ttf +0 -0
  131. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBlackItalic.ttf +0 -0
  132. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBold.ttf +0 -0
  133. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactBoldItalic.ttf +0 -0
  134. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDark.ttf +0 -0
  135. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactDarkItalic.ttf +0 -0
  136. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFine.ttf +0 -0
  137. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactFineItalic.ttf +0 -0
  138. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLight.ttf +0 -0
  139. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactLightItalic.ttf +0 -0
  140. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMedium.ttf +0 -0
  141. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactMediumItalic.ttf +0 -0
  142. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegular.ttf +0 -0
  143. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-CompactRegularItalic.ttf +0 -0
  144. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Dark.ttf +0 -0
  145. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-DarkItalic.ttf +0 -0
  146. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Fine.ttf +0 -0
  147. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-FineItalic.ttf +0 -0
  148. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Light.ttf +0 -0
  149. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-LightItalic.ttf +0 -0
  150. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Medium.ttf +0 -0
  151. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-MediumItalic.ttf +0 -0
  152. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlack.ttf +0 -0
  153. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBlackItalic.ttf +0 -0
  154. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBold.ttf +0 -0
  155. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowBoldItalic.ttf +0 -0
  156. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDark.ttf +0 -0
  157. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowDarkItalic.ttf +0 -0
  158. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFine.ttf +0 -0
  159. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowFineItalic.ttf +0 -0
  160. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLight.ttf +0 -0
  161. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowLightItalic.ttf +0 -0
  162. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMedium.ttf +0 -0
  163. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowMediumItalic.ttf +0 -0
  164. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegular.ttf +0 -0
  165. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-NarrowRegularItalic.ttf +0 -0
  166. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-Regular.ttf +0 -0
  167. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-RegularItalic.ttf +0 -0
  168. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlack.ttf +0 -0
  169. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBlackItalic.ttf +0 -0
  170. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBold.ttf +0 -0
  171. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialBoldItalic.ttf +0 -0
  172. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDark.ttf +0 -0
  173. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialDarkItalic.ttf +0 -0
  174. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFine.ttf +0 -0
  175. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialFineItalic.ttf +0 -0
  176. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLight.ttf +0 -0
  177. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialLightItalic.ttf +0 -0
  178. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMedium.ttf +0 -0
  179. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialMediumItalic.ttf +0 -0
  180. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegular.ttf +0 -0
  181. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-SpatialRegularItalic.ttf +0 -0
  182. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlack.ttf +0 -0
  183. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBlackItalic.ttf +0 -0
  184. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBold.ttf +0 -0
  185. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallBoldItalic.ttf +0 -0
  186. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDark.ttf +0 -0
  187. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallDarkItalic.ttf +0 -0
  188. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFine.ttf +0 -0
  189. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallFineItalic.ttf +0 -0
  190. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLight.ttf +0 -0
  191. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallLightItalic.ttf +0 -0
  192. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMedium.ttf +0 -0
  193. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallMediumItalic.ttf +0 -0
  194. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegular.ttf +0 -0
  195. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TallRegularItalic.ttf +0 -0
  196. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlack.ttf +0 -0
  197. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBlackItalic.ttf +0 -0
  198. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBold.ttf +0 -0
  199. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightBoldItalic.ttf +0 -0
  200. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDark.ttf +0 -0
  201. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightDarkItalic.ttf +0 -0
  202. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFine.ttf +0 -0
  203. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightFineItalic.ttf +0 -0
  204. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLight.ttf +0 -0
  205. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightLightItalic.ttf +0 -0
  206. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMedium.ttf +0 -0
  207. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightMediumItalic.ttf +0 -0
  208. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegular.ttf +0 -0
  209. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-TightRegularItalic.ttf +0 -0
  210. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlack.ttf +0 -0
  211. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBlackItalic.ttf +0 -0
  212. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBold.ttf +0 -0
  213. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideBoldItalic.ttf +0 -0
  214. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDark.ttf +0 -0
  215. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideDarkItalic.ttf +0 -0
  216. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFine.ttf +0 -0
  217. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideFineItalic.ttf +0 -0
  218. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLight.ttf +0 -0
  219. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideLightItalic.ttf +0 -0
  220. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMedium.ttf +0 -0
  221. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideMediumItalic.ttf +0 -0
  222. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegular.ttf +0 -0
  223. package/dist/fonts/Right-Grotesk-ttf/PPRightGrotesk-WideRegularItalic.ttf +0 -0
  224. package/dist/fonts/TG/TGGullhamrarVF.ttf +0 -0
  225. package/dist/fonts/TG/TGMalromurRomanVF.ttf +0 -0
  226. package/dist/fonts/TG/TGRotVF.ttf +0 -0
  227. package/dist/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
  228. package/dist/fonts/jetbrains-mono/JetBrainsMono-MediumItalic.woff2 +0 -0
  229. package/dist/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
  230. package/dist/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
  231. package/dist/host-Cidlc8xP.js +718 -0
  232. package/dist/host-IfZgcJFg.js +2405 -0
  233. package/dist/meshPalettes-BJODHYrY.js +892 -0
  234. package/package.json +63 -0
@@ -0,0 +1,2405 @@
1
+ import { C as e, S as t, _ as n, a as r, b as i, c as a, f as o, g as s, h as c, l, m as u, p as d, r as f, s as p, u as m, y as h } from "./meshPalettes-BJODHYrY.js";
2
+ import { $ as g, A as _, B as v, C as y, E as b, F as ee, G as x, H as te, I as ne, J as re, K as S, L as ie, M as ae, N as C, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as fe, W as w, X as pe, Y as me, Z as he, _ as ge, a as _e, at as T, b as ve, c as E, et as D, f as ye, g as O, h as be, i as xe, it as k, j as Se, k as A, l as Ce, m as we, n as Te, nt as j, o as M, ot as Ee, p as N, q as De, r as Oe, rt as ke, s as P, t as F, tt as I, u as Ae, v as L, w as je, x as R, y as Me, z } from "./OrbitControls-BAhLQ5d8.js";
3
+ //#region src/loops/gl/DriftEngine.js
4
+ var Ne = {
5
+ clouds: 0,
6
+ cirrus: 1,
7
+ aurora: 2,
8
+ waves: 0,
9
+ ripples: 1,
10
+ caustics: 2,
11
+ folds: 0,
12
+ flag: 1,
13
+ drape: 2
14
+ }, Pe = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Fe = "\n precision highp float;\n varying vec2 vUv;\n uniform float uPhase, uAspect;\n uniform float uScale, uWarp, uEvolve, uGust, uContrast, uCoverage, uSoft, uSheen, uGrain;\n uniform float uAmp, uChop, uFoam, uFold, uDrape, uSway;\n uniform vec2 uFlow, uLight; // direction vectors (unit)\n uniform int uStyle;\n uniform vec3 uColors[5];\n uniform vec3 uBase;\n", Ie = "\n const float TAU = 6.28318530718;\n \n vec4 mod289(vec4 x){ return x - floor(x*(1.0/289.0))*289.0; }\n float mod289(float x){ return x - floor(x*(1.0/289.0))*289.0; }\n vec4 permute(vec4 x){ return mod289(((x*34.0)+1.0)*x); }\n float permute(float x){ return mod289(((x*34.0)+1.0)*x); }\n vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314*r; }\n float taylorInvSqrt(float r){ return 1.79284291400159 - 0.85373472095314*r; }\n vec4 grad4(float j, vec4 ip){\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n p.xyz = floor( fract(vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n return p;\n }\n float snoise(vec4 v){\n const vec4 C = vec4(0.138196601125011, 0.276393202250021, 0.414589803375032, -0.447213595499958);\n vec4 i = floor(v + dot(v, vec4(0.309016994374947451)) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute(\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0);\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2,p2), dot(p3,p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)), 0.0);\n m0 = m0*m0; m1 = m1*m1;\n return 49.0 * ( dot(m0*m0, vec3(dot(p0,x0), dot(p1,x1), dot(p2,x2)))\n + dot(m1*m1, vec2(dot(p3,x3), dot(p4,x4))) );\n }\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\n // noise sampled on a circle in (z,w) → perfectly periodic in phase.\n float loopNoise(vec2 p, float ph, float r){\n float a = TAU * ph;\n return snoise(vec4(p, r * cos(a), r * sin(a)));\n }\n float lfbm(vec2 p, float ph, float r){\n float v = 0.0, amp = 0.5;\n for (int i = 0; i < 4; i++){ v += amp * loopNoise(p, ph, r); p *= 2.02; amp *= 0.5; r *= 1.7; }\n return v;\n }\n vec3 ramp(float t){\n float ft = clamp(t, 0.0, 1.0) * 4.0; // 5 stops → 4 segments\n int i = int(floor(ft));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(ft));\n }\n // loop-safe grain: seeded off the same phase circle so it closes too.\n float grain(float ph){ return hash(vUv * vec2(1920.0, 1080.0) + (0.5 + 0.5*cos(TAU*ph)) * 13.0) - 0.5; }\n", Le = {
15
+ air: Fe + Ie + "\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n vec2 gust = uFlow * sin(TAU * ph) * uGust; // directional sway, loop-safe\n\n float f; float sheen = 0.0;\n if (uStyle == 1) {\n vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25) * uScale + gust; // cirrus\n f = lfbm(ps, ph, uEvolve);\n } else if (uStyle == 2) {\n vec2 sp = p * uScale + gust; // aurora\n float band = sp.x * 1.6 + 0.6 * lfbm(vec2(sp.y * 1.2, 0.0), ph, uEvolve);\n f = sin(band * 3.14159) * 0.5 + 0.4 * lfbm(sp, ph, uEvolve);\n } else {\n vec2 sp = p * 0.62 * uScale + gust; // clouds (domain-warped)\n vec2 q = vec2(lfbm(sp + vec2(0.0, 1.3), ph, uEvolve), lfbm(sp + vec2(5.2, 1.3), ph, uEvolve));\n vec2 r = vec2(lfbm(sp + uWarp * q + vec2(1.7, 9.2), ph, uEvolve),\n lfbm(sp + uWarp * q + vec2(8.3, 2.8), ph, uEvolve));\n f = lfbm(sp + uWarp * r, ph, uEvolve);\n sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);\n }\n\n float d = clamp(f * 0.5 + 0.5, 0.0, 1.0);\n vec3 cloudCol = ramp(d);\n float edge = mix(0.04, 0.6, uSoft);\n float lo = 1.0 - uCoverage;\n float cov = smoothstep(lo, lo + edge, d);\n vec3 col = mix(uBase, cloudCol, cov);\n col += sheen * uSheen * 0.18 * cov;\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
16
+ water: Fe + Ie + "\n // height field — directional swells (integer cycles/loop) + looped ripple.\n float waterH(vec2 p, float ph, float scl){\n vec2 d1 = normalize(uFlow + vec2(0.0001));\n vec2 d2 = normalize(vec2(-d1.y, d1.x) * 0.7 + d1 * 0.3);\n float k = uScale * scl;\n float a = uAmp;\n float v = 0.0;\n v += a * sin(dot(p, d1) * 2.2 * k + TAU * ph * 2.0);\n v += a * 0.55 * sin(dot(p, d2) * 3.6 * k + TAU * ph * 3.0);\n v += a * 0.30 * sin(dot(p, normalize(d1 + d2)) * 6.0 * k + TAU * ph * 5.0);\n v += uChop * 0.35 * lfbm(p * 3.0 * k, ph, uEvolve);\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n\n if (uStyle == 2) { // caustics — ridged looped-noise veins over deep water\n float c = pow(1.0 - abs(lfbm(p * 2.4 * uScale, ph, uEvolve)), 6.0)\n + 0.6 * pow(1.0 - abs(lfbm(p * 4.8 * uScale + vec2(3.0), ph, uEvolve)), 8.0);\n c *= uChop + 0.5;\n vec3 col = ramp(clamp(0.3 + c * 0.7, 0.0, 1.0));\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n return;\n }\n\n float scl = (uStyle == 1) ? 2.2 : 1.0; // ripples = higher frequency\n float e = 0.0022;\n float hC = waterH(p, ph, scl);\n float hX = waterH(p + vec2(e, 0.0), ph, scl);\n float hY = waterH(p + vec2(0.0, e), ph, scl);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 8.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.8, 0.6));\n vec3 V = vec3(0.0, 0.0, 1.0);\n float spec = pow(max(dot(reflect(-L, n), V), 0.0), 40.0) * uSheen;\n float fres = pow(1.0 - max(n.z, 0.0), 3.0);\n\n float t = clamp(0.5 + hC * 0.6, 0.0, 1.0);\n vec3 col = mix(ramp(t), uBase, fres * 0.6); // sky reflection at grazing\n col += spec;\n float slope = clamp(length(vec2(hC - hX, hC - hY)) * 120.0, 0.0, 1.0);\n float foam = smoothstep(1.0 - uFoam, 1.0, max(slope, t * 0.8));\n col = mix(col, vec3(0.95), foam * uFoam);\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n",
17
+ cloth: Fe + Ie + "\n float clothH(vec2 p, float ph){\n vec2 fd = normalize(uFlow + vec2(0.0001)); // fold direction\n vec2 pd = vec2(-fd.y, fd.x);\n float k = uScale;\n float sway = uSway * sin(TAU * ph);\n float v = uFold * sin(dot(p, pd) * 5.0 * k + sway * 2.0 + 0.6 * lfbm(p * 1.5 * k, ph, uEvolve));\n if (uStyle == 1) v += uFold * 0.7 * sin(dot(p, fd) * 4.0 * k + TAU * ph * 2.0); // flag travel\n if (uStyle == 2) v += uDrape * sin(p.y * 3.0 * k + TAU * ph) * (0.5 + 0.5 * p.y); // drape sag\n v += uDrape * 0.30 * lfbm(p * 4.0 * k, ph, uEvolve); // wrinkle\n return v;\n }\n void main(){\n vec2 p = vUv * 2.0 - 1.0; p.x *= uAspect;\n float ph = uPhase;\n float e = 0.0025;\n float hC = clothH(p, ph);\n float hX = clothH(p + vec2(e, 0.0), ph);\n float hY = clothH(p + vec2(0.0, e), ph);\n vec3 n = normalize(vec3(hC - hX, hC - hY, e * 6.0));\n\n vec3 L = normalize(vec3(normalize(uLight + vec2(0.0001)) * 0.9, 0.5));\n float diff = 0.5 + 0.5 * dot(n, L);\n float sheen = pow(1.0 - abs(dot(n, L)), 3.0) * uSheen; // anisotropic satin rim\n vec3 col = ramp(clamp(diff, 0.0, 1.0));\n col += sheen * 0.5;\n col *= mix(1.0, 0.7, smoothstep(0.0, -uFold, hC)); // valley self-shadow\n col = clamp((col - 0.5) * uContrast + 0.5, 0.0, 1.0);\n col += grain(ph) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n"
18
+ }, B = (e) => {
19
+ let t = parseInt(e.slice(1), 16);
20
+ return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
21
+ }, Re = class {
22
+ constructor(e = "air") {
23
+ this.family = e, this.renderer = null, this.time = 0, this.period = 8, this.playing = !0, this.speed = 1;
24
+ }
25
+ init(e) {
26
+ this.renderer = new T({
27
+ canvas: e,
28
+ antialias: !0,
29
+ preserveDrawingBuffer: !0
30
+ }), this.scene = new w(), this.cam = new E();
31
+ let n = t[this.family][0];
32
+ this.uniforms = {
33
+ uPhase: { value: 0 },
34
+ uAspect: { value: 1 },
35
+ uScale: { value: 1 },
36
+ uWarp: { value: 1.6 },
37
+ uEvolve: { value: .16 },
38
+ uGust: { value: .25 },
39
+ uContrast: { value: 1.1 },
40
+ uCoverage: { value: .6 },
41
+ uSoft: { value: .6 },
42
+ uSheen: { value: .6 },
43
+ uGrain: { value: .03 },
44
+ uAmp: { value: .8 },
45
+ uChop: { value: .5 },
46
+ uFoam: { value: .3 },
47
+ uFold: { value: .7 },
48
+ uDrape: { value: .5 },
49
+ uSway: { value: .5 },
50
+ uFlow: { value: new I(1, 0) },
51
+ uLight: { value: new I(.7, .7) },
52
+ uStyle: { value: 0 },
53
+ uColors: { value: n.cols.map(B) },
54
+ uBase: { value: B(n.base) }
55
+ }, this.mat = new S({
56
+ vertexShader: Pe,
57
+ fragmentShader: Le[this.family],
58
+ uniforms: this.uniforms
59
+ }), this.scene.add(new A(new v(2, 2), this.mat));
60
+ }
61
+ resize(e, t) {
62
+ this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
63
+ }
64
+ setParams(t) {
65
+ if (!this.uniforms) return;
66
+ let n = this.uniforms;
67
+ if (t.freq != null && (n.uScale.value = t.freq), t.warp != null && (n.uWarp.value = t.warp), t.evolve != null && (n.uEvolve.value = t.evolve), t.wind != null && (n.uGust.value = t.wind), t.contrast != null && (n.uContrast.value = t.contrast), t.coverage != null && (n.uCoverage.value = t.coverage), t.soft != null && (n.uSoft.value = t.soft), t.sheen != null && (n.uSheen.value = t.sheen), t.grain != null && (n.uGrain.value = t.grain), t.amp != null && (n.uAmp.value = t.amp), t.chop != null && (n.uChop.value = t.chop), t.foam != null && (n.uFoam.value = t.foam), t.fold != null && (n.uFold.value = t.fold), t.drape != null && (n.uDrape.value = t.drape), t.sway != null && (n.uSway.value = t.sway), t.direction != null) {
68
+ let e = t.direction * Math.PI / 180;
69
+ n.uFlow.value.set(Math.cos(e), Math.sin(e));
70
+ }
71
+ if (t.light != null) {
72
+ let e = t.light * Math.PI / 180;
73
+ n.uLight.value.set(Math.cos(e), Math.sin(e));
74
+ }
75
+ if (t.period != null && (this.period = t.period), t.speed != null && (this.speed = t.speed), t.style != null && (n.uStyle.value = Ne[t.style] ?? 0), t.palette != null) {
76
+ let r = e(this.family, t.palette);
77
+ n.uColors.value = r.cols.map(B), n.uBase.value = B(r.base);
78
+ }
79
+ }
80
+ setPlaying(e) {
81
+ this.playing = e;
82
+ }
83
+ frame(e) {
84
+ if (!this.renderer) return;
85
+ this.playing && (this.time += e * this.speed);
86
+ let t = this.period || 8, n = this.time % t / t;
87
+ n < 0 && (n += 1), this.uniforms.uPhase.value = n, this.renderer.render(this.scene, this.cam);
88
+ }
89
+ resetTime() {
90
+ this.time = 0, this.uniforms.uPhase.value = 0, this.renderer && this.renderer.render(this.scene, this.cam);
91
+ }
92
+ renderAtPhase(e) {
93
+ if (!this.renderer) return;
94
+ let t = e % 1;
95
+ t < 0 && (t += 1), this.uniforms.uPhase.value = t, this.renderer.render(this.scene, this.cam);
96
+ }
97
+ exportBlob(e, t) {
98
+ return new Promise((n) => {
99
+ if (!this.renderer) return n(null);
100
+ let r = {
101
+ w: this.renderer.domElement.width,
102
+ h: this.renderer.domElement.height
103
+ };
104
+ this.resize(e, t), this.renderer.render(this.scene, this.cam), this.renderer.domElement.toBlob((e) => {
105
+ this.resize(r.w, r.h), n(e);
106
+ }, "image/png");
107
+ });
108
+ }
109
+ destroy() {
110
+ this.renderer &&= (this.renderer.dispose(), null);
111
+ }
112
+ }, ze = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Be = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uSize, uSpread, uIrid, uHue, uSheen, uGloss;\n uniform float uRelief, uWarp, uGrain, uSpectral, uAngle, uFreq;\n uniform float uWinds, uPitch, uPetals, uSpin, uMouth;\n uniform int uCat, uType, uCount;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n vec3 poleColor(int i){\n int idx = i < 5 ? i : 4;\n return mix(uColors[idx], spectral(uHue + float(i) * 0.18), uSpectral);\n }\n\n // Shared surface lighting: soft key light + broad glossy specular + rim lift.\n vec3 applyLight(vec3 col, vec3 n){\n vec3 viewDir = vec3(0.0, 0.0, 1.0);\n vec3 L = normalize(vec3(0.35, 0.55, 0.85));\n vec3 H = normalize(L + viewDir);\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n col *= 0.58 + 0.42 * max(dot(n, L), 0.0);\n col += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n col += col * fres * 0.35;\n return col;\n }\n\n vec2 blobPos(int i){\n float fi = float(i);\n return vec2(sin(uTime*0.30 + fi*2.10)*uSpread,\n cos(uTime*0.26 + fi*1.70)*uSpread*0.82);\n }\n float field(vec2 q){\n float s = 0.0;\n for(int i=0;i<6;i++){\n if(i>=uCount) break;\n vec2 d = q - blobPos(i);\n s += (uSize*uSize) / (dot(d,d) + 0.0009);\n }\n return s;\n }\n float heightOf(float v){ return smoothstep(0.65, 3.2, v); }\n\n vec4 blobLayer(vec2 q){\n float e = 0.014;\n float h = heightOf(field(q));\n float hx = heightOf(field(q + vec2(e, 0.0)));\n float hy = heightOf(field(q + vec2(0.0, e)));\n vec2 g = vec2(hx - h, hy - h) / e;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.25 + (n.x * 0.5 + 0.5) * 0.55 + h * 0.45) + uTime * 0.018;\n return vec4(applyLight(tint(ci), n), smoothstep(0.015, 0.22, h));\n }\n\n vec3 coreGlow(vec2 q){\n float d = length(q);\n float m = smoothstep(uMouth * 1.25, 0.0, d);\n vec3 n = normalize(vec3(-q * 1.6, 1.0));\n float ci = uHue + uIrid * ((q.x * 0.5 + 0.5) * 0.6 + d * 0.6) + uTime * 0.05;\n return applyLight(tint(ci), n) * m;\n }\n\n vec3 spiralLayer(vec2 c){\n float r = length(c) + 1e-4;\n float ang = atan(c.y, c.x);\n float scallop = 0.07 * sin(ang * uPetals + uTime * 0.1);\n float sp = ang * (uWinds * 0.159155) + log(r) * uPitch + scallop - uTime * 0.15 * uSpin;\n float cell = fract(sp);\n float fid = floor(sp);\n float bump = sin(cell * 3.14159);\n float seam = smoothstep(0.0, 0.10, cell) * smoothstep(1.0, 0.90, cell);\n vec2 gdir = (uWinds * 0.159155) * vec2(-c.y, c.x) / (r * r) + uPitch * c / (r * r);\n float slope = cos(cell * 3.14159) * 3.14159;\n vec3 n = normalize(vec3(-gdir * slope * uRelief * 0.05, 1.0));\n float ci = uHue + uIrid * 0.5 * (fid * 0.10 + (n.x * 0.5 + 0.5) * 0.5);\n vec3 plate = applyLight(tint(ci), n) * (0.35 + 0.65 * bump);\n plate = mix(uBg, plate, seam);\n float mouth = smoothstep(0.0, uMouth, r);\n return mix(uBg, plate, mouth) + coreGlow(c) * (1.0 - mouth * 0.6);\n }\n\n // ── Field — flat colour gradients ──\n vec3 fieldCol(vec2 q, vec2 p){\n float s;\n vec2 dir = vec2(cos(uAngle), sin(uAngle));\n if (uType == 0) s = clamp(dot(q, dir) * 0.6 + 0.5, 0.0, 1.0); // linear\n else if (uType == 1) { float x = dot(q, dir) * uFreq - uTime * 0.1 * uSpin; s = abs(fract(x) * 2.0 - 1.0); } // stripe\n else if (uType == 2) s = clamp(length(q) * uFreq * 0.6, 0.0, 1.0); // radial\n else s = fract(atan(q.y, q.x) * 0.159155 + 0.5 + uAngle * 0.159155 - uTime * 0.05 * uSpin); // conic\n vec3 col = tint(uHue + s * uIrid);\n col *= mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.22); // soft vignette\n return col;\n }\n\n // ── Pole — influence fields ──\n vec3 poleCol(vec2 q){\n if (uType == 0) { // monopole\n vec2 src = vec2(sin(uTime * 0.2) * uSpread, cos(uTime * 0.17) * uSpread);\n float d = length(q - src);\n float infl = 1.0 / (1.0 + d * d * uFreq * 1.5);\n return tint(uHue + (1.0 - infl) * uIrid) + infl * infl * uSheen * 0.4;\n } else if (uType == 1) { // multipole (inverse-distance blend)\n vec3 acc = vec3(0.0); float wsum = 0.0;\n for (int i = 0; i < 5; i++) {\n if (i >= uCount) break;\n vec2 pp = blobPos(i);\n float d = distance(q, pp);\n float w = 1.0 / (d * d + 0.02);\n acc += poleColor(i) * w; wsum += w;\n }\n vec3 col = acc / max(wsum, 1e-4);\n float sh = pow(max(0.0, 0.5 + 0.5 * sin((q.x + q.y) * 3.1416 - uTime * 0.2)), 3.0);\n return col + sh * uSheen * 0.2;\n } else if (uType == 2) { // bilinear mesh (4 palette corners)\n vec2 g = clamp(q * 0.5 + 0.5, 0.0, 1.0);\n return mix(mix(poleColor(0), poleColor(1), g.x), mix(poleColor(2), poleColor(3), g.x), g.y);\n } else { // aurora — domain-warped fbm\n vec2 sp = q * 0.7;\n vec2 a = vec2(fbm(sp + vec2(0.0, uTime * 0.08)), fbm(sp + vec2(5.2, 1.3) - uTime * 0.08));\n vec2 b = vec2(fbm(sp + 1.6 * a + uTime * 0.06), fbm(sp + 1.6 * a + vec2(8.3, 2.8) - uTime * 0.06));\n float f = fbm(sp + 2.2 * b);\n return tint(uHue + (f * 0.5 + 0.5) * uIrid);\n }\n }\n\n // ── Volume — glossy 3D-reading forms ──\n vec3 volumeCol(vec2 q, vec2 p){\n if (uType == 0) { vec4 bl = blobLayer(q); return mix(uBg, bl.rgb, bl.a); }\n if (uType == 1) return spiralLayer(q);\n if (uType == 2) { // dome — glossy iridescent orb\n float R = uSize * 1.6;\n float rr = length(q) / R;\n vec3 col = uBg;\n if (rr < 1.0) {\n float h = sqrt(max(0.0, 1.0 - rr * rr));\n vec3 n = normalize(vec3(q / R, h));\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), 2.4);\n float ci = uHue + uIrid * (fres * 1.1 + (n.x * 0.5 + 0.5) * 0.5 + h * 0.4) + uTime * 0.05;\n col = applyLight(tint(ci), n);\n }\n return mix(uBg, col, smoothstep(1.02, 0.96, rr));\n }\n // ripple — concentric glossy ridges\n float e = 0.01;\n float k = uFreq * 3.0; float ph = uTime * uSpin * 1.5;\n float hC = 0.5 + 0.5 * sin(length(q) * k - ph);\n float hX = 0.5 + 0.5 * sin(length(q + vec2(e, 0.0)) * k - ph);\n float hY = 0.5 + 0.5 * sin(length(q + vec2(0.0, e)) * k - ph);\n vec2 gg = vec2(hX - hC, hY - hC) / e;\n vec3 n = normalize(vec3(-gg * uRelief * 0.15, 1.0));\n float ci = uHue + uIrid * (length(q) * 0.5 + hC * 0.4) + uTime * 0.04;\n vec3 col = applyLight(tint(ci), n);\n return col * mix(1.0, smoothstep(1.75, 0.1, length(p)), 0.3);\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec2 wv = vec2(fbm(p*1.4 + uTime*0.05), fbm(p*1.4 + 7.3 - uTime*0.05));\n vec2 q = p + (wv - 0.5) * uWarp;\n\n vec3 col;\n if (uCat == 0) col = fieldCol(q, p);\n else if (uCat == 1) col = poleCol(q);\n else col = volumeCol(q, p);\n\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", V = (e) => {
113
+ let t = parseInt(e.slice(1), 16);
114
+ return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
115
+ }, Ve = class {
116
+ constructor() {
117
+ this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
118
+ }
119
+ init(e) {
120
+ this.renderer = new T({
121
+ canvas: e,
122
+ antialias: !0,
123
+ preserveDrawingBuffer: !0
124
+ }), this.scene = new w(), this.cam = new E(), this.uniforms = {
125
+ uTime: { value: 0 },
126
+ uAspect: { value: 1 },
127
+ uCat: { value: 2 },
128
+ uType: { value: 0 },
129
+ uCount: { value: 3 },
130
+ uSize: { value: .62 },
131
+ uSpread: { value: .42 },
132
+ uIrid: { value: 1.15 },
133
+ uHue: { value: 0 },
134
+ uSheen: { value: .5 },
135
+ uGloss: { value: 24 },
136
+ uRelief: { value: .9 },
137
+ uWarp: { value: .25 },
138
+ uGrain: { value: .03 },
139
+ uSpectral: { value: 1 },
140
+ uAngle: { value: 0 },
141
+ uFreq: { value: 2 },
142
+ uWinds: { value: 5 },
143
+ uPitch: { value: 2.4 },
144
+ uPetals: { value: 9 },
145
+ uSpin: { value: 1 },
146
+ uMouth: { value: .5 },
147
+ uBg: { value: V("#000000") },
148
+ uColors: { value: n[0].cols.map(V) }
149
+ }, this.mat = new S({
150
+ vertexShader: ze,
151
+ fragmentShader: Be,
152
+ uniforms: this.uniforms
153
+ }), this.scene.add(new A(new v(2, 2), this.mat));
154
+ }
155
+ resize(e, t) {
156
+ this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
157
+ }
158
+ setParams(e) {
159
+ if (!this.uniforms) return;
160
+ let t = e.look ? s.find((t) => t.value === e.look) : null;
161
+ t?.p && (e = {
162
+ ...e,
163
+ ...t.p
164
+ });
165
+ let r = this.uniforms;
166
+ if (e.cat != null && (r.uCat.value = Math.round(e.cat)), e.type != null && (r.uType.value = Math.round(e.type)), e.count != null && (r.uCount.value = Math.max(1, Math.min(6, Math.round(e.count)))), e.size != null && (r.uSize.value = e.size), e.spread != null && (r.uSpread.value = e.spread), e.irid != null && (r.uIrid.value = e.irid), e.hue != null && (r.uHue.value = e.hue), e.sheen != null && (r.uSheen.value = e.sheen), e.gloss != null && (r.uGloss.value = e.gloss), e.relief != null && (r.uRelief.value = e.relief), e.warp != null && (r.uWarp.value = e.warp), e.grain != null && (r.uGrain.value = e.grain), e.spectral != null && (r.uSpectral.value = +!!e.spectral), e.angle != null && (r.uAngle.value = e.angle), e.freq != null && (r.uFreq.value = e.freq), e.winds != null && (r.uWinds.value = e.winds), e.pitch != null && (r.uPitch.value = e.pitch), e.petals != null && (r.uPetals.value = e.petals), e.spin != null && (r.uSpin.value = e.spin), e.mouth != null && (r.uMouth.value = e.mouth), e.speed != null && (this.speed = e.speed), e.palette != null) {
167
+ let t = n.find((t) => t.value === e.palette) || n[0];
168
+ r.uColors.value = t.cols.map(V);
169
+ }
170
+ if (e.backdrop != null) {
171
+ let t = c.find((t) => t.value === e.backdrop) || c[0];
172
+ r.uBg.value = V(t.col);
173
+ }
174
+ }
175
+ setPlaying(e) {
176
+ this.playing = e;
177
+ }
178
+ frame(e) {
179
+ this.renderer && (this.playing && (this.time += e * this.speed), this.uniforms.uTime.value = this.time, this.renderer.render(this.scene, this.cam));
180
+ }
181
+ resetTime() {
182
+ this.time = 0, this.uniforms.uTime.value = 0;
183
+ }
184
+ exportBlob(e, t) {
185
+ return new Promise((n) => {
186
+ if (!this.renderer) return n(null);
187
+ let r = {
188
+ w: this.renderer.domElement.width,
189
+ h: this.renderer.domElement.height
190
+ };
191
+ this.resize(e, t), this.renderer.render(this.scene, this.cam), this.renderer.domElement.toBlob((e) => {
192
+ this.resize(r.w, r.h), n(e);
193
+ }, "image/png");
194
+ });
195
+ }
196
+ destroy() {
197
+ this.renderer &&= (this.renderer.dispose(), null);
198
+ }
199
+ }, H = 5, He = {
200
+ teardrop: 0,
201
+ pill: 1,
202
+ dome: 2,
203
+ super: 3,
204
+ orb: 2
205
+ }, Ue = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", We = "\n precision highp float;\n varying vec2 vUv;\n uniform float uTime, uAspect, uCount;\n uniform float uHue, uIrid, uSheen, uGloss, uRim, uRimPow, uRimShift, uSSS;\n uniform float uBulge, uRelief, uMotion, uGrain, uSpectral, uEdge;\n uniform vec2 uDir, uBgFade;\n uniform vec3 uBg;\n uniform vec3 uColors[5];\n uniform float uType[5];\n uniform vec2 uPos[5];\n uniform vec2 uScale[5];\n uniform float uRot[5];\n uniform float uHueOff[5];\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n\n vec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t + vec3(0.0, 0.33, 0.67)));\n }\n vec3 ramp(float t){\n t = fract(t) * 4.0;\n int i = int(floor(t));\n vec3 a = uColors[i];\n vec3 b = uColors[i + 1 < 5 ? i + 1 : 4];\n return mix(a, b, fract(t));\n }\n vec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\n vec2 rot2(vec2 v, float a){ float c = cos(a), s = sin(a); return mat2(c, -s, s, c) * v; }\n\n // Signed-ish distance for each form (negative inside). q is form-local\n // (centred, unrotated, divided by the form's scale → \"radius 1\" forms).\n float formDist(float ty, vec2 q){\n if (ty < 0.5) { // teardrop — ellipse tapered toward +y\n float taper = mix(1.0, 0.36, clamp(q.y * 0.5 + 0.5, 0.0, 1.0));\n return length(vec2(q.x / taper, q.y)) - 1.0;\n } else if (ty < 1.5) { // pill — horizontal capsule\n vec2 d = q; d.x = max(abs(d.x) - 0.58, 0.0);\n return length(d) - 0.5;\n } else if (ty < 2.5) { // dome / orb — ellipse\n return length(q) - 1.0;\n }\n vec2 e = pow(abs(q), vec2(3.4)); // superellipse — soft-cornered lozenge\n return pow(e.x + e.y, 1.0/3.4) - 1.0;\n }\n\n // Inside a form (d<0) the surface bulges up; sqrt gives spherical edge falloff.\n float heightOf(float d){ float t = clamp(-d / uBulge, 0.0, 1.0); return sqrt(t * (2.0 - t)); }\n\n // Procedural matcap: hue swept across the surface normal (the broad gradient\n // that flows over the volume) + baked soft key light + glossy hotspot +\n // coloured fresnel rim + a touch of subsurface glow at thin edges.\n vec3 shade(vec3 n, float hueOff, float h){\n float ci = uHue + hueOff + uIrid * (dot(n.xy, uDir) * 0.5 + 0.5);\n vec3 base = tint(ci);\n vec3 L = normalize(vec3(-0.35, 0.55, 0.85));\n float key = 0.5 + 0.5 * dot(n, L);\n base *= mix(0.6, 1.18, key);\n vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));\n base += pow(max(dot(n, H), 0.0), uGloss) * uSheen;\n float fres = pow(1.0 - clamp(n.z, 0.0, 1.0), uRimPow);\n base += tint(ci + uRimShift) * fres * uRim;\n base += base * (1.0 - clamp(h, 0.0, 1.0)) * uSSS;\n return base;\n }\n\n void main(){\n vec2 p = vUv * 2.0 - 1.0;\n p.x *= uAspect;\n vec3 col = uBg;\n const float E = 0.012;\n\n for (int i = 0; i < 5; i++){\n if (float(i) >= uCount) break;\n vec2 pos = uPos[i] + uMotion * vec2(sin(uTime*0.40 + float(i)*1.7),\n cos(uTime*0.33 + float(i)*2.1)) * 0.05;\n float ty = uType[i];\n vec2 sc = uScale[i];\n float rt = uRot[i];\n\n vec2 q = rot2(p - pos, -rt) / sc;\n vec2 qx = rot2(p + vec2(E, 0.0) - pos, -rt) / sc;\n vec2 qy = rot2(p + vec2(0.0, E) - pos, -rt) / sc;\n float d = formDist(ty, q);\n float h = heightOf(d);\n vec2 g = vec2(heightOf(formDist(ty, qx)) - h,\n heightOf(formDist(ty, qy)) - h) / E;\n vec3 n = normalize(vec3(-g * uRelief, 1.0));\n\n float a = smoothstep(uEdge, -uEdge, d);\n col = mix(col, shade(n, uHueOff[i], h), a);\n }\n\n col *= mix(1.0, smoothstep(uBgFade.y, uBgFade.x, length(p)), 0.18); // soft vignette\n col += (hash(vUv * vec2(1920.0, 1080.0) + uTime) - 0.5) * uGrain;\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", U = (e) => {
206
+ let t = parseInt(e.slice(1), 16);
207
+ return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
208
+ }, Ge = class {
209
+ constructor() {
210
+ this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
211
+ }
212
+ init(e) {
213
+ this.renderer = new T({
214
+ canvas: e,
215
+ antialias: !0,
216
+ preserveDrawingBuffer: !0
217
+ }), this.scene = new w(), this.cam = new E(), this.uniforms = {
218
+ uTime: { value: 0 },
219
+ uAspect: { value: 1 },
220
+ uCount: { value: 3 },
221
+ uHue: { value: 0 },
222
+ uIrid: { value: 1 },
223
+ uSheen: { value: .35 },
224
+ uGloss: { value: 32 },
225
+ uRim: { value: .7 },
226
+ uRimPow: { value: 2.6 },
227
+ uRimShift: { value: .12 },
228
+ uSSS: { value: .25 },
229
+ uBulge: { value: .55 },
230
+ uRelief: { value: 1 },
231
+ uMotion: { value: 0 },
232
+ uGrain: { value: .02 },
233
+ uSpectral: { value: 0 },
234
+ uEdge: { value: .02 },
235
+ uDir: { value: new I(.3, .95) },
236
+ uBgFade: { value: new I(.2, 1.9) },
237
+ uBg: { value: U("#000000") },
238
+ uColors: { value: n[0].cols.map(U) },
239
+ uType: { value: Array(H).fill(2) },
240
+ uPos: { value: Array.from({ length: H }, () => new I()) },
241
+ uScale: { value: Array.from({ length: H }, () => new I(.6, .6)) },
242
+ uRot: { value: Array(H).fill(0) },
243
+ uHueOff: { value: Array(H).fill(0) }
244
+ }, this.mat = new S({
245
+ vertexShader: Ue,
246
+ fragmentShader: We,
247
+ uniforms: this.uniforms
248
+ }), this.scene.add(new A(new v(2, 2), this.mat));
249
+ }
250
+ resize(e, t) {
251
+ this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
252
+ }
253
+ setForms(e) {
254
+ if (!this.uniforms || !e) return;
255
+ let t = this.uniforms, n = e.slice(0, H);
256
+ t.uCount.value = n.length || 1;
257
+ for (let e = 0; e < H; e++) {
258
+ let r = n[e] || n[n.length - 1] || {};
259
+ t.uType.value[e] = He[r.t] ?? 2, t.uPos.value[e].set(r.x ?? 0, r.y ?? 0);
260
+ let i = r.sx ?? .6;
261
+ t.uScale.value[e].set(i, r.sy ?? i), t.uRot.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
262
+ }
263
+ }
264
+ setParams(e) {
265
+ if (!this.uniforms) return;
266
+ let t = this.uniforms, r = {
267
+ hue: "uHue",
268
+ irid: "uIrid",
269
+ sheen: "uSheen",
270
+ gloss: "uGloss",
271
+ rim: "uRim",
272
+ rimPow: "uRimPow",
273
+ rimShift: "uRimShift",
274
+ sss: "uSSS",
275
+ bulge: "uBulge",
276
+ relief: "uRelief",
277
+ motion: "uMotion",
278
+ grain: "uGrain",
279
+ edge: "uEdge"
280
+ };
281
+ for (let n in r) e[n] != null && (t[r[n]].value = e[n]);
282
+ if (e.spectral != null && (t.uSpectral.value = +!!e.spectral), e.sweep != null) {
283
+ let n = e.sweep * Math.PI / 180;
284
+ t.uDir.value.set(Math.sin(n), Math.cos(n));
285
+ }
286
+ if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
287
+ let r = n.find((t) => t.value === e.palette) || n[0];
288
+ t.uColors.value = r.cols.map(U);
289
+ }
290
+ if (e.backdrop != null) {
291
+ let n = c.find((t) => t.value === e.backdrop) || c[0];
292
+ t.uBg.value = U(n.col);
293
+ }
294
+ }
295
+ setPlaying(e) {
296
+ this.playing = e;
297
+ }
298
+ frame(e) {
299
+ this.renderer && (this.playing && (this.time += e * this.speed), this.uniforms.uTime.value = this.time, this.renderer.render(this.scene, this.cam));
300
+ }
301
+ resetTime() {
302
+ this.time = 0, this.uniforms.uTime.value = 0;
303
+ }
304
+ exportBlob(e, t) {
305
+ return new Promise((n) => {
306
+ if (!this.renderer) return n(null);
307
+ let r = {
308
+ w: this.renderer.domElement.width,
309
+ h: this.renderer.domElement.height
310
+ };
311
+ this.resize(e, t), this.renderer.render(this.scene, this.cam), this.renderer.domElement.toBlob((e) => {
312
+ this.resize(r.w, r.h), n(e);
313
+ }, "image/png");
314
+ });
315
+ }
316
+ destroy() {
317
+ this.renderer &&= (this.renderer.dispose(), null);
318
+ }
319
+ }, W = 5, Ke = {
320
+ sphere: 0,
321
+ orb: 0,
322
+ capsule: 1,
323
+ pill: 1,
324
+ teardrop: 2,
325
+ lozenge: 3,
326
+ super: 3
327
+ }, qe = "varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy,0.,1.); }", Je = "\nprecision highp float;\nvarying vec2 vUv;\n\nuniform float uTime, uAspect, uCount;\nuniform float uTheta, uPhi, uDist;\nuniform float uHue, uIrid, uSheen, uGloss;\nuniform float uRim, uRimPow, uRimShift, uSSS;\nuniform float uMotion, uGrain, uSpectral, uMetaball;\nuniform vec2 uDir;\nuniform vec3 uBg;\nuniform vec3 uColors[5];\nuniform float uType[5];\nuniform vec3 uPos3[5];\nuniform vec3 uScale3[5];\nuniform float uRot3[5];\nuniform float uHueOff[5];\n\nfloat hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }\n\nvec3 spectral(float t){\n t = fract(t);\n return 0.5 + 0.5*cos(6.28318*(t+vec3(0.,0.333,0.667)));\n}\nvec3 ramp(float t){\n t = fract(t)*4.;\n int i = int(floor(t));\n return mix(uColors[i], uColors[i+1<5?i+1:4], fract(t));\n}\nvec3 tint(float ci){ return mix(ramp(fract(ci)), spectral(ci), uSpectral); }\n\nvec3 rotY(vec3 p, float a){ float c=cos(a),s=sin(a); return vec3(c*p.x+s*p.z,p.y,-s*p.x+c*p.z); }\n\nfloat sdSphere(vec3 q){ return length(q)-1.; }\nfloat sdCapsule(vec3 q){ q.y-=clamp(q.y,-0.5,0.5); return length(q)-0.5; }\nfloat sdTeardrop(vec3 q){\n float tp = mix(1.,0.36,clamp(q.y*0.5+0.5,0.,1.));\n return length(vec3(q.x/tp,q.y,q.z/tp))-1.;\n}\nfloat sdLozenge(vec3 q){\n vec3 a = pow(abs(q),vec3(3.4));\n return pow(a.x+a.y+a.z,1./3.4)-1.;\n}\n\n// Forms: return (dist, hueOff_of_nearest). Loop-index access of uHueOff[] is\n// safe in GLSL ES 1.00 (loop induction variable, not a dynamic expression).\nvec2 mapForms(vec3 p){\n vec2 res = vec2(1e9, 0.);\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.06;\n vec3 sc = uScale3[i];\n vec3 q = rotY(p-uPos3[i]-anim,-uRot3[i])/sc;\n float ty=uType[i],d;\n if (ty<.5) d=sdSphere(q);\n else if(ty<1.5)d=sdCapsule(q);\n else if(ty<2.5)d=sdTeardrop(q);\n else d=sdLozenge(q);\n d*=min(sc.x,min(sc.y,sc.z));\n if(d<res.x) res=vec2(d,uHueOff[i]);\n }\n return res;\n}\n\n// Metaballs: potential = Σ r²/(|p-c|²+ε); isosurface at potential = 1.\n// Animation amplitude 0.35 per axis so balls visibly cycle separated→merged.\nvec2 mapMeta(vec3 p){\n float field=0.,wh=0.,wsum=0.;\n for(int i=0;i<5;i++){\n if(float(i)>=uCount) break;\n float fi=float(i);\n vec3 anim = uMotion*vec3(sin(uTime*.38+fi*1.7),cos(uTime*.31+fi*2.3),sin(uTime*.43+fi*1.1))*0.35;\n float r = uScale3[i].x;\n vec3 dv= p-uPos3[i]-anim;\n float w = r*r/(dot(dv,dv)+0.0001);\n field+=w; wh+=uHueOff[i]*w; wsum+=w;\n }\n return vec2(1.-field, wsum>0.?wh/wsum:0.);\n}\n\nvec2 map(vec3 p){ return uMetaball>.5 ? mapMeta(p) : mapForms(p); }\n\n// World-space surface normal via central difference\nvec3 calcNormal(vec3 p){\n const float E=0.002;\n return normalize(vec3(\n map(p+vec3(E,0,0)).x-map(p-vec3(E,0,0)).x,\n map(p+vec3(0,E,0)).x-map(p-vec3(0,E,0)).x,\n map(p+vec3(0,0,E)).x-map(p-vec3(0,0,E)).x\n ));\n}\n\n// AO: 6 samples along the world normal. Merge zones between metaballs have low\n// potential headroom → small d values → high occlusion → dark necks.\nfloat calcAO(vec3 p, vec3 n){\n float occ=0.,sca=1.;\n for(int i=1;i<=6;i++){\n float h = 0.006+0.08*float(i)/6.;\n float d = map(p+n*h).x;\n occ += max(h-d,0.)*sca;\n sca *= 0.87;\n }\n return clamp(1.-14.*occ, 0., 1.);\n}\n\n// Soft shadow: march from surface toward the world key light.\n// One metaball casts a soft shadow onto another → depth is unmistakable.\nfloat calcShadow(vec3 ro, vec3 rd){\n float sha=1.,t=0.02;\n for(int i=0;i<28;i++){\n float h=map(ro+rd*t).x;\n if(h<0.001) return 0.;\n sha=min(sha,8.*h/t);\n t+=clamp(h,0.01,0.18);\n if(sha<0.005||t>4.) break;\n }\n return clamp(sha,0.,1.);\n}\n\n// Shading: matcap iridescence (view-space) + world lighting (view-space L) + AO + shadow.\n// nv = view-space normal (n.z=1 faces camera).\n// Lv = world key light transformed to view space: diffuse changes as you orbit.\nvec3 shade(vec3 nv, float hueOff, float ao, float sha, vec3 Lv){\n float ci = uHue+hueOff+uIrid*(dot(nv.xy,uDir)*.5+.5);\n vec3 base = tint(ci);\n\n // Key: world-space light, so shading shifts as camera orbits\n float diff = max(dot(nv,Lv),0.);\n base *= mix(0.15,1.,diff*sha)*ao;\n\n // Cool fill from opposite quarter (unshadowed, softer)\n base += tint(ci+0.5)*max(dot(nv,normalize(-Lv+vec3(.2,-.1,0.))),0.)*0.09*ao;\n\n // Gloss specular\n vec3 H = normalize(Lv+vec3(0,0,1));\n base += pow(max(dot(nv,H),0.),uGloss)*uSheen*sha;\n\n // Coloured fresnel rim at silhouette\n float fres = pow(1.-clamp(nv.z,0.,1.),uRimPow);\n base += tint(ci+uRimShift)*fres*uRim;\n\n // SSS: scattered inner glow — most visible at metaball neck/thin spots\n base += tint(ci+0.5)*fres*fres*uSSS*0.5;\n\n return base;\n}\n\nvoid main(){\n vec2 uv = vUv*2.-1.;\n uv.x *= uAspect;\n\n // Orbit camera\n float cosPhi=cos(uPhi);\n vec3 ro = vec3(uDist*cosPhi*sin(uTheta), uDist*sin(uPhi), uDist*cosPhi*cos(uTheta));\n vec3 fwd = normalize(-ro);\n vec3 right = normalize(cross(fwd,vec3(0,1,0)));\n vec3 upV = cross(right,fwd);\n vec3 rd = normalize(fwd+uv.x*right*.9+uv.y*upV*.9);\n\n // World key light → view space (so diffuse changes as you orbit)\n vec3 L_w = normalize(vec3(-.4,.8,.6));\n vec3 Lv = normalize(vec3(dot(L_w,right),dot(L_w,upV),-dot(L_w,fwd)));\n\n vec3 col = uBg;\n float t = 0.1;\n float hitHue = 0.;\n bool didHit = false;\n\n for(int i=0;i<200;i++){\n vec3 p = ro+rd*t;\n vec2 r = map(p);\n if(r.x<0.0012){ hitHue=r.y; didHit=true; break; }\n float step = r.x*0.85;\n if(uMetaball>.5) step=clamp(r.x*0.45, 0.005, 0.13); // conservative: field isn't a true SDF\n t+=step;\n if(t>10.) break;\n }\n\n if(didHit){\n vec3 p = ro+rd*t;\n vec3 n = calcNormal(p); // world normal\n vec3 nv = normalize(vec3(dot(n,right),dot(n,upV),-dot(n,fwd))); // view normal\n\n float ao = calcAO(p, n);\n float sha = calcShadow(p+n*0.006, L_w);\n\n col = shade(nv, hitHue, ao, sha, Lv);\n }\n\n // Cinematic vignette\n col *= 1.-0.55*pow(dot(uv,uv)/2.,1.4);\n col += (hash(vUv*1920.+uTime)-.5)*uGrain;\n gl_FragColor = vec4(clamp(col,0.,1.),1.);\n}\n", G = (e) => {
328
+ let t = parseInt(e.slice(1), 16);
329
+ return new j((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
330
+ }, Ye = class {
331
+ constructor() {
332
+ this.renderer = null, this.time = 0, this.playing = !0, this.speed = 1;
333
+ }
334
+ init(e) {
335
+ this.renderer = new T({
336
+ canvas: e,
337
+ antialias: !0,
338
+ preserveDrawingBuffer: !0
339
+ }), this.scene = new w(), this.cam = new E(), this.uniforms = {
340
+ uTime: { value: 0 },
341
+ uAspect: { value: 1 },
342
+ uCount: { value: 1 },
343
+ uTheta: { value: .3 },
344
+ uPhi: { value: .15 },
345
+ uDist: { value: 3.2 },
346
+ uHue: { value: 0 },
347
+ uIrid: { value: 1 },
348
+ uSheen: { value: .4 },
349
+ uGloss: { value: 32 },
350
+ uRim: { value: .8 },
351
+ uRimPow: { value: 2.6 },
352
+ uRimShift: { value: .12 },
353
+ uSSS: { value: .3 },
354
+ uMotion: { value: 0 },
355
+ uGrain: { value: .018 },
356
+ uSpectral: { value: 1 },
357
+ uMetaball: { value: 0 },
358
+ uDir: { value: new I(.3, .95) },
359
+ uBg: { value: G("#000000") },
360
+ uColors: { value: n[0].cols.map(G) },
361
+ uType: { value: Array(W).fill(0) },
362
+ uPos3: { value: Array.from({ length: W }, () => new j()) },
363
+ uScale3: { value: Array.from({ length: W }, () => new j(.7, .7, .7)) },
364
+ uRot3: { value: Array(W).fill(0) },
365
+ uHueOff: { value: Array(W).fill(0) }
366
+ }, this.mat = new S({
367
+ vertexShader: qe,
368
+ fragmentShader: Je,
369
+ uniforms: this.uniforms
370
+ }), this.scene.add(new A(new v(2, 2), this.mat));
371
+ }
372
+ resize(e, t) {
373
+ this.renderer && (this.renderer.setSize(e, t, !1), this.uniforms.uAspect.value = e / t);
374
+ }
375
+ setCamera({ theta: e, phi: t, dist: n }) {
376
+ this.uniforms && (this.uniforms.uTheta.value = e, this.uniforms.uPhi.value = t, this.uniforms.uDist.value = n);
377
+ }
378
+ setForms(e) {
379
+ if (!this.uniforms || !e) return;
380
+ let t = this.uniforms, n = e.slice(0, W);
381
+ t.uCount.value = n.length || 1;
382
+ for (let e = 0; e < W; e++) {
383
+ let r = n[e] || {};
384
+ t.uType.value[e] = Ke[r.t] ?? 0, t.uPos3.value[e].set(r.x ?? 0, r.y ?? 0, r.z ?? 0);
385
+ let i = r.sx ?? .7;
386
+ t.uScale3.value[e].set(i, r.sy ?? i, r.sz ?? i), t.uRot3.value[e] = (r.rot ?? 0) * Math.PI / 180, t.uHueOff.value[e] = r.hue ?? 0;
387
+ }
388
+ }
389
+ setParams(e) {
390
+ if (!this.uniforms) return;
391
+ let t = this.uniforms, r = {
392
+ hue: "uHue",
393
+ irid: "uIrid",
394
+ sheen: "uSheen",
395
+ gloss: "uGloss",
396
+ rim: "uRim",
397
+ rimPow: "uRimPow",
398
+ rimShift: "uRimShift",
399
+ sss: "uSSS",
400
+ motion: "uMotion",
401
+ grain: "uGrain"
402
+ };
403
+ for (let n in r) e[n] != null && (t[r[n]].value = e[n]);
404
+ if (e.spectral != null && (t.uSpectral.value = +!!e.spectral), e.metaball != null && (t.uMetaball.value = +!!e.metaball), e.sweep != null) {
405
+ let n = e.sweep * Math.PI / 180;
406
+ t.uDir.value.set(Math.sin(n), Math.cos(n));
407
+ }
408
+ if (e.speed != null && (this.speed = e.speed), e.forms && this.setForms(e.forms), e.palette != null) {
409
+ let r = n.find((t) => t.value === e.palette) || n[0];
410
+ t.uColors.value = r.cols.map(G);
411
+ }
412
+ if (e.backdrop != null) {
413
+ let n = c.find((t) => t.value === e.backdrop) || c[0];
414
+ t.uBg.value = G(n.col);
415
+ }
416
+ }
417
+ setPlaying(e) {
418
+ this.playing = e;
419
+ }
420
+ frame(e) {
421
+ this.renderer && (this.playing && (this.time += e * this.speed), this.uniforms.uTime.value = this.time, this.renderer.render(this.scene, this.cam));
422
+ }
423
+ resetTime() {
424
+ this.time = 0, this.uniforms.uTime.value = 0;
425
+ }
426
+ exportBlob(e, t) {
427
+ return new Promise((n) => {
428
+ if (!this.renderer) return n(null);
429
+ let r = {
430
+ w: this.renderer.domElement.width,
431
+ h: this.renderer.domElement.height
432
+ };
433
+ this.resize(e, t), this.renderer.render(this.scene, this.cam), this.renderer.domElement.toBlob((e) => {
434
+ this.resize(r.w, r.h), n(e);
435
+ }, "image/png");
436
+ });
437
+ }
438
+ destroy() {
439
+ this.renderer &&= (this.renderer.dispose(), null);
440
+ }
441
+ }, K = new j();
442
+ function q(e, t, n, r, i, a) {
443
+ let o = 2 * Math.PI * i / 4, s = Math.max(a - 2 * i, 0), c = Math.PI / 4;
444
+ K.copy(t), K[r] = 0, K.normalize();
445
+ let l = .5 * o / (o + s), u = 1 - K.angleTo(e) / c;
446
+ return Math.sign(K[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
447
+ }
448
+ var Xe = class extends _e {
449
+ constructor(e = 1, t = 1, n = 1, r = 2, i = .1) {
450
+ if (r = r * 2 + 1, i = Math.min(e / 2, t / 2, n / 2, i), super(1, 1, 1, r, r, r), r === 1) return;
451
+ let a = this.toNonIndexed();
452
+ this.index = null, this.attributes.position = a.attributes.position, this.attributes.normal = a.attributes.normal, this.attributes.uv = a.attributes.uv;
453
+ let o = new j(), s = new j(), c = new j(e, t, n).divideScalar(2).subScalar(i), l = this.attributes.position.array, u = this.attributes.normal.array, d = this.attributes.uv.array, f = l.length / 6, p = new j(), m = .5 / r;
454
+ for (let r = 0, a = 0; r < l.length; r += 3, a += 2) switch (o.fromArray(l, r), s.copy(o), s.x -= Math.sign(s.x) * m, s.y -= Math.sign(s.y) * m, s.z -= Math.sign(s.z) * m, s.normalize(), l[r + 0] = c.x * Math.sign(o.x) + s.x * i, l[r + 1] = c.y * Math.sign(o.y) + s.y * i, l[r + 2] = c.z * Math.sign(o.z) + s.z * i, u[r + 0] = s.x, u[r + 1] = s.y, u[r + 2] = s.z, Math.floor(r / f)) {
455
+ case 0:
456
+ p.set(1, 0, 0), d[a + 0] = q(p, s, "z", "y", i, n), d[a + 1] = 1 - q(p, s, "y", "z", i, t);
457
+ break;
458
+ case 1:
459
+ p.set(-1, 0, 0), d[a + 0] = 1 - q(p, s, "z", "y", i, n), d[a + 1] = 1 - q(p, s, "y", "z", i, t);
460
+ break;
461
+ case 2:
462
+ p.set(0, 1, 0), d[a + 0] = 1 - q(p, s, "x", "z", i, e), d[a + 1] = q(p, s, "z", "x", i, n);
463
+ break;
464
+ case 3:
465
+ p.set(0, -1, 0), d[a + 0] = 1 - q(p, s, "x", "z", i, e), d[a + 1] = 1 - q(p, s, "z", "x", i, n);
466
+ break;
467
+ case 4:
468
+ p.set(0, 0, 1), d[a + 0] = 1 - q(p, s, "x", "y", i, e), d[a + 1] = 1 - q(p, s, "y", "x", i, t);
469
+ break;
470
+ case 5:
471
+ p.set(0, 0, -1), d[a + 0] = q(p, s, "x", "y", i, e), d[a + 1] = 1 - q(p, s, "y", "x", i, t);
472
+ break;
473
+ }
474
+ }
475
+ }, Ze = new xe(), J = new j(), Qe = class extends je {
476
+ constructor() {
477
+ super(), this.isLineSegmentsGeometry = !0, this.type = "LineSegmentsGeometry", this.setIndex([
478
+ 0,
479
+ 2,
480
+ 1,
481
+ 2,
482
+ 3,
483
+ 1,
484
+ 2,
485
+ 4,
486
+ 3,
487
+ 4,
488
+ 5,
489
+ 3,
490
+ 4,
491
+ 6,
492
+ 5,
493
+ 6,
494
+ 7,
495
+ 5
496
+ ]), this.setAttribute("position", new L([
497
+ -1,
498
+ 2,
499
+ 0,
500
+ 1,
501
+ 2,
502
+ 0,
503
+ -1,
504
+ 1,
505
+ 0,
506
+ 1,
507
+ 1,
508
+ 0,
509
+ -1,
510
+ 0,
511
+ 0,
512
+ 1,
513
+ 0,
514
+ 0,
515
+ -1,
516
+ -1,
517
+ 0,
518
+ 1,
519
+ -1,
520
+ 0
521
+ ], 3)), this.setAttribute("uv", new L([
522
+ -1,
523
+ 2,
524
+ 1,
525
+ 2,
526
+ -1,
527
+ 1,
528
+ 1,
529
+ 1,
530
+ -1,
531
+ -1,
532
+ 1,
533
+ -1,
534
+ -1,
535
+ -2,
536
+ 1,
537
+ -2
538
+ ], 2));
539
+ }
540
+ applyMatrix4(e) {
541
+ let t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
542
+ return t !== void 0 && (t.applyMatrix4(e), n.applyMatrix4(e), t.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
543
+ }
544
+ setPositions(e) {
545
+ let t;
546
+ e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
547
+ let n = new ue(t, 6, 1);
548
+ return this.setAttribute("instanceStart", new b(n, 3, 0)), this.setAttribute("instanceEnd", new b(n, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
549
+ }
550
+ setColors(e) {
551
+ let t;
552
+ e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e));
553
+ let n = new ue(t, 6, 1);
554
+ return this.setAttribute("instanceColorStart", new b(n, 3, 0)), this.setAttribute("instanceColorEnd", new b(n, 3, 3)), this;
555
+ }
556
+ fromWireframeGeometry(e) {
557
+ return this.setPositions(e.attributes.position.array), this;
558
+ }
559
+ fromEdgesGeometry(e) {
560
+ return this.setPositions(e.attributes.position.array), this;
561
+ }
562
+ fromMesh(e) {
563
+ return this.fromWireframeGeometry(new Ee(e.geometry)), this;
564
+ }
565
+ fromLineSegments(e) {
566
+ let t = e.geometry;
567
+ return this.setPositions(t.attributes.position.array), this;
568
+ }
569
+ computeBoundingBox() {
570
+ this.boundingBox === null && (this.boundingBox = new xe());
571
+ let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
572
+ e !== void 0 && t !== void 0 && (this.boundingBox.setFromBufferAttribute(e), Ze.setFromBufferAttribute(t), this.boundingBox.union(Ze));
573
+ }
574
+ computeBoundingSphere() {
575
+ this.boundingSphere === null && (this.boundingSphere = new De()), this.boundingBox === null && this.computeBoundingBox();
576
+ let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
577
+ if (e !== void 0 && t !== void 0) {
578
+ let n = this.boundingSphere.center;
579
+ this.boundingBox.getCenter(n);
580
+ let r = 0;
581
+ for (let i = 0, a = e.count; i < a; i++) J.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(J)), J.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(J));
582
+ this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
583
+ }
584
+ }
585
+ toJSON() {}
586
+ applyMatrix(e) {
587
+ return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(e);
588
+ }
589
+ };
590
+ g.line = {
591
+ worldUnits: { value: 1 },
592
+ linewidth: { value: 1 },
593
+ resolution: { value: new I(1, 1) },
594
+ dashOffset: { value: 0 },
595
+ dashScale: { value: 1 },
596
+ dashSize: { value: 1 },
597
+ gapSize: { value: 1 }
598
+ }, x.line = {
599
+ uniforms: D.merge([
600
+ g.common,
601
+ g.fog,
602
+ g.line
603
+ ]),
604
+ vertexShader: "\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n void trimSegment( const in vec4 start, inout vec4 end ) {\n\n // trim end segment so it terminates between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n float nearEstimate = - 0.5 * b / a;\n\n float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n vUv = uv;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n #ifdef WORLD_UNITS\n\n worldStart = start.xyz;\n worldEnd = end.xyz;\n\n #else\n\n vUv = uv;\n\n #endif\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n trimSegment( start, end );\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n trimSegment( end, start );\n\n }\n\n }\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec3 ndcStart = clipStart.xyz / clipStart.w;\n vec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd.xy - ndcStart.xy;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n #ifdef WORLD_UNITS\n\n vec3 worldDir = normalize( end.xyz - start.xyz );\n vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n vec3 worldFwd = cross( worldDir, worldUp );\n worldPos = position.y < 0.5 ? start: end;\n\n // height offset\n float hw = linewidth * 0.5;\n worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n // don't extend the line if we're rendering dashes because we\n // won't be rendering the endcaps\n #ifndef USE_DASH\n\n // cap extension\n worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n // add width to the box\n worldPos.xyz += worldFwd * hw;\n\n // endcaps\n if ( position.y > 1.0 || position.y < 0.0 ) {\n\n worldPos.xyz -= worldFwd * 2.0 * hw;\n\n }\n\n #endif\n\n // project the worldpos\n vec4 clip = projectionMatrix * worldPos;\n\n // shift the depth of the projected points so the line\n // segments overlap neatly\n vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n clip.z = clipPose.z * clip.w;\n\n #else\n\n vec2 offset = vec2( dir.y, - dir.x );\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n #endif\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",
605
+ fragmentShader: "\n uniform vec3 diffuse;\n uniform float opacity;\n uniform float linewidth;\n\n #ifdef USE_DASH\n\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n float mua;\n float mub;\n\n vec3 p13 = p1 - p3;\n vec3 p43 = p4 - p3;\n\n vec3 p21 = p2 - p1;\n\n float d1343 = dot( p13, p43 );\n float d4321 = dot( p43, p21 );\n float d1321 = dot( p13, p21 );\n float d4343 = dot( p43, p43 );\n float d2121 = dot( p21, p21 );\n\n float denom = d2121 * d4343 - d4321 * d4321;\n\n float numer = d1343 * d4321 - d1321 * d4343;\n\n mua = numer / denom;\n mua = clamp( mua, 0.0, 1.0 );\n mub = ( d1343 + d4321 * ( mua ) ) / d4343;\n mub = clamp( mub, 0.0, 1.0 );\n\n return vec2( mua, mub );\n\n }\n\n void main() {\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n float alpha = opacity;\n\n #ifdef WORLD_UNITS\n\n // Find the closest points on the view ray and the line segment\n vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n vec3 lineDir = worldEnd - worldStart;\n vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n vec3 p1 = worldStart + lineDir * params.x;\n vec3 p2 = rayEnd * params.y;\n vec3 delta = p1 - p2;\n float len = length( delta );\n float norm = len / linewidth;\n\n #ifndef USE_DASH\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n float dnorm = fwidth( norm );\n alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n #else\n\n if ( norm > 0.5 ) {\n\n discard;\n\n }\n\n #endif\n\n #endif\n\n #else\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n // artifacts appear on some hardware if a derivative is taken within a conditional\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n float dlen = fwidth( len2 );\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n }\n\n #else\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n #endif\n\n #endif\n\n vec4 diffuseColor = vec4( diffuse, alpha );\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "
606
+ };
607
+ var $e = class extends S {
608
+ constructor(e) {
609
+ super({
610
+ type: "LineMaterial",
611
+ uniforms: D.clone(x.line.uniforms),
612
+ vertexShader: x.line.vertexShader,
613
+ fragmentShader: x.line.fragmentShader,
614
+ clipping: !0
615
+ }), this.isLineMaterial = !0, this.setValues(e);
616
+ }
617
+ get color() {
618
+ return this.uniforms.diffuse.value;
619
+ }
620
+ set color(e) {
621
+ this.uniforms.diffuse.value = e;
622
+ }
623
+ get worldUnits() {
624
+ return "WORLD_UNITS" in this.defines;
625
+ }
626
+ set worldUnits(e) {
627
+ e === !0 ? this.defines.WORLD_UNITS = "" : delete this.defines.WORLD_UNITS;
628
+ }
629
+ get linewidth() {
630
+ return this.uniforms.linewidth.value;
631
+ }
632
+ set linewidth(e) {
633
+ this.uniforms.linewidth && (this.uniforms.linewidth.value = e);
634
+ }
635
+ get dashed() {
636
+ return "USE_DASH" in this.defines;
637
+ }
638
+ set dashed(e) {
639
+ e === !0 !== this.dashed && (this.needsUpdate = !0), e === !0 ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH;
640
+ }
641
+ get dashScale() {
642
+ return this.uniforms.dashScale.value;
643
+ }
644
+ set dashScale(e) {
645
+ this.uniforms.dashScale.value = e;
646
+ }
647
+ get dashSize() {
648
+ return this.uniforms.dashSize.value;
649
+ }
650
+ set dashSize(e) {
651
+ this.uniforms.dashSize.value = e;
652
+ }
653
+ get dashOffset() {
654
+ return this.uniforms.dashOffset.value;
655
+ }
656
+ set dashOffset(e) {
657
+ this.uniforms.dashOffset.value = e;
658
+ }
659
+ get gapSize() {
660
+ return this.uniforms.gapSize.value;
661
+ }
662
+ set gapSize(e) {
663
+ this.uniforms.gapSize.value = e;
664
+ }
665
+ get opacity() {
666
+ return this.uniforms.opacity.value;
667
+ }
668
+ set opacity(e) {
669
+ this.uniforms && (this.uniforms.opacity.value = e);
670
+ }
671
+ get resolution() {
672
+ return this.uniforms.resolution.value;
673
+ }
674
+ set resolution(e) {
675
+ this.uniforms.resolution.value.copy(e);
676
+ }
677
+ get alphaToCoverage() {
678
+ return "USE_ALPHA_TO_COVERAGE" in this.defines;
679
+ }
680
+ set alphaToCoverage(e) {
681
+ this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
682
+ }
683
+ }, et = new j(), tt = new j(), nt = new ke(), rt = class extends A {
684
+ constructor(e = new Qe(), t = new $e({ color: Math.random() * 16777215 })) {
685
+ super(e, t), this.isWireframe = !0, this.type = "Wireframe";
686
+ }
687
+ computeLineDistances() {
688
+ let e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, r = new Float32Array(2 * t.count);
689
+ for (let e = 0, i = 0, a = t.count; e < a; e++, i += 2) et.fromBufferAttribute(t, e), tt.fromBufferAttribute(n, e), r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + et.distanceTo(tt);
690
+ let i = new ue(r, 2, 1);
691
+ return e.setAttribute("instanceDistanceStart", new b(i, 1, 0)), e.setAttribute("instanceDistanceEnd", new b(i, 1, 1)), this;
692
+ }
693
+ onBeforeRender(e) {
694
+ let t = this.material.uniforms;
695
+ t && t.resolution && (e.getViewport(nt), this.material.uniforms.resolution.value.set(nt.z, nt.w));
696
+ }
697
+ }, Y = class extends Qe {
698
+ constructor(e) {
699
+ super(), this.isWireframeGeometry2 = !0, this.type = "WireframeGeometry2", this.fromWireframeGeometry(new Ee(e));
700
+ }
701
+ }, it = class extends w {
702
+ constructor() {
703
+ super();
704
+ let e = new _e();
705
+ e.deleteAttribute("uv");
706
+ let t = new oe({ side: 1 }), n = new oe(), r = new fe(16777215, 900, 28, 2);
707
+ r.position.set(.418, 16.199, .3), this.add(r);
708
+ let i = new A(e, t);
709
+ i.position.set(-.757, 13.219, .717), i.scale.set(31.713, 28.305, 28.591), this.add(i);
710
+ let a = new A(e, n);
711
+ a.position.set(-10.906, 2.009, 1.846), a.rotation.set(0, -.195, 0), a.scale.set(2.328, 7.905, 4.651), this.add(a);
712
+ let o = new A(e, n);
713
+ o.position.set(-5.607, -.754, -.758), o.rotation.set(0, .994, 0), o.scale.set(1.97, 1.534, 3.955), this.add(o);
714
+ let s = new A(e, n);
715
+ s.position.set(6.167, .857, 7.803), s.rotation.set(0, .561, 0), s.scale.set(3.927, 6.285, 3.687), this.add(s);
716
+ let c = new A(e, n);
717
+ c.position.set(-2.017, .018, 6.124), c.rotation.set(0, .333, 0), c.scale.set(2.002, 4.566, 2.064), this.add(c);
718
+ let l = new A(e, n);
719
+ l.position.set(2.291, -.756, -2.621), l.rotation.set(0, -.286, 0), l.scale.set(1.546, 1.552, 1.496), this.add(l);
720
+ let u = new A(e, n);
721
+ u.position.set(-2.193, -.369, -5.547), u.rotation.set(0, .516, 0), u.scale.set(3.875, 3.487, 2.986), this.add(u);
722
+ let d = new A(e, X(50));
723
+ d.position.set(-16.116, 14.37, 8.208), d.scale.set(.1, 2.428, 2.739), this.add(d);
724
+ let f = new A(e, X(50));
725
+ f.position.set(-16.109, 18.021, -8.207), f.scale.set(.1, 2.425, 2.751), this.add(f);
726
+ let p = new A(e, X(17));
727
+ p.position.set(14.904, 12.198, -1.832), p.scale.set(.15, 4.265, 6.331), this.add(p);
728
+ let m = new A(e, X(43));
729
+ m.position.set(-.462, 8.89, 14.52), m.scale.set(4.38, 5.441, .088), this.add(m);
730
+ let h = new A(e, X(20));
731
+ h.position.set(3.235, 11.486, -12.541), h.scale.set(2.5, 2, .1), this.add(h);
732
+ let g = new A(e, X(100));
733
+ g.position.set(0, 20, 0), g.scale.set(1, .1, 1), this.add(g);
734
+ }
735
+ dispose() {
736
+ let e = /* @__PURE__ */ new Set();
737
+ this.traverse((t) => {
738
+ t.isMesh && (e.add(t.geometry), e.add(t.material));
739
+ });
740
+ for (let t of e) t.dispose();
741
+ }
742
+ };
743
+ function X(e) {
744
+ let t = new _();
745
+ return t.color.setScalar(e), t;
746
+ }
747
+ //#endregion
748
+ //#region src/loops/gl/primitiveEasing.js
749
+ function at(e) {
750
+ let t = 7.5625, n = 2.75;
751
+ return e < 1 / n ? t * e * e : e < 2 / n ? (e -= 1.5 / n, t * e * e + .75) : e < 2.5 / n ? (e -= 2.25 / n, t * e * e + .9375) : (e -= 2.625 / n, t * e * e + .984375);
752
+ }
753
+ var ot = {
754
+ linear: (e) => e,
755
+ in: (e) => e * e,
756
+ out: (e) => 1 - (1 - e) * (1 - e),
757
+ inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
758
+ sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
759
+ cubicIn: (e) => e * e * e,
760
+ cubicOut: (e) => 1 - (1 - e) ** 3,
761
+ cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
762
+ expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
763
+ expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
764
+ backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
765
+ backInOut: (e) => {
766
+ let t = 1.70158 * 1.525;
767
+ return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
768
+ },
769
+ elasticOut: (e) => {
770
+ if (e <= 0) return 0;
771
+ if (e >= 1) return 1;
772
+ let t = 2 * Math.PI / 3;
773
+ return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
774
+ },
775
+ bounceOut: at
776
+ }, st = {
777
+ linear: "Linear",
778
+ in: "Ease in",
779
+ out: "Ease out",
780
+ inout: "Ease in-out",
781
+ sine: "Sine",
782
+ cubicIn: "Cubic in",
783
+ cubicOut: "Cubic out",
784
+ cubicInOut: "Cubic in-out",
785
+ expoOut: "Expo out",
786
+ expoInOut: "Expo in-out",
787
+ backOut: "Back out",
788
+ backInOut: "Back in-out",
789
+ elasticOut: "Elastic out",
790
+ bounceOut: "Bounce out"
791
+ };
792
+ Object.keys(ot).map((e) => ({
793
+ value: e,
794
+ label: st[e] || e
795
+ }));
796
+ //#endregion
797
+ //#region src/loops/gl/primitiveKeyframes.js
798
+ var ct = (e, t, n) => e + (t - e) * n, lt = (e, t, n) => [
799
+ ct(e[0], t[0], n),
800
+ ct(e[1], t[1], n),
801
+ ct(e[2], t[2], n)
802
+ ], ut = (e) => ({
803
+ rot: e.rot || [
804
+ 0,
805
+ 0,
806
+ 0
807
+ ],
808
+ pos: e.pos || [
809
+ 0,
810
+ 0,
811
+ 0
812
+ ],
813
+ scale: e.scale ?? 1
814
+ });
815
+ function dt(e, t) {
816
+ if (!e || !e.length) return {};
817
+ if (e.length === 1) return ut(e[0]);
818
+ let n = 0;
819
+ for (; n < e.length - 1 && t > e[n + 1].t;) n++;
820
+ let r = e[n], i = e[n + 1] || r, a = i.t - r.t || 1, o = Math.max(0, Math.min(1, (t - r.t) / a));
821
+ return o = (ot[i.ease] || ot.inout)(o), {
822
+ rot: lt(r.rot || [
823
+ 0,
824
+ 0,
825
+ 0
826
+ ], i.rot || [
827
+ 0,
828
+ 0,
829
+ 0
830
+ ], o),
831
+ pos: lt(r.pos || [
832
+ 0,
833
+ 0,
834
+ 0
835
+ ], i.pos || [
836
+ 0,
837
+ 0,
838
+ 0
839
+ ], o),
840
+ scale: ct(r.scale ?? 1, i.scale ?? 1, o)
841
+ };
842
+ }
843
+ Math.PI * 2;
844
+ //#endregion
845
+ //#region src/loops/gl/PrimitiveEngine.js
846
+ var ft = "#0b0b0e", pt = .004, mt = 24, ht = class {
847
+ constructor(e, { autoLoop: t = !1 } = {}) {
848
+ this.canvas = e, this.autoLoop = t, this.renderer = new T({
849
+ canvas: e,
850
+ antialias: !0,
851
+ preserveDrawingBuffer: !0,
852
+ alpha: !0
853
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(ft), 1), this.scene = new w(), this.camera = new z(38, 1, .1, 100), this.camera.position.set(0, .6, 4), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.scene.add(new Te(16777215, .35)), this.scene.add(new le(13424383, 2105384, .5));
854
+ let n = new O(16777215, 1.5);
855
+ n.position.set(3, 4, 2), this.scene.add(n);
856
+ let r = new O(10070783, .5);
857
+ r.position.set(-3, -1, -2), this.scene.add(r), this.pmrem = new ce(this.renderer), this.envTex = null, this.color = "#b9c2d0", this.roughness = .38, this.metalness = .18, this.flat = !1, this.matType = "standard", this.material = this.makeMaterial("standard"), this.lineMat = new $e({
858
+ color: 12174032,
859
+ linewidth: 3 * pt,
860
+ worldUnits: !0
861
+ }), this.primId = "box", this.params = {
862
+ tube: .32,
863
+ p: 2,
864
+ q: 3,
865
+ detail: 0
866
+ }, this.rounding = .22, this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new Y(this.activeGeom), this.items = [], this.layoutPos = [[
867
+ 0,
868
+ 0,
869
+ 0
870
+ ]], this.setCount(1), this.axes = new Oe(1), this.axes.material.transparent = !0, this.axes.material.opacity = .7, this.axes.visible = !1, this.scene.add(this.axes), this.presets = Object.fromEntries(i.map((e) => [e.id, e.sample])), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
871
+ preset: "spin",
872
+ animMode: "preset",
873
+ keyframes: [],
874
+ loop: !0,
875
+ paused: !0,
876
+ speed: 1,
877
+ duration: 8,
878
+ count: 1,
879
+ arrangement: "single",
880
+ spread: 2.2,
881
+ objectSize: 1,
882
+ stagger: 0,
883
+ cameraMotion: !1,
884
+ orbitSpeed: 1,
885
+ fov: 38,
886
+ wireframe: !1,
887
+ strokeWidth: 3,
888
+ materialType: "standard",
889
+ environment: !1,
890
+ roughness: .38,
891
+ metalness: .18,
892
+ color: "#b9c2d0",
893
+ flatShading: !1,
894
+ showAxis: !1,
895
+ axisLength: 1.5,
896
+ axisOpacity: .7
897
+ }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
898
+ }
899
+ buildGeometry(e) {
900
+ let t = this.params;
901
+ switch (e) {
902
+ case "box": {
903
+ let e = Math.min(Math.max(this.rounding, 0), .7);
904
+ return e > 0 ? new Xe(1.5, 1.5, 1.5, 6, e) : new _e(1.5, 1.5, 1.5);
905
+ }
906
+ case "sphere": return new re(1, 64, 48);
907
+ case "torus": return new he(.78, t.tube ?? .32, 48, 96);
908
+ case "torusKnot": return new se(.7, .26, 160, 32, t.p ?? 2, t.q ?? 3);
909
+ case "cone": return new we(.95, 1.7, 64);
910
+ case "cylinder": return new be(.8, .8, 1.6, 64);
911
+ case "icosahedron": return new y(1.1, t.detail ?? 0);
912
+ case "octahedron": return new ne(1.15, t.detail ?? 0);
913
+ case "dodecahedron": return new ge(1.05, t.detail ?? 0);
914
+ default: return new _e(1.5, 1.5, 1.5);
915
+ }
916
+ }
917
+ rebuildGeometry() {
918
+ let e = this.activeGeom, t = this.wireGeom;
919
+ this.activeGeom = this.buildGeometry(this.primId), this.wireGeom = new Y(this.activeGeom);
920
+ for (let e of this.items) e.mesh.geometry = this.activeGeom, e.wire.geometry = this.wireGeom;
921
+ e.dispose(), t.dispose();
922
+ }
923
+ makeMaterial(e) {
924
+ let t = new N(this.color);
925
+ switch (e) {
926
+ case "normal": return new Se({ flatShading: this.flat });
927
+ case "phong": return new ae({
928
+ color: t,
929
+ flatShading: this.flat,
930
+ shininess: 60
931
+ });
932
+ case "toon": return new ee({ color: t });
933
+ case "glass": return new C({
934
+ color: t,
935
+ metalness: 0,
936
+ roughness: this.roughness,
937
+ transmission: 1,
938
+ thickness: .6,
939
+ ior: 1.4,
940
+ flatShading: this.flat
941
+ });
942
+ case "dispersion": return new C({
943
+ color: t,
944
+ metalness: 0,
945
+ roughness: this.roughness,
946
+ transmission: 1,
947
+ thickness: .8,
948
+ ior: 1.5,
949
+ dispersion: 6,
950
+ flatShading: this.flat
951
+ });
952
+ default: return new oe({
953
+ color: t,
954
+ roughness: this.roughness,
955
+ metalness: this.metalness,
956
+ flatShading: this.flat
957
+ });
958
+ }
959
+ }
960
+ setMaterialType(e) {
961
+ if (e === this.matType) return;
962
+ let t = this.material;
963
+ this.matType = e, this.material = this.makeMaterial(e);
964
+ for (let e of this.items) e.mesh.material = this.material;
965
+ t.dispose();
966
+ }
967
+ applyMaterialProps() {
968
+ let e = this.material;
969
+ e.color && this.matType !== "normal" && e.color.set(this.color), "roughness" in e && (e.roughness = this.roughness), "metalness" in e && this.matType !== "glass" && this.matType !== "dispersion" && (e.metalness = this.metalness), "flatShading" in e && e.flatShading !== this.flat && (e.flatShading = this.flat, e.needsUpdate = !0), this.lineMat.color.set(this.color);
970
+ }
971
+ setCount(e) {
972
+ for (e = Math.max(1, Math.min(mt, Math.round(e))); this.items.length < e;) {
973
+ let e = new A(this.activeGeom, this.material), t = new rt(this.wireGeom, this.lineMat);
974
+ t.visible = !1, this.scene.add(e), this.scene.add(t), this.items.push({
975
+ mesh: e,
976
+ wire: t
977
+ });
978
+ }
979
+ for (; this.items.length > e;) {
980
+ let e = this.items.pop();
981
+ this.scene.remove(e.mesh), this.scene.remove(e.wire);
982
+ }
983
+ }
984
+ ensureEnv() {
985
+ return this.envTex ||= this.pmrem.fromScene(new it(), .04).texture, this.envTex;
986
+ }
987
+ update({ globals: e, primitive: t, params: n } = {}) {
988
+ let r = !1;
989
+ if (t && t !== this.primId && (this.primId = t, r = !0), n && (this.params = {
990
+ ...this.params,
991
+ ...n
992
+ }, r = !0), e) {
993
+ this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.flat = !!e.flatShading, this.setMaterialType(e.materialType || "standard"), this.applyMaterialProps();
994
+ let t = !!e.wireframe;
995
+ for (let e of this.items) e.mesh.visible = !t, e.wire.visible = t;
996
+ this.lineMat.linewidth = (e.strokeWidth ?? 3) * pt, e.rounding != null && e.rounding !== this.rounding && (this.rounding = e.rounding, this.primId === "box" && (r = !0)), this.setCount(e.count ?? 1), this.layoutPos = h(e.arrangement || "single", e.count ?? 1, e.spread ?? 2.2), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), this.scene.environment = e.environment ? this.ensureEnv() : null, this.axes.visible = !!e.showAxis, this.axes.scale.setScalar(e.axisLength ?? 1.5), this.axes.material.opacity = e.axisOpacity ?? .7;
997
+ }
998
+ r && this.rebuildGeometry();
999
+ }
1000
+ resize(e, t) {
1001
+ this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
1002
+ }
1003
+ seek(e) {
1004
+ this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1005
+ }
1006
+ setBackground(e) {
1007
+ this.renderer.setClearColor(new N(e), 1);
1008
+ }
1009
+ resetCamera() {
1010
+ this.camera.position.set(0, .6, 4), this.controls.target.set(0, 0, 0), this.controls.update();
1011
+ }
1012
+ poseAt(e) {
1013
+ let t = this.globals;
1014
+ return t.animMode === "keyframe" ? dt(t.keyframes, e) : (this.presets[t.preset] || this.presets.spin)(e);
1015
+ }
1016
+ _applyLive(e) {
1017
+ let t = this.material;
1018
+ Number.isFinite(e.roughness) && "roughness" in t && (t.roughness = e.roughness), Number.isFinite(e.metalness) && "metalness" in t && this.matType !== "glass" && this.matType !== "dispersion" && (t.metalness = e.metalness), Number.isFinite(e.strokeWidth) && (this.lineMat.linewidth = e.strokeWidth * pt), Number.isFinite(e.fov) && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix()), Number.isFinite(e.axisLength) && this.axes.scale.setScalar(e.axisLength), Number.isFinite(e.axisOpacity) && (this.axes.material.opacity = e.axisOpacity);
1019
+ }
1020
+ frame(e) {
1021
+ this.step(e);
1022
+ }
1023
+ loop = () => {
1024
+ this.raf = requestAnimationFrame(this.loop);
1025
+ let e = performance.now(), t = (e - this.last) / 1e3;
1026
+ this.last = e, this.step(t);
1027
+ };
1028
+ step = (e) => {
1029
+ let t = this.globals, n;
1030
+ this.recording ? (this.accum += e, n = Math.min(this.accum, this.dur)) : (t.paused || (this.accum += e * (Number(t.speed) || 1)), n = t.loop ? this.accum % this.dur : Math.min(this.accum, this.dur)), this.onProgress && this.onProgress({
1031
+ t: n,
1032
+ dur: this.dur
1033
+ });
1034
+ let r = this.dur > 0 ? n / this.dur : 0, i = t, a = this.items.length, o = i.stagger ?? 0, s = i.objectSize ?? 1, c = 1 + 0 * (i.audioAmount ?? 1);
1035
+ for (let e = 0; e < a; e++) {
1036
+ let t = this.items[e], n = a > 1 ? (r + e / a * o) % 1 : r, i = this.poseAt(n), l = i.rot || [
1037
+ 0,
1038
+ 0,
1039
+ 0
1040
+ ], u = i.pos || [
1041
+ 0,
1042
+ 0,
1043
+ 0
1044
+ ], d = this.layoutPos[e] || [
1045
+ 0,
1046
+ 0,
1047
+ 0
1048
+ ];
1049
+ t.mesh.position.set(d[0] + u[0], d[1] + u[1], d[2] + u[2]), t.mesh.rotation.set(l[0], l[1], l[2]), t.mesh.scale.setScalar(s * (i.scale ?? 1) * c), t.wire.visible && (t.wire.position.copy(t.mesh.position), t.wire.rotation.copy(t.mesh.rotation), t.wire.scale.copy(t.mesh.scale));
1050
+ }
1051
+ if (this.controls.autoRotate = !this.recording && !!i.cameraMotion && !i.paused, this.controls.autoRotateSpeed = 2 * (i.orbitSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1052
+ let e = this._recStop;
1053
+ this._recStop = null, e();
1054
+ }
1055
+ };
1056
+ exportBlob() {
1057
+ return new Promise((e) => this.canvas.toBlob(e, "image/png"));
1058
+ }
1059
+ exportBlobAt(e, t) {
1060
+ let n = this.renderer.getPixelRatio(), r = this.w, i = this.h;
1061
+ return this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.lineMat.resolution.set(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), new Promise((e) => {
1062
+ this.canvas.toBlob((t) => {
1063
+ this.renderer.setPixelRatio(n), this.renderer.setSize(r, i, !1), this.lineMat.resolution.set(r, i), this.camera.aspect = r / i, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), e(t);
1064
+ }, "image/png");
1065
+ });
1066
+ }
1067
+ recordLoop(e, t, n = 30) {
1068
+ if (typeof MediaRecorder > "u" || !this.canvas.captureStream) return Promise.resolve(null);
1069
+ e ||= this.w, t ||= this.h;
1070
+ let r = this.renderer.getPixelRatio(), i = this.w, a = this.h;
1071
+ this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.lineMat.resolution.set(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
1072
+ let o = this.canvas.captureStream(n), s = (e) => typeof MediaRecorder.isTypeSupported == "function" && MediaRecorder.isTypeSupported(e), c = s("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : s("video/webm;codecs=vp8") ? "video/webm;codecs=vp8" : "video/webm", l = new MediaRecorder(o, {
1073
+ mimeType: c,
1074
+ videoBitsPerSecond: 12e6
1075
+ }), u = [];
1076
+ return l.ondataavailable = (e) => {
1077
+ e.data && e.data.size && u.push(e.data);
1078
+ }, this.accum = 0, this.recording = !0, new Promise((e) => {
1079
+ l.onstop = () => {
1080
+ this.recording = !1, this.accum = 0, this.renderer.setPixelRatio(r), this.renderer.setSize(i, a, !1), this.lineMat.resolution.set(i, a), this.camera.aspect = i / a, this.camera.updateProjectionMatrix(), e(new Blob(u, { type: "video/webm" }));
1081
+ }, this._recStop = () => l.stop(), l.start();
1082
+ });
1083
+ }
1084
+ dispose() {
1085
+ cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.activeGeom.dispose(), this.wireGeom.dispose(), this.axes.geometry.dispose(), this.axes.material.dispose(), this.envTex?.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1086
+ }
1087
+ }, gt = Math.PI * 2, _t = "#0b0b0e";
1088
+ function vt() {
1089
+ let e = document.createElement("canvas");
1090
+ e.width = e.height = 64;
1091
+ let t = e.getContext("2d"), n = t.createRadialGradient(64 / 2, 64 / 2, 0, 64 / 2, 64 / 2, 64 / 2);
1092
+ n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(.55, "rgba(255,255,255,0.85)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 64, 64);
1093
+ let r = new Ce(e);
1094
+ return r.needsUpdate = !0, r;
1095
+ }
1096
+ var yt = class {
1097
+ constructor(e, { autoLoop: t = !1 } = {}) {
1098
+ this.autoLoop = t, this.canvas = e, this.renderer = new T({
1099
+ canvas: e,
1100
+ antialias: !0,
1101
+ preserveDrawingBuffer: !0,
1102
+ alpha: !0
1103
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(_t), 1), this.scene = new w(), this.scene.fog = new Me(new N(_t), 3.2, 9.5), this.camera = new z(40, 1, .1, 100), this.camera.position.set(0, .4, 4.4), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2, this.controls.maxDistance = 14, this.sprite = vt(), this.material = new de({
1104
+ map: this.sprite,
1105
+ vertexColors: !0,
1106
+ size: .05,
1107
+ sizeAttenuation: !0,
1108
+ transparent: !0,
1109
+ alphaTest: .4,
1110
+ depthWrite: !0
1111
+ }), this.geometry = new P(), this.points = new te(this.geometry, this.material), this.scene.add(this.points), this.form = "helix", this.samples = 30, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this.count = 0, this._rebuild(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1112
+ form: "helix",
1113
+ samples: 30,
1114
+ cycles: 2,
1115
+ amp: .35,
1116
+ pointSize: .05,
1117
+ turns: 2.5,
1118
+ radius: .85,
1119
+ height: 2.4,
1120
+ spin: !1,
1121
+ spinSpeed: 1,
1122
+ fov: 40,
1123
+ loop: !0,
1124
+ duration: 8,
1125
+ paused: !0,
1126
+ speed: 1,
1127
+ color: "#e5dfcf",
1128
+ accent: "#8b8fd6"
1129
+ }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1130
+ }
1131
+ _rebuild() {
1132
+ this.count = o(this.form, this.samples), this.posArr = new Float32Array(this.count * 3), this.colArr = new Float32Array(this.count * 3), this.vparArr = new Float32Array(this.count), u(this.form, this.samples, this.vparArr);
1133
+ let e = new P();
1134
+ e.setAttribute("position", new M(this.posArr, 3)), e.setAttribute("color", new M(this.colArr, 3));
1135
+ let t = this.geometry;
1136
+ this.geometry = e, this.points.geometry = e, t.dispose(), this._recolor();
1137
+ }
1138
+ _recolor() {
1139
+ let e = new N(this.colFg), t = new N(this.colAccent), n = this.colArr;
1140
+ for (let r = 0; r < this.count; r++) {
1141
+ let i = this.vparArr[r];
1142
+ n[r * 3] = t.r + (e.r - t.r) * i, n[r * 3 + 1] = t.g + (e.g - t.g) * i, n[r * 3 + 2] = t.b + (e.b - t.b) * i;
1143
+ }
1144
+ this.geometry.attributes.color && (this.geometry.attributes.color.needsUpdate = !0);
1145
+ }
1146
+ update({ form: e, globals: t } = {}) {
1147
+ let n = !1;
1148
+ if (e && e !== this.form && (this.form = e, n = !0), t) {
1149
+ this.globals = t, t.samples && t.samples !== this.samples && (this.samples = t.samples, n = !0), this.material.size = t.pointSize ?? this.material.size, t.fov != null && t.fov !== this.camera.fov && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix()), t.duration && (this.dur = t.duration);
1150
+ let e = !1;
1151
+ t.color && t.color !== this.colFg && (this.colFg = t.color, e = !0), t.accent && t.accent !== this.colAccent && (this.colAccent = t.accent, e = !0), n ? this._rebuild() : e && this._recolor();
1152
+ } else n && this._rebuild();
1153
+ }
1154
+ resize(e, t) {
1155
+ this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1156
+ }
1157
+ seek(e) {
1158
+ this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1159
+ }
1160
+ setBackground(e) {
1161
+ let t = new N(e);
1162
+ this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1163
+ }
1164
+ resetCamera() {
1165
+ this.camera.position.set(0, .4, 4.4), this.controls.target.set(0, 0, 0), this.controls.update();
1166
+ }
1167
+ frame(e) {
1168
+ this.step(e);
1169
+ }
1170
+ loop = () => {
1171
+ this.raf = requestAnimationFrame(this.loop);
1172
+ let e = performance.now(), t = (e - this.last) / 1e3;
1173
+ this.last = e, this.step(t);
1174
+ };
1175
+ step = (e) => {
1176
+ let t = this.globals, n;
1177
+ this.recording ? (this.accum += e, n = Math.min(this.accum, this.dur)) : (t.paused || (this.accum += e * (t.speed ?? 1)), n = t.loop ? this.accum % this.dur : Math.min(this.accum, this.dur)), this.onProgress && this.onProgress({
1178
+ t: n,
1179
+ dur: this.dur
1180
+ });
1181
+ let r = (this.dur > 0 ? n / this.dur : 0) * gt * (t.cycles ?? 2);
1182
+ if (d(this.form, this.samples, r, {
1183
+ amp: t.amp ?? .35,
1184
+ turns: t.turns,
1185
+ radius: t.radius,
1186
+ height: t.height
1187
+ }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.controls.autoRotate = !this.recording && !!t.spin && !t.paused, this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1188
+ let e = this._recStop;
1189
+ this._recStop = null, e();
1190
+ }
1191
+ };
1192
+ exportBlob() {
1193
+ return new Promise((e) => this.canvas.toBlob(e, "image/png"));
1194
+ }
1195
+ exportBlobAt(e, t) {
1196
+ let n = this.renderer.getPixelRatio(), r = this.w, i = this.h;
1197
+ return this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), new Promise((e) => {
1198
+ this.canvas.toBlob((t) => {
1199
+ this.renderer.setPixelRatio(n), this.renderer.setSize(r, i, !1), this.camera.aspect = r / i, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), e(t);
1200
+ }, "image/png");
1201
+ });
1202
+ }
1203
+ recordLoop(e, t, n = 30) {
1204
+ if (typeof MediaRecorder > "u" || !this.canvas.captureStream) return Promise.resolve(null);
1205
+ e ||= this.w, t ||= this.h;
1206
+ let r = this.renderer.getPixelRatio(), i = this.w, a = this.h;
1207
+ this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
1208
+ let o = this.canvas.captureStream(n), s = (e) => typeof MediaRecorder.isTypeSupported == "function" && MediaRecorder.isTypeSupported(e), c = s("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : s("video/webm;codecs=vp8") ? "video/webm;codecs=vp8" : "video/webm", l = new MediaRecorder(o, {
1209
+ mimeType: c,
1210
+ videoBitsPerSecond: 12e6
1211
+ }), u = [];
1212
+ return l.ondataavailable = (e) => {
1213
+ e.data && e.data.size && u.push(e.data);
1214
+ }, this.accum = 0, this.recording = !0, new Promise((e) => {
1215
+ l.onstop = () => {
1216
+ this.recording = !1, this.accum = 0, this.renderer.setPixelRatio(r), this.renderer.setSize(i, a, !1), this.camera.aspect = i / a, this.camera.updateProjectionMatrix(), e(new Blob(u, { type: "video/webm" }));
1217
+ }, this._recStop = () => l.stop(), l.start();
1218
+ });
1219
+ }
1220
+ dispose() {
1221
+ cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.sprite.dispose(), this.geometry.dispose(), this.renderer.dispose();
1222
+ }
1223
+ }, bt = Math.PI * 2, xt = "#0b0b0e", St = {
1224
+ mountain: {
1225
+ pos: [
1226
+ 0,
1227
+ 2.6,
1228
+ 6.2
1229
+ ],
1230
+ target: [
1231
+ 0,
1232
+ 0,
1233
+ 0
1234
+ ],
1235
+ fov: 45
1236
+ },
1237
+ ocean: {
1238
+ pos: [
1239
+ 0,
1240
+ 1.4,
1241
+ 5.6
1242
+ ],
1243
+ target: [
1244
+ 0,
1245
+ 0,
1246
+ 0
1247
+ ],
1248
+ fov: 42
1249
+ },
1250
+ tunnel: {
1251
+ pos: [
1252
+ 0,
1253
+ 0,
1254
+ 0
1255
+ ],
1256
+ target: [
1257
+ 0,
1258
+ 0,
1259
+ -3
1260
+ ],
1261
+ fov: 70
1262
+ }
1263
+ }, Ct = class {
1264
+ constructor(e, { autoLoop: t = !1 } = {}) {
1265
+ this.autoLoop = t, this.canvas = e, this.renderer = new T({
1266
+ canvas: e,
1267
+ antialias: !0,
1268
+ preserveDrawingBuffer: !0,
1269
+ alpha: !0
1270
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(xt), 1), this.scene = new w(), this.scene.fog = new Me(new N(xt), 3, 11), this.camera = new z(45, 1, .1, 100), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.minDistance = .1, this.controls.maxDistance = 16, this.material = new _({
1271
+ vertexColors: !0,
1272
+ side: 2
1273
+ }), this.geometry = new P(), this.mesh = new A(this.geometry, this.material), this.scene.add(this.mesh), this.env = "mountain", this.samples = 48, this.colFg = "#e5dfcf", this.colAccent = "#8b8fd6", this.posArr = null, this.colArr = null, this.vparArr = null, this._rebuild(), this.resetCamera(), this.dur = 8, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1274
+ env: "mountain",
1275
+ samples: 48,
1276
+ cycles: 2,
1277
+ amp: .5,
1278
+ fov: 45,
1279
+ spin: !1,
1280
+ spinSpeed: 1,
1281
+ loop: !0,
1282
+ duration: 8,
1283
+ paused: !0,
1284
+ speed: 1,
1285
+ color: "#e5dfcf",
1286
+ accent: "#8b8fd6"
1287
+ }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1288
+ }
1289
+ _rebuild() {
1290
+ let e = this.samples * this.samples;
1291
+ this.posArr = new Float32Array(e * 3), this.colArr = new Float32Array(e * 3), this.vparArr = new Float32Array(e), m(this.env, this.samples, this.vparArr);
1292
+ let t = new P();
1293
+ t.setAttribute("position", new M(this.posArr, 3)), t.setAttribute("color", new M(this.colArr, 3)), t.setIndex(new M(p(this.env, this.samples), 1));
1294
+ let n = this.geometry;
1295
+ this.geometry = t, this.mesh.geometry = t, n.dispose(), this._recolor();
1296
+ }
1297
+ _recolor() {
1298
+ let e = new N(this.colFg), t = new N(this.colAccent), n = this.colArr, r = this.samples * this.samples;
1299
+ for (let i = 0; i < r; i++) {
1300
+ let r = this.vparArr[i];
1301
+ n[i * 3] = t.r + (e.r - t.r) * r, n[i * 3 + 1] = t.g + (e.g - t.g) * r, n[i * 3 + 2] = t.b + (e.b - t.b) * r;
1302
+ }
1303
+ this.geometry.attributes.color && (this.geometry.attributes.color.needsUpdate = !0);
1304
+ }
1305
+ update({ env: e, globals: t } = {}) {
1306
+ let n = !1;
1307
+ if (e && e !== this.env && (this.env = e, n = !0, this.resetCamera()), t) {
1308
+ this.globals = t, t.samples && t.samples !== this.samples && (this.samples = t.samples, n = !0), t.fov != null && t.fov !== this.camera.fov && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix()), t.duration && (this.dur = t.duration);
1309
+ let e = !1;
1310
+ t.color && t.color !== this.colFg && (this.colFg = t.color, e = !0), t.accent && t.accent !== this.colAccent && (this.colAccent = t.accent, e = !0), n ? this._rebuild() : e && this._recolor();
1311
+ } else n && this._rebuild();
1312
+ }
1313
+ resize(e, t) {
1314
+ this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.w = e, this.h = t;
1315
+ }
1316
+ seek(e) {
1317
+ this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1318
+ }
1319
+ setBackground(e) {
1320
+ let t = new N(e);
1321
+ this.renderer.setClearColor(t, 1), this.scene.fog && this.scene.fog.color.copy(t);
1322
+ }
1323
+ resetCamera() {
1324
+ let e = St[this.env] || St.mountain;
1325
+ this.camera.position.set(...e.pos), this.camera.fov = this.globals?.fov ?? e.fov, this.camera.updateProjectionMatrix(), this.controls.target.set(...e.target), this.controls.update();
1326
+ }
1327
+ frame(e) {
1328
+ this.step(e);
1329
+ }
1330
+ loop = () => {
1331
+ this.raf = requestAnimationFrame(this.loop);
1332
+ let e = performance.now(), t = (e - this.last) / 1e3;
1333
+ this.last = e, this.step(t);
1334
+ };
1335
+ step = (e) => {
1336
+ let t = this.globals, n;
1337
+ this.recording ? (this.accum += e, n = Math.min(this.accum, this.dur)) : (t.paused || (this.accum += e * (t.speed ?? 1)), n = t.loop ? this.accum % this.dur : Math.min(this.accum, this.dur)), this.onProgress && this.onProgress({
1338
+ t: n,
1339
+ dur: this.dur
1340
+ });
1341
+ let r = (this.dur > 0 ? n / this.dur : 0) * bt * (t.cycles ?? 2);
1342
+ if (l(this.env, this.samples, r, { amp: t.amp ?? .5 }, this.posArr), this.geometry.attributes.position.needsUpdate = !0, this.geometry.computeVertexNormals(), this.controls.autoRotate = !this.recording && !!t.spin && !t.paused && !a(this.env), this.controls.autoRotateSpeed = 2 * (t.spinSpeed ?? 1), this.controls.update(), this.w && this.h && this.renderer.render(this.scene, this.camera), this.recording && this.accum >= this.dur && this._recStop) {
1343
+ let e = this._recStop;
1344
+ this._recStop = null, e();
1345
+ }
1346
+ };
1347
+ exportBlob() {
1348
+ return new Promise((e) => this.canvas.toBlob(e, "image/png"));
1349
+ }
1350
+ exportBlobAt(e, t) {
1351
+ let n = this.renderer.getPixelRatio(), r = this.w, i = this.h;
1352
+ return this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), new Promise((e) => {
1353
+ this.canvas.toBlob((t) => {
1354
+ this.renderer.setPixelRatio(n), this.renderer.setSize(r, i, !1), this.camera.aspect = r / i, this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera), e(t);
1355
+ }, "image/png");
1356
+ });
1357
+ }
1358
+ recordLoop(e, t, n = 30) {
1359
+ if (typeof MediaRecorder > "u" || !this.canvas.captureStream) return Promise.resolve(null);
1360
+ e ||= this.w, t ||= this.h;
1361
+ let r = this.renderer.getPixelRatio(), i = this.w, a = this.h;
1362
+ this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
1363
+ let o = this.canvas.captureStream(n), s = (e) => typeof MediaRecorder.isTypeSupported == "function" && MediaRecorder.isTypeSupported(e), c = s("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : s("video/webm;codecs=vp8") ? "video/webm;codecs=vp8" : "video/webm", l = new MediaRecorder(o, {
1364
+ mimeType: c,
1365
+ videoBitsPerSecond: 12e6
1366
+ }), u = [];
1367
+ return l.ondataavailable = (e) => {
1368
+ e.data && e.data.size && u.push(e.data);
1369
+ }, this.accum = 0, this.recording = !0, new Promise((e) => {
1370
+ l.onstop = () => {
1371
+ this.recording = !1, this.accum = 0, this.renderer.setPixelRatio(r), this.renderer.setSize(i, a, !1), this.camera.aspect = i / a, this.camera.updateProjectionMatrix(), e(new Blob(u, { type: "video/webm" }));
1372
+ }, this._recStop = () => l.stop(), l.start();
1373
+ });
1374
+ }
1375
+ dispose() {
1376
+ cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.geometry.dispose(), this.renderer.dispose();
1377
+ }
1378
+ }, wt = {
1379
+ name: "CopyShader",
1380
+ uniforms: {
1381
+ tDiffuse: { value: null },
1382
+ opacity: { value: 1 }
1383
+ },
1384
+ vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1385
+ fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
1386
+ }, Z = class {
1387
+ constructor() {
1388
+ this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
1389
+ }
1390
+ setSize() {}
1391
+ render() {
1392
+ console.error("THREE.Pass: .render() must be implemented in derived pass.");
1393
+ }
1394
+ dispose() {}
1395
+ }, Tt = new ie(-1, 1, 1, -1, 0, 1), Et = new class extends P {
1396
+ constructor() {
1397
+ super(), this.setAttribute("position", new L([
1398
+ -1,
1399
+ 3,
1400
+ 0,
1401
+ -1,
1402
+ -1,
1403
+ 0,
1404
+ 3,
1405
+ -1,
1406
+ 0
1407
+ ], 3)), this.setAttribute("uv", new L([
1408
+ 0,
1409
+ 2,
1410
+ 0,
1411
+ 0,
1412
+ 2,
1413
+ 0
1414
+ ], 2));
1415
+ }
1416
+ }(), Dt = class {
1417
+ constructor(e) {
1418
+ this._mesh = new A(Et, e);
1419
+ }
1420
+ dispose() {
1421
+ this._mesh.geometry.dispose();
1422
+ }
1423
+ render(e) {
1424
+ e.render(this._mesh, Tt);
1425
+ }
1426
+ get material() {
1427
+ return this._mesh.material;
1428
+ }
1429
+ set material(e) {
1430
+ this._mesh.material = e;
1431
+ }
1432
+ }, Ot = class extends Z {
1433
+ constructor(e, t) {
1434
+ super(), this.textureID = t === void 0 ? "tDiffuse" : t, e instanceof S ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = D.clone(e.uniforms), this.material = new S({
1435
+ name: e.name === void 0 ? "unspecified" : e.name,
1436
+ defines: Object.assign({}, e.defines),
1437
+ uniforms: this.uniforms,
1438
+ vertexShader: e.vertexShader,
1439
+ fragmentShader: e.fragmentShader
1440
+ })), this.fsQuad = new Dt(this.material);
1441
+ }
1442
+ render(e, t, n) {
1443
+ this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = n.texture), this.fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
1444
+ }
1445
+ dispose() {
1446
+ this.material.dispose(), this.fsQuad.dispose();
1447
+ }
1448
+ }, kt = class extends Z {
1449
+ constructor(e, t) {
1450
+ super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
1451
+ }
1452
+ render(e, t, n) {
1453
+ let r = e.getContext(), i = e.state;
1454
+ i.buffers.color.setMask(!1), i.buffers.depth.setMask(!1), i.buffers.color.setLocked(!0), i.buffers.depth.setLocked(!0);
1455
+ let a, o;
1456
+ this.inverse ? (a = 0, o = 1) : (a = 1, o = 0), i.buffers.stencil.setTest(!0), i.buffers.stencil.setOp(r.REPLACE, r.REPLACE, r.REPLACE), i.buffers.stencil.setFunc(r.ALWAYS, a, 4294967295), i.buffers.stencil.setClear(o), i.buffers.stencil.setLocked(!0), e.setRenderTarget(n), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), i.buffers.color.setLocked(!1), i.buffers.depth.setLocked(!1), i.buffers.color.setMask(!0), i.buffers.depth.setMask(!0), i.buffers.stencil.setLocked(!1), i.buffers.stencil.setFunc(r.EQUAL, 1, 4294967295), i.buffers.stencil.setOp(r.KEEP, r.KEEP, r.KEEP), i.buffers.stencil.setLocked(!0);
1457
+ }
1458
+ }, At = class extends Z {
1459
+ constructor() {
1460
+ super(), this.needsSwap = !1;
1461
+ }
1462
+ render(e) {
1463
+ e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
1464
+ }
1465
+ }, jt = class {
1466
+ constructor(e, t) {
1467
+ if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
1468
+ let n = e.getSize(new I());
1469
+ this._width = n.width, this._height = n.height, t = new k(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: R }), t.texture.name = "EffectComposer.rt1";
1470
+ } else this._width = t.width, this._height = t.height;
1471
+ this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new Ot(wt), this.copyPass.material.blending = 0, this.clock = new ye();
1472
+ }
1473
+ swapBuffers() {
1474
+ let e = this.readBuffer;
1475
+ this.readBuffer = this.writeBuffer, this.writeBuffer = e;
1476
+ }
1477
+ addPass(e) {
1478
+ this.passes.push(e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
1479
+ }
1480
+ insertPass(e, t) {
1481
+ this.passes.splice(t, 0, e), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
1482
+ }
1483
+ removePass(e) {
1484
+ let t = this.passes.indexOf(e);
1485
+ t !== -1 && this.passes.splice(t, 1);
1486
+ }
1487
+ isLastEnabledPass(e) {
1488
+ for (let t = e + 1; t < this.passes.length; t++) if (this.passes[t].enabled) return !1;
1489
+ return !0;
1490
+ }
1491
+ render(e) {
1492
+ e === void 0 && (e = this.clock.getDelta());
1493
+ let t = this.renderer.getRenderTarget(), n = !1;
1494
+ for (let t = 0, r = this.passes.length; t < r; t++) {
1495
+ let r = this.passes[t];
1496
+ if (r.enabled !== !1) {
1497
+ if (r.renderToScreen = this.renderToScreen && this.isLastEnabledPass(t), r.render(this.renderer, this.writeBuffer, this.readBuffer, e, n), r.needsSwap) {
1498
+ if (n) {
1499
+ let t = this.renderer.getContext(), n = this.renderer.state.buffers.stencil;
1500
+ n.setFunc(t.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), n.setFunc(t.EQUAL, 1, 4294967295);
1501
+ }
1502
+ this.swapBuffers();
1503
+ }
1504
+ kt !== void 0 && (r instanceof kt ? n = !0 : r instanceof At && (n = !1));
1505
+ }
1506
+ }
1507
+ this.renderer.setRenderTarget(t);
1508
+ }
1509
+ reset(e) {
1510
+ if (e === void 0) {
1511
+ let t = this.renderer.getSize(new I());
1512
+ this._pixelRatio = this.renderer.getPixelRatio(), this._width = t.width, this._height = t.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
1513
+ }
1514
+ this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
1515
+ }
1516
+ setSize(e, t) {
1517
+ this._width = e, this._height = t;
1518
+ let n = this._width * this._pixelRatio, r = this._height * this._pixelRatio;
1519
+ this.renderTarget1.setSize(n, r), this.renderTarget2.setSize(n, r);
1520
+ for (let e = 0; e < this.passes.length; e++) this.passes[e].setSize(n, r);
1521
+ }
1522
+ setPixelRatio(e) {
1523
+ this._pixelRatio = e, this.setSize(this._width, this._height);
1524
+ }
1525
+ dispose() {
1526
+ this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
1527
+ }
1528
+ }, Mt = class extends Z {
1529
+ constructor(e, t, n = null, r = null, i = null) {
1530
+ super(), this.scene = e, this.camera = t, this.overrideMaterial = n, this.clearColor = r, this.clearAlpha = i, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this._oldClearColor = new N();
1531
+ }
1532
+ render(e, t, n) {
1533
+ let r = e.autoClear;
1534
+ e.autoClear = !1;
1535
+ let i, a;
1536
+ this.overrideMaterial !== null && (a = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (i = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == 1 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : n), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(i), this.overrideMaterial !== null && (this.scene.overrideMaterial = a), e.autoClear = r;
1537
+ }
1538
+ }, Nt = {
1539
+ name: "LuminosityHighPassShader",
1540
+ shaderID: "luminosityHighPass",
1541
+ uniforms: {
1542
+ tDiffuse: { value: null },
1543
+ luminosityThreshold: { value: 1 },
1544
+ smoothWidth: { value: 1 },
1545
+ defaultColor: { value: new N(0) },
1546
+ defaultOpacity: { value: 0 }
1547
+ },
1548
+ vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1549
+ fragmentShader: "\n\n uniform sampler2D tDiffuse;\n uniform vec3 defaultColor;\n uniform float defaultOpacity;\n uniform float luminosityThreshold;\n uniform float smoothWidth;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n\n float v = luminance( texel.xyz );\n\n vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n gl_FragColor = mix( outputColor, texel, alpha );\n\n }"
1550
+ }, Pt = class e extends Z {
1551
+ constructor(e, t, n, r) {
1552
+ super(), this.strength = t === void 0 ? 1 : t, this.radius = n, this.threshold = r, this.resolution = e === void 0 ? new I(256, 256) : new I(e.x, e.y), this.clearColor = new N(0, 0, 0), this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1553
+ let i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1554
+ this.renderTargetBright = new k(i, a, { type: R }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1555
+ for (let e = 0; e < this.nMips; e++) {
1556
+ let t = new k(i, a, { type: R });
1557
+ t.texture.name = "UnrealBloomPass.h" + e, t.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(t);
1558
+ let n = new k(i, a, { type: R });
1559
+ n.texture.name = "UnrealBloomPass.v" + e, n.texture.generateMipmaps = !1, this.renderTargetsVertical.push(n), i = Math.round(i / 2), a = Math.round(a / 2);
1560
+ }
1561
+ let o = Nt;
1562
+ this.highPassUniforms = D.clone(o.uniforms), this.highPassUniforms.luminosityThreshold.value = r, this.highPassUniforms.smoothWidth.value = .01, this.materialHighPassFilter = new S({
1563
+ uniforms: this.highPassUniforms,
1564
+ vertexShader: o.vertexShader,
1565
+ fragmentShader: o.fragmentShader
1566
+ }), this.separableBlurMaterials = [];
1567
+ let s = [
1568
+ 3,
1569
+ 5,
1570
+ 7,
1571
+ 9,
1572
+ 11
1573
+ ];
1574
+ i = Math.round(this.resolution.x / 2), a = Math.round(this.resolution.y / 2);
1575
+ for (let e = 0; e < this.nMips; e++) this.separableBlurMaterials.push(this.getSeperableBlurMaterial(s[e])), this.separableBlurMaterials[e].uniforms.invSize.value = new I(1 / i, 1 / a), i = Math.round(i / 2), a = Math.round(a / 2);
1576
+ this.compositeMaterial = this.getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = .1;
1577
+ let c = [
1578
+ 1,
1579
+ .8,
1580
+ .6,
1581
+ .4,
1582
+ .2
1583
+ ];
1584
+ this.compositeMaterial.uniforms.bloomFactors.value = c, this.bloomTintColors = [
1585
+ new j(1, 1, 1),
1586
+ new j(1, 1, 1),
1587
+ new j(1, 1, 1),
1588
+ new j(1, 1, 1),
1589
+ new j(1, 1, 1)
1590
+ ], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors;
1591
+ let l = wt;
1592
+ this.copyUniforms = D.clone(l.uniforms), this.blendMaterial = new S({
1593
+ uniforms: this.copyUniforms,
1594
+ vertexShader: l.vertexShader,
1595
+ fragmentShader: l.fragmentShader,
1596
+ blending: 2,
1597
+ depthTest: !1,
1598
+ depthWrite: !1,
1599
+ transparent: !0
1600
+ }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new N(), this.oldClearAlpha = 1, this.basic = new _(), this.fsQuad = new Dt(null);
1601
+ }
1602
+ dispose() {
1603
+ for (let e = 0; e < this.renderTargetsHorizontal.length; e++) this.renderTargetsHorizontal[e].dispose();
1604
+ for (let e = 0; e < this.renderTargetsVertical.length; e++) this.renderTargetsVertical[e].dispose();
1605
+ this.renderTargetBright.dispose();
1606
+ for (let e = 0; e < this.separableBlurMaterials.length; e++) this.separableBlurMaterials[e].dispose();
1607
+ this.compositeMaterial.dispose(), this.blendMaterial.dispose(), this.basic.dispose(), this.fsQuad.dispose();
1608
+ }
1609
+ setSize(e, t) {
1610
+ let n = Math.round(e / 2), r = Math.round(t / 2);
1611
+ this.renderTargetBright.setSize(n, r);
1612
+ for (let e = 0; e < this.nMips; e++) this.renderTargetsHorizontal[e].setSize(n, r), this.renderTargetsVertical[e].setSize(n, r), this.separableBlurMaterials[e].uniforms.invSize.value = new I(1 / n, 1 / r), n = Math.round(n / 2), r = Math.round(r / 2);
1613
+ }
1614
+ render(t, n, r, i, a) {
1615
+ t.getClearColor(this._oldClearColor), this.oldClearAlpha = t.getClearAlpha();
1616
+ let o = t.autoClear;
1617
+ t.autoClear = !1, t.setClearColor(this.clearColor, 0), a && t.state.buffers.stencil.setTest(!1), this.renderToScreen && (this.fsQuad.material = this.basic, this.basic.map = r.texture, t.setRenderTarget(null), t.clear(), this.fsQuad.render(t)), this.highPassUniforms.tDiffuse.value = r.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this.fsQuad.material = this.materialHighPassFilter, t.setRenderTarget(this.renderTargetBright), t.clear(), this.fsQuad.render(t);
1618
+ let s = this.renderTargetBright;
1619
+ for (let n = 0; n < this.nMips; n++) this.fsQuad.material = this.separableBlurMaterials[n], this.separableBlurMaterials[n].uniforms.colorTexture.value = s.texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionX, t.setRenderTarget(this.renderTargetsHorizontal[n]), t.clear(), this.fsQuad.render(t), this.separableBlurMaterials[n].uniforms.colorTexture.value = this.renderTargetsHorizontal[n].texture, this.separableBlurMaterials[n].uniforms.direction.value = e.BlurDirectionY, t.setRenderTarget(this.renderTargetsVertical[n]), t.clear(), this.fsQuad.render(t), s = this.renderTargetsVertical[n];
1620
+ this.fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, t.setRenderTarget(this.renderTargetsHorizontal[0]), t.clear(), this.fsQuad.render(t), this.fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, a && t.state.buffers.stencil.setTest(!0), this.renderToScreen ? (t.setRenderTarget(null), this.fsQuad.render(t)) : (t.setRenderTarget(r), this.fsQuad.render(t)), t.setClearColor(this._oldClearColor, this.oldClearAlpha), t.autoClear = o;
1621
+ }
1622
+ getSeperableBlurMaterial(e) {
1623
+ let t = [];
1624
+ for (let n = 0; n < e; n++) t.push(.39894 * Math.exp(-.5 * n * n / (e * e)) / e);
1625
+ return new S({
1626
+ defines: { KERNEL_RADIUS: e },
1627
+ uniforms: {
1628
+ colorTexture: { value: null },
1629
+ invSize: { value: new I(.5, .5) },
1630
+ direction: { value: new I(.5, .5) },
1631
+ gaussianCoefficients: { value: t }
1632
+ },
1633
+ vertexShader: "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1634
+ fragmentShader: "#include <common>\n varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 invSize;\n uniform vec2 direction;\n uniform float gaussianCoefficients[KERNEL_RADIUS];\n\n void main() {\n float weightSum = gaussianCoefficients[0];\n vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n for( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n float x = float(i);\n float w = gaussianCoefficients[i];\n vec2 uvOffset = direction * invSize * x;\n vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n diffuseSum += (sample1 + sample2) * w;\n weightSum += 2.0 * w;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n }"
1635
+ });
1636
+ }
1637
+ getCompositeMaterial(e) {
1638
+ return new S({
1639
+ defines: { NUM_MIPS: e },
1640
+ uniforms: {
1641
+ blurTexture1: { value: null },
1642
+ blurTexture2: { value: null },
1643
+ blurTexture3: { value: null },
1644
+ blurTexture4: { value: null },
1645
+ blurTexture5: { value: null },
1646
+ bloomStrength: { value: 1 },
1647
+ bloomFactors: { value: null },
1648
+ bloomTintColors: { value: null },
1649
+ bloomRadius: { value: 0 }
1650
+ },
1651
+ vertexShader: "varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1652
+ fragmentShader: "varying vec2 vUv;\n uniform sampler2D blurTexture1;\n uniform sampler2D blurTexture2;\n uniform sampler2D blurTexture3;\n uniform sampler2D blurTexture4;\n uniform sampler2D blurTexture5;\n uniform float bloomStrength;\n uniform float bloomRadius;\n uniform float bloomFactors[NUM_MIPS];\n uniform vec3 bloomTintColors[NUM_MIPS];\n\n float lerpBloomFactor(const in float factor) {\n float mirrorFactor = 1.2 - factor;\n return mix(factor, mirrorFactor, bloomRadius);\n }\n\n void main() {\n gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n }"
1653
+ });
1654
+ }
1655
+ };
1656
+ Pt.BlurDirectionX = new I(1, 0), Pt.BlurDirectionY = new I(0, 1);
1657
+ //#endregion
1658
+ //#region src/loops/gl/rng.js
1659
+ function Ft(e) {
1660
+ let t = e >>> 0;
1661
+ return function() {
1662
+ t |= 0, t = t + 1831565813 | 0;
1663
+ let e = Math.imul(t ^ t >>> 15, 1 | t);
1664
+ return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
1665
+ };
1666
+ }
1667
+ //#endregion
1668
+ //#region src/loops/gl/ribbonGeometry.js
1669
+ function It(e, t, n, r) {
1670
+ n = Math.min(n, e, t);
1671
+ let i = Math.max(4, Math.round(r / 4)), a = [
1672
+ {
1673
+ cx: e - n,
1674
+ cy: t - n,
1675
+ a0: 0
1676
+ },
1677
+ {
1678
+ cx: -(e - n),
1679
+ cy: t - n,
1680
+ a0: Math.PI / 2
1681
+ },
1682
+ {
1683
+ cx: -(e - n),
1684
+ cy: -(t - n),
1685
+ a0: Math.PI
1686
+ },
1687
+ {
1688
+ cx: e - n,
1689
+ cy: -(t - n),
1690
+ a0: 3 * Math.PI / 2
1691
+ }
1692
+ ], o = [];
1693
+ for (let e of a) for (let t = 0; t < i; t++) {
1694
+ let r = e.a0 + t / i * (Math.PI / 2);
1695
+ o.push({
1696
+ u: e.cx + Math.cos(r) * n,
1697
+ v: e.cy + Math.sin(r) * n
1698
+ });
1699
+ }
1700
+ return o;
1701
+ }
1702
+ function Lt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1 } = {}) {
1703
+ let o = Ft(e >>> 0 || 1), s = (e) => (o() - .5) * 2 * e, c = Math.max(1, Math.round(t)), l = -((c - 1) * r) / 2, u = n, d = [], f = 0, p = (t, n) => {
1704
+ d.push(new j(t, n, Math.sin(f * 1.7 + e) * i)), f += 1;
1705
+ };
1706
+ for (let e = 0; e < c; e++) {
1707
+ let t = l + e * r + s(r * .06), n = e % 2 == 0, i = n ? -u / 2 : u / 2, a = n ? u / 2 : -u / 2;
1708
+ for (let e = 0; e < 10; e++) p(t, i + (a - i) * e / 10);
1709
+ if (e < c - 1) {
1710
+ let i = l + (e + 1) * r, o = (t + i) / 2, s = (i - t) / 2, c = n ? 1 : -1;
1711
+ for (let e = 0; e <= 24; e++) {
1712
+ let t = e / 24 * Math.PI;
1713
+ p(o - Math.cos(t) * s, a + c * Math.sin(t) * s);
1714
+ }
1715
+ }
1716
+ }
1717
+ if (a > 0 && d.length >= 2) {
1718
+ let t = d[d.length - 1], n = d[d.length - 2], o = t.clone().sub(n).setZ(0).normalize(), s = new j(-o.y, o.x, 0).normalize(), c = r * .5, l = t.clone().add(s.clone().multiplyScalar(c)), u = Math.atan2(t.y - l.y, t.x - l.x), f = 1.1 * a;
1719
+ for (let n = 1; n <= 44; n++) {
1720
+ let r = n / 44, a = u - f * Math.PI * 2 * r, o = c * (1 - .7 * r);
1721
+ d.push(new j(l.x + Math.cos(a) * o, l.y + Math.sin(a) * o, t.z + Math.sin(r * 3 + e) * i * .4));
1722
+ }
1723
+ }
1724
+ return new Ae(d, !1, "centripetal");
1725
+ }
1726
+ function Rt({ seed: e = 1, loops: t = 3, height: n = 2.2, gap: r = .92, depth: i = .35, curl: a = 1, width: o = .5, ribbonThickness: s = .12, corner: c = .045, tubularSegments: l = 800, radialSegments: u = 48 } = {}) {
1727
+ let d = Lt({
1728
+ seed: e,
1729
+ loops: t,
1730
+ height: n,
1731
+ gap: r,
1732
+ depth: i,
1733
+ curl: a
1734
+ });
1735
+ d.arcLengthDivisions = Math.max(400, l);
1736
+ let f = d.computeFrenetFrames(l, !1), p = It(o / 2, s / 2, c, u), m = p.length, h = m + 1, g = [], _ = [], v = [], y = new j();
1737
+ for (let e = 0; e <= l; e++) {
1738
+ d.getPointAt(e / l, y);
1739
+ let t = f.normals[e], n = f.binormals[e];
1740
+ for (let r = 0; r <= m; r++) {
1741
+ let i = p[r % m];
1742
+ g.push(y.x + i.u * n.x + i.v * t.x, y.y + i.u * n.y + i.v * t.y, y.z + i.u * n.z + i.v * t.z), _.push(e / l, r / m);
1743
+ }
1744
+ }
1745
+ for (let e = 0; e < l; e++) for (let t = 0; t < m; t++) {
1746
+ let n = e * h + t, r = (e + 1) * h + t, i = (e + 1) * h + t + 1, a = e * h + t + 1;
1747
+ v.push(n, r, a, r, i, a);
1748
+ }
1749
+ let b = g.length / 3;
1750
+ d.getPointAt(0, y), g.push(y.x, y.y, y.z), _.push(0, .5);
1751
+ let ee = g.length / 3;
1752
+ d.getPointAt(1, y), g.push(y.x, y.y, y.z), _.push(1, .5);
1753
+ for (let e = 0; e < m; e++) {
1754
+ v.push(b, e + 1, e);
1755
+ let t = l * h;
1756
+ v.push(ee, t + e, t + e + 1);
1757
+ }
1758
+ let x = new P();
1759
+ return x.setAttribute("position", new L(g, 3)), x.setAttribute("uv", new L(_, 2)), x.setIndex(v), x.computeVertexNormals(), x.computeBoundingSphere(), x.userData = {
1760
+ tubularSegments: l,
1761
+ ringIndexCount: m * 6,
1762
+ bodyIndexCount: l * m * 6,
1763
+ totalIndexCount: v.length
1764
+ }, x;
1765
+ }
1766
+ //#endregion
1767
+ //#region src/loops/gl/filterPass.js
1768
+ var zt = {
1769
+ uniforms: {
1770
+ tDiffuse: { value: null },
1771
+ uAberration: { value: 0 },
1772
+ uGrain: { value: 0 },
1773
+ uVignette: { value: 0 },
1774
+ uTime: { value: 0 }
1775
+ },
1776
+ vertexShader: "\n varying vec2 vUv;\n void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }\n ",
1777
+ fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform float uAberration, uGrain, uVignette, uTime;\n varying vec2 vUv;\n float rand(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }\n void main() {\n vec2 uv = vUv;\n vec2 dir = uv - 0.5;\n // chromatic aberration — split R/B outward, scaled by distance from centre\n float a = uAberration * 0.02;\n vec3 col;\n col.r = texture2D(tDiffuse, uv + dir * a).r;\n col.g = texture2D(tDiffuse, uv).g;\n col.b = texture2D(tDiffuse, uv - dir * a).b;\n // grain\n if (uGrain > 0.0) col += (rand(uv + fract(uTime)) - 0.5) * uGrain;\n // vignette\n if (uVignette > 0.0) {\n float v = smoothstep(0.85, 0.25, length(dir));\n col *= mix(1.0, v, uVignette);\n }\n gl_FragColor = vec4(col, 1.0);\n }\n "
1778
+ }, Bt = .004, Vt = class {
1779
+ constructor(e, { autoLoop: t = !1 } = {}) {
1780
+ this.autoLoop = t, this.canvas = e, this.renderer = new T({
1781
+ canvas: e,
1782
+ antialias: !0,
1783
+ preserveDrawingBuffer: !0,
1784
+ alpha: !0
1785
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N("#000000"), 1), this.renderer.toneMapping = 4, this.renderer.toneMappingExposure = 1.1, this.scene = new w(), this.camera = new z(36, 1, .1, 100), this.camera.position.set(0, 0, 6), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 2.5, this.controls.maxDistance = 18, this.scene.add(new Te(16777215, .25));
1786
+ let n = new O(16777215, 2.2);
1787
+ n.position.set(4, 5, 3), this.scene.add(n);
1788
+ let r = new O(8956671, 1);
1789
+ r.position.set(-4, -2, -3), this.scene.add(r), this.pmrem = new ce(this.renderer), this.envTex = this.pmrem.fromScene(new it(), .01).texture, this.scene.environment = this.envTex, this.group = new ve(), this.scene.add(this.group), this.matType = "glass", this.color = "#cfe0ff", this.roughness = .06, this.metalness = 1, this.ior = 1.55, this.dispersion = 10, this.material = this.makeMaterial("glass"), this.lineMat = new $e({
1790
+ color: 10466006,
1791
+ linewidth: 2.5 * Bt,
1792
+ worldUnits: !0
1793
+ }), this.geomParams = {
1794
+ seed: 3,
1795
+ loops: 3,
1796
+ height: 2.2,
1797
+ gap: .92,
1798
+ depth: .35,
1799
+ curl: 1,
1800
+ width: .5,
1801
+ ribbonThickness: .12,
1802
+ corner: .045
1803
+ }, this.geom = Rt(this.geomParams), this.wireGeom = new Y(this.geom), this.mesh = new A(this.geom, this.material), this.wire = new rt(this.wireGeom, this.lineMat), this.wire.visible = !1, this.group.add(this.mesh), this.group.add(this.wire), this.composer = new jt(this.renderer), this.composer.addPass(new Mt(this.scene, this.camera)), this.bloom = new Pt(new I(1, 1), 0, .7, .85), this.composer.addPass(this.bloom), this.filter = new Ot(zt), this.composer.addPass(this.filter), this.dur = 12, this.accum = 0, this.last = performance.now(), this.recording = !1, this._recStop = null, this.globals = {
1804
+ paused: !0,
1805
+ loop: !0,
1806
+ speed: 1,
1807
+ duration: 12,
1808
+ flow: .6,
1809
+ cameraOrbit: !1,
1810
+ orbitSpeed: .6,
1811
+ fov: 36,
1812
+ materialType: "glass",
1813
+ color: "#cfe0ff",
1814
+ roughness: .05,
1815
+ metalness: 1,
1816
+ ior: 1.55,
1817
+ dispersion: 10,
1818
+ background: "#000000",
1819
+ wireframe: !1,
1820
+ strokeWidth: 2.5,
1821
+ aberration: 1,
1822
+ bloom: 0,
1823
+ vignette: .35,
1824
+ grain: 0
1825
+ }, this.onProgress = null, this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
1826
+ }
1827
+ makeMaterial(e) {
1828
+ let t = new N(this.color);
1829
+ return e === "chrome" ? new C({
1830
+ color: t,
1831
+ metalness: 1,
1832
+ roughness: this.roughness,
1833
+ clearcoat: 1,
1834
+ clearcoatRoughness: .04,
1835
+ envMapIntensity: 2.2
1836
+ }) : new C({
1837
+ color: t,
1838
+ metalness: 0,
1839
+ roughness: this.roughness,
1840
+ transmission: 1,
1841
+ thickness: 1.4,
1842
+ ior: this.ior,
1843
+ dispersion: this.dispersion,
1844
+ envMapIntensity: 1.8,
1845
+ clearcoat: .5,
1846
+ clearcoatRoughness: .06
1847
+ });
1848
+ }
1849
+ setMaterialType(e) {
1850
+ if (e === this.matType) return;
1851
+ this.matType = e;
1852
+ let t = this.material;
1853
+ this.material = this.makeMaterial(e), this.mesh.material = this.material, t.dispose();
1854
+ }
1855
+ applyMaterialProps() {
1856
+ let e = this.material;
1857
+ e.color.set(this.color), e.roughness = this.roughness, this.matType === "chrome" ? e.metalness = this.metalness : (e.ior = this.ior, e.dispersion = this.dispersion), this.lineMat.color.set(this.color);
1858
+ }
1859
+ rebuildGeometry() {
1860
+ let e = this.geom, t = this.wireGeom;
1861
+ this.geom = Rt(this.geomParams), this.wireGeom = new Y(this.geom), this.mesh.geometry = this.geom, this.wire.geometry = this.wireGeom, e.dispose(), t.dispose();
1862
+ }
1863
+ update({ globals: e, geom: t } = {}) {
1864
+ let n = !1;
1865
+ if (t) {
1866
+ for (let e in t) if (t[e] !== this.geomParams[e]) {
1867
+ this.geomParams = {
1868
+ ...this.geomParams,
1869
+ ...t
1870
+ }, n = !0;
1871
+ break;
1872
+ }
1873
+ }
1874
+ if (e) {
1875
+ this.globals = e, this.color = e.color || this.color, this.roughness = e.roughness ?? this.roughness, this.metalness = e.metalness ?? this.metalness, this.ior = e.ior ?? this.ior, this.dispersion = e.dispersion ?? this.dispersion, this.setMaterialType(e.materialType || "glass"), this.applyMaterialProps(), e.duration && (this.dur = e.duration), e.fov != null && e.fov !== this.camera.fov && (this.camera.fov = e.fov, this.camera.updateProjectionMatrix());
1876
+ let t = !!e.wireframe;
1877
+ this.mesh.visible = !t, this.wire.visible = t, this.lineMat.linewidth = (e.strokeWidth ?? 2.5) * Bt, this.bloom.strength = e.bloom ?? 0, this.filter.uniforms.uAberration.value = e.aberration ?? 0, this.filter.uniforms.uVignette.value = e.vignette ?? 0, this.filter.uniforms.uGrain.value = e.grain ?? 0;
1878
+ }
1879
+ n && this.rebuildGeometry();
1880
+ }
1881
+ resize(e, t) {
1882
+ this.renderer.setSize(e, t, !1), this.composer.setSize(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.lineMat.resolution.set(e, t), this.w = e, this.h = t;
1883
+ }
1884
+ seek(e) {
1885
+ this.accum = Math.max(0, Math.min(1, e)) * this.dur;
1886
+ }
1887
+ setBackground(e) {
1888
+ this.renderer.setClearColor(new N(e), 1);
1889
+ }
1890
+ resetCamera() {
1891
+ this.camera.position.set(0, 0, 6), this.controls.target.set(0, 0, 0), this.controls.update();
1892
+ }
1893
+ frame(e) {
1894
+ this.step(e);
1895
+ }
1896
+ loop = () => {
1897
+ this.raf = requestAnimationFrame(this.loop);
1898
+ let e = performance.now(), t = (e - this.last) / 1e3;
1899
+ this.last = e, this.step(t);
1900
+ };
1901
+ step = (e) => {
1902
+ let t = this.globals, n;
1903
+ this.recording ? (this.accum += e, n = Math.min(this.accum, this.dur)) : (t.paused || (this.accum += e * (t.speed ?? 1)), n = t.loop ? this.accum % this.dur : Math.min(this.accum, this.dur)), this.onProgress && this.onProgress({
1904
+ t: n,
1905
+ dur: this.dur
1906
+ });
1907
+ let r = this.dur > 0 ? n / this.dur : 0, i = Math.max(0, Math.min(.95, t.flow ?? 0)), a = this.geom.userData;
1908
+ if (i > 0 && r < 1) {
1909
+ let e = Math.min(r / i, 1);
1910
+ if (e < 1) {
1911
+ let t = Math.max(1, Math.round(e * a.tubularSegments));
1912
+ this.geom.setDrawRange(0, t * a.ringIndexCount);
1913
+ } else this.geom.setDrawRange(0, a.totalIndexCount);
1914
+ } else this.geom.setDrawRange(0, a.totalIndexCount);
1915
+ if (this.controls.autoRotate = !this.recording && !!t.cameraOrbit, this.controls.autoRotateSpeed = t.orbitSpeed ?? .6, this.filter.uniforms.uTime.value = n, this.controls.update(), this.w && this.h && this.composer.render(), this.recording && this.accum >= this.dur && this._recStop) {
1916
+ let e = this._recStop;
1917
+ this._recStop = null, e();
1918
+ }
1919
+ };
1920
+ exportBlob() {
1921
+ return new Promise((e) => this.canvas.toBlob(e, "image/png"));
1922
+ }
1923
+ exportBlobAt(e, t) {
1924
+ let n = this.renderer.getPixelRatio(), r = this.w, i = this.h;
1925
+ return this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.composer.setSize(e, t), this.lineMat.resolution.set(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix(), this.composer.render(), new Promise((e) => {
1926
+ this.canvas.toBlob((t) => {
1927
+ this.renderer.setPixelRatio(n), this.renderer.setSize(r, i, !1), this.composer.setSize(r, i), this.lineMat.resolution.set(r, i), this.camera.aspect = r / i, this.camera.updateProjectionMatrix(), this.composer.render(), e(t);
1928
+ }, "image/png");
1929
+ });
1930
+ }
1931
+ recordLoop(e, t, n = 30) {
1932
+ if (typeof MediaRecorder > "u" || !this.canvas.captureStream) return Promise.resolve(null);
1933
+ e ||= this.w, t ||= this.h;
1934
+ let r = this.renderer.getPixelRatio(), i = this.w, a = this.h;
1935
+ this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.composer.setSize(e, t), this.lineMat.resolution.set(e, t), this.camera.aspect = e / t, this.camera.updateProjectionMatrix();
1936
+ let o = this.canvas.captureStream(n), s = (e) => typeof MediaRecorder.isTypeSupported == "function" && MediaRecorder.isTypeSupported(e), c = s("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : s("video/webm;codecs=vp8") ? "video/webm;codecs=vp8" : "video/webm", l = new MediaRecorder(o, {
1937
+ mimeType: c,
1938
+ videoBitsPerSecond: 12e6
1939
+ }), u = [];
1940
+ return l.ondataavailable = (e) => {
1941
+ e.data && e.data.size && u.push(e.data);
1942
+ }, this.accum = 0, this.recording = !0, new Promise((e) => {
1943
+ l.onstop = () => {
1944
+ this.recording = !1, this.accum = 0, this.renderer.setPixelRatio(r), this.renderer.setSize(i, a, !1), this.composer.setSize(i, a), this.lineMat.resolution.set(i, a), this.camera.aspect = i / a, this.camera.updateProjectionMatrix(), e(new Blob(u, { type: "video/webm" }));
1945
+ }, this._recStop = () => l.stop(), l.start();
1946
+ });
1947
+ }
1948
+ dispose() {
1949
+ cancelAnimationFrame(this.raf), this.controls.dispose(), this.material.dispose(), this.lineMat.dispose(), this.geom.dispose(), this.wireGeom.dispose(), this.bloom.dispose(), this.composer.dispose?.(), this.envTex.dispose(), this.pmrem.dispose(), this.renderer.dispose();
1950
+ }
1951
+ }, Ht = "\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n", Ut = "\nvarying vec2 vUv;\nvoid main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Wt = `
1952
+ uniform vec3 uColors[5];
1953
+ uniform int uCount;
1954
+ uniform float uTime;
1955
+ uniform float uSeedOffset;
1956
+ uniform float uIntensity;
1957
+ uniform int uStyle;
1958
+ uniform vec3 uBase;
1959
+ varying vec2 vUv;
1960
+ ${Ht}
1961
+ vec3 ramp(float t) {
1962
+ float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
1963
+ int i = int(floor(ft));
1964
+ vec3 a = uColors[i];
1965
+ vec3 b = uColors[i + 1 < uCount ? i + 1 : uCount - 1];
1966
+ return mix(a, b, fract(ft));
1967
+ }
1968
+ float fbm(vec2 p) {
1969
+ float a = 0.5, s = 0.0;
1970
+ for (int i = 0; i < 4; i++) { s += a * snoise(vec3(p, uTime * 0.06 + uSeedOffset)); p *= 2.02; a *= 0.5; }
1971
+ return s;
1972
+ }
1973
+ void main() {
1974
+ vec2 p = vUv * 2.0 - 1.0;
1975
+ float t1 = uTime * 0.08;
1976
+ float f;
1977
+ float sheen = 0.0;
1978
+ if (uStyle == 1) {
1979
+ // streaks — anisotropic diagonal smear
1980
+ vec2 ps = vec2(p.x * 0.28 + p.y * 0.22, p.y * 1.25);
1981
+ f = fbm(ps + vec2(t1 * 2.2, t1 * 0.4));
1982
+ } else if (uStyle == 2) {
1983
+ // aurora — vertical wavy bands
1984
+ float band = p.x * 1.6 + 0.5 * fbm(vec2(p.y * 1.2, t1));
1985
+ f = sin(band * 3.14159) * 0.5 + 0.4 * fbm(p + vec2(0.0, t1));
1986
+ } else {
1987
+ // flow — domain-warped fbm at low frequency = big smooth lobes; the warp
1988
+ // magnitude drives an iridescent sheen on the ridges.
1989
+ vec2 sp = p * 0.62;
1990
+ vec2 q = vec2(fbm(sp + vec2(0.0, t1)), fbm(sp + vec2(5.2, 1.3) - t1));
1991
+ vec2 r = vec2(fbm(sp + 1.6 * q + vec2(1.7, 9.2) + t1 * 0.7), fbm(sp + 1.6 * q + vec2(8.3, 2.8) - t1 * 0.6));
1992
+ f = fbm(sp + 2.2 * r);
1993
+ sheen = pow(clamp(length(r) * 0.6, 0.0, 1.0), 3.0);
1994
+ }
1995
+ float tt = smoothstep(0.1, 0.9, clamp(f * 0.5 + 0.5, 0.0, 1.0)); // contrast
1996
+ vec3 col = ramp(tt);
1997
+ col += sheen * 0.18; // iridescent lift on flow ridges
1998
+ col *= mix(1.0, smoothstep(1.6, 0.1, length(p)), 0.4); // soft vignette
1999
+ col = mix(uBase, col, uIntensity);
2000
+ gl_FragColor = vec4(col, 1.0);
2001
+ }
2002
+ `, Gt = `
2003
+ uniform float uTime;
2004
+ uniform float uDistort;
2005
+ uniform float uSeedOffset;
2006
+ varying vec3 vNormal;
2007
+ varying vec3 vWorldPos;
2008
+ varying vec3 vViewDir;
2009
+ ${Ht}
2010
+ void main() {
2011
+ vec3 p = position;
2012
+ float n = snoise(position * 1.4 + vec3(uSeedOffset) + vec3(0.0, 0.0, uTime * 0.35));
2013
+ p += normal * n * uDistort;
2014
+ vec4 world = modelMatrix * vec4(p, 1.0);
2015
+ vWorldPos = world.xyz;
2016
+ vNormal = normalize(mat3(modelMatrix) * normal);
2017
+ vViewDir = cameraPosition - world.xyz;
2018
+ gl_Position = projectionMatrix * viewMatrix * world;
2019
+ }
2020
+ `, Kt = `
2021
+ uniform vec3 uColors[5];
2022
+ uniform int uCount;
2023
+ uniform int uDriver;
2024
+ uniform float uTime;
2025
+ uniform float uGlow;
2026
+ uniform float uGrain;
2027
+ uniform float uSeedOffset;
2028
+ varying vec3 vNormal;
2029
+ varying vec3 vWorldPos;
2030
+ varying vec3 vViewDir;
2031
+ ${Ht}
2032
+ vec3 ramp(float t) {
2033
+ float ft = clamp(t, 0.0, 1.0) * float(uCount - 1);
2034
+ int i = int(floor(ft));
2035
+ vec3 a = uColors[i];
2036
+ vec3 b = uColors[i + 1 < uCount ? i + 1 : uCount - 1];
2037
+ return mix(a, b, fract(ft));
2038
+ }
2039
+ float hash(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
2040
+ void main() {
2041
+ vec3 n = normalize(vNormal);
2042
+ if (!gl_FrontFacing) n = -n;
2043
+ vec3 v = normalize(vViewDir);
2044
+ float fres = pow(1.0 - abs(dot(n, v)), 2.2);
2045
+ float t;
2046
+ if (uDriver == 0) t = 0.5 + 0.5 * dot(n, normalize(vec3(0.6, 0.8, 0.4)));
2047
+ else if (uDriver == 1) t = fres;
2048
+ else t = clamp(vWorldPos.y * 0.45 + 0.5, 0.0, 1.0);
2049
+ t += 0.12 * snoise(vWorldPos * 1.5 + vec3(uSeedOffset) + vec3(uTime * 0.12));
2050
+ vec3 col = ramp(t);
2051
+ float diff = 0.45 + 0.55 * max(dot(n, normalize(vec3(0.35, 0.9, 0.5))), 0.0);
2052
+ col *= diff;
2053
+ col += col * fres * (0.55 + uGlow);
2054
+ col += (hash(gl_FragCoord.xy) - 0.5) * uGrain;
2055
+ gl_FragColor = vec4(col, 1.0);
2056
+ }
2057
+ `, qt = "#0b0b0e", Q = 14, $ = 5, Jt = () => {
2058
+ let e = document.createElement("canvas");
2059
+ e.width = e.height = 128;
2060
+ let t = e.getContext("2d"), n = t.createRadialGradient(64, 64, 0, 64, 64, 64);
2061
+ return n.addColorStop(0, "rgba(255,255,255,0.85)"), n.addColorStop(.4, "rgba(255,255,255,0.25)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, 128, 128), new Ce(e);
2062
+ }, Yt = class {
2063
+ constructor(e, { autoLoop: t = !1 } = {}) {
2064
+ this.autoLoop = t, this.canvas = e, this.renderer = new T({
2065
+ canvas: e,
2066
+ antialias: !0,
2067
+ preserveDrawingBuffer: !0
2068
+ }), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), this.renderer.setClearColor(new N(qt), 1), this.camera = new z(32, 1, .1, 50), this.camera.position.set(0, .15, 4.2), this.camera.lookAt(0, 0, 0), this.controls = new F(this.camera, e), this.controls.enableDamping = !0, this.controls.enablePan = !1, this.controls.minDistance = 1.6, this.controls.maxDistance = 12, this.glowTex = Jt(), this.bgGeo = new v(2, 2), this.bgCam = new E(), this.bgBase = new N(qt), this.geoms = {
2069
+ sphere: new re(1.02, 96, 96),
2070
+ plane: new v(2.1, 1.5, 128, 96)
2071
+ }, this.tiles = [], this.rects = [], this.mode = "grid", this.idx = 0, this.globals = {
2072
+ glow: .6,
2073
+ grain: .06,
2074
+ speed: 1,
2075
+ paused: !1,
2076
+ bg: .85,
2077
+ bgStyle: 0
2078
+ }, this.time = 0, this.last = performance.now(), this.autoLoop && (this.raf = requestAnimationFrame(this.loop));
2079
+ }
2080
+ buildTile(e) {
2081
+ let t = new w(), n = new S({
2082
+ vertexShader: Gt,
2083
+ fragmentShader: Kt,
2084
+ side: 2,
2085
+ uniforms: {
2086
+ uTime: { value: 0 },
2087
+ uDistort: { value: 0 },
2088
+ uSeedOffset: { value: 0 },
2089
+ uColors: { value: Array.from({ length: $ }, () => new N()) },
2090
+ uCount: { value: 2 },
2091
+ uDriver: { value: 0 },
2092
+ uGlow: { value: .6 },
2093
+ uGrain: { value: .06 }
2094
+ }
2095
+ }), r = new A(this.geoms[e.shape], n), i = new me(new pe({
2096
+ map: this.glowTex,
2097
+ transparent: !0,
2098
+ depthWrite: !1,
2099
+ blending: 2,
2100
+ opacity: .3
2101
+ }));
2102
+ i.position.set(0, -.5, -1.2), i.scale.set(3.6, 3.6, 1), t.add(i), t.add(r);
2103
+ let a = new S({
2104
+ vertexShader: Ut,
2105
+ fragmentShader: Wt,
2106
+ depthTest: !1,
2107
+ depthWrite: !1,
2108
+ uniforms: {
2109
+ uTime: { value: 0 },
2110
+ uColors: { value: Array.from({ length: $ }, () => new N()) },
2111
+ uCount: { value: 2 },
2112
+ uSeedOffset: { value: 0 },
2113
+ uIntensity: { value: .75 },
2114
+ uStyle: { value: 0 },
2115
+ uBase: { value: this.bgBase }
2116
+ }
2117
+ }), o = new w();
2118
+ return o.add(new A(this.bgGeo, a)), {
2119
+ scene: t,
2120
+ mesh: r,
2121
+ material: n,
2122
+ glow: i,
2123
+ bgScene: o,
2124
+ bgMaterial: a,
2125
+ spec: e
2126
+ };
2127
+ }
2128
+ applySpec(e, t) {
2129
+ let n = e.material.uniforms;
2130
+ e.mesh.geometry = this.geoms[t.shape], e.mesh.rotation.set(t.shape === "plane" ? -.35 : .12, 0, 0), n.uDistort.value = t.distort, n.uSeedOffset.value = t.seed % 977, n.uDriver.value = t.driver, n.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => n.uColors.value[t].set(e)), e.glow.material.color.set(t.colors[Math.floor(t.colors.length / 2)]);
2131
+ let r = e.bgMaterial.uniforms;
2132
+ r.uCount.value = Math.min(t.colors.length, $), t.colors.slice(0, $).forEach((e, t) => r.uColors.value[t].set(e)), r.uSeedOffset.value = t.seed % 977, e.spec = t;
2133
+ }
2134
+ update({ specs: e, mode: t, idx: n, globals: r }) {
2135
+ if (e) {
2136
+ for (; this.tiles.length < e.length;) this.tiles.push(this.buildTile(e[this.tiles.length]));
2137
+ e.forEach((e, t) => this.applySpec(this.tiles[t], e));
2138
+ }
2139
+ t && (this.mode = t), n != null && (this.idx = n), r && (this.globals = r);
2140
+ }
2141
+ resize(e, t) {
2142
+ this.renderer.setSize(e, t, !1), this.w = e, this.h = t;
2143
+ }
2144
+ tileAt(e, t) {
2145
+ return this.rects.findIndex((n) => e >= n.x && e <= n.x + n.w && t >= n.y && t <= n.y + n.h);
2146
+ }
2147
+ renderTile(e, t) {
2148
+ let n = this.renderer;
2149
+ n.setViewport(t.x, this.h - t.y - t.h, t.w, t.h), n.setScissor(t.x, this.h - t.y - t.h, t.w, t.h), n.autoClear = !0, n.render(e.bgScene, this.bgCam), n.autoClear = !1, this.camera.aspect = t.w / t.h, this.camera.updateProjectionMatrix(), n.render(e.scene, this.camera), n.autoClear = !0;
2150
+ }
2151
+ frame(e) {
2152
+ this.step(e);
2153
+ }
2154
+ loop = () => {
2155
+ this.raf = requestAnimationFrame(this.loop);
2156
+ let e = performance.now(), t = (e - this.last) / 1e3;
2157
+ this.last = e, this.step(t);
2158
+ };
2159
+ step = (e) => {
2160
+ this.globals.paused || (this.time += e * (Number(this.globals.speed) || 1));
2161
+ let t = this.globals;
2162
+ if (this.controls.update(), !(!this.w || !this.h || this.tiles.length === 0)) {
2163
+ for (let e of this.tiles) {
2164
+ let n = e.material.uniforms;
2165
+ n.uTime.value = this.time, n.uGlow.value = t.glow, n.uGrain.value = t.grain;
2166
+ let r = e.bgMaterial.uniforms;
2167
+ r.uTime.value = this.time, r.uIntensity.value = t.bg, r.uStyle.value = t.bgStyle, e.glow.material.opacity = .18 + t.glow * .3;
2168
+ let i = e.spec.shape === "plane";
2169
+ e.mesh.rotation.y = e.spec.phase + this.time * e.spec.rotSpeed * (i ? .3 : 1);
2170
+ }
2171
+ if (this.renderer.setScissorTest(!1), this.renderer.setViewport(0, 0, this.w, this.h), this.renderer.clear(), this.renderer.setScissorTest(!0), this.mode === "single") {
2172
+ let e = {
2173
+ x: 0,
2174
+ y: 0,
2175
+ w: this.w,
2176
+ h: this.h
2177
+ };
2178
+ this.rects = [e], this.renderTile(this.tiles[this.idx], e);
2179
+ } else {
2180
+ let e = this.tiles.length, t = Math.ceil(e / 3), n = (this.w - Q * 4) / 3, r = (this.h - Q * (t + 1)) / t;
2181
+ this.rects = this.tiles.map((e, t) => ({
2182
+ x: Q + t % 3 * (n + Q),
2183
+ y: Q + Math.floor(t / 3) * (r + Q),
2184
+ w: n,
2185
+ h: r
2186
+ })), this.tiles.forEach((e, t) => this.renderTile(e, this.rects[t]));
2187
+ }
2188
+ this.renderer.setScissorTest(!1);
2189
+ }
2190
+ };
2191
+ setBackground(e) {
2192
+ this.renderer.setClearColor(new N(e), 1), this.bgBase.set(e);
2193
+ }
2194
+ resetCamera() {
2195
+ this.camera.position.set(0, .15, 4.2), this.controls.target.set(0, 0, 0), this.controls.update();
2196
+ }
2197
+ resetTime() {
2198
+ this.time = 0;
2199
+ }
2200
+ exportBlob() {
2201
+ return new Promise((e) => this.canvas.toBlob(e, "image/png"));
2202
+ }
2203
+ dispose() {
2204
+ cancelAnimationFrame(this.raf), this.controls.dispose();
2205
+ for (let e of this.tiles) e.material.dispose(), e.glow.material.dispose(), e.bgMaterial.dispose();
2206
+ for (let e of Object.values(this.geoms)) e.dispose();
2207
+ this.bgGeo.dispose(), this.glowTex.dispose(), this.renderer.dispose();
2208
+ }
2209
+ };
2210
+ //#endregion
2211
+ //#region src/loops/gl/host.js
2212
+ function Xt(e, t) {
2213
+ let n = Qt(e, t);
2214
+ return n.controls && (n.controls.enabled = !1), n;
2215
+ }
2216
+ function Zt(e, t, n) {
2217
+ t?.controls && (t.controls.enabled = !!n);
2218
+ }
2219
+ function Qt(e, t) {
2220
+ switch (e.engine) {
2221
+ case "drift": {
2222
+ let n = new Re(e.family);
2223
+ return n.init(t), n;
2224
+ }
2225
+ case "iridescent": {
2226
+ let e = new Ve();
2227
+ return e.init(t), e;
2228
+ }
2229
+ case "softforms": {
2230
+ let e = new Ge();
2231
+ return e.init(t), e;
2232
+ }
2233
+ case "softforms3d": {
2234
+ let e = new Ye();
2235
+ return e.init(t), e;
2236
+ }
2237
+ case "scene": return new ht(t);
2238
+ case "forms": return new yt(t);
2239
+ case "environment": return new Ct(t);
2240
+ case "ribbon": return new Vt(t);
2241
+ case "mesh": return new Yt(t);
2242
+ default: throw Error(`unknown gl engine "${e.engine}"`);
2243
+ }
2244
+ }
2245
+ var $t = {
2246
+ loop: !0,
2247
+ paused: !1,
2248
+ speed: 0
2249
+ };
2250
+ function en(e, t, n) {
2251
+ tn(e, t, n), e.bgToggle && t.renderer?.setClearAlpha(n.bgOn === !1 ? 0 : 1);
2252
+ }
2253
+ function tn(e, t, n) {
2254
+ switch (e.engine) {
2255
+ case "scene":
2256
+ t.update({
2257
+ primitive: n.primitive,
2258
+ globals: {
2259
+ preset: n.pose,
2260
+ animMode: "preset",
2261
+ loop: !0,
2262
+ paused: !1,
2263
+ speed: 0,
2264
+ count: n.count,
2265
+ arrangement: n.arrangement,
2266
+ spread: n.spread,
2267
+ objectSize: n.objectSize,
2268
+ stagger: n.stagger,
2269
+ cameraMotion: n.cameraMotion,
2270
+ orbitSpeed: n.orbitSpeed,
2271
+ fov: n.fov,
2272
+ wireframe: n.wireframe,
2273
+ strokeWidth: n.strokeWidth,
2274
+ materialType: n.materialType,
2275
+ environment: n.environment,
2276
+ roughness: n.roughness,
2277
+ metalness: n.metalness,
2278
+ color: n.sceneColor,
2279
+ flatShading: !1,
2280
+ showAxis: !1
2281
+ }
2282
+ });
2283
+ return;
2284
+ case "softforms3d":
2285
+ t.setParams(n), n.camTheta != null && t.setCamera({
2286
+ theta: n.camTheta,
2287
+ phi: n.camPhi ?? .35,
2288
+ dist: n.camDist ?? 3
2289
+ });
2290
+ return;
2291
+ case "forms":
2292
+ t.update({
2293
+ form: n.form,
2294
+ globals: {
2295
+ ...$t,
2296
+ duration: 8,
2297
+ samples: n.samples,
2298
+ cycles: n.cycles,
2299
+ amp: n.amp,
2300
+ pointSize: n.pointSize,
2301
+ turns: n.turns,
2302
+ radius: n.radius,
2303
+ height: n.height,
2304
+ spin: n.spin,
2305
+ spinSpeed: n.spinSpeed,
2306
+ fov: n.fov,
2307
+ color: n.formColor,
2308
+ accent: n.accent
2309
+ }
2310
+ });
2311
+ return;
2312
+ case "environment":
2313
+ t.update({
2314
+ env: n.env,
2315
+ globals: {
2316
+ ...$t,
2317
+ duration: 8,
2318
+ samples: n.samples,
2319
+ cycles: n.cycles,
2320
+ amp: n.amp,
2321
+ spin: n.spin,
2322
+ spinSpeed: n.spinSpeed,
2323
+ fov: n.fov,
2324
+ color: n.formColor,
2325
+ accent: n.accent
2326
+ }
2327
+ });
2328
+ return;
2329
+ case "ribbon":
2330
+ t.update({
2331
+ geom: {
2332
+ seed: n.seed,
2333
+ loops: n.loops,
2334
+ height: n.height,
2335
+ gap: n.gap,
2336
+ depth: n.depth,
2337
+ curl: n.curl,
2338
+ width: n.width,
2339
+ ribbonThickness: n.ribbonThickness ?? .12,
2340
+ corner: n.corner ?? .045
2341
+ },
2342
+ globals: {
2343
+ ...$t,
2344
+ duration: 12,
2345
+ flow: n.flow,
2346
+ cameraOrbit: n.cameraOrbit,
2347
+ orbitSpeed: n.orbitSpeed,
2348
+ fov: n.fov,
2349
+ materialType: n.materialType,
2350
+ color: n.ribbonColor,
2351
+ roughness: n.roughness,
2352
+ metalness: n.metalness,
2353
+ ior: n.ior,
2354
+ dispersion: n.dispersion,
2355
+ wireframe: !1,
2356
+ strokeWidth: 2.5,
2357
+ aberration: n.aberration,
2358
+ bloom: n.bloom,
2359
+ vignette: n.vignette,
2360
+ grain: n.grain
2361
+ }
2362
+ }), n.background != null && t.setBackground(n.background);
2363
+ return;
2364
+ case "mesh": {
2365
+ let e = Ft(n.seed ?? 7);
2366
+ e(), e(), e();
2367
+ let i = e(), a = .12 + e() * .3, o = e() * Math.PI * 2, s = f.find((e) => e.id === n.palette) || f[0];
2368
+ t.update({
2369
+ mode: "single",
2370
+ idx: 0,
2371
+ specs: [{
2372
+ seed: n.seed ?? 7,
2373
+ shape: n.shape || "sphere",
2374
+ colors: s.colors.map((e) => r(e, n.hueShift || 0)),
2375
+ driver: n.driver ?? 0,
2376
+ distort: (n.distort ?? .5) * (.6 + i * .5),
2377
+ rotSpeed: a,
2378
+ phase: o
2379
+ }],
2380
+ globals: {
2381
+ glow: n.glow,
2382
+ grain: n.grain,
2383
+ speed: n.speed,
2384
+ paused: !1,
2385
+ bg: n.bgAmount ?? .85,
2386
+ bgStyle: n.bgStyle ?? 0
2387
+ }
2388
+ });
2389
+ return;
2390
+ }
2391
+ default: t.setParams(n);
2392
+ }
2393
+ }
2394
+ function nn(e, t, { u: n, dt: r }) {
2395
+ e.drive === "phase" ? t.renderAtPhase(n) : e.drive === "seek" ? (t.seek(n), t.frame(0)) : t.frame(r);
2396
+ }
2397
+ function rn(e) {
2398
+ if (e) try {
2399
+ typeof e.dispose == "function" ? e.dispose() : typeof e.destroy == "function" && e.destroy();
2400
+ } catch (e) {
2401
+ console.warn("[gl] engine dispose failed (ignored):", e?.message ?? e);
2402
+ }
2403
+ }
2404
+ //#endregion
2405
+ export { en as applyParams, Xt as createEngine, rn as destroyEngine, nn as driveEngine, Zt as setCameraDrag };