shaders 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/core/{AngularBlur-BJi-Edw-.js → AngularBlur-BTUdXC0g.js} +7 -6
  2. package/dist/core/{Ascii-B1KHvM1u.js → Ascii-Bu8ii7oo.js} +32 -31
  3. package/dist/core/Blob-C0G0efjG.js +170 -0
  4. package/dist/core/{Blur-bz9Ubr0x.js → Blur-BzUO9yxF.js} +14 -13
  5. package/dist/core/Bulge-BCXYAzig.js +104 -0
  6. package/dist/core/{CRTScreen-BnfROw0f.js → CRTScreen-cJ3XHrI9.js} +13 -12
  7. package/dist/core/{ChannelBlur-DhWT-55L.js → ChannelBlur-BEK1qzGn.js} +23 -22
  8. package/dist/core/{Checkerboard-CgWGd9t7.js → Checkerboard-BPkiSF5I.js} +16 -14
  9. package/dist/core/{ChromaFlow-DOVrymVB.js → ChromaFlow-AHO3C4o3.js} +18 -17
  10. package/dist/core/{ChromaticAberration-CyTSXY7j.js → ChromaticAberration-nVg3r1FK.js} +12 -11
  11. package/dist/core/{Circle-0WHV1HrM.js → Circle-C8ltF4BZ.js} +15 -13
  12. package/dist/core/{CursorTrail-3zQ5rtjh.js → CursorTrail-BeJGeovB.js} +17 -16
  13. package/dist/core/DiffuseBlur-BdGvOoBw.js +40 -0
  14. package/dist/core/{Dither-Cnbknfji.js → Dither-CpN3vGSh.js} +13 -12
  15. package/dist/core/DotGrid-BFUzeSQw.js +62 -0
  16. package/dist/core/{Duotone-BI4tJI3k.js → Duotone-_nR_o3-g.js} +8 -7
  17. package/dist/core/FilmGrain-BAKXXtLg.js +29 -0
  18. package/dist/core/FloatingParticles-Fv8JIzKk.js +161 -0
  19. package/dist/core/GlassTiles-5MyBj1ff.js +53 -0
  20. package/dist/core/{Glow-BD0t9E1L.js → Glow-DvJj7BB7.js} +12 -11
  21. package/dist/core/{Godrays-CPIAbymT.js → Godrays-cUzAKVXn.js} +24 -22
  22. package/dist/core/{Grayscale-BtOqK43k.js → Grayscale-oWIF3PV5.js} +3 -2
  23. package/dist/core/Grid-Bov7AA9m.js +51 -0
  24. package/dist/core/GridDistortion-CWYom5Dw.js +148 -0
  25. package/dist/core/Group-CPk-7fiA.js +18 -0
  26. package/dist/core/{Halftone-B_MuXCD8.js → Halftone-F7fsdu7W.js} +11 -10
  27. package/dist/core/{HueShift-CKG9M-d2.js → HueShift-CiS4hdtk.js} +3 -2
  28. package/dist/core/{ImageTexture-B6zFP2fB.js → ImageTexture-B3Q29OHX.js} +24 -22
  29. package/dist/core/Invert-Cyc4JHWc.js +21 -0
  30. package/dist/core/{LinearBlur-JFLMQBY4.js → LinearBlur-BTC54qzk.js} +12 -11
  31. package/dist/core/{LinearGradient-Ztg5Lzwj.js → LinearGradient-LEMeW0KM.js} +18 -16
  32. package/dist/core/Liquify-D2nzMDzq.js +140 -0
  33. package/dist/core/Pixelate-irPzmtQm.js +39 -0
  34. package/dist/core/{PolarCoordinates-qzU8gNXR.js → PolarCoordinates-Ck5ZWrQO.js} +21 -16
  35. package/dist/core/{Posterize-BkBU8tnN.js → Posterize-DICq_t96.js} +9 -8
  36. package/dist/core/{ProgressiveBlur-HAQf188T.js → ProgressiveBlur-BuORe3VH.js} +17 -16
  37. package/dist/core/{RadialGradient-DISqJuTZ.js → RadialGradient-D0cN67jm.js} +17 -15
  38. package/dist/core/RectangularCoordinates-1LIDaeHR.js +93 -0
  39. package/dist/core/{Ripples-CX8Qgnog.js → Ripples-DH71sFJc.js} +14 -12
  40. package/dist/core/{Saturation-DMxPYmIU.js → Saturation-DbSXtSeK.js} +10 -9
  41. package/dist/core/{SimplexNoise-B5ygfckG.js → SimplexNoise-DPGC2OPJ.js} +14 -12
  42. package/dist/core/{SineWave-KPFlP3Wk.js → SineWave-CkWtnzHF.js} +16 -14
  43. package/dist/core/{SolidColor-B8oxlGge.js → SolidColor-DaB-FHNX.js} +8 -6
  44. package/dist/core/{Spiral-CX22hUJ3.js → Spiral-CcyI8azF.js} +19 -17
  45. package/dist/core/Strands-Co4fkc05.js +126 -0
  46. package/dist/core/{Swirl-CIXreSgZ.js → Swirl-BoveqtNV.js} +18 -16
  47. package/dist/core/{TiltShift-J0UUcoh-.js → TiltShift-D53azmRe.js} +14 -13
  48. package/dist/core/{Tritone-E9eHvjJV.js → Tritone-Cg1rX-hL.js} +13 -12
  49. package/dist/core/{Twirl-ClhPpapm.js → Twirl-raO5pe5X.js} +20 -15
  50. package/dist/core/{Vibrance-CqnE9Zco.js → Vibrance-DtekSkcz.js} +8 -7
  51. package/dist/core/WaveDistortion-C65qO_cZ.js +133 -0
  52. package/dist/core/{ZoomBlur-CaGbSDG3.js → ZoomBlur-B97ZjhXe.js} +11 -10
  53. package/dist/core/{colorMixing-C_ESXyqX.js → colorMixing-DPZ-Td4U.js} +3 -3
  54. package/dist/core/edges-B-tVdqcI.js +16 -0
  55. package/dist/core/index.js +1333 -948
  56. package/dist/core/performanceTracker.d.ts +2 -0
  57. package/dist/core/performanceTracker.d.ts.map +1 -1
  58. package/dist/core/renderer.d.ts +12 -0
  59. package/dist/core/renderer.d.ts.map +1 -1
  60. package/dist/core/shaderRegistry.d.ts.map +1 -1
  61. package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
  62. package/dist/core/shaders/AngularBlur/index.js +3 -3
  63. package/dist/core/shaders/Ascii/index.d.ts.map +1 -1
  64. package/dist/core/shaders/Ascii/index.js +2 -2
  65. package/dist/core/shaders/Blob/index.d.ts.map +1 -1
  66. package/dist/core/shaders/Blob/index.js +5 -5
  67. package/dist/core/shaders/Blur/index.d.ts.map +1 -1
  68. package/dist/core/shaders/Blur/index.js +2 -2
  69. package/dist/core/shaders/Bulge/index.d.ts.map +1 -1
  70. package/dist/core/shaders/Bulge/index.js +4 -4
  71. package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
  72. package/dist/core/shaders/CRTScreen/index.js +2 -2
  73. package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
  74. package/dist/core/shaders/ChannelBlur/index.js +2 -2
  75. package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
  76. package/dist/core/shaders/Checkerboard/index.js +4 -4
  77. package/dist/core/shaders/ChromaFlow/index.d.ts.map +1 -1
  78. package/dist/core/shaders/ChromaFlow/index.js +3 -3
  79. package/dist/core/shaders/ChromaticAberration/index.d.ts.map +1 -1
  80. package/dist/core/shaders/ChromaticAberration/index.js +3 -3
  81. package/dist/core/shaders/Circle/index.d.ts.map +1 -1
  82. package/dist/core/shaders/Circle/index.js +3 -3
  83. package/dist/core/shaders/CursorTrail/index.d.ts.map +1 -1
  84. package/dist/core/shaders/CursorTrail/index.js +4 -4
  85. package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
  86. package/dist/core/shaders/DiffuseBlur/index.js +2 -2
  87. package/dist/core/shaders/Dither/index.d.ts.map +1 -1
  88. package/dist/core/shaders/Dither/index.js +3 -3
  89. package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
  90. package/dist/core/shaders/DotGrid/index.js +3 -3
  91. package/dist/core/shaders/Duotone/index.d.ts.map +1 -1
  92. package/dist/core/shaders/Duotone/index.js +4 -4
  93. package/dist/core/shaders/FilmGrain/index.d.ts.map +1 -1
  94. package/dist/core/shaders/FilmGrain/index.js +2 -2
  95. package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
  96. package/dist/core/shaders/FloatingParticles/index.js +3 -3
  97. package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
  98. package/dist/core/shaders/GlassTiles/index.js +2 -2
  99. package/dist/core/shaders/Glow/index.d.ts.map +1 -1
  100. package/dist/core/shaders/Glow/index.js +2 -2
  101. package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
  102. package/dist/core/shaders/Godrays/index.js +3 -3
  103. package/dist/core/shaders/Grayscale/index.d.ts.map +1 -1
  104. package/dist/core/shaders/Grayscale/index.js +2 -2
  105. package/dist/core/shaders/Grid/index.d.ts.map +1 -1
  106. package/dist/core/shaders/Grid/index.js +3 -3
  107. package/dist/core/shaders/GridDistortion/index.d.ts.map +1 -1
  108. package/dist/core/shaders/GridDistortion/index.js +4 -4
  109. package/dist/core/shaders/Group/index.d.ts.map +1 -1
  110. package/dist/core/shaders/Group/index.js +2 -2
  111. package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
  112. package/dist/core/shaders/Halftone/index.js +3 -3
  113. package/dist/core/shaders/HueShift/index.d.ts.map +1 -1
  114. package/dist/core/shaders/HueShift/index.js +2 -2
  115. package/dist/core/shaders/ImageTexture/index.d.ts +1 -1
  116. package/dist/core/shaders/ImageTexture/index.d.ts.map +1 -1
  117. package/dist/core/shaders/ImageTexture/index.js +2 -2
  118. package/dist/core/shaders/Invert/index.d.ts.map +1 -1
  119. package/dist/core/shaders/Invert/index.js +2 -2
  120. package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
  121. package/dist/core/shaders/LinearBlur/index.js +3 -3
  122. package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
  123. package/dist/core/shaders/LinearGradient/index.js +4 -4
  124. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  125. package/dist/core/shaders/Liquify/index.js +4 -4
  126. package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
  127. package/dist/core/shaders/Pixelate/index.js +2 -2
  128. package/dist/core/shaders/PolarCoordinates/index.d.ts.map +1 -1
  129. package/dist/core/shaders/PolarCoordinates/index.js +4 -4
  130. package/dist/core/shaders/Posterize/index.d.ts.map +1 -1
  131. package/dist/core/shaders/Posterize/index.js +2 -2
  132. package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
  133. package/dist/core/shaders/ProgressiveBlur/index.js +3 -3
  134. package/dist/core/shaders/RadialGradient/index.d.ts.map +1 -1
  135. package/dist/core/shaders/RadialGradient/index.js +4 -4
  136. package/dist/core/shaders/RectangularCoordinates/index.d.ts +38 -0
  137. package/dist/core/shaders/RectangularCoordinates/index.d.ts.map +1 -0
  138. package/dist/core/shaders/RectangularCoordinates/index.js +8 -0
  139. package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
  140. package/dist/core/shaders/Ripples/index.js +4 -4
  141. package/dist/core/shaders/Saturation/index.d.ts.map +1 -1
  142. package/dist/core/shaders/Saturation/index.js +2 -2
  143. package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
  144. package/dist/core/shaders/SimplexNoise/index.js +4 -4
  145. package/dist/core/shaders/SineWave/index.d.ts.map +1 -1
  146. package/dist/core/shaders/SineWave/index.js +3 -3
  147. package/dist/core/shaders/SolidColor/index.d.ts.map +1 -1
  148. package/dist/core/shaders/SolidColor/index.js +3 -3
  149. package/dist/core/shaders/Spiral/index.d.ts.map +1 -1
  150. package/dist/core/shaders/Spiral/index.js +4 -4
  151. package/dist/core/shaders/Strands/index.d.ts.map +1 -1
  152. package/dist/core/shaders/Strands/index.js +4 -4
  153. package/dist/core/shaders/Swirl/index.d.ts.map +1 -1
  154. package/dist/core/shaders/Swirl/index.js +5 -5
  155. package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
  156. package/dist/core/shaders/TiltShift/index.js +3 -3
  157. package/dist/core/shaders/Tritone/index.d.ts.map +1 -1
  158. package/dist/core/shaders/Tritone/index.js +4 -4
  159. package/dist/core/shaders/Twirl/index.d.ts.map +1 -1
  160. package/dist/core/shaders/Twirl/index.js +4 -4
  161. package/dist/core/shaders/Vibrance/index.d.ts.map +1 -1
  162. package/dist/core/shaders/Vibrance/index.js +2 -2
  163. package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
  164. package/dist/core/shaders/WaveDistortion/index.js +6 -7
  165. package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
  166. package/dist/core/shaders/ZoomBlur/index.js +3 -3
  167. package/dist/core/telemetry/collector.d.ts.map +1 -1
  168. package/dist/core/telemetry/index.js +19 -19
  169. package/dist/core/{three.tsl-CgyjOhns.js → three.tsl-BqgDcRt9.js} +21 -20
  170. package/dist/core/{time-myrFQH-u.js → time-5uQ65blS.js} +1 -1
  171. package/dist/core/{transformations-Bs66Qh16.js → transformations-DBjTkQ5b.js} +1 -1
  172. package/dist/core/types.d.ts +85 -0
  173. package/dist/core/types.d.ts.map +1 -1
  174. package/dist/core/utilities/edges.d.ts +13 -2
  175. package/dist/core/utilities/edges.d.ts.map +1 -1
  176. package/dist/core/utilities/uvTransform.d.ts +20 -0
  177. package/dist/core/utilities/uvTransform.d.ts.map +1 -1
  178. package/dist/react/components/RectangularCoordinates.d.ts +31 -0
  179. package/dist/react/components/RectangularCoordinates.d.ts.map +1 -0
  180. package/dist/react/index.cjs +233 -233
  181. package/dist/react/index.d.ts +1 -0
  182. package/dist/react/index.d.ts.map +1 -1
  183. package/dist/react/index.js +16218 -15498
  184. package/dist/react/utils/generatePresetCode.cjs +2 -2
  185. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  186. package/dist/react/utils/generatePresetCode.js +13 -1
  187. package/dist/registry.d.ts +3 -0
  188. package/dist/registry.js +376 -87
  189. package/dist/svelte/components/RectangularCoordinates.svelte.d.ts +19 -0
  190. package/dist/svelte/index.d.ts +1 -0
  191. package/dist/svelte/index.js +15766 -15088
  192. package/dist/svelte/utils/generatePresetCode.js +13 -1
  193. package/dist/vue/components/RectangularCoordinates.vue.d.ts +57 -0
  194. package/dist/vue/components/RectangularCoordinates.vue.d.ts.map +1 -0
  195. package/dist/vue/{generatePresetCode-B6Ks_W3s.js → generatePresetCode-D4V6rBae.js} +13 -1
  196. package/dist/vue/index.d.ts +1 -0
  197. package/dist/vue/index.d.ts.map +1 -1
  198. package/dist/vue/index.js +15240 -14552
  199. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  200. package/dist/vue/utils/generatePresetCode.js +1 -1
  201. package/package.json +6 -1
  202. package/dist/core/Blob-CBASKMfO.js +0 -168
  203. package/dist/core/Bulge-Ceythf-i.js +0 -99
  204. package/dist/core/DiffuseBlur-DLIKRsnf.js +0 -39
  205. package/dist/core/DotGrid-BkItF2C8.js +0 -60
  206. package/dist/core/FilmGrain-BAZORehh.js +0 -27
  207. package/dist/core/FloatingParticles-7wvOBUbD.js +0 -158
  208. package/dist/core/GlassTiles-C0y_PWTa.js +0 -48
  209. package/dist/core/Grid-Ro0Yi5WY.js +0 -49
  210. package/dist/core/GridDistortion-CuxRQdzs.js +0 -137
  211. package/dist/core/Group-DTXP-whY.js +0 -17
  212. package/dist/core/Invert-Cd7GK1vs.js +0 -20
  213. package/dist/core/Liquify-rmJGJAdt.js +0 -126
  214. package/dist/core/Pixelate-BIANS3t9.js +0 -34
  215. package/dist/core/Strands-Bv7RvyRC.js +0 -124
  216. package/dist/core/WaveDistortion-gecgVpvO.js +0 -129
  217. package/dist/core/edges-Cj8yVYgz.js +0 -10
@@ -1,242 +1,243 @@
1
- import { B as wn, D as p, E as ce, F as Oe, G as Cn, H as Mn, I as Sn, K as An, L as xn, M as v, O as Z, P as He, R as Dn, S as zn, T as Ze, V as $n, _ as ue, c as Un, d as L, g as Be, h as Fe, i as En, j as _, k as E, l as en, m as R, n as b, o as On, q as _n, s as Bn, t as Fn, v as o, w as Gn, x as N, z as Ln } from "./three.tsl-CgyjOhns.js";
2
- import { t as Nn } from "./edges-Cj8yVYgz.js";
3
- import { t as qr } from "./time-myrFQH-u.js";
4
- import "./transformations-Bs66Qh16.js";
5
- import { n as qn } from "./AngularBlur-BJi-Edw-.js";
6
- import { n as Pn } from "./Ascii-B1KHvM1u.js";
7
- import "./colorMixing-C_ESXyqX.js";
8
- import { n as Vn } from "./Blob-CBASKMfO.js";
9
- import { n as Hn } from "./Blur-bz9Ubr0x.js";
10
- import { n as In } from "./Bulge-Ceythf-i.js";
11
- import { n as Wn } from "./ChannelBlur-DhWT-55L.js";
12
- import { n as Xn } from "./Checkerboard-CgWGd9t7.js";
13
- import { n as Yn } from "./ChromaFlow-DOVrymVB.js";
14
- import { n as jn } from "./ChromaticAberration-CyTSXY7j.js";
15
- import { n as Qn } from "./Circle-0WHV1HrM.js";
16
- import { n as Jn } from "./CRTScreen-BnfROw0f.js";
17
- import { n as Kn } from "./CursorTrail-3zQ5rtjh.js";
18
- import { n as Zn } from "./DiffuseBlur-DLIKRsnf.js";
19
- import { n as et } from "./Dither-Cnbknfji.js";
20
- import { n as nt } from "./DotGrid-BkItF2C8.js";
21
- import { n as tt } from "./Duotone-BI4tJI3k.js";
22
- import { n as rt } from "./FilmGrain-BAZORehh.js";
23
- import { n as ot } from "./FloatingParticles-7wvOBUbD.js";
24
- import { n as it } from "./GlassTiles-C0y_PWTa.js";
25
- import { n as at } from "./Glow-BD0t9E1L.js";
26
- import { n as st } from "./Godrays-CPIAbymT.js";
1
+ import { A as N, B as In, D as C, E as xe, F as dn, H as Hn, I as Je, J as Wn, K as jn, L as Qn, M as Y, N as x, P as we, R as Jn, S as Ce, T as wn, U as Kn, V as Zn, _ as Me, c as er, d as Z, g as Ke, h as Ze, i as nr, k as pe, l as yn, m as A, n as k, o as hn, q as rr, s as tr, t as or, v as i, w as sr, x as ee, z as ar } from "./three.tsl-BqgDcRt9.js";
2
+ import { n as ce, t as ye } from "./edges-B-tVdqcI.js";
3
+ import { t as oo } from "./time-5uQ65blS.js";
4
+ import "./transformations-DBjTkQ5b.js";
5
+ import { n as ir } from "./AngularBlur-BTUdXC0g.js";
6
+ import { n as lr } from "./Ascii-Bu8ii7oo.js";
7
+ import "./colorMixing-DPZ-Td4U.js";
8
+ import { n as cr } from "./Blob-C0G0efjG.js";
9
+ import { n as fr } from "./Blur-BzUO9yxF.js";
10
+ import { n as mr } from "./Bulge-BCXYAzig.js";
11
+ import { n as ur } from "./ChannelBlur-BEK1qzGn.js";
12
+ import { n as dr } from "./Checkerboard-BPkiSF5I.js";
13
+ import { n as hr } from "./ChromaFlow-AHO3C4o3.js";
14
+ import { n as pr } from "./ChromaticAberration-nVg3r1FK.js";
15
+ import { n as gr } from "./Circle-C8ltF4BZ.js";
16
+ import { n as br } from "./CRTScreen-cJ3XHrI9.js";
17
+ import { n as vr } from "./CursorTrail-BeJGeovB.js";
18
+ import { n as Cr } from "./DiffuseBlur-BdGvOoBw.js";
19
+ import { n as Rr } from "./Dither-CpN3vGSh.js";
20
+ import { n as Tr } from "./DotGrid-BFUzeSQw.js";
21
+ import { n as kr } from "./Duotone-_nR_o3-g.js";
22
+ import { n as wr } from "./FilmGrain-BAKXXtLg.js";
23
+ import { n as yr } from "./FloatingParticles-Fv8JIzKk.js";
24
+ import { n as Sr } from "./GlassTiles-5MyBj1ff.js";
25
+ import { n as Ur } from "./Glow-DvJj7BB7.js";
26
+ import { n as xr } from "./Godrays-cUzAKVXn.js";
27
27
  import "./TSLBase-BFMvTOak.js";
