@linker-design-plus/timeline-track 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- var Pn = Object.defineProperty;
2
- var xn = (a, t, e) => t in a ? Pn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var f = (a, t, e) => xn(a, typeof t != "symbol" ? t + "" : t, e);
4
- const An = {
1
+ var xn = Object.defineProperty;
2
+ var An = (a, t, e) => t in a ? xn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var f = (a, t, e) => An(a, typeof t != "symbol" ? t + "" : t, e);
4
+ const En = {
5
5
  isDragging: !1,
6
6
  isResizing: !1,
7
7
  isResizingLeft: !1,
@@ -52,7 +52,7 @@ const wt = {
52
52
  mode: "auto-first-added-video",
53
53
  width: 16,
54
54
  height: 9
55
- }, El = [
55
+ }, Il = [
56
56
  {
57
57
  key: "default",
58
58
  label: "默认",
@@ -79,20 +79,20 @@ const wt = {
79
79
  aspectRatio: { mode: "manual", width: 4, height: 3 }
80
80
  }
81
81
  ];
82
- function Ls(a) {
82
+ function Rs(a) {
83
83
  return a === "manual" ? "manual" : "auto-first-added-video";
84
84
  }
85
85
  function pe(a) {
86
- return Ls(a) === "auto-first-added-video";
86
+ return Rs(a) === "auto-first-added-video";
87
87
  }
88
88
  function Nt(a) {
89
89
  return {
90
- mode: Ls(a == null ? void 0 : a.mode),
90
+ mode: Rs(a == null ? void 0 : a.mode),
91
91
  width: typeof (a == null ? void 0 : a.width) == "number" && a.width > 0 ? a.width : wt.width,
92
92
  height: typeof (a == null ? void 0 : a.height) == "number" && a.height > 0 ? a.height : wt.height
93
93
  };
94
94
  }
95
- const Il = {
95
+ const Ml = {
96
96
  DEFAULT: 1,
97
97
  // 默认层级
98
98
  ACTIVE: 2
@@ -103,12 +103,12 @@ const Il = {
103
103
  MEDIUM: 30,
104
104
  LARGE: 60,
105
105
  MAX: 100
106
- }, En = {
106
+ }, In = {
107
107
  DURATION: 300,
108
108
  // 动画持续时间(毫秒)
109
109
  EASING: "easeOutCubic"
110
110
  // 缓动函数
111
- }, Ml = {
111
+ }, Ll = {
112
112
  DEFAULT_HEIGHT: 40,
113
113
  // 默认时间刻度高度
114
114
  MIN_HEIGHT: 20,
@@ -119,19 +119,19 @@ const Il = {
119
119
  AUDIO: 48
120
120
  // 音频轨道高度
121
121
  };
122
- function In(a = {}) {
122
+ function Mn(a = {}) {
123
123
  const t = Object.fromEntries(
124
124
  Object.entries(a).filter(([, e]) => e !== void 0)
125
125
  );
126
126
  return {
127
- ...An,
127
+ ...En,
128
128
  ...t
129
129
  };
130
130
  }
131
- function Ds(a, t = {}) {
131
+ function Os(a, t = {}) {
132
132
  return {
133
133
  ...a,
134
- ...In(t)
134
+ ...Mn(t)
135
135
  };
136
136
  }
137
137
  class z {
@@ -259,19 +259,19 @@ class z {
259
259
  * 刻度类型
260
260
  */
261
261
  f(z, "TICK_TYPE_MAJOR", "major"), f(z, "TICK_TYPE_MINOR", "minor");
262
- const Mn = Math.PI / 180;
263
- function Ln() {
262
+ const Ln = Math.PI / 180;
263
+ function Dn() {
264
264
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
265
265
  }
266
266
  const Ft = typeof global < "u" ? global : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, E = {
267
267
  _global: Ft,
268
268
  version: "10.2.0",
269
- isBrowser: Ln(),
269
+ isBrowser: Dn(),
270
270
  isUnminified: /param/.test((function(a) {
271
271
  }).toString()),
272
272
  dblClickWindow: 400,
273
273
  getAngle(a) {
274
- return E.angleDeg ? a * Mn : a;
274
+ return E.angleDeg ? a * Ln : a;
275
275
  },
276
276
  enableTrace: !1,
277
277
  pointerEventsEnabled: !0,
@@ -313,7 +313,7 @@ const Ft = typeof global < "u" ? global : typeof window < "u" ? window : typeof
313
313
  E[a.prototype.getClassName()] = a;
314
314
  };
315
315
  E._injectGlobal(E);
316
- const Dn = `Konva.js unsupported environment.
316
+ const Rn = `Konva.js unsupported environment.
317
317
 
318
318
  Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
319
319
 
@@ -328,7 +328,7 @@ bash: npm install skia-canvas
328
328
  js: import "konva/skia-backend";
329
329
  `, Oi = () => {
330
330
  if (typeof document > "u")
331
- throw new Error(Dn);
331
+ throw new Error(Rn);
332
332
  };
333
333
  class ct {
334
334
  constructor(t = [1, 0, 0, 1, 0, 0]) {
@@ -398,10 +398,10 @@ class ct {
398
398
  const h = Math.sqrt(i * i + s * s);
399
399
  l.rotation = Math.PI / 2 - (s > 0 ? Math.acos(-i / h) : -Math.acos(i / h)), l.scaleX = o / h, l.scaleY = h, l.skewX = 0, l.skewY = (t * i + e * s) / o;
400
400
  }
401
- return l.rotation = C._getRotation(l.rotation), l;
401
+ return l.rotation = S._getRotation(l.rotation), l;
402
402
  }
403
403
  }
404
- const Rn = "[object Array]", On = "[object Number]", Gn = "[object String]", Bn = "[object Boolean]", Hn = Math.PI / 180, zn = 180 / Math.PI, ee = "#", Nn = "", Fn = "0", Vn = "Konva warning: ", Gi = "Konva error: ", Wn = "rgb(", qe = {
404
+ const On = "[object Array]", Gn = "[object Number]", Bn = "[object String]", Hn = "[object Boolean]", zn = Math.PI / 180, Nn = 180 / Math.PI, ee = "#", Fn = "", Vn = "0", Wn = "Konva warning: ", Gi = "Konva error: ", Yn = "rgb(", qe = {
405
405
  aliceblue: [240, 248, 255],
406
406
  antiquewhite: [250, 235, 215],
407
407
  aqua: [0, 255, 255],
@@ -551,11 +551,11 @@ const Rn = "[object Array]", On = "[object Number]", Gn = "[object String]", Bn
551
551
  whitesmoke: [245, 245, 245],
552
552
  yellow: [255, 255, 0],
553
553
  yellowgreen: [154, 205, 5]
554
- }, Yn = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
554
+ }, Xn = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
555
555
  let Pe = [], ie = null;
556
- const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(a) {
556
+ const Un = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(a) {
557
557
  setTimeout(a, 16);
558
- }, C = {
558
+ }, S = {
559
559
  _isElement(a) {
560
560
  return !!(a && a.nodeType == 1);
561
561
  },
@@ -566,16 +566,16 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
566
566
  return !!a && a.constructor === Object;
567
567
  },
568
568
  _isArray(a) {
569
- return Object.prototype.toString.call(a) === Rn;
569
+ return Object.prototype.toString.call(a) === On;
570
570
  },
571
571
  _isNumber(a) {
572
- return Object.prototype.toString.call(a) === On && !isNaN(a) && isFinite(a);
572
+ return Object.prototype.toString.call(a) === Gn && !isNaN(a) && isFinite(a);
573
573
  },
574
574
  _isString(a) {
575
- return Object.prototype.toString.call(a) === Gn;
575
+ return Object.prototype.toString.call(a) === Bn;
576
576
  },
577
577
  _isBoolean(a) {
578
- return Object.prototype.toString.call(a) === Bn;
578
+ return Object.prototype.toString.call(a) === Hn;
579
579
  },
580
580
  isObject(a) {
581
581
  return a instanceof Object;
@@ -590,7 +590,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
590
590
  return a === 0 || a > 0 ? 1 : -1;
591
591
  },
592
592
  requestAnimFrame(a) {
593
- Pe.push(a), Pe.length === 1 && Xn(function() {
593
+ Pe.push(a), Pe.length === 1 && Un(function() {
594
594
  const t = Pe;
595
595
  Pe = [], t.forEach(function(e) {
596
596
  e();
@@ -616,7 +616,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
616
616
  return !1;
617
617
  },
618
618
  _urlToImage(a, t) {
619
- const e = C.createImageElement();
619
+ const e = S.createImageElement();
620
620
  e.onload = function() {
621
621
  t(e);
622
622
  }, e.src = a;
@@ -625,7 +625,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
625
625
  return ((1 << 24) + (a << 16) + (t << 8) + e).toString(16).slice(1);
626
626
  },
627
627
  _hexToRgb(a) {
628
- a = a.replace(ee, Nn);
628
+ a = a.replace(ee, Fn);
629
629
  const t = parseInt(a, 16);
630
630
  return {
631
631
  r: t >> 16 & 255,
@@ -636,7 +636,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
636
636
  getRandomColor() {
637
637
  let a = (Math.random() * 16777215 << 0).toString(16);
638
638
  for (; a.length < 6; )
639
- a = Fn + a;
639
+ a = Vn + a;
640
640
  return ee + a;
641
641
  },
642
642
  isCanvasFarblingActive() {
@@ -676,7 +676,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
676
676
  r: t[0],
677
677
  g: t[1],
678
678
  b: t[2]
679
- }) : a[0] === ee ? this._hexToRgb(a.substring(1)) : a.substr(0, 4) === Wn ? (t = Yn.exec(a.replace(/ /g, "")), {
679
+ }) : a[0] === ee ? this._hexToRgb(a.substring(1)) : a.substr(0, 4) === Yn ? (t = Xn.exec(a.replace(/ /g, "")), {
680
680
  r: parseInt(t[1], 10),
681
681
  g: parseInt(t[2], 10),
682
682
  b: parseInt(t[3], 10)
@@ -687,7 +687,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
687
687
  };
688
688
  },
689
689
  colorToRGBA(a) {
690
- return a = a || "black", C._namedColorToRBA(a) || C._hex3ColorToRGBA(a) || C._hex4ColorToRGBA(a) || C._hex6ColorToRGBA(a) || C._hex8ColorToRGBA(a) || C._rgbColorToRGBA(a) || C._rgbaColorToRGBA(a) || C._hslColorToRGBA(a);
690
+ return a = a || "black", S._namedColorToRBA(a) || S._hex3ColorToRGBA(a) || S._hex4ColorToRGBA(a) || S._hex6ColorToRGBA(a) || S._hex8ColorToRGBA(a) || S._rgbColorToRGBA(a) || S._rgbaColorToRGBA(a) || S._hslColorToRGBA(a);
691
691
  },
692
692
  _namedColorToRBA(a) {
693
693
  const t = qe[a.toLowerCase()];
@@ -794,19 +794,19 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
794
794
  return a.slice(0);
795
795
  },
796
796
  degToRad(a) {
797
- return a * Hn;
797
+ return a * zn;
798
798
  },
799
799
  radToDeg(a) {
800
- return a * zn;
800
+ return a * Nn;
801
801
  },
802
802
  _degToRad(a) {
803
- return C.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), C.degToRad(a);
803
+ return S.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), S.degToRad(a);
804
804
  },
805
805
  _radToDeg(a) {
806
- return C.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), C.radToDeg(a);
806
+ return S.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), S.radToDeg(a);
807
807
  },
808
808
  _getRotation(a) {
809
- return E.angleDeg ? C.radToDeg(a) : a;
809
+ return E.angleDeg ? S.radToDeg(a) : a;
810
810
  },
811
811
  _capitalize(a) {
812
812
  return a.charAt(0).toUpperCase() + a.slice(1);
@@ -818,7 +818,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
818
818
  console.error(Gi + a);
819
819
  },
820
820
  warn(a) {
821
- E.showWarnings && console.warn(Vn + a);
821
+ E.showWarnings && console.warn(Wn + a);
822
822
  },
823
823
  each(a, t) {
824
824
  for (const e in a)
@@ -839,12 +839,12 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
839
839
  return [r, o, l];
840
840
  },
841
841
  _getProjectionToLine(a, t, e) {
842
- const i = C.cloneObject(a);
842
+ const i = S.cloneObject(a);
843
843
  let s = Number.MAX_VALUE;
844
844
  return t.forEach(function(n, r) {
845
845
  if (!e && r === t.length - 1)
846
846
  return;
847
- const o = t[(r + 1) % t.length], l = C._getProjectionToSegment(n.x, n.y, o.x, o.y, a.x, a.y), h = l[0], c = l[1], d = l[2];
847
+ const o = t[(r + 1) % t.length], l = S._getProjectionToSegment(n.x, n.y, o.x, o.y, a.x, a.y), h = l[0], c = l[1], d = l[2];
848
848
  d < s && (i.x = h, i.y = c, s = d);
849
849
  }), i;
850
850
  },
@@ -866,7 +866,7 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
866
866
  });
867
867
  const n = [];
868
868
  return s.forEach(function(r) {
869
- const o = C._getProjectionToLine(r, i, e);
869
+ const o = S._getProjectionToLine(r, i, e);
870
870
  n.push(o.x), n.push(o.y);
871
871
  }), n;
872
872
  },
@@ -875,12 +875,12 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
875
875
  a.visitedByCircularReferenceRemoval = !0;
876
876
  for (const e in a)
877
877
  if (a.hasOwnProperty(e) && a[e] && typeof a[e] == "object") {
878
- if (t = Object.getOwnPropertyDescriptor(a, e), a[e].visitedByCircularReferenceRemoval || C._isElement(a[e]))
878
+ if (t = Object.getOwnPropertyDescriptor(a, e), a[e].visitedByCircularReferenceRemoval || S._isElement(a[e]))
879
879
  if (t.configurable)
880
880
  delete a[e];
881
881
  else
882
882
  return null;
883
- else if (C._prepareToStringify(a[e]) === null)
883
+ else if (S._prepareToStringify(a[e]) === null)
884
884
  if (t.configurable)
885
885
  delete a[e];
886
886
  else
@@ -913,26 +913,26 @@ const Xn = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
913
913
  const r = t[(n - 1 + e) % e], o = t[n], l = t[(n + 1) % e], h = { x: o.x - r.x, y: o.y - r.y }, c = { x: l.x - o.x, y: l.y - o.y }, d = Math.hypot(h.x, h.y), u = Math.hypot(c.x, c.y);
914
914
  let p;
915
915
  typeof s == "number" ? p = s : p = n < s.length ? s[n] : 0, p = i * Math.cos(Math.PI / e) * Math.min(1, p / i * 2);
916
- const y = { x: h.x / d, y: h.y / d }, T = { x: c.x / u, y: c.y / u }, S = {
916
+ const y = { x: h.x / d, y: h.y / d }, T = { x: c.x / u, y: c.y / u }, C = {
917
917
  x: o.x - y.x * p,
918
918
  y: o.y - y.y * p
919
919
  }, v = {
920
920
  x: o.x + T.x * p,
921
921
  y: o.y + T.y * p
922
922
  };
923
- n === 0 ? a.moveTo(S.x, S.y) : a.lineTo(S.x, S.y), a.arcTo(o.x, o.y, v.x, v.y, p);
923
+ n === 0 ? a.moveTo(C.x, C.y) : a.lineTo(C.x, C.y), a.arcTo(o.x, o.y, v.x, v.y, p);
924
924
  }
925
925
  }
926
926
  };
927
- function Un(a) {
928
- const t = [], e = a.length, i = C;
927
+ function $n(a) {
928
+ const t = [], e = a.length, i = S;
929
929
  for (let s = 0; s < e; s++) {
930
930
  let n = a[s];
931
931
  i._isNumber(n) ? n = Math.round(n * 1e3) / 1e3 : i._isString(n) || (n = n + ""), t.push(n);
932
932
  }
933
933
  return t;
934
934
  }
935
- const Bi = ",", $n = "(", Kn = ")", jn = "([", Zn = "])", qn = ";", Jn = "()", Qn = "=", Hi = [
935
+ const Bi = ",", Kn = "(", jn = ")", Zn = "([", qn = "])", Jn = ";", Qn = "()", tr = "=", Hi = [
936
936
  "arc",
937
937
  "arcTo",
938
938
  "beginPath",
@@ -965,7 +965,7 @@ const Bi = ",", $n = "(", Kn = ")", jn = "([", Zn = "])", qn = ";", Jn = "()", Q
965
965
  "strokeText",
966
966
  "transform",
967
967
  "translate"
968
- ], tr = [
968
+ ], er = [
969
969
  "fillStyle",
970
970
  "strokeStyle",
971
971
  "shadowColor",
@@ -986,13 +986,13 @@ const Bi = ",", $n = "(", Kn = ")", jn = "([", Zn = "])", qn = ";", Jn = "()", Q
986
986
  "globalCompositeOperation",
987
987
  "imageSmoothingEnabled",
988
988
  "filter"
989
- ], er = 100;
989
+ ], ir = 100;
990
990
  let xe = null;
991
991
  function zi() {
992
992
  if (xe !== null)
993
993
  return xe;
994
994
  try {
995
- const t = C.createCanvasElement().getContext("2d");
995
+ const t = S.createCanvasElement().getContext("2d");
996
996
  return t ? !!t && "filter" in t : (xe = !1, !1);
997
997
  } catch {
998
998
  return xe = !1, !1;
@@ -1018,7 +1018,7 @@ class Ke {
1018
1018
  getTrace(t, e) {
1019
1019
  let i = this.traceArr, s = i.length, n = "", r, o, l, h;
1020
1020
  for (r = 0; r < s; r++)
1021
- o = i[r], l = o.method, l ? (h = o.args, n += l, t ? n += Jn : C._isArray(h[0]) ? n += jn + h.join(Bi) + Zn : (e && (h = h.map((c) => typeof c == "number" ? Math.floor(c) : c)), n += $n + h.join(Bi) + Kn)) : (n += o.property, t || (n += Qn + o.val)), n += qn;
1021
+ o = i[r], l = o.method, l ? (h = o.args, n += l, t ? n += Qn : S._isArray(h[0]) ? n += Zn + h.join(Bi) + qn : (e && (h = h.map((c) => typeof c == "number" ? Math.floor(c) : c)), n += Kn + h.join(Bi) + jn)) : (n += o.property, t || (n += tr + o.val)), n += Jn;
1022
1022
  return n;
1023
1023
  }
1024
1024
  clearTrace() {
@@ -1026,7 +1026,7 @@ class Ke {
1026
1026
  }
1027
1027
  _trace(t) {
1028
1028
  let e = this.traceArr, i;
1029
- e.push(t), i = e.length, i >= er && e.shift();
1029
+ e.push(t), i = e.length, i >= ir && e.shift();
1030
1030
  }
1031
1031
  reset() {
1032
1032
  const t = this.getCanvas().getPixelRatio();
@@ -1179,7 +1179,7 @@ class Ke {
1179
1179
  const r = function(o) {
1180
1180
  let l = t[o], h;
1181
1181
  t[o] = function() {
1182
- return n = Un(Array.prototype.slice.call(arguments, 0)), h = l.apply(t, arguments), t._trace({
1182
+ return n = $n(Array.prototype.slice.call(arguments, 0)), h = l.apply(t, arguments), t._trace({
1183
1183
  method: o,
1184
1184
  args: n
1185
1185
  }), h;
@@ -1202,7 +1202,7 @@ class Ke {
1202
1202
  !e || e === "source-over" || this.setAttr("globalCompositeOperation", e);
1203
1203
  }
1204
1204
  }
1205
- tr.forEach(function(a) {
1205
+ er.forEach(function(a) {
1206
1206
  Object.defineProperty(Ke.prototype, a, {
1207
1207
  get() {
1208
1208
  return this._context[a];
@@ -1212,7 +1212,7 @@ tr.forEach(function(a) {
1212
1212
  }
1213
1213
  });
1214
1214
  });
1215
- class ir extends Ke {
1215
+ class sr extends Ke {
1216
1216
  constructor(t, { willReadFrequently: e = !1 } = {}) {
1217
1217
  super(t), this._context = t._canvas.getContext("2d", {
1218
1218
  willReadFrequently: e
@@ -1284,7 +1284,7 @@ class ir extends Ke {
1284
1284
  this.setAttr("shadowColor", n), this.setAttr("shadowBlur", r * Math.min(Math.abs(c), Math.abs(d))), this.setAttr("shadowOffsetX", o.x * c), this.setAttr("shadowOffsetY", o.y * d);
1285
1285
  }
1286
1286
  }
1287
- class sr extends Ke {
1287
+ class nr extends Ke {
1288
1288
  constructor(t) {
1289
1289
  super(t), this._context = t._canvas.getContext("2d", {
1290
1290
  willReadFrequently: !0
@@ -1311,20 +1311,20 @@ class sr extends Ke {
1311
1311
  }
1312
1312
  }
1313
1313
  let Ae;
1314
- function nr() {
1314
+ function rr() {
1315
1315
  if (Ae)
1316
1316
  return Ae;
1317
- const a = C.createCanvasElement(), t = a.getContext("2d");
1317
+ const a = S.createCanvasElement(), t = a.getContext("2d");
1318
1318
  return Ae = function() {
1319
1319
  const e = E._global.devicePixelRatio || 1, i = t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
1320
1320
  return e / i;
1321
- }(), C.releaseCanvas(a), Ae;
1321
+ }(), S.releaseCanvas(a), Ae;
1322
1322
  }
1323
1323
  class xi {
1324
1324
  constructor(t) {
1325
1325
  this.pixelRatio = 1, this.width = 0, this.height = 0, this.isCache = !1;
1326
- const i = (t || {}).pixelRatio || E.pixelRatio || nr();
1327
- this.pixelRatio = i, this._canvas = C.createCanvasElement(), this._canvas.style.padding = "0", this._canvas.style.margin = "0", this._canvas.style.border = "0", this._canvas.style.background = "transparent", this._canvas.style.position = "absolute", this._canvas.style.top = "0", this._canvas.style.left = "0";
1326
+ const i = (t || {}).pixelRatio || E.pixelRatio || rr();
1327
+ this.pixelRatio = i, this._canvas = S.createCanvasElement(), this._canvas.style.padding = "0", this._canvas.style.margin = "0", this._canvas.style.border = "0", this._canvas.style.background = "transparent", this._canvas.style.position = "absolute", this._canvas.style.top = "0", this._canvas.style.left = "0";
1328
1328
  }
1329
1329
  getContext() {
1330
1330
  return this.context;
@@ -1362,21 +1362,21 @@ class xi {
1362
1362
  try {
1363
1363
  return this._canvas.toDataURL();
1364
1364
  } catch (s) {
1365
- return C.error("Unable to get data URL. " + s.message + " For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."), "";
1365
+ return S.error("Unable to get data URL. " + s.message + " For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."), "";
1366
1366
  }
1367
1367
  }
1368
1368
  }
1369
1369
  }
1370
1370
  class Lt extends xi {
1371
1371
  constructor(t = { width: 0, height: 0, willReadFrequently: !1 }) {
1372
- super(t), this.context = new ir(this, {
1372
+ super(t), this.context = new sr(this, {
1373
1373
  willReadFrequently: t.willReadFrequently
1374
1374
  }), this.setSize(t.width, t.height);
1375
1375
  }
1376
1376
  }
1377
1377
  class Ai extends xi {
1378
1378
  constructor(t = { width: 0, height: 0 }) {
1379
- super(t), this.hitCanvas = !0, this.context = new sr(this), this.setSize(t.width, t.height);
1379
+ super(t), this.hitCanvas = !0, this.context = new nr(this), this.setSize(t.width, t.height);
1380
1380
  }
1381
1381
  }
1382
1382
  const $ = {
@@ -1398,7 +1398,7 @@ const $ = {
1398
1398
  const t = [];
1399
1399
  $._dragElements.forEach((e, i) => {
1400
1400
  const { node: s } = e, n = s.getStage();
1401
- n.setPointersPositions(a), e.pointerId === void 0 && (e.pointerId = C._getFirstPointerId(a));
1401
+ n.setPointersPositions(a), e.pointerId === void 0 && (e.pointerId = S._getFirstPointerId(a));
1402
1402
  const r = n._changedPointerPositions.find((o) => o.id === e.pointerId);
1403
1403
  if (r) {
1404
1404
  if (e.dragStatus !== "dragging") {
@@ -1441,62 +1441,62 @@ const $ = {
1441
1441
  };
1442
1442
  E.isBrowser && (window.addEventListener("mouseup", $._endDragBefore, !0), window.addEventListener("touchend", $._endDragBefore, !0), window.addEventListener("touchcancel", $._endDragBefore, !0), window.addEventListener("mousemove", $._drag), window.addEventListener("touchmove", $._drag), window.addEventListener("mouseup", $._endDragAfter, !1), window.addEventListener("touchend", $._endDragAfter, !1), window.addEventListener("touchcancel", $._endDragAfter, !1));
1443
1443
  function Rt(a) {
1444
- return C._isString(a) ? '"' + a + '"' : Object.prototype.toString.call(a) === "[object Number]" || C._isBoolean(a) ? a : Object.prototype.toString.call(a);
1444
+ return S._isString(a) ? '"' + a + '"' : Object.prototype.toString.call(a) === "[object Number]" || S._isBoolean(a) ? a : Object.prototype.toString.call(a);
1445
1445
  }
1446
- function Rs(a) {
1446
+ function Gs(a) {
1447
1447
  return a > 255 ? 255 : a < 0 ? 0 : Math.round(a);
1448
1448
  }
1449
1449
  function x() {
1450
1450
  if (E.isUnminified)
1451
1451
  return function(a, t) {
1452
- return C._isNumber(a) || C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a number.'), a;
1452
+ return S._isNumber(a) || S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a number.'), a;
1453
1453
  };
1454
1454
  }
1455
1455
  function je(a) {
1456
1456
  if (E.isUnminified)
1457
1457
  return function(t, e) {
1458
- let i = C._isNumber(t), s = C._isArray(t) && t.length == a;
1459
- return !i && !s && C.warn(Rt(t) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + a + ")"), t;
1458
+ let i = S._isNumber(t), s = S._isArray(t) && t.length == a;
1459
+ return !i && !s && S.warn(Rt(t) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + a + ")"), t;
1460
1460
  };
1461
1461
  }
1462
1462
  function Ei() {
1463
1463
  if (E.isUnminified)
1464
1464
  return function(a, t) {
1465
- return C._isNumber(a) || a === "auto" || C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a number or "auto".'), a;
1465
+ return S._isNumber(a) || a === "auto" || S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a number or "auto".'), a;
1466
1466
  };
1467
1467
  }
1468
1468
  function Wt() {
1469
1469
  if (E.isUnminified)
1470
1470
  return function(a, t) {
1471
- return C._isString(a) || C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a string.'), a;
1471
+ return S._isString(a) || S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a string.'), a;
1472
1472
  };
1473
1473
  }
1474
- function Os() {
1474
+ function Bs() {
1475
1475
  if (E.isUnminified)
1476
1476
  return function(a, t) {
1477
- const e = C._isString(a), i = Object.prototype.toString.call(a) === "[object CanvasGradient]" || a && a.addColorStop;
1478
- return e || i || C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a string or a native gradient.'), a;
1477
+ const e = S._isString(a), i = Object.prototype.toString.call(a) === "[object CanvasGradient]" || a && a.addColorStop;
1478
+ return e || i || S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a string or a native gradient.'), a;
1479
1479
  };
1480
1480
  }
1481
- function rr() {
1481
+ function ar() {
1482
1482
  if (E.isUnminified)
1483
1483
  return function(a, t) {
1484
1484
  const e = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
1485
- return e && a instanceof e || (C._isArray(a) ? a.forEach(function(i) {
1486
- C._isNumber(i) || C.warn('"' + t + '" attribute has non numeric element ' + i + ". Make sure that all elements are numbers.");
1487
- }) : C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a array of numbers.')), a;
1485
+ return e && a instanceof e || (S._isArray(a) ? a.forEach(function(i) {
1486
+ S._isNumber(i) || S.warn('"' + t + '" attribute has non numeric element ' + i + ". Make sure that all elements are numbers.");
1487
+ }) : S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a array of numbers.')), a;
1488
1488
  };
1489
1489
  }
1490
1490
  function pt() {
1491
1491
  if (E.isUnminified)
1492
1492
  return function(a, t) {
1493
- return a === !0 || a === !1 || C.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a boolean.'), a;
1493
+ return a === !0 || a === !1 || S.warn(Rt(a) + ' is a not valid value for "' + t + '" attribute. The value should be a boolean.'), a;
1494
1494
  };
1495
1495
  }
1496
- function ar(a) {
1496
+ function or(a) {
1497
1497
  if (E.isUnminified)
1498
1498
  return function(t, e) {
1499
- return t == null || C.isObject(t) || C.warn(Rt(t) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + a), t;
1499
+ return t == null || S.isObject(t) || S.warn(Rt(t) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + a), t;
1500
1500
  };
1501
1501
  }
1502
1502
  const se = "get", ne = "set", m = {
@@ -1504,24 +1504,24 @@ const se = "get", ne = "set", m = {
1504
1504
  m.addGetter(a, t, e), m.addSetter(a, t, i, s), m.addOverloadedGetterSetter(a, t);
1505
1505
  },
1506
1506
  addGetter(a, t, e) {
1507
- const i = se + C._capitalize(t);
1507
+ const i = se + S._capitalize(t);
1508
1508
  a.prototype[i] = a.prototype[i] || function() {
1509
1509
  const s = this.attrs[t];
1510
1510
  return s === void 0 ? e : s;
1511
1511
  };
1512
1512
  },
1513
1513
  addSetter(a, t, e, i) {
1514
- const s = ne + C._capitalize(t);
1514
+ const s = ne + S._capitalize(t);
1515
1515
  a.prototype[s] || m.overWriteSetter(a, t, e, i);
1516
1516
  },
1517
1517
  overWriteSetter(a, t, e, i) {
1518
- const s = ne + C._capitalize(t);
1518
+ const s = ne + S._capitalize(t);
1519
1519
  a.prototype[s] = function(n) {
1520
1520
  return e && n !== void 0 && n !== null && (n = e.call(this, n, t)), this._setAttr(t, n), i && i.call(this), this;
1521
1521
  };
1522
1522
  },
1523
1523
  addComponentsGetterSetter(a, t, e, i, s) {
1524
- const n = e.length, r = C._capitalize, o = se + r(t), l = ne + r(t);
1524
+ const n = e.length, r = S._capitalize, o = se + r(t), l = ne + r(t);
1525
1525
  a.prototype[o] = function() {
1526
1526
  const c = {};
1527
1527
  for (let d = 0; d < n; d++) {
@@ -1530,7 +1530,7 @@ const se = "get", ne = "set", m = {
1530
1530
  }
1531
1531
  return c;
1532
1532
  };
1533
- const h = ar(e);
1533
+ const h = or(e);
1534
1534
  a.prototype[l] = function(c) {
1535
1535
  const d = this.attrs[t];
1536
1536
  i && (c = i.call(this, c, t)), h && h.call(this, c, t);
@@ -1542,27 +1542,27 @@ const se = "get", ne = "set", m = {
1542
1542
  }, m.addOverloadedGetterSetter(a, t);
1543
1543
  },
1544
1544
  addOverloadedGetterSetter(a, t) {
1545
- const e = C._capitalize(t), i = ne + e, s = se + e;
1545
+ const e = S._capitalize(t), i = ne + e, s = se + e;
1546
1546
  a.prototype[t] = function() {
1547
1547
  return arguments.length ? (this[i](arguments[0]), this) : this[s]();
1548
1548
  };
1549
1549
  },
1550
1550
  addDeprecatedGetterSetter(a, t, e, i) {
1551
- C.error("Adding deprecated " + t);
1552
- const s = se + C._capitalize(t), n = t + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
1551
+ S.error("Adding deprecated " + t);
1552
+ const s = se + S._capitalize(t), n = t + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
1553
1553
  a.prototype[s] = function() {
1554
- C.error(n);
1554
+ S.error(n);
1555
1555
  const r = this.attrs[t];
1556
1556
  return r === void 0 ? e : r;
1557
1557
  }, m.addSetter(a, t, i, function() {
1558
- C.error(n);
1558
+ S.error(n);
1559
1559
  }), m.addOverloadedGetterSetter(a, t);
1560
1560
  },
1561
1561
  backCompat(a, t) {
1562
- C.each(t, function(e, i) {
1563
- const s = a.prototype[i], n = se + C._capitalize(e), r = ne + C._capitalize(e);
1562
+ S.each(t, function(e, i) {
1563
+ const s = a.prototype[i], n = se + S._capitalize(e), r = ne + S._capitalize(e);
1564
1564
  function o() {
1565
- s.apply(this, arguments), C.error('"' + e + '" method is deprecated and will be removed soon. Use ""' + i + '" instead.');
1565
+ s.apply(this, arguments), S.error('"' + e + '" method is deprecated and will be removed soon. Use ""' + i + '" instead.');
1566
1566
  }
1567
1567
  a.prototype[e] = o, a.prototype[n] = o, a.prototype[r] = o;
1568
1568
  });
@@ -1571,7 +1571,7 @@ const se = "get", ne = "set", m = {
1571
1571
  this._filterUpToDate = !1;
1572
1572
  }
1573
1573
  };
1574
- function or(a) {
1574
+ function lr(a) {
1575
1575
  const t = /(\w+)\(([^)]+)\)/g;
1576
1576
  let e;
1577
1577
  for (; (e = t.exec(a)) !== null; ) {
@@ -1618,14 +1618,14 @@ function or(a) {
1618
1618
  r && r.Invert && r.Invert.call(this, n);
1619
1619
  };
1620
1620
  default:
1621
- C.warn(`CSS filter "${i}" is not supported in fallback mode. Consider using function filters for better compatibility.`);
1621
+ S.warn(`CSS filter "${i}" is not supported in fallback mode. Consider using function filters for better compatibility.`);
1622
1622
  break;
1623
1623
  }
1624
1624
  }
1625
1625
  return () => {
1626
1626
  };
1627
1627
  }
1628
- const Fe = "absoluteOpacity", Ni = "allEventListeners", kt = "absoluteTransform", Fi = "absoluteScale", Ht = "canvas", lr = "Change", hr = "children", cr = "konva", ui = "listening", dr = "mouseenter", ur = "mouseleave", fr = "pointerenter", gr = "pointerleave", pr = "touchenter", mr = "touchleave", Vi = "set", Wi = "Shape", Ve = " ", Yi = "stage", It = "transform", yr = "Stage", fi = "visible", Cr = [
1628
+ const Fe = "absoluteOpacity", Ni = "allEventListeners", kt = "absoluteTransform", Fi = "absoluteScale", Ht = "canvas", hr = "Change", cr = "children", dr = "konva", ui = "listening", ur = "mouseenter", fr = "mouseleave", gr = "pointerenter", pr = "pointerleave", mr = "touchenter", yr = "touchleave", Vi = "set", Wi = "Shape", Ve = " ", Yi = "stage", It = "transform", Sr = "Stage", fi = "visible", Cr = [
1629
1629
  "xChange.konva",
1630
1630
  "yChange.konva",
1631
1631
  "scaleXChange.konva",
@@ -1637,10 +1637,10 @@ const Fe = "absoluteOpacity", Ni = "allEventListeners", kt = "absoluteTransform"
1637
1637
  "offsetYChange.konva",
1638
1638
  "transformsEnabledChange.konva"
1639
1639
  ].join(Ve);
1640
- let Sr = 1;
1640
+ let Tr = 1;
1641
1641
  class P {
1642
1642
  constructor(t) {
1643
- this._id = Sr++, this.eventListeners = {}, this.attrs = {}, this.index = 0, this._allEventListeners = null, this.parent = null, this._cache = /* @__PURE__ */ new Map(), this._attachedDepsListeners = /* @__PURE__ */ new Map(), this._lastPos = null, this._batchingTransformChange = !1, this._needClearTransformCache = !1, this._filterUpToDate = !1, this._isUnderCache = !1, this._dragEventId = null, this._shouldFireChangeEvents = !1, this.setAttrs(t), this._shouldFireChangeEvents = !0;
1643
+ this._id = Tr++, this.eventListeners = {}, this.attrs = {}, this.index = 0, this._allEventListeners = null, this.parent = null, this._cache = /* @__PURE__ */ new Map(), this._attachedDepsListeners = /* @__PURE__ */ new Map(), this._lastPos = null, this._batchingTransformChange = !1, this._needClearTransformCache = !1, this._filterUpToDate = !1, this._isUnderCache = !1, this._dragEventId = null, this._shouldFireChangeEvents = !1, this.setAttrs(t), this._shouldFireChangeEvents = !0;
1644
1644
  }
1645
1645
  hasChildren() {
1646
1646
  return !1;
@@ -1670,7 +1670,7 @@ class P {
1670
1670
  clearCache() {
1671
1671
  if (this._cache.has(Ht)) {
1672
1672
  const { scene: t, filter: e, hit: i } = this._cache.get(Ht);
1673
- C.releaseCanvas(t._canvas, e._canvas, i._canvas), this._cache.delete(Ht);
1673
+ S.releaseCanvas(t._canvas, e._canvas, i._canvas), this._cache.delete(Ht);
1674
1674
  }
1675
1675
  return this._clearSelfAndDescendantCache(), this._requestDraw(), this;
1676
1676
  }
@@ -1683,7 +1683,7 @@ class P {
1683
1683
  }));
1684
1684
  let s = Math.ceil(e.width || i.width), n = Math.ceil(e.height || i.height), r = e.pixelRatio, o = e.x === void 0 ? Math.floor(i.x) : e.x, l = e.y === void 0 ? Math.floor(i.y) : e.y, h = e.offset || 0, c = e.drawBorder || !1, d = e.hitCanvasPixelRatio || 1;
1685
1685
  if (!s || !n) {
1686
- C.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");
1686
+ S.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");
1687
1687
  return;
1688
1688
  }
1689
1689
  const u = Math.abs(Math.round(i.x) - o) > 0.5 ? 1 : 0, p = Math.abs(Math.round(i.y) - l) > 0.5 ? 1 : 0;
@@ -1701,12 +1701,12 @@ class P {
1701
1701
  pixelRatio: d,
1702
1702
  width: s,
1703
1703
  height: n
1704
- }), S = g.getContext(), v = T.getContext(), b = new Lt({
1704
+ }), C = g.getContext(), v = T.getContext(), b = new Lt({
1705
1705
  width: g.width / g.pixelRatio + Math.abs(o),
1706
1706
  height: g.height / g.pixelRatio + Math.abs(l),
1707
1707
  pixelRatio: g.pixelRatio
1708
1708
  }), k = b.getContext();
1709
- return T.isCache = !0, g.isCache = !0, this._cache.delete(Ht), this._filterUpToDate = !1, e.imageSmoothingEnabled === !1 && (g.getContext()._context.imageSmoothingEnabled = !1, y.getContext()._context.imageSmoothingEnabled = !1), S.save(), v.save(), k.save(), S.translate(-o, -l), v.translate(-o, -l), k.translate(-o, -l), b.x = o, b.y = l, this._isUnderCache = !0, this._clearSelfAndDescendantCache(Fe), this._clearSelfAndDescendantCache(Fi), this.drawScene(g, this, b), this.drawHit(T, this), this._isUnderCache = !1, S.restore(), v.restore(), c && (S.save(), S.beginPath(), S.rect(0, 0, s, n), S.closePath(), S.setAttr("strokeStyle", "red"), S.setAttr("lineWidth", 5), S.stroke(), S.restore()), C.releaseCanvas(b._canvas), this._cache.set(Ht, {
1709
+ return T.isCache = !0, g.isCache = !0, this._cache.delete(Ht), this._filterUpToDate = !1, e.imageSmoothingEnabled === !1 && (g.getContext()._context.imageSmoothingEnabled = !1, y.getContext()._context.imageSmoothingEnabled = !1), C.save(), v.save(), k.save(), C.translate(-o, -l), v.translate(-o, -l), k.translate(-o, -l), b.x = o, b.y = l, this._isUnderCache = !0, this._clearSelfAndDescendantCache(Fe), this._clearSelfAndDescendantCache(Fi), this.drawScene(g, this, b), this.drawHit(T, this), this._isUnderCache = !1, C.restore(), v.restore(), c && (C.save(), C.beginPath(), C.rect(0, 0, s, n), C.closePath(), C.setAttr("strokeStyle", "red"), C.setAttr("lineWidth", 5), C.stroke(), C.restore()), S.releaseCanvas(b._canvas), this._cache.set(Ht, {
1710
1710
  scene: g,
1711
1711
  filter: y,
1712
1712
  hit: T,
@@ -1769,9 +1769,9 @@ class P {
1769
1769
  }
1770
1770
  try {
1771
1771
  for (r = t.length, n.clear(), n.drawImage(i._canvas, 0, 0, i.getWidth() / d, i.getHeight() / d), o = n.getImageData(0, 0, s.getWidth(), s.getHeight()), l = 0; l < r; l++)
1772
- h = t[l], typeof h == "string" && (h = or(h)), h.call(this, o), n.putImageData(o, 0, 0);
1772
+ h = t[l], typeof h == "string" && (h = lr(h)), h.call(this, o), n.putImageData(o, 0, 0);
1773
1773
  } catch (u) {
1774
- C.error("Unable to apply filter. " + u.message + " This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.");
1774
+ S.error("Unable to apply filter. " + u.message + " This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.");
1775
1775
  }
1776
1776
  return this._filterUpToDate = !0, s;
1777
1777
  }
@@ -1819,7 +1819,7 @@ class P {
1819
1819
  this.on(t, function(n) {
1820
1820
  const r = n.target.findAncestors(e, !0, s);
1821
1821
  for (let o = 0; o < r.length; o++)
1822
- n = C.cloneObject(n), n.currentTarget = r[o], i.call(r[o], n);
1822
+ n = S.cloneObject(n), n.currentTarget = r[o], i.call(r[o], n);
1823
1823
  });
1824
1824
  }
1825
1825
  remove() {
@@ -1837,8 +1837,8 @@ class P {
1837
1837
  return this.remove(), this.clearCache(), this;
1838
1838
  }
1839
1839
  getAttr(t) {
1840
- const e = "get" + C._capitalize(t);
1841
- return C._isFunction(this[e]) ? this[e]() : this.attrs[t];
1840
+ const e = "get" + S._capitalize(t);
1841
+ return S._isFunction(this[e]) ? this[e]() : this.attrs[t];
1842
1842
  }
1843
1843
  getAncestors() {
1844
1844
  let t = this.getParent(), e = [];
@@ -1855,7 +1855,7 @@ class P {
1855
1855
  if (!t)
1856
1856
  return this;
1857
1857
  for (e in t)
1858
- e !== hr && (i = Vi + C._capitalize(e), C._isFunction(this[i]) ? this[i](t[e]) : this._setAttr(e, t[e]));
1858
+ e !== cr && (i = Vi + S._capitalize(e), S._isFunction(this[i]) ? this[i](t[e]) : this._setAttr(e, t[e]));
1859
1859
  }), this;
1860
1860
  }
1861
1861
  isListening() {
@@ -1904,7 +1904,7 @@ class P {
1904
1904
  s.length > 0 && s[0].getDepth() <= t && l(s);
1905
1905
  }
1906
1906
  const h = this.getStage();
1907
- return e.nodeType !== yr && h && l(h.getChildren()), i;
1907
+ return e.nodeType !== Sr && h && l(h.getChildren()), i;
1908
1908
  }
1909
1909
  getDepth() {
1910
1910
  let t = 0, e = this.parent;
@@ -1995,32 +1995,32 @@ class P {
1995
1995
  }
1996
1996
  moveToTop() {
1997
1997
  if (!this.parent)
1998
- return C.warn("Node has no parent. moveToTop function is ignored."), !1;
1998
+ return S.warn("Node has no parent. moveToTop function is ignored."), !1;
1999
1999
  const t = this.index, e = this.parent.getChildren().length;
2000
2000
  return t < e - 1 ? (this.parent.children.splice(t, 1), this.parent.children.push(this), this.parent._setChildrenIndices(), !0) : !1;
2001
2001
  }
2002
2002
  moveUp() {
2003
2003
  if (!this.parent)
2004
- return C.warn("Node has no parent. moveUp function is ignored."), !1;
2004
+ return S.warn("Node has no parent. moveUp function is ignored."), !1;
2005
2005
  const t = this.index, e = this.parent.getChildren().length;
2006
2006
  return t < e - 1 ? (this.parent.children.splice(t, 1), this.parent.children.splice(t + 1, 0, this), this.parent._setChildrenIndices(), !0) : !1;
2007
2007
  }
2008
2008
  moveDown() {
2009
2009
  if (!this.parent)
2010
- return C.warn("Node has no parent. moveDown function is ignored."), !1;
2010
+ return S.warn("Node has no parent. moveDown function is ignored."), !1;
2011
2011
  const t = this.index;
2012
2012
  return t > 0 ? (this.parent.children.splice(t, 1), this.parent.children.splice(t - 1, 0, this), this.parent._setChildrenIndices(), !0) : !1;
2013
2013
  }
2014
2014
  moveToBottom() {
2015
2015
  if (!this.parent)
2016
- return C.warn("Node has no parent. moveToBottom function is ignored."), !1;
2016
+ return S.warn("Node has no parent. moveToBottom function is ignored."), !1;
2017
2017
  const t = this.index;
2018
2018
  return t > 0 ? (this.parent.children.splice(t, 1), this.parent.children.unshift(this), this.parent._setChildrenIndices(), !0) : !1;
2019
2019
  }
2020
2020
  setZIndex(t) {
2021
2021
  if (!this.parent)
2022
- return C.warn("Node has no parent. zIndex parameter is ignored."), this;
2023
- (t < 0 || t >= this.parent.children.length) && C.warn("Unexpected value " + t + " for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to " + (this.parent.children.length - 1) + ".");
2022
+ return S.warn("Node has no parent. zIndex parameter is ignored."), this;
2023
+ (t < 0 || t >= this.parent.children.length) && S.warn("Unexpected value " + t + " for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to " + (this.parent.children.length - 1) + ".");
2024
2024
  const e = this.index;
2025
2025
  return this.parent.children.splice(e, 1), this.parent.children.splice(t, 0, this), this.parent._setChildrenIndices(), this;
2026
2026
  }
@@ -2042,8 +2042,8 @@ class P {
2042
2042
  className: this.getClassName()
2043
2043
  };
2044
2044
  for (e in t)
2045
- i = t[e], r = C.isObject(i) && !C._isPlainObject(i) && !C._isArray(i), !r && (s = typeof this[e] == "function" && this[e], delete t[e], n = s ? s.call(this) : null, t[e] = i, n !== i && (o.attrs[e] = i));
2046
- return C._prepareToStringify(o);
2045
+ i = t[e], r = S.isObject(i) && !S._isPlainObject(i) && !S._isArray(i), !r && (s = typeof this[e] == "function" && this[e], delete t[e], n = s ? s.call(this) : null, t[e] = i, n !== i && (o.attrs[e] = i));
2046
+ return S._prepareToStringify(o);
2047
2047
  }
2048
2048
  toJSON() {
2049
2049
  return JSON.stringify(this.toObject());
@@ -2075,7 +2075,7 @@ class P {
2075
2075
  return t(this);
2076
2076
  let e = t.replace(/ /g, "").split(","), i = e.length, s, n;
2077
2077
  for (s = 0; s < i; s++)
2078
- if (n = e[s], C.isValidSelector(n) || (C.warn('Selector "' + n + '" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'), C.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'), C.warn("Konva is awesome, right?")), n.charAt(0) === "#") {
2078
+ if (n = e[s], S.isValidSelector(n) || (S.warn('Selector "' + n + '" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'), S.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'), S.warn("Konva is awesome, right?")), n.charAt(0) === "#") {
2079
2079
  if (this.id() === n.slice(1))
2080
2080
  return !0;
2081
2081
  } else if (n.charAt(0) === ".") {
@@ -2145,13 +2145,13 @@ class P {
2145
2145
  return (s !== 0 || n !== 0) && i.translate(s, n), r !== 0 && i.rotate(r), (h !== 0 || c !== 0) && i.skew(h, c), (o !== 1 || l !== 1) && i.scale(o, l), (d !== 0 || u !== 0) && i.translate(-1 * d, -1 * u), i.dirty = !1, i;
2146
2146
  }
2147
2147
  clone(t) {
2148
- let e = C.cloneObject(this.attrs), i, s, n, r, o;
2148
+ let e = S.cloneObject(this.attrs), i, s, n, r, o;
2149
2149
  for (i in t)
2150
2150
  e[i] = t[i];
2151
2151
  const l = new this.constructor(e);
2152
2152
  for (i in this.eventListeners)
2153
2153
  for (s = this.eventListeners[i], n = s.length, r = 0; r < n; r++)
2154
- o = s[r], o.name.indexOf(cr) < 0 && (l.eventListeners[i] || (l.eventListeners[i] = []), l.eventListeners[i].push(o));
2154
+ o = s[r], o.name.indexOf(dr) < 0 && (l.eventListeners[i] || (l.eventListeners[i] = []), l.eventListeners[i].push(o));
2155
2155
  return l;
2156
2156
  }
2157
2157
  _toKonvaCanvas(t) {
@@ -2179,7 +2179,7 @@ class P {
2179
2179
  return new Promise((e, i) => {
2180
2180
  try {
2181
2181
  const s = t == null ? void 0 : t.callback;
2182
- s && delete t.callback, C._urlToImage(this.toDataURL(t), function(n) {
2182
+ s && delete t.callback, S._urlToImage(this.toDataURL(t), function(n) {
2183
2183
  e(n), s == null || s(n);
2184
2184
  });
2185
2185
  } catch (s) {
@@ -2229,7 +2229,7 @@ class P {
2229
2229
  }
2230
2230
  }
2231
2231
  _fireChangeEvent(t, e, i) {
2232
- this._fire(t + lr, {
2232
+ this._fire(t + hr, {
2233
2233
  oldVal: e,
2234
2234
  newVal: i
2235
2235
  });
@@ -2252,8 +2252,8 @@ class P {
2252
2252
  return i !== -1 && (e.splice(i, 1), this.name(e.join(" "))), this;
2253
2253
  }
2254
2254
  setAttr(t, e) {
2255
- const i = this[Vi + C._capitalize(t)];
2256
- return C._isFunction(i) ? i.call(this, e) : this._setAttr(t, e), this;
2255
+ const i = this[Vi + S._capitalize(t)];
2256
+ return S._isFunction(i) ? i.call(this, e) : this._setAttr(t, e), this;
2257
2257
  }
2258
2258
  _requestDraw() {
2259
2259
  if (E.autoDrawEnabled) {
@@ -2263,7 +2263,7 @@ class P {
2263
2263
  }
2264
2264
  _setAttr(t, e) {
2265
2265
  const i = this.attrs[t];
2266
- i === e && !C.isObject(e) || (e == null ? delete this.attrs[t] : this.attrs[t] = e, this._shouldFireChangeEvents && this._fireChangeEvent(t, i, e), this._requestDraw());
2266
+ i === e && !S.isObject(e) || (e == null ? delete this.attrs[t] : this.attrs[t] = e, this._shouldFireChangeEvents && this._fireChangeEvent(t, i, e), this._requestDraw());
2267
2267
  }
2268
2268
  _setComponentAttr(t, e, i) {
2269
2269
  let s;
@@ -2272,12 +2272,12 @@ class P {
2272
2272
  _fireAndBubble(t, e, i) {
2273
2273
  e && this.nodeType === Wi && (e.target = this);
2274
2274
  const s = [
2275
- dr,
2276
2275
  ur,
2277
2276
  fr,
2278
2277
  gr,
2279
2278
  pr,
2280
- mr
2279
+ mr,
2280
+ yr
2281
2281
  ];
2282
2282
  if (!(s.indexOf(t) !== -1 && (i && (this === i || this.isAncestorOf && this.isAncestorOf(i)) || this.nodeType === "Stage" && !i))) {
2283
2283
  this._fire(t, e);
@@ -2350,7 +2350,7 @@ class P {
2350
2350
  const n = this.dragBoundFunc();
2351
2351
  if (n !== void 0) {
2352
2352
  const r = n.call(this, s, t);
2353
- r ? s = r : C.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");
2353
+ r ? s = r : S.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.");
2354
2354
  }
2355
2355
  (!this._lastPos || this._lastPos.x !== s.x || this._lastPos.y !== s.y) && (this.setAbsolutePosition(s), this._requestDraw()), this._lastPos = s;
2356
2356
  }
@@ -2398,14 +2398,14 @@ class P {
2398
2398
  width: e.width() + 2 * t.x,
2399
2399
  height: e.height() + 2 * t.y
2400
2400
  };
2401
- return C.haveIntersection(i, this.getClientRect());
2401
+ return S.haveIntersection(i, this.getClientRect());
2402
2402
  }
2403
2403
  static create(t, e) {
2404
- return C._isString(t) && (t = JSON.parse(t)), this._createNode(t, e);
2404
+ return S._isString(t) && (t = JSON.parse(t)), this._createNode(t, e);
2405
2405
  }
2406
2406
  static _createNode(t, e) {
2407
2407
  let i = P.prototype.getClassName.call(t), s = t.children, n, r, o;
2408
- e && (t.attrs.container = e), E[i] || (C.warn('Can not find a node with class name "' + i + '". Fallback to "Shape".'), i = "Shape");
2408
+ e && (t.attrs.container = e), E[i] || (S.warn('Can not find a node with class name "' + i + '". Fallback to "Shape".'), i = "Shape");
2409
2409
  const l = E[i];
2410
2410
  if (n = new l(t.attrs), s)
2411
2411
  for (r = s.length, o = 0; o < r; o++)
@@ -2608,8 +2608,8 @@ class dt extends P {
2608
2608
  if (h)
2609
2609
  y = h.call(this, r, this);
2610
2610
  else {
2611
- const T = this.clipX(), S = this.clipY();
2612
- r.rect(T || 0, S || 0, o, l);
2611
+ const T = this.clipX(), C = this.clipY();
2612
+ r.rect(T || 0, C || 0, o, l);
2613
2613
  }
2614
2614
  r.clip.apply(r, y), g = p.copy().invert().getMatrix(), r.transform(g[0], g[1], g[2], g[3], g[4], g[5]);
2615
2615
  }
@@ -2669,7 +2669,7 @@ m.addGetterSetter(dt, "clipY", void 0, x());
2669
2669
  m.addGetterSetter(dt, "clipWidth", void 0, x());
2670
2670
  m.addGetterSetter(dt, "clipHeight", void 0, x());
2671
2671
  m.addGetterSetter(dt, "clipFunc");
2672
- const be = /* @__PURE__ */ new Map(), Gs = E._global.PointerEvent !== void 0;
2672
+ const be = /* @__PURE__ */ new Map(), Hs = E._global.PointerEvent !== void 0;
2673
2673
  function Je(a) {
2674
2674
  return be.get(a);
2675
2675
  }
@@ -2679,30 +2679,30 @@ function Ii(a) {
2679
2679
  pointerId: a.pointerId
2680
2680
  };
2681
2681
  }
2682
- function Bs(a, t) {
2682
+ function zs(a, t) {
2683
2683
  return be.get(a) === t;
2684
2684
  }
2685
- function Hs(a, t) {
2686
- me(a), t.getStage() && (be.set(a, t), Gs && t._fire("gotpointercapture", Ii(new PointerEvent("gotpointercapture"))));
2685
+ function Ns(a, t) {
2686
+ me(a), t.getStage() && (be.set(a, t), Hs && t._fire("gotpointercapture", Ii(new PointerEvent("gotpointercapture"))));
2687
2687
  }
2688
2688
  function me(a, t) {
2689
2689
  const e = be.get(a);
2690
2690
  if (!e)
2691
2691
  return;
2692
2692
  const i = e.getStage();
2693
- i && i.content, be.delete(a), Gs && e._fire("lostpointercapture", Ii(new PointerEvent("lostpointercapture")));
2694
- }
2695
- const Tr = "Stage", vr = "string", Xi = "px", br = "mouseout", zs = "mouseleave", Ns = "mouseover", Fs = "mouseenter", Vs = "mousemove", Ws = "mousedown", Ys = "mouseup", he = "pointermove", ce = "pointerdown", Jt = "pointerup", de = "pointercancel", kr = "lostpointercapture", Ee = "pointerout", ue = "pointerleave", Ie = "pointerover", Me = "pointerenter", gi = "contextmenu", Xs = "touchstart", Us = "touchend", $s = "touchmove", Ks = "touchcancel", pi = "wheel", wr = 5, _r = [
2696
- [Fs, "_pointerenter"],
2697
- [Ws, "_pointerdown"],
2698
- [Vs, "_pointermove"],
2699
- [Ys, "_pointerup"],
2700
- [zs, "_pointerleave"],
2693
+ i && i.content, be.delete(a), Hs && e._fire("lostpointercapture", Ii(new PointerEvent("lostpointercapture")));
2694
+ }
2695
+ const vr = "Stage", br = "string", Xi = "px", kr = "mouseout", Fs = "mouseleave", Vs = "mouseover", Ws = "mouseenter", Ys = "mousemove", Xs = "mousedown", Us = "mouseup", he = "pointermove", ce = "pointerdown", Jt = "pointerup", de = "pointercancel", wr = "lostpointercapture", Ee = "pointerout", ue = "pointerleave", Ie = "pointerover", Me = "pointerenter", gi = "contextmenu", $s = "touchstart", Ks = "touchend", js = "touchmove", Zs = "touchcancel", pi = "wheel", _r = 5, Pr = [
2696
+ [Ws, "_pointerenter"],
2701
2697
  [Xs, "_pointerdown"],
2702
- [$s, "_pointermove"],
2698
+ [Ys, "_pointermove"],
2703
2699
  [Us, "_pointerup"],
2704
- [Ks, "_pointercancel"],
2705
- [Ns, "_pointerover"],
2700
+ [Fs, "_pointerleave"],
2701
+ [$s, "_pointerdown"],
2702
+ [js, "_pointermove"],
2703
+ [Ks, "_pointerup"],
2704
+ [Zs, "_pointercancel"],
2705
+ [Vs, "_pointerover"],
2706
2706
  [pi, "_wheel"],
2707
2707
  [gi, "_contextmenu"],
2708
2708
  [ce, "_pointerdown"],
@@ -2710,16 +2710,16 @@ const Tr = "Stage", vr = "string", Xi = "px", br = "mouseout", zs = "mouseleave"
2710
2710
  [Jt, "_pointerup"],
2711
2711
  [de, "_pointercancel"],
2712
2712
  [ue, "_pointerleave"],
2713
- [kr, "_lostpointercapture"]
2713
+ [wr, "_lostpointercapture"]
2714
2714
  ], Qe = {
2715
2715
  mouse: {
2716
- [Ee]: br,
2717
- [ue]: zs,
2718
- [Ie]: Ns,
2719
- [Me]: Fs,
2720
- [he]: Vs,
2721
- [ce]: Ws,
2722
- [Jt]: Ys,
2716
+ [Ee]: kr,
2717
+ [ue]: Fs,
2718
+ [Ie]: Vs,
2719
+ [Me]: Ws,
2720
+ [he]: Ys,
2721
+ [ce]: Xs,
2722
+ [Jt]: Us,
2723
2723
  [de]: "mousecancel",
2724
2724
  pointerclick: "click",
2725
2725
  pointerdblclick: "dblclick"
@@ -2729,10 +2729,10 @@ const Tr = "Stage", vr = "string", Xi = "px", br = "mouseout", zs = "mouseleave"
2729
2729
  [ue]: "touchleave",
2730
2730
  [Ie]: "touchover",
2731
2731
  [Me]: "touchenter",
2732
- [he]: $s,
2733
- [ce]: Xs,
2734
- [Jt]: Us,
2735
- [de]: Ks,
2732
+ [he]: js,
2733
+ [ce]: $s,
2734
+ [Jt]: Ks,
2735
+ [de]: Zs,
2736
2736
  pointerclick: "tap",
2737
2737
  pointerdblclick: "dbltap"
2738
2738
  },
@@ -2758,9 +2758,9 @@ const Tr = "Stage", vr = "string", Xi = "px", br = "mouseout", zs = "mouseleave"
2758
2758
  return Qe.mouse;
2759
2759
  };
2760
2760
  function Ui(a = {}) {
2761
- return (a.clipFunc || a.clipWidth || a.clipHeight) && C.warn("Stage does not support clipping. Please use clip for Layers or Groups."), a;
2761
+ return (a.clipFunc || a.clipWidth || a.clipHeight) && S.warn("Stage does not support clipping. Please use clip for Layers or Groups."), a;
2762
2762
  }
2763
- const Pr = "Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);", ye = [];
2763
+ const xr = "Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);", ye = [];
2764
2764
  class Ze extends dt {
2765
2765
  constructor(t) {
2766
2766
  super(Ui(t)), this._pointerPositions = [], this._changedPointerPositions = [], this._buildDOM(), this._bindContentEvents(), ye.push(this), this.on("widthChange.konva heightChange.konva", this._resizeDOM), this.on("visibleChange.konva", this._checkVisibility), this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva", () => {
@@ -2769,7 +2769,7 @@ class Ze extends dt {
2769
2769
  }
2770
2770
  _validateAdd(t) {
2771
2771
  const e = t.getType() === "Layer", i = t.getType() === "FastLayer";
2772
- e || i || C.throw("You may only add layers to the stage.");
2772
+ e || i || S.throw("You may only add layers to the stage.");
2773
2773
  }
2774
2774
  _checkVisibility() {
2775
2775
  if (!this.content)
@@ -2778,7 +2778,7 @@ class Ze extends dt {
2778
2778
  this.content.style.display = t;
2779
2779
  }
2780
2780
  setContainer(t) {
2781
- if (typeof t === vr) {
2781
+ if (typeof t === br) {
2782
2782
  let e;
2783
2783
  if (t.charAt(0) === ".") {
2784
2784
  const i = t.slice(1);
@@ -2805,16 +2805,16 @@ class Ze extends dt {
2805
2805
  destroy() {
2806
2806
  super.destroy();
2807
2807
  const t = this.content;
2808
- t && C._isInDocument(t) && this.container().removeChild(t);
2808
+ t && S._isInDocument(t) && this.container().removeChild(t);
2809
2809
  const e = ye.indexOf(this);
2810
- return e > -1 && ye.splice(e, 1), C.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas), this;
2810
+ return e > -1 && ye.splice(e, 1), S.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas), this;
2811
2811
  }
2812
2812
  getPointerPosition() {
2813
2813
  const t = this._pointerPositions[0] || this._changedPointerPositions[0];
2814
2814
  return t ? {
2815
2815
  x: t.x,
2816
2816
  y: t.y
2817
- } : (C.warn(Pr), null);
2817
+ } : (S.warn(xr), null);
2818
2818
  }
2819
2819
  _getPointerById(t) {
2820
2820
  return this._pointerPositions.find((e) => e.id === t);
@@ -2867,7 +2867,7 @@ class Ze extends dt {
2867
2867
  }
2868
2868
  super.add(t);
2869
2869
  const i = this.children.length;
2870
- return i > wr && C.warn("The stage has " + i + " layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."), t.setSize({ width: this.width(), height: this.height() }), t.draw(), E.isBrowser && this.content.appendChild(t.canvas._canvas), this;
2870
+ return i > _r && S.warn("The stage has " + i + " layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."), t.setSize({ width: this.width(), height: this.height() }), t.draw(), E.isBrowser && this.content.appendChild(t.canvas._canvas), this;
2871
2871
  }
2872
2872
  getParent() {
2873
2873
  return null;
@@ -2876,10 +2876,10 @@ class Ze extends dt {
2876
2876
  return null;
2877
2877
  }
2878
2878
  hasPointerCapture(t) {
2879
- return Bs(t, this);
2879
+ return zs(t, this);
2880
2880
  }
2881
2881
  setPointerCapture(t) {
2882
- Hs(t, this);
2882
+ Ns(t, this);
2883
2883
  }
2884
2884
  releaseCapture(t) {
2885
2885
  me(t);
@@ -2888,7 +2888,7 @@ class Ze extends dt {
2888
2888
  return this.children;
2889
2889
  }
2890
2890
  _bindContentEvents() {
2891
- E.isBrowser && _r.forEach(([t, e]) => {
2891
+ E.isBrowser && Pr.forEach(([t, e]) => {
2892
2892
  this.content.addEventListener(t, (i) => {
2893
2893
  this[e](i);
2894
2894
  }, { passive: !1 });
@@ -3076,12 +3076,12 @@ class Ze extends dt {
3076
3076
  })) : (i = (t.clientX - e.left) / e.scaleX, s = (t.clientY - e.top) / e.scaleY, this.pointerPos = {
3077
3077
  x: i,
3078
3078
  y: s
3079
- }, this._pointerPositions = [{ x: i, y: s, id: C._getFirstPointerId(t) }], this._changedPointerPositions = [
3080
- { x: i, y: s, id: C._getFirstPointerId(t) }
3079
+ }, this._pointerPositions = [{ x: i, y: s, id: S._getFirstPointerId(t) }], this._changedPointerPositions = [
3080
+ { x: i, y: s, id: S._getFirstPointerId(t) }
3081
3081
  ]);
3082
3082
  }
3083
3083
  _setPointerPosition(t) {
3084
- C.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'), this.setPointersPositions(t);
3084
+ S.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'), this.setPointersPositions(t);
3085
3085
  }
3086
3086
  _getContentPosition() {
3087
3087
  if (!this.content || !this.content.getBoundingClientRect)
@@ -3115,7 +3115,7 @@ class Ze extends dt {
3115
3115
  t.innerHTML = "", this.content = document.createElement("div"), this.content.style.position = "relative", this.content.style.userSelect = "none", this.content.className = "konvajs-content", this.content.setAttribute("role", "presentation"), t.appendChild(this.content), this._resizeDOM();
3116
3116
  }
3117
3117
  cache() {
3118
- return C.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."), this;
3118
+ return S.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."), this;
3119
3119
  }
3120
3120
  clearCache() {
3121
3121
  return this;
@@ -3126,7 +3126,7 @@ class Ze extends dt {
3126
3126
  }), this;
3127
3127
  }
3128
3128
  }
3129
- Ze.prototype.nodeType = Tr;
3129
+ Ze.prototype.nodeType = vr;
3130
3130
  st(Ze);
3131
3131
  m.addGetterSetter(Ze, "container");
3132
3132
  E.isBrowser && document.addEventListener("visibilitychange", () => {
@@ -3134,57 +3134,57 @@ E.isBrowser && document.addEventListener("visibilitychange", () => {
3134
3134
  a.batchDraw();
3135
3135
  });
3136
3136
  });
3137
- const js = "hasShadow", Zs = "shadowRGBA", qs = "patternImage", Js = "linearGradient", Qs = "radialGradient";
3137
+ const qs = "hasShadow", Js = "shadowRGBA", Qs = "patternImage", tn = "linearGradient", en = "radialGradient";
3138
3138
  let Le;
3139
3139
  function ti() {
3140
- return Le || (Le = C.createCanvasElement().getContext("2d"), Le);
3140
+ return Le || (Le = S.createCanvasElement().getContext("2d"), Le);
3141
3141
  }
3142
- const Ce = {};
3143
- function xr(a) {
3142
+ const Se = {};
3143
+ function Ar(a) {
3144
3144
  const t = this.attrs.fillRule;
3145
3145
  t ? a.fill(t) : a.fill();
3146
3146
  }
3147
- function Ar(a) {
3147
+ function Er(a) {
3148
3148
  a.stroke();
3149
3149
  }
3150
- function Er(a) {
3150
+ function Ir(a) {
3151
3151
  const t = this.attrs.fillRule;
3152
3152
  t ? a.fill(t) : a.fill();
3153
3153
  }
3154
- function Ir(a) {
3154
+ function Mr(a) {
3155
3155
  a.stroke();
3156
3156
  }
3157
- function Mr() {
3158
- this._clearCache(js);
3159
- }
3160
3157
  function Lr() {
3161
- this._clearCache(Zs);
3158
+ this._clearCache(qs);
3162
3159
  }
3163
3160
  function Dr() {
3164
- this._clearCache(qs);
3161
+ this._clearCache(Js);
3165
3162
  }
3166
3163
  function Rr() {
3167
- this._clearCache(Js);
3164
+ this._clearCache(Qs);
3168
3165
  }
3169
3166
  function Or() {
3170
- this._clearCache(Qs);
3167
+ this._clearCache(tn);
3168
+ }
3169
+ function Gr() {
3170
+ this._clearCache(en);
3171
3171
  }
3172
3172
  class w extends P {
3173
3173
  constructor(t) {
3174
3174
  super(t);
3175
3175
  let e, i = 0;
3176
- for (; e = C.getHitColor(), !(e && !(e in Ce)); )
3176
+ for (; e = S.getHitColor(), !(e && !(e in Se)); )
3177
3177
  if (i++, i >= 1e4) {
3178
- C.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."), e = C.getRandomColor();
3178
+ S.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."), e = S.getRandomColor();
3179
3179
  break;
3180
3180
  }
3181
- this.colorKey = e, Ce[e] = this;
3181
+ this.colorKey = e, Se[e] = this;
3182
3182
  }
3183
3183
  getContext() {
3184
- return C.warn("shape.getContext() method is deprecated. Please do not use it."), this.getLayer().getContext();
3184
+ return S.warn("shape.getContext() method is deprecated. Please do not use it."), this.getLayer().getContext();
3185
3185
  }
3186
3186
  getCanvas() {
3187
- return C.warn("shape.getCanvas() method is deprecated. Please do not use it."), this.getLayer().getCanvas();
3187
+ return S.warn("shape.getCanvas() method is deprecated. Please do not use it."), this.getLayer().getCanvas();
3188
3188
  }
3189
3189
  getSceneFunc() {
3190
3190
  return this.attrs.sceneFunc || this._sceneFunc;
@@ -3193,13 +3193,13 @@ class w extends P {
3193
3193
  return this.attrs.hitFunc || this._hitFunc;
3194
3194
  }
3195
3195
  hasShadow() {
3196
- return this._getCache(js, this._hasShadow);
3196
+ return this._getCache(qs, this._hasShadow);
3197
3197
  }
3198
3198
  _hasShadow() {
3199
3199
  return this.shadowEnabled() && this.shadowOpacity() !== 0 && !!(this.shadowColor() || this.shadowBlur() || this.shadowOffsetX() || this.shadowOffsetY());
3200
3200
  }
3201
3201
  _getFillPattern() {
3202
- return this._getCache(qs, this.__getFillPattern);
3202
+ return this._getCache(Qs, this.__getFillPattern);
3203
3203
  }
3204
3204
  __getFillPattern() {
3205
3205
  if (this.fillPatternImage()) {
@@ -3221,7 +3221,7 @@ class w extends P {
3221
3221
  }
3222
3222
  }
3223
3223
  _getLinearGradient() {
3224
- return this._getCache(Js, this.__getLinearGradient);
3224
+ return this._getCache(tn, this.__getLinearGradient);
3225
3225
  }
3226
3226
  __getLinearGradient() {
3227
3227
  const t = this.fillLinearGradientColorStops();
@@ -3233,7 +3233,7 @@ class w extends P {
3233
3233
  }
3234
3234
  }
3235
3235
  _getRadialGradient() {
3236
- return this._getCache(Qs, this.__getRadialGradient);
3236
+ return this._getCache(en, this.__getRadialGradient);
3237
3237
  }
3238
3238
  __getRadialGradient() {
3239
3239
  const t = this.fillRadialGradientColorStops();
@@ -3245,12 +3245,12 @@ class w extends P {
3245
3245
  }
3246
3246
  }
3247
3247
  getShadowRGBA() {
3248
- return this._getCache(Zs, this._getShadowRGBA);
3248
+ return this._getCache(Js, this._getShadowRGBA);
3249
3249
  }
3250
3250
  _getShadowRGBA() {
3251
3251
  if (!this.hasShadow())
3252
3252
  return;
3253
- const t = C.colorToRGBA(this.shadowColor());
3253
+ const t = S.colorToRGBA(this.shadowColor());
3254
3254
  if (t)
3255
3255
  return "rgba(" + t.r + "," + t.g + "," + t.b + "," + t.a * (this.shadowOpacity() || 1) + ")";
3256
3256
  }
@@ -3283,7 +3283,7 @@ class w extends P {
3283
3283
  return i.getContext().clear(), this.drawHit(i, void 0, !0), i.context.getImageData(Math.round(t.x), Math.round(t.y), 1, 1).data[3] > 0;
3284
3284
  }
3285
3285
  destroy() {
3286
- return P.prototype.destroy.call(this), delete Ce[this.colorKey], delete this.colorKey, this;
3286
+ return P.prototype.destroy.call(this), delete Se[this.colorKey], delete this.colorKey, this;
3287
3287
  }
3288
3288
  _useBufferCanvas(t) {
3289
3289
  var e;
@@ -3296,7 +3296,7 @@ class w extends P {
3296
3296
  return !!(s && n && o && l);
3297
3297
  }
3298
3298
  setStrokeHitEnabled(t) {
3299
- C.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."), t ? this.hitStrokeWidth("auto") : this.hitStrokeWidth(0);
3299
+ S.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."), t ? this.hitStrokeWidth("auto") : this.hitStrokeWidth(0);
3300
3300
  }
3301
3301
  getStrokeHitEnabled() {
3302
3302
  return this.hitStrokeWidth() !== 0;
@@ -3319,8 +3319,8 @@ class w extends P {
3319
3319
  }
3320
3320
  i = i.getParent();
3321
3321
  }
3322
- const s = t.skipTransform, n = t.relativeTo || e && this.getStage() || void 0, r = this.getSelfRect(), l = !t.skipStroke && this.hasStroke() && this.strokeWidth() || 0, h = r.width + l, c = r.height + l, d = !t.skipShadow && this.hasShadow(), u = d ? this.shadowOffsetX() : 0, p = d ? this.shadowOffsetY() : 0, g = h + Math.abs(u), y = c + Math.abs(p), T = d && this.shadowBlur() || 0, S = g + T * 2, v = y + T * 2, b = {
3323
- width: S,
3322
+ const s = t.skipTransform, n = t.relativeTo || e && this.getStage() || void 0, r = this.getSelfRect(), l = !t.skipStroke && this.hasStroke() && this.strokeWidth() || 0, h = r.width + l, c = r.height + l, d = !t.skipShadow && this.hasShadow(), u = d ? this.shadowOffsetX() : 0, p = d ? this.shadowOffsetY() : 0, g = h + Math.abs(u), y = c + Math.abs(p), T = d && this.shadowBlur() || 0, C = g + T * 2, v = y + T * 2, b = {
3323
+ width: C,
3324
3324
  height: v,
3325
3325
  x: -(l / 2 + T) + Math.min(u, 0) + r.x,
3326
3326
  y: -(l / 2 + T) + Math.min(p, 0) + r.y
@@ -3361,7 +3361,7 @@ class w extends P {
3361
3361
  if (!this.shouldDrawHit(e, i))
3362
3362
  return this;
3363
3363
  const s = this.getLayer(), n = t || s.hitCanvas, r = n && n.getContext(), o = this.hitFunc() || this.sceneFunc(), l = this._getCanvasCache(), h = l && l.hit;
3364
- if (this.colorKey || C.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"), h) {
3364
+ if (this.colorKey || S.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"), h) {
3365
3365
  r.save();
3366
3366
  const d = this.getAbsoluteTransform(e).getMatrix();
3367
3367
  return r.transform(d[0], d[1], d[2], d[3], d[4], d[5]), this._drawCachedHitCanvas(r), r.restore(), this;
@@ -3378,39 +3378,39 @@ class w extends P {
3378
3378
  const e = this._getCanvasCache(), i = this._getCachedSceneCanvas(), s = e.hit, n = s.getContext(), r = s.getWidth(), o = s.getHeight();
3379
3379
  n.clear(), n.drawImage(i._canvas, 0, 0, r, o);
3380
3380
  try {
3381
- const l = n.getImageData(0, 0, r, o), h = l.data, c = h.length, d = C._hexToRgb(this.colorKey);
3381
+ const l = n.getImageData(0, 0, r, o), h = l.data, c = h.length, d = S._hexToRgb(this.colorKey);
3382
3382
  for (let u = 0; u < c; u += 4)
3383
3383
  h[u + 3] > t ? (h[u] = d.r, h[u + 1] = d.g, h[u + 2] = d.b, h[u + 3] = 255) : h[u + 3] = 0;
3384
3384
  n.putImageData(l, 0, 0);
3385
3385
  } catch (l) {
3386
- C.error("Unable to draw hit graph from cached scene canvas. " + l.message);
3386
+ S.error("Unable to draw hit graph from cached scene canvas. " + l.message);
3387
3387
  }
3388
3388
  return this;
3389
3389
  }
3390
3390
  hasPointerCapture(t) {
3391
- return Bs(t, this);
3391
+ return zs(t, this);
3392
3392
  }
3393
3393
  setPointerCapture(t) {
3394
- Hs(t, this);
3394
+ Ns(t, this);
3395
3395
  }
3396
3396
  releaseCapture(t) {
3397
3397
  me(t);
3398
3398
  }
3399
3399
  }
3400
- w.prototype._fillFunc = xr;
3401
- w.prototype._strokeFunc = Ar;
3402
- w.prototype._fillFuncHit = Er;
3403
- w.prototype._strokeFuncHit = Ir;
3400
+ w.prototype._fillFunc = Ar;
3401
+ w.prototype._strokeFunc = Er;
3402
+ w.prototype._fillFuncHit = Ir;
3403
+ w.prototype._strokeFuncHit = Mr;
3404
3404
  w.prototype._centroid = !1;
3405
3405
  w.prototype.nodeType = "Shape";
3406
3406
  st(w);
3407
3407
  w.prototype.eventListeners = {};
3408
- w.prototype.on.call(w.prototype, "shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Mr);
3409
- w.prototype.on.call(w.prototype, "shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Lr);
3410
- w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva", Dr);
3411
- w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva", Rr);
3412
- w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva", Or);
3413
- m.addGetterSetter(w, "stroke", void 0, Os());
3408
+ w.prototype.on.call(w.prototype, "shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Lr);
3409
+ w.prototype.on.call(w.prototype, "shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva", Dr);
3410
+ w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva", Rr);
3411
+ w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva", Or);
3412
+ w.prototype.on.call(w.prototype, "fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva", Gr);
3413
+ m.addGetterSetter(w, "stroke", void 0, Bs());
3414
3414
  m.addGetterSetter(w, "strokeWidth", 2, x());
3415
3415
  m.addGetterSetter(w, "fillAfterStrokeEnabled", !1);
3416
3416
  m.addGetterSetter(w, "hitStrokeWidth", "auto", Ei());
@@ -3431,7 +3431,7 @@ m.addComponentsGetterSetter(w, "shadowOffset", ["x", "y"]);
3431
3431
  m.addGetterSetter(w, "shadowOffsetX", 0, x());
3432
3432
  m.addGetterSetter(w, "shadowOffsetY", 0, x());
3433
3433
  m.addGetterSetter(w, "fillPatternImage");
3434
- m.addGetterSetter(w, "fill", void 0, Os());
3434
+ m.addGetterSetter(w, "fill", void 0, Bs());
3435
3435
  m.addGetterSetter(w, "fillPatternX", 0, x());
3436
3436
  m.addGetterSetter(w, "fillPatternY", 0, x());
3437
3437
  m.addGetterSetter(w, "fillLinearGradientColorStops");
@@ -3501,13 +3501,13 @@ m.backCompat(w, {
3501
3501
  getDrawHitFunc: "getHitFunc",
3502
3502
  setDrawHitFunc: "setHitFunc"
3503
3503
  });
3504
- const Gr = "beforeDraw", Br = "draw", tn = [
3504
+ const Br = "beforeDraw", Hr = "draw", sn = [
3505
3505
  { x: 0, y: 0 },
3506
3506
  { x: -1, y: -1 },
3507
3507
  { x: 1, y: -1 },
3508
3508
  { x: 1, y: 1 },
3509
3509
  { x: -1, y: 1 }
3510
- ], Hr = tn.length;
3510
+ ], zr = sn.length;
3511
3511
  class Yt extends dt {
3512
3512
  constructor(t) {
3513
3513
  super(t), this.canvas = new Lt(), this.hitCanvas = new Ai({
@@ -3575,7 +3575,7 @@ class Yt extends dt {
3575
3575
  }
3576
3576
  remove() {
3577
3577
  const t = this.getNativeCanvasElement();
3578
- return P.prototype.remove.call(this), t && t.parentNode && C._isInDocument(t) && t.parentNode.removeChild(t), this;
3578
+ return P.prototype.remove.call(this), t && t.parentNode && S._isInDocument(t) && t.parentNode.removeChild(t), this;
3579
3579
  }
3580
3580
  getStage() {
3581
3581
  return this.parent;
@@ -3585,7 +3585,7 @@ class Yt extends dt {
3585
3585
  }
3586
3586
  _validateAdd(t) {
3587
3587
  const e = t.getType();
3588
- e !== "Group" && e !== "Shape" && C.throw("You may only add groups and shapes to a layer.");
3588
+ e !== "Group" && e !== "Shape" && S.throw("You may only add groups and shapes to a layer.");
3589
3589
  }
3590
3590
  _toKonvaCanvas(t) {
3591
3591
  return t = { ...t }, t.width = t.width || this.getWidth(), t.height = t.height || this.getHeight(), t.x = t.x !== void 0 ? t.x : this.x(), t.y = t.y !== void 0 ? t.y : this.y(), P.prototype._toKonvaCanvas.call(this, t);
@@ -3601,17 +3601,17 @@ class Yt extends dt {
3601
3601
  return this.parent.width();
3602
3602
  }
3603
3603
  setWidth() {
3604
- C.warn('Can not change width of layer. Use "stage.width(value)" function instead.');
3604
+ S.warn('Can not change width of layer. Use "stage.width(value)" function instead.');
3605
3605
  }
3606
3606
  getHeight() {
3607
3607
  if (this.parent)
3608
3608
  return this.parent.height();
3609
3609
  }
3610
3610
  setHeight() {
3611
- C.warn('Can not change height of layer. Use "stage.height(value)" function instead.');
3611
+ S.warn('Can not change height of layer. Use "stage.height(value)" function instead.');
3612
3612
  }
3613
3613
  batchDraw() {
3614
- return this._waitingForDraw || (this._waitingForDraw = !0, C.requestAnimFrame(() => {
3614
+ return this._waitingForDraw || (this._waitingForDraw = !0, S.requestAnimFrame(() => {
3615
3615
  this.draw(), this._waitingForDraw = !1;
3616
3616
  })), this;
3617
3617
  }
@@ -3620,8 +3620,8 @@ class Yt extends dt {
3620
3620
  return null;
3621
3621
  let e = 1, i = !1;
3622
3622
  for (; ; ) {
3623
- for (let s = 0; s < Hr; s++) {
3624
- const n = tn[s], r = this._getIntersection({
3623
+ for (let s = 0; s < zr; s++) {
3624
+ const n = sn[s], r = this._getIntersection({
3625
3625
  x: t.x + n.x * e,
3626
3626
  y: t.y + n.y * e
3627
3627
  }), o = r.shape;
@@ -3639,7 +3639,7 @@ class Yt extends dt {
3639
3639
  _getIntersection(t) {
3640
3640
  const e = this.hitCanvas.pixelRatio, i = this.hitCanvas.context.getImageData(Math.round(t.x * e), Math.round(t.y * e), 1, 1).data, s = i[3];
3641
3641
  if (s === 255) {
3642
- const n = C.getHitColorKey(i[0], i[1], i[2]), r = Ce[n];
3642
+ const n = S.getHitColorKey(i[0], i[1], i[2]), r = Se[n];
3643
3643
  return r ? {
3644
3644
  shape: r
3645
3645
  } : {
@@ -3653,9 +3653,9 @@ class Yt extends dt {
3653
3653
  }
3654
3654
  drawScene(t, e, i) {
3655
3655
  const s = this.getLayer(), n = t || s && s.getCanvas();
3656
- return this._fire(Gr, {
3656
+ return this._fire(Br, {
3657
3657
  node: this
3658
- }), this.clearBeforeDraw() && n.getContext().clear(), dt.prototype.drawScene.call(this, n, e, i), this._fire(Br, {
3658
+ }), this.clearBeforeDraw() && n.getContext().clear(), dt.prototype.drawScene.call(this, n, e, i), this._fire(Hr, {
3659
3659
  node: this
3660
3660
  }), this;
3661
3661
  }
@@ -3670,10 +3670,10 @@ class Yt extends dt {
3670
3670
  return this.hitGraphEnabled(!1), this;
3671
3671
  }
3672
3672
  setHitGraphEnabled(t) {
3673
- C.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening(t);
3673
+ S.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening(t);
3674
3674
  }
3675
3675
  getHitGraphEnabled(t) {
3676
- return C.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening();
3676
+ return S.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."), this.listening();
3677
3677
  }
3678
3678
  toggleHitCanvas() {
3679
3679
  if (!this.parent || !this.parent.content)
@@ -3682,7 +3682,7 @@ class Yt extends dt {
3682
3682
  !!this.hitCanvas._canvas.parentNode ? t.content.removeChild(this.hitCanvas._canvas) : t.content.appendChild(this.hitCanvas._canvas);
3683
3683
  }
3684
3684
  destroy() {
3685
- return C.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas), super.destroy();
3685
+ return S.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas), super.destroy();
3686
3686
  }
3687
3687
  }
3688
3688
  Yt.prototype.nodeType = "Layer";
@@ -3692,7 +3692,7 @@ m.addGetterSetter(Yt, "clearBeforeDraw", !0);
3692
3692
  m.addGetterSetter(Yt, "hitGraphEnabled", !0, pt());
3693
3693
  class Mi extends Yt {
3694
3694
  constructor(t) {
3695
- super(t), this.listening(!1), C.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.');
3695
+ super(t), this.listening(!1), S.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.');
3696
3696
  }
3697
3697
  }
3698
3698
  Mi.prototype.nodeType = "FastLayer";
@@ -3700,7 +3700,7 @@ st(Mi);
3700
3700
  class Qt extends dt {
3701
3701
  _validateAdd(t) {
3702
3702
  const e = t.getType();
3703
- e !== "Group" && e !== "Shape" && C.throw("You may only add groups and shapes to groups.");
3703
+ e !== "Group" && e !== "Shape" && S.throw("You may only add groups and shapes to groups.");
3704
3704
  }
3705
3705
  }
3706
3706
  Qt.prototype.nodeType = "Group";
@@ -3780,24 +3780,24 @@ class ft {
3780
3780
  }
3781
3781
  static _animationLoop() {
3782
3782
  const t = ft;
3783
- t.animations.length ? (t._runFrames(), C.requestAnimFrame(t._animationLoop)) : t.animRunning = !1;
3783
+ t.animations.length ? (t._runFrames(), S.requestAnimFrame(t._animationLoop)) : t.animRunning = !1;
3784
3784
  }
3785
3785
  static _handleAnimation() {
3786
- this.animRunning || (this.animRunning = !0, C.requestAnimFrame(this._animationLoop));
3786
+ this.animRunning || (this.animRunning = !0, S.requestAnimFrame(this._animationLoop));
3787
3787
  }
3788
3788
  }
3789
3789
  ft.animations = [];
3790
3790
  ft.animIdCounter = 0;
3791
3791
  ft.animRunning = !1;
3792
- const zr = {
3792
+ const Nr = {
3793
3793
  node: 1,
3794
3794
  duration: 1,
3795
3795
  easing: 1,
3796
3796
  onFinish: 1,
3797
3797
  yoyo: 1
3798
- }, Nr = 1, $i = 2, Ki = 3, ji = ["fill", "stroke", "shadowColor"];
3799
- let Fr = 0;
3800
- class Vr {
3798
+ }, Fr = 1, $i = 2, Ki = 3, ji = ["fill", "stroke", "shadowColor"];
3799
+ let Vr = 0;
3800
+ class Wr {
3801
3801
  constructor(t, e, i, s, n, r, o) {
3802
3802
  this.prop = t, this.propFunc = e, this.begin = s, this._pos = s, this.duration = r, this._change = 0, this.prevPos = 0, this.yoyo = o, this._time = 0, this._position = 0, this._startTime = 0, this._finish = 0, this.func = i, this._change = n - this.begin, this.pause();
3803
3803
  }
@@ -3840,7 +3840,7 @@ class Vr {
3840
3840
  this.state === $i ? this.setTime(t) : this.state === Ki && this.setTime(this.duration - t);
3841
3841
  }
3842
3842
  pause() {
3843
- this.state = Nr, this.fire("onPause");
3843
+ this.state = Fr, this.fire("onPause");
3844
3844
  }
3845
3845
  getTimer() {
3846
3846
  return (/* @__PURE__ */ new Date()).getTime();
@@ -3848,17 +3848,17 @@ class Vr {
3848
3848
  }
3849
3849
  class Q {
3850
3850
  constructor(t) {
3851
- const e = this, i = t.node, s = i._id, n = t.easing || Se.Linear, r = !!t.yoyo;
3851
+ const e = this, i = t.node, s = i._id, n = t.easing || Ce.Linear, r = !!t.yoyo;
3852
3852
  let o, l;
3853
- typeof t.duration > "u" ? o = 0.3 : t.duration === 0 ? o = 1e-3 : o = t.duration, this.node = i, this._id = Fr++;
3853
+ typeof t.duration > "u" ? o = 0.3 : t.duration === 0 ? o = 1e-3 : o = t.duration, this.node = i, this._id = Vr++;
3854
3854
  const h = i.getLayer() || (i instanceof E.Stage ? i.getLayers() : null);
3855
- h || C.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new ft(function() {
3855
+ h || S.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new ft(function() {
3856
3856
  e.tween.onEnterFrame();
3857
- }, h), this.tween = new Vr(l, function(c) {
3857
+ }, h), this.tween = new Wr(l, function(c) {
3858
3858
  e._tweenFunc(c);
3859
3859
  }, n, 0, 1, o * 1e3, r), this._addListeners(), Q.attrs[s] || (Q.attrs[s] = {}), Q.attrs[s][this._id] || (Q.attrs[s][this._id] = {}), Q.tweens[s] || (Q.tweens[s] = {});
3860
3860
  for (l in t)
3861
- zr[l] === void 0 && this._addAttr(l, t[l]);
3861
+ Nr[l] === void 0 && this._addAttr(l, t[l]);
3862
3862
  this.reset(), this.onFinish = t.onFinish, this.onReset = t.onReset, this.onUpdate = t.onUpdate;
3863
3863
  }
3864
3864
  _addAttr(t, e) {
@@ -3867,14 +3867,14 @@ class Q {
3867
3867
  const c = Q.tweens[s][t];
3868
3868
  c && delete Q.attrs[s][c][t];
3869
3869
  let d = i.getAttr(t);
3870
- if (C._isArray(e))
3871
- if (n = [], r = Math.max(e.length, d.length), t === "points" && e.length !== d.length && (e.length > d.length ? (l = d, d = C._prepareArrayForTween(d, e, i.closed())) : (o = e, e = C._prepareArrayForTween(e, d, i.closed()))), t.indexOf("fill") === 0)
3870
+ if (S._isArray(e))
3871
+ if (n = [], r = Math.max(e.length, d.length), t === "points" && e.length !== d.length && (e.length > d.length ? (l = d, d = S._prepareArrayForTween(d, e, i.closed())) : (o = e, e = S._prepareArrayForTween(e, d, i.closed()))), t.indexOf("fill") === 0)
3872
3872
  for (let u = 0; u < r; u++)
3873
3873
  if (u % 2 === 0)
3874
3874
  n.push(e[u] - d[u]);
3875
3875
  else {
3876
- const p = C.colorToRGBA(d[u]);
3877
- h = C.colorToRGBA(e[u]), d[u] = p, n.push({
3876
+ const p = S.colorToRGBA(d[u]);
3877
+ h = S.colorToRGBA(e[u]), d[u] = p, n.push({
3878
3878
  r: h.r - p.r,
3879
3879
  g: h.g - p.g,
3880
3880
  b: h.b - p.b,
@@ -3884,7 +3884,7 @@ class Q {
3884
3884
  else
3885
3885
  for (let u = 0; u < r; u++)
3886
3886
  n.push(e[u] - d[u]);
3887
- else ji.indexOf(t) !== -1 ? (d = C.colorToRGBA(d), h = C.colorToRGBA(e), n = {
3887
+ else ji.indexOf(t) !== -1 ? (d = S.colorToRGBA(d), h = S.colorToRGBA(e), n = {
3888
3888
  r: h.r - d.r,
3889
3889
  g: h.g - d.g,
3890
3890
  b: h.b - d.b,
@@ -3902,7 +3902,7 @@ class Q {
3902
3902
  const e = this.node, i = Q.attrs[e._id][this._id];
3903
3903
  let s, n, r, o, l, h, c, d;
3904
3904
  for (s in i) {
3905
- if (n = i[s], r = n.start, o = n.diff, d = n.end, C._isArray(r))
3905
+ if (n = i[s], r = n.start, o = n.diff, d = n.end, S._isArray(r))
3906
3906
  if (l = [], c = Math.max(r.length, d.length), s.indexOf("fill") === 0)
3907
3907
  for (h = 0; h < c; h++)
3908
3908
  h % 2 === 0 ? l.push((r[h] || 0) + o[h] * t) : l.push("rgba(" + Math.round(r[h].r + o[h].r * t) + "," + Math.round(r[h].g + o[h].g * t) + "," + Math.round(r[h].b + o[h].b * t) + "," + (r[h].a + o[h].a * t) + ")");
@@ -3964,7 +3964,7 @@ P.prototype.to = function(a) {
3964
3964
  this.destroy(), t && t();
3965
3965
  }, new Q(a).play();
3966
3966
  };
3967
- const Se = {
3967
+ const Ce = {
3968
3968
  BackEaseIn(a, t, e, i) {
3969
3969
  return e * (a /= i) * a * ((1.70158 + 1) * a - 1.70158) + t;
3970
3970
  },
@@ -3991,10 +3991,10 @@ const Se = {
3991
3991
  return (a /= i) < 1 / 2.75 ? e * (7.5625 * a * a) + t : a < 2 / 2.75 ? e * (7.5625 * (a -= 1.5 / 2.75) * a + 0.75) + t : a < 2.5 / 2.75 ? e * (7.5625 * (a -= 2.25 / 2.75) * a + 0.9375) + t : e * (7.5625 * (a -= 2.625 / 2.75) * a + 0.984375) + t;
3992
3992
  },
3993
3993
  BounceEaseIn(a, t, e, i) {
3994
- return e - Se.BounceEaseOut(i - a, 0, e, i) + t;
3994
+ return e - Ce.BounceEaseOut(i - a, 0, e, i) + t;
3995
3995
  },
3996
3996
  BounceEaseInOut(a, t, e, i) {
3997
- return a < i / 2 ? Se.BounceEaseIn(a * 2, 0, e, i) * 0.5 + t : Se.BounceEaseOut(a * 2 - i, 0, e, i) * 0.5 + e * 0.5 + t;
3997
+ return a < i / 2 ? Ce.BounceEaseIn(a * 2, 0, e, i) * 0.5 + t : Ce.BounceEaseOut(a * 2 - i, 0, e, i) * 0.5 + e * 0.5 + t;
3998
3998
  },
3999
3999
  EaseIn(a, t, e, i) {
4000
4000
  return e * (a /= i) * a + t;
@@ -4017,8 +4017,8 @@ const Se = {
4017
4017
  Linear(a, t, e, i) {
4018
4018
  return e * a / i + t;
4019
4019
  }
4020
- }, Zi = C._assign(E, {
4021
- Util: C,
4020
+ }, Zi = S._assign(E, {
4021
+ Util: S,
4022
4022
  Transform: ct,
4023
4023
  Node: P,
4024
4024
  Container: dt,
@@ -4029,10 +4029,10 @@ const Se = {
4029
4029
  Group: Qt,
4030
4030
  DD: $,
4031
4031
  Shape: w,
4032
- shapes: Ce,
4032
+ shapes: Se,
4033
4033
  Animation: ft,
4034
4034
  Tween: Q,
4035
- Easings: Se,
4035
+ Easings: Ce,
4036
4036
  Context: Ke,
4037
4037
  Canvas: xi
4038
4038
  });
@@ -4088,7 +4088,7 @@ function qi(a, t) {
4088
4088
  }
4089
4089
  return i;
4090
4090
  }
4091
- function Wr(a) {
4091
+ function Yr(a) {
4092
4092
  const t = [
4093
4093
  [a[0], a[2], a[4], a[6]],
4094
4094
  [a[1], a[3], a[5], a[7]]
@@ -4177,7 +4177,7 @@ class xt extends w {
4177
4177
  ] : this.bezier() ? t = [
4178
4178
  t[0],
4179
4179
  t[1],
4180
- ...Wr(this.points()),
4180
+ ...Yr(this.points()),
4181
4181
  t[t.length - 2],
4182
4182
  t[t.length - 1]
4183
4183
  ] : t = this.points();
@@ -4198,8 +4198,8 @@ st(xt);
4198
4198
  m.addGetterSetter(xt, "closed", !1);
4199
4199
  m.addGetterSetter(xt, "bezier", !1);
4200
4200
  m.addGetterSetter(xt, "tension", 0, x());
4201
- m.addGetterSetter(xt, "points", [], rr());
4202
- const Yr = [
4201
+ m.addGetterSetter(xt, "points", [], ar());
4202
+ const Xr = [
4203
4203
  [],
4204
4204
  [],
4205
4205
  [
@@ -4547,7 +4547,7 @@ const Yr = [
4547
4547
  -0.9951872199970213,
4548
4548
  0.9951872199970213
4549
4549
  ]
4550
- ], Xr = [
4550
+ ], Ur = [
4551
4551
  [],
4552
4552
  [],
4553
4553
  [1, 1],
@@ -4892,12 +4892,12 @@ const Yr = [
4892
4892
  0.0123412297999872,
4893
4893
  0.0123412297999872
4894
4894
  ]
4895
- ], Ur = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]], Ji = (a, t, e) => {
4895
+ ], $r = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]], Ji = (a, t, e) => {
4896
4896
  let i, s;
4897
4897
  const r = e / 2;
4898
4898
  i = 0;
4899
4899
  for (let o = 0; o < 20; o++)
4900
- s = r * Yr[20][o] + r, i += Xr[20][o] * $r(a, t, s);
4900
+ s = r * Xr[20][o] + r, i += Ur[20][o] * Kr(a, t, s);
4901
4901
  return r * i;
4902
4902
  }, Qi = (a, t, e) => {
4903
4903
  e === void 0 && (e = 1);
@@ -4907,7 +4907,7 @@ const Yr = [
4907
4907
  const c = l / (2 * o), d = h / o, u = e + c, p = d - c * c, g = u * u + p > 0 ? Math.sqrt(u * u + p) : 0, y = c * c + p > 0 ? Math.sqrt(c * c + p) : 0, T = c + Math.sqrt(c * c + p) !== 0 ? p * Math.log(Math.abs((u + g) / (c + y))) : 0;
4908
4908
  return Math.sqrt(o) / 2 * (u * g - c * y + T);
4909
4909
  };
4910
- function $r(a, t, e) {
4910
+ function Kr(a, t, e) {
4911
4911
  const i = yi(1, e, a), s = yi(1, e, t), n = i * i + s * s;
4912
4912
  return Math.sqrt(n);
4913
4913
  }
@@ -4919,7 +4919,7 @@ const yi = (a, t, e) => {
4919
4919
  if (a === 0) {
4920
4920
  n = 0;
4921
4921
  for (let r = 0; r <= i; r++)
4922
- n += Ur[i][r] * Math.pow(1 - t, i - r) * Math.pow(t, r) * e[r];
4922
+ n += $r[i][r] * Math.pow(1 - t, i - r) * Math.pow(t, r) * e[r];
4923
4923
  return n;
4924
4924
  } else {
4925
4925
  s = new Array(i);
@@ -4971,8 +4971,8 @@ class tt extends w {
4971
4971
  t.quadraticCurveTo(r[0], r[1], r[2], r[3]);
4972
4972
  break;
4973
4973
  case "A":
4974
- const o = r[0], l = r[1], h = r[2], c = r[3], d = r[4], u = r[5], p = r[6], g = r[7], y = h > c ? h : c, T = h > c ? 1 : h / c, S = h > c ? c / h : 1;
4975
- t.translate(o, l), t.rotate(p), t.scale(T, S), t.arc(0, 0, y, d, d + u, 1 - g), t.scale(1 / T, 1 / S), t.rotate(-p), t.translate(-o, -l);
4974
+ const o = r[0], l = r[1], h = r[2], c = r[3], d = r[4], u = r[5], p = r[6], g = r[7], y = h > c ? h : c, T = h > c ? 1 : h / c, C = h > c ? c / h : 1;
4975
+ t.translate(o, l), t.rotate(p), t.scale(T, C), t.arc(0, 0, y, d, d + u, 1 - g), t.scale(1 / T, 1 / C), t.rotate(-p), t.translate(-o, -l);
4976
4976
  break;
4977
4977
  case "z":
4978
4978
  i = !0, t.closePath();
@@ -5074,8 +5074,8 @@ class tt extends w {
5074
5074
  const h = (n - i) / (s - e), c = Math.sqrt(t * t / (1 + h * h)) * (s < e ? -1 : 1), d = h * c;
5075
5075
  if (Math.abs(o - i - h * (r - e)) < 1e-10)
5076
5076
  return { x: r + c, y: o + d };
5077
- const u = ((r - e) * (s - e) + (o - i) * (n - i)) / (l * l), p = e + u * (s - e), g = i + u * (n - i), y = this.getLineLength(r, o, p, g), T = Math.sqrt(t * t - y * y), S = Math.sqrt(T * T / (1 + h * h)) * (s < e ? -1 : 1), v = h * S;
5078
- return { x: p + S, y: g + v };
5077
+ const u = ((r - e) * (s - e) + (o - i) * (n - i)) / (l * l), p = e + u * (s - e), g = i + u * (n - i), y = this.getLineLength(r, o, p, g), T = Math.sqrt(t * t - y * y), C = Math.sqrt(T * T / (1 + h * h)) * (s < e ? -1 : 1), v = h * C;
5078
+ return { x: p + C, y: g + v };
5079
5079
  }
5080
5080
  static getPointOnCubicBezier(t, e, i, s, n, r, o, l, h) {
5081
5081
  function c(T) {
@@ -5154,7 +5154,7 @@ class tt extends w {
5154
5154
  for (u = u.slice(1), r.length = 0; c = h.exec(u); )
5155
5155
  r.push(c[0]);
5156
5156
  let g = [], y = p === "A" || p === "a" ? 0 : -1;
5157
- for (let T = 0, S = r.length; T < S; T++) {
5157
+ for (let T = 0, C = r.length; T < C; T++) {
5158
5158
  const v = r[T];
5159
5159
  if (v === "00") {
5160
5160
  g.push(0, 0), y >= 0 && (y += 2, y >= 7 && (y -= 7));
@@ -5192,15 +5192,15 @@ class tt extends w {
5192
5192
  }
5193
5193
  }
5194
5194
  for (; g.length > 0 && !isNaN(g[0]); ) {
5195
- let T = "", S = [];
5195
+ let T = "", C = [];
5196
5196
  const v = o, b = l;
5197
5197
  let k, M, _, R, A, I, D, N, G, W;
5198
5198
  switch (p) {
5199
5199
  case "l":
5200
- o += g.shift(), l += g.shift(), T = "L", S.push(o, l);
5200
+ o += g.shift(), l += g.shift(), T = "L", C.push(o, l);
5201
5201
  break;
5202
5202
  case "L":
5203
- o = g.shift(), l = g.shift(), S.push(o, l);
5203
+ o = g.shift(), l = g.shift(), C.push(o, l);
5204
5204
  break;
5205
5205
  case "m":
5206
5206
  const F = g.shift(), H = g.shift();
@@ -5211,62 +5211,62 @@ class tt extends w {
5211
5211
  break;
5212
5212
  }
5213
5213
  }
5214
- S.push(o, l), p = "l";
5214
+ C.push(o, l), p = "l";
5215
5215
  break;
5216
5216
  case "M":
5217
- o = g.shift(), l = g.shift(), T = "M", S.push(o, l), p = "L";
5217
+ o = g.shift(), l = g.shift(), T = "M", C.push(o, l), p = "L";
5218
5218
  break;
5219
5219
  case "h":
5220
- o += g.shift(), T = "L", S.push(o, l);
5220
+ o += g.shift(), T = "L", C.push(o, l);
5221
5221
  break;
5222
5222
  case "H":
5223
- o = g.shift(), T = "L", S.push(o, l);
5223
+ o = g.shift(), T = "L", C.push(o, l);
5224
5224
  break;
5225
5225
  case "v":
5226
- l += g.shift(), T = "L", S.push(o, l);
5226
+ l += g.shift(), T = "L", C.push(o, l);
5227
5227
  break;
5228
5228
  case "V":
5229
- l = g.shift(), T = "L", S.push(o, l);
5229
+ l = g.shift(), T = "L", C.push(o, l);
5230
5230
  break;
5231
5231
  case "C":
5232
- S.push(g.shift(), g.shift(), g.shift(), g.shift()), o = g.shift(), l = g.shift(), S.push(o, l);
5232
+ C.push(g.shift(), g.shift(), g.shift(), g.shift()), o = g.shift(), l = g.shift(), C.push(o, l);
5233
5233
  break;
5234
5234
  case "c":
5235
- S.push(o + g.shift(), l + g.shift(), o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "C", S.push(o, l);
5235
+ C.push(o + g.shift(), l + g.shift(), o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "C", C.push(o, l);
5236
5236
  break;
5237
5237
  case "S":
5238
- M = o, _ = l, k = n[n.length - 1], k.command === "C" && (M = o + (o - k.points[2]), _ = l + (l - k.points[3])), S.push(M, _, g.shift(), g.shift()), o = g.shift(), l = g.shift(), T = "C", S.push(o, l);
5238
+ M = o, _ = l, k = n[n.length - 1], k.command === "C" && (M = o + (o - k.points[2]), _ = l + (l - k.points[3])), C.push(M, _, g.shift(), g.shift()), o = g.shift(), l = g.shift(), T = "C", C.push(o, l);
5239
5239
  break;
5240
5240
  case "s":
5241
- M = o, _ = l, k = n[n.length - 1], k.command === "C" && (M = o + (o - k.points[2]), _ = l + (l - k.points[3])), S.push(M, _, o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "C", S.push(o, l);
5241
+ M = o, _ = l, k = n[n.length - 1], k.command === "C" && (M = o + (o - k.points[2]), _ = l + (l - k.points[3])), C.push(M, _, o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "C", C.push(o, l);
5242
5242
  break;
5243
5243
  case "Q":
5244
- S.push(g.shift(), g.shift()), o = g.shift(), l = g.shift(), S.push(o, l);
5244
+ C.push(g.shift(), g.shift()), o = g.shift(), l = g.shift(), C.push(o, l);
5245
5245
  break;
5246
5246
  case "q":
5247
- S.push(o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "Q", S.push(o, l);
5247
+ C.push(o + g.shift(), l + g.shift()), o += g.shift(), l += g.shift(), T = "Q", C.push(o, l);
5248
5248
  break;
5249
5249
  case "T":
5250
- M = o, _ = l, k = n[n.length - 1], k.command === "Q" && (M = o + (o - k.points[0]), _ = l + (l - k.points[1])), o = g.shift(), l = g.shift(), T = "Q", S.push(M, _, o, l);
5250
+ M = o, _ = l, k = n[n.length - 1], k.command === "Q" && (M = o + (o - k.points[0]), _ = l + (l - k.points[1])), o = g.shift(), l = g.shift(), T = "Q", C.push(M, _, o, l);
5251
5251
  break;
5252
5252
  case "t":
5253
- M = o, _ = l, k = n[n.length - 1], k.command === "Q" && (M = o + (o - k.points[0]), _ = l + (l - k.points[1])), o += g.shift(), l += g.shift(), T = "Q", S.push(M, _, o, l);
5253
+ M = o, _ = l, k = n[n.length - 1], k.command === "Q" && (M = o + (o - k.points[0]), _ = l + (l - k.points[1])), o += g.shift(), l += g.shift(), T = "Q", C.push(M, _, o, l);
5254
5254
  break;
5255
5255
  case "A":
5256
- R = g.shift(), A = g.shift(), I = g.shift(), D = g.shift(), N = g.shift(), G = o, W = l, o = g.shift(), l = g.shift(), T = "A", S = this.convertEndpointToCenterParameterization(G, W, o, l, D, N, R, A, I);
5256
+ R = g.shift(), A = g.shift(), I = g.shift(), D = g.shift(), N = g.shift(), G = o, W = l, o = g.shift(), l = g.shift(), T = "A", C = this.convertEndpointToCenterParameterization(G, W, o, l, D, N, R, A, I);
5257
5257
  break;
5258
5258
  case "a":
5259
- R = g.shift(), A = g.shift(), I = g.shift(), D = g.shift(), N = g.shift(), G = o, W = l, o += g.shift(), l += g.shift(), T = "A", S = this.convertEndpointToCenterParameterization(G, W, o, l, D, N, R, A, I);
5259
+ R = g.shift(), A = g.shift(), I = g.shift(), D = g.shift(), N = g.shift(), G = o, W = l, o += g.shift(), l += g.shift(), T = "A", C = this.convertEndpointToCenterParameterization(G, W, o, l, D, N, R, A, I);
5260
5260
  break;
5261
5261
  }
5262
5262
  n.push({
5263
5263
  command: T || p,
5264
- points: S,
5264
+ points: C,
5265
5265
  start: {
5266
5266
  x: v,
5267
5267
  y: b
5268
5268
  },
5269
- pathLength: this.calcLength(v, b, T || p, S)
5269
+ pathLength: this.calcLength(v, b, T || p, C)
5270
5270
  });
5271
5271
  }
5272
5272
  (p === "z" || p === "Z") && n.push({
@@ -5307,7 +5307,7 @@ class tt extends w {
5307
5307
  p > 1 && (o *= Math.sqrt(p), l *= Math.sqrt(p));
5308
5308
  let g = Math.sqrt((o * o * (l * l) - o * o * (u * u) - l * l * (d * d)) / (o * o * (u * u) + l * l * (d * d)));
5309
5309
  n === r && (g *= -1), isNaN(g) && (g = 0);
5310
- const y = g * o * u / l, T = g * -l * d / o, S = (t + i) / 2 + Math.cos(c) * y - Math.sin(c) * T, v = (e + s) / 2 + Math.sin(c) * y + Math.cos(c) * T, b = function(D) {
5310
+ const y = g * o * u / l, T = g * -l * d / o, C = (t + i) / 2 + Math.cos(c) * y - Math.sin(c) * T, v = (e + s) / 2 + Math.sin(c) * y + Math.cos(c) * T, b = function(D) {
5311
5311
  return Math.sqrt(D[0] * D[0] + D[1] * D[1]);
5312
5312
  }, k = function(D, N) {
5313
5313
  return (D[0] * N[0] + D[1] * N[1]) / (b(D) * b(N));
@@ -5315,7 +5315,7 @@ class tt extends w {
5315
5315
  return (D[0] * N[1] < D[1] * N[0] ? -1 : 1) * Math.acos(k(D, N));
5316
5316
  }, _ = M([1, 0], [(d - y) / o, (u - T) / l]), R = [(d - y) / o, (u - T) / l], A = [(-1 * d - y) / o, (-1 * u - T) / l];
5317
5317
  let I = M(R, A);
5318
- return k(R, A) <= -1 && (I = Math.PI), k(R, A) >= 1 && (I = 0), r === 0 && I > 0 && (I = I - 2 * Math.PI), r === 1 && I < 0 && (I = I + 2 * Math.PI), [S, v, o, l, _, I, c, r];
5318
+ return k(R, A) <= -1 && (I = Math.PI), k(R, A) >= 1 && (I = 0), r === 0 && I > 0 && (I = I - 2 * Math.PI), r === 1 && I < 0 && (I = I + 2 * Math.PI), [C, v, o, l, _, I, c, r];
5319
5319
  }
5320
5320
  }
5321
5321
  tt.prototype.className = "Path";
@@ -5413,7 +5413,7 @@ st(Ot);
5413
5413
  m.addComponentsGetterSetter(Ot, "radius", ["x", "y"]);
5414
5414
  m.addGetterSetter(Ot, "radiusX", 0, x());
5415
5415
  m.addGetterSetter(Ot, "radiusY", 0, x());
5416
- let mt = class en extends w {
5416
+ let mt = class nn extends w {
5417
5417
  constructor(t) {
5418
5418
  super(t), this._loadListener = () => {
5419
5419
  this._requestDraw();
@@ -5452,11 +5452,11 @@ let mt = class en extends w {
5452
5452
  i
5453
5453
  ] : r = [n, 0, 0, e, i];
5454
5454
  }
5455
- (this.hasFill() || this.hasStroke() || s) && (t.beginPath(), s ? C.drawRoundedRectPath(t, e, i, s) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this)), n && (s && t.clip(), t.drawImage.apply(t, r));
5455
+ (this.hasFill() || this.hasStroke() || s) && (t.beginPath(), s ? S.drawRoundedRectPath(t, e, i, s) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this)), n && (s && t.clip(), t.drawImage.apply(t, r));
5456
5456
  }
5457
5457
  _hitFunc(t) {
5458
5458
  const e = this.width(), i = this.height(), s = this.cornerRadius();
5459
- t.beginPath(), s ? C.drawRoundedRectPath(t, e, i, s) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this);
5459
+ t.beginPath(), s ? S.drawRoundedRectPath(t, e, i, s) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this);
5460
5460
  }
5461
5461
  getWidth() {
5462
5462
  var t, e, i;
@@ -5467,9 +5467,9 @@ let mt = class en extends w {
5467
5467
  return (i = (t = this.attrs.height) !== null && t !== void 0 ? t : (e = this.image()) === null || e === void 0 ? void 0 : e.height) !== null && i !== void 0 ? i : 0;
5468
5468
  }
5469
5469
  static fromURL(t, e, i = null) {
5470
- const s = C.createImageElement();
5470
+ const s = S.createImageElement();
5471
5471
  s.onload = function() {
5472
- const n = new en({
5472
+ const n = new nn({
5473
5473
  image: s
5474
5474
  });
5475
5475
  e(n);
@@ -5486,7 +5486,7 @@ m.addGetterSetter(mt, "cropX", 0, x());
5486
5486
  m.addGetterSetter(mt, "cropY", 0, x());
5487
5487
  m.addGetterSetter(mt, "cropWidth", 0, x());
5488
5488
  m.addGetterSetter(mt, "cropHeight", 0, x());
5489
- const sn = [
5489
+ const rn = [
5490
5490
  "fontFamily",
5491
5491
  "fontSize",
5492
5492
  "fontStyle",
@@ -5498,7 +5498,7 @@ const sn = [
5498
5498
  "pointerDirection",
5499
5499
  "pointerWidth",
5500
5500
  "pointerHeight"
5501
- ], Kr = "Change.konva", jr = "none", Ci = "up", Si = "right", Ti = "down", vi = "left", Zr = sn.length;
5501
+ ], jr = "Change.konva", Zr = "none", Si = "up", Ci = "right", Ti = "down", vi = "left", qr = rn.length;
5502
5502
  class Li extends Qt {
5503
5503
  constructor(t) {
5504
5504
  super(t), this.on("add.konva", function(e) {
@@ -5516,8 +5516,8 @@ class Li extends Qt {
5516
5516
  const s = function() {
5517
5517
  e._sync();
5518
5518
  };
5519
- for (i = 0; i < Zr; i++)
5520
- t.on(sn[i] + Kr, s);
5519
+ for (i = 0; i < qr; i++)
5520
+ t.on(rn[i] + jr, s);
5521
5521
  }
5522
5522
  getWidth() {
5523
5523
  return this.getText().width();
@@ -5529,10 +5529,10 @@ class Li extends Qt {
5529
5529
  let t = this.getText(), e = this.getTag(), i, s, n, r, o, l, h;
5530
5530
  if (t && e) {
5531
5531
  switch (i = t.width(), s = t.height(), n = e.pointerDirection(), r = e.pointerWidth(), h = e.pointerHeight(), o = 0, l = 0, n) {
5532
- case Ci:
5532
+ case Si:
5533
5533
  o = i / 2, l = -1 * h;
5534
5534
  break;
5535
- case Si:
5535
+ case Ci:
5536
5536
  o = i + r, l = s / 2;
5537
5537
  break;
5538
5538
  case Ti:
@@ -5560,11 +5560,11 @@ class Ut extends w {
5560
5560
  _sceneFunc(t) {
5561
5561
  const e = this.width(), i = this.height(), s = this.pointerDirection(), n = this.pointerWidth(), r = this.pointerHeight(), o = this.cornerRadius();
5562
5562
  let l = 0, h = 0, c = 0, d = 0;
5563
- typeof o == "number" ? l = h = c = d = Math.min(o, e / 2, i / 2) : (l = Math.min(o[0] || 0, e / 2, i / 2), h = Math.min(o[1] || 0, e / 2, i / 2), d = Math.min(o[2] || 0, e / 2, i / 2), c = Math.min(o[3] || 0, e / 2, i / 2)), t.beginPath(), t.moveTo(l, 0), s === Ci && (t.lineTo((e - n) / 2, 0), t.lineTo(e / 2, -1 * r), t.lineTo((e + n) / 2, 0)), t.lineTo(e - h, 0), t.arc(e - h, h, h, Math.PI * 3 / 2, 0, !1), s === Si && (t.lineTo(e, (i - r) / 2), t.lineTo(e + n, i / 2), t.lineTo(e, (i + r) / 2)), t.lineTo(e, i - d), t.arc(e - d, i - d, d, 0, Math.PI / 2, !1), s === Ti && (t.lineTo((e + n) / 2, i), t.lineTo(e / 2, i + r), t.lineTo((e - n) / 2, i)), t.lineTo(c, i), t.arc(c, i - c, c, Math.PI / 2, Math.PI, !1), s === vi && (t.lineTo(0, (i + r) / 2), t.lineTo(-1 * n, i / 2), t.lineTo(0, (i - r) / 2)), t.lineTo(0, l), t.arc(l, l, l, Math.PI, Math.PI * 3 / 2, !1), t.closePath(), t.fillStrokeShape(this);
5563
+ typeof o == "number" ? l = h = c = d = Math.min(o, e / 2, i / 2) : (l = Math.min(o[0] || 0, e / 2, i / 2), h = Math.min(o[1] || 0, e / 2, i / 2), d = Math.min(o[2] || 0, e / 2, i / 2), c = Math.min(o[3] || 0, e / 2, i / 2)), t.beginPath(), t.moveTo(l, 0), s === Si && (t.lineTo((e - n) / 2, 0), t.lineTo(e / 2, -1 * r), t.lineTo((e + n) / 2, 0)), t.lineTo(e - h, 0), t.arc(e - h, h, h, Math.PI * 3 / 2, 0, !1), s === Ci && (t.lineTo(e, (i - r) / 2), t.lineTo(e + n, i / 2), t.lineTo(e, (i + r) / 2)), t.lineTo(e, i - d), t.arc(e - d, i - d, d, 0, Math.PI / 2, !1), s === Ti && (t.lineTo((e + n) / 2, i), t.lineTo(e / 2, i + r), t.lineTo((e - n) / 2, i)), t.lineTo(c, i), t.arc(c, i - c, c, Math.PI / 2, Math.PI, !1), s === vi && (t.lineTo(0, (i + r) / 2), t.lineTo(-1 * n, i / 2), t.lineTo(0, (i - r) / 2)), t.lineTo(0, l), t.arc(l, l, l, Math.PI, Math.PI * 3 / 2, !1), t.closePath(), t.fillStrokeShape(this);
5564
5564
  }
5565
5565
  getSelfRect() {
5566
5566
  let t = 0, e = 0, i = this.pointerWidth(), s = this.pointerHeight(), n = this.pointerDirection(), r = this.width(), o = this.height();
5567
- return n === Ci ? (e -= s, o += s) : n === Ti ? o += s : n === vi ? (t -= i * 1.5, r += i) : n === Si && (r += i * 1.5), {
5567
+ return n === Si ? (e -= s, o += s) : n === Ti ? o += s : n === vi ? (t -= i * 1.5, r += i) : n === Ci && (r += i * 1.5), {
5568
5568
  x: t,
5569
5569
  y: e,
5570
5570
  width: r,
@@ -5574,14 +5574,14 @@ class Ut extends w {
5574
5574
  }
5575
5575
  Ut.prototype.className = "Tag";
5576
5576
  st(Ut);
5577
- m.addGetterSetter(Ut, "pointerDirection", jr);
5577
+ m.addGetterSetter(Ut, "pointerDirection", Zr);
5578
5578
  m.addGetterSetter(Ut, "pointerWidth", 0, x());
5579
5579
  m.addGetterSetter(Ut, "pointerHeight", 0, x());
5580
5580
  m.addGetterSetter(Ut, "cornerRadius", 0, je(4));
5581
5581
  class ke extends w {
5582
5582
  _sceneFunc(t) {
5583
5583
  const e = this.cornerRadius(), i = this.width(), s = this.height();
5584
- t.beginPath(), e ? C.drawRoundedRectPath(t, i, s, e) : t.rect(0, 0, i, s), t.closePath(), t.fillStrokeShape(this);
5584
+ t.beginPath(), e ? S.drawRoundedRectPath(t, i, s, e) : t.rect(0, 0, i, s), t.closePath(), t.fillStrokeShape(this);
5585
5585
  }
5586
5586
  }
5587
5587
  ke.prototype.className = "Rect";
@@ -5591,7 +5591,7 @@ class Gt extends w {
5591
5591
  _sceneFunc(t) {
5592
5592
  const e = this._getPoints(), i = this.radius(), s = this.sides(), n = this.cornerRadius();
5593
5593
  if (t.beginPath(), n)
5594
- C.drawRoundedPolygonPath(t, e, s, i, n);
5594
+ S.drawRoundedPolygonPath(t, e, s, i, n);
5595
5595
  else {
5596
5596
  t.moveTo(e[0].x, e[0].y);
5597
5597
  for (let r = 1; r < e.length; r++)
@@ -5773,7 +5773,7 @@ function Mt(a) {
5773
5773
  return t;
5774
5774
  }, []);
5775
5775
  }
5776
- const jt = "auto", qr = "center", nn = "inherit", re = "justify", Jr = "Change.konva", Qr = "2d", is = "-", rn = "left", ta = "text", ea = "Text", ia = "top", sa = "bottom", ss = "middle", an = "normal", na = "px ", De = " ", ra = "right", ns = "rtl", aa = "word", oa = "char", rs = "none", ii = "…", on = [
5776
+ const jt = "auto", Jr = "center", an = "inherit", re = "justify", Qr = "Change.konva", ta = "2d", is = "-", on = "left", ea = "text", ia = "Text", sa = "top", na = "bottom", ss = "middle", ln = "normal", ra = "px ", De = " ", aa = "right", ns = "rtl", oa = "word", la = "char", rs = "none", ii = "…", hn = [
5777
5777
  "direction",
5778
5778
  "fontFamily",
5779
5779
  "fontSize",
@@ -5789,8 +5789,8 @@ const jt = "auto", qr = "center", nn = "inherit", re = "justify", Jr = "Change.k
5789
5789
  "wrap",
5790
5790
  "ellipsis",
5791
5791
  "letterSpacing"
5792
- ], la = on.length;
5793
- function ha(a) {
5792
+ ], ha = hn.length;
5793
+ function ca(a) {
5794
5794
  return a.split(",").map((t) => {
5795
5795
  t = t.trim();
5796
5796
  const e = t.indexOf(" ") >= 0, i = t.indexOf('"') >= 0 || t.indexOf("'") >= 0;
@@ -5799,22 +5799,22 @@ function ha(a) {
5799
5799
  }
5800
5800
  let Re;
5801
5801
  function si() {
5802
- return Re || (Re = C.createCanvasElement().getContext(Qr), Re);
5802
+ return Re || (Re = S.createCanvasElement().getContext(ta), Re);
5803
5803
  }
5804
- function ca(a) {
5804
+ function da(a) {
5805
5805
  a.fillText(this._partialText, this._partialTextX, this._partialTextY);
5806
5806
  }
5807
- function da(a) {
5807
+ function ua(a) {
5808
5808
  a.setAttr("miterLimit", 2), a.strokeText(this._partialText, this._partialTextX, this._partialTextY);
5809
5809
  }
5810
- function ua(a) {
5810
+ function fa(a) {
5811
5811
  return a = a || {}, !a.fillLinearGradientColorStops && !a.fillRadialGradientColorStops && !a.fillPatternImage && (a.fill = a.fill || "black"), a;
5812
5812
  }
5813
5813
  class et extends w {
5814
5814
  constructor(t) {
5815
- super(ua(t)), this._partialTextX = 0, this._partialTextY = 0;
5816
- for (let e = 0; e < la; e++)
5817
- this.on(on[e] + Jr, this._setTextData);
5815
+ super(fa(t)), this._partialTextX = 0, this._partialTextY = 0;
5816
+ for (let e = 0; e < ha; e++)
5817
+ this.on(hn[e] + Qr, this._setTextData);
5818
5818
  this._setTextData();
5819
5819
  }
5820
5820
  _sceneFunc(t) {
@@ -5822,8 +5822,8 @@ class et extends w {
5822
5822
  const s = this.textArr, n = s.length;
5823
5823
  if (!this.text())
5824
5824
  return;
5825
- let r = this.padding(), o = this.fontSize(), l = this.lineHeight() * o, h = this.verticalAlign(), c = this.direction(), d = 0, u = this.align(), p = this.getWidth(), g = this.letterSpacing(), y = this.charRenderFunc(), T = this.fill(), S = this.textDecoration(), v = this.underlineOffset(), b = S.indexOf("underline") !== -1, k = S.indexOf("line-through") !== -1, M;
5826
- c = c === nn ? t.direction : c;
5825
+ let r = this.padding(), o = this.fontSize(), l = this.lineHeight() * o, h = this.verticalAlign(), c = this.direction(), d = 0, u = this.align(), p = this.getWidth(), g = this.letterSpacing(), y = this.charRenderFunc(), T = this.fill(), C = this.textDecoration(), v = this.underlineOffset(), b = C.indexOf("underline") !== -1, k = C.indexOf("line-through") !== -1, M;
5826
+ c = c === an ? t.direction : c;
5827
5827
  let _ = l / 2, R = ss;
5828
5828
  if (!E.legacyTextRendering) {
5829
5829
  const A = this.measureSize("M");
@@ -5831,10 +5831,10 @@ class et extends w {
5831
5831
  const I = (e = A.fontBoundingBoxAscent) !== null && e !== void 0 ? e : A.actualBoundingBoxAscent, D = (i = A.fontBoundingBoxDescent) !== null && i !== void 0 ? i : A.actualBoundingBoxDescent;
5832
5832
  _ = (I - D) / 2 + l / 2;
5833
5833
  }
5834
- for (c === ns && t.setAttr("direction", c), t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", R), t.setAttr("textAlign", rn), h === ss ? d = (this.getHeight() - n * l - r * 2) / 2 : h === sa && (d = this.getHeight() - n * l - r * 2), t.translate(r, d + r), M = 0; M < n; M++) {
5834
+ for (c === ns && t.setAttr("direction", c), t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", R), t.setAttr("textAlign", on), h === ss ? d = (this.getHeight() - n * l - r * 2) / 2 : h === na && (d = this.getHeight() - n * l - r * 2), t.translate(r, d + r), M = 0; M < n; M++) {
5835
5835
  let A = 0, I = 0;
5836
5836
  const D = s[M], N = D.text, G = D.width, W = D.lastInParagraph;
5837
- if (t.save(), u === ra ? A += p - G - r * 2 : u === qr && (A += (p - G - r * 2) / 2), b) {
5837
+ if (t.save(), u === aa ? A += p - G - r * 2 : u === Jr && (A += (p - G - r * 2) / 2), b) {
5838
5838
  t.save(), t.beginPath();
5839
5839
  const H = v ?? (E.legacyTextRendering ? Math.round(o / 2) : Math.round(o / 4)), L = A, j = _ + I + H;
5840
5840
  t.moveTo(L, j);
@@ -5884,8 +5884,8 @@ class et extends w {
5884
5884
  t.beginPath(), t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this);
5885
5885
  }
5886
5886
  setText(t) {
5887
- const e = C._isString(t) ? t : t == null ? "" : t + "";
5888
- return this._setAttr(ta, e), this;
5887
+ const e = S._isString(t) ? t : t == null ? "" : t + "";
5888
+ return this._setAttr(ea, e), this;
5889
5889
  }
5890
5890
  getWidth() {
5891
5891
  return this.attrs.width === jt || this.attrs.width === void 0 ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
@@ -5897,7 +5897,7 @@ class et extends w {
5897
5897
  return this.textWidth;
5898
5898
  }
5899
5899
  getTextHeight() {
5900
- return C.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
5900
+ return S.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
5901
5901
  }
5902
5902
  measureSize(t) {
5903
5903
  var e, i, s, n, r, o, l, h, c, d, u;
@@ -5921,7 +5921,7 @@ class et extends w {
5921
5921
  };
5922
5922
  }
5923
5923
  _getContextFont() {
5924
- return this.fontStyle() + De + this.fontVariant() + De + (this.fontSize() + na) + ha(this.fontFamily());
5924
+ return this.fontStyle() + De + this.fontVariant() + De + (this.fontSize() + ra) + ca(this.fontFamily());
5925
5925
  }
5926
5926
  _addTextLine(t) {
5927
5927
  this.align() === re && (t = t.trim());
@@ -5938,9 +5938,9 @@ class et extends w {
5938
5938
  }
5939
5939
  _setTextData() {
5940
5940
  let t = this.text().split(`
5941
- `), e = +this.fontSize(), i = 0, s = this.lineHeight() * e, n = this.attrs.width, r = this.attrs.height, o = n !== jt && n !== void 0, l = r !== jt && r !== void 0, h = this.padding(), c = n - h * 2, d = r - h * 2, u = 0, p = this.wrap(), g = p !== rs, y = p !== oa && g, T = this.ellipsis();
5941
+ `), e = +this.fontSize(), i = 0, s = this.lineHeight() * e, n = this.attrs.width, r = this.attrs.height, o = n !== jt && n !== void 0, l = r !== jt && r !== void 0, h = this.padding(), c = n - h * 2, d = r - h * 2, u = 0, p = this.wrap(), g = p !== rs, y = p !== la && g, T = this.ellipsis();
5942
5942
  this.textArr = [], si().font = this._getContextFont();
5943
- const S = T ? this._getTextWidth(ii) : 0;
5943
+ const C = T ? this._getTextWidth(ii) : 0;
5944
5944
  for (let v = 0, b = t.length; v < b; ++v) {
5945
5945
  let k = t[v], M = this._getTextWidth(k);
5946
5946
  if (o && M > c)
@@ -5948,7 +5948,7 @@ class et extends w {
5948
5948
  let _ = 0, R = Mt(k).length, A = "", I = 0;
5949
5949
  for (; _ < R; ) {
5950
5950
  const D = _ + R >>> 1, N = Mt(k), G = N.slice(0, D + 1).join(""), W = this._getTextWidth(G);
5951
- (T && l && u + s > d ? W + S : W) <= c ? (_ = D + 1, A = G, I = W) : R = D;
5951
+ (T && l && u + s > d ? W + C : W) <= c ? (_ = D + 1, A = G, I = W) : R = D;
5952
5952
  }
5953
5953
  if (A) {
5954
5954
  if (y) {
@@ -5996,9 +5996,9 @@ class et extends w {
5996
5996
  return t && e ? !0 : super._useBufferCanvas();
5997
5997
  }
5998
5998
  }
5999
- et.prototype._fillFunc = ca;
6000
- et.prototype._strokeFunc = da;
6001
- et.prototype.className = ea;
5999
+ et.prototype._fillFunc = da;
6000
+ et.prototype._strokeFunc = ua;
6001
+ et.prototype.className = ia;
6002
6002
  et.prototype._attrsAffectingSize = [
6003
6003
  "text",
6004
6004
  "fontSize",
@@ -6010,32 +6010,32 @@ et.prototype._attrsAffectingSize = [
6010
6010
  st(et);
6011
6011
  m.overWriteSetter(et, "width", Ei());
6012
6012
  m.overWriteSetter(et, "height", Ei());
6013
- m.addGetterSetter(et, "direction", nn);
6013
+ m.addGetterSetter(et, "direction", an);
6014
6014
  m.addGetterSetter(et, "fontFamily", "Arial");
6015
6015
  m.addGetterSetter(et, "fontSize", 12, x());
6016
- m.addGetterSetter(et, "fontStyle", an);
6017
- m.addGetterSetter(et, "fontVariant", an);
6016
+ m.addGetterSetter(et, "fontStyle", ln);
6017
+ m.addGetterSetter(et, "fontVariant", ln);
6018
6018
  m.addGetterSetter(et, "padding", 0, x());
6019
- m.addGetterSetter(et, "align", rn);
6020
- m.addGetterSetter(et, "verticalAlign", ia);
6019
+ m.addGetterSetter(et, "align", on);
6020
+ m.addGetterSetter(et, "verticalAlign", sa);
6021
6021
  m.addGetterSetter(et, "lineHeight", 1, x());
6022
- m.addGetterSetter(et, "wrap", aa);
6022
+ m.addGetterSetter(et, "wrap", oa);
6023
6023
  m.addGetterSetter(et, "ellipsis", !1, pt());
6024
6024
  m.addGetterSetter(et, "letterSpacing", 0, x());
6025
6025
  m.addGetterSetter(et, "text", "", Wt());
6026
6026
  m.addGetterSetter(et, "textDecoration", "");
6027
6027
  m.addGetterSetter(et, "underlineOffset", void 0, x());
6028
6028
  m.addGetterSetter(et, "charRenderFunc", void 0);
6029
- const fa = "", ln = "normal";
6030
- function hn(a) {
6029
+ const ga = "", cn = "normal";
6030
+ function dn(a) {
6031
6031
  a.fillText(this.partialText, 0, 0);
6032
6032
  }
6033
- function cn(a) {
6033
+ function un(a) {
6034
6034
  a.strokeText(this.partialText, 0, 0);
6035
6035
  }
6036
6036
  class rt extends w {
6037
6037
  constructor(t) {
6038
- super(t), this.dummyCanvas = C.createCanvasElement(), this.dataArray = [], this._readDataAttribute(), this.on("dataChange.konva", function() {
6038
+ super(t), this.dummyCanvas = S.createCanvasElement(), this.dataArray = [], this._readDataAttribute(), this.on("dataChange.konva", function() {
6039
6039
  this._readDataAttribute(), this._setTextData();
6040
6040
  }), this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva", this._setTextData), this._setTextData();
6041
6041
  }
@@ -6088,7 +6088,7 @@ class rt extends w {
6088
6088
  return this.textWidth;
6089
6089
  }
6090
6090
  getTextHeight() {
6091
- return C.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
6091
+ return S.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
6092
6092
  }
6093
6093
  setText(t) {
6094
6094
  return et.prototype.setText.call(this, t);
@@ -6134,15 +6134,15 @@ class rt extends w {
6134
6134
  if (!y)
6135
6135
  return;
6136
6136
  const T = tt.getLineLength(u.x, u.y, y.x, y.y);
6137
- let S = 0;
6137
+ let C = 0;
6138
6138
  if (o)
6139
6139
  try {
6140
- S = o(e[d - 1].char, p) * this.fontSize();
6140
+ C = o(e[d - 1].char, p) * this.fontSize();
6141
6141
  } catch {
6142
- S = 0;
6142
+ C = 0;
6143
6143
  }
6144
- u.x += S, y.x += S, this.textWidth += S;
6145
- const v = tt.getPointOnLine(S + T / 2, u.x, u.y, y.x, y.y), b = Math.atan2(y.y - u.y, y.x - u.x);
6144
+ u.x += C, y.x += C, this.textWidth += C;
6145
+ const v = tt.getPointOnLine(C + T / 2, u.x, u.y, y.x, y.y), b = Math.atan2(y.y - u.y, y.x - u.x);
6146
6146
  this.glyphInfo.push({
6147
6147
  transposeX: v.x,
6148
6148
  transposeY: v.y,
@@ -6178,28 +6178,28 @@ class rt extends w {
6178
6178
  };
6179
6179
  }
6180
6180
  destroy() {
6181
- return C.releaseCanvas(this.dummyCanvas), super.destroy();
6181
+ return S.releaseCanvas(this.dummyCanvas), super.destroy();
6182
6182
  }
6183
6183
  }
6184
- rt.prototype._fillFunc = hn;
6185
- rt.prototype._strokeFunc = cn;
6186
- rt.prototype._fillFuncHit = hn;
6187
- rt.prototype._strokeFuncHit = cn;
6184
+ rt.prototype._fillFunc = dn;
6185
+ rt.prototype._strokeFunc = un;
6186
+ rt.prototype._fillFuncHit = dn;
6187
+ rt.prototype._strokeFuncHit = un;
6188
6188
  rt.prototype.className = "TextPath";
6189
6189
  rt.prototype._attrsAffectingSize = ["text", "fontSize", "data"];
6190
6190
  st(rt);
6191
6191
  m.addGetterSetter(rt, "data");
6192
6192
  m.addGetterSetter(rt, "fontFamily", "Arial");
6193
6193
  m.addGetterSetter(rt, "fontSize", 12, x());
6194
- m.addGetterSetter(rt, "fontStyle", ln);
6194
+ m.addGetterSetter(rt, "fontStyle", cn);
6195
6195
  m.addGetterSetter(rt, "align", "left");
6196
6196
  m.addGetterSetter(rt, "letterSpacing", 0, x());
6197
6197
  m.addGetterSetter(rt, "textBaseline", "middle");
6198
- m.addGetterSetter(rt, "fontVariant", ln);
6199
- m.addGetterSetter(rt, "text", fa);
6198
+ m.addGetterSetter(rt, "fontVariant", cn);
6199
+ m.addGetterSetter(rt, "text", ga);
6200
6200
  m.addGetterSetter(rt, "textDecoration", "");
6201
6201
  m.addGetterSetter(rt, "kerningFunc", void 0);
6202
- const dn = "tr-konva", ga = [
6202
+ const fn = "tr-konva", pa = [
6203
6203
  "resizeEnabledChange",
6204
6204
  "rotateAnchorOffsetChange",
6205
6205
  "rotateAnchorAngleChange",
@@ -6216,7 +6216,7 @@ const dn = "tr-konva", ga = [
6216
6216
  "anchorCornerRadiusChange",
6217
6217
  "ignoreStrokeChange",
6218
6218
  "anchorStyleFuncChange"
6219
- ].map((a) => a + `.${dn}`).join(" "), as = "nodesRect", pa = [
6219
+ ].map((a) => a + `.${fn}`).join(" "), as = "nodesRect", ma = [
6220
6220
  "widthChange",
6221
6221
  "heightChange",
6222
6222
  "scaleXChange",
@@ -6229,7 +6229,7 @@ const dn = "tr-konva", ga = [
6229
6229
  "transformsEnabledChange",
6230
6230
  "strokeWidthChange",
6231
6231
  "draggableChange"
6232
- ], ma = {
6232
+ ], ya = {
6233
6233
  "top-left": -45,
6234
6234
  "top-center": 0,
6235
6235
  "top-right": 45,
@@ -6238,13 +6238,13 @@ const dn = "tr-konva", ga = [
6238
6238
  "bottom-left": -135,
6239
6239
  "bottom-center": 180,
6240
6240
  "bottom-right": 135
6241
- }, ya = "ontouchstart" in E._global;
6241
+ }, Sa = "ontouchstart" in E._global;
6242
6242
  function Ca(a, t, e) {
6243
6243
  if (a === "rotater")
6244
6244
  return e;
6245
- t += C.degToRad(ma[a] || 0);
6246
- const i = (C.radToDeg(t) % 360 + 360) % 360;
6247
- return C._inRange(i, 315 + 22.5, 360) || C._inRange(i, 0, 22.5) ? "ns-resize" : C._inRange(i, 45 - 22.5, 45 + 22.5) ? "nesw-resize" : C._inRange(i, 90 - 22.5, 90 + 22.5) ? "ew-resize" : C._inRange(i, 135 - 22.5, 135 + 22.5) ? "nwse-resize" : C._inRange(i, 180 - 22.5, 180 + 22.5) ? "ns-resize" : C._inRange(i, 225 - 22.5, 225 + 22.5) ? "nesw-resize" : C._inRange(i, 270 - 22.5, 270 + 22.5) ? "ew-resize" : C._inRange(i, 315 - 22.5, 315 + 22.5) ? "nwse-resize" : (C.error("Transformer has unknown angle for cursor detection: " + i), "pointer");
6245
+ t += S.degToRad(ya[a] || 0);
6246
+ const i = (S.radToDeg(t) % 360 + 360) % 360;
6247
+ return S._inRange(i, 315 + 22.5, 360) || S._inRange(i, 0, 22.5) ? "ns-resize" : S._inRange(i, 45 - 22.5, 45 + 22.5) ? "nesw-resize" : S._inRange(i, 90 - 22.5, 90 + 22.5) ? "ew-resize" : S._inRange(i, 135 - 22.5, 135 + 22.5) ? "nwse-resize" : S._inRange(i, 180 - 22.5, 180 + 22.5) ? "ns-resize" : S._inRange(i, 225 - 22.5, 225 + 22.5) ? "nesw-resize" : S._inRange(i, 270 - 22.5, 270 + 22.5) ? "ew-resize" : S._inRange(i, 315 - 22.5, 315 + 22.5) ? "nwse-resize" : (S.error("Transformer has unknown angle for cursor detection: " + i), "pointer");
6248
6248
  }
6249
6249
  const Ue = [
6250
6250
  "top-left",
@@ -6256,13 +6256,13 @@ const Ue = [
6256
6256
  "bottom-center",
6257
6257
  "bottom-right"
6258
6258
  ];
6259
- function Sa(a) {
6259
+ function Ta(a) {
6260
6260
  return {
6261
6261
  x: a.x + a.width / 2 * Math.cos(a.rotation) + a.height / 2 * Math.sin(-a.rotation),
6262
6262
  y: a.y + a.height / 2 * Math.cos(a.rotation) + a.width / 2 * Math.sin(a.rotation)
6263
6263
  };
6264
6264
  }
6265
- function un(a, t, e) {
6265
+ function gn(a, t, e) {
6266
6266
  const i = e.x + (a.x - e.x) * Math.cos(t) - (a.y - e.y) * Math.sin(t), s = e.y + (a.x - e.x) * Math.sin(t) + (a.y - e.y) * Math.cos(t);
6267
6267
  return {
6268
6268
  ...a,
@@ -6271,11 +6271,11 @@ function un(a, t, e) {
6271
6271
  y: s
6272
6272
  };
6273
6273
  }
6274
- function Ta(a, t) {
6275
- const e = Sa(a);
6276
- return un(a, t, e);
6274
+ function va(a, t) {
6275
+ const e = Ta(a);
6276
+ return gn(a, t, e);
6277
6277
  }
6278
- function va(a, t, e) {
6278
+ function ba(a, t, e) {
6279
6279
  let i = t;
6280
6280
  for (let s = 0; s < a.length; s++) {
6281
6281
  const n = E.getAngle(a[s]), r = Math.abs(n - t) % (Math.PI * 2);
@@ -6286,23 +6286,23 @@ function va(a, t, e) {
6286
6286
  let bi = 0;
6287
6287
  class Y extends Qt {
6288
6288
  constructor(t) {
6289
- super(t), this._movingAnchorName = null, this._transforming = !1, this._createElements(), this._handleMouseMove = this._handleMouseMove.bind(this), this._handleMouseUp = this._handleMouseUp.bind(this), this.update = this.update.bind(this), this.on(ga, this.update), this.getNode() && this.update();
6289
+ super(t), this._movingAnchorName = null, this._transforming = !1, this._createElements(), this._handleMouseMove = this._handleMouseMove.bind(this), this._handleMouseUp = this._handleMouseUp.bind(this), this.update = this.update.bind(this), this.on(pa, this.update), this.getNode() && this.update();
6290
6290
  }
6291
6291
  attachTo(t) {
6292
6292
  return this.setNode(t), this;
6293
6293
  }
6294
6294
  setNode(t) {
6295
- return C.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."), this.setNodes([t]);
6295
+ return S.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."), this.setNodes([t]);
6296
6296
  }
6297
6297
  getNode() {
6298
6298
  return this._nodes && this._nodes[0];
6299
6299
  }
6300
6300
  _getEventNamespace() {
6301
- return dn + this._id;
6301
+ return fn + this._id;
6302
6302
  }
6303
6303
  setNodes(t = []) {
6304
6304
  this._nodes && this._nodes.length && this.detach();
6305
- const e = t.filter((s) => s.isAncestorOf(this) ? (C.error("Konva.Transformer cannot be an a child of the node you are trying to attach"), !1) : !0);
6305
+ const e = t.filter((s) => s.isAncestorOf(this) ? (S.error("Konva.Transformer cannot be an a child of the node you are trying to attach"), !1) : !0);
6306
6306
  return this._nodes = t = e, t.length === 1 && this.useSingleNodeRotation() ? this.rotation(t[0].getAbsoluteRotation()) : this.rotation(0), this._nodes.forEach((s) => {
6307
6307
  const n = () => {
6308
6308
  this.nodes().length === 1 && this.useSingleNodeRotation() && this.rotation(this.nodes()[0].getAbsoluteRotation()), this._resetTransformCache(), !this._transforming && !this.isDragging() && this.update();
@@ -6311,7 +6311,7 @@ class Y extends Qt {
6311
6311
  const r = s._attrsAffectingSize.map((o) => o + "Change." + this._getEventNamespace()).join(" ");
6312
6312
  s.on(r, n);
6313
6313
  }
6314
- s.on(pa.map((r) => r + `.${this._getEventNamespace()}`).join(" "), n), s.on(`absoluteTransformChange.${this._getEventNamespace()}`, n), this._proxyDrag(s);
6314
+ s.on(ma.map((r) => r + `.${this._getEventNamespace()}`).join(" "), n), s.on(`absoluteTransformChange.${this._getEventNamespace()}`, n), this._proxyDrag(s);
6315
6315
  }), this._resetTransformCache(), !!this.findOne(".top-left") && this.update(), this;
6316
6316
  }
6317
6317
  _proxyDrag(t) {
@@ -6362,7 +6362,7 @@ class Y extends Qt {
6362
6362
  height: s.height * n.y,
6363
6363
  rotation: h
6364
6364
  };
6365
- return un(c, -E.getAngle(e), {
6365
+ return gn(c, -E.getAngle(e), {
6366
6366
  x: 0,
6367
6367
  y: 0
6368
6368
  });
@@ -6434,7 +6434,7 @@ class Y extends Qt {
6434
6434
  name: t + " _anchor",
6435
6435
  dragDistance: 0,
6436
6436
  draggable: !0,
6437
- hitStrokeWidth: ya ? 10 : "auto"
6437
+ hitStrokeWidth: Sa ? 10 : "auto"
6438
6438
  }), i = this;
6439
6439
  e.on("mousedown touchstart", function(s) {
6440
6440
  i._handleMouseDown(s);
@@ -6457,11 +6457,11 @@ class Y extends Qt {
6457
6457
  sceneFunc(e, i) {
6458
6458
  const s = i.getParent(), n = s.padding(), r = i.width(), o = i.height();
6459
6459
  if (e.beginPath(), e.rect(-n, -n, r + n * 2, o + n * 2), s.rotateEnabled() && s.rotateLineVisible()) {
6460
- const l = s.rotateAnchorAngle(), h = s.rotateAnchorOffset(), c = C.degToRad(l), d = Math.sin(c), u = -Math.cos(c), p = r / 2, g = o / 2;
6460
+ const l = s.rotateAnchorAngle(), h = s.rotateAnchorOffset(), c = S.degToRad(l), d = Math.sin(c), u = -Math.cos(c), p = r / 2, g = o / 2;
6461
6461
  let y = 1 / 0;
6462
6462
  u < 0 ? y = Math.min(y, -g / u) : u > 0 && (y = Math.min(y, (o - g) / u)), d < 0 ? y = Math.min(y, -p / d) : d > 0 && (y = Math.min(y, (r - p) / d));
6463
- const T = p + d * y, S = g + u * y, v = C._sign(o), b = T + d * h * v, k = S + u * h * v;
6464
- e.moveTo(T, S), e.lineTo(b, k);
6463
+ const T = p + d * y, C = g + u * y, v = S._sign(o), b = T + d * h * v, k = C + u * h * v;
6464
+ e.moveTo(T, C), e.lineTo(b, k);
6465
6465
  }
6466
6466
  e.fillStrokeShape(i);
6467
6467
  },
@@ -6516,7 +6516,7 @@ class Y extends Qt {
6516
6516
  const b = E.getAngle(this.rotateAnchorAngle());
6517
6517
  let k = Math.atan2(-i, e) + Math.PI / 2 - b;
6518
6518
  v.height < 0 && (k -= Math.PI);
6519
- const _ = E.getAngle(this.rotation()) + k, R = E.getAngle(this.rotationSnapTolerance()), I = va(this.rotationSnaps(), _, R) - v.rotation, D = Ta(v, I);
6519
+ const _ = E.getAngle(this.rotation()) + k, R = E.getAngle(this.rotationSnapTolerance()), I = ba(this.rotationSnaps(), _, R) - v.rotation, D = va(v, I);
6520
6520
  this._fitNodesInto(D, t);
6521
6521
  return;
6522
6522
  }
@@ -6601,12 +6601,12 @@ class Y extends Qt {
6601
6601
  }
6602
6602
  const y = this.findOne(".top-left").getAbsolutePosition();
6603
6603
  e = y.x, i = y.y;
6604
- const T = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), S = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
6604
+ const T = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), C = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
6605
6605
  this._fitNodesInto({
6606
6606
  x: e,
6607
6607
  y: i,
6608
6608
  width: T,
6609
- height: S,
6609
+ height: C,
6610
6610
  rotation: E.getAngle(this.rotation())
6611
6611
  }, t);
6612
6612
  }
@@ -6629,11 +6629,11 @@ class Y extends Qt {
6629
6629
  }
6630
6630
  _fitNodesInto(t, e) {
6631
6631
  const i = this._getNodeRect(), s = 1;
6632
- if (C._inRange(t.width, -this.padding() * 2 - s, s)) {
6632
+ if (S._inRange(t.width, -this.padding() * 2 - s, s)) {
6633
6633
  this.update();
6634
6634
  return;
6635
6635
  }
6636
- if (C._inRange(t.height, -this.padding() * 2 - s, s)) {
6636
+ if (S._inRange(t.height, -this.padding() * 2 - s, s)) {
6637
6637
  this.update();
6638
6638
  return;
6639
6639
  }
@@ -6666,7 +6666,7 @@ class Y extends Qt {
6666
6666
  }
6667
6667
  if (this.boundBoxFunc()) {
6668
6668
  const u = this.boundBoxFunc()(i, t);
6669
- u ? t = u : C.warn("boundBoxFunc returned falsy. You should return new bound rect from it!");
6669
+ u ? t = u : S.warn("boundBoxFunc returned falsy. You should return new bound rect from it!");
6670
6670
  }
6671
6671
  const r = 1e7, o = new ct();
6672
6672
  o.translate(i.x, i.y), o.rotate(i.rotation), o.scale(i.width / r, i.height / r);
@@ -6681,9 +6681,9 @@ class Y extends Qt {
6681
6681
  y.translate(u.offsetX(), u.offsetY());
6682
6682
  const T = new ct();
6683
6683
  T.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(y);
6684
- const S = T.decompose();
6685
- u.setAttrs(S), (p = u.getLayer()) === null || p === void 0 || p.batchDraw();
6686
- }), this.rotation(C._getRotation(t.rotation)), this._nodes.forEach((u) => {
6684
+ const C = T.decompose();
6685
+ u.setAttrs(C), (p = u.getLayer()) === null || p === void 0 || p.batchDraw();
6686
+ }), this.rotation(S._getRotation(t.rotation)), this._nodes.forEach((u) => {
6687
6687
  this._fire("transform", { evt: e, target: u }), u._fire("transform", { evt: e, target: u });
6688
6688
  }), this._resetTransformCache(), this.update(), this.getLayer().batchDraw();
6689
6689
  }
@@ -6696,7 +6696,7 @@ class Y extends Qt {
6696
6696
  update() {
6697
6697
  var t;
6698
6698
  const e = this._getNodeRect();
6699
- this.rotation(C._getRotation(e.rotation));
6699
+ this.rotation(S._getRotation(e.rotation));
6700
6700
  const i = e.width, s = e.height, n = this.enabledAnchors(), r = this.resizeEnabled(), o = this.padding(), l = this.anchorSize(), h = this.find("._anchor");
6701
6701
  h.forEach((_) => {
6702
6702
  _.setAttrs({
@@ -6754,10 +6754,10 @@ class Y extends Qt {
6754
6754
  offsetY: l / 2 - o,
6755
6755
  visible: r && n.indexOf("bottom-right") >= 0
6756
6756
  });
6757
- const c = this.rotateAnchorAngle(), d = this.rotateAnchorOffset(), u = C.degToRad(c), p = Math.sin(u), g = -Math.cos(u), y = i / 2, T = s / 2;
6758
- let S = 1 / 0;
6759
- g < 0 ? S = Math.min(S, -T / g) : g > 0 && (S = Math.min(S, (s - T) / g)), p < 0 ? S = Math.min(S, -y / p) : p > 0 && (S = Math.min(S, (i - y) / p));
6760
- const v = y + p * S, b = T + g * S, k = C._sign(s);
6757
+ const c = this.rotateAnchorAngle(), d = this.rotateAnchorOffset(), u = S.degToRad(c), p = Math.sin(u), g = -Math.cos(u), y = i / 2, T = s / 2;
6758
+ let C = 1 / 0;
6759
+ g < 0 ? C = Math.min(C, -T / g) : g > 0 && (C = Math.min(C, (s - T) / g)), p < 0 ? C = Math.min(C, -y / p) : p > 0 && (C = Math.min(C, (i - y) / p));
6760
+ const v = y + p * C, b = T + g * C, k = S._sign(s);
6761
6761
  this._batchChangeChild(".rotater", {
6762
6762
  x: v + p * d * k,
6763
6763
  y: b + g * d * k - o * g,
@@ -6802,14 +6802,14 @@ class Y extends Qt {
6802
6802
  }
6803
6803
  }
6804
6804
  Y.isTransforming = () => bi > 0;
6805
- function ba(a) {
6806
- return a instanceof Array || C.warn("enabledAnchors value should be an array"), a instanceof Array && a.forEach(function(t) {
6807
- Ue.indexOf(t) === -1 && C.warn("Unknown anchor name: " + t + ". Available names are: " + Ue.join(", "));
6805
+ function ka(a) {
6806
+ return a instanceof Array || S.warn("enabledAnchors value should be an array"), a instanceof Array && a.forEach(function(t) {
6807
+ Ue.indexOf(t) === -1 && S.warn("Unknown anchor name: " + t + ". Available names are: " + Ue.join(", "));
6808
6808
  }), a || [];
6809
6809
  }
6810
6810
  Y.prototype.className = "Transformer";
6811
6811
  st(Y);
6812
- m.addGetterSetter(Y, "enabledAnchors", Ue, ba);
6812
+ m.addGetterSetter(Y, "enabledAnchors", Ue, ka);
6813
6813
  m.addGetterSetter(Y, "flipEnabled", !0, pt());
6814
6814
  m.addGetterSetter(Y, "resizeEnabled", !0);
6815
6815
  m.addGetterSetter(Y, "anchorSize", 10, x());
@@ -6877,7 +6877,7 @@ m.backCompat(At, {
6877
6877
  function os() {
6878
6878
  this.r = 0, this.g = 0, this.b = 0, this.a = 0, this.next = null;
6879
6879
  }
6880
- const ka = [
6880
+ const wa = [
6881
6881
  512,
6882
6882
  512,
6883
6883
  456,
@@ -7133,7 +7133,7 @@ const ka = [
7133
7133
  263,
7134
7134
  261,
7135
7135
  259
7136
- ], wa = [
7136
+ ], _a = [
7137
7137
  9,
7138
7138
  11,
7139
7139
  12,
@@ -7390,60 +7390,60 @@ const ka = [
7390
7390
  24,
7391
7391
  24
7392
7392
  ];
7393
- function _a(a, t) {
7393
+ function Pa(a, t) {
7394
7394
  const e = a.data, i = a.width, s = a.height;
7395
- let n, r, o, l, h, c, d, u, p, g, y, T, S, v, b, k, M, _, R, A;
7396
- const I = t + t + 1, D = i - 1, N = s - 1, G = t + 1, W = G * (G + 1) / 2, F = new os(), H = ka[t], L = wa[t];
7395
+ let n, r, o, l, h, c, d, u, p, g, y, T, C, v, b, k, M, _, R, A;
7396
+ const I = t + t + 1, D = i - 1, N = s - 1, G = t + 1, W = G * (G + 1) / 2, F = new os(), H = wa[t], L = _a[t];
7397
7397
  let j = null, B = F, U = null, q = null;
7398
7398
  for (let K = 1; K < I; K++)
7399
7399
  B = B.next = new os(), K === G && (j = B);
7400
7400
  B.next = F, o = r = 0;
7401
7401
  for (let K = 0; K < s; K++) {
7402
- T = S = v = b = l = h = c = d = 0, u = G * (k = e[r]), p = G * (M = e[r + 1]), g = G * (_ = e[r + 2]), y = G * (R = e[r + 3]), l += W * k, h += W * M, c += W * _, d += W * R, B = F;
7402
+ T = C = v = b = l = h = c = d = 0, u = G * (k = e[r]), p = G * (M = e[r + 1]), g = G * (_ = e[r + 2]), y = G * (R = e[r + 3]), l += W * k, h += W * M, c += W * _, d += W * R, B = F;
7403
7403
  for (let nt = 0; nt < G; nt++)
7404
7404
  B.r = k, B.g = M, B.b = _, B.a = R, B = B.next;
7405
7405
  for (let nt = 1; nt < G; nt++)
7406
- n = r + ((D < nt ? D : nt) << 2), l += (B.r = k = e[n]) * (A = G - nt), h += (B.g = M = e[n + 1]) * A, c += (B.b = _ = e[n + 2]) * A, d += (B.a = R = e[n + 3]) * A, T += k, S += M, v += _, b += R, B = B.next;
7406
+ n = r + ((D < nt ? D : nt) << 2), l += (B.r = k = e[n]) * (A = G - nt), h += (B.g = M = e[n + 1]) * A, c += (B.b = _ = e[n + 2]) * A, d += (B.a = R = e[n + 3]) * A, T += k, C += M, v += _, b += R, B = B.next;
7407
7407
  U = F, q = j;
7408
7408
  for (let nt = 0; nt < i; nt++)
7409
- e[r + 3] = R = d * H >> L, R !== 0 ? (R = 255 / R, e[r] = (l * H >> L) * R, e[r + 1] = (h * H >> L) * R, e[r + 2] = (c * H >> L) * R) : e[r] = e[r + 1] = e[r + 2] = 0, l -= u, h -= p, c -= g, d -= y, u -= U.r, p -= U.g, g -= U.b, y -= U.a, n = o + ((n = nt + t + 1) < D ? n : D) << 2, T += U.r = e[n], S += U.g = e[n + 1], v += U.b = e[n + 2], b += U.a = e[n + 3], l += T, h += S, c += v, d += b, U = U.next, u += k = q.r, p += M = q.g, g += _ = q.b, y += R = q.a, T -= k, S -= M, v -= _, b -= R, q = q.next, r += 4;
7409
+ e[r + 3] = R = d * H >> L, R !== 0 ? (R = 255 / R, e[r] = (l * H >> L) * R, e[r + 1] = (h * H >> L) * R, e[r + 2] = (c * H >> L) * R) : e[r] = e[r + 1] = e[r + 2] = 0, l -= u, h -= p, c -= g, d -= y, u -= U.r, p -= U.g, g -= U.b, y -= U.a, n = o + ((n = nt + t + 1) < D ? n : D) << 2, T += U.r = e[n], C += U.g = e[n + 1], v += U.b = e[n + 2], b += U.a = e[n + 3], l += T, h += C, c += v, d += b, U = U.next, u += k = q.r, p += M = q.g, g += _ = q.b, y += R = q.a, T -= k, C -= M, v -= _, b -= R, q = q.next, r += 4;
7410
7410
  o += i;
7411
7411
  }
7412
7412
  for (let K = 0; K < i; K++) {
7413
- S = v = b = T = h = c = d = l = 0, r = K << 2, u = G * (k = e[r]), p = G * (M = e[r + 1]), g = G * (_ = e[r + 2]), y = G * (R = e[r + 3]), l += W * k, h += W * M, c += W * _, d += W * R, B = F;
7413
+ C = v = b = T = h = c = d = l = 0, r = K << 2, u = G * (k = e[r]), p = G * (M = e[r + 1]), g = G * (_ = e[r + 2]), y = G * (R = e[r + 3]), l += W * k, h += W * M, c += W * _, d += W * R, B = F;
7414
7414
  for (let lt = 0; lt < G; lt++)
7415
7415
  B.r = k, B.g = M, B.b = _, B.a = R, B = B.next;
7416
7416
  let nt = i;
7417
7417
  for (let lt = 1; lt <= t; lt++)
7418
- r = nt + K << 2, l += (B.r = k = e[r]) * (A = G - lt), h += (B.g = M = e[r + 1]) * A, c += (B.b = _ = e[r + 2]) * A, d += (B.a = R = e[r + 3]) * A, T += k, S += M, v += _, b += R, B = B.next, lt < N && (nt += i);
7418
+ r = nt + K << 2, l += (B.r = k = e[r]) * (A = G - lt), h += (B.g = M = e[r + 1]) * A, c += (B.b = _ = e[r + 2]) * A, d += (B.a = R = e[r + 3]) * A, T += k, C += M, v += _, b += R, B = B.next, lt < N && (nt += i);
7419
7419
  r = K, U = F, q = j;
7420
7420
  for (let lt = 0; lt < s; lt++)
7421
- n = r << 2, e[n + 3] = R = d * H >> L, R > 0 ? (R = 255 / R, e[n] = (l * H >> L) * R, e[n + 1] = (h * H >> L) * R, e[n + 2] = (c * H >> L) * R) : e[n] = e[n + 1] = e[n + 2] = 0, l -= u, h -= p, c -= g, d -= y, u -= U.r, p -= U.g, g -= U.b, y -= U.a, n = K + ((n = lt + G) < N ? n : N) * i << 2, l += T += U.r = e[n], h += S += U.g = e[n + 1], c += v += U.b = e[n + 2], d += b += U.a = e[n + 3], U = U.next, u += k = q.r, p += M = q.g, g += _ = q.b, y += R = q.a, T -= k, S -= M, v -= _, b -= R, q = q.next, r += i;
7421
+ n = r << 2, e[n + 3] = R = d * H >> L, R > 0 ? (R = 255 / R, e[n] = (l * H >> L) * R, e[n + 1] = (h * H >> L) * R, e[n + 2] = (c * H >> L) * R) : e[n] = e[n + 1] = e[n + 2] = 0, l -= u, h -= p, c -= g, d -= y, u -= U.r, p -= U.g, g -= U.b, y -= U.a, n = K + ((n = lt + G) < N ? n : N) * i << 2, l += T += U.r = e[n], h += C += U.g = e[n + 1], c += v += U.b = e[n + 2], d += b += U.a = e[n + 3], U = U.next, u += k = q.r, p += M = q.g, g += _ = q.b, y += R = q.a, T -= k, C -= M, v -= _, b -= R, q = q.next, r += i;
7422
7422
  }
7423
7423
  }
7424
- const Pa = function(t) {
7424
+ const xa = function(t) {
7425
7425
  const e = Math.round(this.blurRadius());
7426
- e > 0 && _a(t, e);
7426
+ e > 0 && Pa(t, e);
7427
7427
  };
7428
7428
  m.addGetterSetter(P, "blurRadius", 0, x(), m.afterSetFilter);
7429
- const xa = function(a) {
7429
+ const Aa = function(a) {
7430
7430
  const t = this.brightness() * 255, e = a.data, i = e.length;
7431
7431
  for (let s = 0; s < i; s += 4)
7432
7432
  e[s] += t, e[s + 1] += t, e[s + 2] += t;
7433
7433
  };
7434
7434
  m.addGetterSetter(P, "brightness", 0, x(), m.afterSetFilter);
7435
- const Aa = function(a) {
7435
+ const Ea = function(a) {
7436
7436
  const t = this.brightness(), e = a.data, i = e.length;
7437
7437
  for (let s = 0; s < i; s += 4)
7438
7438
  e[s] = Math.min(255, e[s] * t), e[s + 1] = Math.min(255, e[s + 1] * t), e[s + 2] = Math.min(255, e[s + 2] * t);
7439
- }, Ea = function(a) {
7439
+ }, Ia = function(a) {
7440
7440
  const t = Math.pow((this.contrast() + 100) / 100, 2), e = a.data, i = e.length;
7441
7441
  let s = 150, n = 150, r = 150;
7442
7442
  for (let o = 0; o < i; o += 4)
7443
7443
  s = e[o], n = e[o + 1], r = e[o + 2], s /= 255, s -= 0.5, s *= t, s += 0.5, s *= 255, n /= 255, n -= 0.5, n *= t, n += 0.5, n *= 255, r /= 255, r -= 0.5, r *= t, r += 0.5, r *= 255, s = s < 0 ? 0 : s > 255 ? 255 : s, n = n < 0 ? 0 : n > 255 ? 255 : n, r = r < 0 ? 0 : r > 255 ? 255 : r, e[o] = s, e[o + 1] = n, e[o + 2] = r;
7444
7444
  };
7445
7445
  m.addGetterSetter(P, "contrast", 0, x(), m.afterSetFilter);
7446
- const Ia = function(a) {
7446
+ const Ma = function(a) {
7447
7447
  var t, e, i, s, n, r, o, l, h;
7448
7448
  const c = a.data, d = a.width, u = a.height, p = Math.min(1, Math.max(0, (e = (t = this.embossStrength) === null || t === void 0 ? void 0 : t.call(this)) !== null && e !== void 0 ? e : 0.5)), g = Math.min(1, Math.max(0, (s = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && s !== void 0 ? s : 0.5)), T = (o = {
7449
7449
  "top-left": 315,
@@ -7454,7 +7454,7 @@ const Ia = function(a) {
7454
7454
  bottom: 90,
7455
7455
  "bottom-left": 45,
7456
7456
  left: 0
7457
- }[(r = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && r !== void 0 ? r : "top-left"]) !== null && o !== void 0 ? o : 315, S = !!((h = (l = this.embossBlend) === null || l === void 0 ? void 0 : l.call(this)) !== null && h !== void 0 && h), v = p * 10, b = g * 255, k = T * Math.PI / 180, M = Math.cos(k), _ = Math.sin(k), R = 128 / 1020 * v, A = new Uint8ClampedArray(c), I = new Float32Array(d * u);
7457
+ }[(r = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && r !== void 0 ? r : "top-left"]) !== null && o !== void 0 ? o : 315, C = !!((h = (l = this.embossBlend) === null || l === void 0 ? void 0 : l.call(this)) !== null && h !== void 0 && h), v = p * 10, b = g * 255, k = T * Math.PI / 180, M = Math.cos(k), _ = Math.sin(k), R = 128 / 1020 * v, A = new Uint8ClampedArray(c), I = new Float32Array(d * u);
7458
7458
  for (let F = 0, H = 0; H < c.length; H += 4, F++)
7459
7459
  I[F] = 0.2126 * A[H] + 0.7152 * A[H + 1] + 0.0722 * A[H + 2];
7460
7460
  const D = [-1, 0, 1, -2, 0, 2, -1, 0, 1], N = [-1, -2, -1, 0, 0, 0, 1, 2, 1], G = [-d - 1, -d, -d + 1, -1, 0, 1, d - 1, d, d + 1], W = (F) => F < 0 ? 0 : F > 255 ? 255 : F;
@@ -7464,7 +7464,7 @@ const Ia = function(a) {
7464
7464
  let j = 0, B = 0;
7465
7465
  j += I[L + G[0]] * D[0], B += I[L + G[0]] * N[0], j += I[L + G[1]] * D[1], B += I[L + G[1]] * N[1], j += I[L + G[2]] * D[2], B += I[L + G[2]] * N[2], j += I[L + G[3]] * D[3], B += I[L + G[3]] * N[3], j += I[L + G[5]] * D[5], B += I[L + G[5]] * N[5], j += I[L + G[6]] * D[6], B += I[L + G[6]] * N[6], j += I[L + G[7]] * D[7], B += I[L + G[7]] * N[7], j += I[L + G[8]] * D[8], B += I[L + G[8]] * N[8];
7466
7466
  const U = M * j + _ * B, q = W(b + U * R), K = L * 4;
7467
- if (S) {
7467
+ if (C) {
7468
7468
  const nt = q - b;
7469
7469
  c[K] = W(A[K] + nt), c[K + 1] = W(A[K + 1] + nt), c[K + 2] = W(A[K + 2] + nt), c[K + 3] = A[K + 3];
7470
7470
  } else
@@ -7493,7 +7493,7 @@ function ni(a, t, e, i, s) {
7493
7493
  let o = (a - t) / n;
7494
7494
  return o = r * o + i, o;
7495
7495
  }
7496
- const Ma = function(a) {
7496
+ const La = function(a) {
7497
7497
  const t = a.data, e = t.length;
7498
7498
  let i = t[0], s = i, n, r = t[1], o = r, l, h = t[2], c = h, d;
7499
7499
  const u = this.enhance();
@@ -7502,22 +7502,22 @@ const Ma = function(a) {
7502
7502
  for (let b = 0; b < e; b += 4)
7503
7503
  n = t[b + 0], n < i ? i = n : n > s && (s = n), l = t[b + 1], l < r ? r = l : l > o && (o = l), d = t[b + 2], d < h ? h = d : d > c && (c = d);
7504
7504
  s === i && (s = 255, i = 0), o === r && (o = 255, r = 0), c === h && (c = 255, h = 0);
7505
- let p, g, y, T, S, v;
7505
+ let p, g, y, T, C, v;
7506
7506
  if (u > 0)
7507
- p = s + u * (255 - s), g = i - u * (i - 0), y = o + u * (255 - o), T = r - u * (r - 0), S = c + u * (255 - c), v = h - u * (h - 0);
7507
+ p = s + u * (255 - s), g = i - u * (i - 0), y = o + u * (255 - o), T = r - u * (r - 0), C = c + u * (255 - c), v = h - u * (h - 0);
7508
7508
  else {
7509
7509
  const b = (s + i) * 0.5;
7510
7510
  p = s + u * (s - b), g = i + u * (i - b);
7511
7511
  const k = (o + r) * 0.5;
7512
7512
  y = o + u * (o - k), T = r + u * (r - k);
7513
7513
  const M = (c + h) * 0.5;
7514
- S = c + u * (c - M), v = h + u * (h - M);
7514
+ C = c + u * (c - M), v = h + u * (h - M);
7515
7515
  }
7516
7516
  for (let b = 0; b < e; b += 4)
7517
- t[b + 0] = ni(t[b + 0], i, s, g, p), t[b + 1] = ni(t[b + 1], r, o, T, y), t[b + 2] = ni(t[b + 2], h, c, v, S);
7517
+ t[b + 0] = ni(t[b + 0], i, s, g, p), t[b + 1] = ni(t[b + 1], r, o, T, y), t[b + 2] = ni(t[b + 2], h, c, v, C);
7518
7518
  };
7519
7519
  m.addGetterSetter(P, "enhance", 0, x(), m.afterSetFilter);
7520
- const La = function(a) {
7520
+ const Da = function(a) {
7521
7521
  const t = a.data, e = t.length;
7522
7522
  for (let i = 0; i < e; i += 4) {
7523
7523
  const s = 0.34 * t[i] + 0.5 * t[i + 1] + 0.16 * t[i + 2];
@@ -7527,66 +7527,66 @@ const La = function(a) {
7527
7527
  m.addGetterSetter(P, "hue", 0, x(), m.afterSetFilter);
7528
7528
  m.addGetterSetter(P, "saturation", 0, x(), m.afterSetFilter);
7529
7529
  m.addGetterSetter(P, "luminance", 0, x(), m.afterSetFilter);
7530
- const Da = function(a) {
7531
- const t = a.data, e = t.length, i = 1, s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = this.luminance() * 127, o = i * s * Math.cos(n * Math.PI / 180), l = i * s * Math.sin(n * Math.PI / 180), h = 0.299 * i + 0.701 * o + 0.167 * l, c = 0.587 * i - 0.587 * o + 0.33 * l, d = 0.114 * i - 0.114 * o - 0.497 * l, u = 0.299 * i - 0.299 * o - 0.328 * l, p = 0.587 * i + 0.413 * o + 0.035 * l, g = 0.114 * i - 0.114 * o + 0.293 * l, y = 0.299 * i - 0.3 * o + 1.25 * l, T = 0.587 * i - 0.586 * o - 1.05 * l, S = 0.114 * i + 0.886 * o - 0.2 * l;
7530
+ const Ra = function(a) {
7531
+ const t = a.data, e = t.length, i = 1, s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = this.luminance() * 127, o = i * s * Math.cos(n * Math.PI / 180), l = i * s * Math.sin(n * Math.PI / 180), h = 0.299 * i + 0.701 * o + 0.167 * l, c = 0.587 * i - 0.587 * o + 0.33 * l, d = 0.114 * i - 0.114 * o - 0.497 * l, u = 0.299 * i - 0.299 * o - 0.328 * l, p = 0.587 * i + 0.413 * o + 0.035 * l, g = 0.114 * i - 0.114 * o + 0.293 * l, y = 0.299 * i - 0.3 * o + 1.25 * l, T = 0.587 * i - 0.586 * o - 1.05 * l, C = 0.114 * i + 0.886 * o - 0.2 * l;
7532
7532
  let v, b, k, M;
7533
7533
  for (let _ = 0; _ < e; _ += 4)
7534
- v = t[_ + 0], b = t[_ + 1], k = t[_ + 2], M = t[_ + 3], t[_ + 0] = h * v + c * b + d * k + r, t[_ + 1] = u * v + p * b + g * k + r, t[_ + 2] = y * v + T * b + S * k + r, t[_ + 3] = M;
7535
- }, Ra = function(a) {
7534
+ v = t[_ + 0], b = t[_ + 1], k = t[_ + 2], M = t[_ + 3], t[_ + 0] = h * v + c * b + d * k + r, t[_ + 1] = u * v + p * b + g * k + r, t[_ + 2] = y * v + T * b + C * k + r, t[_ + 3] = M;
7535
+ }, Oa = function(a) {
7536
7536
  const t = a.data, e = t.length, i = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, r = i * s * Math.cos(n * Math.PI / 180), o = i * s * Math.sin(n * Math.PI / 180), l = 0.299 * i + 0.701 * r + 0.167 * o, h = 0.587 * i - 0.587 * r + 0.33 * o, c = 0.114 * i - 0.114 * r - 0.497 * o, d = 0.299 * i - 0.299 * r - 0.328 * o, u = 0.587 * i + 0.413 * r + 0.035 * o, p = 0.114 * i - 0.114 * r + 0.293 * o, g = 0.299 * i - 0.3 * r + 1.25 * o, y = 0.587 * i - 0.586 * r - 1.05 * o, T = 0.114 * i + 0.886 * r - 0.2 * o;
7537
- for (let S = 0; S < e; S += 4) {
7538
- const v = t[S + 0], b = t[S + 1], k = t[S + 2], M = t[S + 3];
7539
- t[S + 0] = l * v + h * b + c * k, t[S + 1] = d * v + u * b + p * k, t[S + 2] = g * v + y * b + T * k, t[S + 3] = M;
7537
+ for (let C = 0; C < e; C += 4) {
7538
+ const v = t[C + 0], b = t[C + 1], k = t[C + 2], M = t[C + 3];
7539
+ t[C + 0] = l * v + h * b + c * k, t[C + 1] = d * v + u * b + p * k, t[C + 2] = g * v + y * b + T * k, t[C + 3] = M;
7540
7540
  }
7541
7541
  };
7542
7542
  m.addGetterSetter(P, "hue", 0, x(), m.afterSetFilter);
7543
7543
  m.addGetterSetter(P, "saturation", 0, x(), m.afterSetFilter);
7544
7544
  m.addGetterSetter(P, "value", 0, x(), m.afterSetFilter);
7545
- const Oa = function(a) {
7545
+ const Ga = function(a) {
7546
7546
  const t = a.data, e = t.length;
7547
7547
  for (let i = 0; i < e; i += 4)
7548
7548
  t[i] = 255 - t[i], t[i + 1] = 255 - t[i + 1], t[i + 2] = 255 - t[i + 2];
7549
- }, Ga = function(a, t, e) {
7549
+ }, Ba = function(a, t, e) {
7550
7550
  const i = a.data, s = t.data, n = a.width, r = a.height, o = e.polarCenterX || n / 2, l = e.polarCenterY || r / 2;
7551
7551
  let h = Math.sqrt(o * o + l * l), c = n - o, d = r - l;
7552
7552
  const u = Math.sqrt(c * c + d * d);
7553
7553
  h = u > h ? u : h;
7554
7554
  const p = r, g = n, y = 360 / g * Math.PI / 180;
7555
7555
  for (let T = 0; T < g; T += 1) {
7556
- const S = Math.sin(T * y), v = Math.cos(T * y);
7556
+ const C = Math.sin(T * y), v = Math.cos(T * y);
7557
7557
  for (let b = 0; b < p; b += 1) {
7558
- c = Math.floor(o + h * b / p * v), d = Math.floor(l + h * b / p * S);
7558
+ c = Math.floor(o + h * b / p * v), d = Math.floor(l + h * b / p * C);
7559
7559
  let k = (d * n + c) * 4;
7560
7560
  const M = i[k + 0], _ = i[k + 1], R = i[k + 2], A = i[k + 3];
7561
7561
  k = (T + b * n) * 4, s[k + 0] = M, s[k + 1] = _, s[k + 2] = R, s[k + 3] = A;
7562
7562
  }
7563
7563
  }
7564
- }, Ba = function(a, t, e) {
7564
+ }, Ha = function(a, t, e) {
7565
7565
  const i = a.data, s = t.data, n = a.width, r = a.height, o = e.polarCenterX || n / 2, l = e.polarCenterY || r / 2;
7566
7566
  let h = Math.sqrt(o * o + l * l), c = n - o, d = r - l;
7567
7567
  const u = Math.sqrt(c * c + d * d);
7568
7568
  h = u > h ? u : h;
7569
7569
  const p = r, g = n, y = 0;
7570
- let T, S;
7570
+ let T, C;
7571
7571
  for (c = 0; c < n; c += 1)
7572
7572
  for (d = 0; d < r; d += 1) {
7573
7573
  const v = c - o, b = d - l, k = Math.sqrt(v * v + b * b) * p / h;
7574
7574
  let M = (Math.atan2(b, v) * 180 / Math.PI + 360 + y) % 360;
7575
- M = M * g / 360, T = Math.floor(M), S = Math.floor(k);
7576
- let _ = (S * n + T) * 4;
7575
+ M = M * g / 360, T = Math.floor(M), C = Math.floor(k);
7576
+ let _ = (C * n + T) * 4;
7577
7577
  const R = i[_ + 0], A = i[_ + 1], I = i[_ + 2], D = i[_ + 3];
7578
7578
  _ = (d * n + c) * 4, s[_ + 0] = R, s[_ + 1] = A, s[_ + 2] = I, s[_ + 3] = D;
7579
7579
  }
7580
- }, Ha = function(a) {
7580
+ }, za = function(a) {
7581
7581
  const t = a.width, e = a.height;
7582
7582
  let i, s, n, r, o, l, h, c, d, u, p = Math.round(this.kaleidoscopePower());
7583
7583
  const g = Math.round(this.kaleidoscopeAngle()), y = Math.floor(t * (g % 360) / 360);
7584
7584
  if (p < 1)
7585
7585
  return;
7586
- const T = C.createCanvasElement();
7586
+ const T = S.createCanvasElement();
7587
7587
  T.width = t, T.height = e;
7588
- const S = T.getContext("2d").getImageData(0, 0, t, e);
7589
- C.releaseCanvas(T), Ga(a, S, {
7588
+ const C = T.getContext("2d").getImageData(0, 0, t, e);
7589
+ S.releaseCanvas(T), Ba(a, C, {
7590
7590
  polarCenterX: t / 2,
7591
7591
  polarCenterY: e / 2
7592
7592
  });
@@ -7597,14 +7597,14 @@ const Oa = function(a) {
7597
7597
  let b = v, k = 0, M = b, _ = 1;
7598
7598
  for (y + v > t && (k = b, M = 0, _ = -1), s = 0; s < e; s += 1)
7599
7599
  for (i = k; i !== M; i += _)
7600
- n = Math.round(i + y) % t, d = (t * s + n) * 4, o = S.data[d + 0], l = S.data[d + 1], h = S.data[d + 2], c = S.data[d + 3], u = (t * s + i) * 4, S.data[u + 0] = o, S.data[u + 1] = l, S.data[u + 2] = h, S.data[u + 3] = c;
7600
+ n = Math.round(i + y) % t, d = (t * s + n) * 4, o = C.data[d + 0], l = C.data[d + 1], h = C.data[d + 2], c = C.data[d + 3], u = (t * s + i) * 4, C.data[u + 0] = o, C.data[u + 1] = l, C.data[u + 2] = h, C.data[u + 3] = c;
7601
7601
  for (s = 0; s < e; s += 1)
7602
7602
  for (b = Math.floor(v), r = 0; r < p; r += 1) {
7603
7603
  for (i = 0; i < b + 1; i += 1)
7604
- d = (t * s + i) * 4, o = S.data[d + 0], l = S.data[d + 1], h = S.data[d + 2], c = S.data[d + 3], u = (t * s + b * 2 - i - 1) * 4, S.data[u + 0] = o, S.data[u + 1] = l, S.data[u + 2] = h, S.data[u + 3] = c;
7604
+ d = (t * s + i) * 4, o = C.data[d + 0], l = C.data[d + 1], h = C.data[d + 2], c = C.data[d + 3], u = (t * s + b * 2 - i - 1) * 4, C.data[u + 0] = o, C.data[u + 1] = l, C.data[u + 2] = h, C.data[u + 3] = c;
7605
7605
  b *= 2;
7606
7606
  }
7607
- Ba(S, a, {});
7607
+ Ha(C, a, {});
7608
7608
  };
7609
7609
  m.addGetterSetter(P, "kaleidoscopePower", 2, x(), m.afterSetFilter);
7610
7610
  m.addGetterSetter(P, "kaleidoscopeAngle", 0, x(), m.afterSetFilter);
@@ -7616,16 +7616,16 @@ function Oe(a, t, e) {
7616
7616
  function ae(a, t) {
7617
7617
  return Math.sqrt(Math.pow(a[0] - t[0], 2) + Math.pow(a[1] - t[1], 2) + Math.pow(a[2] - t[2], 2));
7618
7618
  }
7619
- function za(a) {
7619
+ function Na(a) {
7620
7620
  const t = [0, 0, 0];
7621
7621
  for (let e = 0; e < a.length; e++)
7622
7622
  t[0] += a[e][0], t[1] += a[e][1], t[2] += a[e][2];
7623
7623
  return t[0] /= a.length, t[1] /= a.length, t[2] /= a.length, t;
7624
7624
  }
7625
- function Na(a, t) {
7625
+ function Fa(a, t) {
7626
7626
  const e = Oe(a, 0, 0), i = Oe(a, a.width - 1, 0), s = Oe(a, 0, a.height - 1), n = Oe(a, a.width - 1, a.height - 1), r = t || 10;
7627
7627
  if (ae(e, i) < r && ae(i, n) < r && ae(n, s) < r && ae(s, e) < r) {
7628
- const o = za([i, e, n, s]), l = [];
7628
+ const o = Na([i, e, n, s]), l = [];
7629
7629
  for (let h = 0; h < a.width * a.height; h++) {
7630
7630
  const c = ae(o, [
7631
7631
  a.data[h * 4],
@@ -7637,11 +7637,11 @@ function Na(a, t) {
7637
7637
  return l;
7638
7638
  }
7639
7639
  }
7640
- function Fa(a, t) {
7640
+ function Va(a, t) {
7641
7641
  for (let e = 0; e < a.width * a.height; e++)
7642
7642
  a.data[4 * e + 3] = t[e];
7643
7643
  }
7644
- function Va(a, t, e) {
7644
+ function Wa(a, t, e) {
7645
7645
  const i = [1, 1, 1, 1, 0, 1, 1, 1, 1], s = Math.round(Math.sqrt(i.length)), n = Math.floor(s / 2), r = [];
7646
7646
  for (let o = 0; o < e; o++)
7647
7647
  for (let l = 0; l < t; l++) {
@@ -7659,7 +7659,7 @@ function Va(a, t, e) {
7659
7659
  }
7660
7660
  return r;
7661
7661
  }
7662
- function Wa(a, t, e) {
7662
+ function Ya(a, t, e) {
7663
7663
  const i = [1, 1, 1, 1, 1, 1, 1, 1, 1], s = Math.round(Math.sqrt(i.length)), n = Math.floor(s / 2), r = [];
7664
7664
  for (let o = 0; o < e; o++)
7665
7665
  for (let l = 0; l < t; l++) {
@@ -7677,7 +7677,7 @@ function Wa(a, t, e) {
7677
7677
  }
7678
7678
  return r;
7679
7679
  }
7680
- function Ya(a, t, e) {
7680
+ function Xa(a, t, e) {
7681
7681
  const i = [
7682
7682
  0.1111111111111111,
7683
7683
  0.1111111111111111,
@@ -7705,38 +7705,38 @@ function Ya(a, t, e) {
7705
7705
  }
7706
7706
  return r;
7707
7707
  }
7708
- const Xa = function(a) {
7708
+ const Ua = function(a) {
7709
7709
  const t = this.threshold();
7710
- let e = Na(a, t);
7711
- return e && (e = Va(e, a.width, a.height), e = Wa(e, a.width, a.height), e = Ya(e, a.width, a.height), Fa(a, e)), a;
7710
+ let e = Fa(a, t);
7711
+ return e && (e = Wa(e, a.width, a.height), e = Ya(e, a.width, a.height), e = Xa(e, a.width, a.height), Va(a, e)), a;
7712
7712
  };
7713
7713
  m.addGetterSetter(P, "threshold", 0, x(), m.afterSetFilter);
7714
- const Ua = function(a) {
7714
+ const $a = function(a) {
7715
7715
  const t = this.noise() * 255, e = a.data, i = e.length, s = t / 2;
7716
7716
  for (let n = 0; n < i; n += 4)
7717
7717
  e[n + 0] += s - 2 * s * Math.random(), e[n + 1] += s - 2 * s * Math.random(), e[n + 2] += s - 2 * s * Math.random();
7718
7718
  };
7719
7719
  m.addGetterSetter(P, "noise", 0.2, x(), m.afterSetFilter);
7720
- const $a = function(a) {
7720
+ const Ka = function(a) {
7721
7721
  let t = Math.ceil(this.pixelSize()), e = a.width, i = a.height, s = Math.ceil(e / t), n = Math.ceil(i / t), r = a.data;
7722
7722
  if (t <= 0) {
7723
- C.error("pixelSize value can not be <= 0");
7723
+ S.error("pixelSize value can not be <= 0");
7724
7724
  return;
7725
7725
  }
7726
7726
  for (let o = 0; o < s; o += 1)
7727
7727
  for (let l = 0; l < n; l += 1) {
7728
7728
  let h = 0, c = 0, d = 0, u = 0;
7729
7729
  const p = o * t, g = p + t, y = l * t, T = y + t;
7730
- let S = 0;
7730
+ let C = 0;
7731
7731
  for (let v = p; v < g; v += 1)
7732
7732
  if (!(v >= e))
7733
7733
  for (let b = y; b < T; b += 1) {
7734
7734
  if (b >= i)
7735
7735
  continue;
7736
7736
  const k = (e * b + v) * 4;
7737
- h += r[k + 0], c += r[k + 1], d += r[k + 2], u += r[k + 3], S += 1;
7737
+ h += r[k + 0], c += r[k + 1], d += r[k + 2], u += r[k + 3], C += 1;
7738
7738
  }
7739
- h = h / S, c = c / S, d = d / S, u = u / S;
7739
+ h = h / C, c = c / C, d = d / C, u = u / C;
7740
7740
  for (let v = p; v < g; v += 1)
7741
7741
  if (!(v >= e))
7742
7742
  for (let b = y; b < T; b += 1) {
@@ -7748,13 +7748,13 @@ const $a = function(a) {
7748
7748
  }
7749
7749
  };
7750
7750
  m.addGetterSetter(P, "pixelSize", 8, x(), m.afterSetFilter);
7751
- const Ka = function(a) {
7751
+ const ja = function(a) {
7752
7752
  const t = Math.round(this.levels() * 254) + 1, e = a.data, i = e.length, s = 255 / t;
7753
7753
  for (let n = 0; n < i; n += 1)
7754
7754
  e[n] = Math.floor(e[n] / s) * s;
7755
7755
  };
7756
7756
  m.addGetterSetter(P, "levels", 0.5, x(), m.afterSetFilter);
7757
- const ja = function(a) {
7757
+ const Za = function(a) {
7758
7758
  const t = a.data, e = t.length, i = this.red(), s = this.green(), n = this.blue();
7759
7759
  for (let r = 0; r < e; r += 4) {
7760
7760
  const o = (0.34 * t[r] + 0.5 * t[r + 1] + 0.16 * t[r + 2]) / 255;
@@ -7767,8 +7767,8 @@ m.addGetterSetter(P, "red", 0, function(a) {
7767
7767
  m.addGetterSetter(P, "green", 0, function(a) {
7768
7768
  return this._filterUpToDate = !1, a > 255 ? 255 : a < 0 ? 0 : Math.round(a);
7769
7769
  });
7770
- m.addGetterSetter(P, "blue", 0, Rs, m.afterSetFilter);
7771
- const Za = function(a) {
7770
+ m.addGetterSetter(P, "blue", 0, Gs, m.afterSetFilter);
7771
+ const qa = function(a) {
7772
7772
  const t = a.data, e = t.length, i = this.red(), s = this.green(), n = this.blue(), r = this.alpha();
7773
7773
  for (let o = 0; o < e; o += 4) {
7774
7774
  const l = 1 - r;
@@ -7781,24 +7781,24 @@ m.addGetterSetter(P, "red", 0, function(a) {
7781
7781
  m.addGetterSetter(P, "green", 0, function(a) {
7782
7782
  return this._filterUpToDate = !1, a > 255 ? 255 : a < 0 ? 0 : Math.round(a);
7783
7783
  });
7784
- m.addGetterSetter(P, "blue", 0, Rs, m.afterSetFilter);
7784
+ m.addGetterSetter(P, "blue", 0, Gs, m.afterSetFilter);
7785
7785
  m.addGetterSetter(P, "alpha", 1, function(a) {
7786
7786
  return this._filterUpToDate = !1, a > 1 ? 1 : a < 0 ? 0 : a;
7787
7787
  });
7788
- const qa = function(a) {
7788
+ const Ja = function(a) {
7789
7789
  const t = a.data, e = t.length;
7790
7790
  for (let i = 0; i < e; i += 4) {
7791
7791
  const s = t[i + 0], n = t[i + 1], r = t[i + 2];
7792
7792
  t[i + 0] = Math.min(255, s * 0.393 + n * 0.769 + r * 0.189), t[i + 1] = Math.min(255, s * 0.349 + n * 0.686 + r * 0.168), t[i + 2] = Math.min(255, s * 0.272 + n * 0.534 + r * 0.131);
7793
7793
  }
7794
- }, Ja = function(a) {
7794
+ }, Qa = function(a) {
7795
7795
  const e = a.data;
7796
7796
  for (let i = 0; i < e.length; i += 4) {
7797
7797
  const s = e[i], n = e[i + 1], r = e[i + 2];
7798
7798
  0.2126 * s + 0.7152 * n + 0.0722 * r >= 128 && (e[i] = 255 - s, e[i + 1] = 255 - n, e[i + 2] = 255 - r);
7799
7799
  }
7800
7800
  return a;
7801
- }, Qa = function(a) {
7801
+ }, to = function(a) {
7802
7802
  const t = this.threshold() * 255, e = a.data, i = e.length;
7803
7803
  for (let s = 0; s < i; s += 1)
7804
7804
  e[s] = e[s] < t ? 0 : 255;
@@ -7824,26 +7824,26 @@ const X = Zi.Util._assign(Zi, {
7824
7824
  Transformer: Y,
7825
7825
  Wedge: At,
7826
7826
  Filters: {
7827
- Blur: Pa,
7828
- Brightness: Aa,
7829
- Brighten: xa,
7830
- Contrast: Ea,
7831
- Emboss: Ia,
7832
- Enhance: Ma,
7833
- Grayscale: La,
7834
- HSL: Da,
7835
- HSV: Ra,
7836
- Invert: Oa,
7837
- Kaleidoscope: Ha,
7838
- Mask: Xa,
7839
- Noise: Ua,
7840
- Pixelate: $a,
7841
- Posterize: Ka,
7842
- RGB: ja,
7843
- RGBA: Za,
7844
- Sepia: qa,
7845
- Solarize: Ja,
7846
- Threshold: Qa
7827
+ Blur: xa,
7828
+ Brightness: Ea,
7829
+ Brighten: Aa,
7830
+ Contrast: Ia,
7831
+ Emboss: Ma,
7832
+ Enhance: La,
7833
+ Grayscale: Da,
7834
+ HSL: Ra,
7835
+ HSV: Oa,
7836
+ Invert: Ga,
7837
+ Kaleidoscope: za,
7838
+ Mask: Ua,
7839
+ Noise: $a,
7840
+ Pixelate: Ka,
7841
+ Posterize: ja,
7842
+ RGB: Za,
7843
+ RGBA: qa,
7844
+ Sepia: Ja,
7845
+ Solarize: Qa,
7846
+ Threshold: to
7847
7847
  }
7848
7848
  }), ls = {
7849
7849
  debug: 10,
@@ -7855,13 +7855,13 @@ const X = Zi.Util._assign(Zi, {
7855
7855
  level: "warn",
7856
7856
  moduleLevels: {}
7857
7857
  }, hs = 400;
7858
- function to(a, t) {
7858
+ function eo(a, t) {
7859
7859
  return a.moduleLevels[t] ?? a.level;
7860
7860
  }
7861
7861
  function zt(a, t, e) {
7862
7862
  if (!a.enabled)
7863
7863
  return !1;
7864
- const i = to(a, e);
7864
+ const i = eo(a, e);
7865
7865
  return ls[t] >= ls[i];
7866
7866
  }
7867
7867
  function cs(a) {
@@ -7882,7 +7882,7 @@ function cs(a) {
7882
7882
  altKey: !!a.altKey
7883
7883
  };
7884
7884
  }
7885
- function eo(a) {
7885
+ function io(a) {
7886
7886
  if (a === void 0)
7887
7887
  return;
7888
7888
  const t = cs(a);
@@ -7898,8 +7898,8 @@ function eo(a) {
7898
7898
  }
7899
7899
  return a;
7900
7900
  }
7901
- function io(a, t, e, i) {
7902
- const s = eo(i);
7901
+ function so(a, t, e, i) {
7902
+ const s = io(i);
7903
7903
  s === void 0 ? a(`${t} ${e}`) : a(`${t} ${e}`, s);
7904
7904
  }
7905
7905
  class O {
@@ -7969,14 +7969,14 @@ class O {
7969
7969
  const l = (o == null ? void 0 : o.suppressed) ?? 0, h = l > 0 ? `${i} (+${l} repeats)` : i;
7970
7970
  this.dedupeState.set(r, { lastPrintedAt: n, suppressed: 0 });
7971
7971
  const c = `[${t.toUpperCase()}] [${e}]`, d = this.resolveConsoleMethod(t);
7972
- io(d, c, h, s);
7972
+ so(d, c, h, s);
7973
7973
  }
7974
7974
  static resolveConsoleMethod(t) {
7975
7975
  return t === "debug" ? console.log.bind(console) : t === "info" ? console.info.bind(console) : t === "warn" ? console.warn.bind(console) : console.error.bind(console);
7976
7976
  }
7977
7977
  }
7978
7978
  f(O, "config", { ...Ge }), f(O, "dedupeWindowMs", hs), f(O, "dedupeState", /* @__PURE__ */ new Map());
7979
- class Ct {
7979
+ class St {
7980
7980
  static clearImageCache() {
7981
7981
  this.imageCache = {}, this.keyframeDimensionsCache = {}, this.keyframeDimensionsPromiseCache = {};
7982
7982
  }
@@ -8023,7 +8023,7 @@ class Ct {
8023
8023
  p.push(Math.round(y * (n - 1) / (d - 1)));
8024
8024
  const g = [];
8025
8025
  for (let y = 0; y < d; y++) {
8026
- const T = t[p[y]], S = await this.getSafeKeyframeDimensions(r, T), v = S.width / S.height;
8026
+ const T = t[p[y]], C = await this.getSafeKeyframeDimensions(r, T), v = C.width / C.height;
8027
8027
  g.push({
8028
8028
  coverUrl: T,
8029
8029
  singleImageWidth: i * v,
@@ -8048,10 +8048,10 @@ class Ct {
8048
8048
  p.push(Math.round(y * (n - 1) / (d - 1)));
8049
8049
  const g = [];
8050
8050
  for (let y = 0; y < d; y++) {
8051
- const T = t[p[y]], S = this.getCachedKeyframeDimensions(r, T);
8052
- if (!S)
8051
+ const T = t[p[y]], C = this.getCachedKeyframeDimensions(r, T);
8052
+ if (!C)
8053
8053
  return null;
8054
- const v = S.width / S.height;
8054
+ const v = C.width / C.height;
8055
8055
  g.push({
8056
8056
  coverUrl: T,
8057
8057
  singleImageWidth: i * v,
@@ -8089,7 +8089,7 @@ class Ct {
8089
8089
  });
8090
8090
  u.src || (u.src = n);
8091
8091
  for (let g = 0; g < c; g++) {
8092
- const y = g * d, T = l - y, S = i - o - y, v = Math.min(d, T, S);
8092
+ const y = g * d, T = l - y, C = i - o - y, v = Math.min(d, T, C);
8093
8093
  if (v <= 0)
8094
8094
  continue;
8095
8095
  const b = new X.Image({
@@ -8171,12 +8171,12 @@ class Ct {
8171
8171
  }
8172
8172
  }
8173
8173
  }
8174
- f(Ct, "MIN_IMAGE_DISPLAY_WIDTH", 24), f(Ct, "COVER_RENDER_VERSION_KEY", "_coverRenderVersion"), f(Ct, "MAX_CACHE_SIZE", 1e3), f(Ct, "DEFAULT_DIMENSIONS", { width: 160, height: 90 }), f(Ct, "keyframeDimensionsCache", {}), f(Ct, "keyframeDimensionsPromiseCache", {}), f(Ct, "imageCache", {});
8175
- const at = 3, ds = 10, so = 8, no = 8, ro = 10, ri = 4, us = 14, ao = [4, 10, 14, 10, 4], fs = [3, 7, 11, 15, 11, 7, 3], Di = 28, oo = 14, fn = 8, lo = [4, 9, 14, 9, 4];
8174
+ f(St, "MIN_IMAGE_DISPLAY_WIDTH", 24), f(St, "COVER_RENDER_VERSION_KEY", "_coverRenderVersion"), f(St, "MAX_CACHE_SIZE", 1e3), f(St, "DEFAULT_DIMENSIONS", { width: 160, height: 90 }), f(St, "keyframeDimensionsCache", {}), f(St, "keyframeDimensionsPromiseCache", {}), f(St, "imageCache", {});
8175
+ const at = 3, ds = 10, no = 8, ro = 8, ao = 10, ri = 4, us = 14, pn = 10, oo = [4, 10, 14, 10, 4], fs = [3, 7, 11, 15, 11, 7, 3], Di = 28, lo = 14, mn = 8, ho = [4, 9, 14, 9, 4];
8176
8176
  function Tt(a, t, e, i, s = "#ffffff", n = "#000000", r = 1) {
8177
8177
  return new X.Rect({ x: a, y: t, width: e, height: i, fill: s, stroke: n, strokeWidth: r });
8178
8178
  }
8179
- function gn(a, t, e, i = 12, s = "Arial", n = "#000000", r = "left", o = "top") {
8179
+ function yn(a, t, e, i = 12, s = "Arial", n = "#000000", r = "left", o = "top") {
8180
8180
  return new X.Text({ text: a, x: t, y: e, fontSize: i, fontFamily: s, fill: n, align: r, verticalAlign: o });
8181
8181
  }
8182
8182
  function _t(a = 0, t = 0) {
@@ -8189,11 +8189,11 @@ function Ri(a, t, e, i) {
8189
8189
  }
8190
8190
  a.add(new X.Rect({ x: 0, y: 0, width: at, height: e, name: "clip-resize-left" })), a.add(new X.Rect({ x: t - at, y: 0, width: at, height: e, name: "clip-resize-right" }));
8191
8191
  }
8192
- function ho(a, t, e, i) {
8192
+ function co(a, t, e, i) {
8193
8193
  const s = a.findOne(".clip-resize-left"), n = a.findOne(".clip-resize-right");
8194
8194
  return !s || !n ? !1 : (s.x(0), s.y(0), s.width(at), s.height(e), n.x(t - at), n.y(0), n.width(at), n.height(e), !0);
8195
8195
  }
8196
- function pn(a, t, e) {
8196
+ function Sn(a, t, e) {
8197
8197
  return e === "audio" ? {
8198
8198
  background: t ? a.clipSelectedBackground || a.audioClipBackground || a.clipBackground : a.audioClipBackground || a.clipBackground,
8199
8199
  label: t ? a.clipSelectedName || a.audioClipText || a.clipName : a.audioClipText || a.clipName,
@@ -8206,11 +8206,11 @@ function pn(a, t, e) {
8206
8206
  coverBackground: t ? a.clipSelectedCoverBackground || a.clipCoverBackground || "#FFF2A0" : a.clipCoverBackground || "#FFF2A0"
8207
8207
  };
8208
8208
  }
8209
- function co(a, t, e, i) {
8209
+ function uo(a, t, e, i) {
8210
8210
  const s = Tt(0, 0, t, e, i.background, "transparent", 0);
8211
8211
  s.cornerRadius(Math.min(4, Math.floor(t / 2))), s.name("clip-background"), a.add(s), Ri(a, t, e, !0);
8212
8212
  }
8213
- function uo(a, t, e) {
8213
+ function fo(a, t, e) {
8214
8214
  const i = Tt(0, 0, t.width, t.height, e.background, "transparent", 0);
8215
8215
  i.cornerRadius(4), i.name("clip-background"), a.add(i), Ri(a, t.width, t.height, !1);
8216
8216
  const s = 15, n = t.height - s - 4, r = t.width - at * 2, o = _t(at, 2);
@@ -8218,7 +8218,7 @@ function uo(a, t, e) {
8218
8218
  const l = Tt(0, 0, r, n, e.coverBackground, "transparent", 0);
8219
8219
  l.cornerRadius(2), l.name("clip-cover-background"), o.add(l);
8220
8220
  const h = _t(0, 0);
8221
- h.name("clip-covers-group"), o.add(h), Ct.renderClipCovers(
8221
+ h.name("clip-covers-group"), o.add(h), St.renderClipCovers(
8222
8222
  h,
8223
8223
  t.thumbnails ?? [],
8224
8224
  r,
@@ -8226,24 +8226,24 @@ function uo(a, t, e) {
8226
8226
  t.videoSrc,
8227
8227
  t.deferCoverRender
8228
8228
  );
8229
- const c = r >= 120 ? Di + fn : 0, d = gn(
8229
+ const c = r >= 120 ? Di + mn : 0, d = yn(
8230
8230
  `${t.clipName} ${z.formatDuration(t.duration)}`,
8231
8231
  at,
8232
8232
  t.height - s,
8233
- 10,
8233
+ pn,
8234
8234
  "Arial",
8235
8235
  e.label,
8236
8236
  "left",
8237
8237
  "middle"
8238
8238
  );
8239
- d.ellipsis(!0), d.width(Math.max(0, r - c)), d.height(s), d.name("clip-label"), a.add(d), c > 0 && mn(a, t.width, t.height, e.label, t.hasSeparatedAudio);
8239
+ d.ellipsis(!0), d.width(Math.max(0, r - c)), d.height(s), d.name("clip-label"), a.add(d), c > 0 && Cn(a, t.width, t.height, e.label, t.hasSeparatedAudio);
8240
8240
  }
8241
- function fo(a, t, e) {
8241
+ function go(a, t, e) {
8242
8242
  const i = a.findOne(".clip-background"), s = a.findOne(".clip-cover-container"), n = a.findOne(".clip-cover-background"), r = a.findOne(".clip-covers-group"), o = a.findOne(".clip-label");
8243
- if (!i || !s || !n || !r || !o || (i.width(t.width), i.height(t.height), i.fill(e.background), i.stroke("transparent"), i.strokeWidth(0), i.cornerRadius(4), !ho(a, t.width, t.height)))
8243
+ if (!i || !s || !n || !r || !o || (i.width(t.width), i.height(t.height), i.fill(e.background), i.stroke("transparent"), i.strokeWidth(0), i.cornerRadius(4), !co(a, t.width, t.height)))
8244
8244
  return !1;
8245
8245
  const l = 15, h = t.height - l - 4, c = t.width - at * 2;
8246
- s.x(at), s.y(2), s.clip({ x: 0, y: 0, width: c, height: h }), n.width(c), n.height(h), n.fill(e.coverBackground), n.cornerRadius(2), Ct.renderClipCovers(
8246
+ s.x(at), s.y(2), s.clip({ x: 0, y: 0, width: c, height: h }), n.width(c), n.height(h), n.fill(e.coverBackground), n.cornerRadius(2), St.renderClipCovers(
8247
8247
  r,
8248
8248
  t.thumbnails ?? [],
8249
8249
  c,
@@ -8251,10 +8251,10 @@ function fo(a, t, e) {
8251
8251
  t.videoSrc,
8252
8252
  t.deferCoverRender
8253
8253
  );
8254
- const d = c >= 120 ? Di + fn : 0;
8254
+ const d = c >= 120 ? Di + mn : 0;
8255
8255
  o.text(`${t.clipName} ${z.formatDuration(t.duration)}`), o.x(at), o.y(t.height - l), o.fill(e.label), o.width(Math.max(0, c - d)), o.height(l), o.ellipsis(!0);
8256
8256
  const u = a.findOne(".video-audio-status");
8257
- return u == null || u.destroy(), d > 0 && mn(a, t.width, t.height, e.label, t.hasSeparatedAudio), !0;
8257
+ return u == null || u.destroy(), d > 0 && Cn(a, t.width, t.height, e.label, t.hasSeparatedAudio), !0;
8258
8258
  }
8259
8259
  function ki(a, t, e, i, s, n, r) {
8260
8260
  return a.name(s), t.forEach((o, l) => {
@@ -8270,7 +8270,7 @@ function ki(a, t, e, i, s, n, r) {
8270
8270
  h.cornerRadius(1), h.name(`${s}-bar-${l}`), a.add(h);
8271
8271
  }), t.length * n + Math.max(0, t.length - 1) * r;
8272
8272
  }
8273
- function mn(a, t, e, i, s) {
8273
+ function Cn(a, t, e, i, s) {
8274
8274
  const n = _t(
8275
8275
  Math.max(at, t - at - Di),
8276
8276
  Math.max(0, e - 15)
@@ -8291,16 +8291,16 @@ function mn(a, t, e, i, s) {
8291
8291
  const o = Tt(0, 5, 3, 3, i, "transparent", 0);
8292
8292
  o.cornerRadius(1.5), o.name("video-audio-status-active-left-dot"), r.add(o);
8293
8293
  const l = _t(5, 0);
8294
- ki(l, lo, oo, i, "video-audio-status-active-bars", 2, 2), r.add(l);
8294
+ ki(l, ho, lo, i, "video-audio-status-active-bars", 2, 2), r.add(l);
8295
8295
  const h = Tt(25, 5, 3, 3, i, "transparent", 0);
8296
8296
  h.cornerRadius(1.5), h.name("video-audio-status-active-right-dot"), r.add(h), n.add(r), a.add(n);
8297
8297
  }
8298
- function go(a, t, e) {
8298
+ function po(a, t, e) {
8299
8299
  const i = Tt(0, 0, t.width, t.height, e.background, "transparent", 0);
8300
8300
  i.cornerRadius(6), i.name("clip-background"), a.add(i), Ri(a, t.width, t.height, !1);
8301
- const s = at + ds, n = Math.max(0, t.width - at * 2 - ds * 2), r = so, o = _t(s, r), l = ki(o, ao, 14, e.accent, "audio-clip-icon", 2, 2);
8301
+ const s = at + ds, n = Math.max(0, t.width - at * 2 - ds * 2), r = no, o = _t(s, r), l = ki(o, oo, 14, e.accent, "audio-clip-icon", 2, 2);
8302
8302
  a.add(o);
8303
- const h = s + l + ro, c = Math.max(0, s + n - h), d = 3 + ri, u = Math.min(fs.length, Math.floor((c + ri) / d));
8303
+ const h = s + l + ao, c = Math.max(0, s + n - h), d = 3 + ri, u = Math.min(fs.length, Math.floor((c + ri) / d));
8304
8304
  if (u > 0) {
8305
8305
  const g = _t(h, r);
8306
8306
  ki(
@@ -8313,11 +8313,11 @@ function go(a, t, e) {
8313
8313
  ri
8314
8314
  ), a.add(g);
8315
8315
  }
8316
- const p = gn(
8316
+ const p = yn(
8317
8317
  t.clipName,
8318
8318
  s,
8319
- t.height - no - us,
8320
- 12,
8319
+ t.height - ro - us,
8320
+ pn,
8321
8321
  "Arial",
8322
8322
  e.label,
8323
8323
  "left",
@@ -8325,27 +8325,27 @@ function go(a, t, e) {
8325
8325
  );
8326
8326
  p.ellipsis(!0), p.width(n), p.height(us), p.name("clip-label"), a.add(p);
8327
8327
  }
8328
- function yn(a, t) {
8329
- const e = t.width <= Xe, i = pn(t.theme, t.isSelected, t.clipType);
8328
+ function Tn(a, t) {
8329
+ const e = t.width <= Xe, i = Sn(t.theme, t.isSelected, t.clipType);
8330
8330
  if (a.destroyChildren(), e) {
8331
- co(a, t.width, t.height, i);
8331
+ uo(a, t.width, t.height, i);
8332
8332
  return;
8333
8333
  }
8334
8334
  if (t.clipType === "audio") {
8335
- go(a, t, i);
8335
+ po(a, t, i);
8336
8336
  return;
8337
8337
  }
8338
- uo(a, t, i);
8338
+ fo(a, t, i);
8339
8339
  }
8340
- function po(a, t) {
8340
+ function mo(a, t) {
8341
8341
  if (t.width <= Xe || t.clipType !== "video")
8342
8342
  return !1;
8343
- const i = pn(t.theme, t.isSelected, t.clipType);
8344
- return fo(a, t, i);
8343
+ const i = Sn(t.theme, t.isSelected, t.clipType);
8344
+ return go(a, t, i);
8345
8345
  }
8346
- function mo(a, t, e, i, s, n, r, o = !1, l, h, c = "video", d = !1, u = !1) {
8346
+ function yo(a, t, e, i, s, n, r, o = !1, l, h, c = "video", d = !1, u = !1) {
8347
8347
  const p = _t(a, t);
8348
- return p.clip({ x: 0, y: 0, width: e, height: i }), yn(p, {
8348
+ return p.clip({ x: 0, y: 0, width: e, height: i }), Tn(p, {
8349
8349
  width: e,
8350
8350
  height: i,
8351
8351
  clipName: s,
@@ -8359,7 +8359,7 @@ function mo(a, t, e, i, s, n, r, o = !1, l, h, c = "video", d = !1, u = !1) {
8359
8359
  deferCoverRender: u
8360
8360
  }), p;
8361
8361
  }
8362
- function yo(a, t, e, i, s, n, r = !1, o, l, h = "video", c = !1, d = !1) {
8362
+ function So(a, t, e, i, s, n, r = !1, o, l, h = "video", c = !1, d = !1) {
8363
8363
  a.clip({ x: 0, y: 0, width: t, height: e });
8364
8364
  const u = {
8365
8365
  width: t,
@@ -8374,7 +8374,7 @@ function yo(a, t, e, i, s, n, r = !1, o, l, h = "video", c = !1, d = !1) {
8374
8374
  hasSeparatedAudio: c,
8375
8375
  deferCoverRender: d
8376
8376
  };
8377
- po(a, u) || yn(a, u);
8377
+ mo(a, u) || Tn(a, u);
8378
8378
  }
8379
8379
  function Co(a, t, e, i) {
8380
8380
  return new X.Rect({
@@ -8397,7 +8397,7 @@ function wi(a, t = "#000000", e = 1) {
8397
8397
  lineJoin: "round"
8398
8398
  });
8399
8399
  }
8400
- function So(a, t, e, i = 12, s = "Arial", n = "#000000", r = "left", o = "top") {
8400
+ function To(a, t, e, i = 12, s = "Arial", n = "#000000", r = "left", o = "top") {
8401
8401
  return new X.Text({
8402
8402
  text: a,
8403
8403
  x: t,
@@ -8409,17 +8409,17 @@ function So(a, t, e, i = 12, s = "Arial", n = "#000000", r = "left", o = "top")
8409
8409
  verticalAlign: o
8410
8410
  });
8411
8411
  }
8412
- function To(a = 0, t = 0) {
8412
+ function vo(a = 0, t = 0) {
8413
8413
  return new X.Group({ x: a, y: t });
8414
8414
  }
8415
- function vo(a, t, e, i, s, n, r, o) {
8415
+ function bo(a, t, e, i, s, n, r, o) {
8416
8416
  const l = o || i, h = r === "major" ? l * 0.6 : l * 0.3, c = wi(
8417
8417
  [t, e, t, e + h],
8418
8418
  n.timeTick,
8419
8419
  r === "major" ? 1 : 0.5
8420
8420
  );
8421
8421
  if (c.name("time-tick-line"), a.add(c), r === "major") {
8422
- const d = e + h + 5, u = So(
8422
+ const d = e + h + 5, u = To(
8423
8423
  z.formatTime(s),
8424
8424
  t,
8425
8425
  d,
@@ -8431,8 +8431,8 @@ function vo(a, t, e, i, s, n, r, o) {
8431
8431
  u.name("time-tick-text"), a.add(u);
8432
8432
  }
8433
8433
  }
8434
- function bo(a, t, e, i, s, n) {
8435
- const r = To(t, e);
8434
+ function ko(a, t, e, i, s, n) {
8435
+ const r = vo(t, e);
8436
8436
  for (let o = 0; o <= i; o += n)
8437
8437
  r.add(wi([o, 0, o, s], "#E0E0E0", 0.5));
8438
8438
  for (let o = 0; o <= s; o += n)
@@ -8529,25 +8529,25 @@ class it {
8529
8529
  * 绘制时间刻度
8530
8530
  */
8531
8531
  static drawTimeTick(t, e, i, s, n, r, o, l) {
8532
- vo(t, e, i, s, n, r, o, l);
8532
+ bo(t, e, i, s, n, r, o, l);
8533
8533
  }
8534
8534
  /**
8535
8535
  * 绘制网格线
8536
8536
  */
8537
8537
  static drawGrid(t, e, i, s, n, r) {
8538
- bo(t, e, i, s, n, r);
8538
+ ko(t, e, i, s, n, r);
8539
8539
  }
8540
8540
  /**
8541
8541
  * 清空图片缓存
8542
8542
  */
8543
8543
  static clearImageCache() {
8544
- Ct.clearImageCache();
8544
+ St.clearImageCache();
8545
8545
  }
8546
8546
  /**
8547
8547
  * 创建片段组
8548
8548
  */
8549
8549
  static createClipGroup(t, e, i, s, n, r, o, l = !1, h, c, d = "video", u = !1, p = !1) {
8550
- return mo(
8550
+ return yo(
8551
8551
  t,
8552
8552
  e,
8553
8553
  i,
@@ -8567,7 +8567,7 @@ class it {
8567
8567
  * 更新片段组
8568
8568
  */
8569
8569
  static updateClipGroup(t, e, i, s, n, r, o = !1, l, h, c = "video", d = !1, u = !1) {
8570
- yo(
8570
+ So(
8571
8571
  t,
8572
8572
  e,
8573
8573
  i,
@@ -8610,7 +8610,7 @@ function we(a) {
8610
8610
  function _e(a) {
8611
8611
  typeof window < "u" && (window.removeEventListener("mousemove", a.onPointerMove), window.removeEventListener("mouseup", a.onPointerEnd), window.removeEventListener("blur", a.onWindowBlur || a.onPointerEnd)), typeof document < "u" && document.removeEventListener("visibilitychange", a.onVisibilityChange);
8612
8612
  }
8613
- class Ll {
8613
+ class Dl {
8614
8614
  constructor(t, e, i, s, n, r) {
8615
8615
  f(this, "stage");
8616
8616
  f(this, "gridLayer");
@@ -8727,7 +8727,7 @@ class Ll {
8727
8727
  }
8728
8728
  }
8729
8729
  animateZoom(t, e) {
8730
- const i = this.config.zoom, s = En.DURATION, n = Date.now(), r = this.pixelToTime(e), o = () => {
8730
+ const i = this.config.zoom, s = In.DURATION, n = Date.now(), r = this.pixelToTime(e), o = () => {
8731
8731
  const l = Date.now() - n, h = Math.min(l / s, 1), c = this.easeOutCubic(h), d = i + (t - i) * c, u = z.timeToPixels(r, d), p = Math.max(0, u - (e - this.leftPadding));
8732
8732
  if (this.scrollLeft = p, this.config.zoom = d, this.onZoomChange(d), this.onScrollChange(p), this.render(), h < 1)
8733
8733
  this.animationFrameId = requestAnimationFrame(o);
@@ -8822,10 +8822,10 @@ class Ll {
8822
8822
  let g = 0;
8823
8823
  const y = 20;
8824
8824
  for (const T of p) {
8825
- const S = this.timeToPixel(T.time);
8826
- S >= -y && S <= t + y && (it.drawTimeTick(
8825
+ const C = this.timeToPixel(T.time);
8826
+ C >= -y && C <= t + y && (it.drawTimeTick(
8827
8827
  this.gridLayer,
8828
- S,
8828
+ C,
8829
8829
  0,
8830
8830
  this.timeScaleHeight,
8831
8831
  T.time,
@@ -8925,17 +8925,17 @@ const ge = 8;
8925
8925
  function ht(a, t, e) {
8926
8926
  return it.timeToPixels(a, t) - e + ot;
8927
8927
  }
8928
- function St(a, t) {
8928
+ function Ct(a, t) {
8929
8929
  const e = it.timeToPixels(a, t);
8930
8930
  return a <= 1e3 || e <= Xe ? Xe : e;
8931
8931
  }
8932
8932
  function gs(a, t) {
8933
- const e = ht(a.startTime, a.zoom, a.scrollLeft), i = St(a.duration, a.zoom);
8933
+ const e = ht(a.startTime, a.zoom, a.scrollLeft), i = Ct(a.duration, a.zoom);
8934
8934
  return e + i > 0 && e < t;
8935
8935
  }
8936
- function ko(a) {
8936
+ function wo(a) {
8937
8937
  for (const t of a.clips) {
8938
- const e = ht(t.startTime, a.zoom, a.scrollLeft), i = St(t.duration, a.zoom), s = a.y >= a.trackY && a.y <= a.trackY + a.trackHeight;
8938
+ const e = ht(t.startTime, a.zoom, a.scrollLeft), i = Ct(t.duration, a.zoom), s = a.y >= a.trackY && a.y <= a.trackY + a.trackHeight;
8939
8939
  if (a.x >= e && a.x <= e + ge && s || a.x >= e + i - ge && a.x <= e + i && s)
8940
8940
  return "ew-resize";
8941
8941
  if (a.x > e + ge && a.x < e + i - ge && s)
@@ -8948,7 +8948,7 @@ class ai {
8948
8948
  f(this, "clip");
8949
8949
  f(this, "onUpdate");
8950
8950
  f(this, "onSplit");
8951
- this.clip = Ds(
8951
+ this.clip = Os(
8952
8952
  {
8953
8953
  ...t,
8954
8954
  endTime: z.calculateEndTime(t.startTime, t.duration)
@@ -8981,7 +8981,7 @@ class ai {
8981
8981
  }, this.onUpdate(this.clip);
8982
8982
  }
8983
8983
  isPointInResizeHandle(t, e, i, s, n, r) {
8984
- const o = ht(this.clip.startTime, i, r), l = St(this.clip.duration, i), h = ge;
8984
+ const o = ht(this.clip.startTime, i, r), l = Ct(this.clip.duration, i), h = ge;
8985
8985
  return e < s || e > s + n ? (this.setResizeHandleState(!1, !1), !1) : t >= o && t <= o + h ? (this.setResizeHandleState(!0, !1), !0) : t >= o + l - h && t <= o + l ? (this.setResizeHandleState(!1, !0), !0) : (this.setResizeHandleState(!1, !1), !1);
8986
8986
  }
8987
8987
  startDrag(t) {
@@ -9035,7 +9035,7 @@ function Zt(a) {
9035
9035
  function ve(a) {
9036
9036
  return !a || a.kind === "idle" || a.kind === "boxSelecting" ? null : a.kind === "pressed" ? a.operation : a.kind === "draggingResizeLeft" ? "resize-left" : a.kind === "draggingResizeRight" ? "resize-right" : "move";
9037
9037
  }
9038
- function wo(a) {
9038
+ function _o(a) {
9039
9039
  const t = ve(a);
9040
9040
  return t ? t === "move" ? "grabbing" : "ew-resize" : null;
9041
9041
  }
@@ -9111,9 +9111,9 @@ function Be(a, t) {
9111
9111
  }
9112
9112
  } : { state: a, effects: {} };
9113
9113
  if (t.type === "POINTER_MOVE") {
9114
- const i = Po(a.context, t, ve(a) || "move");
9115
- return a.kind === "pressed" ? xo(a.context, t.activationThreshold, t.clientX, t.clientY) ? {
9116
- state: _o(a.operation, i),
9114
+ const i = xo(a.context, t, ve(a) || "move");
9115
+ return a.kind === "pressed" ? Ao(a.context, t.activationThreshold, t.clientX, t.clientY) ? {
9116
+ state: Po(a.operation, i),
9117
9117
  effects: {
9118
9118
  updatePreview: !0
9119
9119
  }
@@ -9150,7 +9150,7 @@ function Be(a, t) {
9150
9150
  }
9151
9151
  };
9152
9152
  }
9153
- function _o(a, t) {
9153
+ function Po(a, t) {
9154
9154
  return a === "resize-left" ? {
9155
9155
  kind: "draggingResizeLeft",
9156
9156
  context: t
@@ -9162,7 +9162,7 @@ function _o(a, t) {
9162
9162
  context: t
9163
9163
  };
9164
9164
  }
9165
- function Po(a, t, e) {
9165
+ function xo(a, t, e) {
9166
9166
  const i = e === "move";
9167
9167
  return {
9168
9168
  ...a,
@@ -9172,12 +9172,12 @@ function Po(a, t, e) {
9172
9172
  crossTrackDragOffsetY: i ? t.localY - a.pointerStartY : 0
9173
9173
  };
9174
9174
  }
9175
- function xo(a, t, e, i) {
9175
+ function Ao(a, t, e, i) {
9176
9176
  const s = e - a.pointerStartClientX, n = i - a.pointerStartClientY;
9177
9177
  return Math.hypot(s, n) >= Math.max(0, t);
9178
9178
  }
9179
9179
  const yt = class yt {
9180
- constructor(t, e, i, s, n, r, o, l, h, c, d, u, p, g, y, T, S, v, b, k, M, _, R, A, I, D = yt.DEFAULT_DRAG_ACTIVATION_THRESHOLD, N = !1, G = yt.DEFAULT_CLIP_SNAP_THRESHOLD) {
9180
+ constructor(t, e, i, s, n, r, o, l, h, c, d, u, p, g, y, T, C, v, b, k, M, _, R, A, I, D = yt.DEFAULT_DRAG_ACTIVATION_THRESHOLD, N = !1, G = yt.DEFAULT_CLIP_SNAP_THRESHOLD) {
9181
9181
  f(this, "layer");
9182
9182
  f(this, "trackGroup");
9183
9183
  f(this, "dragOverlayLayer", null);
@@ -9258,7 +9258,7 @@ const yt = class yt {
9258
9258
  }
9259
9259
  this.startEdgeAutoScroll();
9260
9260
  });
9261
- this.layer = t, this.config = e, this.theme = o, this.trackType = i, this.zoom = s, this.trackY = n, this.trackHeight = r, this.onClipUpdate = l, this.onClipAdd = h, this.onClipRemove = c, this.onClipSplit = d, this.onClipSelect = u, this.onTimeJump = p, this.onHorizontalDragAutoScroll = g, this.onClipOverlap = y, this.onClipCrossTrackPreview = T, this.onClipCrossTrack = S, this.onClearDropPreview = v, this.onClearSelection = b, this.onSnapGuideChange = k, this.onClipToggleSelection = M, this.onSetSingleSelection = _, this.getMultiDragClipIds = R, this.onMultiDragMove = A, this.onMultiDragInteractionEnd = I, this.dragActivationThreshold = Math.max(0, D), this.enableClipSnap = N, this.clipSnapThreshold = Math.max(0, G), this.trackGroup = it.createGroup(0, n), this.layer.add(this.trackGroup), this.initClips(), this.initEventListeners(), this.render();
9261
+ this.layer = t, this.config = e, this.theme = o, this.trackType = i, this.zoom = s, this.trackY = n, this.trackHeight = r, this.onClipUpdate = l, this.onClipAdd = h, this.onClipRemove = c, this.onClipSplit = d, this.onClipSelect = u, this.onTimeJump = p, this.onHorizontalDragAutoScroll = g, this.onClipOverlap = y, this.onClipCrossTrackPreview = T, this.onClipCrossTrack = C, this.onClearDropPreview = v, this.onClearSelection = b, this.onSnapGuideChange = k, this.onClipToggleSelection = M, this.onSetSingleSelection = _, this.getMultiDragClipIds = R, this.onMultiDragMove = A, this.onMultiDragInteractionEnd = I, this.dragActivationThreshold = Math.max(0, D), this.enableClipSnap = N, this.clipSnapThreshold = Math.max(0, G), this.trackGroup = it.createGroup(0, n), this.layer.add(this.trackGroup), this.initClips(), this.initEventListeners(), this.render();
9262
9262
  }
9263
9263
  initClips() {
9264
9264
  this.clips = this.config.clips.map((t) => {
@@ -9277,7 +9277,7 @@ const yt = class yt {
9277
9277
  return t.name("clip-drop-preview"), t.visible(!1), t.listening(!1), this.trackGroup.add(t), this.dropPreviewGroup = t, t;
9278
9278
  }
9279
9279
  createDropPreviewRect(t) {
9280
- const e = this.trackType === "video" ? "rgba(80, 227, 194, 0.18)" : "rgba(181, 186, 255, 0.18)", i = this.trackType === "video" ? "#50e3c2" : "#b5baff", s = ht(t.startTime, this.zoom, this.scrollLeft), n = St(t.duration, this.zoom), r = it.createRect(s, 2, Math.max(n, 1), Math.max(this.trackHeight - 4, 1), e, i, 1);
9280
+ const e = this.trackType === "video" ? "rgba(80, 227, 194, 0.18)" : "rgba(181, 186, 255, 0.18)", i = this.trackType === "video" ? "#50e3c2" : "#b5baff", s = ht(t.startTime, this.zoom, this.scrollLeft), n = Ct(t.duration, this.zoom), r = it.createRect(s, 2, Math.max(n, 1), Math.max(this.trackHeight - 4, 1), e, i, 1);
9281
9281
  return r.dash([6, 4]), r.cornerRadius(4), r.listening(!1), r.visible(s + n > 0 && s < this.layer.width()), r;
9282
9282
  }
9283
9283
  showDropPreview(t) {
@@ -9327,12 +9327,11 @@ const yt = class yt {
9327
9327
  handleTrackBackgroundMouseDown(t) {
9328
9328
  }
9329
9329
  updateClipSelection(t, e) {
9330
- var s;
9331
- const i = this.clips.find((n) => n.getClip().id === t);
9332
- i && (this.isVisualUpdate = !0, i.setSelected(e), this.isVisualUpdate = !1, e ? (this.selectedClipIds.add(t), this.selectedClip = i, this.hasSelectedClip = !0) : (this.selectedClipIds.delete(t), ((s = this.selectedClip) == null ? void 0 : s.getClip().id) === t && (this.selectedClip = null, this.hasSelectedClip = !1)), this.updateClipGroup(i.getClip()), this.layer.batchDraw());
9330
+ const i = this.clips.find((s) => s.getClip().id === t);
9331
+ i && (this.isVisualUpdate = !0, i.setSelected(e), this.isVisualUpdate = !1, e ? this.selectedClipIds.add(t) : this.selectedClipIds.delete(t), this.syncSelectionState(t), this.updateClipGroup(i.getClip()), this.render(!1), this.layer.batchDraw());
9333
9332
  }
9334
9333
  createClipGroup(t) {
9335
- const e = ht(t.startTime, this.zoom, this.scrollLeft), i = St(t.duration, this.zoom), s = 2, n = this.trackHeight - 4, r = it.createClipGroup(
9334
+ const e = ht(t.startTime, this.zoom, this.scrollLeft), i = Ct(t.duration, this.zoom), s = 2, n = this.trackHeight - 4, r = it.createClipGroup(
9336
9335
  e,
9337
9336
  s,
9338
9337
  i,
@@ -9392,11 +9391,11 @@ const yt = class yt {
9392
9391
  const p = u.getBoundingClientRect(), g = e.clientX - p.left, y = e.clientY - p.top;
9393
9392
  if (s) {
9394
9393
  this.multiDragOriginalPositions.clear();
9395
- for (const S of this.selectedClipIds) {
9396
- const v = this.clips.find((b) => b.getClip().id === S);
9394
+ for (const C of this.selectedClipIds) {
9395
+ const v = this.clips.find((b) => b.getClip().id === C);
9397
9396
  if (v) {
9398
9397
  const b = v.getClip();
9399
- this.multiDragOriginalPositions.set(S, {
9398
+ this.multiDragOriginalPositions.set(C, {
9400
9399
  startTime: b.startTime,
9401
9400
  duration: b.duration
9402
9401
  });
@@ -9458,7 +9457,7 @@ const yt = class yt {
9458
9457
  applyInteractionTransition(t) {
9459
9458
  var i, s;
9460
9459
  this.interactionState = t.state, this.syncLegacyInteractionMirror(t.state), t.effects.bindGlobalListeners && this.bindGlobalPointerListenersForDrag();
9461
- const e = wo(t.state);
9460
+ const e = _o(t.state);
9462
9461
  e && this.lockPointerCursor(e), t.effects.cleanup && (this.releasePointerCursor(), this.hideDropPreview(), (i = this.onClearDropPreview) == null || i.call(this), this.updateSnapGuideLine(null), this.stopEdgeAutoScroll(), this.clearClipDragOverlay(), this.multiDragOriginalPositions.size > 0 && ((s = this.onMultiDragInteractionEnd) == null || s.call(this), this.multiDragOriginalPositions.clear())), t.effects.unbindGlobalListeners && this.unbindGlobalPointerListenersForDrag();
9463
9462
  }
9464
9463
  resolveInteractionState(t = this.interactionState) {
@@ -9494,7 +9493,7 @@ const yt = class yt {
9494
9493
  e.hasDragMoved = Te(t), e.activePointerOperation = ve(t), e.originalClipsState = (i == null ? void 0 : i.originalClipsState) ?? [], e.nonDraggedClips = (i == null ? void 0 : i.nonDraggedClips) ?? [], e.snapCandidateClips = (i == null ? void 0 : i.snapCandidateClips) ?? [], e.dragStartY = (i == null ? void 0 : i.pointerStartY) ?? 0, e.dragTargetTrackY = (i == null ? void 0 : i.dragTargetTrackY) ?? 0, e.crossTrackDragOffsetY = (i == null ? void 0 : i.crossTrackDragOffsetY) ?? 0, e.crossTrackDragStartX = (i == null ? void 0 : i.pointerStartX) ?? 0, e.dragStartScrollLeft = (i == null ? void 0 : i.dragStartScrollLeft) ?? 0, e.dragGestureStartClientX = (i == null ? void 0 : i.pointerStartClientX) ?? null, e.dragGestureStartClientY = (i == null ? void 0 : i.pointerStartClientY) ?? null, e.lastDragClientX = (i == null ? void 0 : i.lastPointerClientX) ?? null, e.lastDragClientY = (i == null ? void 0 : i.lastPointerClientY) ?? null;
9495
9494
  }
9496
9495
  handleClipMoveEnd(t, e) {
9497
- var T, S, v;
9496
+ var T, C, v;
9498
9497
  const i = this.resolveInteractionState(e), s = this, n = Zt(i) || {
9499
9498
  clipId: t.id,
9500
9499
  originalClipsState: Array.isArray(s.originalClipsState) ? s.originalClipsState : [t],
@@ -9515,7 +9514,7 @@ const yt = class yt {
9515
9514
  isFinal: !0
9516
9515
  })) {
9517
9516
  for (const D of this.selectedClipIds) {
9518
- const N = (S = this.clipGroups) == null ? void 0 : S.get(D);
9517
+ const N = (C = this.clipGroups) == null ? void 0 : C.get(D);
9519
9518
  N == null || N.y(2);
9520
9519
  }
9521
9520
  this.multiDragOriginalPositions.clear();
@@ -9632,7 +9631,7 @@ const yt = class yt {
9632
9631
  if (!s || this.isDragSessionActive())
9633
9632
  return;
9634
9633
  const n = s.getBoundingClientRect(), r = t - n.left, o = e - n.top;
9635
- s.style.cursor = ko({
9634
+ s.style.cursor = wo({
9636
9635
  clips: this.clips.map((l) => l.getClip()),
9637
9636
  zoom: this.zoom,
9638
9637
  scrollLeft: this.scrollLeft,
@@ -9675,7 +9674,7 @@ const yt = class yt {
9675
9674
  updateClipGroup(t, e = !1) {
9676
9675
  const i = this.clipGroups.get(t.id);
9677
9676
  if (i) {
9678
- const s = ht(t.startTime, this.zoom, this.scrollLeft), n = St(t.duration, this.zoom);
9677
+ const s = ht(t.startTime, this.zoom, this.scrollLeft), n = Ct(t.duration, this.zoom);
9679
9678
  i.x(s), i.visible(gs({
9680
9679
  startTime: t.startTime,
9681
9680
  duration: t.duration,
@@ -9700,20 +9699,19 @@ const yt = class yt {
9700
9699
  }
9701
9700
  }
9702
9701
  handleClipUpdate(t) {
9703
- var i, s;
9704
- const e = this.clips.findIndex((n) => n.getClip().id === t.id);
9702
+ const e = this.clips.findIndex((i) => i.getClip().id === t.id);
9705
9703
  if (e !== -1) {
9706
- const n = this.clips[e].getClip(), r = {
9704
+ const i = this.clips[e].getClip(), s = {
9707
9705
  ...t,
9708
- isSelected: this.isVisualUpdate || ((i = this.selectedClip) == null ? void 0 : i.getClip().id) === t.id ? t.isSelected : !1
9706
+ isSelected: this.isVisualUpdate ? t.isSelected : this.selectedClipIds.has(t.id)
9709
9707
  };
9710
9708
  this.clips[e] = new ai(
9711
- r,
9709
+ s,
9712
9710
  this.handleClipUpdate.bind(this),
9713
9711
  this.handleClipSplit.bind(this)
9714
- ), ((s = this.selectedClip) == null ? void 0 : s.getClip().id) === t.id && (this.selectedClip = this.clips[e]), this.updateClipGroup(r);
9715
- const o = this.clipGroups.get(t.id);
9716
- o && o.opacity(r.opacity), this.isVisualUpdate || this.onClipUpdate(r, n), this.layer.batchDraw();
9712
+ ), this.syncSelectionState(t.id), this.updateClipGroup(s);
9713
+ const n = this.clipGroups.get(t.id);
9714
+ n && n.opacity(s.opacity), this.isVisualUpdate || this.onClipUpdate(s, i), this.layer.batchDraw();
9717
9715
  }
9718
9716
  }
9719
9717
  handleClipSplit(t, e) {
@@ -9749,12 +9747,11 @@ const yt = class yt {
9749
9747
  this.clips.push(i), this.createClipGroup(e), this.onClipAdd(e), this.layer.batchDraw();
9750
9748
  }
9751
9749
  removeClip(t) {
9752
- var i;
9753
- const e = this.clips.findIndex((s) => s.getClip().id === t);
9750
+ const e = this.clips.findIndex((i) => i.getClip().id === t);
9754
9751
  if (e !== -1) {
9755
- this.clips.splice(e, 1), ((i = this.selectedClip) == null ? void 0 : i.getClip().id) === t && (this.selectedClip = null);
9756
- const s = this.clipGroups.get(t);
9757
- s && (this.getPromotedClipParents().delete(t), s.remove(), this.clipGroups.delete(t)), this.onClipRemove(t), this.hideDropPreview(), this.layer.batchDraw();
9752
+ this.clips.splice(e, 1), this.selectedClipIds.delete(t), this.syncSelectionState();
9753
+ const i = this.clipGroups.get(t);
9754
+ i && (this.getPromotedClipParents().delete(t), i.remove(), this.clipGroups.delete(t)), this.onClipRemove(t), this.hideDropPreview(), this.render(!1), this.layer.batchDraw();
9758
9755
  }
9759
9756
  }
9760
9757
  updateClip(t, e) {
@@ -9848,15 +9845,10 @@ const yt = class yt {
9848
9845
  return this.selectedClip ? this.selectedClip.getClip() : null;
9849
9846
  }
9850
9847
  clearSelection() {
9851
- this.selectedClipIds.clear(), this.updateSelectionVisual(null);
9848
+ this.selectedClipIds.clear(), this.applySelectionVisual(null), this.syncSelectionState(), this.render();
9852
9849
  }
9853
9850
  updateSelectionVisual(t) {
9854
- if (this.applySelectionVisual(t), t) {
9855
- const e = this.clips.find((i) => i.getClip().id === t);
9856
- this.selectedClip = e || null, this.hasSelectedClip = !!e;
9857
- } else
9858
- this.selectedClip = null, this.hasSelectedClip = !1;
9859
- this.render();
9851
+ this.applySelectionVisual(t), this.selectedClipIds = t ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set(), this.syncSelectionState(t ?? void 0), this.render();
9860
9852
  }
9861
9853
  selectClip(t) {
9862
9854
  const e = this.clips.find((i) => i.getClip().id === t);
@@ -9873,6 +9865,16 @@ const yt = class yt {
9873
9865
  this.isVisualUpdate = !1;
9874
9866
  }
9875
9867
  }
9868
+ syncSelectionState(t) {
9869
+ var r;
9870
+ const e = this.clips.filter((o) => this.selectedClipIds.has(o.getClip().id)), s = e.length > 0 ? e : this.clips.filter((o) => o.getClip().isSelected);
9871
+ if (this.selectedClipIds = new Set(s.map((o) => o.getClip().id)), this.hasSelectedClip = s.length > 0, !this.hasSelectedClip) {
9872
+ this.selectedClip = null;
9873
+ return;
9874
+ }
9875
+ const n = t ?? ((r = this.selectedClip) == null ? void 0 : r.getClip().id) ?? null;
9876
+ this.selectedClip = s.find((o) => o.getClip().id === n) ?? s[s.length - 1] ?? null;
9877
+ }
9876
9878
  splitSelectedClip(t) {
9877
9879
  const e = this.clips.find((i) => {
9878
9880
  const s = i.getClip();
@@ -9916,7 +9918,7 @@ const yt = class yt {
9916
9918
  const h = ht(e, this.zoom, this.scrollLeft);
9917
9919
  o.x(h), o.y(this.resolveClipRenderY(t, s)), o.moveToTop(), it.updateClipGroup(
9918
9920
  o,
9919
- St(r.duration, this.zoom),
9921
+ Ct(r.duration, this.zoom),
9920
9922
  this.trackHeight - 4,
9921
9923
  r.name,
9922
9924
  r.duration,
@@ -9978,7 +9980,7 @@ const yt = class yt {
9978
9980
  this.resolveSnapTargetClips = t;
9979
9981
  }
9980
9982
  updateDraggedClipFromPointer(t, e, i) {
9981
- var T, S, v, b, k;
9983
+ var T, C, v, b, k;
9982
9984
  const s = this.resolveInteractionState(), n = Zt(s), r = ve(s), o = this.layer.getStage();
9983
9985
  if (!o || !this.selectedClip || !n || !r) return;
9984
9986
  const l = o.container();
@@ -9998,10 +10000,10 @@ const yt = class yt {
9998
10000
  return;
9999
10001
  const R = this.buildPreviewClip(g, _, c, n, r);
10000
10002
  if (!R) {
10001
- this.hideDropPreview(), (S = this.onClearDropPreview) == null || S.call(this), this.updateSnapGuideLine(null);
10003
+ this.hideDropPreview(), (C = this.onClearDropPreview) == null || C.call(this), this.updateSnapGuideLine(null);
10002
10004
  return;
10003
10005
  }
10004
- const A = R.clip, I = A.startTime - _.startTime, D = this.applyPreviewClipState(A), N = ht(A.startTime, this.zoom, this.scrollLeft), G = St(A.duration, this.zoom);
10006
+ const A = R.clip, I = A.startTime - _.startTime, D = this.applyPreviewClipState(A), N = ht(A.startTime, this.zoom, this.scrollLeft), G = Ct(A.duration, this.zoom);
10005
10007
  y.x(N), y.y(this.resolveClipRenderY(g.id, n.crossTrackDragOffsetY)), y.visible(N + G > 0 && N < this.layer.width()), D && (this.updateClipGroup(A), y.y(this.resolveClipRenderY(g.id, n.crossTrackDragOffsetY)));
10006
10008
  let W = !1;
10007
10009
  if (p) {
@@ -10021,12 +10023,12 @@ const yt = class yt {
10021
10023
  if (B) {
10022
10024
  const U = ht(j, this.zoom, this.scrollLeft);
10023
10025
  B.x(U), B.y(this.resolveClipRenderY(F, n.crossTrackDragOffsetY)), B.visible(
10024
- U + St(H.duration, this.zoom) > 0 && U < this.layer.width()
10026
+ U + Ct(H.duration, this.zoom) > 0 && U < this.layer.width()
10025
10027
  );
10026
10028
  const q = L.getClip();
10027
10029
  it.updateClipGroup(
10028
10030
  B,
10029
- St(q.duration, this.zoom),
10031
+ Ct(q.duration, this.zoom),
10030
10032
  this.trackHeight - 4,
10031
10033
  q.name,
10032
10034
  q.duration,
@@ -10279,7 +10281,7 @@ const yt = class yt {
10279
10281
  };
10280
10282
  f(yt, "DEFAULT_DRAG_ACTIVATION_THRESHOLD", 4), f(yt, "DEFAULT_CLIP_SNAP_THRESHOLD", 8), f(yt, "AUTO_SCROLL_EDGE_THRESHOLD", 48), f(yt, "AUTO_SCROLL_MAX_SPEED", 18);
10281
10283
  let _i = yt;
10282
- class Dl {
10284
+ class Rl {
10283
10285
  constructor(t, e, i, s, n, r) {
10284
10286
  f(this, "layer");
10285
10287
  f(this, "playheadGroup");
@@ -10351,7 +10353,7 @@ class Dl {
10351
10353
  return this.playheadGroup;
10352
10354
  }
10353
10355
  }
10354
- class Ao {
10356
+ class Eo {
10355
10357
  constructor(t, e, i, s) {
10356
10358
  f(this, "container");
10357
10359
  f(this, "tracks", []);
@@ -10421,7 +10423,7 @@ class Ao {
10421
10423
  this.trackList = null, this.container.innerHTML = "";
10422
10424
  }
10423
10425
  }
10424
- const Eo = {
10426
+ const Io = {
10425
10427
  backgroundColor: "#1e1e1e",
10426
10428
  borderColor: "#333",
10427
10429
  textColor: "#e0e0e0",
@@ -10452,11 +10454,11 @@ const Eo = {
10452
10454
  presetButton: "clip-config-preset-button",
10453
10455
  resetButton: "clip-config-reset-button",
10454
10456
  emptyState: "clip-config-empty-state"
10455
- }, Io = {
10457
+ }, Mo = {
10456
10458
  visual: "画面",
10457
10459
  audio: "音频"
10458
10460
  };
10459
- class Mo {
10461
+ class Lo {
10460
10462
  constructor(t) {
10461
10463
  f(this, "container");
10462
10464
  f(this, "rootElement", null);
@@ -10476,7 +10478,7 @@ class Mo {
10476
10478
  f(this, "scaleInput", null);
10477
10479
  f(this, "volumeSlider", null);
10478
10480
  f(this, "volumeInput", null);
10479
- this.container = t.container, this.theme = t.theme ?? Eo, this.onClipUpdate = t.onClipUpdate, this.render();
10481
+ this.container = t.container, this.theme = t.theme ?? Io, this.onClipUpdate = t.onClipUpdate, this.render();
10480
10482
  }
10481
10483
  setClip(t) {
10482
10484
  this.currentClip = t, (t == null ? void 0 : t.type) === "video" ? this.activeTab = "visual" : (t == null ? void 0 : t.type) === "audio" && (this.activeTab = "audio"), this.render();
@@ -10508,7 +10510,7 @@ class Mo {
10508
10510
  const t = this.getAvailableTabs();
10509
10511
  this.tabBar = document.createElement("div"), this.tabBar.className = Z.tabBar, this.tabBar.style.display = "flex", this.tabBar.style.gap = "12px", this.tabBar.style.padding = "4px", this.tabBar.style.backgroundColor = "#2a2a2a", this.tabBar.style.borderRadius = "4px 4px 0 0", t.forEach((e) => {
10510
10512
  const i = document.createElement("button");
10511
- i.className = Z.tabButton, i.textContent = Io[e], i.style.lineHeight = "22px", i.style.padding = "0 6px", i.style.border = "none", i.style.cursor = "pointer", i.style.fontSize = "13px", i.style.fontFamily = "inherit", i.style.transition = "background-color 0.15s, color 0.15s";
10513
+ i.className = Z.tabButton, i.textContent = Mo[e], i.style.lineHeight = "22px", i.style.padding = "0 6px", i.style.border = "none", i.style.cursor = "pointer", i.style.fontSize = "13px", i.style.fontFamily = "inherit", i.style.transition = "background-color 0.15s, color 0.15s";
10512
10514
  const s = this.activeTab === e;
10513
10515
  i.style.backgroundColor = s ? "#595A5D" : "transparent", i.style.color = s ? "#fff" : "#b5b6bf", i.style.borderRadius = "4px", i.addEventListener("click", () => {
10514
10516
  this.activeTab = e, this.updateTabBarState(), this.updateContentVisibility();
@@ -10552,7 +10554,7 @@ class Mo {
10552
10554
  t.className = Z.actionBar, t.style.borderTop = `1px solid ${this.theme.borderColor}`, t.style.borderRadius = "0 0 4px 4px", t.style.minHeight = "36px", t.style.backgroundColor = "#2a2a2a", this.rootElement.appendChild(t);
10553
10555
  }
10554
10556
  renderPositionControl(t, e, i) {
10555
- var u, p, g, y, T, S;
10557
+ var u, p, g, y, T, C;
10556
10558
  const s = document.createElement("div");
10557
10559
  s.className = Z.row, s.style.display = "flex", s.style.alignItems = "center", s.style.gap = "8px", s.style.marginBottom = "8px";
10558
10560
  const n = document.createElement("label");
@@ -10563,7 +10565,7 @@ class Mo {
10563
10565
  this.handleTransformChange(i, b);
10564
10566
  }), s.appendChild(c);
10565
10567
  const d = document.createElement("input");
10566
- d.type = "number", d.className = Z.input, d.min = String(l), d.max = String(h), d.step = "0.01", d.value = String(((S = (T = this.currentClip) == null ? void 0 : T.visualTransform) == null ? void 0 : S[i]) ?? 0.5), d.style.width = "60px", d.style.padding = "4px 6px", d.style.border = `1px solid ${this.theme.inputBorder}`, d.style.borderRadius = "4px", d.style.fontSize = "12px", d.style.backgroundColor = this.theme.inputBackground, d.style.color = this.theme.textColor, d.addEventListener("change", (v) => {
10568
+ d.type = "number", d.className = Z.input, d.min = String(l), d.max = String(h), d.step = "0.01", d.value = String(((C = (T = this.currentClip) == null ? void 0 : T.visualTransform) == null ? void 0 : C[i]) ?? 0.5), d.style.width = "60px", d.style.padding = "4px 6px", d.style.border = `1px solid ${this.theme.inputBorder}`, d.style.borderRadius = "4px", d.style.fontSize = "12px", d.style.backgroundColor = this.theme.inputBackground, d.style.color = this.theme.textColor, d.addEventListener("change", (v) => {
10567
10569
  const b = parseFloat(v.target.value);
10568
10570
  this.handleTransformChange(i, b);
10569
10571
  }), s.appendChild(d), i === "x" ? (this.xSlider = c, this.xInput = d) : (this.ySlider = c, this.yInput = d), t.appendChild(s);
@@ -10837,9 +10839,9 @@ class ps {
10837
10839
  targetTrackId: v
10838
10840
  };
10839
10841
  }
10840
- const S = p + y;
10841
- if (S < u.length) {
10842
- const v = u[S], b = r.find((k) => this.resolveTrackId(k) === v);
10842
+ const C = p + y;
10843
+ if (C < u.length) {
10844
+ const v = u[C], b = r.find((k) => this.resolveTrackId(k) === v);
10843
10845
  if (b && !this.hasOverlapOnTrack(t, b))
10844
10846
  return {
10845
10847
  status: "move_to_track",
@@ -11342,7 +11344,7 @@ class ys {
11342
11344
  } : null;
11343
11345
  }
11344
11346
  }
11345
- const Lo = [
11347
+ const Do = [
11346
11348
  "type",
11347
11349
  "externalId",
11348
11350
  "src",
@@ -11359,11 +11361,11 @@ const Lo = [
11359
11361
  "visualTransform",
11360
11362
  "separatedAudioClipId",
11361
11363
  "separatedFromVideoClipId"
11362
- ], Do = /* @__PURE__ */ new Set(["thumbnails"]);
11363
- function Ro(a, t) {
11364
+ ], Ro = /* @__PURE__ */ new Set(["thumbnails"]);
11365
+ function Oo(a, t) {
11364
11366
  return Object.is(a, t) ? !0 : a === void 0 || t === void 0 ? !1 : typeof a == "object" && typeof t == "object" ? JSON.stringify(a) === JSON.stringify(t) : !1;
11365
11367
  }
11366
- class Cs {
11368
+ class Ss {
11367
11369
  constructor(t) {
11368
11370
  this.history = t;
11369
11371
  }
@@ -11446,34 +11448,34 @@ class Cs {
11446
11448
  e.startTime
11447
11449
  );
11448
11450
  const r = {}, o = {};
11449
- return Lo.forEach((h) => {
11450
- Ro(t[h], e[h]) || (r[h] = t[h], o[h] = e[h]);
11451
- }), Object.keys(r).length === 0 || Object.keys(r).every((h) => Do.has(h)) ? null : this.history.createUpdateClipAction(t.id, r, o);
11451
+ return Do.forEach((h) => {
11452
+ Oo(t[h], e[h]) || (r[h] = t[h], o[h] = e[h]);
11453
+ }), Object.keys(r).length === 0 || Object.keys(r).every((h) => Ro.has(h)) ? null : this.history.createUpdateClipAction(t.id, r, o);
11452
11454
  }
11453
11455
  }
11454
11456
  function He(a) {
11455
11457
  a.notifySelectionChange(), a.emitSelectedClipChangeIfNeeded(), a.handleClipChange();
11456
11458
  }
11457
- function Oo(a) {
11459
+ function Go(a) {
11458
11460
  var t, e;
11459
11461
  a.notifySelectionChange(), (t = a.reloadClipThumbnailsIfNeeded) == null || t.call(a), (e = a.checkTrackDurationChange) == null || e.call(a), a.emitSelectedClipChangeIfNeeded(), a.handleClipChange();
11460
11462
  }
11461
- function Go(a, t, e = !1) {
11463
+ function Bo(a, t, e = !1) {
11462
11464
  if (!t || !e || a.type === "audio")
11463
11465
  return !1;
11464
11466
  const i = t.duration !== a.duration, s = t.startTimeAtSource !== a.startTimeAtSource || t.endTimeAtSource !== a.endTimeAtSource;
11465
11467
  return i || s;
11466
11468
  }
11467
- function Bo(a, t) {
11469
+ function Ho(a, t) {
11468
11470
  if (a.length === 0)
11469
11471
  return !1;
11470
11472
  const e = Math.max(...a.map((i) => i.endTime));
11471
11473
  return t < e;
11472
11474
  }
11473
- function Ho(a) {
11475
+ function zo(a) {
11474
11476
  return a.currentCanPlay === a.nextCanPlay ? a.currentCanPlay : (a.setCanPlay(a.nextCanPlay), a.currentCanPlay && !a.nextCanPlay && a.playState === "playing" && (a.pauseTimeline(), a.setCurrentTime(a.clipEndTime || 1)), a.emitCanPlayChange(a.nextCanPlay), a.nextCanPlay);
11475
11477
  }
11476
- function zo(a) {
11478
+ function No(a) {
11477
11479
  const t = !a.id && a.startTime > 0;
11478
11480
  return {
11479
11481
  shouldJumpToTime: t,
@@ -11485,7 +11487,7 @@ function We(a) {
11485
11487
  var t;
11486
11488
  return a.applied ? (a.isExecutingHistoryAction || (t = a.recordHistory) == null || t.call(a), a.applyEffects(), !0) : !1;
11487
11489
  }
11488
- function No(a) {
11490
+ function Fo(a) {
11489
11491
  return We({
11490
11492
  applied: a.applied,
11491
11493
  isExecutingHistoryAction: a.isExecutingHistoryAction,
@@ -11505,7 +11507,7 @@ function No(a) {
11505
11507
  applyEffects: a.applyEffects
11506
11508
  });
11507
11509
  }
11508
- function Fo(a) {
11510
+ function Vo(a) {
11509
11511
  var t;
11510
11512
  a.isExecutingHistoryAction || (t = a.recordSplitClip) == null || t.call(a, a.clip1, a.clip2), a.emitClipUpdated(a.clip1), a.emitClipAdded(a.clip2), a.applyEffects();
11511
11513
  }
@@ -11513,25 +11515,25 @@ const li = {
11513
11515
  x: 0.5,
11514
11516
  y: 0.5,
11515
11517
  scale: 1
11516
- }, Vo = 0.1, Wo = 8;
11518
+ }, Wo = 0.1, Yo = 8;
11517
11519
  function hi(a, t) {
11518
11520
  return typeof a == "number" && Number.isFinite(a) ? a : t;
11519
11521
  }
11520
- function Yo(a) {
11521
- return Math.min(Wo, Math.max(Vo, a));
11522
+ function Xo(a) {
11523
+ return Math.min(Yo, Math.max(Wo, a));
11522
11524
  }
11523
11525
  function gt(a) {
11524
11526
  return {
11525
11527
  x: hi(a == null ? void 0 : a.x, li.x),
11526
11528
  y: hi(a == null ? void 0 : a.y, li.y),
11527
- scale: Yo(hi(a == null ? void 0 : a.scale, li.scale))
11529
+ scale: Xo(hi(a == null ? void 0 : a.scale, li.scale))
11528
11530
  };
11529
11531
  }
11530
- function Cn(a, t, e = 1e-4) {
11532
+ function vn(a, t, e = 1e-4) {
11531
11533
  const i = gt(a), s = gt(t);
11532
11534
  return Math.abs(i.x - s.x) <= e && Math.abs(i.y - s.y) <= e && Math.abs(i.scale - s.scale) <= e;
11533
11535
  }
11534
- function Sn(a, t) {
11536
+ function bn(a, t) {
11535
11537
  if (a.width <= 0 || a.height <= 0)
11536
11538
  return {
11537
11539
  left: 0,
@@ -11554,8 +11556,8 @@ function Sn(a, t) {
11554
11556
  centerY: h + o / 2
11555
11557
  };
11556
11558
  }
11557
- function Ss(a, t, e) {
11558
- const i = Sn(a, t), s = gt(e), n = i.width * s.scale, r = i.height * s.scale, o = a.width * s.x, l = a.height * s.y;
11559
+ function Cs(a, t, e) {
11560
+ const i = bn(a, t), s = gt(e), n = i.width * s.scale, r = i.height * s.scale, o = a.width * s.x, l = a.height * s.y;
11559
11561
  return {
11560
11562
  left: o - n / 2,
11561
11563
  top: l - r / 2,
@@ -11565,7 +11567,7 @@ function Ss(a, t, e) {
11565
11567
  centerY: l
11566
11568
  };
11567
11569
  }
11568
- function Xo(a, t, e, i) {
11570
+ function Uo(a, t, e, i) {
11569
11571
  const s = gt(a), n = i.width > 0 ? i.width : 1, r = i.height > 0 ? i.height : 1;
11570
11572
  return gt({
11571
11573
  x: s.x + t / n,
@@ -11573,7 +11575,7 @@ function Xo(a, t, e, i) {
11573
11575
  scale: s.scale
11574
11576
  });
11575
11577
  }
11576
- function Uo(a, t, e, i, s, n) {
11578
+ function $o(a, t, e, i, s, n) {
11577
11579
  const r = gt(n), o = Math.max(s.width / 2, 1), l = Math.max(s.height / 2, 1), h = Math.abs(e - a) / o, c = Math.abs(i - t) / l;
11578
11580
  return gt({
11579
11581
  x: r.x,
@@ -11587,7 +11589,7 @@ function Ts(a) {
11587
11589
  const t = Number.parseFloat(a);
11588
11590
  return Number.isFinite(t) ? t : 0;
11589
11591
  }
11590
- class $o {
11592
+ class Ko {
11591
11593
  constructor(t = {}) {
11592
11594
  f(this, "frameElement", null);
11593
11595
  f(this, "overlayElement", null);
@@ -11700,7 +11702,7 @@ class $o {
11700
11702
  const i = this.toLocalPoint(e);
11701
11703
  let s = this.interaction.startTransform;
11702
11704
  if (this.interaction.mode === "move")
11703
- s = Xo(
11705
+ s = Uo(
11704
11706
  this.interaction.startTransform,
11705
11707
  i.x - this.interaction.pointerStart.x,
11706
11708
  i.y - this.interaction.pointerStart.y,
@@ -11708,7 +11710,7 @@ class $o {
11708
11710
  );
11709
11711
  else {
11710
11712
  const l = this.interaction.startTransform.x * this.interaction.frameSize.width, h = this.interaction.startTransform.y * this.interaction.frameSize.height;
11711
- s = Uo(
11713
+ s = $o(
11712
11714
  l,
11713
11715
  h,
11714
11716
  i.x,
@@ -11717,7 +11719,7 @@ class $o {
11717
11719
  this.interaction.startTransform
11718
11720
  );
11719
11721
  }
11720
- this.interaction.nextTransform = s, this.interaction.changed = !Cn(this.interaction.startTransform, s), (o = (r = this.callbacks).onPreviewTransformChange) == null || o.call(r, this.interaction.clipId, s);
11722
+ this.interaction.nextTransform = s, this.interaction.changed = !vn(this.interaction.startTransform, s), (o = (r = this.callbacks).onPreviewTransformChange) == null || o.call(r, this.interaction.clipId, s);
11721
11723
  }
11722
11724
  finishInteraction(t) {
11723
11725
  var i, s, n, r;
@@ -11774,14 +11776,14 @@ class $o {
11774
11776
  e && (e.style.cursor = t || "");
11775
11777
  }
11776
11778
  }
11777
- function Ko(a, t) {
11779
+ function jo(a, t) {
11778
11780
  return !pe(a.mode) || !t ? a : {
11779
11781
  mode: wt.mode,
11780
11782
  width: t.width,
11781
11783
  height: t.height
11782
11784
  };
11783
11785
  }
11784
- function jo(a) {
11786
+ function Zo(a) {
11785
11787
  return a.getAttribute("src") || a.currentSrc || a.src || "";
11786
11788
  }
11787
11789
  function vs(a) {
@@ -11799,7 +11801,7 @@ function qt(a) {
11799
11801
  } catch {
11800
11802
  }
11801
11803
  }
11802
- function Zo(a) {
11804
+ function qo(a) {
11803
11805
  var t;
11804
11806
  try {
11805
11807
  const e = a.play();
@@ -11825,7 +11827,7 @@ function ks(a) {
11825
11827
  const t = Number.parseFloat(a);
11826
11828
  return Number.isFinite(t) ? t : 0;
11827
11829
  }
11828
- class qo {
11830
+ class Jo {
11829
11831
  constructor(t = {}, e = {}) {
11830
11832
  f(this, "container", null);
11831
11833
  f(this, "rootElement", null);
@@ -11851,7 +11853,7 @@ class qo {
11851
11853
  f(this, "aspectRatioProbeSrc", null);
11852
11854
  f(this, "isAspectRatioProbeLoading", !1);
11853
11855
  f(this, "pendingState", null);
11854
- this.callbacks = t, this.dependencies = e, this.transformOverlay = new $o({
11856
+ this.callbacks = t, this.dependencies = e, this.transformOverlay = new Ko({
11855
11857
  onPreviewTransformChange: this.handlePreviewTransformChange.bind(this),
11856
11858
  onPreviewTransformCommit: (i, s) => {
11857
11859
  var n, r;
@@ -11914,7 +11916,7 @@ class qo {
11914
11916
  this.requestedAspectRatio = Nt(t), this.updateFrameLayout();
11915
11917
  }
11916
11918
  getAspectRatio() {
11917
- return Ko(this.requestedAspectRatio, this.resolvedAutoAspectRatio);
11919
+ return jo(this.requestedAspectRatio, this.resolvedAutoAspectRatio);
11918
11920
  }
11919
11921
  createMediaElement(t, e) {
11920
11922
  const i = this.dependencies.createMediaElement, s = i ? i(t, e) : document.createElement(t === "video" ? "video" : "audio");
@@ -11992,32 +11994,33 @@ class qo {
11992
11994
  }
11993
11995
  assignClipToSlot(t, e) {
11994
11996
  t.entry = e, t.isActive = t.role === "current";
11995
- const i = e.clip.src, s = t.attachedSrc || jo(t.element);
11997
+ const i = e.clip.src, s = t.attachedSrc || Zo(t.element);
11996
11998
  (t.attachedClipId !== e.clip.id || s !== i) && (t.attachedClipId = e.clip.id, t.attachedSrc = i, t.isLoading = !0, t.isBuffering = !1, t.element.setAttribute("src", i), oe(t.element)), this.configureAudioRouting(t, e);
11997
11999
  }
11998
12000
  configureAudioRouting(t, e) {
12001
+ const i = Math.max(0, Math.min(1, e.clip.volume ?? 1)), s = e.muted ? 0 : i;
11999
12002
  if (!e.hasAudio) {
12000
- t.element.muted = !0;
12003
+ t.element.muted = !0, t.element.volume = 0;
12001
12004
  return;
12002
12005
  }
12003
- const i = this.getAudioContext();
12004
- if (!i || t.audioRoutingFailed) {
12005
- t.element.muted = e.muted;
12006
+ const n = this.getAudioContext();
12007
+ if (!n || t.audioRoutingFailed) {
12008
+ t.element.muted = e.muted, t.element.volume = s;
12006
12009
  return;
12007
12010
  }
12008
12011
  if (!t.sourceNode || !t.gainNode)
12009
12012
  try {
12010
- t.sourceNode = i.createMediaElementSource(t.element), t.gainNode = i.createGain(), t.sourceNode.connect(t.gainNode), t.gainNode.connect(this.getMasterGainNode(i));
12013
+ t.sourceNode = n.createMediaElementSource(t.element), t.gainNode = n.createGain(), t.sourceNode.connect(t.gainNode), t.gainNode.connect(this.getMasterGainNode(n));
12011
12014
  } catch {
12012
- t.audioRoutingFailed = !0, t.element.muted = e.muted;
12015
+ t.audioRoutingFailed = !0, t.element.muted = e.muted, t.element.volume = s;
12013
12016
  return;
12014
12017
  }
12015
- t.element.muted = !1, t.gainNode.gain.value = e.muted ? 0 : 1;
12018
+ t.element.muted = !1, t.element.volume = 1, t.gainNode.gain.value = s;
12016
12019
  }
12017
12020
  syncCurrentSlot(t, e, i, s) {
12018
12021
  t.isActive = !0, t.entry = e, t.element.playbackRate = i;
12019
12022
  const n = e.mediaTime / 1e3, r = Math.max(0.1, i * 0.15);
12020
- Math.abs(t.element.currentTime - n) > r && (t.isSeeking = !0, t.isBuffering = !0, bs(t.element, n), this.refreshBufferingState()), s === "playing" ? (this.resumeAudioContext(), Zo(t.element)) : qt(t.element), this.setSlotVisible(t, e.hasVisual, 1e3 - e.trackOrder);
12023
+ Math.abs(t.element.currentTime - n) > r && (t.isSeeking = !0, t.isBuffering = !0, bs(t.element, n), this.refreshBufferingState()), s === "playing" ? (this.resumeAudioContext(), qo(t.element)) : qt(t.element), this.setSlotVisible(t, e.hasVisual, 1e3 - e.trackOrder);
12021
12024
  }
12022
12025
  preparePreloadSlot(t, e) {
12023
12026
  if (t.isActive = !1, t.isBuffering = !1, t.isSeeking = !1, !e) {
@@ -12153,7 +12156,7 @@ class qo {
12153
12156
  const e = this.getFrameSize();
12154
12157
  if (e.width <= 0 || e.height <= 0)
12155
12158
  return;
12156
- const i = this.getMediaSize(t, t.entry, e), s = this.getEffectiveVisualTransform(t.entry), n = Ss(e, i, s);
12159
+ const i = this.getMediaSize(t, t.entry, e), s = this.getEffectiveVisualTransform(t.entry), n = Cs(e, i, s);
12157
12160
  t.wrapper.style.left = `${n.left}px`, t.wrapper.style.top = `${n.top}px`, t.wrapper.style.width = `${n.width}px`, t.wrapper.style.height = `${n.height}px`;
12158
12161
  }
12159
12162
  buildSelectedOverlayState() {
@@ -12170,8 +12173,8 @@ class qo {
12170
12173
  clipId: e.entry.clip.id,
12171
12174
  transform: s,
12172
12175
  frameSize: t,
12173
- baseRect: Sn(t, i),
12174
- displayRect: Ss(t, i, s)
12176
+ baseRect: bn(t, i),
12177
+ displayRect: Cs(t, i, s)
12175
12178
  };
12176
12179
  }
12177
12180
  return null;
@@ -12204,26 +12207,28 @@ class qo {
12204
12207
  return ((e = this.transientVisualTransform) == null ? void 0 : e.clipId) === t.clip.id ? this.transientVisualTransform.transform : gt(t.clip.visualTransform);
12205
12208
  }
12206
12209
  }
12207
- class Jo extends qo {
12210
+ class Qo extends Jo {
12208
12211
  destroy() {
12209
12212
  this.detach();
12210
12213
  }
12211
12214
  }
12212
- function Qo(a) {
12215
+ function tl(a) {
12213
12216
  return "dom";
12214
12217
  }
12215
- const tl = 36e5, el = 3e5;
12216
- function Tn(a) {
12218
+ const el = 36e5, il = 3e5;
12219
+ function sl(a) {
12217
12220
  return a.length === 0 ? 0 : a.reduce((t, e) => Math.max(t, e.startTime + e.duration), 0);
12218
12221
  }
12219
- function vn(a) {
12220
- return Math.max(a + el, tl);
12222
+ function ws(a) {
12223
+ if (a.length === 0)
12224
+ return 0;
12225
+ const t = a.reduce((i, s) => Math.min(i, s.startTime), Number.POSITIVE_INFINITY), e = a.reduce((i, s) => Math.max(i, s.startTime + s.duration), 0);
12226
+ return Math.max(0, e - t);
12221
12227
  }
12222
- function il(a) {
12223
- const t = Tn(a.clips);
12224
- return t === a.lastTrackDuration ? a.lastTrackDuration : (a.setLastTrackDuration(t), a.setTimelineDuration(vn(t)), a.emitTrackDurationChange(t), t);
12228
+ function _s(a) {
12229
+ return Math.max(a + il, el);
12225
12230
  }
12226
- class ws {
12231
+ class Ps {
12227
12232
  constructor(t = {}) {
12228
12233
  f(this, "listeners", /* @__PURE__ */ new Map());
12229
12234
  this.initialPayloadProviders = t;
@@ -12249,10 +12254,10 @@ class ws {
12249
12254
  this.listeners.clear();
12250
12255
  }
12251
12256
  }
12252
- function sl(a) {
12257
+ function nl(a) {
12253
12258
  return [...a].sort((t, e) => t.order - e.order);
12254
12259
  }
12255
- function nl(a) {
12260
+ function rl(a) {
12256
12261
  return [...a].sort((t, e) => t.startTime - e.startTime);
12257
12262
  }
12258
12263
  function ci(a, t, e) {
@@ -12268,15 +12273,15 @@ function ci(a, t, e) {
12268
12273
  hasAudio: !0
12269
12274
  };
12270
12275
  }
12271
- class rl {
12276
+ class al {
12272
12277
  resolveActiveClipsAtTime(t, e) {
12273
12278
  return this.resolvePlaybackPlan(t, e).activeClips;
12274
12279
  }
12275
12280
  resolvePlaybackPlan(t, e) {
12276
- const i = sl(t), s = [], n = [];
12281
+ const i = nl(t), s = [], n = [];
12277
12282
  let r = null;
12278
12283
  for (const o of i) {
12279
- const l = nl(o.clips), h = l.find((d) => e >= d.startTime && e < d.endTime);
12284
+ const l = rl(o.clips), h = l.find((d) => e >= d.startTime && e < d.endTime);
12280
12285
  if (h) {
12281
12286
  const d = h.startTimeAtSource + (e - h.startTime);
12282
12287
  s.push(ci(o, h, d));
@@ -12294,7 +12299,7 @@ class rl {
12294
12299
  };
12295
12300
  }
12296
12301
  }
12297
- function al(a) {
12302
+ function ol(a) {
12298
12303
  var e;
12299
12304
  const t = a.getSelectedClip() || ((e = a.findFallbackSelectedClip) == null ? void 0 : e.call(a)) || null;
12300
12305
  return {
@@ -12302,51 +12307,51 @@ function al(a) {
12302
12307
  hasSelectedClip: !!t
12303
12308
  };
12304
12309
  }
12305
- function ol(a) {
12310
+ function ll(a) {
12306
12311
  var i;
12307
12312
  const t = a.resolveSelectedClip(), e = ((i = t.clip) == null ? void 0 : i.id) || null;
12308
12313
  return e === a.lastSelectedClipId ? a.lastSelectedClipId : (a.emitSelectedClipChange(t), e);
12309
12314
  }
12310
- function bn(a, t) {
12315
+ function kn(a, t) {
12311
12316
  var e, i, s, n;
12312
12317
  return ((i = (e = a.findById(t)) == null ? void 0 : e.getId) == null ? void 0 : i.call(e)) || ((n = (s = a.getLastTrack()) == null ? void 0 : s.getId) == null ? void 0 : n.call(s)) || t;
12313
12318
  }
12314
- function ll(a) {
12319
+ function hl(a) {
12315
12320
  if (a.placement.status === "use_existing_track")
12316
12321
  return a.trackCollection.addClipToTrack(a.placement.trackId, a.clip);
12317
- const t = a.createTrack(a.placement.trackType, a.placement.suggestedTrackName), e = bn(a.trackCollection, t);
12322
+ const t = a.createTrack(a.placement.trackType, a.placement.suggestedTrackName), e = kn(a.trackCollection, t);
12318
12323
  return e ? a.trackCollection.addClipToTrack(e, a.clip) : !1;
12319
12324
  }
12320
- function _s(a, t, e) {
12325
+ function xs(a, t, e) {
12321
12326
  return t.trackId ? a.removeClipFromTrack(t.trackId, e) : !1;
12322
12327
  }
12323
- function hl(a) {
12328
+ function cl(a) {
12324
12329
  return a.trackCollection.moveClipToTrack(
12325
12330
  a.command.clip,
12326
12331
  a.command.sourceTrackId,
12327
12332
  a.command.targetTrackId
12328
12333
  );
12329
12334
  }
12330
- function cl(a) {
12331
- const t = a.createTrack(a.trackType, a.trackName), e = bn(a.trackCollection, t);
12335
+ function dl(a) {
12336
+ const t = a.createTrack(a.trackType, a.trackName), e = kn(a.trackCollection, t);
12332
12337
  return e ? a.trackCollection.moveClipToTrack(a.clip, a.currentTrackId, e) : !1;
12333
12338
  }
12334
12339
  function Et(a) {
12335
12340
  var t, e, i, s, n;
12336
12341
  (t = a.checkTrackDurationChange) == null || t.call(a), (e = a.updateCanPlayState) == null || e.call(a), (i = a.updateTrackInfoPanel) == null || i.call(a), (s = a.handleClipChange) == null || s.call(a), (n = a.cleanupEmptyTracks) == null || n.call(a);
12337
12342
  }
12338
- function dl(a) {
12343
+ function ul(a) {
12339
12344
  var t, e;
12340
12345
  a.notifySelectionChange(), (t = a.cleanupEmptyTracks) == null || t.call(a), a.updateTrackInfoPanel(), (e = a.batchDraw) == null || e.call(a), a.syncPreviewSession();
12341
12346
  }
12342
- class ul {
12347
+ class fl {
12343
12348
  constructor() {
12344
12349
  f(this, "panel", null);
12345
12350
  }
12346
12351
  init(t) {
12347
12352
  var i, s, n, r;
12348
12353
  const e = ((i = t.theme) == null ? void 0 : i.background) || "#1a1a1a";
12349
- this.panel = new Ao(
12354
+ this.panel = new Eo(
12350
12355
  {
12351
12356
  container: t.container,
12352
12357
  theme: {
@@ -12382,7 +12387,7 @@ class ul {
12382
12387
  (t = this.panel) == null || t.destroy(), this.panel = null;
12383
12388
  }
12384
12389
  }
12385
- class Ps {
12390
+ class As {
12386
12391
  syncCurrentTime(t, e, i, s) {
12387
12392
  t == null || t.setCurrentTime(s), e == null || e.setCurrentTime(s), i.syncCurrentTime(s);
12388
12393
  }
@@ -12437,7 +12442,7 @@ class Ps {
12437
12442
  return null;
12438
12443
  }
12439
12444
  }
12440
- class xs {
12445
+ class Es {
12441
12446
  constructor(t, e = _i) {
12442
12447
  this.handlers = t, this.TrackCtor = e;
12443
12448
  }
@@ -12474,7 +12479,7 @@ class xs {
12474
12479
  );
12475
12480
  }
12476
12481
  }
12477
- class fl {
12482
+ class gl {
12478
12483
  constructor(t) {
12479
12484
  this.tracks = t;
12480
12485
  }
@@ -12596,7 +12601,7 @@ class fl {
12596
12601
  return typeof t.getId == "function" ? t.getId() : typeof t.id == "string" ? t.id : null;
12597
12602
  }
12598
12603
  }
12599
- class gl {
12604
+ class pl {
12600
12605
  constructor(t = []) {
12601
12606
  f(this, "tracks", []);
12602
12607
  f(this, "trackCounter", 0);
@@ -12696,10 +12701,10 @@ function le(a, t, e) {
12696
12701
  }
12697
12702
  return i;
12698
12703
  }
12699
- function As(a, t) {
12704
+ function Is(a, t) {
12700
12705
  return a.reduce((e, i) => e + Vt(i.type), t);
12701
12706
  }
12702
- function pl(a, t) {
12707
+ function ml(a, t) {
12703
12708
  let e = t;
12704
12709
  return a.map((i) => {
12705
12710
  const s = Vt(i.type), n = {
@@ -12710,12 +12715,12 @@ function pl(a, t) {
12710
12715
  return e += s, n;
12711
12716
  });
12712
12717
  }
12713
- const kn = 200, wn = 8, Es = "timeline-manager-managed-layout-styles";
12714
- function ml() {
12715
- if (typeof document > "u" || document.getElementById(Es))
12718
+ const wn = 200, _n = 8, Ms = "timeline-manager-managed-layout-styles";
12719
+ function yl() {
12720
+ if (typeof document > "u" || document.getElementById(Ms))
12716
12721
  return;
12717
12722
  const a = document.createElement("style");
12718
- a.id = Es, a.textContent = `
12723
+ a.id = Ms, a.textContent = `
12719
12724
  .timeline-manager-root {
12720
12725
  position: relative;
12721
12726
  overflow: hidden;
@@ -12743,9 +12748,9 @@ function ml() {
12743
12748
  }
12744
12749
  `, document.head.appendChild(a);
12745
12750
  }
12746
- function yl(a, t) {
12747
- ml();
12748
- const e = t.leftPanelWidth ?? kn, i = t.scrollbarSize ?? wn;
12751
+ function Sl(a, t) {
12752
+ yl();
12753
+ const e = t.leftPanelWidth ?? wn, i = t.scrollbarSize ?? _n;
12749
12754
  a.innerHTML = "", a.classList.add("timeline-manager-root"), a.style.gridTemplateColumns = `${e}px minmax(0, 1fr)`, a.style.gridTemplateRows = `${t.timeScaleHeight}px minmax(0, 1fr)`, a.style.background = t.theme.background;
12750
12755
  const s = bt("div");
12751
12756
  s.className = "timeline-manager-header-corner", Ne(s, t.theme), s.style.gridColumn = "1", s.style.gridRow = "1", s.style.borderBottom = `1px solid ${t.theme.border}`;
@@ -12808,7 +12813,7 @@ class Cl {
12808
12813
  this.speed = t;
12809
12814
  }
12810
12815
  }
12811
- class _n {
12816
+ class Pn {
12812
12817
  constructor() {
12813
12818
  f(this, "selectedClipIds", /* @__PURE__ */ new Set());
12814
12819
  }
@@ -12846,7 +12851,7 @@ class _n {
12846
12851
  return this.selectedClipIds.size;
12847
12852
  }
12848
12853
  }
12849
- class Sl {
12854
+ class Tl {
12850
12855
  constructor(t) {
12851
12856
  f(this, "zoom");
12852
12857
  f(this, "duration");
@@ -12900,16 +12905,16 @@ class Sl {
12900
12905
  this.contentHeight = t;
12901
12906
  }
12902
12907
  }
12903
- class Is {
12908
+ class Ls {
12904
12909
  constructor(t) {
12905
12910
  f(this, "selectionStore");
12906
12911
  f(this, "playbackStore");
12907
12912
  f(this, "viewportStore");
12908
- this.selectionStore = new _n(), this.playbackStore = new Cl({
12913
+ this.selectionStore = new Pn(), this.playbackStore = new Cl({
12909
12914
  currentTime: t.currentTime,
12910
12915
  playState: t.playState,
12911
12916
  speed: t.speed
12912
- }), this.viewportStore = new Sl({
12917
+ }), this.viewportStore = new Tl({
12913
12918
  zoom: t.zoom,
12914
12919
  duration: t.duration,
12915
12920
  scrollLeft: t.scrollLeft,
@@ -12992,7 +12997,7 @@ class Is {
12992
12997
  this.viewportStore.setContentHeight(t);
12993
12998
  }
12994
12999
  }
12995
- class Tl {
13000
+ class vl {
12996
13001
  constructor(t, e, i, s, n) {
12997
13002
  f(this, "stage");
12998
13003
  f(this, "layer");
@@ -13297,7 +13302,7 @@ const V = class V {
13297
13302
  };
13298
13303
  f(V, "SVG_NS", "http://www.w3.org/2000/svg"), f(V, "VISUAL_WIDTH", 14), f(V, "HANDLE_HEIGHT", 16), f(V, "HANDLE_LINE_START", 13), f(V, "LINE_WIDTH", 2), f(V, "LINE_HIT_WIDTH", 12), f(V, "END_CAP_WIDTH", 14), f(V, "END_CAP_HEIGHT", 10), f(V, "AUTO_SCROLL_EDGE_THRESHOLD", 48), f(V, "AUTO_SCROLL_MAX_SPEED", 18);
13299
13304
  let Pi = V;
13300
- class Ms {
13305
+ class Ds {
13301
13306
  constructor(t) {
13302
13307
  f(this, "container");
13303
13308
  f(this, "orientation");
@@ -13434,7 +13439,7 @@ class Ms {
13434
13439
  return this.scrollOffset / i * s;
13435
13440
  }
13436
13441
  }
13437
- class vl {
13442
+ class bl {
13438
13443
  constructor() {
13439
13444
  f(this, "entries", /* @__PURE__ */ new Map());
13440
13445
  }
@@ -13450,7 +13455,7 @@ class vl {
13450
13455
  this.entries.clear();
13451
13456
  }
13452
13457
  }
13453
- class bl {
13458
+ class kl {
13454
13459
  constructor() {
13455
13460
  f(this, "panel", null);
13456
13461
  f(this, "config", null);
@@ -13459,7 +13464,7 @@ class bl {
13459
13464
  init(t) {
13460
13465
  this.config = t;
13461
13466
  const e = this.convertTheme(t.theme);
13462
- this.panel = new Mo({
13467
+ this.panel = new Lo({
13463
13468
  container: t.container,
13464
13469
  theme: e,
13465
13470
  onClipUpdate: (i, s) => {
@@ -13497,10 +13502,10 @@ class bl {
13497
13502
  };
13498
13503
  }
13499
13504
  }
13500
- const kl = "2.0.3", wl = {
13501
- version: kl
13502
- }, _l = 1, Pl = 2, xl = 8e3;
13503
- class Rl {
13505
+ const wl = "2.0.3", _l = {
13506
+ version: wl
13507
+ }, Pl = 1, xl = 2, Al = 8e3;
13508
+ class Ol {
13504
13509
  constructor(t = {}) {
13505
13510
  f(this, "timeline", null);
13506
13511
  f(this, "tracks", []);
@@ -13537,6 +13542,7 @@ class Rl {
13537
13542
  f(this, "verticalScrollbar", null);
13538
13543
  f(this, "isExecutingHistoryAction", !1);
13539
13544
  f(this, "lastTrackDuration", 0);
13545
+ f(this, "lastEffectiveTrackDuration", 0);
13540
13546
  f(this, "thumbnailProvider", null);
13541
13547
  f(this, "canPlay", !1);
13542
13548
  f(this, "sourceLoadingCount", 0);
@@ -13567,9 +13573,9 @@ class Rl {
13567
13573
  f(this, "rootWheelListener", (t) => {
13568
13574
  this.handleUnifiedWheel(t);
13569
13575
  });
13570
- f(this, "mountManager", new vl());
13576
+ f(this, "mountManager", new bl());
13571
13577
  f(this, "pendingDraftData", null);
13572
- f(this, "selectionStore", new _n());
13578
+ f(this, "selectionStore", new Pn());
13573
13579
  f(this, "multiDragSession", null);
13574
13580
  f(this, "clipRemovalBatchDepth", 0);
13575
13581
  this.config = {
@@ -13588,7 +13594,7 @@ class Rl {
13588
13594
  thumbnailProvider: t.thumbnailProvider,
13589
13595
  previewBackend: t.previewBackend ?? "dom",
13590
13596
  previewSourceResolver: t.previewSourceResolver
13591
- }, O.setConfig(this.config.logConfig), O.debug("TimelineManager", "日志系统初始化完成", { logConfig: this.config.logConfig }), this.thumbnailProvider = t.thumbnailProvider || null, this.trackInfoPanelController = new ul(), this.eventDispatcher = new ws({
13597
+ }, O.setConfig(this.config.logConfig), O.debug("TimelineManager", "日志系统初始化完成", { logConfig: this.config.logConfig }), this.thumbnailProvider = t.thumbnailProvider || null, this.trackInfoPanelController = new fl(), this.eventDispatcher = new Ps({
13592
13598
  can_play_change: () => ({ canPlay: this.canPlay }),
13593
13599
  selected_clip_change: () => this.resolveSelectedClipSnapshot(),
13594
13600
  source_loading_change: () => this.getSourceLoadingState(),
@@ -13602,7 +13608,7 @@ class Rl {
13602
13608
  canRedo: this.history.canRedo()
13603
13609
  });
13604
13610
  }
13605
- ), this.timelineHistoryRecorder = new Cs(this.history), this.timelineHistoryExecutor = new ys({
13611
+ ), this.timelineHistoryRecorder = new Ss(this.history), this.timelineHistoryExecutor = new ys({
13606
13612
  removeClip: this.removeClip.bind(this),
13607
13613
  addClipToTrack: this.addClipToTrack.bind(this),
13608
13614
  updateClip: this.updateClip.bind(this),
@@ -13613,13 +13619,13 @@ class Rl {
13613
13619
  findTrackByClipId: this.findTrackByClipId.bind(this),
13614
13620
  getDefaultTrack: () => this.getDefaultTrackForHistory(),
13615
13621
  loadClipThumbnails: this.loadClipThumbnails.bind(this)
13616
- }), this.trackManager = new gl(), this.timelineStore = new Is({
13622
+ }), this.trackManager = new pl(), this.timelineStore = new Ls({
13617
13623
  currentTime: this.config.currentTime,
13618
13624
  playState: this.config.playState,
13619
13625
  speed: this.config.speed || 1,
13620
13626
  zoom: this.config.zoom,
13621
13627
  duration: this.config.duration
13622
- }), this.timelineCommands = new ps(this.timelineStore), this.timelinePresentationAdapter = new Ps(), this.timelineTrackBridge = new xs({
13628
+ }), this.timelineCommands = new ps(this.timelineStore), this.timelinePresentationAdapter = new As(), this.timelineTrackBridge = new Es({
13623
13629
  onClipUpdate: (e, i, s) => this.handleClipUpdate(e, i, s),
13624
13630
  onClipAdd: this.handleClipAdd.bind(this),
13625
13631
  onClipRemove: this.handleClipRemove.bind(this),
@@ -13644,7 +13650,7 @@ class Rl {
13644
13650
  var t, e, i, s, n;
13645
13651
  if (!this.timelineStore) {
13646
13652
  const r = ((t = this.config) == null ? void 0 : t.currentTime) ?? 0, o = ((e = this.config) == null ? void 0 : e.playState) ?? "paused", l = ((i = this.config) == null ? void 0 : i.speed) || 1, h = ((s = this.config) == null ? void 0 : s.zoom) || ut.MEDIUM, c = ((n = this.config) == null ? void 0 : n.duration) || 36e5;
13647
- this.timelineStore = new Is({
13653
+ this.timelineStore = new Ls({
13648
13654
  currentTime: r,
13649
13655
  playState: o,
13650
13656
  speed: l,
@@ -13658,13 +13664,13 @@ class Rl {
13658
13664
  return this.timelineCommands || (this.timelineCommands = new ps(this.getTimelineStore())), this.timelineCommands;
13659
13665
  }
13660
13666
  getTrackCollection() {
13661
- return new fl(this.tracks);
13667
+ return new gl(this.tracks);
13662
13668
  }
13663
13669
  getTimelinePresentationAdapter() {
13664
- return this.timelinePresentationAdapter || (this.timelinePresentationAdapter = new Ps()), this.timelinePresentationAdapter;
13670
+ return this.timelinePresentationAdapter || (this.timelinePresentationAdapter = new As()), this.timelinePresentationAdapter;
13665
13671
  }
13666
13672
  getTimelineTrackBridge() {
13667
- return this.timelineTrackBridge || (this.timelineTrackBridge = new xs({
13673
+ return this.timelineTrackBridge || (this.timelineTrackBridge = new Es({
13668
13674
  onClipUpdate: (t, e, i) => this.handleClipUpdate(t, e, i),
13669
13675
  onClipAdd: this.handleClipAdd.bind(this),
13670
13676
  onClipRemove: this.handleClipRemove.bind(this),
@@ -13685,10 +13691,10 @@ class Rl {
13685
13691
  })), this.timelineTrackBridge;
13686
13692
  }
13687
13693
  getTimelinePlaybackResolver() {
13688
- return this.timelinePlaybackResolver || (this.timelinePlaybackResolver = new rl()), this.timelinePlaybackResolver;
13694
+ return this.timelinePlaybackResolver || (this.timelinePlaybackResolver = new al()), this.timelinePlaybackResolver;
13689
13695
  }
13690
13696
  resolveConfiguredPreviewBackend() {
13691
- return this.runtimePreviewBackendOverride ? (this.resolvedPreviewBackend = this.runtimePreviewBackendOverride, this.resolvedPreviewBackend) : (this.resolvedPreviewBackend = Qo(this.config.previewBackend), this.resolvedPreviewBackend);
13697
+ return this.runtimePreviewBackendOverride ? (this.resolvedPreviewBackend = this.runtimePreviewBackendOverride, this.resolvedPreviewBackend) : (this.resolvedPreviewBackend = tl(this.config.previewBackend), this.resolvedPreviewBackend);
13692
13698
  }
13693
13699
  createPreviewBackendCallbacks(t = this.activePreviewCallbackToken) {
13694
13700
  return {
@@ -13717,7 +13723,7 @@ class Rl {
13717
13723
  }
13718
13724
  createPreviewBackend(t = this.resolveConfiguredPreviewBackend()) {
13719
13725
  const e = this.createPreviewBackendCallbacks(++this.activePreviewCallbackToken);
13720
- return new Jo(e);
13726
+ return new Qo(e);
13721
13727
  }
13722
13728
  isActivePreviewCallbackToken(t) {
13723
13729
  return t === this.activePreviewCallbackToken;
@@ -13726,7 +13732,7 @@ class Rl {
13726
13732
  return this.previewSession || (this.previewSession = this.createPreviewBackend()), this.previewSession;
13727
13733
  }
13728
13734
  getEventDispatcher() {
13729
- return this.eventDispatcher || (this.eventDispatcher = new ws({
13735
+ return this.eventDispatcher || (this.eventDispatcher = new Ps({
13730
13736
  can_play_change: () => ({ canPlay: this.canPlay ?? !1 }),
13731
13737
  selected_clip_change: () => this.resolveSelectedClipSnapshot(),
13732
13738
  source_loading_change: () => this.getSourceLoadingState(),
@@ -13739,7 +13745,7 @@ class Rl {
13739
13745
  getTimelineHistoryRecorder() {
13740
13746
  return this.timelineHistoryRecorder || (this.history || (this.history = new ms(() => {
13741
13747
  }, () => {
13742
- })), this.timelineHistoryRecorder = new Cs(this.history)), this.timelineHistoryRecorder;
13748
+ })), this.timelineHistoryRecorder = new Ss(this.history)), this.timelineHistoryRecorder;
13743
13749
  }
13744
13750
  getTimelineHistoryExecutor() {
13745
13751
  return this.timelineHistoryExecutor || (this.timelineHistoryExecutor = new ys({
@@ -14010,7 +14016,7 @@ class Rl {
14010
14016
  this.pendingPreviewState.timeoutId = setTimeout(() => {
14011
14017
  var e, i;
14012
14018
  !this.pendingPreviewState || this.pendingPreviewState.syncRequestId !== t || (this.pendingPreviewState.errorMessage = "资源加载异常,请刷新重试", this.clearPendingPreviewTimeout(), (i = (e = this.previewSession) == null ? void 0 : e.setPendingState) == null || i.call(e, this.buildPreviewPendingState()));
14013
- }, xl);
14019
+ }, Al);
14014
14020
  }
14015
14021
  clearPendingPreviewTimeout() {
14016
14022
  var t;
@@ -14050,11 +14056,11 @@ class Rl {
14050
14056
  O.warn("TimelineManager", "TimelineManager has already been initialized");
14051
14057
  return;
14052
14058
  }
14053
- this.rootContainer = t, this.layout = yl(t, {
14059
+ this.rootContainer = t, this.layout = Sl(t, {
14054
14060
  theme: this.config.theme,
14055
14061
  timeScaleHeight: this.getTimeScaleHeight(),
14056
- leftPanelWidth: kn,
14057
- scrollbarSize: wn
14062
+ leftPanelWidth: wn,
14063
+ scrollbarSize: _n
14058
14064
  }), this.layout.bodyViewport.addEventListener("scroll", this.bodyViewportScrollListener), (s = (i = this.layout.bodyCanvasHost).addEventListener) == null || s.call(i, "click", this.bodyCanvasHostClickListener), (r = (n = this.rootContainer) == null ? void 0 : n.addEventListener) == null || r.call(n, "wheel", this.rootWheelListener, { passive: !1 }), this.headerStage = new X.Stage({
14059
14065
  container: this.layout.headerCanvasHost,
14060
14066
  width: this.layout.headerViewport.clientWidth,
@@ -14065,7 +14071,7 @@ class Rl {
14065
14071
  height: 0
14066
14072
  }), this.backgroundLayer = new X.Layer({ name: "trackBackgroundLayer" }), this.trackLayer = new X.Layer({ name: "trackLayer" }), this.dragOverlayLayer = new X.Layer({ name: "trackDragOverlayLayer", listening: !1 }), this.snapGuideLayer = new X.Layer({ name: "trackSnapGuideLayer", listening: !1 }), this.selectionBoxLayer = new X.Layer({ name: "selectionBoxLayer", listening: !1 }), this.stage.add(this.backgroundLayer), this.stage.add(this.trackLayer), this.stage.add(this.dragOverlayLayer), this.stage.add(this.snapGuideLayer), this.stage.add(this.selectionBoxLayer);
14067
14073
  const e = (l = (o = this.stage) == null ? void 0 : o.container) == null ? void 0 : l.call(o);
14068
- if (e && e.addEventListener("mousedown", this.handleStageMouseDown.bind(this)), this.timeline = new Tl(
14074
+ if (e && e.addEventListener("mousedown", this.handleStageMouseDown.bind(this)), this.timeline = new vl(
14069
14075
  this.headerStage,
14070
14076
  this.headerLayer,
14071
14077
  this.config,
@@ -14079,13 +14085,13 @@ class Rl {
14079
14085
  this.config.theme,
14080
14086
  this.handleTimeChange.bind(this),
14081
14087
  this.handleHorizontalDragAutoScroll.bind(this)
14082
- ), this.horizontalScrollbar = new Ms({
14088
+ ), this.horizontalScrollbar = new Ds({
14083
14089
  container: this.layout.horizontalScrollbarCanvasHost,
14084
14090
  orientation: "horizontal",
14085
14091
  theme: this.config.theme,
14086
14092
  leadingInset: ot,
14087
14093
  onScrollChange: this.handleScrollChange.bind(this)
14088
- }), this.verticalScrollbar = new Ms({
14094
+ }), this.verticalScrollbar = new Ds({
14089
14095
  container: this.layout.verticalScrollbarCanvasHost,
14090
14096
  orientation: "vertical",
14091
14097
  theme: this.config.theme,
@@ -14168,11 +14174,11 @@ class Rl {
14168
14174
  return le(this.trackManager.getTracks(), t, this.getTrackContentTopOffset());
14169
14175
  }
14170
14176
  calculateTotalHeight() {
14171
- return As(this.trackManager.getTracks(), this.getTrackContentTopOffset());
14177
+ return Is(this.trackManager.getTracks(), this.getTrackContentTopOffset());
14172
14178
  }
14173
14179
  updateAllTrackPositions() {
14174
14180
  var e, i;
14175
- const t = pl(this.trackManager.getTracks(), this.getTrackContentTopOffset());
14181
+ const t = ml(this.trackManager.getTracks(), this.getTrackContentTopOffset());
14176
14182
  for (const s of t) {
14177
14183
  const n = this.getTrackCollection().findById(s.trackId);
14178
14184
  n && ((e = n.setTrackY) == null || e.call(n, s.y), (i = n.setTrackHeight) == null || i.call(n, s.height));
@@ -14260,7 +14266,7 @@ class Rl {
14260
14266
  if (e === "bottom_of_type_region" && o)
14261
14267
  return le(s, o.id, this.getTrackContentTopOffset()) + Vt(o.type);
14262
14268
  if (!n)
14263
- return t === "video" ? this.getTrackContentTopOffset() : As(s, this.getTrackContentTopOffset());
14269
+ return t === "video" ? this.getTrackContentTopOffset() : Is(s, this.getTrackContentTopOffset());
14264
14270
  const l = le(s, n.id, this.getTrackContentTopOffset());
14265
14271
  return t === "video" ? l : l + Vt(n.type);
14266
14272
  }
@@ -14365,9 +14371,9 @@ class Rl {
14365
14371
  normalizeWheelDelta(t, e, i) {
14366
14372
  if (!Number.isFinite(t) || t === 0)
14367
14373
  return 0;
14368
- if (e === _l)
14374
+ if (e === Pl)
14369
14375
  return t * 16;
14370
- if (e === Pl) {
14376
+ if (e === xl) {
14371
14377
  const s = i === "x" ? this.getViewportWidth() : this.getViewportHeight();
14372
14378
  return t * (s || 1);
14373
14379
  }
@@ -14632,7 +14638,7 @@ class Rl {
14632
14638
  O.error("TimelineManager", "Failed to get video duration:", { error: u }), r = n;
14633
14639
  }
14634
14640
  let o = t.thumbnails;
14635
- const l = t.id || `clip_${t.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, h = t.type || "video", c = Ds({
14641
+ const l = t.id || `clip_${t.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, h = t.type || "video", c = Os({
14636
14642
  id: l,
14637
14643
  type: h,
14638
14644
  externalId: t.externalId,
@@ -14649,7 +14655,8 @@ class Rl {
14649
14655
  style: t.style,
14650
14656
  visualTransform: t.visualTransform,
14651
14657
  separatedAudioClipId: t.separatedAudioClipId,
14652
- separatedFromVideoClipId: t.separatedFromVideoClipId
14658
+ separatedFromVideoClipId: t.separatedFromVideoClipId,
14659
+ volume: t.volume ?? 1
14653
14660
  });
14654
14661
  if (O.debugLazy("TimelineManager", () => "添加的片段", () => ({ clipId: c.id, type: c.type, startTime: c.startTime, duration: c.duration })), this.tracks.length > 0) {
14655
14662
  if (t.trackId) {
@@ -14676,7 +14683,7 @@ class Rl {
14676
14683
  return c.id;
14677
14684
  }
14678
14685
  }
14679
- const u = this.getTimelineCommands().planTrackPlacement(c, this.tracks), p = this.getTrackCollection(), g = ll({
14686
+ const u = this.getTimelineCommands().planTrackPlacement(c, this.tracks), p = this.getTrackCollection(), g = hl({
14680
14687
  clip: c,
14681
14688
  placement: u,
14682
14689
  trackCollection: p,
@@ -14707,7 +14714,7 @@ class Rl {
14707
14714
  removeClip(t) {
14708
14715
  const e = this.getTimelineCommands().prepareRemoveClip(t, this.tracks);
14709
14716
  e.exists && (e.shouldClearSelection && this.clearSelection(), We({
14710
- applied: _s(this.getTrackCollection(), e, t),
14717
+ applied: xs(this.getTrackCollection(), e, t),
14711
14718
  isExecutingHistoryAction: this.isExecutingHistoryAction,
14712
14719
  recordHistory: () => {
14713
14720
  this.getTimelineHistoryRecorder().recordRemoveClip(
@@ -14737,7 +14744,7 @@ class Rl {
14737
14744
  return this.withClipRemovalBatch(() => {
14738
14745
  for (const n of e) {
14739
14746
  const r = this.getTimelineCommands().prepareRemoveClip(n, this.tracks);
14740
- r.exists && (s = _s(this.getTrackCollection(), r, n) || s);
14747
+ r.exists && (s = xs(this.getTrackCollection(), r, n) || s);
14741
14748
  }
14742
14749
  }), s ? (He({
14743
14750
  notifySelectionChange: this.notifySelectionChange.bind(this),
@@ -14807,7 +14814,8 @@ class Rl {
14807
14814
  thumbnails: l.thumbnails,
14808
14815
  visualTransform: l.type === "video" ? gt(l.visualTransform) : void 0,
14809
14816
  separatedAudioClipId: l.separatedAudioClipId,
14810
- separatedFromVideoClipId: l.separatedFromVideoClipId
14817
+ separatedFromVideoClipId: l.separatedFromVideoClipId,
14818
+ volume: l.volume ?? 1
14811
14819
  })).sort((l, h) => l.startTime - h.startTime);
14812
14820
  return {
14813
14821
  id: r.id,
@@ -14866,6 +14874,7 @@ class Rl {
14866
14874
  visualTransform: h.visualTransform,
14867
14875
  separatedAudioClipId: c,
14868
14876
  separatedFromVideoClipId: d,
14877
+ volume: h.volume,
14869
14878
  trackId: l
14870
14879
  }, p = await this.addClip(u);
14871
14880
  s.set(h.id, p);
@@ -14884,7 +14893,7 @@ class Rl {
14884
14893
  * 获取插件版本号
14885
14894
  */
14886
14895
  getVersion() {
14887
- return wl.version;
14896
+ return _l.version;
14888
14897
  }
14889
14898
  undo() {
14890
14899
  return this.history.undo();
@@ -14920,7 +14929,7 @@ class Rl {
14920
14929
  this.syncScrollLeft(t);
14921
14930
  }
14922
14931
  handleClipUpdate(t, e, i) {
14923
- this.isExecutingHistoryAction || this.getTimelineHistoryRecorder().recordClipUpdate(t, e, i), this.emitEvent("clip_updated", { clip: t }), Oo({
14932
+ this.isExecutingHistoryAction || this.getTimelineHistoryRecorder().recordClipUpdate(t, e, i), this.emitEvent("clip_updated", { clip: t }), Go({
14924
14933
  notifySelectionChange: this.notifySelectionChange.bind(this),
14925
14934
  reloadClipThumbnailsIfNeeded: () => this.reloadClipThumbnailsIfNeeded(t, e),
14926
14935
  checkTrackDurationChange: this.checkTrackDurationChange.bind(this),
@@ -14948,7 +14957,7 @@ class Rl {
14948
14957
  * @param originalClip 原始片段
14949
14958
  */
14950
14959
  reloadClipThumbnailsIfNeeded(t, e) {
14951
- Go(t, e, !!this.thumbnailProvider) && this.loadClipThumbnails(t).catch((i) => {
14960
+ Bo(t, e, !!this.thumbnailProvider) && this.loadClipThumbnails(t).catch((i) => {
14952
14961
  O.warn("TimelineManager", "Error reloading clip thumbnails during update:", { error: i, clipId: t.id });
14953
14962
  });
14954
14963
  }
@@ -14957,8 +14966,8 @@ class Rl {
14957
14966
  */
14958
14967
  updateCanPlayState() {
14959
14968
  var n;
14960
- const t = this.getClips(), e = this.getCurrentTime(), i = Bo(t, e), s = this.canPlay;
14961
- this.canPlay = Ho({
14969
+ const t = this.getClips(), e = this.getCurrentTime(), i = Ho(t, e), s = this.canPlay;
14970
+ this.canPlay = zo({
14962
14971
  currentCanPlay: this.canPlay,
14963
14972
  nextCanPlay: i,
14964
14973
  playState: this.getPlayStateState(),
@@ -14974,7 +14983,7 @@ class Rl {
14974
14983
  }), s !== this.canPlay && O.debugLazy("TimelineManager", () => "Can play state changed", () => ({ oldState: s, newState: this.canPlay }));
14975
14984
  }
14976
14985
  handleClipSplit(t, e) {
14977
- Fo({
14986
+ Vo({
14978
14987
  clip1: t,
14979
14988
  clip2: e,
14980
14989
  isExecutingHistoryAction: this.isExecutingHistoryAction,
@@ -14993,7 +15002,7 @@ class Rl {
14993
15002
  });
14994
15003
  }
14995
15004
  handleClipSelect(t) {
14996
- const e = zo(t);
15005
+ const e = No(t);
14997
15006
  e.shouldJumpToTime && e.jumpTime !== null ? (this.setCurrentTime(e.jumpTime), this.emitEvent("clip_selected", { clip: t }), O.debugLazy("TimelineManager", () => "Empty track clicked, jumping to time", () => ({ time: t.startTime }))) : e.shouldSelectClip && this.selectClip(t.id, t);
14998
15007
  }
14999
15008
  handleActionUndo(t) {
@@ -15012,7 +15021,7 @@ class Rl {
15012
15021
  this.getEventDispatcher().emit(t, e);
15013
15022
  }
15014
15023
  emitSelectedClipChangeIfNeeded() {
15015
- this.lastSelectedClipId = ol({
15024
+ this.lastSelectedClipId = ll({
15016
15025
  lastSelectedClipId: this.lastSelectedClipId,
15017
15026
  resolveSelectedClip: () => this.resolveSelectedClipSnapshot(),
15018
15027
  emitSelectedClipChange: (t) => this.emitEvent("selected_clip_change", t)
@@ -15035,7 +15044,7 @@ class Rl {
15035
15044
  const i = this.getTrackCollection();
15036
15045
  if (!i.findById(e)) return;
15037
15046
  const s = t.type, n = this.trackManager.getTracksByType(s).length + 1, r = s === "video" ? `视频轨道 ${n}` : `音频轨道 ${n}`;
15038
- cl({
15047
+ dl({
15039
15048
  clip: t,
15040
15049
  currentTrackId: e,
15041
15050
  trackType: s,
@@ -15087,28 +15096,41 @@ class Rl {
15087
15096
  const t = ((e = this.selectionStore) == null ? void 0 : e.getSelectedClipIds()) ?? [];
15088
15097
  this.getTimelinePresentationAdapter().syncSelection(this.getTrackCollection(), this.selectedClipId, t);
15089
15098
  }
15099
+ syncPrimarySelectionFromSelectionStore(t) {
15100
+ const e = this.selectionStore.getSelectedClipIds();
15101
+ if (e.length === 0) {
15102
+ this.selectedClipId = null;
15103
+ return;
15104
+ }
15105
+ if (t && e.includes(t)) {
15106
+ this.selectedClipId = t;
15107
+ return;
15108
+ }
15109
+ const i = this.selectedClipId;
15110
+ i && e.includes(i) || (this.selectedClipId = e[0] ?? null);
15111
+ }
15090
15112
  selectClip(t, e) {
15091
15113
  var s;
15092
15114
  const i = e || ((s = this.getTimelineCommands().findClipById(this.tracks, t)) == null ? void 0 : s.clip);
15093
- this.getTimelineCommands().selectClip(t), this.notifySelectionChange(), i && this.emitEvent("clip_selected", { clip: i }), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15115
+ this.getTimelineCommands().selectClip(t), this.selectionStore.setSelection([t]), this.notifySelectionChange(), this.emitSelectionChangeEvent(), i && this.emitEvent("clip_selected", { clip: i }), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15094
15116
  }
15095
15117
  /**
15096
15118
  * 清空所有轨道的选中状态
15097
15119
  */
15098
15120
  clearSelection() {
15099
- this.resetMultiDragSession(), this.getTimelineCommands().clearSelection(), this.selectionStore.clear(), this.notifySelectionChange(), this.emitSelectedClipChangeIfNeeded(), this.updateAllTracksSelectionVisual(), this.syncPreviewSession();
15121
+ this.resetMultiDragSession(), this.getTimelineCommands().clearSelection(), this.selectionStore.clear(), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15100
15122
  }
15101
15123
  getSelectedClipIds() {
15102
15124
  return this.selectionStore.getSelectedClipIds();
15103
15125
  }
15104
15126
  addToSelection(t) {
15105
- this.resetMultiDragSession(), this.selectionStore.addToSelection(t), this.emitSelectionChangeEvent();
15127
+ this.resetMultiDragSession(), this.selectionStore.addToSelection(t), this.syncPrimarySelectionFromSelectionStore(this.selectedClipId ?? t), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15106
15128
  }
15107
15129
  removeFromSelection(t) {
15108
- this.resetMultiDragSession(), this.selectionStore.removeFromSelection(t), this.emitSelectionChangeEvent();
15130
+ this.resetMultiDragSession(), this.selectionStore.removeFromSelection(t), this.syncPrimarySelectionFromSelectionStore(), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15109
15131
  }
15110
15132
  toggleSelection(t) {
15111
- this.resetMultiDragSession(), this.selectionStore.toggleSelection(t), this.emitSelectionChangeEvent(), this.updateAllTracksSelectionVisual();
15133
+ this.resetMultiDragSession(), this.selectionStore.toggleSelection(t), this.syncPrimarySelectionFromSelectionStore(t), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15112
15134
  }
15113
15135
  isClipSelected(t) {
15114
15136
  return this.selectionStore.isSelected(t);
@@ -15145,7 +15167,7 @@ class Rl {
15145
15167
  for (const t of this.tracks)
15146
15168
  for (const e of t.getClips())
15147
15169
  this.selectionStore.addToSelection(e.id);
15148
- this.updateAllTracksSelectionVisual(), this.emitSelectionChangeEvent();
15170
+ this.syncPrimarySelectionFromSelectionStore(this.selectedClipId), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15149
15171
  }
15150
15172
  emitSelectionChangeEvent() {
15151
15173
  this.resetMultiDragSession(), this.emitEvent("selection_change", {
@@ -15228,7 +15250,7 @@ class Rl {
15228
15250
  (t = this.previewSession) != null && t.hasPreview() && (this.clearPendingPreviewState(), this.destroyPreviewSession(), this.recreateDetachedPreviewSession(), this.previewMountContainer = null, O.debugLazy("TimelineManager", () => "TimelineManager detached from preview container"));
15229
15251
  }
15230
15252
  attachClipConfig(t) {
15231
- const e = new bl();
15253
+ const e = new kl();
15232
15254
  e.init({
15233
15255
  container: t,
15234
15256
  theme: this.config.theme,
@@ -15285,45 +15307,66 @@ class Rl {
15285
15307
  const e = this.getClips().find((i) => i.id === t);
15286
15308
  return !!e && e.type === "video" && !!e.separatedAudioClipId;
15287
15309
  }
15310
+ resolvePreferredSeparatedAudioTrackId(t, e) {
15311
+ var l;
15312
+ if (!this.trackManager || typeof this.trackManager.getTracks != "function")
15313
+ return null;
15314
+ const i = this.resolveTrackIdByClipId(t);
15315
+ if (!i)
15316
+ return null;
15317
+ const s = [...this.getResolvedTracksSnapshot()].sort((h, c) => h.order - c.order), n = s.findIndex((h) => h.id === i);
15318
+ if (n === -1)
15319
+ return null;
15320
+ const r = e.startTime + e.duration, o = s.map((h, c) => ({ track: h, index: c })).filter(({ track: h }) => h.type === "audio").filter(({ track: h }) => !h.clips.some((c) => e.startTime < c.endTime && r > c.startTime));
15321
+ return o.length === 0 ? null : (o.sort((h, c) => {
15322
+ const d = Math.abs(h.index - n) - Math.abs(c.index - n);
15323
+ return d !== 0 ? d : h.index - c.index;
15324
+ }), ((l = o[0]) == null ? void 0 : l.track.id) ?? null);
15325
+ }
15288
15326
  async separateClipAudio(t) {
15289
15327
  if (!this.canSeparateClipAudio(t))
15290
15328
  return null;
15291
- const e = this.getClips().find((l) => l.id === t);
15329
+ const e = this.getClips().find((h) => h.id === t);
15292
15330
  if (!e || e.type !== "video")
15293
15331
  return null;
15294
- const i = this.isExecutingHistoryAction;
15295
- let s = null;
15332
+ const i = this.isExecutingHistoryAction, s = this.resolvePreferredSeparatedAudioTrackId(e.id, {
15333
+ startTime: e.startTime,
15334
+ duration: e.duration
15335
+ });
15336
+ let n = null;
15296
15337
  this.isExecutingHistoryAction = !0;
15297
15338
  try {
15298
- if (s = await this.addClip({
15339
+ if (n = await this.addClip({
15299
15340
  type: "audio",
15300
15341
  src: e.src,
15301
- name: `${e.name} 原声`,
15342
+ name: e.name,
15302
15343
  startTime: e.startTime,
15303
15344
  duration: e.duration,
15304
15345
  startTimeAtSource: e.startTimeAtSource,
15305
15346
  endTimeAtSource: e.endTimeAtSource,
15306
15347
  sourceDuration: e.sourceDuration,
15307
15348
  separatedFromVideoClipId: e.id,
15308
- isMuted: !1
15309
- }), !s)
15349
+ isMuted: !1,
15350
+ volume: e.volume ?? 1,
15351
+ trackId: s ?? void 0
15352
+ }), !n)
15310
15353
  return null;
15311
15354
  this.updateClip(t, {
15312
15355
  isMuted: !0,
15313
- separatedAudioClipId: s
15356
+ separatedAudioClipId: n
15314
15357
  });
15315
15358
  } finally {
15316
15359
  this.isExecutingHistoryAction = i;
15317
15360
  }
15318
- if (!s)
15361
+ if (!n)
15319
15362
  return null;
15320
- const n = this.getClips().find((l) => l.id === t), r = this.getClips().find((l) => l.id === s) ?? null, o = this.resolveTrackIdByClipId(s);
15321
- return n ? (i || this.getTimelineHistoryRecorder().recordSeparateClipAudio(
15363
+ const r = this.getClips().find((h) => h.id === t), o = this.getClips().find((h) => h.id === n) ?? null, l = this.resolveTrackIdByClipId(n);
15364
+ return r ? (i || this.getTimelineHistoryRecorder().recordSeparateClipAudio(
15322
15365
  e,
15323
- n,
15324
15366
  r,
15325
- o
15326
- ), s) : null;
15367
+ o,
15368
+ l
15369
+ ), n) : null;
15327
15370
  }
15328
15371
  restoreClipAudio(t) {
15329
15372
  if (!this.canRestoreClipAudio(t))
@@ -15418,14 +15461,14 @@ class Rl {
15418
15461
  }), !1;
15419
15462
  if (n.status !== "ready")
15420
15463
  return !1;
15421
- const { sourceTrackId: r, targetTrackId: o } = n, l = i ? { ...i } : { ...n.clip }, h = s ? { ...s } : { ...n.clip }, c = this.cloneTrackSnapshot(r), d = this.cloneTrackSnapshot(o), u = hl({
15464
+ const { sourceTrackId: r, targetTrackId: o } = n, l = i ? { ...i } : { ...n.clip }, h = s ? { ...s } : { ...n.clip }, c = this.cloneTrackSnapshot(r), d = this.cloneTrackSnapshot(o), u = cl({
15422
15465
  command: {
15423
15466
  ...n,
15424
15467
  clip: h
15425
15468
  },
15426
15469
  trackCollection: this.getTrackCollection()
15427
15470
  }), p = this.getClips().find((g) => g.id === t) ?? null;
15428
- return No({
15471
+ return Fo({
15429
15472
  applied: u,
15430
15473
  clipId: t,
15431
15474
  sourceTrackId: r,
@@ -15436,7 +15479,7 @@ class Rl {
15436
15479
  targetTrackSnapshot: d,
15437
15480
  isExecutingHistoryAction: this.isExecutingHistoryAction,
15438
15481
  recordMoveClipBetweenTracks: this.getTimelineHistoryRecorder().recordMoveClipBetweenTracks.bind(this.getTimelineHistoryRecorder()),
15439
- applyEffects: () => dl({
15482
+ applyEffects: () => ul({
15440
15483
  notifySelectionChange: this.notifySelectionChange.bind(this),
15441
15484
  cleanupEmptyTracks: this.cleanupEmptyTracks.bind(this),
15442
15485
  updateTrackInfoPanel: this.updateTrackInfoPanel.bind(this),
@@ -15449,11 +15492,11 @@ class Rl {
15449
15492
  }) ? (this.clearAllTrackDropPreviews(), !0) : !1;
15450
15493
  }
15451
15494
  /**
15452
- * 获取轨道内的总时长(包含空隙)
15453
- * @returns 从0到最后一个clip结束时间的总时长(毫秒)
15495
+ * 获取轨道内的有效总时长(去除首尾空白)
15496
+ * @returns 最早 clip 起点到最晚 clip 终点的时长(毫秒)
15454
15497
  */
15455
15498
  getTrackTotalDuration() {
15456
- return Tn(this.getClips());
15499
+ return ws(this.getClips());
15457
15500
  }
15458
15501
  destroy() {
15459
15502
  var t, e, i, s, n, r, o, l, h, c, d;
@@ -15500,10 +15543,10 @@ class Rl {
15500
15543
  return null;
15501
15544
  }
15502
15545
  handleClipToggleSelection(t) {
15503
- this.resetMultiDragSession(), this.selectionStore.toggleSelection(t), this.emitSelectionChangeEvent(), this.updateAllTracksSelectionVisual();
15546
+ this.resetMultiDragSession(), this.selectionStore.toggleSelection(t), this.syncPrimarySelectionFromSelectionStore(t), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15504
15547
  }
15505
15548
  handleSetSingleSelection(t) {
15506
- this.resetMultiDragSession(), this.selectionStore.setSelection([t]), this.emitSelectionChangeEvent(), this.updateAllTracksSelectionVisual();
15549
+ this.resetMultiDragSession(), this.selectionStore.setSelection([t]), this.syncPrimarySelectionFromSelectionStore(t), this.notifySelectionChange(), this.emitSelectionChangeEvent(), this.emitSelectedClipChangeIfNeeded(), this.syncPreviewSession();
15507
15550
  }
15508
15551
  getMultiDragClipIds(t) {
15509
15552
  return this.selectionStore.isSelected(t) && this.selectionStore.getSelectionCount() > 1 ? this.selectionStore.getSelectedClipIds() : null;
@@ -16010,27 +16053,20 @@ class Rl {
16010
16053
  * 检查轨道总时长是否变化,如果变化则触发事件并更新时间轴时长
16011
16054
  */
16012
16055
  checkTrackDurationChange() {
16013
- const t = this.lastTrackDuration, e = il({
16014
- clips: this.getClips(),
16015
- lastTrackDuration: this.lastTrackDuration,
16016
- setLastTrackDuration: (i) => {
16017
- this.lastTrackDuration = i;
16018
- },
16019
- setTimelineDuration: (i) => {
16020
- var s;
16021
- this.setDurationState(i), (s = this.timeline) == null || s.setDuration(i), this.updateViewportLayout();
16022
- },
16023
- emitTrackDurationChange: (i) => {
16024
- this.emitEvent("track_duration_change", { duration: i });
16025
- }
16026
- });
16027
- e !== t && O.debugLazy(
16056
+ var r;
16057
+ const t = this.getClips(), e = this.lastTrackDuration, i = this.lastEffectiveTrackDuration, s = sl(t), n = ws(t);
16058
+ if (s !== e) {
16059
+ this.lastTrackDuration = s;
16060
+ const o = _s(s);
16061
+ this.setDurationState(o), (r = this.timeline) == null || r.setDuration(o), this.updateViewportLayout();
16062
+ }
16063
+ n !== i && (this.lastEffectiveTrackDuration = n, this.emitEvent("track_duration_change", { duration: n })), !(s === e && n === i) && O.debugLazy(
16028
16064
  "TimelineManager",
16029
- () => `Track duration changed: ${e}ms, setting timeline duration to ${vn(e)}ms`
16065
+ () => `Track duration changed: effective=${n}ms, extent=${s}ms, timeline=${_s(s)}ms`
16030
16066
  );
16031
16067
  }
16032
16068
  resolveSelectedClipSnapshot() {
16033
- return al({
16069
+ return ol({
16034
16070
  getSelectedClip: () => {
16035
16071
  var t;
16036
16072
  return ((t = this.getSelectedClip) == null ? void 0 : t.call(this)) || null;
@@ -16043,7 +16079,7 @@ class Rl {
16043
16079
  if (!i || i.type !== "video")
16044
16080
  return;
16045
16081
  const s = gt(i.visualTransform), n = gt(e);
16046
- Cn(s, n) || this.updateClip(t, {
16082
+ vn(s, n) || this.updateClip(t, {
16047
16083
  visualTransform: n
16048
16084
  });
16049
16085
  }
@@ -16068,31 +16104,31 @@ class Rl {
16068
16104
  }
16069
16105
  }
16070
16106
  export {
16071
- Il as CLIP_LAYER,
16107
+ Ml as CLIP_LAYER,
16072
16108
  ai as Clip,
16073
- Mo as ClipConfigPanel,
16074
- An as DEFAULT_CLIP_VIEW_STATE,
16109
+ Lo as ClipConfigPanel,
16110
+ En as DEFAULT_CLIP_VIEW_STATE,
16075
16111
  wt as DEFAULT_PREVIEW_ASPECT_RATIO,
16076
16112
  ms as HistoryManager,
16077
16113
  Xe as MIN_CLIP_LINE_WIDTH,
16078
- El as PREVIEW_ASPECT_RATIO_PRESETS,
16079
- Dl as Playhead,
16114
+ Il as PREVIEW_ASPECT_RATIO_PRESETS,
16115
+ Rl as Playhead,
16080
16116
  ot as TIMELINE_LEFT_PADDING,
16081
- Ml as TIME_SCALE,
16117
+ Ll as TIME_SCALE,
16082
16118
  Dt as TRACK_HEIGHT,
16083
16119
  z as TimeUtils,
16084
- Ll as Timeline,
16085
- Rl as TimelineManager,
16120
+ Dl as Timeline,
16121
+ Ol as TimelineManager,
16086
16122
  _i as Track,
16087
- Ao as TrackInfoPanel,
16088
- gl as TrackManager,
16089
- En as ZOOM_ANIMATION,
16123
+ Eo as TrackInfoPanel,
16124
+ pl as TrackManager,
16125
+ In as ZOOM_ANIMATION,
16090
16126
  ut as ZOOM_PRESETS,
16091
- In as createClipViewState,
16092
- Ds as createClipWithViewState,
16127
+ Mn as createClipViewState,
16128
+ Os as createClipWithViewState,
16093
16129
  di as defaultDarkTheme,
16094
16130
  pe as isAutoPreviewAspectRatioMode,
16095
16131
  Nt as normalizePreviewAspectRatio,
16096
- Ls as normalizePreviewAspectRatioMode,
16132
+ Rs as normalizePreviewAspectRatioMode,
16097
16133
  Ye as resolveTheme
16098
16134
  };