@codingfactory/mediables-vue 2.10.1 → 2.12.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.
@@ -1,9 +1,9 @@
1
- var Ve = Object.defineProperty;
2
- var Ue = (s, e, t) => e in s ? Ve(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var J = (s, e, t) => Ue(s, typeof e != "symbol" ? e + "" : e, t);
4
- import * as b from "pixi-filters";
1
+ var je = Object.defineProperty;
2
+ var qe = (s, e, t) => e in s ? je(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var ie = (s, e, t) => qe(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import * as y from "pixi-filters";
5
5
  import * as R from "pixi.js";
6
- class W {
6
+ class G {
7
7
  constructor() {
8
8
  this._events = /* @__PURE__ */ new Map();
9
9
  }
@@ -33,7 +33,7 @@ class W {
33
33
  e ? this._events.delete(e) : this._events.clear();
34
34
  }
35
35
  }
36
- class je extends W {
36
+ class He extends G {
37
37
  constructor() {
38
38
  super(), this._state = {
39
39
  // Image state
@@ -56,8 +56,15 @@ class je extends W {
56
56
  // 'free' | 'square' | 'circle'
57
57
  aspect: "free",
58
58
  // 'free' | '1:1' | '4:3' | '16:9' | '3:2' | '2:3'
59
- rect: null
59
+ rect: null,
60
60
  // { x, y, width, height }
61
+ dirty: !1
62
+ // true once the user changes the generated crop frame
63
+ },
64
+ // Transform state
65
+ transform: {
66
+ rotation: 0
67
+ // degrees clockwise, normalized to 0..359.999
61
68
  },
62
69
  // UI state
63
70
  theme: "auto",
@@ -92,10 +99,10 @@ class je extends W {
92
99
  const i = this.get(e);
93
100
  if (e.includes(".")) {
94
101
  const r = e.split("."), a = r.pop();
95
- let n = this._state;
96
- for (const o of r)
97
- n[o] === void 0 && (n[o] = {}), n = n[o];
98
- n[a] = t;
102
+ let o = this._state;
103
+ for (const n of r)
104
+ o[n] === void 0 && (o[n] = {}), o = o[n];
105
+ o[a] = t;
99
106
  } else
100
107
  this._state[e] = t;
101
108
  this.emit(`change:${e}`, { value: t, old: i }), this.emit("change", { key: e, value: t, old: i });
@@ -114,14 +121,15 @@ class je extends W {
114
121
  * @returns {Object} ImageEditorSessionState-compatible object
115
122
  */
116
123
  getSerializableState() {
124
+ var i;
117
125
  const e = [];
118
126
  if (this._state.activeFilters)
119
- for (const i of this._state.activeFilters) {
120
- const r = this._state.filterValues[i];
127
+ for (const r of this._state.activeFilters) {
128
+ const a = this._state.filterValues[r];
121
129
  e.push({
122
- id: i,
130
+ id: r,
123
131
  enabled: !0,
124
- values: r ? { ...r } : {}
132
+ values: a ? { ...a } : {}
125
133
  });
126
134
  }
127
135
  const t = this._state.crop;
@@ -132,6 +140,9 @@ class je extends W {
132
140
  aspectRatio: (t == null ? void 0 : t.aspect) || "free",
133
141
  shape: (t == null ? void 0 : t.shape) || "free"
134
142
  },
143
+ transform: {
144
+ rotation: Number((i = this._state.transform) == null ? void 0 : i.rotation) || 0
145
+ },
135
146
  filters: e
136
147
  };
137
148
  }
@@ -188,12 +199,12 @@ class je extends W {
188
199
  this.set("isDarkMode", this._state.theme === "dark");
189
200
  }
190
201
  }
191
- function qe() {
192
- return new je();
202
+ function $e() {
203
+ return new He();
193
204
  }
194
- class He extends W {
205
+ class We extends G {
195
206
  constructor() {
196
- super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null, this._mountPromise = null;
207
+ super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null, this._lastExportDimensions = null, this._mountPromise = null;
197
208
  }
198
209
  /**
199
210
  * Whether the renderer is fully initialized and ready for use.
@@ -209,8 +220,8 @@ class He extends W {
209
220
  * canvas getter which throws when renderer is undefined.
210
221
  */
211
222
  _getCssSize() {
212
- var r, a, n, o, l, c;
213
- const e = (a = (r = this.app) == null ? void 0 : r.renderer) == null ? void 0 : a.canvas, t = (e == null ? void 0 : e.clientWidth) ?? ((o = (n = this.app) == null ? void 0 : n.screen) == null ? void 0 : o.width) ?? 0, i = (e == null ? void 0 : e.clientHeight) ?? ((c = (l = this.app) == null ? void 0 : l.screen) == null ? void 0 : c.height) ?? 0;
223
+ var r, a, o, n, l, c;
224
+ const e = (a = (r = this.app) == null ? void 0 : r.renderer) == null ? void 0 : a.canvas, t = (e == null ? void 0 : e.clientWidth) ?? ((n = (o = this.app) == null ? void 0 : o.screen) == null ? void 0 : n.width) ?? 0, i = (e == null ? void 0 : e.clientHeight) ?? ((c = (l = this.app) == null ? void 0 : l.screen) == null ? void 0 : c.height) ?? 0;
214
225
  return { w: t, h: i };
215
226
  }
216
227
  /**
@@ -297,10 +308,10 @@ class He extends W {
297
308
  if (!a)
298
309
  throw new Error("PIXI.js not found. Please ensure PIXI is loaded globally.");
299
310
  (d = a.Assets) != null && d.setPreferences && a.Assets.setPreferences({ crossOrigin: "anonymous" });
300
- const n = e.clientWidth || 600, o = e.clientHeight || 400, l = typeof i.backgroundAlpha == "number" ? i.backgroundAlpha : 1;
311
+ const o = e.clientWidth || 600, n = e.clientHeight || 400, l = typeof i.backgroundAlpha == "number" ? i.backgroundAlpha : 1;
301
312
  this.app = new a.Application(), await this.app.init({
302
- width: n,
303
- height: o,
313
+ width: o,
314
+ height: n,
304
315
  backgroundColor: t,
305
316
  backgroundAlpha: l,
306
317
  antialias: !0,
@@ -308,7 +319,7 @@ class He extends W {
308
319
  resolution: window.devicePixelRatio || 1
309
320
  }), e.appendChild(this.app.canvas);
310
321
  const c = this.app.canvas;
311
- c.classList.add("pixi-canvas"), c.style.width = "100%", c.style.height = "100%", c.style.transform = "translateZ(0)", c.style.willChange = "transform", c.setAttribute("role", "img"), c.setAttribute("aria-label", "Image editor canvas — use toolbar controls to edit the image"), this.emit("mounted", { width: n, height: o });
322
+ c.classList.add("pixi-canvas"), c.style.width = "100%", c.style.height = "100%", c.style.transform = "translateZ(0)", c.style.willChange = "transform", c.setAttribute("role", "img"), c.setAttribute("aria-label", "Image editor canvas — use toolbar controls to edit the image"), this.emit("mounted", { width: o, height: n });
312
323
  };
313
324
  this._mountPromise = r(), await this._mountPromise;
314
325
  }
@@ -325,10 +336,76 @@ class He extends W {
325
336
  if (!r)
326
337
  return !1;
327
338
  this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
328
- const { w: a, h: n } = this._getCssSize();
329
- if (this.applyViewTransform({ center: { x: a / 2, y: n / 2 } }), await this._waitForNextFrame(), !((d = this.app) != null && d.renderer)) return !1;
330
- const o = this.getFitScaleFor(r);
331
- return Math.abs(o - this.fitScale) / Math.max(1e-6, o) > 0.02 && (this.fitScale = o, this.applyViewTransform({ center: { x: a / 2, y: n / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
339
+ const { w: a, h: o } = this._getCssSize();
340
+ if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await this._waitForNextFrame(), !((d = this.app) != null && d.renderer)) return !1;
341
+ const n = this.getFitScaleFor(r);
342
+ return Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
343
+ }
344
+ /**
345
+ * Normalize degrees to the 0..360 range.
346
+ * @param {number} degrees
347
+ * @returns {number}
348
+ */
349
+ _normalizeDegrees(e) {
350
+ if (!Number.isFinite(e)) return 0;
351
+ const t = e % 360;
352
+ return t < 0 ? t + 360 : t;
353
+ }
354
+ /**
355
+ * Calculate the axis-aligned bounds for a rotated rectangle.
356
+ * @param {number} width
357
+ * @param {number} height
358
+ * @param {number} degrees
359
+ * @returns {{ width: number, height: number }}
360
+ */
361
+ getRotatedBounds(e, t, i) {
362
+ const r = this._normalizeDegrees(i);
363
+ if (r === 0)
364
+ return {
365
+ width: Math.max(1, Math.round(e)),
366
+ height: Math.max(1, Math.round(t))
367
+ };
368
+ const a = r * Math.PI / 180, o = Math.abs(Math.cos(a)), n = Math.abs(Math.sin(a)), l = o < 1e-10 ? 0 : o, c = n < 1e-10 ? 0 : n;
369
+ return {
370
+ width: Math.max(1, Math.ceil(e * l + t * c)),
371
+ height: Math.max(1, Math.ceil(e * c + t * l))
372
+ };
373
+ }
374
+ /**
375
+ * Permanently rotate the working texture. This keeps crop math simple:
376
+ * after rotation, sprite coordinates and texture dimensions both describe
377
+ * the visible image exactly.
378
+ *
379
+ * @param {number} degrees Clockwise degrees to add to the working texture.
380
+ * @returns {boolean}
381
+ */
382
+ rotateBy(e) {
383
+ var g, x, P;
384
+ const t = this._normalizeDegrees(e);
385
+ if (t === 0) return !0;
386
+ if (!((g = this.app) != null && g.renderer) || !this.originalTexture || !this.sprite)
387
+ return !1;
388
+ const i = window.PIXI, r = Math.round(this.originalTexture.width), a = Math.round(this.originalTexture.height);
389
+ if (r <= 0 || a <= 0) return !1;
390
+ const { width: o, height: n } = this.getRotatedBounds(r, a, t), l = t * Math.PI / 180, c = new i.Container(), d = new i.Sprite(this.originalTexture);
391
+ (P = (x = d.anchor) == null ? void 0 : x.set) == null || P.call(x, 0.5), d.x = o / 2, d.y = n / 2, d.rotation = l, c.addChild(d);
392
+ const h = i.RenderTexture.create({ width: o, height: n, resolution: 1 });
393
+ try {
394
+ this.app.renderer.render({
395
+ container: c,
396
+ target: h,
397
+ clear: !0,
398
+ clearColor: [0, 0, 0, 0]
399
+ });
400
+ } catch {
401
+ return h.destroy(!0), !1;
402
+ } finally {
403
+ c.removeChildren(), d.destroy({ children: !1, texture: !1, textureSource: !1 }), c.destroy({ children: !1 });
404
+ }
405
+ const u = this.originalTexture, p = Array.isArray(this.sprite.filters) ? [...this.sprite.filters] : null;
406
+ u && u !== this.baseTexture && u.destroy(!0), this.originalTexture = h, this._lastExportDimensions = null, this.app.stage.removeChild(this.sprite), this.sprite.destroy({ children: !1, texture: !1, textureSource: !1 });
407
+ const b = new i.Sprite(h);
408
+ return p != null && p.length && (b.filters = p), this.app.stage.addChild(b), this.sprite = b, this.fitScale = this.getFitScaleFor(h), this.zoom = 1, this.applyViewTransform({ keepCenter: !1 }), this.render(), this.emit("textureRotated", { width: o, height: n, degrees: t }), !0;
332
409
  }
333
410
  /**
334
411
  * Export the current image with filters applied.
@@ -346,108 +423,108 @@ class He extends W {
346
423
  var T;
347
424
  if (!((T = this.app) != null && T.renderer) || !this.originalTexture || !this.sprite)
348
425
  return null;
349
- const n = window.PIXI, o = Math.round(this.originalTexture.width), l = Math.round(this.originalTexture.height);
350
- if (o <= 0 || l <= 0)
426
+ const o = window.PIXI, n = Math.round(this.originalTexture.width), l = Math.round(this.originalTexture.height);
427
+ if (n <= 0 || l <= 0)
351
428
  return null;
352
429
  const c = this.sprite.width, d = this.sprite.height;
353
430
  if (c <= 0 || d <= 0)
354
431
  return null;
355
- const h = c / o, u = h > 0 ? 1 / h : 1, f = [];
432
+ const h = c / n, u = h > 0 ? 1 / h : 1, p = [];
356
433
  if (Array.isArray(this.sprite.filters)) {
357
- for (const y of this.sprite.filters)
358
- if (y)
359
- if (typeof y.createExportFilter == "function") {
360
- const C = y.createExportFilter({ previewToNativeScale: u });
361
- C && f.push(C);
434
+ for (const _ of this.sprite.filters)
435
+ if (_)
436
+ if (typeof _.createExportFilter == "function") {
437
+ const C = _.createExportFilter({ previewToNativeScale: u });
438
+ C && p.push(C);
362
439
  } else
363
- f.push(y);
364
- }
365
- let _ = 0;
366
- for (const y of f) {
367
- const C = typeof y.getExportPadding == "function" ? Number(y.getExportPadding()) || 0 : typeof y._exportPadding == "number" ? y._exportPadding : typeof y.padding == "number" ? y.padding : 0;
368
- C > 0 && (_ += C);
369
- }
370
- const g = Math.max(Math.ceil(_), 64), x = (y) => {
371
- var k, w;
372
- const C = Math.ceil(o + 2 * y), v = Math.ceil(l + 2 * y), M = new n.Container(), F = new n.Sprite(this.originalTexture);
373
- F.x = y, F.y = y, F.scale.set(1, 1), f.length > 0 && (F.filters = f, F.filterArea = new n.Rectangle(0, 0, o, l)), M.addChild(F);
374
- const I = n.RenderTexture.create({
440
+ p.push(_);
441
+ }
442
+ let b = 0;
443
+ for (const _ of p) {
444
+ const C = typeof _.getExportPadding == "function" ? Number(_.getExportPadding()) || 0 : typeof _._exportPadding == "number" ? _._exportPadding : typeof _.padding == "number" ? _.padding : 0;
445
+ C > 0 && (b += C);
446
+ }
447
+ const g = Math.max(Math.ceil(b), 64), x = (_) => {
448
+ var F, w;
449
+ const C = Math.ceil(n + 2 * _), M = Math.ceil(l + 2 * _), k = new o.Container(), A = new o.Sprite(this.originalTexture);
450
+ A.x = _, A.y = _, A.scale.set(1, 1), p.length > 0 && (A.filters = p, A.filterArea = new o.Rectangle(0, 0, n, l)), k.addChild(A);
451
+ const B = o.RenderTexture.create({
375
452
  width: C,
376
- height: v,
453
+ height: M,
377
454
  resolution: 1
378
455
  });
379
456
  try {
380
457
  this.app.renderer.render({
381
- container: M,
382
- target: I,
458
+ container: k,
459
+ target: B,
383
460
  clear: !0,
384
461
  clearColor: [0, 0, 0, 0]
385
462
  });
386
- const S = (w = (k = this.app.renderer.extract) == null ? void 0 : k.canvas) == null ? void 0 : w.call(k, I);
387
- return S ? { canvas: S, width: C, height: v, margin: y } : null;
463
+ const S = (w = (F = this.app.renderer.extract) == null ? void 0 : F.canvas) == null ? void 0 : w.call(F, B);
464
+ return S ? { canvas: S, width: C, height: M, margin: _ } : null;
388
465
  } finally {
389
- F.filters = null, M.removeChildren(), F.destroy({ children: !1, texture: !1, textureSource: !1 }), M.destroy({ children: !1 }), I.destroy(!0);
466
+ A.filters = null, k.removeChildren(), A.destroy({ children: !1, texture: !1, textureSource: !1 }), k.destroy({ children: !1 }), B.destroy(!0);
390
467
  }
391
- }, A = (y, C, v) => {
392
- const M = typeof y.getContext == "function" ? y.getContext("2d") : null;
393
- if (!M) return null;
394
- let F;
468
+ }, P = (_, C, M) => {
469
+ const k = typeof _.getContext == "function" ? _.getContext("2d") : null;
470
+ if (!k) return null;
471
+ let A;
395
472
  try {
396
- F = M.getImageData(0, 0, C, v).data;
473
+ A = k.getImageData(0, 0, C, M).data;
397
474
  } catch {
398
475
  return null;
399
476
  }
400
- const I = 1;
401
- let k = C, w = v, S = -1, Z = -1;
402
- const ce = 4, Be = C * ce;
403
- for (let Y = 0; Y < v; Y++) {
404
- const De = Y * Be;
405
- for (let L = 0; L < C; L++)
406
- F[De + L * ce + 3] >= I && (L < k && (k = L), L > S && (S = L), Y < w && (w = Y), Y > Z && (Z = Y));
477
+ const B = 1;
478
+ let F = C, w = M, S = -1, K = -1;
479
+ const de = 4, Ye = C * de;
480
+ for (let Y = 0; Y < M; Y++) {
481
+ const Ue = Y * Ye;
482
+ for (let D = 0; D < C; D++)
483
+ A[Ue + D * de + 3] >= B && (D < F && (F = D), D > S && (S = D), Y < w && (w = Y), Y > K && (K = Y));
407
484
  }
408
485
  if (S < 0) return null;
409
- const Ye = S - k + 1, Oe = Z - w + 1, Le = k === 0 || w === 0 || S === C - 1 || Z === v - 1;
410
- return { x: k, y: w, width: Ye, height: Oe, touchesEdge: Le };
486
+ const De = S - F + 1, Le = K - w + 1, Ve = F === 0 || w === 0 || S === C - 1 || K === M - 1;
487
+ return { x: F, y: w, width: De, height: Le, touchesEdge: Ve };
411
488
  };
412
- let P = null;
489
+ let v = null;
413
490
  try {
414
- let y = x(g);
415
- if (!y)
491
+ let _ = x(g);
492
+ if (!_)
416
493
  return null;
417
- let C = A(y.canvas, y.width, y.height);
494
+ let C = P(_.canvas, _.width, _.height);
418
495
  if (!C)
419
496
  return null;
420
- if (C.touchesEdge && g < o && g < l) {
421
- const k = Math.max(g * 4, 256), w = x(k);
497
+ if (C.touchesEdge && g < n && g < l) {
498
+ const F = Math.max(g * 4, 256), w = x(F);
422
499
  if (w) {
423
- const S = A(w.canvas, w.width, w.height);
424
- S && !S.touchesEdge ? (y = w, C = S) : (y = w, C = S ?? C);
500
+ const S = P(w.canvas, w.width, w.height);
501
+ S && !S.touchesEdge ? (_ = w, C = S) : (_ = w, C = S ?? C);
425
502
  }
426
503
  }
427
- let v = C.width, M = C.height;
504
+ let M = C.width, k = C.height;
428
505
  if (i > 0) {
429
- const k = Math.max(v, M);
430
- let w = i / k;
431
- r && (w = Math.min(1, w)), v = Math.max(1, Math.round(v * w)), M = Math.max(1, Math.round(M * w));
506
+ const F = Math.max(M, k);
507
+ let w = i / F;
508
+ r && (w = Math.min(1, w)), M = Math.max(1, Math.round(M * w)), k = Math.max(1, Math.round(k * w));
432
509
  }
433
- if (a > 0 && v * M > a) {
434
- const k = Math.sqrt(a / (v * M));
435
- v = Math.max(1, Math.floor(v * k)), M = Math.max(1, Math.floor(M * k));
510
+ if (a > 0 && M * k > a) {
511
+ const F = Math.sqrt(a / (M * k));
512
+ M = Math.max(1, Math.floor(M * F)), k = Math.max(1, Math.floor(k * F));
436
513
  }
437
- const F = document.createElement("canvas");
438
- F.width = v, F.height = M;
439
- const I = F.getContext("2d");
440
- return I ? (I.drawImage(
441
- y.canvas,
514
+ const A = document.createElement("canvas");
515
+ A.width = M, A.height = k;
516
+ const B = A.getContext("2d");
517
+ return B ? (B.drawImage(
518
+ _.canvas,
442
519
  C.x,
443
520
  C.y,
444
521
  C.width,
445
522
  C.height,
446
523
  0,
447
524
  0,
448
- v,
449
- M
450
- ), P = F.toDataURL(`image/${e}`, t), this._lastExportDimensions = { width: v, height: M }, P || null) : null;
525
+ M,
526
+ k
527
+ ), v = A.toDataURL(`image/${e}`, t), this._lastExportDimensions = { width: M, height: k }, v || null) : null;
451
528
  } catch {
452
529
  return null;
453
530
  }
@@ -463,16 +540,16 @@ class He extends W {
463
540
  * @returns {{ width: number, height: number }}
464
541
  */
465
542
  getExportDimensions() {
466
- var n;
543
+ var o;
467
544
  if (this._lastExportDimensions)
468
545
  return { ...this._lastExportDimensions };
469
546
  const e = this.originalTexture, t = Math.round((e == null ? void 0 : e.width) || 0), i = Math.round((e == null ? void 0 : e.height) || 0);
470
547
  let r = 0;
471
- const a = (n = this.sprite) == null ? void 0 : n.filters;
548
+ const a = (o = this.sprite) == null ? void 0 : o.filters;
472
549
  if (Array.isArray(a))
473
- for (const o of a) {
474
- if (!o) continue;
475
- const l = typeof o._exportPadding == "number" ? o._exportPadding : typeof o.padding == "number" ? o.padding : 0;
550
+ for (const n of a) {
551
+ if (!n) continue;
552
+ const l = typeof n._exportPadding == "number" ? n._exportPadding : typeof n.padding == "number" ? n.padding : 0;
476
553
  l > r && (r = l);
477
554
  }
478
555
  return {
@@ -489,8 +566,8 @@ class He extends W {
489
566
  async exportBlob(e = "png", t = 0.92) {
490
567
  const i = this.exportImage(e, t);
491
568
  if (!i) return null;
492
- const a = await (await fetch(i)).blob(), n = this.getExportDimensions();
493
- return { blob: a, width: n.width, height: n.height };
569
+ const a = await (await fetch(i)).blob(), o = this.getExportDimensions();
570
+ return { blob: a, width: o.width, height: o.height };
494
571
  }
495
572
  /**
496
573
  * Resize renderer to container
@@ -544,64 +621,64 @@ class He extends W {
544
621
  this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
545
622
  }
546
623
  }
547
- const Me = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M328 112L184 256l144 144"/></svg>', Pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"/></svg>', $e = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M256 184v74m-37-37h74"/></svg>', We = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M184 221h74"/></svg>', Ze = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', Ge = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M262.29 192.31a64 64 0 1057.4 57.4 64.13 64.13 0 00-57.4-57.4z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416.39 256a154.34 154.34 0 01-1.53 20.79l45.21 35.46a10.81 10.81 0 012.45 13.75l-42.77 74a10.81 10.81 0 01-13.14 4.59l-44.9-18.08a16.11 16.11 0 00-15.17 1.75A164.48 164.48 0 01325 400.8a15.94 15.94 0 00-8.82 12.14l-6.73 47.89a11.08 11.08 0 01-10.68 9.17h-85.54a11.11 11.11 0 01-10.69-8.87l-6.72-47.82a16.07 16.07 0 00-9-12.22 155.3 155.3 0 01-21.46-12.57 16 16 0 00-15.11-1.71l-44.89 18.07a10.81 10.81 0 01-13.14-4.58l-42.77-74a10.8 10.8 0 012.45-13.75l38.21-30a16.05 16.05 0 006-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 00-6.07-13.94l-38.19-30A10.81 10.81 0 0149.48 186l42.77-74a10.81 10.81 0 0113.14-4.59l44.9 18.08a16.11 16.11 0 0015.17-1.75A164.48 164.48 0 01187 111.2a15.94 15.94 0 008.82-12.14l6.73-47.89A11.08 11.08 0 01213.23 42h85.54a11.11 11.11 0 0110.69 8.87l6.72 47.82a16.07 16.07 0 009 12.22 155.3 155.3 0 0121.46 12.57 16 16 0 0015.11 1.71l44.89-18.07a10.81 10.81 0 0113.14 4.58l42.77 74a10.8 10.8 0 01-2.45 13.75l-38.21 30a16.05 16.05 0 00-6.05 14.08c.33 4.14.55 8.3.55 12.47z"/></svg>', Ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M400 320c0 88.37-55.63 144-144 144s-144-55.63-144-144c0-94.83 103.23-222.85 134.89-259.88a12 12 0 0118.23 0C296.77 97.15 400 225.17 400 320z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M344 328a72 72 0 01-72 72"/></svg>', Qe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32" d="M430.11 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 11.99-36.6.1-47.7z"/><circle cx="144" cy="208" r="32"/><circle cx="152" cy="311" r="32"/><circle cx="224" cy="144" r="32"/><circle cx="256" cy="367" r="32"/><circle cx="328" cy="144" r="32"/></svg>', Je = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M259.92 262.91L216.4 149.77a9 9 0 00-16.8 0l-43.52 113.14a9 9 0 01-5.17 5.17L37.77 311.6a9 9 0 000 16.8l113.14 43.52a9 9 0 015.17 5.17l43.52 113.14a9 9 0 0016.8 0l43.52-113.14a9 9 0 015.17-5.17l113.14-43.52a9 9 0 000-16.8l-113.14-43.52a9 9 0 01-5.17-5.17zM108 68L88 16 68 68 16 88l52 20 20 52 20-52 52-20-52-20zM426.67 117.33L400 48l-26.67 69.33L304 144l69.33 26.67L400 240l26.67-69.33L496 144l-69.33-26.67z"/></svg>', et = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', tt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M315.27 33L96 304h128l-31.51 173.23a2.36 2.36 0 002.33 2.77h0a2.36 2.36 0 001.89-.95L416 208H288l31.66-173.25a2.45 2.45 0 00-2.44-2.75h0a2.42 2.42 0 00-1.95 1z"/></svg>', ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M144 48v272a48 48 0 0048 48h272"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 464V192a48 48 0 00-48-48H48"/></svg>', it = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M380.93 57.37A32 32 0 00358.3 48H94.22A46.21 46.21 0 0048 94.22v323.56A46.21 46.21 0 0094.22 464h323.56A46.36 46.36 0 00464 417.78V153.7a32 32 0 00-9.37-22.63zM256 416a64 64 0 1164-64 63.92 63.92 0 01-64 64zm48-224H112a16 16 0 01-16-16v-64a16 16 0 0116-16h192a16 16 0 0116 16v64a16 16 0 01-16 16z"/></svg>', oe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>', Fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M320 146s24.36-12-64-12a160 160 0 10160 160"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 58l80 80-80 80"/></svg>', rt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M80 112h352"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M192 112V72h0a23.93 23.93 0 0124-24h80a23.93 23.93 0 0124 24h0v40M256 176v224M184 176l8 224M328 176l-8 224"/></svg>', st = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M64 192v-72a40 40 0 0140-40h75.89a40 40 0 0122.19 6.72l27.84 18.56a40 40 0 0022.19 6.72H408a40 40 0 0140 40v40"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M479.9 226.55L463.68 392a40 40 0 01-39.93 40H88.25a40 40 0 01-39.93-40L32.1 226.55A32 32 0 0164 192h384.1a32 32 0 0131.8 34.55z"/></svg>', se = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"/></svg>', at = '<svg viewBox="0 0 512 512" width="20" height="20"><rect x="64" y="64" width="384" height="384" rx="48" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"/></svg>', nt = '<svg viewBox="0 0 512 512" width="20" height="20"><circle cx="256" cy="256" r="208" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/></svg>', ot = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M80 96h64l64 320h64l64-160h96"/></svg>', he = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M256 48v48M256 416v48M403.08 108.92l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48M96 256H48M403.08 403.08l-33.94-33.94M142.86 142.86l-33.94-33.94"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32"/></svg>', de = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z"/></svg>', lt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M436 80H76a44.05 44.05 0 00-44 44v264a44.05 44.05 0 0044 44h360a44.05 44.05 0 0044-44V124a44.05 44.05 0 00-44-44z"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 80v56M292 80v56M220 376v56M292 376v56M80 144h56M80 224h56M80 304h56M376 144h56M376 224h56M376 304h56"/></svg>', le = [
624
+ const Pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M328 112L184 256l144 144"/></svg>', Fe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M184 112l144 144-144 144"/></svg>', Ze = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M256 184v74m-37-37h74"/></svg>', Ge = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M338.29 338.29L448 448M184 221h74"/></svg>', Ke = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', Qe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M262.29 192.31a64 64 0 1057.4 57.4 64.13 64.13 0 00-57.4-57.4z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416.39 256a154.34 154.34 0 01-1.53 20.79l45.21 35.46a10.81 10.81 0 012.45 13.75l-42.77 74a10.81 10.81 0 01-13.14 4.59l-44.9-18.08a16.11 16.11 0 00-15.17 1.75A164.48 164.48 0 01325 400.8a15.94 15.94 0 00-8.82 12.14l-6.73 47.89a11.08 11.08 0 01-10.68 9.17h-85.54a11.11 11.11 0 01-10.69-8.87l-6.72-47.82a16.07 16.07 0 00-9-12.22 155.3 155.3 0 01-21.46-12.57 16 16 0 00-15.11-1.71l-44.89 18.07a10.81 10.81 0 01-13.14-4.58l-42.77-74a10.8 10.8 0 012.45-13.75l38.21-30a16.05 16.05 0 006-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 00-6.07-13.94l-38.19-30A10.81 10.81 0 0149.48 186l42.77-74a10.81 10.81 0 0113.14-4.59l44.9 18.08a16.11 16.11 0 0015.17-1.75A164.48 164.48 0 01187 111.2a15.94 15.94 0 008.82-12.14l6.73-47.89A11.08 11.08 0 01213.23 42h85.54a11.11 11.11 0 0110.69 8.87l6.72 47.82a16.07 16.07 0 009 12.22 155.3 155.3 0 0121.46 12.57 16 16 0 0015.11 1.71l44.89-18.07a10.81 10.81 0 0113.14 4.58l42.77 74a10.8 10.8 0 01-2.45 13.75l-38.21 30a16.05 16.05 0 00-6.05 14.08c.33 4.14.55 8.3.55 12.47z"/></svg>', Je = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M400 320c0 88.37-55.63 144-144 144s-144-55.63-144-144c0-94.83 103.23-222.85 134.89-259.88a12 12 0 0118.23 0C296.77 97.15 400 225.17 400 320z"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M344 328a72 72 0 01-72 72"/></svg>', et = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32" d="M430.11 347.9c-6.6-6.1-16.3-7.6-24.6-9-11.5-1.9-15.9-4-22.6-10-14.3-12.7-14.3-31.1 0-43.8l30.3-26.9c46.4-41 46.4-108.2 0-149.2-34.2-30.1-80.1-45-127.8-45-55.7 0-113.9 20.3-158.8 60.1-83.5 73.8-83.5 194.7 0 268.5 41.5 36.7 97.5 55 152.9 55.4h1.7c55.4 0 110-17.9 148.8-52.4 14.4-12.7 11.99-36.6.1-47.7z"/><circle cx="144" cy="208" r="32"/><circle cx="152" cy="311" r="32"/><circle cx="224" cy="144" r="32"/><circle cx="256" cy="367" r="32"/><circle cx="328" cy="144" r="32"/></svg>', tt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M259.92 262.91L216.4 149.77a9 9 0 00-16.8 0l-43.52 113.14a9 9 0 01-5.17 5.17L37.77 311.6a9 9 0 000 16.8l113.14 43.52a9 9 0 015.17 5.17l43.52 113.14a9 9 0 0016.8 0l43.52-113.14a9 9 0 015.17-5.17l113.14-43.52a9 9 0 000-16.8l-113.14-43.52a9 9 0 01-5.17-5.17zM108 68L88 16 68 68 16 88l52 20 20 52 20-52 52-20-52-20zM426.67 117.33L400 48l-26.67 69.33L304 144l69.33 26.67L400 240l26.67-69.33L496 144l-69.33-26.67z"/></svg>', it = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', rt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M315.27 33L96 304h128l-31.51 173.23a2.36 2.36 0 002.33 2.77h0a2.36 2.36 0 001.89-.95L416 208H288l31.66-173.25a2.45 2.45 0 00-2.44-2.75h0a2.42 2.42 0 00-1.95 1z"/></svg>', Ae = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M144 48v272a48 48 0 0048 48h272"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 464V192a48 48 0 00-48-48H48"/></svg>', st = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M380.93 57.37A32 32 0 00358.3 48H94.22A46.21 46.21 0 0048 94.22v323.56A46.21 46.21 0 0094.22 464h323.56A46.36 46.36 0 00464 417.78V153.7a32 32 0 00-9.37-22.63zM256 416a64 64 0 1164-64 63.92 63.92 0 01-64 64zm48-224H112a16 16 0 01-16-16v-64a16 16 0 0116-16h192a16 16 0 0116 16v64a16 16 0 01-16 16z"/></svg>', ce = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>', Ne = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M320 146s24.36-12-64-12a160 160 0 10160 160"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 58l80 80-80 80"/></svg>', at = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M176 112l-64 64 64 64"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 176h176a112 112 0 110 224H160"/></svg>', ot = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M336 112l64 64-64 64"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M400 176H224a112 112 0 100 224h128"/></svg>', nt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M80 112h352"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M192 112V72h0a23.93 23.93 0 0124-24h80a23.93 23.93 0 0124 24h0v40M256 176v224M184 176l8 224M328 176l-8 224"/></svg>', lt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M64 192v-72a40 40 0 0140-40h75.89a40 40 0 0122.19 6.72l27.84 18.56a40 40 0 0022.19 6.72H408a40 40 0 0140 40v40"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M479.9 226.55L463.68 392a40 40 0 01-39.93 40H88.25a40 40 0 01-39.93-40L32.1 226.55A32 32 0 0164 192h384.1a32 32 0 0131.8 34.55z"/></svg>', ne = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"/></svg>', ct = '<svg viewBox="0 0 512 512" width="20" height="20"><rect x="64" y="64" width="384" height="384" rx="48" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32"/></svg>', ht = '<svg viewBox="0 0 512 512" width="20" height="20"><circle cx="256" cy="256" r="208" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/></svg>', dt = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M80 96h64l64 320h64l64-160h96"/></svg>', ue = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M256 48v48M256 416v48M403.08 108.92l-33.94 33.94M142.86 369.14l-33.94 33.94M464 256h-48M96 256H48M403.08 403.08l-33.94-33.94M142.86 142.86l-33.94-33.94"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32"/></svg>', pe = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z"/></svg>', ut = '<svg viewBox="0 0 512 512" width="20" height="20"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M436 80H76a44.05 44.05 0 00-44 44v264a44.05 44.05 0 0044 44h360a44.05 44.05 0 0044-44V124a44.05 44.05 0 00-44-44z"/><circle cx="256" cy="256" r="80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 80v56M292 80v56M220 376v56M292 376v56M80 144h56M80 224h56M80 304h56M376 144h56M376 224h56M376 304h56"/></svg>', he = [
548
625
  {
549
626
  id: "adjust",
550
627
  name: "Adjust",
551
- icon: Ge,
628
+ icon: Qe,
552
629
  registryCategories: ["adjust", "advanced"]
553
630
  // adjustment, adjustmentAdvanced, alpha, colorMatrix
554
631
  },
555
632
  {
556
633
  id: "blur",
557
634
  name: "Blur",
558
- icon: Ke,
635
+ icon: Je,
559
636
  registryCategories: ["blur"]
560
637
  },
561
638
  {
562
639
  id: "color",
563
640
  name: "Color",
564
- icon: Qe,
641
+ icon: et,
565
642
  registryCategories: ["color"]
566
643
  },
567
644
  {
568
645
  id: "effects",
569
646
  name: "Effects",
570
- icon: Je,
647
+ icon: tt,
571
648
  registryCategories: ["effects"]
572
649
  },
573
650
  {
574
651
  id: "distortion",
575
652
  name: "Distortion",
576
- icon: et,
653
+ icon: it,
577
654
  registryCategories: ["distortion"]
578
655
  },
579
656
  {
580
657
  id: "light",
581
658
  name: "Light",
582
- icon: tt,
659
+ icon: rt,
583
660
  registryCategories: ["light"]
584
661
  },
585
662
  {
586
663
  id: "stylize",
587
664
  name: "Stylize",
588
- icon: lt,
665
+ icon: ut,
589
666
  registryCategories: ["stylize"]
590
667
  },
591
668
  {
592
669
  id: "crop",
593
670
  name: "Crop",
594
- icon: ke
671
+ icon: Ae
595
672
  }
596
- ], ct = Object.fromEntries(
597
- le.filter((s) => Array.isArray(s.registryCategories) && s.registryCategories.length > 0).map((s) => [s.id, s.registryCategories])
598
- ), ht = Object.fromEntries(
599
- le.filter((s) => Array.isArray(s.registryCategories)).flatMap((s) => s.registryCategories.map((e) => [e, s.id]))
673
+ ], pt = Object.fromEntries(
674
+ he.filter((s) => Array.isArray(s.registryCategories) && s.registryCategories.length > 0).map((s) => [s.id, s.registryCategories])
675
+ ), ft = Object.fromEntries(
676
+ he.filter((s) => Array.isArray(s.registryCategories)).flatMap((s) => s.registryCategories.map((e) => [e, s.id]))
600
677
  );
601
- function dt(s) {
602
- return ct[s] || [s];
678
+ function mt(s) {
679
+ return pt[s] || [s];
603
680
  }
604
- class ut extends W {
681
+ class gt extends G {
605
682
  constructor(e, t) {
606
683
  super(), this.state = e, this.renderer = t, this.instances = {}, this._filterRegistry = null;
607
684
  }
@@ -636,11 +713,11 @@ class ut extends W {
636
713
  */
637
714
  getFiltersByCategory(e) {
638
715
  if (!this._filterRegistry) return [];
639
- const t = dt(e), i = [], r = /* @__PURE__ */ new Set();
716
+ const t = mt(e), i = [], r = /* @__PURE__ */ new Set();
640
717
  for (const a of t) {
641
- const n = this._filterRegistry.getFiltersByCategory(a) || [];
642
- for (const o of n)
643
- r.has(o.id) || (r.add(o.id), i.push(o));
718
+ const o = this._filterRegistry.getFiltersByCategory(a) || [];
719
+ for (const n of o)
720
+ r.has(n.id) || (r.add(n.id), i.push(n));
644
721
  }
645
722
  return i;
646
723
  }
@@ -685,12 +762,12 @@ class ut extends W {
685
762
  }
686
763
  const r = t.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
687
764
  let a = e;
688
- for (let o = 0; o < r.length - 1; o++) {
689
- const l = r[o];
765
+ for (let n = 0; n < r.length - 1; n++) {
766
+ const l = r[n];
690
767
  if (!(l in a) || (a = a[l], a == null)) return;
691
768
  }
692
- const n = r[r.length - 1];
693
- a[n] = i;
769
+ const o = r[r.length - 1];
770
+ a[o] = i;
694
771
  }
695
772
  /**
696
773
  * Initialize filter values from definition defaults.
@@ -704,8 +781,8 @@ class ut extends W {
704
781
  if (!t) return;
705
782
  const i = this.state.getFilterValues(e), r = new Set((t.controls || []).map((a) => a.id));
706
783
  if (t.defaultParams)
707
- for (const [a, n] of Object.entries(t.defaultParams))
708
- !r.has(a) && !(a in i) && this.state.setFilterValue(e, a, n);
784
+ for (const [a, o] of Object.entries(t.defaultParams))
785
+ !r.has(a) && !(a in i) && this.state.setFilterValue(e, a, o);
709
786
  t.controls && t.controls.forEach((a) => {
710
787
  a.id in i || this.state.setFilterValue(e, a.id, a.default);
711
788
  });
@@ -756,16 +833,16 @@ class ut extends W {
756
833
  * @returns {boolean} True if updated in-place, false if caller must recreate
757
834
  */
758
835
  updateValue(e, t, i) {
759
- const r = this._normalizeValue(i), a = this.getFilterDef(e), n = a == null ? void 0 : a.controls.find((h) => h.id === t), o = !n && (t.includes("[") || t.includes("."));
760
- o || this.state.setFilterValue(e, t, r);
836
+ const r = this._normalizeValue(i), a = this.getFilterDef(e), o = a == null ? void 0 : a.controls.find((h) => h.id === t), n = !o && (t.includes("[") || t.includes("."));
837
+ n || this.state.setFilterValue(e, t, r);
761
838
  const l = this.instances[e];
762
839
  if (!l) return !1;
763
- const c = (n == null ? void 0 : n.property) || t;
840
+ const c = (o == null ? void 0 : o.property) || t;
764
841
  if (typeof l.updateUIParam == "function") {
765
- if (l.updateUIParam(c, r), o && typeof l.getSerializableParams == "function") {
842
+ if (l.updateUIParam(c, r), n && typeof l.getSerializableParams == "function") {
766
843
  const h = l.getSerializableParams();
767
- for (const [u, f] of Object.entries(h))
768
- this.state.setFilterValue(e, u, f);
844
+ for (const [u, p] of Object.entries(h))
845
+ this.state.setFilterValue(e, u, p);
769
846
  }
770
847
  return !0;
771
848
  }
@@ -786,8 +863,8 @@ class ut extends W {
786
863
  if (!(!i || typeof i.updateUIParam != "function")) {
787
864
  if (i.updateUIParam(t, !0), typeof i.getSerializableParams == "function") {
788
865
  const r = i.getSerializableParams();
789
- for (const [a, n] of Object.entries(r))
790
- this.state.setFilterValue(e, a, n);
866
+ for (const [a, o] of Object.entries(r))
867
+ this.state.setFilterValue(e, a, o);
791
868
  }
792
869
  this.applyFilters(), this.emit("filterActionPerformed", { filterId: e, action: t });
793
870
  }
@@ -806,20 +883,20 @@ class ut extends W {
806
883
  const t = [], i = [];
807
884
  this.state.get("activeFilters").forEach((a) => {
808
885
  try {
809
- const n = this.getFilterDef(a);
810
- if (!n || !n.createFilter || typeof n.createFilter != "function")
886
+ const o = this.getFilterDef(a);
887
+ if (!o || !o.createFilter || typeof o.createFilter != "function")
811
888
  return;
812
- const o = this.state.getFilterValues(a), l = n.defaultParams ? { ...n.defaultParams } : {};
813
- n.controls && Array.isArray(n.controls) && n.controls.forEach((f) => {
814
- const _ = f.property || f.id;
815
- l[_] = o[f.id] ?? f.default;
889
+ const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
890
+ o.controls && Array.isArray(o.controls) && o.controls.forEach((p) => {
891
+ const b = p.property || p.id;
892
+ l[b] = n[p.id] ?? p.default;
816
893
  });
817
- const c = new Set((n.controls || []).map((f) => f.id));
818
- for (const [f, _] of Object.entries(o))
819
- c.has(f) || (l[f] = _);
894
+ const c = new Set((o.controls || []).map((p) => p.id));
895
+ for (const [p, b] of Object.entries(n))
896
+ c.has(p) || (l[p] = b);
820
897
  const d = this.renderer.sprite, h = this.renderer.originalTexture;
821
898
  l._sourceWidth = Math.round((h == null ? void 0 : h.width) || (d == null ? void 0 : d.width) || 0), l._sourceHeight = Math.round((h == null ? void 0 : h.height) || (d == null ? void 0 : d.height) || 0);
822
- const u = n.createFilter(l);
899
+ const u = o.createFilter(l);
823
900
  u && (t.push(u), this.instances[a] = u);
824
901
  } catch {
825
902
  i.push(a);
@@ -856,7 +933,7 @@ class ut extends W {
856
933
  return this.instances[e] || null;
857
934
  }
858
935
  }
859
- const U = class U extends W {
936
+ const U = class U extends G {
860
937
  constructor(e, t) {
861
938
  super(), this.state = e, this.renderer = t, this._overlayCanvas = null, this._isDragging = !1, this._dragStart = null, this._dragMode = null, this._startRect = null, this._hoverMode = null, this._lastAutoZoomCheck = 0, this.HANDLE_SIZE = 14, this.EDGE_HIT_PAD = 10, this._onPointerDown = this._handlePointerDown.bind(this), this._onPointerMove = this._handlePointerMove.bind(this), this._onPointerUp = this._handlePointerUp.bind(this);
862
939
  }
@@ -911,8 +988,8 @@ const U = class U extends W {
911
988
  if (!t || !i) return;
912
989
  const r = this.state.get("crop.shape"), a = { x: 0, y: 0, w: i.screen.width, h: i.screen.height };
913
990
  if (e.x = Math.max(a.x, Math.min(e.x, a.x + a.w - e.width)), e.y = Math.max(a.y, Math.min(e.y, a.y + a.h - e.height)), e.width = Math.min(e.width, a.w), e.height = Math.min(e.height, a.h), r !== "free" || this.state.get("crop.aspect") === "1:1") {
914
- const n = Math.min(e.width, e.height);
915
- e.width = n, e.height = n;
991
+ const o = Math.min(e.width, e.height);
992
+ e.width = o, e.height = o;
916
993
  }
917
994
  this.state.set("crop.rect", e);
918
995
  }
@@ -929,21 +1006,21 @@ const U = class U extends W {
929
1006
  * @param {number} currentZoom - Current zoom level
930
1007
  * @returns {number|null} Target zoom level, or null if no zoom needed
931
1008
  */
932
- static calcAutoZoom(e, t, i, r, a, n, o) {
933
- if (!e || !r || !a || !n) return null;
1009
+ static calcAutoZoom(e, t, i, r, a, o, n) {
1010
+ if (!e || !r || !a || !o) return null;
934
1011
  const l = e.width > t, c = e.height > i;
935
1012
  if (!l && !c) return null;
936
1013
  const d = U.AUTO_ZOOM_PADDING;
937
- let h = o;
1014
+ let h = n;
938
1015
  if (l) {
939
- const u = e.width / (d * r * n);
1016
+ const u = e.width / (d * r * o);
940
1017
  h = Math.min(h, u);
941
1018
  }
942
1019
  if (c) {
943
- const u = e.height / (d * a * n);
1020
+ const u = e.height / (d * a * o);
944
1021
  h = Math.min(h, u);
945
1022
  }
946
- return h = Math.max(0.1, h), h >= o - 0.01 ? null : h;
1023
+ return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
947
1024
  }
948
1025
  /**
949
1026
  * Check if auto-zoom is needed and apply it (throttled).
@@ -975,43 +1052,43 @@ const U = class U extends W {
975
1052
  if (!e) return;
976
1053
  const t = this.renderer.app;
977
1054
  if (!t) return;
978
- const i = t.canvas, r = i.clientWidth, a = i.clientHeight, n = window.devicePixelRatio || 1;
979
- (e.width !== Math.max(1, Math.floor(r * n)) || e.height !== Math.max(1, Math.floor(a * n))) && (e.width = Math.max(1, Math.floor(r * n)), e.height = Math.max(1, Math.floor(a * n)), e.style.width = r + "px", e.style.height = a + "px");
980
- const o = e.getContext("2d");
981
- if (!o) return;
982
- o.setTransform(n, 0, 0, n, 0, 0), o.clearRect(0, 0, r, a), o.fillStyle = "rgba(0, 0, 0, 0.5)", o.fillRect(0, 0, r, a);
1055
+ const i = t.canvas, r = i.clientWidth, a = i.clientHeight, o = window.devicePixelRatio || 1;
1056
+ (e.width !== Math.max(1, Math.floor(r * o)) || e.height !== Math.max(1, Math.floor(a * o))) && (e.width = Math.max(1, Math.floor(r * o)), e.height = Math.max(1, Math.floor(a * o)), e.style.width = r + "px", e.style.height = a + "px");
1057
+ const n = e.getContext("2d");
1058
+ if (!n) return;
1059
+ n.setTransform(o, 0, 0, o, 0, 0), n.clearRect(0, 0, r, a), n.fillStyle = "rgba(0, 0, 0, 0.5)", n.fillRect(0, 0, r, a);
983
1060
  const l = this.state.get("crop.rect");
984
1061
  if (!l) return;
985
1062
  const c = this.state.get("crop.shape");
986
- if (o.save(), c === "circle") {
987
- const x = l.x + l.width / 2, A = l.y + l.height / 2, P = Math.min(l.width, l.height) / 2;
988
- o.beginPath(), o.arc(x, A, P, 0, Math.PI * 2), o.clip();
1063
+ if (n.save(), c === "circle") {
1064
+ const x = l.x + l.width / 2, P = l.y + l.height / 2, v = Math.min(l.width, l.height) / 2;
1065
+ n.beginPath(), n.arc(x, P, v, 0, Math.PI * 2), n.clip();
989
1066
  } else
990
- o.beginPath(), o.rect(l.x, l.y, l.width, l.height), o.clip();
991
- o.clearRect(l.x, l.y, l.width, l.height), o.restore(), o.strokeStyle = "#ffffff", o.lineWidth = 2, o.setLineDash([5, 5]), c === "circle" ? (o.beginPath(), o.arc(
1067
+ n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
1068
+ n.clearRect(l.x, l.y, l.width, l.height), n.restore(), n.strokeStyle = "#ffffff", n.lineWidth = 2, n.setLineDash([5, 5]), c === "circle" ? (n.beginPath(), n.arc(
992
1069
  l.x + l.width / 2,
993
1070
  l.y + l.height / 2,
994
1071
  Math.min(l.width, l.height) / 2,
995
1072
  0,
996
1073
  Math.PI * 2
997
- ), o.stroke()) : o.strokeRect(l.x, l.y, l.width, l.height), o.setLineDash([]), o.strokeStyle = "rgba(255,255,255,0.3)", o.lineWidth = 1;
1074
+ ), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
998
1075
  const d = l.width / 3, h = l.height / 3;
999
1076
  for (let x = 1; x <= 2; x++)
1000
- o.beginPath(), o.moveTo(l.x + d * x, l.y), o.lineTo(l.x + d * x, l.y + l.height), o.stroke(), o.beginPath(), o.moveTo(l.x, l.y + h * x), o.lineTo(l.x + l.width, l.y + h * x), o.stroke();
1001
- const u = this.HANDLE_SIZE, f = [
1077
+ n.beginPath(), n.moveTo(l.x + d * x, l.y), n.lineTo(l.x + d * x, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * x), n.lineTo(l.x + l.width, l.y + h * x), n.stroke();
1078
+ const u = this.HANDLE_SIZE, p = [
1002
1079
  { x: l.x, y: l.y, m: "resize-nw" },
1003
1080
  { x: l.x + l.width, y: l.y, m: "resize-ne" },
1004
1081
  { x: l.x, y: l.y + l.height, m: "resize-sw" },
1005
1082
  { x: l.x + l.width, y: l.y + l.height, m: "resize-se" }
1006
- ], _ = [
1083
+ ], b = [
1007
1084
  { x: l.x + l.width / 2, y: l.y, m: "n" },
1008
1085
  { x: l.x + l.width / 2, y: l.y + l.height, m: "s" },
1009
1086
  { x: l.x, y: l.y + l.height / 2, m: "w" },
1010
1087
  { x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
1011
- ], g = [...f, ..._];
1088
+ ], g = [...p, ...b];
1012
1089
  for (const x of g) {
1013
- const A = this._hoverMode === x.m, P = A ? u + 4 : u;
1014
- o.beginPath(), o.rect(x.x - P / 2, x.y - P / 2, P, P), o.fillStyle = A ? "#4da3ff" : "#ffffff", o.strokeStyle = "rgba(0,0,0,0.6)", o.lineWidth = 1, o.fill(), o.stroke();
1090
+ const P = this._hoverMode === x.m, v = P ? u + 4 : u;
1091
+ n.beginPath(), n.rect(x.x - v / 2, x.y - v / 2, v, v), n.fillStyle = P ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
1015
1092
  }
1016
1093
  }
1017
1094
  /**
@@ -1023,7 +1100,7 @@ const U = class U extends W {
1023
1100
  _hitHandle(e, t) {
1024
1101
  const i = this.state.get("crop.rect");
1025
1102
  if (!i) return null;
1026
- const r = (a, n, o, l, c) => Math.abs(a - o) <= c && Math.abs(n - l) <= c;
1103
+ const r = (a, o, n, l, c) => Math.abs(a - n) <= c && Math.abs(o - l) <= c;
1027
1104
  return r(e, t, i.x, i.y, this.HANDLE_SIZE) ? "resize-nw" : r(e, t, i.x + i.width, i.y, this.HANDLE_SIZE) ? "resize-ne" : r(e, t, i.x, i.y + i.height, this.HANDLE_SIZE) ? "resize-sw" : r(e, t, i.x + i.width, i.y + i.height, this.HANDLE_SIZE) ? "resize-se" : Math.abs(t - i.y) <= this.EDGE_HIT_PAD && e >= i.x && e <= i.x + i.width ? "n" : Math.abs(t - (i.y + i.height)) <= this.EDGE_HIT_PAD && e >= i.x && e <= i.x + i.width ? "s" : Math.abs(e - i.x) <= this.EDGE_HIT_PAD && t >= i.y && t <= i.y + i.height ? "w" : Math.abs(e - (i.x + i.width)) <= this.EDGE_HIT_PAD && t >= i.y && t <= i.y + i.height ? "e" : e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height ? "move" : null;
1028
1105
  }
1029
1106
  /**
@@ -1049,16 +1126,16 @@ const U = class U extends W {
1049
1126
  }
1050
1127
  const r = this.state.get("crop.rect");
1051
1128
  if (!r) return;
1052
- const a = i.x - this._dragStart.x, n = i.y - this._dragStart.y;
1129
+ const a = i.x - this._dragStart.x, o = i.y - this._dragStart.y;
1053
1130
  switch (this._dragMode) {
1054
1131
  case "move":
1055
- r.x = this._startRect.x + a, r.y = this._startRect.y + n;
1132
+ r.x = this._startRect.x + a, r.y = this._startRect.y + o;
1056
1133
  break;
1057
1134
  case "n":
1058
- r.y = this._startRect.y + n, r.height = this._startRect.height - n;
1135
+ r.y = this._startRect.y + o, r.height = this._startRect.height - o;
1059
1136
  break;
1060
1137
  case "s":
1061
- r.height = this._startRect.height + n;
1138
+ r.height = this._startRect.height + o;
1062
1139
  break;
1063
1140
  case "w":
1064
1141
  r.x = this._startRect.x + a, r.width = this._startRect.width - a;
@@ -1067,19 +1144,19 @@ const U = class U extends W {
1067
1144
  r.width = this._startRect.width + a;
1068
1145
  break;
1069
1146
  case "resize-nw":
1070
- r.x = this._startRect.x + a, r.y = this._startRect.y + n, r.width = this._startRect.width - a, r.height = this._startRect.height - n;
1147
+ r.x = this._startRect.x + a, r.y = this._startRect.y + o, r.width = this._startRect.width - a, r.height = this._startRect.height - o;
1071
1148
  break;
1072
1149
  case "resize-ne":
1073
- r.y = this._startRect.y + n, r.width = this._startRect.width + a, r.height = this._startRect.height - n;
1150
+ r.y = this._startRect.y + o, r.width = this._startRect.width + a, r.height = this._startRect.height - o;
1074
1151
  break;
1075
1152
  case "resize-sw":
1076
- r.x = this._startRect.x + a, r.width = this._startRect.width - a, r.height = this._startRect.height + n;
1153
+ r.x = this._startRect.x + a, r.width = this._startRect.width - a, r.height = this._startRect.height + o;
1077
1154
  break;
1078
1155
  case "resize-se":
1079
- r.width = this._startRect.width + a, r.height = this._startRect.height + n;
1156
+ r.width = this._startRect.width + a, r.height = this._startRect.height + o;
1080
1157
  break;
1081
1158
  }
1082
- r.width = Math.max(50, r.width), r.height = Math.max(50, r.height), this.state.set("crop.rect", r), this.state.get("crop.shape") === "circle" && this.state.get("crop.aspect") !== "1:1" && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this._dragMode !== "move" && this._checkAutoZoom(), this.constrainCropRect(), this.drawOverlay();
1159
+ r.width = Math.max(50, r.width), r.height = Math.max(50, r.height), this.state.set("crop.rect", r), this.state.set("crop.dirty", !0), this.state.get("crop.shape") === "circle" && this.state.get("crop.aspect") !== "1:1" && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this._dragMode !== "move" && this._checkAutoZoom(), this.constrainCropRect(), this.drawOverlay();
1083
1160
  }
1084
1161
  /**
1085
1162
  * Handle pointer up event
@@ -1096,18 +1173,19 @@ const U = class U extends W {
1096
1173
  let i = this.state.get("crop.rect");
1097
1174
  if (!i) {
1098
1175
  this.state.get("crop.shape") === "circle" && this.state.set("crop.aspect", "1:1");
1099
- const n = this.state.get("crop.aspect"), o = this._getAspectRatio(n);
1176
+ const o = this.state.get("crop.aspect"), n = this._getAspectRatio(o);
1100
1177
  let l, c;
1101
- if (o) {
1102
- const u = t.width * 0.9, f = t.height * 0.9;
1103
- u / f > o ? (c = f, l = c * o) : (l = u, c = l / o);
1178
+ if (n) {
1179
+ const u = t.width * 0.9, p = t.height * 0.9;
1180
+ u / p > n ? (c = p, l = c * n) : (l = u, c = l / n);
1104
1181
  } else {
1105
1182
  const u = Math.min(e.screen.width, e.screen.height) * 0.7;
1106
1183
  l = u, c = u;
1107
1184
  }
1108
1185
  const d = t.x + (t.width - l) / 2, h = t.y + (t.height - c) / 2;
1109
- i = { x: d, y: h, width: l, height: c }, this.state.set("crop.rect", i), n !== "free" && this.constrainCropRect();
1186
+ i = { x: d, y: h, width: l, height: c }, this.state.set("crop.rect", i), o !== "free" && this.constrainCropRect();
1110
1187
  }
1188
+ this.state.set("crop.dirty", !1);
1111
1189
  const r = e.stage;
1112
1190
  r.eventMode = "static", r.hitArea = e.screen, r.cursor = "crosshair", r.on("pointerdown", this._onPointerDown), r.on("pointermove", this._onPointerMove), r.on("pointerup", this._onPointerUp), r.on("pointerupoutside", this._onPointerUp), this.state.set("mode", "crop"), this.drawOverlay(), this.emit("enabled");
1113
1191
  }
@@ -1118,7 +1196,7 @@ const U = class U extends W {
1118
1196
  const e = this.renderer.app;
1119
1197
  if (!e) return;
1120
1198
  const t = e.stage;
1121
- if (t.off("pointerdown", this._onPointerDown), t.off("pointermove", this._onPointerMove), t.off("pointerup", this._onPointerUp), t.off("pointerupoutside", this._onPointerUp), t.eventMode = "auto", t.cursor = "default", this.state.set("crop.rect", null), this._overlayCanvas) {
1199
+ if (t.off("pointerdown", this._onPointerDown), t.off("pointermove", this._onPointerMove), t.off("pointerup", this._onPointerUp), t.off("pointerupoutside", this._onPointerUp), t.eventMode = "auto", t.cursor = "default", this.state.set("crop.rect", null), this.state.set("crop.dirty", !1), this._overlayCanvas) {
1122
1200
  const i = this._overlayCanvas.getContext("2d");
1123
1201
  i == null || i.clearRect(0, 0, this._overlayCanvas.width, this._overlayCanvas.height);
1124
1202
  }
@@ -1131,34 +1209,34 @@ const U = class U extends W {
1131
1209
  apply() {
1132
1210
  const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
1133
1211
  if (!r || !t || !e || !i) return null;
1134
- const a = window.PIXI, n = this.renderer.zoom, o = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * o, d = (r.y - t.y) * l;
1135
- let h = Math.round(Math.max(1, r.width * o)), u = Math.round(Math.max(1, r.height * l)), f = Math.round(c), _ = Math.round(d);
1212
+ const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, d = (r.y - t.y) * l;
1213
+ let h = Math.round(Math.max(1, r.width * n)), u = Math.round(Math.max(1, r.height * l)), p = Math.round(c), b = Math.round(d);
1136
1214
  if (h <= 0 || u <= 0) return null;
1137
1215
  const g = new a.Container(), x = new a.Sprite(i);
1138
1216
  if (this.state.get("crop.shape") === "circle") {
1139
- const I = Math.round(Math.max(h, u)), k = f + h / 2, w = _ + u / 2;
1140
- f = Math.round(k - I / 2), _ = Math.round(w - I / 2), h = u = I;
1217
+ const B = Math.round(Math.max(h, u)), F = p + h / 2, w = b + u / 2;
1218
+ p = Math.round(F - B / 2), b = Math.round(w - B / 2), h = u = B;
1141
1219
  const S = new a.Graphics();
1142
1220
  typeof S.circle == "function" && typeof S.fill == "function" ? S.circle(h / 2, u / 2, h / 2).fill(16777215) : (S.beginFill(16777215, 1), S.drawCircle(h / 2, u / 2, h / 2), S.endFill()), x.mask = S, g.addChild(S);
1143
1221
  }
1144
- x.x = -f, x.y = -_, g.addChild(x);
1145
- const P = a.RenderTexture.create({ width: h, height: u });
1222
+ x.x = -p, x.y = -b, g.addChild(x);
1223
+ const v = a.RenderTexture.create({ width: h, height: u });
1146
1224
  e.renderer.render({
1147
1225
  container: g,
1148
- target: P,
1226
+ target: v,
1149
1227
  clear: !0
1150
1228
  }), g.destroy({ children: !0 });
1151
1229
  const T = this.renderer.originalTexture;
1152
- T && T !== this.renderer.baseTexture && T.destroy(!0), this.renderer.originalTexture = P, e.stage.removeChild(t), t.destroy();
1153
- const N = new a.Sprite(P);
1154
- e.stage.addChild(N), this.renderer.sprite = N, this.renderer.fitScale = this.renderer.getFitScaleFor(P), this.renderer.setZoom(n, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
1155
- const y = this.state.get("crop.appliedRect"), v = y && Number.isFinite(y.x) && Number.isFinite(y.y) && Number.isFinite(y.width) && Number.isFinite(y.height) ? {
1156
- x: Math.round(y.x + f),
1157
- y: Math.round(y.y + _),
1230
+ T && T !== this.renderer.baseTexture && T.destroy(!0), this.renderer.originalTexture = v, e.stage.removeChild(t), t.destroy();
1231
+ const z = new a.Sprite(v);
1232
+ e.stage.addChild(z), this.renderer.sprite = z, this.renderer.fitScale = this.renderer.getFitScaleFor(v), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
1233
+ const _ = this.state.get("crop.appliedRect"), M = _ && Number.isFinite(_.x) && Number.isFinite(_.y) && Number.isFinite(_.width) && Number.isFinite(_.height) ? {
1234
+ x: Math.round(_.x + p),
1235
+ y: Math.round(_.y + b),
1158
1236
  width: h,
1159
1237
  height: u
1160
- } : { x: f, y: _, width: h, height: u }, M = this.state.get("crop.shape") || "free", F = this.state.get("crop.aspect") || "free";
1161
- return this.disable(), this.state.set("crop.appliedRect", v), this.state.set("crop.appliedShape", M), this.state.set("crop.appliedAspect", F), this.emit("applied", { width: h, height: u }), { texture: P, preservedZoom: n };
1238
+ } : { x: p, y: b, width: h, height: u }, k = this.state.get("crop.shape") || "free", A = this.state.get("crop.aspect") || "free";
1239
+ return this.disable(), this.state.set("crop.appliedRect", M), this.state.set("crop.appliedShape", k), this.state.set("crop.appliedAspect", A), this.state.set("crop.dirty", !1), this.emit("applied", { width: h, height: u }), { texture: v, preservedZoom: o };
1162
1240
  }
1163
1241
  /**
1164
1242
  * Apply a crop from saved texture-pixel coordinates (for state rehydration).
@@ -1170,23 +1248,23 @@ const U = class U extends W {
1170
1248
  applyFromPixelRect(e, t = "free") {
1171
1249
  const i = this.renderer.app, r = this.renderer.sprite, a = this.renderer.originalTexture;
1172
1250
  if (!e || !r || !i || !a) return null;
1173
- const n = window.PIXI, o = this.renderer.zoom;
1251
+ const o = window.PIXI, n = this.renderer.zoom;
1174
1252
  let l = Math.round(Math.max(1, e.width)), c = Math.round(Math.max(1, e.height)), d = Math.round(e.x), h = Math.round(e.y);
1175
1253
  if (l <= 0 || c <= 0) return null;
1176
- const u = new n.Container(), f = new n.Sprite(a);
1254
+ const u = new o.Container(), p = new o.Sprite(a);
1177
1255
  if (t === "circle") {
1178
- const A = Math.round(Math.max(l, c)), P = d + l / 2, T = h + c / 2;
1179
- d = Math.round(P - A / 2), h = Math.round(T - A / 2), l = c = A;
1180
- const N = new n.Graphics();
1181
- typeof N.circle == "function" && typeof N.fill == "function" ? N.circle(l / 2, c / 2, l / 2).fill(16777215) : (N.beginFill(16777215, 1), N.drawCircle(l / 2, c / 2, l / 2), N.endFill()), f.mask = N, u.addChild(N);
1182
- }
1183
- f.x = -d, f.y = -h, u.addChild(f);
1184
- const _ = n.RenderTexture.create({ width: l, height: c });
1185
- i.renderer.render({ container: u, target: _, clear: !0 }), u.destroy({ children: !0 });
1256
+ const P = Math.round(Math.max(l, c)), v = d + l / 2, T = h + c / 2;
1257
+ d = Math.round(v - P / 2), h = Math.round(T - P / 2), l = c = P;
1258
+ const z = new o.Graphics();
1259
+ typeof z.circle == "function" && typeof z.fill == "function" ? z.circle(l / 2, c / 2, l / 2).fill(16777215) : (z.beginFill(16777215, 1), z.drawCircle(l / 2, c / 2, l / 2), z.endFill()), p.mask = z, u.addChild(z);
1260
+ }
1261
+ p.x = -d, p.y = -h, u.addChild(p);
1262
+ const b = o.RenderTexture.create({ width: l, height: c });
1263
+ i.renderer.render({ container: u, target: b, clear: !0 }), u.destroy({ children: !0 });
1186
1264
  const g = this.renderer.originalTexture;
1187
- g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture = _, i.stage.removeChild(r), r.destroy();
1188
- const x = new n.Sprite(_);
1189
- return i.stage.addChild(x), this.renderer.sprite = x, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), { texture: _, preservedZoom: o };
1265
+ g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture = b, i.stage.removeChild(r), r.destroy();
1266
+ const x = new o.Sprite(b);
1267
+ return i.stage.addChild(x), this.renderer.sprite = x, this.renderer.fitScale = this.renderer.getFitScaleFor(b), this.renderer.setZoom(n, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), { texture: b, preservedZoom: n };
1190
1268
  }
1191
1269
  /**
1192
1270
  * Cancel crop
@@ -1199,7 +1277,7 @@ const U = class U extends W {
1199
1277
  * @param {'free'|'square'|'circle'} shape
1200
1278
  */
1201
1279
  setShape(e) {
1202
- this.state.get("lockCropShape") || (this.state.set("crop.shape", e), (e === "circle" || e === "square") && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay());
1280
+ this.state.get("lockCropShape") || (this.state.set("crop.shape", e), this.state.set("crop.dirty", !0), (e === "circle" || e === "square") && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay());
1203
1281
  }
1204
1282
  /**
1205
1283
  * Set aspect ratio
@@ -1211,19 +1289,19 @@ const U = class U extends W {
1211
1289
  if (this.state.get("lockCropShape")) return;
1212
1290
  this.state.set("crop.shape", "free");
1213
1291
  }
1214
- this.state.set("crop.aspect", e), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay();
1292
+ this.state.set("crop.aspect", e), this.state.set("crop.dirty", !0), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay();
1215
1293
  }
1216
1294
  };
1217
1295
  /**
1218
1296
  * Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
1219
1297
  * Higher values = more aggressive zoom-out, more padding around image.
1220
1298
  */
1221
- J(U, "AUTO_ZOOM_PADDING", 1.1), /**
1299
+ ie(U, "AUTO_ZOOM_PADDING", 1.1), /**
1222
1300
  * Minimum interval (ms) between auto-zoom adjustments during drag.
1223
1301
  */
1224
- J(U, "AUTO_ZOOM_THROTTLE_MS", 100);
1225
- let ae = U;
1226
- class pt {
1302
+ ie(U, "AUTO_ZOOM_THROTTLE_MS", 100);
1303
+ let le = U;
1304
+ class bt {
1227
1305
  /**
1228
1306
  * Create a new RemoveBgManager
1229
1307
  * @param {Object} options
@@ -1248,7 +1326,7 @@ class pt {
1248
1326
  async removeBackground(e, t = {}) {
1249
1327
  const i = typeof e == "string" ? await this._dataUrlToBlob(e) : e, r = new FormData();
1250
1328
  r.append("file", i, "image.png"), r.append("tier", t.tier || "balanced"), t.model && r.append("model", t.model), t.alpha_matting && (r.append("alpha_matting", "true"), r.append("alpha_f", String(t.alpha_f ?? 10)), r.append("alpha_fr", String(t.alpha_fr ?? 15)), r.append("alpha_erode_size", String(t.alpha_erode_size ?? 10)));
1251
- let a, n;
1329
+ let a, o;
1252
1330
  try {
1253
1331
  a = await fetch(this._endpoint, {
1254
1332
  method: "POST",
@@ -1257,7 +1335,7 @@ class pt {
1257
1335
  // For Sanctum auth
1258
1336
  });
1259
1337
  } catch (c) {
1260
- n = c;
1338
+ o = c;
1261
1339
  }
1262
1340
  if ((!a || !a.ok) && this._fallbackEndpoint)
1263
1341
  try {
@@ -1266,10 +1344,10 @@ class pt {
1266
1344
  body: r
1267
1345
  });
1268
1346
  } catch (c) {
1269
- n || (n = c);
1347
+ o || (o = c);
1270
1348
  }
1271
1349
  if (!a)
1272
- throw n || new Error("Network error: Unable to connect to background removal service");
1350
+ throw o || new Error("Network error: Unable to connect to background removal service");
1273
1351
  if (!a.ok) {
1274
1352
  let c = `Background removal failed (HTTP ${a.status})`;
1275
1353
  try {
@@ -1279,9 +1357,9 @@ class pt {
1279
1357
  }
1280
1358
  throw new Error(c);
1281
1359
  }
1282
- const o = await a.blob();
1360
+ const n = await a.blob();
1283
1361
  return {
1284
- dataUrl: await this._blobToDataUrl(o),
1362
+ dataUrl: await this._blobToDataUrl(n),
1285
1363
  model: a.headers.get("X-Model-Used") || "unknown",
1286
1364
  processMs: a.headers.get("X-Process-Ms") || "0"
1287
1365
  };
@@ -1293,10 +1371,10 @@ class pt {
1293
1371
  */
1294
1372
  async _dataUrlToBlob(e) {
1295
1373
  if (e.startsWith("data:")) {
1296
- const [i, r] = e.split(","), a = i.match(/:(.*?);/), n = a ? a[1] : "image/png", o = atob(r), l = new Uint8Array(o.length);
1297
- for (let c = 0; c < o.length; c++)
1298
- l[c] = o.charCodeAt(c);
1299
- return new Blob([l], { type: n });
1374
+ const [i, r] = e.split(","), a = i.match(/:(.*?);/), o = a ? a[1] : "image/png", n = atob(r), l = new Uint8Array(n.length);
1375
+ for (let c = 0; c < n.length; c++)
1376
+ l[c] = n.charCodeAt(c);
1377
+ return new Blob([l], { type: o });
1300
1378
  }
1301
1379
  return (await fetch(e)).blob();
1302
1380
  }
@@ -1333,7 +1411,7 @@ class pt {
1333
1411
  }
1334
1412
  }
1335
1413
  }
1336
- function p(s, e = {}, ...t) {
1414
+ function f(s, e = {}, ...t) {
1337
1415
  const i = document.createElement(s);
1338
1416
  for (const [r, a] of Object.entries(e))
1339
1417
  if (a != null)
@@ -1342,24 +1420,24 @@ function p(s, e = {}, ...t) {
1342
1420
  else if (r === "style" && typeof a == "object")
1343
1421
  Object.assign(i.style, a);
1344
1422
  else if (r.startsWith("on") && typeof a == "function") {
1345
- const n = r.slice(2).toLowerCase();
1346
- i.addEventListener(n, a);
1423
+ const o = r.slice(2).toLowerCase();
1424
+ i.addEventListener(o, a);
1347
1425
  } else r === "dataset" && typeof a == "object" ? Object.assign(i.dataset, a) : i.setAttribute(r, a);
1348
1426
  for (const r of t)
1349
1427
  typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && i.appendChild(r);
1350
1428
  return i;
1351
1429
  }
1352
- function Ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: n }) {
1353
- const o = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = p("div", {
1430
+ function ze({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
1431
+ const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = f("div", {
1354
1432
  className: "slider-control slider-wrapper",
1355
- "data-control": o,
1356
- "data-testid": `slider-${o}`
1357
- }), c = p(
1433
+ "data-control": n,
1434
+ "data-testid": `slider-${n}`
1435
+ }), c = f(
1358
1436
  "div",
1359
1437
  { className: "slider-header" },
1360
- p("label", { for: s, className: "slider-label" }, e),
1361
- p("span", { className: "slider-value", id: `${s}-value` }, ee(a))
1362
- ), d = p("input", {
1438
+ f("label", { for: s, className: "slider-label" }, e),
1439
+ f("span", { className: "slider-value", id: `${s}-value` }, re(a))
1440
+ ), d = f("input", {
1363
1441
  type: "range",
1364
1442
  id: s,
1365
1443
  className: "slider-input",
@@ -1368,56 +1446,56 @@ function Ae({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
1368
1446
  step: String(r),
1369
1447
  value: String(a),
1370
1448
  onInput: (h) => {
1371
- const u = parseFloat(h.target.value), f = l.querySelector(".slider-value");
1372
- f && (f.textContent = ee(u)), n == null || n(u);
1449
+ const u = parseFloat(h.target.value), p = l.querySelector(".slider-value");
1450
+ p && (p.textContent = re(u)), o == null || o(u);
1373
1451
  }
1374
1452
  });
1375
1453
  return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
1376
1454
  d.value = String(h);
1377
1455
  const u = l.querySelector(".slider-value");
1378
- u && (u.textContent = ee(h));
1456
+ u && (u.textContent = re(h));
1379
1457
  }, l;
1380
1458
  }
1381
- function ee(s) {
1459
+ function re(s) {
1382
1460
  return Number.isInteger(s) ? String(s) : s.toFixed(2);
1383
1461
  }
1384
- function ze({ id: s, label: e, checked: t = !1, onChange: i }) {
1385
- const r = p("div", { className: "toggle-control" }), a = p("label", { className: "toggle-label", for: s }, e), n = p("input", {
1462
+ function Re({ id: s, label: e, checked: t = !1, onChange: i }) {
1463
+ const r = f("div", { className: "toggle-control" }), a = f("label", { className: "toggle-label", for: s }, e), o = f("input", {
1386
1464
  type: "checkbox",
1387
1465
  id: s,
1388
1466
  className: "toggle-input",
1389
1467
  checked: t ? "checked" : void 0,
1390
1468
  onChange: (c) => i == null ? void 0 : i(c.target.checked)
1391
- }), o = p("div", {
1469
+ }), n = f("div", {
1392
1470
  className: "toggle-switch",
1393
1471
  onClick: (c) => {
1394
- c.target !== n && (n.checked = !n.checked, i == null || i(n.checked));
1472
+ c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
1395
1473
  }
1396
- }), l = p("span", { className: "toggle-slider" });
1397
- return o.appendChild(n), o.appendChild(l), r.appendChild(a), r.appendChild(o), r.setChecked = (c) => {
1398
- n.checked = c;
1474
+ }), l = f("span", { className: "toggle-slider" });
1475
+ return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
1476
+ o.checked = c;
1399
1477
  }, r;
1400
1478
  }
1401
- function Ne({ id: s, label: e, value: t = "#000000", onChange: i }) {
1402
- const r = p("div", { className: "color-control" }), a = p("label", { className: "color-label", for: s }, e), n = p("input", {
1479
+ function Te({ id: s, label: e, value: t = "#000000", onChange: i }) {
1480
+ const r = f("div", { className: "color-control" }), a = f("label", { className: "color-label", for: s }, e), o = f("input", {
1403
1481
  type: "color",
1404
1482
  id: s,
1405
1483
  className: "color-input",
1406
1484
  value: t,
1407
- onInput: (o) => i == null ? void 0 : i(o.target.value)
1485
+ onInput: (n) => i == null ? void 0 : i(n.target.value)
1408
1486
  });
1409
- return r.appendChild(a), r.appendChild(n), r.setValue = (o) => {
1410
- n.value = o;
1487
+ return r.appendChild(a), r.appendChild(o), r.setValue = (n) => {
1488
+ o.value = n;
1411
1489
  }, r;
1412
1490
  }
1413
- function Re({ id: s, label: e, value: t = "", placeholder: i = "", onCommit: r }) {
1414
- const a = p("div", {
1491
+ function Ee({ id: s, label: e, value: t = "", placeholder: i = "", onCommit: r }) {
1492
+ const a = f("div", {
1415
1493
  className: "text-control",
1416
1494
  "data-control": s,
1417
1495
  "data-testid": `text-${s}`
1418
- }), n = p("label", { className: "text-label", for: s }, e);
1419
- let o = t;
1420
- const l = p("input", {
1496
+ }), o = f("label", { className: "text-label", for: s }, e);
1497
+ let n = t;
1498
+ const l = f("input", {
1421
1499
  type: "text",
1422
1500
  id: s,
1423
1501
  className: "text-input",
@@ -1430,74 +1508,74 @@ function Re({ id: s, label: e, value: t = "", placeholder: i = "", onCommit: r }
1430
1508
  });
1431
1509
  function c() {
1432
1510
  const d = l.value;
1433
- d !== o && (o = d, r == null || r(d));
1511
+ d !== n && (n = d, r == null || r(d));
1434
1512
  }
1435
- return a.appendChild(n), a.appendChild(l), a.setValue = (d) => {
1513
+ return a.appendChild(o), a.appendChild(l), a.setValue = (d) => {
1436
1514
  const h = d == null ? "" : String(d);
1437
- l.value = h, o = h;
1515
+ l.value = h, n = h;
1438
1516
  }, a;
1439
1517
  }
1440
- function Te({ id: s, label: e, options: t = [], value: i, onChange: r }) {
1441
- const a = p("div", { className: "select-control" }), n = p("label", { className: "select-label", for: s }, e), o = p("select", {
1518
+ function Ie({ id: s, label: e, options: t = [], value: i, onChange: r }) {
1519
+ const a = f("div", { className: "select-control" }), o = f("label", { className: "select-label", for: s }, e), n = f("select", {
1442
1520
  id: s,
1443
1521
  className: "select-input",
1444
1522
  onChange: (l) => r == null ? void 0 : r(l.target.value)
1445
1523
  });
1446
1524
  for (const l of t) {
1447
- const c = p("option", { value: l.value }, l.label);
1448
- l.value === i && (c.selected = !0), o.appendChild(c);
1525
+ const c = f("option", { value: l.value }, l.label);
1526
+ l.value === i && (c.selected = !0), n.appendChild(c);
1449
1527
  }
1450
- return a.appendChild(n), a.appendChild(o), a.setValue = (l) => {
1451
- o.value = l;
1528
+ return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
1529
+ n.value = l;
1452
1530
  }, a;
1453
1531
  }
1454
- function O({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
1455
- const a = p("button", {
1532
+ function E({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
1533
+ const a = f("button", {
1456
1534
  type: "button",
1457
1535
  className: `btn ${e}`.trim(),
1458
1536
  onClick: t,
1459
1537
  disabled: r ? "disabled" : void 0
1460
1538
  });
1461
1539
  if (i) {
1462
- const n = p("span", { className: "btn-icon" });
1463
- n.innerHTML = i;
1464
- const o = n.querySelector("svg");
1465
- o && o.setAttribute("aria-hidden", "true"), a.appendChild(n);
1540
+ const o = f("span", { className: "btn-icon" });
1541
+ o.innerHTML = i;
1542
+ const n = o.querySelector("svg");
1543
+ n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
1466
1544
  }
1467
1545
  return s && a.appendChild(document.createTextNode(s)), a;
1468
1546
  }
1469
- function z({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: n = null }) {
1470
- const o = {
1547
+ function N({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
1548
+ const n = {
1471
1549
  type: "button",
1472
1550
  className: `icon-btn ${t}`.trim(),
1473
1551
  title: e,
1474
- "aria-label": n || e,
1552
+ "aria-label": o || e,
1475
1553
  onClick: i,
1476
1554
  disabled: r ? "disabled" : void 0
1477
1555
  };
1478
- a && (o.dataset = { testid: a });
1479
- const l = p("button", o);
1556
+ a && (n.dataset = { testid: a });
1557
+ const l = f("button", n);
1480
1558
  l.innerHTML = s;
1481
1559
  const c = l.querySelector("svg");
1482
1560
  return c && c.setAttribute("aria-hidden", "true"), l;
1483
1561
  }
1484
- function ne({ label: s, icon: e, active: t = !1, onClick: i }) {
1485
- const r = p("button", {
1562
+ function ee({ label: s, icon: e, active: t = !1, onClick: i }) {
1563
+ const r = f("button", {
1486
1564
  type: "button",
1487
1565
  className: `chip ${t ? "active" : ""}`.trim(),
1488
1566
  onClick: i
1489
1567
  });
1490
1568
  if (e) {
1491
- const a = p("span", { className: "chip-icon" });
1569
+ const a = f("span", { className: "chip-icon" });
1492
1570
  a.innerHTML = e;
1493
- const n = a.querySelector("svg");
1494
- n && n.setAttribute("aria-hidden", "true"), r.appendChild(a);
1571
+ const o = a.querySelector("svg");
1572
+ o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
1495
1573
  }
1496
- return r.appendChild(p("span", { className: "chip-label" }, s)), r.setActive = (a) => {
1574
+ return r.appendChild(f("span", { className: "chip-label" }, s)), r.setActive = (a) => {
1497
1575
  r.classList.toggle("active", a);
1498
1576
  }, r;
1499
1577
  }
1500
- class ft {
1578
+ class yt {
1501
1579
  constructor(e, t) {
1502
1580
  this.state = e, this.editor = t, this.element = null, this._unsubscribers = [];
1503
1581
  }
@@ -1506,9 +1584,9 @@ class ft {
1506
1584
  * @returns {HTMLElement}
1507
1585
  */
1508
1586
  render() {
1509
- this.element = p("div", { className: "editor-toolbar" });
1510
- const e = p("div", { className: "toolbar-section toolbar-left" }), t = z({
1511
- icon: st,
1587
+ this.element = f("div", { className: "editor-toolbar" });
1588
+ const e = f("div", { className: "toolbar-section toolbar-left" }), t = N({
1589
+ icon: lt,
1512
1590
  title: "Open Image",
1513
1591
  className: "toolbar-btn",
1514
1592
  testId: "btn-open-image",
@@ -1516,8 +1594,8 @@ class ft {
1516
1594
  onClick: () => this.editor.openFilePicker()
1517
1595
  });
1518
1596
  e.appendChild(t);
1519
- const i = p("div", { className: "toolbar-section toolbar-center" }), r = z({
1520
- icon: We,
1597
+ const i = f("div", { className: "toolbar-section toolbar-center" }), r = N({
1598
+ icon: Ge,
1521
1599
  title: "Zoom Out",
1522
1600
  className: "toolbar-btn",
1523
1601
  testId: "btn-zoom-out",
@@ -1527,14 +1605,14 @@ class ft {
1527
1605
  this.editor.setZoom(h - 0.25);
1528
1606
  }
1529
1607
  });
1530
- this._zoomLabel = p("span", {
1608
+ this._zoomLabel = f("span", {
1531
1609
  className: "zoom-label",
1532
1610
  "aria-live": "polite",
1533
1611
  "aria-atomic": "true",
1534
1612
  role: "status"
1535
1613
  }, "100%");
1536
- const a = z({
1537
- icon: $e,
1614
+ const a = N({
1615
+ icon: Ze,
1538
1616
  title: "Zoom In",
1539
1617
  className: "toolbar-btn",
1540
1618
  testId: "btn-zoom-in",
@@ -1543,25 +1621,25 @@ class ft {
1543
1621
  const h = this.state.get("zoom");
1544
1622
  this.editor.setZoom(h + 0.25);
1545
1623
  }
1546
- }), n = z({
1547
- icon: Ze,
1624
+ }), o = N({
1625
+ icon: Ke,
1548
1626
  title: "Fit to Screen",
1549
1627
  className: "toolbar-btn",
1550
1628
  testId: "btn-fit-screen",
1551
1629
  ariaLabel: "Fit to screen",
1552
1630
  onClick: () => this.editor.fitToScreen()
1553
1631
  });
1554
- i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(n);
1555
- const o = p("div", { className: "toolbar-section toolbar-right" });
1556
- this._themeBtn = z({
1557
- icon: this.state.get("isDarkMode") ? he : de,
1632
+ i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
1633
+ const n = f("div", { className: "toolbar-section toolbar-right" });
1634
+ this._themeBtn = N({
1635
+ icon: this.state.get("isDarkMode") ? ue : pe,
1558
1636
  title: "Toggle Theme",
1559
1637
  className: "toolbar-btn toolbar-btn-theme",
1560
1638
  testId: "btn-toggle-theme",
1561
1639
  ariaLabel: "Toggle theme",
1562
1640
  onClick: () => this.editor.toggleTheme()
1563
- }), this._cropBtn = z({
1564
- icon: ke,
1641
+ }), this._cropBtn = N({
1642
+ icon: Ae,
1565
1643
  title: "Crop",
1566
1644
  className: "toolbar-btn toolbar-btn-crop",
1567
1645
  testId: "btn-crop",
@@ -1570,29 +1648,29 @@ class ft {
1570
1648
  this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
1571
1649
  }
1572
1650
  });
1573
- const l = z({
1574
- icon: Fe,
1651
+ const l = N({
1652
+ icon: Ne,
1575
1653
  title: "Reset All",
1576
1654
  className: "toolbar-btn",
1577
1655
  testId: "btn-reset-all",
1578
1656
  ariaLabel: "Reset all changes",
1579
1657
  onClick: () => this.editor.resetAll()
1580
- }), c = z({
1581
- icon: it,
1658
+ }), c = N({
1659
+ icon: st,
1582
1660
  title: "Save Image",
1583
1661
  className: "toolbar-btn toolbar-btn-primary",
1584
1662
  testId: "btn-save-edit",
1585
1663
  ariaLabel: "Save image",
1586
1664
  onClick: () => this.editor.save()
1587
- }), d = z({
1588
- icon: oe,
1665
+ }), d = N({
1666
+ icon: ce,
1589
1667
  title: "Close",
1590
1668
  className: "toolbar-btn",
1591
1669
  testId: "btn-cancel-edit",
1592
1670
  ariaLabel: "Close editor",
1593
1671
  onClick: () => this.editor.close()
1594
1672
  });
1595
- return o.appendChild(this._themeBtn), o.appendChild(this._cropBtn), o.appendChild(l), o.appendChild(c), o.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(o), this._subscribeToState(), this.element;
1673
+ return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
1596
1674
  }
1597
1675
  /**
1598
1676
  * Subscribe to state changes
@@ -1603,7 +1681,7 @@ class ft {
1603
1681
  });
1604
1682
  this._unsubscribers.push(e);
1605
1683
  const t = this.state.on("change:isDarkMode", ({ value: r }) => {
1606
- this._themeBtn.innerHTML = r ? he : de;
1684
+ this._themeBtn.innerHTML = r ? ue : pe;
1607
1685
  });
1608
1686
  this._unsubscribers.push(t);
1609
1687
  const i = this.state.on("change:mode", ({ value: r }) => {
@@ -1626,8 +1704,8 @@ class ft {
1626
1704
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], (e = this.element) == null || e.remove(), this.element = null;
1627
1705
  }
1628
1706
  }
1629
- const G = le;
1630
- class mt {
1707
+ const Q = he;
1708
+ class _t {
1631
1709
  constructor(e, t) {
1632
1710
  this.state = e, this.editor = t, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
1633
1711
  }
@@ -1637,35 +1715,35 @@ class mt {
1637
1715
  * @returns {HTMLElement}
1638
1716
  */
1639
1717
  render(e) {
1640
- this._onSelect = e, this.element = p("div", {
1718
+ this._onSelect = e, this.element = f("div", {
1641
1719
  className: "category-carousel-container",
1642
1720
  "data-testid": "category-carousel"
1643
- }), this._leftBtn = z({
1644
- icon: Me,
1721
+ }), this._leftBtn = N({
1722
+ icon: Pe,
1645
1723
  title: "Previous categories",
1646
1724
  className: "carousel-nav carousel-nav-left",
1647
1725
  onClick: () => this._scrollLeft()
1648
- }), this._carousel = p("div", { className: "category-carousel" }), G.forEach((i) => {
1649
- const r = ne({
1726
+ }), this._carousel = f("div", { className: "category-carousel" }), Q.forEach((i) => {
1727
+ const r = ee({
1650
1728
  label: i.name,
1651
1729
  icon: i.icon,
1652
1730
  active: this.state.get("selectedCategory") === i.id,
1653
1731
  onClick: () => this._selectCategory(i.id)
1654
1732
  });
1655
1733
  r.dataset.categoryId = i.id, r.dataset.category = i.id, r.dataset.testid = `category-${i.id}`, this._chips.set(i.id, r), this._carousel.appendChild(r);
1656
- }), this._rightBtn = z({
1657
- icon: Pe,
1734
+ }), this._rightBtn = N({
1735
+ icon: Fe,
1658
1736
  title: "Next categories",
1659
1737
  className: "carousel-nav carousel-nav-right",
1660
1738
  onClick: () => this._scrollRight()
1661
- }), this._pagination = p("div", {
1739
+ }), this._pagination = f("div", {
1662
1740
  className: "carousel-pagination",
1663
1741
  role: "tablist",
1664
1742
  "aria-label": "Category pages"
1665
1743
  });
1666
- const t = Math.ceil(G.length / 3);
1744
+ const t = Math.ceil(Q.length / 3);
1667
1745
  for (let i = 0; i < t; i++) {
1668
- const r = p("button", {
1746
+ const r = f("button", {
1669
1747
  type: "button",
1670
1748
  className: `pagination-dot ${i === 0 ? "active" : ""}`,
1671
1749
  role: "tab",
@@ -1710,7 +1788,7 @@ class mt {
1710
1788
  * Scroll carousel right
1711
1789
  */
1712
1790
  _scrollRight() {
1713
- this._scrollIndex < G.length - 3 && (this._scrollIndex++, this._scrollCarousel());
1791
+ this._scrollIndex < Q.length - 3 && (this._scrollIndex++, this._scrollCarousel());
1714
1792
  }
1715
1793
  /**
1716
1794
  * Scroll to a specific page
@@ -1737,7 +1815,7 @@ class mt {
1737
1815
  * Update navigation button states
1738
1816
  */
1739
1817
  _updateNavButtons() {
1740
- this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= G.length - 3);
1818
+ this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= Q.length - 3);
1741
1819
  }
1742
1820
  /**
1743
1821
  * Update pagination dot states
@@ -1766,7 +1844,7 @@ class mt {
1766
1844
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
1767
1845
  }
1768
1846
  }
1769
- class gt {
1847
+ class xt {
1770
1848
  constructor(e, t) {
1771
1849
  this.state = e, this.filterManager = t, this.element = null, this._filterCards = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
1772
1850
  }
@@ -1776,13 +1854,13 @@ class gt {
1776
1854
  * @returns {HTMLElement}
1777
1855
  */
1778
1856
  render({ onToggle: e, onSelect: t }) {
1779
- return this._onToggle = e, this._onSelect = t, this.element = p("div", { className: "filter-carousel-container" }), this._leftBtn = z({
1780
- icon: Me,
1857
+ return this._onToggle = e, this._onSelect = t, this.element = f("div", { className: "filter-carousel-container" }), this._leftBtn = N({
1858
+ icon: Pe,
1781
1859
  title: "Previous filters",
1782
1860
  className: "carousel-nav carousel-nav-left",
1783
1861
  onClick: () => this._scrollLeft()
1784
- }), this._carousel = p("div", { className: "filter-carousel" }), this._rightBtn = z({
1785
- icon: Pe,
1862
+ }), this._carousel = f("div", { className: "filter-carousel" }), this._rightBtn = N({
1863
+ icon: Fe,
1786
1864
  title: "Next filters",
1787
1865
  className: "carousel-nav carousel-nav-right",
1788
1866
  onClick: () => this._scrollRight()
@@ -1814,11 +1892,11 @@ class gt {
1814
1892
  if (e === "crop") return;
1815
1893
  const t = this.filterManager.getFiltersByCategory(e), i = this.state.get("activeFilters"), r = this.state.get("selectedFilter");
1816
1894
  t.forEach((a) => {
1817
- const n = this._createFilterCard(a, {
1895
+ const o = this._createFilterCard(a, {
1818
1896
  isActive: i.has(a.id),
1819
1897
  isSelected: r === a.id
1820
1898
  });
1821
- this._filterCards.set(a.id, n), this._carousel.appendChild(n);
1899
+ this._filterCards.set(a.id, o), this._carousel.appendChild(o);
1822
1900
  }), this._updateNavButtons();
1823
1901
  }
1824
1902
  /**
@@ -1828,14 +1906,14 @@ class gt {
1828
1906
  * @returns {HTMLElement}
1829
1907
  */
1830
1908
  _createFilterCard(e, { isActive: t, isSelected: i }) {
1831
- const r = p("div", {
1909
+ const r = f("div", {
1832
1910
  className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
1833
1911
  "data-filter": e.id,
1834
1912
  "data-testid": `filter-${e.id}`,
1835
1913
  onClick: () => this._handleCardClick(e.id)
1836
- }), a = p("div", { className: "filter-preview" }), n = p("span", { className: "filter-preview-text" }, e.name.charAt(0));
1837
- a.appendChild(n);
1838
- const o = p("span", { className: "filter-name", title: e.name }, e.name), l = p("button", {
1914
+ }), a = f("div", { className: "filter-preview" }), o = f("span", { className: "filter-preview-text" }, e.name.charAt(0));
1915
+ a.appendChild(o);
1916
+ const n = f("span", { className: "filter-name", title: e.name }, e.name), l = f("button", {
1839
1917
  className: `filter-toggle ${t ? "active" : ""}`,
1840
1918
  onClick: (c) => {
1841
1919
  var u;
@@ -1844,7 +1922,7 @@ class gt {
1844
1922
  this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (u = this._onSelect) == null || u.call(this, e.id));
1845
1923
  }
1846
1924
  });
1847
- return l.innerHTML = t ? se : "", r.appendChild(a), r.appendChild(o), r.appendChild(l), r._toggle = l, r._isActive = t, r;
1925
+ return l.innerHTML = t ? ne : "", r.appendChild(a), r.appendChild(n), r.appendChild(l), r._toggle = l, r._isActive = t, r;
1848
1926
  }
1849
1927
  /**
1850
1928
  * Handle filter card click (select)
@@ -1870,7 +1948,7 @@ class gt {
1870
1948
  const e = this.state.get("activeFilters");
1871
1949
  this._filterCards.forEach((t, i) => {
1872
1950
  const r = e.has(i);
1873
- t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? se : "", t._isActive = r;
1951
+ t.classList.toggle("active", r), t._toggle.classList.toggle("active", r), t._toggle.innerHTML = r ? ne : "", t._isActive = r;
1874
1952
  });
1875
1953
  }
1876
1954
  /**
@@ -1923,7 +2001,7 @@ class gt {
1923
2001
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
1924
2002
  }
1925
2003
  }
1926
- class bt {
2004
+ class Ct {
1927
2005
  constructor(e, t) {
1928
2006
  this.state = e, this.filterManager = t, this.element = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onAction = null, this._unsubscribers = [];
1929
2007
  }
@@ -1933,7 +2011,7 @@ class bt {
1933
2011
  * @returns {HTMLElement}
1934
2012
  */
1935
2013
  render({ onChange: e, onReset: t, onAction: i }) {
1936
- return this._onChange = e, this._onReset = t, this._onAction = i, this.element = p("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
2014
+ return this._onChange = e, this._onReset = t, this._onAction = i, this.element = f("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
1937
2015
  }
1938
2016
  /**
1939
2017
  * Subscribe to state changes
@@ -1960,36 +2038,36 @@ class bt {
1960
2038
  const e = this.state.get("selectedFilter");
1961
2039
  if (!e) {
1962
2040
  this.element.appendChild(
1963
- p("div", { className: "no-filter-selected" }, "Select a filter to adjust")
2041
+ f("div", { className: "no-filter-selected" }, "Select a filter to adjust")
1964
2042
  );
1965
2043
  return;
1966
2044
  }
1967
2045
  const t = this.filterManager.getFilterDef(e);
1968
2046
  if (!t) {
1969
2047
  this.element.appendChild(
1970
- p("div", { className: "no-filter-selected" }, "Filter not found")
2048
+ f("div", { className: "no-filter-selected" }, "Filter not found")
1971
2049
  );
1972
2050
  return;
1973
2051
  }
1974
- const i = p("div", { className: "adjustments-header" });
1975
- i.appendChild(p("span", { className: "adjustments-title" }, t.name)), i.appendChild(O({
2052
+ const i = f("div", { className: "adjustments-header" });
2053
+ i.appendChild(f("span", { className: "adjustments-title" }, t.name)), i.appendChild(E({
1976
2054
  label: "Reset",
1977
2055
  className: "btn-text",
1978
2056
  onClick: () => this._handleReset(e)
1979
2057
  })), this.element.appendChild(i);
1980
- const r = p("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
1981
- (t.controls || []).forEach((o) => {
1982
- const l = a[o.id] ?? o.default, c = this._createControl(e, o, l);
1983
- c && (this._controls.set(o.id, c), r.appendChild(c));
2058
+ const r = f("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
2059
+ (t.controls || []).forEach((n) => {
2060
+ const l = a[n.id] ?? n.default, c = this._createControl(e, n, l);
2061
+ c && (this._controls.set(n.id, c), r.appendChild(c));
1984
2062
  });
1985
- const n = this.filterManager.getInstance(e);
1986
- if (n && typeof n.getDynamicControls == "function") {
1987
- let o = [];
2063
+ const o = this.filterManager.getInstance(e);
2064
+ if (o && typeof o.getDynamicControls == "function") {
2065
+ let n = [];
1988
2066
  try {
1989
- o = n.getDynamicControls() || [];
2067
+ n = o.getDynamicControls() || [];
1990
2068
  } catch {
1991
2069
  }
1992
- o.forEach((l) => {
2070
+ n.forEach((l) => {
1993
2071
  const c = l.property || l.id, d = a[c] ?? l.default, h = this._createControl(e, l, d);
1994
2072
  h && (this._controls.set(l.id, h), r.appendChild(h));
1995
2073
  });
@@ -2012,52 +2090,52 @@ class bt {
2012
2090
  */
2013
2091
  _createControl(e, t, i) {
2014
2092
  if (t.hidden) return null;
2015
- const r = t.label || t.id, a = this._normalizeControlType(t.type), n = t.property || t.id;
2093
+ const r = t.label || t.id, a = this._normalizeControlType(t.type), o = t.property || t.id;
2016
2094
  switch (a) {
2017
2095
  case "slider":
2018
- return Ae({
2096
+ return ze({
2019
2097
  id: `${e}-${t.id}`,
2020
2098
  label: r,
2021
2099
  min: t.min ?? 0,
2022
2100
  max: t.max ?? 1,
2023
2101
  step: t.step ?? 0.01,
2024
2102
  value: typeof i == "number" ? i : t.default ?? 0,
2025
- onChange: (c) => this._handleChange(e, n, c)
2103
+ onChange: (c) => this._handleChange(e, o, c)
2026
2104
  });
2027
2105
  case "toggle":
2028
- return ze({
2106
+ return Re({
2029
2107
  id: `${e}-${t.id}`,
2030
2108
  label: r,
2031
2109
  checked: !!i,
2032
- onChange: (c) => this._handleChange(e, n, c)
2110
+ onChange: (c) => this._handleChange(e, o, c)
2033
2111
  });
2034
2112
  case "color":
2035
- return Ne({
2113
+ return Te({
2036
2114
  id: `${e}-${t.id}`,
2037
2115
  label: r,
2038
2116
  value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
2039
- onChange: (c) => this._handleChange(e, n, c)
2117
+ onChange: (c) => this._handleChange(e, o, c)
2040
2118
  });
2041
2119
  case "select":
2042
- const o = this._normalizeOptions(t.options);
2043
- return Te({
2120
+ const n = this._normalizeOptions(t.options);
2121
+ return Ie({
2044
2122
  id: `${e}-${t.id}`,
2045
2123
  label: r,
2046
- options: o,
2124
+ options: n,
2047
2125
  value: i ?? t.default,
2048
- onChange: (c) => this._handleChange(e, n, c)
2126
+ onChange: (c) => this._handleChange(e, o, c)
2049
2127
  });
2050
2128
  case "text":
2051
- return Re({
2129
+ return Ee({
2052
2130
  id: `${e}-${t.id}`,
2053
2131
  label: r,
2054
2132
  value: typeof i == "string" ? i : t.default ?? "",
2055
2133
  placeholder: t.placeholder || "",
2056
- onCommit: (c) => this._handleChange(e, n, c)
2134
+ onCommit: (c) => this._handleChange(e, o, c)
2057
2135
  });
2058
2136
  case "button":
2059
- const l = p("div", { className: "button-control" });
2060
- return l.appendChild(O({
2137
+ const l = f("div", { className: "button-control" });
2138
+ return l.appendChild(E({
2061
2139
  label: r,
2062
2140
  className: "btn-secondary",
2063
2141
  onClick: () => this._handleAction(e, t.action || t.id)
@@ -2132,8 +2210,8 @@ class bt {
2132
2210
  i && i.controls.forEach((r) => {
2133
2211
  const a = this._controls.get(r.id);
2134
2212
  if (a && typeof a.setValue == "function") {
2135
- const n = t[r.id] ?? r.default;
2136
- a.setValue(n);
2213
+ const o = t[r.id] ?? r.default;
2214
+ a.setValue(o);
2137
2215
  }
2138
2216
  });
2139
2217
  }
@@ -2157,7 +2235,7 @@ class bt {
2157
2235
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
2158
2236
  }
2159
2237
  }
2160
- class yt {
2238
+ class wt {
2161
2239
  constructor(e, t) {
2162
2240
  this.state = e, this.filterManager = t, this._drawer = null, this._body = null, this._titleEl = null, this._isOpen = !1, this._currentFilterId = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onRemove = null, this._onAction = null, this._container = null;
2163
2241
  }
@@ -2167,31 +2245,31 @@ class yt {
2167
2245
  * @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
2168
2246
  */
2169
2247
  build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
2170
- this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = p("div", { className: "mobile-filter-drawer" });
2171
- const n = p("div", { className: "drawer-header" });
2172
- this._titleEl = p("span", { className: "drawer-title" }, "Filter");
2173
- const o = p("div", { className: "drawer-header-actions" }), l = O({
2248
+ this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = f("div", { className: "mobile-filter-drawer" });
2249
+ const o = f("div", { className: "drawer-header" });
2250
+ this._titleEl = f("span", { className: "drawer-title" }, "Filter");
2251
+ const n = f("div", { className: "drawer-header-actions" }), l = E({
2174
2252
  label: "Reset",
2175
2253
  className: "btn-text",
2176
2254
  onClick: () => {
2177
2255
  var h;
2178
2256
  this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
2179
2257
  }
2180
- }), c = O({
2258
+ }), c = E({
2181
2259
  label: "Remove",
2182
2260
  className: "btn-text btn-danger",
2183
2261
  onClick: () => {
2184
2262
  var h;
2185
2263
  this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
2186
2264
  }
2187
- }), d = z({
2188
- icon: oe,
2265
+ }), d = N({
2266
+ icon: ce,
2189
2267
  title: "Close",
2190
2268
  className: "btn-icon-sm",
2191
2269
  ariaLabel: "Close drawer",
2192
2270
  onClick: () => this.close()
2193
2271
  });
2194
- o.appendChild(l), o.appendChild(c), o.appendChild(d), n.appendChild(this._titleEl), n.appendChild(o), this._drawer.appendChild(n), this._body = p("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
2272
+ n.appendChild(l), n.appendChild(c), n.appendChild(d), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = f("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
2195
2273
  }
2196
2274
  /**
2197
2275
  * Open the drawer for a specific filter
@@ -2243,11 +2321,11 @@ class yt {
2243
2321
  const e = this.filterManager.getFilterDef(this._currentFilterId);
2244
2322
  if (!e) return;
2245
2323
  this._titleEl.textContent = e.name;
2246
- const t = p("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
2324
+ const t = f("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
2247
2325
  (e.controls || []).forEach((a) => {
2248
2326
  if (a.hidden) return;
2249
- const n = this._createControl(this._currentFilterId, a, i[a.id] ?? a.default);
2250
- n && (this._controls.set(a.id, n), t.appendChild(n));
2327
+ const o = this._createControl(this._currentFilterId, a, i[a.id] ?? a.default);
2328
+ o && (this._controls.set(a.id, o), t.appendChild(o));
2251
2329
  });
2252
2330
  const r = this.filterManager.getInstance(this._currentFilterId);
2253
2331
  if (r && typeof r.getDynamicControls == "function") {
@@ -2256,9 +2334,9 @@ class yt {
2256
2334
  a = r.getDynamicControls() || [];
2257
2335
  } catch {
2258
2336
  }
2259
- a.forEach((n) => {
2260
- const o = n.property || n.id, l = i[o] ?? n.default, c = this._createControl(this._currentFilterId, n, l);
2261
- c && (this._controls.set(n.id, c), t.appendChild(c));
2337
+ a.forEach((o) => {
2338
+ const n = o.property || o.id, l = i[n] ?? o.default, c = this._createControl(this._currentFilterId, o, l);
2339
+ c && (this._controls.set(o.id, c), t.appendChild(c));
2262
2340
  });
2263
2341
  }
2264
2342
  this._body.appendChild(t);
@@ -2273,75 +2351,75 @@ class yt {
2273
2351
  */
2274
2352
  _createControl(e, t, i) {
2275
2353
  if (t.hidden) return null;
2276
- const r = t.label || t.id, a = this._normalizeControlType(t.type), n = t.property || t.id;
2354
+ const r = t.label || t.id, a = this._normalizeControlType(t.type), o = t.property || t.id;
2277
2355
  switch (a) {
2278
2356
  case "slider":
2279
- return Ae({
2357
+ return ze({
2280
2358
  id: `drawer-${e}-${t.id}`,
2281
2359
  label: r,
2282
2360
  min: t.min ?? 0,
2283
2361
  max: t.max ?? 1,
2284
2362
  step: t.step ?? 0.01,
2285
2363
  value: typeof i == "number" ? i : t.default ?? 0,
2286
- onChange: (o) => {
2364
+ onChange: (n) => {
2287
2365
  var l;
2288
- return (l = this._onChange) == null ? void 0 : l.call(this, e, n, o);
2366
+ return (l = this._onChange) == null ? void 0 : l.call(this, e, o, n);
2289
2367
  }
2290
2368
  });
2291
2369
  case "toggle":
2292
- return ze({
2370
+ return Re({
2293
2371
  id: `drawer-${e}-${t.id}`,
2294
2372
  label: r,
2295
2373
  checked: !!i,
2296
- onChange: (o) => {
2374
+ onChange: (n) => {
2297
2375
  var l;
2298
- return (l = this._onChange) == null ? void 0 : l.call(this, e, n, o);
2376
+ return (l = this._onChange) == null ? void 0 : l.call(this, e, o, n);
2299
2377
  }
2300
2378
  });
2301
2379
  case "color":
2302
- return Ne({
2380
+ return Te({
2303
2381
  id: `drawer-${e}-${t.id}`,
2304
2382
  label: r,
2305
2383
  value: typeof i == "string" && i.startsWith("#") ? i : t.default || "#000000",
2306
- onChange: (o) => {
2384
+ onChange: (n) => {
2307
2385
  var l;
2308
- return (l = this._onChange) == null ? void 0 : l.call(this, e, n, o);
2386
+ return (l = this._onChange) == null ? void 0 : l.call(this, e, o, n);
2309
2387
  }
2310
2388
  });
2311
2389
  case "select": {
2312
- const o = this._normalizeOptions(t.options);
2313
- return Te({
2390
+ const n = this._normalizeOptions(t.options);
2391
+ return Ie({
2314
2392
  id: `drawer-${e}-${t.id}`,
2315
2393
  label: r,
2316
- options: o,
2394
+ options: n,
2317
2395
  value: i ?? t.default,
2318
2396
  onChange: (l) => {
2319
2397
  var c;
2320
- return (c = this._onChange) == null ? void 0 : c.call(this, e, n, l);
2398
+ return (c = this._onChange) == null ? void 0 : c.call(this, e, o, l);
2321
2399
  }
2322
2400
  });
2323
2401
  }
2324
2402
  case "text":
2325
- return Re({
2403
+ return Ee({
2326
2404
  id: `drawer-${e}-${t.id}`,
2327
2405
  label: r,
2328
2406
  value: typeof i == "string" ? i : t.default ?? "",
2329
2407
  placeholder: t.placeholder || "",
2330
- onCommit: (o) => {
2408
+ onCommit: (n) => {
2331
2409
  var l;
2332
- return (l = this._onChange) == null ? void 0 : l.call(this, e, n, o);
2410
+ return (l = this._onChange) == null ? void 0 : l.call(this, e, o, n);
2333
2411
  }
2334
2412
  });
2335
2413
  case "button": {
2336
- const o = p("div", { className: "button-control" });
2337
- return o.appendChild(O({
2414
+ const n = f("div", { className: "button-control" });
2415
+ return n.appendChild(E({
2338
2416
  label: r,
2339
2417
  className: "btn-secondary",
2340
2418
  onClick: () => {
2341
2419
  var l;
2342
2420
  (l = this._onAction) == null || l.call(this, e, t.action || t.id), this._renderControls();
2343
2421
  }
2344
- })), o;
2422
+ })), n;
2345
2423
  }
2346
2424
  default:
2347
2425
  return null;
@@ -2381,7 +2459,7 @@ class yt {
2381
2459
  this._controls.clear(), (e = this._drawer) == null || e.remove(), this._drawer = null, this._isOpen = !1, this._currentFilterId = null, this._container = null;
2382
2460
  }
2383
2461
  }
2384
- class _t {
2462
+ class St {
2385
2463
  constructor(e, t) {
2386
2464
  this.state = e, this.filterManager = t, this.element = null, this._scrollContainer = null, this._chips = /* @__PURE__ */ new Map(), this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
2387
2465
  }
@@ -2390,10 +2468,10 @@ class _t {
2390
2468
  * @returns {HTMLElement}
2391
2469
  */
2392
2470
  render({ onToggle: e, onSelect: t }) {
2393
- return this._onToggle = e, this._onSelect = t, this.element = p("div", {
2471
+ return this._onToggle = e, this._onSelect = t, this.element = f("div", {
2394
2472
  className: "mobile-active-filters",
2395
2473
  "data-testid": "mobile-active-filters"
2396
- }), this._scrollContainer = p("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
2474
+ }), this._scrollContainer = f("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
2397
2475
  }
2398
2476
  _subscribeToState() {
2399
2477
  const e = this.state.on("change:activeFilters", () => {
@@ -2409,7 +2487,7 @@ class _t {
2409
2487
  this._scrollContainer.innerHTML = "", this._chips.clear();
2410
2488
  const e = this.state.get("activeFilters");
2411
2489
  if (!e || e.size === 0) {
2412
- const t = p("div", {
2490
+ const t = f("div", {
2413
2491
  className: "active-filter-placeholder"
2414
2492
  }, "No active filters");
2415
2493
  this._scrollContainer.appendChild(t);
@@ -2423,22 +2501,22 @@ class _t {
2423
2501
  }), this._updateSelectedState();
2424
2502
  }
2425
2503
  _createChip(e, t) {
2426
- const i = p("div", {
2504
+ const i = f("div", {
2427
2505
  className: "active-filter-chip",
2428
2506
  "data-filter-id": e,
2429
2507
  "data-testid": `active-chip-${e}`
2430
- }), r = p("span", {
2508
+ }), r = f("span", {
2431
2509
  className: "active-filter-chip-label",
2432
- onClick: (n) => {
2433
- var o;
2434
- n.stopPropagation(), (o = this._onSelect) == null || o.call(this, e);
2510
+ onClick: (o) => {
2511
+ var n;
2512
+ o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
2435
2513
  }
2436
- }, t.name), a = p("button", {
2514
+ }, t.name), a = f("button", {
2437
2515
  className: "active-filter-chip-check",
2438
2516
  "aria-label": `Remove ${t.name} filter`,
2439
- onClick: (n) => {
2440
- var o;
2441
- n.stopPropagation(), (o = this._onToggle) == null || o.call(this, e, !1);
2517
+ onClick: (o) => {
2518
+ var n;
2519
+ o.stopPropagation(), (n = this._onToggle) == null || n.call(this, e, !1);
2442
2520
  }
2443
2521
  });
2444
2522
  return a.innerHTML = '<svg width="10" height="10" viewBox="0 0 12 12"><path d="M2 6l3 3 5-5" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>', i.appendChild(r), i.appendChild(a), i;
@@ -2454,21 +2532,31 @@ class _t {
2454
2532
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
2455
2533
  }
2456
2534
  }
2457
- const xt = [
2458
- { id: "free", name: "Free", icon: ot },
2459
- { id: "square", name: "Square", icon: at },
2460
- { id: "circle", name: "Circle", icon: nt }
2461
- ], Ct = [
2535
+ const vt = [
2536
+ { id: "free", name: "Free", icon: dt },
2537
+ { id: "square", name: "Square", icon: ct },
2538
+ { id: "circle", name: "Circle", icon: ht }
2539
+ ], Mt = [
2462
2540
  { id: "free", name: "Free" },
2463
2541
  { id: "1:1", name: "1:1" },
2464
2542
  { id: "4:3", name: "4:3" },
2465
2543
  { id: "16:9", name: "16:9" },
2466
2544
  { id: "3:2", name: "3:2" },
2467
2545
  { id: "2:3", name: "2:3" }
2546
+ ], kt = [
2547
+ { id: "0", label: "0°", angle: 0 },
2548
+ { id: "90", label: "90°", angle: 90 },
2549
+ { id: "180", label: "180°", angle: 180 },
2550
+ { id: "270", label: "270°", angle: 270 }
2468
2551
  ];
2469
- class wt {
2470
- constructor(e, t) {
2471
- this.state = e, this.cropManager = t, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
2552
+ function q(s) {
2553
+ if (!Number.isFinite(Number(s))) return 0;
2554
+ const e = Number(s) % 360;
2555
+ return e < 0 ? e + 360 : e;
2556
+ }
2557
+ class Pt {
2558
+ constructor(e, t, i = null) {
2559
+ this.state = e, this.cropManager = t, this.editor = i, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._rotationPresetChips = /* @__PURE__ */ new Map(), this._rotationRange = null, this._rotationNumber = null, this._rotationValue = null, this._unsubscribers = [];
2472
2560
  }
2473
2561
  /**
2474
2562
  * Apply crop and return the editor UI to filter mode.
@@ -2483,62 +2571,182 @@ class wt {
2483
2571
  * @returns {HTMLElement}
2484
2572
  */
2485
2573
  render() {
2486
- this.element = p("div", {
2574
+ this.element = f("div", {
2487
2575
  className: "crop-controls",
2488
2576
  "data-testid": "crop-controls"
2489
- });
2490
- const e = p("div", { className: "crop-section" });
2491
- e.appendChild(p("label", { className: "section-label" }, "Shape"));
2492
- const t = p("div", { className: "chip-row" }), i = this.state.get("crop.shape");
2493
- xt.forEach((c) => {
2494
- const d = ne({
2577
+ }), this.element.appendChild(this._renderRotationSection());
2578
+ const e = f("div", { className: "crop-section" });
2579
+ e.appendChild(f("label", { className: "section-label" }, "Shape"));
2580
+ const t = f("div", { className: "chip-row" }), i = this.state.get("crop.shape");
2581
+ vt.forEach((c) => {
2582
+ const d = ee({
2495
2583
  label: c.name,
2496
2584
  icon: c.icon,
2497
2585
  active: i === c.id,
2498
2586
  onClick: () => this._selectShape(c.id)
2499
2587
  });
2500
2588
  d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), t.appendChild(d);
2501
- }), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = p("div", { className: "crop-section" }), this._aspectSection.appendChild(p("label", { className: "section-label" }, "Aspect Ratio"));
2502
- const r = p("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
2503
- Ct.forEach((c) => {
2504
- const d = ne({
2589
+ }), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = f("div", { className: "crop-section" }), this._aspectSection.appendChild(f("label", { className: "section-label" }, "Aspect Ratio"));
2590
+ const r = f("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
2591
+ Mt.forEach((c) => {
2592
+ const d = ee({
2505
2593
  label: c.name,
2506
2594
  active: a === c.id,
2507
2595
  onClick: () => this._selectAspect(c.id)
2508
2596
  });
2509
2597
  d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
2510
2598
  }), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
2511
- const n = p("div", { className: "crop-actions" }), o = O({
2599
+ const o = f("div", { className: "crop-actions" }), n = E({
2512
2600
  label: "Cancel",
2513
2601
  className: "btn-secondary crop-cancel-btn",
2514
- icon: oe,
2602
+ icon: ce,
2515
2603
  onClick: () => this.cropManager.cancel()
2516
2604
  });
2517
- o.dataset.testid = "cancel-crop";
2518
- const l = O({
2605
+ n.dataset.testid = "cancel-crop";
2606
+ const l = E({
2519
2607
  label: "Apply Crop",
2520
2608
  className: "btn-primary crop-apply-btn",
2521
- icon: se,
2609
+ icon: ne,
2522
2610
  onClick: () => this._applyCropAndReturnToFilters()
2523
2611
  });
2524
- return l.dataset.testid = "apply-crop", n.appendChild(o), n.appendChild(l), this.element.appendChild(n), this._subscribeToState(), this.element;
2612
+ return l.dataset.testid = "apply-crop", o.appendChild(n), o.appendChild(l), this.element.appendChild(o), this._subscribeToState(), this.element;
2613
+ }
2614
+ _renderRotationSection() {
2615
+ const e = f("div", { className: "crop-section rotation-section" });
2616
+ e.appendChild(f("label", { className: "section-label" }, "Rotate"));
2617
+ const t = f("div", { className: "rotation-action-row" }), i = E({
2618
+ label: "Left 90°",
2619
+ className: "btn-secondary rotation-action-btn",
2620
+ icon: at,
2621
+ onClick: () => this._rotateBy(-90)
2622
+ });
2623
+ i.dataset.testid = "rotate-left-90";
2624
+ const r = E({
2625
+ label: "Right 90°",
2626
+ className: "btn-secondary rotation-action-btn",
2627
+ icon: ot,
2628
+ onClick: () => this._rotateBy(90)
2629
+ });
2630
+ r.dataset.testid = "rotate-right-90";
2631
+ const a = E({
2632
+ label: "Rotate 180°",
2633
+ className: "btn-secondary rotation-action-btn",
2634
+ onClick: () => this._rotateBy(180)
2635
+ });
2636
+ a.dataset.testid = "rotate-180";
2637
+ const o = E({
2638
+ label: "Rotate 270°",
2639
+ className: "btn-secondary rotation-action-btn",
2640
+ onClick: () => this._rotateBy(270)
2641
+ });
2642
+ o.dataset.testid = "rotate-270", t.appendChild(i), t.appendChild(r), t.appendChild(a), t.appendChild(o), e.appendChild(t);
2643
+ const n = f("div", { className: "chip-row rotation-preset-row" }), l = q(this.state.get("transform.rotation") ?? 0);
2644
+ kt.forEach((p) => {
2645
+ const b = ee({
2646
+ label: p.label,
2647
+ active: Math.round(l) === p.angle,
2648
+ onClick: () => this._setRotation(p.angle)
2649
+ });
2650
+ b.dataset.angle = p.id, b.dataset.testid = `rotation-preset-${p.id}`, this._rotationPresetChips.set(p.id, b), n.appendChild(b);
2651
+ }), e.appendChild(n);
2652
+ const c = f("div", { className: "rotation-arbitrary" }), d = f(
2653
+ "div",
2654
+ { className: "rotation-angle-header" },
2655
+ f("label", { className: "rotation-angle-label", for: "image-editor-rotation-angle" }, "Angle"),
2656
+ f("span", { className: "rotation-angle-value" }, this._formatAngle(l))
2657
+ );
2658
+ this._rotationValue = d.querySelector(".rotation-angle-value"), this._rotationRange = f("input", {
2659
+ id: "image-editor-rotation-angle",
2660
+ type: "range",
2661
+ className: "slider-input rotation-range",
2662
+ min: "0",
2663
+ max: "360",
2664
+ step: "1",
2665
+ value: String(Math.round(l)),
2666
+ "aria-label": "Rotation angle",
2667
+ onInput: (p) => this._previewAngleValue(p.target.value),
2668
+ onChange: (p) => this._setRotation(Number(p.target.value))
2669
+ }), this._rotationNumber = f("input", {
2670
+ type: "number",
2671
+ className: "text-input rotation-number-input",
2672
+ min: "-360",
2673
+ max: "360",
2674
+ step: "1",
2675
+ value: this._formatPlainAngle(l),
2676
+ "aria-label": "Rotation angle in degrees",
2677
+ onKeyDown: (p) => {
2678
+ p.key === "Enter" && (p.preventDefault(), this._setRotation(Number(p.target.value)), p.target.blur());
2679
+ },
2680
+ onBlur: (p) => this._setRotation(Number(p.target.value))
2681
+ });
2682
+ const h = f(
2683
+ "div",
2684
+ { className: "rotation-angle-row" },
2685
+ this._rotationRange,
2686
+ this._rotationNumber
2687
+ );
2688
+ c.appendChild(d), c.appendChild(h);
2689
+ const u = E({
2690
+ label: "Reset rotation",
2691
+ className: "btn-text rotation-reset-btn",
2692
+ onClick: () => this._setRotation(0)
2693
+ });
2694
+ return u.dataset.testid = "reset-rotation", c.appendChild(u), e.appendChild(c), e;
2525
2695
  }
2526
2696
  /**
2527
2697
  * Subscribe to state changes
2528
2698
  */
2529
2699
  _subscribeToState() {
2530
- const e = this.state.on("change:crop.shape", ({ value: i }) => {
2531
- this._shapeChips.forEach((r, a) => {
2532
- r.setActive(a === i);
2700
+ const e = this.state.on("change:crop.shape", ({ value: r }) => {
2701
+ this._shapeChips.forEach((a, o) => {
2702
+ a.setActive(o === r);
2533
2703
  }), this._updateAspectVisibility();
2534
2704
  });
2535
2705
  this._unsubscribers.push(e);
2536
- const t = this.state.on("change:crop.aspect", ({ value: i }) => {
2537
- this._aspectChips.forEach((r, a) => {
2538
- r.setActive(a === i);
2706
+ const t = this.state.on("change:crop.aspect", ({ value: r }) => {
2707
+ this._aspectChips.forEach((a, o) => {
2708
+ a.setActive(o === r);
2539
2709
  });
2540
2710
  });
2541
2711
  this._unsubscribers.push(t);
2712
+ const i = this.state.on("change:transform.rotation", ({ value: r }) => {
2713
+ this._syncRotationControls(r);
2714
+ });
2715
+ this._unsubscribers.push(i);
2716
+ }
2717
+ _rotateBy(e) {
2718
+ var i, r;
2719
+ ((r = (i = this.editor) == null ? void 0 : i.rotateBy) == null ? void 0 : r.call(i, e)) !== !1 && this._syncRotationControls(this.state.get("transform.rotation") ?? 0);
2720
+ }
2721
+ _setRotation(e) {
2722
+ var r, a;
2723
+ const t = q(e);
2724
+ if (((a = (r = this.editor) == null ? void 0 : r.setRotationAngle) == null ? void 0 : a.call(r, t)) === !1) {
2725
+ this._syncRotationControls(this.state.get("transform.rotation") ?? 0);
2726
+ return;
2727
+ }
2728
+ this._syncRotationControls(t);
2729
+ }
2730
+ _previewAngleValue(e) {
2731
+ const t = q(Number(e));
2732
+ this._rotationValue && (this._rotationValue.textContent = this._formatAngle(t)), this._rotationNumber && (this._rotationNumber.value = this._formatPlainAngle(t)), this._refreshPresetChips(t);
2733
+ }
2734
+ _syncRotationControls(e) {
2735
+ const t = q(e);
2736
+ this._rotationValue && (this._rotationValue.textContent = this._formatAngle(t)), this._rotationRange && (this._rotationRange.value = String(Math.round(t))), this._rotationNumber && (this._rotationNumber.value = this._formatPlainAngle(t)), this._refreshPresetChips(t);
2737
+ }
2738
+ _refreshPresetChips(e) {
2739
+ const t = Math.round(q(e)) % 360;
2740
+ this._rotationPresetChips.forEach((i, r) => {
2741
+ i.setActive(Number(r) === t);
2742
+ });
2743
+ }
2744
+ _formatAngle(e) {
2745
+ return `${this._formatPlainAngle(e)}°`;
2746
+ }
2747
+ _formatPlainAngle(e) {
2748
+ const t = q(e);
2749
+ return Number.isInteger(t) ? String(t) : t.toFixed(1);
2542
2750
  }
2543
2751
  /**
2544
2752
  * Select a crop shape
@@ -2578,10 +2786,10 @@ class wt {
2578
2786
  */
2579
2787
  destroy() {
2580
2788
  var e;
2581
- this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
2789
+ this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), this._rotationPresetChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
2582
2790
  }
2583
2791
  }
2584
- class St {
2792
+ class Ft {
2585
2793
  constructor(e, t) {
2586
2794
  this.state = e, this.filterManager = t, this.element = null, this._filterItems = /* @__PURE__ */ new Map(), this._unsubscribers = [], this._onRemove = null, this._onReset = null, this._onClearAll = null, this._onUpdateValue = null, this._onSelect = null;
2587
2795
  }
@@ -2591,18 +2799,18 @@ class St {
2591
2799
  * @returns {HTMLElement}
2592
2800
  */
2593
2801
  render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
2594
- this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = p("div", {
2802
+ this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = f("div", {
2595
2803
  className: "active-filters-panel",
2596
2804
  "data-testid": "active-filters-panel"
2597
2805
  });
2598
- const n = p("div", { className: "panel-header" });
2599
- n.appendChild(p("h3", { className: "panel-title" }, "Active Filters"));
2600
- const o = O({
2806
+ const o = f("div", { className: "panel-header" });
2807
+ o.appendChild(f("h3", { className: "panel-title" }, "Active Filters"));
2808
+ const n = E({
2601
2809
  label: "Clear All",
2602
2810
  className: "btn-text btn-danger",
2603
2811
  onClick: () => this._handleClearAll()
2604
2812
  });
2605
- return o.dataset.testid = "clear-all-filters", n.appendChild(o), this.element.appendChild(n), this._listContainer = p("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
2813
+ return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = f("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
2606
2814
  }
2607
2815
  /**
2608
2816
  * Subscribe to state changes
@@ -2638,7 +2846,7 @@ class St {
2638
2846
  const e = this.state.get("activeFilters");
2639
2847
  if (e.size === 0) {
2640
2848
  this._listContainer.appendChild(
2641
- p("div", { className: "no-filters-message" }, "No filters active")
2849
+ f("div", { className: "no-filters-message" }, "No filters active")
2642
2850
  );
2643
2851
  return;
2644
2852
  }
@@ -2656,26 +2864,26 @@ class St {
2656
2864
  * @returns {HTMLElement}
2657
2865
  */
2658
2866
  _createFilterItem(e, t) {
2659
- const r = this.state.get("selectedFilter") === e, a = p("div", {
2867
+ const r = this.state.get("selectedFilter") === e, a = f("div", {
2660
2868
  className: `active-filter-item ${r ? "selected" : ""}`,
2661
2869
  "data-active-filter": e,
2662
2870
  "data-testid": `active-filter-${e}`,
2663
- onClick: (f) => {
2664
- f.target.closest(".filter-item-actions") || this._handleSelect(e);
2871
+ onClick: (p) => {
2872
+ p.target.closest(".filter-item-actions") || this._handleSelect(e);
2665
2873
  }
2666
- }), n = p("div", { className: "filter-item-header" }), o = p("span", { className: "filter-item-name" }, t.name), l = p("div", { className: "filter-item-actions" }), c = z({
2667
- icon: Fe,
2874
+ }), o = f("div", { className: "filter-item-header" }), n = f("span", { className: "filter-item-name" }, t.name), l = f("div", { className: "filter-item-actions" }), c = N({
2875
+ icon: Ne,
2668
2876
  title: "Reset filter",
2669
2877
  className: "btn-icon-sm",
2670
2878
  onClick: () => this._handleReset(e)
2671
- }), d = z({
2672
- icon: rt,
2879
+ }), d = N({
2880
+ icon: nt,
2673
2881
  title: "Remove filter",
2674
2882
  className: "btn-icon-sm btn-danger",
2675
2883
  onClick: () => this._handleRemove(e)
2676
2884
  });
2677
- l.appendChild(c), l.appendChild(d), n.appendChild(o), n.appendChild(l), a.appendChild(n);
2678
- const h = this.state.getFilterValues(e), u = p("div", { className: "filter-item-summary" });
2885
+ l.appendChild(c), l.appendChild(d), o.appendChild(n), o.appendChild(l), a.appendChild(o);
2886
+ const h = this.state.getFilterValues(e), u = f("div", { className: "filter-item-summary" });
2679
2887
  return u.textContent = this._getValuesSummary(t, h), a.appendChild(u), a._summaryEl = u, a;
2680
2888
  }
2681
2889
  /**
@@ -2708,8 +2916,8 @@ class St {
2708
2916
  return e.controls.forEach((r) => {
2709
2917
  const a = this._normalizeControlType(r.type);
2710
2918
  if (a === "button") return;
2711
- const n = r.label || r.id, o = t[r.id] ?? r.default;
2712
- o !== r.default && (a === "slider" ? i.push(`${n}: ${this._formatValue(o)}`) : a === "toggle" ? o && i.push(n) : a === "color" ? i.push(`${n}: ${o}`) : a === "select" && i.push(`${n}: ${o}`));
2919
+ const o = r.label || r.id, n = t[r.id] ?? r.default;
2920
+ n !== r.default && (a === "slider" ? i.push(`${o}: ${this._formatValue(n)}`) : a === "toggle" ? n && i.push(o) : a === "color" ? i.push(`${o}: ${n}`) : a === "select" && i.push(`${o}: ${n}`));
2713
2921
  }), i.length > 0 ? i.join(", ") : "Default values";
2714
2922
  }
2715
2923
  /**
@@ -2782,7 +2990,7 @@ class St {
2782
2990
  this._unsubscribers.forEach((t) => t()), this._unsubscribers = [], this._filterItems.clear(), (e = this.element) == null || e.remove(), this.element = null;
2783
2991
  }
2784
2992
  }
2785
- const H = {
2993
+ const $ = {
2786
2994
  name: "free",
2787
2995
  initialMode: "filters",
2788
2996
  cropShape: "free",
@@ -2794,12 +3002,12 @@ const H = {
2794
3002
  showCropControls: !0,
2795
3003
  maxExportWidth: void 0,
2796
3004
  maxExportHeight: void 0
2797
- }, te = {
3005
+ }, se = {
2798
3006
  free: {
2799
- ...H
3007
+ ...$
2800
3008
  },
2801
3009
  avatar: {
2802
- ...H,
3010
+ ...$,
2803
3011
  name: "avatar",
2804
3012
  initialMode: "crop",
2805
3013
  cropShape: "circle",
@@ -2809,7 +3017,7 @@ const H = {
2809
3017
  lockAspectRatio: !0
2810
3018
  },
2811
3019
  banner: {
2812
- ...H,
3020
+ ...$,
2813
3021
  name: "banner",
2814
3022
  initialMode: "crop",
2815
3023
  cropShape: "square",
@@ -2819,7 +3027,7 @@ const H = {
2819
3027
  lockAspectRatio: !0
2820
3028
  },
2821
3029
  cover: {
2822
- ...H,
3030
+ ...$,
2823
3031
  name: "cover",
2824
3032
  initialMode: "crop",
2825
3033
  cropShape: "free",
@@ -2829,7 +3037,7 @@ const H = {
2829
3037
  lockAspectRatio: !0
2830
3038
  },
2831
3039
  product: {
2832
- ...H,
3040
+ ...$,
2833
3041
  name: "product",
2834
3042
  initialMode: "filters",
2835
3043
  cropShape: "square",
@@ -2839,26 +3047,35 @@ const H = {
2839
3047
  lockAspectRatio: !1
2840
3048
  }
2841
3049
  };
2842
- function vt(s) {
3050
+ function At(s) {
2843
3051
  if (!s)
2844
- return { ...te.free };
3052
+ return { ...se.free };
2845
3053
  if (typeof s == "object" && s !== null)
2846
- return { ...H, ...s };
2847
- const e = te[s];
2848
- return e ? { ...e } : { ...te.free };
3054
+ return { ...$, ...s };
3055
+ const e = se[s];
3056
+ return e ? { ...e } : { ...se.free };
3057
+ }
3058
+ function Z(s) {
3059
+ if (!Number.isFinite(Number(s))) return 0;
3060
+ const e = Number(s) % 360;
3061
+ return e < 0 ? e + 360 : e;
2849
3062
  }
2850
- class Si extends W {
3063
+ function Nt(s, e) {
3064
+ const t = Z(s);
3065
+ return (Z(e) - t + 540) % 360 - 180;
3066
+ }
3067
+ class Ai extends G {
2851
3068
  /**
2852
3069
  * Create a new VanillaImageEditor
2853
3070
  * @param {HTMLElement} container - Container element to mount the editor
2854
3071
  * @param {Object} options - Configuration options
2855
3072
  */
2856
3073
  constructor(e, t = {}) {
2857
- var a, n, o;
3074
+ var a, o, n;
2858
3075
  if (super(), !e)
2859
3076
  throw new Error("VanillaImageEditor: container element is required");
2860
3077
  this._container = e, this._destroyed = !1, this._loadVersion = 0, this._objectUrls = /* @__PURE__ */ new Set();
2861
- const i = t.preset ? vt(t.preset) : null, r = i ? {
3078
+ const i = t.preset ? At(t.preset) : null, r = i ? {
2862
3079
  initialMode: i.initialMode === "crop" ? "crop" : "adjust",
2863
3080
  cropShape: i.cropShape,
2864
3081
  initialAspectRatio: i.aspectRatio
@@ -2876,9 +3093,9 @@ class Si extends W {
2876
3093
  },
2877
3094
  ...r,
2878
3095
  ...t
2879
- }, this._preset = i, this._state = qe(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._preset && (this._state.set("lockCropShape", !!this._preset.lockCropShape), this._state.set("lockAspectRatio", !!this._preset.lockAspectRatio), this._state.set("showFilters", this._preset.showFilters !== !1), this._state.set("showCropControls", this._preset.showCropControls !== !1), this._state.set("autoZoomOnCropOverflow", !!this._preset.autoZoomOnCropOverflow)), this._renderer = new He(), this._filterManager = new ut(this._state, this._renderer), this._cropManager = new ae(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new pt({
2880
- endpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.endpoint,
2881
- fallbackEndpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.fallbackEndpoint
3096
+ }, this._preset = i, this._state = $e(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._preset && (this._state.set("lockCropShape", !!this._preset.lockCropShape), this._state.set("lockAspectRatio", !!this._preset.lockAspectRatio), this._state.set("showFilters", this._preset.showFilters !== !1), this._state.set("showCropControls", this._preset.showCropControls !== !1), this._state.set("autoZoomOnCropOverflow", !!this._preset.autoZoomOnCropOverflow)), this._renderer = new We(), this._filterManager = new gt(this._state, this._renderer), this._cropManager = new le(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new bt({
3097
+ endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
3098
+ fallbackEndpoint: (n = this._options.backgroundRemoval) == null ? void 0 : n.fallbackEndpoint
2882
3099
  })), this._loadingOverlay = null, this._isMobile = typeof window < "u" ? window.innerWidth <= 768 : !1, this._toolbar = null, this._categoryCarousel = null, this._filterCarousel = null, this._filterAdjustments = null, this._mobileFilterDrawer = null, this._mobileActiveFilters = null, this._cropControls = null, this._activeFiltersPanel = null, this._editorEl = null, this._canvasContainer = null, this._cropOverlay = null, this._controlsSection = null, this._filterControlsEl = null, this._fileInput = null, this._resizeObserver = null, this._init();
2883
3100
  }
2884
3101
  /**
@@ -2894,13 +3111,13 @@ class Si extends W {
2894
3111
  * Build DOM structure
2895
3112
  */
2896
3113
  _buildDOM() {
2897
- this._container.innerHTML = "", this._editorEl = p("div", {
3114
+ this._container.innerHTML = "", this._editorEl = f("div", {
2898
3115
  className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
2899
3116
  });
2900
- const e = p("div", { className: "editor-toolbar-container" });
3117
+ const e = f("div", { className: "editor-toolbar-container" });
2901
3118
  this._editorEl.appendChild(e), this._toolbarContainer = e;
2902
- const t = p("div", { className: "editor-content" }), i = p("div", { className: "canvas-section" });
2903
- this._canvasContainer = p("div", { className: "canvas-container" }), this._cropOverlay = p("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = p("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = p("input", {
3119
+ const t = f("div", { className: "editor-content" }), i = f("div", { className: "canvas-section" });
3120
+ this._canvasContainer = f("div", { className: "canvas-container" }), this._cropOverlay = f("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = f("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = f("input", {
2904
3121
  type: "file",
2905
3122
  accept: "image/*",
2906
3123
  className: "hidden-file-input",
@@ -2912,32 +3129,32 @@ class Si extends W {
2912
3129
  * Initialize UI components
2913
3130
  */
2914
3131
  _initUI() {
2915
- this._toolbar = new ft(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = p("div", { className: "filter-controls-container" }), this._categoryCarousel = new mt(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
3132
+ this._toolbar = new yt(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = f("div", { className: "filter-controls-container" }), this._categoryCarousel = new _t(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
2916
3133
  }));
2917
- const e = p("div", { className: "filter-layout" }), t = p("div", { className: "filter-left-column" });
2918
- this._filterCarousel = new gt(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
3134
+ const e = f("div", { className: "filter-layout" }), t = f("div", { className: "filter-left-column" });
3135
+ this._filterCarousel = new xt(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
2919
3136
  onToggle: (r, a) => this._handleFilterToggle(r, a),
2920
3137
  onSelect: (r) => {
2921
3138
  this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
2922
3139
  }
2923
- })), this._filterAdjustments = new bt(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
2924
- onChange: (r, a, n) => this._handleFilterChange(r, a, n),
3140
+ })), this._filterAdjustments = new Ct(this._state, this._filterManager), t.appendChild(this._filterAdjustments.render({
3141
+ onChange: (r, a, o) => this._handleFilterChange(r, a, o),
2925
3142
  onReset: (r) => this._handleFilterReset(r),
2926
3143
  onAction: (r, a) => this._handleFilterAction(r, a)
2927
3144
  })), e.appendChild(t);
2928
- const i = p("div", { className: "filter-right-column" });
2929
- this._activeFiltersPanel = new St(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
3145
+ const i = f("div", { className: "filter-right-column" });
3146
+ this._activeFiltersPanel = new Ft(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
2930
3147
  onRemove: (r) => this._handleFilterToggle(r, !1),
2931
3148
  onReset: (r) => this._handleFilterReset(r),
2932
3149
  onClearAll: () => this.resetAll(),
2933
3150
  onSelect: (r) => this._handleFilterSelect(r)
2934
- })), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new _t(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
3151
+ })), e.appendChild(i), this._filterControlsEl.appendChild(e), this._mobileActiveFilters = new St(this._state, this._filterManager), this._filterControlsEl.appendChild(this._mobileActiveFilters.render({
2935
3152
  onToggle: (r, a) => this._handleFilterToggle(r, a),
2936
3153
  onSelect: (r) => {
2937
3154
  this._handleFilterSelect(r), this._isMobile && this._mobileFilterDrawer && this._mobileFilterDrawer.open(r);
2938
3155
  }
2939
- })), this._cropControls = new wt(this._state, this._cropManager), this._cropControlsEl = this._cropControls.render(), this._cropControlsEl.style.display = "none", this._controlsSection.appendChild(this._filterControlsEl), this._controlsSection.appendChild(this._cropControlsEl), this._mobileFilterDrawer = new yt(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
2940
- onChange: (r, a, n) => this._handleFilterChange(r, a, n),
3156
+ })), this._cropControls = new Pt(this._state, this._cropManager, this), this._cropControlsEl = this._cropControls.render(), this._cropControlsEl.style.display = "none", this._controlsSection.appendChild(this._filterControlsEl), this._controlsSection.appendChild(this._cropControlsEl), this._mobileFilterDrawer = new wt(this._state, this._filterManager), this._mobileFilterDrawer.build(this._controlsSection, {
3157
+ onChange: (r, a, o) => this._handleFilterChange(r, a, o),
2941
3158
  onReset: (r) => this._handleFilterReset(r),
2942
3159
  onRemove: (r) => {
2943
3160
  this._handleFilterToggle(r, !1), this._state.set("selectedFilter", null);
@@ -3075,7 +3292,7 @@ class Si extends W {
3075
3292
  * Called at the start of loadImage() to prevent stale state bleed between sessions.
3076
3293
  */
3077
3294
  _resetEditorState() {
3078
- this._filterManager.resetAll(), this._state.set("crop.rect", null), this._state.set("crop.appliedRect", null), this._state.set("crop.appliedShape", null), this._state.set("crop.appliedAspect", null), this._state.set("crop.shape", this._options.cropShape || "free"), this._state.set("crop.aspect", this._options.initialAspectRatio || "free"), this._state.get("mode") === "crop" && (this._cropManager.disable(), this._state.set("mode", "filters"));
3295
+ this._filterManager.resetAll(), this._state.set("crop.rect", null), this._state.set("crop.appliedRect", null), this._state.set("crop.appliedShape", null), this._state.set("crop.appliedAspect", null), this._state.set("crop.dirty", !1), this._state.set("crop.shape", this._options.cropShape || "free"), this._state.set("crop.aspect", this._options.initialAspectRatio || "free"), this._state.set("transform.rotation", 0), this._state.get("mode") === "crop" && (this._cropManager.disable(), this._state.set("mode", "filters"));
3079
3296
  }
3080
3297
  /**
3081
3298
  * Hydrate editor state from a canonical ImageEditorSessionState object.
@@ -3083,27 +3300,28 @@ class Si extends W {
3083
3300
  * @param {Object} state - ImageEditorSessionState
3084
3301
  */
3085
3302
  _hydrateState(e) {
3086
- if (!(!e || e.version !== 1)) {
3087
- if (e.crop) {
3088
- const t = e.crop.shape || "free", i = e.crop.aspectRatio || "free";
3089
- e.crop.rect && (this._cropManager.applyFromPixelRect(e.crop.rect, t), this._state.set("crop.appliedRect", { ...e.crop.rect }), this._state.set("crop.appliedShape", t), this._state.set("crop.appliedAspect", i)), this._state.set("crop.shape", t), this._state.set("crop.aspect", i);
3090
- }
3091
- if (Array.isArray(e.filters)) {
3092
- let t = null;
3093
- for (const i of e.filters)
3094
- if (i.enabled && (t === null && (t = i.id), this._state.toggleFilter(i.id, !0), this._filterManager.initializeValues(i.id), i.values))
3095
- for (const [r, a] of Object.entries(i.values))
3096
- this._state.setFilterValue(i.id, r, a);
3097
- if (t !== null) {
3098
- this._state.set("selectedFilter", t);
3099
- const i = this._filterManager.getFilterDef(t);
3100
- if (typeof (i == null ? void 0 : i.category) == "string") {
3101
- const r = ht[i.category] ?? i.category;
3102
- this._state.set("selectedCategory", r);
3103
- }
3303
+ var i;
3304
+ if (!e || e.version !== 1) return;
3305
+ const t = Z(((i = e.transform) == null ? void 0 : i.rotation) ?? 0);
3306
+ if (t !== 0 && this._renderer.rotateBy(t) && this._state.set("transform.rotation", t), e.crop) {
3307
+ const r = e.crop.shape || "free", a = e.crop.aspectRatio || "free";
3308
+ e.crop.rect && (this._cropManager.applyFromPixelRect(e.crop.rect, r), this._state.set("crop.appliedRect", { ...e.crop.rect }), this._state.set("crop.appliedShape", r), this._state.set("crop.appliedAspect", a)), this._state.set("crop.shape", r), this._state.set("crop.aspect", a);
3309
+ }
3310
+ if (Array.isArray(e.filters)) {
3311
+ let r = null;
3312
+ for (const a of e.filters)
3313
+ if (a.enabled && (r === null && (r = a.id), this._state.toggleFilter(a.id, !0), this._filterManager.initializeValues(a.id), a.values))
3314
+ for (const [o, n] of Object.entries(a.values))
3315
+ this._state.setFilterValue(a.id, o, n);
3316
+ if (r !== null) {
3317
+ this._state.set("selectedFilter", r);
3318
+ const a = this._filterManager.getFilterDef(r);
3319
+ if (typeof (a == null ? void 0 : a.category) == "string") {
3320
+ const o = ft[a.category] ?? a.category;
3321
+ this._state.set("selectedCategory", o);
3104
3322
  }
3105
- this._filterManager.applyFilters();
3106
3323
  }
3324
+ this._filterManager.applyFilters();
3107
3325
  }
3108
3326
  }
3109
3327
  /**
@@ -3124,7 +3342,8 @@ class Si extends W {
3124
3342
  * @returns {string|null} Data URL
3125
3343
  */
3126
3344
  exportImage(e = "png", t = 0.92, i = {}) {
3127
- return this._state.get("crop.rect") && !this._cropManager.apply() ? null : this._renderer.exportImage(
3345
+ const r = this._state.get("crop.rect"), a = this._state.get("crop.dirty") !== !1 || this._state.get("mode") !== "crop";
3346
+ return r && a && !this._cropManager.apply() ? null : this._renderer.exportImage(
3128
3347
  e,
3129
3348
  t,
3130
3349
  i.maxEdge ?? 0,
@@ -3161,12 +3380,12 @@ class Si extends W {
3161
3380
  getSerializableState() {
3162
3381
  const e = this._state.get("activeFilters"), t = [];
3163
3382
  if (e)
3164
- for (const n of e) {
3165
- const o = this._state.getFilterValues(n);
3383
+ for (const o of e) {
3384
+ const n = this._state.getFilterValues(o);
3166
3385
  t.push({
3167
- id: n,
3386
+ id: o,
3168
3387
  enabled: !0,
3169
- values: { ...o }
3388
+ values: { ...n }
3170
3389
  });
3171
3390
  }
3172
3391
  const i = this._state.get("crop.appliedRect"), r = this._state.get("crop.rect"), a = i || r;
@@ -3177,6 +3396,9 @@ class Si extends W {
3177
3396
  aspectRatio: this._state.get("crop.appliedAspect") || this._state.get("crop.aspect") || "free",
3178
3397
  shape: this._state.get("crop.appliedShape") || this._state.get("crop.shape") || "free"
3179
3398
  },
3399
+ transform: {
3400
+ rotation: Z(this._state.get("transform.rotation") ?? 0)
3401
+ },
3180
3402
  filters: t
3181
3403
  };
3182
3404
  }
@@ -3205,6 +3427,23 @@ class Si extends W {
3205
3427
  resetAll() {
3206
3428
  this._filterManager.resetAll();
3207
3429
  }
3430
+ rotateBy(e) {
3431
+ const t = this._state.get("transform.rotation") ?? 0;
3432
+ return this.setRotationAngle(Number(t) + Number(e));
3433
+ }
3434
+ setRotationAngle(e) {
3435
+ if (!this._state.get("hasImage")) return !1;
3436
+ const t = Z(this._state.get("transform.rotation") ?? 0), i = Z(e), r = Nt(t, i), a = this._state.get("mode") === "crop";
3437
+ if (Math.abs(r) > 1e-3) {
3438
+ if (a && this._cropManager.disable(), !this._renderer.rotateBy(r))
3439
+ return a && this._cropManager.enable(), !1;
3440
+ this._filterManager.applyFilters(), this._state.set("crop.rect", null), this._state.set("crop.dirty", !1), a && this._cropManager.enable();
3441
+ }
3442
+ return this._state.set("transform.rotation", i), this.emit("transformChanged", { rotation: i }), !0;
3443
+ }
3444
+ resetRotation() {
3445
+ return this.setRotationAngle(0);
3446
+ }
3208
3447
  /**
3209
3448
  * Toggle theme
3210
3449
  */
@@ -3281,9 +3520,9 @@ class Si extends W {
3281
3520
  _showLoadingOverlay(e) {
3282
3521
  var i;
3283
3522
  if (!this._loadingOverlay)
3284
- this._loadingOverlay = p("div", { className: "editor-loading-overlay" }, [
3285
- p("div", { className: "editor-loading-spinner" }),
3286
- p("div", { className: "editor-loading-text" }, e)
3523
+ this._loadingOverlay = f("div", { className: "editor-loading-overlay" }, [
3524
+ f("div", { className: "editor-loading-spinner" }),
3525
+ f("div", { className: "editor-loading-text" }, e)
3287
3526
  ]);
3288
3527
  else {
3289
3528
  const r = this._loadingOverlay.querySelector(".editor-loading-text");
@@ -3303,36 +3542,36 @@ class Si extends W {
3303
3542
  * Destroy the editor and clean up
3304
3543
  */
3305
3544
  destroy() {
3306
- var e, t, i, r, a, n, o, l, c, d;
3545
+ var e, t, i, r, a, o, n, l, c, d;
3307
3546
  this._destroyed = !0;
3308
3547
  for (const h of this._objectUrls)
3309
3548
  try {
3310
3549
  URL.revokeObjectURL(h);
3311
3550
  } catch {
3312
3551
  }
3313
- this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (n = this._mobileFilterDrawer) == null || n.destroy(), (o = this._mobileActiveFilters) == null || o.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
3552
+ this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
3314
3553
  }
3315
3554
  }
3316
- const E = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
3317
- function Mt(s, e) {
3555
+ const I = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
3556
+ function zt(s, e) {
3318
3557
  return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
3319
3558
  }
3320
3559
  function m(s) {
3321
3560
  var e;
3322
- return E.has(s.id), E.set(s.id, s), j.has(s.category) || j.set(s.category, []), (e = j.get(s.category)) == null || e.push(s.id), s;
3561
+ return I.has(s.id), I.set(s.id, s), j.has(s.category) || j.set(s.category, []), (e = j.get(s.category)) == null || e.push(s.id), s;
3323
3562
  }
3324
- function Pt(s) {
3325
- return E.get(s);
3563
+ function Rt(s) {
3564
+ return I.get(s);
3326
3565
  }
3327
- function Q() {
3328
- return Array.from(E.values());
3566
+ function te() {
3567
+ return Array.from(I.values());
3329
3568
  }
3330
- function kt() {
3331
- Q().map((t) => t.id), Object.entries(b).filter(
3569
+ function Tt() {
3570
+ te().map((t) => t.id), Object.entries(y).filter(
3332
3571
  (t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
3333
3572
  ).forEach(([t, i]) => {
3334
3573
  const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
3335
- E.has(r) || m({
3574
+ I.has(r) || m({
3336
3575
  id: r,
3337
3576
  name: t.replace(/Filter$/, ""),
3338
3577
  category: "unlisted",
@@ -3351,20 +3590,20 @@ function kt() {
3351
3590
  });
3352
3591
  });
3353
3592
  }
3354
- function Ft(s) {
3355
- return (j.get(s) || []).map((t) => E.get(t)).filter(Boolean);
3593
+ function Et(s) {
3594
+ return (j.get(s) || []).map((t) => I.get(t)).filter(Boolean);
3356
3595
  }
3357
- function At() {
3596
+ function It() {
3358
3597
  return Array.from(j.keys());
3359
3598
  }
3360
- function vi(s) {
3361
- return E.has(s);
3599
+ function Ni(s) {
3600
+ return I.has(s);
3362
3601
  }
3363
- function zt(s) {
3364
- const e = E.get(s);
3602
+ function Bt(s) {
3603
+ const e = I.get(s);
3365
3604
  if (!e)
3366
3605
  return !1;
3367
- E.delete(s);
3606
+ I.delete(s);
3368
3607
  const t = j.get(e.category);
3369
3608
  if (t) {
3370
3609
  const i = t.indexOf(s);
@@ -3372,12 +3611,12 @@ function zt(s) {
3372
3611
  }
3373
3612
  return !0;
3374
3613
  }
3375
- function Mi(s, e) {
3376
- const t = E.get(s);
3377
- return t ? Mt(t, e) : !1;
3614
+ function zi(s, e) {
3615
+ const t = I.get(s);
3616
+ return t ? zt(t, e) : !1;
3378
3617
  }
3379
- function Nt() {
3380
- return Array.from(E.values()).map((s) => ({
3618
+ function Xt() {
3619
+ return Array.from(I.values()).map((s) => ({
3381
3620
  id: s.id,
3382
3621
  name: s.name,
3383
3622
  category: s.category,
@@ -3385,17 +3624,17 @@ function Nt() {
3385
3624
  }));
3386
3625
  }
3387
3626
  if (typeof window < "u") {
3388
- window.__DEBUG_FILTERS_LIST = Array.from(E.keys()), window.getAllFilters = Q, window.getFilter = Pt, window.getFiltersByCategory = Ft, window.getRegisteredFilters = Nt;
3627
+ window.__DEBUG_FILTERS_LIST = Array.from(I.keys()), window.getAllFilters = te, window.getFilter = Rt, window.getFiltersByCategory = Et, window.getRegisteredFilters = Xt;
3389
3628
  const s = m;
3390
3629
  window.registerFilter = (e) => {
3391
3630
  const t = s(e);
3392
- return window.__DEBUG_FILTERS_LIST = Array.from(E.keys()), t;
3631
+ return window.__DEBUG_FILTERS_LIST = Array.from(I.keys()), t;
3393
3632
  };
3394
3633
  }
3395
3634
  typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
3396
3635
  return [];
3397
3636
  });
3398
- const { AdjustmentFilter: Rt } = b, { ColorMatrixFilter: Tt } = R, X = {
3637
+ const { AdjustmentFilter: Ot } = y, { ColorMatrixFilter: Yt } = R, X = {
3399
3638
  gamma: 1,
3400
3639
  saturation: 1,
3401
3640
  contrast: 1,
@@ -3404,7 +3643,7 @@ const { AdjustmentFilter: Rt } = b, { ColorMatrixFilter: Tt } = R, X = {
3404
3643
  green: 1,
3405
3644
  blue: 1,
3406
3645
  alpha: 1
3407
- }, Et = /* @__PURE__ */ new Set([
3646
+ }, Dt = /* @__PURE__ */ new Set([
3408
3647
  "gamma",
3409
3648
  "saturation",
3410
3649
  "contrast",
@@ -3414,7 +3653,7 @@ const { AdjustmentFilter: Rt } = b, { ColorMatrixFilter: Tt } = R, X = {
3414
3653
  "blue",
3415
3654
  "alpha"
3416
3655
  ]);
3417
- function B(s, e) {
3656
+ function O(s, e) {
3418
3657
  if (typeof s == "number" && Number.isFinite(s))
3419
3658
  return s;
3420
3659
  if (typeof s == "string") {
@@ -3424,22 +3663,22 @@ function B(s, e) {
3424
3663
  }
3425
3664
  return e;
3426
3665
  }
3427
- function ue(s) {
3428
- return Et.has(s);
3666
+ function fe(s) {
3667
+ return Dt.has(s);
3429
3668
  }
3430
- function It(s) {
3669
+ function Lt(s) {
3431
3670
  return {
3432
- gamma: B(s.gamma, X.gamma),
3433
- saturation: B(s.saturation, X.saturation),
3434
- contrast: B(s.contrast, X.contrast),
3435
- brightness: B(s.brightness, X.brightness),
3436
- red: B(s.red, X.red),
3437
- green: B(s.green, X.green),
3438
- blue: B(s.blue, X.blue),
3439
- alpha: B(s.alpha, X.alpha)
3671
+ gamma: O(s.gamma, X.gamma),
3672
+ saturation: O(s.saturation, X.saturation),
3673
+ contrast: O(s.contrast, X.contrast),
3674
+ brightness: O(s.brightness, X.brightness),
3675
+ red: O(s.red, X.red),
3676
+ green: O(s.green, X.green),
3677
+ blue: O(s.blue, X.blue),
3678
+ alpha: O(s.alpha, X.alpha)
3440
3679
  };
3441
3680
  }
3442
- function pe(s, e) {
3681
+ function me(s, e) {
3443
3682
  s.reset(), s.brightness(e.brightness, !0), s.contrast(e.contrast, !0), s.saturate(e.saturation, !0);
3444
3683
  }
3445
3684
  m({
@@ -3450,28 +3689,28 @@ m({
3450
3689
  // Create an instance of the AdjustmentFilter with the provided parameters
3451
3690
  createFilter: (s) => {
3452
3691
  try {
3453
- const e = It(s ?? {}), t = { ...e };
3692
+ const e = Lt(s ?? {}), t = { ...e };
3454
3693
  try {
3455
- const i = new Rt(t), r = i;
3456
- return r._customParams = { ...e }, r.updateUIParam = function(n, o) {
3694
+ const i = new Ot(t), r = i;
3695
+ return r._customParams = { ...e }, r.updateUIParam = function(o, n) {
3457
3696
  try {
3458
- if (!ue(n))
3697
+ if (!fe(o))
3459
3698
  return;
3460
- const l = this._customParams ?? { ...X }, c = B(o, l[n]);
3461
- l[n] = c, this._customParams = l;
3699
+ const l = this._customParams ?? { ...X }, c = O(n, l[o]);
3700
+ l[o] = c, this._customParams = l;
3462
3701
  const d = this;
3463
- n in d && (d[n] = c);
3702
+ o in d && (d[o] = c);
3464
3703
  } catch {
3465
3704
  }
3466
3705
  }, i;
3467
3706
  } catch {
3468
- const r = new Tt(), a = r;
3469
- return a._customParams = { ...e }, pe(r, e), a.updateUIParam = function(o, l) {
3707
+ const r = new Yt(), a = r;
3708
+ return a._customParams = { ...e }, me(r, e), a.updateUIParam = function(n, l) {
3470
3709
  try {
3471
- if (!ue(o))
3710
+ if (!fe(n))
3472
3711
  return;
3473
- const c = this._customParams ?? { ...X }, d = B(l, c[o]);
3474
- c[o] = d, this._customParams = c, pe(this, c);
3712
+ const c = this._customParams ?? { ...X }, d = O(l, c[n]);
3713
+ c[n] = d, this._customParams = c, me(this, c);
3475
3714
  } catch {
3476
3715
  }
3477
3716
  }, r;
@@ -3575,14 +3814,14 @@ m({
3575
3814
  }
3576
3815
  ]
3577
3816
  });
3578
- const { ColorMatrixFilter: Xt } = R, V = {
3817
+ const { ColorMatrixFilter: Vt } = R, V = {
3579
3818
  brightness: 1,
3580
3819
  contrast: 1,
3581
3820
  saturation: 1,
3582
3821
  hue: 0,
3583
3822
  sepia: 0,
3584
3823
  negative: !1
3585
- }, Bt = /* @__PURE__ */ new Set([
3824
+ }, Ut = /* @__PURE__ */ new Set([
3586
3825
  "brightness",
3587
3826
  "contrast",
3588
3827
  "saturation",
@@ -3590,10 +3829,10 @@ const { ColorMatrixFilter: Xt } = R, V = {
3590
3829
  "sepia",
3591
3830
  "negative"
3592
3831
  ]);
3593
- function Yt(s) {
3594
- return Bt.has(s);
3832
+ function jt(s) {
3833
+ return Ut.has(s);
3595
3834
  }
3596
- function $(s, e) {
3835
+ function W(s, e) {
3597
3836
  if (typeof s == "number" && Number.isFinite(s))
3598
3837
  return s;
3599
3838
  if (typeof s == "string") {
@@ -3603,7 +3842,7 @@ function $(s, e) {
3603
3842
  }
3604
3843
  return e;
3605
3844
  }
3606
- function Ee(s, e) {
3845
+ function Be(s, e) {
3607
3846
  if (typeof s == "boolean")
3608
3847
  return s;
3609
3848
  if (typeof s == "string") {
@@ -3614,17 +3853,17 @@ function Ee(s, e) {
3614
3853
  }
3615
3854
  return e;
3616
3855
  }
3617
- function Ot(s) {
3856
+ function qt(s) {
3618
3857
  return {
3619
- brightness: $(s.brightness, V.brightness),
3620
- contrast: $(s.contrast, V.contrast),
3621
- saturation: $(s.saturation, V.saturation),
3622
- hue: $(s.hue, V.hue),
3623
- sepia: $(s.sepia, V.sepia),
3624
- negative: Ee(s.negative, V.negative)
3858
+ brightness: W(s.brightness, V.brightness),
3859
+ contrast: W(s.contrast, V.contrast),
3860
+ saturation: W(s.saturation, V.saturation),
3861
+ hue: W(s.hue, V.hue),
3862
+ sepia: W(s.sepia, V.sepia),
3863
+ negative: Be(s.negative, V.negative)
3625
3864
  };
3626
3865
  }
3627
- function fe(s, e) {
3866
+ function ge(s, e) {
3628
3867
  s.reset(), e.brightness !== 1 && s.brightness(e.brightness, !0), e.contrast !== 1 && s.contrast(e.contrast, !0), e.saturation !== 1 && s.saturate(e.saturation, !0), e.hue !== 0 && s.hue(e.hue, !0), e.sepia > 0 && s.sepia(!0), e.negative && s.negative(!0);
3629
3868
  }
3630
3869
  m({
@@ -3635,19 +3874,19 @@ m({
3635
3874
  // Create an instance of the ColorMatrixFilter with the provided parameters
3636
3875
  createFilter: (s) => {
3637
3876
  try {
3638
- const e = Ot(s ?? {}), t = new Xt(), i = t;
3639
- return i._customParams = { ...e }, fe(t, e), i.updateUIParam = function(a, n) {
3877
+ const e = qt(s ?? {}), t = new Vt(), i = t;
3878
+ return i._customParams = { ...e }, ge(t, e), i.updateUIParam = function(a, o) {
3640
3879
  try {
3641
- if (!Yt(a))
3880
+ if (!jt(a))
3642
3881
  return;
3643
- const o = this._customParams ?? { ...V };
3882
+ const n = this._customParams ?? { ...V };
3644
3883
  if (a === "negative")
3645
- o.negative = Ee(n, o.negative);
3884
+ n.negative = Be(o, n.negative);
3646
3885
  else {
3647
3886
  const l = a;
3648
- o[l] = $(n, o[l]);
3887
+ n[l] = W(o, n[l]);
3649
3888
  }
3650
- this._customParams = o, fe(this, o);
3889
+ this._customParams = n, ge(this, n);
3651
3890
  } catch {
3652
3891
  }
3653
3892
  }, t;
@@ -3725,16 +3964,16 @@ m({
3725
3964
  }
3726
3965
  ]
3727
3966
  });
3728
- const me = (s) => Math.max(0, Math.min(1, s));
3967
+ const be = (s) => Math.max(0, Math.min(1, s));
3729
3968
  m({
3730
3969
  id: "alpha",
3731
3970
  name: "Alpha",
3732
3971
  category: "adjust",
3733
3972
  description: "Adjust the opacity of the image",
3734
3973
  createFilter: (s) => {
3735
- const e = me(s.alpha !== void 0 ? Number(s.alpha) : 1), t = new R.AlphaFilter(e);
3974
+ const e = be(s.alpha !== void 0 ? Number(s.alpha) : 1), t = new R.AlphaFilter(e);
3736
3975
  return t.updateUIParam = function(i, r) {
3737
- i === "alpha" && (this.alpha = me(Number(r)));
3976
+ i === "alpha" && (this.alpha = be(Number(r)));
3738
3977
  }, t;
3739
3978
  },
3740
3979
  defaultParams: {
@@ -3816,10 +4055,10 @@ m({
3816
4055
  }
3817
4056
  ]
3818
4057
  });
3819
- function ge(s, e) {
4058
+ function ye(s, e) {
3820
4059
  typeof s.reset == "function" && s.reset(), e.brightness !== 1 && s.brightness(e.brightness, !1), e.contrast !== 1 && s.contrast(e.contrast, !1), e.saturation !== 1 && s.saturate(e.saturation, !1), e.hue !== 0 && s.hue(e.hue, !1), e.sepia && s.sepia(!1), e.negative && s.negative(!1);
3821
4060
  }
3822
- function be(s) {
4061
+ function _e(s) {
3823
4062
  return {
3824
4063
  brightness: Number(s.brightness ?? 1),
3825
4064
  contrast: Number(s.contrast ?? 1),
@@ -3837,24 +4076,24 @@ m({
3837
4076
  createFilter: (s) => {
3838
4077
  const e = R.ColorMatrixFilter;
3839
4078
  if (!e) return null;
3840
- const t = new e(), i = be(s);
3841
- return t._customParams = { ...i }, ge(t, i), t.updateUIParam = function(r, a) {
3842
- const n = this._customParams ?? be({});
4079
+ const t = new e(), i = _e(s);
4080
+ return t._customParams = { ...i }, ye(t, i), t.updateUIParam = function(r, a) {
4081
+ const o = this._customParams ?? _e({});
3843
4082
  switch (r) {
3844
4083
  case "brightness":
3845
4084
  case "contrast":
3846
4085
  case "saturation":
3847
4086
  case "hue":
3848
- n[r] = Number(a);
4087
+ o[r] = Number(a);
3849
4088
  break;
3850
4089
  case "sepia":
3851
4090
  case "negative":
3852
- n[r] = !!a;
4091
+ o[r] = !!a;
3853
4092
  break;
3854
4093
  default:
3855
4094
  return;
3856
4095
  }
3857
- this._customParams = n, ge(this, n);
4096
+ this._customParams = o, ye(this, o);
3858
4097
  }, t;
3859
4098
  },
3860
4099
  defaultParams: {
@@ -3924,7 +4163,7 @@ m({
3924
4163
  }
3925
4164
  ]
3926
4165
  });
3927
- const { ColorOverlayFilter: Lt } = b;
4166
+ const { ColorOverlayFilter: Ht } = y;
3928
4167
  m({
3929
4168
  id: "colorOverlay",
3930
4169
  name: "Color Overlay",
@@ -3939,7 +4178,7 @@ m({
3939
4178
  try {
3940
4179
  let e = 16711680;
3941
4180
  s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
3942
- const t = new Lt({
4181
+ const t = new Ht({
3943
4182
  color: e,
3944
4183
  alpha: s.alpha || 0.5
3945
4184
  });
@@ -3947,8 +4186,8 @@ m({
3947
4186
  const a = this._customParams || {};
3948
4187
  switch (this._customParams = a, a[i] = r, i) {
3949
4188
  case "color":
3950
- let n;
3951
- typeof r == "string" ? n = parseInt(r.replace("#", "0x"), 16) : n = Number(r), this.color = n, this.uniforms && (this.uniforms.uColor = n);
4189
+ let o;
4190
+ typeof r == "string" ? o = parseInt(r.replace("#", "0x"), 16) : o = Number(r), this.color = o, this.uniforms && (this.uniforms.uColor = o);
3952
4191
  break;
3953
4192
  case "alpha":
3954
4193
  this.alpha = Number(r), this.uniforms && (this.uniforms.uAlpha = Number(r));
@@ -4000,11 +4239,11 @@ m({
4000
4239
  */
4001
4240
  createFilter: (s) => {
4002
4241
  try {
4003
- const e = s.color ? s.color.replace("#", "0x") : "0x000000", t = s.distance !== void 0 ? s.distance : 5, i = s.angle !== void 0 ? s.angle : 90, r = s.blur !== void 0 ? s.blur : 2, a = s.quality !== void 0 ? s.quality : 3, n = {
4242
+ const e = s.color ? s.color.replace("#", "0x") : "0x000000", t = s.distance !== void 0 ? s.distance : 5, i = s.angle !== void 0 ? s.angle : 90, r = s.blur !== void 0 ? s.blur : 2, a = s.quality !== void 0 ? s.quality : 3, o = {
4004
4243
  x: t * Math.cos(i * Math.PI / 180),
4005
4244
  y: t * Math.sin(i * Math.PI / 180)
4006
- }, o = new b.DropShadowFilter({
4007
- offset: n,
4245
+ }, n = new y.DropShadowFilter({
4246
+ offset: o,
4008
4247
  color: parseInt(e, 16),
4009
4248
  alpha: s.alpha !== void 0 ? s.alpha : 0.5,
4010
4249
  blur: r,
@@ -4014,24 +4253,24 @@ m({
4014
4253
  x: s.pixelSizeX !== void 0 ? s.pixelSizeX : 1,
4015
4254
  y: s.pixelSizeY !== void 0 ? s.pixelSizeY : 1
4016
4255
  }
4017
- }), l = (h, u, f, _) => {
4018
- const g = h * u * 2, x = Math.sqrt(f * f + _ * _);
4256
+ }), l = (h, u, p, b) => {
4257
+ const g = h * u * 2, x = Math.sqrt(p * p + b * b);
4019
4258
  return Math.ceil(g + x + 2);
4020
4259
  };
4021
- o._exportPadding = l(r, a, n.x, n.y), o.padding = Math.max(o.padding ?? 0, o._exportPadding), o._customParams = {
4260
+ n._exportPadding = l(r, a, o.x, o.y), n.padding = Math.max(n.padding ?? 0, n._exportPadding), n._customParams = {
4022
4261
  ...s,
4023
4262
  // Also store the calculated offset for use in updateUIParam
4024
- _offset: n,
4263
+ _offset: o,
4025
4264
  _distance: t,
4026
4265
  _angle: i
4027
4266
  };
4028
4267
  const c = (h, u) => {
4029
- const f = Number(h._distance ?? h.distance ?? 5) * u, _ = Number(h._angle ?? h.angle ?? 90), g = Number(h.blur ?? 2) * u, x = Number(h.quality ?? 3), A = {
4030
- x: f * Math.cos(_ * Math.PI / 180),
4031
- y: f * Math.sin(_ * Math.PI / 180)
4032
- }, P = h.color ? String(h.color).replace("#", "0x") : "0x000000", T = new b.DropShadowFilter({
4033
- offset: A,
4034
- color: parseInt(P, 16),
4268
+ const p = Number(h._distance ?? h.distance ?? 5) * u, b = Number(h._angle ?? h.angle ?? 90), g = Number(h.blur ?? 2) * u, x = Number(h.quality ?? 3), P = {
4269
+ x: p * Math.cos(b * Math.PI / 180),
4270
+ y: p * Math.sin(b * Math.PI / 180)
4271
+ }, v = h.color ? String(h.color).replace("#", "0x") : "0x000000", T = new y.DropShadowFilter({
4272
+ offset: P,
4273
+ color: parseInt(v, 16),
4035
4274
  alpha: h.alpha !== void 0 ? Number(h.alpha) : 0.5,
4036
4275
  blur: g,
4037
4276
  quality: x,
@@ -4040,24 +4279,24 @@ m({
4040
4279
  x: h.pixelSizeX !== void 0 ? Number(h.pixelSizeX) : 1,
4041
4280
  y: h.pixelSizeY !== void 0 ? Number(h.pixelSizeY) : 1
4042
4281
  }
4043
- }), N = l(g, x, A.x, A.y);
4044
- return T._exportPadding = N, T.padding = Math.max(T.padding ?? 0, N), T;
4282
+ }), z = l(g, x, P.x, P.y);
4283
+ return T._exportPadding = z, T.padding = Math.max(T.padding ?? 0, z), T;
4045
4284
  };
4046
- o.createExportFilter = function(h = {}) {
4047
- const u = Number.isFinite(h.previewToNativeScale) ? Math.max(1, Number(h.previewToNativeScale)) : 1, f = this._customParams || s;
4048
- return c(f, u);
4049
- }, o.getExportPadding = function() {
4285
+ n.createExportFilter = function(h = {}) {
4286
+ const u = Number.isFinite(h.previewToNativeScale) ? Math.max(1, Number(h.previewToNativeScale)) : 1, p = this._customParams || s;
4287
+ return c(p, u);
4288
+ }, n.getExportPadding = function() {
4050
4289
  return Number(this._exportPadding || this.padding || 0);
4051
4290
  };
4052
4291
  const d = (h) => {
4053
4292
  var x;
4054
- const u = ((x = h._customParams) == null ? void 0 : x._offset) ?? { x: 0, y: 0 }, f = Number(h.blur ?? 0), _ = Number(h.quality ?? 1), g = l(f, _, u.x, u.y);
4293
+ const u = ((x = h._customParams) == null ? void 0 : x._offset) ?? { x: 0, y: 0 }, p = Number(h.blur ?? 0), b = Number(h.quality ?? 1), g = l(p, b, u.x, u.y);
4055
4294
  h._exportPadding = g, h.padding = Math.max(h.padding ?? 0, g);
4056
4295
  };
4057
- return o.updateUIParam = function(h, u) {
4296
+ return n.updateUIParam = function(h, u) {
4058
4297
  try {
4059
- const f = this._customParams || {};
4060
- switch (this._customParams = f, f[h] = u, h) {
4298
+ const p = this._customParams || {};
4299
+ switch (this._customParams = p, p[h] = u, h) {
4061
4300
  case "color":
4062
4301
  typeof u == "string" && (this.color = parseInt(u.replace("#", "0x"), 16));
4063
4302
  break;
@@ -4074,19 +4313,19 @@ m({
4074
4313
  this.shadowOnly = !!u;
4075
4314
  break;
4076
4315
  case "pixelSizeX":
4077
- this.pixelSizeX = Number(u), f.pixelSizeX = Number(u);
4316
+ this.pixelSizeX = Number(u), p.pixelSizeX = Number(u);
4078
4317
  break;
4079
4318
  case "pixelSizeY":
4080
- this.pixelSizeY = Number(u), f.pixelSizeY = Number(u);
4319
+ this.pixelSizeY = Number(u), p.pixelSizeY = Number(u);
4081
4320
  break;
4082
4321
  case "distance":
4083
4322
  case "angle": {
4084
- h === "distance" ? (f._distance = Number(u), f.distance = Number(u)) : (f._angle = Number(u), f.angle = Number(u));
4085
- const _ = {
4086
- x: f._distance * Math.cos(f._angle * Math.PI / 180),
4087
- y: f._distance * Math.sin(f._angle * Math.PI / 180)
4323
+ h === "distance" ? (p._distance = Number(u), p.distance = Number(u)) : (p._angle = Number(u), p.angle = Number(u));
4324
+ const b = {
4325
+ x: p._distance * Math.cos(p._angle * Math.PI / 180),
4326
+ y: p._distance * Math.sin(p._angle * Math.PI / 180)
4088
4327
  };
4089
- f._offset = _, this.offset = _, d(this);
4328
+ p._offset = b, this.offset = b, d(this);
4090
4329
  break;
4091
4330
  }
4092
4331
  default:
@@ -4097,7 +4336,7 @@ m({
4097
4336
  } catch {
4098
4337
  return this._customParams && (this._customParams[h] = u), !1;
4099
4338
  }
4100
- }, o;
4339
+ }, n;
4101
4340
  } catch {
4102
4341
  return null;
4103
4342
  }
@@ -4202,7 +4441,7 @@ m({
4202
4441
  }
4203
4442
  ]
4204
4443
  });
4205
- const { ColorMatrixFilter: Dt } = R;
4444
+ const { ColorMatrixFilter: $t } = R;
4206
4445
  m({
4207
4446
  id: "grayscale",
4208
4447
  name: "Grayscale",
@@ -4215,14 +4454,14 @@ m({
4215
4454
  */
4216
4455
  createFilter: (s) => {
4217
4456
  try {
4218
- const e = new Dt();
4457
+ const e = new $t();
4219
4458
  e._customParams = { ...s };
4220
4459
  const t = s.intensity !== void 0 ? s.intensity : 1;
4221
- return ye(e, t), e.updateUIParam = function(i, r) {
4460
+ return xe(e, t), e.updateUIParam = function(i, r) {
4222
4461
  const a = this._customParams || {};
4223
4462
  switch (this._customParams = a, a[i] = r, i) {
4224
4463
  case "intensity":
4225
- ye(this, r);
4464
+ xe(this, r);
4226
4465
  break;
4227
4466
  default:
4228
4467
  i in this && (this[i] = r);
@@ -4252,10 +4491,10 @@ m({
4252
4491
  }
4253
4492
  ]
4254
4493
  });
4255
- function ye(s, e) {
4494
+ function xe(s, e) {
4256
4495
  s.reset(), s.greyscale(e);
4257
4496
  }
4258
- const { HslAdjustmentFilter: Vt } = b;
4497
+ const { HslAdjustmentFilter: Wt } = y;
4259
4498
  m({
4260
4499
  id: "hsl-adjustment",
4261
4500
  name: "HSL Adjustment",
@@ -4267,7 +4506,7 @@ m({
4267
4506
  */
4268
4507
  createFilter: (s) => {
4269
4508
  try {
4270
- const e = new Vt({
4509
+ const e = new Wt({
4271
4510
  hue: s.hue !== void 0 ? s.hue : 0,
4272
4511
  saturation: s.saturation !== void 0 ? s.saturation : 0,
4273
4512
  lightness: s.lightness !== void 0 ? s.lightness : 0,
@@ -4365,7 +4604,7 @@ m({
4365
4604
  }
4366
4605
  ]
4367
4606
  });
4368
- const { KawaseBlurFilter: Ut } = b;
4607
+ const { KawaseBlurFilter: Zt } = y;
4369
4608
  m({
4370
4609
  id: "kawase-blur",
4371
4610
  name: "Kawase Blur",
@@ -4378,7 +4617,7 @@ m({
4378
4617
  */
4379
4618
  createFilter: (s) => {
4380
4619
  try {
4381
- const e = new Ut({
4620
+ const e = new Zt({
4382
4621
  strength: s.strength || 4,
4383
4622
  quality: s.quality || 3,
4384
4623
  clamp: s.clamp || !1,
@@ -4483,7 +4722,7 @@ m({
4483
4722
  }
4484
4723
  ]
4485
4724
  });
4486
- const { MotionBlurFilter: jt } = b;
4725
+ const { MotionBlurFilter: Gt } = y;
4487
4726
  m({
4488
4727
  id: "motion-blur",
4489
4728
  name: "Motion Blur",
@@ -4496,7 +4735,7 @@ m({
4496
4735
  */
4497
4736
  createFilter: (s) => {
4498
4737
  try {
4499
- const e = new jt({
4738
+ const e = new Gt({
4500
4739
  velocity: {
4501
4740
  x: s.velocityX !== void 0 ? s.velocityX : 0,
4502
4741
  y: s.velocityY !== void 0 ? s.velocityY : 0
@@ -4591,7 +4830,7 @@ m({
4591
4830
  }
4592
4831
  ]
4593
4832
  });
4594
- const { RadialBlurFilter: qt } = b;
4833
+ const { RadialBlurFilter: Kt } = y;
4595
4834
  m({
4596
4835
  id: "radial-blur",
4597
4836
  name: "Radial Blur",
@@ -4600,7 +4839,7 @@ m({
4600
4839
  // Create an instance of the RadialBlurFilter with the provided parameters
4601
4840
  createFilter: (s) => {
4602
4841
  try {
4603
- const e = new qt({
4842
+ const e = new Kt({
4604
4843
  angle: s.angle ?? 20,
4605
4844
  center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
4606
4845
  kernelSize: s.kernelSize ?? 15,
@@ -4715,7 +4954,7 @@ m({
4715
4954
  }
4716
4955
  ]
4717
4956
  });
4718
- const { TiltShiftFilter: Ht } = b;
4957
+ const { TiltShiftFilter: Qt } = y;
4719
4958
  m({
4720
4959
  id: "tilt-shift",
4721
4960
  name: "Tilt Shift",
@@ -4724,20 +4963,20 @@ m({
4724
4963
  // Create an instance of the TiltShiftFilter with the provided parameters
4725
4964
  createFilter: (s) => {
4726
4965
  try {
4727
- const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, n = typeof s.endY == "number" ? s.endY : 0.5, o = new Ht({
4966
+ const e = typeof s.blur == "number" ? s.blur : 100, t = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, i = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, o = typeof s.endY == "number" ? s.endY : 0.5, n = new Qt({
4728
4967
  blur: Number(e),
4729
4968
  gradientBlur: Number(t),
4730
4969
  start: { x: Number(i), y: Number(r) },
4731
- end: { x: Number(a), y: Number(n) }
4970
+ end: { x: Number(a), y: Number(o) }
4732
4971
  });
4733
- return o._customParams = {
4972
+ return n._customParams = {
4734
4973
  blur: e,
4735
4974
  gradientBlur: t,
4736
4975
  startX: i,
4737
4976
  startY: r,
4738
4977
  endX: a,
4739
- endY: n
4740
- }, o.updateUIParam = function(l, c) {
4978
+ endY: o
4979
+ }, n.updateUIParam = function(l, c) {
4741
4980
  try {
4742
4981
  const d = Number(c), h = this._customParams || {};
4743
4982
  switch (this._customParams = h, h[l] = d, l) {
@@ -4765,7 +5004,7 @@ m({
4765
5004
  }
4766
5005
  } catch {
4767
5006
  }
4768
- }, o;
5007
+ }, n;
4769
5008
  } catch {
4770
5009
  return null;
4771
5010
  }
@@ -4843,7 +5082,7 @@ m({
4843
5082
  }
4844
5083
  ]
4845
5084
  });
4846
- const { ZoomBlurFilter: $t } = b;
5085
+ const { ZoomBlurFilter: Jt } = y;
4847
5086
  m({
4848
5087
  id: "zoom-blur",
4849
5088
  name: "Zoom Blur",
@@ -4856,7 +5095,7 @@ m({
4856
5095
  */
4857
5096
  createFilter: (s) => {
4858
5097
  try {
4859
- const e = new $t({
5098
+ const e = new Jt({
4860
5099
  strength: s.strength || 0.1,
4861
5100
  center: {
4862
5101
  x: s.centerX !== void 0 ? s.centerX : 0.5,
@@ -4970,24 +5209,24 @@ m({
4970
5209
  }
4971
5210
  ]
4972
5211
  });
4973
- const { ColorGradientFilter: _e } = b;
4974
- function Ie(s) {
5212
+ const { ColorGradientFilter: Ce } = y;
5213
+ function Xe(s) {
4975
5214
  return parseInt(s.replace("#", "0x"), 16);
4976
5215
  }
4977
- function Wt(s) {
5216
+ function ei(s) {
4978
5217
  return "#" + s.toString(16).padStart(6, "0");
4979
5218
  }
4980
- function xe(s) {
5219
+ function we(s) {
4981
5220
  return {
4982
5221
  offset: Number(s.offset),
4983
- color: typeof s.color == "string" ? Ie(s.color) : Number(s.color),
5222
+ color: typeof s.color == "string" ? Xe(s.color) : Number(s.color),
4984
5223
  alpha: Number(s.alpha)
4985
5224
  };
4986
5225
  }
4987
- function Ce(s) {
5226
+ function Se(s) {
4988
5227
  return {
4989
5228
  offset: s.offset,
4990
- color: typeof s.color == "number" ? Wt(s.color) : s.color,
5229
+ color: typeof s.color == "number" ? ei(s.color) : s.color,
4991
5230
  alpha: s.alpha
4992
5231
  };
4993
5232
  }
@@ -5000,12 +5239,12 @@ m({
5000
5239
  let t = (s.colorStops || [
5001
5240
  { offset: 0, color: "#ff0000", alpha: 1 },
5002
5241
  { offset: 1, color: "#0000ff", alpha: 1 }
5003
- ]).map(xe);
5242
+ ]).map(we);
5004
5243
  t.length < 2 && (t = [
5005
5244
  { offset: 0, color: 16711680, alpha: 1 },
5006
5245
  { offset: 1, color: 255, alpha: 1 }
5007
5246
  ]), t.sort((r, a) => r.offset - a.offset);
5008
- const i = new _e({
5247
+ const i = new Ce({
5009
5248
  type: s.gradientType,
5010
5249
  stops: t,
5011
5250
  angle: s.angle,
@@ -5017,7 +5256,7 @@ m({
5017
5256
  cssGradient: s.cssGradient || ""
5018
5257
  }, i.getSerializableParams = function() {
5019
5258
  var a;
5020
- const r = Array.isArray(this.stops) ? this.stops.map(Ce) : [];
5259
+ const r = Array.isArray(this.stops) ? this.stops.map(Se) : [];
5021
5260
  return {
5022
5261
  gradientType: this.type,
5023
5262
  colorStops: r,
@@ -5028,41 +5267,41 @@ m({
5028
5267
  cssGradient: ((a = this._customParams) == null ? void 0 : a.cssGradient) ?? ""
5029
5268
  };
5030
5269
  }, i.getColorStopsForUI = function() {
5031
- return Array.isArray(this.stops) ? this.stops.map(Ce) : [];
5270
+ return Array.isArray(this.stops) ? this.stops.map(Se) : [];
5032
5271
  }, i.getDynamicControls = function() {
5033
5272
  const r = this.getColorStopsForUI(), a = [];
5034
- return r.forEach((n, o) => {
5273
+ return r.forEach((o, n) => {
5035
5274
  a.push({
5036
- id: `colorStop-${o}-color`,
5275
+ id: `colorStop-${n}-color`,
5037
5276
  type: "color",
5038
- label: `Stop ${o + 1} Color`,
5039
- property: `colorStops[${o}].color`,
5040
- default: n.color
5277
+ label: `Stop ${n + 1} Color`,
5278
+ property: `colorStops[${n}].color`,
5279
+ default: o.color
5041
5280
  }), a.push({
5042
- id: `colorStop-${o}-offset`,
5281
+ id: `colorStop-${n}-offset`,
5043
5282
  type: "slider",
5044
- label: `Stop ${o + 1} Position`,
5045
- property: `colorStops[${o}].offset`,
5283
+ label: `Stop ${n + 1} Position`,
5284
+ property: `colorStops[${n}].offset`,
5046
5285
  min: 0,
5047
5286
  max: 1,
5048
5287
  step: 0.01,
5049
- default: n.offset
5288
+ default: o.offset
5050
5289
  }), a.push({
5051
- id: `colorStop-${o}-alpha`,
5290
+ id: `colorStop-${n}-alpha`,
5052
5291
  type: "slider",
5053
- label: `Stop ${o + 1} Alpha`,
5054
- property: `colorStops[${o}].alpha`,
5292
+ label: `Stop ${n + 1} Alpha`,
5293
+ property: `colorStops[${n}].alpha`,
5055
5294
  min: 0,
5056
5295
  max: 1,
5057
5296
  step: 0.01,
5058
- default: n.alpha
5297
+ default: o.alpha
5059
5298
  });
5060
5299
  }), a;
5061
5300
  }, i.handleButtonAction = function(r) {
5062
5301
  (r === "addColorStop" || r === "removeColorStop") && this.updateUIParam(r, !0);
5063
5302
  }, i.updateUIParam = function(r, a) {
5064
- const n = this._customParams ?? {};
5065
- switch (this._customParams = n, r) {
5303
+ const o = this._customParams ?? {};
5304
+ switch (this._customParams = o, r) {
5066
5305
  case "gradientType":
5067
5306
  this.type = Number(a);
5068
5307
  return;
@@ -5075,23 +5314,23 @@ m({
5075
5314
  this.replace = !!a;
5076
5315
  return;
5077
5316
  case "addColorStop": {
5078
- const o = Array.isArray(this.stops) ? [...this.stops] : [], l = Math.floor(Math.random() * 255) << 16 | Math.floor(Math.random() * 255) << 8 | Math.floor(Math.random() * 255);
5079
- if (o.length > 0)
5080
- for (const d of o)
5317
+ const n = Array.isArray(this.stops) ? [...this.stops] : [], l = Math.floor(Math.random() * 255) << 16 | Math.floor(Math.random() * 255) << 8 | Math.floor(Math.random() * 255);
5318
+ if (n.length > 0)
5319
+ for (const d of n)
5081
5320
  d.offset *= 0.8;
5082
- o.push({ offset: 1, color: l, alpha: 1 }), o.sort((c, d) => c.offset - d.offset), this.stops = o;
5321
+ n.push({ offset: 1, color: l, alpha: 1 }), n.sort((c, d) => c.offset - d.offset), this.stops = n;
5083
5322
  return;
5084
5323
  }
5085
5324
  case "removeColorStop": {
5086
- const o = Array.isArray(this.stops) ? [...this.stops] : [];
5087
- o.length > 2 && (o.pop(), this.stops = o);
5325
+ const n = Array.isArray(this.stops) ? [...this.stops] : [];
5326
+ n.length > 2 && (n.pop(), this.stops = n);
5088
5327
  return;
5089
5328
  }
5090
5329
  case "cssGradient": {
5091
- const o = typeof a == "string" ? a.trim() : "";
5092
- if (n.cssGradient = o, !o) return;
5330
+ const n = typeof a == "string" ? a.trim() : "";
5331
+ if (o.cssGradient = n, !n) return;
5093
5332
  try {
5094
- const l = new _e({ css: o });
5333
+ const l = new Ce({ css: n });
5095
5334
  this.type = l.type, this.angle = l.angle, this.stops = [...l.stops];
5096
5335
  } catch {
5097
5336
  }
@@ -5099,16 +5338,16 @@ m({
5099
5338
  }
5100
5339
  case "colorStops": {
5101
5340
  if (!Array.isArray(a)) return;
5102
- const o = a.map(xe);
5103
- o.sort((l, c) => l.offset - c.offset), this.stops = o;
5341
+ const n = a.map(we);
5342
+ n.sort((l, c) => l.offset - c.offset), this.stops = n;
5104
5343
  return;
5105
5344
  }
5106
5345
  default: {
5107
- const o = /^colorStops\[(\d+)\]\.(offset|color|alpha)$/.exec(r);
5108
- if (o) {
5109
- const [, l, c] = o, d = Number(l), h = Array.isArray(this.stops) ? [...this.stops] : [];
5346
+ const n = /^colorStops\[(\d+)\]\.(offset|color|alpha)$/.exec(r);
5347
+ if (n) {
5348
+ const [, l, c] = n, d = Number(l), h = Array.isArray(this.stops) ? [...this.stops] : [];
5110
5349
  if (d < 0 || d >= h.length) return;
5111
- c === "color" ? h[d].color = typeof a == "string" ? Ie(a) : Number(a) : (c === "offset" || c === "alpha") && (h[d][c] = Number(a)), this.stops = h;
5350
+ c === "color" ? h[d].color = typeof a == "string" ? Xe(a) : Number(a) : (c === "offset" || c === "alpha") && (h[d][c] = Number(a)), this.stops = h;
5112
5351
  }
5113
5352
  }
5114
5353
  }
@@ -5206,7 +5445,7 @@ m({
5206
5445
  // Create an instance of the ColorMapFilter with the provided parameters
5207
5446
  createFilter: (s) => {
5208
5447
  try {
5209
- const e = b.ColorMapFilter;
5448
+ const e = y.ColorMapFilter;
5210
5449
  if (!e)
5211
5450
  return null;
5212
5451
  let t = null;
@@ -5217,8 +5456,8 @@ m({
5217
5456
  mix: s.mix
5218
5457
  });
5219
5458
  return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
5220
- const n = this._customParams || {};
5221
- switch (this._customParams = n, n[r] = a, r) {
5459
+ const o = this._customParams || {};
5460
+ switch (this._customParams = o, o[r] = a, r) {
5222
5461
  case "texturePath":
5223
5462
  a && (this.colorMap = R.Texture.from(a));
5224
5463
  break;
@@ -5281,7 +5520,7 @@ m({
5281
5520
  }
5282
5521
  ]
5283
5522
  });
5284
- const Zt = b.ColorReplaceFilter;
5523
+ const ti = y.ColorReplaceFilter;
5285
5524
  m({
5286
5525
  id: "color-replace",
5287
5526
  name: "Color Replace",
@@ -5298,14 +5537,14 @@ m({
5298
5537
  s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
5299
5538
  let t = 255;
5300
5539
  s.targetColor && (typeof s.targetColor == "string" ? t = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (t = s.targetColor));
5301
- const i = new Zt({
5540
+ const i = new ti({
5302
5541
  originalColor: e,
5303
5542
  targetColor: t,
5304
5543
  tolerance: s.tolerance || 0.4
5305
5544
  });
5306
5545
  return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
5307
- const n = this._customParams || {};
5308
- switch (this._customParams = n, n[r] = a, r) {
5546
+ const o = this._customParams || {};
5547
+ switch (this._customParams = o, o[r] = a, r) {
5309
5548
  case "originalColor":
5310
5549
  typeof a == "string" ? this.originalColor = parseInt(a.replace("#", "0x"), 16) : typeof a == "number" && (this.originalColor = a);
5311
5550
  break;
@@ -5362,7 +5601,7 @@ m({
5362
5601
  }
5363
5602
  ]
5364
5603
  });
5365
- const Gt = b.MultiColorReplaceFilter;
5604
+ const ii = y.MultiColorReplaceFilter;
5366
5605
  m({
5367
5606
  id: "multi-color-replace",
5368
5607
  name: "Multi-Color Replace",
@@ -5388,7 +5627,7 @@ m({
5388
5627
  const i = typeof s.originalColor3 == "string" ? parseInt(s.originalColor3.replace("#", "0x"), 16) : s.originalColor3, r = typeof s.targetColor3 == "string" ? parseInt(s.targetColor3.replace("#", "0x"), 16) : s.targetColor3;
5389
5628
  e.push([i, r]);
5390
5629
  }
5391
- const t = new Gt(
5630
+ const t = new ii(
5392
5631
  e,
5393
5632
  s.tolerance || 0.05,
5394
5633
  3
@@ -5397,20 +5636,20 @@ m({
5397
5636
  return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
5398
5637
  const a = this._customParams || {};
5399
5638
  if (this._customParams = a, a[i] = r, i === "originalColor1" || i === "targetColor1" || i === "originalColor2" || i === "targetColor2" || i === "originalColor3" || i === "targetColor3" || i === "enableThirdPair") {
5400
- const n = [];
5639
+ const o = [];
5401
5640
  if (a.originalColor1 && a.targetColor1) {
5402
- const o = typeof a.originalColor1 == "string" ? parseInt(a.originalColor1.replace("#", "0x"), 16) : a.originalColor1, l = typeof a.targetColor1 == "string" ? parseInt(a.targetColor1.replace("#", "0x"), 16) : a.targetColor1;
5403
- n.push([o, l]);
5641
+ const n = typeof a.originalColor1 == "string" ? parseInt(a.originalColor1.replace("#", "0x"), 16) : a.originalColor1, l = typeof a.targetColor1 == "string" ? parseInt(a.targetColor1.replace("#", "0x"), 16) : a.targetColor1;
5642
+ o.push([n, l]);
5404
5643
  }
5405
5644
  if (a.originalColor2 && a.targetColor2) {
5406
- const o = typeof a.originalColor2 == "string" ? parseInt(a.originalColor2.replace("#", "0x"), 16) : a.originalColor2, l = typeof a.targetColor2 == "string" ? parseInt(a.targetColor2.replace("#", "0x"), 16) : a.targetColor2;
5407
- n.push([o, l]);
5645
+ const n = typeof a.originalColor2 == "string" ? parseInt(a.originalColor2.replace("#", "0x"), 16) : a.originalColor2, l = typeof a.targetColor2 == "string" ? parseInt(a.targetColor2.replace("#", "0x"), 16) : a.targetColor2;
5646
+ o.push([n, l]);
5408
5647
  }
5409
5648
  if (a.enableThirdPair && a.originalColor3 && a.targetColor3) {
5410
- const o = typeof a.originalColor3 == "string" ? parseInt(a.originalColor3.replace("#", "0x"), 16) : a.originalColor3, l = typeof a.targetColor3 == "string" ? parseInt(a.targetColor3.replace("#", "0x"), 16) : a.targetColor3;
5411
- n.push([o, l]);
5649
+ const n = typeof a.originalColor3 == "string" ? parseInt(a.originalColor3.replace("#", "0x"), 16) : a.originalColor3, l = typeof a.targetColor3 == "string" ? parseInt(a.targetColor3.replace("#", "0x"), 16) : a.targetColor3;
5650
+ o.push([n, l]);
5412
5651
  }
5413
- this.replacements = n, this.refresh();
5652
+ this.replacements = o, this.refresh();
5414
5653
  } else i === "tolerance" ? this.tolerance = r : i in this && (this[i] = r);
5415
5654
  return !0;
5416
5655
  }, t;
@@ -5499,7 +5738,7 @@ m({
5499
5738
  }
5500
5739
  ]
5501
5740
  });
5502
- const { RGBSplitFilter: Kt } = b;
5741
+ const { RGBSplitFilter: ri } = y;
5503
5742
  m({
5504
5743
  id: "rgb-split",
5505
5744
  name: "RGB Split",
@@ -5520,40 +5759,40 @@ m({
5520
5759
  }, i = {
5521
5760
  x: s.blueX !== void 0 ? s.blueX : 0,
5522
5761
  y: s.blueY !== void 0 ? s.blueY : 0
5523
- }, r = new Kt({
5762
+ }, r = new ri({
5524
5763
  red: e,
5525
5764
  green: t,
5526
5765
  blue: i
5527
5766
  });
5528
- return r._customParams = { ...s }, r.updateUIParam = function(a, n) {
5767
+ return r._customParams = { ...s }, r.updateUIParam = function(a, o) {
5529
5768
  try {
5530
- const o = this._customParams || {};
5531
- switch (this._customParams = o, o[a] = n, a) {
5769
+ const n = this._customParams || {};
5770
+ switch (this._customParams = n, n[a] = o, a) {
5532
5771
  case "redX":
5533
- this.redX = Number(n);
5772
+ this.redX = Number(o);
5534
5773
  break;
5535
5774
  case "redY":
5536
- this.redY = Number(n);
5775
+ this.redY = Number(o);
5537
5776
  break;
5538
5777
  case "greenX":
5539
- this.greenX = Number(n);
5778
+ this.greenX = Number(o);
5540
5779
  break;
5541
5780
  case "greenY":
5542
- this.greenY = Number(n);
5781
+ this.greenY = Number(o);
5543
5782
  break;
5544
5783
  case "blueX":
5545
- this.blueX = Number(n);
5784
+ this.blueX = Number(o);
5546
5785
  break;
5547
5786
  case "blueY":
5548
- this.blueY = Number(n);
5787
+ this.blueY = Number(o);
5549
5788
  break;
5550
5789
  default:
5551
- a in this && (this[a] = n);
5790
+ a in this && (this[a] = o);
5552
5791
  break;
5553
5792
  }
5554
5793
  return !0;
5555
5794
  } catch {
5556
- return this._customParams && (this._customParams[a] = n), !1;
5795
+ return this._customParams && (this._customParams[a] = o), !1;
5557
5796
  }
5558
5797
  }, r;
5559
5798
  } catch {
@@ -5633,7 +5872,7 @@ m({
5633
5872
  }
5634
5873
  ]
5635
5874
  });
5636
- const { AdvancedBloomFilter: Qt } = b;
5875
+ const { AdvancedBloomFilter: si } = y;
5637
5876
  m({
5638
5877
  id: "advanced-bloom",
5639
5878
  name: "Advanced Bloom",
@@ -5642,7 +5881,7 @@ m({
5642
5881
  // Create an instance of the AdvancedBloomFilter with the provided parameters
5643
5882
  createFilter: (s) => {
5644
5883
  try {
5645
- const e = new Qt({
5884
+ const e = new si({
5646
5885
  threshold: s.threshold || 0.5,
5647
5886
  bloomScale: s.bloomScale || 1,
5648
5887
  brightness: s.brightness || 1,
@@ -5789,7 +6028,7 @@ m({
5789
6028
  }
5790
6029
  ]
5791
6030
  });
5792
- const Jt = b.AsciiFilter;
6031
+ const ai = y.AsciiFilter;
5793
6032
  m({
5794
6033
  id: "ascii",
5795
6034
  name: "ASCII",
@@ -5801,7 +6040,7 @@ m({
5801
6040
  const e = typeof s.size == "number" ? s.size : 8;
5802
6041
  let t = s.color;
5803
6042
  typeof t == "string" && t.startsWith("#") && (t = parseInt(t.replace("#", "0x"), 16));
5804
- const i = s.replaceColor === !0, r = new Jt({
6043
+ const i = s.replaceColor === !0, r = new ai({
5805
6044
  size: e,
5806
6045
  color: t,
5807
6046
  replaceColor: i
@@ -5810,21 +6049,21 @@ m({
5810
6049
  size: e,
5811
6050
  color: t,
5812
6051
  replaceColor: i
5813
- }, r.updateUIParam = function(a, n) {
6052
+ }, r.updateUIParam = function(a, o) {
5814
6053
  try {
5815
- const o = this._customParams || {};
5816
- switch (this._customParams = o, o[a] = n, a) {
6054
+ const n = this._customParams || {};
6055
+ switch (this._customParams = n, n[a] = o, a) {
5817
6056
  case "size":
5818
- this.size = Number(n);
6057
+ this.size = Number(o);
5819
6058
  break;
5820
6059
  case "color":
5821
- typeof n == "string" && n.startsWith("#") ? (o.color = n, this.color = parseInt(n.replace("#", "0x"), 16)) : this.color = n;
6060
+ typeof o == "string" && o.startsWith("#") ? (n.color = o, this.color = parseInt(o.replace("#", "0x"), 16)) : this.color = o;
5822
6061
  break;
5823
6062
  case "replaceColor":
5824
- this.replaceColor = !!n;
6063
+ this.replaceColor = !!o;
5825
6064
  break;
5826
6065
  default:
5827
- a in this && (this[a] = n);
6066
+ a in this && (this[a] = o);
5828
6067
  break;
5829
6068
  }
5830
6069
  } catch {
@@ -5868,7 +6107,7 @@ m({
5868
6107
  }
5869
6108
  ]
5870
6109
  });
5871
- const ei = b.BackdropBlurFilter;
6110
+ const oi = y.BackdropBlurFilter;
5872
6111
  m({
5873
6112
  id: "backdrop-blur",
5874
6113
  name: "Backdrop Blur",
@@ -5877,7 +6116,7 @@ m({
5877
6116
  // Create an instance of the BackdropBlurFilter with the provided parameters
5878
6117
  createFilter: (s) => {
5879
6118
  try {
5880
- const e = new ei({
6119
+ const e = new oi({
5881
6120
  // Higher strength values (20-50) make the effect more noticeable
5882
6121
  strength: s.strength || 20,
5883
6122
  quality: s.quality || 4,
@@ -5975,7 +6214,7 @@ m({
5975
6214
  }
5976
6215
  ]
5977
6216
  });
5978
- const { BevelFilter: ti } = b;
6217
+ const { BevelFilter: ni } = y;
5979
6218
  m({
5980
6219
  id: "bevel",
5981
6220
  name: "Bevel",
@@ -5987,7 +6226,7 @@ m({
5987
6226
  */
5988
6227
  createFilter: (s) => {
5989
6228
  try {
5990
- const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new ti({
6229
+ const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", t = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", i = new ni({
5991
6230
  rotation: s.rotation !== void 0 ? s.rotation : 45,
5992
6231
  thickness: s.thickness !== void 0 ? s.thickness : 2,
5993
6232
  lightColor: parseInt(e, 16),
@@ -5997,8 +6236,8 @@ m({
5997
6236
  });
5998
6237
  return i._customParams = { ...s }, i.updateUIParam = function(r, a) {
5999
6238
  try {
6000
- const n = this._customParams || {};
6001
- switch (this._customParams = n, n[r] = a, r) {
6239
+ const o = this._customParams || {};
6240
+ switch (this._customParams = o, o[r] = a, r) {
6002
6241
  case "rotation":
6003
6242
  this.rotation = Number(a);
6004
6243
  break;
@@ -6007,8 +6246,8 @@ m({
6007
6246
  break;
6008
6247
  case "lightColor":
6009
6248
  if (typeof a == "string") {
6010
- const o = parseInt(a.replace("#", "0x"), 16);
6011
- this.lightColor = o;
6249
+ const n = parseInt(a.replace("#", "0x"), 16);
6250
+ this.lightColor = n;
6012
6251
  }
6013
6252
  break;
6014
6253
  case "lightAlpha":
@@ -6016,8 +6255,8 @@ m({
6016
6255
  break;
6017
6256
  case "shadowColor":
6018
6257
  if (typeof a == "string") {
6019
- const o = parseInt(a.replace("#", "0x"), 16);
6020
- this.shadowColor = o;
6258
+ const n = parseInt(a.replace("#", "0x"), 16);
6259
+ this.shadowColor = n;
6021
6260
  }
6022
6261
  break;
6023
6262
  case "shadowAlpha":
@@ -6103,7 +6342,7 @@ m({
6103
6342
  }
6104
6343
  ]
6105
6344
  });
6106
- const { BloomFilter: ii } = b;
6345
+ const { BloomFilter: li } = y;
6107
6346
  m({
6108
6347
  id: "bloom",
6109
6348
  name: "Bloom/Glow",
@@ -6112,7 +6351,7 @@ m({
6112
6351
  // Create an instance of the BloomFilter with the provided parameters
6113
6352
  createFilter: (s) => {
6114
6353
  try {
6115
- const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, n = new ii({
6354
+ const e = typeof s.strengthX == "number" ? s.strengthX : 2, t = typeof s.strengthY == "number" ? s.strengthY : 2, i = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, o = new li({
6116
6355
  strength: {
6117
6356
  x: Number(e),
6118
6357
  y: Number(t)
@@ -6121,17 +6360,17 @@ m({
6121
6360
  resolution: Number(r),
6122
6361
  kernelSize: Number(a)
6123
6362
  });
6124
- return n._customParams = {
6363
+ return o._customParams = {
6125
6364
  strengthX: e,
6126
6365
  strengthY: t,
6127
6366
  quality: i,
6128
6367
  resolution: r,
6129
6368
  kernelSize: a
6130
- }, n.updateUIParam = function(o, l) {
6369
+ }, o.updateUIParam = function(n, l) {
6131
6370
  var c, d;
6132
6371
  try {
6133
6372
  const h = Number(l), u = this._customParams || {};
6134
- switch (this._customParams = u, u[o] = h, o) {
6373
+ switch (this._customParams = u, u[n] = h, n) {
6135
6374
  case "strengthX":
6136
6375
  this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
6137
6376
  break;
@@ -6148,12 +6387,12 @@ m({
6148
6387
  this.kernelSize = h;
6149
6388
  break;
6150
6389
  default:
6151
- o in this && (this[o] = h);
6390
+ n in this && (this[n] = h);
6152
6391
  break;
6153
6392
  }
6154
6393
  } catch {
6155
6394
  }
6156
- }, n;
6395
+ }, o;
6157
6396
  } catch {
6158
6397
  return null;
6159
6398
  }
@@ -6215,7 +6454,7 @@ m({
6215
6454
  }
6216
6455
  ]
6217
6456
  });
6218
- const { BulgePinchFilter: we } = b, ie = (s) => {
6457
+ const { BulgePinchFilter: ve } = y, ae = (s) => {
6219
6458
  const e = Math.max(0, Number(s) || 0);
6220
6459
  return Math.ceil(e + 2);
6221
6460
  };
@@ -6226,15 +6465,15 @@ m({
6226
6465
  description: "Creates a bulge or pinch effect in a circular area",
6227
6466
  createFilter: (s) => {
6228
6467
  try {
6229
- const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new we({
6468
+ const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = s.radius ?? 100, r = s.strength ?? 1, a = new ve({
6230
6469
  center: { x: e, y: t },
6231
6470
  radius: i,
6232
6471
  strength: r
6233
- }), n = ie(i);
6234
- a.padding = Math.max(a.padding ?? 0, n), a._exportPadding = n, a._customParams = { ...s };
6235
- const o = (l) => {
6472
+ }), o = ae(i);
6473
+ a.padding = Math.max(a.padding ?? 0, o), a._exportPadding = o, a._customParams = { ...s };
6474
+ const n = (l) => {
6236
6475
  var h;
6237
- const c = Number(((h = l._customParams) == null ? void 0 : h.radius) ?? l.radius ?? 0), d = ie(c);
6476
+ const c = Number(((h = l._customParams) == null ? void 0 : h.radius) ?? l.radius ?? 0), d = ae(c);
6238
6477
  l._exportPadding = d, l.padding = Math.max(l.padding ?? 0, d);
6239
6478
  };
6240
6479
  return a.updateUIParam = function(l, c) {
@@ -6247,7 +6486,7 @@ m({
6247
6486
  this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.y = c;
6248
6487
  break;
6249
6488
  case "radius":
6250
- this.radius = Number(c), o(this);
6489
+ this.radius = Number(c), n(this);
6251
6490
  break;
6252
6491
  case "strength":
6253
6492
  this.strength = Number(c);
@@ -6258,15 +6497,15 @@ m({
6258
6497
  }
6259
6498
  return !0;
6260
6499
  }, a.createExportFilter = function(l = {}) {
6261
- const c = Number.isFinite(l.previewToNativeScale) ? Math.max(1, Number(l.previewToNativeScale)) : 1, d = this._customParams || s, h = Number(d.radius ?? 100) * c, u = new we({
6500
+ const c = Number.isFinite(l.previewToNativeScale) ? Math.max(1, Number(l.previewToNativeScale)) : 1, d = this._customParams || s, h = Number(d.radius ?? 100) * c, u = new ve({
6262
6501
  center: {
6263
6502
  x: Number(d.centerX ?? 0.5),
6264
6503
  y: Number(d.centerY ?? 0.5)
6265
6504
  },
6266
6505
  radius: h,
6267
6506
  strength: Number(d.strength ?? 1)
6268
- }), f = ie(h);
6269
- return u._exportPadding = f, u.padding = Math.max(u.padding ?? 0, f), u;
6507
+ }), p = ae(h);
6508
+ return u._exportPadding = p, u.padding = Math.max(u.padding ?? 0, p), u;
6270
6509
  }, a.getExportPadding = function() {
6271
6510
  return Number(this._exportPadding || this.padding || 0);
6272
6511
  }, a;
@@ -6323,7 +6562,7 @@ m({
6323
6562
  }
6324
6563
  ]
6325
6564
  });
6326
- const { ConvolutionFilter: ri } = b, q = {
6565
+ const { ConvolutionFilter: ci } = y, H = {
6327
6566
  normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
6328
6567
  gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
6329
6568
  boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
@@ -6356,25 +6595,25 @@ m({
6356
6595
  ];
6357
6596
  else {
6358
6597
  const i = s.preset;
6359
- e = q[i] || q.normal;
6598
+ e = H[i] || H.normal;
6360
6599
  }
6361
- const t = new ri(e, s.width || 200, s.height || 200);
6600
+ const t = new ci(e, s.width || 200, s.height || 200);
6362
6601
  return t._customParams = { ...s }, t.updateUIParam = function(i, r) {
6363
6602
  const a = this._customParams || {};
6364
6603
  switch (this._customParams = a, a[i] = r, i) {
6365
6604
  case "preset":
6366
6605
  if (!a.customMatrix) {
6367
- const n = r;
6368
- q[n] && (this.matrix = q[n]);
6606
+ const o = r;
6607
+ H[o] && (this.matrix = H[o]);
6369
6608
  }
6370
6609
  break;
6371
6610
  case "customMatrix":
6372
6611
  if (r) {
6373
- const n = this.matrix;
6374
- a.m00 = n[0], a.m01 = n[1], a.m02 = n[2], a.m10 = n[3], a.m11 = n[4], a.m12 = n[5], a.m20 = n[6], a.m21 = n[7], a.m22 = n[8];
6612
+ const o = this.matrix;
6613
+ a.m00 = o[0], a.m01 = o[1], a.m02 = o[2], a.m10 = o[3], a.m11 = o[4], a.m12 = o[5], a.m20 = o[6], a.m21 = o[7], a.m22 = o[8];
6375
6614
  } else {
6376
- const n = a.preset;
6377
- this.matrix = q[n] || q.normal;
6615
+ const o = a.preset;
6616
+ this.matrix = H[o] || H.normal;
6378
6617
  }
6379
6618
  break;
6380
6619
  case "m00":
@@ -6387,7 +6626,7 @@ m({
6387
6626
  case "m21":
6388
6627
  case "m22":
6389
6628
  if (a.customMatrix) {
6390
- const n = [...this.matrix], l = {
6629
+ const o = [...this.matrix], l = {
6391
6630
  m00: 0,
6392
6631
  m01: 1,
6393
6632
  m02: 2,
@@ -6398,7 +6637,7 @@ m({
6398
6637
  m21: 7,
6399
6638
  m22: 8
6400
6639
  }[i];
6401
- l !== void 0 && (n[l] = r, this.matrix = n);
6640
+ l !== void 0 && (o[l] = r, this.matrix = o);
6402
6641
  }
6403
6642
  break;
6404
6643
  case "width":
@@ -6569,7 +6808,7 @@ m({
6569
6808
  }
6570
6809
  ]
6571
6810
  });
6572
- const { CrossHatchFilter: si } = b;
6811
+ const { CrossHatchFilter: hi } = y;
6573
6812
  m({
6574
6813
  id: "cross-hatch",
6575
6814
  name: "Cross Hatch",
@@ -6579,7 +6818,7 @@ m({
6579
6818
  // Note: CrossHatchFilter has NO parameters according to PixiJS examples
6580
6819
  createFilter: (s) => {
6581
6820
  try {
6582
- const e = new si();
6821
+ const e = new hi();
6583
6822
  return e.updateUIParam = function(t, i) {
6584
6823
  return !0;
6585
6824
  }, e;
@@ -6612,7 +6851,7 @@ m({
6612
6851
  vignettingBlur: typeof s.vignettingBlur == "number" ? s.vignettingBlur : 0.3,
6613
6852
  time: typeof s.time == "number" ? s.time : 0,
6614
6853
  seed: typeof s.seed == "number" ? s.seed : Math.random()
6615
- }, t = new b.CRTFilter(e);
6854
+ }, t = new y.CRTFilter(e);
6616
6855
  return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
6617
6856
  try {
6618
6857
  const a = this._customParams || {};
@@ -6776,7 +7015,7 @@ m({
6776
7015
  }
6777
7016
  ]
6778
7017
  });
6779
- const ai = R.DisplacementFilter, ni = R.Sprite, re = R.Texture;
7018
+ const di = R.DisplacementFilter, ui = R.Sprite, oe = R.Texture;
6780
7019
  m({
6781
7020
  id: "displacement",
6782
7021
  // ID must match what the application expects
@@ -6789,41 +7028,41 @@ m({
6789
7028
  const e = s.mapTexture || "/assets/images/displacement_map.png";
6790
7029
  let t;
6791
7030
  try {
6792
- t = re.from(e), t.source.addressMode = "repeat";
7031
+ t = oe.from(e), t.source.addressMode = "repeat";
6793
7032
  } catch {
6794
- const n = document.createElement("canvas");
6795
- n.width = 256, n.height = 256;
6796
- const o = n.getContext("2d");
6797
- if (o) {
6798
- o.fillStyle = "#ffffff", o.fillRect(0, 0, n.width, n.height), o.fillStyle = "#000000";
7033
+ const o = document.createElement("canvas");
7034
+ o.width = 256, o.height = 256;
7035
+ const n = o.getContext("2d");
7036
+ if (n) {
7037
+ n.fillStyle = "#ffffff", n.fillRect(0, 0, o.width, o.height), n.fillStyle = "#000000";
6799
7038
  for (let l = 0; l < 10; l++)
6800
7039
  for (let c = 0; c < 10; c++)
6801
- (l + c) % 2 === 0 && o.fillRect(l * 25, c * 25, 25, 25);
7040
+ (l + c) % 2 === 0 && n.fillRect(l * 25, c * 25, 25, 25);
6802
7041
  }
6803
- t = re.from(n);
7042
+ t = oe.from(o);
6804
7043
  }
6805
- const i = new ni(t), r = new ai(i, s.scale || 50);
6806
- return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, n) {
6807
- const o = this._customParams || {};
6808
- switch (this._customParams = o, o[a] = n, a) {
7044
+ const i = new ui(t), r = new di(i, s.scale || 50);
7045
+ return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = i, r.updateUIParam = function(a, o) {
7046
+ const n = this._customParams || {};
7047
+ switch (this._customParams = n, n[a] = o, a) {
6809
7048
  case "scaleX":
6810
- this.scale.x = n;
7049
+ this.scale.x = o;
6811
7050
  break;
6812
7051
  case "scaleY":
6813
- this.scale.y = n;
7052
+ this.scale.y = o;
6814
7053
  break;
6815
7054
  case "mapTexture":
6816
7055
  try {
6817
7056
  const l = this._displacementSprite;
6818
7057
  if (l) {
6819
- const c = re.from(n);
7058
+ const c = oe.from(o);
6820
7059
  c.source.addressMode = "repeat", l.texture = c;
6821
7060
  }
6822
7061
  } catch {
6823
7062
  }
6824
7063
  break;
6825
7064
  default:
6826
- a in this ? this[a] = n : a in this.scale && (this.scale[a] = n);
7065
+ a in this ? this[a] = o : a in this.scale && (this.scale[a] = o);
6827
7066
  break;
6828
7067
  }
6829
7068
  return !0;
@@ -6887,7 +7126,7 @@ m({
6887
7126
  scale: typeof s.scale == "number" ? s.scale : 1,
6888
7127
  angle: typeof s.angle == "number" ? s.angle : 5,
6889
7128
  grayscale: s.grayscale === !0
6890
- }, t = new b.DotFilter(e);
7129
+ }, t = new y.DotFilter(e);
6891
7130
  return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
6892
7131
  try {
6893
7132
  const a = this._customParams || {};
@@ -6949,7 +7188,7 @@ m({
6949
7188
  }
6950
7189
  ]
6951
7190
  });
6952
- const { EmbossFilter: oi } = b;
7191
+ const { EmbossFilter: pi } = y;
6953
7192
  m({
6954
7193
  id: "emboss",
6955
7194
  name: "Emboss",
@@ -6958,7 +7197,7 @@ m({
6958
7197
  // Create an instance of the Emboss filter with the provided parameters
6959
7198
  createFilter: (s) => {
6960
7199
  try {
6961
- const e = typeof s.strength == "number" ? s.strength : 5, t = new oi(e);
7200
+ const e = typeof s.strength == "number" ? s.strength : 5, t = new pi(e);
6962
7201
  return t._customParams = {
6963
7202
  strength: e
6964
7203
  }, t.updateUIParam = function(i, r) {
@@ -6966,8 +7205,8 @@ m({
6966
7205
  const a = this._customParams || {};
6967
7206
  switch (this._customParams = a, a[i] = r, i) {
6968
7207
  case "strength":
6969
- const n = Number(r);
6970
- a.strength = n, this.strength = n;
7208
+ const o = Number(r);
7209
+ a.strength = o, this.strength = o;
6971
7210
  break;
6972
7211
  default:
6973
7212
  i in this && (this[i] = r);
@@ -6998,7 +7237,7 @@ m({
6998
7237
  }
6999
7238
  ]
7000
7239
  });
7001
- const { GlitchFilter: li } = b, D = {
7240
+ const { GlitchFilter: fi } = y, L = {
7002
7241
  TRANSPARENT: 0,
7003
7242
  ORIGINAL: 1,
7004
7243
  LOOP: 2,
@@ -7012,7 +7251,7 @@ m({
7012
7251
  description: "Apply digital distortion and glitch effects",
7013
7252
  createFilter: (s) => {
7014
7253
  try {
7015
- const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new li({
7254
+ const e = { x: s.redX, y: s.redY }, t = { x: s.greenX, y: s.greenY }, i = { x: s.blueX, y: s.blueY }, r = new fi({
7016
7255
  slices: s.slices,
7017
7256
  offset: s.offset,
7018
7257
  direction: s.direction,
@@ -7027,16 +7266,16 @@ m({
7027
7266
  });
7028
7267
  r.animating = s.animating || !1, r._customParams = { ...s }, typeof r.refresh == "function" && r.refresh();
7029
7268
  let a = null;
7030
- const n = () => {
7031
- r.animating && (r.seed = Math.random()), a = requestAnimationFrame(n);
7269
+ const o = () => {
7270
+ r.animating && (r.seed = Math.random()), a = requestAnimationFrame(o);
7032
7271
  };
7033
- return r.animating && (a = requestAnimationFrame(n)), r._stopAnimation = () => {
7272
+ return r.animating && (a = requestAnimationFrame(o)), r._stopAnimation = () => {
7034
7273
  a !== null && (cancelAnimationFrame(a), a = null);
7035
- }, r.updateUIParam = function(o, l) {
7274
+ }, r.updateUIParam = function(n, l) {
7036
7275
  const c = this._customParams || {};
7037
- switch (this._customParams = c, c[o] = l, o) {
7276
+ switch (this._customParams = c, c[n] = l, n) {
7038
7277
  case "animating":
7039
- this.animating = l, l && !a && (a = requestAnimationFrame(n));
7278
+ this.animating = l, l && !a && (a = requestAnimationFrame(o));
7040
7279
  break;
7041
7280
  case "slices":
7042
7281
  this.slices = Math.round(l);
@@ -7044,17 +7283,17 @@ m({
7044
7283
  case "redX":
7045
7284
  case "redY":
7046
7285
  const d = this.red;
7047
- o === "redX" ? d.x = l : d.y = l, this.red = d;
7286
+ n === "redX" ? d.x = l : d.y = l, this.red = d;
7048
7287
  break;
7049
7288
  case "greenX":
7050
7289
  case "greenY":
7051
7290
  const h = this.green;
7052
- o === "greenX" ? h.x = l : h.y = l, this.green = h;
7291
+ n === "greenX" ? h.x = l : h.y = l, this.green = h;
7053
7292
  break;
7054
7293
  case "blueX":
7055
7294
  case "blueY":
7056
7295
  const u = this.blue;
7057
- o === "blueX" ? u.x = l : u.y = l, this.blue = u;
7296
+ n === "blueX" ? u.x = l : u.y = l, this.blue = u;
7058
7297
  break;
7059
7298
  case "seed":
7060
7299
  this.animating || (this.seed = l);
@@ -7075,10 +7314,10 @@ m({
7075
7314
  case "average":
7076
7315
  case "minSize":
7077
7316
  case "sampleSize":
7078
- o in this && (this[o] = l);
7317
+ n in this && (this[n] = l);
7079
7318
  break;
7080
7319
  default:
7081
- o in this && (this[o] = l);
7320
+ n in this && (this[n] = l);
7082
7321
  break;
7083
7322
  }
7084
7323
  }, r;
@@ -7090,7 +7329,7 @@ m({
7090
7329
  slices: 10,
7091
7330
  offset: 100,
7092
7331
  direction: 0,
7093
- fillMode: D.LOOP,
7332
+ fillMode: L.LOOP,
7094
7333
  // LOOP mode looks better for the demo
7095
7334
  seed: 0.5,
7096
7335
  average: !1,
@@ -7153,13 +7392,13 @@ m({
7153
7392
  label: "Fill Mode",
7154
7393
  property: "fillMode",
7155
7394
  options: [
7156
- { value: D.TRANSPARENT, label: "Transparent" },
7157
- { value: D.ORIGINAL, label: "Original" },
7158
- { value: D.LOOP, label: "Loop" },
7159
- { value: D.CLAMP, label: "Clamp" },
7160
- { value: D.MIRROR, label: "Mirror" }
7395
+ { value: L.TRANSPARENT, label: "Transparent" },
7396
+ { value: L.ORIGINAL, label: "Original" },
7397
+ { value: L.LOOP, label: "Loop" },
7398
+ { value: L.CLAMP, label: "Clamp" },
7399
+ { value: L.MIRROR, label: "Mirror" }
7161
7400
  ],
7162
- default: D.LOOP
7401
+ default: L.LOOP
7163
7402
  },
7164
7403
  {
7165
7404
  id: "seed",
@@ -7253,7 +7492,7 @@ m({
7253
7492
  }
7254
7493
  ]
7255
7494
  });
7256
- const { GlowFilter: ci } = b;
7495
+ const { GlowFilter: mi } = y;
7257
7496
  m({
7258
7497
  id: "glow",
7259
7498
  name: "Glow",
@@ -7262,7 +7501,7 @@ m({
7262
7501
  // Create an instance of the GlowFilter with the provided parameters
7263
7502
  createFilter: (s) => {
7264
7503
  try {
7265
- const e = parseInt(s.color.replace("#", "0x"), 16), t = new ci({
7504
+ const e = parseInt(s.color.replace("#", "0x"), 16), t = new mi({
7266
7505
  distance: s.distance || 10,
7267
7506
  outerStrength: s.outerStrength || 4,
7268
7507
  innerStrength: s.innerStrength || 0,
@@ -7388,7 +7627,7 @@ m({
7388
7627
  }
7389
7628
  ]
7390
7629
  });
7391
- const { GodrayFilter: hi } = b;
7630
+ const { GodrayFilter: gi } = y;
7392
7631
  m({
7393
7632
  id: "godray",
7394
7633
  name: "Godray",
@@ -7397,7 +7636,7 @@ m({
7397
7636
  // Create an instance of the GodrayFilter with the provided parameters
7398
7637
  createFilter: (s) => {
7399
7638
  try {
7400
- const e = new hi({
7639
+ const e = new gi({
7401
7640
  angle: s.angle || 30,
7402
7641
  parallel: s.parallel ?? !0,
7403
7642
  center: {
@@ -7550,7 +7789,7 @@ m({
7550
7789
  }
7551
7790
  ]
7552
7791
  });
7553
- const di = b.SimpleLightmapFilter, Se = R.Texture;
7792
+ const bi = y.SimpleLightmapFilter, Me = R.Texture;
7554
7793
  m({
7555
7794
  id: "lightmap",
7556
7795
  name: "Lightmap",
@@ -7575,14 +7814,14 @@ m({
7575
7814
  const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
7576
7815
  c.addColorStop(0, "white"), c.addColorStop(0.3, "rgba(220, 220, 220, 1)"), c.addColorStop(0.6, "rgba(150, 150, 150, 1)"), c.addColorStop(1, "black"), a.fillStyle = c, a.fillRect(0, 0, 256, 256);
7577
7816
  }
7578
- const n = Se.from(r);
7579
- let o;
7817
+ const o = Me.from(r);
7818
+ let n;
7580
7819
  try {
7581
- typeof t == "string" && t.startsWith("#") ? o = parseInt(t.replace("#", "0x"), 16) : o = 0;
7820
+ typeof t == "string" && t.startsWith("#") ? n = parseInt(t.replace("#", "0x"), 16) : n = 0;
7582
7821
  } catch {
7583
- o = 0;
7822
+ n = 0;
7584
7823
  }
7585
- const l = new di(n, o, i);
7824
+ const l = new bi(o, n, i);
7586
7825
  return l._customParams = {
7587
7826
  textureType: e,
7588
7827
  color: t,
@@ -7595,21 +7834,21 @@ m({
7595
7834
  h.textureType = d;
7596
7835
  const u = document.createElement("canvas");
7597
7836
  u.width = 256, u.height = 256;
7598
- const f = u.getContext("2d");
7599
- if (f) {
7837
+ const p = u.getContext("2d");
7838
+ if (p) {
7600
7839
  if (d === "spotlight") {
7601
- f.fillStyle = "black", f.fillRect(0, 0, 256, 256);
7602
- const g = f.createRadialGradient(128, 128, 5, 128, 128, 80);
7603
- g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"), f.fillStyle = g, f.beginPath(), f.arc(128, 128, 100, 0, Math.PI * 2), f.fill();
7840
+ p.fillStyle = "black", p.fillRect(0, 0, 256, 256);
7841
+ const g = p.createRadialGradient(128, 128, 5, 128, 128, 80);
7842
+ g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"), p.fillStyle = g, p.beginPath(), p.arc(128, 128, 100, 0, Math.PI * 2), p.fill();
7604
7843
  } else if (d === "softlight") {
7605
- const g = f.createLinearGradient(0, 0, 256, 256);
7606
- g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.7, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "rgba(80, 80, 80, 1)"), f.fillStyle = g, f.fillRect(0, 0, 256, 256);
7844
+ const g = p.createLinearGradient(0, 0, 256, 256);
7845
+ g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.7, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "rgba(80, 80, 80, 1)"), p.fillStyle = g, p.fillRect(0, 0, 256, 256);
7607
7846
  } else {
7608
- const g = f.createRadialGradient(128, 128, 10, 128, 128, 160);
7609
- g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.6, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "black"), f.fillStyle = g, f.fillRect(0, 0, 256, 256);
7847
+ const g = p.createRadialGradient(128, 128, 10, 128, 128, 160);
7848
+ g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.6, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "black"), p.fillStyle = g, p.fillRect(0, 0, 256, 256);
7610
7849
  }
7611
- const _ = Se.from(u);
7612
- if (this.lightMap = _, this.enabled !== void 0) {
7850
+ const b = Me.from(u);
7851
+ if (this.lightMap = b, this.enabled !== void 0) {
7613
7852
  const g = this.enabled;
7614
7853
  this.enabled = !1, setTimeout(() => {
7615
7854
  this.enabled = g;
@@ -7681,7 +7920,7 @@ m({
7681
7920
  }
7682
7921
  ]
7683
7922
  });
7684
- const { NoiseFilter: ui } = R;
7923
+ const { NoiseFilter: yi } = R;
7685
7924
  m({
7686
7925
  id: "noise",
7687
7926
  name: "Noise",
@@ -7689,7 +7928,7 @@ m({
7689
7928
  description: "Add random noise to the image",
7690
7929
  createFilter: (s) => {
7691
7930
  try {
7692
- const e = new ui({
7931
+ const e = new yi({
7693
7932
  noise: s.noise || 0.5,
7694
7933
  seed: s.seed || Math.random()
7695
7934
  });
@@ -7701,8 +7940,8 @@ m({
7701
7940
  return e.animating && (t = requestAnimationFrame(i)), e._stopAnimation = () => {
7702
7941
  t !== null && (cancelAnimationFrame(t), t = null);
7703
7942
  }, e.updateUIParam = function(r, a) {
7704
- const n = this._customParams || {};
7705
- switch (this._customParams = n, n[r] = a, r) {
7943
+ const o = this._customParams || {};
7944
+ switch (this._customParams = o, o[r] = a, r) {
7706
7945
  case "animating":
7707
7946
  this.animating = a, a && !t && (t = requestAnimationFrame(i));
7708
7947
  break;
@@ -7766,7 +8005,7 @@ m({
7766
8005
  }
7767
8006
  ]
7768
8007
  });
7769
- const { OldFilmFilter: pi } = b;
8008
+ const { OldFilmFilter: _i } = y;
7770
8009
  m({
7771
8010
  id: "old-film",
7772
8011
  name: "Old Film",
@@ -7774,7 +8013,7 @@ m({
7774
8013
  description: "Apply a vintage film effect with scratches and grain",
7775
8014
  createFilter: (s) => {
7776
8015
  try {
7777
- const e = new pi({
8016
+ const e = new _i({
7778
8017
  sepia: s.sepia,
7779
8018
  noise: s.noise,
7780
8019
  noiseSize: s.noiseSize,
@@ -7794,8 +8033,8 @@ m({
7794
8033
  return e.animating && (t = requestAnimationFrame(i)), e._stopAnimation = () => {
7795
8034
  t !== null && (cancelAnimationFrame(t), t = null);
7796
8035
  }, e.updateUIParam = function(r, a) {
7797
- const n = this._customParams || {};
7798
- switch (this._customParams = n, n[r] = a, r) {
8036
+ const o = this._customParams || {};
8037
+ switch (this._customParams = o, o[r] = a, r) {
7799
8038
  case "animating":
7800
8039
  this.animating = a, a && !t && (t = requestAnimationFrame(i));
7801
8040
  break;
@@ -7955,7 +8194,7 @@ m({
7955
8194
  }
7956
8195
  ]
7957
8196
  });
7958
- const { OutlineFilter: fi } = b;
8197
+ const { OutlineFilter: xi } = y;
7959
8198
  m({
7960
8199
  id: "outline",
7961
8200
  name: "Outline",
@@ -7965,7 +8204,7 @@ m({
7965
8204
  try {
7966
8205
  let e = s.color;
7967
8206
  typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
7968
- const t = new fi({
8207
+ const t = new xi({
7969
8208
  thickness: s.thickness || 4,
7970
8209
  color: e,
7971
8210
  alpha: s.alpha || 1,
@@ -8055,7 +8294,7 @@ m({
8055
8294
  }
8056
8295
  ]
8057
8296
  });
8058
- const { PixelateFilter: mi } = b;
8297
+ const { PixelateFilter: Ci } = y;
8059
8298
  m({
8060
8299
  id: "pixelate",
8061
8300
  name: "Pixelate",
@@ -8063,7 +8302,7 @@ m({
8063
8302
  description: "Create a pixelated or mosaic effect",
8064
8303
  createFilter: (s) => {
8065
8304
  try {
8066
- const e = new mi(
8305
+ const e = new Ci(
8067
8306
  s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
8068
8307
  );
8069
8308
  return e._customParams = { ...s }, e.updateUIParam = function(t, i) {
@@ -8146,7 +8385,7 @@ m({
8146
8385
  }
8147
8386
  ]
8148
8387
  });
8149
- const { ReflectionFilter: gi } = b;
8388
+ const { ReflectionFilter: wi } = y;
8150
8389
  m({
8151
8390
  id: "reflection",
8152
8391
  // ID must match what the application expects
@@ -8163,7 +8402,7 @@ m({
8163
8402
  waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
8164
8403
  alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
8165
8404
  time: s.time ?? 0
8166
- }, t = new gi(e);
8405
+ }, t = new wi(e);
8167
8406
  return t._customParams = { ...s }, t.animating = s.animating ?? !1, t.updateUIParam = function(i, r) {
8168
8407
  const a = this._customParams || {};
8169
8408
  switch (this._customParams = a, a[i] = r, i) {
@@ -8314,7 +8553,7 @@ m({
8314
8553
  }
8315
8554
  ]
8316
8555
  });
8317
- const { ShockwaveFilter: bi } = b;
8556
+ const { ShockwaveFilter: Si } = y;
8318
8557
  m({
8319
8558
  id: "shockwave",
8320
8559
  // ID must match what the application expects
@@ -8324,18 +8563,18 @@ m({
8324
8563
  // Create an instance of the ShockwaveFilter with the provided parameters
8325
8564
  createFilter: (s) => {
8326
8565
  try {
8327
- const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, n = s.speed ?? 500, o = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, d = new bi({
8566
+ const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, d = new Si({
8328
8567
  center: i,
8329
8568
  amplitude: r,
8330
8569
  wavelength: a,
8331
- speed: n,
8332
- brightness: o,
8570
+ speed: o,
8571
+ brightness: n,
8333
8572
  radius: l,
8334
8573
  time: c
8335
8574
  });
8336
8575
  return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, u) {
8337
- const f = this._customParams || {};
8338
- switch (this._customParams = f, f[h] = u, h) {
8576
+ const p = this._customParams || {};
8577
+ switch (this._customParams = p, p[h] = u, h) {
8339
8578
  case "centerX":
8340
8579
  this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.x = u;
8341
8580
  break;
@@ -8466,7 +8705,7 @@ m({
8466
8705
  }
8467
8706
  ]
8468
8707
  });
8469
- const { SimplexNoiseFilter: yi } = b;
8708
+ const { SimplexNoiseFilter: vi } = y;
8470
8709
  m({
8471
8710
  id: "simplex-noise",
8472
8711
  name: "Simplex Noise",
@@ -8474,7 +8713,7 @@ m({
8474
8713
  description: "Apply procedural noise to create texture effects",
8475
8714
  createFilter: (s) => {
8476
8715
  try {
8477
- const e = s.animating ? 0 : s.offsetZ || 0, t = new yi({
8716
+ const e = s.animating ? 0 : s.offsetZ || 0, t = new vi({
8478
8717
  strength: s.strength,
8479
8718
  noiseScale: s.noiseScale,
8480
8719
  offsetX: s.offsetX,
@@ -8489,20 +8728,20 @@ m({
8489
8728
  };
8490
8729
  return t.animating && (i = requestAnimationFrame(a)), t._stopAnimation = () => {
8491
8730
  i !== null && (cancelAnimationFrame(i), i = null);
8492
- }, t.updateUIParam = function(n, o) {
8731
+ }, t.updateUIParam = function(o, n) {
8493
8732
  const l = this._customParams || {};
8494
- switch (this._customParams = l, l[n] = o, n) {
8733
+ switch (this._customParams = l, l[o] = n, o) {
8495
8734
  case "animating":
8496
- this.animating = o, o && !i && (i = requestAnimationFrame(a));
8735
+ this.animating = n, n && !i && (i = requestAnimationFrame(a));
8497
8736
  break;
8498
8737
  case "animationSpeed":
8499
- this.animationSpeed = o;
8738
+ this.animationSpeed = n;
8500
8739
  break;
8501
8740
  case "offsetZ":
8502
- this.animating || (this.offsetZ = o);
8741
+ this.animating || (this.offsetZ = n);
8503
8742
  break;
8504
8743
  case "randomizeSeed":
8505
- if (o) {
8744
+ if (n) {
8506
8745
  const c = () => Math.random() * 100 - 50;
8507
8746
  this.offsetX = c(), this.offsetY = c(), this.offsetZ = c(), l.offsetX = this.offsetX, l.offsetY = this.offsetY, l.offsetZ = this.offsetZ;
8508
8747
  }
@@ -8512,10 +8751,10 @@ m({
8512
8751
  case "offsetX":
8513
8752
  case "offsetY":
8514
8753
  case "step":
8515
- n in this && (this[n] = o);
8754
+ o in this && (this[o] = n);
8516
8755
  break;
8517
8756
  default:
8518
- n in this && (this[n] = o);
8757
+ o in this && (this[o] = n);
8519
8758
  break;
8520
8759
  }
8521
8760
  }, t;
@@ -8621,13 +8860,13 @@ m({
8621
8860
  }
8622
8861
  ]
8623
8862
  });
8624
- const { TwistFilter: _i } = b, Xe = (s) => Math.ceil(Math.max(0, Number(s) || 0) + 2), ve = (s, e = 1) => {
8625
- const t = Math.max(1, Number(s._sourceWidth ?? 0)), i = Math.max(1, Number(s._sourceHeight ?? 0)), r = Math.min(t, i), a = Number(s.centerX ?? 0.5), n = Number(s.centerY ?? 0.5), o = Number(s.radius ?? 0.25), l = Number(s.angle ?? 4), c = a * t * e, d = n * i * e, h = o * r * e, u = new _i({
8863
+ const { TwistFilter: Mi } = y, Oe = (s) => Math.ceil(Math.max(0, Number(s) || 0) + 2), ke = (s, e = 1) => {
8864
+ const t = Math.max(1, Number(s._sourceWidth ?? 0)), i = Math.max(1, Number(s._sourceHeight ?? 0)), r = Math.min(t, i), a = Number(s.centerX ?? 0.5), o = Number(s.centerY ?? 0.5), n = Number(s.radius ?? 0.25), l = Number(s.angle ?? 4), c = a * t * e, d = o * i * e, h = n * r * e, u = new Mi({
8626
8865
  offset: { x: c, y: d },
8627
8866
  radius: h,
8628
8867
  angle: l
8629
- }), f = Xe(h);
8630
- return u.padding = Math.max(u.padding ?? 0, f), u._exportPadding = f, u;
8868
+ }), p = Oe(h);
8869
+ return u.padding = Math.max(u.padding ?? 0, p), u._exportPadding = p, u;
8631
8870
  };
8632
8871
  m({
8633
8872
  id: "twist",
@@ -8643,17 +8882,17 @@ m({
8643
8882
  angle: s.angle ?? 4,
8644
8883
  _sourceWidth: s._sourceWidth,
8645
8884
  _sourceHeight: s._sourceHeight
8646
- }, t = ve(e, 1);
8885
+ }, t = ke(e, 1);
8647
8886
  return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
8648
8887
  const a = this._customParams || {};
8649
8888
  this._customParams = a, a[i] = r;
8650
- const n = Math.max(1, Number(a._sourceWidth ?? 0)), o = Math.max(1, Number(a._sourceHeight ?? 0)), l = Math.min(n, o), c = Number(a.centerX ?? 0.5), d = Number(a.centerY ?? 0.5), h = Number(a.radius ?? 0.25), u = Number(a.angle ?? 4);
8651
- this.offset && (this.offset.x = c * n, this.offset.y = d * o), this.radius = h * l, this.angle = u;
8652
- const f = Xe(this.radius);
8653
- return this._exportPadding = f, this.padding = Math.max(this.padding ?? 0, f), !0;
8889
+ const o = Math.max(1, Number(a._sourceWidth ?? 0)), n = Math.max(1, Number(a._sourceHeight ?? 0)), l = Math.min(o, n), c = Number(a.centerX ?? 0.5), d = Number(a.centerY ?? 0.5), h = Number(a.radius ?? 0.25), u = Number(a.angle ?? 4);
8890
+ this.offset && (this.offset.x = c * o, this.offset.y = d * n), this.radius = h * l, this.angle = u;
8891
+ const p = Oe(this.radius);
8892
+ return this._exportPadding = p, this.padding = Math.max(this.padding ?? 0, p), !0;
8654
8893
  }, t.createExportFilter = function(i = {}) {
8655
8894
  const r = Number.isFinite(i.previewToNativeScale) ? Math.max(1, Number(i.previewToNativeScale)) : 1, a = this._customParams || e;
8656
- return ve(a, r);
8895
+ return ke(a, r);
8657
8896
  }, t.getExportPadding = function() {
8658
8897
  return Number(this._exportPadding || this.padding || 0);
8659
8898
  }, t;
@@ -8715,8 +8954,8 @@ m({
8715
8954
  }
8716
8955
  ]
8717
8956
  });
8718
- const { AdjustmentFilter: xi } = b;
8719
- function K(s) {
8957
+ const { AdjustmentFilter: ki } = y;
8958
+ function J(s) {
8720
8959
  const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
8721
8960
  return [
8722
8961
  (e >> 16 & 255) / 255,
@@ -8724,14 +8963,14 @@ function K(s) {
8724
8963
  (e & 255) / 255
8725
8964
  ];
8726
8965
  }
8727
- class Ci extends xi {
8966
+ class Pi extends ki {
8728
8967
  constructor(e = {}) {
8729
8968
  super({
8730
8969
  brightness: 1,
8731
8970
  contrast: 1,
8732
8971
  saturation: 1,
8733
8972
  alpha: 1
8734
- }), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb = K(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = K(e.color))), this.updateVignette();
8973
+ }), this._radius = 0.8, this._strength = 1, this._colorRgb = [0, 0, 0], this._colorValue = "#000000", this._radius = e.radius ?? 0.8, this._strength = e.strength ?? 1, e.color !== void 0 && (typeof e.color == "string" ? (this._colorValue = e.color, this._colorRgb = J(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = J(e.color))), this.updateVignette();
8735
8974
  }
8736
8975
  /**
8737
8976
  * Updates the filter parameters to simulate a vignette effect
@@ -8757,7 +8996,7 @@ class Ci extends xi {
8757
8996
  return this._colorValue;
8758
8997
  }
8759
8998
  set color(e) {
8760
- typeof e == "string" ? (this._colorValue = e, this._colorRgb = K(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = K(e)), this.updateVignette();
8999
+ typeof e == "string" ? (this._colorValue = e, this._colorRgb = J(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = J(e)), this.updateVignette();
8761
9000
  }
8762
9001
  }
8763
9002
  m({
@@ -8767,7 +9006,7 @@ m({
8767
9006
  description: "Add a classic darkened border effect to the image",
8768
9007
  createFilter: (s) => {
8769
9008
  try {
8770
- const e = new Ci({
9009
+ const e = new Pi({
8771
9010
  radius: s.radius || 0.8,
8772
9011
  strength: s.strength || 1,
8773
9012
  color: s.color || "#000000"
@@ -8831,22 +9070,22 @@ m({
8831
9070
  }
8832
9071
  ]
8833
9072
  });
8834
- function Pi(s) {
9073
+ function Ri(s) {
8835
9074
  try {
8836
9075
  let e = [], t = [];
8837
9076
  try {
8838
- e = Q(), e.length === 0 && kt();
9077
+ e = te(), e.length === 0 && Tt();
8839
9078
  } catch {
8840
9079
  }
8841
9080
  const i = s == null ? void 0 : s.disabled;
8842
9081
  if (Array.isArray(i) && i.length > 0) {
8843
9082
  let r = 0;
8844
9083
  for (const a of i)
8845
- zt(a) && r++;
9084
+ Bt(a) && r++;
8846
9085
  r > 0;
8847
9086
  }
8848
9087
  try {
8849
- e = Q(), t = At();
9088
+ e = te(), t = It();
8850
9089
  } catch {
8851
9090
  e || (e = []), t || (t = []);
8852
9091
  }
@@ -8856,38 +9095,38 @@ function Pi(s) {
8856
9095
  }
8857
9096
  }
8858
9097
  export {
8859
- ae as C,
8860
- le as E,
8861
- ut as F,
8862
- He as P,
8863
- pt as R,
8864
- ft as T,
8865
- Si as V,
8866
- Pt as a,
8867
- Ft as b,
8868
- At as c,
8869
- se as d,
8870
- p as e,
8871
- Pe as f,
8872
- Q as g,
8873
- vi as h,
8874
- Pi as i,
8875
- O as j,
8876
- Re as k,
8877
- Te as l,
8878
- Ne as m,
8879
- ze as n,
8880
- Ae as o,
8881
- oe as p,
8882
- Me as q,
9098
+ le as C,
9099
+ he as E,
9100
+ gt as F,
9101
+ We as P,
9102
+ bt as R,
9103
+ yt as T,
9104
+ Ai as V,
9105
+ Rt as a,
9106
+ Et as b,
9107
+ It as c,
9108
+ ne as d,
9109
+ f as e,
9110
+ Fe as f,
9111
+ te as g,
9112
+ Ni as h,
9113
+ Ri as i,
9114
+ E as j,
9115
+ Ee as k,
9116
+ Ie as l,
9117
+ Te as m,
9118
+ Re as n,
9119
+ ze as o,
9120
+ ce as p,
9121
+ Pe as q,
8883
9122
  m as r,
8884
- W as s,
8885
- vt as t,
8886
- qe as u,
8887
- wt as v,
8888
- ht as w,
8889
- kt as x,
8890
- Mi as y,
8891
- Nt as z
9123
+ G as s,
9124
+ At as t,
9125
+ $e as u,
9126
+ Pt as v,
9127
+ ft as w,
9128
+ Tt as x,
9129
+ zi as y,
9130
+ Xt as z
8892
9131
  };
8893
- //# sourceMappingURL=editor-CYj5y5bp.js.map
9132
+ //# sourceMappingURL=editor-Bj9-m03S.js.map