28
28
  import "./ColorAdjustment-CKwpE_4M.js";
29
- import { n as lt } from "./Grayscale-BtOqK43k.js";
30
- import { n as ct } from "./Grid-Ro0Yi5WY.js";
31
- import { n as ut } from "./GridDistortion-CuxRQdzs.js";
32
- import { n as mt } from "./Group-DTXP-whY.js";
33
- import { n as ft } from "./Halftone-B_MuXCD8.js";
34
- import { n as dt } from "./HueShift-CKG9M-d2.js";
35
- import { n as ht } from "./ImageTexture-B6zFP2fB.js";
36
- import { n as pt } from "./Invert-Cd7GK1vs.js";
37
- import { n as gt } from "./LinearBlur-JFLMQBY4.js";
38
- import { n as bt } from "./LinearGradient-Ztg5Lzwj.js";
39
- import { n as yt } from "./Liquify-rmJGJAdt.js";
40
- import { n as vt } from "./Pixelate-BIANS3t9.js";
41
- import { n as Tt } from "./PolarCoordinates-qzU8gNXR.js";
42
- import { n as Rt } from "./Posterize-BkBU8tnN.js";
43
- import { n as kt } from "./ProgressiveBlur-HAQf188T.js";
44
- import { n as wt } from "./RadialGradient-DISqJuTZ.js";
45
- import { n as Ct } from "./Ripples-CX8Qgnog.js";
46
- import { n as Mt } from "./Saturation-DMxPYmIU.js";
47
- import { n as St } from "./SimplexNoise-B5ygfckG.js";
48
- import { n as At } from "./SineWave-KPFlP3Wk.js";
49
- import { n as xt } from "./SolidColor-B8oxlGge.js";
50
- import { n as Dt } from "./Spiral-CX22hUJ3.js";
51
- import { n as zt } from "./Strands-Bv7RvyRC.js";
52
- import { n as $t } from "./Swirl-CIXreSgZ.js";
53
- import { n as Ut } from "./TiltShift-J0UUcoh-.js";
54
- import { n as Et } from "./Tritone-E9eHvjJV.js";
55
- import { n as Ot } from "./Twirl-ClhPpapm.js";
56
- import { n as _t } from "./Vibrance-CqnE9Zco.js";
57
- import { n as Bt } from "./WaveDistortion-gecgVpvO.js";
58
- import { n as Ft } from "./ZoomBlur-CaGbSDG3.js";
59
- import { WebGLRenderer as Gt } from "three";
60
- Sn();
61
- R();
62
- function Lt(e, n, r = 1) {
63
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
64
- return v(b(o(n.rgb, t), o(e.rgb, o(e.a, p(1, t)))), s);
29
+ import { n as Mr } from "./Grayscale-oWIF3PV5.js";
30
+ import { n as Ar } from "./Grid-Bov7AA9m.js";
31
+ import { n as $r } from "./GridDistortion-CWYom5Dw.js";
32
+ import { n as zr } from "./Group-CPk-7fiA.js";
33
+ import { n as Dr } from "./Halftone-F7fsdu7W.js";
34
+ import { n as Fr } from "./HueShift-CiS4hdtk.js";
35
+ import { n as Er } from "./ImageTexture-B3Q29OHX.js";
36
+ import { n as Or } from "./Invert-Cyc4JHWc.js";
37
+ import { n as Br } from "./LinearBlur-BTC54qzk.js";
38
+ import { n as Pr } from "./LinearGradient-LEMeW0KM.js";
39
+ import { n as _r } from "./Liquify-D2nzMDzq.js";
40
+ import { n as Vr } from "./Pixelate-irPzmtQm.js";
41
+ import { n as Lr } from "./PolarCoordinates-Ck5ZWrQO.js";
42
+ import { n as qr } from "./Posterize-DICq_t96.js";
43
+ import { n as Gr } from "./ProgressiveBlur-BuORe3VH.js";
44
+ import { n as Nr } from "./RadialGradient-D0cN67jm.js";
45
+ import { n as Xr } from "./RectangularCoordinates-1LIDaeHR.js";
46
+ import { n as Yr } from "./Ripples-DH71sFJc.js";
47
+ import { n as Ir } from "./Saturation-DbSXtSeK.js";
48
+ import { n as Hr } from "./SimplexNoise-DPGC2OPJ.js";
49
+ import { n as Wr } from "./SineWave-CkWtnzHF.js";
50
+ import { n as jr } from "./SolidColor-DaB-FHNX.js";
51
+ import { n as Qr } from "./Spiral-CcyI8azF.js";
52
+ import { n as Jr } from "./Strands-Co4fkc05.js";
53
+ import { n as Kr } from "./Swirl-BoveqtNV.js";
54
+ import { n as Zr } from "./TiltShift-D53azmRe.js";
55
+ import { n as et } from "./Tritone-Cg1rX-hL.js";
56
+ import { n as nt } from "./Twirl-raO5pe5X.js";
57
+ import { n as rt } from "./Vibrance-DtekSkcz.js";
58
+ import { n as tt } from "./WaveDistortion-C65qO_cZ.js";
59
+ import { n as ot } from "./ZoomBlur-B97ZjhXe.js";
60
+ import { WebGLRenderer as st } from "three";
61
+ Qn();
62
+ A();
63
+ function at(e, n, a = 1) {
64
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
65
+ return x(k(i(n.rgb, r), i(e.rgb, i(e.a, C(1, r)))), m);
65
66
  }
66
- R();
67
- var Ie = (e) => _(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), Nt = (e) => _(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), We = (e) => {
68
- const n = e.x, r = e.y, t = e.z, s = n.mul(0.4122214708).add(r.mul(0.5363325363)).add(t.mul(0.0514459929)), f = n.mul(0.2119034982).add(r.mul(0.6806995451).add(t.mul(0.1073969566))), m = n.mul(0.0883024619).add(r.mul(0.2817188376)).add(t.mul(0.6299787005)), u = N(s, L(1 / 3)), g = N(f, L(1 / 3)), y = N(m, L(1 / 3));
69
- return _(u.mul(0.2104542553).add(g.mul(0.793617785)).sub(y.mul(0.0040720468)), u.mul(1.9779984951).sub(g.mul(2.428592205)).add(y.mul(0.4505937099)), u.mul(0.0259040371).add(g.mul(0.7827717662)).sub(y.mul(0.808675766)));
70
- }, qt = (e) => {
71
- const n = e.x, r = e.y, t = e.z, s = n.add(r.mul(0.3963377774)).add(t.mul(0.2158037573)), f = n.sub(r.mul(0.1055613458)).sub(t.mul(0.0638541728)), m = n.sub(r.mul(0.0894841775)).sub(t.mul(1.291485548)), u = N(s, L(3)), g = N(f, L(3)), y = N(m, L(3));
72
- return _(u.mul(4.0767416621).sub(g.mul(3.3077115913)).add(y.mul(0.2309699292)), u.mul(-1.2684380046).add(g.mul(2.6097574011)).sub(y.mul(0.3413193965)), u.mul(-0.0041960863).sub(g.mul(0.7034186147)).add(y.mul(1.707614701)));
73
- }, Xe = (e) => {
74
- const n = e.x, r = e.y, t = e.z;
75
- return _(n, Ze(r.mul(r).add(t.mul(t))), En(t, r));
76
- }, Pt = (e) => {
77
- const n = e.x, r = e.y, t = e.z;
78
- return _(n, r.mul(Bn(t)), r.mul(Gn(t)));
67
+ A();
68
+ var pn = (e) => Y(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), it = (e) => Y(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), gn = (e) => {
69
+ const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)), S = ee(h, Z(1 / 3));
70
+ return Y(d.mul(0.2104542553).add(R.mul(0.793617785)).sub(S.mul(0.0040720468)), d.mul(1.9779984951).sub(R.mul(2.428592205)).add(S.mul(0.4505937099)), d.mul(0.0259040371).add(R.mul(0.7827717662)).sub(S.mul(0.808675766)));
71
+ }, lt = (e) => {
72
+ const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)), S = ee(h, Z(3));
73
+ return Y(d.mul(4.0767416621).sub(R.mul(3.3077115913)).add(S.mul(0.2309699292)), d.mul(-1.2684380046).add(R.mul(2.6097574011)).sub(S.mul(0.3413193965)), d.mul(-0.0041960863).sub(R.mul(0.7034186147)).add(S.mul(1.707614701)));
74
+ }, bn = (e) => {
75
+ const n = e.x, a = e.y, r = e.z;
76
+ return Y(n, wn(a.mul(a).add(r.mul(r))), nr(r, a));
77
+ }, ct = (e) => {
78
+ const n = e.x, a = e.y, r = e.z;
79
+ return Y(n, a.mul(tr(r)), a.mul(sr(r)));
79
80
  };
80
- function Vt(e, n, r = 1) {
81
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = Ie(_(e.r, e.g, e.b)), m = Ie(_(n.r, n.g, n.b)), u = We(f), g = We(m), y = Xe(u);
82
- return v(Nt(qt(Pt(b(o(Xe(g), t), o(y, o(e.a, p(1, t))))))), s);
81
+ function ft(e, n, a = 1) {
82
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = pn(Y(e.r, e.g, e.b)), h = pn(Y(n.r, n.g, n.b)), d = gn(p), R = gn(h), S = bn(d);
83
+ return x(it(lt(ct(k(i(bn(R), r), i(S, i(e.a, C(1, r))))))), m);
83
84
  }
84
- R();
85
- var Ye = (e) => _(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), Ht = (e) => _(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), je = (e) => {
86
- const n = e.x, r = e.y, t = e.z, s = n.mul(0.4122214708).add(r.mul(0.5363325363)).add(t.mul(0.0514459929)), f = n.mul(0.2119034982).add(r.mul(0.6806995451).add(t.mul(0.1073969566))), m = n.mul(0.0883024619).add(r.mul(0.2817188376)).add(t.mul(0.6299787005)), u = N(s, L(1 / 3)), g = N(f, L(1 / 3)), y = N(m, L(1 / 3));
87
- return _(u.mul(0.2104542553).add(g.mul(0.793617785)).sub(y.mul(0.0040720468)), u.mul(1.9779984951).sub(g.mul(2.428592205)).add(y.mul(0.4505937099)), u.mul(0.0259040371).add(g.mul(0.7827717662)).sub(y.mul(0.808675766)));
88
- }, It = (e) => {
89
- const n = e.x, r = e.y, t = e.z, s = n.add(r.mul(0.3963377774)).add(t.mul(0.2158037573)), f = n.sub(r.mul(0.1055613458)).sub(t.mul(0.0638541728)), m = n.sub(r.mul(0.0894841775)).sub(t.mul(1.291485548)), u = N(s, L(3)), g = N(f, L(3)), y = N(m, L(3));
90
- return _(u.mul(4.0767416621).sub(g.mul(3.3077115913)).add(y.mul(0.2309699292)), u.mul(-1.2684380046).add(g.mul(2.6097574011)).sub(y.mul(0.3413193965)), u.mul(-0.0041960863).sub(g.mul(0.7034186147)).add(y.mul(1.707614701)));
85
+ A();
86
+ var vn = (e) => Y(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), mt = (e) => Y(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), Cn = (e) => {
87
+ const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)), S = ee(h, Z(1 / 3));
88
+ return Y(d.mul(0.2104542553).add(R.mul(0.793617785)).sub(S.mul(0.0040720468)), d.mul(1.9779984951).sub(R.mul(2.428592205)).add(S.mul(0.4505937099)), d.mul(0.0259040371).add(R.mul(0.7827717662)).sub(S.mul(0.808675766)));
89
+ }, ut = (e) => {
90
+ const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)), S = ee(h, Z(3));
91
+ return Y(d.mul(4.0767416621).sub(R.mul(3.3077115913)).add(S.mul(0.2309699292)), d.mul(-1.2684380046).add(R.mul(2.6097574011)).sub(S.mul(0.3413193965)), d.mul(-0.0041960863).sub(R.mul(0.7034186147)).add(S.mul(1.707614701)));
91
92
  };
