@firecms/neat 0.8.0 → 0.9.1

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.
package/dist/index.umd.js CHANGED
@@ -1,227 +1,275 @@
1
- (function(F,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(F=typeof globalThis<"u"?globalThis:F||self,I(F.neat={}))})(this,function(F){"use strict";const I=`void main() {
2
- vUv = uv;
3
-
4
- // SCROLLING LOGIC
5
- // Separate multipliers for wave, color, and flow offsets
6
- float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
7
- float colorOffset = -u_y_offset * u_y_offset_color_multiplier;
8
- float flowOffset = -u_y_offset * u_y_offset_flow_multiplier;
9
-
10
- // 1. DISPLACEMENT (WAVES)
11
- // We add waveOffset to Y to scroll the wave pattern
12
- v_displacement_amount = cnoise( vec3(
13
- u_wave_frequency_x * position.x + u_time,
14
- u_wave_frequency_y * (position.y + waveOffset) + u_time,
15
- u_time
16
- ));
17
-
18
- // 2. FLOW FIELD
19
- // Apply flow offset to scroll the flow field mask
20
- vec2 baseUv = vUv;
21
- baseUv.y += flowOffset / u_plane_height; // Scale to match wave speed
22
- vec2 flowUv = baseUv;
23
-
24
- if (u_flow_enabled > 0.5) {
25
- if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
26
- vec2 ppp = -1.0 + 2.0 * baseUv;
27
- ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
28
- ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
29
- ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
30
- ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
31
-
32
- float r = length(ppp);
33
- flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, baseUv.y), u_flow_ease);
34
- }
35
- }
36
-
37
- // Pass the standard flow UV to fragment shader (for texture)
38
- vFlowUv = flowUv;
39
-
40
- // 3. COLOR MIXING
41
- // We take the computed flow UVs and apply the color offset
42
- // Scale by plane height to match wave offset speed (world space vs UV space)
43
- vec3 color = u_colors[0].color;
44
- // ...
45
- vec2 adjustedUv = flowUv;
46
- adjustedUv.y += colorOffset / u_plane_height; // Scroll the color mixing pattern
47
-
48
- vec2 noise_cord = adjustedUv * u_color_pressure;
49
- const float minNoise = .0;
50
- const float maxNoise = .9;
51
-
52
- for (int i = 1; i < 6; i++) {
53
- if (i < u_colors_count) {
54
- if (u_colors[i].is_active > 0.5) {
55
- float noiseFlow = (1. + float(i)) / 30.;
56
- float noiseSpeed = (1. + float(i)) * 0.11;
57
- float noiseSeed = 13. + float(i) * 7.;
58
-
59
- float noise = snoise(
60
- vec3(
61
- noise_cord.x * u_color_pressure.x + u_time * noiseFlow * 2.,
62
- noise_cord.y * u_color_pressure.y,
63
- u_time * noiseSpeed
64
- ) + noiseSeed
65
- ) - (.1 * float(i)) + (.5 * u_color_blending);
66
-
67
- noise = clamp(noise, minNoise, maxNoise + float(i) * 0.02);
68
- color = mix(color, u_colors[i].color, smoothstep(0.0, u_color_blending, noise));
69
- }
70
- }
71
- }
72
-
73
- v_color = color;
74
-
75
- // 4. FRESNEL (rim glow)
76
- // (Calculated in fragment shader using displacement slope approximation)
77
-
78
- // 5. VERTEX POSITION
79
- vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
80
- gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
81
- v_new_position = gl_Position;
1
+ (function(k,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(k=typeof globalThis<"u"?globalThis:k||self,q(k.neat={}))})(this,function(k){"use strict";const q=`void main() {
2
+ vUv = uv;
3
+ vPosition = position;
4
+ float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
5
+ float colorOffset = -u_y_offset * u_y_offset_color_multiplier;
6
+ float flowOffset = -u_y_offset * u_y_offset_flow_multiplier;
7
+ v_displacement_amount = cnoise( vec3(
8
+ u_wave_frequency_x * position.x + u_time,
9
+ u_wave_frequency_y * (position.y + waveOffset) + u_time,
10
+ u_time
11
+ ));
12
+ vec2 baseUv = vUv;
13
+ baseUv.y += flowOffset / u_plane_height;
14
+ vec2 flowUv = baseUv;
15
+ if (u_flow_enabled > 0.5) {
16
+ if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
17
+ vec2 ppp = -1.0 + 2.0 * baseUv;
18
+ ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
19
+ ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
20
+ ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
21
+ ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
22
+ float r = length(ppp);
23
+ flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, baseUv.y), u_flow_ease);
82
24
  }
83
- `,te=`float random(vec2 p) {
84
- return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
85
25
  }
86
-
26
+ vFlowUv = flowUv;
27
+ vec3 color = u_colors[0].color;
28
+ vec3 distortedPos = position;
29
+ if (u_flat_shading < 0.5) {
30
+ if (u_flow_enabled > 0.5) {
31
+ if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
32
+ vec3 ppp = position / 25.0;
33
+ ppp.xyz += 0.1 * cos((1.5 * u_flow_scale) * ppp.yxz + 1.1 * u_time + vec3(0.1, 1.1, 2.1));
34
+ ppp.xyz += 0.1 * cos((2.3 * u_flow_scale) * ppp.zxy + 1.3 * u_time + vec3(3.2, 3.4, 1.2));
35
+ ppp.xyz += 0.1 * cos((2.2 * u_flow_scale) * ppp.yxz + 1.7 * u_time + vec3(1.8, 5.2, 3.1));
36
+ ppp.xyz += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.zxy + 1.4 * u_time + vec3(6.3, 3.9, 4.5));
37
+ float r = length(ppp);
38
+ distortedPos = mix(position, vec3(
39
+ position.x * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0,
40
+ position.y,
41
+ position.z * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0
42
+ ), u_flow_ease);
43
+ }
44
+ }
45
+ }
46
+ vec3 noise_cord;
47
+ if (u_flat_shading < 0.5) {
48
+ noise_cord = vec3(distortedPos.x / 50.0, (distortedPos.y + colorOffset) / 50.0, distortedPos.z / 50.0);
49
+ } else {
50
+ vec2 adjustedUv = flowUv;
51
+ adjustedUv.y += colorOffset / u_plane_height;
52
+ noise_cord = vec3(adjustedUv, 0.0);
53
+ }
54
+ const float minNoise = .0;
55
+ const float maxNoise = .9;
56
+ for (int i = 1; i < 6; i++) {
57
+ if (i < u_colors_count) {
58
+ if (u_colors[i].is_active > 0.5) {
59
+ float noiseFlow = (1. + float(i)) / 30.;
60
+ float noiseSpeed = (1. + float(i)) * 0.11;
61
+ float noiseSeed = 13. + float(i) * 7.;
62
+ float noise_z = u_time * noiseSpeed;
63
+ if (u_flat_shading < 0.5) {
64
+ noise_z = noise_cord.z * u_color_pressure.x * u_color_pressure.x + u_time * noiseSpeed;
65
+ }
66
+ float noise = snoise(
67
+ vec3(
68
+ noise_cord.x * u_color_pressure.x * u_color_pressure.x + u_time * noiseFlow * 2.,
69
+ noise_cord.y * u_color_pressure.y * u_color_pressure.y,
70
+ noise_z
71
+ ) + noiseSeed
72
+ ) - (.1 * float(i)) + (.5 * u_color_blending);
73
+ noise = clamp(noise, minNoise, maxNoise + float(i) * 0.02);
74
+ color = mix(color, u_colors[i].color, smoothstep(0.0, u_color_blending, noise));
75
+ }
76
+ }
77
+ }
78
+ v_color = color;
79
+ vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
80
+ vec4 mvPosition = modelViewMatrix * vec4(newPosition, 1.0);
81
+ vViewPosition = mvPosition.xyz;
82
+ vNormal = normalize((modelViewMatrix * vec4(normal, 0.0)).xyz);
83
+ gl_Position = projectionMatrix * mvPosition;
84
+ v_new_position = gl_Position;
85
+ }`,me=`float random(vec2 p) {
86
+ return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
87
+ }
87
88
  float fbm(vec3 x) {
88
- float value = 0.0;
89
- float amplitude = 0.5;
90
- float frequency = 1.0;
91
- for (int i = 0; i < 4; i++) {
92
- value += amplitude * snoise(x * frequency);
93
- frequency *= 2.0;
94
- amplitude *= 0.5;
95
- }
96
- return value;
89
+ float value = 0.0;
90
+ float amplitude = 0.5;
91
+ float frequency = 1.0;
92
+ for (int i = 0; i < 2; i++) {
93
+ value += amplitude * snoise(x * frequency);
94
+ frequency *= 2.0;
95
+ amplitude *= 0.5;
96
+ }
97
+ return value;
97
98
  }
98
-
99
- // Branchless HSL to RGB for iridescence
100
99
  vec3 hsl2rgb(float h, float s, float l) {
101
- vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
102
- return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
100
+ vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
101
+ return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
103
102
  }
104
-
105
103
  void main() {
106
- vec2 finalUv = vFlowUv;
107
-
108
- vec3 baseColor;
109
-
110
- if (u_enable_procedural_texture > 0.5) {
111
- vec2 ppp = -1.0 + 2.0 * finalUv;
112
- ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
113
- ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
114
- ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
115
- ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
116
- float r = length(ppp);
117
-
118
- float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
119
- float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
120
- vec2 texUv = vec2(vx, vy);
121
-
122
- float parallaxFactor = 0.25;
123
- texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
124
- texUv *= 1.5;
125
-
126
- vec4 texSample = texture2D(u_procedural_texture, texUv);
127
- baseColor = texSample.rgb;
128
- } else {
129
- baseColor = v_color;
130
- }
131
-
132
- vec3 color = baseColor;
133
-
134
- // === DOMAIN WARPING (simplified: 3 fbm calls instead of 5) ===
135
- if (u_domain_warp_enabled > 0.5) {
136
- vec3 p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
137
- vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
138
- float f = fbm(p + vec3(4.0 * q, 0.0));
139
- vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
140
- float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
141
- color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
142
- }
143
-
144
- // Post-processing
145
- color += v_displacement_amount * u_highlights;
146
- float shadowFactor = 1.0 - v_displacement_amount;
147
- color -= shadowFactor * shadowFactor * u_shadows;
148
- color = saturation(color, 1.0 + u_saturation);
149
- color = color * u_brightness;
150
-
151
- // === IRIDESCENCE ===
152
- if (u_iridescence_enabled > 0.5) {
153
- float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
154
- vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
155
- color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
156
- }
157
-
158
- // === FRESNEL (Rim glow) ===
159
- if (u_fresnel_enabled > 0.5) {
160
- float slope = 1.0 - abs(v_displacement_amount);
161
- float fresnel = pow(max(slope, 0.0), u_fresnel_power);
162
- color += u_fresnel_color * fresnel * u_fresnel_intensity;
163
- }
164
-
165
- // === VIGNETTE ===
166
- if (u_vignette_intensity > 0.0) {
167
- float dist = length(vUv - vec2(0.5));
168
- float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
169
- color *= mix(1.0, vig, u_vignette_intensity);
170
- }
171
-
172
- // === FAKE BLOOM ===
173
- if (u_bloom_intensity > 0.0) {
174
- float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
175
- float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
176
- color += color * bloomMask * u_bloom_intensity;
177
- }
178
-
179
- // === CHROMATIC ABERRATION ===
180
- if (u_chromatic_aberration > 0.0) {
181
- float caAmount = u_chromatic_aberration * 0.008;
182
- float dist = length(vUv - vec2(0.5));
183
- float rShift = v_displacement_amount + caAmount * dist;
184
- float bShift = v_displacement_amount - caAmount * dist;
185
- color.r *= 1.0 + rShift * caAmount * 10.0;
186
- color.b *= 1.0 - bShift * caAmount * 10.0;
187
- }
188
-
189
- // Grain (use cheap hash noise instead of expensive fbm when static)
190
- float grain = 0.0;
191
- if (u_grain_intensity > 0.0) {
192
- vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
193
- if (u_grain_speed != 0.0) {
194
- grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
195
- } else {
196
- // Static grain: use cheap hash instead of fbm
197
- grain = random(noiseCoords) - 0.5;
198
- }
199
-
200
- grain = grain * 0.5 + 0.5;
201
- grain -= 0.5;
202
- grain = (grain > u_grain_sparsity) ? grain : 0.0;
203
- grain *= u_grain_intensity;
204
- }
205
-
206
- color += vec3(grain);
207
-
208
- gl_FragColor = vec4(color, 1.0);
104
+ vec2 finalUv = vFlowUv;
105
+ vec3 baseColor;
106
+ float texAlpha = 1.0;
107
+ if (u_enable_procedural_texture > 0.5) {
108
+ if (u_flat_shading < 0.5) {
109
+ float parallaxFactor = 0.25;
110
+ float scrollOffset = (u_y_offset * u_y_offset_color_multiplier) * parallaxFactor;
111
+ vec3 scrolledPos = vPosition;
112
+ scrolledPos.y -= scrollOffset;
113
+ vec3 p = (scrolledPos * 1.5) / 50.0;
114
+ vec2 uvX = p.yz + vec2(0.5);
115
+ vec2 uvY = p.zx + vec2(0.5);
116
+ vec2 uvZ = p.xy + vec2(0.5);
117
+ vec4 colX = texture2D(u_procedural_texture, uvX);
118
+ vec4 colY = texture2D(u_procedural_texture, uvY);
119
+ vec4 colZ = texture2D(u_procedural_texture, uvZ);
120
+ vec3 n = normalize(vNormal);
121
+ vec3 blendWeights = abs(n);
122
+ blendWeights = blendWeights / (blendWeights.x + blendWeights.y + blendWeights.z + 0.0001);
123
+ vec4 texSample = colX * blendWeights.x + colY * blendWeights.y + colZ * blendWeights.z;
124
+ baseColor = texSample.rgb;
125
+ if (u_transparent_texture_void > 0.5) {
126
+ texAlpha = texSample.a;
209
127
  }
210
- `;function ie(){return`precision highp float;
211
-
128
+ } else {
129
+ vec2 ppp = -1.0 + 2.0 * finalUv;
130
+ ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
131
+ ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
132
+ ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
133
+ ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
134
+ float r = length(ppp);
135
+ float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
136
+ float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
137
+ vec2 texUv = vec2(vx, vy);
138
+ float parallaxFactor = 0.25;
139
+ texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
140
+ texUv *= 1.5;
141
+ vec4 texSample = texture2D(u_procedural_texture, texUv);
142
+ baseColor = texSample.rgb;
143
+ if (u_transparent_texture_void > 0.5) {
144
+ texAlpha = texSample.a;
145
+ }
146
+ }
147
+ } else {
148
+ baseColor = v_color;
149
+ }
150
+ vec3 color = baseColor;
151
+ if (u_domain_warp_enabled > 0.5) {
152
+ vec3 p;
153
+ if (u_flat_shading < 0.5) {
154
+ p = vec3((vPosition / 50.0 + vec3(0.5)) * u_domain_warp_scale);
155
+ p.z += u_time * 0.15;
156
+ } else {
157
+ p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
158
+ }
159
+ vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
160
+ float f = fbm(p + vec3(4.0 * q, 0.0));
161
+ vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
162
+ float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
163
+ color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
164
+ }
165
+ vec3 normal = normalize(vNormal);
166
+ vec3 viewDir = vec3(0.0, 0.0, 1.0);
167
+ float ndotv = dot(normal, viewDir);
168
+ if (u_shape_type > 0.5 && u_shape_type < 3.5) {
169
+ if (ndotv < 0.0) {
170
+ discard;
171
+ }
172
+ } else {
173
+ if (ndotv < 0.0) {
174
+ normal = -normal;
175
+ ndotv = -ndotv;
176
+ }
177
+ }
178
+ vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));
179
+ float diffuse = max(dot(normal, lightDir), 0.0);
180
+ vec3 halfDir = normalize(lightDir + viewDir);
181
+ float specular = pow(max(dot(normal, halfDir), 0.0), 32.0);
182
+ if (u_flat_shading > 0.5) {
183
+ color += v_displacement_amount * u_highlights;
184
+ float heightShadow = 1.0 - v_displacement_amount;
185
+ color -= heightShadow * heightShadow * u_shadows;
186
+ } else {
187
+ color += specular * u_highlights;
188
+ color += v_displacement_amount * u_highlights * 0.5;
189
+ float heightShadow = 1.0 - v_displacement_amount;
190
+ color -= heightShadow * heightShadow * u_shadows * 0.5;
191
+ color -= (1.0 - diffuse) * u_shadows * 0.5;
192
+ }
193
+ color = saturation(color, 1.0 + u_saturation);
194
+ color = color * u_brightness;
195
+ if (u_iridescence_enabled > 0.5) {
196
+ float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
197
+ vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
198
+ color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
199
+ }
200
+ if (u_fresnel_enabled > 0.5) {
201
+ float slope = 1.0 - abs(v_displacement_amount);
202
+ float fresnel = pow(max(slope, 0.0), u_fresnel_power);
203
+ color += u_fresnel_color * fresnel * u_fresnel_intensity;
204
+ }
205
+ if (u_vignette_intensity > 0.0) {
206
+ vec2 vigUv = vUv;
207
+ if (u_flat_shading < 0.5) {
208
+ vigUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
209
+ }
210
+ float dist = length(vigUv - vec2(0.5));
211
+ float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
212
+ color *= mix(1.0, vig, u_vignette_intensity);
213
+ }
214
+ if (u_bloom_intensity > 0.0) {
215
+ float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
216
+ float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
217
+ color += color * bloomMask * u_bloom_intensity;
218
+ }
219
+ if (u_chromatic_aberration > 0.0) {
220
+ float caAmount = u_chromatic_aberration * 0.008;
221
+ vec2 caUv = vUv;
222
+ if (u_flat_shading < 0.5) {
223
+ caUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
224
+ }
225
+ float dist = length(caUv - vec2(0.5));
226
+ float rShift = v_displacement_amount + caAmount * dist;
227
+ float bShift = v_displacement_amount - caAmount * dist;
228
+ color.r *= 1.0 + rShift * caAmount * 10.0;
229
+ color.b *= 1.0 - bShift * caAmount * 10.0;
230
+ }
231
+ float grain = 0.0;
232
+ if (u_grain_intensity > 0.0) {
233
+ vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
234
+ if (u_grain_speed != 0.0 || u_flat_shading > 0.5) {
235
+ grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
236
+ } else {
237
+ grain = random(noiseCoords) - 0.5;
238
+ }
239
+ grain = grain * 0.5 + 0.5;
240
+ grain -= 0.5;
241
+ grain = (grain > u_grain_sparsity) ? grain : 0.0;
242
+ grain *= u_grain_intensity;
243
+ }
244
+ color += vec3(grain);
245
+ float edgeAlpha = 1.0;
246
+ if (u_silhouette_fade > 0.0 && u_flat_shading < 0.5) {
247
+ edgeAlpha = smoothstep(0.0, u_silhouette_fade, ndotv);
248
+ }
249
+ if (u_shape_type == 3.0) {
250
+ float vFade = smoothstep(0.0, u_cylinder_fade, vUv.y) * smoothstep(1.0, 1.0 - u_cylinder_fade, vUv.y);
251
+ edgeAlpha *= vFade;
252
+ } else if (u_shape_type == 4.0) {
253
+ float uFade = smoothstep(0.0, u_ribbon_fade, vUv.x) * smoothstep(1.0, 1.0 - u_ribbon_fade, vUv.x);
254
+ float vFade = smoothstep(0.0, u_ribbon_fade, vUv.y) * smoothstep(1.0, 1.0 - u_ribbon_fade, vUv.y);
255
+ edgeAlpha *= uFade * vFade;
256
+ }
257
+ edgeAlpha *= texAlpha;
258
+ gl_FragColor = vec4(color, edgeAlpha);
259
+ }`;function pe(){return`precision highp float;
212
260
  attribute vec3 position;
