@linker-design-plus/timeline-track 2.1.3 → 2.1.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
@@ -74,7 +74,7 @@ const _ = {
74
74
  scrollbarBackground: _.borderStrong,
75
75
  scrollbarBorder: _.borderSubtle,
76
76
  scrollbarThumb: _.borderMedium
77
- }, me = {
77
+ }, ye = {
78
78
  backgroundColor: "#0f0f0f",
79
79
  borderColor: _.borderStrong,
80
80
  textColor: _.textSecondary,
@@ -87,7 +87,7 @@ const _ = {
87
87
  buttonActiveBackground: _.accentFocus,
88
88
  buttonActiveBorder: _.accentFocus,
89
89
  buttonActiveText: _.white
90
- }, be = {
90
+ }, ke = {
91
91
  background: _.panelSurface,
92
92
  border: _.borderStrong,
93
93
  text: _.textPrimary,
@@ -102,7 +102,7 @@ const _ = {
102
102
  fill: _.white,
103
103
  stroke: _.black,
104
104
  text: _.black
105
- }, Pe = {
105
+ }, xe = {
106
106
  tabBarBackground: _.buttonSurface,
107
107
  actionBarBackground: _.buttonSurface,
108
108
  activeTabBackground: _.activeTabBackground,
@@ -198,7 +198,7 @@ const qs = 720, He = {
198
198
  mode: "auto-first-added-video",
199
199
  width: 16,
200
200
  height: 9
201
- }, Vp = [
201
+ }, Xp = [
202
202
  {
203
203
  key: "default",
204
204
  label: "默认",
@@ -248,7 +248,7 @@ function Ks(s, e = qs) {
248
248
  height: Math.round(i * a)
249
249
  };
250
250
  }
251
- const Up = {
251
+ const qp = {
252
252
  DEFAULT: 1,
253
253
  // 默认层级
254
254
  ACTIVE: 2
@@ -264,20 +264,20 @@ const Up = {
264
264
  CONVERGENCE_THRESHOLD: 1e-4
265
265
  }, ho = 3e3, uo = 450, po = {
266
266
  ANCHOR_INDEX_WEIGHT: 1e-3
267
- }, $i = {
267
+ }, zi = {
268
268
  MIN: 5,
269
269
  MAX: 300
270
- }, Wp = {
270
+ }, jp = {
271
271
  DURATION: 300,
272
272
  // 动画持续时间(毫秒)
273
273
  EASING: "easeOutCubic"
274
274
  // 缓动函数
275
- }, Yp = {
275
+ }, Kp = {
276
276
  DEFAULT_HEIGHT: 40,
277
277
  // 默认时间刻度高度
278
278
  MIN_HEIGHT: 20,
279
279
  MAX_HEIGHT: 80
280
- }, _e = 15, zi = 6, or = {
280
+ }, fe = 15, $i = 6, or = {
281
281
  TEXT: 25,
282
282
  // 文本轨道高度
283
283
  VIDEO: 64,
@@ -303,7 +303,7 @@ function Zs(s, e = {}) {
303
303
  function Dr(s) {
304
304
  s.disablePictureInPicture = !0, s.setAttribute("disablepictureinpicture", "");
305
305
  }
306
- class Y {
306
+ class U {
307
307
  /**
308
308
  * 将毫秒转换为秒
309
309
  */
@@ -428,7 +428,7 @@ class Y {
428
428
  /**
429
429
  * 刻度类型
430
430
  */
431
- g(Y, "TICK_TYPE_MAJOR", "major"), g(Y, "TICK_TYPE_MINOR", "minor");
431
+ g(U, "TICK_TYPE_MAJOR", "major"), g(U, "TICK_TYPE_MINOR", "minor");
432
432
  const fo = Math.PI / 180;
433
433
  function mo() {
434
434
  return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
@@ -500,7 +500,7 @@ js: import "konva/skia-backend";
500
500
  if (typeof document > "u")
501
501
  throw new Error(yo);
502
502
  };
503
- class ve {
503
+ class Ce {
504
504
  constructor(e = [1, 0, 0, 1, 0, 0]) {
505
505
  this.dirty = !1, this.m = e && e.slice() || [1, 0, 0, 1, 0, 0];
506
506
  }
@@ -508,7 +508,7 @@ class ve {
508
508
  this.m[0] = 1, this.m[1] = 0, this.m[2] = 0, this.m[3] = 1, this.m[4] = 0, this.m[5] = 0;
509
509
  }
510
510
  copy() {
511
- return new ve(this.m);
511
+ return new Ce(this.m);
512
512
  }
513
513
  copyInto(e) {
514
514
  e.m[0] = this.m[0], e.m[1] = this.m[1], e.m[2] = this.m[2], e.m[3] = this.m[3], e.m[4] = this.m[4], e.m[5] = this.m[5];
@@ -1083,14 +1083,14 @@ const Io = typeof requestAnimationFrame < "u" && requestAnimationFrame || functi
1083
1083
  const a = e[(n - 1 + t) % t], o = e[n], l = e[(n + 1) % t], c = { x: o.x - a.x, y: o.y - a.y }, h = { x: l.x - o.x, y: l.y - o.y }, d = Math.hypot(c.x, c.y), u = Math.hypot(h.x, h.y);
1084
1084
  let p;
1085
1085
  typeof r == "number" ? p = r : p = n < r.length ? r[n] : 0, p = i * Math.cos(Math.PI / t) * Math.min(1, p / i * 2);
1086
- const m = { x: c.x / d, y: c.y / d }, v = { x: h.x / u, y: h.y / u }, T = {
1086
+ const m = { x: c.x / d, y: c.y / d }, S = { x: h.x / u, y: h.y / u }, T = {
1087
1087
  x: o.x - m.x * p,
1088
1088
  y: o.y - m.y * p
1089
- }, S = {
1090
- x: o.x + v.x * p,
1091
- y: o.y + v.y * p
1089
+ }, v = {
1090
+ x: o.x + S.x * p,
1091
+ y: o.y + S.y * p
1092
1092
  };
1093
- n === 0 ? s.moveTo(T.x, T.y) : s.lineTo(T.x, T.y), s.arcTo(o.x, o.y, S.x, S.y, p);
1093
+ n === 0 ? s.moveTo(T.x, T.y) : s.lineTo(T.x, T.y), s.arcTo(o.x, o.y, v.x, v.y, p);
1094
1094
  }
1095
1095
  }
1096
1096
  };
@@ -1454,7 +1454,7 @@ class Ho extends er {
1454
1454
  this.setAttr("shadowColor", n), this.setAttr("shadowBlur", a * Math.min(Math.abs(h), Math.abs(d))), this.setAttr("shadowOffsetX", o.x * h), this.setAttr("shadowOffsetY", o.y * d);
1455
1455
  }
1456
1456
  }
1457
- class $o extends er {
1457
+ class zo extends er {
1458
1458
  constructor(e) {
1459
1459
  super(e), this._context = e._canvas.getContext("2d", {
1460
1460
  willReadFrequently: !0
@@ -1481,7 +1481,7 @@ class $o extends er {
1481
1481
  }
1482
1482
  }
1483
1483
  let Ti;
1484
- function zo() {
1484
+ function $o() {
1485
1485
  if (Ti)
1486
1486
  return Ti;
1487
1487
  const s = b.createCanvasElement(), e = s.getContext("2d");
@@ -1493,7 +1493,7 @@ function zo() {
1493
1493
  class an {
1494
1494
  constructor(e) {
1495
1495
  this.pixelRatio = 1, this.width = 0, this.height = 0, this.isCache = !1;
1496
- const i = (e || {}).pixelRatio || M.pixelRatio || zo();
1496
+ const i = (e || {}).pixelRatio || M.pixelRatio || $o();
1497
1497
  this.pixelRatio = i, this._canvas = b.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";
1498
1498
  }
1499
1499
  getContext() {
@@ -1546,7 +1546,7 @@ class je extends an {
1546
1546
  }
1547
1547
  class on extends an {
1548
1548
  constructor(e = { width: 0, height: 0 }) {
1549
- super(e), this.hitCanvas = !0, this.context = new $o(this), this.setSize(e.width, e.height);
1549
+ super(e), this.hitCanvas = !0, this.context = new zo(this), this.setSize(e.width, e.height);
1550
1550
  }
1551
1551
  }
1552
1552
  const J = {
@@ -1867,19 +1867,19 @@ class E {
1867
1867
  width: 0,
1868
1868
  height: 0,
1869
1869
  willReadFrequently: !0
1870
- }), v = new on({
1870
+ }), S = new on({
1871
1871
  pixelRatio: d,
1872
1872
  width: r,
1873
1873
  height: n
1874
- }), T = f.getContext(), S = v.getContext(), C = new je({
1874
+ }), T = f.getContext(), v = S.getContext(), C = new je({
1875
1875
  width: f.width / f.pixelRatio + Math.abs(o),
1876
1876
  height: f.height / f.pixelRatio + Math.abs(l),
1877
1877
  pixelRatio: f.pixelRatio
1878
1878
  }), k = C.getContext();
1879
- return v.isCache = !0, f.isCache = !0, this._cache.delete(rt), this._filterUpToDate = !1, t.imageSmoothingEnabled === !1 && (f.getContext()._context.imageSmoothingEnabled = !1, m.getContext()._context.imageSmoothingEnabled = !1), T.save(), S.save(), k.save(), T.translate(-o, -l), S.translate(-o, -l), k.translate(-o, -l), C.x = o, C.y = l, this._isUnderCache = !0, this._clearSelfAndDescendantCache(Oi), this._clearSelfAndDescendantCache(An), this.drawScene(f, this, C), this.drawHit(v, this), this._isUnderCache = !1, T.restore(), S.restore(), h && (T.save(), T.beginPath(), T.rect(0, 0, r, n), T.closePath(), T.setAttr("strokeStyle", "red"), T.setAttr("lineWidth", 5), T.stroke(), T.restore()), b.releaseCanvas(C._canvas), this._cache.set(rt, {
1879
+ return S.isCache = !0, f.isCache = !0, this._cache.delete(rt), this._filterUpToDate = !1, t.imageSmoothingEnabled === !1 && (f.getContext()._context.imageSmoothingEnabled = !1, m.getContext()._context.imageSmoothingEnabled = !1), T.save(), v.save(), k.save(), T.translate(-o, -l), v.translate(-o, -l), k.translate(-o, -l), C.x = o, C.y = l, this._isUnderCache = !0, this._clearSelfAndDescendantCache(Oi), this._clearSelfAndDescendantCache(An), this.drawScene(f, this, C), this.drawHit(S, this), this._isUnderCache = !1, T.restore(), v.restore(), h && (T.save(), T.beginPath(), T.rect(0, 0, r, n), T.closePath(), T.setAttr("strokeStyle", "red"), T.setAttr("lineWidth", 5), T.stroke(), T.restore()), b.releaseCanvas(C._canvas), this._cache.set(rt, {
1880
1880
  scene: f,
1881
1881
  filter: m,
1882
- hit: v,
1882
+ hit: S,
1883
1883
  x: o,
1884
1884
  y: l
1885
1885
  }), this._requestDraw(), this;
@@ -2116,7 +2116,7 @@ class E {
2116
2116
  i = i.parent;
2117
2117
  }
2118
2118
  t && !e && (e = !0);
2119
- const r = this.getAbsoluteTransform(e).getMatrix(), n = new ve(), a = this.offset();
2119
+ const r = this.getAbsoluteTransform(e).getMatrix(), n = new Ce(), a = this.offset();
2120
2120
  return n.m = r.slice(), n.translate(a.x, a.y), n.getTranslation();
2121
2121
  }
2122
2122
  setAbsolutePosition(e) {
@@ -2275,12 +2275,12 @@ class E {
2275
2275
  _getAbsoluteTransform(e) {
2276
2276
  let t;
2277
2277
  if (e)
2278
- return t = new ve(), this._eachAncestorReverse(function(i) {
2278
+ return t = new Ce(), this._eachAncestorReverse(function(i) {
2279
2279
  const r = i.transformsEnabled();
2280
2280
  r === "all" ? t.multiply(i.getTransform()) : r === "position" && t.translate(i.x() - i.offsetX(), i.y() - i.offsetY());
2281
2281
  }, e), t;
2282
2282
  {
2283
- t = this._cache.get(Oe) || new ve(), this.parent ? this.parent.getAbsoluteTransform().copyInto(t) : t.reset();
2283
+ t = this._cache.get(Oe) || new Ce(), this.parent ? this.parent.getAbsoluteTransform().copyInto(t) : t.reset();
2284
2284
  const i = this.transformsEnabled();
2285
2285
  if (i === "all")
2286
2286
  t.multiply(this.getTransform());
@@ -2309,7 +2309,7 @@ class E {
2309
2309
  }
2310
2310
  _getTransform() {
2311
2311
  var e, t;
2312
- const i = this._cache.get(Xe) || new ve();
2312
+ const i = this._cache.get(Xe) || new Ce();
2313
2313
  i.reset();
2314
2314
  const r = this.x(), n = this.y(), a = M.getAngle(this.rotation()), o = (e = this.attrs.scaleX) !== null && e !== void 0 ? e : 1, l = (t = this.attrs.scaleY) !== null && t !== void 0 ? t : 1, c = this.attrs.skewX || 0, h = this.attrs.skewY || 0, d = this.attrs.offsetX || 0, u = this.attrs.offsetY || 0;
2315
2315
  return (r !== 0 || n !== 0) && i.translate(r, n), a !== 0 && i.rotate(a), (c !== 0 || h !== 0) && i.skew(c, h), (o !== 1 || l !== 1) && i.scale(o, l), (d !== 0 || u !== 0) && i.translate(-1 * d, -1 * u), i.dirty = !1, i;
@@ -2641,7 +2641,7 @@ y.backCompat(E, {
2641
2641
  setRotationDeg: "setRotation",
2642
2642
  getRotationDeg: "getRotation"
2643
2643
  });
2644
- class Ce extends E {
2644
+ class Te extends E {
2645
2645
  constructor() {
2646
2646
  super(...arguments), this.children = [];
2647
2647
  }
@@ -2778,8 +2778,8 @@ class Ce extends E {
2778
2778
  if (c)
2779
2779
  m = c.call(this, a, this);
2780
2780
  else {
2781
- const v = this.clipX(), T = this.clipY();
2782
- a.rect(v || 0, T || 0, o, l);
2781
+ const S = this.clipX(), T = this.clipY();
2782
+ a.rect(S || 0, T || 0, o, l);
2783
2783
  }
2784
2784
  a.clip.apply(a, m), f = p.copy().invert().getMatrix(), a.transform(f[0], f[1], f[2], f[3], f[4], f[5]);
2785
2785
  }
@@ -2828,17 +2828,17 @@ class Ce extends E {
2828
2828
  }, i ? c : this._transformedRect(c, r);
2829
2829
  }
2830
2830
  }
2831
- y.addComponentsGetterSetter(Ce, "clip", [
2831
+ y.addComponentsGetterSetter(Te, "clip", [
2832
2832
  "x",
2833
2833
  "y",
2834
2834
  "width",
2835
2835
  "height"
2836
2836
  ]);
2837
- y.addGetterSetter(Ce, "clipX", void 0, R());
2838
- y.addGetterSetter(Ce, "clipY", void 0, R());
2839
- y.addGetterSetter(Ce, "clipWidth", void 0, R());
2840
- y.addGetterSetter(Ce, "clipHeight", void 0, R());
2841
- y.addGetterSetter(Ce, "clipFunc");
2837
+ y.addGetterSetter(Te, "clipX", void 0, R());
2838
+ y.addGetterSetter(Te, "clipY", void 0, R());
2839
+ y.addGetterSetter(Te, "clipWidth", void 0, R());
2840
+ y.addGetterSetter(Te, "clipHeight", void 0, R());
2841
+ y.addGetterSetter(Te, "clipFunc");
2842
2842
  const oi = /* @__PURE__ */ new Map(), ea = M._global.PointerEvent !== void 0;
2843
2843
  function cr(s) {
2844
2844
  return oi.get(s);
@@ -2931,7 +2931,7 @@ function Dn(s = {}) {
2931
2931
  return (s.clipFunc || s.clipWidth || s.clipHeight) && b.warn("Stage does not support clipping. Please use clip for Layers or Groups."), s;
2932
2932
  }
2933
2933
  const hl = "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);", Qt = [];
2934
- class ir extends Ce {
2934
+ class ir extends Te {
2935
2935
  constructor(e) {
2936
2936
  super(Dn(e)), this._pointerPositions = [], this._changedPointerPositions = [], this._buildDOM(), this._bindContentEvents(), Qt.push(this), this.on("widthChange.konva heightChange.konva", this._resizeDOM), this.on("visibleChange.konva", this._checkVisibility), this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva", () => {
2937
2937
  Dn(this.attrs);
@@ -2970,7 +2970,7 @@ class ir extends Ce {
2970
2970
  return this;
2971
2971
  }
2972
2972
  clone(e) {
2973
- return e || (e = {}), e.container = typeof document < "u" && document.createElement("div"), Ce.prototype.clone.call(this, e);
2973
+ return e || (e = {}), e.container = typeof document < "u" && document.createElement("div"), Te.prototype.clone.call(this, e);
2974
2974
  }
2975
2975
  destroy() {
2976
2976
  super.destroy();
@@ -3375,7 +3375,7 @@ class I extends E {
3375
3375
  if (this.fillPatternImage()) {
3376
3376
  const t = dr().createPattern(this.fillPatternImage(), this.fillPatternRepeat() || "repeat");
3377
3377
  if (t && t.setTransform) {
3378
- const i = new ve();
3378
+ const i = new Ce();
3379
3379
  i.translate(this.fillPatternX(), this.fillPatternY()), i.rotate(M.getAngle(this.fillPatternRotation())), i.scale(this.fillPatternScaleX(), this.fillPatternScaleY()), i.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());
3380
3380
  const r = i.getMatrix(), n = typeof DOMMatrix > "u" ? {
3381
3381
  a: r[0],
@@ -3489,11 +3489,11 @@ class I extends E {
3489
3489
  }
3490
3490
  i = i.getParent();
3491
3491
  }
3492
- const r = e.skipTransform, n = e.relativeTo || t && this.getStage() || void 0, a = this.getSelfRect(), l = !e.skipStroke && this.hasStroke() && this.strokeWidth() || 0, c = a.width + l, h = a.height + l, d = !e.skipShadow && this.hasShadow(), u = d ? this.shadowOffsetX() : 0, p = d ? this.shadowOffsetY() : 0, f = c + Math.abs(u), m = h + Math.abs(p), v = d && this.shadowBlur() || 0, T = f + v * 2, S = m + v * 2, C = {
3492
+ const r = e.skipTransform, n = e.relativeTo || t && this.getStage() || void 0, a = this.getSelfRect(), l = !e.skipStroke && this.hasStroke() && this.strokeWidth() || 0, c = a.width + l, h = a.height + l, d = !e.skipShadow && this.hasShadow(), u = d ? this.shadowOffsetX() : 0, p = d ? this.shadowOffsetY() : 0, f = c + Math.abs(u), m = h + Math.abs(p), S = d && this.shadowBlur() || 0, T = f + S * 2, v = m + S * 2, C = {
3493
3493
  width: T,
3494
- height: S,
3495
- x: -(l / 2 + v) + Math.min(u, 0) + a.x,
3496
- y: -(l / 2 + v) + Math.min(p, 0) + a.y
3494
+ height: v,
3495
+ x: -(l / 2 + S) + Math.min(u, 0) + a.x,
3496
+ y: -(l / 2 + S) + Math.min(p, 0) + a.y
3497
3497
  };
3498
3498
  return r ? C : this._transformedRect(C, n);
3499
3499
  }
@@ -3678,7 +3678,7 @@ const Cl = "beforeDraw", Tl = "draw", Sa = [
3678
3678
  { x: 1, y: 1 },
3679
3679
  { x: -1, y: 1 }
3680
3680
  ], bl = Sa.length;
3681
- class gt extends Ce {
3681
+ class gt extends Te {
3682
3682
  constructor(e) {
3683
3683
  super(e), this.canvas = new je(), this.hitCanvas = new on({
3684
3684
  pixelRatio: 1
@@ -3825,13 +3825,13 @@ class gt extends Ce {
3825
3825
  const r = this.getLayer(), n = e || r && r.getCanvas();
3826
3826
  return this._fire(Cl, {
3827
3827
  node: this
3828
- }), this.clearBeforeDraw() && n.getContext().clear(), Ce.prototype.drawScene.call(this, n, t, i), this._fire(Tl, {
3828
+ }), this.clearBeforeDraw() && n.getContext().clear(), Te.prototype.drawScene.call(this, n, t, i), this._fire(Tl, {
3829
3829
  node: this
3830
3830
  }), this;
3831
3831
  }
3832
3832
  drawHit(e, t) {
3833
3833
  const i = this.getLayer(), r = e || i && i.hitCanvas;
3834
- return i && i.clearBeforeDraw() && i.getHitCanvas().getContext().clear(), Ce.prototype.drawHit.call(this, r, t), this;
3834
+ return i && i.clearBeforeDraw() && i.getHitCanvas().getContext().clear(), Te.prototype.drawHit.call(this, r, t), this;
3835
3835
  }
3836
3836
  enableHitGraph() {
3837
3837
  return this.hitGraphEnabled(!0), this;
@@ -3867,7 +3867,7 @@ class hn extends gt {
3867
3867
  }
3868
3868
  hn.prototype.nodeType = "FastLayer";
3869
3869
  oe(hn);
3870
- class At extends Ce {
3870
+ class At extends Te {
3871
3871
  _validateAdd(e) {
3872
3872
  const t = e.getType();
3873
3873
  t !== "Group" && t !== "Shape" && b.throw("You may only add groups and shapes to groups.");
@@ -3882,9 +3882,9 @@ const ur = function() {
3882
3882
  return (/* @__PURE__ */ new Date()).getTime();
3883
3883
  };
3884
3884
  }();
3885
- class ke {
3885
+ class we {
3886
3886
  constructor(e, t) {
3887
- this.id = ke.animIdCounter++, this.frame = {
3887
+ this.id = we.animIdCounter++, this.frame = {
3888
3888
  time: 0,
3889
3889
  timeDiff: 0,
3890
3890
  lastTime: ur(),
@@ -3906,17 +3906,17 @@ class ke {
3906
3906
  return this.layers.push(e), !0;
3907
3907
  }
3908
3908
  isRunning() {
3909
- const t = ke.animations, i = t.length;
3909
+ const t = we.animations, i = t.length;
3910
3910
  for (let r = 0; r < i; r++)
3911
3911
  if (t[r].id === this.id)
3912
3912
  return !0;
3913
3913
  return !1;
3914
3914
  }
3915
3915
  start() {
3916
- return this.stop(), this.frame.timeDiff = 0, this.frame.lastTime = ur(), ke._addAnimation(this), this;
3916
+ return this.stop(), this.frame.timeDiff = 0, this.frame.lastTime = ur(), we._addAnimation(this), this;
3917
3917
  }
3918
3918
  stop() {
3919
- return ke._removeAnimation(this), this;
3919
+ return we._removeAnimation(this), this;
3920
3920
  }
3921
3921
  _updateFrameObject(e) {
3922
3922
  this.frame.timeDiff = e - this.frame.lastTime, this.frame.lastTime = e, this.frame.time += this.frame.timeDiff, this.frame.frameRate = 1e3 / this.frame.timeDiff;
@@ -3949,16 +3949,16 @@ class ke {
3949
3949
  e.hasOwnProperty(i) && e[i].batchDraw();
3950
3950
  }
3951
3951
  static _animationLoop() {
3952
- const e = ke;
3952
+ const e = we;
3953
3953
  e.animations.length ? (e._runFrames(), b.requestAnimFrame(e._animationLoop)) : e.animRunning = !1;
3954
3954
  }
3955
3955
  static _handleAnimation() {
3956
3956
  this.animRunning || (this.animRunning = !0, b.requestAnimFrame(this._animationLoop));
3957
3957
  }
3958
3958
  }
3959
- ke.animations = [];
3960
- ke.animIdCounter = 0;
3961
- ke.animRunning = !1;
3959
+ we.animations = [];
3960
+ we.animIdCounter = 0;
3961
+ we.animRunning = !1;
3962
3962
  const kl = {
3963
3963
  node: 1,
3964
3964
  duration: 1,
@@ -4022,7 +4022,7 @@ class re {
4022
4022
  let o, l;
4023
4023
  typeof e.duration > "u" ? o = 0.3 : e.duration === 0 ? o = 1e-3 : o = e.duration, this.node = i, this._id = Pl++;
4024
4024
  const c = i.getLayer() || (i instanceof M.Stage ? i.getLayers() : null);
4025
- c || b.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new ke(function() {
4025
+ c || b.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."), this.anim = new we(function() {
4026
4026
  t.tween.onEnterFrame();
4027
4027
  }, c), this.tween = new xl(l, function(h) {
4028
4028
  t._tweenFunc(h);
@@ -4189,9 +4189,9 @@ const ti = {
4189
4189
  }
4190
4190
  }, Fn = b._assign(M, {
4191
4191
  Util: b,
4192
- Transform: ve,
4192
+ Transform: Ce,
4193
4193
  Node: E,
4194
- Container: Ce,
4194
+ Container: Te,
4195
4195
  Stage: ir,
4196
4196
  stages: Qt,
4197
4197
  Layer: gt,
@@ -4200,13 +4200,13 @@ const ti = {
4200
4200
  DD: J,
4201
4201
  Shape: I,
4202
4202
  shapes: ei,
4203
- Animation: ke,
4203
+ Animation: we,
4204
4204
  Tween: re,
4205
4205
  Easings: ti,
4206
4206
  Context: er,
4207
4207
  Canvas: an
4208
4208
  });
4209
- class $e extends I {
4209
+ class ze extends I {
4210
4210
  _sceneFunc(e) {
4211
4211
  const t = M.getAngle(this.angle()), i = this.clockwise();
4212
4212
  e.beginPath(), e.arc(0, 0, this.outerRadius(), 0, t, i), e.arc(0, 0, this.innerRadius(), t, 0, !i), e.closePath(), e.fillStrokeShape(this);
@@ -4233,19 +4233,19 @@ class $e extends I {
4233
4233
  };
4234
4234
  }
4235
4235
  }
4236
- $e.prototype._centroid = !0;
4237
- $e.prototype.className = "Arc";
4238
- $e.prototype._attrsAffectingSize = [
4236
+ ze.prototype._centroid = !0;
4237
+ ze.prototype.className = "Arc";
4238
+ ze.prototype._attrsAffectingSize = [
4239
4239
  "innerRadius",
4240
4240
  "outerRadius",
4241
4241
  "angle",
4242
4242
  "clockwise"
4243
4243
  ];
4244
- oe($e);
4245
- y.addGetterSetter($e, "innerRadius", 0, R());
4246
- y.addGetterSetter($e, "outerRadius", 0, R());
4247
- y.addGetterSetter($e, "angle", 0, R());
4248
- y.addGetterSetter($e, "clockwise", !1, Ie());
4244
+ oe(ze);
4245
+ y.addGetterSetter(ze, "innerRadius", 0, R());
4246
+ y.addGetterSetter(ze, "outerRadius", 0, R());
4247
+ y.addGetterSetter(ze, "angle", 0, R());
4248
+ y.addGetterSetter(ze, "clockwise", !1, Ie());
4249
4249
  function Nr(s, e, t, i, r, n, a) {
4250
4250
  const o = Math.sqrt(Math.pow(t - s, 2) + Math.pow(i - e, 2)), l = Math.sqrt(Math.pow(r - t, 2) + Math.pow(n - i, 2)), c = a * o / (o + l), h = a * l / (o + l), d = t - c * (r - s), u = i - c * (n - e), p = t + h * (r - s), f = i + h * (n - e);
4251
4251
  return [d, u, p, f];
@@ -4278,7 +4278,7 @@ function _l(s) {
4278
4278
  return n * n * n * r[0] + 3 * n * n * i * r[1] + 3 * n * i * i * r[2] + i * i * i * r[3];
4279
4279
  }));
4280
4280
  }
4281
- class ze extends I {
4281
+ class $e extends I {
4282
4282
  constructor(e) {
4283
4283
  super(e), this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva", function() {
4284
4284
  this._clearCache("tensionPoints");
@@ -4362,13 +4362,13 @@ class ze extends I {
4362
4362
  };
4363
4363
  }
4364
4364
  }
4365
- ze.prototype.className = "Line";
4366
- ze.prototype._attrsAffectingSize = ["points", "bezier", "tension"];
4367
- oe(ze);
4368
- y.addGetterSetter(ze, "closed", !1);
4369
- y.addGetterSetter(ze, "bezier", !1);
4370
- y.addGetterSetter(ze, "tension", 0, R());
4371
- y.addGetterSetter(ze, "points", [], Vo());
4365
+ $e.prototype.className = "Line";
4366
+ $e.prototype._attrsAffectingSize = ["points", "bezier", "tension"];
4367
+ oe($e);
4368
+ y.addGetterSetter($e, "closed", !1);
4369
+ y.addGetterSetter($e, "bezier", !1);
4370
+ y.addGetterSetter($e, "tension", 0, R());
4371
+ y.addGetterSetter($e, "points", [], Vo());
4372
4372
  const Al = [
4373
4373
  [],
4374
4374
  [],
@@ -5074,8 +5074,8 @@ const Al = [
5074
5074
  const i = s[0] - 2 * s[1] + s[2], r = e[0] - 2 * e[1] + e[2], n = 2 * s[1] - 2 * s[0], a = 2 * e[1] - 2 * e[0], o = 4 * (i * i + r * r), l = 4 * (i * n + r * a), c = n * n + a * a;
5075
5075
  if (o === 0)
5076
5076
  return t * Math.sqrt(Math.pow(s[2] - s[0], 2) + Math.pow(e[2] - e[0], 2));
5077
- const h = l / (2 * o), d = c / o, u = t + h, p = d - h * h, f = u * u + p > 0 ? Math.sqrt(u * u + p) : 0, m = h * h + p > 0 ? Math.sqrt(h * h + p) : 0, v = h + Math.sqrt(h * h + p) !== 0 ? p * Math.log(Math.abs((u + f) / (h + m))) : 0;
5078
- return Math.sqrt(o) / 2 * (u * f - h * m + v);
5077
+ const h = l / (2 * o), d = c / o, u = t + h, p = d - h * h, f = u * u + p > 0 ? Math.sqrt(u * u + p) : 0, m = h * h + p > 0 ? Math.sqrt(h * h + p) : 0, S = h + Math.sqrt(h * h + p) !== 0 ? p * Math.log(Math.abs((u + f) / (h + m))) : 0;
5078
+ return Math.sqrt(o) / 2 * (u * f - h * m + S);
5079
5079
  };
5080
5080
  function Rl(s, e, t) {
5081
5081
  const i = Gr(1, t, s), r = Gr(1, t, e), n = i * i + r * r;
@@ -5097,7 +5097,7 @@ const Gr = (s, e, t) => {
5097
5097
  r[a] = i * (t[a + 1] - t[a]);
5098
5098
  return Gr(s - 1, e, r);
5099
5099
  }
5100
- }, $n = (s, e, t) => {
5100
+ }, zn = (s, e, t) => {
5101
5101
  let i = 1, r = s / e, n = (s - t(r)) / e, a = 0;
5102
5102
  for (; i > 1e-3; ) {
5103
5103
  const o = t(r + n), l = Math.abs(s - o) / e;
@@ -5141,8 +5141,8 @@ class ne extends I {
5141
5141
  e.quadraticCurveTo(a[0], a[1], a[2], a[3]);
5142
5142
  break;
5143
5143
  case "A":
5144
- const o = a[0], l = a[1], c = a[2], h = a[3], d = a[4], u = a[5], p = a[6], f = a[7], m = c > h ? c : h, v = c > h ? 1 : c / h, T = c > h ? h / c : 1;
5145
- e.translate(o, l), e.rotate(p), e.scale(v, T), e.arc(0, 0, m, d, d + u, 1 - f), e.scale(1 / v, 1 / T), e.rotate(-p), e.translate(-o, -l);
5144
+ const o = a[0], l = a[1], c = a[2], h = a[3], d = a[4], u = a[5], p = a[6], f = a[7], m = c > h ? c : h, S = c > h ? 1 : c / h, T = c > h ? h / c : 1;
5145
+ e.translate(o, l), e.rotate(p), e.scale(S, T), e.arc(0, 0, m, d, d + u, 1 - f), e.scale(1 / S, 1 / T), e.rotate(-p), e.translate(-o, -l);
5146
5146
  break;
5147
5147
  case "z":
5148
5148
  i = !0, e.closePath();
@@ -5224,9 +5224,9 @@ class ne extends I {
5224
5224
  case "L":
5225
5225
  return ne.getPointOnLine(e, a.start.x, a.start.y, o[0], o[1]);
5226
5226
  case "C":
5227
- return ne.getPointOnCubicBezier($n(e, ne.getPathLength(t), (m) => Gn([a.start.x, o[0], o[2], o[4]], [a.start.y, o[1], o[3], o[5]], m)), a.start.x, a.start.y, o[0], o[1], o[2], o[3], o[4], o[5]);
5227
+ return ne.getPointOnCubicBezier(zn(e, ne.getPathLength(t), (m) => Gn([a.start.x, o[0], o[2], o[4]], [a.start.y, o[1], o[3], o[5]], m)), a.start.x, a.start.y, o[0], o[1], o[2], o[3], o[4], o[5]);
5228
5228
  case "Q":
5229
- return ne.getPointOnQuadraticBezier($n(e, ne.getPathLength(t), (m) => Hn([a.start.x, o[0], o[2]], [a.start.y, o[1], o[3]], m)), a.start.x, a.start.y, o[0], o[1], o[2], o[3]);
5229
+ return ne.getPointOnQuadraticBezier(zn(e, ne.getPathLength(t), (m) => Hn([a.start.x, o[0], o[2]], [a.start.y, o[1], o[3]], m)), a.start.x, a.start.y, o[0], o[1], o[2], o[3]);
5230
5230
  case "A":
5231
5231
  const l = o[0], c = o[1], h = o[2], d = o[3], u = o[5], p = o[6];
5232
5232
  let f = o[4];
@@ -5244,21 +5244,21 @@ class ne extends I {
5244
5244
  const c = (n - i) / (r - t), h = Math.sqrt(e * e / (1 + c * c)) * (r < t ? -1 : 1), d = c * h;
5245
5245
  if (Math.abs(o - i - c * (a - t)) < 1e-10)
5246
5246
  return { x: a + h, y: o + d };
5247
- const u = ((a - t) * (r - t) + (o - i) * (n - i)) / (l * l), p = t + u * (r - t), f = i + u * (n - i), m = this.getLineLength(a, o, p, f), v = Math.sqrt(e * e - m * m), T = Math.sqrt(v * v / (1 + c * c)) * (r < t ? -1 : 1), S = c * T;
5248
- return { x: p + T, y: f + S };
5247
+ const u = ((a - t) * (r - t) + (o - i) * (n - i)) / (l * l), p = t + u * (r - t), f = i + u * (n - i), m = this.getLineLength(a, o, p, f), S = Math.sqrt(e * e - m * m), T = Math.sqrt(S * S / (1 + c * c)) * (r < t ? -1 : 1), v = c * T;
5248
+ return { x: p + T, y: f + v };
5249
5249
  }
5250
5250
  static getPointOnCubicBezier(e, t, i, r, n, a, o, l, c) {
5251
- function h(v) {
5252
- return v * v * v;
5251
+ function h(S) {
5252
+ return S * S * S;
5253
5253
  }
5254
- function d(v) {
5255
- return 3 * v * v * (1 - v);
5254
+ function d(S) {
5255
+ return 3 * S * S * (1 - S);
5256
5256
  }
5257
- function u(v) {
5258
- return 3 * v * (1 - v) * (1 - v);
5257
+ function u(S) {
5258
+ return 3 * S * (1 - S) * (1 - S);
5259
5259
  }
5260
- function p(v) {
5261
- return (1 - v) * (1 - v) * (1 - v);
5260
+ function p(S) {
5261
+ return (1 - S) * (1 - S) * (1 - S);
5262
5262
  }
5263
5263
  const f = l * h(e) + a * d(e) + r * u(e) + t * p(e), m = c * h(e) + o * d(e) + n * u(e) + i * p(e);
5264
5264
  return { x: f, y: m };
@@ -5324,119 +5324,119 @@ class ne extends I {
5324
5324
  for (u = u.slice(1), a.length = 0; h = c.exec(u); )
5325
5325
  a.push(h[0]);
5326
5326
  let f = [], m = p === "A" || p === "a" ? 0 : -1;
5327
- for (let v = 0, T = a.length; v < T; v++) {
5328
- const S = a[v];
5329
- if (S === "00") {
5327
+ for (let S = 0, T = a.length; S < T; S++) {
5328
+ const v = a[S];
5329
+ if (v === "00") {
5330
5330
  f.push(0, 0), m >= 0 && (m += 2, m >= 7 && (m -= 7));
5331
5331
  continue;
5332
5332
  }
5333
5333
  if (m >= 0) {
5334
5334
  if (m === 3) {
5335
- if (/^[01]{2}\d+(?:\.\d+)?$/.test(S)) {
5336
- f.push(parseInt(S[0], 10)), f.push(parseInt(S[1], 10)), f.push(parseFloat(S.slice(2))), m += 3, m >= 7 && (m -= 7);
5335
+ if (/^[01]{2}\d+(?:\.\d+)?$/.test(v)) {
5336
+ f.push(parseInt(v[0], 10)), f.push(parseInt(v[1], 10)), f.push(parseFloat(v.slice(2))), m += 3, m >= 7 && (m -= 7);
5337
5337
  continue;
5338
5338
  }
5339
- if (S === "11" || S === "10" || S === "01") {
5340
- f.push(parseInt(S[0], 10)), f.push(parseInt(S[1], 10)), m += 2, m >= 7 && (m -= 7);
5339
+ if (v === "11" || v === "10" || v === "01") {
5340
+ f.push(parseInt(v[0], 10)), f.push(parseInt(v[1], 10)), m += 2, m >= 7 && (m -= 7);
5341
5341
  continue;
5342
5342
  }
5343
- if (S === "0" || S === "1") {
5344
- f.push(parseInt(S, 10)), m += 1, m >= 7 && (m -= 7);
5343
+ if (v === "0" || v === "1") {
5344
+ f.push(parseInt(v, 10)), m += 1, m >= 7 && (m -= 7);
5345
5345
  continue;
5346
5346
  }
5347
5347
  } else if (m === 4) {
5348
- if (/^[01]\d+(?:\.\d+)?$/.test(S)) {
5349
- f.push(parseInt(S[0], 10)), f.push(parseFloat(S.slice(1))), m += 2, m >= 7 && (m -= 7);
5348
+ if (/^[01]\d+(?:\.\d+)?$/.test(v)) {
5349
+ f.push(parseInt(v[0], 10)), f.push(parseFloat(v.slice(1))), m += 2, m >= 7 && (m -= 7);
5350
5350
  continue;
5351
5351
  }
5352
- if (S === "0" || S === "1") {
5353
- f.push(parseInt(S, 10)), m += 1, m >= 7 && (m -= 7);
5352
+ if (v === "0" || v === "1") {
5353
+ f.push(parseInt(v, 10)), m += 1, m >= 7 && (m -= 7);
5354
5354
  continue;
5355
5355
  }
5356
5356
  }
5357
- const C = parseFloat(S);
5357
+ const C = parseFloat(v);
5358
5358
  isNaN(C) ? f.push(0) : f.push(C), m += 1, m >= 7 && (m -= 7);
5359
5359
  } else {
5360
- const C = parseFloat(S);
5360
+ const C = parseFloat(v);
5361
5361
  isNaN(C) ? f.push(0) : f.push(C);
5362
5362
  }
5363
5363
  }
5364
5364
  for (; f.length > 0 && !isNaN(f[0]); ) {
5365
- let v = "", T = [];
5366
- const S = o, C = l;
5367
- let k, x, P, D, w, A, B, $, F, V;
5365
+ let S = "", T = [];
5366
+ const v = o, C = l;
5367
+ let k, P, x, D, w, A, B, z, F, $;
5368
5368
  switch (p) {
5369
5369
  case "l":
5370
- o += f.shift(), l += f.shift(), v = "L", T.push(o, l);
5370
+ o += f.shift(), l += f.shift(), S = "L", T.push(o, l);
5371
5371
  break;
5372
5372
  case "L":
5373
5373
  o = f.shift(), l = f.shift(), T.push(o, l);
5374
5374
  break;
5375
5375
  case "m":
5376
- const z = f.shift(), H = f.shift();
5377
- if (o += z, l += H, v = "M", n.length > 2 && n[n.length - 1].command === "z") {
5376
+ const V = f.shift(), H = f.shift();
5377
+ if (o += V, l += H, S = "M", n.length > 2 && n[n.length - 1].command === "z") {
5378
5378
  for (let L = n.length - 2; L >= 0; L--)
5379
5379
  if (n[L].command === "M") {
5380
- o = n[L].points[0] + z, l = n[L].points[1] + H;
5380
+ o = n[L].points[0] + V, l = n[L].points[1] + H;
5381
5381
  break;
5382
5382
  }
5383
5383
  }
5384
5384
  T.push(o, l), p = "l";
5385
5385
  break;
5386
5386
  case "M":
5387
- o = f.shift(), l = f.shift(), v = "M", T.push(o, l), p = "L";
5387
+ o = f.shift(), l = f.shift(), S = "M", T.push(o, l), p = "L";
5388
5388
  break;
5389
5389
  case "h":
5390
- o += f.shift(), v = "L", T.push(o, l);
5390
+ o += f.shift(), S = "L", T.push(o, l);
5391
5391
  break;
5392
5392
  case "H":
5393
- o = f.shift(), v = "L", T.push(o, l);
5393
+ o = f.shift(), S = "L", T.push(o, l);
5394
5394
  break;
5395
5395
  case "v":
5396
- l += f.shift(), v = "L", T.push(o, l);
5396
+ l += f.shift(), S = "L", T.push(o, l);
5397
5397
  break;
5398
5398
  case "V":
5399
- l = f.shift(), v = "L", T.push(o, l);
5399
+ l = f.shift(), S = "L", T.push(o, l);
5400
5400
  break;
5401
5401
  case "C":
5402
5402
  T.push(f.shift(), f.shift(), f.shift(), f.shift()), o = f.shift(), l = f.shift(), T.push(o, l);
5403
5403
  break;
5404
5404
  case "c":
5405
- T.push(o + f.shift(), l + f.shift(), o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), v = "C", T.push(o, l);
5405
+ T.push(o + f.shift(), l + f.shift(), o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), S = "C", T.push(o, l);
5406
5406
  break;
5407
5407
  case "S":
5408
- x = o, P = l, k = n[n.length - 1], k.command === "C" && (x = o + (o - k.points[2]), P = l + (l - k.points[3])), T.push(x, P, f.shift(), f.shift()), o = f.shift(), l = f.shift(), v = "C", T.push(o, l);
5408
+ P = o, x = l, k = n[n.length - 1], k.command === "C" && (P = o + (o - k.points[2]), x = l + (l - k.points[3])), T.push(P, x, f.shift(), f.shift()), o = f.shift(), l = f.shift(), S = "C", T.push(o, l);
5409
5409
  break;
5410
5410
  case "s":
5411
- x = o, P = l, k = n[n.length - 1], k.command === "C" && (x = o + (o - k.points[2]), P = l + (l - k.points[3])), T.push(x, P, o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), v = "C", T.push(o, l);
5411
+ P = o, x = l, k = n[n.length - 1], k.command === "C" && (P = o + (o - k.points[2]), x = l + (l - k.points[3])), T.push(P, x, o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), S = "C", T.push(o, l);
5412
5412
  break;
5413
5413
  case "Q":
5414
5414
  T.push(f.shift(), f.shift()), o = f.shift(), l = f.shift(), T.push(o, l);
5415
5415
  break;
5416
5416
  case "q":
5417
- T.push(o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), v = "Q", T.push(o, l);
5417
+ T.push(o + f.shift(), l + f.shift()), o += f.shift(), l += f.shift(), S = "Q", T.push(o, l);
5418
5418
  break;
5419
5419
  case "T":
5420
- x = o, P = l, k = n[n.length - 1], k.command === "Q" && (x = o + (o - k.points[0]), P = l + (l - k.points[1])), o = f.shift(), l = f.shift(), v = "Q", T.push(x, P, o, l);
5420
+ P = o, x = l, k = n[n.length - 1], k.command === "Q" && (P = o + (o - k.points[0]), x = l + (l - k.points[1])), o = f.shift(), l = f.shift(), S = "Q", T.push(P, x, o, l);
5421
5421
  break;
5422
5422
  case "t":
5423
- x = o, P = l, k = n[n.length - 1], k.command === "Q" && (x = o + (o - k.points[0]), P = l + (l - k.points[1])), o += f.shift(), l += f.shift(), v = "Q", T.push(x, P, o, l);
5423
+ P = o, x = l, k = n[n.length - 1], k.command === "Q" && (P = o + (o - k.points[0]), x = l + (l - k.points[1])), o += f.shift(), l += f.shift(), S = "Q", T.push(P, x, o, l);
5424
5424
  break;
5425
5425
  case "A":
5426
- D = f.shift(), w = f.shift(), A = f.shift(), B = f.shift(), $ = f.shift(), F = o, V = l, o = f.shift(), l = f.shift(), v = "A", T = this.convertEndpointToCenterParameterization(F, V, o, l, B, $, D, w, A);
5426
+ D = f.shift(), w = f.shift(), A = f.shift(), B = f.shift(), z = f.shift(), F = o, $ = l, o = f.shift(), l = f.shift(), S = "A", T = this.convertEndpointToCenterParameterization(F, $, o, l, B, z, D, w, A);
5427
5427
  break;
5428
5428
  case "a":
5429
- D = f.shift(), w = f.shift(), A = f.shift(), B = f.shift(), $ = f.shift(), F = o, V = l, o += f.shift(), l += f.shift(), v = "A", T = this.convertEndpointToCenterParameterization(F, V, o, l, B, $, D, w, A);
5429
+ D = f.shift(), w = f.shift(), A = f.shift(), B = f.shift(), z = f.shift(), F = o, $ = l, o += f.shift(), l += f.shift(), S = "A", T = this.convertEndpointToCenterParameterization(F, $, o, l, B, z, D, w, A);
5430
5430
  break;
5431
5431
  }
5432
5432
  n.push({
5433
- command: v || p,
5433
+ command: S || p,
5434
5434
  points: T,
5435
5435
  start: {
5436
- x: S,
5436
+ x: v,
5437
5437
  y: C
5438
5438
  },
5439
- pathLength: this.calcLength(S, C, v || p, T)
5439
+ pathLength: this.calcLength(v, C, S || p, T)
5440
5440
  });
5441
5441
  }
5442
5442
  (p === "z" || p === "Z") && n.push({
@@ -5477,22 +5477,22 @@ class ne extends I {
5477
5477
  p > 1 && (o *= Math.sqrt(p), l *= Math.sqrt(p));
5478
5478
  let f = Math.sqrt((o * o * (l * l) - o * o * (u * u) - l * l * (d * d)) / (o * o * (u * u) + l * l * (d * d)));
5479
5479
  n === a && (f *= -1), isNaN(f) && (f = 0);
5480
- const m = f * o * u / l, v = f * -l * d / o, T = (e + i) / 2 + Math.cos(h) * m - Math.sin(h) * v, S = (t + r) / 2 + Math.sin(h) * m + Math.cos(h) * v, C = function(B) {
5480
+ const m = f * o * u / l, S = f * -l * d / o, T = (e + i) / 2 + Math.cos(h) * m - Math.sin(h) * S, v = (t + r) / 2 + Math.sin(h) * m + Math.cos(h) * S, C = function(B) {
5481
5481
  return Math.sqrt(B[0] * B[0] + B[1] * B[1]);
5482
- }, k = function(B, $) {
5483
- return (B[0] * $[0] + B[1] * $[1]) / (C(B) * C($));
5484
- }, x = function(B, $) {
5485
- return (B[0] * $[1] < B[1] * $[0] ? -1 : 1) * Math.acos(k(B, $));
5486
- }, P = x([1, 0], [(d - m) / o, (u - v) / l]), D = [(d - m) / o, (u - v) / l], w = [(-1 * d - m) / o, (-1 * u - v) / l];
5487
- let A = x(D, w);
5488
- return k(D, w) <= -1 && (A = Math.PI), k(D, w) >= 1 && (A = 0), a === 0 && A > 0 && (A = A - 2 * Math.PI), a === 1 && A < 0 && (A = A + 2 * Math.PI), [T, S, o, l, P, A, h, a];
5482
+ }, k = function(B, z) {
5483
+ return (B[0] * z[0] + B[1] * z[1]) / (C(B) * C(z));
5484
+ }, P = function(B, z) {
5485
+ return (B[0] * z[1] < B[1] * z[0] ? -1 : 1) * Math.acos(k(B, z));
5486
+ }, x = P([1, 0], [(d - m) / o, (u - S) / l]), D = [(d - m) / o, (u - S) / l], w = [(-1 * d - m) / o, (-1 * u - S) / l];
5487
+ let A = P(D, w);
5488
+ return k(D, w) <= -1 && (A = Math.PI), k(D, w) >= 1 && (A = 0), a === 0 && A > 0 && (A = A - 2 * Math.PI), a === 1 && A < 0 && (A = A + 2 * Math.PI), [T, v, o, l, x, A, h, a];
5489
5489
  }
5490
5490
  }
5491
5491
  ne.prototype.className = "Path";
5492
5492
  ne.prototype._attrsAffectingSize = ["data"];
5493
5493
  oe(ne);
5494
5494
  y.addGetterSetter(ne, "data");
5495
- class ft extends ze {
5495
+ class ft extends $e {
5496
5496
  _sceneFunc(e) {
5497
5497
  super._sceneFunc(e);
5498
5498
  const t = Math.PI * 2, i = this.points();
@@ -5668,7 +5668,7 @@ const Ca = [
5668
5668
  "pointerDirection",
5669
5669
  "pointerWidth",
5670
5670
  "pointerHeight"
5671
- ], Ml = "Change.konva", Dl = "none", Hr = "up", $r = "right", zr = "down", Vr = "left", Ll = Ca.length;
5671
+ ], Ml = "Change.konva", Dl = "none", Hr = "up", zr = "right", $r = "down", Vr = "left", Ll = Ca.length;
5672
5672
  class dn extends At {
5673
5673
  constructor(e) {
5674
5674
  super(e), this.on("add.konva", function(t) {
@@ -5702,10 +5702,10 @@ class dn extends At {
5702
5702
  case Hr:
5703
5703
  o = i / 2, l = -1 * c;
5704
5704
  break;
5705
- case $r:
5705
+ case zr:
5706
5706
  o = i + a, l = r / 2;
5707
5707
  break;
5708
- case zr:
5708
+ case $r:
5709
5709
  o = i / 2, l = r + c;
5710
5710
  break;
5711
5711
  case Vr:
@@ -5730,11 +5730,11 @@ class mt extends I {
5730
5730
  _sceneFunc(e) {
5731
5731
  const t = this.width(), i = this.height(), r = this.pointerDirection(), n = this.pointerWidth(), a = this.pointerHeight(), o = this.cornerRadius();
5732
5732
  let l = 0, c = 0, h = 0, d = 0;
5733
- typeof o == "number" ? l = c = h = d = Math.min(o, t / 2, i / 2) : (l = Math.min(o[0] || 0, t / 2, i / 2), c = Math.min(o[1] || 0, t / 2, i / 2), d = Math.min(o[2] || 0, t / 2, i / 2), h = Math.min(o[3] || 0, t / 2, i / 2)), e.beginPath(), e.moveTo(l, 0), r === Hr && (e.lineTo((t - n) / 2, 0), e.lineTo(t / 2, -1 * a), e.lineTo((t + n) / 2, 0)), e.lineTo(t - c, 0), e.arc(t - c, c, c, Math.PI * 3 / 2, 0, !1), r === $r && (e.lineTo(t, (i - a) / 2), e.lineTo(t + n, i / 2), e.lineTo(t, (i + a) / 2)), e.lineTo(t, i - d), e.arc(t - d, i - d, d, 0, Math.PI / 2, !1), r === zr && (e.lineTo((t + n) / 2, i), e.lineTo(t / 2, i + a), e.lineTo((t - n) / 2, i)), e.lineTo(h, i), e.arc(h, i - h, h, Math.PI / 2, Math.PI, !1), r === Vr && (e.lineTo(0, (i + a) / 2), e.lineTo(-1 * n, i / 2), e.lineTo(0, (i - a) / 2)), e.lineTo(0, l), e.arc(l, l, l, Math.PI, Math.PI * 3 / 2, !1), e.closePath(), e.fillStrokeShape(this);
5733
+ typeof o == "number" ? l = c = h = d = Math.min(o, t / 2, i / 2) : (l = Math.min(o[0] || 0, t / 2, i / 2), c = Math.min(o[1] || 0, t / 2, i / 2), d = Math.min(o[2] || 0, t / 2, i / 2), h = Math.min(o[3] || 0, t / 2, i / 2)), e.beginPath(), e.moveTo(l, 0), r === Hr && (e.lineTo((t - n) / 2, 0), e.lineTo(t / 2, -1 * a), e.lineTo((t + n) / 2, 0)), e.lineTo(t - c, 0), e.arc(t - c, c, c, Math.PI * 3 / 2, 0, !1), r === zr && (e.lineTo(t, (i - a) / 2), e.lineTo(t + n, i / 2), e.lineTo(t, (i + a) / 2)), e.lineTo(t, i - d), e.arc(t - d, i - d, d, 0, Math.PI / 2, !1), r === $r && (e.lineTo((t + n) / 2, i), e.lineTo(t / 2, i + a), e.lineTo((t - n) / 2, i)), e.lineTo(h, i), e.arc(h, i - h, h, Math.PI / 2, Math.PI, !1), r === Vr && (e.lineTo(0, (i + a) / 2), e.lineTo(-1 * n, i / 2), e.lineTo(0, (i - a) / 2)), e.lineTo(0, l), e.arc(l, l, l, Math.PI, Math.PI * 3 / 2, !1), e.closePath(), e.fillStrokeShape(this);
5734
5734
  }
5735
5735
  getSelfRect() {
5736
5736
  let e = 0, t = 0, i = this.pointerWidth(), r = this.pointerHeight(), n = this.pointerDirection(), a = this.width(), o = this.height();
5737
- return n === Hr ? (t -= r, o += r) : n === zr ? o += r : n === Vr ? (e -= i * 1.5, a += i) : n === $r && (a += i * 1.5), {
5737
+ return n === Hr ? (t -= r, o += r) : n === $r ? o += r : n === Vr ? (e -= i * 1.5, a += i) : n === zr && (a += i * 1.5), {
5738
5738
  x: e,
5739
5739
  y: t,
5740
5740
  width: a,
@@ -5810,10 +5810,10 @@ oe(tt);
5810
5810
  y.addGetterSetter(tt, "radius", 0, R());
5811
5811
  y.addGetterSetter(tt, "sides", 0, R());
5812
5812
  y.addGetterSetter(tt, "cornerRadius", 0, tr(4));
5813
- const zn = Math.PI * 2;
5813
+ const $n = Math.PI * 2;
5814
5814
  class yt extends I {
5815
5815
  _sceneFunc(e) {
5816
- e.beginPath(), e.arc(0, 0, this.innerRadius(), 0, zn, !1), e.moveTo(this.outerRadius(), 0), e.arc(0, 0, this.outerRadius(), zn, 0, !0), e.closePath(), e.fillStrokeShape(this);
5816
+ e.beginPath(), e.arc(0, 0, this.innerRadius(), 0, $n, !1), e.moveTo(this.outerRadius(), 0), e.arc(0, 0, this.outerRadius(), $n, 0, !0), e.closePath(), e.fillStrokeShape(this);
5817
5817
  }
5818
5818
  getWidth() {
5819
5819
  return this.outerRadius() * 2;
@@ -5836,7 +5836,7 @@ y.addGetterSetter(yt, "innerRadius", 0, R());
5836
5836
  y.addGetterSetter(yt, "outerRadius", 0, R());
5837
5837
  class Me extends I {
5838
5838
  constructor(e) {
5839
- super(e), this._updated = !0, this.anim = new ke(() => {
5839
+ super(e), this._updated = !0, this.anim = new we(() => {
5840
5840
  const t = this._updated;
5841
5841
  return this._updated = !1, t;
5842
5842
  }), this.on("animationChange.konva", function() {
@@ -5943,7 +5943,7 @@ function qe(s) {
5943
5943
  return e;
5944
5944
  }, []);
5945
5945
  }
5946
- const vt = "auto", Bl = "center", Ta = "inherit", Nt = "justify", Ol = "Change.konva", Fl = "2d", Vn = "-", ba = "left", Nl = "text", Gl = "Text", Hl = "top", $l = "bottom", Un = "middle", ka = "normal", zl = "px ", xi = " ", Vl = "right", Wn = "rtl", Ul = "word", Wl = "char", Yn = "none", pr = "…", wa = [
5946
+ const vt = "auto", Bl = "center", Ta = "inherit", Nt = "justify", Ol = "Change.konva", Fl = "2d", Vn = "-", ba = "left", Nl = "text", Gl = "Text", Hl = "top", zl = "bottom", Un = "middle", ka = "normal", $l = "px ", xi = " ", Vl = "right", Wn = "rtl", Ul = "word", Wl = "char", Yn = "none", pr = "…", wa = [
5947
5947
  "direction",
5948
5948
  "fontFamily",
5949
5949
  "fontSize",
@@ -5992,43 +5992,43 @@ class se extends I {
5992
5992
  const r = this.textArr, n = r.length;
5993
5993
  if (!this.text())
5994
5994
  return;
5995
- let a = this.padding(), o = this.fontSize(), l = this.lineHeight() * o, c = this.verticalAlign(), h = this.direction(), d = 0, u = this.align(), p = this.getWidth(), f = this.letterSpacing(), m = this.charRenderFunc(), v = this.fill(), T = this.textDecoration(), S = this.underlineOffset(), C = T.indexOf("underline") !== -1, k = T.indexOf("line-through") !== -1, x;
5995
+ let a = this.padding(), o = this.fontSize(), l = this.lineHeight() * o, c = this.verticalAlign(), h = this.direction(), d = 0, u = this.align(), p = this.getWidth(), f = this.letterSpacing(), m = this.charRenderFunc(), S = this.fill(), T = this.textDecoration(), v = this.underlineOffset(), C = T.indexOf("underline") !== -1, k = T.indexOf("line-through") !== -1, P;
5996
5996
  h = h === Ta ? e.direction : h;
5997
- let P = l / 2, D = Un;
5997
+ let x = l / 2, D = Un;
5998
5998
  if (!M.legacyTextRendering) {
5999
5999
  const w = this.measureSize("M");
6000
6000
  D = "alphabetic";
6001
6001
  const A = (t = w.fontBoundingBoxAscent) !== null && t !== void 0 ? t : w.actualBoundingBoxAscent, B = (i = w.fontBoundingBoxDescent) !== null && i !== void 0 ? i : w.actualBoundingBoxDescent;
6002
- P = (A - B) / 2 + l / 2;
6002
+ x = (A - B) / 2 + l / 2;
6003
6003
  }
6004
- for (h === Wn && e.setAttr("direction", h), e.setAttr("font", this._getContextFont()), e.setAttr("textBaseline", D), e.setAttr("textAlign", ba), c === Un ? d = (this.getHeight() - n * l - a * 2) / 2 : c === $l && (d = this.getHeight() - n * l - a * 2), e.translate(a, d + a), x = 0; x < n; x++) {
6004
+ for (h === Wn && e.setAttr("direction", h), e.setAttr("font", this._getContextFont()), e.setAttr("textBaseline", D), e.setAttr("textAlign", ba), c === Un ? d = (this.getHeight() - n * l - a * 2) / 2 : c === zl && (d = this.getHeight() - n * l - a * 2), e.translate(a, d + a), P = 0; P < n; P++) {
6005
6005
  let w = 0, A = 0;
6006
- const B = r[x], $ = B.text, F = B.width, V = B.lastInParagraph;
6006
+ const B = r[P], z = B.text, F = B.width, $ = B.lastInParagraph;
6007
6007
  if (e.save(), u === Vl ? w += p - F - a * 2 : u === Bl && (w += (p - F - a * 2) / 2), C) {
6008
6008
  e.save(), e.beginPath();
6009
- const H = S ?? (M.legacyTextRendering ? Math.round(o / 2) : Math.round(o / 4)), L = w, X = P + A + H;
6009
+ const H = v ?? (M.legacyTextRendering ? Math.round(o / 2) : Math.round(o / 4)), L = w, X = x + A + H;
6010
6010
  e.moveTo(L, X);
6011
- const N = u === Nt && !V ? p - a * 2 : F;
6011
+ const N = u === Nt && !$ ? p - a * 2 : F;
6012
6012
  e.lineTo(L + Math.round(N), X), e.lineWidth = o / 15;
6013
6013
  const Q = this._getLinearGradient();
6014
- e.strokeStyle = Q || v, e.stroke(), e.restore();
6014
+ e.strokeStyle = Q || S, e.stroke(), e.restore();
6015
6015
  }
6016
- const z = w;
6016
+ const V = w;
6017
6017
  if (h !== Wn && (f !== 0 || u === Nt || m)) {
6018
- const H = $.split(" ").length - 1, L = qe($);
6018
+ const H = z.split(" ").length - 1, L = qe(z);
6019
6019
  for (let X = 0; X < L.length; X++) {
6020
6020
  const N = L[X];
6021
- if (N === " " && !V && u === Nt && (w += (p - a * 2 - F) / H), this._partialTextX = w, this._partialTextY = P + A, this._partialText = N, m) {
6021
+ if (N === " " && !$ && u === Nt && (w += (p - a * 2 - F) / H), this._partialTextX = w, this._partialTextY = x + A, this._partialText = N, m) {
6022
6022
  e.save();
6023
- const ae = r.slice(0, x).reduce((K, fe) => K + qe(fe.text).length, 0), W = X + ae;
6023
+ const ae = r.slice(0, P).reduce((K, me) => K + qe(me.text).length, 0), Y = X + ae;
6024
6024
  m({
6025
6025
  char: N,
6026
- index: W,
6026
+ index: Y,
6027
6027
  x: w,
6028
- y: P + A,
6029
- lineIndex: x,
6028
+ y: x + A,
6029
+ lineIndex: P,
6030
6030
  column: X,
6031
- isLastInLine: V,
6031
+ isLastInLine: $,
6032
6032
  width: this.measureSize(N).width,
6033
6033
  context: e
6034
6034
  });
@@ -6036,17 +6036,17 @@ class se extends I {
6036
6036
  e.fillStrokeShape(this), m && e.restore(), w += this.measureSize(N).width + f;
6037
6037
  }
6038
6038
  } else
6039
- f !== 0 && e.setAttr("letterSpacing", `${f}px`), this._partialTextX = w, this._partialTextY = P + A, this._partialText = $, e.fillStrokeShape(this);
6039
+ f !== 0 && e.setAttr("letterSpacing", `${f}px`), this._partialTextX = w, this._partialTextY = x + A, this._partialText = z, e.fillStrokeShape(this);
6040
6040
  if (k) {
6041
6041
  e.save(), e.beginPath();
6042
- const H = M.legacyTextRendering ? 0 : -Math.round(o / 4), L = z;
6043
- e.moveTo(L, P + A + H);
6044
- const X = u === Nt && !V ? p - a * 2 : F;
6045
- e.lineTo(L + Math.round(X), P + A + H), e.lineWidth = o / 15;
6042
+ const H = M.legacyTextRendering ? 0 : -Math.round(o / 4), L = V;
6043
+ e.moveTo(L, x + A + H);
6044
+ const X = u === Nt && !$ ? p - a * 2 : F;
6045
+ e.lineTo(L + Math.round(X), x + A + H), e.lineWidth = o / 15;
6046
6046
  const N = this._getLinearGradient();
6047
- e.strokeStyle = N || v, e.stroke(), e.restore();
6047
+ e.strokeStyle = N || S, e.stroke(), e.restore();
6048
6048
  }
6049
- e.restore(), n > 1 && (P += l);
6049
+ e.restore(), n > 1 && (x += l);
6050
6050
  }
6051
6051
  }
6052
6052
  _hitFunc(e) {
@@ -6073,25 +6073,25 @@ class se extends I {
6073
6073
  var t, i, r, n, a, o, l, c, h, d, u;
6074
6074
  let p = gr(), f = this.fontSize(), m;
6075
6075
  p.save(), p.font = this._getContextFont(), m = p.measureText(e), p.restore();
6076
- const v = f / 100;
6076
+ const S = f / 100;
6077
6077
  return {
6078
- actualBoundingBoxAscent: (t = m.actualBoundingBoxAscent) !== null && t !== void 0 ? t : 71.58203125 * v,
6078
+ actualBoundingBoxAscent: (t = m.actualBoundingBoxAscent) !== null && t !== void 0 ? t : 71.58203125 * S,
6079
6079
  actualBoundingBoxDescent: (i = m.actualBoundingBoxDescent) !== null && i !== void 0 ? i : 0,
6080
- actualBoundingBoxLeft: (r = m.actualBoundingBoxLeft) !== null && r !== void 0 ? r : -7.421875 * v,
6081
- actualBoundingBoxRight: (n = m.actualBoundingBoxRight) !== null && n !== void 0 ? n : 75.732421875 * v,
6080
+ actualBoundingBoxLeft: (r = m.actualBoundingBoxLeft) !== null && r !== void 0 ? r : -7.421875 * S,
6081
+ actualBoundingBoxRight: (n = m.actualBoundingBoxRight) !== null && n !== void 0 ? n : 75.732421875 * S,
6082
6082
  alphabeticBaseline: (a = m.alphabeticBaseline) !== null && a !== void 0 ? a : 0,
6083
- emHeightAscent: (o = m.emHeightAscent) !== null && o !== void 0 ? o : 100 * v,
6084
- emHeightDescent: (l = m.emHeightDescent) !== null && l !== void 0 ? l : -20 * v,
6085
- fontBoundingBoxAscent: (c = m.fontBoundingBoxAscent) !== null && c !== void 0 ? c : 91 * v,
6086
- fontBoundingBoxDescent: (h = m.fontBoundingBoxDescent) !== null && h !== void 0 ? h : 21 * v,
6087
- hangingBaseline: (d = m.hangingBaseline) !== null && d !== void 0 ? d : 72.80000305175781 * v,
6088
- ideographicBaseline: (u = m.ideographicBaseline) !== null && u !== void 0 ? u : -21 * v,
6083
+ emHeightAscent: (o = m.emHeightAscent) !== null && o !== void 0 ? o : 100 * S,
6084
+ emHeightDescent: (l = m.emHeightDescent) !== null && l !== void 0 ? l : -20 * S,
6085
+ fontBoundingBoxAscent: (c = m.fontBoundingBoxAscent) !== null && c !== void 0 ? c : 91 * S,
6086
+ fontBoundingBoxDescent: (h = m.fontBoundingBoxDescent) !== null && h !== void 0 ? h : 21 * S,
6087
+ hangingBaseline: (d = m.hangingBaseline) !== null && d !== void 0 ? d : 72.80000305175781 * S,
6088
+ ideographicBaseline: (u = m.ideographicBaseline) !== null && u !== void 0 ? u : -21 * S,
6089
6089
  width: m.width,
6090
6090
  height: f
6091
6091
  };
6092
6092
  }
6093
6093
  _getContextFont() {
6094
- return this.fontStyle() + xi + this.fontVariant() + xi + (this.fontSize() + zl) + Xl(this.fontFamily());
6094
+ return this.fontStyle() + xi + this.fontVariant() + xi + (this.fontSize() + $l) + Xl(this.fontFamily());
6095
6095
  }
6096
6096
  _addTextLine(e) {
6097
6097
  this.align() === Nt && (e = e.trim());
@@ -6108,43 +6108,43 @@ class se extends I {
6108
6108
  }
6109
6109
  _setTextData() {
6110
6110
  let e = this.text().split(`
6111
- `), t = +this.fontSize(), i = 0, r = this.lineHeight() * t, n = this.attrs.width, a = this.attrs.height, o = n !== vt && n !== void 0, l = a !== vt && a !== void 0, c = this.padding(), h = n - c * 2, d = a - c * 2, u = 0, p = this.wrap(), f = p !== Yn, m = p !== Wl && f, v = this.ellipsis();
6111
+ `), t = +this.fontSize(), i = 0, r = this.lineHeight() * t, n = this.attrs.width, a = this.attrs.height, o = n !== vt && n !== void 0, l = a !== vt && a !== void 0, c = this.padding(), h = n - c * 2, d = a - c * 2, u = 0, p = this.wrap(), f = p !== Yn, m = p !== Wl && f, S = this.ellipsis();
6112
6112
  this.textArr = [], gr().font = this._getContextFont();
6113
- const T = v ? this._getTextWidth(pr) : 0;
6114
- for (let S = 0, C = e.length; S < C; ++S) {
6115
- let k = e[S], x = this._getTextWidth(k);
6116
- if (o && x > h)
6113
+ const T = S ? this._getTextWidth(pr) : 0;
6114
+ for (let v = 0, C = e.length; v < C; ++v) {
6115
+ let k = e[v], P = this._getTextWidth(k);
6116
+ if (o && P > h)
6117
6117
  for (; k.length > 0; ) {
6118
- let P = 0, D = qe(k).length, w = "", A = 0;
6119
- for (; P < D; ) {
6120
- const B = P + D >>> 1, $ = qe(k), F = $.slice(0, B + 1).join(""), V = this._getTextWidth(F);
6121
- (v && l && u + r > d ? V + T : V) <= h ? (P = B + 1, w = F, A = V) : D = B;
6118
+ let x = 0, D = qe(k).length, w = "", A = 0;
6119
+ for (; x < D; ) {
6120
+ const B = x + D >>> 1, z = qe(k), F = z.slice(0, B + 1).join(""), $ = this._getTextWidth(F);
6121
+ (S && l && u + r > d ? $ + T : $) <= h ? (x = B + 1, w = F, A = $) : D = B;
6122
6122
  }
6123
6123
  if (w) {
6124
6124
  if (m) {
6125
- const F = qe(k), V = qe(w), z = F[V.length], H = z === xi || z === Vn;
6125
+ const F = qe(k), $ = qe(w), V = F[$.length], H = V === xi || V === Vn;
6126
6126
  let L;
6127
6127
  if (H && A <= h)
6128
- L = V.length;
6128
+ L = $.length;
6129
6129
  else {
6130
- const X = V.lastIndexOf(xi), N = V.lastIndexOf(Vn);
6130
+ const X = $.lastIndexOf(xi), N = $.lastIndexOf(Vn);
6131
6131
  L = Math.max(X, N) + 1;
6132
6132
  }
6133
- L > 0 && (P = L, w = F.slice(0, P).join(""), A = this._getTextWidth(w));
6133
+ L > 0 && (x = L, w = F.slice(0, x).join(""), A = this._getTextWidth(w));
6134
6134
  }
6135
6135
  if (w = w.trimRight(), this._addTextLine(w), i = Math.max(i, A), u += r, this._shouldHandleEllipsis(u)) {
6136
6136
  this._tryToAddEllipsisToLastLine();
6137
6137
  break;
6138
6138
  }
6139
- if (k = qe(k).slice(P).join("").trimLeft(), k.length > 0 && (x = this._getTextWidth(k), x <= h)) {
6140
- this._addTextLine(k), u += r, i = Math.max(i, x);
6139
+ if (k = qe(k).slice(x).join("").trimLeft(), k.length > 0 && (P = this._getTextWidth(k), P <= h)) {
6140
+ this._addTextLine(k), u += r, i = Math.max(i, P);
6141
6141
  break;
6142
6142
  }
6143
6143
  } else
6144
6144
  break;
6145
6145
  }
6146
6146
  else
6147
- this._addTextLine(k), u += r, i = Math.max(i, x), this._shouldHandleEllipsis(u) && S < C - 1 && this._tryToAddEllipsisToLastLine();
6147
+ this._addTextLine(k), u += r, i = Math.max(i, P), this._shouldHandleEllipsis(u) && v < C - 1 && this._tryToAddEllipsisToLastLine();
6148
6148
  if (this.textArr[this.textArr.length - 1] && (this.textArr[this.textArr.length - 1].lastInParagraph = !0), l && u + r > d)
6149
6149
  break;
6150
6150
  }
@@ -6303,7 +6303,7 @@ class he extends I {
6303
6303
  const m = this._getPointAtLength(h + f);
6304
6304
  if (!m)
6305
6305
  return;
6306
- const v = ne.getLineLength(u.x, u.y, m.x, m.y);
6306
+ const S = ne.getLineLength(u.x, u.y, m.x, m.y);
6307
6307
  let T = 0;
6308
6308
  if (o)
6309
6309
  try {
@@ -6312,15 +6312,15 @@ class he extends I {
6312
6312
  T = 0;
6313
6313
  }
6314
6314
  u.x += T, m.x += T, this.textWidth += T;
6315
- const S = ne.getPointOnLine(T + v / 2, u.x, u.y, m.x, m.y), C = Math.atan2(m.y - u.y, m.x - u.x);
6315
+ const v = ne.getPointOnLine(T + S / 2, u.x, u.y, m.x, m.y), C = Math.atan2(m.y - u.y, m.x - u.x);
6316
6316
  this.glyphInfo.push({
6317
- transposeX: S.x,
6318
- transposeY: S.y,
6317
+ transposeX: v.x,
6318
+ transposeY: v.y,
6319
6319
  text: e[d],
6320
6320
  rotation: C,
6321
6321
  p0: u,
6322
6322
  p1: m,
6323
- width: v
6323
+ width: S
6324
6324
  }), h += f;
6325
6325
  }
6326
6326
  }
@@ -6454,7 +6454,7 @@ function sc(s, e, t) {
6454
6454
  return i;
6455
6455
  }
6456
6456
  let Ur = 0;
6457
- class U extends At {
6457
+ class W extends At {
6458
6458
  constructor(e) {
6459
6459
  super(e), 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(Jl, this.update), this.getNode() && this.update();
6460
6460
  }
@@ -6563,7 +6563,7 @@ class U extends At {
6563
6563
  t.push(f);
6564
6564
  });
6565
6565
  });
6566
- const i = new ve();
6566
+ const i = new Ce();
6567
6567
  i.rotate(-M.getAngle(this.rotation()));
6568
6568
  let r = 1 / 0, n = 1 / 0, a = -1 / 0, o = -1 / 0;
6569
6569
  t.forEach(function(c) {
@@ -6630,8 +6630,8 @@ class U extends At {
6630
6630
  const l = r.rotateAnchorAngle(), c = r.rotateAnchorOffset(), h = b.degToRad(l), d = Math.sin(h), u = -Math.cos(h), p = a / 2, f = o / 2;
6631
6631
  let m = 1 / 0;
6632
6632
  u < 0 ? m = Math.min(m, -f / u) : u > 0 && (m = Math.min(m, (o - f) / u)), d < 0 ? m = Math.min(m, -p / d) : d > 0 && (m = Math.min(m, (a - p) / d));
6633
- const v = p + d * m, T = f + u * m, S = b._sign(o), C = v + d * c * S, k = T + u * c * S;
6634
- t.moveTo(v, T), t.lineTo(C, k);
6633
+ const S = p + d * m, T = f + u * m, v = b._sign(o), C = S + d * c * v, k = T + u * c * v;
6634
+ t.moveTo(S, T), t.lineTo(C, k);
6635
6635
  }
6636
6636
  t.fillStrokeShape(i);
6637
6637
  },
@@ -6681,12 +6681,12 @@ class U extends At {
6681
6681
  if (c.x === h.x && c.y === h.y)
6682
6682
  return;
6683
6683
  if (this._movingAnchorName === "rotater") {
6684
- const S = this._getNodeRect();
6685
- t = n.x() - S.width / 2, i = -n.y() + S.height / 2;
6684
+ const v = this._getNodeRect();
6685
+ t = n.x() - v.width / 2, i = -n.y() + v.height / 2;
6686
6686
  const C = M.getAngle(this.rotateAnchorAngle());
6687
6687
  let k = Math.atan2(-i, t) + Math.PI / 2 - C;
6688
- S.height < 0 && (k -= Math.PI);
6689
- const P = M.getAngle(this.rotation()) + k, D = M.getAngle(this.rotationSnapTolerance()), A = sc(this.rotationSnaps(), P, D) - S.rotation, B = nc(S, A);
6688
+ v.height < 0 && (k -= Math.PI);
6689
+ const x = M.getAngle(this.rotation()) + k, D = M.getAngle(this.rotationSnapTolerance()), A = sc(this.rotationSnaps(), x, D) - v.rotation, B = nc(v, A);
6690
6690
  this._fitNodesInto(B, e);
6691
6691
  return;
6692
6692
  }
@@ -6696,31 +6696,31 @@ class U extends At {
6696
6696
  let p = this.centeredScaling() || e.altKey;
6697
6697
  if (this._movingAnchorName === "top-left") {
6698
6698
  if (u) {
6699
- const S = p ? {
6699
+ const v = p ? {
6700
6700
  x: this.width() / 2,
6701
6701
  y: this.height() / 2
6702
6702
  } : {
6703
6703
  x: this.findOne(".bottom-right").x(),
6704
6704
  y: this.findOne(".bottom-right").y()
6705
6705
  };
6706
- r = Math.sqrt(Math.pow(S.x - n.x(), 2) + Math.pow(S.y - n.y(), 2));
6707
- const C = this.findOne(".top-left").x() > S.x ? -1 : 1, k = this.findOne(".top-left").y() > S.y ? -1 : 1;
6708
- t = r * this.cos * C, i = r * this.sin * k, this.findOne(".top-left").x(S.x - t), this.findOne(".top-left").y(S.y - i);
6706
+ r = Math.sqrt(Math.pow(v.x - n.x(), 2) + Math.pow(v.y - n.y(), 2));
6707
+ const C = this.findOne(".top-left").x() > v.x ? -1 : 1, k = this.findOne(".top-left").y() > v.y ? -1 : 1;
6708
+ t = r * this.cos * C, i = r * this.sin * k, this.findOne(".top-left").x(v.x - t), this.findOne(".top-left").y(v.y - i);
6709
6709
  }
6710
6710
  } else if (this._movingAnchorName === "top-center")
6711
6711
  this.findOne(".top-left").y(n.y());
6712
6712
  else if (this._movingAnchorName === "top-right") {
6713
6713
  if (u) {
6714
- const S = p ? {
6714
+ const v = p ? {
6715
6715
  x: this.width() / 2,
6716
6716
  y: this.height() / 2
6717
6717
  } : {
6718
6718
  x: this.findOne(".bottom-left").x(),
6719
6719
  y: this.findOne(".bottom-left").y()
6720
6720
  };
6721
- r = Math.sqrt(Math.pow(n.x() - S.x, 2) + Math.pow(S.y - n.y(), 2));
6722
- const C = this.findOne(".top-right").x() < S.x ? -1 : 1, k = this.findOne(".top-right").y() > S.y ? -1 : 1;
6723
- t = r * this.cos * C, i = r * this.sin * k, this.findOne(".top-right").x(S.x + t), this.findOne(".top-right").y(S.y - i);
6721
+ r = Math.sqrt(Math.pow(n.x() - v.x, 2) + Math.pow(v.y - n.y(), 2));
6722
+ const C = this.findOne(".top-right").x() < v.x ? -1 : 1, k = this.findOne(".top-right").y() > v.y ? -1 : 1;
6723
+ t = r * this.cos * C, i = r * this.sin * k, this.findOne(".top-right").x(v.x + t), this.findOne(".top-right").y(v.y - i);
6724
6724
  }
6725
6725
  var f = n.position();
6726
6726
  this.findOne(".top-left").y(f.y), this.findOne(".bottom-right").x(f.x);
@@ -6730,52 +6730,52 @@ class U extends At {
6730
6730
  this.findOne(".bottom-right").x(n.x());
6731
6731
  else if (this._movingAnchorName === "bottom-left") {
6732
6732
  if (u) {
6733
- const S = p ? {
6733
+ const v = p ? {
6734
6734
  x: this.width() / 2,
6735
6735
  y: this.height() / 2
6736
6736
  } : {
6737
6737
  x: this.findOne(".top-right").x(),
6738
6738
  y: this.findOne(".top-right").y()
6739
6739
  };
6740
- r = Math.sqrt(Math.pow(S.x - n.x(), 2) + Math.pow(n.y() - S.y, 2));
6741
- const C = S.x < n.x() ? -1 : 1, k = n.y() < S.y ? -1 : 1;
6742
- t = r * this.cos * C, i = r * this.sin * k, n.x(S.x - t), n.y(S.y + i);
6740
+ r = Math.sqrt(Math.pow(v.x - n.x(), 2) + Math.pow(n.y() - v.y, 2));
6741
+ const C = v.x < n.x() ? -1 : 1, k = n.y() < v.y ? -1 : 1;
6742
+ t = r * this.cos * C, i = r * this.sin * k, n.x(v.x - t), n.y(v.y + i);
6743
6743
  }
6744
6744
  f = n.position(), this.findOne(".top-left").x(f.x), this.findOne(".bottom-right").y(f.y);
6745
6745
  } else if (this._movingAnchorName === "bottom-center")
6746
6746
  this.findOne(".bottom-right").y(n.y());
6747
6747
  else if (this._movingAnchorName === "bottom-right") {
6748
6748
  if (u) {
6749
- const S = p ? {
6749
+ const v = p ? {
6750
6750
  x: this.width() / 2,
6751
6751
  y: this.height() / 2
6752
6752
  } : {
6753
6753
  x: this.findOne(".top-left").x(),
6754
6754
  y: this.findOne(".top-left").y()
6755
6755
  };
6756
- r = Math.sqrt(Math.pow(n.x() - S.x, 2) + Math.pow(n.y() - S.y, 2));
6757
- const C = this.findOne(".bottom-right").x() < S.x ? -1 : 1, k = this.findOne(".bottom-right").y() < S.y ? -1 : 1;
6758
- t = r * this.cos * C, i = r * this.sin * k, this.findOne(".bottom-right").x(S.x + t), this.findOne(".bottom-right").y(S.y + i);
6756
+ r = Math.sqrt(Math.pow(n.x() - v.x, 2) + Math.pow(n.y() - v.y, 2));
6757
+ const C = this.findOne(".bottom-right").x() < v.x ? -1 : 1, k = this.findOne(".bottom-right").y() < v.y ? -1 : 1;
6758
+ t = r * this.cos * C, i = r * this.sin * k, this.findOne(".bottom-right").x(v.x + t), this.findOne(".bottom-right").y(v.y + i);
6759
6759
  }
6760
6760
  } else
6761
6761
  console.error(new Error("Wrong position argument of selection resizer: " + this._movingAnchorName));
6762
6762
  if (p = this.centeredScaling() || e.altKey, p) {
6763
- const S = this.findOne(".top-left"), C = this.findOne(".bottom-right"), k = S.x(), x = S.y(), P = this.getWidth() - C.x(), D = this.getHeight() - C.y();
6763
+ const v = this.findOne(".top-left"), C = this.findOne(".bottom-right"), k = v.x(), P = v.y(), x = this.getWidth() - C.x(), D = this.getHeight() - C.y();
6764
6764
  C.move({
6765
6765
  x: -k,
6766
- y: -x
6767
- }), S.move({
6768
- x: P,
6766
+ y: -P
6767
+ }), v.move({
6768
+ x,
6769
6769
  y: D
6770
6770
  });
6771
6771
  }
6772
6772
  const m = this.findOne(".top-left").getAbsolutePosition();
6773
6773
  t = m.x, i = m.y;
6774
- const v = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), T = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
6774
+ const S = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), T = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
6775
6775
  this._fitNodesInto({
6776
6776
  x: t,
6777
6777
  y: i,
6778
- width: v,
6778
+ width: S,
6779
6779
  height: T,
6780
6780
  rotation: M.getAngle(this.rotation())
6781
6781
  }, e);
@@ -6807,7 +6807,7 @@ class U extends At {
6807
6807
  this.update();
6808
6808
  return;
6809
6809
  }
6810
- const n = new ve();
6810
+ const n = new Ce();
6811
6811
  if (n.rotate(M.getAngle(this.rotation())), this._movingAnchorName && e.width < 0 && this._movingAnchorName.indexOf("left") >= 0) {
6812
6812
  const u = n.point({
6813
6813
  x: -this.padding() * 2,
@@ -6838,9 +6838,9 @@ class U extends At {
6838
6838
  const u = this.boundBoxFunc()(i, e);
6839
6839
  u ? e = u : b.warn("boundBoxFunc returned falsy. You should return new bound rect from it!");
6840
6840
  }
6841
- const a = 1e7, o = new ve();
6841
+ const a = 1e7, o = new Ce();
6842
6842
  o.translate(i.x, i.y), o.rotate(i.rotation), o.scale(i.width / a, i.height / a);
6843
- const l = new ve(), c = e.width / a, h = e.height / a;
6843
+ const l = new Ce(), c = e.width / a, h = e.height / a;
6844
6844
  this.flipEnabled() === !1 ? (l.translate(e.x, e.y), l.rotate(e.rotation), l.translate(e.width < 0 ? e.width : 0, e.height < 0 ? e.height : 0), l.scale(Math.abs(c), Math.abs(h))) : (l.translate(e.x, e.y), l.rotate(e.rotation), l.scale(c, h));
6845
6845
  const d = l.multiply(o.invert());
6846
6846
  this._nodes.forEach((u) => {
@@ -6849,9 +6849,9 @@ class U extends At {
6849
6849
  return;
6850
6850
  const f = u.getParent().getAbsoluteTransform(), m = u.getTransform().copy();
6851
6851
  m.translate(u.offsetX(), u.offsetY());
6852
- const v = new ve();
6853
- v.multiply(f.copy().invert()).multiply(d).multiply(f).multiply(m);
6854
- const T = v.decompose();
6852
+ const S = new Ce();
6853
+ S.multiply(f.copy().invert()).multiply(d).multiply(f).multiply(m);
6854
+ const T = S.decompose();
6855
6855
  u.setAttrs(T), (p = u.getLayer()) === null || p === void 0 || p.batchDraw();
6856
6856
  }), this.rotation(b._getRotation(e.rotation)), this._nodes.forEach((u) => {
6857
6857
  this._fire("transform", { evt: t, target: u }), u._fire("transform", { evt: t, target: u });
@@ -6868,8 +6868,8 @@ class U extends At {
6868
6868
  const t = this._getNodeRect();
6869
6869
  this.rotation(b._getRotation(t.rotation));
6870
6870
  const i = t.width, r = t.height, n = this.enabledAnchors(), a = this.resizeEnabled(), o = this.padding(), l = this.anchorSize(), c = this.find("._anchor");
6871
- c.forEach((P) => {
6872
- P.setAttrs({
6871
+ c.forEach((x) => {
6872
+ x.setAttrs({
6873
6873
  width: l,
6874
6874
  height: l,
6875
6875
  offsetX: l / 2,
@@ -6924,12 +6924,12 @@ class U extends At {
6924
6924
  offsetY: l / 2 - o,
6925
6925
  visible: a && n.indexOf("bottom-right") >= 0
6926
6926
  });
6927
- const h = this.rotateAnchorAngle(), d = this.rotateAnchorOffset(), u = b.degToRad(h), p = Math.sin(u), f = -Math.cos(u), m = i / 2, v = r / 2;
6927
+ const h = this.rotateAnchorAngle(), d = this.rotateAnchorOffset(), u = b.degToRad(h), p = Math.sin(u), f = -Math.cos(u), m = i / 2, S = r / 2;
6928
6928
  let T = 1 / 0;
6929
- f < 0 ? T = Math.min(T, -v / f) : f > 0 && (T = Math.min(T, (r - v) / f)), p < 0 ? T = Math.min(T, -m / p) : p > 0 && (T = Math.min(T, (i - m) / p));
6930
- const S = m + p * T, C = v + f * T, k = b._sign(r);
6929
+ f < 0 ? T = Math.min(T, -S / f) : f > 0 && (T = Math.min(T, (r - S) / f)), p < 0 ? T = Math.min(T, -m / p) : p > 0 && (T = Math.min(T, (i - m) / p));
6930
+ const v = m + p * T, C = S + f * T, k = b._sign(r);
6931
6931
  this._batchChangeChild(".rotater", {
6932
- x: S + p * d * k,
6932
+ x: v + p * d * k,
6933
6933
  y: C + f * d * k - o * f,
6934
6934
  visible: this.rotateEnabled()
6935
6935
  }), this._batchChangeChild(".back", {
@@ -6939,13 +6939,13 @@ class U extends At {
6939
6939
  stroke: this.borderStroke(),
6940
6940
  strokeWidth: this.borderStrokeWidth(),
6941
6941
  dash: this.borderDash(),
6942
- draggable: this.nodes().some((P) => P.draggable()),
6942
+ draggable: this.nodes().some((x) => x.draggable()),
6943
6943
  x: 0,
6944
6944
  y: 0
6945
6945
  });
6946
- const x = this.anchorStyleFunc();
6947
- x && c.forEach((P) => {
6948
- x(P);
6946
+ const P = this.anchorStyleFunc();
6947
+ P && c.forEach((x) => {
6948
+ P(x);
6949
6949
  }), (e = this.getLayer()) === null || e === void 0 || e.batchDraw();
6950
6950
  }
6951
6951
  isTransforming() {
@@ -6971,46 +6971,46 @@ class U extends At {
6971
6971
  return this.nodes().length > 0 ? super.getClientRect() : { x: 0, y: 0, width: 0, height: 0 };
6972
6972
  }
6973
6973
  }
6974
- U.isTransforming = () => Ur > 0;
6974
+ W.isTransforming = () => Ur > 0;
6975
6975
  function ac(s) {
6976
6976
  return s instanceof Array || b.warn("enabledAnchors value should be an array"), s instanceof Array && s.forEach(function(e) {
6977
6977
  Vi.indexOf(e) === -1 && b.warn("Unknown anchor name: " + e + ". Available names are: " + Vi.join(", "));
6978
6978
  }), s || [];
6979
6979
  }
6980
- U.prototype.className = "Transformer";
6981
- oe(U);
6982
- y.addGetterSetter(U, "enabledAnchors", Vi, ac);
6983
- y.addGetterSetter(U, "flipEnabled", !0, Ie());
6984
- y.addGetterSetter(U, "resizeEnabled", !0);
6985
- y.addGetterSetter(U, "anchorSize", 10, R());
6986
- y.addGetterSetter(U, "rotateEnabled", !0);
6987
- y.addGetterSetter(U, "rotateLineVisible", !0);
6988
- y.addGetterSetter(U, "rotationSnaps", []);
6989
- y.addGetterSetter(U, "rotateAnchorOffset", 50, R());
6990
- y.addGetterSetter(U, "rotateAnchorAngle", 0, R());
6991
- y.addGetterSetter(U, "rotateAnchorCursor", "crosshair");
6992
- y.addGetterSetter(U, "rotationSnapTolerance", 5, R());
6993
- y.addGetterSetter(U, "borderEnabled", !0);
6994
- y.addGetterSetter(U, "anchorStroke", "rgb(0, 161, 255)");
6995
- y.addGetterSetter(U, "anchorStrokeWidth", 1, R());
6996
- y.addGetterSetter(U, "anchorFill", "white");
6997
- y.addGetterSetter(U, "anchorCornerRadius", 0, R());
6998
- y.addGetterSetter(U, "borderStroke", "rgb(0, 161, 255)");
6999
- y.addGetterSetter(U, "borderStrokeWidth", 1, R());
7000
- y.addGetterSetter(U, "borderDash");
7001
- y.addGetterSetter(U, "keepRatio", !0);
7002
- y.addGetterSetter(U, "shiftBehavior", "default");
7003
- y.addGetterSetter(U, "centeredScaling", !1);
7004
- y.addGetterSetter(U, "ignoreStroke", !1);
7005
- y.addGetterSetter(U, "padding", 0, R());
7006
- y.addGetterSetter(U, "nodes");
7007
- y.addGetterSetter(U, "node");
7008
- y.addGetterSetter(U, "boundBoxFunc");
7009
- y.addGetterSetter(U, "anchorDragBoundFunc");
7010
- y.addGetterSetter(U, "anchorStyleFunc");
7011
- y.addGetterSetter(U, "shouldOverdrawWholeArea", !1);
7012
- y.addGetterSetter(U, "useSingleNodeRotation", !0);
7013
- y.backCompat(U, {
6980
+ W.prototype.className = "Transformer";
6981
+ oe(W);
6982
+ y.addGetterSetter(W, "enabledAnchors", Vi, ac);
6983
+ y.addGetterSetter(W, "flipEnabled", !0, Ie());
6984
+ y.addGetterSetter(W, "resizeEnabled", !0);
6985
+ y.addGetterSetter(W, "anchorSize", 10, R());
6986
+ y.addGetterSetter(W, "rotateEnabled", !0);
6987
+ y.addGetterSetter(W, "rotateLineVisible", !0);
6988
+ y.addGetterSetter(W, "rotationSnaps", []);
6989
+ y.addGetterSetter(W, "rotateAnchorOffset", 50, R());
6990
+ y.addGetterSetter(W, "rotateAnchorAngle", 0, R());
6991
+ y.addGetterSetter(W, "rotateAnchorCursor", "crosshair");
6992
+ y.addGetterSetter(W, "rotationSnapTolerance", 5, R());
6993
+ y.addGetterSetter(W, "borderEnabled", !0);
6994
+ y.addGetterSetter(W, "anchorStroke", "rgb(0, 161, 255)");
6995
+ y.addGetterSetter(W, "anchorStrokeWidth", 1, R());
6996
+ y.addGetterSetter(W, "anchorFill", "white");
6997
+ y.addGetterSetter(W, "anchorCornerRadius", 0, R());
6998
+ y.addGetterSetter(W, "borderStroke", "rgb(0, 161, 255)");
6999
+ y.addGetterSetter(W, "borderStrokeWidth", 1, R());
7000
+ y.addGetterSetter(W, "borderDash");
7001
+ y.addGetterSetter(W, "keepRatio", !0);
7002
+ y.addGetterSetter(W, "shiftBehavior", "default");
7003
+ y.addGetterSetter(W, "centeredScaling", !1);
7004
+ y.addGetterSetter(W, "ignoreStroke", !1);
7005
+ y.addGetterSetter(W, "padding", 0, R());
7006
+ y.addGetterSetter(W, "nodes");
7007
+ y.addGetterSetter(W, "node");
7008
+ y.addGetterSetter(W, "boundBoxFunc");
7009
+ y.addGetterSetter(W, "anchorDragBoundFunc");
7010
+ y.addGetterSetter(W, "anchorStyleFunc");
7011
+ y.addGetterSetter(W, "shouldOverdrawWholeArea", !1);
7012
+ y.addGetterSetter(W, "useSingleNodeRotation", !0);
7013
+ y.backCompat(W, {
7014
7014
  lineEnabled: "borderEnabled",
7015
7015
  rotateHandlerOffset: "rotateAnchorOffset",
7016
7016
  enabledHandlers: "enabledAnchors"
@@ -7562,33 +7562,33 @@ const oc = [
7562
7562
  ];
7563
7563
  function cc(s, e) {
7564
7564
  const t = s.data, i = s.width, r = s.height;
7565
- let n, a, o, l, c, h, d, u, p, f, m, v, T, S, C, k, x, P, D, w;
7566
- const A = e + e + 1, B = i - 1, $ = r - 1, F = e + 1, V = F * (F + 1) / 2, z = new qn(), H = oc[e], L = lc[e];
7567
- let X = null, N = z, Q = null, ae = null;
7568
- for (let W = 1; W < A; W++)
7569
- N = N.next = new qn(), W === F && (X = N);
7570
- N.next = z, o = a = 0;
7571
- for (let W = 0; W < r; W++) {
7572
- v = T = S = C = l = c = h = d = 0, u = F * (k = t[a]), p = F * (x = t[a + 1]), f = F * (P = t[a + 2]), m = F * (D = t[a + 3]), l += V * k, c += V * x, h += V * P, d += V * D, N = z;
7565
+ let n, a, o, l, c, h, d, u, p, f, m, S, T, v, C, k, P, x, D, w;
7566
+ const A = e + e + 1, B = i - 1, z = r - 1, F = e + 1, $ = F * (F + 1) / 2, V = new qn(), H = oc[e], L = lc[e];
7567
+ let X = null, N = V, Q = null, ae = null;
7568
+ for (let Y = 1; Y < A; Y++)
7569
+ N = N.next = new qn(), Y === F && (X = N);
7570
+ N.next = V, o = a = 0;
7571
+ for (let Y = 0; Y < r; Y++) {
7572
+ S = T = v = C = l = c = h = d = 0, u = F * (k = t[a]), p = F * (P = t[a + 1]), f = F * (x = t[a + 2]), m = F * (D = t[a + 3]), l += $ * k, c += $ * P, h += $ * x, d += $ * D, N = V;
7573
7573
  for (let K = 0; K < F; K++)
7574
- N.r = k, N.g = x, N.b = P, N.a = D, N = N.next;
7574
+ N.r = k, N.g = P, N.b = x, N.a = D, N = N.next;
7575
7575
  for (let K = 1; K < F; K++)
7576
- n = a + ((B < K ? B : K) << 2), l += (N.r = k = t[n]) * (w = F - K), c += (N.g = x = t[n + 1]) * w, h += (N.b = P = t[n + 2]) * w, d += (N.a = D = t[n + 3]) * w, v += k, T += x, S += P, C += D, N = N.next;
7577
- Q = z, ae = X;
7576
+ n = a + ((B < K ? B : K) << 2), l += (N.r = k = t[n]) * (w = F - K), c += (N.g = P = t[n + 1]) * w, h += (N.b = x = t[n + 2]) * w, d += (N.a = D = t[n + 3]) * w, S += k, T += P, v += x, C += D, N = N.next;
7577
+ Q = V, ae = X;
7578
7578
  for (let K = 0; K < i; K++)
7579
- t[a + 3] = D = d * H >> L, D !== 0 ? (D = 255 / D, t[a] = (l * H >> L) * D, t[a + 1] = (c * H >> L) * D, t[a + 2] = (h * H >> L) * D) : t[a] = t[a + 1] = t[a + 2] = 0, l -= u, c -= p, h -= f, d -= m, u -= Q.r, p -= Q.g, f -= Q.b, m -= Q.a, n = o + ((n = K + e + 1) < B ? n : B) << 2, v += Q.r = t[n], T += Q.g = t[n + 1], S += Q.b = t[n + 2], C += Q.a = t[n + 3], l += v, c += T, h += S, d += C, Q = Q.next, u += k = ae.r, p += x = ae.g, f += P = ae.b, m += D = ae.a, v -= k, T -= x, S -= P, C -= D, ae = ae.next, a += 4;
7579
+ t[a + 3] = D = d * H >> L, D !== 0 ? (D = 255 / D, t[a] = (l * H >> L) * D, t[a + 1] = (c * H >> L) * D, t[a + 2] = (h * H >> L) * D) : t[a] = t[a + 1] = t[a + 2] = 0, l -= u, c -= p, h -= f, d -= m, u -= Q.r, p -= Q.g, f -= Q.b, m -= Q.a, n = o + ((n = K + e + 1) < B ? n : B) << 2, S += Q.r = t[n], T += Q.g = t[n + 1], v += Q.b = t[n + 2], C += Q.a = t[n + 3], l += S, c += T, h += v, d += C, Q = Q.next, u += k = ae.r, p += P = ae.g, f += x = ae.b, m += D = ae.a, S -= k, T -= P, v -= x, C -= D, ae = ae.next, a += 4;
7580
7580
  o += i;
7581
7581
  }
7582
- for (let W = 0; W < i; W++) {
7583
- T = S = C = v = c = h = d = l = 0, a = W << 2, u = F * (k = t[a]), p = F * (x = t[a + 1]), f = F * (P = t[a + 2]), m = F * (D = t[a + 3]), l += V * k, c += V * x, h += V * P, d += V * D, N = z;
7584
- for (let fe = 0; fe < F; fe++)
7585
- N.r = k, N.g = x, N.b = P, N.a = D, N = N.next;
7582
+ for (let Y = 0; Y < i; Y++) {
7583
+ T = v = C = S = c = h = d = l = 0, a = Y << 2, u = F * (k = t[a]), p = F * (P = t[a + 1]), f = F * (x = t[a + 2]), m = F * (D = t[a + 3]), l += $ * k, c += $ * P, h += $ * x, d += $ * D, N = V;
7584
+ for (let me = 0; me < F; me++)
7585
+ N.r = k, N.g = P, N.b = x, N.a = D, N = N.next;
7586
7586
  let K = i;
7587
- for (let fe = 1; fe <= e; fe++)
7588
- a = K + W << 2, l += (N.r = k = t[a]) * (w = F - fe), c += (N.g = x = t[a + 1]) * w, h += (N.b = P = t[a + 2]) * w, d += (N.a = D = t[a + 3]) * w, v += k, T += x, S += P, C += D, N = N.next, fe < $ && (K += i);
7589
- a = W, Q = z, ae = X;
7590
- for (let fe = 0; fe < r; fe++)
7591
- n = a << 2, t[n + 3] = D = d * H >> L, D > 0 ? (D = 255 / D, t[n] = (l * H >> L) * D, t[n + 1] = (c * H >> L) * D, t[n + 2] = (h * H >> L) * D) : t[n] = t[n + 1] = t[n + 2] = 0, l -= u, c -= p, h -= f, d -= m, u -= Q.r, p -= Q.g, f -= Q.b, m -= Q.a, n = W + ((n = fe + F) < $ ? n : $) * i << 2, l += v += Q.r = t[n], c += T += Q.g = t[n + 1], h += S += Q.b = t[n + 2], d += C += Q.a = t[n + 3], Q = Q.next, u += k = ae.r, p += x = ae.g, f += P = ae.b, m += D = ae.a, v -= k, T -= x, S -= P, C -= D, ae = ae.next, a += i;
7587
+ for (let me = 1; me <= e; me++)
7588
+ a = K + Y << 2, l += (N.r = k = t[a]) * (w = F - me), c += (N.g = P = t[a + 1]) * w, h += (N.b = x = t[a + 2]) * w, d += (N.a = D = t[a + 3]) * w, S += k, T += P, v += x, C += D, N = N.next, me < z && (K += i);
7589
+ a = Y, Q = V, ae = X;
7590
+ for (let me = 0; me < r; me++)
7591
+ n = a << 2, t[n + 3] = D = d * H >> L, D > 0 ? (D = 255 / D, t[n] = (l * H >> L) * D, t[n + 1] = (c * H >> L) * D, t[n + 2] = (h * H >> L) * D) : t[n] = t[n + 1] = t[n + 2] = 0, l -= u, c -= p, h -= f, d -= m, u -= Q.r, p -= Q.g, f -= Q.b, m -= Q.a, n = Y + ((n = me + F) < z ? n : z) * i << 2, l += S += Q.r = t[n], c += T += Q.g = t[n + 1], h += v += Q.b = t[n + 2], d += C += Q.a = t[n + 3], Q = Q.next, u += k = ae.r, p += P = ae.g, f += x = ae.b, m += D = ae.a, S -= k, T -= P, v -= x, C -= D, ae = ae.next, a += i;
7592
7592
  }
7593
7593
  }
7594
7594
  const hc = function(e) {
@@ -7615,7 +7615,7 @@ const uc = function(s) {
7615
7615
  y.addGetterSetter(E, "contrast", 0, R(), y.afterSetFilter);
7616
7616
  const gc = function(s) {
7617
7617
  var e, t, i, r, n, a, o, l, c;
7618
- const h = s.data, d = s.width, u = s.height, p = Math.min(1, Math.max(0, (t = (e = this.embossStrength) === null || e === void 0 ? void 0 : e.call(this)) !== null && t !== void 0 ? t : 0.5)), f = Math.min(1, Math.max(0, (r = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && r !== void 0 ? r : 0.5)), v = (o = {
7618
+ const h = s.data, d = s.width, u = s.height, p = Math.min(1, Math.max(0, (t = (e = this.embossStrength) === null || e === void 0 ? void 0 : e.call(this)) !== null && t !== void 0 ? t : 0.5)), f = Math.min(1, Math.max(0, (r = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && r !== void 0 ? r : 0.5)), S = (o = {
7619
7619
  "top-left": 315,
7620
7620
  top: 270,
7621
7621
  "top-right": 225,
@@ -7624,28 +7624,28 @@ const gc = function(s) {
7624
7624
  bottom: 90,
7625
7625
  "bottom-left": 45,
7626
7626
  left: 0
7627
- }[(a = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && a !== void 0 ? a : "top-left"]) !== null && o !== void 0 ? o : 315, T = !!((c = (l = this.embossBlend) === null || l === void 0 ? void 0 : l.call(this)) !== null && c !== void 0 && c), S = p * 10, C = f * 255, k = v * Math.PI / 180, x = Math.cos(k), P = Math.sin(k), D = 128 / 1020 * S, w = new Uint8ClampedArray(h), A = new Float32Array(d * u);
7628
- for (let z = 0, H = 0; H < h.length; H += 4, z++)
7629
- A[z] = 0.2126 * w[H] + 0.7152 * w[H + 1] + 0.0722 * w[H + 2];
7630
- const B = [-1, 0, 1, -2, 0, 2, -1, 0, 1], $ = [-1, -2, -1, 0, 0, 0, 1, 2, 1], F = [-d - 1, -d, -d + 1, -1, 0, 1, d - 1, d, d + 1], V = (z) => z < 0 ? 0 : z > 255 ? 255 : z;
7631
- for (let z = 1; z < u - 1; z++)
7627
+ }[(a = (n = this.embossDirection) === null || n === void 0 ? void 0 : n.call(this)) !== null && a !== void 0 ? a : "top-left"]) !== null && o !== void 0 ? o : 315, T = !!((c = (l = this.embossBlend) === null || l === void 0 ? void 0 : l.call(this)) !== null && c !== void 0 && c), v = p * 10, C = f * 255, k = S * Math.PI / 180, P = Math.cos(k), x = Math.sin(k), D = 128 / 1020 * v, w = new Uint8ClampedArray(h), A = new Float32Array(d * u);
7628
+ for (let V = 0, H = 0; H < h.length; H += 4, V++)
7629
+ A[V] = 0.2126 * w[H] + 0.7152 * w[H + 1] + 0.0722 * w[H + 2];
7630
+ const B = [-1, 0, 1, -2, 0, 2, -1, 0, 1], z = [-1, -2, -1, 0, 0, 0, 1, 2, 1], F = [-d - 1, -d, -d + 1, -1, 0, 1, d - 1, d, d + 1], $ = (V) => V < 0 ? 0 : V > 255 ? 255 : V;
7631
+ for (let V = 1; V < u - 1; V++)
7632
7632
  for (let H = 1; H < d - 1; H++) {
7633
- const L = z * d + H;
7633
+ const L = V * d + H;
7634
7634
  let X = 0, N = 0;
7635
- X += A[L + F[0]] * B[0], N += A[L + F[0]] * $[0], X += A[L + F[1]] * B[1], N += A[L + F[1]] * $[1], X += A[L + F[2]] * B[2], N += A[L + F[2]] * $[2], X += A[L + F[3]] * B[3], N += A[L + F[3]] * $[3], X += A[L + F[5]] * B[5], N += A[L + F[5]] * $[5], X += A[L + F[6]] * B[6], N += A[L + F[6]] * $[6], X += A[L + F[7]] * B[7], N += A[L + F[7]] * $[7], X += A[L + F[8]] * B[8], N += A[L + F[8]] * $[8];
7636
- const Q = x * X + P * N, ae = V(C + Q * D), W = L * 4;
7635
+ X += A[L + F[0]] * B[0], N += A[L + F[0]] * z[0], X += A[L + F[1]] * B[1], N += A[L + F[1]] * z[1], X += A[L + F[2]] * B[2], N += A[L + F[2]] * z[2], X += A[L + F[3]] * B[3], N += A[L + F[3]] * z[3], X += A[L + F[5]] * B[5], N += A[L + F[5]] * z[5], X += A[L + F[6]] * B[6], N += A[L + F[6]] * z[6], X += A[L + F[7]] * B[7], N += A[L + F[7]] * z[7], X += A[L + F[8]] * B[8], N += A[L + F[8]] * z[8];
7636
+ const Q = P * X + x * N, ae = $(C + Q * D), Y = L * 4;
7637
7637
  if (T) {
7638
7638
  const K = ae - C;
7639
- h[W] = V(w[W] + K), h[W + 1] = V(w[W + 1] + K), h[W + 2] = V(w[W + 2] + K), h[W + 3] = w[W + 3];
7639
+ h[Y] = $(w[Y] + K), h[Y + 1] = $(w[Y + 1] + K), h[Y + 2] = $(w[Y + 2] + K), h[Y + 3] = w[Y + 3];
7640
7640
  } else
7641
- h[W] = h[W + 1] = h[W + 2] = ae, h[W + 3] = w[W + 3];
7641
+ h[Y] = h[Y + 1] = h[Y + 2] = ae, h[Y + 3] = w[Y + 3];
7642
7642
  }
7643
- for (let z = 0; z < d; z++) {
7644
- let H = z * 4, L = ((u - 1) * d + z) * 4;
7643
+ for (let V = 0; V < d; V++) {
7644
+ let H = V * 4, L = ((u - 1) * d + V) * 4;
7645
7645
  h[H] = w[H], h[H + 1] = w[H + 1], h[H + 2] = w[H + 2], h[H + 3] = w[H + 3], h[L] = w[L], h[L + 1] = w[L + 1], h[L + 2] = w[L + 2], h[L + 3] = w[L + 3];
7646
7646
  }
7647
- for (let z = 1; z < u - 1; z++) {
7648
- let H = z * d * 4, L = (z * d + (d - 1)) * 4;
7647
+ for (let V = 1; V < u - 1; V++) {
7648
+ let H = V * d * 4, L = (V * d + (d - 1)) * 4;
7649
7649
  h[H] = w[H], h[H + 1] = w[H + 1], h[H + 2] = w[H + 2], h[H + 3] = w[H + 3], h[L] = w[L], h[L + 1] = w[L + 1], h[L + 2] = w[L + 2], h[L + 3] = w[L + 3];
7650
7650
  }
7651
7651
  return s;
@@ -7672,19 +7672,19 @@ const fc = function(s) {
7672
7672
  for (let C = 0; C < t; C += 4)
7673
7673
  n = e[C + 0], n < i ? i = n : n > r && (r = n), l = e[C + 1], l < a ? a = l : l > o && (o = l), d = e[C + 2], d < c ? c = d : d > h && (h = d);
7674
7674
  r === i && (r = 255, i = 0), o === a && (o = 255, a = 0), h === c && (h = 255, c = 0);
7675
- let p, f, m, v, T, S;
7675
+ let p, f, m, S, T, v;
7676
7676
  if (u > 0)
7677
- p = r + u * (255 - r), f = i - u * (i - 0), m = o + u * (255 - o), v = a - u * (a - 0), T = h + u * (255 - h), S = c - u * (c - 0);
7677
+ p = r + u * (255 - r), f = i - u * (i - 0), m = o + u * (255 - o), S = a - u * (a - 0), T = h + u * (255 - h), v = c - u * (c - 0);
7678
7678
  else {
7679
7679
  const C = (r + i) * 0.5;
7680
7680
  p = r + u * (r - C), f = i + u * (i - C);
7681
7681
  const k = (o + a) * 0.5;
7682
- m = o + u * (o - k), v = a + u * (a - k);
7683
- const x = (h + c) * 0.5;
7684
- T = h + u * (h - x), S = c + u * (c - x);
7682
+ m = o + u * (o - k), S = a + u * (a - k);
7683
+ const P = (h + c) * 0.5;
7684
+ T = h + u * (h - P), v = c + u * (c - P);
7685
7685
  }
7686
7686
  for (let C = 0; C < t; C += 4)
7687
- e[C + 0] = fr(e[C + 0], i, r, f, p), e[C + 1] = fr(e[C + 1], a, o, v, m), e[C + 2] = fr(e[C + 2], c, h, S, T);
7687
+ e[C + 0] = fr(e[C + 0], i, r, f, p), e[C + 1] = fr(e[C + 1], a, o, S, m), e[C + 2] = fr(e[C + 2], c, h, v, T);
7688
7688
  };
7689
7689
  y.addGetterSetter(E, "enhance", 0, R(), y.afterSetFilter);
7690
7690
  const mc = function(s) {
@@ -7698,15 +7698,15 @@ y.addGetterSetter(E, "hue", 0, R(), y.afterSetFilter);
7698
7698
  y.addGetterSetter(E, "saturation", 0, R(), y.afterSetFilter);
7699
7699
  y.addGetterSetter(E, "luminance", 0, R(), y.afterSetFilter);
7700
7700
  const yc = function(s) {
7701
- const e = s.data, t = e.length, i = 1, r = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, a = this.luminance() * 127, o = i * r * Math.cos(n * Math.PI / 180), l = i * r * Math.sin(n * Math.PI / 180), c = 0.299 * i + 0.701 * o + 0.167 * l, h = 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, f = 0.114 * i - 0.114 * o + 0.293 * l, m = 0.299 * i - 0.3 * o + 1.25 * l, v = 0.587 * i - 0.586 * o - 1.05 * l, T = 0.114 * i + 0.886 * o - 0.2 * l;
7702
- let S, C, k, x;
7703
- for (let P = 0; P < t; P += 4)
7704
- S = e[P + 0], C = e[P + 1], k = e[P + 2], x = e[P + 3], e[P + 0] = c * S + h * C + d * k + a, e[P + 1] = u * S + p * C + f * k + a, e[P + 2] = m * S + v * C + T * k + a, e[P + 3] = x;
7701
+ const e = s.data, t = e.length, i = 1, r = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, a = this.luminance() * 127, o = i * r * Math.cos(n * Math.PI / 180), l = i * r * Math.sin(n * Math.PI / 180), c = 0.299 * i + 0.701 * o + 0.167 * l, h = 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, f = 0.114 * i - 0.114 * o + 0.293 * l, m = 0.299 * i - 0.3 * o + 1.25 * l, S = 0.587 * i - 0.586 * o - 1.05 * l, T = 0.114 * i + 0.886 * o - 0.2 * l;
7702
+ let v, C, k, P;
7703
+ for (let x = 0; x < t; x += 4)
7704
+ v = e[x + 0], C = e[x + 1], k = e[x + 2], P = e[x + 3], e[x + 0] = c * v + h * C + d * k + a, e[x + 1] = u * v + p * C + f * k + a, e[x + 2] = m * v + S * C + T * k + a, e[x + 3] = P;
7705
7705
  }, Sc = function(s) {
7706
- const e = s.data, t = e.length, i = Math.pow(2, this.value()), r = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, a = i * r * Math.cos(n * Math.PI / 180), o = i * r * Math.sin(n * Math.PI / 180), l = 0.299 * i + 0.701 * a + 0.167 * o, c = 0.587 * i - 0.587 * a + 0.33 * o, h = 0.114 * i - 0.114 * a - 0.497 * o, d = 0.299 * i - 0.299 * a - 0.328 * o, u = 0.587 * i + 0.413 * a + 0.035 * o, p = 0.114 * i - 0.114 * a + 0.293 * o, f = 0.299 * i - 0.3 * a + 1.25 * o, m = 0.587 * i - 0.586 * a - 1.05 * o, v = 0.114 * i + 0.886 * a - 0.2 * o;
7706
+ const e = s.data, t = e.length, i = Math.pow(2, this.value()), r = Math.pow(2, this.saturation()), n = Math.abs(this.hue() + 360) % 360, a = i * r * Math.cos(n * Math.PI / 180), o = i * r * Math.sin(n * Math.PI / 180), l = 0.299 * i + 0.701 * a + 0.167 * o, c = 0.587 * i - 0.587 * a + 0.33 * o, h = 0.114 * i - 0.114 * a - 0.497 * o, d = 0.299 * i - 0.299 * a - 0.328 * o, u = 0.587 * i + 0.413 * a + 0.035 * o, p = 0.114 * i - 0.114 * a + 0.293 * o, f = 0.299 * i - 0.3 * a + 1.25 * o, m = 0.587 * i - 0.586 * a - 1.05 * o, S = 0.114 * i + 0.886 * a - 0.2 * o;
7707
7707
  for (let T = 0; T < t; T += 4) {
7708
- const S = e[T + 0], C = e[T + 1], k = e[T + 2], x = e[T + 3];
7709
- e[T + 0] = l * S + c * C + h * k, e[T + 1] = d * S + u * C + p * k, e[T + 2] = f * S + m * C + v * k, e[T + 3] = x;
7708
+ const v = e[T + 0], C = e[T + 1], k = e[T + 2], P = e[T + 3];
7709
+ e[T + 0] = l * v + c * C + h * k, e[T + 1] = d * v + u * C + p * k, e[T + 2] = f * v + m * C + S * k, e[T + 3] = P;
7710
7710
  }
7711
7711
  };
7712
7712
  y.addGetterSetter(E, "hue", 0, R(), y.afterSetFilter);
@@ -7722,13 +7722,13 @@ const vc = function(s) {
7722
7722
  const u = Math.sqrt(h * h + d * d);
7723
7723
  c = u > c ? u : c;
7724
7724
  const p = a, f = n, m = 360 / f * Math.PI / 180;
7725
- for (let v = 0; v < f; v += 1) {
7726
- const T = Math.sin(v * m), S = Math.cos(v * m);
7725
+ for (let S = 0; S < f; S += 1) {
7726
+ const T = Math.sin(S * m), v = Math.cos(S * m);
7727
7727
  for (let C = 0; C < p; C += 1) {
7728
- h = Math.floor(o + c * C / p * S), d = Math.floor(l + c * C / p * T);
7728
+ h = Math.floor(o + c * C / p * v), d = Math.floor(l + c * C / p * T);
7729
7729
  let k = (d * n + h) * 4;
7730
- const x = i[k + 0], P = i[k + 1], D = i[k + 2], w = i[k + 3];
7731
- k = (v + C * n) * 4, r[k + 0] = x, r[k + 1] = P, r[k + 2] = D, r[k + 3] = w;
7730
+ const P = i[k + 0], x = i[k + 1], D = i[k + 2], w = i[k + 3];
7731
+ k = (S + C * n) * 4, r[k + 0] = P, r[k + 1] = x, r[k + 2] = D, r[k + 3] = w;
7732
7732
  }
7733
7733
  }
7734
7734
  }, Tc = function(s, e, t) {
@@ -7737,15 +7737,15 @@ const vc = function(s) {
7737
7737
  const u = Math.sqrt(h * h + d * d);
7738
7738
  c = u > c ? u : c;
7739
7739
  const p = a, f = n, m = 0;
7740
- let v, T;
7740
+ let S, T;
7741
7741
  for (h = 0; h < n; h += 1)
7742
7742
  for (d = 0; d < a; d += 1) {
7743
- const S = h - o, C = d - l, k = Math.sqrt(S * S + C * C) * p / c;
7744
- let x = (Math.atan2(C, S) * 180 / Math.PI + 360 + m) % 360;
7745
- x = x * f / 360, v = Math.floor(x), T = Math.floor(k);
7746
- let P = (T * n + v) * 4;
7747
- const D = i[P + 0], w = i[P + 1], A = i[P + 2], B = i[P + 3];
7748
- P = (d * n + h) * 4, r[P + 0] = D, r[P + 1] = w, r[P + 2] = A, r[P + 3] = B;
7743
+ const v = h - o, C = d - l, k = Math.sqrt(v * v + C * C) * p / c;
7744
+ let P = (Math.atan2(C, v) * 180 / Math.PI + 360 + m) % 360;
7745
+ P = P * f / 360, S = Math.floor(P), T = Math.floor(k);
7746
+ let x = (T * n + S) * 4;
7747
+ const D = i[x + 0], w = i[x + 1], A = i[x + 2], B = i[x + 3];
7748
+ x = (d * n + h) * 4, r[x + 0] = D, r[x + 1] = w, r[x + 2] = A, r[x + 3] = B;
7749
7749
  }
7750
7750
  }, bc = function(s) {
7751
7751
  const e = s.width, t = s.height;
@@ -7753,23 +7753,23 @@ const vc = function(s) {
7753
7753
  const f = Math.round(this.kaleidoscopeAngle()), m = Math.floor(e * (f % 360) / 360);
7754
7754
  if (p < 1)
7755
7755
  return;
7756
- const v = b.createCanvasElement();
7757
- v.width = e, v.height = t;
7758
- const T = v.getContext("2d").getImageData(0, 0, e, t);
7759
- b.releaseCanvas(v), Cc(s, T, {
7756
+ const S = b.createCanvasElement();
7757
+ S.width = e, S.height = t;
7758
+ const T = S.getContext("2d").getImageData(0, 0, e, t);
7759
+ b.releaseCanvas(S), Cc(s, T, {
7760
7760
  polarCenterX: e / 2,
7761
7761
  polarCenterY: t / 2
7762
7762
  });
7763
- let S = e / Math.pow(2, p);
7764
- for (; S <= 8; )
7765
- S = S * 2, p -= 1;
7766
- S = Math.ceil(S);
7767
- let C = S, k = 0, x = C, P = 1;
7768
- for (m + S > e && (k = C, x = 0, P = -1), r = 0; r < t; r += 1)
7769
- for (i = k; i !== x; i += P)
7763
+ let v = e / Math.pow(2, p);
7764
+ for (; v <= 8; )
7765
+ v = v * 2, p -= 1;
7766
+ v = Math.ceil(v);
7767
+ let C = v, k = 0, P = C, x = 1;
7768
+ for (m + v > e && (k = C, P = 0, x = -1), r = 0; r < t; r += 1)
7769
+ for (i = k; i !== P; i += x)
7770
7770
  n = Math.round(i + m) % e, d = (e * r + n) * 4, o = T.data[d + 0], l = T.data[d + 1], c = T.data[d + 2], h = T.data[d + 3], u = (e * r + i) * 4, T.data[u + 0] = o, T.data[u + 1] = l, T.data[u + 2] = c, T.data[u + 3] = h;
7771
7771
  for (r = 0; r < t; r += 1)
7772
- for (C = Math.floor(S), a = 0; a < p; a += 1) {
7772
+ for (C = Math.floor(v), a = 0; a < p; a += 1) {
7773
7773
  for (i = 0; i < C + 1; i += 1)
7774
7774
  d = (e * r + i) * 4, o = T.data[d + 0], l = T.data[d + 1], c = T.data[d + 2], h = T.data[d + 3], u = (e * r + C * 2 - i - 1) * 4, T.data[u + 0] = o, T.data[u + 1] = l, T.data[u + 2] = c, T.data[u + 3] = h;
7775
7775
  C *= 2;
@@ -7821,8 +7821,8 @@ function xc(s, e, t) {
7821
7821
  for (let u = 0; u < r; u++) {
7822
7822
  const p = o + d - n, f = l + u - n;
7823
7823
  if (p >= 0 && p < t && f >= 0 && f < e) {
7824
- const m = p * e + f, v = i[d * r + u];
7825
- h += s[m] * v;
7824
+ const m = p * e + f, S = i[d * r + u];
7825
+ h += s[m] * S;
7826
7826
  }
7827
7827
  }
7828
7828
  a[c] = h === 255 * 8 ? 255 : 0;
@@ -7839,8 +7839,8 @@ function _c(s, e, t) {
7839
7839
  for (let u = 0; u < r; u++) {
7840
7840
  const p = o + d - n, f = l + u - n;
7841
7841
  if (p >= 0 && p < t && f >= 0 && f < e) {
7842
- const m = p * e + f, v = i[d * r + u];
7843
- h += s[m] * v;
7842
+ const m = p * e + f, S = i[d * r + u];
7843
+ h += s[m] * S;
7844
7844
  }
7845
7845
  }
7846
7846
  a[c] = h >= 255 * 4 ? 255 : 0;
@@ -7867,8 +7867,8 @@ function Ac(s, e, t) {
7867
7867
  for (let u = 0; u < r; u++) {
7868
7868
  const p = o + d - n, f = l + u - n;
7869
7869
  if (p >= 0 && p < t && f >= 0 && f < e) {
7870
- const m = p * e + f, v = i[d * r + u];
7871
- h += s[m] * v;
7870
+ const m = p * e + f, S = i[d * r + u];
7871
+ h += s[m] * S;
7872
7872
  }
7873
7873
  }
7874
7874
  a[c] = h;
@@ -7896,23 +7896,23 @@ const Rc = function(s) {
7896
7896
  for (let o = 0; o < r; o += 1)
7897
7897
  for (let l = 0; l < n; l += 1) {
7898
7898
  let c = 0, h = 0, d = 0, u = 0;
7899
- const p = o * e, f = p + e, m = l * e, v = m + e;
7899
+ const p = o * e, f = p + e, m = l * e, S = m + e;
7900
7900
  let T = 0;
7901
- for (let S = p; S < f; S += 1)
7902
- if (!(S >= t))
7903
- for (let C = m; C < v; C += 1) {
7901
+ for (let v = p; v < f; v += 1)
7902
+ if (!(v >= t))
7903
+ for (let C = m; C < S; C += 1) {
7904
7904
  if (C >= i)
7905
7905
  continue;
7906
- const k = (t * C + S) * 4;
7906
+ const k = (t * C + v) * 4;
7907
7907
  c += a[k + 0], h += a[k + 1], d += a[k + 2], u += a[k + 3], T += 1;
7908
7908
  }
7909
7909
  c = c / T, h = h / T, d = d / T, u = u / T;
7910
- for (let S = p; S < f; S += 1)
7911
- if (!(S >= t))
7912
- for (let C = m; C < v; C += 1) {
7910
+ for (let v = p; v < f; v += 1)
7911
+ if (!(v >= t))
7912
+ for (let C = m; C < S; C += 1) {
7913
7913
  if (C >= i)
7914
7914
  continue;
7915
- const k = (t * C + S) * 4;
7915
+ const k = (t * C + v) * 4;
7916
7916
  a[k + 0] = c, a[k + 1] = h, a[k + 2] = d, a[k + 3] = u;
7917
7917
  }
7918
7918
  }
@@ -7975,14 +7975,14 @@ const Bc = function(s) {
7975
7975
  };
7976
7976
  y.addGetterSetter(E, "threshold", 0.5, R(), y.afterSetFilter);
7977
7977
  const Z = Fn.Util._assign(Fn, {
7978
- Arc: $e,
7978
+ Arc: ze,
7979
7979
  Arrow: ft,
7980
7980
  Circle: Mt,
7981
7981
  Ellipse: et,
7982
7982
  Image: Ee,
7983
7983
  Label: dn,
7984
7984
  Tag: mt,
7985
- Line: ze,
7985
+ Line: $e,
7986
7986
  Path: ne,
7987
7987
  Rect: mi,
7988
7988
  RegularPolygon: tt,
@@ -7991,7 +7991,7 @@ const Z = Fn.Util._assign(Fn, {
7991
7991
  Star: it,
7992
7992
  Text: se,
7993
7993
  TextPath: he,
7994
- Transformer: U,
7994
+ Transformer: W,
7995
7995
  Wedge: Ve,
7996
7996
  Filters: {
7997
7997
  Blur: hc,
@@ -8015,12 +8015,12 @@ const Z = Fn.Util._assign(Fn, {
8015
8015
  Solarize: Oc,
8016
8016
  Threshold: Fc
8017
8017
  }
8018
- }), Ea = "media-editor-track.diagnostics.v1", Wr = "media-editor-track.diagnostics.failure-window.v1", Ra = "media-editor-track-diagnostics", Ze = "snapshots", Ma = "state", Da = "latest-failure-window", li = 1, un = 1, jn = 40, Nc = 48, Gc = 250, Kn = 20, Hc = 100, $c = 500, Yr = /* @__PURE__ */ new Set([
8018
+ }), Ea = "media-editor-track.diagnostics.v1", Wr = "media-editor-track.diagnostics.failure-window.v1", Ra = "media-editor-track-diagnostics", Ze = "snapshots", Ma = "state", Da = "latest-failure-window", li = 1, un = 1, jn = 40, Nc = 48, Gc = 250, Kn = 20, Hc = 100, zc = 500, Yr = /* @__PURE__ */ new Set([
8019
8019
  "pending-preview.begin",
8020
8020
  "preview.sync.requested",
8021
8021
  "media.seeking",
8022
8022
  "media.seeked"
8023
- ]), zc = /* @__PURE__ */ new Set([
8023
+ ]), $c = /* @__PURE__ */ new Set([
8024
8024
  ...Yr,
8025
8025
  "media.current-slot.seek",
8026
8026
  "media.preload-slot.seek",
@@ -8041,7 +8041,7 @@ const Z = Fn.Util._assign(Fn, {
8041
8041
  maxHotEvents: 500,
8042
8042
  includeFullSourceUrl: !0,
8043
8043
  consoleSeverityThreshold: "error",
8044
- highFrequencyEventThrottleMs: $c
8044
+ highFrequencyEventThrottleMs: zc
8045
8045
  };
8046
8046
  function Jn(s) {
8047
8047
  return `${s}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
@@ -8286,7 +8286,7 @@ function Oa(s) {
8286
8286
  summary: Ba(e)
8287
8287
  };
8288
8288
  }
8289
- function $t(s, e, t = {}) {
8289
+ function zt(s, e, t = {}) {
8290
8290
  const i = s.slice(-e.maxSessions).map((n) => {
8291
8291
  const a = n.events.slice(-e.maxHotEvents);
8292
8292
  return Oa({
@@ -8376,7 +8376,7 @@ class nh {
8376
8376
  const t = Zc();
8377
8377
  this.latestFailureWindow = Jc(), this.state = {
8378
8378
  version: li,
8379
- sessions: $t((t == null ? void 0 : t.sessions) ?? [], this.config, {
8379
+ sessions: zt((t == null ? void 0 : t.sessions) ?? [], this.config, {
8380
8380
  enforceStorageQuota: this.config.persist
8381
8381
  })
8382
8382
  }, this.restoreIndexedDbState();
@@ -8393,7 +8393,7 @@ class nh {
8393
8393
  events: [],
8394
8394
  summary: ii()
8395
8395
  };
8396
- return this.currentSessionId = i.sessionId, this.state.sessions = $t([...this.state.sessions, i], this.config), this.emit({
8396
+ return this.currentSessionId = i.sessionId, this.state.sessions = zt([...this.state.sessions, i], this.config), this.emit({
8397
8397
  severity: "info",
8398
8398
  category: "session",
8399
8399
  eventName: "session.started",
@@ -8420,7 +8420,7 @@ class nh {
8420
8420
  return r === "skip-update" || (this.updateCoalescedEvent(n, e, i), this.schedulePersist(), this.scheduleNotify()), n;
8421
8421
  t.sequence += 1;
8422
8422
  const a = this.createEvent(t, e, i, t.sequence);
8423
- return t.events.push(a), jc(t.summary, a), this.trimSessionEvents(t), this.captureFailureWindow(t, a), this.state.sessions = $t(this.state.sessions, this.config), this.emitToConsole(a), this.schedulePersist(), this.scheduleNotify(), a;
8423
+ return t.events.push(a), jc(t.summary, a), this.trimSessionEvents(t), this.captureFailureWindow(t, a), this.state.sessions = zt(this.state.sessions, this.config), this.emitToConsole(a), this.schedulePersist(), this.scheduleNotify(), a;
8424
8424
  }
8425
8425
  subscribe(e) {
8426
8426
  return this.listeners.add(e), e(this.getSnapshot()), () => {
@@ -8546,7 +8546,7 @@ class nh {
8546
8546
  return null;
8547
8547
  }
8548
8548
  resolveHighFrequencyDecision(e, t) {
8549
- if (e.severity === "warn" || e.severity === "error" || !zc.has(e.eventName))
8549
+ if (e.severity === "warn" || e.severity === "error" || !$c.has(e.eventName))
8550
8550
  return "record";
8551
8551
  const i = this.config.highFrequencyEventThrottleMs;
8552
8552
  if (i <= 0)
@@ -8651,7 +8651,7 @@ class nh {
8651
8651
  return;
8652
8652
  const e = {
8653
8653
  version: li,
8654
- sessions: $t(this.state.sessions, this.config, {
8654
+ sessions: zt(this.state.sessions, this.config, {
8655
8655
  enforceStorageQuota: !0
8656
8656
  })
8657
8657
  };
@@ -8689,7 +8689,7 @@ class nh {
8689
8689
  [...this.state.sessions, ...e.sessions].forEach((a) => {
8690
8690
  const o = Oa(a), l = n.get(o.sessionId);
8691
8691
  (!l || l.updatedAt < o.updatedAt) && n.set(o.sessionId, o);
8692
- }), this.state.sessions = $t(
8692
+ }), this.state.sessions = zt(
8693
8693
  Array.from(n.values()).sort((a, o) => a.startedAt - o.startedAt),
8694
8694
  this.config,
8695
8695
  {
@@ -9003,14 +9003,14 @@ const ah = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.o
9003
9003
  ["clip-audio", fh],
9004
9004
  ["clip-without-audio", mh]
9005
9005
  ]), is = /* @__PURE__ */ new Map();
9006
- function Te(s) {
9006
+ function be(s) {
9007
9007
  return yh.get(s) ?? "";
9008
9008
  }
9009
9009
  function Sh(s) {
9010
9010
  const e = is.get(s);
9011
9011
  if (e)
9012
9012
  return e;
9013
- const t = Te(s);
9013
+ const t = be(s);
9014
9014
  if (!t)
9015
9015
  return null;
9016
9016
  const i = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`, r = typeof Image > "u" ? {
@@ -9049,7 +9049,7 @@ function wh(s, e, t, i) {
9049
9049
  const r = s.findOne(".clip-resize-left"), n = s.findOne(".clip-resize-right");
9050
9050
  return !r || !n ? !1 : (r.x(0), r.y(0), r.width(ue), r.height(t), n.x(e - ue), n.y(0), n.width(ue), n.height(t), !0);
9051
9051
  }
9052
- function $a(s, e, t) {
9052
+ function za(s, e, t) {
9053
9053
  const i = e ? s.clipSelectedBorder : _.transparent, r = e ? Ga : 0;
9054
9054
  return t === "audio" ? {
9055
9055
  background: _.audioClipBackground,
@@ -9080,7 +9080,7 @@ function $a(s, e, t) {
9080
9080
  borderWidth: r
9081
9081
  };
9082
9082
  }
9083
- function za(s, e, t, i, r) {
9083
+ function $a(s, e, t, i, r) {
9084
9084
  const n = It(
9085
9085
  i,
9086
9086
  0,
@@ -9126,7 +9126,7 @@ function _h(s, e, t) {
9126
9126
  );
9127
9127
  h.cornerRadius(2), h.name("clip-cover-background"), c.add(h);
9128
9128
  const d = Et(0, 0);
9129
- d.name("clip-covers-group"), d.setAttr("coverFallbackFill", i ? t.failedBackground : t.coverBackground), d.setAttr("coverUnavailableFill", i ? t.failedBackground : _.mediaClipFailedBackground), c.add(d), i ? (pe.renderClipCovers(d, [], l, o, e.videoSrc, e.deferCoverRender), za(c, l, o, r, t.failedLabel)) : pe.renderClipCovers(
9129
+ d.name("clip-covers-group"), d.setAttr("coverFallbackFill", i ? t.failedBackground : t.coverBackground), d.setAttr("coverUnavailableFill", i ? t.failedBackground : _.mediaClipFailedBackground), c.add(d), i ? (pe.renderClipCovers(d, [], l, o, e.videoSrc, e.deferCoverRender), $a(c, l, o, r, t.failedLabel)) : pe.renderClipCovers(
9130
9130
  d,
9131
9131
  e.thumbnails ?? [],
9132
9132
  l,
@@ -9135,7 +9135,7 @@ function _h(s, e, t) {
9135
9135
  e.deferCoverRender
9136
9136
  );
9137
9137
  const u = l >= 120 ? Wi + Ha : 0, p = It(
9138
- `${e.clipName} ${Y.formatDuration(e.duration)}`,
9138
+ `${e.clipName} ${U.formatDuration(e.duration)}`,
9139
9139
  ue,
9140
9140
  e.height - a,
9141
9141
  Xr,
@@ -9154,7 +9154,7 @@ function Ah(s, e, t) {
9154
9154
  if (i.width(e.width), i.height(e.height), i.fill(t.background), i.stroke(t.border), i.strokeWidth(t.borderWidth), i.cornerRadius(4), !wh(s, e.width, e.height))
9155
9155
  return !1;
9156
9156
  const d = 15, u = e.height - d - 4, p = e.width - ue * 2;
9157
- r.x(ue), r.y(2), r.clip({ x: 0, y: 0, width: p, height: u }), n.width(p), n.height(u), n.fill(c ? t.failedBackground : t.coverBackground), n.cornerRadius(2), a.setAttr("coverFallbackFill", c ? t.failedBackground : t.coverBackground), a.setAttr("coverUnavailableFill", c ? t.failedBackground : _.mediaClipFailedBackground), c ? (pe.renderClipCovers(a, [], p, u, e.videoSrc, e.deferCoverRender), l ? (l.text(h), l.x(0), l.y(Math.max(0, Math.floor((u - ri) / 2) - 2)), l.width(p), l.height(ri + 6), l.fill(t.failedLabel)) : za(r, p, u, h, t.failedLabel)) : (l == null || l.destroy(), pe.renderClipCovers(
9157
+ r.x(ue), r.y(2), r.clip({ x: 0, y: 0, width: p, height: u }), n.width(p), n.height(u), n.fill(c ? t.failedBackground : t.coverBackground), n.cornerRadius(2), a.setAttr("coverFallbackFill", c ? t.failedBackground : t.coverBackground), a.setAttr("coverUnavailableFill", c ? t.failedBackground : _.mediaClipFailedBackground), c ? (pe.renderClipCovers(a, [], p, u, e.videoSrc, e.deferCoverRender), l ? (l.text(h), l.x(0), l.y(Math.max(0, Math.floor((u - ri) / 2) - 2)), l.width(p), l.height(ri + 6), l.fill(t.failedLabel)) : $a(r, p, u, h, t.failedLabel)) : (l == null || l.destroy(), pe.renderClipCovers(
9158
9158
  a,
9159
9159
  e.thumbnails ?? [],
9160
9160
  p,
@@ -9163,7 +9163,7 @@ function Ah(s, e, t) {
9163
9163
  e.deferCoverRender
9164
9164
  ));
9165
9165
  const f = p >= 120 ? Wi + Ha : 0;
9166
- o.text(`${e.clipName} ${Y.formatDuration(e.duration)}`), o.x(ue), o.y(e.height - d), o.fill(t.label), o.height(d), hi(o);
9166
+ o.text(`${e.clipName} ${U.formatDuration(e.duration)}`), o.x(ue), o.y(e.height - d), o.fill(t.label), o.height(d), hi(o);
9167
9167
  const m = s.findOne(".video-audio-status");
9168
9168
  return m == null || m.destroy(), f > 0 && Ua(s, e.width, e.height, e.hasSeparatedAudio), !0;
9169
9169
  }
@@ -9254,7 +9254,7 @@ function Rh(s, e, t) {
9254
9254
  r.height(e.height), r.lineHeight(1), hi(r), r.name("clip-label"), s.add(r);
9255
9255
  }
9256
9256
  function Wa(s, e) {
9257
- const t = e.width <= zi, i = $a(e.theme, e.isSelected, e.clipType);
9257
+ const t = e.width <= $i, i = za(e.theme, e.isSelected, e.clipType);
9258
9258
  if (s.destroyChildren(), t) {
9259
9259
  xh(s, e.width, e.height, i);
9260
9260
  return;
@@ -9270,14 +9270,14 @@ function Wa(s, e) {
9270
9270
  _h(s, e, i);
9271
9271
  }
9272
9272
  function Mh(s, e) {
9273
- if (e.width <= zi || e.clipType !== "video")
9273
+ if (e.width <= $i || e.clipType !== "video")
9274
9274
  return !1;
9275
- const i = $a(e.theme, e.isSelected, e.clipType);
9275
+ const i = za(e.theme, e.isSelected, e.clipType);
9276
9276
  return Ah(s, e, i);
9277
9277
  }
9278
9278
  function Dh(s, e, t, i, r, n, a, o = !1, l, c, h = "video", d = !1, u = !1, p, f, m) {
9279
- const v = Et(s, e);
9280
- return v.clip({ x: 0, y: 0, width: t, height: i }), Wa(v, {
9279
+ const S = Et(s, e);
9280
+ return S.clip({ x: 0, y: 0, width: t, height: i }), Wa(S, {
9281
9281
  width: t,
9282
9282
  height: i,
9283
9283
  clipName: r,
@@ -9292,7 +9292,7 @@ function Dh(s, e, t, i, r, n, a, o = !1, l, c, h = "video", d = !1, u = !1, p, f
9292
9292
  deferCoverRender: u,
9293
9293
  mediaStatus: f,
9294
9294
  mediaStatusMessage: m
9295
- }), v;
9295
+ }), S;
9296
9296
  }
9297
9297
  function Lh(s, e, t, i, r, n, a = !1, o, l, c = "video", h = !1, d = !1, u, p, f) {
9298
9298
  s.clip({ x: 0, y: 0, width: e, height: t });
@@ -9357,7 +9357,7 @@ function Nh(s, e, t, i, r, n, a, o) {
9357
9357
  );
9358
9358
  if (h.name("time-tick-line"), s.add(h), a === "major") {
9359
9359
  const d = t + c + 5, u = Oh(
9360
- Y.formatTime(r),
9360
+ U.formatTime(r),
9361
9361
  e,
9362
9362
  d,
9363
9363
  10,
@@ -9465,7 +9465,7 @@ class de {
9465
9465
  /**
9466
9466
  * 创建片段组
9467
9467
  */
9468
- static createClipGroup(e, t, i, r, n, a, o, l = !1, c, h, d = "video", u = !1, p = !1, f, m, v) {
9468
+ static createClipGroup(e, t, i, r, n, a, o, l = !1, c, h, d = "video", u = !1, p = !1, f, m, S) {
9469
9469
  return Dh(
9470
9470
  e,
9471
9471
  t,
@@ -9482,7 +9482,7 @@ class de {
9482
9482
  p,
9483
9483
  f,
9484
9484
  m,
9485
- v
9485
+ S
9486
9486
  );
9487
9487
  }
9488
9488
  /**
@@ -9530,19 +9530,19 @@ class de {
9530
9530
  g(de, "RESIZE_AREA_WIDTH", 3);
9531
9531
  const Kt = 8;
9532
9532
  function ge(s, e, t) {
9533
- return de.timeToPixels(s, e) - t + _e;
9533
+ return de.timeToPixels(s, e) - t + fe;
9534
9534
  }
9535
- function Se(s, e) {
9535
+ function ve(s, e) {
9536
9536
  const t = Math.max(s, 0), i = de.timeToPixels(t, e);
9537
- return i <= zi ? zi : i;
9537
+ return i <= $i ? $i : i;
9538
9538
  }
9539
9539
  function Hh(s, e) {
9540
- const t = ge(s.startTime, s.zoom, s.scrollLeft), i = Se(s.duration, s.zoom);
9540
+ const t = ge(s.startTime, s.zoom, s.scrollLeft), i = ve(s.duration, s.zoom);
9541
9541
  return t + i > 0 && t < e;
9542
9542
  }
9543
- function $h(s) {
9543
+ function zh(s) {
9544
9544
  for (const e of s.clips) {
9545
- const t = ge(e.startTime, s.zoom, s.scrollLeft), i = Se(e.duration, s.zoom), r = s.y >= s.trackY && s.y <= s.trackY + s.trackHeight;
9545
+ const t = ge(e.startTime, s.zoom, s.scrollLeft), i = ve(e.duration, s.zoom), r = s.y >= s.trackY && s.y <= s.trackY + s.trackHeight;
9546
9546
  if (s.x >= t && s.x <= t + Kt && r || s.x >= t + i - Kt && s.x <= t + i && r)
9547
9547
  return "ew-resize";
9548
9548
  if (s.x > t + Kt && s.x < t + i - Kt && r)
@@ -9558,7 +9558,7 @@ class mr {
9558
9558
  this.clip = Zs(
9559
9559
  {
9560
9560
  ...e,
9561
- endTime: Y.calculateEndTime(e.startTime, e.duration)
9561
+ endTime: U.calculateEndTime(e.startTime, e.duration)
9562
9562
  },
9563
9563
  {
9564
9564
  isDragging: e.isDragging,
@@ -9578,7 +9578,7 @@ class mr {
9578
9578
  this.clip = {
9579
9579
  ...this.clip,
9580
9580
  ...e,
9581
- endTime: Y.calculateEndTime(e.startTime, e.duration)
9581
+ endTime: U.calculateEndTime(e.startTime, e.duration)
9582
9582
  };
9583
9583
  }
9584
9584
  setSelected(e) {
@@ -9588,7 +9588,7 @@ class mr {
9588
9588
  }, this.onUpdate(this.clip);
9589
9589
  }
9590
9590
  isPointInResizeHandle(e, t, i, r, n, a) {
9591
- const o = ge(this.clip.startTime, i, a), l = Se(this.clip.duration, i), c = Kt;
9591
+ const o = ge(this.clip.startTime, i, a), l = ve(this.clip.duration, i), c = Kt;
9592
9592
  return t < r || t > r + n ? (this.setResizeHandleState(!1, !1), !1) : e >= o && e <= o + c ? (this.setResizeHandleState(!0, !1), !0) : e >= o + l - c && e <= o + l ? (this.setResizeHandleState(!1, !0), !0) : (this.setResizeHandleState(!1, !1), !1);
9593
9593
  }
9594
9594
  startDrag(e) {
@@ -9649,7 +9649,7 @@ function Ct(s) {
9649
9649
  function ji(s) {
9650
9650
  return !s || s.kind === "idle" || s.kind === "boxSelecting" ? null : s.kind === "pressed" ? s.operation : s.kind === "draggingResizeLeft" ? "resize-left" : s.kind === "draggingResizeRight" ? "resize-right" : "move";
9651
9651
  }
9652
- function zh(s) {
9652
+ function $h(s) {
9653
9653
  const e = ji(s);
9654
9654
  return e ? e === "move" ? "grabbing" : "ew-resize" : null;
9655
9655
  }
@@ -9791,7 +9791,7 @@ function Wh(s, e, t, i) {
9791
9791
  return Math.hypot(r, n) >= Math.max(0, e);
9792
9792
  }
9793
9793
  const ce = class ce {
9794
- constructor(e, t, i, r, n, a, o, l, c, h, d, u, p, f, m, v, T, S, C, k, x, P, D, w, A, B = ce.DEFAULT_DRAG_ACTIVATION_THRESHOLD, $ = !1, F = ce.DEFAULT_CLIP_SNAP_THRESHOLD) {
9794
+ constructor(e, t, i, r, n, a, o, l, c, h, d, u, p, f, m, S, T, v, C, k, P, x, D, w, A, B, z = ce.DEFAULT_DRAG_ACTIVATION_THRESHOLD, F = !1, $ = ce.DEFAULT_CLIP_SNAP_THRESHOLD) {
9795
9795
  g(this, "layer");
9796
9796
  g(this, "trackGroup");
9797
9797
  g(this, "dragOverlayLayer", null);
@@ -9820,6 +9820,7 @@ const ce = class ce {
9820
9820
  g(this, "onClipSelect");
9821
9821
  g(this, "onTimeJump");
9822
9822
  g(this, "onClipOverlap");
9823
+ g(this, "onPrimaryTrackMagnetMove");
9823
9824
  g(this, "hasBoundGlobalPointerListenersForDrag", !1);
9824
9825
  g(this, "hasLockedGlobalCursor", !1);
9825
9826
  g(this, "edgeAutoScrollAnimationFrameId", null);
@@ -9872,7 +9873,7 @@ const ce = class ce {
9872
9873
  }
9873
9874
  this.startEdgeAutoScroll();
9874
9875
  });
9875
- this.layer = e, this.config = t, this.theme = o, this.trackType = i, this.zoom = r, this.trackY = n, this.trackHeight = a, this.onClipUpdate = l, this.onClipAdd = c, this.onClipRemove = h, this.onClipSplit = d, this.onClipSelect = u, this.onTimeJump = p, this.onHorizontalDragAutoScroll = f, this.onClipOverlap = m, this.onClipCrossTrackPreview = v, this.onClipCrossTrack = T, this.onClearDropPreview = S, this.onClearSelection = C, this.onSnapGuideChange = k, this.onClipToggleSelection = x, this.onSetSingleSelection = P, this.getMultiDragClipIds = D, this.onMultiDragMove = w, this.onMultiDragInteractionEnd = A, this.dragActivationThreshold = Math.max(0, B), this.enableClipSnap = $, this.clipSnapThreshold = Math.max(0, F), this.trackGroup = de.createGroup(0, n), this.layer.add(this.trackGroup), this.initClips(), this.initEventListeners(), this.render();
9876
+ this.layer = e, this.config = t, this.theme = o, this.trackType = i, this.zoom = r, this.trackY = n, this.trackHeight = a, this.onClipUpdate = l, this.onClipAdd = c, this.onClipRemove = h, this.onClipSplit = d, this.onClipSelect = u, this.onTimeJump = p, this.onHorizontalDragAutoScroll = f, this.onClipOverlap = m, this.onPrimaryTrackMagnetMove = S, this.onClipCrossTrackPreview = T, this.onClipCrossTrack = v, this.onClearDropPreview = C, this.onClearSelection = k, this.onSnapGuideChange = P, this.onClipToggleSelection = x, this.onSetSingleSelection = D, this.getMultiDragClipIds = w, this.onMultiDragMove = A, this.onMultiDragInteractionEnd = B, this.dragActivationThreshold = Math.max(0, z), this.enableClipSnap = F, this.clipSnapThreshold = Math.max(0, $), this.trackGroup = de.createGroup(0, n), this.layer.add(this.trackGroup), this.initClips(), this.initEventListeners(), this.render();
9876
9877
  }
9877
9878
  initClips() {
9878
9879
  this.clips = this.config.clips.map((e) => {
@@ -9891,7 +9892,7 @@ const ce = class ce {
9891
9892
  return e.name("clip-drop-preview"), e.visible(!1), e.listening(!1), this.trackGroup.add(e), this.dropPreviewGroup = e, e;
9892
9893
  }
9893
9894
  createDropPreviewRect(e) {
9894
- const t = this.trackType === "text" ? "rgba(96, 76, 51, 0.28)" : this.trackType === "video" ? Si.videoFill : Si.audioFill, i = this.trackType === "text" ? "#C9CBD4" : this.trackType === "video" ? Si.videoStroke : Si.audioStroke, r = ge(e.startTime, this.zoom, this.scrollLeft), n = Se(e.duration, this.zoom), a = de.createRect(r, 2, Math.max(n, 1), Math.max(this.trackHeight - 4, 1), t, i, 1);
9895
+ const t = this.trackType === "text" ? "rgba(96, 76, 51, 0.28)" : this.trackType === "video" ? Si.videoFill : Si.audioFill, i = this.trackType === "text" ? "#C9CBD4" : this.trackType === "video" ? Si.videoStroke : Si.audioStroke, r = ge(e.startTime, this.zoom, this.scrollLeft), n = ve(e.duration, this.zoom), a = de.createRect(r, 2, Math.max(n, 1), Math.max(this.trackHeight - 4, 1), t, i, 1);
9895
9896
  return a.dash([6, 4]), a.cornerRadius(4), a.listening(!1), a.visible(r + n > 0 && r < this.layer.width()), a;
9896
9897
  }
9897
9898
  showDropPreview(e) {
@@ -9935,7 +9936,7 @@ const ce = class ce {
9935
9936
  if (!t) return;
9936
9937
  const i = t.container();
9937
9938
  if (!i) return;
9938
- const r = i.getBoundingClientRect(), n = e.clientX - r.left, a = Math.max(0, Y.pixelsToTime(n - _e + this.scrollLeft, this.zoom));
9939
+ const r = i.getBoundingClientRect(), n = e.clientX - r.left, a = Math.max(0, U.pixelsToTime(n - fe + this.scrollLeft, this.zoom));
9939
9940
  this.onTimeJump(a), this.onClearSelection && this.onClearSelection();
9940
9941
  }
9941
9942
  handleTrackBackgroundMouseDown(e) {
@@ -9955,7 +9956,7 @@ const ce = class ce {
9955
9956
  i && (this.isVisualUpdate = !0, i.setSelected(t), this.isVisualUpdate = !1, t ? this.selectedClipIds.add(e) : this.selectedClipIds.delete(e), this.syncSelectionState(e), this.updateClipGroup(i.getClip()), this.render(!1), this.layer.batchDraw());
9956
9957
  }
9957
9958
  createClipGroup(e) {
9958
- const t = ge(e.startTime, this.zoom, this.scrollLeft), i = Se(e.duration, this.zoom), r = 2, n = this.trackHeight - 4, a = de.createClipGroup(
9959
+ const t = ge(e.startTime, this.zoom, this.scrollLeft), i = ve(e.duration, this.zoom), r = 2, n = this.trackHeight - 4, a = de.createClipGroup(
9959
9960
  t,
9960
9961
  r,
9961
9962
  i,
@@ -10020,9 +10021,9 @@ const ce = class ce {
10020
10021
  if (r) {
10021
10022
  this.multiDragOriginalPositions.clear();
10022
10023
  for (const T of this.selectedClipIds) {
10023
- const S = this.clips.find((C) => C.getClip().id === T);
10024
- if (S) {
10025
- const C = S.getClip();
10024
+ const v = this.clips.find((C) => C.getClip().id === T);
10025
+ if (v) {
10026
+ const C = v.getClip();
10026
10027
  this.multiDragOriginalPositions.set(T, {
10027
10028
  startTime: C.startTime,
10028
10029
  duration: C.duration
@@ -10030,10 +10031,10 @@ const ce = class ce {
10030
10031
  }
10031
10032
  }
10032
10033
  }
10033
- let v;
10034
- c.isPointInResizeHandle(f, m, this.zoom, this.trackY, this.trackHeight, this.scrollLeft) ? (v = c.getClip().isResizingLeft ? "resize-left" : "resize-right", c.startResize({ x: f, y: m })) : (v = "move", c.startDrag({ x: f, y: m }), this.trackGroup.moveToTop()), this.applyInteractionTransition(Ei(this.interactionState, {
10034
+ let S;
10035
+ c.isPointInResizeHandle(f, m, this.zoom, this.trackY, this.trackHeight, this.scrollLeft) ? (S = c.getClip().isResizingLeft ? "resize-left" : "resize-right", c.startResize({ x: f, y: m })) : (S = "move", c.startDrag({ x: f, y: m }), this.trackGroup.moveToTop()), this.applyInteractionTransition(Ei(this.interactionState, {
10035
10036
  type: "POINTER_DOWN",
10036
- operation: v,
10037
+ operation: S,
10037
10038
  clipId: e,
10038
10039
  originalClipsState: n,
10039
10040
  nonDraggedClips: a,
@@ -10094,11 +10095,11 @@ const ce = class ce {
10094
10095
  applyInteractionTransition(e) {
10095
10096
  var i, r;
10096
10097
  this.interactionState = e.state, e.effects.bindGlobalListeners && this.bindGlobalPointerListenersForDrag();
10097
- const t = zh(e.state);
10098
+ const t = $h(e.state);
10098
10099
  t && this.lockPointerCursor(t), e.effects.cleanup && (this.releasePointerCursor(), this.hideDropPreview(), (i = this.onClearDropPreview) == null || i.call(this), this.updateSnapGuideLine(null), this.stopEdgeAutoScroll(), this.clearClipDragOverlay(), this.multiDragOriginalPositions.size > 0 && ((r = this.onMultiDragInteractionEnd) == null || r.call(this), this.multiDragOriginalPositions.clear())), e.effects.unbindGlobalListeners && this.unbindGlobalPointerListenersForDrag();
10099
10100
  }
10100
10101
  handleClipMoveEnd(e, t) {
10101
- var m, v, T;
10102
+ var m, S, T;
10102
10103
  const i = t ?? this.interactionState, r = Ct(i) || {
10103
10104
  clipId: e.id,
10104
10105
  originalClipsState: [e],
@@ -10108,7 +10109,7 @@ const ce = class ce {
10108
10109
  crossTrackDragOffsetY: 0
10109
10110
  }, n = ji(i) || (e.isResizingLeft ? "resize-left" : e.isResizingRight ? "resize-right" : "move"), a = n === "move", o = a && this.multiDragOriginalPositions.size > 0, l = (m = this.clipGroups) == null ? void 0 : m.get(e.id);
10110
10111
  if (l && l.y(2), o) {
10111
- const S = this.multiDragOriginalPositions.get(e.id), C = S ? e.startTime - S.startTime : 0;
10112
+ const v = this.multiDragOriginalPositions.get(e.id), C = v ? e.startTime - v.startTime : 0;
10112
10113
  if (this.onMultiDragMove && this.config.id && this.onMultiDragMove({
10113
10114
  draggedClipId: e.id,
10114
10115
  deltaTime: C,
@@ -10118,20 +10119,20 @@ const ce = class ce {
10118
10119
  isFinal: !0
10119
10120
  })) {
10120
10121
  for (const A of this.selectedClipIds) {
10121
- const B = (v = this.clipGroups) == null ? void 0 : v.get(A);
10122
+ const B = (S = this.clipGroups) == null ? void 0 : S.get(A);
10122
10123
  B == null || B.y(2);
10123
10124
  }
10124
10125
  this.multiDragOriginalPositions.clear();
10125
10126
  return;
10126
10127
  }
10127
- const k = [], x = [];
10128
+ const k = [], P = [];
10128
10129
  for (const [w, A] of this.multiDragOriginalPositions) {
10129
10130
  const B = this.clips.find((H) => H.getClip().id === w);
10130
10131
  if (!B) continue;
10131
- const $ = Math.max(0, A.startTime + C), F = {
10132
+ const z = Math.max(0, A.startTime + C), F = {
10132
10133
  ...B.getClip(),
10133
- startTime: $,
10134
- endTime: $ + A.duration,
10134
+ startTime: z,
10135
+ endTime: z + A.duration,
10135
10136
  isDragging: !1,
10136
10137
  isResizing: !1,
10137
10138
  isResizingLeft: !1,
@@ -10141,15 +10142,15 @@ const ce = class ce {
10141
10142
  isSelected: this.selectedClipIds.has(w)
10142
10143
  };
10143
10144
  k.push(F);
10144
- const V = r.originalClipsState.find((H) => H.id === w);
10145
- V && x.push(V);
10146
- const z = (T = this.clipGroups) == null ? void 0 : T.get(w);
10147
- z && z.y(2);
10145
+ const $ = r.originalClipsState.find((H) => H.id === w);
10146
+ $ && P.push($);
10147
+ const V = (T = this.clipGroups) == null ? void 0 : T.get(w);
10148
+ V && V.y(2);
10148
10149
  }
10149
- const P = [];
10150
+ const x = [];
10150
10151
  for (const w of this.clips) {
10151
- const A = w.getClip(), B = k.find(($) => $.id === A.id);
10152
- B ? P.push(B) : P.push({
10152
+ const A = w.getClip(), B = k.find((z) => z.id === A.id);
10153
+ B ? x.push(B) : x.push({
10153
10154
  ...A,
10154
10155
  isDragging: !1,
10155
10156
  isResizing: !1,
@@ -10157,11 +10158,11 @@ const ce = class ce {
10157
10158
  isResizingRight: !1
10158
10159
  });
10159
10160
  }
10160
- P.sort((w, A) => w.startTime - A.startTime), this.isVisualUpdate = !0;
10161
- for (const w of P)
10161
+ x.sort((w, A) => w.startTime - A.startTime), this.isVisualUpdate = !0;
10162
+ for (const w of x)
10162
10163
  this.clips.find((B) => B.getClip().id === w.id) && this.handleClipUpdate(w);
10163
10164
  this.isVisualUpdate = !1;
10164
- const D = x.map((w) => {
10165
+ const D = P.map((w) => {
10165
10166
  const A = k.find((B) => B.id === w.id);
10166
10167
  return A && (w.startTime !== A.startTime || w.duration !== A.duration) ? {
10167
10168
  clipId: w.id,
@@ -10169,45 +10170,55 @@ const ce = class ce {
10169
10170
  newState: A
10170
10171
  } : null;
10171
10172
  }).filter((w) => w !== null);
10172
- D.length > 0 && this.onClipUpdate(e, x.find((w) => w.id === e.id), D), this.multiDragOriginalPositions.clear();
10173
+ D.length > 0 && this.onClipUpdate(e, P.find((w) => w.id === e.id), D), this.multiDragOriginalPositions.clear();
10173
10174
  return;
10174
10175
  }
10175
10176
  if (a && this.onClipCrossTrack && this.config.id) {
10176
- const S = r.originalClipsState.find((k) => k.id === e.id) ?? null;
10177
- if (this.onClipCrossTrack(e, S, r.dragTargetTrackY, this.config.id)) {
10177
+ const v = r.originalClipsState.find((k) => k.id === e.id) ?? null;
10178
+ if (this.onClipCrossTrack(e, v, r.dragTargetTrackY, this.config.id)) {
10178
10179
  this.multiDragOriginalPositions.clear();
10179
10180
  return;
10180
10181
  }
10181
10182
  }
10183
+ if (a && this.config.role === "primary" && this.onPrimaryTrackMagnetMove && this.config.id) {
10184
+ const v = r.originalClipsState.find((k) => k.id === e.id) ?? null;
10185
+ if (this.onPrimaryTrackMagnetMove(
10186
+ e,
10187
+ v,
10188
+ [...r.nonDraggedClips],
10189
+ this.config.id
10190
+ ))
10191
+ return;
10192
+ }
10182
10193
  const c = a ? [...r.nonDraggedClips] : [];
10183
10194
  let h = !1;
10184
10195
  const d = e.startTime + e.duration;
10185
- for (const S of c) {
10186
- const C = S.startTime + S.duration;
10187
- if (e.startTime < C && d > S.startTime) {
10196
+ for (const v of c) {
10197
+ const C = v.startTime + v.duration;
10198
+ if (e.startTime < C && d > v.startTime) {
10188
10199
  h = !0;
10189
10200
  break;
10190
10201
  }
10191
10202
  }
10192
10203
  if (a && h && this.onClipOverlap && this.config.id) {
10193
- const S = r.originalClipsState.find((C) => C.id === e.id) ?? null;
10194
- this.onClipOverlap(e, this.config.id, S);
10204
+ const v = r.originalClipsState.find((C) => C.id === e.id) ?? null;
10205
+ this.onClipOverlap(e, this.config.id, v);
10195
10206
  return;
10196
10207
  }
10197
- const u = r.nonDraggedClips.map((S) => ({ ...S }));
10208
+ const u = r.nonDraggedClips.map((v) => ({ ...v }));
10198
10209
  if (n === "resize-right") {
10199
- const S = r.originalClipsState.find((C) => C.id === e.id);
10200
- if (S) {
10201
- const C = this.computeResizeRightPushFollowers(S, e, r.nonDraggedClips);
10210
+ const v = r.originalClipsState.find((C) => C.id === e.id);
10211
+ if (v) {
10212
+ const C = this.computeResizeRightPushFollowers(v, e, r.nonDraggedClips);
10202
10213
  for (const k of C) {
10203
- const x = u.findIndex((P) => P.id === k.id);
10204
- x >= 0 && (u[x] = { ...k, isSelected: !1 });
10214
+ const P = u.findIndex((x) => x.id === k.id);
10215
+ P >= 0 && (u[P] = { ...k, isSelected: !1 });
10205
10216
  }
10206
10217
  }
10207
10218
  }
10208
- let p = u.findIndex((S) => S.startTime >= e.startTime);
10209
- p === -1 && (p = u.length), r.nonDraggedClips.forEach((S) => {
10210
- S.isSelected = !1;
10219
+ let p = u.findIndex((v) => v.startTime >= e.startTime);
10220
+ p === -1 && (p = u.length), r.nonDraggedClips.forEach((v) => {
10221
+ v.isSelected = !1;
10211
10222
  });
10212
10223
  const f = {
10213
10224
  ...e,
@@ -10219,7 +10230,18 @@ const ce = class ce {
10219
10230
  opacity: 1,
10220
10231
  isSelected: !0
10221
10232
  };
10222
- u.splice(p, 0, f), this.updateAllClips(u), this.buildAndSendUpdates(f, u, r.originalClipsState);
10233
+ u.splice(p, 0, f), this.config.role === "primary" && (n === "resize-left" || n === "resize-right") && this.compactPrimaryTrackClips(u), this.updateAllClips(u), this.buildAndSendUpdates(f, u, r.originalClipsState);
10234
+ }
10235
+ compactPrimaryTrackClips(e) {
10236
+ if (e.length <= 1)
10237
+ return;
10238
+ const t = e.map((r, n) => ({ clip: r, index: n })).sort((r, n) => r.clip.startTime === n.clip.startTime ? r.index - n.index : r.clip.startTime - n.clip.startTime);
10239
+ let i = t[0].clip.startTime + t[0].clip.duration;
10240
+ t[0].clip.endTime = i;
10241
+ for (let r = 1; r < t.length; r += 1) {
10242
+ const n = t[r].clip;
10243
+ n.startTime = i, n.endTime = n.startTime + n.duration, i = n.endTime;
10244
+ }
10223
10245
  }
10224
10246
  updateAllClips(e) {
10225
10247
  const t = this.clips ?? [];
@@ -10246,7 +10268,7 @@ const ce = class ce {
10246
10268
  if (!r || this.isDragSessionActive())
10247
10269
  return;
10248
10270
  const n = r.getBoundingClientRect(), a = e - n.left, o = t - n.top;
10249
- r.style.cursor = $h({
10271
+ r.style.cursor = zh({
10250
10272
  clips: this.clips.map((l) => l.getClip()),
10251
10273
  zoom: this.zoom,
10252
10274
  scrollLeft: this.scrollLeft,
@@ -10289,7 +10311,7 @@ const ce = class ce {
10289
10311
  updateClipGroup(e, t = !1) {
10290
10312
  const i = this.clipGroups.get(e.id);
10291
10313
  if (i) {
10292
- const r = Se(e.duration, this.zoom);
10314
+ const r = ve(e.duration, this.zoom);
10293
10315
  this.updateClipViewportState(e);
10294
10316
  const n = e.isSelected;
10295
10317
  (e.isDragging || n) && i.moveToTop(), i.opacity(e.opacity), de.updateClipGroup(
@@ -10338,7 +10360,7 @@ const ce = class ce {
10338
10360
  id: `${e.id}_split_${Date.now()}`,
10339
10361
  startTime: t,
10340
10362
  duration: r,
10341
- endTime: Y.calculateEndTime(t, r),
10363
+ endTime: U.calculateEndTime(t, r),
10342
10364
  startTimeAtSource: n,
10343
10365
  endTimeAtSource: e.endTimeAtSource
10344
10366
  };
@@ -10531,7 +10553,7 @@ const ce = class ce {
10531
10553
  const c = ge(t, this.zoom, this.scrollLeft);
10532
10554
  o.x(c), o.y(this.resolveClipRenderY(e, r)), o.moveToTop(), de.updateClipGroup(
10533
10555
  o,
10534
- Se(a.duration, this.zoom),
10556
+ ve(a.duration, this.zoom),
10535
10557
  this.trackHeight - 4,
10536
10558
  this.getClipDisplayLabel(a),
10537
10559
  a.duration,
@@ -10596,7 +10618,7 @@ const ce = class ce {
10596
10618
  this.resolveSnapTargetClips = e;
10597
10619
  }
10598
10620
  updateDraggedClipFromPointer(e, t, i) {
10599
- var T, S, C, k, x, P;
10621
+ var T, v, C, k, P, x;
10600
10622
  const r = this.interactionState, n = Ct(r), a = ji(r), o = this.layer.getStage(), l = this.resolveDraggedClipForInteraction(r);
10601
10623
  if (!o || !l || !n || !a) return;
10602
10624
  const c = o.container();
@@ -10607,8 +10629,8 @@ const ce = class ce {
10607
10629
  currentTrackId: this.config.id,
10608
10630
  offsetY: n.crossTrackDragOffsetY
10609
10631
  }));
10610
- const m = l.getClip(), v = (T = this.clipGroups) == null ? void 0 : T.get(m.id);
10611
- if (v) {
10632
+ const m = l.getClip(), S = (T = this.clipGroups) == null ? void 0 : T.get(m.id);
10633
+ if (S) {
10612
10634
  const D = p && n.crossTrackDragOffsetY !== 0;
10613
10635
  this.setClipDragOverlayActive(m.id, D);
10614
10636
  const w = n.originalClipsState.find((L) => L.id === m.id);
@@ -10616,16 +10638,16 @@ const ce = class ce {
10616
10638
  return;
10617
10639
  const A = this.buildPreviewClip(m, w, d, n, a);
10618
10640
  if (!A) {
10619
- this.hideDropPreview(), (S = this.onClearDropPreview) == null || S.call(this), this.updateSnapGuideLine(null);
10641
+ this.hideDropPreview(), (v = this.onClearDropPreview) == null || v.call(this), this.updateSnapGuideLine(null);
10620
10642
  return;
10621
10643
  }
10622
- const B = A.clip, $ = B.startTime - w.startTime, F = this.applyPreviewClipState(l, B), V = ge(B.startTime, this.zoom, this.scrollLeft), z = Se(B.duration, this.zoom);
10623
- v.x(V), v.y(this.resolveClipRenderY(m.id, n.crossTrackDragOffsetY)), v.visible(V + z > 0 && V < this.layer.width()), F && (this.updateClipGroup(B), v.y(this.resolveClipRenderY(m.id, n.crossTrackDragOffsetY)));
10644
+ const B = A.clip, z = B.startTime - w.startTime, F = this.applyPreviewClipState(l, B), $ = ge(B.startTime, this.zoom, this.scrollLeft), V = ve(B.duration, this.zoom);
10645
+ S.x($), S.y(this.resolveClipRenderY(m.id, n.crossTrackDragOffsetY)), S.visible($ + V > 0 && $ < this.layer.width()), F && (this.updateClipGroup(B), S.y(this.resolveClipRenderY(m.id, n.crossTrackDragOffsetY)));
10624
10646
  let H = !1;
10625
10647
  if (f) {
10626
10648
  this.onMultiDragMove && this.config.id && (H = this.onMultiDragMove({
10627
10649
  draggedClipId: m.id,
10628
- deltaTime: $,
10650
+ deltaTime: z,
10629
10651
  targetTrackY: n.dragTargetTrackY,
10630
10652
  currentTrackId: this.config.id,
10631
10653
  crossTrackOffsetY: n.crossTrackDragOffsetY,
@@ -10633,18 +10655,18 @@ const ce = class ce {
10633
10655
  }) === !0);
10634
10656
  for (const [L, X] of this.multiDragOriginalPositions) {
10635
10657
  if (L === m.id) continue;
10636
- const N = this.clips.find((W) => W.getClip().id === L);
10658
+ const N = this.clips.find((Y) => Y.getClip().id === L);
10637
10659
  if (!N) continue;
10638
- const Q = Math.max(0, X.startTime + $), ae = (C = this.clipGroups) == null ? void 0 : C.get(L);
10660
+ const Q = Math.max(0, X.startTime + z), ae = (C = this.clipGroups) == null ? void 0 : C.get(L);
10639
10661
  if (ae) {
10640
- const W = ge(Q, this.zoom, this.scrollLeft);
10641
- ae.x(W), ae.y(this.resolveClipRenderY(L, n.crossTrackDragOffsetY)), ae.visible(
10642
- W + Se(X.duration, this.zoom) > 0 && W < this.layer.width()
10662
+ const Y = ge(Q, this.zoom, this.scrollLeft);
10663
+ ae.x(Y), ae.y(this.resolveClipRenderY(L, n.crossTrackDragOffsetY)), ae.visible(
10664
+ Y + ve(X.duration, this.zoom) > 0 && Y < this.layer.width()
10643
10665
  );
10644
10666
  const K = N.getClip();
10645
10667
  de.updateClipGroup(
10646
10668
  ae,
10647
- Se(K.duration, this.zoom),
10669
+ ve(K.duration, this.zoom),
10648
10670
  this.trackHeight - 4,
10649
10671
  this.getClipDisplayLabel(K),
10650
10672
  K.duration,
@@ -10669,15 +10691,15 @@ const ce = class ce {
10669
10691
  if (!X)
10670
10692
  continue;
10671
10693
  const N = ge(L.startTime, this.zoom, this.scrollLeft);
10672
- X.x(N), X.y(this.resolveClipRenderY(L.id, n.crossTrackDragOffsetY)), X.visible(N + Se(L.duration, this.zoom) > 0 && N < this.layer.width());
10694
+ X.x(N), X.y(this.resolveClipRenderY(L.id, n.crossTrackDragOffsetY)), X.visible(N + ve(L.duration, this.zoom) > 0 && N < this.layer.width());
10673
10695
  }
10674
10696
  p && this.onClipCrossTrackPreview && this.config.id && !H ? this.onClipCrossTrackPreview(B, n.dragTargetTrackY, this.config.id) !== "self" && this.hideDropPreview() : H ? this.hideDropPreview() : this.showDropPreview(B), this.updateSnapGuideLine(A.guideTime);
10675
10697
  } else
10676
- this.hideDropPreview(), (x = this.onClearDropPreview) == null || x.call(this), this.updateSnapGuideLine(null);
10677
- i && this.updateEdgeAutoScrollState(d, h.width), this.layer.batchDraw(), (P = this.dragOverlayLayer) == null || P.batchDraw();
10698
+ this.hideDropPreview(), (P = this.onClearDropPreview) == null || P.call(this), this.updateSnapGuideLine(null);
10699
+ i && this.updateEdgeAutoScrollState(d, h.width), this.layer.batchDraw(), (x = this.dragOverlayLayer) == null || x.batchDraw();
10678
10700
  }
10679
10701
  buildPreviewClip(e, t, i, r, n) {
10680
- const a = i - r.pointerStartX + (this.scrollLeft - r.dragStartScrollLeft), o = Y.pixelsToTime(a, this.zoom);
10702
+ const a = i - r.pointerStartX + (this.scrollLeft - r.dragStartScrollLeft), o = U.pixelsToTime(a, this.zoom);
10681
10703
  let l;
10682
10704
  n === "resize-left" || e.isResizingLeft ? l = this.buildResizeLeftPreviewClip(e, t, o) : n === "resize-right" || e.isResizingRight ? l = this.buildResizeRightPreviewClip(e, t, o) : l = {
10683
10705
  ...e,
@@ -10733,7 +10755,7 @@ const ce = class ce {
10733
10755
  computeResizeRightPushFollowers(e, t, i) {
10734
10756
  if (!t.isResizingRight)
10735
10757
  return [];
10736
- const r = t.startTime + t.duration, n = Y.calculateEndTime(e.startTime, e.duration), a = [...i].filter((h) => h.startTime >= n).sort((h, d) => h.startTime - d.startTime);
10758
+ const r = t.startTime + t.duration, n = U.calculateEndTime(e.startTime, e.duration), a = [...i].filter((h) => h.startTime >= n).sort((h, d) => h.startTime - d.startTime);
10737
10759
  if (a.length === 0)
10738
10760
  return [];
10739
10761
  const o = a[0], l = r - o.startTime;
@@ -10748,7 +10770,7 @@ const ce = class ce {
10748
10770
  }
10749
10771
  buildResizeLeftPreviewClip(e, t, i) {
10750
10772
  if (!this.isSourceBoundClip(t)) {
10751
- const p = Y.calculateEndTime(t.startTime, t.duration);
10773
+ const p = U.calculateEndTime(t.startTime, t.duration);
10752
10774
  let f = Math.max(0, t.startTime + i), m = p - f;
10753
10775
  return m < ce.MIN_CLIP_DURATION_MS && (m = ce.MIN_CLIP_DURATION_MS, f = p - m), {
10754
10776
  ...e,
@@ -10760,7 +10782,7 @@ const ce = class ce {
10760
10782
  sourceDuration: m
10761
10783
  };
10762
10784
  }
10763
- const n = Math.max(0, t.startTime + i) - t.startTime, o = Math.max(0, t.startTimeAtSource + i) - t.startTimeAtSource, l = Math.abs(n) < Math.abs(o) ? n : o, c = Y.calculateEndTime(t.startTime, t.duration);
10785
+ const n = Math.max(0, t.startTime + i) - t.startTime, o = Math.max(0, t.startTimeAtSource + i) - t.startTimeAtSource, l = Math.abs(n) < Math.abs(o) ? n : o, c = U.calculateEndTime(t.startTime, t.duration);
10764
10786
  let h = t.startTime + l, d = t.duration - l, u;
10765
10787
  return d < ce.MIN_CLIP_DURATION_MS ? (d = ce.MIN_CLIP_DURATION_MS, h = c - d, u = t.endTimeAtSource - d) : u = t.startTimeAtSource + l, {
10766
10788
  ...e,
@@ -10801,7 +10823,7 @@ const ce = class ce {
10801
10823
  const r = i.flatMap((c) => [c.startTime, c.startTime + c.duration]);
10802
10824
  if (r.length === 0)
10803
10825
  return { clip: e, guideTime: null };
10804
- const n = Y.pixelsToTime(this.clipSnapThreshold, this.zoom), a = e.startTime + e.duration, o = [];
10826
+ const n = U.pixelsToTime(this.clipSnapThreshold, this.zoom), a = e.startTime + e.duration, o = [];
10805
10827
  if (e.isResizingLeft)
10806
10828
  for (const c of r) {
10807
10829
  const h = a - c, d = t.endTimeAtSource - h, u = Math.abs(c - e.startTime);
@@ -11231,7 +11253,7 @@ bt.elementStyles = [], bt.shadowRootOptions = { mode: "open" }, bt[ni("elementPr
11231
11253
  * SPDX-License-Identifier: BSD-3-Clause
11232
11254
  */
11233
11255
  const si = globalThis, ds = (s) => s, Ki = si.trustedTypes, us = Ki ? Ki.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, qa = "$lit$", Ke = `lit$${Math.random().toFixed(9).slice(2)}$`, ja = "?" + Ke, id = `<${ja}>`, dt = document, di = () => dt.createComment(""), ui = (s) => s === null || typeof s != "object" && typeof s != "function", fn = Array.isArray, rd = (s) => fn(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Sr = `[
11234
- \f\r]`, zt = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ps = /-->/g, gs = />/g, nt = RegExp(`>|${Sr}(?:([^\\s"'>=/]+)(${Sr}*=${Sr}*(?:[^
11256
+ \f\r]`, $t = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ps = /-->/g, gs = />/g, nt = RegExp(`>|${Sr}(?:([^\\s"'>=/]+)(${Sr}*=${Sr}*(?:[^
11235
11257
  \f\r"'\`<>=]|("|')|))|$)`, "g"), fs = /'/g, ms = /"/g, Ka = /^(?:script|style|textarea|title)$/i, nd = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), j = nd(1), ut = Symbol.for("lit-noChange"), le = Symbol.for("lit-nothing"), ys = /* @__PURE__ */ new WeakMap(), ct = dt.createTreeWalker(dt, 129);
11236
11258
  function Za(s, e) {
11237
11259
  if (!fn(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
@@ -11239,13 +11261,13 @@ function Za(s, e) {
11239
11261
  }
11240
11262
  const sd = (s, e) => {
11241
11263
  const t = s.length - 1, i = [];
11242
- let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = zt;
11264
+ let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = $t;
11243
11265
  for (let o = 0; o < t; o++) {
11244
11266
  const l = s[o];
11245
11267
  let c, h, d = -1, u = 0;
11246
- for (; u < l.length && (a.lastIndex = u, h = a.exec(l), h !== null); ) u = a.lastIndex, a === zt ? h[1] === "!--" ? a = ps : h[1] !== void 0 ? a = gs : h[2] !== void 0 ? (Ka.test(h[2]) && (r = RegExp("</" + h[2], "g")), a = nt) : h[3] !== void 0 && (a = nt) : a === nt ? h[0] === ">" ? (a = r ?? zt, d = -1) : h[1] === void 0 ? d = -2 : (d = a.lastIndex - h[2].length, c = h[1], a = h[3] === void 0 ? nt : h[3] === '"' ? ms : fs) : a === ms || a === fs ? a = nt : a === ps || a === gs ? a = zt : (a = nt, r = void 0);
11268
+ for (; u < l.length && (a.lastIndex = u, h = a.exec(l), h !== null); ) u = a.lastIndex, a === $t ? h[1] === "!--" ? a = ps : h[1] !== void 0 ? a = gs : h[2] !== void 0 ? (Ka.test(h[2]) && (r = RegExp("</" + h[2], "g")), a = nt) : h[3] !== void 0 && (a = nt) : a === nt ? h[0] === ">" ? (a = r ?? $t, d = -1) : h[1] === void 0 ? d = -2 : (d = a.lastIndex - h[2].length, c = h[1], a = h[3] === void 0 ? nt : h[3] === '"' ? ms : fs) : a === ms || a === fs ? a = nt : a === ps || a === gs ? a = $t : (a = nt, r = void 0);
11247
11269
  const p = a === nt && s[o + 1].startsWith("/>") ? " " : "";
11248
- n += a === zt ? l + id : d >= 0 ? (i.push(c), l.slice(0, d) + qa + l.slice(d) + Ke + p) : l + Ke + (d === -2 ? o : p);
11270
+ n += a === $t ? l + id : d >= 0 ? (i.push(c), l.slice(0, d) + qa + l.slice(d) + Ke + p) : l + Ke + (d === -2 ? o : p);
11249
11271
  }
11250
11272
  return [Za(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
11251
11273
  };
@@ -11840,13 +11862,13 @@ class vd {
11840
11862
  g(this, "onMuteTrack");
11841
11863
  var n, a, o, l, c, h;
11842
11864
  this.container = e.container, this.width = e.width ?? fi, this.timeScaleHeight = e.timeScaleHeight || 40, this.includeTimeScaleSpacer = e.includeTimeScaleSpacer ?? !0, this.theme = {
11843
- background: ((n = e.theme) == null ? void 0 : n.background) || be.background,
11844
- border: ((a = e.theme) == null ? void 0 : a.border) || be.border,
11845
- text: ((o = e.theme) == null ? void 0 : o.text) || be.text,
11846
- buttonBackground: ((l = e.theme) == null ? void 0 : l.buttonBackground) || be.buttonBackground,
11847
- buttonHover: ((c = e.theme) == null ? void 0 : c.buttonHover) || be.buttonHover,
11848
- buttonDanger: ((h = e.theme) == null ? void 0 : h.buttonDanger) || be.buttonDanger
11849
- }, this.onMuteTrack = r, this.iconCache.set("OmAi-camera", Te("OmAi-camera")), this.iconCache.set("OmAi-display", Te("OmAi-display")), this.iconCache.set("OmAi-hide", Te("OmAi-hide")), this.iconCache.set("OmAi-music", Te("OmAi-music")), this.iconCache.set("OmAi-text", Te("OmAi-text")), this.iconCache.set("OmAi-volume", Te("OmAi-volume")), this.iconCache.set("OmAi-volume-mute", Te("OmAi-volume-mute")), this.init();
11865
+ background: ((n = e.theme) == null ? void 0 : n.background) || ke.background,
11866
+ border: ((a = e.theme) == null ? void 0 : a.border) || ke.border,
11867
+ text: ((o = e.theme) == null ? void 0 : o.text) || ke.text,
11868
+ buttonBackground: ((l = e.theme) == null ? void 0 : l.buttonBackground) || ke.buttonBackground,
11869
+ buttonHover: ((c = e.theme) == null ? void 0 : c.buttonHover) || ke.buttonHover,
11870
+ buttonDanger: ((h = e.theme) == null ? void 0 : h.buttonDanger) || ke.buttonDanger
11871
+ }, this.onMuteTrack = r, this.iconCache.set("OmAi-camera", be("OmAi-camera")), this.iconCache.set("OmAi-display", be("OmAi-display")), this.iconCache.set("OmAi-hide", be("OmAi-hide")), this.iconCache.set("OmAi-music", be("OmAi-music")), this.iconCache.set("OmAi-text", be("OmAi-text")), this.iconCache.set("OmAi-volume", be("OmAi-volume")), this.iconCache.set("OmAi-volume-mute", be("OmAi-volume-mute")), this.init();
11850
11872
  }
11851
11873
  init() {
11852
11874
  this.container.className = "track-info-panel", this.container.style.position = "relative", this.container.style.overflow = "hidden", this.container.style.width = `${this.width}px`, this.container.style.background = this.theme.background, this.container.style.borderRight = `1px solid ${this.theme.border}`, this.container.style.color = this.theme.text, this.renderer.mount(this.container), this.render();
@@ -11998,7 +12020,7 @@ const Cd = {
11998
12020
  background: radial-gradient(circle at 32% 30%, ${_.sliderThumbGlowStart} 0%, ${_.sliderThumbGlowEnd} 74%);
11999
12021
  box-shadow:
12000
12022
  var(--clip-slider-thumb-shadow),
12001
- ${Pe.sliderThumbInnerShadow};
12023
+ ${xe.sliderThumbInnerShadow};
12002
12024
  }
12003
12025
 
12004
12026
  .clip-config-panel .clip-config-slider::-moz-range-track {
@@ -12021,7 +12043,7 @@ const Cd = {
12021
12043
  background: radial-gradient(circle at 32% 30%, ${_.sliderThumbGlowStart} 0%, ${_.sliderThumbGlowEnd} 74%);
12022
12044
  box-shadow:
12023
12045
  var(--clip-slider-thumb-shadow),
12024
- ${Pe.sliderThumbInnerShadow};
12046
+ ${xe.sliderThumbInnerShadow};
12025
12047
  }
12026
12048
  .clip-config-voice-card{
12027
12049
  border: 1px solid transparent;
@@ -12264,7 +12286,7 @@ const Cd = {
12264
12286
  return j`
12265
12287
  <div
12266
12288
  class=${G.tabBar}
12267
- style=${`display:flex;gap:12px;padding:4px;background-color:${Pe.tabBarBackground};border-radius:4px 4px 0 0;height:32px;`}
12289
+ style=${`display:flex;gap:12px;padding:4px;background-color:${xe.tabBarBackground};border-radius:4px 4px 0 0;height:32px;`}
12268
12290
  >
12269
12291
  ${t.map((i) => {
12270
12292
  const r = e.activeTab === i;
@@ -12279,8 +12301,8 @@ const Cd = {
12279
12301
  "font-size:13px",
12280
12302
  "font-family:inherit",
12281
12303
  "transition:background-color 0.15s, color 0.15s",
12282
- `background-color:${r ? Pe.activeTabBackground : _.transparent}`,
12283
- `color:${r ? Pe.activeTabText : Pe.inactiveTabText}`,
12304
+ `background-color:${r ? xe.activeTabBackground : _.transparent}`,
12305
+ `color:${r ? xe.activeTabText : xe.inactiveTabText}`,
12284
12306
  "border-radius:4px"
12285
12307
  ].join(";")}
12286
12308
  @click=${() => e.callbacks.onTabChange(i)}
@@ -12301,7 +12323,7 @@ const Cd = {
12301
12323
  `border-top:1px solid ${e.theme.borderColor}`,
12302
12324
  "border-radius:0 0 4px 4px",
12303
12325
  "min-height:32px",
12304
- `background-color:${Pe.actionBarBackground}`,
12326
+ `background-color:${xe.actionBarBackground}`,
12305
12327
  "padding:8px 10px"
12306
12328
  ].join(";")}
12307
12329
  >
@@ -12327,7 +12349,7 @@ const Cd = {
12327
12349
  <button
12328
12350
  class=${G.primaryButton}
12329
12351
  style=${[
12330
- `--clip-config-primary-bg:${i ? e.theme.buttonBackground : Pe.activeTabBackground}`,
12352
+ `--clip-config-primary-bg:${i ? e.theme.buttonBackground : xe.activeTabBackground}`,
12331
12353
  `--clip-config-primary-bg-hover:${i ? e.theme.buttonBackground : "#74767C"}`,
12332
12354
  `--clip-config-primary-bg-active:${i ? e.theme.buttonBackground : "#4B4D53"}`,
12333
12355
  `--clip-config-primary-bg-disabled:${e.theme.buttonBackground}`,
@@ -12580,7 +12602,7 @@ const Cd = {
12580
12602
  "border-radius:999px",
12581
12603
  "cursor:pointer",
12582
12604
  "font-size:12px",
12583
- `background:${r ? Pe.activeTabBackground : e.theme.buttonBackground}`,
12605
+ `background:${r ? xe.activeTabBackground : e.theme.buttonBackground}`,
12584
12606
  `color:${r ? e.theme.buttonActiveText : e.theme.textColor}`
12585
12607
  ].join(";")}
12586
12608
  data-key=${t}
@@ -12609,7 +12631,7 @@ const Cd = {
12609
12631
  "text-align:left",
12610
12632
  "cursor:pointer",
12611
12633
  `border:${r ? `1px solid ${e.theme.buttonActiveBorder}` : ""}`,
12612
- `background:${r ? Pe.activeTabBackground : e.theme.buttonBackground}`,
12634
+ `background:${r ? xe.activeTabBackground : e.theme.buttonBackground}`,
12613
12635
  `color:${e.theme.textColor}`
12614
12636
  ].join(";")}
12615
12637
  @click=${() => e.callbacks.onVoiceSelect(t.id)}
@@ -12856,7 +12878,7 @@ const Cd = {
12856
12878
  `--clip-slider-fill-end:${_.sliderFillEnd}`,
12857
12879
  `--clip-slider-road:${_.sliderRoad}`,
12858
12880
  `--clip-slider-thumb-border:${_.sliderThumbBorder}`,
12859
- `--clip-slider-thumb-shadow:${Pe.sliderThumbShadow}`
12881
+ `--clip-slider-thumb-shadow:${xe.sliderThumbShadow}`
12860
12882
  ].join(";");
12861
12883
  }
12862
12884
  getSliderStyle(e, t, i) {
@@ -12892,7 +12914,7 @@ const Cd = {
12892
12914
  g(xt, "colorRafId", 0);
12893
12915
  let en = xt;
12894
12916
  const Td = {
12895
- ...me
12917
+ ...ye
12896
12918
  };
12897
12919
  function Cs(s) {
12898
12920
  return s ? {
@@ -12948,7 +12970,7 @@ class kd {
12948
12970
  g(this, "handleVoicePreviewEnded", () => {
12949
12971
  this.stopVoicePreview();
12950
12972
  });
12951
- this.container = e.container, this.theme = e.theme ?? Td, this.voiceCatalog = e.voiceCatalog ?? [], this.onClipUpdate = e.onClipUpdate, this.onGenerateVoice = e.onGenerateVoice, this.iconCache.set("OmAi-camera", Te("OmAi-camera")), this.iconCache.set("OmAi-accept", Te("OmAi-accept")), this.iconCache.set("OmAi-loading", Te("OmAi-loading")), this.iconCache.set("OmAi-text", Te("OmAi-text")), this.renderer.mount(this.container), this.render();
12973
+ this.container = e.container, this.theme = e.theme ?? Td, this.voiceCatalog = e.voiceCatalog ?? [], this.onClipUpdate = e.onClipUpdate, this.onGenerateVoice = e.onGenerateVoice, this.iconCache.set("OmAi-camera", be("OmAi-camera")), this.iconCache.set("OmAi-accept", be("OmAi-accept")), this.iconCache.set("OmAi-loading", be("OmAi-loading")), this.iconCache.set("OmAi-text", be("OmAi-text")), this.renderer.mount(this.container), this.render();
12952
12974
  }
12953
12975
  setClip(e) {
12954
12976
  this.setSelectionState(Cs(e));
@@ -13201,8 +13223,8 @@ class kd {
13201
13223
  if (!Number.isFinite(n))
13202
13224
  return;
13203
13225
  r.fontSize = Math.max(
13204
- $i.MIN,
13205
- Math.min($i.MAX, n)
13226
+ zi.MIN,
13227
+ Math.min(zi.MAX, n)
13206
13228
  );
13207
13229
  } else if (e === "rotation") {
13208
13230
  const n = typeof t == "number" ? t : Number.parseFloat(String(t));
@@ -13382,22 +13404,22 @@ class Ts {
13382
13404
  };
13383
13405
  const u = n.filter((m) => m.type === e.type).map((m) => m.id), p = u.indexOf(l);
13384
13406
  for (let m = 1; m <= u.length; m += 1) {
13385
- const v = p - m;
13386
- if (v >= 0) {
13387
- const S = u[v], C = a.find((k) => this.resolveTrackId(k) === S);
13407
+ const S = p - m;
13408
+ if (S >= 0) {
13409
+ const v = u[S], C = a.find((k) => this.resolveTrackId(k) === v);
13388
13410
  if (C && !this.hasOverlapOnTrack(e, C))
13389
13411
  return {
13390
13412
  status: "move_to_track",
13391
- targetTrackId: S
13413
+ targetTrackId: v
13392
13414
  };
13393
13415
  }
13394
13416
  const T = p + m;
13395
13417
  if (T < u.length) {
13396
- const S = u[T], C = a.find((k) => this.resolveTrackId(k) === S);
13418
+ const v = u[T], C = a.find((k) => this.resolveTrackId(k) === v);
13397
13419
  if (C && !this.hasOverlapOnTrack(e, C))
13398
13420
  return {
13399
13421
  status: "move_to_track",
13400
- targetTrackId: S
13422
+ targetTrackId: v
13401
13423
  };
13402
13424
  }
13403
13425
  }
@@ -13742,6 +13764,16 @@ class bs {
13742
13764
  timestamp: Date.now()
13743
13765
  };
13744
13766
  }
13767
+ createSetPrimaryTrackMagnetAction(e, t) {
13768
+ return {
13769
+ type: "set_primary_track_magnet",
13770
+ data: {
13771
+ previousEnabled: e,
13772
+ nextEnabled: t
13773
+ },
13774
+ timestamp: Date.now()
13775
+ };
13776
+ }
13745
13777
  createCompoundAction(e, t) {
13746
13778
  return {
13747
13779
  type: "compound",
@@ -13764,25 +13796,25 @@ class ks {
13764
13796
  this.executeRedoInternal(e, /* @__PURE__ */ new Map());
13765
13797
  }
13766
13798
  executeUndoInternal(e, t) {
13767
- var i, r;
13799
+ var i, r, n, a;
13768
13800
  switch (e.type) {
13769
13801
  case "add_clip":
13770
13802
  this.target.removeClip(this.normalizeAddClipActionData(e.data).clip.id);
13771
13803
  break;
13772
13804
  case "remove_clip": {
13773
- const n = this.normalizeRemoveClipActionData(e.data);
13774
- let a = !1;
13775
- const o = this.resolveTrackIdForHistorySnapshot(
13776
- n.sourceTrackSnapshot,
13777
- n.sourceTrackId,
13805
+ const o = this.normalizeRemoveClipActionData(e.data);
13806
+ let l = !1;
13807
+ const c = this.resolveTrackIdForHistorySnapshot(
13808
+ o.sourceTrackSnapshot,
13809
+ o.sourceTrackId,
13778
13810
  t,
13779
- n.sourceTrackRestoreAnchor
13811
+ o.sourceTrackRestoreAnchor
13780
13812
  );
13781
- if (o && (a = this.target.addClipToTrack(o, n.clip)), !a) {
13782
- const l = this.target.findTrackByClipId(n.clip.id) || this.target.getDefaultTrack();
13783
- l == null || l.addClip(n.clip);
13813
+ if (c && (l = this.target.addClipToTrack(c, o.clip)), !l) {
13814
+ const h = this.target.findTrackByClipId(o.clip.id) || this.target.getDefaultTrack();
13815
+ h == null || h.addClip(o.clip);
13784
13816
  }
13785
- (r = (i = this.target).loadClipThumbnails) == null || r.call(i, n.clip);
13817
+ (r = (i = this.target).loadClipThumbnails) == null || r.call(i, o.clip);
13786
13818
  break;
13787
13819
  }
13788
13820
  case "update_clip":
@@ -13790,17 +13822,17 @@ class ks {
13790
13822
  break;
13791
13823
  case "split_clip": {
13792
13824
  this.withClipRemovalBatch(() => {
13793
- const n = this.normalizeSplitClipActionData(e.data), a = this.target.findTrackByClipId(e.data.clip1.id) || this.target.getDefaultTrack(), o = this.resolveTrackIdForHistorySnapshot(
13794
- n.sourceTrackSnapshot,
13795
- n.sourceTrackId,
13825
+ const o = this.normalizeSplitClipActionData(e.data), l = this.target.findTrackByClipId(e.data.clip1.id) || this.target.getDefaultTrack(), c = this.resolveTrackIdForHistorySnapshot(
13826
+ o.sourceTrackSnapshot,
13827
+ o.sourceTrackId,
13796
13828
  t,
13797
- n.sourceTrackRestoreAnchor
13829
+ o.sourceTrackRestoreAnchor
13798
13830
  );
13799
- if (this.target.removeClip(e.data.clip1.id), this.target.removeClip(e.data.clip2.id), o) {
13800
- this.target.addClipToTrack(o, e.data.originalClip);
13831
+ if (this.target.removeClip(e.data.clip1.id), this.target.removeClip(e.data.clip2.id), c) {
13832
+ this.target.addClipToTrack(c, e.data.originalClip);
13801
13833
  return;
13802
13834
  }
13803
- a == null || a.addClip(e.data.originalClip);
13835
+ l == null || l.addClip(e.data.originalClip);
13804
13836
  });
13805
13837
  break;
13806
13838
  }
@@ -13814,24 +13846,24 @@ class ks {
13814
13846
  });
13815
13847
  break;
13816
13848
  case "remove_gaps":
13817
- this.target.getClips().forEach((n) => this.target.removeClip(n.id)), e.data.clipsBefore.forEach((n) => {
13818
- const a = this.target.findTrackByClipId(n.id) || this.target.getDefaultTrack();
13819
- a == null || a.addClip(n);
13849
+ this.target.getClips().forEach((o) => this.target.removeClip(o.id)), e.data.clipsBefore.forEach((o) => {
13850
+ const l = this.target.findTrackByClipId(o.id) || this.target.getDefaultTrack();
13851
+ l == null || l.addClip(o);
13820
13852
  });
13821
13853
  break;
13822
13854
  case "multi_clip_update":
13823
- e.data.clipUpdates.forEach((n) => {
13824
- this.target.updateClip(n.clipId, n.previousState);
13855
+ e.data.clipUpdates.forEach((o) => {
13856
+ this.target.updateClip(o.clipId, o.previousState);
13825
13857
  });
13826
13858
  break;
13827
13859
  case "move_clip_between_tracks": {
13828
- const n = this.normalizeMoveClipBetweenTracksActionData(e.data);
13860
+ const o = this.normalizeMoveClipBetweenTracksActionData(e.data);
13829
13861
  this.restoreMovedClip(
13830
- n.clipId,
13831
- n.sourceTrackId,
13832
- n.sourceTrackSnapshot,
13833
- n.sourceTrackRestoreAnchor,
13834
- n.clipBefore,
13862
+ o.clipId,
13863
+ o.sourceTrackId,
13864
+ o.sourceTrackSnapshot,
13865
+ o.sourceTrackRestoreAnchor,
13866
+ o.clipBefore,
13835
13867
  t
13836
13868
  );
13837
13869
  break;
@@ -13842,9 +13874,12 @@ class ks {
13842
13874
  case "restore_clip_audio":
13843
13875
  this.target.updateClip(e.data.videoClipBefore.id, e.data.videoClipBefore);
13844
13876
  break;
13877
+ case "set_primary_track_magnet":
13878
+ (a = (n = this.target).setPrimaryTrackMagnetEnabled) == null || a.call(n, e.data.previousEnabled);
13879
+ break;
13845
13880
  case "compound":
13846
- [...e.data.actions].reverse().forEach((n) => {
13847
- this.executeUndoInternal(n, t);
13881
+ [...e.data.actions].reverse().forEach((o) => {
13882
+ this.executeUndoInternal(o, t);
13848
13883
  });
13849
13884
  break;
13850
13885
  default:
@@ -13852,22 +13887,22 @@ class ks {
13852
13887
  }
13853
13888
  }
13854
13889
  executeRedoInternal(e, t) {
13855
- var i, r;
13890
+ var i, r, n, a;
13856
13891
  switch (e.type) {
13857
13892
  case "add_clip": {
13858
- const n = this.normalizeAddClipActionData(e.data);
13859
- let a = !1;
13860
- const o = this.resolveTrackIdForHistorySnapshot(
13861
- n.targetTrackSnapshot,
13862
- n.targetTrackId,
13893
+ const o = this.normalizeAddClipActionData(e.data);
13894
+ let l = !1;
13895
+ const c = this.resolveTrackIdForHistorySnapshot(
13896
+ o.targetTrackSnapshot,
13897
+ o.targetTrackId,
13863
13898
  t,
13864
- n.targetTrackRestoreAnchor
13899
+ o.targetTrackRestoreAnchor
13865
13900
  );
13866
- if (o && (a = this.target.addClipToTrack(o, n.clip)), !a) {
13867
- const l = this.target.findTrackByClipId(n.clip.id) || this.target.getDefaultTrack();
13868
- l == null || l.addClip(n.clip);
13901
+ if (c && (l = this.target.addClipToTrack(c, o.clip)), !l) {
13902
+ const h = this.target.findTrackByClipId(o.clip.id) || this.target.getDefaultTrack();
13903
+ h == null || h.addClip(o.clip);
13869
13904
  }
13870
- (r = (i = this.target).loadClipThumbnails) == null || r.call(i, n.clip);
13905
+ (r = (i = this.target).loadClipThumbnails) == null || r.call(i, o.clip);
13871
13906
  break;
13872
13907
  }
13873
13908
  case "remove_clip":
@@ -13878,17 +13913,17 @@ class ks {
13878
13913
  break;
13879
13914
  case "split_clip": {
13880
13915
  this.withClipRemovalBatch(() => {
13881
- const n = this.normalizeSplitClipActionData(e.data), a = this.target.findTrackByClipId(e.data.originalClip.id) || this.target.getDefaultTrack(), o = this.resolveTrackIdForHistorySnapshot(
13882
- n.sourceTrackSnapshot,
13883
- n.sourceTrackId,
13916
+ const o = this.normalizeSplitClipActionData(e.data), l = this.target.findTrackByClipId(e.data.originalClip.id) || this.target.getDefaultTrack(), c = this.resolveTrackIdForHistorySnapshot(
13917
+ o.sourceTrackSnapshot,
13918
+ o.sourceTrackId,
13884
13919
  t,
13885
- n.sourceTrackRestoreAnchor
13920
+ o.sourceTrackRestoreAnchor
13886
13921
  );
13887
- if (this.target.removeClip(e.data.originalClip.id), o) {
13888
- this.target.addClipToTrack(o, e.data.clip1), this.target.addClipToTrack(o, e.data.clip2);
13922
+ if (this.target.removeClip(e.data.originalClip.id), c) {
13923
+ this.target.addClipToTrack(c, e.data.clip1), this.target.addClipToTrack(c, e.data.clip2);
13889
13924
  return;
13890
13925
  }
13891
- a == null || a.addClip(e.data.clip1), a == null || a.addClip(e.data.clip2);
13926
+ l == null || l.addClip(e.data.clip1), l == null || l.addClip(e.data.clip2);
13892
13927
  });
13893
13928
  break;
13894
13929
  }
@@ -13905,18 +13940,18 @@ class ks {
13905
13940
  this.target.removeClipGaps();
13906
13941
  break;
13907
13942
  case "multi_clip_update":
13908
- e.data.clipUpdates.forEach((n) => {
13909
- this.target.updateClip(n.clipId, n.newState);
13943
+ e.data.clipUpdates.forEach((o) => {
13944
+ this.target.updateClip(o.clipId, o.newState);
13910
13945
  });
13911
13946
  break;
13912
13947
  case "move_clip_between_tracks": {
13913
- const n = this.normalizeMoveClipBetweenTracksActionData(e.data);
13948
+ const o = this.normalizeMoveClipBetweenTracksActionData(e.data);
13914
13949
  this.restoreMovedClip(
13915
- n.clipId,
13916
- n.targetTrackId,
13917
- n.targetTrackSnapshot,
13918
- n.targetTrackRestoreAnchor,
13919
- n.clipAfter,
13950
+ o.clipId,
13951
+ o.targetTrackId,
13952
+ o.targetTrackSnapshot,
13953
+ o.targetTrackRestoreAnchor,
13954
+ o.clipAfter,
13920
13955
  t
13921
13956
  );
13922
13957
  break;
@@ -13927,9 +13962,12 @@ class ks {
13927
13962
  case "restore_clip_audio":
13928
13963
  this.target.updateClip(e.data.videoClipAfter.id, e.data.videoClipAfter);
13929
13964
  break;
13965
+ case "set_primary_track_magnet":
13966
+ (a = (n = this.target).setPrimaryTrackMagnetEnabled) == null || a.call(n, e.data.nextEnabled);
13967
+ break;
13930
13968
  case "compound":
13931
- e.data.actions.forEach((n) => {
13932
- this.executeRedoInternal(n, t);
13969
+ e.data.actions.forEach((o) => {
13970
+ this.executeRedoInternal(o, t);
13933
13971
  });
13934
13972
  break;
13935
13973
  default:
@@ -14099,6 +14137,10 @@ class ws {
14099
14137
  createRestoreClipAudioAction(e, t, i, r) {
14100
14138
  return this.history.createRestoreClipAudioAction(e, t, i, r);
14101
14139
  }
14140
+ recordSetPrimaryTrackMagnet(e, t) {
14141
+ const i = this.history.createSetPrimaryTrackMagnetAction(e, t);
14142
+ return this.recordAction(i), i;
14143
+ }
14102
14144
  recordCompoundAction(e, t) {
14103
14145
  if (e.length === 0)
14104
14146
  return null;
@@ -14319,18 +14361,18 @@ const Tr = {
14319
14361
  function br(s, e) {
14320
14362
  return typeof s == "number" && Number.isFinite(s) ? s : e;
14321
14363
  }
14322
- function $d(s) {
14364
+ function zd(s) {
14323
14365
  return Math.min(Hd, Math.max(Gd, s));
14324
14366
  }
14325
- function we(s) {
14367
+ function Pe(s) {
14326
14368
  return {
14327
14369
  x: br(s == null ? void 0 : s.x, Tr.x),
14328
14370
  y: br(s == null ? void 0 : s.y, Tr.y),
14329
- scale: $d(br(s == null ? void 0 : s.scale, Tr.scale))
14371
+ scale: zd(br(s == null ? void 0 : s.scale, Tr.scale))
14330
14372
  };
14331
14373
  }
14332
14374
  function mn(s, e, t = 1e-4) {
14333
- const i = we(s), r = we(e);
14375
+ const i = Pe(s), r = Pe(e);
14334
14376
  return Math.abs(i.x - r.x) <= t && Math.abs(i.y - r.y) <= t && Math.abs(i.scale - r.scale) <= t;
14335
14377
  }
14336
14378
  function Qa(s, e) {
@@ -14357,7 +14399,7 @@ function Qa(s, e) {
14357
14399
  };
14358
14400
  }
14359
14401
  function Ps(s, e, t) {
14360
- const i = Qa(s, e), r = we(t), n = i.width * r.scale, a = i.height * r.scale, o = s.width * r.x, l = s.height * r.y;
14402
+ const i = Qa(s, e), r = Pe(t), n = i.width * r.scale, a = i.height * r.scale, o = s.width * r.x, l = s.height * r.y;
14361
14403
  return {
14362
14404
  left: o - n / 2,
14363
14405
  top: l - a / 2,
@@ -14368,16 +14410,16 @@ function Ps(s, e, t) {
14368
14410
  };
14369
14411
  }
14370
14412
  function eo(s, e, t, i) {
14371
- const r = we(s), n = i.width > 0 ? i.width : 1, a = i.height > 0 ? i.height : 1;
14372
- return we({
14413
+ const r = Pe(s), n = i.width > 0 ? i.width : 1, a = i.height > 0 ? i.height : 1;
14414
+ return Pe({
14373
14415
  x: r.x + e / n,
14374
14416
  y: r.y + t / a,
14375
14417
  scale: r.scale
14376
14418
  });
14377
14419
  }
14378
- function zd(s, e, t, i, r, n) {
14379
- const a = we(n), o = Math.max(r.width / 2, 1), l = Math.max(r.height / 2, 1), c = Math.abs(t - s) / o, h = Math.abs(i - e) / l;
14380
- return we({
14420
+ function $d(s, e, t, i, r, n) {
14421
+ const a = Pe(n), o = Math.max(r.width / 2, 1), l = Math.max(r.height / 2, 1), c = Math.abs(t - s) / o, h = Math.abs(i - e) / l;
14422
+ return Pe({
14381
14423
  x: a.x,
14382
14424
  y: a.y,
14383
14425
  scale: Math.max(c, h)
@@ -14559,13 +14601,13 @@ class Vd {
14559
14601
  (n = t.preventDefault) == null || n.call(t);
14560
14602
  const i = this.toLocalPoint(t);
14561
14603
  if (this.interaction.mode === "rotate" && this.interaction.startRotation !== void 0) {
14562
- const u = i.x - this.interaction.centerX, p = i.y - this.interaction.centerY, m = Math.atan2(p, u) * (180 / Math.PI) - this.interaction.startAngle, v = Math.round(this.interaction.startRotation + m);
14563
- this.interaction.nextRotation = v, this.interaction.changed = v !== this.interaction.startRotation, (o = (a = this.callbacks).onRotationChange) == null || o.call(a, this.interaction.clipId, v);
14604
+ const u = i.x - this.interaction.centerX, p = i.y - this.interaction.centerY, m = Math.atan2(p, u) * (180 / Math.PI) - this.interaction.startAngle, S = Math.round(this.interaction.startRotation + m);
14605
+ this.interaction.nextRotation = S, this.interaction.changed = S !== this.interaction.startRotation, (o = (a = this.callbacks).onRotationChange) == null || o.call(a, this.interaction.clipId, S);
14564
14606
  return;
14565
14607
  }
14566
14608
  if (this.interaction.clipType === "text" && this.interaction.startFontSize !== void 0) {
14567
- const u = i.x - this.interaction.centerX, p = i.y - this.interaction.centerY, f = Math.sqrt(u * u + p * p), m = (this.interaction.startCenterDistance ?? 0) > 0 ? f / this.interaction.startCenterDistance : 1, v = Math.max(5, Math.min(300, Math.round(this.interaction.startFontSize * m)));
14568
- this.interaction.nextFontSize = v, this.interaction.changed = v !== this.interaction.startFontSize, (c = (l = this.callbacks).onFontSizeChange) == null || c.call(l, this.interaction.clipId, v);
14609
+ const u = i.x - this.interaction.centerX, p = i.y - this.interaction.centerY, f = Math.sqrt(u * u + p * p), m = (this.interaction.startCenterDistance ?? 0) > 0 ? f / this.interaction.startCenterDistance : 1, S = Math.max(5, Math.min(300, Math.round(this.interaction.startFontSize * m)));
14610
+ this.interaction.nextFontSize = S, this.interaction.changed = S !== this.interaction.startFontSize, (c = (l = this.callbacks).onFontSizeChange) == null || c.call(l, this.interaction.clipId, S);
14569
14611
  return;
14570
14612
  }
14571
14613
  let r = this.interaction.startTransform;
@@ -14578,7 +14620,7 @@ class Vd {
14578
14620
  );
14579
14621
  else {
14580
14622
  const u = this.interaction.startTransform.x * this.interaction.frameSize.width, p = this.interaction.startTransform.y * this.interaction.frameSize.height;
14581
- r = zd(
14623
+ r = $d(
14582
14624
  u,
14583
14625
  p,
14584
14626
  i.x,
@@ -14667,7 +14709,7 @@ function Ud(s, e) {
14667
14709
  }), i.forEach((p) => {
14668
14710
  o.set(p.trackId, { kind: p.trackType, order: p.trackOrder });
14669
14711
  }), Array.from(o.entries()).map(([p, f]) => {
14670
- const m = n.get(p) || null, v = d(p, f.kind) && a.get(p) || null;
14712
+ const m = n.get(p) || null, S = d(p, f.kind) && a.get(p) || null;
14671
14713
  return {
14672
14714
  trackId: p,
14673
14715
  kind: f.kind,
@@ -14683,7 +14725,7 @@ function Ud(s, e) {
14683
14725
  },
14684
14726
  preload: {
14685
14727
  role: "preload",
14686
- entry: v,
14728
+ entry: S,
14687
14729
  playState: "paused",
14688
14730
  speed: 1,
14689
14731
  visible: !1,
@@ -14876,14 +14918,14 @@ function wu(s, e) {
14876
14918
  height: e.height
14877
14919
  };
14878
14920
  }
14879
- function xe(s) {
14921
+ function _e(s) {
14880
14922
  return s.getAttribute("src") || s.currentSrc || s.src || "";
14881
14923
  }
14882
14924
  function Ji(s) {
14883
14925
  return s.getAttribute("src") || "";
14884
14926
  }
14885
14927
  function De(s, e) {
14886
- const t = Ji(s), i = s.currentSrc || "", r = s.src || "", n = xe(s);
14928
+ const t = Ji(s), i = s.currentSrc || "", r = s.src || "", n = _e(s);
14887
14929
  return {
14888
14930
  desiredSource: e || null,
14889
14931
  srcAttribute: t || null,
@@ -14954,7 +14996,7 @@ function ee(s) {
14954
14996
  tsMs: rn(),
14955
14997
  currentTime: Number.isFinite(s.currentTime) ? Number(s.currentTime.toFixed(3)) : null,
14956
14998
  duration: Number.isFinite(s.duration) ? Number(s.duration.toFixed(3)) : null,
14957
- currentSrc: xe(s) || null,
14999
+ currentSrc: _e(s) || null,
14958
15000
  srcAttribute: Ji(s) || null,
14959
15001
  elementSrc: s.src || null,
14960
15002
  rawCurrentSrc: s.currentSrc || null,
@@ -15122,7 +15164,7 @@ class xu {
15122
15164
  clipId: ((i = e.entry) == null ? void 0 : i.clip.id) ?? null,
15123
15165
  slotKey: `${e.trackId}:${e.role}`,
15124
15166
  desiredSourceUrl: e.desiredSource,
15125
- actualSourceUrl: xe(e.element) || null,
15167
+ actualSourceUrl: _e(e.element) || null,
15126
15168
  extra: {
15127
15169
  role: e.role,
15128
15170
  kind: e.kind,
@@ -15245,11 +15287,11 @@ class xu {
15245
15287
  return r.preload = t === "preload" ? "auto" : "metadata", r.crossOrigin = "anonymous", r.loop = !1, r.controls = !1, Qi(r) ? (Dr(r), r.playsInline = !0, r.style.position = "absolute", r.style.inset = "0", r.style.width = "100%", r.style.height = "100%", r.style.objectFit = "fill", r.style.background = _.black, r.style.pointerEvents = "none") : r.style.display = "none", r;
15246
15288
  }
15247
15289
  createSlot(e, t, i) {
15248
- var P, D;
15290
+ var x, D;
15249
15291
  const r = this.createMediaElement(t, i), n = t === "video" ? document.createElement("div") : null, a = t === "video" ? document.createElement("div") : null, o = t === "video" ? document.createElement("div") : null;
15250
15292
  if (n) {
15251
15293
  const w = this.dependencies.slotClassNamePrefix ?? "timeline-preview-slot";
15252
- n.className = `${w} timeline-preview-slot--${e} timeline-preview-slot--${i}`, n.style.position = "absolute", n.style.overflow = "hidden", n.style.background = _.black, n.style.pointerEvents = "none", n.style.display = "none", n.appendChild(r), a && o && (a.className = "timeline-preview-slot__failure", a.style.position = "absolute", a.style.inset = "0", a.style.display = "none", a.style.alignItems = "center", a.style.justifyContent = "center", a.style.padding = "12px", a.style.boxSizing = "border-box", a.style.background = _.mediaClipFailedBackground, a.style.color = _.white, a.style.pointerEvents = "none", o.className = "timeline-preview-slot__failure-label", o.style.fontSize = "18px", o.style.fontWeight = "600", o.style.lineHeight = "1.2", o.style.textAlign = "center", o.textContent = Is, a.appendChild(o), n.appendChild(a)), (P = this.frameElement) == null || P.appendChild(n);
15294
+ n.className = `${w} timeline-preview-slot--${e} timeline-preview-slot--${i}`, n.style.position = "absolute", n.style.overflow = "hidden", n.style.background = _.black, n.style.pointerEvents = "none", n.style.display = "none", n.appendChild(r), a && o && (a.className = "timeline-preview-slot__failure", a.style.position = "absolute", a.style.inset = "0", a.style.display = "none", a.style.alignItems = "center", a.style.justifyContent = "center", a.style.padding = "12px", a.style.boxSizing = "border-box", a.style.background = _.mediaClipFailedBackground, a.style.color = _.white, a.style.pointerEvents = "none", o.className = "timeline-preview-slot__failure-label", o.style.fontSize = "18px", o.style.fontWeight = "600", o.style.lineHeight = "1.2", o.style.textAlign = "center", o.textContent = Is, a.appendChild(o), n.appendChild(a)), (x = this.frameElement) == null || x.appendChild(n);
15253
15295
  }
15254
15296
  const l = {
15255
15297
  role: i,
@@ -15352,14 +15394,14 @@ class xu {
15352
15394
  message: "Media event: playing",
15353
15395
  mediaState: ee(l.element)
15354
15396
  })), this.refreshRuntimeState();
15355
- }, v = () => {
15397
+ }, S = () => {
15356
15398
  this.refreshRuntimeState();
15357
15399
  }, T = () => {
15358
15400
  this.emitDiagnostic("debug", "playback", "media.pause", this.buildSlotTraceData(l, {
15359
15401
  message: "Media event: pause",
15360
15402
  mediaState: ee(l.element)
15361
15403
  })), this.refreshRuntimeState();
15362
- }, S = () => {
15404
+ }, v = () => {
15363
15405
  l.isBuffering = l.role === "current" && l.isActive && l.requestedPlayState === "playing", l.hasBufferingSignalSinceSourceChange = l.isBuffering, l.lastPlaybackResumeAttemptAtMs = -1, this.emitDiagnostic("warn", "playback", "media.stalled", this.buildSlotTraceData(l, {
15364
15406
  message: "Media event: stalled",
15365
15407
  mediaState: ee(l.element)
@@ -15371,19 +15413,19 @@ class xu {
15371
15413
  })), this.refreshRuntimeState();
15372
15414
  }, k = () => {
15373
15415
  l.isSeeking = !0, this.refreshRuntimeState();
15374
- }, x = () => {
15416
+ }, P = () => {
15375
15417
  l.isSeeking = !1, l.hasReadyEventSinceSourceChange = !0, l.hasBufferingSignalSinceSourceChange = !1, this.resetSlotPlaybackProgressProbe(l), this.maybeResumeRequestedPlayback(l, "seeked"), this.refreshRuntimeState();
15376
15418
  };
15377
- return r.addEventListener("loadstart", p), r.addEventListener("canplay", f), r.addEventListener("playing", m), r.addEventListener("progress", v), r.addEventListener("pause", T), r.addEventListener("stalled", S), r.addEventListener("waiting", C), r.addEventListener("seeking", k), r.addEventListener("seeked", x), r.addEventListener("abort", h), r.addEventListener("emptied", d), r.addEventListener("error", u), l.cleanup.push(
15419
+ return r.addEventListener("loadstart", p), r.addEventListener("canplay", f), r.addEventListener("playing", m), r.addEventListener("progress", S), r.addEventListener("pause", T), r.addEventListener("stalled", v), r.addEventListener("waiting", C), r.addEventListener("seeking", k), r.addEventListener("seeked", P), r.addEventListener("abort", h), r.addEventListener("emptied", d), r.addEventListener("error", u), l.cleanup.push(
15378
15420
  () => r.removeEventListener("loadstart", p),
15379
15421
  () => r.removeEventListener("canplay", f),
15380
15422
  () => r.removeEventListener("playing", m),
15381
- () => r.removeEventListener("progress", v),
15423
+ () => r.removeEventListener("progress", S),
15382
15424
  () => r.removeEventListener("pause", T),
15383
- () => r.removeEventListener("stalled", S),
15425
+ () => r.removeEventListener("stalled", v),
15384
15426
  () => r.removeEventListener("waiting", C),
15385
15427
  () => r.removeEventListener("seeking", k),
15386
- () => r.removeEventListener("seeked", x),
15428
+ () => r.removeEventListener("seeked", P),
15387
15429
  () => r.removeEventListener("abort", h),
15388
15430
  () => r.removeEventListener("emptied", d),
15389
15431
  () => r.removeEventListener("error", u)
@@ -15437,7 +15479,7 @@ class xu {
15437
15479
  });
15438
15480
  }
15439
15481
  applySlotTarget(e, t) {
15440
- const i = ++e.applyToken, r = e.entry, n = xe(e.element) || null, a = r ? this.buildPreviewSourceCacheKey(r.clip) : null, o = t.entry ? this.buildPreviewSourceCacheKey(t.entry.clip) : null;
15482
+ const i = ++e.applyToken, r = e.entry, n = _e(e.element) || null, a = r ? this.buildPreviewSourceCacheKey(r.clip) : null, o = t.entry ? this.buildPreviewSourceCacheKey(t.entry.clip) : null;
15441
15483
  if (e.entry = t.entry, e.requestedPlayState = t.playState, e.isActive = t.role === "current" && !!t.entry, e.errorMessage = t.entry ? e.errorMessage : null, e.isBuffering = t.entry ? e.isBuffering : !1, e.isSeeking = t.entry ? e.isSeeking : !1, e.consecutiveStalledCount = t.entry ? e.consecutiveStalledCount : 0, !t.entry) {
15442
15484
  this.deferredPreloadSlotKeys.delete(this.getSlotKey(e)), (r || n) && this.emitDiagnostic("info", "playback", "slot.cleared", this.buildSlotTraceData(e, {
15443
15485
  message: "Preview slot cleared",
@@ -15626,7 +15668,7 @@ class xu {
15626
15668
  this.emitDiagnostic("debug", "resource", r, this.buildSlotTraceData(e, {
15627
15669
  message: n,
15628
15670
  desiredSourceUrl: o,
15629
- actualSourceUrl: xe(e.element) || null,
15671
+ actualSourceUrl: _e(e.element) || null,
15630
15672
  mediaState: ee(e.element),
15631
15673
  extra: {
15632
15674
  stableSourceUrl: t,
@@ -15668,7 +15710,7 @@ class xu {
15668
15710
  const i = Qd({
15669
15711
  desiredSource: t,
15670
15712
  configuredSource: Ji(e.element) || null,
15671
- assignedSource: xe(e.element) || null,
15713
+ assignedSource: _e(e.element) || null,
15672
15714
  forceRecover: e.forceRecover,
15673
15715
  isActive: e.isActive,
15674
15716
  isLoading: e.isLoading,
@@ -15769,7 +15811,7 @@ class xu {
15769
15811
  desiredSource: o,
15770
15812
  mediaState: ee(e.element)
15771
15813
  });
15772
- const c = xe(e.element), h = De(e.element, o), d = tu(c || null, t, e.retryCount);
15814
+ const c = _e(e.element), h = De(e.element, o), d = tu(c || null, t, e.retryCount);
15773
15815
  Le(e.element), e.expectedEmptiedEvents = d ? 2 : 1, e.stableSourceUrl = a.stableSourceUrl, e.hasReadyEventSinceSourceChange = !1, this.resetSlotPlaybackProgressProbe(e), this.rememberSlotObjectUrl(e, a.objectUrl), d && (e.element.removeAttribute("src"), Ye(e.element)), e.element.setAttribute("src", o), Ye(e.element), this.emitDiagnostic("info", "resource", "source.assigned", this.buildSlotTraceData(e, {
15774
15816
  message: "Preview source assigned",
15775
15817
  desiredSourceUrl: o,
@@ -15814,7 +15856,7 @@ class xu {
15814
15856
  }
15815
15857
  deferPreloadTarget(e, t, i, r) {
15816
15858
  const n = i.url;
15817
- e.desiredSource = n, this.rememberSlotObjectUrl(e, i.objectUrl), e.element.getAttribute("src") && e.element.getAttribute("src") !== n && (Le(e.element), e.element.removeAttribute("src"), Ye(e.element)), xe(e.element) || (e.hasReadyEventSinceSourceChange = !1), lu(e, !!xe(e.element)), this.deferredPreloadSlotKeys.add(this.getSlotKey(e)), this.emitDiagnostic("info", "recovery", "preload.recovery.deferred", this.buildSlotTraceData(e, {
15859
+ e.desiredSource = n, this.rememberSlotObjectUrl(e, i.objectUrl), e.element.getAttribute("src") && e.element.getAttribute("src") !== n && (Le(e.element), e.element.removeAttribute("src"), Ye(e.element)), _e(e.element) || (e.hasReadyEventSinceSourceChange = !1), lu(e, !!_e(e.element)), this.deferredPreloadSlotKeys.add(this.getSlotKey(e)), this.emitDiagnostic("info", "recovery", "preload.recovery.deferred", this.buildSlotTraceData(e, {
15818
15860
  message: "Deferred preload recovery until active current media settles",
15819
15861
  desiredSourceUrl: n,
15820
15862
  extra: {
@@ -16178,12 +16220,12 @@ class xu {
16178
16220
  e <= 0 || t <= 0 || (this.resolvedAutoAspectRatio = { width: e, height: t }, this.updateFrameLayout(), Zt(this.requestedAspectRatio.mode) && ((r = (i = this.callbacks).onAspectRatioChange) == null || r.call(i, this.getAspectRatio())));
16179
16221
  }
16180
16222
  refreshRuntimeState() {
16181
- var m, v, T, S, C, k, x, P;
16223
+ var m, S, T, v, C, k, P, x;
16182
16224
  const e = [];
16183
16225
  let t = null, i = !1, r = 0, n = 0, a = !1, o = !1, l = !1, c = !1;
16184
16226
  for (const { current: D, preload: w } of this.trackSlots.values())
16185
16227
  for (const A of [D, w]) {
16186
- const B = this.isTrackedActiveCurrentVideoSlot(A), $ = B ? this.evaluateTrackedCurrentVideoSlot(A) : null, F = xe(A.element) || null;
16228
+ const B = this.isTrackedActiveCurrentVideoSlot(A), z = B ? this.evaluateTrackedCurrentVideoSlot(A) : null, F = _e(A.element) || null;
16187
16229
  e.push({
16188
16230
  trackId: A.trackId,
16189
16231
  role: A.role,
@@ -16194,7 +16236,7 @@ class xu {
16194
16236
  phase: A.phase,
16195
16237
  retryCount: A.retryCount,
16196
16238
  errorMessage: A.errorMessage
16197
- }), A.phase !== "idle" && (i = !0), B && (r += 1, $ != null && $.failed && (n += 1, a = !0, t || (t = A.errorMessage || "资源加载异常,请刷新重试")), $ != null && $.resolving && (o = !0), $ != null && $.seeking && (l = !0), $ != null && $.mediaUnready && (c = !0));
16239
+ }), A.phase !== "idle" && (i = !0), B && (r += 1, z != null && z.failed && (n += 1, a = !0, t || (t = A.errorMessage || "资源加载异常,请刷新重试")), z != null && z.resolving && (o = !0), z != null && z.seeking && (l = !0), z != null && z.mediaUnready && (c = !0));
16198
16240
  }
16199
16241
  const h = this.buildPreviewLoadingState({
16200
16242
  trackedActiveCurrentVideoSlotCount: r,
@@ -16223,9 +16265,9 @@ class xu {
16223
16265
  loadingStatus: u.loading.status,
16224
16266
  loadingReason: u.loading.reason,
16225
16267
  isLoading: u.loading.isLoading,
16226
- clockStatus: ((v = u.clock) == null ? void 0 : v.status) ?? "unavailable",
16268
+ clockStatus: ((S = u.clock) == null ? void 0 : S.status) ?? "unavailable",
16227
16269
  clockReason: ((T = u.clock) == null ? void 0 : T.reason) ?? null,
16228
- clockTimelineTime: ((S = u.clock) == null ? void 0 : S.timelineTime) ?? null
16270
+ clockTimelineTime: ((v = u.clock) == null ? void 0 : v.timelineTime) ?? null
16229
16271
  },
16230
16272
  extra: {
16231
16273
  previousPhase: p.phase,
@@ -16242,7 +16284,7 @@ class xu {
16242
16284
  actualSource: D.actualSource
16243
16285
  }))
16244
16286
  }
16245
- }), (k = (C = this.callbacks).onRuntimeStateChange) == null || k.call(C, u)), (h.status === "ready" || h.status === "failed" || h.status === "idle") && u.syncRequestId !== void 0 && this.lastSettledSyncRequestId !== u.syncRequestId && (this.lastSettledSyncRequestId = u.syncRequestId, (P = (x = this.callbacks).onSyncProcessed) == null || P.call(x, u.syncRequestId)), h.status !== "loading" && this.deferredPreloadSlotKeys.size > 0 && this.scheduleDeferredPreloadFlush(), this.syncLoadingProbe(h), this.syncClockProbe(u.clock), this.refreshPendingOverlay();
16287
+ }), (k = (C = this.callbacks).onRuntimeStateChange) == null || k.call(C, u)), (h.status === "ready" || h.status === "failed" || h.status === "idle") && u.syncRequestId !== void 0 && this.lastSettledSyncRequestId !== u.syncRequestId && (this.lastSettledSyncRequestId = u.syncRequestId, (x = (P = this.callbacks).onSyncProcessed) == null || x.call(P, u.syncRequestId)), h.status !== "loading" && this.deferredPreloadSlotKeys.size > 0 && this.scheduleDeferredPreloadFlush(), this.syncLoadingProbe(h), this.syncClockProbe(u.clock), this.refreshPendingOverlay();
16246
16288
  }
16247
16289
  buildPreviewClockState(e) {
16248
16290
  const t = this.getPreviewClockSourceSlot();
@@ -16416,7 +16458,7 @@ class xu {
16416
16458
  doesSlotSourceMatchDesired(e, t) {
16417
16459
  return Jd(
16418
16460
  Ji(e.element) || null,
16419
- xe(e.element) || null,
16461
+ _e(e.element) || null,
16420
16462
  t
16421
16463
  );
16422
16464
  }
@@ -16740,7 +16782,7 @@ class xu {
16740
16782
  }
16741
16783
  getEffectiveVisualTransform(e) {
16742
16784
  var t;
16743
- return ((t = this.transientVisualTransform) == null ? void 0 : t.clipId) === e.clip.id ? this.transientVisualTransform.transform : we(e.clip.visualTransform);
16785
+ return ((t = this.transientVisualTransform) == null ? void 0 : t.clipId) === e.clip.id ? this.transientVisualTransform.transform : Pe(e.clip.visualTransform);
16744
16786
  }
16745
16787
  }
16746
16788
  class _u extends xu {
@@ -17096,7 +17138,7 @@ function Hu(s) {
17096
17138
  const t = e.toLowerCase();
17097
17139
  return t === "space" || t === "spacebar" ? "Space" : t === "delete" ? "Delete" : t === "backspace" ? "Backspace" : /^[a-z]$/i.test(e) ? `Key${e.toUpperCase()}` : /^key[a-z]$/i.test(e) ? `Key${e.slice(-1).toUpperCase()}` : /^[0-9]$/.test(e) ? `Digit${e}` : /^digit[0-9]$/i.test(e) ? `Digit${e.slice(-1)}` : null;
17098
17140
  }
17099
- function $u(s, e, t) {
17141
+ function zu(s, e, t) {
17100
17142
  const i = e.split("+").map((c) => c.trim()).filter((c) => c.length > 0);
17101
17143
  if (i.length === 0)
17102
17144
  return null;
@@ -17138,7 +17180,7 @@ function $u(s, e, t) {
17138
17180
  shiftKey: l
17139
17181
  } : null;
17140
17182
  }
17141
- function zu(s) {
17183
+ function $u(s) {
17142
17184
  if (!(s instanceof HTMLElement))
17143
17185
  return !1;
17144
17186
  if (s.isContentEditable)
@@ -17153,7 +17195,7 @@ function Uu(s, e) {
17153
17195
  return s === !1 || (s == null ? void 0 : s.enabled) === !1 ? [] : Fu.flatMap((t) => {
17154
17196
  var n;
17155
17197
  const i = (n = s == null ? void 0 : s.bindings) == null ? void 0 : n[t];
17156
- return (i === void 0 ? Nu[t] : Array.isArray(i) ? i : [i]).map((a) => $u(t, a, e)).filter((a) => a !== null);
17198
+ return (i === void 0 ? Nu[t] : Array.isArray(i) ? i : [i]).map((a) => zu(t, a, e)).filter((a) => a !== null);
17157
17199
  });
17158
17200
  }
17159
17201
  class Wu {
@@ -17177,7 +17219,7 @@ class Wu {
17177
17219
  (t = (e = globalThis.window) == null ? void 0 : e.removeEventListener) == null || t.call(e, "keydown", this.keydownListener);
17178
17220
  }
17179
17221
  handleKeydown(e) {
17180
- if (zu(e.target))
17222
+ if ($u(e.target))
17181
17223
  return;
17182
17224
  const t = this.bindings.find((i) => Vu(e, i));
17183
17225
  t && (e.preventDefault(), e.stopPropagation(), this.dispatchAction(t.action));
@@ -17324,6 +17366,9 @@ class qu {
17324
17366
  this.updateClip(e, t);
17325
17367
  },
17326
17368
  moveClipToTrack: (e, t) => this.moveClipToTrack(e, t),
17369
+ setPrimaryTrackMagnetEnabled: (e) => {
17370
+ this.options.setPrimaryTrackMagnetEnabled(e);
17371
+ },
17327
17372
  ensureTrackFromHistorySnapshot: (e, t) => this.ensureTrackFromHistorySnapshot(e, t),
17328
17373
  removeClipGaps: () => {
17329
17374
  this.removeClipGaps();
@@ -17455,18 +17500,18 @@ class Ju {
17455
17500
  }
17456
17501
  convertTheme(e) {
17457
17502
  return {
17458
- backgroundColor: me.backgroundColor,
17459
- borderColor: e.border || me.borderColor,
17460
- textColor: e.clipName || me.textColor,
17461
- labelColor: e.timeText || me.labelColor,
17462
- inputBackground: e.trackBackground || me.inputBackground,
17463
- inputBorder: e.trackBorder || me.inputBorder,
17464
- inputFocusBorder: me.inputFocusBorder,
17465
- buttonBackground: e.clipBackground || me.buttonBackground,
17466
- buttonBorder: e.clipBorder || me.buttonBorder,
17467
- buttonActiveBackground: me.buttonActiveBackground,
17468
- buttonActiveBorder: e.clipSelectedBorder || me.buttonActiveBorder,
17469
- buttonActiveText: me.buttonActiveText
17503
+ backgroundColor: ye.backgroundColor,
17504
+ borderColor: e.border || ye.borderColor,
17505
+ textColor: e.clipName || ye.textColor,
17506
+ labelColor: e.timeText || ye.labelColor,
17507
+ inputBackground: e.trackBackground || ye.inputBackground,
17508
+ inputBorder: e.trackBorder || ye.inputBorder,
17509
+ inputFocusBorder: ye.inputFocusBorder,
17510
+ buttonBackground: e.clipBackground || ye.buttonBackground,
17511
+ buttonBorder: e.clipBorder || ye.buttonBorder,
17512
+ buttonActiveBackground: ye.buttonActiveBackground,
17513
+ buttonActiveBorder: e.clipSelectedBorder || ye.buttonActiveBorder,
17514
+ buttonActiveText: ye.buttonActiveText
17470
17515
  };
17471
17516
  }
17472
17517
  }
@@ -17476,17 +17521,17 @@ class Qu {
17476
17521
  }
17477
17522
  init(e) {
17478
17523
  var i, r, n, a;
17479
- const t = ((i = e.theme) == null ? void 0 : i.background) || be.background;
17524
+ const t = ((i = e.theme) == null ? void 0 : i.background) || ke.background;
17480
17525
  this.panel = new vd(
17481
17526
  {
17482
17527
  container: e.container,
17483
17528
  theme: {
17484
17529
  background: t,
17485
- border: ((r = e.theme) == null ? void 0 : r.border) || be.border,
17486
- text: ((n = e.theme) == null ? void 0 : n.clipName) || be.text,
17487
- buttonBackground: ((a = e.theme) == null ? void 0 : a.clipBackground) || be.buttonBackground,
17488
- buttonHover: be.buttonHover,
17489
- buttonDanger: be.buttonDanger
17530
+ border: ((r = e.theme) == null ? void 0 : r.border) || ke.border,
17531
+ text: ((n = e.theme) == null ? void 0 : n.clipName) || ke.text,
17532
+ buttonBackground: ((a = e.theme) == null ? void 0 : a.clipBackground) || ke.buttonBackground,
17533
+ buttonHover: ke.buttonHover,
17534
+ buttonDanger: ke.buttonDanger
17490
17535
  },
17491
17536
  width: fi,
17492
17537
  timeScaleHeight: e.timeScaleHeight || 40,
@@ -17550,12 +17595,12 @@ const ep = 100 * 1024 * 1024, tp = 10 * 1024 * 1024 * 1024, ip = 30 * 24 * 60 *
17550
17595
  preferStorage: "opfs",
17551
17596
  resolveMode: "prefer-fast-start",
17552
17597
  allowedMimeTypes: rp
17553
- }, np = "timeline-preview-resource-cache", sp = 1, ye = "metadata";
17598
+ }, np = "timeline-preview-resource-cache", sp = 1, Se = "metadata";
17554
17599
  function ap() {
17555
17600
  return new Promise((s, e) => {
17556
17601
  const t = indexedDB.open(np, sp);
17557
17602
  t.onupgradeneeded = () => {
17558
- const i = t.result, r = i.objectStoreNames.contains(ye) ? t.transaction.objectStore(ye) : i.createObjectStore(ye, { keyPath: "cacheKey" });
17603
+ const i = t.result, r = i.objectStoreNames.contains(Se) ? t.transaction.objectStore(Se) : i.createObjectStore(Se, { keyPath: "cacheKey" });
17559
17604
  r.indexNames.contains("sourceUrl") || r.createIndex("sourceUrl", "sourceUrl"), r.indexNames.contains("expiresAt") || r.createIndex("expiresAt", "expiresAt"), r.indexNames.contains("lastAccessedAt") || r.createIndex("lastAccessedAt", "lastAccessedAt"), r.indexNames.contains("storageKind") || r.createIndex("storageKind", "storageKind");
17560
17605
  }, t.onerror = () => e(t.error), t.onsuccess = () => s(t.result);
17561
17606
  });
@@ -17577,26 +17622,26 @@ class op {
17577
17622
  async get(e) {
17578
17623
  const t = await this.getDb();
17579
17624
  return new Promise((i, r) => {
17580
- const n = t.transaction(ye, "readonly").objectStore(ye).get(e);
17625
+ const n = t.transaction(Se, "readonly").objectStore(Se).get(e);
17581
17626
  n.onerror = () => r(n.error), n.onsuccess = () => i(n.result ?? null);
17582
17627
  });
17583
17628
  }
17584
17629
  async put(e) {
17585
- const i = (await this.getDb()).transaction(ye, "readwrite");
17586
- i.objectStore(ye).put(e), await _r(i);
17630
+ const i = (await this.getDb()).transaction(Se, "readwrite");
17631
+ i.objectStore(Se).put(e), await _r(i);
17587
17632
  }
17588
17633
  async delete(e) {
17589
- const i = (await this.getDb()).transaction(ye, "readwrite");
17590
- i.objectStore(ye).delete(e), await _r(i);
17634
+ const i = (await this.getDb()).transaction(Se, "readwrite");
17635
+ i.objectStore(Se).delete(e), await _r(i);
17591
17636
  }
17592
17637
  async clear() {
17593
- const t = (await this.getDb()).transaction(ye, "readwrite");
17594
- t.objectStore(ye).clear(), await _r(t);
17638
+ const t = (await this.getDb()).transaction(Se, "readwrite");
17639
+ t.objectStore(Se).clear(), await _r(t);
17595
17640
  }
17596
17641
  async list() {
17597
17642
  const e = await this.getDb();
17598
17643
  return new Promise((t, i) => {
17599
- const r = e.transaction(ye, "readonly").objectStore(ye).getAll();
17644
+ const r = e.transaction(Se, "readonly").objectStore(Se).getAll();
17600
17645
  r.onerror = () => i(r.error), r.onsuccess = () => t(r.result);
17601
17646
  });
17602
17647
  }
@@ -17782,7 +17827,7 @@ function Tp(s) {
17782
17827
  const t = Number(e[1]);
17783
17828
  return Number.isSafeInteger(t) && t >= 0 ? t : null;
17784
17829
  }
17785
- function $s(s, e, t) {
17830
+ function zs(s, e, t) {
17786
17831
  return {
17787
17832
  url: e,
17788
17833
  ok: s.ok,
@@ -17800,7 +17845,7 @@ class bp {
17800
17845
  try {
17801
17846
  const n = await fetch(e, { method: "HEAD" }), a = Hs(n.headers.get("content-length"));
17802
17847
  if (n.ok && a !== null)
17803
- return $s(n, e, a);
17848
+ return zs(n, e, a);
17804
17849
  } catch {
17805
17850
  }
17806
17851
  const t = await fetch(e, {
@@ -17813,7 +17858,7 @@ class bp {
17813
17858
  await ((r = t.body) == null ? void 0 : r.cancel());
17814
17859
  } catch {
17815
17860
  }
17816
- return $s(t, e, i);
17861
+ return zs(t, e, i);
17817
17862
  }
17818
17863
  async download(e) {
17819
17864
  const t = await fetch(e);
@@ -18111,7 +18156,7 @@ class Er {
18111
18156
  });
18112
18157
  }
18113
18158
  }
18114
- class zs {
18159
+ class $s {
18115
18160
  constructor(e, t = Kr) {
18116
18161
  this.handlers = e, this.TrackCtor = t;
18117
18162
  }
@@ -18132,6 +18177,7 @@ class zs {
18132
18177
  this.handlers.onTimeJump,
18133
18178
  this.handlers.onHorizontalDragAutoScroll,
18134
18179
  this.handlers.onClipOverlap,
18180
+ this.handlers.onPrimaryTrackMagnetMove,
18135
18181
  this.handlers.onClipCrossTrackPreview,
18136
18182
  this.handlers.onClipCrossTrack,
18137
18183
  this.handlers.onClearDropPreview,
@@ -18674,11 +18720,11 @@ class Mp {
18674
18720
  return this.scrollLeft;
18675
18721
  }
18676
18722
  scrollToTime(e) {
18677
- const t = Y.timeToPixels(e, this.config.zoom), i = this.stage.width();
18723
+ const t = U.timeToPixels(e, this.config.zoom), i = this.stage.width();
18678
18724
  this.setScrollLeft(Math.max(0, t - i / 2));
18679
18725
  }
18680
18726
  scrollToClip(e) {
18681
- const t = Y.timeToPixels(e.startTime, this.config.zoom), r = Y.timeToPixels(e.startTime + e.duration, this.config.zoom) - t, n = this.stage.width(), a = r <= n ? Math.max(0, t - (n - r) / 2) : Math.max(0, t);
18727
+ const t = U.timeToPixels(e.startTime, this.config.zoom), r = U.timeToPixels(e.startTime + e.duration, this.config.zoom) - t, n = this.stage.width(), a = r <= n ? Math.max(0, t - (n - r) / 2) : Math.max(0, t);
18682
18728
  this.setScrollLeft(a);
18683
18729
  }
18684
18730
  resize(e) {
@@ -18730,10 +18776,10 @@ class Mp {
18730
18776
  this.dragStartX = e.clientX, this.scrollLeft = i, this.render(), r !== this.scrollLeft && this.onScrollChange(this.scrollLeft);
18731
18777
  }
18732
18778
  pixelToTime(e) {
18733
- return Y.pixelsToTime(e - _e + this.scrollLeft, this.config.zoom);
18779
+ return U.pixelsToTime(e - fe + this.scrollLeft, this.config.zoom);
18734
18780
  }
18735
18781
  timeToPixel(e) {
18736
- return Y.timeToPixels(e, this.config.zoom) - this.scrollLeft + _e;
18782
+ return U.timeToPixels(e, this.config.zoom) - this.scrollLeft + fe;
18737
18783
  }
18738
18784
  render() {
18739
18785
  const e = this.stage.width(), t = this.stage.height(), i = this.layer.findOne(".timeline-header-background");
@@ -18746,7 +18792,7 @@ class Mp {
18746
18792
  this.layer.find(".time-tick-line").forEach((r) => r.remove()), this.layer.find(".time-tick-text").forEach((r) => r.remove()), this.renderTimeTicks(), this.layer.batchDraw();
18747
18793
  }
18748
18794
  renderTimeTicks() {
18749
- const e = this.stage.width(), t = this.scrollLeft, i = this.scrollLeft + e, r = Y.pixelsToTime(t, this.config.zoom), n = Y.pixelsToTime(i, this.config.zoom), a = Y.msToSeconds(r), o = Y.msToSeconds(n), { majorStep: l, minorStep: c } = Y.getTickConfig(this.config.zoom), h = Y.generateVisibleTicks(a - 10, o + 10, l, c);
18795
+ const e = this.stage.width(), t = this.scrollLeft, i = this.scrollLeft + e, r = U.pixelsToTime(t, this.config.zoom), n = U.pixelsToTime(i, this.config.zoom), a = U.msToSeconds(r), o = U.msToSeconds(n), { majorStep: l, minorStep: c } = U.getTickConfig(this.config.zoom), h = U.generateVisibleTicks(a - 10, o + 10, l, c);
18750
18796
  for (const d of h) {
18751
18797
  const u = this.timeToPixel(d.time);
18752
18798
  u >= -20 && u <= e + 20 && de.drawTimeTick(
@@ -18765,7 +18811,7 @@ class Mp {
18765
18811
  }
18766
18812
  }
18767
18813
  clampScrollLeft(e) {
18768
- const t = Math.max(0, Y.timeToPixels(this.config.duration, this.config.zoom) - this.stage.width());
18814
+ const t = Math.max(0, U.timeToPixels(this.config.duration, this.config.zoom) - this.stage.width());
18769
18815
  return Math.max(0, Math.min(t, e));
18770
18816
  }
18771
18817
  }
@@ -18850,7 +18896,7 @@ const q = class q {
18850
18896
  }), this.hasBoundGlobalPointerListeners = !1);
18851
18897
  }
18852
18898
  updateTimeFromClientX(e) {
18853
- const t = this.container.getBoundingClientRect(), i = e - t.left, r = Y.pixelsToTime(i - _e + this.scrollLeft, this.zoom);
18899
+ const t = this.container.getBoundingClientRect(), i = e - t.left, r = U.pixelsToTime(i - fe + this.scrollLeft, this.zoom);
18854
18900
  this.onTimeChange(Math.max(0, r), "scrub");
18855
18901
  }
18856
18902
  updateEdgeAutoScrollState(e) {
@@ -18888,7 +18934,7 @@ const q = class q {
18888
18934
  this.edgeAutoScrollAnimationFrameId !== null && (typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.edgeAutoScrollAnimationFrameId), this.edgeAutoScrollAnimationFrameId = null);
18889
18935
  }
18890
18936
  render() {
18891
- const e = Y.timeToPixels(this.currentTime, this.zoom) - this.scrollLeft + _e, t = e >= 0 && e <= this.container.clientWidth, i = Math.max(q.HANDLE_HEIGHT + q.END_CAP_HEIGHT, this.height);
18937
+ const e = U.timeToPixels(this.currentTime, this.zoom) - this.scrollLeft + fe, t = e >= 0 && e <= this.container.clientWidth, i = Math.max(q.HANDLE_HEIGHT + q.END_CAP_HEIGHT, this.height);
18892
18938
  this.visualElement.style.display = t ? "block" : "none", this.lineHitAreaElement.style.display = t ? "block" : "none", this.visualElement.style.left = `${e}px`, this.visualElement.style.height = `${i}px`, this.visualElement.setAttribute("height", `${i}`), this.visualElement.setAttribute("viewBox", `0 0 ${q.VISUAL_WIDTH} ${i}`), this.lineHitAreaElement.style.left = `${e}px`, this.lineHitAreaElement.style.height = `${i}px`, this.renderVisual(i);
18893
18939
  }
18894
18940
  renderVisual(e) {
@@ -19071,6 +19117,31 @@ class Us {
19071
19117
  return this.scrollOffset / i * r;
19072
19118
  }
19073
19119
  }
19120
+ const Dp = 48;
19121
+ function Lp(s, e, t) {
19122
+ return U.timeToPixels(s, e) - t + fe;
19123
+ }
19124
+ function Bp(s, e, t) {
19125
+ const i = Math.max(0, t - e);
19126
+ return Math.max(0, Math.min(i, s));
19127
+ }
19128
+ function Op(s) {
19129
+ const {
19130
+ time: e,
19131
+ zoom: t,
19132
+ scrollLeft: i,
19133
+ viewportWidth: r,
19134
+ contentWidth: n,
19135
+ margin: a = Dp
19136
+ } = s;
19137
+ if (r <= 0 || Math.max(0, n - r) <= 0)
19138
+ return null;
19139
+ const l = Lp(e, t, i), c = r - a;
19140
+ if (l >= a && l <= c)
19141
+ return null;
19142
+ const h = U.timeToPixels(e, t), d = l < a ? h + fe - a : h + fe - c, u = Bp(d, r, n);
19143
+ return Math.abs(u - i) <= 0.5 ? null : u;
19144
+ }
19074
19145
  class Ws {
19075
19146
  constructor() {
19076
19147
  g(this, "entries", /* @__PURE__ */ new Map());
@@ -19088,20 +19159,20 @@ class Ws {
19088
19159
  this.entries.clear();
19089
19160
  }
19090
19161
  }
19091
- const Dp = "@linker-design-plus/timeline-track", Lp = "2.1.2", Ut = {
19092
- name: Dp,
19093
- version: Lp
19094
- }, Bp = 1, Op = 2, Fp = 250, Np = 750, Gp = 1500;
19162
+ const Fp = "@linker-design-plus/timeline-track", Np = "2.1.3", Ut = {
19163
+ name: Fp,
19164
+ version: Np
19165
+ }, Gp = 1, Hp = 2, zp = 250, $p = 750, Vp = 1500;
19095
19166
  function Ys(s) {
19096
19167
  return s == null ? s : JSON.parse(JSON.stringify(s));
19097
19168
  }
19098
- function Hp(s, e) {
19169
+ function Up(s, e) {
19099
19170
  return s.length !== e.length ? !1 : s.every((t, i) => t === e[i]);
19100
19171
  }
19101
- function $p(s) {
19172
+ function Wp(s) {
19102
19173
  return s === "text" ? "文本" : s === "video" ? "视频" : "音频";
19103
19174
  }
19104
- class Kp {
19175
+ class eg {
19105
19176
  constructor(e = {}) {
19106
19177
  g(this, "timeline", null);
19107
19178
  g(this, "tracks", []);
@@ -19210,6 +19281,8 @@ class Kp {
19210
19281
  g(this, "activeStructureSession", null);
19211
19282
  g(this, "structureSessionDepth", 0);
19212
19283
  g(this, "preserveEmptyTracksDepth", 0);
19284
+ g(this, "playbackViewportFollowSuspended", !1);
19285
+ g(this, "isProgrammaticScrollChange", !1);
19213
19286
  this.config = {
19214
19287
  duration: e.duration || Bi,
19215
19288
  zoom: e.zoom || Fe.MEDIUM,
@@ -19222,13 +19295,15 @@ class Kp {
19222
19295
  speed: e.speed || 1,
19223
19296
  dragActivationThreshold: e.dragActivationThreshold ?? 4,
19224
19297
  enableClipSnap: e.enableClipSnap ?? !1,
19298
+ enablePrimaryTrackMagnet: e.enablePrimaryTrackMagnet ?? !0,
19225
19299
  clipSnapThreshold: e.clipSnapThreshold ?? 8,
19226
19300
  thumbnailProvider: e.thumbnailProvider,
19227
19301
  previewBackend: e.previewBackend ?? "dom",
19228
19302
  previewSourceResolver: e.previewSourceResolver,
19229
19303
  resourceCache: e.resourceCache,
19230
19304
  textPreviewFont: e.textPreviewFont ?? null,
19231
- keyboardShortcuts: e.keyboardShortcuts
19305
+ keyboardShortcuts: e.keyboardShortcuts,
19306
+ playbackViewportFollow: e.playbackViewportFollow ?? !0
19232
19307
  }, this.diagnostics = new nh(this.config.diagnostics), this.resourceCacheManager = this.config.resourceCache ? new Pp({
19233
19308
  options: this.config.resourceCache,
19234
19309
  onEvent: (t, i) => {
@@ -19268,7 +19343,7 @@ class Kp {
19268
19343
  speed: this.config.speed || 1,
19269
19344
  zoom: this.config.zoom,
19270
19345
  duration: this.config.duration
19271
- }), this.timelineCommands = new Ts(this.timelineStore), this.timelinePresentationAdapter = new Fs(), this.timelineTrackBridge = new zs({
19346
+ }), this.timelineCommands = new Ts(this.timelineStore), this.timelinePresentationAdapter = new Fs(), this.timelineTrackBridge = new $s({
19272
19347
  onClipUpdate: (t, i, r) => this.handleClipUpdate(t, i, r),
19273
19348
  onClipAdd: this.handleClipAdd.bind(this),
19274
19349
  onClipRemove: this.handleClipRemove.bind(this),
@@ -19277,6 +19352,7 @@ class Kp {
19277
19352
  onTimeJump: this.handleTimeChange.bind(this),
19278
19353
  onHorizontalDragAutoScroll: this.handleHorizontalDragAutoScroll.bind(this),
19279
19354
  onClipOverlap: this.handleClipOverlap.bind(this),
19355
+ onPrimaryTrackMagnetMove: this.handlePrimaryTrackMagnetMove.bind(this),
19280
19356
  onClipCrossTrackPreview: this.handleClipCrossTrackPreview.bind(this),
19281
19357
  onClipCrossTrack: this.handleClipCrossTrack.bind(this),
19282
19358
  onClearDropPreview: this.clearAllTrackDropPreviews.bind(this),
@@ -19347,7 +19423,7 @@ class Kp {
19347
19423
  return this.timelinePresentationAdapter || (this.timelinePresentationAdapter = new Fs()), this.timelinePresentationAdapter;
19348
19424
  }
19349
19425
  getTimelineTrackBridge() {
19350
- return this.timelineTrackBridge || (this.timelineTrackBridge = new zs({
19426
+ return this.timelineTrackBridge || (this.timelineTrackBridge = new $s({
19351
19427
  onClipUpdate: (e, t, i) => this.handleClipUpdate(e, t, i),
19352
19428
  onClipAdd: this.handleClipAdd.bind(this),
19353
19429
  onClipRemove: this.handleClipRemove.bind(this),
@@ -19356,6 +19432,7 @@ class Kp {
19356
19432
  onTimeJump: this.handleTimeChange.bind(this),
19357
19433
  onHorizontalDragAutoScroll: this.handleHorizontalDragAutoScroll.bind(this),
19358
19434
  onClipOverlap: this.handleClipOverlap.bind(this),
19435
+ onPrimaryTrackMagnetMove: this.handlePrimaryTrackMagnetMove.bind(this),
19359
19436
  onClipCrossTrackPreview: this.handleClipCrossTrackPreview.bind(this),
19360
19437
  onClipCrossTrack: this.handleClipCrossTrack.bind(this),
19361
19438
  onClearDropPreview: this.clearAllTrackDropPreviews.bind(this),
@@ -19514,6 +19591,7 @@ class Kp {
19514
19591
  trackCollection: this.getTrackCollection(),
19515
19592
  ensureTrackFromHistorySnapshot: this.ensureTrackFromHistorySnapshot.bind(this),
19516
19593
  removeClipGaps: this.removeClipGaps.bind(this),
19594
+ setPrimaryTrackMagnetEnabled: this.setPrimaryTrackMagnetEnabledFromHistory.bind(this),
19517
19595
  loadClipThumbnails: this.loadClipThumbnails.bind(this),
19518
19596
  addClipToTrack: (n, a) => this.getTrackCollection().addClipToTrack(n, a),
19519
19597
  removeClip: (n) => {
@@ -19653,11 +19731,46 @@ class Kp {
19653
19731
  speed: 1,
19654
19732
  dragActivationThreshold: 4,
19655
19733
  enableClipSnap: !1,
19734
+ enablePrimaryTrackMagnet: !0,
19656
19735
  clipSnapThreshold: 8,
19657
19736
  previewBackend: "dom",
19658
- textPreviewFont: null
19737
+ textPreviewFont: null,
19738
+ playbackViewportFollow: !0
19659
19739
  }), this.config;
19660
19740
  }
19741
+ isPlaybackViewportFollowEnabled() {
19742
+ return this.ensureConfigState().playbackViewportFollow !== !1;
19743
+ }
19744
+ suspendPlaybackViewportFollowIfUserScrolling() {
19745
+ this.getPlayStateState() === "playing" && !this.isProgrammaticScrollChange && (this.playbackViewportFollowSuspended = !0);
19746
+ }
19747
+ runProgrammaticScrollChange(e) {
19748
+ this.isProgrammaticScrollChange = !0;
19749
+ try {
19750
+ e();
19751
+ } finally {
19752
+ this.isProgrammaticScrollChange = !1;
19753
+ }
19754
+ }
19755
+ followPlaybackViewportIfNeeded(e) {
19756
+ if (!this.isPlaybackViewportFollowEnabled() || this.getPlayStateState() !== "playing" || this.playbackViewportFollowSuspended)
19757
+ return;
19758
+ const t = this.getViewportWidth(), i = this.getZoomState(), r = this.getScrollLeftState(), n = this.getHorizontalContentWidth(), a = Op({
19759
+ time: e,
19760
+ zoom: i,
19761
+ scrollLeft: r,
19762
+ viewportWidth: t,
19763
+ contentWidth: n
19764
+ });
19765
+ if (a !== null) {
19766
+ this.isProgrammaticScrollChange = !0;
19767
+ try {
19768
+ this.syncScrollLeft(a);
19769
+ } finally {
19770
+ this.isProgrammaticScrollChange = !1;
19771
+ }
19772
+ }
19773
+ }
19661
19774
  getCurrentTimeState() {
19662
19775
  return this.getTimelineStore().getCurrentTime();
19663
19776
  }
@@ -19738,7 +19851,7 @@ class Kp {
19738
19851
  return ((e = this.layout) == null ? void 0 : e.bodyViewport.clientHeight) || 0;
19739
19852
  }
19740
19853
  getHorizontalContentWidth() {
19741
- return Y.timeToPixels(this.getDurationState(), this.getZoomState());
19854
+ return U.timeToPixels(this.getDurationState(), this.getZoomState());
19742
19855
  }
19743
19856
  getVerticalContentHeight() {
19744
19857
  return Math.max(this.calculateTotalHeight(), this.getViewportHeight());
@@ -19881,7 +19994,7 @@ class Kp {
19881
19994
  });
19882
19995
  }
19883
19996
  shouldSkipSteadyPlaybackPreviewSync(e, t, i) {
19884
- return t !== "playing" || i !== "steady" || this.pendingPreviewState || this.getPreviewLoadingState().isLoading || this.lastPreviewSyncedPlayState !== "playing" || this.lastPreviewSyncSignature !== e ? !1 : Date.now() - this.lastSteadyPlaybackPreviewSyncAt < Fp;
19997
+ return t !== "playing" || i !== "steady" || this.pendingPreviewState || this.getPreviewLoadingState().isLoading || this.lastPreviewSyncedPlayState !== "playing" || this.lastPreviewSyncSignature !== e ? !1 : Date.now() - this.lastSteadyPlaybackPreviewSyncAt < zp;
19885
19998
  }
19886
19999
  syncPreviewSession(e) {
19887
20000
  var d, u, p, f;
@@ -19957,7 +20070,7 @@ class Kp {
19957
20070
  return e.status !== "unavailable" || e.timelineTime === null ? !1 : this.isPreviewClockForCurrentActiveClip(e);
19958
20071
  }
19959
20072
  shouldIgnorePreviewClockUntilSeekTargetAligned(e) {
19960
- return this.previewClockSeekAlignmentTargetTime == null || e.timelineTime === null ? !1 : Date.now() > this.previewClockSeekAlignmentDeadlineMs ? (this.previewClockSeekAlignmentTargetTime = null, this.previewClockSeekAlignmentDeadlineMs = 0, !1) : Math.abs(e.timelineTime - this.previewClockSeekAlignmentTargetTime) <= Np ? (this.previewClockSeekAlignmentTargetTime = null, this.previewClockSeekAlignmentDeadlineMs = 0, !1) : !0;
20073
+ return this.previewClockSeekAlignmentTargetTime == null || e.timelineTime === null ? !1 : Date.now() > this.previewClockSeekAlignmentDeadlineMs ? (this.previewClockSeekAlignmentTargetTime = null, this.previewClockSeekAlignmentDeadlineMs = 0, !1) : Math.abs(e.timelineTime - this.previewClockSeekAlignmentTargetTime) <= $p ? (this.previewClockSeekAlignmentTargetTime = null, this.previewClockSeekAlignmentDeadlineMs = 0, !1) : !0;
19961
20074
  }
19962
20075
  commitPlaybackTimeFromPreviewClock(e) {
19963
20076
  if (e.timelineTime === null)
@@ -19968,13 +20081,13 @@ class Kp {
19968
20081
  return;
19969
20082
  }
19970
20083
  const r = i.nextValue;
19971
- this.ensureConfigState().currentTime = r, this.syncCurrentTimeToScene(r), this.emitEvent("time_change", { time: r }), this.emitSelectionChangeEvent(), this.updateCanPlayState(), this.syncPreviewAfterPreviewClockCommitIfNeeded(r, e);
20084
+ this.ensureConfigState().currentTime = r, this.syncCurrentTimeToScene(r), this.followPlaybackViewportIfNeeded(r), this.emitEvent("time_change", { time: r }), this.emitSelectionChangeEvent(), this.updateCanPlayState(), this.syncPreviewAfterPreviewClockCommitIfNeeded(r, e);
19972
20085
  }
19973
20086
  syncPreviewAfterPreviewClockCommitIfNeeded(e, t) {
19974
20087
  if (this.getPlayStateState() !== "playing" || this.pendingPreviewState)
19975
20088
  return;
19976
20089
  const i = this.buildPlaybackPlan(e), r = i.activeClips.map((n) => n.clip.id);
19977
- if (!Hp(r, this.previewActiveClipIds)) {
20090
+ if (!Up(r, this.previewActiveClipIds)) {
19978
20091
  this.syncPreviewSession(), this.resumeWallClockPlaybackIfPreviewClockUnavailable(e, i);
19979
20092
  return;
19980
20093
  }
@@ -20102,7 +20215,7 @@ class Kp {
20102
20215
  container: this.layout.horizontalScrollbarCanvasHost,
20103
20216
  orientation: "horizontal",
20104
20217
  theme: this.config.theme,
20105
- leadingInset: _e,
20218
+ leadingInset: fe,
20106
20219
  onScrollChange: this.handleScrollChange.bind(this)
20107
20220
  }), this.verticalScrollbar = new Us({
20108
20221
  container: this.layout.verticalScrollbarCanvasHost,
@@ -20320,7 +20433,7 @@ class Kp {
20320
20433
  }), this.bodyBackgroundRect = r, this.backgroundLayer.add(r), i && this.backgroundLayer.batchDraw();
20321
20434
  }
20322
20435
  handleBodyBackgroundClick(e) {
20323
- const t = Y.pixelsToTime(e - _e + this.getScrollLeftState(), this.getZoomState());
20436
+ const t = U.pixelsToTime(e - fe + this.getScrollLeftState(), this.getZoomState());
20324
20437
  this.handleTimeChange(Math.max(0, t));
20325
20438
  }
20326
20439
  handleBodyCanvasHostClick(e) {
@@ -20394,9 +20507,9 @@ class Kp {
20394
20507
  normalizeWheelDelta(e, t, i) {
20395
20508
  if (!Number.isFinite(e) || e === 0)
20396
20509
  return 0;
20397
- if (t === Bp)
20510
+ if (t === Gp)
20398
20511
  return e * 16;
20399
- if (t === Op) {
20512
+ if (t === Hp) {
20400
20513
  const r = i === "x" ? this.getViewportWidth() : this.getViewportHeight();
20401
20514
  return e * (r || 1);
20402
20515
  }
@@ -20449,7 +20562,7 @@ class Kp {
20449
20562
  return;
20450
20563
  }
20451
20564
  }
20452
- this.refreshPlaybackAttempt("play"), this.setPlayStateState("playing"), this.lastUpdateTime = Date.now();
20565
+ this.refreshPlaybackAttempt("play"), this.playbackViewportFollowSuspended = !1, this.setPlayStateState("playing"), this.followPlaybackViewportIfNeeded(this.getCurrentTimeState()), this.lastUpdateTime = Date.now();
20453
20566
  const e = this.shouldUsePreviewClockPlayback();
20454
20567
  e ? (this.previewPlaybackSuspendedByBuffering = !1, this.previewPlaybackAutoResume = !1, this.cancelPlaybackAnimationFrame()) : this.getPreviewLoadingState().isLoading ? (this.previewPlaybackSuspendedByBuffering = !0, this.previewPlaybackAutoResume = !0) : this.animate(), this.emitPlayStateChangeEvent(), this.emitDiagnostic({
20455
20568
  severity: "info",
@@ -20559,7 +20672,7 @@ class Kp {
20559
20672
  return;
20560
20673
  }
20561
20674
  const r = i.nextValue;
20562
- this.ensureConfigState().currentTime = r, this.syncCurrentTimeToScene(r), this.emitEvent("time_change", { time: r }), this.emitSelectionChangeEvent(), this.updateCanPlayState(), this.syncPreviewSession();
20675
+ this.ensureConfigState().currentTime = r, this.syncCurrentTimeToScene(r), this.followPlaybackViewportIfNeeded(r), this.emitEvent("time_change", { time: r }), this.emitSelectionChangeEvent(), this.updateCanPlayState(), this.syncPreviewSession();
20563
20676
  }
20564
20677
  getCurrentTime() {
20565
20678
  return this.getCurrentTimeState();
@@ -20572,6 +20685,95 @@ class Kp {
20572
20685
  getEnableClipSnap() {
20573
20686
  return !!this.ensureConfigState().enableClipSnap;
20574
20687
  }
20688
+ setEnablePrimaryTrackMagnet(e) {
20689
+ const t = this.getEnablePrimaryTrackMagnet();
20690
+ t !== e && this.withHistoryTransaction("set_primary_track_magnet", () => {
20691
+ this.setPrimaryTrackMagnetEnabledState(e), this.shouldSkipHistoryRecording() || this.getTimelineHistoryRecorder().recordSetPrimaryTrackMagnet(t, e), e && this.withStructureSession((i) => {
20692
+ this.normalizePrimaryTrackInSession(i);
20693
+ });
20694
+ });
20695
+ }
20696
+ getEnablePrimaryTrackMagnet() {
20697
+ return this.ensureConfigState().enablePrimaryTrackMagnet !== !1;
20698
+ }
20699
+ setPrimaryTrackMagnetEnabledFromHistory(e) {
20700
+ this.setPrimaryTrackMagnetEnabledState(e);
20701
+ }
20702
+ setPrimaryTrackMagnetEnabledState(e) {
20703
+ this.ensureConfigState().enablePrimaryTrackMagnet = e;
20704
+ }
20705
+ getPrimaryTrackId() {
20706
+ var i, r;
20707
+ const e = this.getTrackCollection();
20708
+ if (typeof e.getPrimaryTrack == "function") {
20709
+ const n = e.getPrimaryTrack();
20710
+ return ((i = n == null ? void 0 : n.getId) == null ? void 0 : i.call(n)) ?? null;
20711
+ }
20712
+ const t = Array.isArray(this.tracks) ? this.tracks.find((n) => {
20713
+ var a;
20714
+ return ((a = n.getRole) == null ? void 0 : a.call(n)) === "primary";
20715
+ }) : null;
20716
+ return ((r = t == null ? void 0 : t.getId) == null ? void 0 : r.call(t)) ?? null;
20717
+ }
20718
+ isPrimaryTrackId(e) {
20719
+ var r, n, a, o;
20720
+ if (!e)
20721
+ return !1;
20722
+ const t = this.getTrackCollection(), i = typeof t.findById == "function" ? t.findById(e) : null;
20723
+ return ((r = i == null ? void 0 : i.getRole) == null ? void 0 : r.call(i)) === "primary" ? !0 : ((o = (a = (n = this.trackManager) == null ? void 0 : n.getTrack) == null ? void 0 : a.call(n, e)) == null ? void 0 : o.role) === "primary";
20724
+ }
20725
+ shouldNormalizePrimaryTrackForTrackIds(e) {
20726
+ return this.getEnablePrimaryTrackMagnet() && e.some((t) => this.isPrimaryTrackId(t));
20727
+ }
20728
+ getStableStartOrderedClips(e) {
20729
+ return e.map((t, i) => ({ clip: t, index: i })).sort((t, i) => t.clip.startTime === i.clip.startTime ? t.index - i.index : t.clip.startTime - i.clip.startTime).map((t) => t.clip);
20730
+ }
20731
+ buildPrimaryTrackContinuousClips(e) {
20732
+ if (e.length === 0)
20733
+ return [];
20734
+ let t = e[0].startTime;
20735
+ return e.map((i) => {
20736
+ const r = {
20737
+ ...i,
20738
+ startTime: t,
20739
+ endTime: t + i.duration
20740
+ };
20741
+ return t += i.duration, r;
20742
+ });
20743
+ }
20744
+ buildPrimaryTrackMultiDragOrderedClips(e, t) {
20745
+ return e.map((i, r) => ({
20746
+ clip: t.get(i.id) ?? i,
20747
+ index: r,
20748
+ isMoved: t.has(i.id)
20749
+ })).sort((i, r) => i.clip.startTime !== r.clip.startTime ? i.clip.startTime - r.clip.startTime : i.isMoved !== r.isMoved ? i.isMoved ? -1 : 1 : i.index - r.index).map((i) => i.clip);
20750
+ }
20751
+ normalizePrimaryTrackInSession(e, t = {}) {
20752
+ var c;
20753
+ if (!this.getEnablePrimaryTrackMagnet())
20754
+ return [];
20755
+ const i = this.getPrimaryTrackId();
20756
+ if (!this.isPrimaryTrackId(i))
20757
+ return [];
20758
+ const r = i ? this.getTrackCollection().findById(i) : null, n = t.orderedClips ? [...t.orderedClips] : this.getStableStartOrderedClips(((c = r == null ? void 0 : r.getClips) == null ? void 0 : c.call(r)) ?? []);
20759
+ if (n.length === 0)
20760
+ return [];
20761
+ const a = this.buildPrimaryTrackContinuousClips(n), o = new Set(t.forceClipIds ?? []), l = [];
20762
+ return a.forEach((h, d) => {
20763
+ const u = n[d];
20764
+ if (!u)
20765
+ return;
20766
+ const p = u.startTime !== h.startTime || u.endTime !== h.endTime;
20767
+ p && l.push({
20768
+ clipId: u.id,
20769
+ previousState: u,
20770
+ newState: h
20771
+ }), (p || o.has(u.id)) && e.updateClip(u.id, {
20772
+ startTime: h.startTime,
20773
+ endTime: h.endTime
20774
+ });
20775
+ }), l.length > 0 && !this.shouldSkipHistoryRecording() && this.getTimelineHistoryRecorder().recordClipUpdate(l[0].newState, void 0, l), l;
20776
+ }
20575
20777
  setZoom(e) {
20576
20778
  const t = this.getTimelineCommands().setZoom(e);
20577
20779
  if (!t.changed) return;
@@ -20587,8 +20789,10 @@ class Kp {
20587
20789
  if (!r.changed) return;
20588
20790
  const n = r.nextValue;
20589
20791
  if (this.ensureConfigState().zoom = n, this.syncZoomToScene(n), this.refreshScrollbarMetrics(), this.timeline) {
20590
- const a = this.timeline.getScrollLeft(), o = Y.timeToPixels(i, t), c = Y.timeToPixels(i, n) - o + a;
20591
- this.timeline.setScrollLeft(c), this.handleScrollChange(this.timeline.getScrollLeft());
20792
+ const a = this.timeline.getScrollLeft(), o = U.timeToPixels(i, t), c = U.timeToPixels(i, n) - o + a;
20793
+ this.timeline.setScrollLeft(c), this.runProgrammaticScrollChange(() => {
20794
+ this.handleScrollChange(this.timeline.getScrollLeft());
20795
+ });
20592
20796
  }
20593
20797
  this.emitEvent("zoom_change", { zoom: n });
20594
20798
  }
@@ -20618,12 +20822,14 @@ class Kp {
20618
20822
  this.setZoom(e);
20619
20823
  return;
20620
20824
  }
20621
- const i = this.getZoomState(), r = this.timeline.getScrollLeft(), n = Y.pixelsToTime(t - _e + r, i), a = this.getTimelineCommands().setZoom(e);
20825
+ const i = this.getZoomState(), r = this.timeline.getScrollLeft(), n = U.pixelsToTime(t - fe + r, i), a = this.getTimelineCommands().setZoom(e);
20622
20826
  if (!a.changed) return;
20623
20827
  const o = a.nextValue;
20624
20828
  this.ensureConfigState().zoom = o, this.syncZoomToScene(o), this.refreshScrollbarMetrics();
20625
- const c = Y.timeToPixels(n, o) - (t - _e);
20626
- this.timeline.setScrollLeft(c), this.handleScrollChange(this.timeline.getScrollLeft()), this.emitEvent("zoom_change", { zoom: o });
20829
+ const c = U.timeToPixels(n, o) - (t - fe);
20830
+ this.timeline.setScrollLeft(c), this.runProgrammaticScrollChange(() => {
20831
+ this.handleScrollChange(this.timeline.getScrollLeft());
20832
+ }), this.emitEvent("zoom_change", { zoom: o });
20627
20833
  }
20628
20834
  getZoom() {
20629
20835
  return this.getZoomState();
@@ -20811,7 +21017,6 @@ class Kp {
20811
21017
  }
20812
21018
  async addClipInternal(e) {
20813
21019
  return this.withStructureSession(async () => {
20814
- var T;
20815
21020
  let t = e.startTime;
20816
21021
  t === void 0 && (t = this.getCurrentTime());
20817
21022
  const i = e.type || "video", r = i === "text", n = e.src ?? "", a = e.duration ?? (r ? ho : 0), o = e.name ?? (r ? "文本" : `${i}_${Date.now()}`);
@@ -20821,7 +21026,7 @@ class Kp {
20821
21026
  let h = r ? a : e.sourceDuration;
20822
21027
  if (!h)
20823
21028
  try {
20824
- h = await Y.getVideoDuration(n, {
21029
+ h = await U.getVideoDuration(n, {
20825
21030
  registry: this.sourceMediaRegistry,
20826
21031
  cacheKey: this.buildSourceMediaKey(e)
20827
21032
  }), h <= 0 && (h = c);
@@ -20845,7 +21050,7 @@ class Kp {
20845
21050
  endTime: t + a,
20846
21051
  thumbnails: d,
20847
21052
  style: e.style,
20848
- visualTransform: r || i === "video" ? we(e.visualTransform) : e.visualTransform,
21053
+ visualTransform: r || i === "video" ? Pe(e.visualTransform) : e.visualTransform,
20849
21054
  separatedAudioClipId: e.separatedAudioClipId,
20850
21055
  separatedFromVideoClipId: e.separatedFromVideoClipId,
20851
21056
  volume: e.volume ?? 1,
@@ -20856,51 +21061,70 @@ class Kp {
20856
21061
  ttsVoiceName: e.ttsVoiceName,
20857
21062
  ttsFollowTextUpdates: e.ttsFollowTextUpdates
20858
21063
  });
20859
- if (O.debugLazy("TimelineManager", () => "添加的片段", () => ({ clipId: p.id, type: p.type, startTime: p.startTime, duration: p.duration })), e.trackId) {
20860
- const S = this.getTrackCollection().findById(e.trackId);
20861
- if (S)
20862
- return this.registerPreviewAutoAspectRatioClip(p), (T = S.addClip) == null || T.call(S, p), Hi({
20863
- applied: !0,
20864
- isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
20865
- recordHistory: () => {
20866
- const C = e.trackId;
20867
- this.getTimelineHistoryRecorder().recordAddClip(
20868
- p,
20869
- C,
20870
- this.cloneTrackSnapshot(C),
20871
- this.getTrackRestoreAnchor(C)
20872
- );
20873
- },
20874
- applyEffects: () => {
21064
+ O.debugLazy("TimelineManager", () => "添加的片段", () => ({ clipId: p.id, type: p.type, startTime: p.startTime, duration: p.duration }));
21065
+ const f = () => {
21066
+ var k;
21067
+ if (e.trackId) {
21068
+ const P = this.getTrackCollection().findById(e.trackId);
21069
+ if (P) {
21070
+ if (this.registerPreviewAutoAspectRatioClip(p), (k = P.addClip) == null || k.call(P, p), Hi({
21071
+ applied: !0,
21072
+ isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
21073
+ recordHistory: () => {
21074
+ const x = e.trackId;
21075
+ this.getTimelineHistoryRecorder().recordAddClip(
21076
+ p,
21077
+ x,
21078
+ this.cloneTrackSnapshot(x),
21079
+ this.getTrackRestoreAnchor(x)
21080
+ );
21081
+ },
21082
+ applyEffects: () => {
21083
+ }
21084
+ }), this.shouldNormalizePrimaryTrackForTrackIds([e.trackId])) {
21085
+ const x = this.getActiveStructureSession();
21086
+ x && this.normalizePrimaryTrackInSession(x);
20875
21087
  }
20876
- }), this.primeOrLoadClipThumbnails(p), p.id;
20877
- }
20878
- const f = this.getTimelineCommands().planTrackPlacement(p, this.getTracksSortedByOrder()), m = this.getTrackCollection(), v = Ku({
20879
- clip: p,
20880
- placement: f,
20881
- trackCollection: m,
20882
- createTrack: this.createTrack.bind(this)
20883
- });
20884
- return Hi({
20885
- applied: v,
20886
- isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
20887
- recordHistory: () => {
20888
- const S = this.resolveTrackIdByClipId(p.id);
20889
- this.getTimelineHistoryRecorder().recordAddClip(
20890
- p,
20891
- S,
20892
- S ? this.cloneTrackSnapshot(S) : null,
20893
- S ? this.getTrackRestoreAnchor(S) : null
20894
- );
20895
- },
20896
- applyEffects: () => {
21088
+ return this.primeOrLoadClipThumbnails(p), p.id;
21089
+ }
20897
21090
  }
20898
- }), this.primeOrLoadClipThumbnails(p), p.id;
21091
+ const S = this.getTimelineCommands().planTrackPlacement(p, this.getTracksSortedByOrder()), T = this.getTrackCollection(), v = Ku({
21092
+ clip: p,
21093
+ placement: S,
21094
+ trackCollection: T,
21095
+ createTrack: this.createTrack.bind(this)
21096
+ });
21097
+ Hi({
21098
+ applied: v,
21099
+ isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
21100
+ recordHistory: () => {
21101
+ const P = this.resolveTrackIdByClipId(p.id);
21102
+ this.getTimelineHistoryRecorder().recordAddClip(
21103
+ p,
21104
+ P,
21105
+ P ? this.cloneTrackSnapshot(P) : null,
21106
+ P ? this.getTrackRestoreAnchor(P) : null
21107
+ );
21108
+ },
21109
+ applyEffects: () => {
21110
+ }
21111
+ });
21112
+ const C = this.resolveTrackIdByClipId(p.id);
21113
+ if (this.shouldNormalizePrimaryTrackForTrackIds([C])) {
21114
+ const P = this.getActiveStructureSession();
21115
+ P && this.normalizePrimaryTrackInSession(P);
21116
+ }
21117
+ return this.primeOrLoadClipThumbnails(p), p.id;
21118
+ }, m = e.trackId ? [e.trackId] : [this.getPrimaryTrackId()];
21119
+ return this.shouldNormalizePrimaryTrackForTrackIds(m) ? this.withHistoryTransaction("add_primary_track_clip", f) : f();
20899
21120
  });
20900
21121
  }
20901
21122
  removeClip(e) {
20902
21123
  const t = this.getTimelineCommands().prepareRemoveClip(e, this.tracks);
20903
- t.exists && (t.shouldClearSelection && this.clearSelection(), this.withStructureSession(() => {
21124
+ if (!t.exists)
21125
+ return;
21126
+ t.shouldClearSelection && this.clearSelection();
21127
+ const i = () => this.withStructureSession((r) => {
20904
21128
  Hi({
20905
21129
  applied: Os(this.getTrackCollection(), t, e),
20906
21130
  isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
@@ -20914,8 +21138,13 @@ class Kp {
20914
21138
  },
20915
21139
  applyEffects: () => {
20916
21140
  }
20917
- });
20918
- }));
21141
+ }), this.shouldNormalizePrimaryTrackForTrackIds([t.trackId]) && this.normalizePrimaryTrackInSession(r);
21142
+ });
21143
+ if (this.shouldNormalizePrimaryTrackForTrackIds([t.trackId])) {
21144
+ this.withHistoryTransaction("remove_primary_track_clip", i);
21145
+ return;
21146
+ }
21147
+ i();
20919
21148
  }
20920
21149
  removeClipsByExternalId(e) {
20921
21150
  if (!e)
@@ -20962,24 +21191,34 @@ class Kp {
20962
21191
  if ((i == null ? void 0 : i.clip.type) === "text")
20963
21192
  return;
20964
21193
  const r = i == null ? void 0 : i.track.splitSelectedClip;
20965
- r && (this.withSplitOperation(() => {
20966
- r.call(i.track, t);
20967
- }), Di({
20968
- checkTrackDurationChange: this.checkTrackDurationChange.bind(this),
20969
- updateCanPlayState: this.updateCanPlayState.bind(this)
20970
- }));
21194
+ if (r) {
21195
+ const n = () => {
21196
+ this.withSplitOperation(() => {
21197
+ r.call(i.track, t);
21198
+ });
21199
+ };
21200
+ this.shouldNormalizePrimaryTrackForTrackIds([i.trackId]) ? this.withHistoryTransaction("split_primary_track_clip", n) : n(), Di({
21201
+ checkTrackDurationChange: this.checkTrackDurationChange.bind(this),
21202
+ updateCanPlayState: this.updateCanPlayState.bind(this)
21203
+ });
21204
+ }
20971
21205
  }
20972
21206
  splitCurrentClip() {
20973
21207
  const e = this.getCurrentTime(), t = this.resolveSelectedClipAtTime(e);
20974
21208
  if ((t == null ? void 0 : t.clip.type) === "text")
20975
21209
  return;
20976
21210
  const i = t == null ? void 0 : t.track.splitSelectedClip;
20977
- i && (this.withSplitOperation(() => {
20978
- i.call(t.track, e);
20979
- }), Di({
20980
- checkTrackDurationChange: this.checkTrackDurationChange.bind(this),
20981
- updateCanPlayState: this.updateCanPlayState.bind(this)
20982
- }));
21211
+ if (i) {
21212
+ const r = () => {
21213
+ this.withSplitOperation(() => {
21214
+ i.call(t.track, e);
21215
+ });
21216
+ };
21217
+ this.shouldNormalizePrimaryTrackForTrackIds([t.trackId]) ? this.withHistoryTransaction("split_primary_track_clip", r) : r(), Di({
21218
+ checkTrackDurationChange: this.checkTrackDurationChange.bind(this),
21219
+ updateCanPlayState: this.updateCanPlayState.bind(this)
21220
+ });
21221
+ }
20983
21222
  }
20984
21223
  getClips() {
20985
21224
  return this.getTrackCollection().getAllClips();
@@ -21083,7 +21322,7 @@ class Kp {
21083
21322
  endTimeAtSource: Math.round(n.endTimeAtSource),
21084
21323
  sourceDuration: Math.round(n.sourceDuration),
21085
21324
  thumbnails: n.thumbnails,
21086
- visualTransform: n.type === "video" || n.type === "text" ? we(n.visualTransform) : void 0,
21325
+ visualTransform: n.type === "video" || n.type === "text" ? Pe(n.visualTransform) : void 0,
21087
21326
  separatedAudioClipId: n.separatedAudioClipId,
21088
21327
  separatedFromVideoClipId: n.separatedFromVideoClipId,
21089
21328
  volume: n.volume ?? 1,
@@ -21228,7 +21467,7 @@ class Kp {
21228
21467
  var l;
21229
21468
  const e = this.getClips();
21230
21469
  if (e.length === 0) return;
21231
- const t = Math.min(...e.map((c) => c.startTime)), r = (Math.max(...e.map((c) => c.endTime)) - t) / 1e3, n = ((l = this.stage) == null ? void 0 : l.width()) || 0, a = n - _e * 2;
21470
+ const t = Math.min(...e.map((c) => c.startTime)), r = (Math.max(...e.map((c) => c.endTime)) - t) / 1e3, n = ((l = this.stage) == null ? void 0 : l.width()) || 0, a = n - fe * 2;
21232
21471
  O.debugLazy("TimelineManager", () => "适合缩放", () => ({ duration: r, containerWidth: n, availableWidth: a }));
21233
21472
  const o = Math.min(a / r, Fe.MAX);
21234
21473
  if (this.setZoom(o), this.timeline) {
@@ -21243,7 +21482,7 @@ class Kp {
21243
21482
  }
21244
21483
  handleTimeChange(e, t = "seek") {
21245
21484
  var i;
21246
- this.previewSyncInteractionMode = t, this.previewClockSeekAlignmentTargetTime = t === "seek" ? this.clampPlaybackSeekTime(e) : null, this.previewClockSeekAlignmentDeadlineMs = t === "seek" ? Date.now() + Gp : 0, this.beginPendingPreview(e, t), this.setCurrentTime(e), this.getPlayStateState() === "playing" && this.resumeWallClockPlaybackIfPreviewClockUnavailable(this.getCurrentTimeState()), t !== "scrub" && this.emitDiagnostic({
21485
+ this.previewSyncInteractionMode = t, this.previewClockSeekAlignmentTargetTime = t === "seek" ? this.clampPlaybackSeekTime(e) : null, this.previewClockSeekAlignmentDeadlineMs = t === "seek" ? Date.now() + Vp : 0, this.beginPendingPreview(e, t), this.setCurrentTime(e), this.getPlayStateState() === "playing" && this.resumeWallClockPlaybackIfPreviewClockUnavailable(this.getCurrentTimeState()), t !== "scrub" && this.emitDiagnostic({
21247
21486
  severity: "info",
21248
21487
  category: "ui-trigger",
21249
21488
  eventName: "timeline.seek",
@@ -21257,7 +21496,7 @@ class Kp {
21257
21496
  });
21258
21497
  }
21259
21498
  handleScrollChange(e) {
21260
- this.syncScrollLeft(e);
21499
+ this.suspendPlaybackViewportFollowIfUserScrolling(), this.syncScrollLeft(e);
21261
21500
  }
21262
21501
  handleClipUpdate(e, t, i) {
21263
21502
  this.shouldSkipHistoryRecording() || this.getTimelineHistoryRecorder().recordClipUpdate(e, t, i);
@@ -21556,8 +21795,8 @@ class Kp {
21556
21795
  const C = this.createTrack(e[0].type);
21557
21796
  C && n.set(e[0].key, C);
21558
21797
  for (let k = 1; k < e.length; k += 1) {
21559
- const x = this.createTrack(e[k].type, void 0, e[0].type === "audio" ? "bottom_of_type_region" : "top_of_type_region");
21560
- x && n.set(e[k].key, x);
21798
+ const P = this.createTrack(e[k].type, void 0, e[0].type === "audio" ? "bottom_of_type_region" : "top_of_type_region");
21799
+ P && n.set(e[k].key, P);
21561
21800
  }
21562
21801
  return n;
21563
21802
  }
@@ -21565,14 +21804,14 @@ class Kp {
21565
21804
  const k = this.buildClipboardPasteGroupPlacementClips(C, t, i, r);
21566
21805
  if (k.length === 0)
21567
21806
  return null;
21568
- const x = this.resolvePreferredTrackIndexForPasteGroup(
21807
+ const P = this.resolvePreferredTrackIndexForPasteGroup(
21569
21808
  C,
21570
21809
  a,
21571
21810
  Math.min(C.sourceOrder, Math.max(a.length - 1, 0))
21572
21811
  );
21573
21812
  return {
21574
21813
  ...C,
21575
- preferredTrackIndex: x,
21814
+ preferredTrackIndex: P,
21576
21815
  clips: k
21577
21816
  };
21578
21817
  }).filter((C) => C !== null);
@@ -21580,14 +21819,14 @@ class Kp {
21580
21819
  return n;
21581
21820
  const c = l.map((C) => C.preferredTrackIndex), h = Math.min(...c), d = a.length, u = -l.length, p = [];
21582
21821
  for (let C = u; C <= d; C += 1) {
21583
- let k = !0, x = 0, P = 0;
21822
+ let k = !0, P = 0, x = 0;
21584
21823
  for (let D = 0; D < l.length; D += 1) {
21585
21824
  const w = l[D];
21586
21825
  if (!w)
21587
21826
  continue;
21588
21827
  const A = C + D;
21589
- if (x += Math.abs(A - w.preferredTrackIndex), A < 0 || A >= a.length) {
21590
- P += 1;
21828
+ if (P += Math.abs(A - w.preferredTrackIndex), A < 0 || A >= a.length) {
21829
+ x += 1;
21591
21830
  continue;
21592
21831
  }
21593
21832
  if (this.doesClipGroupOverlapOnTrack(a[A].id, w.clips, o)) {
@@ -21595,10 +21834,10 @@ class Kp {
21595
21834
  break;
21596
21835
  }
21597
21836
  }
21598
- k && (x += P * 0.1, x += Math.abs(C - h) * po.ANCHOR_INDEX_WEIGHT, p.push({
21837
+ k && (P += x * 0.1, P += Math.abs(C - h) * po.ANCHOR_INDEX_WEIGHT, p.push({
21599
21838
  startIndex: C,
21600
- score: x,
21601
- newTrackCount: P
21839
+ score: P,
21840
+ newTrackCount: x
21602
21841
  }));
21603
21842
  }
21604
21843
  const f = this.selectBestClipboardPasteStartIndex(
@@ -21607,15 +21846,15 @@ class Kp {
21607
21846
  );
21608
21847
  if (f === null)
21609
21848
  return n;
21610
- const m = Math.max(0, -f), v = Math.max(0, f + l.length - a.length);
21611
- m > 0 && this.createTracksForTypeBoundary(l[0].type, m, "before"), v > 0 && this.createTracksForTypeBoundary(l[0].type, v, "after");
21849
+ const m = Math.max(0, -f), S = Math.max(0, f + l.length - a.length);
21850
+ m > 0 && this.createTracksForTypeBoundary(l[0].type, m, "before"), S > 0 && this.createTracksForTypeBoundary(l[0].type, S, "after");
21612
21851
  const T = [...this.getResolvedTracksSnapshot()].filter((C) => {
21613
21852
  var k;
21614
21853
  return C.type === ((k = l[0]) == null ? void 0 : k.type);
21615
- }).sort((C, k) => C.order - k.order), S = f + m;
21854
+ }).sort((C, k) => C.order - k.order), v = f + m;
21616
21855
  return l.forEach((C, k) => {
21617
- const x = T[S + k];
21618
- x && n.set(C.key, x.id);
21856
+ const P = T[v + k];
21857
+ P && n.set(C.key, P.id);
21619
21858
  }), n;
21620
21859
  }
21621
21860
  resolvePreferredTrackIndexForPasteGroup(e, t, i) {
@@ -21704,32 +21943,32 @@ class Kp {
21704
21943
  e.setPreferredTab("voice");
21705
21944
  const u = [];
21706
21945
  if (await this.withHistoryTransaction("generate_voice_from_text_clips", async () => {
21707
- const f = await n(d), m = new Map(f.map((v) => [v.requestId, v]));
21708
- for (const v of d) {
21709
- const T = m.get(v.requestId);
21946
+ const f = await n(d), m = new Map(f.map((S) => [S.requestId, S]));
21947
+ for (const S of d) {
21948
+ const T = m.get(S.requestId);
21710
21949
  if (!T)
21711
21950
  continue;
21712
- const S = c.find((P) => P.id === v.sourceTextClipId);
21713
- if (!S)
21951
+ const v = c.find((x) => x.id === S.sourceTextClipId);
21952
+ if (!v)
21714
21953
  continue;
21715
- const C = this.normalizeGeneratedAudioDuration(T.duration), k = S.textContent ?? S.name ?? "";
21716
- this.syncTextClipDurationToAudio(S.id, C);
21717
- const x = await this.addClip({
21954
+ const C = this.normalizeGeneratedAudioDuration(T.duration), k = v.textContent ?? v.name ?? "";
21955
+ this.syncTextClipDurationToAudio(v.id, C);
21956
+ const P = await this.addClip({
21718
21957
  type: "audio",
21719
21958
  src: T.audioSrc,
21720
21959
  name: this.buildGeneratedAudioClipName(T.voiceName),
21721
21960
  textContent: k,
21722
- startTime: S.startTime,
21961
+ startTime: v.startTime,
21723
21962
  duration: C,
21724
21963
  startTimeAtSource: 0,
21725
21964
  endTimeAtSource: C,
21726
21965
  sourceDuration: C,
21727
- ttsSourceTextClipId: S.id,
21966
+ ttsSourceTextClipId: v.id,
21728
21967
  ttsVoiceId: T.voiceId,
21729
21968
  ttsVoiceName: T.voiceName,
21730
21969
  ttsFollowTextUpdates: r
21731
21970
  });
21732
- u.push(x);
21971
+ u.push(P);
21733
21972
  }
21734
21973
  if (u.length === 0)
21735
21974
  throw new Error("生成音频失败:未返回音频结果");
@@ -21763,7 +22002,7 @@ class Kp {
21763
22002
  const p = h.get(u.requestId);
21764
22003
  if (!p || !u.targetAudioClipId)
21765
22004
  continue;
21766
- const f = a.find((v) => v.id === u.targetAudioClipId);
22005
+ const f = a.find((S) => S.id === u.targetAudioClipId);
21767
22006
  if (!f)
21768
22007
  continue;
21769
22008
  const m = this.resolveTtsAudioVoiceGenerationSource(f);
@@ -21774,10 +22013,10 @@ class Kp {
21774
22013
  p,
21775
22014
  r
21776
22015
  ), this.relocateClipIfNeeded(u.targetAudioClipId), m.persistedSourceTextClipId) {
21777
- const v = d.get(m.persistedSourceTextClipId) ?? 0;
22016
+ const S = d.get(m.persistedSourceTextClipId) ?? 0;
21778
22017
  d.set(
21779
22018
  m.persistedSourceTextClipId,
21780
- Math.max(v, p.duration)
22019
+ Math.max(S, p.duration)
21781
22020
  );
21782
22021
  }
21783
22022
  }
@@ -21829,31 +22068,33 @@ class Kp {
21829
22068
  }
21830
22069
  handleClipSplit(e, t) {
21831
22070
  const i = this.resolveTrackIdByClipId(e.id), r = i ? this.cloneTrackSnapshot(i) : null, n = i ? this.getTrackRestoreAnchor(i) : null;
21832
- Ld({
21833
- clip1: e,
21834
- clip2: t,
21835
- isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
21836
- recordSplitClip: (a, o) => {
21837
- this.getTimelineHistoryRecorder().recordSplitClip(
21838
- a,
21839
- o,
21840
- i,
21841
- r,
21842
- n
21843
- );
21844
- },
21845
- emitClipUpdated: (a) => {
21846
- this.emitEvent("clip_updated", { clip: a });
21847
- },
21848
- emitClipAdded: (a) => {
21849
- this.emitEvent("clip_added", { clip: a });
21850
- },
21851
- applyEffects: () => Ri({
21852
- notifySelectionChange: this.notifySelectionChange.bind(this),
21853
- emitSelectionChangeEvent: this.emitSelectionChangeEvent.bind(this),
21854
- emitSelectedClipChangeIfNeeded: this.emitSelectedClipChangeIfNeeded.bind(this),
21855
- handleClipChange: this.handleClipChange.bind(this)
21856
- })
22071
+ this.withStructureSession((a) => {
22072
+ Ld({
22073
+ clip1: e,
22074
+ clip2: t,
22075
+ isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
22076
+ recordSplitClip: (o, l) => {
22077
+ this.getTimelineHistoryRecorder().recordSplitClip(
22078
+ o,
22079
+ l,
22080
+ i,
22081
+ r,
22082
+ n
22083
+ );
22084
+ },
22085
+ emitClipUpdated: (o) => {
22086
+ this.emitEvent("clip_updated", { clip: o });
22087
+ },
22088
+ emitClipAdded: (o) => {
22089
+ this.emitEvent("clip_added", { clip: o });
22090
+ },
22091
+ applyEffects: () => Ri({
22092
+ notifySelectionChange: this.notifySelectionChange.bind(this),
22093
+ emitSelectionChangeEvent: this.emitSelectionChangeEvent.bind(this),
22094
+ emitSelectedClipChangeIfNeeded: this.emitSelectedClipChangeIfNeeded.bind(this),
22095
+ handleClipChange: this.handleClipChange.bind(this)
22096
+ })
22097
+ }), this.shouldNormalizePrimaryTrackForTrackIds([i]) && this.normalizePrimaryTrackInSession(a);
21857
22098
  });
21858
22099
  }
21859
22100
  handleClipSelect(e) {
@@ -21896,12 +22137,25 @@ class Kp {
21896
22137
  endSourceLoading() {
21897
22138
  this.sourceLoadingCount = Math.max(0, this.sourceLoadingCount - 1);
21898
22139
  }
22140
+ handlePrimaryTrackMagnetMove(e, t, i, r) {
22141
+ if (!this.getEnablePrimaryTrackMagnet() || !this.isPrimaryTrackId(r))
22142
+ return !1;
22143
+ const n = this.getStableStartOrderedClips(i), a = n.findIndex((l) => l.startTime >= e.startTime), o = [...n];
22144
+ return o.splice(a === -1 ? o.length : a, 0, e), this.withHistoryTransaction("move_primary_track_clips", () => {
22145
+ this.withStructureSession((l) => {
22146
+ this.normalizePrimaryTrackInSession(l, {
22147
+ orderedClips: o,
22148
+ forceClipIds: [e.id]
22149
+ });
22150
+ });
22151
+ }), !0;
22152
+ }
21899
22153
  handleClipOverlap(e, t, i) {
21900
22154
  var h, d, u, p;
21901
22155
  O.debugLazy("TimelineManager", () => "检测到 clip 重叠,需要创建新轨道", () => ({ clipId: e.id, currentTrackId: t }));
21902
22156
  const r = this.getTrackCollection();
21903
22157
  if (!r.findById(t)) return;
21904
- const n = e.type, a = this.trackManager.getTracksByType(n).length + 1, o = `${$p(n)}轨道 ${a}`, l = this.createTrack(n, o);
22158
+ const n = e.type, a = this.trackManager.getTracksByType(n).length + 1, o = `${Wp(n)}轨道 ${a}`, l = this.createTrack(n, o);
21905
22159
  if (!l) return;
21906
22160
  const c = ((d = (h = r.findById(l)) == null ? void 0 : h.getId) == null ? void 0 : d.call(h)) || ((p = (u = r.getLastTrack()) == null ? void 0 : u.getId) == null ? void 0 : p.call(u)) || l;
21907
22161
  this.moveClipToTrackWithHistorySnapshot(e.id, c, i ?? null, e), this.cleanupEmptyTracks();
@@ -21947,7 +22201,9 @@ class Kp {
21947
22201
  * @param setCurrentTime 是否同时将当前时间设置为该时间点,默认为 false
21948
22202
  */
21949
22203
  scrollToTime(e, t = !1) {
21950
- this.timeline && (this.timeline.scrollToTime(e), this.handleScrollChange(this.timeline.getScrollLeft()), t && this.setCurrentTime(e));
22204
+ this.timeline && (this.timeline.scrollToTime(e), this.runProgrammaticScrollChange(() => {
22205
+ this.handleScrollChange(this.timeline.getScrollLeft());
22206
+ }), t && this.setCurrentTime(e));
21951
22207
  }
21952
22208
  /**
21953
22209
  * 选择指定的片段
@@ -22176,7 +22432,9 @@ class Kp {
22176
22432
  */
22177
22433
  scrollToClip(e, t = {}) {
22178
22434
  const { selectClip: i = !1, setCurrentTime: r = !1 } = t, n = this.getClips().find((a) => a.id === e);
22179
- !n || !this.timeline || (this.timeline.scrollToClip(n), this.handleScrollChange(this.timeline.getScrollLeft()), r && this.setCurrentTime(n.startTime), i && this.selectClip(e));
22435
+ !n || !this.timeline || (this.timeline.scrollToClip(n), this.runProgrammaticScrollChange(() => {
22436
+ this.handleScrollChange(this.timeline.getScrollLeft());
22437
+ }), r && this.setCurrentTime(n.startTime), i && this.selectClip(e));
22180
22438
  }
22181
22439
  /**
22182
22440
  * 获取当前时间点所在的clip
@@ -22495,58 +22753,62 @@ class Kp {
22495
22753
  return this.moveClipToTrackWithHistorySnapshot(e, t, null);
22496
22754
  }
22497
22755
  moveClipToTrackWithHistorySnapshot(e, t, i, r = null) {
22498
- return this.withStructureSession(() => {
22499
- const n = this.getTimelineCommands().prepareMoveClipToTrack(e, t, this.tracks);
22500
- if (n.status === "missing_source_track")
22501
- return O.warn("TimelineManager", `片段不在任何轨道中: ${e}`), !1;
22502
- if (n.status === "noop")
22503
- return O.debugLazy("TimelineManager", () => `源轨道和目标轨道相同,无需移动: ${e}`), !0;
22504
- if (n.status === "missing_target_track")
22505
- return O.warn("TimelineManager", `目标轨道不存在: ${t}`), !1;
22506
- if (n.status === "track_type_mismatch")
22507
- return O.debugLazy("TimelineManager", () => "轨道类型不匹配", () => {
22508
- var v, T, S;
22509
- return {
22510
- targetTrackType: (T = (v = this.getTrackCollection().findById(t)) == null ? void 0 : v.getTrackType) == null ? void 0 : T.call(v),
22511
- clipType: (S = this.getTimelineCommands().findClipById(this.tracks, e)) == null ? void 0 : S.clip.type
22512
- };
22513
- }), !1;
22514
- if (n.status !== "ready")
22515
- return !1;
22516
- const { sourceTrackId: a, targetTrackId: o } = n, l = i ? { ...i } : { ...n.clip }, c = r ? { ...r } : { ...n.clip }, h = this.cloneTrackSnapshot(a), d = this.cloneTrackSnapshot(o), u = this.getTrackRestoreAnchor(a), p = this.getTrackRestoreAnchor(o), f = Zu({
22756
+ const n = this.getTimelineCommands().prepareMoveClipToTrack(e, t, this.tracks);
22757
+ if (n.status === "missing_source_track")
22758
+ return O.warn("TimelineManager", `片段不在任何轨道中: ${e}`), !1;
22759
+ if (n.status === "noop")
22760
+ return O.debugLazy("TimelineManager", () => `源轨道和目标轨道相同,无需移动: ${e}`), !0;
22761
+ if (n.status === "missing_target_track")
22762
+ return O.warn("TimelineManager", `目标轨道不存在: ${t}`), !1;
22763
+ if (n.status === "track_type_mismatch")
22764
+ return O.debugLazy("TimelineManager", () => "轨道类型不匹配", () => {
22765
+ var l, c, h;
22766
+ return {
22767
+ targetTrackType: (c = (l = this.getTrackCollection().findById(t)) == null ? void 0 : l.getTrackType) == null ? void 0 : c.call(l),
22768
+ clipType: (h = this.getTimelineCommands().findClipById(this.tracks, e)) == null ? void 0 : h.clip.type
22769
+ };
22770
+ }), !1;
22771
+ if (n.status !== "ready")
22772
+ return !1;
22773
+ const a = this.shouldNormalizePrimaryTrackForTrackIds([
22774
+ n.sourceTrackId,
22775
+ n.targetTrackId
22776
+ ]), o = () => this.withStructureSession((l) => {
22777
+ const { sourceTrackId: c, targetTrackId: h } = n, d = i ? { ...i } : { ...n.clip }, u = r ? { ...r } : { ...n.clip }, p = this.cloneTrackSnapshot(c), f = this.cloneTrackSnapshot(h), m = this.getTrackRestoreAnchor(c), S = this.getTrackRestoreAnchor(h), T = Zu({
22517
22778
  command: {
22518
22779
  ...n,
22519
- clip: c
22780
+ clip: u
22520
22781
  },
22521
22782
  trackCollection: this.getTrackCollection()
22522
- }), m = this.getClips().find((v) => v.id === e) ?? null;
22783
+ }), v = this.getClips().find((C) => C.id === e) ?? null;
22523
22784
  return Dd({
22524
- applied: f,
22785
+ applied: T,
22525
22786
  clipId: e,
22526
- sourceTrackId: a,
22527
- targetTrackId: o,
22528
- clipBefore: l,
22529
- clipAfter: m ?? l,
22530
- sourceTrackSnapshot: h,
22531
- targetTrackSnapshot: d,
22787
+ sourceTrackId: c,
22788
+ targetTrackId: h,
22789
+ clipBefore: d,
22790
+ clipAfter: v ?? d,
22791
+ sourceTrackSnapshot: p,
22792
+ targetTrackSnapshot: f,
22532
22793
  isExecutingHistoryAction: this.shouldSkipHistoryRecording(),
22533
- recordMoveClipBetweenTracks: (v, T, S, C, k, x, P) => {
22794
+ recordMoveClipBetweenTracks: (C, k, P, x, D, w, A) => {
22534
22795
  this.getTimelineHistoryRecorder().recordMoveClipBetweenTracks(
22535
- v,
22536
- T,
22537
- S,
22538
22796
  C,
22539
22797
  k,
22540
- x,
22541
22798
  P,
22542
- u,
22543
- p
22799
+ x,
22800
+ D,
22801
+ w,
22802
+ A,
22803
+ m,
22804
+ S
22544
22805
  );
22545
22806
  },
22546
22807
  applyEffects: () => {
22547
22808
  }
22548
- }) ? (this.clearAllTrackDropPreviews(), !0) : !1;
22809
+ }) ? (a && this.normalizePrimaryTrackInSession(l), this.clearAllTrackDropPreviews(), !0) : !1;
22549
22810
  });
22811
+ return a ? this.withHistoryTransaction("move_primary_track_clip_between_tracks", o) : o();
22550
22812
  }
22551
22813
  /**
22552
22814
  * 获取时间轴总时长
@@ -22575,11 +22837,11 @@ class Kp {
22575
22837
  await ((e = this.resourceCacheManager) == null ? void 0 : e.clear());
22576
22838
  }
22577
22839
  destroy() {
22578
- var t, i, r, n, a, o, l, c, h, d, u, p, f, m, v;
22840
+ var t, i, r, n, a, o, l, c, h, d, u, p, f, m, S;
22579
22841
  this.mountManager.destroyAll(), this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.clearPendingPreviewState(), (t = this.resourceCacheManager) == null || t.cleanupExpired().catch(() => {
22580
22842
  }), this.previewSession && (this.previewSession.hasPreview() ? (this.detachPreview(), this.previewSession = void 0) : this.destroyPreviewSession(!0)), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.trackInfoPanelController.destroy(), (i = this.layout) == null || i.bodyViewport.removeEventListener("scroll", this.bodyViewportScrollListener), (a = (r = this.layout) == null ? void 0 : (n = r.bodyCanvasHost).removeEventListener) == null || a.call(n, "click", this.bodyCanvasHostClickListener);
22581
22843
  const e = (l = (o = this.stage) == null ? void 0 : o.container) == null ? void 0 : l.call(o);
22582
- e && this.stageMouseDownListener && ((c = e.removeEventListener) == null || c.call(e, "mousedown", this.stageMouseDownListener)), (d = (h = this.rootContainer) == null ? void 0 : h.removeEventListener) == null || d.call(h, "wheel", this.rootWheelListener), (u = this.horizontalScrollbar) == null || u.destroy(), (p = this.verticalScrollbar) == null || p.destroy(), (f = this.playhead) == null || f.destroy(), (m = this.timeline) == null || m.destroy(), (v = this.stage) == null || v.destroy(), this.rootContainer && (this.rootContainer.innerHTML = ""), this.getEventDispatcher().clear();
22844
+ e && this.stageMouseDownListener && ((c = e.removeEventListener) == null || c.call(e, "mousedown", this.stageMouseDownListener)), (d = (h = this.rootContainer) == null ? void 0 : h.removeEventListener) == null || d.call(h, "wheel", this.rootWheelListener), (u = this.horizontalScrollbar) == null || u.destroy(), (p = this.verticalScrollbar) == null || p.destroy(), (f = this.playhead) == null || f.destroy(), (m = this.timeline) == null || m.destroy(), (S = this.stage) == null || S.destroy(), this.rootContainer && (this.rootContainer.innerHTML = ""), this.getEventDispatcher().clear();
22583
22845
  }
22584
22846
  initKeyboardShortcuts() {
22585
22847
  var e;
@@ -22865,34 +23127,73 @@ class Kp {
22865
23127
  const a = t.type === "audio" ? "bottom_of_type_region" : "top_of_type_region", o = this.createTrack(t.type, void 0, a);
22866
23128
  return o ? (this.registerMultiDragPlacementTrack(e, o, t.type, a), o) : null;
22867
23129
  }
22868
- commitMultiDragPlacements(e, t, i) {
22869
- const r = [], n = this.createMultiDragPlacementContext(new Set(e.selectedClipIds));
22870
- for (const a of e.selectedClipIds) {
22871
- const o = e.clips.get(a);
22872
- if (!o)
23130
+ commitMultiDragPlacements(e, t, i, r = {}) {
23131
+ const n = [], a = this.createMultiDragPlacementContext(new Set(e.selectedClipIds)), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
23132
+ let c = null;
23133
+ for (const h of e.selectedClipIds) {
23134
+ const d = e.clips.get(h);
23135
+ if (!d)
22873
23136
  continue;
22874
- const l = this.buildMovedClipSnapshot(o.clip, t.deltaTime), c = i(o, l);
22875
- if (!c)
23137
+ const u = this.buildMovedClipSnapshot(d.clip, t.deltaTime), p = i(d, u);
23138
+ if (!p)
23139
+ continue;
23140
+ if (r.compactSameTrackPrimary && this.getEnablePrimaryTrackMagnet() && p === d.trackId && this.isPrimaryTrackId(d.trackId)) {
23141
+ c = d.trackId, l.set(d.clipId, d.clip), o.set(d.clipId, u);
22876
23142
  continue;
22877
- let h = c;
22878
- if (!(this.doesMultiDragPlacementOverlap(n, c, l) && (h = this.resolveMultiDragOverlapTargetTrackId(n, l, c), !h))) {
22879
- if (this.reserveMultiDragPlacement(n, h, l), h === o.trackId) {
22880
- if (l.startTime === o.clip.startTime && l.endTime === o.clip.endTime)
23143
+ }
23144
+ let f = p;
23145
+ if (!(this.doesMultiDragPlacementOverlap(a, p, u) && (f = this.resolveMultiDragOverlapTargetTrackId(a, u, p), !f))) {
23146
+ if (this.reserveMultiDragPlacement(a, f, u), f === d.trackId) {
23147
+ if (u.startTime === d.clip.startTime && u.endTime === d.clip.endTime)
22881
23148
  continue;
22882
- this.updateClipPositionSilently(o.trackId, o.clipId, l.startTime), r.push({
22883
- clipId: o.clipId,
22884
- previousState: o.clip,
22885
- newState: l
23149
+ this.updateClipPositionSilently(d.trackId, d.clipId, u.startTime), n.push({
23150
+ clipId: d.clipId,
23151
+ previousState: d.clip,
23152
+ newState: u
22886
23153
  });
22887
23154
  continue;
22888
23155
  }
22889
- this.updateClipPositionSilently(o.trackId, o.clipId, l.startTime), this.moveClipToTrackWithHistorySnapshot(o.clipId, h, o.clip, l);
23156
+ this.updateClipPositionSilently(d.trackId, d.clipId, u.startTime), this.moveClipToTrackWithHistorySnapshot(d.clipId, f, d.clip, u);
22890
23157
  }
22891
23158
  }
22892
- return r.length > 0 && this.getTimelineHistoryRecorder().recordClipUpdate(r[0].newState, void 0, r), !0;
23159
+ return c && o.size > 0 && n.push(
23160
+ ...this.compactPrimaryTrackAfterMultiDrag(
23161
+ c,
23162
+ o,
23163
+ l
23164
+ )
23165
+ ), n.length > 0 && this.getTimelineHistoryRecorder().recordClipUpdate(n[0].newState, void 0, n), !0;
22893
23166
  }
22894
23167
  finalizeMultiDragSameTrack(e, t) {
22895
- return this.commitMultiDragPlacements(e, t, (i) => i.trackId);
23168
+ return this.commitMultiDragPlacements(
23169
+ e,
23170
+ t,
23171
+ (i) => i.trackId,
23172
+ {
23173
+ compactSameTrackPrimary: !0
23174
+ }
23175
+ );
23176
+ }
23177
+ compactPrimaryTrackAfterMultiDrag(e, t, i) {
23178
+ var d;
23179
+ if (!this.getEnablePrimaryTrackMagnet() || !this.isPrimaryTrackId(e))
23180
+ return [];
23181
+ const r = this.getTrackCollection().findById(e), n = this.getStableStartOrderedClips(((d = r == null ? void 0 : r.getClips) == null ? void 0 : d.call(r)) ?? []);
23182
+ if (n.length === 0)
23183
+ return [];
23184
+ const a = new Map(n.map((u) => [u.id, u])), o = new Map(a);
23185
+ i.forEach((u, p) => {
23186
+ o.set(p, u);
23187
+ });
23188
+ const l = this.buildPrimaryTrackMultiDragOrderedClips(n, t), c = this.buildPrimaryTrackContinuousClips(l), h = [];
23189
+ return c.forEach((u) => {
23190
+ const p = a.get(u.id), f = o.get(u.id);
23191
+ !p || !f || ((p.startTime !== u.startTime || p.endTime !== u.endTime) && this.updateClipPositionSilently(e, u.id, u.startTime), (f.startTime !== u.startTime || f.endTime !== u.endTime) && h.push({
23192
+ clipId: u.id,
23193
+ previousState: f,
23194
+ newState: u
23195
+ }));
23196
+ }), h;
22896
23197
  }
22897
23198
  previewMultiDragCrossTrack(e, t) {
22898
23199
  const i = e.clips.get(t.draggedClipId);
@@ -23163,7 +23464,7 @@ class Kp {
23163
23464
  const n = i.getTrackGroup().y(), a = this.resolveTrackRenderHeight(i);
23164
23465
  if (!(t < n || t > n + a))
23165
23466
  for (const o of i.getClips()) {
23166
- const l = ge(o.startTime, this.getZoomState(), this.getScrollLeftState()), c = Se(o.duration, this.getZoomState());
23467
+ const l = ge(o.startTime, this.getZoomState(), this.getScrollLeftState()), c = ve(o.duration, this.getZoomState());
23167
23468
  if (e >= l && e <= l + c && t >= n + 2 && t <= n + a - 2)
23168
23469
  return !0;
23169
23470
  }
@@ -23175,7 +23476,7 @@ class Kp {
23175
23476
  for (const i of this.tracks) {
23176
23477
  const n = i.getTrackGroup().y(), a = this.resolveTrackRenderHeight(i);
23177
23478
  for (const o of i.getClips()) {
23178
- const l = ge(o.startTime, this.getZoomState(), this.getScrollLeftState()), c = Se(o.duration, this.getZoomState()), h = n + 2, d = a - 4, u = l + c, p = h + d, f = e.x + e.width, m = e.y + e.height;
23479
+ const l = ge(o.startTime, this.getZoomState(), this.getScrollLeftState()), c = ve(o.duration, this.getZoomState()), h = n + 2, d = a - 4, u = l + c, p = h + d, f = e.x + e.width, m = e.y + e.height;
23179
23480
  l < f && u > e.x && h < m && p > e.y && t.push(o.id);
23180
23481
  }
23181
23482
  }
@@ -23352,7 +23653,7 @@ class Kp {
23352
23653
  const i = this.getClips().find((a) => a.id === e);
23353
23654
  if (!i || i.type !== "video" && i.type !== "text")
23354
23655
  return;
23355
- const r = we(i.visualTransform), n = we(t);
23656
+ const r = Pe(i.visualTransform), n = Pe(t);
23356
23657
  mn(r, n) || this.updateClip(e, {
23357
23658
  visualTransform: n
23358
23659
  });
@@ -23361,8 +23662,8 @@ class Kp {
23361
23662
  const i = this.getClips().find((a) => a.id === e);
23362
23663
  if (!i || i.type !== "text") return;
23363
23664
  const r = Ne(i.textStyle), n = Math.max(
23364
- $i.MIN,
23365
- Math.min($i.MAX, Math.round(t))
23665
+ zi.MIN,
23666
+ Math.min(zi.MAX, Math.round(t))
23366
23667
  );
23367
23668
  r.fontSize !== n && this.updateClip(e, { textStyle: { ...r, fontSize: n } });
23368
23669
  }
@@ -23394,7 +23695,7 @@ class Kp {
23394
23695
  }
23395
23696
  export {
23396
23697
  qs as ASPECT_RATIO_BASELINE_SHORT_EDGE_PX,
23397
- Up as CLIP_LAYER,
23698
+ qp as CLIP_LAYER,
23398
23699
  mr as Clip,
23399
23700
  kd as ClipConfigPanel,
23400
23701
  co as DEFAULT_CLIP_VIEW_STATE,
@@ -23404,21 +23705,21 @@ export {
23404
23705
  Bi as DEFAULT_TIMELINE_DURATION_MS,
23405
23706
  nh as DiagnosticsCenter,
23406
23707
  bs as HistoryManager,
23407
- zi as MIN_CLIP_LINE_WIDTH,
23408
- Vp as PREVIEW_ASPECT_RATIO_PRESETS,
23708
+ $i as MIN_CLIP_LINE_WIDTH,
23709
+ Xp as PREVIEW_ASPECT_RATIO_PRESETS,
23409
23710
  po as SNAP_SCORING,
23410
- $i as TEXT_CLIP_FONT_SIZE_LIMITS,
23411
- _e as TIMELINE_LEFT_PADDING,
23412
- Yp as TIME_SCALE,
23711
+ zi as TEXT_CLIP_FONT_SIZE_LIMITS,
23712
+ fe as TIMELINE_LEFT_PADDING,
23713
+ Kp as TIME_SCALE,
23413
23714
  or as TRACK_HEIGHT,
23414
- Y as TimeUtils,
23715
+ U as TimeUtils,
23415
23716
  Ju as TimelineClipConfigController,
23416
- Kp as TimelineManager,
23717
+ eg as TimelineManager,
23417
23718
  Kr as Track,
23418
23719
  vd as TrackInfoPanel,
23419
23720
  Ip as TrackManager,
23420
23721
  uo as VOICE_LINKED_TEXT_REGEN_DEBOUNCE_MS,
23421
- Wp as ZOOM_ANIMATION,
23722
+ jp as ZOOM_ANIMATION,
23422
23723
  Tn as ZOOM_GESTURE,
23423
23724
  Fe as ZOOM_PRESETS,
23424
23725
  go as createClipViewState,