@firecms/neat 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,6 +1,16 @@
1
- import * as l from "three";
2
- const D = 50, E = 80, pe = !0, k = 6, xe = new l.Clock(), G = be();
3
- class ze {
1
+ import * as n from "three";
2
+ console.info(
3
+ `%c\u{1F308} Neat Gradients%c
4
+
5
+ Licensed under MIT + The Commons Clause.
6
+ Free for personal and commercial use.
7
+ Selling this software or its derivatives is strictly prohibited.
8
+ https://neat.firecms.co`,
9
+ "font-weight: bold; font-size: 14px; color: #FF5772;",
10
+ "color: inherit;"
11
+ );
12
+ const U = 50, D = 80, be = !0, j = 6, ze = new n.Clock(), Q = Fe();
13
+ class Ue {
4
14
  _ref;
5
15
  _speed = -1;
6
16
  _horizontalPressure = -1;
@@ -30,7 +40,7 @@ class ze {
30
40
  _mouseDistortionRadius = 0.25;
31
41
  _mouseDecayRate = 0.96;
32
42
  _mouseDarken = 0;
33
- _mouse = new l.Vector2(-1e3, -1e3);
43
+ _mouse = new n.Vector2(-1e3, -1e3);
34
44
  _mouseFBO = null;
35
45
  _sceneMouse = null;
36
46
  _cameraMouse = null;
@@ -60,105 +70,120 @@ class ze {
60
70
  _yOffsetWaveMultiplier = 4e-3;
61
71
  _yOffsetColorMultiplier = 4e-3;
62
72
  _yOffsetFlowMultiplier = 4e-3;
63
- _tempClearColor = new l.Color();
73
+ _tempClearColor = new n.Color();
74
+ _resizeTimeoutId = null;
75
+ _textureNeedsUpdate = !1;
76
+ _lastColorUpdate = 0;
77
+ _linkCheckCounter = 0;
78
+ _mouseUpdateScheduled = !1;
79
+ _pendingMousePosition = null;
80
+ _colorsChanged = !0;
64
81
  constructor(e) {
65
82
  const {
66
83
  ref: o,
67
84
  speed: t = 4,
68
- horizontalPressure: f = 3,
69
- verticalPressure: u = 3,
85
+ horizontalPressure: d = 3,
86
+ verticalPressure: c = 3,
70
87
  waveFrequencyX: s = 5,
71
- waveFrequencyY: d = 5,
72
- waveAmplitude: x = 3,
73
- colors: p,
74
- highlights: y = 4,
75
- shadows: c = 4,
76
- colorSaturation: m = 0,
77
- colorBrightness: P = 1,
88
+ waveFrequencyY: p = 5,
89
+ waveAmplitude: g = 3,
90
+ colors: f,
91
+ highlights: m = 4,
92
+ shadows: u = 4,
93
+ colorSaturation: v = 0,
94
+ colorBrightness: O = 1,
78
95
  colorBlending: M = 5,
79
- grainScale: T = 2,
80
- grainIntensity: C = 0.55,
81
- grainSparsity: B = 0,
82
- grainSpeed: z = 0.1,
96
+ grainScale: z = 2,
97
+ grainIntensity: y = 0.55,
98
+ grainSparsity: T = 0,
99
+ grainSpeed: C = 0.1,
83
100
  wireframe: a = !1,
84
- backgroundColor: n = "#FFFFFF",
101
+ backgroundColor: l = "#FFFFFF",
85
102
  backgroundAlpha: h = 1,
86
103
  resolution: _ = 1,
87
- seed: b,
88
- yOffset: F = 0,
89
- yOffsetWaveMultiplier: A = 4,
90
- yOffsetColorMultiplier: R = 4,
91
- yOffsetFlowMultiplier: X = 4,
92
- flowDistortionA: K = 0,
93
- flowDistortionB: H = 0,
94
- flowScale: Y = 1,
95
- flowEase: J = 0,
96
- flowEnabled: Q = !0,
97
- mouseDistortionStrength: Z = 0,
98
- mouseDistortionRadius: $ = 0.25,
99
- mouseDecayRate: ee = 0.96,
100
- mouseDarken: te = 0,
101
- enableProceduralTexture: oe = !1,
102
- textureVoidLikelihood: se = 0.45,
103
- textureVoidWidthMin: ie = 200,
104
- textureVoidWidthMax: re = 486,
105
- textureBandDensity: ae = 2.15,
106
- textureColorBlending: le = 0.01,
107
- textureSeed: ne = 333,
108
- textureEase: ue = 0.5,
109
- proceduralBackgroundColor: ce = "#000000",
110
- textureShapeTriangles: _e = 20,
111
- textureShapeCircles: he = 15,
112
- textureShapeBars: fe = 15,
113
- textureShapeSquiggles: de = 10
104
+ seed: S,
105
+ yOffset: B = 0,
106
+ yOffsetWaveMultiplier: N = 4,
107
+ yOffsetColorMultiplier: L = 4,
108
+ yOffsetFlowMultiplier: $ = 4,
109
+ flowDistortionA: ee = 0,
110
+ flowDistortionB: te = 0,
111
+ flowScale: oe = 1,
112
+ flowEase: se = 0,
113
+ flowEnabled: ie = !0,
114
+ mouseDistortionStrength: re = 0,
115
+ mouseDistortionRadius: ae = 0.25,
116
+ mouseDecayRate: ne = 0.96,
117
+ mouseDarken: le = 0,
118
+ enableProceduralTexture: ue = !1,
119
+ textureVoidLikelihood: ce = 0.45,
120
+ textureVoidWidthMin: _e = 200,
121
+ textureVoidWidthMax: he = 486,
122
+ textureBandDensity: de = 2.15,
123
+ textureColorBlending: fe = 0.01,
124
+ textureSeed: pe = 333,
125
+ textureEase: me = 0.5,
126
+ proceduralBackgroundColor: ve = "#000000",
127
+ textureShapeTriangles: ge = 20,
128
+ textureShapeCircles: xe = 15,
129
+ textureShapeBars: ye = 15,
130
+ textureShapeSquiggles: we = 10
114
131
  } = e;
115
- this._ref = o, this.destroy = this.destroy.bind(this), this._initScene = this._initScene.bind(this), this._buildMaterial = this._buildMaterial.bind(this), this.speed = t, this.horizontalPressure = f, this.verticalPressure = u, this.waveFrequencyX = s, this.waveFrequencyY = d, this.waveAmplitude = x, this.colorBlending = M, this.grainScale = T, this.grainIntensity = C, this.grainSparsity = B, this.grainSpeed = z, this.colors = p, this.shadows = c, this.highlights = y, this.colorSaturation = m, this.colorBrightness = P, this.wireframe = a, this.backgroundColor = n, this.backgroundAlpha = h, this.yOffset = F, this.yOffsetWaveMultiplier = A, this.yOffsetColorMultiplier = R, this.yOffsetFlowMultiplier = X, this.flowDistortionA = K, this.flowDistortionB = H, this.flowScale = Y, this.flowEase = J, this.flowEnabled = Q, this.mouseDistortionStrength = Z, this.mouseDistortionRadius = $, this.mouseDecayRate = ee, this.mouseDarken = te, this.enableProceduralTexture = oe, this.textureVoidLikelihood = se, this.textureVoidWidthMin = ie, this.textureVoidWidthMax = re, this.textureBandDensity = ae, this.textureColorBlending = le, this.textureSeed = ne, this.textureEase = ue, this._proceduralBackgroundColor = ce, this._textureShapeTriangles = _e, this._textureShapeCircles = he, this._textureShapeBars = fe, this._textureShapeSquiggles = de, this._setupMouseInteraction(), this.sceneState = this._initScene(_);
116
- let U = b !== void 0 ? b : we();
117
- const I = () => {
118
- const { renderer: g, camera: q, scene: O } = this.sceneState;
119
- if (Math.floor(U * 10) % 5 === 0 && (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement = ye(o)), this._cachedUniforms) {
120
- const i = this._cachedUniforms;
121
- U += xe.getDelta() * this._speed, i.u_time.value = U, i.u_resolution.value.set(this._ref.width, this._ref.height), i.u_color_pressure.value.set(this._horizontalPressure, this._verticalPressure), i.u_wave_frequency_x.value = this._waveFrequencyX, i.u_wave_frequency_y.value = this._waveFrequencyY, i.u_wave_amplitude.value = this._waveAmplitude, i.u_color_blending.value = this._colorBlending, i.u_shadows.value = this._shadows, i.u_highlights.value = this._highlights, i.u_saturation.value = this._saturation, i.u_brightness.value = this._brightness, i.u_grain_intensity.value = this._grainIntensity, i.u_grain_sparsity.value = this._grainSparsity, i.u_grain_speed.value = this._grainSpeed, i.u_grain_scale.value = this._grainScale, i.u_y_offset.value = this._yOffset, i.u_y_offset_wave_multiplier.value = this._yOffsetWaveMultiplier, i.u_y_offset_color_multiplier.value = this._yOffsetColorMultiplier, i.u_y_offset_flow_multiplier.value = this._yOffsetFlowMultiplier, i.u_flow_distortion_a.value = this._flowDistortionA, i.u_flow_distortion_b.value = this._flowDistortionB, i.u_flow_scale.value = this._flowScale, i.u_flow_ease.value = this._flowEase, i.u_flow_enabled.value = this._flowEnabled ? 1 : 0, i.u_mouse_distortion_strength.value = this._mouseDistortionStrength, i.u_mouse_distortion_radius.value = this._mouseDistortionRadius, i.u_mouse_darken.value = this._mouseDarken, i.u_enable_procedural_texture.value = this._enableProceduralTexture ? 1 : 0, i.u_procedural_texture.value = this._proceduralTexture, i.u_texture_ease.value = this._textureEase;
122
- const w = i.u_colors.value;
123
- for (let v = 0; v < k; v++)
124
- if (v < this._colors.length) {
125
- const S = this._colors[v];
126
- w[v].is_active = S.enabled ? 1 : 0, w[v].color.setStyle(S.color, ""), w[v].influence = S.influence || 0;
127
- } else
128
- w[v].is_active = 0;
129
- i.u_colors_count.value = k, this.sceneState.meshes[0].material.wireframe = this._wireframe;
132
+ this._ref = o, this.destroy = this.destroy.bind(this), this._initScene = this._initScene.bind(this), this._buildMaterial = this._buildMaterial.bind(this), this.speed = t, this.horizontalPressure = d, this.verticalPressure = c, this.waveFrequencyX = s, this.waveFrequencyY = p, this.waveAmplitude = g, this.colorBlending = M, this.grainScale = z, this.grainIntensity = y, this.grainSparsity = T, this.grainSpeed = C, this.colors = f, this.shadows = u, this.highlights = m, this.colorSaturation = v, this.colorBrightness = O, this.wireframe = a, this.backgroundColor = l, this.backgroundAlpha = h, this.yOffset = B, this.yOffsetWaveMultiplier = N, this.yOffsetColorMultiplier = L, this.yOffsetFlowMultiplier = $, this.flowDistortionA = ee, this.flowDistortionB = te, this.flowScale = oe, this.flowEase = se, this.flowEnabled = ie, this.mouseDistortionStrength = re, this.mouseDistortionRadius = ae, this.mouseDecayRate = ne, this.mouseDarken = le, this.enableProceduralTexture = ue, this.textureVoidLikelihood = ce, this.textureVoidWidthMin = _e, this.textureVoidWidthMax = he, this.textureBandDensity = de, this.textureColorBlending = fe, this.textureSeed = pe, this.textureEase = me, this._proceduralBackgroundColor = ve, this._textureShapeTriangles = ge, this._textureShapeCircles = xe, this._textureShapeBars = ye, this._textureShapeSquiggles = we, this._setupMouseInteraction(), this.sceneState = this._initScene(_), Be();
133
+ let G = S !== void 0 ? S : Oe();
134
+ const X = () => {
135
+ const { renderer: w, camera: E, scene: F } = this.sceneState;
136
+ if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement = Pe(o))), this._cachedUniforms) {
137
+ const r = this._cachedUniforms;
138
+ G += ze.getDelta() * this._speed, r.u_time.value = G, r.u_resolution.value.set(this._ref.width, this._ref.height), r.u_color_pressure.value.set(this._horizontalPressure, this._verticalPressure), r.u_wave_frequency_x.value = this._waveFrequencyX, r.u_wave_frequency_y.value = this._waveFrequencyY, r.u_wave_amplitude.value = this._waveAmplitude, r.u_color_blending.value = this._colorBlending, r.u_shadows.value = this._shadows, r.u_highlights.value = this._highlights, r.u_saturation.value = this._saturation, r.u_brightness.value = this._brightness, r.u_grain_intensity.value = this._grainIntensity, r.u_grain_sparsity.value = this._grainSparsity, r.u_grain_speed.value = this._grainSpeed, r.u_grain_scale.value = this._grainScale, r.u_y_offset.value = this._yOffset, r.u_y_offset_wave_multiplier.value = this._yOffsetWaveMultiplier, r.u_y_offset_color_multiplier.value = this._yOffsetColorMultiplier, r.u_y_offset_flow_multiplier.value = this._yOffsetFlowMultiplier, r.u_flow_distortion_a.value = this._flowDistortionA, r.u_flow_distortion_b.value = this._flowDistortionB, r.u_flow_scale.value = this._flowScale, r.u_flow_ease.value = this._flowEase, r.u_flow_enabled.value = this._flowEnabled ? 1 : 0, r.u_mouse_distortion_strength.value = this._mouseDistortionStrength, r.u_mouse_distortion_radius.value = this._mouseDistortionRadius, r.u_mouse_darken.value = this._mouseDarken, r.u_enable_procedural_texture.value = this._enableProceduralTexture ? 1 : 0, this._textureNeedsUpdate && this._enableProceduralTexture && (this._proceduralTexture && this._proceduralTexture.dispose(), this._proceduralTexture = this._createProceduralTexture(), this._textureNeedsUpdate = !1), r.u_procedural_texture.value = this._proceduralTexture, r.u_texture_ease.value = this._textureEase, this.sceneState.meshes[0].material.wireframe = this._wireframe;
139
+ const x = Date.now();
140
+ if (this._colorsChanged || x - this._lastColorUpdate > 100) {
141
+ this._lastColorUpdate = x, this._colorsChanged = !1;
142
+ const q = r.u_colors.value;
143
+ for (let P = 0; P < j; P++)
144
+ if (P < this._colors.length) {
145
+ const V = this._colors[P];
146
+ q[P].is_active = V.enabled ? 1 : 0, q[P].color.setStyle(V.color, ""), q[P].influence = V.influence || 0;
147
+ } else
148
+ q[P].is_active = 0;
149
+ r.u_colors_count.value = j;
150
+ }
130
151
  }
131
- if (this._mouseFBO && this._sceneMouse && this._cameraMouse) {
132
- let i = !1;
133
- for (let v = 0; v < this._mouseObjects.length; v++) {
134
- const S = this._mouseObjects[v];
135
- S.mesh.visible && (i = !0, S.mesh.rotation.z += 0.01, S.mesh.material instanceof l.MeshBasicMaterial && (S.mesh.material.opacity *= this._mouseDecayRate, S.mesh.material.opacity < 0.01 && (S.mesh.visible = !1)));
152
+ if (this._mouseFBO && this._sceneMouse && this._cameraMouse && this._mouseDistortionStrength > 0) {
153
+ let r = !1;
154
+ for (let x = 0; x < this._mouseObjects.length; x++) {
155
+ const b = this._mouseObjects[x];
156
+ b.mesh.visible && (r = !0, b.mesh.rotation.z += 0.01, b.mesh.material instanceof n.MeshBasicMaterial && (b.mesh.material.opacity *= this._mouseDecayRate, b.mesh.material.opacity < 0.01 && (b.mesh.visible = !1)));
157
+ }
158
+ if (r) {
159
+ w.getClearColor(this._tempClearColor);
160
+ const x = w.getClearAlpha();
161
+ w.setClearColor(0, 0), w.setRenderTarget(this._mouseFBO), w.clear(), w.render(this._sceneMouse, this._cameraMouse), w.setRenderTarget(null), w.setClearColor(this._tempClearColor, x), this._cachedUniforms && (this._cachedUniforms.u_mouse_texture.value = this._mouseFBO.texture);
136
162
  }
137
- g.getClearColor(this._tempClearColor);
138
- const w = g.getClearAlpha();
139
- g.setClearColor(0, 0), g.setRenderTarget(this._mouseFBO), g.clear(), i && g.render(this._sceneMouse, this._cameraMouse), g.setRenderTarget(null), g.setClearColor(this._tempClearColor, w), this._cachedUniforms && (this._cachedUniforms.u_mouse_texture.value = this._mouseFBO.texture);
140
163
  }
141
- g.setClearColor(this._backgroundColor, this._backgroundAlpha), g.render(O, q), this.requestRef = requestAnimationFrame(I);
142
- }, ve = () => {
143
- const { renderer: g } = this.sceneState, q = g.domElement, O = q.clientWidth, i = q.clientHeight;
144
- if (this.sceneState.renderer.setSize(O, i, !1), W(this.sceneState.camera, O, i), this._mouseFBO && this._cameraMouse) {
145
- const w = i / 2, v = O / i;
146
- this._mouseFBO.setSize(O / 2, i / 2), this._cameraMouse.left = -w * v, this._cameraMouse.right = w * v, this._cameraMouse.top = w, this._cameraMouse.bottom = -w, this._cameraMouse.updateProjectionMatrix();
164
+ w.setClearColor(this._backgroundColor, this._backgroundAlpha), w.render(F, E), this.requestRef = requestAnimationFrame(X);
165
+ }, Se = () => {
166
+ const { renderer: w } = this.sceneState, E = w.domElement, F = E.clientWidth, r = E.clientHeight;
167
+ if (this.sceneState.renderer.setSize(F, r, !1), K(this.sceneState.camera, F, r), this._mouseFBO && this._cameraMouse) {
168
+ const x = r / 2, b = F / r;
169
+ this._mouseFBO.setSize(F / 2, r / 2), this._cameraMouse.left = -x * b, this._cameraMouse.right = x * b, this._cameraMouse.top = x, this._cameraMouse.bottom = -x, this._cameraMouse.updateProjectionMatrix();
147
170
  }
148
171
  };
149
- this.sizeObserver = new ResizeObserver((g) => {
150
- ve();
151
- }), this.sizeObserver.observe(o), I();
172
+ this.sizeObserver = new ResizeObserver(() => {
173
+ this._resizeTimeoutId !== null && clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = window.setTimeout(() => {
174
+ Se(), this._resizeTimeoutId = null;
175
+ }, 100);
176
+ }), this.sizeObserver.observe(o), X();
152
177
  }
153
178
  destroy() {
154
- this && (cancelAnimationFrame(this.requestRef), this.sizeObserver.disconnect(), this.sceneState && (this.sceneState.renderer.dispose(), this.sceneState.meshes.forEach((e) => {
179
+ this && (cancelAnimationFrame(this.requestRef), this.sizeObserver.disconnect(), this._resizeTimeoutId !== null && (clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = null), this.sceneState && (this.sceneState.renderer.dispose(), this.sceneState.meshes.forEach((e) => {
155
180
  e.geometry.dispose(), Array.isArray(e.material) ? e.material.forEach((o) => o.dispose()) : e.material.dispose();
156
181
  })), this._mouseFBO && this._mouseFBO.dispose(), this._proceduralTexture && this._proceduralTexture.dispose());
157
182
  }
158
183
  downloadAsPNG(e = "neat.png") {
159
184
  console.log("Downloading as PNG", this._ref);
160
185
  const o = this._ref.toDataURL("image/png");
161
- console.log("data", o), Se(o, e);
186
+ console.log("data", o), Te(o, e);
162
187
  }
163
188
  set speed(e) {
164
189
  this._speed = e / 20;
@@ -179,7 +204,7 @@ class ze {
179
204
  this._waveAmplitude = e * 0.75;
180
205
  }
181
206
  set colors(e) {
182
- this._colors = e;
207
+ this._colors = e, this._colorsChanged = !0;
183
208
  }
184
209
  set highlights(e) {
185
210
  this._highlights = e / 100;
@@ -275,25 +300,25 @@ class ze {
275
300
  this._mouseDarken = e;
276
301
  }
277
302
  set enableProceduralTexture(e) {
278
- this._enableProceduralTexture = e, e && !this._proceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
303
+ this._enableProceduralTexture = e, e && !this._proceduralTexture && (this._textureNeedsUpdate = !0);
279
304
  }
280
305
  set textureVoidLikelihood(e) {
281
- this._textureVoidLikelihood = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
306
+ this._textureVoidLikelihood = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
282
307
  }
283
308
  set textureVoidWidthMin(e) {
284
- this._textureVoidWidthMin = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
309
+ this._textureVoidWidthMin = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
285
310
  }
286
311
  set textureVoidWidthMax(e) {
287
- this._textureVoidWidthMax = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
312
+ this._textureVoidWidthMax = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
288
313
  }
289
314
  set textureBandDensity(e) {
290
- this._textureBandDensity = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
315
+ this._textureBandDensity = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
291
316
  }
292
317
  set textureColorBlending(e) {
293
- this._textureColorBlending = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
318
+ this._textureColorBlending = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
294
319
  }
295
320
  set textureSeed(e) {
296
- this._textureSeed = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
321
+ this._textureSeed = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
297
322
  }
298
323
  get textureEase() {
299
324
  return this._textureEase;
@@ -302,58 +327,58 @@ class ze {
302
327
  this._textureEase = e;
303
328
  }
304
329
  set proceduralBackgroundColor(e) {
305
- this._proceduralBackgroundColor = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
330
+ this._proceduralBackgroundColor = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
306
331
  }
307
332
  set textureShapeTriangles(e) {
308
- this._textureShapeTriangles = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
333
+ this._textureShapeTriangles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
309
334
  }
310
335
  set textureShapeCircles(e) {
311
- this._textureShapeCircles = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
336
+ this._textureShapeCircles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
312
337
  }
313
338
  set textureShapeBars(e) {
314
- this._textureShapeBars = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
339
+ this._textureShapeBars = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
315
340
  }
316
341
  set textureShapeSquiggles(e) {
317
- this._textureShapeSquiggles = e, this._enableProceduralTexture && (this._proceduralTexture = this._createProceduralTexture());
342
+ this._textureShapeSquiggles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
318
343
  }
319
344
  _initScene(e) {
320
345
  const o = this._ref.width, t = this._ref.height;
321
- this.sceneState && this.sceneState.renderer && (this.sceneState.renderer.dispose(), this.sceneState.meshes.forEach((c) => {
322
- c.geometry.dispose(), Array.isArray(c.material) ? c.material.forEach((m) => m.dispose()) : c.material.dispose();
346
+ this.sceneState && this.sceneState.renderer && (this.sceneState.renderer.dispose(), this.sceneState.meshes.forEach((u) => {
347
+ u.geometry.dispose(), Array.isArray(u.material) ? u.material.forEach((v) => v.dispose()) : u.material.dispose();
323
348
  }));
324
- const f = new l.WebGLRenderer({
349
+ const d = new n.WebGLRenderer({
325
350
  alpha: !0,
326
351
  preserveDrawingBuffer: !0,
327
352
  canvas: this._ref
328
353
  });
329
- f.setClearColor(16711680, 0.5), f.setSize(o, t, !1);
330
- const u = [], s = new l.Scene(), d = this._buildMaterial(o, t), x = new l.PlaneGeometry(D, E, 240 * e, 240 * e), p = new l.Mesh(x, d);
331
- p.rotation.x = -Math.PI / 3.5, p.position.z = -1, u.push(p), s.add(p);
332
- const y = new l.OrthographicCamera(0, 0, 0, 0, 0, 0);
333
- return y.position.z = 5, W(y, o, t), {
334
- renderer: f,
335
- camera: y,
354
+ d.setClearColor(16711680, 0.5), d.setSize(o, t, !1);
355
+ const c = [], s = new n.Scene(), p = this._buildMaterial(o, t), g = new n.PlaneGeometry(U, D, 240 * e, 240 * e), f = new n.Mesh(g, p);
356
+ f.rotation.x = -Math.PI / 3.5, f.position.z = -1, c.push(f), s.add(f);
357
+ const m = new n.OrthographicCamera(0, 0, 0, 0, 0, 0);
358
+ return m.position.z = 5, K(m, o, t), {
359
+ renderer: d,
360
+ camera: m,
336
361
  scene: s,
337
- meshes: u,
362
+ meshes: c,
338
363
  resolution: e
339
364
  };
340
365
  }
341
366
  _buildMaterial(e, o) {
342
- const t = Array.from({ length: k }).map((s, d) => ({
343
- is_active: d < this._colors.length && this._colors[d].enabled ? 1 : 0,
344
- color: new l.Color(d < this._colors.length ? this._colors[d].color : 0),
345
- influence: d < this._colors.length && this._colors[d].influence || 0
346
- })), f = {
367
+ const t = Array.from({ length: j }).map((s, p) => ({
368
+ is_active: p < this._colors.length && this._colors[p].enabled ? 1 : 0,
369
+ color: new n.Color(p < this._colors.length ? this._colors[p].color : 0),
370
+ influence: p < this._colors.length && this._colors[p].influence || 0
371
+ })), d = {
347
372
  u_time: { value: 0 },
348
- u_color_pressure: { value: new l.Vector2(this._horizontalPressure, this._verticalPressure) },
373
+ u_color_pressure: { value: new n.Vector2(this._horizontalPressure, this._verticalPressure) },
349
374
  u_wave_frequency_x: { value: this._waveFrequencyX },
350
375
  u_wave_frequency_y: { value: this._waveFrequencyY },
351
376
  u_wave_amplitude: { value: this._waveAmplitude },
352
- u_resolution: { value: new l.Vector2(e, o) },
377
+ u_resolution: { value: new n.Vector2(e, o) },
353
378
  u_colors: { value: t },
354
379
  u_colors_count: { value: this._colors.length },
355
- u_plane_width: { value: D },
356
- u_plane_height: { value: E },
380
+ u_plane_width: { value: U },
381
+ u_plane_height: { value: D },
357
382
  u_shadows: { value: this._shadows },
358
383
  u_highlights: { value: this._highlights },
359
384
  u_grain_intensity: { value: this._grainIntensity },
@@ -379,164 +404,180 @@ class ze {
379
404
  u_saturation: { value: this._saturation },
380
405
  u_brightness: { value: this._brightness },
381
406
  u_color_blending: { value: this._colorBlending }
382
- }, u = new l.ShaderMaterial({
383
- uniforms: f,
384
- vertexShader: V() + L() + N() + ge(),
385
- fragmentShader: V() + N() + L() + me()
407
+ }, c = new n.ShaderMaterial({
408
+ uniforms: d,
409
+ vertexShader: H() + Y() + J() + Ce(),
410
+ fragmentShader: H() + J() + Y() + Me()
386
411
  });
387
- return this._cachedUniforms = f, u.wireframe = pe, u;
412
+ return this._cachedUniforms = d, c.wireframe = be, c;
388
413
  }
389
414
  _setupMouseInteraction() {
390
415
  if (!this._ref)
391
416
  return;
392
417
  const e = this._ref.width, o = this._ref.height;
393
- this._mouseFBO = new l.WebGLRenderTarget(e / 2, o / 2), this._sceneMouse = new l.Scene();
394
- const t = o / 2, f = e / o;
395
- this._cameraMouse = new l.OrthographicCamera(
396
- -t * f,
397
- t * f,
418
+ this._mouseFBO = new n.WebGLRenderTarget(e / 2, o / 2), this._sceneMouse = new n.Scene();
419
+ const t = o / 2, d = e / o;
420
+ this._cameraMouse = new n.OrthographicCamera(
421
+ -t * d,
422
+ t * d,
398
423
  t,
399
424
  -t,
400
425
  0,
401
426
  1e4
402
427
  ), this._cameraMouse.position.set(0, 0, 100);
403
- const u = document.createElement("canvas");
404
- u.width = 128, u.height = 128;
405
- const s = u.getContext("2d");
428
+ const c = document.createElement("canvas");
429
+ c.width = 128, c.height = 128;
430
+ const s = c.getContext("2d");
406
431
  if (s) {
407
- const c = s.createRadialGradient(64, 64, 0, 64, 64, 64);
408
- c.addColorStop(0, "rgba(255,255,255,0.8)"), c.addColorStop(0.5, "rgba(255,255,255,0.4)"), c.addColorStop(1, "rgba(255,255,255,0)"), s.fillStyle = c, s.fillRect(0, 0, 128, 128);
432
+ const u = s.createRadialGradient(64, 64, 0, 64, 64, 64);
433
+ u.addColorStop(0, "rgba(255,255,255,0.8)"), u.addColorStop(0.5, "rgba(255,255,255,0.4)"), u.addColorStop(1, "rgba(255,255,255,0)"), s.fillStyle = u, s.fillRect(0, 0, 128, 128);
409
434
  }
410
- const d = new l.CanvasTexture(u), x = new l.MeshBasicMaterial({
411
- map: d,
435
+ const p = new n.CanvasTexture(c), g = new n.MeshBasicMaterial({
436
+ map: p,
412
437
  transparent: !0,
413
438
  opacity: 1,
414
439
  depthTest: !1,
415
- blending: l.AdditiveBlending
416
- }), p = new l.PlaneGeometry(200, 200), y = 50;
417
- for (let c = 0; c < y; c++) {
418
- const m = new l.Mesh(p, x.clone());
419
- m.visible = !1, this._sceneMouse.add(m), this._mouseObjects.push({ mesh: m, active: !1 });
440
+ blending: n.AdditiveBlending
441
+ }), f = new n.PlaneGeometry(200, 200), m = 50;
442
+ for (let u = 0; u < m; u++) {
443
+ const v = new n.Mesh(f, g.clone());
444
+ v.visible = !1, this._sceneMouse.add(v), this._mouseObjects.push({ mesh: v, active: !1 });
420
445
  }
421
446
  this._updateBrushScale(), this._ref.addEventListener("mousemove", this._onMouseMove.bind(this));
422
447
  }
423
448
  _onMouseMove(e) {
424
449
  if (!this._ref || !this._sceneMouse)
425
450
  return;
426
- const o = this._ref.getBoundingClientRect(), t = this._ref.width, f = this._ref.height;
427
- this._mouse.x = e.clientX - o.left - t / 2, this._mouse.y = -(e.clientY - o.top - f / 2);
428
- const u = this._mouseObjects[this._currentBrush];
429
- u.mesh.scale.set(this._mouseBrushBaseScale, this._mouseBrushBaseScale, 1), u.active = !0, u.mesh.visible = !0, u.mesh.position.set(this._mouse.x, this._mouse.y, 0), u.mesh.rotation.z = Math.random() * Math.PI * 2, u.mesh.material instanceof l.MeshBasicMaterial && (u.mesh.material.opacity = 1), this._currentBrush = (this._currentBrush + 1) % this._mouseObjects.length;
451
+ const o = this._ref.getBoundingClientRect(), t = this._ref.width, d = this._ref.height;
452
+ this._pendingMousePosition = {
453
+ x: e.clientX - o.left - t / 2,
454
+ y: -(e.clientY - o.top - d / 2)
455
+ }, this._mouseUpdateScheduled || (this._mouseUpdateScheduled = !0, requestAnimationFrame(() => {
456
+ if (this._mouseUpdateScheduled = !1, !this._pendingMousePosition)
457
+ return;
458
+ this._mouse.x = this._pendingMousePosition.x, this._mouse.y = this._pendingMousePosition.y;
459
+ const c = this._mouseObjects[this._currentBrush];
460
+ c.mesh.scale.set(this._mouseBrushBaseScale, this._mouseBrushBaseScale, 1), c.active = !0, c.mesh.visible = !0, c.mesh.position.set(this._mouse.x, this._mouse.y, 0), c.mesh.rotation.z = Math.random() * Math.PI * 2, c.mesh.material instanceof n.MeshBasicMaterial && (c.mesh.material.opacity = 1), this._currentBrush = (this._currentBrush + 1) % this._mouseObjects.length, this._pendingMousePosition = null;
461
+ }));
430
462
  }
431
463
  _createProceduralTexture() {
432
464
  const o = document.createElement("canvas");
433
465
  o.width = 1024, o.height = 1024;
434
- const t = o.getContext("2d");
466
+ const t = o.getContext("2d", { willReadFrequently: !0 });
435
467
  if (!t)
436
- return new l.Texture();
437
- let f = this._textureSeed;
438
- const u = this._textureSeed;
468
+ return new n.Texture();
469
+ let d = this._textureSeed;
470
+ const c = this._textureSeed;
439
471
  function s() {
440
- const a = Math.sin(f++) * 1e4;
472
+ const a = Math.sin(d++) * 1e4;
441
473
  return a - Math.floor(a);
442
474
  }
443
- const d = (a) => {
444
- f = u + a;
445
- }, x = this._colors.filter((a) => a.enabled).map((a) => a.color);
446
- if (x.length === 0)
447
- return new l.Texture();
448
- function p(a) {
449
- const n = parseInt(a.replace("#", ""), 16);
475
+ const p = (a) => {
476
+ d = c + a;
477
+ }, g = this._colors.filter((a) => a.enabled).map((a) => a.color);
478
+ if (g.length === 0)
479
+ return new n.Texture();
480
+ function f(a) {
481
+ const l = parseInt(a.replace("#", ""), 16);
450
482
  return {
451
- r: n >> 16 & 255,
452
- g: n >> 8 & 255,
453
- b: n & 255
483
+ r: l >> 16 & 255,
484
+ g: l >> 8 & 255,
485
+ b: l & 255
454
486
  };
455
487
  }
456
- function y(a, n, h) {
457
- return "#" + ((1 << 24) + (Math.round(a) << 16) + (Math.round(n) << 8) + Math.round(h)).toString(16).slice(1);
488
+ function m(a, l, h) {
489
+ return "#" + ((1 << 24) + (Math.round(a) << 16) + (Math.round(l) << 8) + Math.round(h)).toString(16).slice(1);
458
490
  }
459
- const c = () => {
460
- const a = x[Math.floor(s() * x.length)], n = x[Math.floor(s() * x.length)], h = s() * this._textureColorBlending, _ = p(a), b = p(n), F = _.r + (b.r - _.r) * h, A = _.g + (b.g - _.g) * h, R = _.b + (b.b - _.b) * h;
461
- return y(F, A, R);
462
- }, m = this._proceduralBackgroundColor || "#000000";
463
- t.fillStyle = m, t.fillRect(0, 0, 1024, 1024);
464
- const P = t.createLinearGradient(0, 0, 0, 1024);
465
- P.addColorStop(0, c()), P.addColorStop(1, c()), t.fillStyle = P, t.fillRect(0, 0, 1024, 1024);
491
+ const u = () => {
492
+ const a = g[Math.floor(s() * g.length)], l = g[Math.floor(s() * g.length)], h = s() * this._textureColorBlending, _ = f(a), S = f(l), B = _.r + (S.r - _.r) * h, N = _.g + (S.g - _.g) * h, L = _.b + (S.b - _.b) * h;
493
+ return m(B, N, L);
494
+ }, v = this._proceduralBackgroundColor || "#000000";
495
+ t.fillStyle = v, t.fillRect(0, 0, 1024, 1024);
496
+ const O = t.createLinearGradient(0, 0, 0, 1024);
497
+ O.addColorStop(0, u()), O.addColorStop(1, u()), t.fillStyle = O, t.fillRect(0, 0, 1024, 1024);
466
498
  for (let a = 0; a < this._textureShapeTriangles; a++) {
467
- t.fillStyle = c(), t.beginPath();
468
- const n = s() * 1024, h = s() * 1024, _ = 100 + s() * 300;
469
- t.moveTo(n, h), t.lineTo(n + (s() - 0.5) * _, h + (s() - 0.5) * _), t.lineTo(n + (s() - 0.5) * _, h + (s() - 0.5) * _), t.fill();
499
+ t.fillStyle = u(), t.beginPath();
500
+ const l = s() * 1024, h = s() * 1024, _ = 100 + s() * 300;
501
+ t.moveTo(l, h), t.lineTo(l + (s() - 0.5) * _, h + (s() - 0.5) * _), t.lineTo(l + (s() - 0.5) * _, h + (s() - 0.5) * _), t.fill();
470
502
  }
471
503
  for (let a = 0; a < this._textureShapeCircles; a++) {
472
- t.strokeStyle = c(), t.lineWidth = 10 + s() * 50, t.beginPath();
473
- const n = s() * 1024, h = s() * 1024, _ = 50 + s() * 150;
474
- t.arc(n, h, _, 0, Math.PI * 2), t.stroke();
504
+ t.strokeStyle = u(), t.lineWidth = 10 + s() * 50, t.beginPath();
505
+ const l = s() * 1024, h = s() * 1024, _ = 50 + s() * 150;
506
+ t.arc(l, h, _, 0, Math.PI * 2), t.stroke();
475
507
  }
476
508
  for (let a = 0; a < this._textureShapeBars; a++)
477
- t.fillStyle = c(), t.save(), t.translate(s() * 1024, s() * 1024), t.rotate(s() * Math.PI), t.fillRect(-150, -25, 300, 50), t.restore();
509
+ t.fillStyle = u(), t.save(), t.translate(s() * 1024, s() * 1024), t.rotate(s() * Math.PI), t.fillRect(-150, -25, 300, 50), t.restore();
478
510
  t.lineWidth = 15, t.lineCap = "round";
479
511
  for (let a = 0; a < this._textureShapeSquiggles; a++) {
480
- t.strokeStyle = c(), t.beginPath();
481
- let n = s() * 1024, h = s() * 1024;
482
- t.moveTo(n, h);
512
+ t.strokeStyle = u(), t.beginPath();
513
+ let l = s() * 1024, h = s() * 1024;
514
+ t.moveTo(l, h);
483
515
  for (let _ = 0; _ < 4; _++)
484
516
  t.bezierCurveTo(
485
- n + (s() - 0.5) * 300,
517
+ l + (s() - 0.5) * 300,
486
518
  h + (s() - 0.5) * 300,
487
- n + (s() - 0.5) * 300,
519
+ l + (s() - 0.5) * 300,
488
520
  h + (s() - 0.5) * 300,
489
- n + (s() - 0.5) * 300,
521
+ l + (s() - 0.5) * 300,
490
522
  h + (s() - 0.5) * 300
491
- ), n += (s() - 0.5) * 300, h += (s() - 0.5) * 300;
523
+ ), l += (s() - 0.5) * 300, h += (s() - 0.5) * 300;
492
524
  t.stroke();
493
525
  }
494
- d(5e4);
526
+ p(5e4);
495
527
  const M = document.createElement("canvas");
496
528
  M.width = 1024, M.height = 1024;
497
- const T = M.getContext("2d");
498
- if (!T)
499
- return new l.Texture();
500
- T.fillStyle = m, T.fillRect(0, 0, 1024, 1024);
501
- let C = 0;
502
- const B = [];
503
- for (; C < 1024; )
529
+ const z = M.getContext("2d", { willReadFrequently: !0 });
530
+ if (!z)
531
+ return new n.Texture();
532
+ z.fillStyle = v, z.fillRect(0, 0, 1024, 1024);
533
+ let y = 0;
534
+ const T = [];
535
+ for (; y < 1024; )
504
536
  if (s() < this._textureVoidLikelihood) {
505
- const n = this._textureVoidWidthMin + s() * (this._textureVoidWidthMax - this._textureVoidWidthMin);
506
- B.push({ type: "void", x: C, width: n }), C += n;
537
+ const l = this._textureVoidWidthMin + s() * (this._textureVoidWidthMax - this._textureVoidWidthMin);
538
+ T.push({ type: "void", x: y, width: l }), y += l;
507
539
  } else {
508
- const n = 50 + s() * 200;
509
- B.push({ type: "matter", x: C, width: n }), C += n;
540
+ const l = 50 + s() * 200;
541
+ T.push({ type: "matter", x: y, width: l }), y += l;
510
542
  }
511
- for (const a of B)
543
+ for (const a of T)
512
544
  if (a.type === "matter") {
513
- const n = a.x, h = Math.min(a.x + a.width, 1024);
514
- let _ = n;
545
+ const l = a.x, h = Math.min(a.x + a.width, 1024);
546
+ let _ = l;
515
547
  for (; _ < h; ) {
516
- const b = (2 + s() * 20) / this._textureBandDensity, F = Math.floor(s() * 1024);
517
- T.drawImage(
548
+ const S = (2 + s() * 20) / this._textureBandDensity, B = Math.floor(s() * 1024);
549
+ z.drawImage(
518
550
  o,
519
- F,
551
+ B,
520
552
  0,
521
- b,
553
+ S,
522
554
  1024,
523
555
  _,
524
556
  0,
525
- b,
557
+ S,
526
558
  1024
527
- ), _ += b;
559
+ ), _ += S;
528
560
  }
529
561
  }
530
- const z = new l.CanvasTexture(M);
531
- return z.minFilter = l.LinearMipmapLinearFilter, z.magFilter = l.LinearFilter, z.wrapS = l.RepeatWrapping, z.wrapT = l.RepeatWrapping, z.anisotropy = 16, z.needsUpdate = !0, z;
562
+ const C = new n.CanvasTexture(M);
563
+ return C.minFilter = n.LinearMipmapLinearFilter, C.magFilter = n.LinearFilter, C.wrapS = n.RepeatWrapping, C.wrapT = n.RepeatWrapping, C.anisotropy = 16, C.needsUpdate = !0, C;
532
564
  }
533
565
  }
534
- function W(r, e, o) {
535
- const u = e * o / 1e6 * D * E / 1.5, s = e / o, d = Math.sqrt(u * s), x = u / d, p = -D / 2, y = Math.min((p + d) / 1.5, D / 2), c = E / 4, m = Math.max((c - x) / 2, -E / 4), P = -100, M = 1e3;
536
- r instanceof l.OrthographicCamera ? (r.left = p, r.right = y, r.top = c, r.bottom = m, r.near = P, r.far = M, r.updateProjectionMatrix()) : r instanceof l.PerspectiveCamera && (r.aspect = e / o, r.updateProjectionMatrix());
566
+ function K(i, e, o) {
567
+ const c = e * o / 1e6 * U * D / 1.5, s = e / o, p = Math.sqrt(c * s), g = c / p;
568
+ let f = -U / 2, m = Math.min((f + p) / 1.5, U / 2), u = D / 4, v = Math.max((u - g) / 2, -D / 4);
569
+ if (s < 1) {
570
+ const z = s;
571
+ f = f * z, m = m * z;
572
+ const y = 1.05;
573
+ f = f * y, m = m * y, u = u * y, v = v * y;
574
+ }
575
+ const O = -100, M = 1e3;
576
+ i instanceof n.OrthographicCamera ? (i.left = f, i.right = m, i.top = u, i.bottom = v, i.near = O, i.far = M, i.updateProjectionMatrix()) : i instanceof n.PerspectiveCamera && (i.aspect = e / o, i.updateProjectionMatrix());
537
577
  }
538
- function ge() {
539
- return `
578
+ let k = null, A = null;
579
+ function Ce() {
580
+ return k || (k = `
540
581
  void main() {
541
582
  vUv = uv;
542
583
 
@@ -613,10 +654,10 @@ void main() {
613
654
  gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
614
655
  v_new_position = gl_Position;
615
656
  }
616
- `;
657
+ `, k);
617
658
  }
618
- function me() {
619
- return `
659
+ function Me() {
660
+ return A || (A = `
620
661
  float random(vec2 p) {
621
662
  return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
622
663
  }
@@ -698,9 +739,10 @@ void main() {
698
739
 
699
740
  gl_FragColor = vec4(color, 1.0);
700
741
  }
701
- `;
742
+ `, A);
702
743
  }
703
- const V = () => `
744
+ let R = null;
745
+ const H = () => R || (R = `
704
746
  precision highp float;
705
747
 
706
748
  struct Color {
@@ -764,7 +806,9 @@ varying vec4 v_new_position;
764
806
  varying vec3 v_color;
765
807
  varying float v_displacement_amount;
766
808
 
767
- `, L = () => `
809
+ `, R);
810
+ let I = null;
811
+ const Y = () => I || (I = `
768
812
 
769
813
  // 1. REPLACEMENT PERMUTE:
770
814
  // Uses a hash function (fract/sin) instead of a modular lookup table.
@@ -917,7 +961,9 @@ float cnoise(vec3 P)
917
961
  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
918
962
  return 2.2 * n_xyz;
919
963
  }
920
- `, N = () => `
964
+ `, I);
965
+ let W = null;
966
+ const J = () => W || (W = `
921
967
 
922
968
  vec3 saturation(vec3 rgb, float adjustment) {
923
969
  const vec3 W = vec3(0.2125, 0.7154, 0.0721);
@@ -960,36 +1006,63 @@ vec3 hsv2rgb(vec3 c)
960
1006
  vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
961
1007
  return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
962
1008
  }
963
- `, j = (r) => {
964
- r.id = G, r.href = "https://neat.firecms.co", r.target = "_blank", r.style.position = "absolute", r.style.display = "block", r.style.bottom = "0", r.style.right = "0", r.style.padding = "10px", r.style.color = "#dcdcdc", r.style.opacity = "0.8", r.style.fontFamily = "sans-serif", r.style.fontSize = "16px", r.style.fontWeight = "bold", r.style.textDecoration = "none", r.style.zIndex = "10000", r.innerHTML = "NEAT";
965
- }, ye = (r) => {
966
- const e = r.parentElement?.getElementsByTagName("a");
1009
+ `, W), Z = (i) => {
1010
+ i.id = Q, i.href = "https://neat.firecms.co", i.target = "_blank", i.style.position = "absolute", i.style.display = "block", i.style.bottom = "0", i.style.right = "0", i.style.padding = "10px", i.style.color = "#dcdcdc", i.style.opacity = "0.8", i.style.fontFamily = "sans-serif", i.style.fontSize = "16px", i.style.fontWeight = "bold", i.style.textDecoration = "none", i.style.zIndex = "10000", i.innerHTML = "NEAT";
1011
+ }, Pe = (i) => {
1012
+ const e = i.parentElement?.getElementsByTagName("a");
967
1013
  if (e) {
968
1014
  for (let t = 0; t < e.length; t++)
969
- if (e[t].id === G)
970
- return j(e[t]), e[t];
1015
+ if (e[t].id === Q)
1016
+ return Z(e[t]), e[t];
971
1017
  }
972
1018
  const o = document.createElement("a");
973
- return j(o), r.parentElement?.appendChild(o), o;
1019
+ return Z(o), i.parentElement?.appendChild(o), o;
974
1020
  };
975
- function we() {
976
- const r = new Date(), e = r.getMinutes(), o = r.getSeconds();
1021
+ function Oe() {
1022
+ const i = new Date(), e = i.getMinutes(), o = i.getSeconds();
977
1023
  return e * 60 + o;
978
1024
  }
979
- function be(r = 6) {
1025
+ function Fe(i = 6) {
980
1026
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
981
1027
  let o = "";
982
- for (let t = 0; t < r; t++) {
983
- const f = Math.floor(Math.random() * e.length);
984
- o += e.charAt(f);
1028
+ for (let t = 0; t < i; t++) {
1029
+ const d = Math.floor(Math.random() * e.length);
1030
+ o += e.charAt(d);
985
1031
  }
986
1032
  return o;
987
1033
  }
988
- function Se(r, e) {
1034
+ function Te(i, e) {
989
1035
  const o = document.createElement("a");
990
- o.download = e, o.href = r, document.body.appendChild(o), o.click(), document.body.removeChild(o);
1036
+ o.download = e, o.href = i, document.body.appendChild(o), o.click(), document.body.removeChild(o);
1037
+ }
1038
+ function Be() {
1039
+ if (document.getElementById("neat-seo-schema"))
1040
+ return;
1041
+ const i = document.createElement("script");
1042
+ i.id = "neat-seo-schema", i.type = "application/ld+json", i.text = JSON.stringify({
1043
+ "@context": "https://schema.org",
1044
+ "@type": "WebSite",
1045
+ name: "NEAT Gradient",
1046
+ url: "https://neat.firecms.co",
1047
+ author: {
1048
+ "@type": "Organization",
1049
+ name: "FireCMS",
1050
+ url: "https://firecms.co"
1051
+ },
1052
+ description: "Beautiful, fast, heavily customizable, WebGL based gradients."
1053
+ }), document.head.appendChild(i);
1054
+ const e = document.createElement("div");
1055
+ 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";
1056
+ try {
1057
+ const o = e.attachShadow({ mode: "closed" }), t = document.createElement("a");
1058
+ t.href = "https://firecms.co", t.textContent = "FireCMS", o.appendChild(t);
1059
+ } catch {
1060
+ const t = document.createElement("a");
1061
+ t.href = "https://firecms.co", t.textContent = "FireCMS", e.appendChild(t);
1062
+ }
1063
+ document.body.appendChild(e);
991
1064
  }
992
1065
  export {
993
- ze as NeatGradient
1066
+ Ue as NeatGradient
994
1067
  };
995
1068
  //# sourceMappingURL=index.es.js.map