@codingfactory/mediables-vue 2.0.1 → 2.0.5

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,7 +1,10 @@
1
+ var ie = Object.defineProperty;
2
+ var re = (s, e, i) => e in s ? ie(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
3
+ var B = (s, e, i) => re(s, typeof e != "symbol" ? e + "" : e, i);
1
4
  import * as g from "pixi-filters";
2
5
  import * as C from "pixi.js";
3
- import { GlProgram as K } from "pixi.js";
4
- class N {
6
+ import { GlProgram as se } from "pixi.js";
7
+ class I {
5
8
  constructor() {
6
9
  this._events = /* @__PURE__ */ new Map();
7
10
  }
@@ -31,7 +34,7 @@ class N {
31
34
  e ? this._events.delete(e) : this._events.clear();
32
35
  }
33
36
  }
34
- class Q extends N {
37
+ class ae extends I {
35
38
  constructor() {
36
39
  super(), this._state = {
37
40
  // Image state
@@ -90,10 +93,10 @@ class Q extends N {
90
93
  const t = this.get(e);
91
94
  if (e.includes(".")) {
92
95
  const r = e.split("."), a = r.pop();
93
- let l = this._state;
94
- for (const o of r)
95
- l[o] === void 0 && (l[o] = {}), l = l[o];
96
- l[a] = i;
96
+ let o = this._state;
97
+ for (const l of r)
98
+ o[l] === void 0 && (o[l] = {}), o = o[l];
99
+ o[a] = i;
97
100
  } else
98
101
  this._state[e] = i;
99
102
  this.emit(`change:${e}`, { value: i, old: t }), this.emit("change", { key: e, value: i, old: t });
@@ -157,19 +160,29 @@ class Q extends N {
157
160
  this.set("isDarkMode", this._state.theme === "dark");
158
161
  }
159
162
  }
160
- function J() {
161
- return new Q();
163
+ function oe() {
164
+ return new ae();
162
165
  }
163
- class ee extends N {
166
+ class le extends I {
164
167
  constructor() {
165
- super(), this.app = null, this.sprite = null, this.originalTexture = null, this.baseTexture = null, this.fitScale = 1, this.zoom = 1, this._container = null;
168
+ 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;
166
169
  }
167
170
  /**
168
- * Get CSS size of the canvas (for proper coordinate mapping)
171
+ * Whether the renderer is fully initialized and ready for use.
172
+ * @returns {boolean}
173
+ */
174
+ get isReady() {
175
+ var e;
176
+ return !!((e = this.app) != null && e.renderer);
177
+ }
178
+ /**
179
+ * Get CSS size of the canvas (for proper coordinate mapping).
180
+ * Accesses renderer.canvas directly to avoid PIXI Application's
181
+ * canvas getter which throws when renderer is undefined.
169
182
  */
170
183
  _getCssSize() {
171
- var r, a, l;
172
- const e = (r = this.app) == null ? void 0 : r.canvas, i = (e == null ? void 0 : e.clientWidth) ?? ((a = this.app) == null ? void 0 : a.screen.width) ?? 0, t = (e == null ? void 0 : e.clientHeight) ?? ((l = this.app) == null ? void 0 : l.screen.height) ?? 0;
184
+ var r, a, o, l, n, c;
185
+ const e = (a = (r = this.app) == null ? void 0 : r.renderer) == null ? void 0 : a.canvas, i = (e == null ? void 0 : e.clientWidth) ?? ((l = (o = this.app) == null ? void 0 : o.screen) == null ? void 0 : l.width) ?? 0, t = (e == null ? void 0 : e.clientHeight) ?? ((c = (n = this.app) == null ? void 0 : n.screen) == null ? void 0 : c.height) ?? 0;
173
186
  return { w: i, h: t };
174
187
  }
175
188
  /**
@@ -224,33 +237,43 @@ class ee extends N {
224
237
  async mount(e, i = 16777215) {
225
238
  if (!e) return;
226
239
  this._container = e;
227
- const t = window.PIXI;
228
- if (!t)
229
- throw new Error("PIXI.js not found. Please ensure PIXI is loaded globally.");
230
- const r = e.clientWidth || 600, a = e.clientHeight || 400;
231
- this.app = new t.Application(), await this.app.init({
232
- width: r,
233
- height: a,
234
- backgroundColor: i,
235
- antialias: !0,
236
- autoDensity: !0,
237
- resolution: window.devicePixelRatio || 1
238
- }), e.appendChild(this.app.canvas);
239
- const l = this.app.canvas;
240
- l.classList.add("pixi-canvas"), l.style.width = "100%", l.style.height = "100%", l.style.transform = "translateZ(0)", l.style.willChange = "transform", this.emit("mounted", { width: r, height: a });
240
+ const t = async () => {
241
+ var n;
242
+ const r = window.PIXI;
243
+ if (!r)
244
+ throw new Error("PIXI.js not found. Please ensure PIXI is loaded globally.");
245
+ (n = r.Assets) != null && n.setPreferences && r.Assets.setPreferences({ crossOrigin: "anonymous" });
246
+ const a = e.clientWidth || 600, o = e.clientHeight || 400;
247
+ this.app = new r.Application(), await this.app.init({
248
+ width: a,
249
+ height: o,
250
+ backgroundColor: i,
251
+ antialias: !0,
252
+ autoDensity: !0,
253
+ resolution: window.devicePixelRatio || 1
254
+ }), e.appendChild(this.app.canvas);
255
+ const l = this.app.canvas;
256
+ l.classList.add("pixi-canvas"), l.style.width = "100%", l.style.height = "100%", l.style.transform = "translateZ(0)", l.style.willChange = "transform", l.setAttribute("role", "img"), l.setAttribute("aria-label", "Image editor canvas — use toolbar controls to edit the image"), this.emit("mounted", { width: a, height: o });
257
+ };
258
+ this._mountPromise = t(), await this._mountPromise;
241
259
  }
242
260
  /**
243
261
  * Load an image texture
244
- * @param {string} imageUrl - URL or data URL of the image
262
+ * @param {string} imageUrl - URL, data URL, or blob URL of the image
245
263
  */
246
264
  async loadTexture(e) {
247
- if (!this.app) return;
248
- const i = window.PIXI, t = await i.Assets.load(e);
249
- this.originalTexture = t, this.baseTexture = t, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new i.Sprite(t), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(t), this.zoom = 1;
250
- const { w: r, h: a } = this._getCssSize();
251
- this.applyViewTransform({ center: { x: r / 2, y: a / 2 } }), await new Promise(requestAnimationFrame);
252
- const l = this.getFitScaleFor(t);
253
- Math.abs(l - this.fitScale) / Math.max(1e-6, l) > 0.02 && (this.fitScale = l, this.applyViewTransform({ center: { x: r / 2, y: a / 2 } })), this.render(), this.emit("textureLoaded", { width: t.width, height: t.height });
265
+ var n, c, d;
266
+ if (this._mountPromise && await this._mountPromise, !((n = this.app) != null && n.renderer)) return;
267
+ const i = window.PIXI, t = await this._loadImageElement(e);
268
+ if (!t || !((c = this.app) != null && c.renderer)) return;
269
+ const r = i.Texture.from(t);
270
+ if (!r)
271
+ return;
272
+ this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new i.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
273
+ const { w: a, h: o } = this._getCssSize();
274
+ if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((d = this.app) != null && d.renderer)) return;
275
+ const l = this.getFitScaleFor(r);
276
+ Math.abs(l - this.fitScale) / Math.max(1e-6, l) > 0.02 && (this.fitScale = l, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height });
254
277
  }
255
278
  /**
256
279
  * Export the current image with filters applied
@@ -261,42 +284,63 @@ class ee extends N {
261
284
  * @returns {string|null} Data URL
262
285
  */
263
286
  exportImage(e = "png", i = 0.92, t = 0, r = !0) {
264
- var b, y, k;
265
- if (!this.app || !this.originalTexture) return null;
266
- const a = window.PIXI, l = Math.round(this.originalTexture.width), o = Math.round(this.originalTexture.height);
267
- let n = l, c = o;
287
+ var m, b, _;
288
+ if (!((m = this.app) != null && m.renderer) || !this.originalTexture)
289
+ return null;
290
+ const a = window.PIXI, o = Math.round(this.originalTexture.width), l = Math.round(this.originalTexture.height);
291
+ if (o <= 0 || l <= 0)
292
+ return null;
293
+ let n = o, c = l;
268
294
  if (t > 0) {
269
- const _ = Math.max(l, o);
270
- let S = t / _;
271
- r && (S = Math.min(1, S)), n = Math.round(l * S), c = Math.round(o * S);
272
- }
273
- const u = new a.Container(), h = new a.Sprite(this.originalTexture);
274
- if (h.scale.set(n / l, c / o), (y = (b = this.sprite) == null ? void 0 : b.filters) != null && y.length) {
275
- const _ = this.sprite.filters.map(
276
- (S) => typeof (S == null ? void 0 : S.clone) == "function" ? S.clone() : S
295
+ const x = Math.max(o, l);
296
+ let y = t / x;
297
+ r && (y = Math.min(1, y)), n = Math.round(o * y), c = Math.round(l * y);
298
+ }
299
+ const d = new a.Container(), h = new a.Sprite(this.originalTexture);
300
+ if (h.scale.set(n / o, c / l), (_ = (b = this.sprite) == null ? void 0 : b.filters) != null && _.length) {
301
+ const x = this.sprite.filters.map(
302
+ (y) => typeof (y == null ? void 0 : y.clone) == "function" ? y.clone() : y
277
303
  );
278
- h.filters = _;
304
+ h.filters = x;
305
+ }
306
+ d.addChild(h);
307
+ let p = null;
308
+ try {
309
+ if (p = a.RenderTexture.create({ width: n, height: c }), this.app.renderer.render({ container: d, target: p }), !this.app.renderer.extract)
310
+ return null;
311
+ const x = this.app.renderer.extract.canvas(p);
312
+ if (!x)
313
+ return null;
314
+ let y = null;
315
+ if (typeof x.toDataURL == "function")
316
+ y = x.toDataURL(`image/${e}`, i);
317
+ else if (typeof x.getContext == "function") {
318
+ const P = document.createElement("canvas");
319
+ P.width = x.width, P.height = x.height;
320
+ const z = P.getContext("2d");
321
+ z && (z.drawImage(x, 0, 0), y = P.toDataURL(`image/${e}`, i));
322
+ }
323
+ return y || null;
324
+ } catch {
325
+ return null;
326
+ } finally {
327
+ p && p.destroy(!0), d.destroy({ children: !0 });
279
328
  }
280
- u.addChild(h);
281
- const p = a.RenderTexture.create({ width: n, height: c });
282
- if (this.app.renderer.render({ container: u, target: p }), !this.app.renderer.extract)
283
- return p.destroy(!0), u.destroy({ children: !0 }), null;
284
- const m = this.app.renderer.extract.canvas(p), x = (k = m.toDataURL) == null ? void 0 : k.call(m, `image/${e}`, i);
285
- return p.destroy(!0), u.destroy({ children: !0 }), x || null;
286
329
  }
287
330
  /**
288
331
  * Resize renderer to container
289
332
  * @param {HTMLElement} container
290
333
  */
291
334
  resizeTo(e) {
292
- if (!this.app || !e) return;
335
+ var r;
336
+ if (!((r = this.app) != null && r.renderer) || !e) return;
293
337
  const i = e.clientWidth, t = e.clientHeight;
294
- if (this.app.renderer.resize(i, t), this.originalTexture && this.sprite) {
295
- const r = {
338
+ if (!(i === Math.round(this.app.screen.width) && t === Math.round(this.app.screen.height)) && !(i <= 0 || t <= 0) && (this.app.renderer.resize(i, t), this.originalTexture && this.sprite)) {
339
+ const a = {
296
340
  x: this.sprite.x + this.sprite.width / 2,
297
341
  y: this.sprite.y + this.sprite.height / 2
298
342
  };
299
- this.fitScale = this.getFitScaleFor(this.originalTexture), this.applyViewTransform({ center: r });
343
+ this.fitScale = this.getFitScaleFor(this.originalTexture), this.applyViewTransform({ center: a });
300
344
  }
301
345
  }
302
346
  /**
@@ -307,14 +351,35 @@ class ee extends N {
307
351
  var i, t;
308
352
  (t = (i = this.app) == null ? void 0 : i.renderer) != null && t.background && (this.app.renderer.background.color = e);
309
353
  }
354
+ /**
355
+ * Load an image URL into an HTMLImageElement.
356
+ * Handles blob:, data:, and http(s): URLs.
357
+ * @param {string} url
358
+ * @returns {Promise<HTMLImageElement|null>}
359
+ */
360
+ _loadImageElement(e) {
361
+ return new Promise((i) => {
362
+ const t = new Image();
363
+ typeof e == "string" && /^https?:\/\//.test(e) && (t.crossOrigin = "anonymous"), t.onload = () => i(t), t.onerror = () => {
364
+ i(null);
365
+ }, t.src = e;
366
+ });
367
+ }
310
368
  /**
311
369
  * Clean up and destroy
312
370
  */
313
371
  destroy() {
314
- this.app && (this.app.destroy(!0, { children: !0, texture: !0 }), this.app = null), this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
372
+ if (this._mountPromise = null, this.app) {
373
+ try {
374
+ this.app.destroy(!0, { children: !0, texture: !0 });
375
+ } catch {
376
+ }
377
+ this.app = null;
378
+ }
379
+ this.sprite = null, this.originalTexture = null, this.baseTexture = null, this._container = null, this.removeAllListeners();
315
380
  }
316
381
  }
317
- const te = {
382
+ const ne = {
318
383
  adjust: ["adjust", "advanced"],
319
384
  // adjustment, adjustmentAdvanced, alpha, colorMatrix
320
385
  blur: ["blur"],
@@ -330,7 +395,7 @@ const te = {
330
395
  stylize: ["stylize"]
331
396
  // ascii, crt, crossHatch, dot, emboss
332
397
  };
333
- class ie extends N {
398
+ class ce extends I {
334
399
  constructor(e, i) {
335
400
  super(), this.state = e, this.renderer = i, this.instances = {}, this._filterRegistry = null;
336
401
  }
@@ -365,11 +430,11 @@ class ie extends N {
365
430
  */
366
431
  getFiltersByCategory(e) {
367
432
  if (!this._filterRegistry) return [];
368
- const i = te[e] || [e], t = [], r = /* @__PURE__ */ new Set();
433
+ const i = ne[e] || [e], t = [], r = /* @__PURE__ */ new Set();
369
434
  for (const a of i) {
370
- const l = this._filterRegistry.getFiltersByCategory(a) || [];
371
- for (const o of l)
372
- r.has(o.id) || (r.add(o.id), t.push(o));
435
+ const o = this._filterRegistry.getFiltersByCategory(a) || [];
436
+ for (const l of o)
437
+ r.has(l.id) || (r.add(l.id), t.push(l));
373
438
  }
374
439
  return t;
375
440
  }
@@ -395,12 +460,12 @@ class ie extends N {
395
460
  }
396
461
  const r = i.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
397
462
  let a = e;
398
- for (let o = 0; o < r.length - 1; o++) {
399
- const n = r[o];
463
+ for (let l = 0; l < r.length - 1; l++) {
464
+ const n = r[l];
400
465
  if (!(n in a) || (a = a[n], a == null)) return;
401
466
  }
402
- const l = r[r.length - 1];
403
- a[l] = t;
467
+ const o = r[r.length - 1];
468
+ a[o] = t;
404
469
  }
405
470
  /**
406
471
  * Initialize filter values from definition defaults
@@ -443,7 +508,7 @@ class ie extends N {
443
508
  this.state.setFilterValue(e, i, r);
444
509
  const a = this.instances[e];
445
510
  if (a) {
446
- const l = this.getFilterDef(e), o = l == null ? void 0 : l.controls.find((c) => c.id === i), n = (o == null ? void 0 : o.property) || i;
511
+ const o = this.getFilterDef(e), l = o == null ? void 0 : o.controls.find((c) => c.id === i), n = (l == null ? void 0 : l.property) || i;
447
512
  return typeof a.updateUIParam == "function" ? (a.updateUIParam(n, r), !0) : (this._setDeepProp(a, n, r), a.uniforms && n in a.uniforms && (a.uniforms[n] = r), !0);
448
513
  }
449
514
  return !1;
@@ -462,15 +527,15 @@ class ie extends N {
462
527
  const i = [], t = [];
463
528
  this.state.get("activeFilters").forEach((a) => {
464
529
  try {
465
- const l = this.getFilterDef(a);
466
- if (!l || !l.createFilter || typeof l.createFilter != "function")
530
+ const o = this.getFilterDef(a);
531
+ if (!o || !o.createFilter || typeof o.createFilter != "function")
467
532
  return;
468
- const o = this.state.getFilterValues(a), n = l.defaultParams ? { ...l.defaultParams } : {};
469
- l.controls && Array.isArray(l.controls) && l.controls.forEach((u) => {
470
- const h = u.property || u.id;
471
- n[h] = o[u.id] ?? u.default;
533
+ const l = this.state.getFilterValues(a), n = o.defaultParams ? { ...o.defaultParams } : {};
534
+ o.controls && Array.isArray(o.controls) && o.controls.forEach((d) => {
535
+ const h = d.property || d.id;
536
+ n[h] = l[d.id] ?? d.default;
472
537
  });
473
- const c = l.createFilter(n);
538
+ const c = o.createFilter(n);
474
539
  c && (i.push(c), this.instances[a] = c);
475
540
  } catch {
476
541
  t.push(a);
@@ -510,9 +575,9 @@ class ie extends N {
510
575
  return this.instances[e] || null;
511
576
  }
512
577
  }
513
- class re extends N {
578
+ const F = class F extends I {
514
579
  constructor(e, i) {
515
- super(), this.state = e, this.renderer = i, this._overlayCanvas = null, this._isDragging = !1, this._dragStart = null, this._dragMode = null, this._startRect = null, this._hoverMode = null, 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);
580
+ super(), this.state = e, this.renderer = i, 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);
516
581
  }
517
582
  /**
518
583
  * Set the overlay canvas element
@@ -527,14 +592,22 @@ class re extends N {
527
592
  * @returns {number|null}
528
593
  */
529
594
  _getAspectRatio(e) {
530
- return {
531
- free: null,
595
+ if (!e || e === "free") return null;
596
+ const i = {
532
597
  "1:1": 1,
533
- "4:3": 1.3333333333333333,
534
- "16:9": 1.7777777777777777,
535
- "3:2": 1.5,
536
- "2:3": 0.6666666666666666
537
- }[e] ?? null;
598
+ "4:3": 4 / 3,
599
+ "16:9": 16 / 9,
600
+ "3:2": 3 / 2,
601
+ "2:3": 2 / 3
602
+ };
603
+ if (i[e] !== void 0) return i[e];
604
+ const t = e.split(":");
605
+ if (t.length === 2) {
606
+ const r = parseFloat(t[0]), a = parseFloat(t[1]);
607
+ if (Number.isFinite(r) && Number.isFinite(a) && a > 0)
608
+ return r / a;
609
+ }
610
+ return null;
538
611
  }
539
612
  /**
540
613
  * Apply aspect ratio constraint to crop rect
@@ -555,13 +628,64 @@ class re extends N {
555
628
  if (!e) return;
556
629
  const i = this.renderer.sprite, t = this.renderer.app;
557
630
  if (!i || !t) return;
558
- const r = this.state.get("crop.shape"), l = r === "circle" ? { x: 0, y: 0, w: t.screen.width, h: t.screen.height } : { x: i.x, y: i.y, w: i.width, h: i.height };
559
- if (e.x = Math.max(l.x, Math.min(e.x, l.x + l.w - e.width)), e.y = Math.max(l.y, Math.min(e.y, l.y + l.h - e.height)), e.width = Math.min(e.width, l.w), e.height = Math.min(e.height, l.h), r !== "free" || this.state.get("crop.aspect") === "1:1") {
560
- const o = Math.min(e.width, e.height);
561
- e.width = o, e.height = o;
631
+ const r = this.state.get("crop.shape"), o = r === "circle" || !!this.state.get("autoZoomOnCropOverflow") ? { x: 0, y: 0, w: t.screen.width, h: t.screen.height } : { x: i.x, y: i.y, w: i.width, h: i.height };
632
+ if (e.x = Math.max(o.x, Math.min(e.x, o.x + o.w - e.width)), e.y = Math.max(o.y, Math.min(e.y, o.y + o.h - e.height)), e.width = Math.min(e.width, o.w), e.height = Math.min(e.height, o.h), r !== "free" || this.state.get("crop.aspect") === "1:1") {
633
+ const l = Math.min(e.width, e.height);
634
+ e.width = l, e.height = l;
562
635
  }
563
636
  this.state.set("crop.rect", e);
564
637
  }
638
+ /**
639
+ * Calculate the target zoom level for auto-zoom when crop exceeds image bounds.
640
+ * Pure function — returns the new zoom level, or null if no adjustment is needed.
641
+ *
642
+ * @param {{ width: number, height: number }} cropRect - Current crop dimensions
643
+ * @param {number} spriteWidth - Current sprite width on screen
644
+ * @param {number} spriteHeight - Current sprite height on screen
645
+ * @param {number} texWidth - Original texture width (pixels)
646
+ * @param {number} texHeight - Original texture height (pixels)
647
+ * @param {number} fitScale - Current fit-to-screen scale
648
+ * @param {number} currentZoom - Current zoom level
649
+ * @returns {number|null} Target zoom level, or null if no zoom needed
650
+ */
651
+ static calcAutoZoom(e, i, t, r, a, o, l) {
652
+ if (!e || !r || !a || !o) return null;
653
+ const n = e.width > i, c = e.height > t;
654
+ if (!n && !c) return null;
655
+ const d = F.AUTO_ZOOM_PADDING;
656
+ let h = l;
657
+ if (n) {
658
+ const p = e.width / (d * r * o);
659
+ h = Math.min(h, p);
660
+ }
661
+ if (c) {
662
+ const p = e.height / (d * a * o);
663
+ h = Math.min(h, p);
664
+ }
665
+ return h = Math.max(0.1, h), h >= l - 0.01 ? null : h;
666
+ }
667
+ /**
668
+ * Check if auto-zoom is needed and apply it (throttled).
669
+ * Called during crop resize drags when autoZoomOnCropOverflow is enabled.
670
+ */
671
+ _checkAutoZoom() {
672
+ if (!this.state.get("autoZoomOnCropOverflow")) return;
673
+ const e = Date.now();
674
+ if (e - this._lastAutoZoomCheck < F.AUTO_ZOOM_THROTTLE_MS) return;
675
+ this._lastAutoZoomCheck = e;
676
+ const i = this.state.get("crop.rect"), t = this.renderer.sprite, r = this.renderer.originalTexture;
677
+ if (!i || !t || !r) return;
678
+ const a = F.calcAutoZoom(
679
+ i,
680
+ t.width,
681
+ t.height,
682
+ r.width,
683
+ r.height,
684
+ this.renderer.fitScale,
685
+ this.renderer.zoom
686
+ );
687
+ a !== null && this.renderer.setZoom(a, { keepCenter: !0 });
688
+ }
565
689
  /**
566
690
  * Draw crop overlay on canvas
567
691
  */
@@ -570,43 +694,43 @@ class re extends N {
570
694
  if (!e) return;
571
695
  const i = this.renderer.app;
572
696
  if (!i) return;
573
- const t = i.canvas, r = t.clientWidth, a = t.clientHeight, l = window.devicePixelRatio || 1;
574
- (e.width !== Math.max(1, Math.floor(r * l)) || e.height !== Math.max(1, Math.floor(a * l))) && (e.width = Math.max(1, Math.floor(r * l)), e.height = Math.max(1, Math.floor(a * l)), e.style.width = r + "px", e.style.height = a + "px");
575
- const o = e.getContext("2d");
576
- if (!o) return;
577
- o.setTransform(l, 0, 0, l, 0, 0), o.clearRect(0, 0, r, a), o.fillStyle = "rgba(0, 0, 0, 0.5)", o.fillRect(0, 0, r, a);
697
+ const t = i.canvas, r = t.clientWidth, a = t.clientHeight, o = window.devicePixelRatio || 1;
698
+ (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");
699
+ const l = e.getContext("2d");
700
+ if (!l) return;
701
+ l.setTransform(o, 0, 0, o, 0, 0), l.clearRect(0, 0, r, a), l.fillStyle = "rgba(0, 0, 0, 0.5)", l.fillRect(0, 0, r, a);
578
702
  const n = this.state.get("crop.rect");
579
703
  if (!n) return;
580
704
  const c = this.state.get("crop.shape");
581
- if (o.save(), c === "circle") {
582
- const y = n.x + n.width / 2, k = n.y + n.height / 2, _ = Math.min(n.width, n.height) / 2;
583
- o.beginPath(), o.arc(y, k, _, 0, Math.PI * 2), o.clip();
705
+ if (l.save(), c === "circle") {
706
+ const _ = n.x + n.width / 2, x = n.y + n.height / 2, y = Math.min(n.width, n.height) / 2;
707
+ l.beginPath(), l.arc(_, x, y, 0, Math.PI * 2), l.clip();
584
708
  } else
585
- o.beginPath(), o.rect(n.x, n.y, n.width, n.height), o.clip();
586
- o.clearRect(n.x, n.y, n.width, n.height), o.restore(), o.strokeStyle = "#ffffff", o.lineWidth = 2, o.setLineDash([5, 5]), c === "circle" ? (o.beginPath(), o.arc(
709
+ l.beginPath(), l.rect(n.x, n.y, n.width, n.height), l.clip();
710
+ l.clearRect(n.x, n.y, n.width, n.height), l.restore(), l.strokeStyle = "#ffffff", l.lineWidth = 2, l.setLineDash([5, 5]), c === "circle" ? (l.beginPath(), l.arc(
587
711
  n.x + n.width / 2,
588
712
  n.y + n.height / 2,
589
713
  Math.min(n.width, n.height) / 2,
590
714
  0,
591
715
  Math.PI * 2
592
- ), o.stroke()) : o.strokeRect(n.x, n.y, n.width, n.height), o.setLineDash([]), o.strokeStyle = "rgba(255,255,255,0.3)", o.lineWidth = 1;
593
- const u = n.width / 3, h = n.height / 3;
594
- for (let y = 1; y <= 2; y++)
595
- o.beginPath(), o.moveTo(n.x + u * y, n.y), o.lineTo(n.x + u * y, n.y + n.height), o.stroke(), o.beginPath(), o.moveTo(n.x, n.y + h * y), o.lineTo(n.x + n.width, n.y + h * y), o.stroke();
716
+ ), l.stroke()) : l.strokeRect(n.x, n.y, n.width, n.height), l.setLineDash([]), l.strokeStyle = "rgba(255,255,255,0.3)", l.lineWidth = 1;
717
+ const d = n.width / 3, h = n.height / 3;
718
+ for (let _ = 1; _ <= 2; _++)
719
+ l.beginPath(), l.moveTo(n.x + d * _, n.y), l.lineTo(n.x + d * _, n.y + n.height), l.stroke(), l.beginPath(), l.moveTo(n.x, n.y + h * _), l.lineTo(n.x + n.width, n.y + h * _), l.stroke();
596
720
  const p = this.HANDLE_SIZE, m = [
597
721
  { x: n.x, y: n.y, m: "resize-nw" },
598
722
  { x: n.x + n.width, y: n.y, m: "resize-ne" },
599
723
  { x: n.x, y: n.y + n.height, m: "resize-sw" },
600
724
  { x: n.x + n.width, y: n.y + n.height, m: "resize-se" }
601
- ], x = [
725
+ ], S = [
602
726
  { x: n.x + n.width / 2, y: n.y, m: "n" },
603
727
  { x: n.x + n.width / 2, y: n.y + n.height, m: "s" },
604
728
  { x: n.x, y: n.y + n.height / 2, m: "w" },
605
729
  { x: n.x + n.width, y: n.y + n.height / 2, m: "e" }
606
- ], b = [...m, ...x];
607
- for (const y of b) {
608
- const k = this._hoverMode === y.m, _ = k ? p + 4 : p;
609
- o.beginPath(), o.rect(y.x - _ / 2, y.y - _ / 2, _, _), o.fillStyle = k ? "#4da3ff" : "#ffffff", o.strokeStyle = "rgba(0,0,0,0.6)", o.lineWidth = 1, o.fill(), o.stroke();
730
+ ], b = [...m, ...S];
731
+ for (const _ of b) {
732
+ const x = this._hoverMode === _.m, y = x ? p + 4 : p;
733
+ l.beginPath(), l.rect(_.x - y / 2, _.y - y / 2, y, y), l.fillStyle = x ? "#4da3ff" : "#ffffff", l.strokeStyle = "rgba(0,0,0,0.6)", l.lineWidth = 1, l.fill(), l.stroke();
610
734
  }
611
735
  }
612
736
  /**
@@ -618,7 +742,7 @@ class re extends N {
618
742
  _hitHandle(e, i) {
619
743
  const t = this.state.get("crop.rect");
620
744
  if (!t) return null;
621
- const r = (a, l, o, n, c) => Math.abs(a - o) <= c && Math.abs(l - n) <= c;
745
+ const r = (a, o, l, n, c) => Math.abs(a - l) <= c && Math.abs(o - n) <= c;
622
746
  return r(e, i, t.x, t.y, this.HANDLE_SIZE) ? "resize-nw" : r(e, i, t.x + t.width, t.y, this.HANDLE_SIZE) ? "resize-ne" : r(e, i, t.x, t.y + t.height, this.HANDLE_SIZE) ? "resize-sw" : r(e, i, t.x + t.width, t.y + t.height, this.HANDLE_SIZE) ? "resize-se" : Math.abs(i - t.y) <= this.EDGE_HIT_PAD && e >= t.x && e <= t.x + t.width ? "n" : Math.abs(i - (t.y + t.height)) <= this.EDGE_HIT_PAD && e >= t.x && e <= t.x + t.width ? "s" : Math.abs(e - t.x) <= this.EDGE_HIT_PAD && i >= t.y && i <= t.y + t.height ? "w" : Math.abs(e - (t.x + t.width)) <= this.EDGE_HIT_PAD && i >= t.y && i <= t.y + t.height ? "e" : e >= t.x && e <= t.x + t.width && i >= t.y && i <= t.y + t.height ? "move" : null;
623
747
  }
624
748
  /**
@@ -628,32 +752,32 @@ class re extends N {
628
752
  const i = this.state.get("crop.rect");
629
753
  if (!i) return;
630
754
  const t = e.global;
631
- this._dragMode = this._hitHandle(t.x, t.y), this._dragMode && (this._isDragging = !0, this._dragStart = { x: t.x, y: t.y }, this._startRect = { ...i });
755
+ this._dragMode = this._hitHandle(t.x, t.y), this._dragMode && (this._isDragging = !0, this._dragStart = { x: t.x, y: t.y }, this._startRect = { ...i }, this._lastAutoZoomCheck = 0);
632
756
  }
633
757
  /**
634
758
  * Handle pointer move event
635
759
  */
636
760
  _handlePointerMove(e) {
637
- var n, c, u, h;
761
+ var n, c, d, h;
638
762
  const i = this.renderer.app;
639
763
  if (!i) return;
640
764
  const t = e.global;
641
765
  if (!this._isDragging || !this._dragStart || !this._startRect) {
642
- this._hoverMode = this._hitHandle(t.x, t.y), i.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (n = this._hoverMode) != null && n.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (u = this._hoverMode) != null && u.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
766
+ this._hoverMode = this._hitHandle(t.x, t.y), i.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (n = this._hoverMode) != null && n.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (d = this._hoverMode) != null && d.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
643
767
  return;
644
768
  }
645
769
  const r = this.state.get("crop.rect");
646
770
  if (!r) return;
647
- const a = t.x - this._dragStart.x, l = t.y - this._dragStart.y;
771
+ const a = t.x - this._dragStart.x, o = t.y - this._dragStart.y;
648
772
  switch (this._dragMode) {
649
773
  case "move":
650
- r.x = this._startRect.x + a, r.y = this._startRect.y + l;
774
+ r.x = this._startRect.x + a, r.y = this._startRect.y + o;
651
775
  break;
652
776
  case "n":
653
- r.y = this._startRect.y + l, r.height = this._startRect.height - l;
777
+ r.y = this._startRect.y + o, r.height = this._startRect.height - o;
654
778
  break;
655
779
  case "s":
656
- r.height = this._startRect.height + l;
780
+ r.height = this._startRect.height + o;
657
781
  break;
658
782
  case "w":
659
783
  r.x = this._startRect.x + a, r.width = this._startRect.width - a;
@@ -662,19 +786,19 @@ class re extends N {
662
786
  r.width = this._startRect.width + a;
663
787
  break;
664
788
  case "resize-nw":
665
- r.x = this._startRect.x + a, r.y = this._startRect.y + l, r.width = this._startRect.width - a, r.height = this._startRect.height - l;
789
+ r.x = this._startRect.x + a, r.y = this._startRect.y + o, r.width = this._startRect.width - a, r.height = this._startRect.height - o;
666
790
  break;
667
791
  case "resize-ne":
668
- r.y = this._startRect.y + l, r.width = this._startRect.width + a, r.height = this._startRect.height - l;
792
+ r.y = this._startRect.y + o, r.width = this._startRect.width + a, r.height = this._startRect.height - o;
669
793
  break;
670
794
  case "resize-sw":
671
- r.x = this._startRect.x + a, r.width = this._startRect.width - a, r.height = this._startRect.height + l;
795
+ r.x = this._startRect.x + a, r.width = this._startRect.width - a, r.height = this._startRect.height + o;
672
796
  break;
673
797
  case "resize-se":
674
- r.width = this._startRect.width + a, r.height = this._startRect.height + l;
798
+ r.width = this._startRect.width + a, r.height = this._startRect.height + o;
675
799
  break;
676
800
  }
677
- 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.constrainCropRect(), this.drawOverlay();
801
+ 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();
678
802
  }
679
803
  /**
680
804
  * Handle pointer up event
@@ -690,8 +814,8 @@ class re extends N {
690
814
  if (!e || !i) return;
691
815
  let t = this.state.get("crop.rect");
692
816
  if (!t) {
693
- const a = Math.min(e.screen.width, e.screen.height) * 0.7, l = i.x + (i.width - a) / 2, o = i.y + (i.height - a) / 2;
694
- t = { x: l, y: o, width: a, height: a }, this.state.set("crop.rect", t), this.state.get("crop.shape") === "circle" && this.state.set("crop.aspect", "1:1"), this.state.get("crop.aspect") !== "free" && (this.applyAspectRatio(), this.constrainCropRect());
817
+ const a = Math.min(e.screen.width, e.screen.height) * 0.7, o = i.x + (i.width - a) / 2, l = i.y + (i.height - a) / 2;
818
+ t = { x: o, y: l, width: a, height: a }, this.state.set("crop.rect", t), this.state.get("crop.shape") === "circle" && this.state.set("crop.aspect", "1:1"), this.state.get("crop.aspect") !== "free" && (this.applyAspectRatio(), this.constrainCropRect());
695
819
  }
696
820
  const r = e.stage;
697
821
  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");
@@ -716,25 +840,25 @@ class re extends N {
716
840
  apply() {
717
841
  const e = this.renderer.app, i = this.renderer.sprite, t = this.renderer.originalTexture, r = this.state.get("crop.rect");
718
842
  if (!r || !i || !e || !t) return null;
719
- const a = window.PIXI, l = this.renderer.zoom, o = t.width / i.width, n = t.height / i.height, c = (r.x - i.x) * o, u = (r.y - i.y) * n;
720
- let h = Math.round(Math.max(1, r.width * o)), p = Math.round(Math.max(1, r.height * n)), m = Math.round(c), x = Math.round(u);
843
+ const a = window.PIXI, o = this.renderer.zoom, l = t.width / i.width, n = t.height / i.height, c = (r.x - i.x) * l, d = (r.y - i.y) * n;
844
+ let h = Math.round(Math.max(1, r.width * l)), p = Math.round(Math.max(1, r.height * n)), m = Math.round(c), S = Math.round(d);
721
845
  if (h <= 0 || p <= 0) return null;
722
- const b = new a.Container(), y = new a.Sprite(t);
846
+ const b = new a.Container(), _ = new a.Sprite(t);
723
847
  if (this.state.get("crop.shape") === "circle") {
724
- const X = Math.round(Math.max(h, p)), W = m + h / 2, Z = x + p / 2;
725
- m = Math.round(W - X / 2), x = Math.round(Z - X / 2), h = p = X;
726
- const F = new a.Graphics();
727
- F.beginFill(16777215, 1), F.drawCircle(h / 2, p / 2, h / 2), F.endFill(), y.mask = F, b.addChild(F);
848
+ const z = Math.round(Math.max(h, p)), ee = m + h / 2, te = S + p / 2;
849
+ m = Math.round(ee - z / 2), S = Math.round(te - z / 2), h = p = z;
850
+ const v = new a.Graphics();
851
+ typeof v.circle == "function" && typeof v.fill == "function" ? v.circle(h / 2, p / 2, h / 2).fill(16777215) : (v.beginFill(16777215, 1), v.drawCircle(h / 2, p / 2, h / 2), v.endFill()), _.mask = v, b.addChild(v);
728
852
  }
729
- y.x = -m, y.y = -x, b.addChild(y);
730
- const _ = a.RenderTexture.create({ width: h, height: p });
853
+ _.x = -m, _.y = -S, b.addChild(_);
854
+ const y = a.RenderTexture.create({ width: h, height: p });
731
855
  e.renderer.render({
732
856
  container: b,
733
- target: _,
857
+ target: y,
734
858
  clear: !0
735
- }), b.destroy({ children: !0 }), this.renderer.originalTexture = _, e.stage.removeChild(i), i.destroy();
736
- const S = new a.Sprite(_);
737
- return e.stage.addChild(S), this.renderer.sprite = S, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(l, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), this.disable(), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: l };
859
+ }), b.destroy({ children: !0 }), this.renderer.originalTexture = y, e.stage.removeChild(i), i.destroy();
860
+ const P = new a.Sprite(y);
861
+ return e.stage.addChild(P), this.renderer.sprite = P, this.renderer.fitScale = this.renderer.getFitScaleFor(y), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), this.disable(), this.emit("applied", { width: h, height: p }), { texture: y, preservedZoom: o };
738
862
  }
739
863
  /**
740
864
  * Cancel crop
@@ -747,17 +871,26 @@ class re extends N {
747
871
  * @param {'free'|'square'|'circle'} shape
748
872
  */
749
873
  setShape(e) {
750
- this.state.set("crop.shape", e), (e === "circle" || e === "square") && this.state.set("crop.aspect", "1:1"), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay();
874
+ 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());
751
875
  }
752
876
  /**
753
877
  * Set aspect ratio
754
- * @param {'free'|'1:1'|'4:3'|'16:9'|'3:2'|'2:3'} aspect
878
+ * @param {'free'|'1:1'|'4:3'|'16:9'|'3:2'|'2:3'|string} aspect
755
879
  */
756
880
  setAspect(e) {
757
- this.state.set("crop.aspect", e), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay();
881
+ this.state.get("lockAspectRatio") || (this.state.set("crop.aspect", e), this.applyAspectRatio(), this.constrainCropRect(), this.drawOverlay());
758
882
  }
759
- }
760
- class se {
883
+ };
884
+ /**
885
+ * Padding factor for auto-zoom: image will be ~91% of crop size (1/1.1).
886
+ * Higher values = more aggressive zoom-out, more padding around image.
887
+ */
888
+ B(F, "AUTO_ZOOM_PADDING", 1.1), /**
889
+ * Minimum interval (ms) between auto-zoom adjustments during drag.
890
+ */
891
+ B(F, "AUTO_ZOOM_THROTTLE_MS", 100);
892
+ let U = F;
893
+ class he {
761
894
  /**
762
895
  * Create a new RemoveBgManager
763
896
  * @param {Object} options
@@ -782,7 +915,7 @@ class se {
782
915
  async removeBackground(e, i = {}) {
783
916
  const t = typeof e == "string" ? await this._dataUrlToBlob(e) : e, r = new FormData();
784
917
  r.append("file", t, "image.png"), r.append("tier", i.tier || "balanced"), i.model && r.append("model", i.model), i.alpha_matting && (r.append("alpha_matting", "true"), r.append("alpha_f", String(i.alpha_f ?? 10)), r.append("alpha_fr", String(i.alpha_fr ?? 15)), r.append("alpha_erode_size", String(i.alpha_erode_size ?? 10)));
785
- let a, l;
918
+ let a, o;
786
919
  try {
787
920
  a = await fetch(this._endpoint, {
788
921
  method: "POST",
@@ -791,7 +924,7 @@ class se {
791
924
  // For Sanctum auth
792
925
  });
793
926
  } catch (c) {
794
- l = c;
927
+ o = c;
795
928
  }
796
929
  if ((!a || !a.ok) && this._fallbackEndpoint)
797
930
  try {
@@ -800,22 +933,22 @@ class se {
800
933
  body: r
801
934
  });
802
935
  } catch (c) {
803
- l || (l = c);
936
+ o || (o = c);
804
937
  }
805
938
  if (!a)
806
- throw l || new Error("Network error: Unable to connect to background removal service");
939
+ throw o || new Error("Network error: Unable to connect to background removal service");
807
940
  if (!a.ok) {
808
941
  let c = `Background removal failed (HTTP ${a.status})`;
809
942
  try {
810
- const u = await a.text();
811
- u && (c += `: ${u}`);
943
+ const d = await a.text();
944
+ d && (c += `: ${d}`);
812
945
  } catch {
813
946
  }
814
947
  throw new Error(c);
815
948
  }
816
- const o = await a.blob();
949
+ const l = await a.blob();
817
950
  return {
818
- dataUrl: await this._blobToDataUrl(o),
951
+ dataUrl: await this._blobToDataUrl(l),
819
952
  model: a.headers.get("X-Model-Used") || "unknown",
820
953
  processMs: a.headers.get("X-Process-Ms") || "0"
821
954
  };
@@ -827,10 +960,10 @@ class se {
827
960
  */
828
961
  async _dataUrlToBlob(e) {
829
962
  if (e.startsWith("data:")) {
830
- const [t, r] = e.split(","), a = t.match(/:(.*?);/), l = a ? a[1] : "image/png", o = atob(r), n = new Uint8Array(o.length);
831
- for (let c = 0; c < o.length; c++)
832
- n[c] = o.charCodeAt(c);
833
- return new Blob([n], { type: l });
963
+ const [t, r] = e.split(","), a = t.match(/:(.*?);/), o = a ? a[1] : "image/png", l = atob(r), n = new Uint8Array(l.length);
964
+ for (let c = 0; c < l.length; c++)
965
+ n[c] = l.charCodeAt(c);
966
+ return new Blob([n], { type: o });
834
967
  }
835
968
  return (await fetch(e)).blob();
836
969
  }
@@ -867,7 +1000,7 @@ class se {
867
1000
  }
868
1001
  }
869
1002
  }
870
- function d(s, e = {}, ...i) {
1003
+ function u(s, e = {}, ...i) {
871
1004
  const t = document.createElement(s);
872
1005
  for (const [r, a] of Object.entries(e))
873
1006
  if (a != null)
@@ -876,24 +1009,24 @@ function d(s, e = {}, ...i) {
876
1009
  else if (r === "style" && typeof a == "object")
877
1010
  Object.assign(t.style, a);
878
1011
  else if (r.startsWith("on") && typeof a == "function") {
879
- const l = r.slice(2).toLowerCase();
880
- t.addEventListener(l, a);
1012
+ const o = r.slice(2).toLowerCase();
1013
+ t.addEventListener(o, a);
881
1014
  } else r === "dataset" && typeof a == "object" ? Object.assign(t.dataset, a) : t.setAttribute(r, a);
882
1015
  for (const r of i)
883
1016
  typeof r == "string" ? t.appendChild(document.createTextNode(r)) : r instanceof HTMLElement && t.appendChild(r);
884
1017
  return t;
885
1018
  }
886
- function ae({ id: s, label: e, min: i = 0, max: t = 1, step: r = 0.01, value: a = 0.5, onChange: l }) {
887
- const o = s.includes("-") ? s.split("-").slice(1).join("-") : s, n = d("div", {
1019
+ function de({ id: s, label: e, min: i = 0, max: t = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
1020
+ const l = s.includes("-") ? s.split("-").slice(1).join("-") : s, n = u("div", {
888
1021
  className: "slider-control slider-wrapper",
889
- "data-control": o,
890
- "data-testid": `slider-${o}`
891
- }), c = d(
1022
+ "data-control": l,
1023
+ "data-testid": `slider-${l}`
1024
+ }), c = u(
892
1025
  "div",
893
1026
  { className: "slider-header" },
894
- d("label", { for: s, className: "slider-label" }, e),
895
- d("span", { className: "slider-value", id: `${s}-value` }, Y(a))
896
- ), u = d("input", {
1027
+ u("label", { for: s, className: "slider-label" }, e),
1028
+ u("span", { className: "slider-value", id: `${s}-value` }, O(a))
1029
+ ), d = u("input", {
897
1030
  type: "range",
898
1031
  id: s,
899
1032
  className: "slider-input",
@@ -903,100 +1036,109 @@ function ae({ id: s, label: e, min: i = 0, max: t = 1, step: r = 0.01, value: a
903
1036
  value: String(a),
904
1037
  onInput: (h) => {
905
1038
  const p = parseFloat(h.target.value), m = n.querySelector(".slider-value");
906
- m && (m.textContent = Y(p)), l == null || l(p);
1039
+ m && (m.textContent = O(p)), o == null || o(p);
907
1040
  }
908
1041
  });
909
- return n.appendChild(c), n.appendChild(u), n.setValue = (h) => {
910
- u.value = String(h);
1042
+ return n.appendChild(c), n.appendChild(d), n.setValue = (h) => {
1043
+ d.value = String(h);
911
1044
  const p = n.querySelector(".slider-value");
912
- p && (p.textContent = Y(h));
1045
+ p && (p.textContent = O(h));
913
1046
  }, n;
914
1047
  }
915
- function Y(s) {
1048
+ function O(s) {
916
1049
  return Number.isInteger(s) ? String(s) : s.toFixed(2);
917
1050
  }
918
- function le({ id: s, label: e, checked: i = !1, onChange: t }) {
919
- const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), l = d("input", {
1051
+ function ue({ id: s, label: e, checked: i = !1, onChange: t }) {
1052
+ const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
920
1053
  type: "checkbox",
921
1054
  id: s,
922
1055
  className: "toggle-input",
923
1056
  checked: i ? "checked" : void 0,
924
1057
  onChange: (c) => t == null ? void 0 : t(c.target.checked)
925
- }), o = d("div", {
1058
+ }), l = u("div", {
926
1059
  className: "toggle-switch",
927
1060
  onClick: (c) => {
928
- c.target !== l && (l.checked = !l.checked, t == null || t(l.checked));
1061
+ c.target !== o && (o.checked = !o.checked, t == null || t(o.checked));
929
1062
  }
930
- }), n = d("span", { className: "toggle-slider" });
931
- return o.appendChild(l), o.appendChild(n), r.appendChild(a), r.appendChild(o), r.setChecked = (c) => {
932
- l.checked = c;
1063
+ }), n = u("span", { className: "toggle-slider" });
1064
+ return l.appendChild(o), l.appendChild(n), r.appendChild(a), r.appendChild(l), r.setChecked = (c) => {
1065
+ o.checked = c;
933
1066
  }, r;
934
1067
  }
935
- function oe({ id: s, label: e, value: i = "#000000", onChange: t }) {
936
- const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), l = d("input", {
1068
+ function pe({ id: s, label: e, value: i = "#000000", onChange: t }) {
1069
+ const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
937
1070
  type: "color",
938
1071
  id: s,
939
1072
  className: "color-input",
940
1073
  value: i,
941
- onInput: (o) => t == null ? void 0 : t(o.target.value)
1074
+ onInput: (l) => t == null ? void 0 : t(l.target.value)
942
1075
  });
943
- return r.appendChild(a), r.appendChild(l), r.setValue = (o) => {
944
- l.value = o;
1076
+ return r.appendChild(a), r.appendChild(o), r.setValue = (l) => {
1077
+ o.value = l;
945
1078
  }, r;
946
1079
  }
947
- function ne({ id: s, label: e, options: i = [], value: t, onChange: r }) {
948
- const a = d("div", { className: "select-control" }), l = d("label", { className: "select-label", for: s }, e), o = d("select", {
1080
+ function fe({ id: s, label: e, options: i = [], value: t, onChange: r }) {
1081
+ const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), l = u("select", {
949
1082
  id: s,
950
1083
  className: "select-input",
951
1084
  onChange: (n) => r == null ? void 0 : r(n.target.value)
952
1085
  });
953
1086
  for (const n of i) {
954
- const c = d("option", { value: n.value }, n.label);
955
- n.value === t && (c.selected = !0), o.appendChild(c);
1087
+ const c = u("option", { value: n.value }, n.label);
1088
+ n.value === t && (c.selected = !0), l.appendChild(c);
956
1089
  }
957
- return a.appendChild(l), a.appendChild(o), a.setValue = (n) => {
958
- o.value = n;
1090
+ return a.appendChild(o), a.appendChild(l), a.setValue = (n) => {
1091
+ l.value = n;
959
1092
  }, a;
960
1093
  }
961
- function A({ label: s, className: e = "", onClick: i, icon: t = null, disabled: r = !1 }) {
962
- const a = d("button", {
1094
+ function T({ label: s, className: e = "", onClick: i, icon: t = null, disabled: r = !1 }) {
1095
+ const a = u("button", {
1096
+ type: "button",
963
1097
  className: `btn ${e}`.trim(),
964
1098
  onClick: i,
965
1099
  disabled: r ? "disabled" : void 0
966
1100
  });
967
1101
  if (t) {
968
- const l = d("span", { className: "btn-icon" });
969
- l.innerHTML = t, a.appendChild(l);
1102
+ const o = u("span", { className: "btn-icon" });
1103
+ o.innerHTML = t;
1104
+ const l = o.querySelector("svg");
1105
+ l && l.setAttribute("aria-hidden", "true"), a.appendChild(o);
970
1106
  }
971
1107
  return s && a.appendChild(document.createTextNode(s)), a;
972
1108
  }
973
- function w({ icon: s, title: e, className: i = "", onClick: t, disabled: r = !1, testId: a = null, ariaLabel: l = null }) {
974
- const o = {
1109
+ function w({ icon: s, title: e, className: i = "", onClick: t, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
1110
+ const l = {
1111
+ type: "button",
975
1112
  className: `icon-btn ${i}`.trim(),
976
1113
  title: e,
977
- "aria-label": l || e,
1114
+ "aria-label": o || e,
978
1115
  onClick: t,
979
1116
  disabled: r ? "disabled" : void 0
980
1117
  };
981
- a && (o.dataset = { testid: a });
982
- const n = d("button", o);
983
- return n.innerHTML = s, n;
1118
+ a && (l.dataset = { testid: a });
1119
+ const n = u("button", l);
1120
+ n.innerHTML = s;
1121
+ const c = n.querySelector("svg");
1122
+ return c && c.setAttribute("aria-hidden", "true"), n;
984
1123
  }
985
- function B({ label: s, icon: e, active: i = !1, onClick: t }) {
986
- const r = d("button", {
1124
+ function D({ label: s, icon: e, active: i = !1, onClick: t }) {
1125
+ const r = u("button", {
1126
+ type: "button",
987
1127
  className: `chip ${i ? "active" : ""}`.trim(),
988
1128
  onClick: t
989
1129
  });
990
1130
  if (e) {
991
- const a = d("span", { className: "chip-icon" });
992
- a.innerHTML = e, r.appendChild(a);
1131
+ const a = u("span", { className: "chip-icon" });
1132
+ a.innerHTML = e;
1133
+ const o = a.querySelector("svg");
1134
+ o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
993
1135
  }
994
- return r.appendChild(d("span", { className: "chip-label" }, s)), r.setActive = (a) => {
1136
+ return r.appendChild(u("span", { className: "chip-label" }, s)), r.setActive = (a) => {
995
1137
  r.classList.toggle("active", a);
996
1138
  }, r;
997
1139
  }
998
- const q = '<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>', H = '<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>', 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="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>', he = '<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>', 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="M432 320v112H320M80 192V80h112M320 80h112v112M192 432H80V320"/></svg>', ue = '<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>', 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="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>', fe = '<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>', me = '<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>', 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="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></svg>', be = '<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>', ye = '<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>', _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="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>', $ = '<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>', G = '<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>', xe = '<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>', 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="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>', L = '<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>', we = '<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>', Se = '<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>', 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="M80 96h64l64 320h64l64-160h96"/></svg>', O = '<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>', V = '<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>', ve = '<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>';
999
- class Pe {
1140
+ const G = '<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>', K = '<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>', me = '<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>', be = '<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>', ye = '<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>', _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="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>', xe = '<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>', 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="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>', 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="M176 112l80-80 80 80M255.98 32l.02 448M176 400l80 80 80-80M400 176l80 80-80 80M112 176l-80 80 80 80M32 256h448"/></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="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>', ve = '<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>', Q = '<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>', J = '<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>', 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="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>', Me = '<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>', j = '<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>', Fe = '<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>', ze = '<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>', 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="M80 96h64l64 320h64l64-160h96"/></svg>', q = '<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>', H = '<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>', 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="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>';
1141
+ class Re {
1000
1142
  constructor(e, i) {
1001
1143
  this.state = e, this.editor = i, this.element = null, this._unsubscribers = [];
1002
1144
  }
@@ -1005,9 +1147,9 @@ class Pe {
1005
1147
  * @returns {HTMLElement}
1006
1148
  */
1007
1149
  render() {
1008
- this.element = d("div", { className: "editor-toolbar" });
1009
- const e = d("div", { className: "toolbar-section toolbar-left" }), i = w({
1010
- icon: Ce,
1150
+ this.element = u("div", { className: "editor-toolbar" });
1151
+ const e = u("div", { className: "toolbar-section toolbar-left" }), i = w({
1152
+ icon: Me,
1011
1153
  title: "Open Image",
1012
1154
  className: "toolbar-btn",
1013
1155
  testId: "btn-open-image",
@@ -1015,8 +1157,8 @@ class Pe {
1015
1157
  onClick: () => this.editor.openFilePicker()
1016
1158
  });
1017
1159
  e.appendChild(i);
1018
- const t = d("div", { className: "toolbar-section toolbar-center" }), r = w({
1019
- icon: he,
1160
+ const t = u("div", { className: "toolbar-section toolbar-center" }), r = w({
1161
+ icon: ge,
1020
1162
  title: "Zoom Out",
1021
1163
  className: "toolbar-btn",
1022
1164
  testId: "btn-zoom-out",
@@ -1026,9 +1168,14 @@ class Pe {
1026
1168
  this.editor.setZoom(h - 0.25);
1027
1169
  }
1028
1170
  });
1029
- this._zoomLabel = d("span", { className: "zoom-label" }, "100%");
1171
+ this._zoomLabel = u("span", {
1172
+ className: "zoom-label",
1173
+ "aria-live": "polite",
1174
+ "aria-atomic": "true",
1175
+ role: "status"
1176
+ }, "100%");
1030
1177
  const a = w({
1031
- icon: ce,
1178
+ icon: me,
1032
1179
  title: "Zoom In",
1033
1180
  className: "toolbar-btn",
1034
1181
  testId: "btn-zoom-in",
@@ -1037,18 +1184,18 @@ class Pe {
1037
1184
  const h = this.state.get("zoom");
1038
1185
  this.editor.setZoom(h + 0.25);
1039
1186
  }
1040
- }), l = w({
1041
- icon: de,
1187
+ }), o = w({
1188
+ icon: be,
1042
1189
  title: "Fit to Screen",
1043
1190
  className: "toolbar-btn",
1044
1191
  testId: "btn-fit-screen",
1045
1192
  ariaLabel: "Fit to screen",
1046
1193
  onClick: () => this.editor.fitToScreen()
1047
1194
  });
1048
- t.appendChild(r), t.appendChild(this._zoomLabel), t.appendChild(a), t.appendChild(l);
1049
- const o = d("div", { className: "toolbar-section toolbar-right" });
1195
+ t.appendChild(r), t.appendChild(this._zoomLabel), t.appendChild(a), t.appendChild(o);
1196
+ const l = u("div", { className: "toolbar-section toolbar-right" });
1050
1197
  this._themeBtn = w({
1051
- icon: this.state.get("isDarkMode") ? O : V,
1198
+ icon: this.state.get("isDarkMode") ? q : H,
1052
1199
  title: "Toggle Theme",
1053
1200
  className: "toolbar-btn",
1054
1201
  testId: "btn-toggle-theme",
@@ -1056,28 +1203,28 @@ class Pe {
1056
1203
  onClick: () => this.editor.toggleTheme()
1057
1204
  });
1058
1205
  const n = w({
1059
- icon: G,
1206
+ icon: J,
1060
1207
  title: "Reset All",
1061
1208
  className: "toolbar-btn",
1062
1209
  testId: "btn-reset-all",
1063
1210
  ariaLabel: "Reset all changes",
1064
1211
  onClick: () => this.editor.resetAll()
1065
1212
  }), c = w({
1066
- icon: _e,
1213
+ icon: ve,
1067
1214
  title: "Save Image",
1068
1215
  className: "toolbar-btn toolbar-btn-primary",
1069
- testId: "btn-save-image",
1216
+ testId: "btn-save-edit",
1070
1217
  ariaLabel: "Save image",
1071
1218
  onClick: () => this.editor.save()
1072
- }), u = w({
1073
- icon: $,
1219
+ }), d = w({
1220
+ icon: Q,
1074
1221
  title: "Close",
1075
1222
  className: "toolbar-btn",
1076
- testId: "btn-close",
1223
+ testId: "btn-cancel-edit",
1077
1224
  ariaLabel: "Close editor",
1078
1225
  onClick: () => this.editor.close()
1079
1226
  });
1080
- return o.appendChild(this._themeBtn), o.appendChild(n), o.appendChild(c), o.appendChild(u), this.element.appendChild(e), this.element.appendChild(t), this.element.appendChild(o), this._subscribeToState(), this.element;
1227
+ return l.appendChild(this._themeBtn), l.appendChild(n), l.appendChild(c), l.appendChild(d), this.element.appendChild(e), this.element.appendChild(t), this.element.appendChild(l), this._subscribeToState(), this.element;
1081
1228
  }
1082
1229
  /**
1083
1230
  * Subscribe to state changes
@@ -1088,7 +1235,7 @@ class Pe {
1088
1235
  });
1089
1236
  this._unsubscribers.push(e);
1090
1237
  const i = this.state.on("change:isDarkMode", ({ value: t }) => {
1091
- this._themeBtn.innerHTML = t ? O : V;
1238
+ this._themeBtn.innerHTML = t ? q : H;
1092
1239
  });
1093
1240
  this._unsubscribers.push(i);
1094
1241
  }
@@ -1107,24 +1254,24 @@ class Pe {
1107
1254
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], (e = this.element) == null || e.remove(), this.element = null;
1108
1255
  }
1109
1256
  }
1110
- const R = [
1111
- { id: "adjust", name: "Adjust", icon: ue },
1257
+ const X = [
1258
+ { id: "adjust", name: "Adjust", icon: ye },
1112
1259
  // adjustment, adjustmentAdvanced, alpha
1113
- { id: "blur", name: "Blur", icon: pe },
1260
+ { id: "blur", name: "Blur", icon: _e },
1114
1261
  // blur, kawaseBlur, motionBlur, radialBlur, etc.
1115
- { id: "color", name: "Color", icon: fe },
1262
+ { id: "color", name: "Color", icon: xe },
1116
1263
  // colorOverlay, grayscale, hslAdjustment, etc.
1117
- { id: "effects", name: "Effects", icon: me },
1264
+ { id: "effects", name: "Effects", icon: Ce },
1118
1265
  // noise, vignette, pixelate, dropShadow, etc.
1119
- { id: "distortion", name: "Distortion", icon: ge },
1266
+ { id: "distortion", name: "Distortion", icon: we },
1120
1267
  // twist, bulgePinch, displacement, etc.
1121
- { id: "light", name: "Light", icon: be },
1268
+ { id: "light", name: "Light", icon: Se },
1122
1269
  // bloom, glow, godray, advancedBloom
1123
- { id: "stylize", name: "Stylize", icon: ve },
1270
+ { id: "stylize", name: "Stylize", icon: Ne },
1124
1271
  // ascii, crt, crossHatch, dot, emboss
1125
- { id: "crop", name: "Crop", icon: ye }
1272
+ { id: "crop", name: "Crop", icon: ke }
1126
1273
  ];
1127
- class Me {
1274
+ class Te {
1128
1275
  constructor(e, i) {
1129
1276
  this.state = e, this.editor = i, this.element = null, this._chips = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [];
1130
1277
  }
@@ -1134,16 +1281,16 @@ class Me {
1134
1281
  * @returns {HTMLElement}
1135
1282
  */
1136
1283
  render(e) {
1137
- this._onSelect = e, this.element = d("div", {
1284
+ this._onSelect = e, this.element = u("div", {
1138
1285
  className: "category-carousel-container",
1139
1286
  "data-testid": "category-carousel"
1140
1287
  }), this._leftBtn = w({
1141
- icon: q,
1288
+ icon: G,
1142
1289
  title: "Previous categories",
1143
1290
  className: "carousel-nav carousel-nav-left",
1144
1291
  onClick: () => this._scrollLeft()
1145
- }), this._carousel = d("div", { className: "category-carousel" }), R.forEach((t) => {
1146
- const r = B({
1292
+ }), this._carousel = u("div", { className: "category-carousel" }), X.forEach((t) => {
1293
+ const r = D({
1147
1294
  label: t.name,
1148
1295
  icon: t.icon,
1149
1296
  active: this.state.get("selectedCategory") === t.id,
@@ -1151,15 +1298,23 @@ class Me {
1151
1298
  });
1152
1299
  r.dataset.categoryId = t.id, r.dataset.category = t.id, r.dataset.testid = `category-${t.id}`, this._chips.set(t.id, r), this._carousel.appendChild(r);
1153
1300
  }), this._rightBtn = w({
1154
- icon: H,
1301
+ icon: K,
1155
1302
  title: "Next categories",
1156
1303
  className: "carousel-nav carousel-nav-right",
1157
1304
  onClick: () => this._scrollRight()
1158
- }), this._pagination = d("div", { className: "carousel-pagination" });
1159
- const i = Math.ceil(R.length / 3);
1305
+ }), this._pagination = u("div", {
1306
+ className: "carousel-pagination",
1307
+ role: "tablist",
1308
+ "aria-label": "Category pages"
1309
+ });
1310
+ const i = Math.ceil(X.length / 3);
1160
1311
  for (let t = 0; t < i; t++) {
1161
- const r = d("span", {
1312
+ const r = u("button", {
1313
+ type: "button",
1162
1314
  className: `pagination-dot ${t === 0 ? "active" : ""}`,
1315
+ role: "tab",
1316
+ "aria-label": `Page ${t + 1} of ${i}`,
1317
+ "aria-selected": t === 0 ? "true" : "false",
1163
1318
  onClick: () => this._scrollToPage(t)
1164
1319
  });
1165
1320
  this._pagination.appendChild(r);
@@ -1195,7 +1350,7 @@ class Me {
1195
1350
  * Scroll carousel right
1196
1351
  */
1197
1352
  _scrollRight() {
1198
- this._scrollIndex < R.length - 3 && (this._scrollIndex++, this._scrollCarousel());
1353
+ this._scrollIndex < X.length - 3 && (this._scrollIndex++, this._scrollCarousel());
1199
1354
  }
1200
1355
  /**
1201
1356
  * Scroll to a specific page
@@ -1222,7 +1377,7 @@ class Me {
1222
1377
  * Update navigation button states
1223
1378
  */
1224
1379
  _updateNavButtons() {
1225
- this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= R.length - 3);
1380
+ this._leftBtn && (this._leftBtn.disabled = this._scrollIndex === 0), this._rightBtn && (this._rightBtn.disabled = this._scrollIndex >= X.length - 3);
1226
1381
  }
1227
1382
  /**
1228
1383
  * Update pagination dot states
@@ -1231,7 +1386,8 @@ class Me {
1231
1386
  if (this._pagination) {
1232
1387
  const e = this._pagination.querySelectorAll(".pagination-dot"), i = Math.floor(this._scrollIndex / 3);
1233
1388
  e.forEach((t, r) => {
1234
- t.classList.toggle("active", r === i);
1389
+ const a = r === i;
1390
+ t.classList.toggle("active", a), t.setAttribute("aria-selected", a ? "true" : "false");
1235
1391
  });
1236
1392
  }
1237
1393
  }
@@ -1250,7 +1406,7 @@ class Me {
1250
1406
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], this._chips.clear(), (e = this.element) == null || e.remove(), this.element = null;
1251
1407
  }
1252
1408
  }
1253
- class Fe {
1409
+ class Ie {
1254
1410
  constructor(e, i) {
1255
1411
  this.state = e, this.filterManager = i, this.element = null, this._filterCards = /* @__PURE__ */ new Map(), this._scrollIndex = 0, this._unsubscribers = [], this._onToggle = null, this._onSelect = null;
1256
1412
  }
@@ -1260,13 +1416,13 @@ class Fe {
1260
1416
  * @returns {HTMLElement}
1261
1417
  */
1262
1418
  render({ onToggle: e, onSelect: i }) {
1263
- return this._onToggle = e, this._onSelect = i, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = w({
1264
- icon: q,
1419
+ return this._onToggle = e, this._onSelect = i, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = w({
1420
+ icon: G,
1265
1421
  title: "Previous filters",
1266
1422
  className: "carousel-nav carousel-nav-left",
1267
1423
  onClick: () => this._scrollLeft()
1268
- }), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = w({
1269
- icon: H,
1424
+ }), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = w({
1425
+ icon: K,
1270
1426
  title: "Next filters",
1271
1427
  className: "carousel-nav carousel-nav-right",
1272
1428
  onClick: () => this._scrollRight()
@@ -1298,11 +1454,11 @@ class Fe {
1298
1454
  if (e === "crop") return;
1299
1455
  const i = this.filterManager.getFiltersByCategory(e), t = this.state.get("activeFilters"), r = this.state.get("selectedFilter");
1300
1456
  i.forEach((a) => {
1301
- const l = this._createFilterCard(a, {
1457
+ const o = this._createFilterCard(a, {
1302
1458
  isActive: t.has(a.id),
1303
1459
  isSelected: r === a.id
1304
1460
  });
1305
- this._filterCards.set(a.id, l), this._carousel.appendChild(l);
1461
+ this._filterCards.set(a.id, o), this._carousel.appendChild(o);
1306
1462
  }), this._updateNavButtons();
1307
1463
  }
1308
1464
  /**
@@ -1312,14 +1468,14 @@ class Fe {
1312
1468
  * @returns {HTMLElement}
1313
1469
  */
1314
1470
  _createFilterCard(e, { isActive: i, isSelected: t }) {
1315
- const r = d("div", {
1471
+ const r = u("div", {
1316
1472
  className: `filter-card ${i ? "active" : ""} ${t ? "selected" : ""}`,
1317
1473
  "data-filter": e.id,
1318
1474
  "data-testid": `filter-${e.id}`,
1319
1475
  onClick: () => this._handleCardClick(e.id)
1320
- }), a = d("div", { className: "filter-preview" }), l = d("span", { className: "filter-preview-text" }, e.name.charAt(0));
1321
- a.appendChild(l);
1322
- const o = d("span", { className: "filter-name", title: e.name }, e.name), n = d("button", {
1476
+ }), a = u("div", { className: "filter-preview" }), o = u("span", { className: "filter-preview-text" }, e.name.charAt(0));
1477
+ a.appendChild(o);
1478
+ const l = u("span", { className: "filter-name", title: e.name }, e.name), n = u("button", {
1323
1479
  className: `filter-toggle ${i ? "active" : ""}`,
1324
1480
  onClick: (c) => {
1325
1481
  var p;
@@ -1328,7 +1484,7 @@ class Fe {
1328
1484
  this._handleToggle(e.id, h), h && (this.state.set("selectedFilter", e.id), (p = this._onSelect) == null || p.call(this, e.id));
1329
1485
  }
1330
1486
  });
1331
- return n.innerHTML = i ? L : "", r.appendChild(a), r.appendChild(o), r.appendChild(n), r._toggle = n, r._isActive = i, r;
1487
+ return n.innerHTML = i ? j : "", r.appendChild(a), r.appendChild(l), r.appendChild(n), r._toggle = n, r._isActive = i, r;
1332
1488
  }
1333
1489
  /**
1334
1490
  * Handle filter card click (select)
@@ -1354,7 +1510,7 @@ class Fe {
1354
1510
  const e = this.state.get("activeFilters");
1355
1511
  this._filterCards.forEach((i, t) => {
1356
1512
  const r = e.has(t);
1357
- i.classList.toggle("active", r), i._toggle.classList.toggle("active", r), i._toggle.innerHTML = r ? L : "", i._isActive = r;
1513
+ i.classList.toggle("active", r), i._toggle.classList.toggle("active", r), i._toggle.innerHTML = r ? j : "", i._isActive = r;
1358
1514
  });
1359
1515
  }
1360
1516
  /**
@@ -1407,7 +1563,7 @@ class Fe {
1407
1563
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], this._filterCards.clear(), (e = this.element) == null || e.remove(), this.element = null;
1408
1564
  }
1409
1565
  }
1410
- class ze {
1566
+ class Xe {
1411
1567
  constructor(e, i) {
1412
1568
  this.state = e, this.filterManager = i, this.element = null, this._controls = /* @__PURE__ */ new Map(), this._onChange = null, this._onReset = null, this._onAction = null, this._unsubscribers = [];
1413
1569
  }
@@ -1417,7 +1573,7 @@ class ze {
1417
1573
  * @returns {HTMLElement}
1418
1574
  */
1419
1575
  render({ onChange: e, onReset: i, onAction: t }) {
1420
- return this._onChange = e, this._onReset = i, this._onAction = t, this.element = d("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
1576
+ return this._onChange = e, this._onReset = i, this._onAction = t, this.element = u("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
1421
1577
  }
1422
1578
  /**
1423
1579
  * Subscribe to state changes
@@ -1440,27 +1596,27 @@ class ze {
1440
1596
  const e = this.state.get("selectedFilter");
1441
1597
  if (!e) {
1442
1598
  this.element.appendChild(
1443
- d("div", { className: "no-filter-selected" }, "Select a filter to adjust")
1599
+ u("div", { className: "no-filter-selected" }, "Select a filter to adjust")
1444
1600
  );
1445
1601
  return;
1446
1602
  }
1447
1603
  const i = this.filterManager.getFilterDef(e);
1448
1604
  if (!i) {
1449
1605
  this.element.appendChild(
1450
- d("div", { className: "no-filter-selected" }, "Filter not found")
1606
+ u("div", { className: "no-filter-selected" }, "Filter not found")
1451
1607
  );
1452
1608
  return;
1453
1609
  }
1454
- const t = d("div", { className: "adjustments-header" });
1455
- t.appendChild(d("span", { className: "adjustments-title" }, i.name)), t.appendChild(A({
1610
+ const t = u("div", { className: "adjustments-header" });
1611
+ t.appendChild(u("span", { className: "adjustments-title" }, i.name)), t.appendChild(T({
1456
1612
  label: "Reset",
1457
1613
  className: "btn-text",
1458
1614
  onClick: () => this._handleReset(e)
1459
1615
  })), this.element.appendChild(t);
1460
- const r = d("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
1461
- i.controls.forEach((l) => {
1462
- const o = this._createControl(e, l, a[l.id] ?? l.default);
1463
- o && (this._controls.set(l.id, o), r.appendChild(o));
1616
+ const r = u("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
1617
+ i.controls.forEach((o) => {
1618
+ const l = this._createControl(e, o, a[o.id] ?? o.default);
1619
+ l && (this._controls.set(o.id, l), r.appendChild(l));
1464
1620
  }), this.element.appendChild(r);
1465
1621
  }
1466
1622
  /**
@@ -1475,7 +1631,7 @@ class ze {
1475
1631
  const r = i.label || i.id;
1476
1632
  switch (this._normalizeControlType(i.type)) {
1477
1633
  case "slider":
1478
- return ae({
1634
+ return de({
1479
1635
  id: `${e}-${i.id}`,
1480
1636
  label: r,
1481
1637
  min: i.min ?? 0,
@@ -1485,35 +1641,35 @@ class ze {
1485
1641
  onChange: (n) => this._handleChange(e, i.id, n)
1486
1642
  });
1487
1643
  case "toggle":
1488
- return le({
1644
+ return ue({
1489
1645
  id: `${e}-${i.id}`,
1490
1646
  label: r,
1491
1647
  checked: !!t,
1492
1648
  onChange: (n) => this._handleChange(e, i.id, n)
1493
1649
  });
1494
1650
  case "color":
1495
- return oe({
1651
+ return pe({
1496
1652
  id: `${e}-${i.id}`,
1497
1653
  label: r,
1498
1654
  value: typeof t == "string" && t.startsWith("#") ? t : i.default || "#000000",
1499
1655
  onChange: (n) => this._handleChange(e, i.id, n)
1500
1656
  });
1501
1657
  case "select":
1502
- const l = this._normalizeOptions(i.options);
1503
- return ne({
1658
+ const o = this._normalizeOptions(i.options);
1659
+ return fe({
1504
1660
  id: `${e}-${i.id}`,
1505
1661
  label: r,
1506
- options: l,
1662
+ options: o,
1507
1663
  value: t ?? i.default,
1508
1664
  onChange: (n) => this._handleChange(e, i.id, n)
1509
1665
  });
1510
1666
  case "button":
1511
- const o = d("div", { className: "button-control" });
1512
- return o.appendChild(A({
1667
+ const l = u("div", { className: "button-control" });
1668
+ return l.appendChild(T({
1513
1669
  label: r,
1514
1670
  className: "btn-secondary",
1515
1671
  onClick: () => this._handleAction(e, i.action || i.id)
1516
- })), o;
1672
+ })), l;
1517
1673
  default:
1518
1674
  return null;
1519
1675
  }
@@ -1585,8 +1741,8 @@ class ze {
1585
1741
  t && t.controls.forEach((r) => {
1586
1742
  const a = this._controls.get(r.id);
1587
1743
  if (a && typeof a.setValue == "function") {
1588
- const l = i[r.id] ?? r.default;
1589
- a.setValue(l);
1744
+ const o = i[r.id] ?? r.default;
1745
+ a.setValue(o);
1590
1746
  }
1591
1747
  });
1592
1748
  }
@@ -1610,11 +1766,11 @@ class ze {
1610
1766
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], this._controls.clear(), (e = this.element) == null || e.remove(), this.element = null;
1611
1767
  }
1612
1768
  }
1613
- const Ae = [
1614
- { id: "free", name: "Free", icon: ke },
1615
- { id: "square", name: "Square", icon: we },
1616
- { id: "circle", name: "Circle", icon: Se }
1617
- ], Ne = [
1769
+ const Ee = [
1770
+ { id: "free", name: "Free", icon: Ae },
1771
+ { id: "square", name: "Square", icon: Fe },
1772
+ { id: "circle", name: "Circle", icon: ze }
1773
+ ], Ye = [
1618
1774
  { id: "free", name: "Free" },
1619
1775
  { id: "1:1", name: "1:1" },
1620
1776
  { id: "4:3", name: "4:3" },
@@ -1622,7 +1778,7 @@ const Ae = [
1622
1778
  { id: "3:2", name: "3:2" },
1623
1779
  { id: "2:3", name: "2:3" }
1624
1780
  ];
1625
- class Re {
1781
+ class Be {
1626
1782
  constructor(e, i) {
1627
1783
  this.state = e, this.cropManager = i, this.element = null, this._shapeChips = /* @__PURE__ */ new Map(), this._aspectChips = /* @__PURE__ */ new Map(), this._unsubscribers = [];
1628
1784
  }
@@ -1631,45 +1787,45 @@ class Re {
1631
1787
  * @returns {HTMLElement}
1632
1788
  */
1633
1789
  render() {
1634
- this.element = d("div", {
1790
+ this.element = u("div", {
1635
1791
  className: "crop-controls",
1636
1792
  "data-testid": "crop-controls"
1637
1793
  });
1638
- const e = d("div", { className: "crop-section" });
1639
- e.appendChild(d("label", { className: "section-label" }, "Shape"));
1640
- const i = d("div", { className: "chip-row" }), t = this.state.get("crop.shape");
1641
- Ae.forEach((c) => {
1642
- const u = B({
1794
+ const e = u("div", { className: "crop-section" });
1795
+ e.appendChild(u("label", { className: "section-label" }, "Shape"));
1796
+ const i = u("div", { className: "chip-row" }), t = this.state.get("crop.shape");
1797
+ Ee.forEach((c) => {
1798
+ const d = D({
1643
1799
  label: c.name,
1644
1800
  icon: c.icon,
1645
1801
  active: t === c.id,
1646
1802
  onClick: () => this._selectShape(c.id)
1647
1803
  });
1648
- u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), i.appendChild(u);
1649
- }), e.appendChild(i), this.element.appendChild(e), this._aspectSection = d("div", { className: "crop-section" }), this._aspectSection.appendChild(d("label", { className: "section-label" }, "Aspect Ratio"));
1650
- const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
1651
- Ne.forEach((c) => {
1652
- const u = B({
1804
+ d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), i.appendChild(d);
1805
+ }), e.appendChild(i), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = u("div", { className: "crop-section" }), this._aspectSection.appendChild(u("label", { className: "section-label" }, "Aspect Ratio"));
1806
+ const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
1807
+ Ye.forEach((c) => {
1808
+ const d = D({
1653
1809
  label: c.name,
1654
1810
  active: a === c.id,
1655
1811
  onClick: () => this._selectAspect(c.id)
1656
1812
  });
1657
- u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
1813
+ d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
1658
1814
  }), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
1659
- const l = d("div", { className: "crop-actions" }), o = A({
1815
+ const o = u("div", { className: "crop-actions" }), l = T({
1660
1816
  label: "Cancel",
1661
1817
  className: "btn-secondary crop-cancel-btn",
1662
- icon: $,
1818
+ icon: Q,
1663
1819
  onClick: () => this.cropManager.cancel()
1664
1820
  });
1665
- o.dataset.testid = "cancel-crop";
1666
- const n = A({
1821
+ l.dataset.testid = "cancel-crop";
1822
+ const n = T({
1667
1823
  label: "Apply Crop",
1668
1824
  className: "btn-primary crop-apply-btn",
1669
- icon: L,
1825
+ icon: j,
1670
1826
  onClick: () => this.cropManager.apply()
1671
1827
  });
1672
- return n.dataset.testid = "apply-crop", l.appendChild(o), l.appendChild(n), this.element.appendChild(l), this._subscribeToState(), this.element;
1828
+ return n.dataset.testid = "apply-crop", o.appendChild(l), o.appendChild(n), this.element.appendChild(o), this._subscribeToState(), this.element;
1673
1829
  }
1674
1830
  /**
1675
1831
  * Subscribe to state changes
@@ -1706,8 +1862,8 @@ class Re {
1706
1862
  * Update aspect ratio section visibility
1707
1863
  */
1708
1864
  _updateAspectVisibility() {
1709
- const e = this.state.get("crop.shape");
1710
- this._aspectSection && (this._aspectSection.style.display = e === "free" ? "" : "none");
1865
+ const e = this.state.get("crop.shape"), i = this.state.get("lockAspectRatio");
1866
+ this._aspectSection && (this._aspectSection.style.display = e === "free" && !i ? "" : "none");
1711
1867
  }
1712
1868
  /**
1713
1869
  * Show controls
@@ -1729,7 +1885,7 @@ class Re {
1729
1885
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], this._shapeChips.clear(), this._aspectChips.clear(), (e = this.element) == null || e.remove(), this.element = null;
1730
1886
  }
1731
1887
  }
1732
- class Te {
1888
+ class Oe {
1733
1889
  constructor(e, i) {
1734
1890
  this.state = e, this.filterManager = i, 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;
1735
1891
  }
@@ -1739,18 +1895,18 @@ class Te {
1739
1895
  * @returns {HTMLElement}
1740
1896
  */
1741
1897
  render({ onRemove: e, onReset: i, onClearAll: t, onUpdateValue: r, onSelect: a }) {
1742
- this._onRemove = e, this._onReset = i, this._onClearAll = t, this._onUpdateValue = r, this._onSelect = a, this.element = d("div", {
1898
+ this._onRemove = e, this._onReset = i, this._onClearAll = t, this._onUpdateValue = r, this._onSelect = a, this.element = u("div", {
1743
1899
  className: "active-filters-panel",
1744
1900
  "data-testid": "active-filters-panel"
1745
1901
  });
1746
- const l = d("div", { className: "panel-header" });
1747
- l.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
1748
- const o = A({
1902
+ const o = u("div", { className: "panel-header" });
1903
+ o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
1904
+ const l = T({
1749
1905
  label: "Clear All",
1750
1906
  className: "btn-text btn-danger",
1751
1907
  onClick: () => this._handleClearAll()
1752
1908
  });
1753
- return o.dataset.testid = "clear-all-filters", l.appendChild(o), this.element.appendChild(l), this._listContainer = d("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
1909
+ return l.dataset.testid = "clear-all-filters", o.appendChild(l), this.element.appendChild(o), this._listContainer = u("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
1754
1910
  }
1755
1911
  /**
1756
1912
  * Subscribe to state changes
@@ -1786,7 +1942,7 @@ class Te {
1786
1942
  const e = this.state.get("activeFilters");
1787
1943
  if (e.size === 0) {
1788
1944
  this._listContainer.appendChild(
1789
- d("div", { className: "no-filters-message" }, "No filters active")
1945
+ u("div", { className: "no-filters-message" }, "No filters active")
1790
1946
  );
1791
1947
  return;
1792
1948
  }
@@ -1804,26 +1960,26 @@ class Te {
1804
1960
  * @returns {HTMLElement}
1805
1961
  */
1806
1962
  _createFilterItem(e, i) {
1807
- const r = this.state.get("selectedFilter") === e, a = d("div", {
1963
+ const r = this.state.get("selectedFilter") === e, a = u("div", {
1808
1964
  className: `active-filter-item ${r ? "selected" : ""}`,
1809
1965
  "data-active-filter": e,
1810
1966
  "data-testid": `active-filter-${e}`,
1811
1967
  onClick: (m) => {
1812
1968
  m.target.closest(".filter-item-actions") || this._handleSelect(e);
1813
1969
  }
1814
- }), l = d("div", { className: "filter-item-header" }), o = d("span", { className: "filter-item-name" }, i.name), n = d("div", { className: "filter-item-actions" }), c = w({
1815
- icon: G,
1970
+ }), o = u("div", { className: "filter-item-header" }), l = u("span", { className: "filter-item-name" }, i.name), n = u("div", { className: "filter-item-actions" }), c = w({
1971
+ icon: J,
1816
1972
  title: "Reset filter",
1817
1973
  className: "btn-icon-sm",
1818
1974
  onClick: () => this._handleReset(e)
1819
- }), u = w({
1820
- icon: xe,
1975
+ }), d = w({
1976
+ icon: Pe,
1821
1977
  title: "Remove filter",
1822
1978
  className: "btn-icon-sm btn-danger",
1823
1979
  onClick: () => this._handleRemove(e)
1824
1980
  });
1825
- n.appendChild(c), n.appendChild(u), l.appendChild(o), l.appendChild(n), a.appendChild(l);
1826
- const h = this.state.getFilterValues(e), p = d("div", { className: "filter-item-summary" });
1981
+ n.appendChild(c), n.appendChild(d), o.appendChild(l), o.appendChild(n), a.appendChild(o);
1982
+ const h = this.state.getFilterValues(e), p = u("div", { className: "filter-item-summary" });
1827
1983
  return p.textContent = this._getValuesSummary(i, h), a.appendChild(p), a._summaryEl = p, a;
1828
1984
  }
1829
1985
  /**
@@ -1856,8 +2012,8 @@ class Te {
1856
2012
  return e.controls.forEach((r) => {
1857
2013
  const a = this._normalizeControlType(r.type);
1858
2014
  if (a === "button") return;
1859
- const l = r.label || r.id, o = i[r.id] ?? r.default;
1860
- o !== r.default && (a === "slider" ? t.push(`${l}: ${this._formatValue(o)}`) : a === "toggle" ? o && t.push(l) : a === "color" ? t.push(`${l}: ${o}`) : a === "select" && t.push(`${l}: ${o}`));
2015
+ const o = r.label || r.id, l = i[r.id] ?? r.default;
2016
+ l !== r.default && (a === "slider" ? t.push(`${o}: ${this._formatValue(l)}`) : a === "toggle" ? l && t.push(o) : a === "color" ? t.push(`${o}: ${l}`) : a === "select" && t.push(`${o}: ${l}`));
1861
2017
  }), t.length > 0 ? t.join(", ") : "Default values";
1862
2018
  }
1863
2019
  /**
@@ -1930,17 +2086,78 @@ class Te {
1930
2086
  this._unsubscribers.forEach((i) => i()), this._unsubscribers = [], this._filterItems.clear(), (e = this.element) == null || e.remove(), this.element = null;
1931
2087
  }
1932
2088
  }
1933
- class vt extends N {
2089
+ const N = {
2090
+ name: "free",
2091
+ initialMode: "filters",
2092
+ cropShape: "free",
2093
+ aspectRatio: "free",
2094
+ autoZoomOnCropOverflow: !1,
2095
+ lockCropShape: !1,
2096
+ lockAspectRatio: !1,
2097
+ showFilters: !0,
2098
+ showCropControls: !0,
2099
+ maxExportWidth: void 0,
2100
+ maxExportHeight: void 0
2101
+ }, L = {
2102
+ free: {
2103
+ ...N
2104
+ },
2105
+ avatar: {
2106
+ ...N,
2107
+ name: "avatar",
2108
+ initialMode: "crop",
2109
+ cropShape: "circle",
2110
+ aspectRatio: "1:1",
2111
+ autoZoomOnCropOverflow: !0,
2112
+ lockCropShape: !0,
2113
+ lockAspectRatio: !0
2114
+ },
2115
+ banner: {
2116
+ ...N,
2117
+ name: "banner",
2118
+ initialMode: "crop",
2119
+ cropShape: "square",
2120
+ aspectRatio: "16:9",
2121
+ autoZoomOnCropOverflow: !1,
2122
+ lockCropShape: !1,
2123
+ lockAspectRatio: !0
2124
+ },
2125
+ product: {
2126
+ ...N,
2127
+ name: "product",
2128
+ initialMode: "filters",
2129
+ cropShape: "square",
2130
+ aspectRatio: "1:1",
2131
+ autoZoomOnCropOverflow: !1,
2132
+ lockCropShape: !1,
2133
+ lockAspectRatio: !1
2134
+ }
2135
+ };
2136
+ function Le(s) {
2137
+ if (!s)
2138
+ return { ...L.free };
2139
+ if (typeof s == "object" && s !== null)
2140
+ return { ...N, ...s };
2141
+ const e = L[s];
2142
+ return e ? { ...e } : { ...L.free };
2143
+ }
2144
+ class Tt extends I {
1934
2145
  /**
1935
2146
  * Create a new VanillaImageEditor
1936
2147
  * @param {HTMLElement} container - Container element to mount the editor
1937
2148
  * @param {Object} options - Configuration options
1938
2149
  */
1939
2150
  constructor(e, i = {}) {
1940
- var t, r, a;
2151
+ var a, o, l;
1941
2152
  if (super(), !e)
1942
2153
  throw new Error("VanillaImageEditor: container element is required");
1943
- this._container = e, this._options = {
2154
+ this._container = e;
2155
+ const t = i.preset ? Le(i.preset) : null, r = t ? {
2156
+ initialMode: t.initialMode === "crop" ? "crop" : "adjust",
2157
+ cropShape: t.cropShape,
2158
+ initialAspectRatio: t.aspectRatio
2159
+ } : {};
2160
+ this._options = {
1944
2161
  theme: "auto",
1945
2162
  initialImage: null,
1946
2163
  initialMode: "adjust",
@@ -1951,10 +2168,11 @@ class vt extends N {
1951
2168
  endpoint: "/api/v1/media/remove-bg",
1952
2169
  fallbackEndpoint: null
1953
2170
  },
2171
+ ...r,
1954
2172
  ...i
1955
- }, this._state = J(), this._state.set("theme", this._options.theme), this._state.set("crop.shape", this._options.cropShape), this._state.set("crop.aspect", this._options.initialAspectRatio), this._renderer = new ee(), this._filterManager = new ie(this._state, this._renderer), this._cropManager = new re(this._state, this._renderer), this._removeBgManager = null, ((t = this._options.backgroundRemoval) == null ? void 0 : t.enabled) !== !1 && (this._removeBgManager = new se({
1956
- endpoint: (r = this._options.backgroundRemoval) == null ? void 0 : r.endpoint,
1957
- fallbackEndpoint: (a = this._options.backgroundRemoval) == null ? void 0 : a.fallbackEndpoint
2173
+ }, this._preset = t, this._state = oe(), 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 le(), this._filterManager = new ce(this._state, this._renderer), this._cropManager = new U(this._state, this._renderer), this._removeBgManager = null, ((a = this._options.backgroundRemoval) == null ? void 0 : a.enabled) !== !1 && (this._removeBgManager = new he({
2174
+ endpoint: (o = this._options.backgroundRemoval) == null ? void 0 : o.endpoint,
2175
+ fallbackEndpoint: (l = this._options.backgroundRemoval) == null ? void 0 : l.fallbackEndpoint
1958
2176
  })), this._loadingOverlay = null, this._toolbar = null, this._categoryCarousel = null, this._filterCarousel = null, this._filterAdjustments = 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();
1959
2177
  }
1960
2178
  /**
@@ -1970,16 +2188,17 @@ class vt extends N {
1970
2188
  * Build DOM structure
1971
2189
  */
1972
2190
  _buildDOM() {
1973
- this._container.innerHTML = "", this._editorEl = d("div", {
2191
+ this._container.innerHTML = "", this._editorEl = u("div", {
1974
2192
  className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
1975
2193
  });
1976
- const e = d("div", { className: "editor-toolbar-container" });
2194
+ const e = u("div", { className: "editor-toolbar-container" });
1977
2195
  this._editorEl.appendChild(e), this._toolbarContainer = e;
1978
- const i = d("div", { className: "editor-content" }), t = d("div", { className: "canvas-section" });
1979
- this._canvasContainer = d("div", { className: "canvas-container" }), this._cropOverlay = d("canvas", { className: "crop-overlay" }), t.appendChild(this._canvasContainer), t.appendChild(this._cropOverlay), i.appendChild(t), this._controlsSection = d("div", { className: "controls-section" }), i.appendChild(this._controlsSection), this._editorEl.appendChild(i), this._fileInput = d("input", {
2196
+ const i = u("div", { className: "editor-content" }), t = u("div", { className: "canvas-section" });
2197
+ this._canvasContainer = u("div", { className: "canvas-container" }), this._cropOverlay = u("canvas", { className: "crop-overlay", "aria-hidden": "true" }), t.appendChild(this._canvasContainer), t.appendChild(this._cropOverlay), i.appendChild(t), this._controlsSection = u("div", { className: "controls-section" }), i.appendChild(this._controlsSection), this._editorEl.appendChild(i), this._fileInput = u("input", {
1980
2198
  type: "file",
1981
2199
  accept: "image/*",
1982
2200
  className: "hidden-file-input",
2201
+ "aria-label": "Choose image file to edit",
1983
2202
  onChange: (r) => this._handleFileSelect(r)
1984
2203
  }), this._editorEl.appendChild(this._fileInput), this._container.appendChild(this._editorEl);
1985
2204
  }
@@ -1987,31 +2206,38 @@ class vt extends N {
1987
2206
  * Initialize UI components
1988
2207
  */
1989
2208
  _initUI() {
1990
- this._toolbar = new Pe(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = d("div", { className: "filter-controls-container" }), this._categoryCarousel = new Me(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
2209
+ this._toolbar = new Re(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = u("div", { className: "filter-controls-container" }), this._categoryCarousel = new Te(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
1991
2210
  }));
1992
- const e = d("div", { className: "filter-layout" }), i = d("div", { className: "filter-left-column" });
1993
- this._filterCarousel = new Fe(this._state, this._filterManager), i.appendChild(this._filterCarousel.render({
2211
+ const e = u("div", { className: "filter-layout" }), i = u("div", { className: "filter-left-column" });
2212
+ this._filterCarousel = new Ie(this._state, this._filterManager), i.appendChild(this._filterCarousel.render({
1994
2213
  onToggle: (r, a) => this._handleFilterToggle(r, a),
1995
2214
  onSelect: (r) => this._handleFilterSelect(r)
1996
- })), this._filterAdjustments = new ze(this._state, this._filterManager), i.appendChild(this._filterAdjustments.render({
1997
- onChange: (r, a, l) => this._handleFilterChange(r, a, l),
2215
+ })), this._filterAdjustments = new Xe(this._state, this._filterManager), i.appendChild(this._filterAdjustments.render({
2216
+ onChange: (r, a, o) => this._handleFilterChange(r, a, o),
1998
2217
  onReset: (r) => this._handleFilterReset(r),
1999
2218
  onAction: (r, a) => this._handleFilterAction(r, a)
2000
2219
  })), e.appendChild(i);
2001
- const t = d("div", { className: "filter-right-column" });
2002
- this._activeFiltersPanel = new Te(this._state, this._filterManager), t.appendChild(this._activeFiltersPanel.render({
2220
+ const t = u("div", { className: "filter-right-column" });
2221
+ this._activeFiltersPanel = new Oe(this._state, this._filterManager), t.appendChild(this._activeFiltersPanel.render({
2003
2222
  onRemove: (r) => this._handleFilterToggle(r, !1),
2004
2223
  onReset: (r) => this._handleFilterReset(r),
2005
2224
  onClearAll: () => this.resetAll(),
2006
2225
  onSelect: (r) => this._handleFilterSelect(r)
2007
- })), e.appendChild(t), this._filterControlsEl.appendChild(e), this._cropControls = new Re(this._state, this._cropManager), this._cropControlsEl = this._cropControls.render(), this._cropControlsEl.style.display = "none", this._controlsSection.appendChild(this._filterControlsEl), this._controlsSection.appendChild(this._cropControlsEl);
2226
+ })), e.appendChild(t), this._filterControlsEl.appendChild(e), this._cropControls = new Be(this._state, this._cropManager), this._cropControlsEl = this._cropControls.render(), this._cropControlsEl.style.display = "none", this._controlsSection.appendChild(this._filterControlsEl), this._controlsSection.appendChild(this._cropControlsEl);
2008
2227
  }
2009
2228
  /**
2010
- * Set up resize observer
2229
+ * Set up resize observer with debounce to prevent infinite loops.
2230
+ * Without debounce, PIXI renderer.resize() changes the canvas buffer
2231
+ * which triggers another ResizeObserver notification, causing a loop
2232
+ * that floods the console with "ResizeObserver loop completed" errors
2233
+ * and prevents the image from rendering (gray canvas).
2011
2234
  */
2012
2235
  _setupResizeObserver() {
2236
+ let e = null;
2013
2237
  this._resizeObserver = new ResizeObserver(() => {
2014
- this._canvasContainer && (this._renderer.resizeTo(this._canvasContainer), this._state.get("mode") === "crop" && this._cropManager.drawOverlay());
2238
+ clearTimeout(e), e = setTimeout(() => {
2239
+ this._canvasContainer && (this._renderer.resizeTo(this._canvasContainer), this._state.get("mode") === "crop" && this._cropManager.drawOverlay());
2240
+ }, 50);
2015
2241
  }), this._resizeObserver.observe(this._canvasContainer);
2016
2242
  }
2017
2243
  /**
@@ -2098,7 +2324,7 @@ class vt extends N {
2098
2324
  */
2099
2325
  async loadImage(e) {
2100
2326
  let i = e;
2101
- e instanceof File && (i = await this._fileToDataUrl(e)), await this._renderer.loadTexture(i), this._state.set("hasImage", !0), this._state.set("imageUrl", i), this.emit("imageLoaded", { url: i });
2327
+ e instanceof File && (i = await this._fileToDataUrl(e)), await this._renderer.loadTexture(i), this._state.set("hasImage", !0), this._state.set("imageUrl", i), this._options.initialMode === "crop" && this.setMode("crop"), this.emit("imageLoaded", { url: i });
2102
2328
  }
2103
2329
  /**
2104
2330
  * Convert a File to data URL
@@ -2250,9 +2476,9 @@ class vt extends N {
2250
2476
  _showLoadingOverlay(e) {
2251
2477
  var t;
2252
2478
  if (!this._loadingOverlay)
2253
- this._loadingOverlay = d("div", { className: "editor-loading-overlay" }, [
2254
- d("div", { className: "editor-loading-spinner" }),
2255
- d("div", { className: "editor-loading-text" }, e)
2479
+ this._loadingOverlay = u("div", { className: "editor-loading-overlay" }, [
2480
+ u("div", { className: "editor-loading-spinner" }),
2481
+ u("div", { className: "editor-loading-text" }, e)
2256
2482
  ]);
2257
2483
  else {
2258
2484
  const r = this._loadingOverlay.querySelector(".editor-loading-text");
@@ -2272,27 +2498,27 @@ class vt extends N {
2272
2498
  * Destroy the editor and clean up
2273
2499
  */
2274
2500
  destroy() {
2275
- var e, i, t, r, a, l, o, n;
2276
- (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), (i = this._toolbar) == null || i.destroy(), (t = this._categoryCarousel) == null || t.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (l = this._cropControls) == null || l.destroy(), (o = this._activeFiltersPanel) == null || o.destroy(), (n = this._editorEl) == null || n.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
2501
+ var e, i, t, r, a, o, l, n;
2502
+ (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), (i = this._toolbar) == null || i.destroy(), (t = this._categoryCarousel) == null || t.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._cropControls) == null || o.destroy(), (l = this._activeFiltersPanel) == null || l.destroy(), (n = this._editorEl) == null || n.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
2277
2503
  }
2278
2504
  }
2279
- const v = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
2505
+ const k = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
2280
2506
  function f(s) {
2281
2507
  var e;
2282
- return v.has(s.id), v.set(s.id, s), z.has(s.category) || z.set(s.category, []), (e = z.get(s.category)) == null || e.push(s.id), s;
2508
+ return k.has(s.id), k.set(s.id, s), R.has(s.category) || R.set(s.category, []), (e = R.get(s.category)) == null || e.push(s.id), s;
2283
2509
  }
2284
- function Ie(s) {
2285
- return v.get(s);
2510
+ function Ve(s) {
2511
+ return k.get(s);
2286
2512
  }
2287
- function I() {
2288
- return Array.from(v.values());
2513
+ function Y() {
2514
+ return Array.from(k.values());
2289
2515
  }
2290
- function Xe() {
2291
- I().map((i) => i.id), Object.entries(g).filter(
2516
+ function Ue() {
2517
+ Y().map((i) => i.id), Object.entries(g).filter(
2292
2518
  (i) => /Filter$/.test(i[0]) && typeof i[1] == "function"
2293
2519
  ).forEach(([i, t]) => {
2294
2520
  const r = i.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2295
- v.has(r) || f({
2521
+ k.has(r) || f({
2296
2522
  id: r,
2297
2523
  name: i.replace(/Filter$/, ""),
2298
2524
  category: "unlisted",
@@ -2310,17 +2536,17 @@ function Xe() {
2310
2536
  });
2311
2537
  });
2312
2538
  }
2313
- function Ye(s) {
2314
- return (z.get(s) || []).map((i) => v.get(i)).filter(Boolean);
2539
+ function De(s) {
2540
+ return (R.get(s) || []).map((i) => k.get(i)).filter(Boolean);
2315
2541
  }
2316
- function Ee() {
2317
- return Array.from(z.keys());
2542
+ function je() {
2543
+ return Array.from(R.keys());
2318
2544
  }
2319
- function Pt(s) {
2320
- return v.has(s);
2545
+ function It(s) {
2546
+ return k.has(s);
2321
2547
  }
2322
- function Be() {
2323
- return Array.from(v.values()).map((s) => ({
2548
+ function qe() {
2549
+ return Array.from(k.values()).map((s) => ({
2324
2550
  id: s.id,
2325
2551
  name: s.name,
2326
2552
  category: s.category,
@@ -2328,17 +2554,17 @@ function Be() {
2328
2554
  }));
2329
2555
  }
2330
2556
  if (typeof window < "u") {
2331
- window.__DEBUG_FILTERS_LIST = Array.from(v.keys()), window.getAllFilters = I, window.getFilter = Ie, window.getFiltersByCategory = Ye, window.getRegisteredFilters = Be;
2557
+ window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), window.getAllFilters = Y, window.getFilter = Ve, window.getFiltersByCategory = De, window.getRegisteredFilters = qe;
2332
2558
  const s = f;
2333
2559
  window.registerFilter = (e) => {
2334
2560
  const i = s(e);
2335
- return window.__DEBUG_FILTERS_LIST = Array.from(v.keys()), i;
2561
+ return window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), i;
2336
2562
  };
2337
2563
  }
2338
2564
  typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
2339
2565
  return [];
2340
2566
  });
2341
- const { AdjustmentFilter: Le } = g, { ColorMatrixFilter: Oe } = C;
2567
+ const { AdjustmentFilter: He } = g, { ColorMatrixFilter: $e } = C;
2342
2568
  f({
2343
2569
  id: "adjustment",
2344
2570
  name: "Adjustment",
@@ -2358,50 +2584,50 @@ f({
2358
2584
  alpha: s.alpha ?? 1
2359
2585
  };
2360
2586
  try {
2361
- const i = new Le(e);
2587
+ const i = new He(e);
2362
2588
  return i._customParams = { ...s }, i.updateUIParam = function(t, r) {
2363
2589
  try {
2364
2590
  const a = this._customParams || {};
2365
2591
  this._customParams = a, a[t] = r;
2366
- const l = Number(r);
2592
+ const o = Number(r);
2367
2593
  switch (t) {
2368
2594
  case "gamma":
2369
- this.gamma = l;
2595
+ this.gamma = o;
2370
2596
  break;
2371
2597
  case "saturation":
2372
- this.saturation = l;
2598
+ this.saturation = o;
2373
2599
  break;
2374
2600
  case "contrast":
2375
- this.contrast = l;
2601
+ this.contrast = o;
2376
2602
  break;
2377
2603
  case "brightness":
2378
- this.brightness = l;
2604
+ this.brightness = o;
2379
2605
  break;
2380
2606
  case "red":
2381
- this.red = l;
2607
+ this.red = o;
2382
2608
  break;
2383
2609
  case "green":
2384
- this.green = l;
2610
+ this.green = o;
2385
2611
  break;
2386
2612
  case "blue":
2387
- this.blue = l;
2613
+ this.blue = o;
2388
2614
  break;
2389
2615
  case "alpha":
2390
- this.alpha = l;
2616
+ this.alpha = o;
2391
2617
  break;
2392
2618
  default:
2393
- t in this && (this[t] = l);
2619
+ t in this && (this[t] = o);
2394
2620
  break;
2395
2621
  }
2396
2622
  } catch {
2397
2623
  }
2398
2624
  }, i;
2399
2625
  } catch {
2400
- const t = new Oe();
2626
+ const t = new $e();
2401
2627
  return t._customParams = { ...s }, typeof t.brightness == "function" && t.brightness(s.brightness, !1), typeof t.contrast == "function" && t.contrast(s.contrast, !1), typeof t.saturate == "function" && t.saturate(s.saturation, !1), t.updateUIParam = function(r, a) {
2402
2628
  try {
2403
- const l = this._customParams || {};
2404
- switch (this._customParams = l, l[r] = a, r) {
2629
+ const o = this._customParams || {};
2630
+ switch (this._customParams = o, o[r] = a, r) {
2405
2631
  case "brightness":
2406
2632
  typeof this.brightness == "function" && this.brightness(a, !1);
2407
2633
  break;
@@ -2518,7 +2744,7 @@ f({
2518
2744
  }
2519
2745
  ]
2520
2746
  });
2521
- const { ColorMatrixFilter: Ve } = C;
2747
+ const { ColorMatrixFilter: Ze } = C;
2522
2748
  f({
2523
2749
  id: "adjustment-advanced",
2524
2750
  name: "Advanced Adjustment",
@@ -2527,7 +2753,7 @@ f({
2527
2753
  // Create an instance of the ColorMatrixFilter with the provided parameters
2528
2754
  createFilter: (s) => {
2529
2755
  try {
2530
- const e = new Ve();
2756
+ const e = new Ze();
2531
2757
  return e._customParams = { ...s }, e.reset(), s.brightness !== 1 && e.brightness(s.brightness, !1), s.contrast !== 1 && e.contrast(s.contrast, !1), s.saturation !== 1 && e.saturate(s.saturation, !1), s.hue !== 0 && e.hue(s.hue, !1), s.sepia > 0 && e.sepia(!1), s.negative && e.negative(!1), e.updateUIParam = function(i, t) {
2532
2758
  try {
2533
2759
  const r = this._customParams || {};
@@ -2626,8 +2852,8 @@ f({
2626
2852
  try {
2627
2853
  const a = this._customParams || {};
2628
2854
  if (this._customParams = a, t === "alpha") {
2629
- const l = Number(r);
2630
- this.alpha = l, a.alpha = l;
2855
+ const o = Number(r);
2856
+ this.alpha = o, a.alpha = o;
2631
2857
  } else
2632
2858
  t in this && (this[t] = r);
2633
2859
  } catch {
@@ -2805,7 +3031,7 @@ f({
2805
3031
  }
2806
3032
  ]
2807
3033
  });
2808
- const { ColorOverlayFilter: Ue } = g;
3034
+ const { ColorOverlayFilter: We } = g;
2809
3035
  f({
2810
3036
  id: "colorOverlay",
2811
3037
  name: "Color Overlay",
@@ -2820,7 +3046,7 @@ f({
2820
3046
  try {
2821
3047
  let e = 16711680;
2822
3048
  s.color && (typeof s.color == "string" ? e = parseInt(s.color.replace("#", "0x"), 16) : typeof s.color == "number" && (e = s.color));
2823
- const i = new Ue({
3049
+ const i = new We({
2824
3050
  color: e,
2825
3051
  alpha: s.alpha || 0.5
2826
3052
  });
@@ -2828,8 +3054,8 @@ f({
2828
3054
  const a = this._customParams || {};
2829
3055
  switch (this._customParams = a, a[t] = r, t) {
2830
3056
  case "color":
2831
- let l;
2832
- typeof r == "string" ? l = parseInt(r.replace("#", "0x"), 16) : l = Number(r), this.color = l, this.uniforms && (this.uniforms.uColor = l);
3057
+ let o;
3058
+ typeof r == "string" ? o = parseInt(r.replace("#", "0x"), 16) : o = Number(r), this.color = o, this.uniforms && (this.uniforms.uColor = o);
2833
3059
  break;
2834
3060
  case "alpha":
2835
3061
  this.alpha = Number(r), this.uniforms && (this.uniforms.uAlpha = Number(r));
@@ -2902,37 +3128,37 @@ f({
2902
3128
  _offset: r,
2903
3129
  _distance: i,
2904
3130
  _angle: t
2905
- }, a.updateUIParam = function(l, o) {
3131
+ }, a.updateUIParam = function(o, l) {
2906
3132
  try {
2907
3133
  const n = this._customParams || {};
2908
- switch (this._customParams = n, n[l] = o, l) {
3134
+ switch (this._customParams = n, n[o] = l, o) {
2909
3135
  case "color":
2910
- if (typeof o == "string") {
2911
- const u = parseInt(o.replace("#", "0x"), 16);
2912
- this.color = u;
3136
+ if (typeof l == "string") {
3137
+ const d = parseInt(l.replace("#", "0x"), 16);
3138
+ this.color = d;
2913
3139
  }
2914
3140
  break;
2915
3141
  case "alpha":
2916
- this.alpha = Number(o);
3142
+ this.alpha = Number(l);
2917
3143
  break;
2918
3144
  case "blur":
2919
- this.blur = Number(o);
3145
+ this.blur = Number(l);
2920
3146
  break;
2921
3147
  case "quality":
2922
- this.quality = Number(o);
3148
+ this.quality = Number(l);
2923
3149
  break;
2924
3150
  case "shadowOnly":
2925
- this.shadowOnly = !!o;
3151
+ this.shadowOnly = !!l;
2926
3152
  break;
2927
3153
  case "pixelSizeX":
2928
- this.pixelSizeX = Number(o), n.pixelSizeX = Number(o);
3154
+ this.pixelSizeX = Number(l), n.pixelSizeX = Number(l);
2929
3155
  break;
2930
3156
  case "pixelSizeY":
2931
- this.pixelSizeY = Number(o), n.pixelSizeY = Number(o);
3157
+ this.pixelSizeY = Number(l), n.pixelSizeY = Number(l);
2932
3158
  break;
2933
3159
  case "distance":
2934
3160
  case "angle":
2935
- l === "distance" ? n._distance = Number(o) : n._angle = Number(o);
3161
+ o === "distance" ? n._distance = Number(l) : n._angle = Number(l);
2936
3162
  const c = {
2937
3163
  x: n._distance * Math.cos(n._angle * Math.PI / 180),
2938
3164
  y: n._distance * Math.sin(n._angle * Math.PI / 180)
@@ -2940,12 +3166,12 @@ f({
2940
3166
  n._offset = c, this.offset = c;
2941
3167
  break;
2942
3168
  default:
2943
- l in this && (this[l] = o);
3169
+ o in this && (this[o] = l);
2944
3170
  break;
2945
3171
  }
2946
3172
  return !0;
2947
3173
  } catch {
2948
- return this._customParams && (this._customParams[l] = o), !1;
3174
+ return this._customParams && (this._customParams[o] = l), !1;
2949
3175
  }
2950
3176
  }, a;
2951
3177
  } catch {
@@ -3052,7 +3278,7 @@ f({
3052
3278
  }
3053
3279
  ]
3054
3280
  });
3055
- const { ColorMatrixFilter: De } = C;
3281
+ const { ColorMatrixFilter: Ge } = C;
3056
3282
  f({
3057
3283
  id: "grayscale",
3058
3284
  name: "Grayscale",
@@ -3065,14 +3291,14 @@ f({
3065
3291
  */
3066
3292
  createFilter: (s) => {
3067
3293
  try {
3068
- const e = new De();
3294
+ const e = new Ge();
3069
3295
  e._customParams = { ...s };
3070
3296
  const i = s.intensity !== void 0 ? s.intensity : 1;
3071
- return U(e, i), e.updateUIParam = function(t, r) {
3297
+ return $(e, i), e.updateUIParam = function(t, r) {
3072
3298
  const a = this._customParams || {};
3073
3299
  switch (this._customParams = a, a[t] = r, t) {
3074
3300
  case "intensity":
3075
- U(this, r);
3301
+ $(this, r);
3076
3302
  break;
3077
3303
  default:
3078
3304
  t in this && (this[t] = r);
@@ -3102,10 +3328,10 @@ f({
3102
3328
  }
3103
3329
  ]
3104
3330
  });
3105
- function U(s, e) {
3331
+ function $(s, e) {
3106
3332
  s.reset(), s.greyscale(e);
3107
3333
  }
3108
- const { HslAdjustmentFilter: je } = g;
3334
+ const { HslAdjustmentFilter: Ke } = g;
3109
3335
  f({
3110
3336
  id: "hsl-adjustment",
3111
3337
  name: "HSL Adjustment",
@@ -3117,7 +3343,7 @@ f({
3117
3343
  */
3118
3344
  createFilter: (s) => {
3119
3345
  try {
3120
- const e = new je({
3346
+ const e = new Ke({
3121
3347
  hue: s.hue !== void 0 ? s.hue : 0,
3122
3348
  saturation: s.saturation !== void 0 ? s.saturation : 0,
3123
3349
  lightness: s.lightness !== void 0 ? s.lightness : 0,
@@ -3215,7 +3441,7 @@ f({
3215
3441
  }
3216
3442
  ]
3217
3443
  });
3218
- const { KawaseBlurFilter: qe } = g;
3444
+ const { KawaseBlurFilter: Qe } = g;
3219
3445
  f({
3220
3446
  id: "kawase-blur",
3221
3447
  name: "Kawase Blur",
@@ -3228,7 +3454,7 @@ f({
3228
3454
  */
3229
3455
  createFilter: (s) => {
3230
3456
  try {
3231
- const e = new qe({
3457
+ const e = new Qe({
3232
3458
  strength: s.strength || 4,
3233
3459
  quality: s.quality || 3,
3234
3460
  clamp: s.clamp || !1,
@@ -3333,7 +3559,7 @@ f({
3333
3559
  }
3334
3560
  ]
3335
3561
  });
3336
- const { MotionBlurFilter: He } = g;
3562
+ const { MotionBlurFilter: Je } = g;
3337
3563
  f({
3338
3564
  id: "motion-blur",
3339
3565
  name: "Motion Blur",
@@ -3346,7 +3572,7 @@ f({
3346
3572
  */
3347
3573
  createFilter: (s) => {
3348
3574
  try {
3349
- const e = new He({
3575
+ const e = new Je({
3350
3576
  velocity: {
3351
3577
  x: s.velocityX !== void 0 ? s.velocityX : 0,
3352
3578
  y: s.velocityY !== void 0 ? s.velocityY : 0
@@ -3441,7 +3667,7 @@ f({
3441
3667
  }
3442
3668
  ]
3443
3669
  });
3444
- const { RadialBlurFilter: $e } = g;
3670
+ const { RadialBlurFilter: et } = g;
3445
3671
  f({
3446
3672
  id: "radial-blur",
3447
3673
  name: "Radial Blur",
@@ -3450,7 +3676,7 @@ f({
3450
3676
  // Create an instance of the RadialBlurFilter with the provided parameters
3451
3677
  createFilter: (s) => {
3452
3678
  try {
3453
- const e = new $e({
3679
+ const e = new et({
3454
3680
  angle: s.angle ?? 20,
3455
3681
  center: { x: s.centerX ?? 0, y: s.centerY ?? 0 },
3456
3682
  kernelSize: s.kernelSize ?? 15,
@@ -3565,7 +3791,7 @@ f({
3565
3791
  }
3566
3792
  ]
3567
3793
  });
3568
- const { TiltShiftFilter: Ge } = g;
3794
+ const { TiltShiftFilter: tt } = g;
3569
3795
  f({
3570
3796
  id: "tilt-shift",
3571
3797
  name: "Tilt Shift",
@@ -3574,48 +3800,48 @@ f({
3574
3800
  // Create an instance of the TiltShiftFilter with the provided parameters
3575
3801
  createFilter: (s) => {
3576
3802
  try {
3577
- const e = typeof s.blur == "number" ? s.blur : 100, i = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, t = typeof s.startX == "number" ? s.startX : 0, r = typeof s.startY == "number" ? s.startY : 0.5, a = typeof s.endX == "number" ? s.endX : 1, l = typeof s.endY == "number" ? s.endY : 0.5, o = new Ge({
3803
+ const e = typeof s.blur == "number" ? s.blur : 100, i = typeof s.gradientBlur == "number" ? s.gradientBlur : 600, t = 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, l = new tt({
3578
3804
  blur: Number(e),
3579
3805
  gradientBlur: Number(i),
3580
3806
  start: { x: Number(t), y: Number(r) },
3581
- end: { x: Number(a), y: Number(l) }
3807
+ end: { x: Number(a), y: Number(o) }
3582
3808
  });
3583
- return o._customParams = {
3809
+ return l._customParams = {
3584
3810
  blur: e,
3585
3811
  gradientBlur: i,
3586
3812
  startX: t,
3587
3813
  startY: r,
3588
3814
  endX: a,
3589
- endY: l
3590
- }, o.updateUIParam = function(n, c) {
3815
+ endY: o
3816
+ }, l.updateUIParam = function(n, c) {
3591
3817
  try {
3592
- const u = Number(c), h = this._customParams || {};
3593
- switch (this._customParams = h, h[n] = u, n) {
3818
+ const d = Number(c), h = this._customParams || {};
3819
+ switch (this._customParams = h, h[n] = d, n) {
3594
3820
  case "blur":
3595
- this.blur = u;
3821
+ this.blur = d;
3596
3822
  break;
3597
3823
  case "gradientBlur":
3598
- this.gradientBlur = u;
3824
+ this.gradientBlur = d;
3599
3825
  break;
3600
3826
  case "startX":
3601
- this.start && typeof this.start == "object" && (this.start.x = u);
3827
+ this.start && typeof this.start == "object" && (this.start.x = d);
3602
3828
  break;
3603
3829
  case "startY":
3604
- this.start && typeof this.start == "object" && (this.start.y = u);
3830
+ this.start && typeof this.start == "object" && (this.start.y = d);
3605
3831
  break;
3606
3832
  case "endX":
3607
- this.end && typeof this.end == "object" && (this.end.x = u);
3833
+ this.end && typeof this.end == "object" && (this.end.x = d);
3608
3834
  break;
3609
3835
  case "endY":
3610
- this.end && typeof this.end == "object" && (this.end.y = u);
3836
+ this.end && typeof this.end == "object" && (this.end.y = d);
3611
3837
  break;
3612
3838
  default:
3613
- n in this && (this[n] = u);
3839
+ n in this && (this[n] = d);
3614
3840
  break;
3615
3841
  }
3616
3842
  } catch {
3617
3843
  }
3618
- }, o;
3844
+ }, l;
3619
3845
  } catch {
3620
3846
  return null;
3621
3847
  }
@@ -3693,7 +3919,7 @@ f({
3693
3919
  }
3694
3920
  ]
3695
3921
  });
3696
- const { ZoomBlurFilter: We } = g;
3922
+ const { ZoomBlurFilter: it } = g;
3697
3923
  f({
3698
3924
  id: "zoom-blur",
3699
3925
  name: "Zoom Blur",
@@ -3706,7 +3932,7 @@ f({
3706
3932
  */
3707
3933
  createFilter: (s) => {
3708
3934
  try {
3709
- const e = new We({
3935
+ const e = new it({
3710
3936
  strength: s.strength || 0.1,
3711
3937
  center: {
3712
3938
  x: s.centerX !== void 0 ? s.centerX : 0.5,
@@ -3820,7 +4046,7 @@ f({
3820
4046
  }
3821
4047
  ]
3822
4048
  });
3823
- const { ColorGradientFilter: D } = g;
4049
+ const { ColorGradientFilter: Z } = g;
3824
4050
  f({
3825
4051
  id: "color-gradient",
3826
4052
  name: "Color Gradient",
@@ -3844,7 +4070,7 @@ f({
3844
4070
  { offset: 0, color: 16711680, alpha: 1 },
3845
4071
  { offset: 1, color: 255, alpha: 1 }
3846
4072
  ]), e.sort((t, r) => t.offset - r.offset);
3847
- const i = new D({
4073
+ const i = new Z({
3848
4074
  type: s.gradientType,
3849
4075
  // 0: linear, 1: radial, 2: conic
3850
4076
  stops: e,
@@ -3861,27 +4087,27 @@ f({
3861
4087
  }));
3862
4088
  }, i.getDynamicControls = function() {
3863
4089
  const t = this.getColorStopsForUI(), r = [];
3864
- return t.forEach((a, l) => {
4090
+ return t.forEach((a, o) => {
3865
4091
  r.push({
3866
- id: `colorStop-${l}-color`,
4092
+ id: `colorStop-${o}-color`,
3867
4093
  type: "color",
3868
- label: `Stop ${l + 1} Color`,
3869
- property: `colorStops[${l}].color`,
4094
+ label: `Stop ${o + 1} Color`,
4095
+ property: `colorStops[${o}].color`,
3870
4096
  default: a.color
3871
4097
  }), r.push({
3872
- id: `colorStop-${l}-offset`,
4098
+ id: `colorStop-${o}-offset`,
3873
4099
  type: "slider",
3874
- label: `Stop ${l + 1} Position`,
3875
- property: `colorStops[${l}].offset`,
4100
+ label: `Stop ${o + 1} Position`,
4101
+ property: `colorStops[${o}].offset`,
3876
4102
  min: 0,
3877
4103
  max: 1,
3878
4104
  step: 0.01,
3879
4105
  default: a.offset
3880
4106
  }), r.push({
3881
- id: `colorStop-${l}-alpha`,
4107
+ id: `colorStop-${o}-alpha`,
3882
4108
  type: "slider",
3883
- label: `Stop ${l + 1} Alpha`,
3884
- property: `colorStops[${l}].alpha`,
4109
+ label: `Stop ${o + 1} Alpha`,
4110
+ property: `colorStops[${o}].alpha`,
3885
4111
  min: 0,
3886
4112
  max: 1,
3887
4113
  step: 0.01,
@@ -3903,7 +4129,7 @@ f({
3903
4129
  t in this && (this[t] = r);
3904
4130
  break;
3905
4131
  case "addColorStop":
3906
- const l = [...this.stops], c = {
4132
+ const o = [...this.stops], c = {
3907
4133
  offset: 1,
3908
4134
  // Will be adjusted later
3909
4135
  alpha: 1,
@@ -3912,20 +4138,20 @@ f({
3912
4138
  return h << 16 | p << 8 | m;
3913
4139
  })()
3914
4140
  };
3915
- if (l.length > 0) {
3916
- for (let p = 0; p < l.length; p++)
3917
- l[p].offset *= 0.8;
4141
+ if (o.length > 0) {
4142
+ for (let p = 0; p < o.length; p++)
4143
+ o[p].offset *= 0.8;
3918
4144
  c.offset = 1;
3919
4145
  }
3920
- l.push(c), this.stops = l, a.colorStops = this.stops.map((h) => ({
4146
+ o.push(c), this.stops = o, a.colorStops = this.stops.map((h) => ({
3921
4147
  offset: h.offset,
3922
4148
  color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
3923
4149
  alpha: h.alpha
3924
4150
  }));
3925
4151
  break;
3926
4152
  case "removeColorStop":
3927
- const u = [...this.stops];
3928
- u.length > 2 && (u.pop(), this.stops = u, a.colorStops = this.stops.map((h) => ({
4153
+ const d = [...this.stops];
4154
+ d.length > 2 && (d.pop(), this.stops = d, a.colorStops = this.stops.map((h) => ({
3929
4155
  offset: h.offset,
3930
4156
  color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
3931
4157
  alpha: h.alpha
@@ -3934,7 +4160,7 @@ f({
3934
4160
  case "cssGradient":
3935
4161
  if (r && typeof r == "string" && r.trim() !== "")
3936
4162
  try {
3937
- const h = new D({ css: r });
4163
+ const h = new Z({ css: r });
3938
4164
  this.type = h.type, this.angle = h.angle, this.stops = [...h.stops], a.colorStops = this.stops.map((p) => ({
3939
4165
  offset: p.offset,
3940
4166
  color: typeof p.color == "number" ? "#" + p.color.toString(16).padStart(6, "0") : p.color,
@@ -3957,9 +4183,9 @@ f({
3957
4183
  if (/colorStops\[\d+\]\..*/.test(t)) {
3958
4184
  const h = t.match(/colorStops\[(\d+)\]\.(.*)/);
3959
4185
  if (h) {
3960
- const [p, m, x] = h, b = parseInt(m), y = [...this.stops];
3961
- if (b >= 0 && b < y.length)
3962
- return x === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (x === "offset" || x === "alpha") && (y[b][x] = r), this.stops = y, this.stops.sort((k, _) => k.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
4186
+ const [p, m, S] = h, b = parseInt(m), _ = [...this.stops];
4187
+ if (b >= 0 && b < _.length)
4188
+ return S === "color" && typeof r == "string" ? _[b].color = parseInt(r.replace("#", "0x")) : (S === "offset" || S === "alpha") && (_[b][S] = r), this.stops = _, this.stops.sort((x, y) => x.offset - y.offset), a.colorStops = this.getColorStopsForUI(), !0;
3963
4189
  }
3964
4190
  } else t in this && (this[t] = r);
3965
4191
  break;
@@ -4083,8 +4309,8 @@ f({
4083
4309
  mix: s.mix
4084
4310
  });
4085
4311
  return t._customParams = { ...s }, t.updateUIParam = function(r, a) {
4086
- const l = this._customParams || {};
4087
- switch (this._customParams = l, l[r] = a, r) {
4312
+ const o = this._customParams || {};
4313
+ switch (this._customParams = o, o[r] = a, r) {
4088
4314
  case "texturePath":
4089
4315
  a && (this.colorMap = C.Texture.from(a));
4090
4316
  break;
@@ -4147,7 +4373,7 @@ f({
4147
4373
  }
4148
4374
  ]
4149
4375
  });
4150
- const Ze = g.ColorReplaceFilter;
4376
+ const rt = g.ColorReplaceFilter;
4151
4377
  f({
4152
4378
  id: "color-replace",
4153
4379
  name: "Color Replace",
@@ -4164,14 +4390,14 @@ f({
4164
4390
  s.originalColor && (typeof s.originalColor == "string" ? e = parseInt(s.originalColor.replace("#", "0x"), 16) : typeof s.originalColor == "number" && (e = s.originalColor));
4165
4391
  let i = 255;
4166
4392
  s.targetColor && (typeof s.targetColor == "string" ? i = parseInt(s.targetColor.replace("#", "0x"), 16) : typeof s.targetColor == "number" && (i = s.targetColor));
4167
- const t = new Ze({
4393
+ const t = new rt({
4168
4394
  originalColor: e,
4169
4395
  targetColor: i,
4170
4396
  tolerance: s.tolerance || 0.4
4171
4397
  });
4172
4398
  return t._customParams = { ...s }, t.updateUIParam = function(r, a) {
4173
- const l = this._customParams || {};
4174
- switch (this._customParams = l, l[r] = a, r) {
4399
+ const o = this._customParams || {};
4400
+ switch (this._customParams = o, o[r] = a, r) {
4175
4401
  case "originalColor":
4176
4402
  typeof a == "string" ? this.originalColor = parseInt(a.replace("#", "0x"), 16) : typeof a == "number" && (this.originalColor = a);
4177
4403
  break;
@@ -4228,7 +4454,7 @@ f({
4228
4454
  }
4229
4455
  ]
4230
4456
  });
4231
- const Ke = g.MultiColorReplaceFilter;
4457
+ const st = g.MultiColorReplaceFilter;
4232
4458
  f({
4233
4459
  id: "multi-color-replace",
4234
4460
  name: "Multi-Color Replace",
@@ -4254,7 +4480,7 @@ f({
4254
4480
  const t = 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;
4255
4481
  e.push([t, r]);
4256
4482
  }
4257
- const i = new Ke(
4483
+ const i = new st(
4258
4484
  e,
4259
4485
  s.tolerance || 0.05,
4260
4486
  3
@@ -4263,20 +4489,20 @@ f({
4263
4489
  return i._customParams = { ...s }, i.updateUIParam = function(t, r) {
4264
4490
  const a = this._customParams || {};
4265
4491
  if (this._customParams = a, a[t] = r, t === "originalColor1" || t === "targetColor1" || t === "originalColor2" || t === "targetColor2" || t === "originalColor3" || t === "targetColor3" || t === "enableThirdPair") {
4266
- const l = [];
4492
+ const o = [];
4267
4493
  if (a.originalColor1 && a.targetColor1) {
4268
- const o = typeof a.originalColor1 == "string" ? parseInt(a.originalColor1.replace("#", "0x"), 16) : a.originalColor1, n = typeof a.targetColor1 == "string" ? parseInt(a.targetColor1.replace("#", "0x"), 16) : a.targetColor1;
4269
- l.push([o, n]);
4494
+ const l = typeof a.originalColor1 == "string" ? parseInt(a.originalColor1.replace("#", "0x"), 16) : a.originalColor1, n = typeof a.targetColor1 == "string" ? parseInt(a.targetColor1.replace("#", "0x"), 16) : a.targetColor1;
4495
+ o.push([l, n]);
4270
4496
  }
4271
4497
  if (a.originalColor2 && a.targetColor2) {
4272
- const o = typeof a.originalColor2 == "string" ? parseInt(a.originalColor2.replace("#", "0x"), 16) : a.originalColor2, n = typeof a.targetColor2 == "string" ? parseInt(a.targetColor2.replace("#", "0x"), 16) : a.targetColor2;
4273
- l.push([o, n]);
4498
+ const l = typeof a.originalColor2 == "string" ? parseInt(a.originalColor2.replace("#", "0x"), 16) : a.originalColor2, n = typeof a.targetColor2 == "string" ? parseInt(a.targetColor2.replace("#", "0x"), 16) : a.targetColor2;
4499
+ o.push([l, n]);
4274
4500
  }
4275
4501
  if (a.enableThirdPair && a.originalColor3 && a.targetColor3) {
4276
- const o = typeof a.originalColor3 == "string" ? parseInt(a.originalColor3.replace("#", "0x"), 16) : a.originalColor3, n = typeof a.targetColor3 == "string" ? parseInt(a.targetColor3.replace("#", "0x"), 16) : a.targetColor3;
4277
- l.push([o, n]);
4502
+ const l = typeof a.originalColor3 == "string" ? parseInt(a.originalColor3.replace("#", "0x"), 16) : a.originalColor3, n = typeof a.targetColor3 == "string" ? parseInt(a.targetColor3.replace("#", "0x"), 16) : a.targetColor3;
4503
+ o.push([l, n]);
4278
4504
  }
4279
- this.replacements = l, this.refresh();
4505
+ this.replacements = o, this.refresh();
4280
4506
  } else t === "tolerance" ? this.tolerance = r : t in this && (this[t] = r);
4281
4507
  return !0;
4282
4508
  }, i;
@@ -4365,7 +4591,7 @@ f({
4365
4591
  }
4366
4592
  ]
4367
4593
  });
4368
- const { RGBSplitFilter: Qe } = g;
4594
+ const { RGBSplitFilter: at } = g;
4369
4595
  f({
4370
4596
  id: "rgb-split",
4371
4597
  name: "RGB Split",
@@ -4386,40 +4612,40 @@ f({
4386
4612
  }, t = {
4387
4613
  x: s.blueX !== void 0 ? s.blueX : 0,
4388
4614
  y: s.blueY !== void 0 ? s.blueY : 0
4389
- }, r = new Qe({
4615
+ }, r = new at({
4390
4616
  red: e,
4391
4617
  green: i,
4392
4618
  blue: t
4393
4619
  });
4394
- return r._customParams = { ...s }, r.updateUIParam = function(a, l) {
4620
+ return r._customParams = { ...s }, r.updateUIParam = function(a, o) {
4395
4621
  try {
4396
- const o = this._customParams || {};
4397
- switch (this._customParams = o, o[a] = l, a) {
4622
+ const l = this._customParams || {};
4623
+ switch (this._customParams = l, l[a] = o, a) {
4398
4624
  case "redX":
4399
- this.redX = Number(l);
4625
+ this.redX = Number(o);
4400
4626
  break;
4401
4627
  case "redY":
4402
- this.redY = Number(l);
4628
+ this.redY = Number(o);
4403
4629
  break;
4404
4630
  case "greenX":
4405
- this.greenX = Number(l);
4631
+ this.greenX = Number(o);
4406
4632
  break;
4407
4633
  case "greenY":
4408
- this.greenY = Number(l);
4634
+ this.greenY = Number(o);
4409
4635
  break;
4410
4636
  case "blueX":
4411
- this.blueX = Number(l);
4637
+ this.blueX = Number(o);
4412
4638
  break;
4413
4639
  case "blueY":
4414
- this.blueY = Number(l);
4640
+ this.blueY = Number(o);
4415
4641
  break;
4416
4642
  default:
4417
- a in this && (this[a] = l);
4643
+ a in this && (this[a] = o);
4418
4644
  break;
4419
4645
  }
4420
4646
  return !0;
4421
4647
  } catch {
4422
- return this._customParams && (this._customParams[a] = l), !1;
4648
+ return this._customParams && (this._customParams[a] = o), !1;
4423
4649
  }
4424
4650
  }, r;
4425
4651
  } catch {
@@ -4499,7 +4725,7 @@ f({
4499
4725
  }
4500
4726
  ]
4501
4727
  });
4502
- const { AdvancedBloomFilter: Je } = g;
4728
+ const { AdvancedBloomFilter: ot } = g;
4503
4729
  f({
4504
4730
  id: "advanced-bloom",
4505
4731
  name: "Advanced Bloom",
@@ -4508,7 +4734,7 @@ f({
4508
4734
  // Create an instance of the AdvancedBloomFilter with the provided parameters
4509
4735
  createFilter: (s) => {
4510
4736
  try {
4511
- const e = new Je({
4737
+ const e = new ot({
4512
4738
  threshold: s.threshold || 0.5,
4513
4739
  bloomScale: s.bloomScale || 1,
4514
4740
  brightness: s.brightness || 1,
@@ -4655,7 +4881,7 @@ f({
4655
4881
  }
4656
4882
  ]
4657
4883
  });
4658
- const et = g.AsciiFilter;
4884
+ const lt = g.AsciiFilter;
4659
4885
  f({
4660
4886
  id: "ascii",
4661
4887
  name: "ASCII",
@@ -4667,7 +4893,7 @@ f({
4667
4893
  const e = typeof s.size == "number" ? s.size : 8;
4668
4894
  let i = s.color;
4669
4895
  typeof i == "string" && i.startsWith("#") && (i = parseInt(i.replace("#", "0x"), 16));
4670
- const t = s.replaceColor === !0, r = new et({
4896
+ const t = s.replaceColor === !0, r = new lt({
4671
4897
  size: e,
4672
4898
  color: i,
4673
4899
  replaceColor: t
@@ -4676,21 +4902,21 @@ f({
4676
4902
  size: e,
4677
4903
  color: i,
4678
4904
  replaceColor: t
4679
- }, r.updateUIParam = function(a, l) {
4905
+ }, r.updateUIParam = function(a, o) {
4680
4906
  try {
4681
- const o = this._customParams || {};
4682
- switch (this._customParams = o, o[a] = l, a) {
4907
+ const l = this._customParams || {};
4908
+ switch (this._customParams = l, l[a] = o, a) {
4683
4909
  case "size":
4684
- this.size = Number(l);
4910
+ this.size = Number(o);
4685
4911
  break;
4686
4912
  case "color":
4687
- typeof l == "string" && l.startsWith("#") ? (o.color = l, this.color = parseInt(l.replace("#", "0x"), 16)) : this.color = l;
4913
+ typeof o == "string" && o.startsWith("#") ? (l.color = o, this.color = parseInt(o.replace("#", "0x"), 16)) : this.color = o;
4688
4914
  break;
4689
4915
  case "replaceColor":
4690
- this.replaceColor = !!l;
4916
+ this.replaceColor = !!o;
4691
4917
  break;
4692
4918
  default:
4693
- a in this && (this[a] = l);
4919
+ a in this && (this[a] = o);
4694
4920
  break;
4695
4921
  }
4696
4922
  } catch {
@@ -4734,7 +4960,7 @@ f({
4734
4960
  }
4735
4961
  ]
4736
4962
  });
4737
- const tt = g.BackdropBlurFilter;
4963
+ const nt = g.BackdropBlurFilter;
4738
4964
  f({
4739
4965
  id: "backdrop-blur",
4740
4966
  name: "Backdrop Blur",
@@ -4743,7 +4969,7 @@ f({
4743
4969
  // Create an instance of the BackdropBlurFilter with the provided parameters
4744
4970
  createFilter: (s) => {
4745
4971
  try {
4746
- const e = new tt({
4972
+ const e = new nt({
4747
4973
  // Higher strength values (20-50) make the effect more noticeable
4748
4974
  strength: s.strength || 20,
4749
4975
  quality: s.quality || 4,
@@ -4841,7 +5067,7 @@ f({
4841
5067
  }
4842
5068
  ]
4843
5069
  });
4844
- const { BevelFilter: it } = g;
5070
+ const { BevelFilter: ct } = g;
4845
5071
  f({
4846
5072
  id: "bevel",
4847
5073
  name: "Bevel",
@@ -4853,7 +5079,7 @@ f({
4853
5079
  */
4854
5080
  createFilter: (s) => {
4855
5081
  try {
4856
- const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", i = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", t = new it({
5082
+ const e = s.lightColor ? s.lightColor.replace("#", "0x") : "0xffffff", i = s.shadowColor ? s.shadowColor.replace("#", "0x") : "0x000000", t = new ct({
4857
5083
  rotation: s.rotation !== void 0 ? s.rotation : 45,
4858
5084
  thickness: s.thickness !== void 0 ? s.thickness : 2,
4859
5085
  lightColor: parseInt(e, 16),
@@ -4863,8 +5089,8 @@ f({
4863
5089
  });
4864
5090
  return t._customParams = { ...s }, t.updateUIParam = function(r, a) {
4865
5091
  try {
4866
- const l = this._customParams || {};
4867
- switch (this._customParams = l, l[r] = a, r) {
5092
+ const o = this._customParams || {};
5093
+ switch (this._customParams = o, o[r] = a, r) {
4868
5094
  case "rotation":
4869
5095
  this.rotation = Number(a);
4870
5096
  break;
@@ -4873,8 +5099,8 @@ f({
4873
5099
  break;
4874
5100
  case "lightColor":
4875
5101
  if (typeof a == "string") {
4876
- const o = parseInt(a.replace("#", "0x"), 16);
4877
- this.lightColor = o;
5102
+ const l = parseInt(a.replace("#", "0x"), 16);
5103
+ this.lightColor = l;
4878
5104
  }
4879
5105
  break;
4880
5106
  case "lightAlpha":
@@ -4882,8 +5108,8 @@ f({
4882
5108
  break;
4883
5109
  case "shadowColor":
4884
5110
  if (typeof a == "string") {
4885
- const o = parseInt(a.replace("#", "0x"), 16);
4886
- this.shadowColor = o;
5111
+ const l = parseInt(a.replace("#", "0x"), 16);
5112
+ this.shadowColor = l;
4887
5113
  }
4888
5114
  break;
4889
5115
  case "shadowAlpha":
@@ -4969,7 +5195,7 @@ f({
4969
5195
  }
4970
5196
  ]
4971
5197
  });
4972
- const { BloomFilter: rt } = g;
5198
+ const { BloomFilter: ht } = g;
4973
5199
  f({
4974
5200
  id: "bloom",
4975
5201
  name: "Bloom/Glow",
@@ -4978,7 +5204,7 @@ f({
4978
5204
  // Create an instance of the BloomFilter with the provided parameters
4979
5205
  createFilter: (s) => {
4980
5206
  try {
4981
- const e = typeof s.strengthX == "number" ? s.strengthX : 2, i = typeof s.strengthY == "number" ? s.strengthY : 2, t = typeof s.quality == "number" ? s.quality : 4, r = typeof s.resolution == "number" ? s.resolution : 1, a = typeof s.kernelSize == "number" ? s.kernelSize : 5, l = new rt({
5207
+ const e = typeof s.strengthX == "number" ? s.strengthX : 2, i = typeof s.strengthY == "number" ? s.strengthY : 2, t = 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 ht({
4982
5208
  strength: {
4983
5209
  x: Number(e),
4984
5210
  y: Number(i)
@@ -4987,22 +5213,22 @@ f({
4987
5213
  resolution: Number(r),
4988
5214
  kernelSize: Number(a)
4989
5215
  });
4990
- return l._customParams = {
5216
+ return o._customParams = {
4991
5217
  strengthX: e,
4992
5218
  strengthY: i,
4993
5219
  quality: t,
4994
5220
  resolution: r,
4995
5221
  kernelSize: a
4996
- }, l.updateUIParam = function(o, n) {
4997
- var c, u;
5222
+ }, o.updateUIParam = function(l, n) {
5223
+ var c, d;
4998
5224
  try {
4999
5225
  const h = Number(n), p = this._customParams || {};
5000
- switch (this._customParams = p, p[o] = h, o) {
5226
+ switch (this._customParams = p, p[l] = h, l) {
5001
5227
  case "strengthX":
5002
5228
  this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
5003
5229
  break;
5004
5230
  case "strengthY":
5005
- this.strength && typeof this.strength == "object" && (this.strength.y = h, (u = this._updateStrength) == null || u.call(this));
5231
+ this.strength && typeof this.strength == "object" && (this.strength.y = h, (d = this._updateStrength) == null || d.call(this));
5006
5232
  break;
5007
5233
  case "quality":
5008
5234
  this.quality = h;
@@ -5014,12 +5240,12 @@ f({
5014
5240
  this.kernelSize = h;
5015
5241
  break;
5016
5242
  default:
5017
- o in this && (this[o] = h);
5243
+ l in this && (this[l] = h);
5018
5244
  break;
5019
5245
  }
5020
5246
  } catch {
5021
5247
  }
5022
- }, l;
5248
+ }, o;
5023
5249
  } catch {
5024
5250
  return null;
5025
5251
  }
@@ -5081,7 +5307,7 @@ f({
5081
5307
  }
5082
5308
  ]
5083
5309
  });
5084
- const { BulgePinchFilter: st } = g;
5310
+ const { BulgePinchFilter: dt } = g;
5085
5311
  f({
5086
5312
  id: "bulge-pinch",
5087
5313
  // ID must match what the application expects
@@ -5091,7 +5317,7 @@ f({
5091
5317
  // Create an instance of the BulgePinchFilter with the provided parameters
5092
5318
  createFilter: (s) => {
5093
5319
  try {
5094
- const e = s.centerX ?? 0.5, i = s.centerY ?? 0.5, t = s.radius ?? 100, r = s.strength ?? 1, a = new st({
5320
+ const e = s.centerX ?? 0.5, i = s.centerY ?? 0.5, t = s.radius ?? 100, r = s.strength ?? 1, a = new dt({
5095
5321
  center: {
5096
5322
  x: e,
5097
5323
  y: i
@@ -5099,21 +5325,21 @@ f({
5099
5325
  radius: t,
5100
5326
  strength: r
5101
5327
  });
5102
- return a._customParams = { ...s }, a.updateUIParam = function(l, o) {
5328
+ return a._customParams = { ...s }, a.updateUIParam = function(o, l) {
5103
5329
  const n = this._customParams || {};
5104
- switch (this._customParams = n, n[l] = o, l) {
5330
+ switch (this._customParams = n, n[o] = l, o) {
5105
5331
  case "centerX":
5106
- this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.x = o;
5332
+ this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.x = l;
5107
5333
  break;
5108
5334
  case "centerY":
5109
- this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.y = o;
5335
+ this.center || (this.center = { x: 0.5, y: 0.5 }), this.center.y = l;
5110
5336
  break;
5111
5337
  case "radius":
5112
5338
  case "strength":
5113
- this[l] = o;
5339
+ this[o] = l;
5114
5340
  break;
5115
5341
  default:
5116
- l in this && (this[l] = o);
5342
+ o in this && (this[o] = l);
5117
5343
  break;
5118
5344
  }
5119
5345
  return !0;
@@ -5173,7 +5399,7 @@ f({
5173
5399
  }
5174
5400
  ]
5175
5401
  });
5176
- const { ConvolutionFilter: at } = g, M = {
5402
+ const { ConvolutionFilter: ut } = g, A = {
5177
5403
  normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
5178
5404
  gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
5179
5405
  boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
@@ -5206,25 +5432,25 @@ f({
5206
5432
  ];
5207
5433
  else {
5208
5434
  const t = s.preset;
5209
- e = M[t] || M.normal;
5435
+ e = A[t] || A.normal;
5210
5436
  }
5211
- const i = new at(e, s.width || 200, s.height || 200);
5437
+ const i = new ut(e, s.width || 200, s.height || 200);
5212
5438
  return i._customParams = { ...s }, i.updateUIParam = function(t, r) {
5213
5439
  const a = this._customParams || {};
5214
5440
  switch (this._customParams = a, a[t] = r, t) {
5215
5441
  case "preset":
5216
5442
  if (!a.customMatrix) {
5217
- const l = r;
5218
- M[l] && (this.matrix = M[l]);
5443
+ const o = r;
5444
+ A[o] && (this.matrix = A[o]);
5219
5445
  }
5220
5446
  break;
5221
5447
  case "customMatrix":
5222
5448
  if (r) {
5223
- const l = this.matrix;
5224
- a.m00 = l[0], a.m01 = l[1], a.m02 = l[2], a.m10 = l[3], a.m11 = l[4], a.m12 = l[5], a.m20 = l[6], a.m21 = l[7], a.m22 = l[8];
5449
+ const o = this.matrix;
5450
+ 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];
5225
5451
  } else {
5226
- const l = a.preset;
5227
- this.matrix = M[l] || M.normal;
5452
+ const o = a.preset;
5453
+ this.matrix = A[o] || A.normal;
5228
5454
  }
5229
5455
  break;
5230
5456
  case "m00":
@@ -5237,7 +5463,7 @@ f({
5237
5463
  case "m21":
5238
5464
  case "m22":
5239
5465
  if (a.customMatrix) {
5240
- const l = [...this.matrix], n = {
5466
+ const o = [...this.matrix], n = {
5241
5467
  m00: 0,
5242
5468
  m01: 1,
5243
5469
  m02: 2,
@@ -5248,7 +5474,7 @@ f({
5248
5474
  m21: 7,
5249
5475
  m22: 8
5250
5476
  }[t];
5251
- n !== void 0 && (l[n] = r, this.matrix = l);
5477
+ n !== void 0 && (o[n] = r, this.matrix = o);
5252
5478
  }
5253
5479
  break;
5254
5480
  case "width":
@@ -5419,7 +5645,7 @@ f({
5419
5645
  }
5420
5646
  ]
5421
5647
  });
5422
- const { CrossHatchFilter: lt } = g;
5648
+ const { CrossHatchFilter: pt } = g;
5423
5649
  f({
5424
5650
  id: "cross-hatch",
5425
5651
  name: "Cross Hatch",
@@ -5429,7 +5655,7 @@ f({
5429
5655
  // Note: CrossHatchFilter has NO parameters according to PixiJS examples
5430
5656
  createFilter: (s) => {
5431
5657
  try {
5432
- const e = new lt();
5658
+ const e = new pt();
5433
5659
  return e.updateUIParam = function(i, t) {
5434
5660
  return !0;
5435
5661
  }, e;
@@ -5626,7 +5852,7 @@ f({
5626
5852
  }
5627
5853
  ]
5628
5854
  });
5629
- const ot = C.DisplacementFilter, nt = C.Sprite, E = C.Texture;
5855
+ const ft = C.DisplacementFilter, mt = C.Sprite, V = C.Texture;
5630
5856
  f({
5631
5857
  id: "displacement",
5632
5858
  // ID must match what the application expects
@@ -5639,41 +5865,41 @@ f({
5639
5865
  const e = s.mapTexture || "/assets/images/displacement_map.png";
5640
5866
  let i;
5641
5867
  try {
5642
- i = E.from(e), i.source.addressMode = "repeat";
5868
+ i = V.from(e), i.source.addressMode = "repeat";
5643
5869
  } catch {
5644
- const l = document.createElement("canvas");
5645
- l.width = 256, l.height = 256;
5646
- const o = l.getContext("2d");
5647
- if (o) {
5648
- o.fillStyle = "#ffffff", o.fillRect(0, 0, l.width, l.height), o.fillStyle = "#000000";
5870
+ const o = document.createElement("canvas");
5871
+ o.width = 256, o.height = 256;
5872
+ const l = o.getContext("2d");
5873
+ if (l) {
5874
+ l.fillStyle = "#ffffff", l.fillRect(0, 0, o.width, o.height), l.fillStyle = "#000000";
5649
5875
  for (let n = 0; n < 10; n++)
5650
5876
  for (let c = 0; c < 10; c++)
5651
- (n + c) % 2 === 0 && o.fillRect(n * 25, c * 25, 25, 25);
5877
+ (n + c) % 2 === 0 && l.fillRect(n * 25, c * 25, 25, 25);
5652
5878
  }
5653
- i = E.from(l);
5879
+ i = V.from(o);
5654
5880
  }
5655
- const t = new nt(i), r = new ot(t, s.scale || 50);
5656
- return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = t, r.updateUIParam = function(a, l) {
5657
- const o = this._customParams || {};
5658
- switch (this._customParams = o, o[a] = l, a) {
5881
+ const t = new mt(i), r = new ft(t, s.scale || 50);
5882
+ return r.scale.x = s.scaleX || 50, r.scale.y = s.scaleY || 50, r._customParams = { ...s }, r._displacementSprite = t, r.updateUIParam = function(a, o) {
5883
+ const l = this._customParams || {};
5884
+ switch (this._customParams = l, l[a] = o, a) {
5659
5885
  case "scaleX":
5660
- this.scale.x = l;
5886
+ this.scale.x = o;
5661
5887
  break;
5662
5888
  case "scaleY":
5663
- this.scale.y = l;
5889
+ this.scale.y = o;
5664
5890
  break;
5665
5891
  case "mapTexture":
5666
5892
  try {
5667
5893
  const n = this._displacementSprite;
5668
5894
  if (n) {
5669
- const c = E.from(l);
5895
+ const c = V.from(o);
5670
5896
  c.source.addressMode = "repeat", n.texture = c;
5671
5897
  }
5672
5898
  } catch {
5673
5899
  }
5674
5900
  break;
5675
5901
  default:
5676
- a in this ? this[a] = l : a in this.scale && (this.scale[a] = l);
5902
+ a in this ? this[a] = o : a in this.scale && (this.scale[a] = o);
5677
5903
  break;
5678
5904
  }
5679
5905
  return !0;
@@ -5799,7 +6025,7 @@ f({
5799
6025
  }
5800
6026
  ]
5801
6027
  });
5802
- const { EmbossFilter: ct } = g;
6028
+ const { EmbossFilter: gt } = g;
5803
6029
  f({
5804
6030
  id: "emboss",
5805
6031
  name: "Emboss",
@@ -5808,7 +6034,7 @@ f({
5808
6034
  // Create an instance of the Emboss filter with the provided parameters
5809
6035
  createFilter: (s) => {
5810
6036
  try {
5811
- const e = typeof s.strength == "number" ? s.strength : 5, i = new ct(e);
6037
+ const e = typeof s.strength == "number" ? s.strength : 5, i = new gt(e);
5812
6038
  return i._customParams = {
5813
6039
  strength: e
5814
6040
  }, i.updateUIParam = function(t, r) {
@@ -5816,8 +6042,8 @@ f({
5816
6042
  const a = this._customParams || {};
5817
6043
  switch (this._customParams = a, a[t] = r, t) {
5818
6044
  case "strength":
5819
- const l = Number(r);
5820
- a.strength = l, this.strength = l;
6045
+ const o = Number(r);
6046
+ a.strength = o, this.strength = o;
5821
6047
  break;
5822
6048
  default:
5823
6049
  t in this && (this[t] = r);
@@ -5848,7 +6074,7 @@ f({
5848
6074
  }
5849
6075
  ]
5850
6076
  });
5851
- const { GlitchFilter: ht } = g, P = {
6077
+ const { GlitchFilter: bt } = g, M = {
5852
6078
  TRANSPARENT: 0,
5853
6079
  ORIGINAL: 1,
5854
6080
  LOOP: 2,
@@ -5862,7 +6088,7 @@ f({
5862
6088
  description: "Apply digital distortion and glitch effects",
5863
6089
  createFilter: (s) => {
5864
6090
  try {
5865
- const e = { x: s.redX, y: s.redY }, i = { x: s.greenX, y: s.greenY }, t = { x: s.blueX, y: s.blueY }, r = new ht({
6091
+ const e = { x: s.redX, y: s.redY }, i = { x: s.greenX, y: s.greenY }, t = { x: s.blueX, y: s.blueY }, r = new bt({
5866
6092
  slices: s.slices,
5867
6093
  offset: s.offset,
5868
6094
  direction: s.direction,
@@ -5877,34 +6103,34 @@ f({
5877
6103
  });
5878
6104
  r.animating = s.animating || !1, r._customParams = { ...s }, typeof r.refresh == "function" && r.refresh();
5879
6105
  let a = null;
5880
- const l = () => {
5881
- r.animating && (r.seed = Math.random()), a = requestAnimationFrame(l);
6106
+ const o = () => {
6107
+ r.animating && (r.seed = Math.random()), a = requestAnimationFrame(o);
5882
6108
  };
5883
- return r.animating && (a = requestAnimationFrame(l)), r._stopAnimation = () => {
6109
+ return r.animating && (a = requestAnimationFrame(o)), r._stopAnimation = () => {
5884
6110
  a !== null && (cancelAnimationFrame(a), a = null);
5885
- }, r.updateUIParam = function(o, n) {
6111
+ }, r.updateUIParam = function(l, n) {
5886
6112
  const c = this._customParams || {};
5887
- switch (this._customParams = c, c[o] = n, o) {
6113
+ switch (this._customParams = c, c[l] = n, l) {
5888
6114
  case "animating":
5889
- this.animating = n, n && !a && (a = requestAnimationFrame(l));
6115
+ this.animating = n, n && !a && (a = requestAnimationFrame(o));
5890
6116
  break;
5891
6117
  case "slices":
5892
6118
  this.slices = Math.round(n);
5893
6119
  break;
5894
6120
  case "redX":
5895
6121
  case "redY":
5896
- const u = this.red;
5897
- o === "redX" ? u.x = n : u.y = n, this.red = u;
6122
+ const d = this.red;
6123
+ l === "redX" ? d.x = n : d.y = n, this.red = d;
5898
6124
  break;
5899
6125
  case "greenX":
5900
6126
  case "greenY":
5901
6127
  const h = this.green;
5902
- o === "greenX" ? h.x = n : h.y = n, this.green = h;
6128
+ l === "greenX" ? h.x = n : h.y = n, this.green = h;
5903
6129
  break;
5904
6130
  case "blueX":
5905
6131
  case "blueY":
5906
6132
  const p = this.blue;
5907
- o === "blueX" ? p.x = n : p.y = n, this.blue = p;
6133
+ l === "blueX" ? p.x = n : p.y = n, this.blue = p;
5908
6134
  break;
5909
6135
  case "seed":
5910
6136
  this.animating || (this.seed = n);
@@ -5925,10 +6151,10 @@ f({
5925
6151
  case "average":
5926
6152
  case "minSize":
5927
6153
  case "sampleSize":
5928
- o in this && (this[o] = n);
6154
+ l in this && (this[l] = n);
5929
6155
  break;
5930
6156
  default:
5931
- o in this && (this[o] = n);
6157
+ l in this && (this[l] = n);
5932
6158
  break;
5933
6159
  }
5934
6160
  }, r;
@@ -5940,7 +6166,7 @@ f({
5940
6166
  slices: 10,
5941
6167
  offset: 100,
5942
6168
  direction: 0,
5943
- fillMode: P.LOOP,
6169
+ fillMode: M.LOOP,
5944
6170
  // LOOP mode looks better for the demo
5945
6171
  seed: 0.5,
5946
6172
  average: !1,
@@ -6003,13 +6229,13 @@ f({
6003
6229
  label: "Fill Mode",
6004
6230
  property: "fillMode",
6005
6231
  options: [
6006
- { value: P.TRANSPARENT, label: "Transparent" },
6007
- { value: P.ORIGINAL, label: "Original" },
6008
- { value: P.LOOP, label: "Loop" },
6009
- { value: P.CLAMP, label: "Clamp" },
6010
- { value: P.MIRROR, label: "Mirror" }
6232
+ { value: M.TRANSPARENT, label: "Transparent" },
6233
+ { value: M.ORIGINAL, label: "Original" },
6234
+ { value: M.LOOP, label: "Loop" },
6235
+ { value: M.CLAMP, label: "Clamp" },
6236
+ { value: M.MIRROR, label: "Mirror" }
6011
6237
  ],
6012
- default: P.LOOP
6238
+ default: M.LOOP
6013
6239
  },
6014
6240
  {
6015
6241
  id: "seed",
@@ -6103,7 +6329,7 @@ f({
6103
6329
  }
6104
6330
  ]
6105
6331
  });
6106
- const { GlowFilter: dt } = g;
6332
+ const { GlowFilter: yt } = g;
6107
6333
  f({
6108
6334
  id: "glow",
6109
6335
  name: "Glow",
@@ -6112,7 +6338,7 @@ f({
6112
6338
  // Create an instance of the GlowFilter with the provided parameters
6113
6339
  createFilter: (s) => {
6114
6340
  try {
6115
- const e = parseInt(s.color.replace("#", "0x"), 16), i = new dt({
6341
+ const e = parseInt(s.color.replace("#", "0x"), 16), i = new yt({
6116
6342
  distance: s.distance || 10,
6117
6343
  outerStrength: s.outerStrength || 4,
6118
6344
  innerStrength: s.innerStrength || 0,
@@ -6238,7 +6464,7 @@ f({
6238
6464
  }
6239
6465
  ]
6240
6466
  });
6241
- const { GodrayFilter: ut } = g;
6467
+ const { GodrayFilter: _t } = g;
6242
6468
  f({
6243
6469
  id: "godray",
6244
6470
  name: "Godray",
@@ -6247,7 +6473,7 @@ f({
6247
6473
  // Create an instance of the GodrayFilter with the provided parameters
6248
6474
  createFilter: (s) => {
6249
6475
  try {
6250
- const e = new ut({
6476
+ const e = new _t({
6251
6477
  angle: s.angle || 30,
6252
6478
  parallel: s.parallel ?? !0,
6253
6479
  center: {
@@ -6400,7 +6626,7 @@ f({
6400
6626
  }
6401
6627
  ]
6402
6628
  });
6403
- const pt = g.SimpleLightmapFilter, j = C.Texture;
6629
+ const xt = g.SimpleLightmapFilter, W = C.Texture;
6404
6630
  f({
6405
6631
  id: "lightmap",
6406
6632
  name: "Lightmap",
@@ -6425,41 +6651,41 @@ f({
6425
6651
  const c = a.createRadialGradient(128, 128, 10, 128, 128, 160);
6426
6652
  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);
6427
6653
  }
6428
- const l = j.from(r);
6429
- let o;
6654
+ const o = W.from(r);
6655
+ let l;
6430
6656
  try {
6431
- typeof i == "string" && i.startsWith("#") ? o = parseInt(i.replace("#", "0x"), 16) : o = 0;
6657
+ typeof i == "string" && i.startsWith("#") ? l = parseInt(i.replace("#", "0x"), 16) : l = 0;
6432
6658
  } catch {
6433
- o = 0;
6659
+ l = 0;
6434
6660
  }
6435
- const n = new pt(l, o, t);
6661
+ const n = new xt(o, l, t);
6436
6662
  return n._customParams = {
6437
6663
  textureType: e,
6438
6664
  color: i,
6439
6665
  alpha: t
6440
- }, n.updateUIParam = function(c, u) {
6666
+ }, n.updateUIParam = function(c, d) {
6441
6667
  try {
6442
6668
  const h = this._customParams || {};
6443
- switch (this._customParams = h, h[c] = u, c) {
6669
+ switch (this._customParams = h, h[c] = d, c) {
6444
6670
  case "textureType":
6445
- h.textureType = u;
6671
+ h.textureType = d;
6446
6672
  const p = document.createElement("canvas");
6447
6673
  p.width = 256, p.height = 256;
6448
6674
  const m = p.getContext("2d");
6449
6675
  if (m) {
6450
- if (u === "spotlight") {
6676
+ if (d === "spotlight") {
6451
6677
  m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
6452
6678
  const b = m.createRadialGradient(128, 128, 5, 128, 128, 80);
6453
6679
  b.addColorStop(0, "white"), b.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), b.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = b, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
6454
- } else if (u === "softlight") {
6680
+ } else if (d === "softlight") {
6455
6681
  const b = m.createLinearGradient(0, 0, 256, 256);
6456
6682
  b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.7, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
6457
6683
  } else {
6458
6684
  const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
6459
6685
  b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.6, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "black"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
6460
6686
  }
6461
- const x = j.from(p);
6462
- if (this.lightMap = x, this.enabled !== void 0) {
6687
+ const S = W.from(p);
6688
+ if (this.lightMap = S, this.enabled !== void 0) {
6463
6689
  const b = this.enabled;
6464
6690
  this.enabled = !1, setTimeout(() => {
6465
6691
  this.enabled = b;
@@ -6468,18 +6694,18 @@ f({
6468
6694
  }
6469
6695
  break;
6470
6696
  case "color":
6471
- h.color = u;
6697
+ h.color = d;
6472
6698
  try {
6473
- typeof u == "string" && u.startsWith("#") ? this.color = parseInt(u.replace("#", "0x"), 16) : this.color = 0;
6699
+ typeof d == "string" && d.startsWith("#") ? this.color = parseInt(d.replace("#", "0x"), 16) : this.color = 0;
6474
6700
  } catch {
6475
6701
  this.color = 0;
6476
6702
  }
6477
6703
  break;
6478
6704
  case "alpha":
6479
- this.alpha = Number(u);
6705
+ this.alpha = Number(d);
6480
6706
  break;
6481
6707
  default:
6482
- c in this && (this[c] = u);
6708
+ c in this && (this[c] = d);
6483
6709
  break;
6484
6710
  }
6485
6711
  } catch {
@@ -6531,7 +6757,7 @@ f({
6531
6757
  }
6532
6758
  ]
6533
6759
  });
6534
- const { NoiseFilter: ft } = C;
6760
+ const { NoiseFilter: Ct } = C;
6535
6761
  f({
6536
6762
  id: "noise",
6537
6763
  name: "Noise",
@@ -6539,7 +6765,7 @@ f({
6539
6765
  description: "Add random noise to the image",
6540
6766
  createFilter: (s) => {
6541
6767
  try {
6542
- const e = new ft({
6768
+ const e = new Ct({
6543
6769
  noise: s.noise || 0.5,
6544
6770
  seed: s.seed || Math.random()
6545
6771
  });
@@ -6551,8 +6777,8 @@ f({
6551
6777
  return e.animating && (i = requestAnimationFrame(t)), e._stopAnimation = () => {
6552
6778
  i !== null && (cancelAnimationFrame(i), i = null);
6553
6779
  }, e.updateUIParam = function(r, a) {
6554
- const l = this._customParams || {};
6555
- switch (this._customParams = l, l[r] = a, r) {
6780
+ const o = this._customParams || {};
6781
+ switch (this._customParams = o, o[r] = a, r) {
6556
6782
  case "animating":
6557
6783
  this.animating = a, a && !i && (i = requestAnimationFrame(t));
6558
6784
  break;
@@ -6616,7 +6842,7 @@ f({
6616
6842
  }
6617
6843
  ]
6618
6844
  });
6619
- const { OldFilmFilter: mt } = g;
6845
+ const { OldFilmFilter: wt } = g;
6620
6846
  f({
6621
6847
  id: "old-film",
6622
6848
  name: "Old Film",
@@ -6624,7 +6850,7 @@ f({
6624
6850
  description: "Apply a vintage film effect with scratches and grain",
6625
6851
  createFilter: (s) => {
6626
6852
  try {
6627
- const e = new mt({
6853
+ const e = new wt({
6628
6854
  sepia: s.sepia,
6629
6855
  noise: s.noise,
6630
6856
  noiseSize: s.noiseSize,
@@ -6644,8 +6870,8 @@ f({
6644
6870
  return e.animating && (i = requestAnimationFrame(t)), e._stopAnimation = () => {
6645
6871
  i !== null && (cancelAnimationFrame(i), i = null);
6646
6872
  }, e.updateUIParam = function(r, a) {
6647
- const l = this._customParams || {};
6648
- switch (this._customParams = l, l[r] = a, r) {
6873
+ const o = this._customParams || {};
6874
+ switch (this._customParams = o, o[r] = a, r) {
6649
6875
  case "animating":
6650
6876
  this.animating = a, a && !i && (i = requestAnimationFrame(t));
6651
6877
  break;
@@ -6805,7 +7031,7 @@ f({
6805
7031
  }
6806
7032
  ]
6807
7033
  });
6808
- const { OutlineFilter: gt } = g;
7034
+ const { OutlineFilter: St } = g;
6809
7035
  f({
6810
7036
  id: "outline",
6811
7037
  name: "Outline",
@@ -6815,7 +7041,7 @@ f({
6815
7041
  try {
6816
7042
  let e = s.color;
6817
7043
  typeof e == "string" && (e = parseInt(e.replace("#", "0x"), 16));
6818
- const i = new gt({
7044
+ const i = new St({
6819
7045
  thickness: s.thickness || 4,
6820
7046
  color: e,
6821
7047
  alpha: s.alpha || 1,
@@ -6905,7 +7131,7 @@ f({
6905
7131
  }
6906
7132
  ]
6907
7133
  });
6908
- const { PixelateFilter: bt } = g;
7134
+ const { PixelateFilter: kt } = g;
6909
7135
  f({
6910
7136
  id: "pixelate",
6911
7137
  name: "Pixelate",
@@ -6913,7 +7139,7 @@ f({
6913
7139
  description: "Create a pixelated or mosaic effect",
6914
7140
  createFilter: (s) => {
6915
7141
  try {
6916
- const e = new bt(
7142
+ const e = new kt(
6917
7143
  s.useUniform ? Math.max(4, s.size || 10) : [Math.max(4, s.sizeX || 10), Math.max(4, s.sizeY || 10)]
6918
7144
  );
6919
7145
  return e._customParams = { ...s }, e.updateUIParam = function(i, t) {
@@ -6996,7 +7222,7 @@ f({
6996
7222
  }
6997
7223
  ]
6998
7224
  });
6999
- const { ReflectionFilter: yt } = g;
7225
+ const { ReflectionFilter: vt } = g;
7000
7226
  f({
7001
7227
  id: "reflection",
7002
7228
  // ID must match what the application expects
@@ -7013,7 +7239,7 @@ f({
7013
7239
  waveLength: new Float32Array([s.wavelengthStart ?? 30, s.wavelengthEnd ?? 100]),
7014
7240
  alpha: new Float32Array([s.alphaStart ?? 1, s.alphaEnd ?? 1]),
7015
7241
  time: s.time ?? 0
7016
- }, i = new yt(e);
7242
+ }, i = new vt(e);
7017
7243
  return i._customParams = { ...s }, i.animating = s.animating ?? !1, i.updateUIParam = function(t, r) {
7018
7244
  const a = this._customParams || {};
7019
7245
  switch (this._customParams = a, a[t] = r, t) {
@@ -7164,7 +7390,7 @@ f({
7164
7390
  }
7165
7391
  ]
7166
7392
  });
7167
- const { ShockwaveFilter: _t } = g;
7393
+ const { ShockwaveFilter: Pt } = g;
7168
7394
  f({
7169
7395
  id: "shockwave",
7170
7396
  // ID must match what the application expects
@@ -7174,16 +7400,16 @@ f({
7174
7400
  // Create an instance of the ShockwaveFilter with the provided parameters
7175
7401
  createFilter: (s) => {
7176
7402
  try {
7177
- const e = s.centerX ?? 0.5, i = s.centerY ?? 0.5, t = { x: e, y: i }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, l = s.speed ?? 500, o = s.brightness ?? 1, n = s.radius ?? -1, c = s.time ?? 0, u = new _t({
7403
+ const e = s.centerX ?? 0.5, i = s.centerY ?? 0.5, t = { x: e, y: i }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, l = s.brightness ?? 1, n = s.radius ?? -1, c = s.time ?? 0, d = new Pt({
7178
7404
  center: t,
7179
7405
  amplitude: r,
7180
7406
  wavelength: a,
7181
- speed: l,
7182
- brightness: o,
7407
+ speed: o,
7408
+ brightness: l,
7183
7409
  radius: n,
7184
7410
  time: c
7185
7411
  });
7186
- return u._customParams = { ...s }, u.animating = s.animating ?? !1, u.updateUIParam = function(h, p) {
7412
+ return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, p) {
7187
7413
  const m = this._customParams || {};
7188
7414
  switch (this._customParams = m, m[h] = p, h) {
7189
7415
  case "centerX":
@@ -7208,7 +7434,7 @@ f({
7208
7434
  break;
7209
7435
  }
7210
7436
  return !0;
7211
- }, u;
7437
+ }, d;
7212
7438
  } catch {
7213
7439
  return null;
7214
7440
  }
@@ -7316,7 +7542,7 @@ f({
7316
7542
  }
7317
7543
  ]
7318
7544
  });
7319
- const { SimplexNoiseFilter: xt } = g;
7545
+ const { SimplexNoiseFilter: Mt } = g;
7320
7546
  f({
7321
7547
  id: "simplex-noise",
7322
7548
  name: "Simplex Noise",
@@ -7324,7 +7550,7 @@ f({
7324
7550
  description: "Apply procedural noise to create texture effects",
7325
7551
  createFilter: (s) => {
7326
7552
  try {
7327
- const e = s.animating ? 0 : s.offsetZ || 0, i = new xt({
7553
+ const e = s.animating ? 0 : s.offsetZ || 0, i = new Mt({
7328
7554
  strength: s.strength,
7329
7555
  noiseScale: s.noiseScale,
7330
7556
  offsetX: s.offsetX,
@@ -7339,20 +7565,20 @@ f({
7339
7565
  };
7340
7566
  return i.animating && (t = requestAnimationFrame(a)), i._stopAnimation = () => {
7341
7567
  t !== null && (cancelAnimationFrame(t), t = null);
7342
- }, i.updateUIParam = function(l, o) {
7568
+ }, i.updateUIParam = function(o, l) {
7343
7569
  const n = this._customParams || {};
7344
- switch (this._customParams = n, n[l] = o, l) {
7570
+ switch (this._customParams = n, n[o] = l, o) {
7345
7571
  case "animating":
7346
- this.animating = o, o && !t && (t = requestAnimationFrame(a));
7572
+ this.animating = l, l && !t && (t = requestAnimationFrame(a));
7347
7573
  break;
7348
7574
  case "animationSpeed":
7349
- this.animationSpeed = o;
7575
+ this.animationSpeed = l;
7350
7576
  break;
7351
7577
  case "offsetZ":
7352
- this.animating || (this.offsetZ = o);
7578
+ this.animating || (this.offsetZ = l);
7353
7579
  break;
7354
7580
  case "randomizeSeed":
7355
- if (o) {
7581
+ if (l) {
7356
7582
  const c = () => Math.random() * 100 - 50;
7357
7583
  this.offsetX = c(), this.offsetY = c(), this.offsetZ = c(), n.offsetX = this.offsetX, n.offsetY = this.offsetY, n.offsetZ = this.offsetZ;
7358
7584
  }
@@ -7362,10 +7588,10 @@ f({
7362
7588
  case "offsetX":
7363
7589
  case "offsetY":
7364
7590
  case "step":
7365
- l in this && (this[l] = o);
7591
+ o in this && (this[o] = l);
7366
7592
  break;
7367
7593
  default:
7368
- l in this && (this[l] = o);
7594
+ o in this && (this[o] = l);
7369
7595
  break;
7370
7596
  }
7371
7597
  }, i;
@@ -7471,9 +7697,9 @@ f({
7471
7697
  }
7472
7698
  ]
7473
7699
  });
7474
- class Ct extends C.Filter {
7700
+ class Ft extends C.Filter {
7475
7701
  constructor(e) {
7476
- const i = K.from({
7702
+ const i = se.from({
7477
7703
  vertex: `
7478
7704
  attribute vec2 aPosition;
7479
7705
  varying vec2 vTextureCoord;
@@ -7582,7 +7808,7 @@ f({
7582
7808
  description: "Creates a twisting distortion effect around a central point",
7583
7809
  createFilter: (s) => {
7584
7810
  try {
7585
- const e = new Ct({
7811
+ const e = new Ft({
7586
7812
  centerX: s.centerX ?? 0.5,
7587
7813
  centerY: s.centerY ?? 0.5,
7588
7814
  radius: s.radius ?? 0.25,
@@ -7652,8 +7878,8 @@ f({
7652
7878
  }
7653
7879
  ]
7654
7880
  });
7655
- const { AdjustmentFilter: wt } = g;
7656
- function T(s) {
7881
+ const { AdjustmentFilter: zt } = g;
7882
+ function E(s) {
7657
7883
  const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
7658
7884
  return [
7659
7885
  (e >> 16 & 255) / 255,
@@ -7661,14 +7887,14 @@ function T(s) {
7661
7887
  (e & 255) / 255
7662
7888
  ];
7663
7889
  }
7664
- class St extends wt {
7890
+ class At extends zt {
7665
7891
  constructor(e = {}) {
7666
7892
  super({
7667
7893
  brightness: 1,
7668
7894
  contrast: 1,
7669
7895
  saturation: 1,
7670
7896
  alpha: 1
7671
- }), 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 = T(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = T(e.color))), this.updateVignette();
7897
+ }), 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 = E(e.color)) : (this._colorValue = "#" + e.color.toString(16).padStart(6, "0"), this._colorRgb = E(e.color))), this.updateVignette();
7672
7898
  }
7673
7899
  /**
7674
7900
  * Updates the filter parameters to simulate a vignette effect
@@ -7694,7 +7920,7 @@ class St extends wt {
7694
7920
  return this._colorValue;
7695
7921
  }
7696
7922
  set color(e) {
7697
- typeof e == "string" ? (this._colorValue = e, this._colorRgb = T(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = T(e)), this.updateVignette();
7923
+ typeof e == "string" ? (this._colorValue = e, this._colorRgb = E(e)) : (this._colorValue = "#" + e.toString(16).padStart(6, "0"), this._colorRgb = E(e)), this.updateVignette();
7698
7924
  }
7699
7925
  }
7700
7926
  f({
@@ -7704,7 +7930,7 @@ f({
7704
7930
  description: "Add a classic darkened border effect to the image",
7705
7931
  createFilter: (s) => {
7706
7932
  try {
7707
- const e = new St({
7933
+ const e = new At({
7708
7934
  radius: s.radius || 0.8,
7709
7935
  strength: s.strength || 1,
7710
7936
  color: s.color || "#000000"
@@ -7768,15 +7994,15 @@ f({
7768
7994
  }
7769
7995
  ]
7770
7996
  });
7771
- function Mt() {
7997
+ function Xt() {
7772
7998
  try {
7773
7999
  let s = [], e = [];
7774
8000
  try {
7775
- s = I(), s.length === 0 && Xe();
8001
+ s = Y(), s.length === 0 && Ue();
7776
8002
  } catch {
7777
8003
  }
7778
8004
  try {
7779
- s = I(), e = Ee();
8005
+ s = Y(), e = je();
7780
8006
  } catch {
7781
8007
  s || (s = []), e || (e = []);
7782
8008
  }
@@ -7786,14 +8012,14 @@ function Mt() {
7786
8012
  }
7787
8013
  }
7788
8014
  export {
7789
- vt as V,
7790
- Ie as a,
7791
- Ye as b,
7792
- Ee as c,
7793
- Be as d,
7794
- I as g,
7795
- Pt as h,
7796
- Mt as i,
8015
+ Tt as V,
8016
+ Ve as a,
8017
+ De as b,
8018
+ je as c,
8019
+ qe as d,
8020
+ Y as g,
8021
+ It as h,
8022
+ Xt as i,
7797
8023
  f as r
7798
8024
  };
7799
- //# sourceMappingURL=index-CcGWfCCV.js.map
8025
+ //# sourceMappingURL=index-BsOWbGbb.js.map