213
261
  attribute vec3 normal;
214
262
  attribute vec2 uv;
215
-
216
263
  uniform mat4 modelViewMatrix;
217
264
  uniform mat4 projectionMatrix;
218
-
219
265
  varying vec2 vUv;
220
266
  varying vec2 vFlowUv;
221
267
  varying vec4 v_new_position;
222
268
  varying vec3 v_color;
223
269
  varying float v_displacement_amount;
224
-
270
+ varying vec3 vViewPosition;
271
+ varying vec3 vNormal;
272
+ varying vec3 vPosition;
225
273
  uniform float u_time;
226
274
  uniform vec2 u_resolution;
227
275
  uniform vec2 u_color_pressure;
@@ -231,265 +279,205 @@ uniform float u_wave_amplitude;
231
279
  uniform float u_plane_width;
232
280
  uniform float u_plane_height;
233
281
  uniform float u_color_blending;
234
-
235
282
  uniform int u_colors_count;
236
283
  struct ColorStop {
237
- float is_active;
238
- vec3 color;
239
- float influence;
284
+ float is_active;
285
+ vec3 color;
286
+ float influence;
240
287
  };
241
288
  uniform ColorStop u_colors[6];
242
-
243
289
  uniform float u_y_offset;
244
290
  uniform float u_y_offset_wave_multiplier;
245
291
  uniform float u_y_offset_color_multiplier;
246
292
  uniform float u_y_offset_flow_multiplier;
247
-
248
- // Flow field uniforms
249
293
  uniform float u_flow_distortion_a;
250
294
  uniform float u_flow_distortion_b;
251
295
  uniform float u_flow_scale;
252
296
  uniform float u_flow_ease;
253
297
  uniform float u_flow_enabled;
254
-
255
- // Fresnel uniforms
256
298
  uniform float u_fresnel_enabled;
257
299
  uniform float u_fresnel_power;
258
300
  uniform float u_fresnel_intensity;
259
301
  uniform vec3 u_fresnel_color;
260
- `}function re(){return`precision highp float;
261
-
302
+ uniform float u_shape_type;
303
+ uniform float u_flat_shading;`}function ge(){return`precision highp float;
262
304
  varying vec2 vUv;
263
305
  varying vec2 vFlowUv;
306
+ varying vec4 v_new_position;
264
307
  varying vec3 v_color;
265
308
  varying float v_displacement_amount;
266
-
309
+ varying vec3 vViewPosition;
310
+ varying vec3 vNormal;
311
+ varying vec3 vPosition;
267
312
  uniform float u_time;
268
313
  uniform vec2 u_resolution;
269
314
  uniform float u_plane_height;
270
-
271
315
  uniform float u_shadows;
272
316
  uniform float u_highlights;
273
317
  uniform float u_saturation;
274
318
  uniform float u_brightness;
275
- uniform float u_grain_intensity;
276
- uniform float u_grain_sparsity;
277
- uniform float u_grain_scale;
278
- uniform float u_grain_speed;
279
-
319
+ uniform float u_grain_intensity;
320
+ uniform float u_grain_sparsity;
321
+ uniform float u_grain_scale;
322
+ uniform float u_grain_speed;
280
323
  uniform float u_y_offset;
281
324
  uniform float u_y_offset_color_multiplier;
282
-
283
- // Flow field uniforms
284
325
  uniform float u_flow_distortion_a;
285
326
  uniform float u_flow_distortion_b;
286
327
  uniform float u_flow_scale;
287
-
288
- // Procedural texture uniforms
289
328
  uniform sampler2D u_procedural_texture;
290
329
  uniform float u_enable_procedural_texture;
291
330
  uniform float u_texture_ease;
292
-
293
- // Domain warping uniforms
294
331
  uniform float u_domain_warp_enabled;
295
332
  uniform float u_domain_warp_intensity;
296
333
  uniform float u_domain_warp_scale;
297
-
298
- // Vignette uniforms
299
334
  uniform float u_vignette_intensity;
300
335
  uniform float u_vignette_radius;
301
-
302
- // Fresnel uniforms (fragment side)
303
336
  uniform float u_fresnel_enabled;
304
337
  uniform float u_fresnel_power;
305
338
  uniform float u_fresnel_intensity;
306
339
  uniform vec3 u_fresnel_color;
307
-
308
-
309
-
310
- // Iridescence uniforms
311
340
  uniform float u_iridescence_enabled;
312
341
  uniform float u_iridescence_intensity;
313
342
  uniform float u_iridescence_speed;
314
-
315
- // Bloom uniforms
316
343
  uniform float u_bloom_intensity;
317
344
  uniform float u_bloom_threshold;
318
-
319
- // Chromatic aberration
320
345
  uniform float u_chromatic_aberration;