92
- function Wt(e, n, r = 1) {
93
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = Ye(_(e.r, e.g, e.b)), m = Ye(_(n.r, n.g, n.b)), u = je(f);
94
- return v(Ht(It(b(o(je(m), t), o(u, o(e.a, p(1, t)))))), s);
93
+ function dt(e, n, a = 1) {
94
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = vn(Y(e.r, e.g, e.b)), h = vn(Y(n.r, n.g, n.b)), d = Cn(p);
95
+ return x(mt(ut(k(i(Cn(h), r), i(d, i(e.a, C(1, r)))))), m);
95
96
  }
96
- R();
97
- function Xt(e, n, r = 1) {
98
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
99
- return v(b(o(o(e.rgb, n.rgb), t), o(e.rgb, o(e.a, p(1, t)))), s);
97
+ A();
98
+ function ht(e, n, a = 1) {
99
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
100
+ return x(k(i(i(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
100
101
  }
101
- R();
102
- function Yt(e, n, r = 1) {
103
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
104
- return v(b(o(p(1, o(p(1, e.rgb), p(1, n.rgb))), t), o(e.rgb, o(e.a, p(1, t)))), s);
102
+ A();
103
+ function pt(e, n, a = 1) {
104
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
105
+ return x(k(i(C(1, i(C(1, e.rgb), C(1, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
105
106
  }
106
- R();
107
- function jt(e, n, r = 1) {
108
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
109
- return v(b(o(Be(b(e.rgb, n.rgb), 1), t), o(e.rgb, o(e.a, p(1, t)))), s);
107
+ A();
108
+ function gt(e, n, a = 1) {
109
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
110
+ return x(k(i(Ke(k(e.rgb, n.rgb), 1), r), i(e.rgb, i(e.a, C(1, r)))), m);
110
111
  }
111
- R();
112
- function Qt(e, n, r = 1) {
113
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
114
- return v(b(o(ue(o(2, o(e.rgb, n.rgb)), p(1, o(2, o(p(1, e.rgb), p(1, n.rgb)))), ce(0.5, e.rgb)), t), o(e.rgb, o(e.a, p(1, t)))), s);
112
+ A();
113
+ function bt(e, n, a = 1) {
114
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
115
+ return x(k(i(Me(i(2, i(e.rgb, n.rgb)), C(1, i(2, i(C(1, e.rgb), C(1, n.rgb)))), xe(0.5, e.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
115
116
  }
116
- R();
117
- function Jt(e, n, r = 1) {
118
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
119
- return v(b(o(Fn(p(e.rgb, n.rgb)), t), o(e.rgb, o(e.a, p(1, t)))), s);
117
+ A();
118
+ function vt(e, n, a = 1) {
119
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
120
+ return x(k(i(or(C(e.rgb, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
120
121
  }
121
- R();
122
- function Kt(e, n, r = 1) {
123
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
124
- return v(b(o(ue(e.rgb, Be(Un(e.rgb, p(1, n.rgb)), 1), ce(1e-3, p(1, n.rgb))), t), o(e.rgb, o(e.a, p(1, t)))), s);
122
+ A();
123
+ function Ct(e, n, a = 1) {
124
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
125
+ return x(k(i(Me(e.rgb, Ke(er(e.rgb, C(1, n.rgb)), 1), xe(1e-3, C(1, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
125
126
  }
126
- R();
127
- function Zt(e, n, r = 1) {
128
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
129
- return v(b(o(p(b(e.rgb, n.rgb), o(2, o(e.rgb, n.rgb))), t), o(e.rgb, o(e.a, p(1, t)))), s);
127
+ A();
128
+ function Rt(e, n, a = 1) {
129
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
130
+ return x(k(i(C(k(e.rgb, n.rgb), i(2, i(e.rgb, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
130
131
  }
131
- R();
132
- function Y(e) {
133
- return b(b(o(e.r, 0.2126), o(e.g, 0.7152)), o(e.b, 0.0722));
132
+ A();
133
+ function me(e) {
134
+ return k(k(i(e.r, 0.2126), i(e.g, 0.7152)), i(e.b, 0.0722));
134
135
  }
135
- R();
136
- function er(e, n, r = 1) {
137
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = p(Y(e.rgb), Y(n.rgb));
138
- return v(b(o(b(n.rgb, f), t), o(e.rgb, o(e.a, p(1, t)))), s);
136
+ A();
137
+ function Tt(e, n, a = 1) {
138
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = C(me(e.rgb), me(n.rgb));
139
+ return x(k(i(k(n.rgb, p), r), i(e.rgb, i(e.a, C(1, r)))), m);
139
140
  }
140
- R();
141
- function nr(e, n, r = 1) {
142
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = Y(e.rgb), m = Y(n.rgb).div(b(f, 1e-4));
143
- return v(b(o(o(e.rgb, m), t), o(e.rgb, o(e.a, p(1, t)))), s);
141
+ A();
142
+ function kt(e, n, a = 1) {
143
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb).div(k(p, 1e-4));
144
+ return x(k(i(i(e.rgb, h), r), i(e.rgb, i(e.a, C(1, r)))), m);
144
145
  }
145
- R();
146
- function tr(e, n, r = 1) {
147
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
148
- return v(b(o(Be(e.rgb, n.rgb), t), o(e.rgb, o(e.a, p(1, t)))), s);
146
+ A();
147
+ function wt(e, n, a = 1) {
148
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
149
+ return x(k(i(Ke(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
149
150
  }
150
- R();
151
- function rr(e, n, r = 1) {
152
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
153
- return v(b(o(Fe(e.rgb, n.rgb), t), o(e.rgb, o(e.a, p(1, t)))), s);
151
+ A();
152
+ function yt(e, n, a = 1) {
153
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
154
+ return x(k(i(Ze(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
154
155
  }
155
- R();
156
- function or(e, n, r = 1) {
157
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
158
- return v(b(o(ue(v(0, 0, 0, 1).rgb, Fe(p(1, p(1, e.rgb).div(b(n.rgb, 1e-4))), 0), ce(1e-4, n.rgb)), t), o(e.rgb, o(e.a, p(1, t)))), s);
156
+ A();
157
+ function St(e, n, a = 1) {
158
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
159
+ return x(k(i(Me(x(0, 0, 0, 1).rgb, Ze(C(1, C(1, e.rgb).div(k(n.rgb, 1e-4))), 0), xe(1e-4, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
159
160
  }
160
- R();
161
- function ir(e, n, r = 1) {
162
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
163
- return v(b(o(Fe(b(b(e.rgb, n.rgb), -1), 0), t), o(e.rgb, o(e.a, p(1, t)))), s);
161
+ A();
162
+ function Ut(e, n, a = 1) {
163
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
164
+ return x(k(i(Ze(k(k(e.rgb, n.rgb), -1), 0), r), i(e.rgb, i(e.a, C(1, r)))), m);
164
165
  }
165
- R();
166
- function ar(e, n, r = 1) {
167
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = b(o(2, o(e.rgb, n.rgb)), o(o(e.rgb, e.rgb), p(1, o(2, n.rgb)))), m = Ze(e.rgb);
168
- return v(b(o(ue(f, b(o(2, o(e.rgb, p(1, n.rgb))), o(m, p(o(2, n.rgb), 1))), ce(0.5, n.rgb)), t), o(e.rgb, o(e.a, p(1, t)))), s);
166
+ A();
167
+ function xt(e, n, a = 1) {
168
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = k(i(2, i(e.rgb, n.rgb)), i(i(e.rgb, e.rgb), C(1, i(2, n.rgb)))), h = wn(e.rgb);
169
+ return x(k(i(Me(p, k(i(2, i(e.rgb, C(1, n.rgb))), i(h, C(i(2, n.rgb), 1))), xe(0.5, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
169
170
  }
170
- R();
171
- function sr(e, n, r = 1) {
172
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t)));
173
- return v(b(o(ue(o(2, o(e.rgb, n.rgb)), p(1, o(2, o(p(1, e.rgb), p(1, n.rgb)))), ce(0.5, n.rgb)), t), o(e.rgb, o(e.a, p(1, t)))), s);
171
+ A();
172
+ function Mt(e, n, a = 1) {
173
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r)));
174
+ return x(k(i(Me(i(2, i(e.rgb, n.rgb)), C(1, i(2, i(C(1, e.rgb), C(1, n.rgb)))), xe(0.5, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
174
175
  }
175
- R();
176
- function lr(e, n, r = 1) {
177
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = Y(e.rgb), m = Y(n.rgb), u = e.rgb.sub(f), g = n.rgb.sub(m), y = u.length();
178
- return v(b(o(b(o(g.normalize(), y), f), t), o(e.rgb, o(e.a, p(1, t)))), s);
176
+ A();
177
+ function At(e, n, a = 1) {
178
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb), d = e.rgb.sub(p), R = n.rgb.sub(h), S = d.length();
179
+ return x(k(i(k(i(R.normalize(), S), p), r), i(e.rgb, i(e.a, C(1, r)))), m);
179
180
  }
180
- R();
181
- function cr(e, n, r = 1) {
182
- const t = o(n.a, r), s = b(t, o(e.a, p(1, t))), f = Y(e.rgb), m = Y(n.rgb), u = e.rgb.sub(f), g = n.rgb.sub(m);
183
- return v(b(o(b(o(u.normalize(), g.length()), f), t), o(e.rgb, o(e.a, p(1, t)))), s);
181
+ A();
182
+ function $t(e, n, a = 1) {
183
+ const r = i(n.a, a), m = k(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb), d = e.rgb.sub(p), R = n.rgb.sub(h);
184
+ return x(k(i(k(i(d.normalize(), R.length()), p), r), i(e.rgb, i(e.a, C(1, r)))), m);
184
185
  }
185
- var Qe = {
186
- normal: Lt,
187
- "normal-oklch": Vt,
188
- "normal-oklab": Wt,
189
- multiply: Xt,
190
- screen: Yt,
191
- linearDodge: jt,
192
- overlay: Qt,
193
- difference: Jt,
194
- colorDodge: Kt,
195
- exclusion: Zt,
196
- color: er,
197
- luminosity: nr,
198
- darken: tr,
199
- lighten: rr,
200
- colorBurn: or,
201
- linearBurn: ir,
202
- softLight: ar,
203
- hardLight: sr,
204
- hue: lr,
205
- saturation: cr
186
+ var Rn = {
187
+ normal: at,
188
+ "normal-oklch": ft,
189
+ "normal-oklab": dt,
190
+ multiply: ht,
191
+ screen: pt,
192
+ linearDodge: gt,
193
+ overlay: bt,
194
+ difference: vt,
195
+ colorDodge: Ct,
196
+ exclusion: Rt,
197
+ color: Tt,
198
+ luminosity: kt,
199
+ darken: wt,
200
+ lighten: yt,
201
+ colorBurn: St,
202
+ linearBurn: Ut,
203
+ softLight: xt,
204
+ hardLight: Mt,
205
+ hue: At,
206
+ saturation: $t
206
207
  };
207
- function X(e, n, r = "normal", t = 1) {
208
- return (Qe[r] || Qe.normal)(e, n, t);
208
+ function K(e, n, a = "normal", r = 1) {
209
+ return (Rn[a] || Rn.normal)(e, n, r);
209
210
  }
210
- R();
211
- function ur(e, n) {
212
- const r = o(e.a, n.a);
213
- return v(e.rgb, r);
211
+ A();
212
+ function zt(e, n) {
213
+ const a = i(e.a, n.a);
214
+ return x(e.rgb, a);
214
215
  }
215
- R();
216
- function mr(e, n) {
217
- const r = p(1, n.a), t = o(e.a, r);
218
- return v(e.rgb, t);
216
+ A();
217
+ function Dt(e, n) {
218
+ const a = C(1, n.a), r = i(e.a, a);
219
+ return x(e.rgb, r);
219
220
  }
220
- R();
221
- function fr(e, n) {
222
- const r = _(0.2126, 0.7152, 0.0722), t = en(n.rgb, r), s = o(e.a, t);
223
- return v(e.rgb, s);
221
+ A();
222
+ function Ft(e, n) {
223
+ const a = Y(0.2126, 0.7152, 0.0722), r = yn(n.rgb, a), m = i(e.a, r);
224
+ return x(e.rgb, m);
224
225
  }
225
- R();
226
- function dr(e, n) {
227
- const r = _(0.2126, 0.7152, 0.0722), t = p(1, en(n.rgb, r)), s = o(e.a, t);
228
- return v(e.rgb, s);
226
+ A();
227
+ function Et(e, n) {
228
+ const a = Y(0.2126, 0.7152, 0.0722), r = C(1, yn(n.rgb, a)), m = i(e.a, r);
229
+ return x(e.rgb, m);
229
230
  }
230
- var Je = {
231
- alpha: ur,
232
- alphaInverted: mr,
233
- luminance: fr,
234
- luminanceInverted: dr
231
+ var Tn = {
232
+ alpha: zt,
233
+ alphaInverted: Dt,
234
+ luminance: Ft,
235
+ luminanceInverted: Et
235
236
  };
236
- function hr(e, n, r = "alpha") {
237
- return (Je[r] || Je.alpha)(e, n);
237
+ function Ot(e, n, a = "alpha") {
238
+ return (Tn[a] || Tn.alpha)(e, n);
238
239
  }
239
- var pr = class {
240
+ var Bt = class {
240
241
  frameTimesMs = [];
241
242
  maxSamples = 60;
242
243
  targetFrameTime = 16.67;
@@ -249,11 +250,19 @@ var pr = class {
249
250
  lastCpuTime = null;
250
251
  lastGpuTime = null;
251
252
  isRendering = !1;
253
+ lastFrameTimestamp = 0;
254
+ frameIntervals = [];
252
255
  /**
253
256
  * Records a frame's render time
254
257
  */
255
258
  recordFrame(e) {
256
- this.frameTimesMs.push(e), this.frameTimesMs.length > this.maxSamples && this.frameTimesMs.shift(), this.totalFrameCount++, e > this.targetFrameTime && this.jankFrameCount++, this.recordMemorySnapshot();
259
+ this.frameTimesMs.push(e), this.frameTimesMs.length > this.maxSamples && this.frameTimesMs.shift(), this.totalFrameCount++, e > this.targetFrameTime && this.jankFrameCount++;
260
+ const n = performance.now();
261
+ if (this.lastFrameTimestamp > 0) {
262
+ const a = n - this.lastFrameTimestamp;
263
+ this.frameIntervals.push(a), this.frameIntervals.length > this.maxSamples && this.frameIntervals.shift();
264
+ }
265
+ this.lastFrameTimestamp = n, this.recordMemorySnapshot();
257
266
  }
258
267
  /**
259
268
  * Records CPU time for the last frame
@@ -289,32 +298,32 @@ var pr = class {
289
298
  time: e,
290
299
  bytes: n
291
300
  });
292
- const r = e - this.memoryWindowMs;
293
- this.memorySnapshots = this.memorySnapshots.filter((t) => t.time > r);
301
+ const a = e - this.memoryWindowMs;
302
+ this.memorySnapshots = this.memorySnapshots.filter((r) => r.time > a);
294
303
  }
295
304
  /**
296
305
  * Calculates memory growth rate in MB/sec
297
306
  */
298
307
  calculateMemoryGrowthRate() {
299
308
  if (this.memorySnapshots.length < 2) return null;
300
- const e = this.memorySnapshots[0], n = this.memorySnapshots[this.memorySnapshots.length - 1], r = (n.time - e.time) / 1e3;
301
- return (n.bytes - e.bytes) / (1024 * 1024) / r;
309
+ const e = this.memorySnapshots[0], n = this.memorySnapshots[this.memorySnapshots.length - 1], a = (n.time - e.time) / 1e3;
310
+ return (n.bytes - e.bytes) / (1024 * 1024) / a;
302
311
  }
303
312
  /**
304
313
  * Calculates standard deviation of frame times
305
314
  */
306
315
  calculateStdDev(e) {
307
316
  if (e.length === 0) return 0;
308
- const n = e.reduce((t, s) => t + s, 0) / e.length, r = e.map((t) => Math.pow(t - n, 2)).reduce((t, s) => t + s, 0) / e.length;
309
- return Math.sqrt(r);
317
+ const n = e.reduce((r, m) => r + m, 0) / e.length, a = e.map((r) => Math.pow(r - n, 2)).reduce((r, m) => r + m, 0) / e.length;
318
+ return Math.sqrt(a);
310
319
  }
311
320
  /**
312
321
  * Calculates 99th percentile frame time
313
322
  */
314
323
  calculateP99(e) {
315
324
  if (e.length === 0) return 0;
316
- const n = [...e].sort((t, s) => t - s), r = Math.floor(n.length * 0.99);
317
- return n[Math.min(r, n.length - 1)];
325
+ const n = [...e].sort((r, m) => r - m), a = Math.floor(n.length * 0.99);
326
+ return n[Math.min(a, n.length - 1)];
318
327
  }
319
328
  /**
320
329
  * Calculates complexity score based on node structure
@@ -340,10 +349,10 @@ var pr = class {
340
349
  score: 0,
341
350
  label: "N/A"
342
351
  };
343
- const n = this.frameTimesMs.reduce((y, A) => y + A, 0) / e, r = Math.min(n / 16.67 * 100, 100), t = this.calculateComplexityScore(), s = Math.min(t / 100 * 100, 100);
344
- let f = 0;
345
- this.lastGpuTime !== null && (f = Math.min(this.lastGpuTime / 16.67 * 100, 100));
346
- const m = this.lastGpuTime !== null ? {
352
+ const n = this.frameTimesMs.reduce((S, V) => S + V, 0) / e, a = Math.min(n / 16.67 * 100, 100), r = this.calculateComplexityScore(), m = Math.min(r / 100 * 100, 100);
353
+ let p = 0;
354
+ this.lastGpuTime !== null && (p = Math.min(this.lastGpuTime / 16.67 * 100, 100));
355
+ const h = this.lastGpuTime !== null ? {
347
356
  frame: 0.4,
348
357
  gpu: 0.4,
349
358
  complexity: 0.2
@@ -351,40 +360,40 @@ var pr = class {
351
360
  frame: 0.7,
352
361
  gpu: 0,
353
362
  complexity: 0.3
354
- }, u = Math.round(r * m.frame + f * m.gpu + s * m.complexity);
355
- let g;
356
- return u <= 20 ? g = "Very Light" : u <= 40 ? g = "Light" : u <= 60 ? g = "Medium" : u <= 80 ? g = "Heavy" : g = "Very Heavy", {
357
- score: Math.min(u, 100),
358
- label: g
363
+ }, d = Math.round(a * h.frame + p * h.gpu + m * h.complexity);
364
+ let R;
365
+ return d <= 20 ? R = "Very Light" : d <= 40 ? R = "Light" : d <= 60 ? R = "Medium" : d <= 80 ? R = "Heavy" : R = "Very Heavy", {
366
+ score: Math.min(d, 100),
367
+ label: R
359
368
  };
360
369
  }
361
370
  /**
362
371
  * Gets current performance statistics
363
372
  */
364
373
  getStats(e) {
365
- const n = this.frameTimesMs.length, r = n > 0 ? 1e3 / (this.frameTimesMs.reduce((M, S) => M + S, 0) / n) : 0, t = n > 0 ? this.frameTimesMs.reduce((M, S) => M + S, 0) / n : 0, s = n > 0 ? Math.min(...this.frameTimesMs) : 0, f = n > 0 ? Math.max(...this.frameTimesMs) : 0, m = this.calculateP99(this.frameTimesMs), u = this.calculateStdDev(this.frameTimesMs), g = this.totalFrameCount > 0 ? this.jankFrameCount / this.totalFrameCount * 100 : 0, y = performance.memory, A = y ? y.usedJSHeapSize / (1024 * 1024) : null, C = this.calculateMemoryGrowthRate(), q = t > 0 ? t / this.targetFrameTime * 100 : 0, B = e?.render?.calls ?? null, F = e?.programs?.length ?? null, O = e?.memory?.textures ?? null, I = this.calculateIntensityScore();
374
+ const n = this.frameTimesMs.length, a = this.frameIntervals.length > 0 ? 1e3 / (this.frameIntervals.reduce((z, D) => z + D, 0) / this.frameIntervals.length) : 0, r = n > 0 ? this.frameTimesMs.reduce((z, D) => z + D, 0) / n : 0, m = n > 0 ? Math.min(...this.frameTimesMs) : 0, p = n > 0 ? Math.max(...this.frameTimesMs) : 0, h = this.calculateP99(this.frameTimesMs), d = this.calculateStdDev(this.frameTimesMs), R = this.totalFrameCount > 0 ? this.jankFrameCount / this.totalFrameCount * 100 : 0, S = performance.memory, V = S ? S.usedJSHeapSize / (1024 * 1024) : null, B = this.calculateMemoryGrowthRate(), ne = r > 0 ? r / this.targetFrameTime * 100 : 0, I = e?.render?.calls ?? null, H = e?.programs?.length ?? null, X = e?.memory?.textures ?? null, ae = this.calculateIntensityScore();
366
375
  return {
367
- fps: Math.round(r),
368
- avgFrameTime: Math.round(t * 100) / 100,
369
- minFrameTime: Math.round(s * 100) / 100,
370
- maxFrameTime: Math.round(f * 100) / 100,
371
- p99FrameTime: Math.round(m * 100) / 100,
372
- stdDevFrameTime: Math.round(u * 100) / 100,
376
+ fps: Math.round(a),
377
+ avgFrameTime: Math.round(r * 100) / 100,
378
+ minFrameTime: Math.round(m * 100) / 100,
379
+ maxFrameTime: Math.round(p * 100) / 100,
380
+ p99FrameTime: Math.round(h * 100) / 100,
381
+ stdDevFrameTime: Math.round(d * 100) / 100,
373
382
  jankCount: this.jankFrameCount,
374
- jankPercent: Math.round(g * 10) / 10,
383
+ jankPercent: Math.round(R * 10) / 10,
375
384
  nodeCount: this.nodeCount,
376
385
  rttNodeCount: this.rttNodeCount,
377
386
  complexityScore: this.calculateComplexityScore(),
378
- memoryUsedMB: A !== null ? Math.round(A * 100) / 100 : null,
379
- memoryGrowthRate: C !== null ? Math.round(C * 1e3) / 1e3 : null,
387
+ memoryUsedMB: V !== null ? Math.round(V * 100) / 100 : null,
388
+ memoryGrowthRate: B !== null ? Math.round(B * 1e3) / 1e3 : null,
380
389
  cpuTime: this.lastCpuTime !== null ? Math.round(this.lastCpuTime * 100) / 100 : null,
381
390
  gpuTime: this.lastGpuTime !== null ? Math.round(this.lastGpuTime * 100) / 100 : null,
382
- budgetUsed: Math.round(q * 10) / 10,
383
- drawCalls: B,
384
- shaderPrograms: F,
385
- textureCount: O,
386
- intensityScore: I.score,
387
- intensityLabel: I.label,
391
+ budgetUsed: Math.round(ne * 10) / 10,
392
+ drawCalls: I,
393
+ shaderPrograms: H,
394
+ textureCount: X,
395
+ intensityScore: ae.score,
396
+ intensityLabel: ae.label,
388
397
  isRendering: this.isRendering
389
398
  };
390
399
  }
@@ -392,96 +401,96 @@ var pr = class {
392
401
  * Resets all statistics
393
402
  */
394
403
  reset() {
395
- this.frameTimesMs = [], this.jankFrameCount = 0, this.totalFrameCount = 0, this.memorySnapshots = [], this.lastCpuTime = null, this.lastGpuTime = null;
404
+ this.frameTimesMs = [], this.frameIntervals = [], this.lastFrameTimestamp = 0, this.jankFrameCount = 0, this.totalFrameCount = 0, this.memorySnapshots = [], this.lastCpuTime = null, this.lastGpuTime = null;
396
405
  }
397
406
  };
398
- R();
399
- var { vec2: le, cos: gr, sin: br, float: yr, PI: vr } = Z;
400
- const _e = (e) => e.offsetX !== 0 || e.offsetY !== 0 || e.rotation !== 0 || e.scale !== 1 || e.anchorX !== 0.5 || e.anchorY !== 0.5, Tr = (e, n, r, t, s, f, m, u) => {
401
- const g = t.mul(vr).div(yr(180)), y = gr(g), A = br(g), C = le(f, m), q = e.sub(C).div(s), B = le(q.x.mul(u), q.y), F = le(B.x.mul(y).sub(B.y.mul(A)), B.x.mul(A).add(B.y.mul(y)));
402
- return le(F.x.div(u), F.y).sub(le(n, r)).add(C);
407
+ A();
408
+ var { vec2: Se, cos: Pt, sin: _t, float: Vt, PI: Lt } = pe;
409
+ const fe = (e) => e.offsetX !== 0 || e.offsetY !== 0 || e.rotation !== 0 || e.scale !== 1 || e.anchorX !== 0.5 || e.anchorY !== 0.5, Ue = (e, n, a, r, m, p, h, d) => {
410
+ const R = r.mul(Lt).div(Vt(180)), S = Pt(R), V = _t(R), B = Se(p, h), ne = e.sub(B).div(m), I = Se(ne.x.mul(d), ne.y), H = Se(I.x.mul(S).sub(I.y.mul(V)), I.x.mul(V).add(I.y.mul(S)));
411
+ return Se(H.x.div(d), H.y).sub(Se(n, a)).add(B);
403
412
  };
404
- var Rr = /* @__PURE__ */ An({
405
- createUniformsMap: () => kr,
406
- updateUniformValue: () => wr
413
+ var qt = /* @__PURE__ */ rr({
414
+ createUniformsMap: () => Gt,
415
+ updateUniformValue: () => Nt
407
416
  });
408
- function kr(e, n, r) {
409
- const t = {};
410
- return Object.entries(e.props).forEach(([s, f]) => {
411
- const m = n[s];
412
- let u = m;
413
- if (f.transform) {
414
- const y = f.transform(m);
415
- u = y?.node ?? y;
417
+ function Gt(e, n, a) {
418
+ const r = {};
419
+ return Object.entries(e.props).forEach(([m, p]) => {
420
+ const h = n[m];
421
+ let d = h;
422
+ if (p.transform) {
423
+ const S = p.transform(h);
424
+ d = S?.node ?? S;
416
425
  }
417
- if (u == null && (u = f.default, f.transform && u !== null && u !== void 0)) {
418
- const y = f.transform(u);
419
- u = y?.node ?? y;
426
+ if (d == null && (d = p.default, p.transform && d !== null && d !== void 0)) {
427
+ const S = p.transform(d);
428
+ d = S?.node ?? S;
420
429
  }
421
- u == null && (console.error(`[Shaders] Uniform "${s}" is null/undefined after fallback. PropConfig:`, {
422
- propName: s,
423
- initialValue: m,
424
- default: f.default,
425
- hasTransform: !!f.transform
426
- }), u = 0);
427
- const g = nn(u).setName(`${s}_${r}`);
428
- typeof u == "string" && g.value === null && (g.value = u), t[s] = {
429
- uniform: g,
430
- transform: f.transform || void 0
430
+ d == null && (console.error(`[Shaders] Uniform "${m}" is null/undefined after fallback. PropConfig:`, {
431
+ propName: m,
432
+ initialValue: h,
433
+ default: p.default,
434
+ hasTransform: !!p.transform
435
+ }), d = 0);
436
+ const R = Sn(d).setName(`${m}_${a}`);
437
+ typeof d == "string" && R.value === null && (R.value = d), r[m] = {
438
+ uniform: R,
439
+ transform: p.transform || void 0
431
440
  };
432
- }), t;
441
+ }), r;
433
442
  }
434
- function wr(e, n) {
443
+ function Nt(e, n) {
435
444
  if (e?.transform) {
436
- const r = e.transform(n), t = r?.data ?? r;
437
- e.uniform.value = t;
445
+ const a = e.transform(n), r = a?.data ?? a;
446
+ e.uniform.value = r;
438
447
  } else e.uniform.value = n;
439
448
  }
440
- var nn, tn = Cn({ "src/utilities/uniforms.ts": (() => {
441
- R(), { uniform: nn } = Z;
449
+ var Sn, Un = jn({ "src/utilities/uniforms.ts": (() => {
450
+ A(), { uniform: Sn } = pe;
442
451
  }) });
443
- R();
444
- var Ke = !1, Cr = /* @__PURE__ */ (() => {
452
+ A();
453
+ var kn = !1, Xt = /* @__PURE__ */ (() => {
445
454
  let e = 0;
446
- const n = /* @__PURE__ */ new Set(), r = (m) => {
447
- n.forEach((u) => {
455
+ const n = /* @__PURE__ */ new Set(), a = (h) => {
456
+ n.forEach((d) => {
448
457
  try {
449
- u.onMouseMove(m);
450
- } catch (g) {
451
- console.error("[Shaders] Error in mouse move handler:", g);
458
+ d.onMouseMove(h);
459
+ } catch (R) {
460
+ console.error("[Shaders] Error in mouse move handler:", R);
452
461
  }
453
462
  });
454
- }, t = (m) => {
455
- n.forEach((u) => {
463
+ }, r = (h) => {
464
+ n.forEach((d) => {
456
465
  try {
457
- u.onTouchMove(m);
458
- } catch (g) {
459
- console.error("[Shaders] Error in touch move handler:", g);
466
+ d.onTouchMove(h);
467
+ } catch (R) {
468
+ console.error("[Shaders] Error in touch move handler:", R);
460
469
  }
461
470
  });
462
- }, s = () => {
463
- n.forEach((m) => {
471
+ }, m = () => {
472
+ n.forEach((h) => {
464
473
  try {
465
- m.onMouseUp();
466
- } catch (u) {
467
- console.error("[Shaders] Error in mouse up handler:", u);
474
+ h.onMouseUp();
475
+ } catch (d) {
476
+ console.error("[Shaders] Error in mouse up handler:", d);
468
477
  }
469
478
  });
470
- }, f = () => {
471
- n.forEach((m) => {
479
+ }, p = () => {
480
+ n.forEach((h) => {
472
481
  try {
473
- m.onTouchEnd();
474
- } catch (u) {
475
- console.error("[Shaders] Error in touch end handler:", u);
482
+ h.onTouchEnd();
483
+ } catch (d) {
484
+ console.error("[Shaders] Error in touch end handler:", d);
476
485
  }
477
486
  });
478
487
  };
479
- return { register(m) {
480
- return n.add(m), e++, e === 1 && (window.addEventListener("mousemove", r), window.addEventListener("touchmove", t), window.addEventListener("mouseup", s), window.addEventListener("touchend", f)), () => {
481
- n.delete(m), e--, e === 0 && (window.removeEventListener("mousemove", r), window.removeEventListener("touchmove", t), window.removeEventListener("mouseup", s), window.removeEventListener("touchend", f));
488
+ return { register(h) {
489
+ return n.add(h), e++, e === 1 && (window.addEventListener("mousemove", a), window.addEventListener("touchmove", r), window.addEventListener("mouseup", m), window.addEventListener("touchend", p)), () => {
490
+ n.delete(h), e--, e === 0 && (window.removeEventListener("mousemove", a), window.removeEventListener("touchmove", r), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", p));
482
491
  };
483
492
  } };
484
- })(), Mr = () => {
493
+ })(), Yt = () => {
485
494
  try {
486
495
  {
487
496
  const { MODE: e, DEV: n } = {
@@ -499,802 +508,1178 @@ var Ke = !1, Cr = /* @__PURE__ */ (() => {
499
508
  return !1;
500
509
  }
501
510
  };
502
- function Io() {
503
- let e = null, n, r, t, s, f;
504
- const m = {
511
+ function cs() {
512
+ let e = null, n, a, r, m, p;
513
+ const h = {
505
514
  nodes: /* @__PURE__ */ new Map(),
506
515
  rootId: null,
507
516
  idToNodeId: /* @__PURE__ */ new Map()
508
- }, u = /* @__PURE__ */ new Map();
509
- let g = null, y = null, A = null, C = !1, q = !1, B = !1, F = null, O = !1, I = !0, M = 0, S = 0, V = !1, Re = 0, ke = !1, me = 0.5, fe = 0.5, j = !1, de = !1, he = null, Q = !1;
510
- const W = new pr();
511
- let H = [], we = !1, pe = [], ee = null, ge = [], ne = null, Ge = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set(), re = /* @__PURE__ */ new Set(), Me = /* @__PURE__ */ new Set(), oe = null, be = !1;
512
- const rn = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, Se = (c, i) => {
513
- c <= 0 || i <= 0 || c === M && i === S || (oe = {
514
- width: c,
515
- height: i
516
- }, be || (be = !0, requestAnimationFrame(() => {
517
- if (be = !1, !oe) return;
518
- const { width: l, height: a } = oe;
519
- oe = null, M = l, S = a, B || (B = !0), n.setSize(l, a, !1);
520
- const h = l / a, T = 2, w = T * h;
521
- r.left = -w / 2, r.right = w / 2, r.top = T / 2, r.bottom = -T / 2, r.updateProjectionMatrix(), s.scale.set(w, T, 1), m.nodes.forEach(($) => {
522
- $.transformUniforms?.aspectRatio && ($.transformUniforms.aspectRatio.value = h), $.resizeCallbacks.forEach((G) => {
517
+ }, d = /* @__PURE__ */ new Map();
518
+ let R = null, S = null, V = null, B = !1, ne = !1, I = !1, H = null, X = !1, ae = !0, z = 0, D = 0, te = !1, Le = 0, Ae = !1, $e = 0.5, ze = 0.5, ue = !1, De = !1, Fe = null, Re = null, de = !1;
519
+ const ie = new Bt();
520
+ let oe = [], qe = !1, Ee = [], ge = null, Oe = [], be = null, en = /* @__PURE__ */ new Set(), nn = /* @__PURE__ */ new Set(), Be = 0, Te = /* @__PURE__ */ new Set(), Ge = /* @__PURE__ */ new Set(), ke = null, Pe = !1;
521
+ const Ne = (s, t) => {
522
+ s <= 0 || t <= 0 || s === z && t === D || (ke = {
523
+ width: s,
524
+ height: t
525
+ }, Pe || (Pe = !0, requestAnimationFrame(() => {
526
+ if (Pe = !1, !ke) return;
527
+ const { width: o, height: l } = ke;
528
+ ke = null, z = o, D = l, I || (I = !0), n.setSize(o, l, !1);
529
+ const f = o / l, b = 2, g = b * f;
530
+ a.left = -g / 2, a.right = g / 2, a.top = b / 2, a.bottom = -b / 2, a.updateProjectionMatrix(), m.scale.set(g, b, 1), h.nodes.forEach((w) => {
531
+ w.transformUniforms?.aspectRatio && (w.transformUniforms.aspectRatio.value = f), w.resizeCallbacks.forEach((M) => {
523
532
  try {
524
- G({
525
- width: l,
526
- height: a
533
+ M({
534
+ width: o,
535
+ height: l
527
536
  });
528
- } catch (D) {
529
- console.error("Error in resize callback:", D);
537
+ } catch (F) {
538
+ console.error("Error in resize callback:", F);
530
539
  }
531
540
  });
532
- }), P().catch(console.warn);
541
+ }), re().catch(console.warn);
533
542
  })));
534
- }, on = () => C && !!n && !!t && !!r && !!f && M > 0 && S > 0 && O, an = (c) => {
535
- if (!n || !r || !s) return;
536
- const i = c[0];
537
- if (!i) return;
538
- let l, a;
539
- if (i.contentBoxSize) {
540
- const h = Array.isArray(i.contentBoxSize) ? i.contentBoxSize[0] : i.contentBoxSize;
541
- h ? (l = Math.round(h.inlineSize), a = Math.round(h.blockSize)) : (l = Math.round(i.contentRect.width), a = Math.round(i.contentRect.height));
543
+ }, xn = () => B && !!n && !!r && !!a && !!p && z > 0 && D > 0 && X, Mn = (s) => {
544
+ if (!n || !a || !m) return;
545
+ const t = s[0];
546
+ if (!t) return;
547
+ let o, l;
548
+ if (t.contentBoxSize) {
549
+ const f = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize;
550
+ f ? (o = Math.round(f.inlineSize), l = Math.round(f.blockSize)) : (o = Math.round(t.contentRect.width), l = Math.round(t.contentRect.height));
542
551
  } else
543
- l = Math.round(i.contentRect.width), a = Math.round(i.contentRect.height);
544
- l === 0 || a === 0 || Se(l, a);
545
- }, sn = (c) => {
546
- const i = c[0];
547
- if (!i) return;
548
- const l = O;
549
- O = i.isIntersecting;
550
- const a = e?.getBoundingClientRect(), h = V;
551
- if (V = O && !!a && a.width > 0 && a.height > 0, O && !l) {
552
- if (ke = !0, e) {
553
- const { width: T, height: w } = e.getBoundingClientRect(), $ = Math.round(T), G = Math.round(w);
554
- $ > 0 && G > 0 && (M === 0 || S === 0 || $ !== M || G !== S ? (Se($, G), !h && V && J()) : f && C && m.rootId && (f.needsUpdate = !0, J(), P().catch(console.warn)));
552
+ o = Math.round(t.contentRect.width), l = Math.round(t.contentRect.height);
553
+ o === 0 || l === 0 || Ne(o, l);
554
+ }, An = (s) => {
555
+ const t = s[0];
556
+ if (!t) return;
557
+ const o = X;
558
+ X = t.isIntersecting;
559
+ const l = e?.getBoundingClientRect(), f = te;
560
+ if (te = X && !!l && l.width > 0 && l.height > 0, X && !o) {
561
+ if (Ae = !0, e) {
562
+ const { width: b, height: g } = e.getBoundingClientRect(), w = Math.round(b), M = Math.round(g);
563
+ w > 0 && M > 0 && (z === 0 || D === 0 || w !== z || M !== D ? (Ne(w, M), !f && te && he()) : p && B && h.rootId && (p.needsUpdate = !0, he(), re().catch(console.warn)));
555
564
  }
556
- I && xe();
557
- } else !O && l && De();
558
- }, ln = (c, i) => {
559
- if (c.size !== i.size) return !1;
560
- for (const l of c) if (!i.has(l)) return !1;
565
+ ae && je();
566
+ } else !X && o && Qe();
567
+ }, $n = (s, t) => {
568
+ if (s.size !== t.size) return !1;
569
+ for (const o of s) if (!t.has(o)) return !1;
561
570
  return !0;
562
- }, cn = (c) => {
563
- const i = On(c);
564
- return re.add(i), i;
565
- }, Le = () => {
566
- Me.forEach((c) => {
571
+ }, Xe = (s) => {
572
+ Be++;
573
+ const t = hn(s);
574
+ return Te.add(t), t;
575
+ }, rn = () => {
576
+ Ge.forEach((s) => {
567
577
  try {
568
- c?.renderTarget?.dispose && c.renderTarget.dispose();
578
+ s?.renderTarget?.dispose && s.renderTarget.dispose();
569
579
  } catch {
570
580
  }
571
- }), Me.clear();
581
+ }), Ge.clear();
572
582
  };
573
- let te = !1;
574
- const J = () => {
575
- if (!(!m.rootId || !f || de) && m.nodes.get(m.rootId)) {
576
- if (M === 0 || S === 0) {
577
- te || (te = !0, requestAnimationFrame(() => {
578
- te = !1, M > 0 && S > 0 && J();
579
- }));
580
- return;
583
+ let ve = !1;
584
+ const he = () => {
585
+ if (!h.rootId || !p || De || !h.nodes.get(h.rootId)) return;
586
+ if (z === 0 || D === 0) {
587
+ ve || (ve = !0, requestAnimationFrame(() => {
588
+ ve = !1, z > 0 && D > 0 && he();
589
+ }));
590
+ return;
591
+ }
592
+ De = !0;
593
+ const s = performance.now();
594
+ console.log("[Shaders Perf] Starting updateMaterial()");
595
+ try {
596
+ const t = performance.now();
597
+ Ge = new Set(Te), Te.clear(), console.log(`[Shaders Perf] Texture management: ${(performance.now() - t).toFixed(2)}ms`);
598
+ const o = /* @__PURE__ */ new Set(), l = performance.now();
599
+ nn.clear(), h.nodes.forEach((g, w) => {
600
+ (g.requiresRTT || g.transformRTTActive) && nn.add(w);
601
+ }), console.log(`[Shaders Perf] RTT tracking rebuild: ${(performance.now() - l).toFixed(2)}ms (${h.nodes.size} nodes)`), Be = 0;
602
+ const f = performance.now(), b = J(h.rootId, /* @__PURE__ */ new Set(), o);
603
+ if (console.log(`[Shaders Perf] composeNodeTree: ${(performance.now() - f).toFixed(2)}ms (RTT ops: ${Be})`), b && p) {
604
+ const g = !$n(en, o), w = p.fragmentNode !== b;
605
+ if (g || Ae || w) {
606
+ console.log(`[Shaders Perf] Recompilation needed: compositionChanged=${g}, nodeChanged=${w}, needsRefresh=${Ae}`);
607
+ const M = performance.now();
608
+ rn(), console.log(`[Shaders Perf] Texture disposal: ${(performance.now() - M).toFixed(2)}ms`);
609
+ const F = performance.now();
610
+ try {
611
+ p.dispose(), n.renderTarget && n.renderTarget.dispose();
612
+ } catch {
613
+ }
614
+ console.log(`[Shaders Perf] Material disposal: ${(performance.now() - F).toFixed(2)}ms`);
615
+ const y = performance.now(), u = new dn({ transparent: !0 });
616
+ u.fragmentNode = b, u.needsUpdate = !0, console.log(`[Shaders Perf] Material creation: ${(performance.now() - y).toFixed(2)}ms`), m.material = u, p = u, Ae = !1, en = o;
617
+ } else console.log("[Shaders Perf] No recompilation needed (composition unchanged)");
581
618
  }
582
- de = !0;
619
+ console.log(`[Shaders Perf] TOTAL updateMaterial: ${(performance.now() - s).toFixed(2)}ms`), console.log("========================================");
620
+ } catch (t) {
621
+ console.error("Error composing shader tree:", t), console.log(`[Shaders Perf] FAILED after ${(performance.now() - s).toFixed(2)}ms`);
622
+ } finally {
623
+ De = !1;
624
+ }
625
+ X && re().catch(console.warn);
626
+ }, Q = (s) => {
627
+ const t = d.get(s);
628
+ if (!t) return [];
629
+ const o = [];
630
+ for (const l of t) {
631
+ const f = h.nodes.get(l);
632
+ f && o.push(f);
633
+ }
634
+ return o;
635
+ }, zn = (s) => {
636
+ for (const [t, o] of h.nodes.entries()) if (o.metadata.id === s) return t;
637
+ return null;
638
+ }, se = (s, t, o, l) => {
639
+ if (!t.metadata.mask?.source) return s;
640
+ const f = t.metadata.mask.source, b = zn(f);
641
+ if (!b) return s;
642
+ if (l.has(b))
643
+ return console.error("Uh oh, looks like you've got a circular dependency in your shader masks."), s;
644
+ const g = new Set(l);
645
+ return g.add(o), Ot(s, J(b, g), t.metadata.mask.type || "alpha");
646
+ }, le = (s, t) => {
647
+ if (!t.metadata.transform || !t.transformUniforms || !fe(t.metadata.transform) && !t.transformRTTActive) return s;
648
+ const o = Xe(s), l = Ue(Ce, t.transformUniforms.offsetX, t.transformUniforms.offsetY, t.transformUniforms.rotation, t.transformUniforms.scale, t.transformUniforms.anchorX, t.transformUniforms.anchorY, t.transformUniforms.aspectRatio);
649
+ return ye(l, o.sample(l), o, t.transformUniforms.edges);
650
+ }, W = (s) => !!s.uvTransformFunc && s.requiresChild && s.metadata.blendMode === "normal" && (s.metadata.opacity === void 0 || s.metadata.opacity === 1) && s.metadata.visible !== !1 && !s.metadata.mask?.source && !(s.transformUniforms && s.metadata.transform && fe(s.metadata.transform)), Ye = (s) => {
651
+ const t = [];
652
+ let o = s;
653
+ for (; o; ) {
654
+ const l = h.nodes.get(o);
655
+ if (!l || !W(l)) break;
656
+ t.push(l);
657
+ const f = Q(l.id);
658
+ if (f.length !== 1) break;
659
+ const b = f[0];
660
+ if (W(b)) o = b.id;
661
+ else break;
662
+ }
663
+ return t;
664
+ }, Dn = (s) => {
665
+ if (s.length === 0) return null;
666
+ const t = s[s.length - 1], o = Q(t.id);
667
+ return o.length === 0 ? null : o.length === 1 ? o[0] : null;
668
+ }, _e = (s) => {
669
+ if (!s.uvTransformFunc || !W(s)) return !1;
670
+ const t = Q(s.id);
671
+ if (t.length !== 1) return !1;
672
+ const o = t[0];
673
+ return o.acceptsUVContext && !o.requiresChild ? !0 : o.uvTransformFunc && W(o) ? _e(o) : !1;
674
+ }, Ie = (s, t, o) => {
675
+ const l = [];
676
+ let f = s;
677
+ for (; f; ) {
678
+ const v = h.nodes.get(f);
679
+ if (!v) break;
680
+ if (l.length >= 2)
681
+ return console.log(`[Shaders Perf] UV chain depth limit reached (${l.length}), falling back to RTT`), J(s, t, o, !0);
682
+ if (l.push(v), o && o.add(v.id), v.acceptsUVContext && !v.requiresChild) break;
683
+ const c = Q(f);
684
+ if (c.length !== 1) break;
685
+ f = c[0].id;
686
+ }
687
+ if (l.length === 0) return x(0, 0, 0, 0);
688
+ const b = l[l.length - 1];
689
+ let g = Ce;
690
+ for (let v = 0; v < l.length; v++) {
691
+ const c = l[v];
692
+ c.uvTransformFunc && (g = c.uvTransformFunc({
693
+ uv: g,
694
+ uniforms: c.uniforms,
695
+ viewportSize: we
696
+ })), c.transformUniforms && c.metadata.transform && fe(c.metadata.transform) && (g = Ue(g, c.transformUniforms.offsetX, c.transformUniforms.offsetY, c.transformUniforms.rotation, c.transformUniforms.scale, c.transformUniforms.anchorX, c.transformUniforms.anchorY, c.transformUniforms.aspectRatio), c.transformUniforms.edges && (g = ce(g, c.transformUniforms.edges)), c.transformRTTActive = !0);
697
+ }
698
+ for (let v = 0; v < l.length - 1; v++) {
699
+ const c = l[v];
700
+ if (!c.requiresChild) continue;
701
+ const $ = (E) => {
702
+ c.cleanupCallbacks.push(E);
703
+ }, P = (E) => {
704
+ c.beforeRenderCallbacks.push(E);
705
+ }, T = (E) => {
706
+ c.afterRenderCallbacks.push(E);
707
+ }, U = (E) => {
708
+ c.resizeCallbacks.push(E);
709
+ };
710
+ c.cleanupCallbacks.forEach((E) => {
711
+ try {
712
+ E();
713
+ } catch (j) {
714
+ console.error("Error in cleanup callback:", j);
715
+ }
716
+ }), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], c.fragmentNodeFunc({
717
+ uniforms: c.uniforms ?? {},
718
+ childNode: void 0,
719
+ uvContext: void 0,
720
+ onCleanup: $,
721
+ onBeforeRender: P,
722
+ onAfterRender: T,
723
+ onResize: U,
724
+ canvas: e,
725
+ dimensions: {
726
+ width: z,
727
+ height: D
728
+ },
729
+ renderer: n
730
+ });
731
+ }
732
+ const w = (v) => {
733
+ b.cleanupCallbacks.push(v);
734
+ }, M = (v) => {
735
+ b.beforeRenderCallbacks.push(v);
736
+ }, F = (v) => {
737
+ b.afterRenderCallbacks.push(v);
738
+ }, y = (v) => {
739
+ b.resizeCallbacks.push(v);
740
+ };
741
+ b.cleanupCallbacks.forEach((v) => {
583
742
  try {
584
- Me = new Set(re), re.clear();
585
- const c = /* @__PURE__ */ new Set();
586
- Ce.clear(), m.nodes.forEach((l, a) => {
587
- (l.requiresRTT || l.transformRTTActive) && Ce.add(a);
743
+ v();
744
+ } catch (c) {
745
+ console.error("Error in cleanup callback:", c);
746
+ }
747
+ }), b.cleanupCallbacks = [], b.beforeRenderCallbacks = [], b.afterRenderCallbacks = [], b.resizeCallbacks = [];
748
+ const u = b.fragmentNodeFunc({
749
+ uniforms: b.uniforms ?? {},
750
+ childNode: void 0,
751
+ uvContext: g,
752
+ onCleanup: w,
753
+ onBeforeRender: M,
754
+ onAfterRender: F,
755
+ onResize: y,
756
+ canvas: e,
757
+ dimensions: {
758
+ width: z,
759
+ height: D
760
+ },
761
+ renderer: n
762
+ });
763
+ for (const v of l) if (v.uniforms.edges?.uniform) return ye(g, u, null, v.uniforms.edges.uniform);
764
+ return u;
765
+ }, He = (s, t, o) => {
766
+ if (s.length === 0) return x(0, 0, 0, 0);
767
+ const l = Dn(s);
768
+ let f;
769
+ if (l) f = J(l.id, t, o);
770
+ else return x(0, 0, 0, 0);
771
+ const b = Xe(f);
772
+ let g = Ce;
773
+ for (let F = s.length - 1; F >= 0; F--) {
774
+ const y = s[F];
775
+ y.uvTransformFunc && (g = y.uvTransformFunc({
776
+ uv: g,
777
+ uniforms: y.uniforms,
778
+ viewportSize: we
779
+ }), y.uniforms.edges?.uniform && (g = ce(g, y.uniforms.edges.uniform))), o && o.add(y.id);
780
+ }
781
+ const w = b.sample(g), M = s[0];
782
+ return M.uniforms.edges?.uniform ? ye(g, w, b, M.uniforms.edges.uniform) : w;
783
+ }, tn = (s, t) => {
784
+ const o = [];
785
+ for (let l = t; l < s.length; l++) {
786
+ const f = s[l];
787
+ if (!W(f) || Q(f.id).length > 0) break;
788
+ o.push(f);
789
+ }
790
+ return o;
791
+ }, on = (s, t, o) => {
792
+ if (s.length === 0) return t;
793
+ const l = Xe(t);
794
+ let f = Ce;
795
+ for (let w = s.length - 1; w >= 0; w--) {
796
+ const M = s[w];
797
+ M.uvTransformFunc && (f = M.uvTransformFunc({
798
+ uv: f,
799
+ uniforms: M.uniforms,
800
+ viewportSize: we
801
+ }), M.uniforms.edges?.uniform && (f = ce(f, M.uniforms.edges.uniform))), o && o.add(M.id);
802
+ }
803
+ const b = l.sample(f), g = s[s.length - 1];
804
+ return g.uniforms.edges?.uniform ? ye(f, b, l, g.uniforms.edges.uniform) : b;
805
+ }, sn = (s) => {
806
+ const t = [], o = [];
807
+ let l = !1;
808
+ for (let g = 0; g < s.length; g++) {
809
+ const w = s[g], M = Q(w.id).length > 0;
810
+ w.acceptsUVContext && !w.requiresChild && t.push(g), W(w) && !M && (o.push(g), t.length > 0 && (l = !0));
811
+ }
812
+ if (t.length === 0 || o.length === 0 || !l) return !1;
813
+ const f = Math.min(...t), b = Math.max(...o);
814
+ for (let g = f + 1; g < b; g++) {
815
+ const w = s[g];
816
+ if (w.requiresRTT && !W(w) && !(w.acceptsUVContext && !w.requiresChild)) return !1;
817
+ }
818
+ return o.length > 2 ? (console.log(`[Shaders Perf] Too many distortions in sibling group (${o.length}), skipping UV propagation`), !1) : !0;
819
+ }, an = (s, t, o) => {
820
+ const l = performance.now();
821
+ console.log(`[Shaders Perf] composeSiblingsWithUVContext (${s.length} children)`);
822
+ const f = performance.now(), b = [], g = [];
823
+ s.forEach((y, u) => {
824
+ const v = Q(y.id).length > 0;
825
+ W(y) && !v ? g.push({
826
+ node: y,
827
+ index: u
828
+ }) : y.acceptsUVContext && !y.requiresChild && !v && b.push({
829
+ node: y,
830
+ index: u
831
+ });
832
+ }), console.log(`[Shaders Perf] Categorization: ${(performance.now() - f).toFixed(2)}ms (${b.length} gens, ${g.length} dists)`);
833
+ const w = performance.now();
834
+ for (const y of g) {
835
+ const u = y.node;
836
+ u.cleanupCallbacks.forEach((T) => {
837
+ try {
838
+ T();
839
+ } catch (U) {
840
+ console.error("Cleanup error:", U);
841
+ }
842
+ }), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
843
+ const v = (T) => u.cleanupCallbacks.push(T), c = (T) => u.beforeRenderCallbacks.push(T), $ = (T) => u.afterRenderCallbacks.push(T), P = (T) => u.resizeCallbacks.push(T);
844
+ u.fragmentNodeFunc({
845
+ uniforms: u.uniforms ?? {},
846
+ childNode: void 0,
847
+ uvContext: void 0,
848
+ onCleanup: v,
849
+ onBeforeRender: c,
850
+ onAfterRender: $,
851
+ onResize: P,
852
+ canvas: e,
853
+ dimensions: {
854
+ width: z,
855
+ height: D
856
+ },
857
+ renderer: n
858
+ }), o && o.add(u.id);
859
+ }
860
+ console.log(`[Shaders Perf] Callback registration: ${(performance.now() - w).toFixed(2)}ms (${g.length} distortions)`);
861
+ const M = performance.now();
862
+ let F;
863
+ for (let y = 0; y < s.length; y++) {
864
+ const u = s[y];
865
+ if (u.metadata.visible === !1) continue;
866
+ const v = u.metadata.opacity ?? 1;
867
+ u.opacityUniform.value = v, o && o.add(u.id);
868
+ const c = Q(u.id).length > 0;
869
+ let $;
870
+ const P = b.find((T) => T.index === y);
871
+ if (P) {
872
+ const T = g.filter((_) => _.index > P.index).sort((_, q) => _.index - q.index).map((_) => _.node);
873
+ let U = Ce;
874
+ for (let _ = T.length - 1; _ >= 0; _--) {
875
+ const q = T[_];
876
+ q.uvTransformFunc && (U = q.uvTransformFunc({
877
+ uv: U,
878
+ uniforms: q.uniforms,
879
+ viewportSize: we
880
+ })), q.transformUniforms && q.metadata.transform && fe(q.metadata.transform) && (U = Ue(U, q.transformUniforms.offsetX, q.transformUniforms.offsetY, q.transformUniforms.rotation, q.transformUniforms.scale, q.transformUniforms.anchorX, q.transformUniforms.anchorY, q.transformUniforms.aspectRatio), q.transformUniforms.edges && (U = ce(U, q.transformUniforms.edges)), q.transformRTTActive = !0), q.uniforms.edges?.uniform && (U = ce(U, q.uniforms.edges.uniform));
881
+ }
882
+ P.node.transformUniforms && P.node.metadata.transform && fe(P.node.metadata.transform) && (U = Ue(U, P.node.transformUniforms.offsetX, P.node.transformUniforms.offsetY, P.node.transformUniforms.rotation, P.node.transformUniforms.scale, P.node.transformUniforms.anchorX, P.node.transformUniforms.anchorY, P.node.transformUniforms.aspectRatio), P.node.transformUniforms.edges && (U = ce(U, P.node.transformUniforms.edges)), P.node.transformRTTActive = !0), u.cleanupCallbacks.forEach((_) => {
883
+ try {
884
+ _();
885
+ } catch (q) {
886
+ console.error("Cleanup error:", q);
887
+ }
888
+ }), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
889
+ const E = (_) => u.cleanupCallbacks.push(_), j = (_) => u.beforeRenderCallbacks.push(_), O = (_) => u.afterRenderCallbacks.push(_), G = (_) => u.resizeCallbacks.push(_);
890
+ let L = u.fragmentNodeFunc({
891
+ uniforms: u.uniforms ?? {},
892
+ childNode: void 0,
893
+ uvContext: U,
894
+ onCleanup: E,
895
+ onBeforeRender: j,
896
+ onAfterRender: O,
897
+ onResize: G,
898
+ canvas: e,
899
+ dimensions: {
900
+ width: z,
901
+ height: D
902
+ },
903
+ renderer: n
588
904
  });
589
- const i = ve(m.rootId, /* @__PURE__ */ new Set(), c);
590
- if (i && f) {
591
- const l = !ln(Ge, c), a = f.fragmentNode !== i;
592
- if (l || ke || a) {
593
- Le();
594
- try {
595
- f.dispose(), n.renderTarget && n.renderTarget.dispose();
596
- } catch {
905
+ if (T.length > 0) {
906
+ const _ = T[0];
907
+ _.uniforms.edges?.uniform && (L = ye(U, L, null, _.uniforms.edges.uniform));
908
+ }
909
+ $ = se(L, u, u.id, t);
910
+ } else {
911
+ if (g.find((T) => T.index === y)) continue;
912
+ if (c) {
913
+ if (_e(u)) $ = Ie(u.id, t, o);
914
+ else if (W(u)) {
915
+ const U = Ye(u.id);
916
+ U.length > 1 ? $ = He(U, t, o) : $ = J(u.id, t, o);
917
+ } else $ = J(u.id, t, o);
918
+ const T = g.filter((U) => U.index > y).sort((U, E) => U.index - E.index).map((U) => U.node);
919
+ if (T.length > 0) {
920
+ const U = hn($);
921
+ let E = Ce;
922
+ for (let j = T.length - 1; j >= 0; j--) {
923
+ const O = T[j];
924
+ O.uvTransformFunc && (E = O.uvTransformFunc({
925
+ uv: E,
926
+ uniforms: O.uniforms,
927
+ viewportSize: we
928
+ })), O.transformUniforms && O.metadata.transform && fe(O.metadata.transform) && (E = Ue(E, O.transformUniforms.offsetX, O.transformUniforms.offsetY, O.transformUniforms.rotation, O.transformUniforms.scale, O.transformUniforms.anchorX, O.transformUniforms.anchorY, O.transformUniforms.aspectRatio), O.transformUniforms.edges && (E = ce(E, O.transformUniforms.edges)), O.transformRTTActive = !0), O.uniforms.edges?.uniform && (E = ce(E, O.uniforms.edges.uniform));
597
929
  }
598
- const h = new He({ transparent: !0 });
599
- h.fragmentNode = i, h.needsUpdate = !0, s.material = h, f = h, ke = !1, Ge = c;
930
+ $ = U.sample(E);
600
931
  }
932
+ } else {
933
+ u.cleanupCallbacks.forEach((G) => {
934
+ try {
935
+ G();
936
+ } catch (L) {
937
+ console.error("Cleanup error:", L);
938
+ }
939
+ }), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
940
+ const T = (G) => u.cleanupCallbacks.push(G), U = (G) => u.beforeRenderCallbacks.push(G), E = (G) => u.afterRenderCallbacks.push(G), j = (G) => u.resizeCallbacks.push(G);
941
+ let O = F;
942
+ u.requiresRTT && F !== void 0 && (O = K(x(0, 0, 0, 0), F, "normal", 1)), $ = se(le(u.fragmentNodeFunc({
943
+ uniforms: u.uniforms ?? {},
944
+ childNode: O,
945
+ onCleanup: T,
946
+ onBeforeRender: U,
947
+ onAfterRender: E,
948
+ onResize: j,
949
+ canvas: e,
950
+ dimensions: {
951
+ width: z,
952
+ height: D
953
+ },
954
+ renderer: n
955
+ }), u), u, u.id, t);
601
956
  }
602
- } catch (c) {
603
- console.error("Error composing shader tree:", c);
604
- } finally {
605
- de = !1;
606
957
  }
607
- O && P().catch(console.warn);
958
+ u.requiresChild && u.metadata.blendMode === "normal" && !c ? F = K(x(0, 0, 0, 0), $, "normal", u.opacityUniform) : F === void 0 ? F = K(x(1, 1, 1, 0), $, u.metadata.blendMode, u.opacityUniform) : F = K(F, $, u.metadata.blendMode, u.opacityUniform);
608
959
  }
609
- }, ye = (c) => {
610
- const i = u.get(c);
611
- if (!i) return [];
612
- const l = [];
613
- for (const a of i) {
614
- const h = m.nodes.get(a);
615
- h && l.push(h);
616
- }
617
- return l;
618
- }, un = (c) => {
619
- for (const [i, l] of m.nodes.entries()) if (l.metadata.id === c) return i;
620
- return null;
621
- }, ie = (c, i, l, a) => {
622
- if (!i.metadata.mask?.source) return c;
623
- const h = i.metadata.mask.source, T = un(h);
624
- if (!T) return c;
625
- if (a.has(T))
626
- return console.error("Uh oh, looks like you've got a circular dependency in your shader masks."), c;
627
- const w = new Set(a);
628
- return w.add(l), hr(c, ve(T, w), i.metadata.mask.type || "alpha");
629
- }, ae = (c, i) => {
630
- if (!i.metadata.transform || !i.transformUniforms || !_e(i.metadata.transform) && !i.transformRTTActive) return c;
631
- const l = cn(c), a = Tr(zn, i.transformUniforms.offsetX, i.transformUniforms.offsetY, i.transformUniforms.rotation, i.transformUniforms.scale, i.transformUniforms.anchorX, i.transformUniforms.anchorY, i.transformUniforms.aspectRatio);
632
- return Nn(a, l.sample(a), l, i.transformUniforms.edges);
633
- }, ve = (c, i = /* @__PURE__ */ new Set(), l) => {
634
- if (M === 0 || S === 0) return v(0, 0, 0, 0);
635
- const a = m.nodes.get(c);
636
- if (!a) return v(0, 0, 0, 0);
637
- const h = (D) => {
638
- a.cleanupCallbacks.push(D);
639
- }, T = (D) => {
640
- a.beforeRenderCallbacks.push(D);
641
- }, w = (D) => {
642
- a.afterRenderCallbacks.push(D);
643
- }, $ = (D) => {
644
- a.resizeCallbacks.push(D);
645
- }, G = ye(c);
646
- if (G.length === 0)
647
- return a.requiresRTT && !V ? v(0, 0, 0, 0) : (a.cleanupCallbacks.forEach((D) => {
960
+ return console.log(`[Shaders Perf] Node processing: ${(performance.now() - M).toFixed(2)}ms`), console.log(`[Shaders Perf] TOTAL composeSiblingsWithUVContext: ${(performance.now() - l).toFixed(2)}ms`), F ?? x(0, 0, 0, 0);
961
+ }, J = (s, t = /* @__PURE__ */ new Set(), o, l = !1) => {
962
+ if (z === 0 || D === 0) return x(0, 0, 0, 0);
963
+ const f = h.nodes.get(s);
964
+ if (!f) return x(0, 0, 0, 0);
965
+ const b = (y) => {
966
+ f.cleanupCallbacks.push(y);
967
+ }, g = (y) => {
968
+ f.beforeRenderCallbacks.push(y);
969
+ }, w = (y) => {
970
+ f.afterRenderCallbacks.push(y);
971
+ }, M = (y) => {
972
+ f.resizeCallbacks.push(y);
973
+ }, F = Q(s);
974
+ if (F.length === 0)
975
+ return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((y) => {
648
976
  try {
649
- D();
650
- } catch (k) {
651
- console.error("Error in cleanup callback:", k);
977
+ y();
978
+ } catch (u) {
979
+ console.error("Error in cleanup callback:", u);
652
980
  }
653
- }), a.cleanupCallbacks = [], a.beforeRenderCallbacks = [], a.afterRenderCallbacks = [], a.resizeCallbacks = [], ie(ae(a.fragmentNodeFunc({
654
- uniforms: a.uniforms ?? {},
981
+ }), f.cleanupCallbacks = [], f.beforeRenderCallbacks = [], f.afterRenderCallbacks = [], f.resizeCallbacks = [], se(le(f.fragmentNodeFunc({
982
+ uniforms: f.uniforms ?? {},
655
983
  childNode: void 0,
656
- onCleanup: h,
657
- onBeforeRender: T,
984
+ onCleanup: b,
985
+ onBeforeRender: g,
658
986
  onAfterRender: w,
659
- onResize: $,
987
+ onResize: M,
660
988
  canvas: e,
661
989
  dimensions: {
662
- width: M,
663
- height: S
990
+ width: z,
991
+ height: D
664
992
  },
665
993
  renderer: n
666
- }), a), a, c, i));
994
+ }), f), f, s, t));
667
995
  {
668
- const D = [...G].sort((k, d) => k.metadata.renderOrder - d.metadata.renderOrder);
669
- if (a.parentId === null) {
670
- let k;
671
- for (const d of D) {
672
- let x;
673
- if (d.metadata.opacity === void 0 ? (x = 1, d.opacityUniform.value = x) : (x = d.metadata.opacity, d.opacityUniform.value = x), d.metadata.visible === !1) continue;
674
- l && l.add(d.id);
675
- const K = ye(d.id).length > 0;
676
- let z;
677
- if (K) z = ve(d.id, i, l);
678
- else if (d.requiresRTT && !V) z = v(0, 0, 0, 0);
996
+ const y = [...F].sort((u, v) => u.metadata.renderOrder - v.metadata.renderOrder);
997
+ if (f.parentId === null) {
998
+ if (!l && sn(y)) return se(le(an(y, t, o), f), f, s, t);
999
+ let u;
1000
+ for (let v = 0; v < y.length; v++) {
1001
+ const c = y[v];
1002
+ let $;
1003
+ if (c.metadata.opacity === void 0 ? ($ = 1, c.opacityUniform.value = $) : ($ = c.metadata.opacity, c.opacityUniform.value = $), c.metadata.visible === !1) continue;
1004
+ o && o.add(c.id);
1005
+ const P = Q(c.id).length > 0;
1006
+ let T;
1007
+ if (P) if (l) T = J(c.id, t, o, !0);
1008
+ else if (_e(c)) T = Ie(c.id, t, o);
1009
+ else if (W(c)) {
1010
+ const U = Ye(c.id);
1011
+ U.length > 1 ? T = He(U, t, o) : T = J(c.id, t, o);
1012
+ } else T = J(c.id, t, o);
679
1013
  else {
680
- const ze = (U) => {
681
- d.cleanupCallbacks.push(U);
682
- }, $e = (U) => {
683
- d.beforeRenderCallbacks.push(U);
684
- }, Ue = (U) => {
685
- d.afterRenderCallbacks.push(U);
686
- }, Ee = (U) => {
687
- d.resizeCallbacks.push(U);
688
- };
689
- let se = k;
690
- d.requiresRTT && k !== void 0 && (se = X(v(0, 0, 0, 0), k, "normal", 1)), d.cleanupCallbacks.forEach((U) => {
691
- try {
692
- U();
693
- } catch (kn) {
694
- console.error("Error in cleanup callback:", kn);
1014
+ if (W(c) && c.requiresChild && u !== void 0) {
1015
+ const U = tn(y, v);
1016
+ if (U.length > 1) {
1017
+ T = on(U, u, o), v += U.length - 1, u = T;
1018
+ continue;
695
1019
  }
696
- }), d.cleanupCallbacks = [], d.beforeRenderCallbacks = [], d.afterRenderCallbacks = [], d.resizeCallbacks = [], z = ie(ae(d.fragmentNodeFunc({
697
- uniforms: d.uniforms ?? {},
698
- childNode: se,
699
- onCleanup: ze,
700
- onBeforeRender: $e,
701
- onAfterRender: Ue,
702
- onResize: Ee,
703
- canvas: e,
704
- dimensions: {
705
- width: M,
706
- height: S
707
- },
708
- renderer: n
709
- }), d), d, d.id, i);
1020
+ }
1021
+ if (c.requiresRTT && !te) T = x(0, 0, 0, 0);
1022
+ else {
1023
+ const U = (L) => {
1024
+ c.cleanupCallbacks.push(L);
1025
+ }, E = (L) => {
1026
+ c.beforeRenderCallbacks.push(L);
1027
+ }, j = (L) => {
1028
+ c.afterRenderCallbacks.push(L);
1029
+ }, O = (L) => {
1030
+ c.resizeCallbacks.push(L);
1031
+ };
1032
+ let G = u;
1033
+ c.requiresRTT && u !== void 0 && (G = K(x(0, 0, 0, 0), u, "normal", 1)), c.cleanupCallbacks.forEach((L) => {
1034
+ try {
1035
+ L();
1036
+ } catch (_) {
1037
+ console.error("Error in cleanup callback:", _);
1038
+ }
1039
+ }), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], T = se(le(c.fragmentNodeFunc({
1040
+ uniforms: c.uniforms ?? {},
1041
+ childNode: G,
1042
+ onCleanup: U,
1043
+ onBeforeRender: E,
1044
+ onAfterRender: j,
1045
+ onResize: O,
1046
+ canvas: e,
1047
+ dimensions: {
1048
+ width: z,
1049
+ height: D
1050
+ },
1051
+ renderer: n
1052
+ }), c), c, c.id, t);
1053
+ }
710
1054
  }
711
- d.requiresChild && d.metadata.blendMode === "normal" && !K ? k = X(v(0, 0, 0, 0), z, "normal", d.opacityUniform) : k === void 0 ? a.requiresRTT || x !== 1 ? k = X(v(1, 1, 1, 0), z, d.metadata.blendMode, d.opacityUniform) : k = z : k = X(k, z, d.metadata.blendMode, d.opacityUniform);
1055
+ c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT || $ !== 1 ? u = K(x(1, 1, 1, 0), T, c.metadata.blendMode, c.opacityUniform) : u = T : u = K(u, T, c.metadata.blendMode, c.opacityUniform);
712
1056
  }
713
- return a.requiresRTT && !V ? v(0, 0, 0, 0) : (a.cleanupCallbacks.forEach((d) => {
1057
+ return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((v) => {
714
1058
  try {
715
- d();
716
- } catch (x) {
717
- console.error("Error in cleanup callback:", x);
1059
+ v();
1060
+ } catch (c) {
1061
+ console.error("Error in cleanup callback:", c);
718
1062
  }
719
- }), a.cleanupCallbacks = [], a.beforeRenderCallbacks = [], a.afterRenderCallbacks = [], a.resizeCallbacks = [], ie(ae(a.fragmentNodeFunc({
720
- uniforms: a.uniforms ?? {},
721
- childNode: k,
722
- onCleanup: h,
723
- onBeforeRender: T,
1063
+ }), f.cleanupCallbacks = [], f.beforeRenderCallbacks = [], f.afterRenderCallbacks = [], f.resizeCallbacks = [], se(le(f.fragmentNodeFunc({
1064
+ uniforms: f.uniforms ?? {},
1065
+ childNode: u,
1066
+ onCleanup: b,
1067
+ onBeforeRender: g,
724
1068
  onAfterRender: w,
725
- onResize: $,
1069
+ onResize: M,
726
1070
  canvas: e,
727
1071
  dimensions: {
728
- width: M,
729
- height: S
1072
+ width: z,
1073
+ height: D
730
1074
  },
731
1075
  renderer: n
732
- }), a), a, c, i));
1076
+ }), f), f, s, t));
733
1077
  } else {
734
- let k;
735
- for (const d of D) {
736
- let x;
737
- if (d.metadata.opacity === void 0 ? (x = 1, d.opacityUniform.value = x) : (x = d.metadata.opacity, d.opacityUniform.value = x), d.metadata.visible === !1) continue;
738
- l && l.add(d.id);
739
- const K = ye(d.id).length > 0;
740
- let z;
741
- if (K) z = ve(d.id, i, l);
742
- else if (d.requiresRTT && !V) z = v(0, 0, 0, 0);
1078
+ if (!l && sn(y)) {
1079
+ const v = an(y, t, o);
1080
+ return se(le(f.fragmentNodeFunc({
1081
+ uniforms: f.uniforms ?? {},
1082
+ childNode: v,
1083
+ onCleanup: b,
1084
+ onBeforeRender: g,
1085
+ onAfterRender: w,
1086
+ onResize: M,
1087
+ canvas: e,
1088
+ dimensions: {
1089
+ width: z,
1090
+ height: D
1091
+ },
1092
+ renderer: n
1093
+ }), f), f, s, t);
1094
+ }
1095
+ let u;
1096
+ for (let v = 0; v < y.length; v++) {
1097
+ const c = y[v];
1098
+ let $;
1099
+ if (c.metadata.opacity === void 0 ? ($ = 1, c.opacityUniform.value = $) : ($ = c.metadata.opacity, c.opacityUniform.value = $), c.metadata.visible === !1) continue;
1100
+ o && o.add(c.id);
1101
+ const P = Q(c.id).length > 0;
1102
+ let T;
1103
+ if (P) if (l) T = J(c.id, t, o, !0);
1104
+ else if (_e(c)) T = Ie(c.id, t, o);
1105
+ else if (W(c)) {
1106
+ const U = Ye(c.id);
1107
+ U.length > 1 ? T = He(U, t, o) : T = J(c.id, t, o);
1108
+ } else T = J(c.id, t, o);
743
1109
  else {
744
- const ze = (U) => {
745
- d.cleanupCallbacks.push(U);
746
- }, $e = (U) => {
747
- d.beforeRenderCallbacks.push(U);
748
- }, Ue = (U) => {
749
- d.afterRenderCallbacks.push(U);
750
- }, Ee = (U) => {
751
- d.resizeCallbacks.push(U);
752
- };
753
- let se = k;
754
- d.requiresRTT && k !== void 0 && (se = X(v(0, 0, 0, 0), k, "normal", 1)), d.cleanupCallbacks = [], d.beforeRenderCallbacks = [], d.afterRenderCallbacks = [], d.resizeCallbacks = [], z = ie(ae(d.fragmentNodeFunc({
755
- uniforms: d.uniforms ?? {},
756
- childNode: se,
757
- onCleanup: ze,
758
- onBeforeRender: $e,
759
- onAfterRender: Ue,
760
- onResize: Ee,
761
- canvas: e,
762
- dimensions: {
763
- width: M,
764
- height: S
765
- },
766
- renderer: n
767
- }), d), d, d.id, i);
1110
+ if (W(c) && c.requiresChild && u !== void 0) {
1111
+ const U = tn(y, v);
1112
+ if (U.length > 1) {
1113
+ T = on(U, u, o), v += U.length - 1, u = T;
1114
+ continue;
1115
+ }
1116
+ }
1117
+ if (c.requiresRTT && !te) T = x(0, 0, 0, 0);
1118
+ else {
1119
+ const U = (L) => {
1120
+ c.cleanupCallbacks.push(L);
1121
+ }, E = (L) => {
1122
+ c.beforeRenderCallbacks.push(L);
1123
+ }, j = (L) => {
1124
+ c.afterRenderCallbacks.push(L);
1125
+ }, O = (L) => {
1126
+ c.resizeCallbacks.push(L);
1127
+ };
1128
+ let G = u;
1129
+ c.requiresRTT && u !== void 0 && (G = K(x(0, 0, 0, 0), u, "normal", 1)), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], T = se(le(c.fragmentNodeFunc({
1130
+ uniforms: c.uniforms ?? {},
1131
+ childNode: G,
1132
+ onCleanup: U,
1133
+ onBeforeRender: E,
1134
+ onAfterRender: j,
1135
+ onResize: O,
1136
+ canvas: e,
1137
+ dimensions: {
1138
+ width: z,
1139
+ height: D
1140
+ },
1141
+ renderer: n
1142
+ }), c), c, c.id, t);
1143
+ }
768
1144
  }
769
- d.requiresChild && d.metadata.blendMode === "normal" && !K ? k = X(v(0, 0, 0, 0), z, "normal", d.opacityUniform) : k === void 0 ? a.requiresRTT || x !== 1 ? k = X(v(1, 1, 1, 0), z, d.metadata.blendMode, d.opacityUniform) : k = z : k = X(k, z, d.metadata.blendMode, d.opacityUniform);
1145
+ c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT || $ !== 1 ? u = K(x(1, 1, 1, 0), T, c.metadata.blendMode, c.opacityUniform) : u = T : u = K(u, T, c.metadata.blendMode, c.opacityUniform);
770
1146
  }
771
- return a.requiresRTT && !V ? v(0, 0, 0, 0) : (a.cleanupCallbacks.forEach((d) => {
1147
+ return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((v) => {
772
1148
  try {
773
- d();
774
- } catch (x) {
775
- console.error("Error in cleanup callback:", x);
1149
+ v();
1150
+ } catch (c) {
1151
+ console.error("Error in cleanup callback:", c);
776
1152
  }
777
- }), a.cleanupCallbacks = [], a.beforeRenderCallbacks = [], a.afterRenderCallbacks = [], a.resizeCallbacks = [], ie(ae(a.fragmentNodeFunc({
778
- uniforms: a.uniforms ?? {},
779
- childNode: k,
780
- onCleanup: h,
781
- onBeforeRender: T,
1153
+ }), f.cleanupCallbacks = [], f.beforeRenderCallbacks = [], f.afterRenderCallbacks = [], f.resizeCallbacks = [], se(le(f.fragmentNodeFunc({
1154
+ uniforms: f.uniforms ?? {},
1155
+ childNode: u,
1156
+ onCleanup: b,
1157
+ onBeforeRender: g,
782
1158
  onAfterRender: w,
783
- onResize: $,
1159
+ onResize: M,
784
1160
  canvas: e,
785
1161
  dimensions: {
786
- width: M,
787
- height: S
1162
+ width: z,
1163
+ height: D
788
1164
  },
789
1165
  renderer: n
790
- }), a), a, c, i));
1166
+ }), f), f, s, t));
791
1167
  }
792
1168
  }
793
- }, Ne = (c, i, l, a, h = {}, T) => {
794
- if (i === null) {
795
- const d = H.findIndex((x) => x.id === c);
796
- if (d !== -1) {
797
- H.splice(d, 1);
1169
+ }, ln = (s, t, o, l, f = {}, b) => {
1170
+ if (t === null) {
1171
+ const u = oe.findIndex((v) => v.id === s);
1172
+ if (u !== -1) {
1173
+ oe.splice(u, 1);
798
1174
  return;
799
1175
  }
800
- Ae(c);
1176
+ We(s);
801
1177
  return;
802
1178
  }
803
- if (!we) {
804
- const d = H.findIndex((x) => x.id === c);
805
- d !== -1 ? H[d] = {
806
- id: c,
807
- fragmentNodeFunc: i,
808
- parentId: l,
809
- metadata: a,
810
- uniforms: h,
811
- componentDefinition: T
812
- } : H.push({
813
- id: c,
814
- fragmentNodeFunc: i,
815
- parentId: l,
816
- metadata: a,
817
- uniforms: h,
818
- componentDefinition: T
1179
+ if (!qe) {
1180
+ const u = oe.findIndex((v) => v.id === s);
1181
+ u !== -1 ? oe[u] = {
1182
+ id: s,
1183
+ fragmentNodeFunc: t,
1184
+ parentId: o,
1185
+ metadata: l,
1186
+ uniforms: f,
1187
+ componentDefinition: b
1188
+ } : oe.push({
1189
+ id: s,
1190
+ fragmentNodeFunc: t,
1191
+ parentId: o,
1192
+ metadata: l,
1193
+ uniforms: f,
1194
+ componentDefinition: b
819
1195
  });
820
1196
  return;
821
1197
  }
822
- let w = 0;
823
- if (l !== null) {
824
- const d = u.get(l);
825
- if (d && d.size > 0) {
826
- let x = 0;
827
- for (const K of d) {
828
- const z = m.nodes.get(K);
829
- z && z.metadata.renderOrder > x && (x = z.metadata.renderOrder);
1198
+ let g = 0;
1199
+ if (o !== null) {
1200
+ const u = d.get(o);
1201
+ if (u && u.size > 0) {
1202
+ let v = 0;
1203
+ for (const c of u) {
1204
+ const $ = h.nodes.get(c);
1205
+ $ && $.metadata.renderOrder > v && (v = $.metadata.renderOrder);
830
1206
  }
831
- w = x + 1;
1207
+ g = v + 1;
832
1208
  }
833
1209
  }
834
- const $ = E(a?.opacity !== void 0 ? a.opacity : 1);
835
- let G;
836
- if (a?.transform) {
837
- const d = M / Math.max(1, S);
838
- G = {
839
- offsetX: E(a.transform.offsetX),
840
- offsetY: E(a.transform.offsetY),
841
- rotation: E(a.transform.rotation),
842
- scale: E(a.transform.scale),
843
- anchorX: E(a.transform.anchorX),
844
- anchorY: E(a.transform.anchorY),
845
- edges: E(a.transform.edges === "stretch" ? 0 : a.transform.edges === "transparent" ? 1 : a.transform.edges === "mirror" ? 2 : 3),
846
- aspectRatio: E(d)
1210
+ const w = N(l?.opacity !== void 0 ? l.opacity : 1);
1211
+ let M;
1212
+ if (l?.transform) {
1213
+ const u = z / Math.max(1, D);
1214
+ M = {
1215
+ offsetX: N(l.transform.offsetX),
1216
+ offsetY: N(l.transform.offsetY),
1217
+ rotation: N(l.transform.rotation),
1218
+ scale: N(l.transform.scale),
1219
+ anchorX: N(l.transform.anchorX),
1220
+ anchorY: N(l.transform.anchorY),
1221
+ edges: N(l.transform.edges === "stretch" ? 0 : l.transform.edges === "transparent" ? 1 : l.transform.edges === "mirror" ? 2 : 3),
1222
+ aspectRatio: N(u)
847
1223
  };
848
1224
  }
849
- const D = {
850
- id: c,
851
- componentName: T?.name || "Unknown",
852
- fragmentNodeFunc: i,
853
- parentId: l,
854
- requiresRTT: T?.requiresRTT || !1,
855
- requiresChild: T?.requiresChild || !1,
856
- opacityUniform: $,
1225
+ const F = {
1226
+ id: s,
1227
+ componentName: b?.name || "Unknown",
1228
+ fragmentNodeFunc: t,
1229
+ parentId: o,
1230
+ requiresRTT: b?.requiresRTT || !1,
1231
+ requiresChild: b?.requiresChild || !1,
1232
+ opacityUniform: w,
857
1233
  metadata: {
858
- blendMode: a?.blendMode || "normal",
859
- opacity: a?.opacity,
860
- visible: a?.visible !== !1,
861
- id: a?.id,
862
- mask: a?.mask,
863
- renderOrder: a?.renderOrder !== void 0 ? a?.renderOrder : w,
864
- transform: a?.transform
1234
+ blendMode: l?.blendMode || "normal",
1235
+ opacity: l?.opacity,
1236
+ visible: l?.visible !== !1,
1237
+ id: l?.id,
1238
+ mask: l?.mask,
1239
+ renderOrder: l?.renderOrder !== void 0 ? l?.renderOrder : g,
1240
+ transform: l?.transform
865
1241
  },
866
- uniforms: h,
1242
+ uniforms: f,
867
1243
  cleanupCallbacks: [],
868
1244
  beforeRenderCallbacks: [],
869
1245
  afterRenderCallbacks: [],
870
1246
  resizeCallbacks: [],
871
- transformUniforms: G,
872
- transformRTTActive: !1
1247
+ transformUniforms: M,
1248
+ transformRTTActive: !1,
1249
+ uvTransformFunc: b?.uvTransformNode,
1250
+ acceptsUVContext: b?.acceptsUVContext || !1
873
1251
  };
874
- m.nodes.set(c, D), l === null && (m.rootId = c);
875
- const k = u.get(l) || /* @__PURE__ */ new Set();
876
- k.add(c), u.set(l, k), f && C && M > 0 && S > 0 ? (pe.includes(c) || pe.push(c), ee === null && (ee = requestAnimationFrame(() => {
877
- ee = null, pe = [], J();
878
- }))) : f && C && (te || (te = !0, requestAnimationFrame(() => {
879
- te = !1, M > 0 && S > 0 && J();
1252
+ h.nodes.set(s, F), o === null && (h.rootId = s);
1253
+ const y = d.get(o) || /* @__PURE__ */ new Set();
1254
+ y.add(s), d.set(o, y), p && B && z > 0 && D > 0 ? (Ee.includes(s) || Ee.push(s), ge === null && (ge = requestAnimationFrame(() => {
1255
+ ge = null, Ee = [], he();
1256
+ }))) : p && B && (ve || (ve = !0, requestAnimationFrame(() => {
1257
+ ve = !1, z > 0 && D > 0 && he();
880
1258
  })));
881
- }, mn = (c, i, l) => {
882
- const a = m.nodes.get(c);
883
- if (!a || !a.uniforms) return;
884
- const h = a.uniforms[i];
885
- if (!(!h || !h.uniform)) {
886
- if (h.transform) {
887
- const { updateUniformValue: T } = (tn(), _n(Rr));
888
- T(h, l);
889
- } else h.uniform.value = l;
890
- O && P();
1259
+ }, Fn = (s, t, o) => {
1260
+ const l = h.nodes.get(s);
1261
+ if (!l || !l.uniforms) return;
1262
+ const f = l.uniforms[t];
1263
+ if (!(!f || !f.uniform)) {
1264
+ if (f.transform) {
1265
+ const { updateUniformValue: b } = (Un(), Wn(qt));
1266
+ b(f, o);
1267
+ } else f.uniform.value = o;
1268
+ X && re();
891
1269
  }
892
- }, fn = (c, i) => {
893
- const l = m.nodes.get(c);
894
- if (!l) return;
895
- let a = !1;
896
- i.blendMode !== void 0 && l.metadata.blendMode !== i.blendMode && (l.metadata.blendMode = i.blendMode, a = !0), i.opacity !== void 0 && l.metadata.opacity !== i.opacity && (l.metadata.opacity = i.opacity, l.opacityUniform.value = i.opacity), i.renderOrder !== void 0 && l.metadata.renderOrder !== i.renderOrder && (l.metadata.renderOrder = i.renderOrder, a = !0);
897
- const h = i.visible !== !1;
898
- if (l.metadata.visible !== h && (l.metadata.visible = h, a = !0), i.id !== void 0 && l.metadata.id !== i.id && (l.metadata.id = i.id, a = !0), i.mask !== void 0 && (l.metadata.mask?.source !== i.mask?.source || l.metadata.mask?.type !== i.mask?.type) && (l.metadata.mask = i.mask, a = !0), i.transform !== void 0) {
899
- const T = l.metadata.transform ? _e(l.metadata.transform) : !1, w = _e(i.transform);
900
- if (l.metadata.transform = i.transform, !l.transformUniforms && i.transform) {
901
- const $ = M / Math.max(1, S);
902
- l.transformUniforms = {
903
- offsetX: E(i.transform.offsetX),
904
- offsetY: E(i.transform.offsetY),
905
- rotation: E(i.transform.rotation),
906
- scale: E(i.transform.scale),
907
- anchorX: E(i.transform.anchorX),
908
- anchorY: E(i.transform.anchorY),
909
- edges: E(i.transform.edges === "stretch" ? 0 : i.transform.edges === "transparent" ? 1 : i.transform.edges === "mirror" ? 2 : 3),
910
- aspectRatio: E($)
1270
+ }, En = (s, t) => {
1271
+ const o = h.nodes.get(s);
1272
+ if (!o) return;
1273
+ let l = !1;
1274
+ t.blendMode !== void 0 && o.metadata.blendMode !== t.blendMode && (o.metadata.blendMode = t.blendMode, l = !0), t.opacity !== void 0 && o.metadata.opacity !== t.opacity && (o.metadata.opacity = t.opacity, o.opacityUniform.value = t.opacity), t.renderOrder !== void 0 && o.metadata.renderOrder !== t.renderOrder && (o.metadata.renderOrder = t.renderOrder, l = !0);
1275
+ const f = t.visible !== !1;
1276
+ if (o.metadata.visible !== f && (o.metadata.visible = f, l = !0), t.id !== void 0 && o.metadata.id !== t.id && (o.metadata.id = t.id, l = !0), t.mask !== void 0 && (o.metadata.mask?.source !== t.mask?.source || o.metadata.mask?.type !== t.mask?.type) && (o.metadata.mask = t.mask, l = !0), t.transform !== void 0) {
1277
+ const b = o.metadata.transform ? fe(o.metadata.transform) : !1, g = fe(t.transform);
1278
+ if (o.metadata.transform = t.transform, !o.transformUniforms && t.transform) {
1279
+ const w = z / Math.max(1, D);
1280
+ o.transformUniforms = {
1281
+ offsetX: N(t.transform.offsetX),
1282
+ offsetY: N(t.transform.offsetY),
1283
+ rotation: N(t.transform.rotation),
1284
+ scale: N(t.transform.scale),
1285
+ anchorX: N(t.transform.anchorX),
1286
+ anchorY: N(t.transform.anchorY),
1287
+ edges: N(t.transform.edges === "stretch" ? 0 : t.transform.edges === "transparent" ? 1 : t.transform.edges === "mirror" ? 2 : 3),
1288
+ aspectRatio: N(w)
911
1289
  };
912
- } else l.transformUniforms && (l.transformUniforms.offsetX.value = i.transform.offsetX, l.transformUniforms.offsetY.value = i.transform.offsetY, l.transformUniforms.rotation.value = i.transform.rotation, l.transformUniforms.scale.value = i.transform.scale, l.transformUniforms.anchorX.value = i.transform.anchorX, l.transformUniforms.anchorY.value = i.transform.anchorY, l.transformUniforms.edges.value = i.transform.edges === "stretch" ? 0 : i.transform.edges === "transparent" ? 1 : i.transform.edges === "mirror" ? 2 : 3);
913
- w && !l.transformRTTActive && (l.transformRTTActive = !0, a = !0), !T && w && !l.transformRTTActive && (a = !0);
1290
+ } else o.transformUniforms && (o.transformUniforms.offsetX.value = t.transform.offsetX, o.transformUniforms.offsetY.value = t.transform.offsetY, o.transformUniforms.rotation.value = t.transform.rotation, o.transformUniforms.scale.value = t.transform.scale, o.transformUniforms.anchorX.value = t.transform.anchorX, o.transformUniforms.anchorY.value = t.transform.anchorY, o.transformUniforms.edges.value = t.transform.edges === "stretch" ? 0 : t.transform.edges === "transparent" ? 1 : t.transform.edges === "mirror" ? 2 : 3);
1291
+ g && !o.transformRTTActive && (o.transformRTTActive = !0, l = !0), !b && g && !o.transformRTTActive && (l = !0);
914
1292
  }
915
- a && f && C ? (ge.includes(c) || ge.push(c), ne === null && (ne = requestAnimationFrame(() => {
916
- ne = null, ge = [], J();
917
- }))) : O && P();
918
- }, Ae = (c) => {
919
- if (!m.nodes.has(c)) return;
920
- const i = m.nodes.get(c);
921
- if (i && i.cleanupCallbacks.length > 0) for (const a of i.cleanupCallbacks) try {
922
- a();
923
- } catch (h) {
924
- console.error(`Error executing cleanup callback for node ${c}:`, h);
1293
+ l && p && B ? (Oe.includes(s) || Oe.push(s), be === null && (be = requestAnimationFrame(() => {
1294
+ be = null, Oe = [], he();
1295
+ }))) : X && re();
1296
+ }, We = (s) => {
1297
+ if (!h.nodes.has(s)) return;
1298
+ const t = h.nodes.get(s);
1299
+ if (t && t.cleanupCallbacks.length > 0) for (const l of t.cleanupCallbacks) try {
1300
+ l();
1301
+ } catch (f) {
1302
+ console.error(`Error executing cleanup callback for node ${s}:`, f);
925
1303
  }
926
- const l = ye(c);
927
- for (const a of l) Ae(a.id);
928
- if (m.rootId === c && (m.rootId = null), i) {
929
- const a = u.get(i.parentId);
930
- a && (a.delete(c), a.size === 0 && u.delete(i.parentId));
1304
+ const o = Q(s);
1305
+ for (const l of o) We(l.id);
1306
+ if (h.rootId === s && (h.rootId = null), t) {
1307
+ const l = d.get(t.parentId);
1308
+ l && (l.delete(s), l.size === 0 && d.delete(t.parentId));
931
1309
  }
932
- m.nodes.delete(c), f && C && J();
933
- }, dn = (c) => {
934
- const i = {
935
- deltaTime: c,
1310
+ h.nodes.delete(s), p && B && he();
1311
+ }, On = (s) => {
1312
+ const t = {
1313
+ deltaTime: s,
936
1314
  pointer: {
937
- x: me,
938
- y: fe
1315
+ x: $e,
1316
+ y: ze
939
1317
  },
940
- pointerActive: j,
1318
+ pointerActive: ue,
941
1319
  dimensions: {
942
- width: M,
943
- height: S
1320
+ width: z,
1321
+ height: D
944
1322
  }
945
1323
  };
946
- for (const l of m.nodes.values()) if (l.beforeRenderCallbacks.length > 0) for (const a of l.beforeRenderCallbacks) try {
947
- a(i);
948
- } catch (h) {
949
- console.error(`Error executing before render callback for node ${l.id}:`, h);
1324
+ for (const o of h.nodes.values()) if (o.beforeRenderCallbacks.length > 0) for (const l of o.beforeRenderCallbacks) try {
1325
+ l(t);
1326
+ } catch (f) {
1327
+ console.error(`Error executing before render callback for node ${o.id}:`, f);
950
1328
  }
951
- }, hn = (c) => {
952
- const i = {
953
- deltaTime: c,
1329
+ }, Bn = (s) => {
1330
+ const t = {
1331
+ deltaTime: s,
954
1332
  pointer: {
955
- x: me,
956
- y: fe
1333
+ x: $e,
1334
+ y: ze
957
1335
  },
958
- pointerActive: j,
1336
+ pointerActive: ue,
959
1337
  dimensions: {
960
- width: M,
961
- height: S
1338
+ width: z,
1339
+ height: D
962
1340
  }
963
1341
  };
964
- for (const l of m.nodes.values()) if (l.afterRenderCallbacks.length > 0) for (const a of l.afterRenderCallbacks) try {
965
- a(i);
966
- } catch (h) {
967
- console.error(`Error executing after render callback for node ${l.id}:`, h);
1342
+ for (const o of h.nodes.values()) if (o.afterRenderCallbacks.length > 0) for (const l of o.afterRenderCallbacks) try {
1343
+ l(t);
1344
+ } catch (f) {
1345
+ console.error(`Error executing after render callback for node ${o.id}:`, f);
968
1346
  }
969
- }, P = async () => {
970
- if (!on()) return;
971
- const c = Q ? performance.now() : 0, i = c || performance.now(), l = Re > 0 ? (i - Re) / 1e3 : 0.016, a = Math.min(l, 0.1);
972
- Re = i, Q && performance.mark("shader-cpu-start"), dn(a);
1347
+ }, re = async () => {
1348
+ if (!xn()) return;
1349
+ const s = de ? performance.now() : 0, t = s || performance.now(), o = Le > 0 ? (t - Le) / 1e3 : 0.016, l = Math.min(o, 0.1);
1350
+ Le = t, de && performance.mark("shader-cpu-start"), On(l);
973
1351
  try {
974
- if (de) return;
975
- if (Q && performance.mark("shader-gpu-start"), n.render(t, r), hn(a), Q) {
976
- if (performance.mark("shader-gpu-end"), n instanceof Oe) try {
977
- const h = n.backend;
978
- if (h && h.get && h.get(n)) {
979
- const T = h.get(n);
980
- if (T?.timestampQuery) {
981
- const w = T.timestampQuery.getResult();
982
- w != null && W.recordGpuTime(w / 1e6);
1352
+ if (De) return;
1353
+ de && performance.mark("shader-gpu-start");
1354
+ const f = performance.now();
1355
+ n.render(r, a);
1356
+ const b = performance.now() - f;
1357
+ if (b > 20 && console.log(`[Shaders Perf] renderer.render(): ${b.toFixed(2)}ms`), b > 100 && console.warn(`[Shaders Perf] ⚠️ SLOW RENDER! Likely GPU shader compilation: ${b.toFixed(0)}ms`), Bn(l), de) {
1358
+ if (performance.mark("shader-gpu-end"), n instanceof Je) try {
1359
+ const g = n.backend;
1360
+ if (g && g.get && g.get(n)) {
1361
+ const w = g.get(n);
1362
+ if (w?.timestampQuery) {
1363
+ const M = w.timestampQuery.getResult();
1364
+ M != null && ie.recordGpuTime(M / 1e6);
983
1365
  }
984
1366
  }
985
1367
  } catch {
986
1368
  }
987
1369
  try {
988
1370
  performance.measure("shader-gpu-time", "shader-gpu-start", "shader-gpu-end");
989
- const h = performance.getEntriesByName("shader-gpu-time")[0];
990
- h && W.recordGpuTime(h.duration), performance.clearMarks("shader-gpu-start"), performance.clearMarks("shader-gpu-end"), performance.clearMeasures("shader-gpu-time");
1371
+ const g = performance.getEntriesByName("shader-gpu-time")[0];
1372
+ g && ie.recordGpuTime(g.duration), performance.clearMarks("shader-gpu-start"), performance.clearMarks("shader-gpu-end"), performance.clearMeasures("shader-gpu-time");
991
1373
  } catch {
992
1374
  }
993
1375
  }
994
- if (Q) {
1376
+ if (de) {
995
1377
  performance.mark("shader-cpu-end");
996
1378
  try {
997
1379
  performance.measure("shader-cpu-time", "shader-cpu-start", "shader-cpu-end");
998
- const T = performance.getEntriesByName("shader-cpu-time")[0];
999
- T && W.recordCpuTime(T.duration), performance.clearMarks("shader-cpu-start"), performance.clearMarks("shader-cpu-end"), performance.clearMeasures("shader-cpu-time");
1380
+ const w = performance.getEntriesByName("shader-cpu-time")[0];
1381
+ w && ie.recordCpuTime(w.duration), performance.clearMarks("shader-cpu-start"), performance.clearMarks("shader-cpu-end"), performance.clearMeasures("shader-cpu-time");
1000
1382
  } catch {
1001
1383
  }
1002
- const h = performance.now() - c;
1003
- W.recordFrame(h);
1384
+ const g = performance.now() - s;
1385
+ ie.recordFrame(g);
1004
1386
  }
1005
- } catch (h) {
1006
- console.error("Render frame error:", h);
1387
+ } catch (f) {
1388
+ console.error("Render frame error:", f);
1007
1389
  }
1008
- }, pn = () => {
1009
- const c = Math.max(0, m.nodes.size - 1), i = Ce.size;
1010
- W.updateNodeCounts(c, i);
1011
- }, gn = () => {
1012
- pn();
1013
- const c = n?.info;
1014
- return W.getStats(c);
1015
- }, xe = () => {
1016
- if (g || !I || !O) return;
1017
- W.setRendering(!0);
1018
- const c = () => {
1019
- g = requestAnimationFrame(c), P().catch(console.warn);
1390
+ }, Pn = () => {
1391
+ const s = Math.max(0, h.nodes.size - 1), t = Be;
1392
+ ie.updateNodeCounts(s, t);
1393
+ }, _n = () => {
1394
+ Pn();
1395
+ const s = n?.info;
1396
+ return ie.getStats(s);
1397
+ }, je = () => {
1398
+ if (R || !ae || !X) return;
1399
+ ie.setRendering(!0);
1400
+ const s = () => {
1401
+ R = requestAnimationFrame(s), re().catch(console.warn);
1020
1402
  };
1021
- c();
1022
- }, De = () => {
1023
- g && (cancelAnimationFrame(g), g = null), W.setRendering(!1);
1024
- }, qe = (c) => {
1403
+ s();
1404
+ }, Qe = () => {
1405
+ R && (cancelAnimationFrame(R), R = null), ie.setRendering(!1);
1406
+ }, cn = (s) => {
1025
1407
  if (!e) return;
1026
- let i, l;
1027
- if ("touches" in c) {
1028
- if (c.touches.length === 0) return;
1029
- i = c.touches[0].clientX, l = c.touches[0].clientY;
1408
+ let t, o;
1409
+ if ("touches" in s) {
1410
+ if (s.touches.length === 0) return;
1411
+ t = s.touches[0].clientX, o = s.touches[0].clientY;
1030
1412
  } else
1031
- i = c.clientX, l = c.clientY;
1032
- const a = e.getBoundingClientRect(), h = (i - a.left) / a.width, T = (l - a.top) / a.height;
1033
- me = h, fe = T;
1034
- }, bn = (c) => {
1035
- !C || !e || qe(c);
1036
- }, yn = (c) => {
1037
- !C || !e || qe(c);
1038
- }, vn = () => {
1039
- C && (j = !1, P().catch(console.warn));
1040
- }, Tn = () => {
1041
- C && (j = !1, P().catch(console.warn));
1042
- }, Pe = () => {
1043
- j = !0, P().catch(console.warn);
1044
- }, Ve = () => {
1045
- j = !0, P().catch(console.warn);
1046
- }, Rn = () => {
1047
- if (H.length === 0) return;
1048
- const c = [...H];
1049
- H = [];
1050
- for (const { id: i, fragmentNodeFunc: l, parentId: a, metadata: h, uniforms: T, componentDefinition: w } of c) l && Ne(i, l, a, h, T, w);
1051
- };
1052
- return {
1053
- initialize: async ({ canvas: c, enablePerformanceTracking: i = !1 }) => {
1054
- if (C || q) return;
1055
- Q = i, q = !0, F = new AbortController();
1056
- const l = F;
1413
+ t = s.clientX, o = s.clientY;
1414
+ const l = e.getBoundingClientRect(), f = (t - l.left) / l.width, b = (o - l.top) / l.height;
1415
+ $e = f, ze = b;
1416
+ }, Vn = (s) => {
1417
+ !B || !e || cn(s);
1418
+ }, Ln = (s) => {
1419
+ !B || !e || cn(s);
1420
+ }, qn = () => {
1421
+ B && (ue = !1, re().catch(console.warn));
1422
+ }, Gn = () => {
1423
+ B && (ue = !1, re().catch(console.warn));
1424
+ }, fn = () => {
1425
+ ue = !0, re().catch(console.warn);
1426
+ }, mn = () => {
1427
+ ue = !0, re().catch(console.warn);
1428
+ }, Nn = () => {
1429
+ if (oe.length === 0) return;
1430
+ const s = [...oe];
1431
+ oe = [];
1432
+ for (const { id: t, fragmentNodeFunc: o, parentId: l, metadata: f, uniforms: b, componentDefinition: g } of s) o && ln(t, o, l, f, b, g);
1433
+ }, Xn = async ({ canvas: s, enablePerformanceTracking: t = !1 }) => {
1434
+ if (B || ne) return;
1435
+ de = t, ne = !0, H = new AbortController();
1436
+ const o = H;
1437
+ try {
1438
+ if (e = s, r = new Kn(), r.background = null, a = new In(-1, 1, 1, -1, 0.1, 10), a.position.z = 1, a.lookAt(0, 0, 0), Fe = Xt.register({
1439
+ onMouseMove: Vn,
1440
+ onTouchMove: Ln,
1441
+ onMouseUp: qn,
1442
+ onTouchEnd: Gn
1443
+ }), s.addEventListener("mousedown", fn), s.addEventListener("touchstart", mn), Re = () => {
1444
+ un();
1445
+ }, window.addEventListener("beforeunload", Re), o.signal.aborted) return;
1057
1446
  try {
1058
- if (e = c, t = new Mn(), t.background = null, r = new Ln(-1, 1, 1, -1, 0.1, 10), r.position.z = 1, r.lookAt(0, 0, 0), he = Cr.register({
1059
- onMouseMove: bn,
1060
- onTouchMove: yn,
1061
- onMouseUp: vn,
1062
- onTouchEnd: Tn
1063
- }), c.addEventListener("mousedown", Pe), c.addEventListener("touchstart", Ve), l.signal.aborted) return;
1447
+ const F = {
1448
+ canvas: s,
1449
+ antialias: !0,
1450
+ alpha: !0,
1451
+ depth: !1,
1452
+ powerPreference: "high-performance"
1453
+ };
1454
+ if (de && (F.forceWebGL = !1, F.requiredFeatures = ["timestamp-query"]), n = new Je(F), await n.init(), o.signal.aborted) return;
1455
+ } catch (F) {
1456
+ if (o.signal.aborted) return;
1457
+ console.warn("[Shaders] WebGPU initialization failed, falling back to WebGL:", F);
1064
1458
  try {
1065
- const D = {
1066
- canvas: c,
1459
+ if (n = new st({
1460
+ canvas: s,
1067
1461
  antialias: !0,
1068
1462
  alpha: !0,
1069
1463
  depth: !1,
1070
1464
  powerPreference: "high-performance"
1071
- };
1072
- if (Q && (D.forceWebGL = !1, D.requiredFeatures = ["timestamp-query"]), n = new Oe(D), await n.init(), l.signal.aborted) return;
1073
- } catch (D) {
1074
- if (l.signal.aborted) return;
1075
- console.warn("[Shaders] WebGPU initialization failed, falling back to WebGL:", D);
1076
- try {
1077
- if (n = new Gt({
1078
- canvas: c,
1079
- antialias: !0,
1080
- alpha: !0,
1081
- depth: !1,
1082
- powerPreference: "high-performance"
1083
- }), l.signal.aborted) return;
1084
- } catch (k) {
1085
- if (l.signal.aborted) return;
1086
- console.error("[Shaders] Both WebGPU and WebGL initialization failed:", k);
1087
- return;
1088
- }
1089
- }
1090
- if (l.signal.aborted) return;
1091
- n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.outputColorSpace = $n, f = new He({ transparent: !0 }), f.fragmentNode = v(0, 0, 0, 0), s = new Dn(new wn(2, 2), f), t.add(s);
1092
- const a = c.parentElement;
1093
- if (!a) {
1094
- console.warn("[Shaders] Canvas has no parent element for resize observation");
1465
+ }), o.signal.aborted) return;
1466
+ } catch (y) {
1467
+ if (o.signal.aborted) return;
1468
+ console.error("[Shaders] Both WebGPU and WebGL initialization failed:", y);
1095
1469
  return;
1096
1470
  }
1097
- y = new ResizeObserver(an), y.observe(a), A = new IntersectionObserver(sn, { threshold: 0 }), A.observe(c);
1098
- const h = c.getBoundingClientRect();
1099
- O = h.width > 0 && h.height > 0 && h.top < window.innerHeight && h.bottom > 0 && h.left < window.innerWidth && h.right > 0, V = O && h.width > 0 && h.height > 0, I = !rn();
1100
- const { width: T, height: w } = c.getBoundingClientRect(), $ = Math.round(T), G = Math.round(w);
1101
- $ > 0 && G > 0 ? (Se($, G), B = !0, await P()) : B = !1, I && O && xe(), l.signal.aborted || (C = !0, we = !0, Rn());
1102
- } catch (a) {
1103
- console.error("[Shaders] Initialization error:", a);
1104
- } finally {
1105
- q = !1, F === l && (F = null);
1106
1471
  }
1107
- },
1108
- cleanup: () => {
1109
- if (F && F.abort(), y && (y.disconnect(), y = null), A && (A.disconnect(), A = null), he && (he(), he = null), e && (e.removeEventListener("mousedown", Pe), e.removeEventListener("touchstart", Ve)), De(), Le(), re.forEach((c) => {
1110
- try {
1111
- c?.renderTarget?.dispose && c.renderTarget.dispose();
1112
- } catch {
1113
- }
1114
- }), re.clear(), m.nodes.clear(), m.rootId = null, m.idToNodeId.clear(), u.clear(), H = [], we = !1, pe = [], ee !== null && (cancelAnimationFrame(ee), ee = null), ge = [], ne !== null && (cancelAnimationFrame(ne), ne = null), oe = null, be = !1, s) {
1115
- t && t.remove(s);
1116
- try {
1117
- s.geometry && typeof s.geometry.dispose == "function" && s.geometry.dispose();
1118
- } catch {
1119
- }
1120
- try {
1121
- s.material instanceof xn && typeof s.material.dispose == "function" && s.material.dispose();
1122
- } catch {
1123
- }
1472
+ if (o.signal.aborted) return;
1473
+ n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.outputColorSpace = Hn, p = new dn({ transparent: !0 }), p.fragmentNode = x(0, 0, 0, 0), m = new ar(new Zn(2, 2), p), r.add(m);
1474
+ const l = s.parentElement;
1475
+ if (!l) {
1476
+ console.warn("[Shaders] Canvas has no parent element for resize observation");
1477
+ return;
1124
1478
  }
1125
- if (n && typeof n.dispose == "function") try {
1126
- n.dispose();
1479
+ S = new ResizeObserver(Mn), S.observe(l), V = new IntersectionObserver(An, { threshold: 0 }), V.observe(s);
1480
+ const f = s.getBoundingClientRect();
1481
+ X = f.width > 0 && f.height > 0 && f.top < window.innerHeight && f.bottom > 0 && f.left < window.innerWidth && f.right > 0, te = X && f.width > 0 && f.height > 0, ae = !0;
1482
+ const { width: b, height: g } = s.getBoundingClientRect(), w = Math.round(b), M = Math.round(g);
1483
+ w > 0 && M > 0 ? (Ne(w, M), I = !0, await re()) : I = !1, ae && X && je(), o.signal.aborted || (B = !0, qe = !0, Nn());
1484
+ } catch (l) {
1485
+ console.error("[Shaders] Initialization error:", l);
1486
+ } finally {
1487
+ ne = !1, H === o && (H = null);
1488
+ }
1489
+ }, Yn = () => {
1490
+ !Yt() || kn || (console.warn("Shaders is running in development mode. Please purchase a license at https://shaders.com to use it in production."), kn = !0);
1491
+ }, un = () => {
1492
+ if (H && H.abort(), S && (S.disconnect(), S = null), V && (V.disconnect(), V = null), Fe && (Fe(), Fe = null), e && (e.removeEventListener("mousedown", fn), e.removeEventListener("touchstart", mn)), Re && (window.removeEventListener("beforeunload", Re), Re = null), Qe(), rn(), Te.forEach((s) => {
1493
+ try {
1494
+ s?.renderTarget?.dispose && s.renderTarget.dispose();
1495
+ } catch {
1496
+ }
1497
+ }), Te.clear(), h.nodes.clear(), h.rootId = null, h.idToNodeId.clear(), d.clear(), oe = [], qe = !1, Ee = [], ge !== null && (cancelAnimationFrame(ge), ge = null), Oe = [], be !== null && (cancelAnimationFrame(be), be = null), ke = null, Pe = !1, m) {
1498
+ r && r.remove(m);
1499
+ try {
1500
+ m.geometry && typeof m.geometry.dispose == "function" && m.geometry.dispose();
1127
1501
  } catch {
1128
1502
  }
1129
- e = null, n = null, r = null, t = null, s = null, f = null, C = !1, q = !1, B = !1, F = null, M = 0, S = 0, O = !1, I = !0, me = 0.5, fe = 0.5, j = !1;
1130
- },
1131
- registerNode: Ne,
1132
- removeNode: Ae,
1133
- updateUniformValue: mn,
1134
- updateNodeMetadata: fn,
1135
- showLicenseWarning: () => {
1136
- !Mr() || Ke || (console.warn("Shaders is running in development mode. Please purchase a license at https://shaders.com to use it in production."), Ke = !0);
1137
- },
1138
- isInitialized: () => C,
1139
- startAnimation: xe,
1140
- stopAnimation: De,
1141
- getPerformanceStats: gn,
1142
- getNodeRegistry: () => ({ nodes: new Map(m.nodes) }),
1143
- getRendererType: () => n ? n instanceof Oe ? "webgpu" : "webgl" : null
1503
+ try {
1504
+ m.material instanceof Jn && typeof m.material.dispose == "function" && m.material.dispose();
1505
+ } catch {
1506
+ }
1507
+ }
1508
+ if (n && typeof n.dispose == "function") try {
1509
+ n.dispose();
1510
+ } catch {
1511
+ }
1512
+ e = null, n = null, a = null, r = null, m = null, p = null, B = !1, ne = !1, I = !1, H = null, z = 0, D = 0, X = !1, ae = !0, $e = 0.5, ze = 0.5, ue = !1;
1513
+ };
1514
+ return {
1515
+ initialize: Xn,
1516
+ cleanup: un,
1517
+ registerNode: ln,
1518
+ removeNode: We,
1519
+ updateUniformValue: Fn,
1520
+ updateNodeMetadata: En,
1521
+ showLicenseWarning: Yn,
1522
+ isInitialized: () => B,
1523
+ startAnimation: je,
1524
+ stopAnimation: Qe,
1525
+ getPerformanceStats: _n,
1526
+ getNodeRegistry: () => ({ nodes: new Map(h.nodes) }),
1527
+ getRendererType: () => n ? n instanceof Je ? "webgpu" : "webgl" : null
1144
1528
  };
1145
1529
  }
1146
- tn();
1147
- function Wo(e) {
1148
- const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), t = {
1530
+ Un();
1531
+ function fs(e) {
1532
+ const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = {
1149
1533
  processingOrder: [],
1150
1534
  maskSources: /* @__PURE__ */ new Map(),
1151
1535
  circularDependencies: []
1152
1536
  };
1153
- return e.forEach((s) => {
1154
- s.elementId && n.set(s.elementId, s.id);
1155
- }), e.forEach((s) => {
1156
- if (s.mask?.source) {
1157
- const f = s.mask.source.startsWith("#") ? s.mask.source.substring(1) : s.mask.source, m = n.get(f);
1158
- m ? (r.has(s.id) || r.set(s.id, []), r.get(s.id)?.push(m), t.maskSources.set(s.id, m)) : console.warn(`Mask source "${f}" not found for node "${s.id}"`);
1537
+ return e.forEach((m) => {
1538
+ m.elementId && n.set(m.elementId, m.id);
1539
+ }), e.forEach((m) => {
1540
+ if (m.mask?.source) {
1541
+ const p = m.mask.source.startsWith("#") ? m.mask.source.substring(1) : m.mask.source, h = n.get(p);
1542
+ h ? (a.has(m.id) || a.set(m.id, []), a.get(m.id)?.push(h), r.maskSources.set(m.id, h)) : console.warn(`Mask source "${p}" not found for node "${m.id}"`);
1159
1543
  }
1160
- }), t.processingOrder = Sr(r, t.circularDependencies), t;
1544
+ }), r.processingOrder = It(a, r.circularDependencies), r;
1161
1545
  }
1162
- function Sr(e, n) {
1163
- const r = [], t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
1164
- function f(u, g = []) {
1165
- if (t.has(u)) return;
1166
- if (s.has(u)) {
1167
- const A = [...g.slice(g.indexOf(u)), u];
1168
- n.push(A);
1546
+ function It(e, n) {
1547
+ const a = [], r = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set();
1548
+ function p(d, R = []) {
1549
+ if (r.has(d)) return;
1550
+ if (m.has(d)) {
1551
+ const V = [...R.slice(R.indexOf(d)), d];
1552
+ n.push(V);
1169
1553
  return;
1170
1554
  }
1171
- s.add(u), g.push(u);
1172
- const y = e.get(u) || [];
1173
- for (const A of y) f(A, [...g]);
1174
- s.delete(u), t.add(u), r.push(u);
1555
+ m.add(d), R.push(d);
1556
+ const S = e.get(d) || [];
1557
+ for (const V of S) p(V, [...R]);
1558
+ m.delete(d), r.add(d), a.push(d);
1175
1559
  }
1176
- for (const u of e.keys()) t.has(u) || f(u);
1177
- const m = new Set([...e.values()].flat());
1178
- for (const u of m) !t.has(u) && !e.has(u) && r.push(u);
1179
- return r.reverse();
1560
+ for (const d of e.keys()) r.has(d) || p(d);
1561
+ const h = new Set([...e.values()].flat());
1562
+ for (const d of h) !r.has(d) && !e.has(d) && a.push(d);
1563
+ return a.reverse();
1180
1564
  }
1181
- R();
1182
- var { vec2: Ar, fract: xr, sin: Dr, dot: zr } = Z;
1183
- const $r = (e) => xr(Dr(zr(e, Ar(12.12345, 78.12345))).mul(40000.12345)), Xo = (e = 0.03) => (n) => $r(n).mul(e).mul(0.10012345);
1184
- R();
1185
- var { vec2: Ur } = Z;
1186
- const Yo = (e = Ur(0), n = 0.02, r = 1, t = 1) => {
1187
- const { vec2: s, sin: f, cos: m, time: u } = Z, g = t * 1.618033988749895, y = t * 2.718281828459045, A = (Math.sin(t) + 2) * 5, C = (Math.cos(t) + 2) * 5, q = s(f(e.x.mul(r).mul(A).add(u.mul(0.1)).add(g)), m(e.y.mul(r).mul(A).add(u.mul(0.1)).add(y))), B = s(f(e.y.mul(r).mul(C).add(u.mul(0.05)).add(y)), m(e.x.mul(r).mul(C).add(u.mul(0.05)).add(g))), F = q.add(B).mul(n);
1188
- return e.add(F);
1565
+ A();
1566
+ var { vec2: Ht, fract: Wt, sin: jt, dot: Qt } = pe;
1567
+ const Jt = (e) => Wt(jt(Qt(e, Ht(12.12345, 78.12345))).mul(40000.12345)), ms = (e = 0.03) => (n) => Jt(n).mul(e).mul(0.10012345);
1568
+ A();
1569
+ var { vec2: Kt } = pe;
1570
+ const us = (e = Kt(0), n = 0.02, a = 1, r = 1) => {
1571
+ const { vec2: m, sin: p, cos: h, time: d } = pe, R = r * 1.618033988749895, S = r * 2.718281828459045, V = (Math.sin(r) + 2) * 5, B = (Math.cos(r) + 2) * 5, ne = m(p(e.x.mul(a).mul(V).add(d.mul(0.1)).add(R)), h(e.y.mul(a).mul(V).add(d.mul(0.1)).add(S))), I = m(p(e.y.mul(a).mul(B).add(d.mul(0.05)).add(S)), h(e.x.mul(a).mul(B).add(d.mul(0.05)).add(R))), H = ne.add(I).mul(n);
1572
+ return e.add(H);
1189
1573
  };
1190
- R();
1191
- const jo = (e, n, r = 0.6, t = 0.3, s = 1) => {
1192
- const { max: f, smoothstep: m, vec4: u } = Z, g = f(f(e.r, e.g), e.b), y = m(r, r + t, g).mul(s).mul(1);
1193
- return u(e.rgb.add(n.rgb.mul(y)), e.a);
1574
+ A();
1575
+ const ds = (e, n, a = 0.6, r = 0.3, m = 1) => {
1576
+ const { max: p, smoothstep: h, vec4: d } = pe, R = p(p(e.r, e.g), e.b), S = h(a, a + r, R).mul(m).mul(1);
1577
+ return d(e.rgb.add(n.rgb.mul(S)), e.a);
1194
1578
  };
1195
- R();
1196
- const Qo = (e = {}) => {
1197
- const { inset: n = 0.4, softness: r = 0.5, offsetX: t = 0, offsetY: s = 0 } = e, { float: f, smoothstep: m, uv: u } = Z, g = u(), y = g.x.sub(0.5).sub(f(t)).mul(2), A = g.y.sub(0.5).add(f(s)).mul(2), C = y.mul(y).add(A.mul(A)).sqrt();
1198
- return f(1).sub(m(f(1).sub(f(n)), f(1).sub(f(n)).add(f(r)), C.mul(f(1).add(f(r)))));
1579
+ A();
1580
+ const hs = (e = {}) => {
1581
+ const { inset: n = 0.4, softness: a = 0.5, offsetX: r = 0, offsetY: m = 0 } = e, { float: p, smoothstep: h, uv: d } = pe, R = d(), S = R.x.sub(0.5).sub(p(r)).mul(2), V = R.y.sub(0.5).add(p(m)).mul(2), B = S.mul(S).add(V.mul(V)).sqrt();
1582
+ return p(1).sub(h(p(1).sub(p(n)), p(1).sub(p(n)).add(p(a)), B.mul(p(1).add(p(a)))));
1199
1583
  };
1200
- var Er = () => {
1584
+ var Zt = () => {
1201
1585
  const e = {};
1202
1586
  return Object.entries({
1203
- AngularBlur: qn,
1204
- Ascii: Pn,
1205
- Blob: Vn,
1206
- Blur: Hn,
1207
- Bulge: In,
1208
- ChannelBlur: Wn,
1209
- Checkerboard: Xn,
1210
- ChromaFlow: Yn,
1211
- ChromaticAberration: jn,
1212
- Circle: Qn,
1213
- CRTScreen: Jn,
1214
- CursorTrail: Kn,
1215
- DiffuseBlur: Zn,
1216
- Dither: et,
1217
- DotGrid: nt,
1218
- Duotone: tt,
1219
- FilmGrain: rt,
1220
- FloatingParticles: ot,
1221
- GlassTiles: it,
1222
- Glow: at,
1223
- Godrays: st,
1224
- Grayscale: lt,
1225
- Grid: ct,
1226
- GridDistortion: ut,
1227
- Group: mt,
1228
- Halftone: ft,
1229
- HueShift: dt,
1230
- ImageTexture: ht,
1231
- Invert: pt,
1232
- LinearBlur: gt,
1233
- LinearGradient: bt,
1234
- Liquify: yt,
1235
- Pixelate: vt,
1236
- PolarCoordinates: Tt,
1237
- Posterize: Rt,
1238
- ProgressiveBlur: kt,
1239
- RadialGradient: wt,
1240
- Ripples: Ct,
1241
- Saturation: Mt,
1242
- SimplexNoise: St,
1243
- SineWave: At,
1244
- SolidColor: xt,
1245
- Spiral: Dt,
1246
- Strands: zt,
1247
- Swirl: $t,
1248
- TiltShift: Ut,
1249
- Tritone: Et,
1250
- Twirl: Ot,
1251
- Vibrance: _t,
1252
- WaveDistortion: Bt,
1253
- ZoomBlur: Ft
1254
- }).forEach(([r, t]) => {
1255
- const s = {};
1256
- t.props && Object.entries(t.props).forEach(([f, m]) => {
1257
- m.ui && (s[f] = {
1258
- ui: m.ui,
1259
- default: m.default,
1260
- description: m.description
1587
+ AngularBlur: ir,
1588
+ Ascii: lr,
1589
+ Blob: cr,
1590
+ Blur: fr,
1591
+ Bulge: mr,
1592
+ ChannelBlur: ur,
1593
+ Checkerboard: dr,
1594
+ ChromaFlow: hr,
1595
+ ChromaticAberration: pr,
1596
+ Circle: gr,
1597
+ CRTScreen: br,
1598
+ CursorTrail: vr,
1599
+ DiffuseBlur: Cr,
1600
+ Dither: Rr,
1601
+ DotGrid: Tr,
1602
+ Duotone: kr,
1603
+ FilmGrain: wr,
1604
+ FloatingParticles: yr,
1605
+ GlassTiles: Sr,
1606
+ Glow: Ur,
1607
+ Godrays: xr,
1608
+ Grayscale: Mr,
1609
+ Grid: Ar,
1610
+ GridDistortion: $r,
1611
+ Group: zr,
1612
+ Halftone: Dr,
1613
+ HueShift: Fr,
1614
+ ImageTexture: Er,
1615
+ Invert: Or,
1616
+ LinearBlur: Br,
1617
+ LinearGradient: Pr,
1618
+ Liquify: _r,
1619
+ Pixelate: Vr,
1620
+ PolarCoordinates: Lr,
1621
+ Posterize: qr,
1622
+ ProgressiveBlur: Gr,
1623
+ RadialGradient: Nr,
1624
+ RectangularCoordinates: Xr,
1625
+ Ripples: Yr,
1626
+ Saturation: Ir,
1627
+ SimplexNoise: Hr,
1628
+ SineWave: Wr,
1629
+ SolidColor: jr,
1630
+ Spiral: Qr,
1631
+ Strands: Jr,
1632
+ Swirl: Kr,
1633
+ TiltShift: Zr,
1634
+ Tritone: et,
1635
+ Twirl: nt,
1636
+ Vibrance: rt,
1637
+ WaveDistortion: tt,
1638
+ ZoomBlur: ot
1639
+ }).forEach(([a, r]) => {
1640
+ const m = {};
1641
+ r.props && Object.entries(r.props).forEach(([p, h]) => {
1642
+ h.ui && (m[p] = {
1643
+ ui: h.ui,
1644
+ default: h.default,
1645
+ description: h.description
1261
1646
  });
1262
- }), e[t.name] = {
1263
- name: t.name,
1264
- fileName: r,
1265
- category: t.category || "Uncategorized",
1266
- definition: t,
1267
- propsMetadata: s
1647
+ }), e[r.name] = {
1648
+ name: r.name,
1649
+ fileName: a,
1650
+ category: r.category || "Uncategorized",
1651
+ definition: r,
1652
+ propsMetadata: m
1268
1653
  };
1269
1654
  }), e;
1270
1655
  };
1271
- const Te = Er();
1272
- function Jo() {
1273
- return Object.values(Te);
1656
+ const Ve = Zt();
1657
+ function ps() {
1658
+ return Object.values(Ve);
1274
1659
  }
1275
- function Ko(e) {
1276
- return Te[e];
1660
+ function gs(e) {
1661
+ return Ve[e];
1277
1662
  }
1278
- function Zo(e) {
1279
- return Object.values(Te).filter((n) => n.category === e);
1663
+ function bs(e) {
1664
+ return Object.values(Ve).filter((n) => n.category === e);
1280
1665
  }
1281
- function ei() {
1282
- const e = new Set(Object.values(Te).map((n) => n.category));
1666
+ function vs() {
1667
+ const e = new Set(Object.values(Ve).map((n) => n.category));
1283
1668
  return Array.from(e).sort();
1284
1669
  }
1285
1670
  export {
1286
- qr as createAnimatedTime,
1287
- kr as createUniformsMap,
1288
- Yo as distort,
1289
- Qo as edgeMask,
1290
- Jo as getAllShaders,
1291
- Ko as getShaderByName,
1292
- ei as getShaderCategories,
1293
- Zo as getShadersByCategory,
1294
- jo as glow,
1295
- Xo as grain,
1296
- Wo as resolveMaskDependencies,
1297
- Te as shaderRegistry,
1298
- Io as shaderRenderer,
1299
- wr as updateUniformValue
1671
+ oo as createAnimatedTime,
1672
+ Gt as createUniformsMap,
1673
+ us as distort,
1674
+ hs as edgeMask,
1675
+ ps as getAllShaders,
1676
+ gs as getShaderByName,
1677
+ vs as getShaderCategories,
1678
+ bs as getShadersByCategory,
1679
+ ds as glow,
1680
+ ms as grain,
1681
+ fs as resolveMaskDependencies,
1682
+ Ve as shaderRegistry,
1683
+ cs as shaderRenderer,
1684
+ Nt as updateUniformValue
1300
1685
  };