321
- `}function V(){return`
322
- // 1. REPLACEMENT PERMUTE:
323
- // Uses a hash function (fract/sin) instead of a modular lookup table.
324
- vec4 permute(vec4 x) {
325
- return floor(fract(sin(x) * 43758.5453123) * 289.0);
346
+ uniform float u_shape_type;
347
+ uniform float u_transparent_texture_void;
348
+ uniform float u_silhouette_fade;
349
+ uniform float u_cylinder_fade;
350
+ uniform float u_ribbon_fade;
351
+ uniform float u_flat_shading;`}function te(){return`vec4 permute(vec4 x) {
352
+ return floor(fract(sin(x) * 43758.5453123) * 289.0);
326
353
  }
327
-
328
- // Taylor Inverse Sqrt
329
354
  vec4 taylorInvSqrt(vec4 r) {
330
- return 1.79284291400159 - 0.85373472095314 * r;
355
+ return 1.79284291400159 - 0.85373472095314 * r;
331
356
  }
332
-
333
- // Fade function
334
357
  vec3 fade(vec3 t) {
335
- return t*t*t*(t*(t*6.0-15.0)+10.0);
358
+ return t*t*t*(t*(t*6.0-15.0)+10.0);
336
359
  }
337
-
338
- // 3D Simplex Noise
339
360
  float snoise(vec3 v) {
340
- const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
341
- const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
342
-
343
- // First corner
344
- vec3 i = floor(v + dot(v, C.yyy) );
345
- vec3 x0 = v - i + dot(i, C.xxx) ;
346
-
347
- // Other corners
348
- vec3 g = step(x0.yzx, x0.xyz);
349
- vec3 l = 1.0 - g;
350
- vec3 i1 = min( g.xyz, l.zxy );
351
- vec3 i2 = max( g.xyz, l.zxy );
352
-
353
- vec3 x1 = x0 - i1 + C.xxx;
354
- vec3 x2 = x0 - i2 + C.yyy;
355
- vec3 x3 = x0 - D.yyy;
356
-
357
- // Permutations
358
- vec4 p = permute( permute( permute(
359
- i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
360
- + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
361
- + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
362
-
363
- // Gradients
364
- float n_ = 0.142857142857; // 1.0/7.0
365
- vec3 ns = n_ * D.wyz - D.xzx;
366
-
367
- vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
368
-
369
- vec4 x_ = floor(j * ns.z);
370
- vec4 y_ = floor(j - 7.0 * x_ );
371
-
372
- vec4 x = x_ *ns.x + ns.yyyy;
373
- vec4 y = y_ *ns.x + ns.yyyy;
374
- vec4 h = 1.0 - abs(x) - abs(y);
375
-
376
- vec4 b0 = vec4( x.xy, y.xy );
377
- vec4 b1 = vec4( x.zw, y.zw );
378
-
379
- vec4 s0 = floor(b0)*2.0 + 1.0;
380
- vec4 s1 = floor(b1)*2.0 + 1.0;
381
- vec4 sh = -step(h, vec4(0.0));
382
-
383
- vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
384
- vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
385
-
386
- vec3 p0 = vec3(a0.xy,h.x);
387
- vec3 p1 = vec3(a0.zw,h.y);
388
- vec3 p2 = vec3(a1.xy,h.z);
389
- vec3 p3 = vec3(a1.zw,h.w);
390
-
391
- // Normalise gradients
392
- vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
393
- p0 *= norm.x;
394
- p1 *= norm.y;
395
- p2 *= norm.z;
396
- p3 *= norm.w;
397
-
398
- // Mix final noise value
399
- vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
400
- m = m * m;
401
- return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
402
- dot(p2,x2), dot(p3,x3) ) );
361
+ const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
362
+ const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
363
+ vec3 i = floor(v + dot(v, C.yyy) );
364
+ vec3 x0 = v - i + dot(i, C.xxx) ;
365
+ vec3 g = step(x0.yzx, x0.xyz);
366
+ vec3 l = 1.0 - g;
367
+ vec3 i1 = min( g.xyz, l.zxy );
368
+ vec3 i2 = max( g.xyz, l.zxy );
369
+ vec3 x1 = x0 - i1 + C.xxx;
370
+ vec3 x2 = x0 - i2 + C.yyy;
371
+ vec3 x3 = x0 - D.yyy;
372
+ vec4 p = permute( permute( permute(
373
+ i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
374
+ + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
375
+ + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
376
+ float n_ = 0.142857142857;
377
+ vec3 ns = n_ * D.wyz - D.xzx;
378
+ vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
379
+ vec4 x_ = floor(j * ns.z);
380
+ vec4 y_ = floor(j - 7.0 * x_ );
381
+ vec4 x = x_ *ns.x + ns.yyyy;
382
+ vec4 y = y_ *ns.x + ns.yyyy;
383
+ vec4 h = 1.0 - abs(x) - abs(y);
384
+ vec4 b0 = vec4( x.xy, y.xy );
385
+ vec4 b1 = vec4( x.zw, y.zw );
386
+ vec4 s0 = floor(b0)*2.0 + 1.0;
387
+ vec4 s1 = floor(b1)*2.0 + 1.0;
388
+ vec4 sh = -step(h, vec4(0.0));
389
+ vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
390
+ vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
391
+ vec3 p0 = vec3(a0.xy,h.x);
392
+ vec3 p1 = vec3(a0.zw,h.y);
393
+ vec3 p2 = vec3(a1.xy,h.z);
394
+ vec3 p3 = vec3(a1.zw,h.w);
395
+ vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
396
+ p0 *= norm.x;
397
+ p1 *= norm.y;
398
+ p2 *= norm.z;
399
+ p3 *= norm.w;
400
+ vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
401
+ m = m * m;
402
+ return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
403
+ dot(p2,x2), dot(p3,x3) ) );
403
404
  }
404
-
405
- // Classic Perlin noise
406
405
  float cnoise(vec3 P)
407
406
  {
408
- vec3 Pi0 = floor(P);
409
- vec3 Pi1 = Pi0 + vec3(1.0);
410
-
411
- vec3 Pf0 = fract(P);
412
- vec3 Pf1 = Pf0 - vec3(1.0);
413
- vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
414
- vec4 iy = vec4(Pi0.yy, Pi1.yy);
415
- vec4 iz0 = Pi0.zzzz;
416
- vec4 iz1 = Pi1.zzzz;
417
-
418
- vec4 ixy = permute(permute(ix) + iy);
419
- vec4 ixy0 = permute(ixy + iz0);
420
- vec4 ixy1 = permute(ixy + iz1);
421
-
422
- vec4 gx0 = ixy0 * (1.0 / 7.0);
423
- vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
424
- gx0 = fract(gx0);
425
- vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
426
- vec4 sz0 = step(gz0, vec4(0.0));
427
- gx0 -= sz0 * (step(0.0, gx0) - 0.5);
428
- gy0 -= sz0 * (step(0.0, gy0) - 0.5);
429
-
430
- vec4 gx1 = ixy1 * (1.0 / 7.0);
431
- vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
432
- gx1 = fract(gx1);
433
- vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
434
- vec4 sz1 = step(gz1, vec4(0.0));
435
- gx1 -= sz1 * (step(0.0, gx1) - 0.5);
436
- gy1 -= sz1 * (step(0.0, gy1) - 0.5);
437
-
438
- vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
439
- vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
440
- vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
441
- vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
442
- vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
443
- vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
444
- vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
445
- vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
446
-
447
- vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
448
- g000 *= norm0.x;
449
- g010 *= norm0.y;
450
- g100 *= norm0.z;
451
- g110 *= norm0.w;
452
- vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
453
- g001 *= norm1.x;
454
- g011 *= norm1.y;
455
- g101 *= norm1.z;
456
- g111 *= norm1.w;
457
-
458
- float n000 = dot(g000, Pf0);
459
- float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
460
- float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
461
- float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
462
- float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
463
- float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
464
- float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
465
- float n111 = dot(g111, Pf1);
466
-
467
- vec3 fade_xyz = fade(Pf0);
468
- vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
469
- vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
470
- float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
471
- return 2.2 * n_xyz;
472
- }
473
- `}function X(){return`
474
- vec3 saturation(vec3 rgb, float adjustment) {
475
- const vec3 W = vec3(0.2125, 0.7154, 0.0721);
476
- vec3 intensity = vec3(dot(rgb, W));
477
- return mix(intensity, rgb, adjustment);
478
- }
479
- `}class G{elements;constructor(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}translate(e,r,s){return this.elements[12]+=this.elements[0]*e+this.elements[4]*r+this.elements[8]*s,this.elements[13]+=this.elements[1]*e+this.elements[5]*r+this.elements[9]*s,this.elements[14]+=this.elements[2]*e+this.elements[6]*r+this.elements[10]*s,this.elements[15]+=this.elements[3]*e+this.elements[7]*r+this.elements[11]*s,this}rotateX(e){const r=Math.cos(e),s=Math.sin(e),t=this.elements[4],S=this.elements[5],y=this.elements[6],a=this.elements[7],p=this.elements[8],v=this.elements[9],T=this.elements[10],x=this.elements[11];return this.elements[4]=r*t+s*p,this.elements[5]=r*S+s*v,this.elements[6]=r*y+s*T,this.elements[7]=r*a+s*x,this.elements[8]=r*p-s*t,this.elements[9]=r*v-s*S,this.elements[10]=r*T-s*y,this.elements[11]=r*x-s*a,this}}class oe{left;right;top;bottom;near;far;position;projectionMatrix;constructor(e,r,s,t,S,y){this.left=e,this.right=r,this.top=s,this.bottom=t,this.near=S,this.far=y,this.position=[0,0,0],this.projectionMatrix=new G,this.updateProjectionMatrix()}updateProjectionMatrix(){const e=1/(this.right-this.left),r=1/(this.top-this.bottom),s=1/(this.far-this.near),t=(this.right+this.left)*e,S=(this.top+this.bottom)*r,y=(this.far+this.near)*s;this.projectionMatrix.elements=new Float32Array([2*e,0,0,0,0,2*r,0,0,0,0,-2*s,0,-t,-S,-y,1])}}function j(l,e,r,s=50,t=50){const a=e*r/1e6*s*t/1.5,p=e/r,v=Math.sqrt(a*p),T=a/v;let x=-s/2,h=Math.min((x+v)/1.5,s/2),b=t/4,R=Math.max((b-T)/2,-t/4);if(p<1){const E=p;x=x*E,h=h*E;const g=1.05;x=x*g,h=h*g,b=b*g,R=R*g}l.left=x,l.right=h,l.top=b,l.bottom=R,l.near=-100,l.far=1e3,l.updateProjectionMatrix()}function se(l,e,r,s){const t=l/2,S=e/2,y=Math.floor(r),a=Math.floor(s),p=y+1,v=a+1,T=l/y,x=e/a,h=[],b=[],R=[],E=[];for(let _=0;_<v;_++){const u=_*x-S;for(let m=0;m<p;m++){const n=m*T-t;b.push(n,-u,0),R.push(0,0,1),E.push(m/y),E.push(1-_/a)}}for(let _=0;_<a;_++)for(let u=0;u<y;u++){const m=u+p*_,n=u+p*(_+1),f=u+1+p*(_+1),c=u+1+p*_;h.push(m,n,c),h.push(n,f,c)}const g=b.length/3>65535,A=[];for(let _=0;_<h.length;_+=3){const u=h[_],m=h[_+1],n=h[_+2];A.push(u,m,m,n,n,u)}return{position:new Float32Array(b),normal:new Float32Array(R),uv:new Float32Array(E),index:g?new Uint32Array(h):new Uint16Array(h),wireframeIndex:g?new Uint32Array(A):new Uint16Array(A)}}console.info(`%c\u{1F308} Neat Gradients%c
407
+ vec3 Pi0 = floor(P);
408
+ vec3 Pi1 = Pi0 + vec3(1.0);
409
+ vec3 Pf0 = fract(P);
410
+ vec3 Pf1 = Pf0 - vec3(1.0);
411
+ vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
412
+ vec4 iy = vec4(Pi0.yy, Pi1.yy);
413
+ vec4 iz0 = Pi0.zzzz;
414
+ vec4 iz1 = Pi1.zzzz;
415
+ vec4 ixy = permute(permute(ix) + iy);
416
+ vec4 ixy0 = permute(ixy + iz0);
417
+ vec4 ixy1 = permute(ixy + iz1);
418
+ vec4 gx0 = ixy0 * (1.0 / 7.0);
419
+ vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
420
+ gx0 = fract(gx0);
421
+ vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
422
+ vec4 sz0 = step(gz0, vec4(0.0));
423
+ gx0 -= sz0 * (step(0.0, gx0) - 0.5);
424
+ gy0 -= sz0 * (step(0.0, gy0) - 0.5);
425
+ vec4 gx1 = ixy1 * (1.0 / 7.0);
426
+ vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
427
+ gx1 = fract(gx1);
428
+ vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
429
+ vec4 sz1 = step(gz1, vec4(0.0));
430
+ gx1 -= sz1 * (step(0.0, gx1) - 0.5);
431
+ gy1 -= sz1 * (step(0.0, gy1) - 0.5);
432
+ vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
433
+ vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
434
+ vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
435
+ vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
436
+ vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
437
+ vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
438
+ vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
439
+ vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
440
+ vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
441
+ g000 *= norm0.x;
442
+ g010 *= norm0.y;
443
+ g100 *= norm0.z;
444
+ g110 *= norm0.w;
445
+ vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
446
+ g001 *= norm1.x;
447
+ g011 *= norm1.y;
448
+ g101 *= norm1.z;
449
+ g111 *= norm1.w;
450
+ float n000 = dot(g000, Pf0);
451
+ float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
452
+ float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
453
+ float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
454
+ float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
455
+ float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
456
+ float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
457
+ float n111 = dot(g111, Pf1);
458
+ vec3 fade_xyz = fade(Pf0);
459
+ vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
460
+ vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
461
+ float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
462
+ return 2.2 * n_xyz;
463
+ }`}function ie(){return`vec3 saturation(vec3 rgb, float adjustment) {
464
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);
465
+ vec3 intensity = vec3(dot(rgb, W));
466
+ return mix(intensity, rgb, adjustment);
467
+ }`}class se{elements;constructor(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}identity(){const e=this.elements;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}translate(e,i,r){return this.elements[12]+=this.elements[0]*e+this.elements[4]*i+this.elements[8]*r,this.elements[13]+=this.elements[1]*e+this.elements[5]*i+this.elements[9]*r,this.elements[14]+=this.elements[2]*e+this.elements[6]*i+this.elements[10]*r,this.elements[15]+=this.elements[3]*e+this.elements[7]*i+this.elements[11]*r,this}rotateX(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[4],y=this.elements[5],v=this.elements[6],s=this.elements[7],l=this.elements[8],_=this.elements[9],b=this.elements[10],a=this.elements[11];return this.elements[4]=i*t+r*l,this.elements[5]=i*y+r*_,this.elements[6]=i*v+r*b,this.elements[7]=i*s+r*a,this.elements[8]=i*l-r*t,this.elements[9]=i*_-r*y,this.elements[10]=i*b-r*v,this.elements[11]=i*a-r*s,this}rotateY(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[0],y=this.elements[1],v=this.elements[2],s=this.elements[3],l=this.elements[8],_=this.elements[9],b=this.elements[10],a=this.elements[11];return this.elements[0]=i*t-r*l,this.elements[1]=i*y-r*_,this.elements[2]=i*v-r*b,this.elements[3]=i*s-r*a,this.elements[8]=r*t+i*l,this.elements[9]=r*y+i*_,this.elements[10]=r*v+i*b,this.elements[11]=r*s+i*a,this}rotateZ(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[0],y=this.elements[1],v=this.elements[2],s=this.elements[3],l=this.elements[4],_=this.elements[5],b=this.elements[6],a=this.elements[7];return this.elements[0]=i*t+r*l,this.elements[1]=i*y+r*_,this.elements[2]=i*v+r*b,this.elements[3]=i*s+r*a,this.elements[4]=-r*t+i*l,this.elements[5]=-r*y+i*_,this.elements[6]=-r*v+i*b,this.elements[7]=-r*s+i*a,this}}class ye{left;right;top;bottom;near;far;position;projectionMatrix;zoom;constructor(e,i,r,t,y,v){this.left=e,this.right=i,this.top=r,this.bottom=t,this.near=y,this.far=v,this.position=[0,0,0],this.zoom=1,this.projectionMatrix=new se,this.updateProjectionMatrix()}updateProjectionMatrix(){const e=1/(this.right-this.left),i=1/(this.top-this.bottom),r=1/(this.far-this.near),t=(this.right+this.left)*e,y=(this.top+this.bottom)*i,v=(this.far+this.near)*r;this.projectionMatrix.elements=new Float32Array([2*e,0,0,0,0,2*i,0,0,0,0,-2*r,0,-t,-y,-v,1])}}function H(n,e,i,r=50,t=50,y="plane",v=1){n.zoom=v;const s=e/i;if(y==="plane"){const b=e*i/1e6*r*t/1.5,a=Math.sqrt(b*s),h=b/a;let p=-r/2,c=Math.min((p+a)/1.5,r/2),d=t/4,R=Math.max((d-h)/2,-t/4);if(s<1){const g=s;p=p*g,c=c*g;const x=1.05;p=p*x,c=c*x,d=d*x,R=R*x}n.left=p,n.right=c,n.top=d,n.bottom=R}else{let l=25;if(y==="sphere"?l=30:y==="torus"?l=35:y==="cylinder"&&(l=30),s>=1)n.left=-l*s,n.right=l*s,n.top=l,n.bottom=-l;else{n.left=-l,n.right=l,n.top=l/s,n.bottom=-l/s;const _=1.05;n.left*=_,n.right*=_,n.top*=_,n.bottom*=_}}n.left/=v,n.right/=v,n.top/=v,n.bottom/=v,n.near=-100,n.far=1e3,n.updateProjectionMatrix()}function re(n,e,i,r){const t=n/2,y=e/2,v=Math.floor(i),s=Math.floor(r),l=v+1,_=s+1,b=n/v,a=e/s,h=[],p=[],c=[],d=[];for(let x=0;x<_;x++){const w=x*a-y;for(let u=0;u<l;u++){const T=u*b-t;p.push(T,-w,0),c.push(0,0,1),d.push(u/v),d.push(1-x/s)}}for(let x=0;x<s;x++)for(let w=0;w<v;w++){const u=w+l*x,T=w+l*(x+1),A=w+1+l*(x+1),D=w+1+l*x;h.push(u,T,D),h.push(T,A,D)}const R=p.length/3>65535,g=[];for(let x=0;x<h.length;x+=3){const w=h[x],u=h[x+1],T=h[x+2];g.push(w,u,u,T,T,w)}return{position:new Float32Array(p),normal:new Float32Array(c),uv:new Float32Array(d),index:R?new Uint32Array(h):new Uint16Array(h),wireframeIndex:R?new Uint32Array(g):new Uint16Array(g)}}function oe(n,e,i){const r=[],t=[],y=[],v=[],s=Math.floor(e),l=Math.floor(i);for(let a=0;a<=l;a++){const h=a/l,p=h*Math.PI;for(let c=0;c<=s;c++){const d=c/s,R=d*Math.PI*2,g=-n*Math.sin(p)*Math.cos(R),x=n*Math.cos(p),w=n*Math.sin(p)*Math.sin(R);r.push(g,x,w);const u=Math.sqrt(g*g+x*x+w*w);t.push(g/u,x/u,w/u),y.push(d,1-h)}}for(let a=0;a<l;a++)for(let h=0;h<s;h++){const p=h+(s+1)*a,c=h+(s+1)*(a+1),d=h+1+(s+1)*(a+1),R=h+1+(s+1)*a;v.push(p,c,R),v.push(c,d,R)}const _=r.length/3>65535,b=[];for(let a=0;a<v.length;a+=3){const h=v[a],p=v[a+1],c=v[a+2];b.push(h,p,p,c,c,h)}return{position:new Float32Array(r),normal:new Float32Array(t),uv:new Float32Array(y),index:_?new Uint32Array(v):new Uint16Array(v),wireframeIndex:_?new Uint32Array(b):new Uint16Array(b)}}function ne(n,e,i,r){const t=[],y=[],v=[],s=[],l=Math.floor(i),_=Math.floor(r);for(let h=0;h<=l;h++){const p=h/l*Math.PI*2;for(let c=0;c<=_;c++){const d=c/_*Math.PI*2,R=(n+e*Math.cos(p))*Math.cos(d),g=(n+e*Math.cos(p))*Math.sin(d),x=e*Math.sin(p);t.push(R,g,x);const w=n*Math.cos(d),u=n*Math.sin(d),T=R-w,A=g-u,D=x,m=Math.sqrt(T*T+A*A+D*D);y.push(T/m,A/m,D/m),v.push(c/_,h/l)}}for(let h=1;h<=l;h++)for(let p=1;p<=_;p++){const c=(_+1)*h+p-1,d=(_+1)*(h-1)+p-1,R=(_+1)*(h-1)+p,g=(_+1)*h+p;s.push(c,d,g),s.push(d,R,g)}const b=t.length/3>65535,a=[];for(let h=0;h<s.length;h+=3){const p=s[h],c=s[h+1],d=s[h+2];a.push(p,c,c,d,d,p)}return{position:new Float32Array(t),normal:new Float32Array(y),uv:new Float32Array(v),index:b?new Uint32Array(s):new Uint16Array(s),wireframeIndex:b?new Uint32Array(a):new Uint16Array(a)}}function ae(n,e,i,r,t){const y=[],v=[],s=[],l=[],_=Math.floor(r),b=Math.floor(t),a=i/2;for(let c=0;c<=b;c++){const d=c/b,R=d*i-a,g=d*(e-n)+n;for(let x=0;x<=_;x++){const w=x/_,u=w*Math.PI*2,T=Math.sin(u),A=Math.cos(u);y.push(g*T,-R,g*A),v.push(T,0,A),s.push(w,1-d)}}for(let c=0;c<b;c++)for(let d=0;d<_;d++){const R=d+(_+1)*c,g=d+(_+1)*(c+1),x=d+1+(_+1)*(c+1),w=d+1+(_+1)*c;l.push(R,g,w),l.push(g,x,w)}const h=y.length/3>65535,p=[];for(let c=0;c<l.length;c+=3){const d=l[c],R=l[c+1],g=l[c+2];p.push(d,R,R,g,g,d)}return{position:new Float32Array(y),normal:new Float32Array(v),uv:new Float32Array(s),index:h?new Uint32Array(l):new Uint16Array(l),wireframeIndex:h?new Uint32Array(p):new Uint16Array(p)}}function le(n,e,i,r,t,y){const v=n/2,s=e/2,l=Math.floor(i),_=Math.floor(r),b=l+1,a=_+1,h=n/l,p=e/_,c=[],d=[],R=[],g=[];for(let u=0;u<a;u++){const T=u*p-s;for(let A=0;A<b;A++){const D=A*h-v;let m=D,F=T,C=0,z=0,M=0,P=1;if(Math.abs(t)>.001){const E=n/t,S=D/E;m=E*Math.sin(S),C=E*(1-Math.cos(S)),z=Math.sin(S),P=Math.cos(S)}if(Math.abs(y)>.001){const E=T/e*y,S=Math.cos(E),U=Math.sin(E),B=m*S-C*U,O=m*U+C*S;m=B,C=O;const I=z*S-P*U,Y=z*U+P*S;z=I,P=Y}c.push(m,-F,C),d.push(z,M,P),R.push(A/l),R.push(1-u/_)}}for(let u=0;u<_;u++)for(let T=0;T<l;T++){const A=T+b*u,D=T+b*(u+1),m=T+1+b*(u+1),F=T+1+b*u;g.push(A,D,F),g.push(D,m,F)}const x=c.length/3>65535,w=[];for(let u=0;u<g.length;u+=3){const T=g[u],A=g[u+1],D=g[u+2];w.push(T,A,A,D,D,T)}return{position:new Float32Array(c),normal:new Float32Array(d),uv:new Float32Array(R),index:x?new Uint32Array(g):new Uint16Array(g),wireframeIndex:x?new Uint32Array(w):new Uint16Array(w)}}console.info(`%c\u{1F308} Neat Gradients%c
480
468
 
481
469
  Licensed under MIT + The Commons Clause.
482
470
  Free for personal and commercial use.
483
471
  Selling this software or its derivatives is strictly prohibited.
484
- https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const Y=50,H=80,L=6,ne=fe();class ae{_ref;_speed=-1;_horizontalPressure=-1;_verticalPressure=-1;_waveFrequencyX=-1;_waveFrequencyY=-1;_waveAmplitude=-1;_shadows=-1;_highlights=-1;_saturation=-1;_brightness=-1;_grainScale=-1;_grainIntensity=-1;_grainSparsity=-1;_grainSpeed=-1;_colorBlending=-1;_colors=[];_wireframe=!1;_backgroundColor="#FFFFFF";_backgroundColorRgb=[1,1,1];_backgroundAlpha=1;_flowDistortionA=0;_flowDistortionB=0;_flowScale=1;_flowEase=0;_flowEnabled=!0;glState;_enableProceduralTexture=!1;_textureVoidLikelihood=.45;_textureVoidWidthMin=200;_textureVoidWidthMax=486;_textureBandDensity=2.15;_textureColorBlending=.01;_textureSeed=333;_textureEase=.5;_domainWarpEnabled=!1;_domainWarpIntensity=.5;_domainWarpScale=1;_vignetteIntensity=.5;_vignetteRadius=.8;_fresnelEnabled=!1;_fresnelPower=2;_fresnelIntensity=.5;_fresnelColor="#FFFFFF";_fresnelColorRgb=[1,1,1];_iridescenceEnabled=!1;_iridescenceIntensity=.5;_iridescenceSpeed=1;_bloomIntensity=0;_bloomThreshold=.7;_chromaticAberration=0;_proceduralTexture=null;_proceduralBackgroundColor="#000000";_textureShapeTriangles=20;_textureShapeCircles=15;_textureShapeBars=15;_textureShapeSquiggles=10;requestRef=-1;sizeObserver;_initialized=!1;_linkElement=null;_cachedColorRgb=[];_yOffset=0;_yOffsetWaveMultiplier=.004;_yOffsetColorMultiplier=.004;_yOffsetFlowMultiplier=.004;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_linkCheckCounter=0;_colorsChanged=!0;_uniformsDirty=!0;_textureDirty=!0;constructor(e){const{ref:r,speed:s=4,horizontalPressure:t=3,verticalPressure:S=3,waveFrequencyX:y=5,waveFrequencyY:a=5,waveAmplitude:p=3,colors:v,highlights:T=4,shadows:x=4,colorSaturation:h=0,colorBrightness:b=1,colorBlending:R=5,grainScale:E=2,grainIntensity:g=.55,grainSparsity:A=0,grainSpeed:_=.1,wireframe:u=!1,backgroundColor:m="#FFFFFF",backgroundAlpha:n=1,resolution:f=1,seed:c,yOffset:d=0,yOffsetWaveMultiplier:C=4,yOffsetColorMultiplier:D=4,yOffsetFlowMultiplier:M=4,flowDistortionA:U=0,flowDistortionB:k=0,flowScale:q=1,flowEase:z=0,flowEnabled:w=!0,enableProceduralTexture:B=!1,textureVoidLikelihood:he=.45,textureVoidWidthMin:de=200,textureVoidWidthMax:me=486,textureBandDensity:pe=2.15,textureColorBlending:ge=.01,textureSeed:xe=333,textureEase:ye=.5,proceduralBackgroundColor:ve="#000000",textureShapeTriangles:be=20,textureShapeCircles:we=15,textureShapeBars:Se=15,textureShapeSquiggles:Ee=10,domainWarpEnabled:Te=!1,domainWarpIntensity:Re=.5,domainWarpScale:Ae=1,vignetteIntensity:Ce=.5,vignetteRadius:Pe=.8,fresnelEnabled:De=!1,fresnelPower:ze=2,fresnelIntensity:Fe=.5,fresnelColor:Ie="#FFFFFF",iridescenceEnabled:Me=!1,iridescenceIntensity:Ue=.5,iridescenceSpeed:Be=1,bloomIntensity:Oe=0,bloomThreshold:Le=.7,chromaticAberration:Ne=0}=e;this._ref=r,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=s,this.horizontalPressure=t,this.verticalPressure=S,this.waveFrequencyX=y,this.waveFrequencyY=a,this.waveAmplitude=p,this.colorBlending=R,this.grainScale=E,this.grainIntensity=g,this.grainSparsity=A,this.grainSpeed=_,this.colors=v,this.shadows=x,this.highlights=T,this.colorSaturation=h,this.colorBrightness=b,this.wireframe=u,this.backgroundColor=m,this.backgroundAlpha=n,this.yOffset=d,this.yOffsetWaveMultiplier=C,this.yOffsetColorMultiplier=D,this.yOffsetFlowMultiplier=M,this.flowDistortionA=U,this.flowDistortionB=k,this.flowScale=q,this.flowEase=z,this.flowEnabled=w,this.enableProceduralTexture=B,this.textureVoidLikelihood=he,this.textureVoidWidthMin=de,this.textureVoidWidthMax=me,this.textureBandDensity=pe,this.textureColorBlending=ge,this.textureSeed=xe,this.textureEase=ye,this._proceduralBackgroundColor=ve,this._textureShapeTriangles=be,this._textureShapeCircles=we,this._textureShapeBars=Se,this._textureShapeSquiggles=Ee,this.domainWarpEnabled=Te,this.domainWarpIntensity=Re,this.domainWarpScale=Ae,this.vignetteIntensity=Ce,this.vignetteRadius=Pe,this.fresnelEnabled=De,this.fresnelPower=ze,this.fresnelIntensity=Fe,this.fresnelColor=Ie,this.iridescenceEnabled=Me,this.iridescenceIntensity=Ue,this.iridescenceSpeed=Be,this.bloomIntensity=Oe,this.bloomThreshold=Le,this.chromaticAberration=Ne,this.glState=this._initScene(f),ce();let K=c!==void 0?c:ue(),Z=performance.now();const J=()=>{const{gl:i,program:N,locations:o,indexCount:O,indexType:W}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=le(r))),this._initialized){const Q=performance.now();if(K+=(Q-Z)/1e3*this._speed,Z=Q,i.useProgram(N),i.uniform1f(o.uniforms.u_time,K),this._uniformsDirty&&(i.uniform2f(o.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),i.uniform2f(o.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),i.uniform1f(o.uniforms.u_wave_frequency_x,this._waveFrequencyX),i.uniform1f(o.uniforms.u_wave_frequency_y,this._waveFrequencyY),i.uniform1f(o.uniforms.u_wave_amplitude,this._waveAmplitude),i.uniform1f(o.uniforms.u_color_blending,this._colorBlending),i.uniform1f(o.uniforms.u_shadows,this._shadows),i.uniform1f(o.uniforms.u_highlights,this._highlights),i.uniform1f(o.uniforms.u_saturation,this._saturation),i.uniform1f(o.uniforms.u_brightness,this._brightness),i.uniform1f(o.uniforms.u_grain_intensity,this._grainIntensity),i.uniform1f(o.uniforms.u_grain_sparsity,this._grainSparsity),i.uniform1f(o.uniforms.u_grain_speed,this._grainSpeed),i.uniform1f(o.uniforms.u_grain_scale,this._grainScale),i.uniform1f(o.uniforms.u_y_offset,this._yOffset),i.uniform1f(o.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),i.uniform1f(o.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),i.uniform1f(o.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),i.uniform1f(o.uniforms.u_flow_distortion_a,this._flowDistortionA),i.uniform1f(o.uniforms.u_flow_distortion_b,this._flowDistortionB),i.uniform1f(o.uniforms.u_flow_scale,this._flowScale),i.uniform1f(o.uniforms.u_flow_ease,this._flowEase),i.uniform1f(o.uniforms.u_flow_enabled,this._flowEnabled?1:0),i.uniform1f(o.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),i.uniform1f(o.uniforms.u_texture_ease,this._textureEase),i.uniform1f(o.uniforms.u_domain_warp_enabled,this._domainWarpEnabled?1:0),i.uniform1f(o.uniforms.u_domain_warp_intensity,this._domainWarpIntensity),i.uniform1f(o.uniforms.u_domain_warp_scale,this._domainWarpScale),i.uniform1f(o.uniforms.u_vignette_intensity,this._vignetteIntensity),i.uniform1f(o.uniforms.u_vignette_radius,this._vignetteRadius),i.uniform1f(o.uniforms.u_fresnel_enabled,this._fresnelEnabled?1:0),i.uniform1f(o.uniforms.u_fresnel_power,this._fresnelPower),i.uniform1f(o.uniforms.u_fresnel_intensity,this._fresnelIntensity),i.uniform3fv(o.uniforms.u_fresnel_color,this._fresnelColorRgb),i.uniform1f(o.uniforms.u_iridescence_enabled,this._iridescenceEnabled?1:0),i.uniform1f(o.uniforms.u_iridescence_intensity,this._iridescenceIntensity),i.uniform1f(o.uniforms.u_iridescence_speed,this._iridescenceSpeed),i.uniform1f(o.uniforms.u_bloom_intensity,this._bloomIntensity),i.uniform1f(o.uniforms.u_bloom_threshold,this._bloomThreshold),i.uniform1f(o.uniforms.u_chromatic_aberration,this._chromaticAberration),this._uniformsDirty=!1),this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&i.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(i),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._proceduralTexture),i.uniform1i(o.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let P=0;P<L;P++)if(P<this._colors.length){const ee=this._colors[P],ke=this._cachedColorRgb[P]||[0,0,0];i.uniform1f(o.uniforms[`u_colors[${P}].is_active`],ee.enabled?1:0),i.uniform3fv(o.uniforms[`u_colors[${P}].color`],ke),i.uniform1f(o.uniforms[`u_colors[${P}].influence`],ee.influence||0)}else i.uniform1f(o.uniforms[`u_colors[${P}].is_active`],0);i.uniform1i(o.uniforms.u_colors_count,L)}}i.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT),this._wireframe?(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),i.drawElements(i.LINES,this.glState.wireframeIndexCount,W,0),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):i.drawElements(i.TRIANGLES,O,W,0),this.requestRef=requestAnimationFrame(J)},We=()=>{const{gl:i,camera:N}=this.glState,o=this._ref.clientWidth,O=this._ref.clientHeight;this._ref.width=o,this._ref.height=O,i.viewport(0,0,o,O),j(N,o,O);const W=i.getUniformLocation(this.glState.program,"projectionMatrix");i.useProgram(this.glState.program),i.uniformMatrix4fv(W,!1,N.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{We(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(r),J()}destroy(){if(cancelAnimationFrame(this.requestRef),this.sizeObserver.disconnect(),this._resizeTimeoutId!==null&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=null),this._linkElement&&this._linkElement.parentElement&&(this._linkElement.parentElement.removeChild(this._linkElement),this._linkElement=null),this.glState){const e=this.glState.gl;e.deleteProgram(this.glState.program),e.deleteBuffer(this.glState.buffers.position),e.deleteBuffer(this.glState.buffers.normal),e.deleteBuffer(this.glState.buffers.uv),e.deleteBuffer(this.glState.buffers.index),e.deleteBuffer(this.glState.buffers.wireframeIndex)}this._proceduralTexture&&this.glState&&this.glState.gl.deleteTexture(this._proceduralTexture)}downloadAsPNG(e="neat.png"){const r=this._ref.toDataURL("image/png");_e(r,e)}set speed(e){this._uniformsDirty=!0,this._speed=e/20}set horizontalPressure(e){this._uniformsDirty=!0,this._horizontalPressure=e/4}set verticalPressure(e){this._uniformsDirty=!0,this._verticalPressure=e/4}set waveFrequencyX(e){this._uniformsDirty=!0,this._waveFrequencyX=e*.04}set waveFrequencyY(e){this._uniformsDirty=!0,this._waveFrequencyY=e*.04}set waveAmplitude(e){this._uniformsDirty=!0,this._waveAmplitude=e*.75}set colors(e){this._uniformsDirty=!0,this._colors=e,this._cachedColorRgb=e.map(r=>this._hexToRgb(r.color)),this._colorsChanged=!0}set highlights(e){this._uniformsDirty=!0,this._highlights=e/100}set shadows(e){this._uniformsDirty=!0,this._shadows=e/100}set colorSaturation(e){this._uniformsDirty=!0,this._saturation=e/10}set colorBrightness(e){this._uniformsDirty=!0,this._brightness=e}set colorBlending(e){this._uniformsDirty=!0,this._colorBlending=e/10}set grainScale(e){this._uniformsDirty=!0,this._grainScale=e==0?1:e}set grainIntensity(e){this._uniformsDirty=!0,this._grainIntensity=e}set grainSparsity(e){this._uniformsDirty=!0,this._grainSparsity=e}set grainSpeed(e){this._uniformsDirty=!0,this._grainSpeed=e}set wireframe(e){this._uniformsDirty=!0,this._wireframe=e}set resolution(e){if(this._uniformsDirty=!0,this.glState){const r=this.glState.gl;r.deleteProgram(this.glState.program),r.deleteBuffer(this.glState.buffers.position),r.deleteBuffer(this.glState.buffers.normal),r.deleteBuffer(this.glState.buffers.uv),r.deleteBuffer(this.glState.buffers.index),r.deleteBuffer(this.glState.buffers.wireframeIndex)}this.glState=this._initScene(e)}set backgroundColor(e){this._uniformsDirty=!0,this._backgroundColor=e,this._backgroundColorRgb=this._hexToRgb(e)}set backgroundAlpha(e){this._uniformsDirty=!0,this._backgroundAlpha=e}set yOffset(e){this._uniformsDirty=!0,this._yOffset=e}get yOffsetWaveMultiplier(){return this._yOffsetWaveMultiplier*1e3}set yOffsetWaveMultiplier(e){this._uniformsDirty=!0,this._yOffsetWaveMultiplier=e/1e3}get yOffsetColorMultiplier(){return this._yOffsetColorMultiplier*1e3}set yOffsetColorMultiplier(e){this._uniformsDirty=!0,this._yOffsetColorMultiplier=e/1e3}get yOffsetFlowMultiplier(){return this._yOffsetFlowMultiplier*1e3}set yOffsetFlowMultiplier(e){this._uniformsDirty=!0,this._yOffsetFlowMultiplier=e/1e3}set flowDistortionA(e){this._uniformsDirty=!0,this._flowDistortionA=e}set flowDistortionB(e){this._uniformsDirty=!0,this._flowDistortionB=e}set flowScale(e){this._uniformsDirty=!0,this._flowScale=e}set flowEase(e){this._uniformsDirty=!0,this._flowEase=e}set flowEnabled(e){this._uniformsDirty=!0,this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}set enableProceduralTexture(e){this._uniformsDirty=!0,this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidLikelihood(e){this._uniformsDirty=!0,this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMin(e){this._uniformsDirty=!0,this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMax(e){this._uniformsDirty=!0,this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureBandDensity(e){this._uniformsDirty=!0,this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureColorBlending(e){this._uniformsDirty=!0,this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureSeed(e){this._uniformsDirty=!0,this._textureSeed=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureEase(){return this._textureEase}set textureEase(e){this._uniformsDirty=!0,this._textureEase=e}set proceduralBackgroundColor(e){this._uniformsDirty=!0,this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeTriangles(e){this._uniformsDirty=!0,this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeCircles(e){this._uniformsDirty=!0,this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeBars(e){this._uniformsDirty=!0,this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeSquiggles(e){this._uniformsDirty=!0,this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_hexToRgb(e){const r=parseInt(e.replace("#",""),16);return[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]}_initScene(e){const r=this._ref.clientWidth,s=this._ref.clientHeight,t=this._ref.getContext("webgl2",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0})||this._ref.getContext("webgl",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0});if(!t)throw new Error("WebGL not supported");t.getExtension("OES_standard_derivatives"),t.getExtension("OES_element_index_uint"),t.viewport(0,0,r,s);const{position:S,normal:y,uv:a,index:p,wireframeIndex:v}=se(Y,H,240*e,240*e),T=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,T),t.bufferData(t.ARRAY_BUFFER,S,t.STATIC_DRAW);const x=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,x),t.bufferData(t.ARRAY_BUFFER,y,t.STATIC_DRAW);const h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,a,t.STATIC_DRAW);const b=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,b),t.bufferData(t.ELEMENT_ARRAY_BUFFER,p,t.STATIC_DRAW);const R=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,R),t.bufferData(t.ELEMENT_ARRAY_BUFFER,v,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,b);const E=ie()+`
485
- `+V()+`
486
- `+X()+`
487
- `+I,g=t.createShader(t.VERTEX_SHADER);t.shaderSource(g,E),t.compileShader(g),t.getShaderParameter(g,t.COMPILE_STATUS)||(console.log("VERTEX_SHADER_ERROR_START"),console.log("Vertex shader error: ",t.getShaderInfoLog(g)),console.log("GL Error Code:",t.getError()),console.log("Vertex Shader Source Dump:"),console.log(E.split(`
488
- `).map((w,B)=>`${B+1}: ${w}`).join(`
489
- `)),console.log("VERTEX_SHADER_ERROR_END"));const A=re()+`
490
- `+X()+`
491
- `+V()+`
492
- `+te,_=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(_,A),t.compileShader(_),t.getShaderParameter(_,t.COMPILE_STATUS)||(console.log("FRAGMENT_SHADER_ERROR_START"),console.log("Fragment shader error: ",t.getShaderInfoLog(_)),console.log("GL Error Code:",t.getError()),console.log("Fragment Shader Source Dump:"),console.log(A.split(`
493
- `).map((w,B)=>`${B+1}: ${w}`).join(`
494
- `)),console.log("FRAGMENT_SHADER_ERROR_END"));const u=t.createProgram();t.attachShader(u,g),t.attachShader(u,_),t.linkProgram(u),t.getProgramParameter(u,t.LINK_STATUS)||(console.log("PROGRAM_LINK_ERROR_START"),console.log("Program linking error: ",t.getProgramInfoLog(u)),console.log("GL Error Code:",t.getError()),console.log("PROGRAM_LINK_ERROR_END")),t.useProgram(u);const m=new oe(0,0,0,0,0,1e3);m.position=[0,0,5],j(m,r,s);const n=t.getAttribLocation(u,"position"),f=t.getAttribLocation(u,"normal"),c=t.getAttribLocation(u,"uv");t.enableVertexAttribArray(n),t.bindBuffer(t.ARRAY_BUFFER,T),t.vertexAttribPointer(n,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(f),t.bindBuffer(t.ARRAY_BUFFER,x),t.vertexAttribPointer(f,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,b);const d=new G;d.translate(-m.position[0],-m.position[1],-m.position[2]),d.translate(0,0,-1),d.rotateX(-Math.PI/3.5);const C=t.getUniformLocation(u,"modelViewMatrix");t.uniformMatrix4fv(C,!1,d.elements);const D=t.getUniformLocation(u,"projectionMatrix");t.uniformMatrix4fv(D,!1,m.projectionMatrix.elements);const M=t.getUniformLocation(u,"u_plane_width");t.uniform1f(M,Y);const U=t.getUniformLocation(u,"u_plane_height");t.uniform1f(U,H);const k=t.getUniformLocation(u,"u_colors_count");t.uniform1i(k,L);const q=["u_time","u_resolution","u_color_pressure","u_wave_frequency_x","u_wave_frequency_y","u_wave_amplitude","u_colors_count","u_plane_width","u_plane_height","u_shadows","u_highlights","u_grain_intensity","u_grain_sparsity","u_grain_scale","u_grain_speed","u_flow_distortion_a","u_flow_distortion_b","u_flow_scale","u_flow_ease","u_flow_enabled","u_y_offset","u_y_offset_wave_multiplier","u_y_offset_color_multiplier","u_y_offset_flow_multiplier","u_procedural_texture","u_enable_procedural_texture","u_texture_ease","u_saturation","u_brightness","u_color_blending","u_domain_warp_enabled","u_domain_warp_intensity","u_domain_warp_scale","u_vignette_intensity","u_vignette_radius","u_fresnel_enabled","u_fresnel_power","u_fresnel_intensity","u_fresnel_color","u_iridescence_enabled","u_iridescence_intensity","u_iridescence_speed","u_bloom_intensity","u_bloom_threshold","u_chromatic_aberration"],z={attributes:{position:n,normal:f,uv:c},uniforms:{}};q.forEach(w=>{z.uniforms[w]=t.getUniformLocation(u,w)});for(let w=0;w<L;w++)z.uniforms[`u_colors[${w}].is_active`]=t.getUniformLocation(u,`u_colors[${w}].is_active`),z.uniforms[`u_colors[${w}].color`]=t.getUniformLocation(u,`u_colors[${w}].color`),z.uniforms[`u_colors[${w}].influence`]=t.getUniformLocation(u,`u_colors[${w}].influence`);return this._initialized=!0,this._uniformsDirty=!0,this._colorsChanged=!0,this._textureDirty=!0,t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.DEPTH_TEST),{gl:t,program:u,buffers:{position:T,normal:x,uv:h,index:b,wireframeIndex:R},locations:z,camera:m,indexCount:p.length,wireframeIndexCount:v.length,indexType:p instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){const s=document.createElement("canvas");s.width=1024,s.height=1024;const t=s.getContext("2d",{willReadFrequently:!0});if(!t)return null;let S=this._textureSeed;const y=this._textureSeed;function a(){const n=Math.sin(S++)*1e4;return n-Math.floor(n)}const p=n=>{S=y+n},v=this._colors.filter(n=>n.enabled).map(n=>n.color);if(v.length===0)return null;function T(n){const f=parseInt(n.replace("#",""),16);return{r:f>>16&255,g:f>>8&255,b:f&255}}function x(n,f,c){return"#"+((1<<24)+(Math.round(n)<<16)+(Math.round(f)<<8)+Math.round(c)).toString(16).slice(1).padStart(6,"0")}const h=()=>{const n=v[Math.floor(a()*v.length)],f=v[Math.floor(a()*v.length)],c=a()*this._textureColorBlending,d=T(n),C=T(f),D=d.r+(C.r-d.r)*c,M=d.g+(C.g-d.g)*c,U=d.b+(C.b-d.b)*c;return x(D,M,U)},b=this._proceduralBackgroundColor||"#000000";t.fillStyle=b,t.fillRect(0,0,1024,1024);const R=t.createLinearGradient(0,0,0,1024);R.addColorStop(0,h()),R.addColorStop(1,h()),t.fillStyle=R,t.fillRect(0,0,1024,1024);for(let n=0;n<this._textureShapeTriangles;n++){t.fillStyle=h(),t.beginPath();const f=a()*1024,c=a()*1024,d=100+a()*300;t.moveTo(f,c),t.lineTo(f+(a()-.5)*d,c+(a()-.5)*d),t.lineTo(f+(a()-.5)*d,c+(a()-.5)*d),t.fill()}for(let n=0;n<this._textureShapeCircles;n++){t.strokeStyle=h(),t.lineWidth=10+a()*50,t.beginPath();const f=a()*1024,c=a()*1024,d=50+a()*150;t.arc(f,c,d,0,Math.PI*2),t.stroke()}for(let n=0;n<this._textureShapeBars;n++)t.fillStyle=h(),t.save(),t.translate(a()*1024,a()*1024),t.rotate(a()*Math.PI),t.fillRect(-150,-25,300,50),t.restore();t.lineWidth=15,t.lineCap="round";for(let n=0;n<this._textureShapeSquiggles;n++){t.strokeStyle=h(),t.beginPath();let f=a()*1024,c=a()*1024;t.moveTo(f,c);for(let d=0;d<4;d++)t.bezierCurveTo(f+(a()-.5)*300,c+(a()-.5)*300,f+(a()-.5)*300,c+(a()-.5)*300,f+(a()-.5)*300,c+(a()-.5)*300),f+=(a()-.5)*300,c+=(a()-.5)*300;t.stroke()}p(5e4);const E=document.createElement("canvas");E.width=1024,E.height=1024;const g=E.getContext("2d",{willReadFrequently:!0});if(!g)return null;g.fillStyle=b,g.fillRect(0,0,1024,1024);let A=0;const _=[];for(;A<1024;)if(a()<this._textureVoidLikelihood){const f=this._textureVoidWidthMin+a()*(this._textureVoidWidthMax-this._textureVoidWidthMin);_.push({type:"void",x:A,width:f}),A+=f}else{const f=50+a()*200;_.push({type:"matter",x:A,width:f}),A+=f}for(const n of _)if(n.type==="matter"){const f=n.x,c=Math.min(n.x+n.width,1024);let d=f;for(;d<c;){const C=(2+a()*20)/this._textureBandDensity,D=Math.floor(a()*1024);g.drawImage(s,D,0,C,1024,d,0,C,1024),d+=C}}const u=e.createTexture();e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,E),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.generateMipmap(e.TEXTURE_2D);const m=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(m){const n=e.getParameter(m.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,m.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,n))}return u}set domainWarpEnabled(e){this._domainWarpEnabled!==e&&(this._domainWarpEnabled=e,this._uniformsDirty=!0)}set domainWarpIntensity(e){this._domainWarpIntensity!==e&&(this._domainWarpIntensity=e,this._uniformsDirty=!0)}set domainWarpScale(e){this._domainWarpScale!==e&&(this._domainWarpScale=e,this._uniformsDirty=!0)}set vignetteIntensity(e){this._vignetteIntensity!==e&&(this._vignetteIntensity=e,this._uniformsDirty=!0)}set vignetteRadius(e){this._vignetteRadius!==e&&(this._vignetteRadius=e,this._uniformsDirty=!0)}set fresnelEnabled(e){this._fresnelEnabled!==e&&(this._fresnelEnabled=e,this._uniformsDirty=!0)}set fresnelPower(e){this._fresnelPower!==e&&(this._fresnelPower=e,this._uniformsDirty=!0)}set fresnelIntensity(e){this._fresnelIntensity!==e&&(this._fresnelIntensity=e,this._uniformsDirty=!0)}set fresnelColor(e){this._fresnelColor!==e&&(this._fresnelColor=e,this._fresnelColorRgb=this._hexToRgb(e),this._uniformsDirty=!0)}set iridescenceEnabled(e){this._iridescenceEnabled!==e&&(this._iridescenceEnabled=e,this._uniformsDirty=!0)}set iridescenceIntensity(e){this._iridescenceIntensity!==e&&(this._iridescenceIntensity=e,this._uniformsDirty=!0)}set iridescenceSpeed(e){this._iridescenceSpeed!==e&&(this._iridescenceSpeed=e,this._uniformsDirty=!0)}set bloomIntensity(e){this._bloomIntensity!==e&&(this._bloomIntensity=e,this._uniformsDirty=!0)}set bloomThreshold(e){this._bloomThreshold!==e&&(this._bloomThreshold=e,this._uniformsDirty=!0)}set chromaticAberration(e){this._chromaticAberration!==e&&(this._chromaticAberration=e,this._uniformsDirty=!0)}}const $=l=>{l.id=ne,l.href="https://neat.firecms.co",l.target="_blank",l.style.position="absolute",l.style.display="block",l.style.bottom="0",l.style.right="0",l.style.padding="10px",l.style.color="#dcdcdc",l.style.opacity="0.8",l.style.fontFamily="sans-serif",l.style.fontSize="16px",l.style.fontWeight="bold",l.style.textDecoration="none",l.style.zIndex="10000",l.style.pointerEvents="auto",l.setAttribute("data-n","1"),l.innerHTML="NEAT"},le=l=>{const e=l.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const s=e.querySelector("a[data-n]");if(s)return $(s),s}const r=document.createElement("a");return $(r),e?.appendChild(r),r};function ue(){const l=new Date,e=l.getMinutes(),r=l.getSeconds();return e*60+r}function fe(l=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let s=0;s<l;s++){const t=Math.floor(Math.random()*e.length);r+=e.charAt(t)}return r}function _e(l,e){const r=document.createElement("a");r.download=e,r.href=l,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function ce(){if(document.getElementById("neat-seo-schema"))return;const l=document.createElement("script");l.id="neat-seo-schema",l.type="application/ld+json",l.text=JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"NEAT Gradient",url:"https://neat.firecms.co",author:{"@type":"Organization",name:"FireCMS",url:"https://firecms.co"},description:"Beautiful, fast, heavily customizable, WebGL based gradients."}),document.head.appendChild(l);const e=document.createElement("div");e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="nowrap",e.style.borderWidth="0";try{const r=e.attachShadow({mode:"closed"}),s=document.createElement("a");s.href="https://firecms.co",s.textContent="FireCMS",r.appendChild(s)}catch{const s=document.createElement("a");s.href="https://firecms.co",s.textContent="FireCMS",e.appendChild(s)}document.body.appendChild(e)}F.NeatGradient=ae,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
472
+ https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const N=50,X=80,j=6,ve=Se();class xe{_ref;_speed=-1;_horizontalPressure=-1;_verticalPressure=-1;_waveFrequencyX=-1;_waveFrequencyY=-1;_waveAmplitude=-1;_shadows=-1;_highlights=-1;_saturation=-1;_brightness=-1;_grainScale=-1;_grainIntensity=-1;_grainSparsity=-1;_grainSpeed=-1;_colorBlending=-1;_resolution=1;_colors=[];_wireframe=!1;_backgroundColor="#FFFFFF";_backgroundColorRgb=[1,1,1];_backgroundAlpha=1;_flowDistortionA=0;_flowDistortionB=0;_flowScale=1;_flowEase=0;_flowEnabled=!0;glState;_enableProceduralTexture=!1;_textureVoidLikelihood=.45;_textureVoidWidthMin=200;_textureVoidWidthMax=486;_textureBandDensity=2.15;_textureColorBlending=.01;_textureSeed=333;_textureEase=.5;_transparentTextureVoid=!1;_domainWarpEnabled=!1;_domainWarpIntensity=.5;_domainWarpScale=1;_vignetteIntensity=.5;_vignetteRadius=.8;_fresnelEnabled=!1;_fresnelPower=2;_fresnelIntensity=.5;_fresnelColor="#FFFFFF";_fresnelColorRgb=[1,1,1];_iridescenceEnabled=!1;_iridescenceIntensity=.5;_iridescenceSpeed=1;_bloomIntensity=0;_bloomThreshold=.7;_chromaticAberration=0;_silhouetteFade=.25;_cylinderFade=.08;_ribbonFade=.05;_flatShading=!0;_shapeType="plane";_shapeRotationX=0;_shapeRotationY=0;_shapeRotationZ=0;_shapeAutoRotateSpeedX=0;_shapeAutoRotateSpeedY=0;_sphereRadius=15;_torusRadius=15;_torusTube=5;_cylinderRadius=10;_cylinderHeight=40;_planeBend=0;_planeTwist=0;_cameraLock=!1;_cameraX=0;_cameraY=0;_cameraZ=0;_cameraRotationX=0;_cameraRotationY=0;_cameraRotationZ=0;_cameraZoom=1;_proceduralTexture=null;_proceduralBackgroundColor="#000000";_textureShapeTriangles=20;_textureShapeCircles=15;_textureShapeBars=15;_textureShapeSquiggles=10;requestRef=-1;sizeObserver;_initialized=!1;_linkElement=null;_cachedColorRgb=[];_yOffset=0;_yOffsetWaveMultiplier=.004;_yOffsetColorMultiplier=.004;_yOffsetFlowMultiplier=.004;_sourceCanvas=null;_sourceCtx=null;_maskedCanvas=null;_maskedCtx=null;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_linkCheckCounter=0;_colorsChanged=!0;_uniformsDirty=!0;_textureDirty=!0;_yOffsetDirty=!1;_modelViewMatrix=new se;_isVisible=!0;_visibilityObserver=null;_visibilityHandler=null;constructor(e){const{ref:i,speed:r=4,horizontalPressure:t=3,verticalPressure:y=3,waveFrequencyX:v=5,waveFrequencyY:s=5,waveAmplitude:l=3,colors:_,highlights:b=4,shadows:a=4,colorSaturation:h=0,colorBrightness:p=1,colorBlending:c=5,grainScale:d=2,grainIntensity:R=.55,grainSparsity:g=0,grainSpeed:x=.1,wireframe:w=!1,backgroundColor:u="#FFFFFF",backgroundAlpha:T=1,resolution:A=1,seed:D,yOffset:m=0,yOffsetWaveMultiplier:F=4,yOffsetColorMultiplier:C=4,yOffsetFlowMultiplier:z=4,flowDistortionA:M=0,flowDistortionB:P=0,flowScale:E=1,flowEase:S=0,flowEnabled:U=!0,enableProceduralTexture:B=!1,textureVoidLikelihood:O=.45,textureVoidWidthMin:I=200,textureVoidWidthMax:Y=486,textureBandDensity:Te=2.15,textureColorBlending:Ee=.01,textureSeed:Ae=333,textureEase:Fe=.5,proceduralBackgroundColor:ze="#000000",transparentTextureVoid:De=!1,textureShapeTriangles:Me=20,textureShapeCircles:Ce=15,textureShapeBars:Pe=15,textureShapeSquiggles:Ue=10,domainWarpEnabled:Ie=!1,domainWarpIntensity:Be=.5,domainWarpScale:Le=1,vignetteIntensity:Oe=0,vignetteRadius:We=.8,fresnelEnabled:Ne=!1,fresnelPower:Xe=2,fresnelIntensity:Ye=.5,fresnelColor:ke="#FFFFFF",iridescenceEnabled:Ve=!1,iridescenceIntensity:qe=.5,iridescenceSpeed:Ze=1,bloomIntensity:Ge=0,bloomThreshold:He=.7,chromaticAberration:je=0,silhouetteFade:$e=.25,cylinderFade:Ke=.08,ribbonFade:Je=.05,flatShading:Qe=!0,cameraLock:et=!1,cameraX:tt=0,cameraY:it=0,cameraZ:st=0,cameraRotationX:rt=0,cameraRotationY:ot=0,cameraRotationZ:nt=0,cameraZoom:at=1,shapeType:lt="plane",shapeRotationX:ut=0,shapeRotationY:_t=0,shapeRotationZ:ct=0,shapeAutoRotateSpeedX:ht=0,shapeAutoRotateSpeedY:ft=0,sphereRadius:dt=15,torusRadius:mt=15,torusTube:pt=5,cylinderRadius:gt=10,cylinderHeight:yt=40,planeBend:vt=0,planeTwist:xt=0}=e;this._ref=i,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=r,this.horizontalPressure=t,this.verticalPressure=y,this.waveFrequencyX=v,this.waveFrequencyY=s,this.waveAmplitude=l,this.colorBlending=c,this._resolution=A,this.grainScale=d,this.grainIntensity=R,this.grainSparsity=g,this.grainSpeed=x,this.colors=_,this.shadows=a,this.highlights=b,this.colorSaturation=h,this.colorBrightness=p,this.wireframe=w,this.backgroundColor=u,this.backgroundAlpha=T,this.yOffset=m,this.yOffsetWaveMultiplier=F,this.yOffsetColorMultiplier=C,this.yOffsetFlowMultiplier=z,this.flowDistortionA=M,this.flowDistortionB=P,this.flowScale=E,this.flowEase=S,this.flowEnabled=U,this.enableProceduralTexture=B,this.textureVoidLikelihood=O,this.textureVoidWidthMin=I,this.textureVoidWidthMax=Y,this.textureBandDensity=Te,this.textureColorBlending=Ee,this.textureSeed=Ae,this.textureEase=Fe,this._proceduralBackgroundColor=ze,this.transparentTextureVoid=De,this._textureShapeTriangles=Me,this._textureShapeCircles=Ce,this._textureShapeBars=Pe,this._textureShapeSquiggles=Ue,this.domainWarpEnabled=Ie,this.domainWarpIntensity=Be,this.domainWarpScale=Le,this.vignetteIntensity=Oe,this.vignetteRadius=We,this.fresnelEnabled=Ne,this.fresnelPower=Xe,this.fresnelIntensity=Ye,this.fresnelColor=ke,this.iridescenceEnabled=Ve,this.iridescenceIntensity=qe,this.iridescenceSpeed=Ze,this.bloomIntensity=Ge,this.bloomThreshold=He,this.chromaticAberration=je,this.silhouetteFade=$e,this.cylinderFade=Ke,this.ribbonFade=Je,this._flatShading=Qe,this._cameraLock=et,this._cameraX=tt,this._cameraY=it,this._cameraZ=st,this._cameraRotationX=rt,this._cameraRotationY=ot,this._cameraRotationZ=nt,this._cameraZoom=at,this._shapeType=lt,this._shapeRotationX=ut,this._shapeRotationY=_t,this._shapeRotationZ=ct,this._shapeAutoRotateSpeedX=ht,this._shapeAutoRotateSpeedY=ft,this._sphereRadius=dt,this._torusRadius=mt,this._torusTube=pt,this._cylinderRadius=gt,this._cylinderHeight=yt,this._planeBend=vt,this._planeTwist=xt,this.glState=this._initScene(A),Re();let $=D!==void 0?D:we(),K=performance.now();const J=()=>{const{gl:o,program:V,locations:f,indexCount:Z,indexType:G}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=be(i))),this._initialized){const ce=performance.now();$+=(ce-K)/1e3*this._speed,K=ce,o.useProgram(V),o.uniform1f(f.uniforms.u_time,$);const Q=this.glState.camera,W=this._modelViewMatrix;W.identity(),W.translate(-Q.position[0]-this._cameraX,-Q.position[1]-this._cameraY,-Q.position[2]-this._cameraZ),W.translate(0,0,-1),W.rotateX(-this._cameraRotationX),W.rotateY(-this._cameraRotationY),W.rotateZ(-this._cameraRotationZ);let ee=this._shapeRotationX,he=this._shapeRotationY,wt=this._shapeRotationZ;this._shapeAutoRotateSpeedX!==0&&(ee+=$*this._shapeAutoRotateSpeedX*.1),this._shapeAutoRotateSpeedY!==0&&(he+=$*this._shapeAutoRotateSpeedY*.1),this._shapeType==="plane"||this._shapeType==="ribbon"?W.rotateX(ee-Math.PI/3.5):W.rotateX(ee),W.rotateY(he),W.rotateZ(wt);const fe=f.uniforms.modelViewMatrix;if(fe&&o.uniformMatrix4fv(fe,!1,W.elements),this._yOffsetDirty&&!this._uniformsDirty&&(o.uniform1f(f.uniforms.u_y_offset,this._yOffset),this._yOffsetDirty=!1),this._uniformsDirty){o.uniform2f(f.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),o.uniform2f(f.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),o.uniform1f(f.uniforms.u_wave_frequency_x,this._waveFrequencyX),o.uniform1f(f.uniforms.u_wave_frequency_y,this._waveFrequencyY),o.uniform1f(f.uniforms.u_wave_amplitude,this._waveAmplitude),o.uniform1f(f.uniforms.u_color_blending,this._colorBlending),o.uniform1f(f.uniforms.u_shadows,this._shadows),o.uniform1f(f.uniforms.u_highlights,this._highlights),o.uniform1f(f.uniforms.u_saturation,this._saturation),o.uniform1f(f.uniforms.u_brightness,this._brightness),o.uniform1f(f.uniforms.u_grain_intensity,this._grainIntensity),o.uniform1f(f.uniforms.u_grain_sparsity,this._grainSparsity),o.uniform1f(f.uniforms.u_grain_speed,this._grainSpeed),o.uniform1f(f.uniforms.u_grain_scale,this._grainScale),o.uniform1f(f.uniforms.u_y_offset,this._yOffset),o.uniform1f(f.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),o.uniform1f(f.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),o.uniform1f(f.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),o.uniform1f(f.uniforms.u_flow_distortion_a,this._flowDistortionA),o.uniform1f(f.uniforms.u_flow_distortion_b,this._flowDistortionB),o.uniform1f(f.uniforms.u_flow_scale,this._flowScale),o.uniform1f(f.uniforms.u_flow_ease,this._flowEase),o.uniform1f(f.uniforms.u_flow_enabled,this._flowEnabled?1:0);let L=0;this._shapeType==="sphere"?L=1:this._shapeType==="torus"?L=2:this._shapeType==="cylinder"?L=3:this._shapeType==="ribbon"&&(L=4),o.uniform1f(f.uniforms.u_shape_type,L),o.uniform1f(f.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),o.uniform1f(f.uniforms.u_texture_ease,this._textureEase),o.uniform1f(f.uniforms.u_transparent_texture_void,this._transparentTextureVoid?1:0),o.uniform1f(f.uniforms.u_domain_warp_enabled,this._domainWarpEnabled?1:0),o.uniform1f(f.uniforms.u_domain_warp_intensity,this._domainWarpIntensity),o.uniform1f(f.uniforms.u_domain_warp_scale,this._domainWarpScale),o.uniform1f(f.uniforms.u_vignette_intensity,this._vignetteIntensity),o.uniform1f(f.uniforms.u_vignette_radius,this._vignetteRadius),o.uniform1f(f.uniforms.u_fresnel_enabled,this._fresnelEnabled?1:0),o.uniform1f(f.uniforms.u_fresnel_power,this._fresnelPower),o.uniform1f(f.uniforms.u_fresnel_intensity,this._fresnelIntensity),o.uniform3fv(f.uniforms.u_fresnel_color,this._fresnelColorRgb),o.uniform1f(f.uniforms.u_iridescence_enabled,this._iridescenceEnabled?1:0),o.uniform1f(f.uniforms.u_iridescence_intensity,this._iridescenceIntensity),o.uniform1f(f.uniforms.u_iridescence_speed,this._iridescenceSpeed),o.uniform1f(f.uniforms.u_bloom_intensity,this._bloomIntensity),o.uniform1f(f.uniforms.u_bloom_threshold,this._bloomThreshold),o.uniform1f(f.uniforms.u_chromatic_aberration,this._chromaticAberration),o.uniform1f(f.uniforms.u_silhouette_fade,this._silhouetteFade),o.uniform1f(f.uniforms.u_cylinder_fade,this._cylinderFade),o.uniform1f(f.uniforms.u_ribbon_fade,this._ribbonFade),o.uniform1f(f.uniforms.u_flat_shading,this._flatShading?1:0),this._uniformsDirty=!1,this._yOffsetDirty=!1}if(this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&o.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(o),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._proceduralTexture),o.uniform1i(f.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let L=0;L<j;L++)if(L<this._colors.length){const de=this._colors[L],St=this._cachedColorRgb[L]||[0,0,0];o.uniform1f(f.uniforms[`u_colors[${L}].is_active`],de.enabled?1:0),o.uniform3fv(f.uniforms[`u_colors[${L}].color`],St),o.uniform1f(f.uniforms[`u_colors[${L}].influence`],de.influence||0)}else o.uniform1f(f.uniforms[`u_colors[${L}].is_active`],0);o.uniform1i(f.uniforms.u_colors_count,j)}}o.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),this._wireframe?(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),o.drawElements(o.LINES,this.glState.wireframeIndexCount,G,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):o.drawElements(o.TRIANGLES,Z,G,0),this._isVisible&&(this.requestRef=requestAnimationFrame(J))};this._visibilityObserver=new IntersectionObserver(o=>{const V=this._isVisible;this._isVisible=o[0].isIntersecting&&document.visibilityState!=="hidden",this._isVisible&&!V&&(K=performance.now(),this.requestRef=requestAnimationFrame(J))},{threshold:0}),this._visibilityObserver.observe(i),this._visibilityHandler=()=>{const o=this._isVisible;document.visibilityState==="hidden"?this._isVisible=!1:(this._isVisible=!0,o||(K=performance.now(),this.requestRef=requestAnimationFrame(J)))},document.addEventListener("visibilitychange",this._visibilityHandler);const bt=()=>{const{gl:o,camera:V}=this.glState,f=this._ref.clientWidth,Z=this._ref.clientHeight;this._ref.width=f,this._ref.height=Z,o.viewport(0,0,f,Z),H(V,f,Z,N,X,this._shapeType,this._cameraZoom);const G=this.glState.locations.uniforms.projectionMatrix;o.useProgram(this.glState.program),G&&o.uniformMatrix4fv(G,!1,V.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{bt(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(i),J()}destroy(){if(cancelAnimationFrame(this.requestRef),this.sizeObserver.disconnect(),this._visibilityObserver&&(this._visibilityObserver.disconnect(),this._visibilityObserver=null),this._visibilityHandler&&(document.removeEventListener("visibilitychange",this._visibilityHandler),this._visibilityHandler=null),this._resizeTimeoutId!==null&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=null),this._linkElement&&this._linkElement.parentElement&&(this._linkElement.parentElement.removeChild(this._linkElement),this._linkElement=null),this.glState){const e=this.glState.gl;e.deleteProgram(this.glState.program),e.deleteBuffer(this.glState.buffers.position),e.deleteBuffer(this.glState.buffers.normal),e.deleteBuffer(this.glState.buffers.uv),e.deleteBuffer(this.glState.buffers.index),e.deleteBuffer(this.glState.buffers.wireframeIndex)}this._proceduralTexture&&this.glState&&this.glState.gl.deleteTexture(this._proceduralTexture)}downloadAsPNG(e="neat.png"){const i=this._ref.toDataURL("image/png");_e(i,e)}recordVideo(e={}){const{durationMs:i=5e3,filename:r="neat.firecms.co",format:t,onProgress:y,onComplete:v}=e,s=this._ref,l=e.width||s.width||s.clientWidth,_=e.height||s.height||s.clientHeight,b=document.createElement("canvas");b.width=l,b.height=_;const a=b.getContext("2d"),h=b.captureStream(0),p=h.getVideoTracks()[0],c=["video/mp4;codecs=avc1","video/mp4;codecs=avc1,opus","video/mp4"],d=["video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm"];let R;t==="mp4"?R=[...c,...d]:t==="webm"?R=[...d,...c]:R=[...c,...d];let g="video/webm";for(const E of R)if(MediaRecorder.isTypeSupported(E)){g=E;break}const x=l*_,w=8e6,u=1280*720,T=Math.round(w*Math.max(1,x/u)),A=new MediaRecorder(h,{mimeType:g,videoBitsPerSecond:T}),D=[];A.ondataavailable=E=>{E.data.size>0&&D.push(E.data)};let m=!1,F;const C=performance.now();let z=0;const M=()=>{if(m)return;a.clearRect(0,0,l,_),a.drawImage(s,0,0,l,_);const E=Math.max(14,Math.round(_*.025));if(a.font=`bold ${E}px "Sofia Sans", sans-serif`,a.textAlign="right",a.textBaseline="bottom",a.shadowColor="rgba(0,0,0,0.5)",a.shadowBlur=4,a.shadowOffsetX=1,a.shadowOffsetY=1,a.fillStyle="rgba(255,255,255,0.7)",a.fillText("NEAT",l-E*.8,_-E*.5),a.shadowColor="transparent",a.shadowBlur=0,a.shadowOffsetX=0,a.shadowOffsetY=0,p.requestFrame&&p.requestFrame(),y){const S=performance.now();S-z>250&&(z=S,y(Math.min(.99,(S-C)/i)))}F=requestAnimationFrame(M)};A.onstop=()=>{m=!0,cancelAnimationFrame(F);const E=g.startsWith("video/mp4"),S=E?".mp4":".webm",U=E?"video/mp4":"video/webm",B=r+S,O=new Blob(D,{type:U}),I=URL.createObjectURL(O);_e(I,B),setTimeout(()=>URL.revokeObjectURL(I),3e4),y?.(1),v?.()},M(),A.start(100);const P=window.setTimeout(()=>{A.state==="recording"&&A.stop()},i);return()=>{clearTimeout(P),A.state==="recording"&&A.stop()}}get speed(){return this._speed*20}set speed(e){this._uniformsDirty=!0,this._speed=e/20}get horizontalPressure(){return this._horizontalPressure*4}set horizontalPressure(e){this._uniformsDirty=!0,this._horizontalPressure=e/4}get verticalPressure(){return this._verticalPressure*4}set verticalPressure(e){this._uniformsDirty=!0,this._verticalPressure=e/4}get waveFrequencyX(){return this._waveFrequencyX/.04}set waveFrequencyX(e){this._uniformsDirty=!0,this._waveFrequencyX=e*.04}get waveFrequencyY(){return this._waveFrequencyY/.04}set waveFrequencyY(e){this._uniformsDirty=!0,this._waveFrequencyY=e*.04}get waveAmplitude(){return this._waveAmplitude/.75}set waveAmplitude(e){this._uniformsDirty=!0,this._waveAmplitude=e*.75}get colors(){return this._colors}set colors(e){this._uniformsDirty=!0,this._colors=e,this._cachedColorRgb=e.map(i=>this._hexToRgb(i.color)),this._colorsChanged=!0}get highlights(){return this._highlights*100}set highlights(e){this._uniformsDirty=!0,this._highlights=e/100}get shadows(){return this._shadows*100}set shadows(e){this._uniformsDirty=!0,this._shadows=e/100}get colorSaturation(){return this._saturation*10}set colorSaturation(e){this._uniformsDirty=!0,this._saturation=e/10}get colorBrightness(){return this._brightness}set colorBrightness(e){this._uniformsDirty=!0,this._brightness=e}get colorBlending(){return this._colorBlending*10}set colorBlending(e){this._uniformsDirty=!0,this._colorBlending=e/10}get grainScale(){return this._grainScale}set grainScale(e){this._uniformsDirty=!0,this._grainScale=e==0?1:e}get grainIntensity(){return this._grainIntensity}set grainIntensity(e){this._uniformsDirty=!0,this._grainIntensity=e}get grainSparsity(){return this._grainSparsity}set grainSparsity(e){this._uniformsDirty=!0,this._grainSparsity=e}get grainSpeed(){return this._grainSpeed}set grainSpeed(e){this._uniformsDirty=!0,this._grainSpeed=e}get wireframe(){return this._wireframe}set wireframe(e){this._uniformsDirty=!0,this._wireframe=e}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this._updateGeometry())}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._uniformsDirty=!0,this._backgroundColor=e,this._backgroundColorRgb=this._hexToRgb(e)}get backgroundAlpha(){return this._backgroundAlpha}set backgroundAlpha(e){this._uniformsDirty=!0,this._backgroundAlpha=e}get yOffset(){return this._yOffset}set yOffset(e){this._yOffset!==e&&(this._yOffsetDirty=!0,this._yOffset=e)}get yOffsetWaveMultiplier(){return this._yOffsetWaveMultiplier*1e3}set yOffsetWaveMultiplier(e){this._uniformsDirty=!0,this._yOffsetWaveMultiplier=e/1e3}get yOffsetColorMultiplier(){return this._yOffsetColorMultiplier*1e3}set yOffsetColorMultiplier(e){this._uniformsDirty=!0,this._yOffsetColorMultiplier=e/1e3}get yOffsetFlowMultiplier(){return this._yOffsetFlowMultiplier*1e3}set yOffsetFlowMultiplier(e){this._uniformsDirty=!0,this._yOffsetFlowMultiplier=e/1e3}get flowDistortionA(){return this._flowDistortionA}set flowDistortionA(e){this._uniformsDirty=!0,this._flowDistortionA=e}get flowDistortionB(){return this._flowDistortionB}set flowDistortionB(e){this._uniformsDirty=!0,this._flowDistortionB=e}get flowScale(){return this._flowScale}set flowScale(e){this._uniformsDirty=!0,this._flowScale=e}get flowEase(){return this._flowEase}set flowEase(e){this._uniformsDirty=!0,this._flowEase=e}set flowEnabled(e){this._uniformsDirty=!0,this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}get enableProceduralTexture(){return this._enableProceduralTexture}set enableProceduralTexture(e){this._uniformsDirty=!0,this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidLikelihood(){return this._textureVoidLikelihood}set textureVoidLikelihood(e){this._uniformsDirty=!0,this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMin(){return this._textureVoidWidthMin}set textureVoidWidthMin(e){this._uniformsDirty=!0,this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMax(){return this._textureVoidWidthMax}set textureVoidWidthMax(e){this._uniformsDirty=!0,this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureBandDensity(){return this._textureBandDensity}set textureBandDensity(e){this._uniformsDirty=!0,this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureColorBlending(){return this._textureColorBlending}set textureColorBlending(e){this._uniformsDirty=!0,this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureSeed(){return this._textureSeed}set textureSeed(e){this._uniformsDirty=!0,this._textureSeed=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureEase(){return this._textureEase}set textureEase(e){this._uniformsDirty=!0,this._textureEase=e}get transparentTextureVoid(){return this._transparentTextureVoid}set transparentTextureVoid(e){this._uniformsDirty=!0,this._transparentTextureVoid=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get proceduralBackgroundColor(){return this._proceduralBackgroundColor}set proceduralBackgroundColor(e){this._uniformsDirty=!0,this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeTriangles(){return this._textureShapeTriangles}set textureShapeTriangles(e){this._uniformsDirty=!0,this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeCircles(){return this._textureShapeCircles}set textureShapeCircles(e){this._uniformsDirty=!0,this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeBars(){return this._textureShapeBars}set textureShapeBars(e){this._uniformsDirty=!0,this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeSquiggles(){return this._textureShapeSquiggles}set textureShapeSquiggles(e){this._uniformsDirty=!0,this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_updateGeometry(){if(!this.glState)return;const e=this.glState.gl,i=this._resolution||1;let r;this._shapeType==="sphere"?r=oe(this._sphereRadius,120*i,120*i):this._shapeType==="torus"?r=ne(this._torusRadius,this._torusTube,120*i,120*i):this._shapeType==="cylinder"?r=ae(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*i,120*i):this._shapeType==="ribbon"?r=le(N,X,240*i,240*i,this._planeBend,this._planeTwist):r=re(N,X,240*i,240*i);const{position:t,normal:y,uv:v,index:s,wireframeIndex:l}=r;e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.position),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.normal),e.bufferData(e.ARRAY_BUFFER,y,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.uv),e.bufferData(e.ARRAY_BUFFER,v,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),e.bufferData(e.ELEMENT_ARRAY_BUFFER,s,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),e.bufferData(e.ELEMENT_ARRAY_BUFFER,l,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),this.glState.indexCount=s.length,this.glState.wireframeIndexCount=l.length,this.glState.indexType=s instanceof Uint32Array?e.UNSIGNED_INT:e.UNSIGNED_SHORT;const _=this._ref.clientWidth,b=this._ref.clientHeight;H(this.glState.camera,_,b,N,X,this._shapeType,this._cameraZoom);const a=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),a&&e.uniformMatrix4fv(a,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!0}_hexToRgb(e){const i=parseInt(e.replace("#",""),16);return[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}_initScene(e){const i=this._ref.clientWidth,r=this._ref.clientHeight,t=this._ref.getContext("webgl2",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0})||this._ref.getContext("webgl",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0});if(!t)throw new Error("WebGL not supported");t.getExtension("OES_standard_derivatives"),t.getExtension("OES_element_index_uint"),t.viewport(0,0,i,r);let y;this._shapeType==="sphere"?y=oe(this._sphereRadius,120*e,120*e):this._shapeType==="torus"?y=ne(this._torusRadius,this._torusTube,120*e,120*e):this._shapeType==="cylinder"?y=ae(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*e,120*e):this._shapeType==="ribbon"?y=le(N,X,240*e,240*e,this._planeBend,this._planeTwist):y=re(N,X,240*e,240*e);const{position:v,normal:s,uv:l,index:_,wireframeIndex:b}=y,a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,v,t.STATIC_DRAW);const h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,s,t.STATIC_DRAW);const p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW);const c=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c),t.bufferData(t.ELEMENT_ARRAY_BUFFER,_,t.STATIC_DRAW);const d=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,d),t.bufferData(t.ELEMENT_ARRAY_BUFFER,b,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const R=pe()+`
473
+ `+te()+`
474
+ `+ie()+`
475
+ `+q,g=t.createShader(t.VERTEX_SHADER);t.shaderSource(g,R),t.compileShader(g),t.getShaderParameter(g,t.COMPILE_STATUS)||(console.log("VERTEX_SHADER_ERROR_START"),console.log("Vertex shader error: ",t.getShaderInfoLog(g)),console.log("GL Error Code:",t.getError()),console.log("Vertex Shader Source Dump:"),console.log(R.split(`
476
+ `).map((S,U)=>`${U+1}: ${S}`).join(`
477
+ `)),console.log("VERTEX_SHADER_ERROR_END"));const x=ge()+`
478
+ `+ie()+`
479
+ `+te()+`
480
+ `+me,w=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(w,x),t.compileShader(w),t.getShaderParameter(w,t.COMPILE_STATUS)||(console.log("FRAGMENT_SHADER_ERROR_START"),console.log("Fragment shader error: ",t.getShaderInfoLog(w)),console.log("GL Error Code:",t.getError()),console.log("Fragment Shader Source Dump:"),console.log(x.split(`
481
+ `).map((S,U)=>`${U+1}: ${S}`).join(`
482
+ `)),console.log("FRAGMENT_SHADER_ERROR_END"));const u=t.createProgram();t.attachShader(u,g),t.attachShader(u,w),t.linkProgram(u),t.getProgramParameter(u,t.LINK_STATUS)||(console.log("PROGRAM_LINK_ERROR_START"),console.log("Program linking error: ",t.getProgramInfoLog(u)),console.log("GL Error Code:",t.getError()),console.log("PROGRAM_LINK_ERROR_END")),t.useProgram(u);const T=new ye(0,0,0,0,0,1e3);T.position=[0,0,5],H(T,i,r,N,X,this._shapeType,this._cameraZoom);const A=t.getAttribLocation(u,"position"),D=t.getAttribLocation(u,"normal"),m=t.getAttribLocation(u,"uv");t.enableVertexAttribArray(A),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(A,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(D),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(D,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(m),t.bindBuffer(t.ARRAY_BUFFER,p),t.vertexAttribPointer(m,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const F=t.getUniformLocation(u,"projectionMatrix");t.uniformMatrix4fv(F,!1,T.projectionMatrix.elements);const C=t.getUniformLocation(u,"u_plane_width");t.uniform1f(C,N);const z=t.getUniformLocation(u,"u_plane_height");t.uniform1f(z,X);const M=t.getUniformLocation(u,"u_colors_count");t.uniform1i(M,j);const P=["projectionMatrix","modelViewMatrix","u_time","u_resolution","u_color_pressure","u_wave_frequency_x","u_wave_frequency_y","u_wave_amplitude","u_colors_count","u_plane_width","u_plane_height","u_shadows","u_highlights","u_grain_intensity","u_grain_sparsity","u_grain_scale","u_grain_speed","u_flow_distortion_a","u_flow_distortion_b","u_flow_scale","u_flow_ease","u_flow_enabled","u_y_offset","u_y_offset_wave_multiplier","u_y_offset_color_multiplier","u_y_offset_flow_multiplier","u_procedural_texture","u_enable_procedural_texture","u_texture_ease","u_transparent_texture_void","u_saturation","u_brightness","u_color_blending","u_domain_warp_enabled","u_domain_warp_intensity","u_domain_warp_scale","u_vignette_intensity","u_vignette_radius","u_fresnel_enabled","u_fresnel_power","u_fresnel_intensity","u_fresnel_color","u_iridescence_enabled","u_iridescence_intensity","u_iridescence_speed","u_bloom_intensity","u_bloom_threshold","u_chromatic_aberration","u_shape_type","u_silhouette_fade","u_cylinder_fade","u_ribbon_fade","u_flat_shading"],E={attributes:{position:A,normal:D,uv:m},uniforms:{}};P.forEach(S=>{E.uniforms[S]=t.getUniformLocation(u,S)});for(let S=0;S<j;S++)E.uniforms[`u_colors[${S}].is_active`]=t.getUniformLocation(u,`u_colors[${S}].is_active`),E.uniforms[`u_colors[${S}].color`]=t.getUniformLocation(u,`u_colors[${S}].color`),E.uniforms[`u_colors[${S}].influence`]=t.getUniformLocation(u,`u_colors[${S}].influence`);return this._initialized=!0,this._uniformsDirty=!0,this._colorsChanged=!0,this._textureDirty=!0,t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.DEPTH_TEST),{gl:t,program:u,buffers:{position:a,normal:h,uv:p,index:c,wireframeIndex:d},locations:E,camera:T,indexCount:_.length,wireframeIndexCount:b.length,indexType:_ instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){this._sourceCanvas||(this._sourceCanvas=document.createElement("canvas"),this._sourceCanvas.width=1024,this._sourceCanvas.height=1024,this._sourceCtx=this._sourceCanvas.getContext("2d"));const r=this._sourceCanvas,t=this._sourceCtx;if(!t)return null;let y=this._textureSeed;const v=this._textureSeed;function s(){const m=Math.sin(y++)*1e4;return m-Math.floor(m)}const l=m=>{y=v+m},_=this._colors.filter(m=>m.enabled).map(m=>m.color);if(_.length===0)return null;const b=this._shapeType!=="plane",a=b?[-1,0,1]:[0],h=b?[-1,0,1]:[0];function p(m){const F=parseInt(m.replace("#",""),16);return{r:F>>16&255,g:F>>8&255,b:F&255}}function c(m,F,C){return"#"+((1<<24)+(Math.round(m)<<16)+(Math.round(F)<<8)+Math.round(C)).toString(16).slice(1).padStart(6,"0")}const d=()=>{const m=_[Math.floor(s()*_.length)],F=_[Math.floor(s()*_.length)],C=s()*this._textureColorBlending,z=p(m),M=p(F),P=z.r+(M.r-z.r)*C,E=z.g+(M.g-z.g)*C,S=z.b+(M.b-z.b)*C;return c(P,E,S)},R=this._proceduralBackgroundColor||"#000000";t.fillStyle=R,t.fillRect(0,0,1024,1024);const g=t.createLinearGradient(0,0,0,1024);g.addColorStop(0,d()),g.addColorStop(1,d()),t.fillStyle=g,t.fillRect(0,0,1024,1024);for(let m=0;m<this._textureShapeTriangles;m++){const F=d(),C=s()*1024,z=s()*1024,M=100+s()*300,P=(s()-.5)*M,E=(s()-.5)*M,S=(s()-.5)*M,U=(s()-.5)*M;for(const B of a)for(const O of h){t.fillStyle=F,t.beginPath();const I=C+B*1024,Y=z+O*1024;t.moveTo(I,Y),t.lineTo(I+P,Y+E),t.lineTo(I+S,Y+U),t.fill()}}for(let m=0;m<this._textureShapeCircles;m++){const F=d(),C=10+s()*50,z=s()*1024,M=s()*1024,P=50+s()*150;for(const E of a)for(const S of h)t.strokeStyle=F,t.lineWidth=C,t.beginPath(),t.arc(z+E*1024,M+S*1024,P,0,Math.PI*2),t.stroke()}for(let m=0;m<this._textureShapeBars;m++){const F=d(),C=s()*1024,z=s()*1024,M=s()*Math.PI;for(const P of a)for(const E of h)t.fillStyle=F,t.save(),t.translate(C+P*1024,z+E*1024),t.rotate(M),t.fillRect(-150,-25,300,50),t.restore()}t.lineWidth=15,t.lineCap="round";for(let m=0;m<this._textureShapeSquiggles;m++){const F=d(),C=s()*1024,z=s()*1024,M=[];let P=0,E=0;for(let S=0;S<4;S++){const U=P+(s()-.5)*300,B=E+(s()-.5)*300;M.push({cx1:P+(s()-.5)*300,cy1:E+(s()-.5)*300,cx2:P+(s()-.5)*300,cy2:E+(s()-.5)*300,ex:U,ey:B}),P=U,E=B}for(const S of a)for(const U of h){t.strokeStyle=F,t.beginPath();const B=C+S*1024,O=z+U*1024;t.moveTo(B,O);for(const I of M)t.bezierCurveTo(B+I.cx1,O+I.cy1,B+I.cx2,O+I.cy2,B+I.ex,O+I.ey);t.stroke()}}l(5e4),this._maskedCanvas||(this._maskedCanvas=document.createElement("canvas"),this._maskedCanvas.width=1024,this._maskedCanvas.height=1024,this._maskedCtx=this._maskedCanvas.getContext("2d"));const x=this._maskedCanvas,w=this._maskedCtx;if(!w)return null;this._transparentTextureVoid?w.clearRect(0,0,1024,1024):(w.fillStyle=R,w.fillRect(0,0,1024,1024));let u=0;const T=[];for(;u<1024;)if(s()<this._textureVoidLikelihood){const F=this._textureVoidWidthMin+s()*(this._textureVoidWidthMax-this._textureVoidWidthMin);T.push({type:"void",x:u,width:F}),u+=F}else{const F=50+s()*200;T.push({type:"matter",x:u,width:F}),u+=F}for(const m of T)if(m.type==="matter"){const F=m.x,C=Math.min(m.x+m.width,1024);let z=F;for(;z<C;){const M=(2+s()*20)/this._textureBandDensity,P=Math.floor(s()*1024);w.drawImage(r,P,0,M,1024,z,0,M,1024),z+=M}}const A=e.createTexture();e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,x),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.generateMipmap(e.TEXTURE_2D);const D=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(D){const m=e.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,D.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,m))}return A}get silhouetteFade(){return this._silhouetteFade}set silhouetteFade(e){this._silhouetteFade!==e&&(this._silhouetteFade=e,this._uniformsDirty=!0)}get cylinderFade(){return this._cylinderFade}set cylinderFade(e){this._cylinderFade!==e&&(this._cylinderFade=e,this._uniformsDirty=!0)}get ribbonFade(){return this._ribbonFade}set ribbonFade(e){this._ribbonFade!==e&&(this._ribbonFade=e,this._uniformsDirty=!0)}get flatShading(){return this._flatShading}set flatShading(e){this._flatShading!==e&&(this._flatShading=e,this._uniformsDirty=!0)}get domainWarpEnabled(){return this._domainWarpEnabled}set domainWarpEnabled(e){this._domainWarpEnabled!==e&&(this._domainWarpEnabled=e,this._uniformsDirty=!0)}get domainWarpIntensity(){return this._domainWarpIntensity}set domainWarpIntensity(e){this._domainWarpIntensity!==e&&(this._domainWarpIntensity=e,this._uniformsDirty=!0)}get domainWarpScale(){return this._domainWarpScale}set domainWarpScale(e){this._domainWarpScale!==e&&(this._domainWarpScale=e,this._uniformsDirty=!0)}get vignetteIntensity(){return this._vignetteIntensity}set vignetteIntensity(e){this._vignetteIntensity!==e&&(this._vignetteIntensity=e,this._uniformsDirty=!0)}get vignetteRadius(){return this._vignetteRadius}set vignetteRadius(e){this._vignetteRadius!==e&&(this._vignetteRadius=e,this._uniformsDirty=!0)}get fresnelEnabled(){return this._fresnelEnabled}set fresnelEnabled(e){this._fresnelEnabled!==e&&(this._fresnelEnabled=e,this._uniformsDirty=!0)}get fresnelPower(){return this._fresnelPower}set fresnelPower(e){this._fresnelPower!==e&&(this._fresnelPower=e,this._uniformsDirty=!0)}get fresnelIntensity(){return this._fresnelIntensity}set fresnelIntensity(e){this._fresnelIntensity!==e&&(this._fresnelIntensity=e,this._uniformsDirty=!0)}get fresnelColor(){return this._fresnelColor}set fresnelColor(e){this._fresnelColor!==e&&(this._fresnelColor=e,this._fresnelColorRgb=this._hexToRgb(e),this._uniformsDirty=!0)}get iridescenceEnabled(){return this._iridescenceEnabled}set iridescenceEnabled(e){this._iridescenceEnabled!==e&&(this._iridescenceEnabled=e,this._uniformsDirty=!0)}get iridescenceIntensity(){return this._iridescenceIntensity}set iridescenceIntensity(e){this._iridescenceIntensity!==e&&(this._iridescenceIntensity=e,this._uniformsDirty=!0)}get iridescenceSpeed(){return this._iridescenceSpeed}set iridescenceSpeed(e){this._iridescenceSpeed!==e&&(this._iridescenceSpeed=e,this._uniformsDirty=!0)}get bloomIntensity(){return this._bloomIntensity}set bloomIntensity(e){this._bloomIntensity!==e&&(this._bloomIntensity=e,this._uniformsDirty=!0)}get bloomThreshold(){return this._bloomThreshold}set bloomThreshold(e){this._bloomThreshold!==e&&(this._bloomThreshold=e,this._uniformsDirty=!0)}get chromaticAberration(){return this._chromaticAberration}set chromaticAberration(e){this._chromaticAberration!==e&&(this._chromaticAberration=e,this._uniformsDirty=!0)}get shapeType(){return this._shapeType}set shapeType(e){this._shapeType!==e&&(this._shapeType=e,this._updateGeometry())}get shapeRotationX(){return this._shapeRotationX}set shapeRotationX(e){this._shapeRotationX=e,this._uniformsDirty=!0}get shapeRotationY(){return this._shapeRotationY}set shapeRotationY(e){this._shapeRotationY=e,this._uniformsDirty=!0}get shapeRotationZ(){return this._shapeRotationZ}set shapeRotationZ(e){this._shapeRotationZ=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedX(){return this._shapeAutoRotateSpeedX}set shapeAutoRotateSpeedX(e){this._shapeAutoRotateSpeedX=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedY(){return this._shapeAutoRotateSpeedY}set shapeAutoRotateSpeedY(e){this._shapeAutoRotateSpeedY=e,this._uniformsDirty=!0}get sphereRadius(){return this._sphereRadius}set sphereRadius(e){this._sphereRadius!==e&&(this._sphereRadius=e,this._updateGeometry())}get torusRadius(){return this._torusRadius}set torusRadius(e){this._torusRadius!==e&&(this._torusRadius=e,this._updateGeometry())}get torusTube(){return this._torusTube}set torusTube(e){this._torusTube!==e&&(this._torusTube=e,this._updateGeometry())}get cylinderRadius(){return this._cylinderRadius}set cylinderRadius(e){this._cylinderRadius!==e&&(this._cylinderRadius=e,this._updateGeometry())}get cylinderHeight(){return this._cylinderHeight}set cylinderHeight(e){this._cylinderHeight!==e&&(this._cylinderHeight=e,this._updateGeometry())}get planeBend(){return this._planeBend}set planeBend(e){this._planeBend!==e&&(this._planeBend=e,this._updateGeometry())}get planeTwist(){return this._planeTwist}set planeTwist(e){this._planeTwist!==e&&(this._planeTwist=e,this._updateGeometry())}get cameraLock(){return this._cameraLock}set cameraLock(e){this._cameraLock=e}get cameraX(){return this._cameraX}set cameraX(e){this._cameraX=e,this._uniformsDirty=!0}get cameraY(){return this._cameraY}set cameraY(e){this._cameraY=e,this._uniformsDirty=!0}get cameraZ(){return this._cameraZ}set cameraZ(e){this._cameraZ=e,this._uniformsDirty=!0}get cameraRotationX(){return this._cameraRotationX}set cameraRotationX(e){this._cameraRotationX=e,this._uniformsDirty=!0}get cameraRotationY(){return this._cameraRotationY}set cameraRotationY(e){this._cameraRotationY=e,this._uniformsDirty=!0}get cameraRotationZ(){return this._cameraRotationZ}set cameraRotationZ(e){this._cameraRotationZ=e,this._uniformsDirty=!0}get cameraZoom(){return this._cameraZoom}set cameraZoom(e){this._cameraZoom!==e&&(this._cameraZoom=e,this._updateCameraFrustum())}_updateCameraFrustum(){if(!this.glState)return;const e=this.glState.gl,i=this._ref.clientWidth,r=this._ref.clientHeight;H(this.glState.camera,i,r,N,X,this._shapeType,this._cameraZoom);const t=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),t&&e.uniformMatrix4fv(t,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!0}}const ue=n=>{n.id=ve,n.href="https://neat.firecms.co",n.target="_blank",n.style.position="absolute",n.style.display="block",n.style.bottom="0",n.style.right="0",n.style.padding="10px",n.style.color="#dcdcdc",n.style.opacity="0.8",n.style.fontFamily="sans-serif",n.style.fontSize="16px",n.style.fontWeight="bold",n.style.textDecoration="none",n.style.zIndex="10000",n.style.pointerEvents="auto",n.setAttribute("data-n","1"),n.innerHTML="NEAT"},be=n=>{const e=n.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const r=e.querySelector("a[data-n]");if(r)return ue(r),r}const i=document.createElement("a");return ue(i),e?.appendChild(i),i};function we(){const n=new Date,e=n.getMinutes(),i=n.getSeconds();return e*60+i}function Se(n=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let r=0;r<n;r++){const t=Math.floor(Math.random()*e.length);i+=e.charAt(t)}return i}function _e(n,e){const i=document.createElement("a");i.download=e,i.href=n,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function Re(){if(document.getElementById("neat-seo-schema"))return;const n=document.createElement("script");n.id="neat-seo-schema",n.type="application/ld+json",n.text=JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"NEAT Gradient",url:"https://neat.firecms.co",author:{"@type":"Organization",name:"FireCMS",url:"https://firecms.co"},description:"Beautiful, fast, heavily customizable, WebGL based gradients."}),document.head.appendChild(n);const e=document.createElement("div");e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="nowrap",e.style.borderWidth="0";try{const i=e.attachShadow({mode:"closed"}),r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",i.appendChild(r)}catch{const r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",e.appendChild(r)}document.body.appendChild(e)}k.NeatGradient=xe,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
495
483
  //# sourceMappingURL=index.umd.js.map