@pixodesk/svg-animator-vue 1.0.34 → 1.0.39

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.umd.js CHANGED
@@ -78,7 +78,7 @@ var PixodeskAnimatorVue = (() => {
78
78
  var toRawType = (value) => {
79
79
  return toTypeString(value).slice(8, -1);
80
80
  };
81
- var isPlainObject = (val) => toTypeString(val) === "[object Object]";
81
+ var isPlainObject2 = (val) => toTypeString(val) === "[object Object]";
82
82
  var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
83
83
  var isReservedProp = /* @__PURE__ */ makeMap(
84
84
  // the leading comma is intentional so empty string "" is also included
@@ -524,17 +524,17 @@ var PixodeskAnimatorVue = (() => {
524
524
  };
525
525
  } else if (isSymbol(val)) {
526
526
  return stringifySymbol(val);
527
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
527
+ } else if (isObject(val) && !isArray(val) && !isPlainObject2(val)) {
528
528
  return String(val);
529
529
  }
530
530
  return val;
531
531
  };
532
532
  var stringifySymbol = (v, i = "") => {
533
- var _a;
533
+ var _a2;
534
534
  return (
535
535
  // Symbol.description in es2019+ so we need to cast here to pass
536
536
  // the lib: es2016 check
537
- isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
537
+ isSymbol(v) ? `Symbol(${(_a2 = v.description) != null ? _a2 : i})` : v
538
538
  );
539
539
  };
540
540
  function normalizeCssVarValue(value) {
@@ -588,7 +588,7 @@ var PixodeskAnimatorVue = (() => {
588
588
  exports.isModelListener = isModelListener;
589
589
  exports.isObject = isObject;
590
590
  exports.isOn = isOn;
591
- exports.isPlainObject = isPlainObject;
591
+ exports.isPlainObject = isPlainObject2;
592
592
  exports.isPromise = isPromise;
593
593
  exports.isRegExp = isRegExp;
594
594
  exports.isRenderableAttrValue = isRenderableAttrValue;
@@ -667,7 +667,7 @@ var PixodeskAnimatorVue = (() => {
667
667
  var toRawType = (value) => {
668
668
  return toTypeString(value).slice(8, -1);
669
669
  };
670
- var isPlainObject = (val) => toTypeString(val) === "[object Object]";
670
+ var isPlainObject2 = (val) => toTypeString(val) === "[object Object]";
671
671
  var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
672
672
  var isReservedProp = /* @__PURE__ */ makeMap(
673
673
  // the leading comma is intentional so empty string "" is also included
@@ -1113,17 +1113,17 @@ var PixodeskAnimatorVue = (() => {
1113
1113
  };
1114
1114
  } else if (isSymbol(val)) {
1115
1115
  return stringifySymbol(val);
1116
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
1116
+ } else if (isObject(val) && !isArray(val) && !isPlainObject2(val)) {
1117
1117
  return String(val);
1118
1118
  }
1119
1119
  return val;
1120
1120
  };
1121
1121
  var stringifySymbol = (v, i = "") => {
1122
- var _a;
1122
+ var _a2;
1123
1123
  return (
1124
1124
  // Symbol.description in es2019+ so we need to cast here to pass
1125
1125
  // the lib: es2016 check
1126
- isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
1126
+ isSymbol(v) ? `Symbol(${(_a2 = v.description) != null ? _a2 : i})` : v
1127
1127
  );
1128
1128
  };
1129
1129
  function normalizeCssVarValue(value) {
@@ -1185,7 +1185,7 @@ var PixodeskAnimatorVue = (() => {
1185
1185
  exports.isModelListener = isModelListener;
1186
1186
  exports.isObject = isObject;
1187
1187
  exports.isOn = isOn;
1188
- exports.isPlainObject = isPlainObject;
1188
+ exports.isPlainObject = isPlainObject2;
1189
1189
  exports.isPromise = isPromise;
1190
1190
  exports.isRegExp = isRegExp;
1191
1191
  exports.isRenderableAttrValue = isRenderableAttrValue;
@@ -1235,7 +1235,7 @@ var PixodeskAnimatorVue = (() => {
1235
1235
  var require_decode_codepoint = __commonJS({
1236
1236
  "../../node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.js"(exports) {
1237
1237
  "use strict";
1238
- var _a;
1238
+ var _a2;
1239
1239
  Object.defineProperty(exports, "__esModule", { value: true });
1240
1240
  exports.fromCodePoint = void 0;
1241
1241
  exports.replaceCodePoint = replaceCodePoint;
@@ -1272,7 +1272,7 @@ var PixodeskAnimatorVue = (() => {
1272
1272
  [159, 376]
1273
1273
  ]);
1274
1274
  exports.fromCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
1275
- (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => {
1275
+ (_a2 = String.fromCodePoint) !== null && _a2 !== void 0 ? _a2 : ((codePoint) => {
1276
1276
  let output = "";
1277
1277
  if (codePoint > 65535) {
1278
1278
  codePoint -= 65536;
@@ -1283,11 +1283,11 @@ var PixodeskAnimatorVue = (() => {
1283
1283
  return output;
1284
1284
  });
1285
1285
  function replaceCodePoint(codePoint) {
1286
- var _a2;
1286
+ var _a3;
1287
1287
  if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) {
1288
1288
  return 65533;
1289
1289
  }
1290
- return (_a2 = decodeMap.get(codePoint)) !== null && _a2 !== void 0 ? _a2 : codePoint;
1290
+ return (_a3 = decodeMap.get(codePoint)) !== null && _a3 !== void 0 ? _a3 : codePoint;
1291
1291
  }
1292
1292
  function decodeCodePoint(codePoint) {
1293
1293
  return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
@@ -1566,9 +1566,9 @@ var PixodeskAnimatorVue = (() => {
1566
1566
  * @returns The number of characters that were consumed.
1567
1567
  */
1568
1568
  emitNumericEntity(lastCp, expectedLength) {
1569
- var _a;
1569
+ var _a2;
1570
1570
  if (this.consumed <= expectedLength) {
1571
- (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
1571
+ (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
1572
1572
  return 0;
1573
1573
  }
1574
1574
  if (lastCp === CharCodes.SEMI) {
@@ -1666,11 +1666,11 @@ var PixodeskAnimatorVue = (() => {
1666
1666
  * @returns The number of characters consumed.
1667
1667
  */
1668
1668
  emitNotTerminatedNamedEntity() {
1669
- var _a;
1669
+ var _a2;
1670
1670
  const { result, decodeTree } = this;
1671
1671
  const valueLength = (decodeTree[result] & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
1672
1672
  this.emitNamedEntityData(result, valueLength, this.consumed);
1673
- (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
1673
+ (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.missingSemicolonAfterCharacterReference();
1674
1674
  return this.consumed;
1675
1675
  }
1676
1676
  /**
@@ -1698,7 +1698,7 @@ var PixodeskAnimatorVue = (() => {
1698
1698
  * @returns The number of characters consumed.
1699
1699
  */
1700
1700
  end() {
1701
- var _a;
1701
+ var _a2;
1702
1702
  switch (this.state) {
1703
1703
  case EntityDecoderState.NamedEntity: {
1704
1704
  return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
@@ -1711,7 +1711,7 @@ var PixodeskAnimatorVue = (() => {
1711
1711
  return this.emitNumericEntity(0, 3);
1712
1712
  }
1713
1713
  case EntityDecoderState.NumericStart: {
1714
- (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
1714
+ (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
1715
1715
  return 0;
1716
1716
  }
1717
1717
  case EntityDecoderState.EntityStart: {
@@ -44357,8 +44357,8 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
44357
44357
  [
44358
44358
  // eslint-disable-next-line no-restricted-syntax
44359
44359
  msg + args.map((a) => {
44360
- var _a, _b;
44361
- return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
44360
+ var _a2, _b;
44361
+ return (_b = (_a2 = a.toString) == null ? void 0 : _a2.call(a)) != null ? _b : JSON.stringify(a);
44362
44362
  }).join(""),
44363
44363
  instance && instance.proxy,
44364
44364
  trace.map(
@@ -44900,7 +44900,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
44900
44900
  }
44901
44901
  }
44902
44902
  function setDevtoolsHook$1(hook, target) {
44903
- var _a, _b;
44903
+ var _a2, _b;
44904
44904
  devtools$1 = hook;
44905
44905
  if (devtools$1) {
44906
44906
  devtools$1.enabled = true;
@@ -44913,7 +44913,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
44913
44913
  typeof window !== "undefined" && // some envs mock window but not fully
44914
44914
  window.HTMLElement && // also exclude jsdom
44915
44915
  // eslint-disable-next-line no-restricted-syntax
44916
- !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
44916
+ !((_b = (_a2 = window.navigator) == null ? void 0 : _a2.userAgent) == null ? void 0 : _b.includes("jsdom"))
44917
44917
  ) {
44918
44918
  const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
44919
44919
  replay.push((newHook) => {
@@ -56826,7 +56826,7 @@ ${codeFrame}` : message);
56826
56826
  return target;
56827
56827
  };
56828
56828
  function bezierToSvgPath(path, forceCurves = false) {
56829
- var _a, _b, _c, _d;
56829
+ var _a2, _b, _c, _d;
56830
56830
  const v = path.v;
56831
56831
  const i = path.i;
56832
56832
  const o = path.o;
@@ -56837,7 +56837,7 @@ ${codeFrame}` : message);
56837
56837
  d.push("M" + v[0][0] + "," + v[0][1]);
56838
56838
  for (let idx = 1; idx < len; idx++) {
56839
56839
  const prevV = v[idx - 1];
56840
- const prevO = (_a = o == null ? void 0 : o[idx - 1]) != null ? _a : prevV;
56840
+ const prevO = (_a2 = o == null ? void 0 : o[idx - 1]) != null ? _a2 : prevV;
56841
56841
  const currI = (_b = i == null ? void 0 : i[idx]) != null ? _b : v[idx];
56842
56842
  const currV = v[idx];
56843
56843
  const isLine = !forceCurves && (prevO[0] === prevV[0] && prevO[1] === prevV[1]) && (currI[0] === currV[0] && currI[1] === currV[1]);
@@ -56888,7 +56888,7 @@ ${codeFrame}` : message);
56888
56888
  return res;
56889
56889
  }
56890
56890
  function interpolateBezier(path1, path2, progress) {
56891
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
56891
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
56892
56892
  if (!path1 || !path2) return path1 || path2 || { v: [] };
56893
56893
  const t = Math.min(Math.max(progress, 0), 1);
56894
56894
  const len = Math.min(path1.v.length, path2.v.length);
@@ -56899,7 +56899,7 @@ ${codeFrame}` : message);
56899
56899
  const v1 = path1.v[idx];
56900
56900
  const v2 = path2.v[idx];
56901
56901
  v.push(interpolateVec(v1, v2, t));
56902
- const i1 = (_b = (_a = path1.i) == null ? void 0 : _a[idx]) != null ? _b : v1;
56902
+ const i1 = (_b = (_a2 = path1.i) == null ? void 0 : _a2[idx]) != null ? _b : v1;
56903
56903
  const i2 = (_d = (_c = path2.i) == null ? void 0 : _c[idx]) != null ? _d : v2;
56904
56904
  i.push(interpolateVec(i1, i2, t));
56905
56905
  const o1 = (_f = (_e = path1.o) == null ? void 0 : _e[idx]) != null ? _f : v1;
@@ -57018,8 +57018,8 @@ ${codeFrame}` : message);
57018
57018
  return color.length === 4 ? "rgba(" + r + "," + g + "," + b + "," + color[3] + ")" : "rgb(" + r + "," + g + "," + b + ")";
57019
57019
  }
57020
57020
  function parseRgba(s) {
57021
- var _a;
57022
- const inner = (_a = s.match(/rgba?\((.*)\)/)) == null ? void 0 : _a[1];
57021
+ var _a2;
57022
+ const inner = (_a2 = s.match(/rgba?\((.*)\)/)) == null ? void 0 : _a2[1];
57023
57023
  if (!inner) throw new Error("Invalid rgb/rgba format");
57024
57024
  const parts = inner.split(",").map((v) => +v.trim());
57025
57025
  return [parts[0] / 255, parts[1] / 255, parts[2] / 255, ...parts[3] !== void 0 ? [parts[3]] : []];
@@ -57054,13 +57054,13 @@ ${codeFrame}` : message);
57054
57054
  }
57055
57055
  return void 0;
57056
57056
  }
57057
- var COLOUR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
57057
+ var COLOR_ATTR_NAMES = /* @__PURE__ */ new Set(["color", "fill", "flood-color", "lighting-color", "stop-color", "stroke"]);
57058
57058
  var TRANSFORM_FN_NAMES = /* @__PURE__ */ new Set(["translate", "rotate", "scale", "skew"]);
57059
57059
  var PCT_BASED_ATTR_NAMES = /* @__PURE__ */ new Set(["offset-distance", "offsetDistance"]);
57060
57060
  function composeTransformParts(parts, opts) {
57061
- var _a;
57061
+ var _a2;
57062
57062
  if (!parts) return "";
57063
- const withUnits = (_a = opts == null ? void 0 : opts.withUnits) != null ? _a : true;
57063
+ const withUnits = (_a2 = opts == null ? void 0 : opts.withUnits) != null ? _a2 : true;
57064
57064
  const segs = [];
57065
57065
  const t = parts.translate;
57066
57066
  const o = parts.origin;
@@ -57078,7 +57078,7 @@ ${codeFrame}` : message);
57078
57078
  return segs.join("");
57079
57079
  }
57080
57080
  function parseTransformParts(str2) {
57081
- var _a, _b;
57081
+ var _a2, _b;
57082
57082
  if (!str2 || typeof str2 !== "string") return void 0;
57083
57083
  const out = {};
57084
57084
  const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
@@ -57094,7 +57094,7 @@ ${codeFrame}` : message);
57094
57094
  if (nums.some((n) => Number.isNaN(n))) return void 0;
57095
57095
  if (fn === "translate") {
57096
57096
  if (nums.length < 1 || nums.length > 2) return void 0;
57097
- out.translate = [nums[0], (_a = nums[1]) != null ? _a : 0];
57097
+ out.translate = [nums[0], (_a2 = nums[1]) != null ? _a2 : 0];
57098
57098
  } else if (fn === "rotate") {
57099
57099
  if (nums.length !== 1) return void 0;
57100
57100
  out.rotate = nums[0];
@@ -57298,8 +57298,8 @@ ${codeFrame}` : message);
57298
57298
  }
57299
57299
  var DEFAULT_PHASE = "cover";
57300
57300
  function resolveRangePointU(point, defaultFraction, subjectSize, scrollportSize) {
57301
- var _a;
57302
- const [u0, u1] = scrollPhaseInterval((_a = point == null ? void 0 : point.phase) != null ? _a : DEFAULT_PHASE, subjectSize, scrollportSize);
57301
+ var _a2;
57302
+ const [u0, u1] = scrollPhaseInterval((_a2 = point == null ? void 0 : point.phase) != null ? _a2 : DEFAULT_PHASE, subjectSize, scrollportSize);
57303
57303
  const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
57304
57304
  return u0 + fraction * (u1 - u0);
57305
57305
  }
@@ -57311,9 +57311,9 @@ ${codeFrame}` : message);
57311
57311
  return clamp((u - uStart) / (uEnd - uStart), 0, 1);
57312
57312
  }
57313
57313
  function scrollOffsetProgress(offset, maxOffset, range) {
57314
- var _a, _b;
57314
+ var _a2, _b;
57315
57315
  const raw = maxOffset > 0 ? clamp(offset / maxOffset, 0, 1) : 1;
57316
- const start = typeof ((_a = range == null ? void 0 : range.start) == null ? void 0 : _a.fraction) === "number" ? range.start.fraction : 0;
57316
+ const start = typeof ((_a2 = range == null ? void 0 : range.start) == null ? void 0 : _a2.fraction) === "number" ? range.start.fraction : 0;
57317
57317
  const end = typeof ((_b = range == null ? void 0 : range.end) == null ? void 0 : _b.fraction) === "number" ? range.end.fraction : 1;
57318
57318
  if (end <= start) return raw >= end ? 1 : 0;
57319
57319
  return clamp((raw - start) / (end - start), 0, 1);
@@ -57325,6 +57325,7 @@ ${codeFrame}` : message);
57325
57325
  if (a === "inline") return vertical ? "y" : "x";
57326
57326
  return vertical ? "x" : "y";
57327
57327
  }
57328
+ var PX_UNKNOWN_KEY_ERROR = "unexpected extra key";
57328
57329
  function pathStr(path) {
57329
57330
  if (!path.length) return ".";
57330
57331
  let result = "";
@@ -57432,6 +57433,7 @@ ${codeFrame}` : message);
57432
57433
  return false;
57433
57434
  }
57434
57435
  };
57436
+ var UNION_MEMBER_ERROR_LIMIT = 4;
57435
57437
  var Union = class extends Base {
57436
57438
  constructor(schemas, defaultVal) {
57437
57439
  super();
@@ -57446,10 +57448,38 @@ ${codeFrame}` : message);
57446
57448
  return this._default;
57447
57449
  }
57448
57450
  isValid(raw, ctx, path) {
57449
- var _a;
57451
+ var _a2;
57450
57452
  const probe = ctx && { errors: [], warnings: [], strict: ctx.strict };
57451
57453
  if (this.schemas.some((s) => s.isValid(raw, probe, path ? [...path] : void 0))) return true;
57452
- ctx == null ? void 0 : ctx.errors.push(pathStr(path != null ? path : []) + ": no union member matched for value " + ((_a = JSON.stringify(raw)) != null ? _a : "").slice(0, 240));
57454
+ if (!ctx) return false;
57455
+ const base = pathStr(path != null ? path : []);
57456
+ ctx.errors.push(base + ": no union member matched for value " + ((_a2 = JSON.stringify(raw)) != null ? _a2 : "").slice(0, 240));
57457
+ let best;
57458
+ let bestDepth = -1;
57459
+ const leafExpectations = [];
57460
+ for (const member of this.schemas) {
57461
+ const sink = { errors: [], warnings: [], strict: ctx.strict };
57462
+ member.isValid(raw, sink, path ? [...path] : void 0);
57463
+ if (!sink.errors.length) continue;
57464
+ const depth = Math.max(...sink.errors.map((e) => e.slice(0, e.indexOf(":")).length));
57465
+ if (depth > bestDepth || depth === bestDepth && best && sink.errors.length < best.length) {
57466
+ bestDepth = depth;
57467
+ best = sink.errors;
57468
+ }
57469
+ if (depth <= base.length) {
57470
+ for (const e of sink.errors) {
57471
+ const m = /: expected (.+?), got /.exec(e);
57472
+ if (m && !leafExpectations.includes(m[1])) leafExpectations.push(m[1]);
57473
+ }
57474
+ }
57475
+ }
57476
+ if (best && bestDepth > base.length) {
57477
+ for (const e of best.slice(0, UNION_MEMBER_ERROR_LIMIT)) {
57478
+ if (!ctx.errors.includes(e)) ctx.errors.push(e);
57479
+ }
57480
+ } else if (leafExpectations.length) {
57481
+ ctx.errors.push(base + ": expected " + leafExpectations.join(" | "));
57482
+ }
57453
57483
  return false;
57454
57484
  }
57455
57485
  _canSanitize(raw) {
@@ -57458,6 +57488,7 @@ ${codeFrame}` : message);
57458
57488
  };
57459
57489
  var DiscriminatedUnion = class extends Base {
57460
57490
  constructor(_key, _schemas, defaultVal) {
57491
+ var _a2;
57461
57492
  super();
57462
57493
  this._key = _key;
57463
57494
  this._schemas = _schemas;
@@ -57466,18 +57497,21 @@ ${codeFrame}` : message);
57466
57497
  this._map = /* @__PURE__ */ new Map();
57467
57498
  for (const s of _schemas) {
57468
57499
  const keySchema = s._shape[_key];
57469
- if (keySchema) this._map.set(keySchema._default, s);
57500
+ if (!keySchema) continue;
57501
+ const literal = (_a2 = keySchema.inner) != null ? _a2 : keySchema;
57502
+ this._map.set(literal._default, s);
57503
+ if (keySchema.inner) this._absentMember = s;
57470
57504
  }
57471
57505
  }
57472
57506
  _findSchema(raw) {
57473
57507
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return void 0;
57474
57508
  const val = raw[this._key];
57475
- if (val === void 0 || val === null) return void 0;
57509
+ if (val === void 0 || val === null) return this._absentMember;
57476
57510
  return this._map.get(val);
57477
57511
  }
57478
57512
  sanitize(raw) {
57479
- var _a;
57480
- return ((_a = this._findSchema(raw)) != null ? _a : this._schemas[0]).sanitize(raw);
57513
+ var _a2;
57514
+ return ((_a2 = this._findSchema(raw)) != null ? _a2 : this._schemas[0]).sanitize(raw);
57481
57515
  }
57482
57516
  isValid(raw, ctx, path) {
57483
57517
  const schema = this._findSchema(raw);
@@ -57506,7 +57540,8 @@ ${codeFrame}` : message);
57506
57540
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
57507
57541
  const out = {};
57508
57542
  for (const key of Object.keys(this._shape)) {
57509
- out[key] = this._shape[key].sanitize(src[key]);
57543
+ const v = this._shape[key].sanitize(src[key]);
57544
+ if (v !== void 0) out[key] = v;
57510
57545
  }
57511
57546
  return out;
57512
57547
  }
@@ -57528,7 +57563,7 @@ ${codeFrame}` : message);
57528
57563
  if (key in this._shape) continue;
57529
57564
  if (obj[key] === void 0) continue;
57530
57565
  p.push(key);
57531
- ctx.errors.push(pathStr(p) + ": unexpected extra key");
57566
+ ctx.errors.push(pathStr(p) + ": " + PX_UNKNOWN_KEY_ERROR);
57532
57567
  p.pop();
57533
57568
  ok = false;
57534
57569
  }
@@ -57552,7 +57587,8 @@ ${codeFrame}` : message);
57552
57587
  const src = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
57553
57588
  const out = __spreadValues2({}, src);
57554
57589
  for (const key of Object.keys(this._shape)) {
57555
- out[key] = this._shape[key].sanitize(src[key]);
57590
+ const v = this._shape[key].sanitize(src[key]);
57591
+ if (v !== void 0) out[key] = v;
57556
57592
  }
57557
57593
  if (this._openSchema) {
57558
57594
  for (const key of Object.keys(src)) {
@@ -57693,8 +57729,8 @@ ${codeFrame}` : message);
57693
57729
  this.resolved = null;
57694
57730
  }
57695
57731
  get schema() {
57696
- var _a;
57697
- return (_a = this.resolved) != null ? _a : this.resolved = this.fn();
57732
+ var _a2;
57733
+ return (_a2 = this.resolved) != null ? _a2 : this.resolved = this.fn();
57698
57734
  }
57699
57735
  sanitize(raw) {
57700
57736
  return this.schema.sanitize(raw);
@@ -57790,24 +57826,159 @@ ${codeFrame}` : message);
57790
57826
  /** Defers schema creation — required for recursive types. Must supply a default value. */
57791
57827
  lazy: (fn, defaultVal) => new Lazy(fn, defaultVal)
57792
57828
  };
57793
- var PX_ANIM_SRC_ATTR_NAME = "data-px-animation-src";
57794
- var PX_ANIM_ATTR_NAME = "_px_animator";
57795
- var PxAnimatorMode = {
57796
- auto: "auto",
57797
- waapi: "waapi",
57798
- frames: "frames"
57829
+ var PX_PLAYER_SCHEMA_VERSION = "1.1";
57830
+ var VERSION_RE = /^(\d+)\.(\d+)(?:\.(\d+))?$/;
57831
+ function parseWireVersion(raw) {
57832
+ if (typeof raw !== "string") return void 0;
57833
+ const m = VERSION_RE.exec(raw.trim());
57834
+ if (!m) return void 0;
57835
+ return { a: Number(m[1]), b: Number(m[2]), c: m[3] === void 0 ? 0 : Number(m[3]) };
57836
+ }
57837
+ var _a;
57838
+ var PLAYER_WIRE_VERSION = (_a = parseWireVersion(PX_PLAYER_SCHEMA_VERSION)) != null ? _a : { a: 1, b: 1, c: 0 };
57839
+ var PxFillMode = {
57840
+ forwards: "forwards",
57841
+ backwards: "backwards",
57842
+ both: "both",
57843
+ none: "none"
57844
+ };
57845
+ var PxPlaybackDirection = {
57846
+ normal: "normal",
57847
+ reverse: "reverse",
57848
+ alternate: "alternate",
57849
+ alternateReverse: "alternate-reverse"
57850
+ };
57851
+ var PxStartOn = {
57852
+ load: "load",
57853
+ mouseOver: "mouseOver",
57854
+ click: "click",
57855
+ scrollIntoView: "scrollIntoView",
57856
+ programmatic: "programmatic"
57857
+ };
57858
+ var PxOutAction = {
57859
+ continue: "continue",
57860
+ pause: "pause",
57861
+ reset: "reset",
57862
+ reverse: "reverse"
57863
+ };
57864
+ var PxFinishAction = {
57865
+ hold: "hold",
57866
+ reset: "reset"
57867
+ };
57868
+ var PxScrollKind = {
57869
+ view: "view",
57870
+ scroll: "scroll"
57799
57871
  };
57800
- var PxAnimatorEngine = {
57801
- waapi: PxAnimatorMode.waapi,
57802
- frames: PxAnimatorMode.frames
57872
+ var PxScrollAxis = {
57873
+ block: "block",
57874
+ inline: "inline",
57875
+ x: "x",
57876
+ y: "y"
57877
+ };
57878
+ var PxScrollSource = {
57879
+ nearest: "nearest",
57880
+ root: "root"
57881
+ };
57882
+ var PxPinAlign = {
57883
+ top: "top",
57884
+ center: "center",
57885
+ bottom: "bottom"
57886
+ };
57887
+ var PxScrollPhase = {
57888
+ cover: "cover",
57889
+ contain: "contain",
57890
+ entry: "entry",
57891
+ exit: "exit",
57892
+ entryCrossing: "entry-crossing",
57893
+ exitCrossing: "exit-crossing"
57894
+ };
57895
+ var PxAlongPathMode = {
57896
+ sampled: "sampled",
57897
+ offsetPath: "offsetPath"
57898
+ };
57899
+ var PX_TIMELINE_SHARED_KEYS = ["duration", "iterations", "engine", "frameRate"];
57900
+ var PX_TIME_ONLY_TIMELINE_KEYS = ["trigger", "delay", "fillMode", "direction"];
57901
+ var PX_FLAT_RUNTIME_VIEW_KEYS = [
57902
+ ...PX_TIMELINE_SHARED_KEYS,
57903
+ ...PX_TIME_ONLY_TIMELINE_KEYS,
57904
+ "fill",
57905
+ "resetOnFinish",
57906
+ "timelineSource",
57907
+ "scroll"
57908
+ ];
57909
+ var PxTimelineEngine = {
57910
+ native: "native",
57911
+ js: "js"
57912
+ };
57913
+ var PxTimelineEngineExtra = __spreadProps2(__spreadValues2({}, PxTimelineEngine), {
57914
+ auto: "auto"
57915
+ });
57916
+ function resolveTimelineEngine(engine) {
57917
+ return engine === PxTimelineEngineExtra.js ? PxTimelineEngine.js : PxTimelineEngine.native;
57918
+ }
57919
+ function isNativeForced(engine) {
57920
+ return engine === PxTimelineEngineExtra.native;
57921
+ }
57922
+ function mayUseNativeScrollTimeline(engine) {
57923
+ return engine !== PxTimelineEngineExtra.js;
57924
+ }
57925
+ var PX_TRIGGER_DEFAULTS = {
57926
+ startOn: "load",
57927
+ outAction: "continue",
57928
+ scrollIntoViewThreshold: 0
57929
+ };
57930
+ var PxControlMode = {
57931
+ /** No control props — the document's trigger decides, and nothing is taken over. */
57932
+ static: "static",
57933
+ /** `progress` / `time` — the host scrubs; the component seeks and stays paused. */
57934
+ fixedTime: "fixedTime",
57935
+ /** `play` / `pause` — the host drives playback with booleans. */
57936
+ play: "play",
57937
+ /** `autoplay` — the document's own trigger starts it. */
57938
+ autoplay: "autoplay"
57939
+ };
57940
+ function resolveControlMode(props) {
57941
+ const hasFixedTime = props.progress !== void 0 || props.time !== void 0;
57942
+ const hasPlayPause = props.play !== void 0 || props.pause !== void 0;
57943
+ const hasAutoplay = !!props.autoplay;
57944
+ const warnings = [];
57945
+ const named = (a, b, winner) => a + " and " + b + " were both set \u2014 " + winner + " wins, " + (winner === a ? b : a) + " is ignored.";
57946
+ if (hasFixedTime) {
57947
+ if (hasPlayPause) warnings.push(named("progress/time", "play/pause", "progress/time"));
57948
+ if (hasAutoplay) warnings.push(named("progress/time", "autoplay", "progress/time"));
57949
+ return { mode: PxControlMode.fixedTime, warnings };
57950
+ }
57951
+ if (hasPlayPause) {
57952
+ if (hasAutoplay) warnings.push(named("play/pause", "autoplay", "play/pause"));
57953
+ return { mode: PxControlMode.play, warnings };
57954
+ }
57955
+ if (hasAutoplay) return { mode: PxControlMode.autoplay, warnings };
57956
+ return { mode: PxControlMode.static, warnings };
57957
+ }
57958
+ function controlModeTakesOverTrigger(mode) {
57959
+ return mode !== PxControlMode.autoplay;
57960
+ }
57961
+ function resolveTrigger(trigger) {
57962
+ var _a2, _b, _c;
57963
+ return {
57964
+ startOn: (_a2 = trigger == null ? void 0 : trigger.startOn) != null ? _a2 : PX_TRIGGER_DEFAULTS.startOn,
57965
+ outAction: (_b = trigger == null ? void 0 : trigger.outAction) != null ? _b : PX_TRIGGER_DEFAULTS.outAction,
57966
+ scrollIntoViewThreshold: (_c = trigger == null ? void 0 : trigger.scrollIntoViewThreshold) != null ? _c : PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold
57967
+ };
57968
+ }
57969
+ var PxLoopRepeatAt = {
57970
+ /** Segment from the START; the repetition runs BEFORE the first keyframe
57971
+ * (intro loops that play until the main timeline begins). */
57972
+ start: "start",
57973
+ /** DEFAULT — segment from the END; the repetition runs AFTER the last keyframe
57974
+ * (idle/outro loops that continue once the main timeline has finished). */
57975
+ end: "end"
57803
57976
  };
57804
- var PxLoopExtend = {
57805
- /** Segment from the START; the animation is extended BEFORE the first keyframe
57806
- * (intro loops that run before the main timeline begins). */
57807
- before: "before",
57808
- /** DEFAULT — segment from the END; extended AFTER the last keyframe (idle/outro
57809
- * loops that continue once the main timeline has finished). */
57810
- after: "after"
57977
+ var PxLoopDirection = {
57978
+ /** DEFAULT — cycle: every repetition replays the segment the same way round. */
57979
+ normal: "normal",
57980
+ /** Ping-pong: repetitions alternate forward / backward. */
57981
+ alternate: "alternate"
57811
57982
  };
57812
57983
  var PxMaskType = {
57813
57984
  luminance: "luminance",
@@ -57817,8 +57988,9 @@ ${codeFrame}` : message);
57817
57988
  userSpaceOnUse: "userSpaceOnUse",
57818
57989
  objectBoundingBox: "objectBoundingBox"
57819
57990
  };
57820
- var PxCloneType = {
57821
- content: "content"
57991
+ var PxCloneWithout = {
57992
+ translate: "translate"
57993
+ // transform: 'transform', // future: drop rotate/scale too (content only)
57822
57994
  };
57823
57995
  var PxPathOverflow = {
57824
57996
  clip: "clip",
@@ -57840,8 +58012,10 @@ ${codeFrame}` : message);
57840
58012
  separate: "separate",
57841
58013
  combined: "combined"
57842
58014
  };
57843
- var TEXT_ATTR = "text";
57844
58015
  var TEXT_CONTENT_ATTR = "textContent";
58016
+ var CLASS_ATTR = "class";
58017
+ var TRANSFORM_ATTR = "transform";
58018
+ var OFFSET_DISTANCE_ATTR = "offsetDistance";
57845
58019
  var INTERNAL_ATTRS = /* @__PURE__ */ new Set([
57846
58020
  "type",
57847
58021
  "children",
@@ -57849,13 +58023,20 @@ ${codeFrame}` : message);
57849
58023
  "meta",
57850
58024
  "animate",
57851
58025
  "effects",
57852
- TEXT_ATTR,
57853
58026
  TEXT_CONTENT_ATTR
57854
58027
  ]);
57855
- var PxGradientUnits = {
57856
- userSpaceOnUse: "userSpaceOnUse",
57857
- objectBoundingBox: "objectBoundingBox"
58028
+ var TRANSFORM_PART = {
58029
+ translate: "translate",
58030
+ rotate: "rotate",
58031
+ scale: "scale",
58032
+ origin: "origin"
57858
58033
  };
58034
+ var PX_TRANSFORM_PART_KEYS = [
58035
+ TRANSFORM_PART.translate,
58036
+ TRANSFORM_PART.rotate,
58037
+ TRANSFORM_PART.scale,
58038
+ TRANSFORM_PART.origin
58039
+ ];
57859
58040
  var PxGradientSpreadMethod = {
57860
58041
  pad: "pad",
57861
58042
  reflect: "reflect",
@@ -57869,27 +58050,38 @@ ${codeFrame}` : message);
57869
58050
  if (!(fileJson && typeof fileJson === "object" && !Array.isArray(fileJson))) {
57870
58051
  return false;
57871
58052
  }
57872
- return fileJson["type"] === "svg";
58053
+ return fileJson.type === "svg";
57873
58054
  }
57874
58055
  function getAnimatorConfig(doc) {
57875
- var _a;
57876
- const cfg = (doc == null ? void 0 : doc.animator) || ((_a = doc == null ? void 0 : doc.meta) == null ? void 0 : _a.animator);
57877
- return cfg ? flattenAnimatorTimeline(cfg) : void 0;
57878
- }
58056
+ var _a2;
58057
+ const cfg = (doc == null ? void 0 : doc.animator) || ((_a2 = doc == null ? void 0 : doc.meta) == null ? void 0 : _a2.animator);
58058
+ if (!cfg) return void 0;
58059
+ const memoised = wireViewMemo.get(cfg);
58060
+ if (memoised) return memoised;
58061
+ const wire = cfg;
58062
+ const stray = PX_FLAT_RUNTIME_VIEW_KEYS.filter((k) => wire[k] !== void 0);
58063
+ const source = stray.length ? __spreadValues2({}, wire) : cfg;
58064
+ for (const k of stray) delete source[k];
58065
+ const view = flattenAnimatorTimeline(source);
58066
+ wireViewMemo.set(cfg, view);
58067
+ return view;
58068
+ }
58069
+ var wireViewMemo = /* @__PURE__ */ new WeakMap();
57879
58070
  var flattenMemo = /* @__PURE__ */ new WeakMap();
57880
58071
  function flattenAnimatorTimeline(cfg) {
57881
58072
  const timeline = cfg.timeline;
57882
58073
  if (timeline === void 0 || timeline === null || typeof timeline !== "object") return cfg;
57883
58074
  const memoised = flattenMemo.get(cfg);
57884
58075
  if (memoised) return memoised;
57885
- const _a = cfg, { timeline: _dropped } = _a, flat = __objRest2(_a, ["timeline"]);
58076
+ const _a2 = cfg, { timeline: _dropped } = _a2, flat = __objRest2(_a2, ["timeline"]);
58077
+ if (timeline.engine !== void 0) flat.engine = timeline.engine;
58078
+ if (timeline.frameRate !== void 0) flat.frameRate = timeline.frameRate;
57886
58079
  if (timeline.type === "scroll" || timeline.type === "view") {
57887
58080
  flat.timelineSource = "scroll";
57888
58081
  if (timeline.duration !== void 0) flat.duration = timeline.duration;
57889
58082
  if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
57890
58083
  const scroll = __spreadValues2({}, flat.scroll || {});
57891
58084
  scroll.kind = timeline.type;
57892
- if (timeline.engine !== void 0) scroll.driver = timeline.engine;
57893
58085
  if (timeline.axis !== void 0) scroll.axis = timeline.axis;
57894
58086
  if (timeline.source !== void 0) scroll.source = timeline.source;
57895
58087
  if (timeline.subject !== void 0) scroll.subject = timeline.subject;
@@ -57900,34 +58092,34 @@ ${codeFrame}` : message);
57900
58092
  else if (pin && typeof pin === "object") {
57901
58093
  scroll.pin = true;
57902
58094
  if (pin.align !== void 0) scroll.pinAlign = pin.align;
57903
- if (pin.top !== void 0) scroll.pinTop = pin.top;
58095
+ if (pin.offset !== void 0) scroll.pinOffset = pin.offset;
57904
58096
  if (pin.distance !== void 0) scroll.pinDistance = pin.distance;
57905
58097
  }
57906
58098
  flat.scroll = scroll;
57907
58099
  } else {
57908
58100
  if (timeline.duration !== void 0) flat.duration = timeline.duration;
57909
58101
  if (timeline.trigger !== void 0) {
57910
- const _b = timeline.trigger, { onFinish } = _b, restTrigger = __objRest2(_b, ["onFinish"]);
58102
+ const _b = timeline.trigger, { finishAction } = _b, restTrigger = __objRest2(_b, ["finishAction"]);
57911
58103
  if (Object.keys(restTrigger).length) flat.trigger = restTrigger;
57912
- if (onFinish !== void 0) flat.resetOnFinish = onFinish === "reset";
58104
+ if (finishAction !== void 0) flat.resetOnFinish = finishAction === "reset";
57913
58105
  }
57914
58106
  if (timeline.delay !== void 0) flat.delay = timeline.delay;
57915
58107
  if (timeline.iterations !== void 0) flat.iterations = timeline.iterations;
57916
58108
  if (timeline.direction !== void 0) flat.direction = timeline.direction;
57917
- if (timeline.fill !== void 0) flat.fill = timeline.fill;
58109
+ if (timeline.fillMode !== void 0) flat.fill = timeline.fillMode;
57918
58110
  }
57919
58111
  flattenMemo.set(cfg, flat);
57920
58112
  return flat;
57921
58113
  }
57922
58114
  function getDefs(doc) {
57923
- var _a;
58115
+ var _a2;
57924
58116
  if (!doc) return void 0;
57925
- return (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.definitions;
58117
+ return (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.definitions;
57926
58118
  }
57927
58119
  function getBindings(doc) {
57928
- var _a;
58120
+ var _a2;
57929
58121
  if (!doc) return void 0;
57930
- const animateById = (_a = getAnimatorConfig(doc)) == null ? void 0 : _a.animateById;
58122
+ const animateById = (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.animateById;
57931
58123
  if (!animateById) return void 0;
57932
58124
  return Object.entries(animateById).map(([id, anim]) => ({ id: id.startsWith("#") ? id.slice(1) : id, animate: anim }));
57933
58125
  }
@@ -57940,14 +58132,13 @@ ${codeFrame}` : message);
57940
58132
  // e.g. for colors
57941
58133
  px.number(),
57942
58134
  px.array(px.number()),
57943
- // ORDER LAW: the key-discriminated object shapes (`{path}`, `{paths}`) come BEFORE the
58135
+ // ORDER LAW: the key-discriminated object shape (`{pathData}`) comes BEFORE the
57944
58136
  // all-optional transform-parts record. In default (non-strict) mode that record accepts
57945
58137
  // ANY object (every key optional, unknown keys ignored), so listing it earlier made
57946
- // Union.sanitize route `{path}`/`{paths}` values into it and strip them to `{}` —
58138
+ // Union.sanitize route `{pathData}` values into it and strip them to `{}` —
57947
58139
  // silent morph-data loss (repro: the editor's keyframeValueSanitize spec). Validity is
57948
58140
  // order-independent (`some()`); only sanitize routing depends on this order.
57949
- px.object({ path: px.string() }),
57950
- px.lazy(() => px.object({ paths: px.array(PxBezierPathSchema) }), { paths: [] }),
58141
+ px.object({ pathData: px.string() }),
57951
58142
  // Gradient `stops` timeline — each kf value is the full stops-array snapshot.
57952
58143
  px.lazy(() => px.array(PxGradientStopSchema), []),
57953
58144
  px.lazy(() => PxTransformPartsSchema, {})
@@ -57962,16 +58153,32 @@ ${codeFrame}` : message);
57962
58153
  // (review §1.3): editor data lives under `meta`. The editor still carries it on
57963
58154
  // its internal COPY-PASTE payload, which never validates against this schema.)
57964
58155
  }));
58156
+ var anyKf = (kf) => kf;
58157
+ var kfTime = (kf) => {
58158
+ var _a2, _b;
58159
+ return (_b = (_a2 = anyKf(kf).time) != null ? _a2 : anyKf(kf).t) != null ? _b : 0;
58160
+ };
58161
+ var kfValue = (kf) => {
58162
+ var _a2;
58163
+ return (_a2 = anyKf(kf).value) != null ? _a2 : anyKf(kf).v;
58164
+ };
58165
+ var kfEasing = (kf) => {
58166
+ var _a2;
58167
+ return (_a2 = anyKf(kf).easing) != null ? _a2 : anyKf(kf).e;
58168
+ };
58169
+ var kfTangentIn = (kf) => anyKf(kf).tangentIn;
58170
+ var kfTangentOut = (kf) => anyKf(kf).tangentOut;
57965
58171
  var PxLoopSchema = implementsInterface()(px.object({
57966
58172
  segmentCount: px.number().optional(),
57967
- extend: px.enum([PxLoopExtend.before, PxLoopExtend.after]).optional(),
57968
- alternate: px.boolean().optional()
58173
+ repeatAt: px.enum([PxLoopRepeatAt.start, PxLoopRepeatAt.end]).optional(),
58174
+ direction: px.enum([PxLoopDirection.normal, PxLoopDirection.alternate]).optional()
57969
58175
  }));
57970
58176
  var PxPropertyAnimationSchema = implementsInterface()(px.object({
57971
58177
  value: PxKeyframeValueSchema.optional(),
57972
58178
  keyframes: px.array(PxKeyframeSchema).optional(),
57973
58179
  loop: px.union([PxLoopSchema, px.boolean()]).optional(),
57974
- autoOrient: px.boolean().optional()
58180
+ autoOrient: px.boolean().optional(),
58181
+ alongPathMode: px.enum([PxAlongPathMode.sampled, PxAlongPathMode.offsetPath]).optional()
57975
58182
  }));
57976
58183
  var PxTransformPartsSchema = implementsInterface()(px.object({
57977
58184
  translate: px.tuple([px.number(), px.number()]).optional(),
@@ -57995,18 +58202,17 @@ ${codeFrame}` : message);
57995
58202
  PxAnimationDefinitionSchema
57996
58203
  ]));
57997
58204
  var PxTriggerSchema = implementsInterface()(px.object({
57998
- startOn: px.enum(["load", "mouseOver", "click", "scrollIntoView", "programmatic"]).optional(),
57999
- outAction: px.enum(["continue", "pause", "reset", "reverse"]).optional(),
58205
+ startOn: px.enum([PxStartOn.load, PxStartOn.mouseOver, PxStartOn.click, PxStartOn.scrollIntoView, PxStartOn.programmatic], PX_TRIGGER_DEFAULTS.startOn).optional(),
58206
+ outAction: px.enum([PxOutAction.continue, PxOutAction.pause, PxOutAction.reset, PxOutAction.reverse], PX_TRIGGER_DEFAULTS.outAction).optional(),
58000
58207
  // What happens after a NATURAL finish — `'hold'` (default: keep the end state per
58001
- // `fill`) or `'reset'` (snap back to the start state). The trigger-vocabulary home of
58002
- // the old top-level `resetOnFinish: boolean` (read-legacy) — review §2.3: both
58003
- // "what happens at the end" knobs now sit side by side and share one style of value.
58004
- onFinish: px.enum(["hold", "reset"]).optional(),
58208
+ // `fill`) or `'reset'` (snap back to the start state). Pairs with `outAction` ("what
58209
+ // happens when the trigger condition ends"); both end-of-life knobs now read alike.
58210
+ finishAction: px.enum([PxFinishAction.hold, PxFinishAction.reset]).optional(),
58005
58211
  scrollIntoViewThreshold: px.number().optional()
58006
58212
  }));
58007
58213
  var PxGlyphSchema = implementsInterface()(px.object({
58008
58214
  width: px.number(),
58009
- d: px.string()
58215
+ pathData: px.string()
58010
58216
  }));
58011
58217
  var PxGlyphFontSchema = implementsInterface()(px.object({
58012
58218
  fontFamily: px.string(),
@@ -58021,11 +58227,17 @@ ${codeFrame}` : message);
58021
58227
  // Review §2.6: the schema now matches the declared type — a style preset is a flat
58022
58228
  // record of string|number attribute values, nothing nested.
58023
58229
  styles: px.record(px.record(px.union([px.string(), px.number()]))).optional(),
58024
- glyphs: px.record(PxGlyphFontSchema).optional()
58230
+ fonts: px.record(PxGlyphFontSchema).optional()
58025
58231
  }));
58026
- var PX_SCROLL_PHASES = ["cover", "contain", "entry", "exit", "entry-crossing", "exit-crossing"];
58027
58232
  var PxScrollRangePointSchema = implementsInterface()(px.object({
58028
- phase: px.enum(PX_SCROLL_PHASES).optional(),
58233
+ phase: px.enum([
58234
+ PxScrollPhase.cover,
58235
+ PxScrollPhase.contain,
58236
+ PxScrollPhase.entry,
58237
+ PxScrollPhase.exit,
58238
+ PxScrollPhase.entryCrossing,
58239
+ PxScrollPhase.exitCrossing
58240
+ ]).optional(),
58029
58241
  fraction: px.number().optional()
58030
58242
  }));
58031
58243
  var PxScrollRangeSchema = px.object({
@@ -58033,34 +58245,38 @@ ${codeFrame}` : message);
58033
58245
  end: PxScrollRangePointSchema.optional()
58034
58246
  });
58035
58247
  var PxScrollSchema = implementsInterface()(px.object({
58036
- driver: px.enum(["custom", "native"]).optional(),
58037
- kind: px.enum(["view", "scroll"]).optional(),
58038
- axis: px.enum(["block", "inline", "x", "y"]).optional(),
58039
- source: px.enum(["nearest", "root"]).optional(),
58248
+ kind: px.enum([PxScrollKind.view, PxScrollKind.scroll]).optional(),
58249
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
58250
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
58040
58251
  // Free-form: the two keywords `parent`/`scroller` plus any CSS selector.
58041
58252
  subject: px.string().optional(),
58042
58253
  smoothing: px.number().optional(),
58043
58254
  pin: px.boolean().optional(),
58044
- pinAlign: px.enum(["top", "center", "bottom"]).optional(),
58045
- pinTop: px.number().optional(),
58255
+ pinAlign: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
58256
+ pinOffset: px.number().optional(),
58046
58257
  pinDistance: px.number().optional(),
58047
58258
  range: PxScrollRangeSchema.optional()
58048
58259
  }));
58049
- var PxTimelinePinSchema = px.object({
58050
- align: px.enum(["top", "center", "bottom"]).optional(),
58051
- top: px.number().optional(),
58260
+ var PxTimelinePinSchema = implementsInterface()(px.object({
58261
+ align: px.enum([PxPinAlign.top, PxPinAlign.center, PxPinAlign.bottom]).optional(),
58262
+ offset: px.number().optional(),
58052
58263
  distance: px.number().optional()
58053
- });
58054
- var PxClockTimelineSchema = px.object({
58055
- type: px.literal("clock"),
58264
+ }));
58265
+ var PxTimelineEngineSchema = px.enum([PxTimelineEngineExtra.auto, PxTimelineEngineExtra.native, PxTimelineEngineExtra.js]).optional();
58266
+ var PxTimeTimelineSchema = implementsInterface()(px.object({
58267
+ type: px.literal("time").optional(),
58268
+ engine: PxTimelineEngineSchema,
58269
+ frameRate: px.number().optional(),
58056
58270
  // §2.8: duration is a property of the TIMELINE — how long one pass takes.
58057
58271
  duration: px.number().optional(),
58058
58272
  trigger: PxTriggerSchema.optional(),
58059
58273
  delay: px.number().optional(),
58060
58274
  iterations: px.union([px.number(), px.literal("infinite")]).optional(),
58061
- fill: px.enum(["forwards", "backwards", "both", "none"]).optional(),
58062
- direction: px.enum(["normal", "reverse", "alternate", "alternate-reverse"]).optional()
58063
- });
58275
+ // `fillMode` on the wire (CSS `animation-fill-mode`; the runtime view calls it `fill`)
58276
+ // — never `fill`, which is paint everywhere else in the format.
58277
+ fillMode: px.enum([PxFillMode.forwards, PxFillMode.backwards, PxFillMode.both, PxFillMode.none]).optional(),
58278
+ direction: px.enum([PxPlaybackDirection.normal, PxPlaybackDirection.reverse, PxPlaybackDirection.alternate, PxPlaybackDirection.alternateReverse]).optional()
58279
+ }));
58064
58280
  var scrollishTimelineShape = {
58065
58281
  // §2.8: duration is a property of the TIMELINE — under scrubbing it is the keyframe
58066
58282
  // span the scroll range maps onto.
@@ -58068,9 +58284,10 @@ ${codeFrame}` : message);
58068
58284
  // Finite repeat count IS meaningful when scrubbing — the scroll range maps onto
58069
58285
  // duration × iterations (rule D4; `'infinite'` cannot map to a range, so no literal here).
58070
58286
  iterations: px.number().optional(),
58071
- engine: px.enum(["custom", "native"]).optional(),
58072
- axis: px.enum(["block", "inline", "x", "y"]).optional(),
58073
- source: px.enum(["nearest", "root"]).optional(),
58287
+ engine: PxTimelineEngineSchema,
58288
+ frameRate: px.number().optional(),
58289
+ axis: px.enum([PxScrollAxis.block, PxScrollAxis.inline, PxScrollAxis.x, PxScrollAxis.y]).optional(),
58290
+ source: px.enum([PxScrollSource.nearest, PxScrollSource.root]).optional(),
58074
58291
  subject: px.string().optional(),
58075
58292
  // 'parent' | 'scroller' | any CSS selector
58076
58293
  smoothing: px.number().optional(),
@@ -58078,23 +58295,29 @@ ${codeFrame}` : message);
58078
58295
  pin: px.union([px.boolean(), PxTimelinePinSchema]).optional(),
58079
58296
  range: PxScrollRangeSchema.optional()
58080
58297
  };
58081
- var PxScrollTimelineSchema = px.object(__spreadValues2({ type: px.literal("scroll") }, scrollishTimelineShape));
58082
- var PxViewTimelineSchema = px.object(__spreadValues2({ type: px.literal("view") }, scrollishTimelineShape));
58298
+ var PxScrollTimelineSchema = implementsInterface()(
58299
+ px.object(__spreadValues2({ type: px.literal("scroll") }, scrollishTimelineShape))
58300
+ );
58301
+ var PxViewTimelineSchema = implementsInterface()(
58302
+ px.object(__spreadValues2({ type: px.literal("view") }, scrollishTimelineShape))
58303
+ );
58083
58304
  var PxTimelineSchema = px.discriminatedUnion("type", [
58084
- PxClockTimelineSchema,
58305
+ PxTimeTimelineSchema,
58306
+ // first = the member an absent `type` selects
58085
58307
  PxScrollTimelineSchema,
58086
58308
  PxViewTimelineSchema
58087
58309
  ]);
58088
58310
  var PxAnimatorConfigSchema = implementsInterface()(px.object({
58089
- mode: px.enum([PxAnimatorMode.auto, PxAnimatorMode.waapi, PxAnimatorMode.frames]).optional(),
58090
- // (`duration` lives INSIDE `timeline` on the wire — §2.8; the flat field below
58091
- // exists only on the runtime view, like the rest of the playback dynamics.)
58092
- frameRate: px.number().optional(),
58311
+ // (`mode`, `duration` and `frameRate` live INSIDE `timeline` on the wire — §2.8; they exist
58312
+ // at this level only on the runtime view, like the rest of the playback dynamics.)
58093
58313
  // THE spelling of "what advances progress" — clock / scroll / view (review §2.1).
58094
58314
  timeline: PxTimelineSchema.optional(),
58095
58315
  definitions: PxDefsSchema.optional(),
58096
58316
  animateById: px.record(PxElementAnimationSchema).optional(),
58097
- debugInstName: px.string().optional()
58317
+ debugGlobalName: px.string().optional(),
58318
+ // Declared HERE because this is a closed object: an undeclared key would be stripped by
58319
+ // `sanitize` and flagged by strict validation on our own files.
58320
+ version: px.string().optional()
58098
58321
  }));
58099
58322
  var PxBindingSchema = implementsInterface()(px.object({
58100
58323
  id: px.string(),
@@ -58143,7 +58366,7 @@ ${codeFrame}` : message);
58143
58366
  origin: PxAnimatableVec2Schema.optional()
58144
58367
  }));
58145
58368
  var PxMaskedByEffectSchema = implementsInterface()(px.object({
58146
- sourceId: px.string().optional(),
58369
+ source: px.string().optional(),
58147
58370
  maskType: px.enum([PxMaskType.luminance, PxMaskType.alpha]).optional(),
58148
58371
  maskUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
58149
58372
  maskContentUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
@@ -58153,7 +58376,7 @@ ${codeFrame}` : message);
58153
58376
  height: px.number().optional()
58154
58377
  }));
58155
58378
  var PxClipPathEffectSchema = implementsInterface()(px.object({
58156
- d: PxAnimatableStringSchema.optional()
58379
+ pathData: PxAnimatableStringSchema.optional()
58157
58380
  }));
58158
58381
  var PxStrokeTrimEffectSchema = implementsInterface()(px.object({
58159
58382
  offset: PxAnimatableNumberSchema.optional(),
@@ -58166,9 +58389,10 @@ ${codeFrame}` : message);
58166
58389
  timeCrop: px.tuple([px.number(), px.number()]).optional()
58167
58390
  }));
58168
58391
  var PxCloneEffectSchema = implementsInterface()(px.object({
58169
- // Contextual kind — the `type` convention, see `PxNodeBase.type`.
58170
- type: px.enum([PxCloneType.content]).optional(),
58171
- sourceId: px.string().optional(),
58392
+ // Subtractive on purpose: the `<use>` can only point at one wrapper layer of the
58393
+ // source, so the choices form a ladder — 'translate' now, maybe 'transform' later.
58394
+ without: px.enum([PxCloneWithout.translate]).optional(),
58395
+ source: px.string().optional(),
58172
58396
  retime: PxRetimeEffectSchema.optional()
58173
58397
  }));
58174
58398
  var PxGradientStopSchema = implementsInterface()(px.object({
@@ -58189,13 +58413,13 @@ ${codeFrame}` : message);
58189
58413
  radius: PxAnimatableNumberSchema.optional(),
58190
58414
  focal: PxAnimatableVec2Schema.optional(),
58191
58415
  stops: PxAnimatableGradientStopsSchema.optional(),
58192
- gradientUnits: px.enum([PxGradientUnits.userSpaceOnUse, PxGradientUnits.objectBoundingBox]).optional(),
58416
+ gradientUnits: px.enum([PxUnits.userSpaceOnUse, PxUnits.objectBoundingBox]).optional(),
58193
58417
  spreadMethod: px.enum([PxGradientSpreadMethod.pad, PxGradientSpreadMethod.reflect, PxGradientSpreadMethod.repeat]).optional(),
58194
58418
  gradientTransform: px.string().optional()
58195
58419
  }));
58196
58420
  var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
58197
58421
  var PxTextPathEffectSchema = implementsInterface()(px.object({
58198
- path: px.string(),
58422
+ pathData: px.string(),
58199
58423
  pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend]).optional(),
58200
58424
  lengthAdjust: px.enum([PxLengthAdjust.spacing, PxLengthAdjust.spacingAndGlyphs]).optional(),
58201
58425
  method: px.enum([PxTextPathMethod.align, PxTextPathMethod.stretch]).optional(),
@@ -58235,20 +58459,100 @@ ${codeFrame}` : message);
58235
58459
  walk(root, "root");
58236
58460
  return warnings;
58237
58461
  }
58462
+ function validateGlyphFontRefs(root, fonts) {
58463
+ if (!fonts || !Object.keys(fonts).length) return [];
58464
+ const problems = [];
58465
+ const walk = (node, path, inherited, inGlyphText) => {
58466
+ var _a2, _b;
58467
+ if (!node) return;
58468
+ const own = typeof node.fontFamily === "string" ? node.fontFamily : void 0;
58469
+ const family = own != null ? own : inherited;
58470
+ const isGlyphText = inGlyphText || node.type === "text" && !!((_b = (_a2 = node.effects) == null ? void 0 : _a2.text) == null ? void 0 : _b.useGlyphs);
58471
+ if (isGlyphText && own && !Object.prototype.hasOwnProperty.call(fonts, own)) {
58472
+ const problem = path + ': glyph-mode text uses font-family "' + own + '", which has no entry in animator.definitions.fonts';
58473
+ if (!problems.includes(problem)) problems.push(problem);
58474
+ }
58475
+ if (Array.isArray(node.children)) {
58476
+ node.children.forEach((c, i) => walk(c, path + ".children[" + i + "]", family, isGlyphText));
58477
+ }
58478
+ };
58479
+ walk(root, "root", void 0, false);
58480
+ return problems;
58481
+ }
58482
+ function validateEasingRefs(root, easings) {
58483
+ const problems = [];
58484
+ const walk = (node, path) => {
58485
+ if (Array.isArray(node)) {
58486
+ node.forEach((item, i) => walk(item, path + "[" + i + "]"));
58487
+ return;
58488
+ }
58489
+ if (!node || typeof node !== "object") return;
58490
+ const easing = node.easing;
58491
+ if (typeof easing === "string" && !(easings && Object.prototype.hasOwnProperty.call(easings, easing))) {
58492
+ const problem = path + '.easing: "' + easing + '" names no entry in animator.definitions.easings \u2014 it will play linear';
58493
+ if (!problems.includes(problem)) problems.push(problem);
58494
+ }
58495
+ for (const [key, value] of Object.entries(node)) {
58496
+ if (key === "easing") continue;
58497
+ if (value && typeof value === "object") walk(value, path + "." + key);
58498
+ }
58499
+ };
58500
+ walk(root, "root");
58501
+ return problems;
58502
+ }
58503
+ function validateVersionStamp(doc) {
58504
+ var _a2;
58505
+ const version = (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.version;
58506
+ if (version === void 0) return [];
58507
+ if (parseWireVersion(version) !== void 0) return [];
58508
+ return ["root.animator.version: " + JSON.stringify(version) + ' is not a version stamp ("a.b" or "a.b.c") \u2014 it reads as unstamped'];
58509
+ }
58510
+ function validateDocument(doc, opts) {
58511
+ var _a2;
58512
+ const strict = (opts == null ? void 0 : opts.strict) !== false;
58513
+ const ctx = { errors: [], warnings: [], strict };
58514
+ const problems = PxAnimatedSvgDocumentSchema.isValid(doc, ctx, ["root"]) ? [] : [...ctx.errors];
58515
+ if (doc && typeof doc === "object") {
58516
+ for (const w of validateNodeEffects(doc, { strict })) {
58517
+ if (!problems.includes(w)) problems.push(w);
58518
+ }
58519
+ const defs = (_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.definitions;
58520
+ for (const w of validateGlyphFontRefs(doc, defs == null ? void 0 : defs.fonts)) {
58521
+ if (!problems.includes(w)) problems.push(w);
58522
+ }
58523
+ for (const w of validateEasingRefs(doc, defs == null ? void 0 : defs.easings)) {
58524
+ if (!problems.includes(w)) problems.push(w);
58525
+ }
58526
+ for (const w of validateVersionStamp(doc)) {
58527
+ if (!problems.includes(w)) problems.push(w);
58528
+ }
58529
+ }
58530
+ return problems;
58531
+ }
58238
58532
  var PxNodeBase = px.openObject({
58239
58533
  // CONVENTION (SCHEMA-DESIGN R1 / issues N4): `type` is the ONE word for "what
58240
58534
  // kind of thing is this", discriminated by its CARRIER — here the node TAG
58241
- // (`rect`, `text`), and inside a sub-object that object's kind (`clone.type`,
58535
+ // (`rect`, `text`), and inside a sub-object that object's kind (`fillGradient.type`,
58242
58536
  // `fillGradient.type`, editor `preset.type`). Each sits in its own object, so
58243
58537
  // the carrier disambiguates completely; synonyms (`cloneKind`, `presetShape`)
58244
58538
  // would add words that all mean "type" and still need the carrier to read.
58245
58539
  // Guarding a `type` SLOT against a wrong VALUE is the job of strict enums
58246
58540
  // (issues V3), never of distinct key names.
58247
58541
  type: px.string(),
58542
+ // The escape hatch for elements that carry a REAL `type` attribute — `<feTurbulence
58543
+ // type="fractalNoise">`, `<feFuncR type="table">`, `<feColorMatrix type="saturate">`.
58544
+ // `type` is taken by the tag name, so the attribute travels here and the renderer puts
58545
+ // it back (`PxAnimatorDOM.renderNode`, `PxRnRender`). Declared here — not merely
58546
+ // documented — because a wire key that is not in a schema is invisible to the
58547
+ // minifier's reserve list and gets renamed (MINIFICATION-BOUNDARY-PLAN.md §1.1).
58548
+ domType: px.string().optional(),
58549
+ // Text content of a `<text>` / `<tspan>`. Declared, so a non-string value is a schema error
58550
+ // and the minifier reserves the key; `text` is NOT an alias for it and is not read anywhere.
58551
+ textContent: px.string().optional(),
58248
58552
  id: px.string().optional(),
58249
58553
  meta: px.any().optional(),
58250
58554
  // Player-effects bucket emitted by the Editor's lightweight design format.
58251
- // Consumed and removed by `applyPlayerEffects` before any other normalisation
58555
+ // Consumed and removed by `applyPlayerEffects` before any other normalization
58252
58556
  // (see `createAnimatorImpl`), so downstream code never sees it.
58253
58557
  effects: PxEffectsSchema.optional(),
58254
58558
  // `PxElementAnimation` (not just `PxAnimationDefinition`) — accepts
@@ -58297,7 +58601,7 @@ ${codeFrame}` : message);
58297
58601
  return cloned;
58298
58602
  }
58299
58603
  function generateNewIds(doc) {
58300
- var _a, _b;
58604
+ var _a2, _b;
58301
58605
  const cloned = deepClone(doc);
58302
58606
  const idMap = /* @__PURE__ */ new Map();
58303
58607
  const hashRefAttrs = /* @__PURE__ */ new Set(["href", "xlink:href"]);
@@ -58315,7 +58619,8 @@ ${codeFrame}` : message);
58315
58619
  "flood-color",
58316
58620
  "lighting-color"
58317
58621
  ]);
58318
- const directIdRefAttrs = /* @__PURE__ */ new Set(["sourceId", "targetId", "boundElementId"]);
58622
+ const directIdRefAttrs = /* @__PURE__ */ new Set(["targetId", "boundElementId"]);
58623
+ const isEffectSourceRef = (key, parentKey) => key === "source" && (parentKey === "maskedBy" || parentKey === "clone");
58319
58624
  function collectIds(node) {
58320
58625
  if (!node || typeof node !== "object") return;
58321
58626
  if (node.id && typeof node.id === "string") {
@@ -58332,7 +58637,7 @@ ${codeFrame}` : message);
58332
58637
  }
58333
58638
  }
58334
58639
  }
58335
- function updateRefs(node) {
58640
+ function updateRefs(node, parentKey) {
58336
58641
  if (!node || typeof node !== "object") return;
58337
58642
  for (const [key, value] of Object.entries(node)) {
58338
58643
  if (key === "children") {
@@ -58352,7 +58657,7 @@ ${codeFrame}` : message);
58352
58657
  }
58353
58658
  } else if (urlRefAttrs.has(key)) {
58354
58659
  node[key] = replaceUrlRefs(value, idMap);
58355
- } else if (directIdRefAttrs.has(key)) {
58660
+ } else if (directIdRefAttrs.has(key) || isEffectSourceRef(key, parentKey)) {
58356
58661
  const hasHash = value.startsWith("#");
58357
58662
  const newId = idMap.get(hasHash ? value.slice(1) : value);
58358
58663
  if (newId) {
@@ -58368,13 +58673,13 @@ ${codeFrame}` : message);
58368
58673
  }
58369
58674
  }
58370
58675
  } else if (typeof value === "object" && value !== null) {
58371
- updateRefs(value);
58676
+ updateRefs(value, key);
58372
58677
  }
58373
58678
  }
58374
58679
  }
58375
58680
  collectIds(cloned);
58376
58681
  updateRefs(cloned);
58377
- const docAnimate = (_a = cloned.animator) == null ? void 0 : _a.animateById;
58682
+ const docAnimate = (_a2 = cloned.animator) == null ? void 0 : _a2.animateById;
58378
58683
  if (docAnimate && typeof docAnimate === "object") {
58379
58684
  const updatedAnimate = {};
58380
58685
  for (const [key, anim] of Object.entries(docAnimate)) {
@@ -58431,7 +58736,7 @@ ${codeFrame}` : message);
58431
58736
  if (nameLower.startsWith("on")) return true;
58432
58737
  return false;
58433
58738
  }
58434
- function sanitiseAttributeValue(name, value) {
58739
+ function sanitizeAttributeValue(name, value) {
58435
58740
  const nameLower = name.toLowerCase();
58436
58741
  if (isDangerousAttrName(nameLower)) {
58437
58742
  console.warn("Attribute blocked (event handler / dangerous): ", nameLower);
@@ -58456,10 +58761,10 @@ ${codeFrame}` : message);
58456
58761
  return value;
58457
58762
  }
58458
58763
  function resolveStyle(style, defs) {
58459
- var _a;
58764
+ var _a2;
58460
58765
  if (!style) return void 0;
58461
58766
  if (typeof style === "string") {
58462
- return (_a = defs == null ? void 0 : defs.styles) == null ? void 0 : _a[style];
58767
+ return (_a2 = defs == null ? void 0 : defs.styles) == null ? void 0 : _a2[style];
58463
58768
  }
58464
58769
  return style;
58465
58770
  }
@@ -58470,18 +58775,18 @@ ${codeFrame}` : message);
58470
58775
  if (INTERNAL_ATTRS.has(key)) continue;
58471
58776
  if (key === "style") continue;
58472
58777
  let value = props[rawKey];
58473
- if (COLOUR_ATTR_NAMES.has(key) && Array.isArray(value)) {
58778
+ if (COLOR_ATTR_NAMES.has(key) && Array.isArray(value)) {
58474
58779
  propsCopy[key] = toRGBA(value);
58475
58780
  } else if (key === "transform" && value !== null && typeof value === "object" && !Array.isArray(value) && !value.keyframes) {
58476
58781
  const parts = value.value && typeof value.value === "object" ? value.value : value;
58477
- propsCopy["transform"] = composeTransformParts(parts, { withUnits: false });
58782
+ propsCopy[TRANSFORM_ATTR] = composeTransformParts(parts, { withUnits: false });
58478
58783
  } else if (TRANSFORM_FN_NAMES.has(key)) {
58479
58784
  if (Array.isArray(value)) {
58480
58785
  if (key === "translate") value = value.map((v) => v + "px");
58481
58786
  value = value.join(",");
58482
58787
  }
58483
58788
  if (key === "rotate") value = value + "deg";
58484
- propsCopy["transform"] = key + "(" + value + ")";
58789
+ propsCopy[TRANSFORM_ATTR] = key + "(" + value + ")";
58485
58790
  } else if (Array.isArray(value)) {
58486
58791
  propsCopy[key] = value.join(",");
58487
58792
  } else if (value !== void 0 && value !== null) {
@@ -58491,8 +58796,7 @@ ${codeFrame}` : message);
58491
58796
  return propsCopy;
58492
58797
  }
58493
58798
  function getKfTranslate(kf) {
58494
- var _a;
58495
- const v = (_a = kf.value) != null ? _a : kf.v;
58799
+ const v = kfValue(kf);
58496
58800
  if (!v) return void 0;
58497
58801
  if (Array.isArray(v) && v.length >= 2 && typeof v[0] === "number" && typeof v[1] === "number") {
58498
58802
  return [v[0], v[1]];
@@ -58502,31 +58806,27 @@ ${codeFrame}` : message);
58502
58806
  return void 0;
58503
58807
  }
58504
58808
  function getKfTime(kf) {
58505
- var _a, _b;
58506
- return (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0;
58809
+ return kfTime(kf);
58507
58810
  }
58508
58811
  function getKfEasing(kf) {
58509
- var _a;
58510
- return (_a = kf.easing) != null ? _a : kf.e;
58812
+ return kfEasing(kf);
58511
58813
  }
58512
58814
  function propAnimIsMotionPath(anim) {
58513
- var _a, _b;
58514
58815
  const kfs = anim.keyframes;
58515
58816
  if (!Array.isArray(kfs)) return false;
58516
58817
  if (anim.autoOrient) return true;
58517
58818
  for (const kf of kfs) {
58518
- if (((_a = kf.tangentIn) != null ? _a : kf.ti) || ((_b = kf.tangentOut) != null ? _b : kf.to)) return true;
58819
+ if (kfTangentIn(kf) || kfTangentOut(kf)) return true;
58519
58820
  }
58520
58821
  return false;
58521
58822
  }
58522
58823
  var _segmentCache = /* @__PURE__ */ new WeakMap();
58523
58824
  function getSegmentCache(prevKf, nextKf, prevPos, nextPos) {
58524
- var _a, _b;
58525
58825
  let byNext = _segmentCache.get(prevKf);
58526
58826
  const existing = byNext == null ? void 0 : byNext.get(nextKf);
58527
58827
  if (existing) return existing;
58528
- const to = (_a = prevKf.tangentOut) != null ? _a : prevKf.to;
58529
- const ti = (_b = nextKf.tangentIn) != null ? _b : nextKf.ti;
58828
+ const to = kfTangentOut(prevKf);
58829
+ const ti = kfTangentIn(nextKf);
58530
58830
  const P1 = [prevPos[0] + (to ? to[0] : 0), prevPos[1] + (to ? to[1] : 0)];
58531
58831
  const P2 = [nextPos[0] + (ti ? ti[0] : 0), nextPos[1] + (ti ? ti[1] : 0)];
58532
58832
  const lut = bezier2D_arcLengthLUT(prevPos, P1, P2, nextPos);
@@ -58575,13 +58875,13 @@ ${codeFrame}` : message);
58575
58875
  var DEFAULT_FLATNESS_TOL = 0.5;
58576
58876
  var DEFAULT_ROTATION_TOL = 5;
58577
58877
  var DEFAULT_MAX_SAMPLES = 32;
58578
- function materialiseMotionPathInPropAnim(anim, opts) {
58579
- var _a, _b, _c;
58878
+ function materializeMotionPathInPropAnim(anim, opts) {
58879
+ var _a2, _b, _c;
58580
58880
  if (!propAnimIsMotionPath(anim)) return anim;
58581
58881
  const kfs = anim.keyframes;
58582
58882
  if (!Array.isArray(kfs) || kfs.length < 2) return anim;
58583
58883
  const autoOrient = !!anim.autoOrient;
58584
- const flatnessTol = (_a = opts == null ? void 0 : opts.flatnessTolerance) != null ? _a : DEFAULT_FLATNESS_TOL;
58884
+ const flatnessTol = (_a2 = opts == null ? void 0 : opts.flatnessTolerance) != null ? _a2 : DEFAULT_FLATNESS_TOL;
58585
58885
  const rotationTol = (_b = opts == null ? void 0 : opts.rotationTolerance) != null ? _b : DEFAULT_ROTATION_TOL;
58586
58886
  const maxSamples = (_c = opts == null ? void 0 : opts.maxSamplesPerSegment) != null ? _c : DEFAULT_MAX_SAMPLES;
58587
58887
  const out = [];
@@ -58607,7 +58907,7 @@ ${codeFrame}` : message);
58607
58907
  if (autoOrient && i > 0) {
58608
58908
  insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol);
58609
58909
  }
58610
- materialiseSegment(out, prevKf, nextKf, prevPos, nextPos, autoOrient, flatnessTol, rotationTol, maxSamples);
58910
+ materializeSegment(out, prevKf, nextKf, prevPos, nextPos, autoOrient, flatnessTol, rotationTol, maxSamples);
58611
58911
  }
58612
58912
  const lastInE = getKfEasing(kfs[kfs.length - 1]);
58613
58913
  if (lastInE) out[out.length - 1].e = lastInE;
@@ -58617,10 +58917,9 @@ ${codeFrame}` : message);
58617
58917
  return result;
58618
58918
  }
58619
58919
  function unwrapAutoOrientRotations(kfs) {
58620
- var _a;
58621
58920
  let prev;
58622
58921
  for (const kf of kfs) {
58623
- const v = (_a = kf.v) != null ? _a : kf.value;
58922
+ const v = kfValue(kf);
58624
58923
  if (!v || typeof v.rotate !== "number") continue;
58625
58924
  if (prev === void 0) {
58626
58925
  prev = v.rotate;
@@ -58637,8 +58936,7 @@ ${codeFrame}` : message);
58637
58936
  return { t: time, v: value };
58638
58937
  }
58639
58938
  function getKfValueParts(kf) {
58640
- var _a;
58641
- const v = (_a = kf.value) != null ? _a : kf.v;
58939
+ const v = kfValue(kf);
58642
58940
  if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
58643
58941
  return v;
58644
58942
  }
@@ -58699,9 +58997,8 @@ ${codeFrame}` : message);
58699
58997
  return d;
58700
58998
  }
58701
58999
  function insertSharpCornerStepKfIfNeeded(out, prevKf, nextKf, prevPos, nextPos, rotationTol) {
58702
- var _a;
58703
59000
  const lastKf = out[out.length - 1];
58704
- const lastV = (_a = lastKf.v) != null ? _a : lastKf.value;
59001
+ const lastV = kfValue(lastKf);
58705
59002
  const prevExit = lastV == null ? void 0 : lastV.rotate;
58706
59003
  if (typeof prevExit !== "number") return;
58707
59004
  const boundaryV = getKfValueParts(prevKf);
@@ -58724,7 +59021,7 @@ ${codeFrame}` : message);
58724
59021
  out.push(makeOutKf(stepTime, dupValue));
58725
59022
  }
58726
59023
  var CORNER_STEP_AFTER_BOUNDARY_MS = 0.05;
58727
- function materialiseSegment(out, prevKf, nextKf, prevPos, nextPos, autoOrient, flatnessTol, rotationTol, maxSamples) {
59024
+ function materializeSegment(out, prevKf, nextKf, prevPos, nextPos, autoOrient, flatnessTol, rotationTol, maxSamples) {
58728
59025
  const seg = getSegmentCache(prevKf, nextKf, prevPos, nextPos);
58729
59026
  const prevTime = getKfTime(prevKf);
58730
59027
  const nextTime = getKfTime(nextKf);
@@ -58847,16 +59144,16 @@ ${codeFrame}` : message);
58847
59144
  const cross = (q[0] - pA[0]) * dy - (q[1] - pA[1]) * dx;
58848
59145
  return Math.abs(cross) / Math.sqrt(len2);
58849
59146
  }
58850
- function materialiseMotionPathsInTree(root, opts) {
58851
- const out = walkAndMaterialise(root, opts);
59147
+ function materializeMotionPathsInTree(root, opts) {
59148
+ const out = walkAndMaterialize(root, opts);
58852
59149
  return out != null ? out : root;
58853
59150
  }
58854
- function walkAndMaterialise(node, opts) {
59151
+ function walkAndMaterialize(node, opts) {
58855
59152
  let newChildren;
58856
59153
  if (node.children) {
58857
59154
  for (let i = 0; i < node.children.length; i++) {
58858
59155
  const ch = node.children[i];
58859
- const ret = walkAndMaterialise(ch, opts);
59156
+ const ret = walkAndMaterialize(ch, opts);
58860
59157
  if (ret !== null) {
58861
59158
  if (!newChildren) newChildren = node.children.slice();
58862
59159
  newChildren[i] = ret;
@@ -58869,9 +59166,9 @@ ${codeFrame}` : message);
58869
59166
  const animDef = animBucket;
58870
59167
  const transformAnim = animDef.transform;
58871
59168
  if (transformAnim && typeof transformAnim === "object" && propAnimIsMotionPath(transformAnim)) {
58872
- const materialised = materialiseMotionPathInPropAnim(transformAnim, opts);
58873
- if (materialised !== transformAnim) {
58874
- newAnimate = __spreadProps2(__spreadValues2({}, animDef), { transform: materialised });
59169
+ const materialized = materializeMotionPathInPropAnim(transformAnim, opts);
59170
+ if (materialized !== transformAnim) {
59171
+ newAnimate = __spreadProps2(__spreadValues2({}, animDef), { transform: materialized });
58875
59172
  }
58876
59173
  }
58877
59174
  }
@@ -58972,8 +59269,8 @@ ${codeFrame}` : message);
58972
59269
  return typeof value === "string" && extractPathData(value) !== void 0;
58973
59270
  }
58974
59271
  function normalizePathValue(value) {
58975
- if (value && typeof value === "object" && typeof value.path === "string") {
58976
- const d = extractPathData(value.path);
59272
+ if (value && typeof value === "object" && typeof value.pathData === "string") {
59273
+ const d = extractPathData(value.pathData);
58977
59274
  return d ? { paths: parseSvgPathToBezier(d) } : value;
58978
59275
  }
58979
59276
  if (value && typeof value === "object" && "paths" in value) {
@@ -59012,21 +59309,21 @@ ${codeFrame}` : message);
59012
59309
  return value;
59013
59310
  }
59014
59311
  function resolveEasing(easing, defs) {
59015
- var _a;
59312
+ var _a2;
59016
59313
  if (!easing) return void 0;
59017
59314
  if (Array.isArray(easing)) {
59018
59315
  return easing;
59019
59316
  }
59020
- if ((_a = defs == null ? void 0 : defs.easings) == null ? void 0 : _a[easing]) {
59317
+ if ((_a2 = defs == null ? void 0 : defs.easings) == null ? void 0 : _a2[easing]) {
59021
59318
  return defs.easings[easing];
59022
59319
  }
59023
59320
  console.warn("Unknown easing name: " + easing);
59024
59321
  return void 0;
59025
59322
  }
59026
59323
  function resolveAnimation(animRef, defs) {
59027
- var _a;
59324
+ var _a2;
59028
59325
  if (typeof animRef === "string") {
59029
- const resolved = (_a = defs == null ? void 0 : defs.animations) == null ? void 0 : _a[animRef];
59326
+ const resolved = (_a2 = defs == null ? void 0 : defs.animations) == null ? void 0 : _a2[animRef];
59030
59327
  if (!resolved) {
59031
59328
  console.warn("Unknown animation name: " + animRef);
59032
59329
  }
@@ -59051,13 +59348,13 @@ ${codeFrame}` : message);
59051
59348
  return results;
59052
59349
  }
59053
59350
  function interpolateValue(propName, a, b, t) {
59054
- var _a, _b;
59351
+ var _a2, _b;
59055
59352
  if (propName === "d") {
59056
- const aPaths = (_a = a == null ? void 0 : a.paths) != null ? _a : Array.isArray(a) ? a : [];
59353
+ const aPaths = (_a2 = a == null ? void 0 : a.paths) != null ? _a2 : Array.isArray(a) ? a : [];
59057
59354
  const bPaths = (_b = b == null ? void 0 : b.paths) != null ? _b : Array.isArray(b) ? b : [];
59058
59355
  return { paths: interpolateBeziers(aPaths, bPaths, t) };
59059
59356
  }
59060
- if (COLOUR_ATTR_NAMES.has(propName)) {
59357
+ if (COLOR_ATTR_NAMES.has(propName)) {
59061
59358
  return interpolateColor(a || [0, 0, 0, 1], b || [0, 0, 0, 1], t);
59062
59359
  }
59063
59360
  if (propName === "transform" && typeof a === "object" && a !== null && !Array.isArray(a) && typeof b === "object" && b !== null && !Array.isArray(b)) {
@@ -59089,11 +59386,11 @@ ${codeFrame}` : message);
59089
59386
  return out;
59090
59387
  }
59091
59388
  function expandLoopKeyframes(propName, keyframes, loop, duration) {
59092
- var _a, _b, _c, _d, _e;
59389
+ var _a2, _b, _c, _d, _e;
59093
59390
  const totalIntervals = keyframes.length - 1;
59094
- const segCount = clamp((_a = loop.segmentCount) != null ? _a : totalIntervals, 1, totalIntervals);
59391
+ const segCount = clamp((_a2 = loop.segmentCount) != null ? _a2 : totalIntervals, 1, totalIntervals);
59095
59392
  let segKfs;
59096
- if (loop.extend === PxLoopExtend.before) {
59393
+ if (loop.repeatAt === PxLoopRepeatAt.start) {
59097
59394
  segKfs = keyframes.slice(0, segCount + 1);
59098
59395
  } else {
59099
59396
  segKfs = keyframes.slice(totalIntervals - segCount);
@@ -59101,7 +59398,7 @@ ${codeFrame}` : message);
59101
59398
  const firstT = (_b = keyframes[0].t) != null ? _b : 0;
59102
59399
  const lastT = (_c = keyframes[keyframes.length - 1].t) != null ? _c : 0;
59103
59400
  let fillStart, fillEnd;
59104
- if (loop.extend === PxLoopExtend.before) {
59401
+ if (loop.repeatAt === PxLoopRepeatAt.start) {
59105
59402
  fillStart = 0;
59106
59403
  fillEnd = firstT;
59107
59404
  } else {
@@ -59114,26 +59411,23 @@ ${codeFrame}` : message);
59114
59411
  const segEndT = (_e = segKfs[segKfs.length - 1].t) != null ? _e : 0;
59115
59412
  const segDuration = segEndT - segStartT;
59116
59413
  if (segDuration <= 0) return keyframes;
59117
- const template = segKfs.map((kf) => {
59118
- var _a2, _b2;
59119
- return {
59120
- relT: (kf.t - segStartT) / segDuration,
59121
- v: kf.v,
59122
- e: kf.e,
59123
- tangentIn: (_a2 = kf.tangentIn) != null ? _a2 : kf.ti,
59124
- tangentOut: (_b2 = kf.tangentOut) != null ? _b2 : kf.to
59125
- };
59126
- });
59414
+ const template = segKfs.map((kf) => ({
59415
+ relT: (kf.t - segStartT) / segDuration,
59416
+ v: kf.v,
59417
+ e: kf.e,
59418
+ tangentIn: kfTangentIn(kf),
59419
+ tangentOut: kfTangentOut(kf)
59420
+ }));
59127
59421
  const fullReps = Math.floor(fillDuration / segDuration);
59128
59422
  const remainder = fillDuration - fullReps * segDuration;
59129
59423
  const partialFraction = remainder / segDuration;
59130
59424
  const looped = [];
59131
- const separateBoundary = loop.extend !== PxLoopExtend.before;
59425
+ const separateBoundary = loop.repeatAt !== PxLoopRepeatAt.start;
59132
59426
  const originalTerminalKf = keyframes[keyframes.length - 1];
59133
59427
  let terminalEasingOverride;
59134
59428
  let hasTerminalEasingOverride = false;
59135
59429
  function appendRep(repStart, isReversed, partial) {
59136
- var _a2;
59430
+ var _a3;
59137
59431
  let entries;
59138
59432
  if (isReversed) {
59139
59433
  entries = [];
@@ -59170,7 +59464,7 @@ ${codeFrame}` : message);
59170
59464
  return;
59171
59465
  }
59172
59466
  const prevKf = looped.length > 0 ? looped[looped.length - 1] : originalTerminalKf;
59173
- const isBoundary = separateBoundary && i === 0 && prevKf !== void 0 && Math.abs(((_a2 = prevKf.t) != null ? _a2 : 0) - (repStart + entry.relT * segDuration)) < 1e-9;
59467
+ const isBoundary = separateBoundary && i === 0 && prevKf !== void 0 && Math.abs(((_a3 = prevKf.t) != null ? _a3 : 0) - (repStart + entry.relT * segDuration)) < 1e-9;
59174
59468
  if (isBoundary) {
59175
59469
  if (deepEqualValue(prevKf.v, entry.v)) {
59176
59470
  if (looped.length > 0) {
@@ -59236,30 +59530,30 @@ ${codeFrame}` : message);
59236
59530
  looped.push(pushed);
59237
59531
  }
59238
59532
  }
59239
- if (loop.extend === PxLoopExtend.before) {
59533
+ if (loop.repeatAt === PxLoopRepeatAt.start) {
59240
59534
  if (partialFraction > 1e-9) {
59241
- const isReversed = !!loop.alternate && fullReps % 2 === 0;
59535
+ const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
59242
59536
  appendRepTail(fillStart, isReversed, partialFraction);
59243
59537
  }
59244
59538
  for (let rep = 0; rep < fullReps; rep++) {
59245
59539
  const distFromBoundary = fullReps - 1 - rep;
59246
- const isReversed = !!loop.alternate && distFromBoundary % 2 === 0;
59540
+ const isReversed = loop.direction === PxLoopDirection.alternate && distFromBoundary % 2 === 0;
59247
59541
  const repStart = fillStart + remainder + rep * segDuration;
59248
59542
  appendRep(repStart, isReversed);
59249
59543
  }
59250
59544
  } else {
59251
59545
  for (let rep = 0; rep < fullReps; rep++) {
59252
- const isReversed = !!loop.alternate && rep % 2 === 0;
59546
+ const isReversed = loop.direction === PxLoopDirection.alternate && rep % 2 === 0;
59253
59547
  const repStart = fillStart + rep * segDuration;
59254
59548
  appendRep(repStart, isReversed);
59255
59549
  }
59256
59550
  if (partialFraction > 1e-9) {
59257
- const isReversed = !!loop.alternate && fullReps % 2 === 0;
59551
+ const isReversed = loop.direction === PxLoopDirection.alternate && fullReps % 2 === 0;
59258
59552
  const repStart = fillStart + fullReps * segDuration;
59259
59553
  appendRep(repStart, isReversed, partialFraction);
59260
59554
  }
59261
59555
  }
59262
- if (loop.extend === PxLoopExtend.before) {
59556
+ if (loop.repeatAt === PxLoopRepeatAt.start) {
59263
59557
  return [...looped, ...keyframes];
59264
59558
  } else {
59265
59559
  if (hasTerminalEasingOverride && keyframes.length > 0) {
@@ -59271,34 +59565,34 @@ ${codeFrame}` : message);
59271
59565
  }
59272
59566
  }
59273
59567
  function normalizeKeyframes(propName, propAnim, duration, defs) {
59274
- var _a, _b, _c, _d, _e, _f, _g;
59568
+ var _a2;
59275
59569
  const keyframes = propAnim.keyframes || [];
59276
59570
  const normalized = [];
59277
59571
  for (const kf of keyframes) {
59278
- const timePct = (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0;
59279
- let value = (_c = kf.value) != null ? _c : kf.v;
59280
- const easing = (_d = kf.easing) != null ? _d : kf.e;
59572
+ const timePct = kfTime(kf);
59573
+ let value = kfValue(kf);
59574
+ const easing = kfEasing(kf);
59281
59575
  if (propName === "d") {
59282
59576
  value = normalizePathValue(value);
59283
59577
  }
59284
59578
  const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
59285
- if (COLOUR_ATTR_NAMES.has(propNameKebab)) {
59286
- value = (_e = parseColor(value)) != null ? _e : value;
59579
+ if (COLOR_ATTR_NAMES.has(propNameKebab)) {
59580
+ value = (_a2 = parseColor(value)) != null ? _a2 : value;
59287
59581
  }
59288
59582
  const normKf = {
59289
59583
  t: timePct,
59290
59584
  v: value,
59291
59585
  e: resolveEasing(easing, defs)
59292
59586
  };
59293
- const tIn = (_f = kf.tangentIn) != null ? _f : kf.ti;
59294
- const tOut = (_g = kf.tangentOut) != null ? _g : kf.to;
59587
+ const tIn = kfTangentIn(kf);
59588
+ const tOut = kfTangentOut(kf);
59295
59589
  if (tIn) normKf.tangentIn = tIn;
59296
59590
  if (tOut) normKf.tangentOut = tOut;
59297
59591
  normalized.push(normKf);
59298
59592
  }
59299
59593
  normalized.sort((a, b) => {
59300
- var _a2, _b2;
59301
- return ((_a2 = a.t) != null ? _a2 : 0) - ((_b2 = b.t) != null ? _b2 : 0);
59594
+ var _a3, _b;
59595
+ return ((_a3 = a.t) != null ? _a3 : 0) - ((_b = b.t) != null ? _b : 0);
59302
59596
  });
59303
59597
  const loopRaw = propAnim.loop;
59304
59598
  const loop = loopRaw === true ? {} : loopRaw || void 0;
@@ -59316,24 +59610,26 @@ ${codeFrame}` : message);
59316
59610
  }
59317
59611
  return merged;
59318
59612
  }
59319
- function materialiseInternalLoopsInPropAnim(propName, propAnim, duration) {
59613
+ function materializeInternalLoopsInPropAnim(propName, propAnim, duration) {
59320
59614
  const loopRaw = propAnim.loop;
59321
59615
  if (loopRaw === void 0 || loopRaw === null || loopRaw === false) return propAnim;
59322
59616
  const loop = loopRaw === true ? {} : loopRaw;
59323
59617
  const rawKfs = propAnim.keyframes;
59324
59618
  if (!Array.isArray(rawKfs) || rawKfs.length < 2) return propAnim;
59325
59619
  const propNameKebab = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
59326
- const isColour = COLOUR_ATTR_NAMES.has(propNameKebab);
59620
+ const isColor = COLOR_ATTR_NAMES.has(propNameKebab);
59327
59621
  const kfs = rawKfs.map((kf) => {
59328
- var _a, _b, _c, _d, _e, _f, _g, _h;
59329
- const t = (_a = kf.t) != null ? _a : kf.time;
59330
- let v = (_b = kf.v) != null ? _b : kf.value;
59622
+ var _a2;
59623
+ const t = kfTime(kf);
59624
+ let v = kfValue(kf);
59331
59625
  if (propName === "d") v = normalizePathValue(v);
59332
- if (isColour) v = (_c = parseColor(v)) != null ? _c : v;
59333
- const e = (_d = kf.e) != null ? _d : kf.easing;
59626
+ if (isColor) v = (_a2 = parseColor(v)) != null ? _a2 : v;
59627
+ const e = kfEasing(kf);
59334
59628
  const out2 = { t, v, e };
59335
- if ((_e = kf.tangentIn) != null ? _e : kf.ti) out2.tangentIn = (_f = kf.tangentIn) != null ? _f : kf.ti;
59336
- if ((_g = kf.tangentOut) != null ? _g : kf.to) out2.tangentOut = (_h = kf.tangentOut) != null ? _h : kf.to;
59629
+ const tIn = kfTangentIn(kf);
59630
+ const tOut = kfTangentOut(kf);
59631
+ if (tIn) out2.tangentIn = tIn;
59632
+ if (tOut) out2.tangentOut = tOut;
59337
59633
  return out2;
59338
59634
  });
59339
59635
  const expanded = expandLoopKeyframes(propName, kfs, loop, duration);
@@ -59341,15 +59637,15 @@ ${codeFrame}` : message);
59341
59637
  if (propAnim.autoOrient !== void 0) out.autoOrient = propAnim.autoOrient;
59342
59638
  return out;
59343
59639
  }
59344
- function materialiseInternalLoopsInTree(root, duration) {
59345
- const ret = walkAndMaterialiseLoops(root, duration);
59640
+ function materializeInternalLoopsInTree(root, duration) {
59641
+ const ret = walkAndMaterializeLoops(root, duration);
59346
59642
  return ret != null ? ret : root;
59347
59643
  }
59348
- function walkAndMaterialiseLoops(node, duration) {
59644
+ function walkAndMaterializeLoops(node, duration) {
59349
59645
  let newChildren;
59350
59646
  if (node.children) {
59351
59647
  for (let i = 0; i < node.children.length; i++) {
59352
- const ret = walkAndMaterialiseLoops(node.children[i], duration);
59648
+ const ret = walkAndMaterializeLoops(node.children[i], duration);
59353
59649
  if (ret !== null) {
59354
59650
  if (!newChildren) newChildren = node.children.slice();
59355
59651
  newChildren[i] = ret;
@@ -59362,10 +59658,10 @@ ${codeFrame}` : message);
59362
59658
  const animDef = animBucket;
59363
59659
  for (const propName of Object.keys(animDef)) {
59364
59660
  const propAnim = animDef[propName];
59365
- const materialised = materialiseInternalLoopsInPropAnim(propName, propAnim, duration);
59366
- if (materialised !== propAnim) {
59661
+ const materialized = materializeInternalLoopsInPropAnim(propName, propAnim, duration);
59662
+ if (materialized !== propAnim) {
59367
59663
  if (!newAnimate) newAnimate = __spreadValues2({}, animDef);
59368
- newAnimate[propName] = materialised;
59664
+ newAnimate[propName] = materialized;
59369
59665
  }
59370
59666
  }
59371
59667
  }
@@ -59384,7 +59680,7 @@ ${codeFrame}` : message);
59384
59680
  const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
59385
59681
  if (!staticParts || !Object.keys(staticParts).length) return animDef;
59386
59682
  const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues2(__spreadValues2({}, staticParts), v) : v;
59387
- const transformAnim = animDef["transform"];
59683
+ const transformAnim = animDef[TRANSFORM_ATTR];
59388
59684
  if (transformAnim && typeof transformAnim === "object") {
59389
59685
  const anim = transformAnim;
59390
59686
  if (Array.isArray(anim.keyframes)) {
@@ -59409,7 +59705,7 @@ ${codeFrame}` : message);
59409
59705
  delete rest[ch];
59410
59706
  return __spreadProps2(__spreadValues2({}, rest), { transform: lifted });
59411
59707
  }
59412
- function normalizeAnimationDefinition(animDef, duration, defs, engine = PxAnimatorEngine.waapi) {
59708
+ function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
59413
59709
  const normalized = {};
59414
59710
  for (const [propName, propAnim] of Object.entries(animDef)) {
59415
59711
  if (propName === "transform" && propAnim.alongPathMode === "offsetPath" && animDef["offsetDistance"] !== void 0) {
@@ -59420,12 +59716,12 @@ ${codeFrame}` : message);
59420
59716
  const out = { keyframes: normalizedKfs };
59421
59717
  if (propAnim.autoOrient !== void 0) out.autoOrient = propAnim.autoOrient;
59422
59718
  if (propAnim.loop !== void 0) out.loop = propAnim.loop;
59423
- normalized[propName] = engine === PxAnimatorEngine.waapi && propName === "transform" ? materialiseMotionPathInPropAnim(out) : out;
59719
+ normalized[propName] = engine === PxTimelineEngine.native && propName === "transform" ? materializeMotionPathInPropAnim(out) : out;
59424
59720
  }
59425
59721
  }
59426
59722
  return normalized;
59427
59723
  }
59428
- function getNormalisedBindings(doc, engine = PxAnimatorEngine.waapi) {
59724
+ function getNormalizedBindings(doc, engine = PxTimelineEngine.native) {
59429
59725
  const animatorConfig = getAnimatorConfig(doc) || {};
59430
59726
  const defs = getDefs(doc);
59431
59727
  const duration = animatorConfig.duration || 1e3;
@@ -59471,12 +59767,12 @@ ${codeFrame}` : message);
59471
59767
  return bindings;
59472
59768
  }
59473
59769
  function getKeyframesPair(keyframes, progress) {
59474
- var _a, _b;
59770
+ var _a2, _b;
59475
59771
  const last = keyframes.length - 1;
59476
59772
  let prevKf = keyframes[0];
59477
59773
  let nextKf = keyframes[last > 0 ? 1 : 0];
59478
59774
  for (let j = 0; j < last; j++) {
59479
- const aOff = (_a = keyframes[j].t) != null ? _a : 0;
59775
+ const aOff = (_a2 = keyframes[j].t) != null ? _a2 : 0;
59480
59776
  const bOff = (_b = keyframes[j + 1].t) != null ? _b : 0;
59481
59777
  if (aOff <= progress && progress <= bOff) {
59482
59778
  prevKf = keyframes[j];
@@ -59491,13 +59787,13 @@ ${codeFrame}` : message);
59491
59787
  return { prevKf, nextKf };
59492
59788
  }
59493
59789
  function calcPropertyValue(propName, propAnim, progress) {
59494
- var _a, _b, _c, _d, _e, _f, _g;
59790
+ var _a2, _b, _c, _d;
59495
59791
  const keyframes = propAnim.keyframes || [];
59496
59792
  if (keyframes.length === 0) return null;
59497
59793
  const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
59498
- let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a = prevKf.t) != null ? _a : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
59794
+ let localProgress = prevKf === nextKf ? 0 : remap(progress, (_a2 = prevKf.t) != null ? _a2 : 0, (_b = nextKf.t) != null ? _b : 0, 0, 1);
59499
59795
  localProgress = clamp(localProgress, 0, 1);
59500
- const easing = (_c = prevKf.e) != null ? _c : prevKf.easing;
59796
+ const easing = kfEasing(prevKf);
59501
59797
  if (easing && Array.isArray(easing)) {
59502
59798
  try {
59503
59799
  localProgress = cubicBezier(easing)(localProgress);
@@ -59506,17 +59802,17 @@ ${codeFrame}` : message);
59506
59802
  }
59507
59803
  let cssAttrName = isCamelCaseWord(propName) ? camelCaseToKebabWordIfNeeded(propName) : propName;
59508
59804
  let cssValue = null;
59509
- const prevV = (_d = prevKf == null ? void 0 : prevKf.v) != null ? _d : prevKf == null ? void 0 : prevKf.value;
59510
- const nextV = (_e = nextKf == null ? void 0 : nextKf.v) != null ? _e : nextKf == null ? void 0 : nextKf.value;
59805
+ const prevV = prevKf == null ? void 0 : prevKf.v;
59806
+ const nextV = nextKf == null ? void 0 : nextKf.v;
59511
59807
  if (cssAttrName === "d") {
59512
- const prevPaths = (_f = prevV == null ? void 0 : prevV.paths) != null ? _f : Array.isArray(prevV) ? prevV : [];
59513
- const nextPaths = (_g = nextV == null ? void 0 : nextV.paths) != null ? _g : Array.isArray(nextV) ? nextV : [];
59808
+ const prevPaths = (_c = prevV == null ? void 0 : prevV.paths) != null ? _c : Array.isArray(prevV) ? prevV : [];
59809
+ const nextPaths = (_d = nextV == null ? void 0 : nextV.paths) != null ? _d : Array.isArray(nextV) ? nextV : [];
59514
59810
  cssValue = interpolateBeziers(
59515
59811
  prevPaths,
59516
59812
  nextPaths,
59517
59813
  localProgress
59518
59814
  ).map((bz) => bezierToSvgPath(bz)).join("");
59519
- } else if (COLOUR_ATTR_NAMES.has(cssAttrName)) {
59815
+ } else if (COLOR_ATTR_NAMES.has(cssAttrName)) {
59520
59816
  cssValue = toRGBA(interpolateColor(
59521
59817
  prevV || [0, 0, 0, 1],
59522
59818
  nextV || [0, 0, 0, 1],
@@ -59622,13 +59918,13 @@ ${codeFrame}` : message);
59622
59918
  function regenerateIdsAndRewriteRefs(root, genId3) {
59623
59919
  const oldToNew = /* @__PURE__ */ new Map();
59624
59920
  const walkAssign = (n) => {
59625
- var _a;
59921
+ var _a2;
59626
59922
  if (typeof n.id === "string") {
59627
59923
  const newId = genId3();
59628
59924
  oldToNew.set(n.id, newId);
59629
59925
  n.id = newId;
59630
59926
  }
59631
- (_a = n.children) == null ? void 0 : _a.forEach(walkAssign);
59927
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(walkAssign);
59632
59928
  };
59633
59929
  walkAssign(root);
59634
59930
  const rewriteUrl = (s) => s.replace(/url\(#([^)]+)\)/g, (m, oldId) => {
@@ -59636,7 +59932,7 @@ ${codeFrame}` : message);
59636
59932
  return newId ? "url(#" + newId + ")" : m;
59637
59933
  });
59638
59934
  const walkRewrite = (n) => {
59639
- var _a;
59935
+ var _a2;
59640
59936
  if (typeof n.href === "string" && n.href.startsWith("#")) {
59641
59937
  const newId = oldToNew.get(n.href.slice(1));
59642
59938
  if (newId) n.href = "#" + newId;
@@ -59648,7 +59944,7 @@ ${codeFrame}` : message);
59648
59944
  n[k] = rewriteUrl(v);
59649
59945
  }
59650
59946
  }
59651
- (_a = n.children) == null ? void 0 : _a.forEach(walkRewrite);
59947
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(walkRewrite);
59652
59948
  };
59653
59949
  walkRewrite(root);
59654
59950
  return oldToNew;
@@ -59658,7 +59954,7 @@ ${codeFrame}` : message);
59658
59954
  return Number.isFinite(n) ? n : 0;
59659
59955
  }
59660
59956
  function applyUseOffsetToG(gNode) {
59661
- var _a;
59957
+ var _a2;
59662
59958
  const x = toFiniteNum(gNode.x);
59663
59959
  const y = toFiniteNum(gNode.y);
59664
59960
  delete gNode.x;
@@ -59667,15 +59963,15 @@ ${codeFrame}` : message);
59667
59963
  const offset = "translate(" + x + "," + y + ")";
59668
59964
  const carriesTransform = gNode.transform !== void 0 || gNode.animate !== void 0;
59669
59965
  if (carriesTransform) {
59670
- const inner = { type: "g", transform: offset, children: (_a = gNode.children) != null ? _a : [] };
59966
+ const inner = { type: "g", transform: offset, children: (_a2 = gNode.children) != null ? _a2 : [] };
59671
59967
  gNode.children = [inner];
59672
59968
  } else {
59673
59969
  gNode.transform = offset;
59674
59970
  }
59675
59971
  return gNode;
59676
59972
  }
59677
- function materialiseAnimatedUseInstances(root) {
59678
- var _a;
59973
+ function materializeAnimatedUseInstances(root) {
59974
+ var _a2;
59679
59975
  const idMap = buildIdMap(root);
59680
59976
  const animatedIds = computeAnimatedSubtreeIds(root, idMap);
59681
59977
  if (animatedIds.size === 0) return root;
@@ -59683,10 +59979,10 @@ ${codeFrame}` : message);
59683
59979
  const genId3 = () => "_lw_use_mat_" + ++idCounter;
59684
59980
  const rootViewport = readRootViewport(root);
59685
59981
  const defsCollector = [];
59686
- const walked = walkAndMaterialise2(root, idMap, animatedIds, genId3, defsCollector, rootViewport);
59982
+ const walked = walkAndMaterialize2(root, idMap, animatedIds, genId3, defsCollector, rootViewport);
59687
59983
  if (defsCollector.length === 0) return walked;
59688
59984
  const defsNode = { type: "defs", children: defsCollector };
59689
- const newChildren = [...(_a = walked.children) != null ? _a : [], defsNode];
59985
+ const newChildren = [...(_a2 = walked.children) != null ? _a2 : [], defsNode];
59690
59986
  return __spreadProps2(__spreadValues2({}, walked), { children: newChildren });
59691
59987
  }
59692
59988
  function readRootViewport(root) {
@@ -59708,9 +60004,9 @@ ${codeFrame}` : message);
59708
60004
  function buildIdMap(root) {
59709
60005
  const map = /* @__PURE__ */ new Map();
59710
60006
  const visit = (n) => {
59711
- var _a;
60007
+ var _a2;
59712
60008
  if (typeof n.id === "string") map.set(n.id, n);
59713
- (_a = n.children) == null ? void 0 : _a.forEach(visit);
60009
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
59714
60010
  };
59715
60011
  visit(root);
59716
60012
  return map;
@@ -59756,16 +60052,16 @@ ${codeFrame}` : message);
59756
60052
  if (typeof href !== "string") return void 0;
59757
60053
  return href.startsWith("#") ? href.slice(1) : href;
59758
60054
  }
59759
- function materialiseOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector, rootViewport) {
59760
- var _a, _b, _c, _d;
60055
+ function materializeOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector, rootViewport) {
60056
+ var _a2, _b, _c, _d;
59761
60057
  const clone2 = deepClonePxNode(target);
59762
60058
  regenerateIdsAndRewriteRefs(clone2, genId3);
59763
60059
  const symbolViewBox = clone2.type === "symbol" ? parseViewBox(clone2.viewBox) : void 0;
59764
- const useW = (_b = (_a = numericAttr(useNode.width)) != null ? _a : symbolViewBox == null ? void 0 : symbolViewBox[2]) != null ? _b : rootViewport[0];
60060
+ const useW = (_b = (_a2 = numericAttr(useNode.width)) != null ? _a2 : symbolViewBox == null ? void 0 : symbolViewBox[2]) != null ? _b : rootViewport[0];
59765
60061
  const useH = (_d = (_c = numericAttr(useNode.height)) != null ? _c : symbolViewBox == null ? void 0 : symbolViewBox[3]) != null ? _d : rootViewport[1];
59766
60062
  const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector, useW, useH) : clone2;
59767
- const materialisedClone = walkAndMaterialise2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
59768
- const newNode = __spreadProps2(__spreadValues2({}, useNode), { type: "g", children: [materialisedClone] });
60063
+ const materializedClone = walkAndMaterialize2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
60064
+ const newNode = __spreadProps2(__spreadValues2({}, useNode), { type: "g", children: [materializedClone] });
59769
60065
  delete newNode.href;
59770
60066
  delete newNode.width;
59771
60067
  delete newNode.height;
@@ -59803,18 +60099,18 @@ ${codeFrame}` : message);
59803
60099
  if (parts.length < 4 || parts.some((n) => !Number.isFinite(n))) return void 0;
59804
60100
  return [parts[0], parts[1], parts[2], parts[3]];
59805
60101
  }
59806
- function walkAndMaterialise2(node, idMap, animatedIds, genId3, defsCollector, rootViewport) {
60102
+ function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, rootViewport) {
59807
60103
  if (node.type === "use" && typeof node.href === "string") {
59808
60104
  const targetId = stripHash(node.href);
59809
60105
  if (targetId && animatedIds.has(targetId)) {
59810
60106
  const target = idMap.get(targetId);
59811
- if (target) return materialiseOneUse(node, target, idMap, animatedIds, genId3, defsCollector, rootViewport);
60107
+ if (target) return materializeOneUse(node, target, idMap, animatedIds, genId3, defsCollector, rootViewport);
59812
60108
  }
59813
60109
  }
59814
60110
  if (!node.children) return node;
59815
60111
  let changed = false;
59816
60112
  const newChildren = node.children.map((ch) => {
59817
- const m = walkAndMaterialise2(ch, idMap, animatedIds, genId3, defsCollector, rootViewport);
60113
+ const m = walkAndMaterialize2(ch, idMap, animatedIds, genId3, defsCollector, rootViewport);
59818
60114
  if (m !== ch) changed = true;
59819
60115
  return m;
59820
60116
  });
@@ -59830,7 +60126,7 @@ ${codeFrame}` : message);
59830
60126
  return rec;
59831
60127
  }
59832
60128
  function readAnimatable(raw) {
59833
- var _a, _b, _c;
60129
+ var _a2, _b;
59834
60130
  if (raw === void 0) return {
59835
60131
  kind: "absent"
59836
60132
  /* Absent */
@@ -59838,20 +60134,20 @@ ${codeFrame}` : message);
59838
60134
  if (Array.isArray(raw)) return { kind: "static", value: raw };
59839
60135
  if (typeof raw === "object") {
59840
60136
  const obj = raw;
59841
- const kfs = (_a = obj.keyframes) != null ? _a : obj.kfs;
60137
+ const kfs = obj.keyframes;
59842
60138
  if (kfs) {
59843
- const out = { kind: "animated", keyframes: kfs.map(normaliseKeyframe), autoOrient: obj.autoOrient, loop: obj.loop };
59844
- const base = (_b = obj.value) != null ? _b : obj.v;
60139
+ const out = { kind: "animated", keyframes: kfs.map(normalizeKeyframe), autoOrient: obj.autoOrient, loop: obj.loop };
60140
+ const base = (_a2 = obj.value) != null ? _a2 : obj.v;
59845
60141
  if (base !== void 0 && out.kind === "animated") out.base = base;
59846
60142
  return out;
59847
60143
  }
59848
- const staticValue = (_c = obj.value) != null ? _c : obj.v;
60144
+ const staticValue = (_b = obj.value) != null ? _b : obj.v;
59849
60145
  if (staticValue !== void 0) return { kind: "static", value: staticValue };
59850
60146
  }
59851
60147
  return { kind: "static", value: raw };
59852
60148
  }
59853
60149
  function writeAnimatableChannel(node, attrName, read, opts) {
59854
- var _a, _b, _c, _d;
60150
+ var _a2, _b, _c, _d;
59855
60151
  const toOut = (v) => (opts == null ? void 0 : opts.asString) && v !== void 0 && v !== null ? String(v) : v;
59856
60152
  if (read.kind === "absent") return;
59857
60153
  if (read.kind === "static") {
@@ -59865,10 +60161,10 @@ ${codeFrame}` : message);
59865
60161
  if (read.autoOrient !== void 0) block.autoOrient = read.autoOrient;
59866
60162
  animate[attrName] = block;
59867
60163
  node.animate = animate;
59868
- const baseline = (_d = (_b = read.base) != null ? _b : (_a = read.keyframes[0]) == null ? void 0 : _a.value) != null ? _d : (_c = read.keyframes[0]) == null ? void 0 : _c.v;
60164
+ const baseline = (_d = (_b = read.base) != null ? _b : (_a2 = read.keyframes[0]) == null ? void 0 : _a2.value) != null ? _d : (_c = read.keyframes[0]) == null ? void 0 : _c.v;
59869
60165
  if (baseline !== void 0) node[attrName] = toOut(baseline);
59870
60166
  }
59871
- function normaliseKeyframe(kf) {
60167
+ function normalizeKeyframe(kf) {
59872
60168
  if (!kf || typeof kf !== "object") return kf;
59873
60169
  const k = kf;
59874
60170
  if (k.t === void 0 && k.v === void 0 && k.e === void 0 && k.to === void 0 && k.ti === void 0) {
@@ -59883,12 +60179,12 @@ ${codeFrame}` : message);
59883
60179
  return out;
59884
60180
  }
59885
60181
  function readStaticOrigin(raw, ctx) {
59886
- var _a;
60182
+ var _a2;
59887
60183
  const o = readAnimatable(raw);
59888
60184
  if (o.kind === "absent") return void 0;
59889
60185
  if (o.kind === "static") return o.value;
59890
60186
  ctx.warnings.push("transformBy.origin: animated origin approximated by its first keyframe");
59891
- return (_a = o.keyframes[0]) == null ? void 0 : _a.value;
60187
+ return (_a2 = o.keyframes[0]) == null ? void 0 : _a2.value;
59892
60188
  }
59893
60189
  function keyframeWith(kf, value) {
59894
60190
  const out = { value };
@@ -59994,9 +60290,9 @@ ${codeFrame}` : message);
59994
60290
  return typeof href === "string" ? href.replace(/^#/, "") : void 0;
59995
60291
  }
59996
60292
  function indexById(node, map) {
59997
- var _a;
60293
+ var _a2;
59998
60294
  if (typeof node.id === "string") map.set(node.id, node);
59999
- (_a = node.children) == null ? void 0 : _a.forEach((child) => indexById(child, map));
60295
+ (_a2 = node.children) == null ? void 0 : _a2.forEach((child) => indexById(child, map));
60000
60296
  }
60001
60297
  function spliceDefs(root, defs) {
60002
60298
  if (!defs.length) return;
@@ -60008,9 +60304,9 @@ ${codeFrame}` : message);
60008
60304
  return regenerateIdsAndRewriteRefs(root, () => genId(ctx, "retimed"));
60009
60305
  }
60010
60306
  function identifyContentRefTargets(node, ctx, allocator) {
60011
- var _a, _b, _c;
60012
- if (node.type === "use" && ((_b = (_a = node.effects) == null ? void 0 : _a.clone) == null ? void 0 : _b.type) === "content") {
60013
- const sourceId = stripHash2(node.effects.clone.sourceId);
60307
+ var _a2, _b, _c;
60308
+ if (node.type === "use" && ((_b = (_a2 = node.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.without) === "translate") {
60309
+ const sourceId = stripHash2(node.effects.clone.source);
60014
60310
  if (typeof sourceId === "string" && sourceId && !ctx.contentRefInnerIds.has(sourceId)) {
60015
60311
  ctx.contentRefInnerIds.set(sourceId, allocator(sourceId));
60016
60312
  }
@@ -60035,10 +60331,10 @@ ${codeFrame}` : message);
60035
60331
  return outerWrapper;
60036
60332
  }
60037
60333
  function liftBodyTranslate(node, transformBy) {
60038
- var _a, _b, _c;
60334
+ var _a2, _b, _c;
60039
60335
  const out = {};
60040
60336
  let didLiftAnimate = false;
60041
- const animTr = (_a = node.animate) == null ? void 0 : _a.transform;
60337
+ const animTr = (_a2 = node.animate) == null ? void 0 : _a2.transform;
60042
60338
  if (animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes)) {
60043
60339
  const kfs = animTr.keyframes;
60044
60340
  const hasTranslate = kfs.some((kf) => kf.value && kf.value.translate);
@@ -60254,7 +60550,7 @@ ${codeFrame}` : message);
60254
60550
  return out;
60255
60551
  }
60256
60552
  function applyGeomVec(out, xAttr, yAttr, raw) {
60257
- var _a, _b, _c;
60553
+ var _a2, _b, _c;
60258
60554
  const read = readAnimatable(raw);
60259
60555
  if (read.kind === "absent") return;
60260
60556
  if (read.kind === "static") {
@@ -60273,7 +60569,7 @@ ${codeFrame}` : message);
60273
60569
  if (read.loop !== void 0) block.loop = read.loop;
60274
60570
  return block;
60275
60571
  };
60276
- const animate = (_a = out.animate) != null ? _a : {};
60572
+ const animate = (_a2 = out.animate) != null ? _a2 : {};
60277
60573
  animate[xAttr] = axisChannel(0);
60278
60574
  animate[yAttr] = axisChannel(1);
60279
60575
  out.animate = animate;
@@ -60289,7 +60585,7 @@ ${codeFrame}` : message);
60289
60585
  writeAnimatableChannel(out, attrName, read, { asString: true });
60290
60586
  }
60291
60587
  function buildStopChildren(stops, ctx) {
60292
- var _a, _b, _c, _d;
60588
+ var _a2, _b;
60293
60589
  if (!stops) return [];
60294
60590
  const read = readAnimatable(stops);
60295
60591
  if (read.kind === "absent") return [];
@@ -60299,14 +60595,14 @@ ${codeFrame}` : message);
60299
60595
  const loopFromSource = read.loop;
60300
60596
  let stopCount = 0;
60301
60597
  for (const kf of kfs) {
60302
- const v = (_a = kf.value) != null ? _a : kf.v;
60598
+ const v = kfValue(kf);
60303
60599
  if (Array.isArray(v) && v.length > stopCount) stopCount = v.length;
60304
60600
  }
60305
60601
  if (!stopCount) return [];
60306
- const firstKfValue = (_b = kfs[0].value) != null ? _b : kfs[0].v;
60602
+ const firstKfValue = kfValue(kfs[0]);
60307
60603
  const baselineStops = [];
60308
60604
  for (let i = 0; i < stopCount; i++) {
60309
- const s = (_d = (_c = firstKfValue == null ? void 0 : firstKfValue[i]) != null ? _c : prevDefinedStop(kfs, 0, i)) != null ? _d : { offset: i / Math.max(1, stopCount - 1), color: "#000000" };
60605
+ const s = (_b = (_a2 = firstKfValue == null ? void 0 : firstKfValue[i]) != null ? _a2 : prevDefinedStop(kfs, 0, i)) != null ? _b : { offset: i / Math.max(1, stopCount - 1), color: "#000000" };
60310
60606
  baselineStops.push({ offset: s.offset, color: s.color });
60311
60607
  }
60312
60608
  return baselineStops.map((bs, i) => animatedStopNode(bs, kfs, i, ctx, loopFromSource));
@@ -60319,16 +60615,16 @@ ${codeFrame}` : message);
60319
60615
  };
60320
60616
  }
60321
60617
  function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
60322
- var _a, _b, _c, _d, _e;
60618
+ var _a2;
60323
60619
  const colorKfs = [];
60324
60620
  const offsetKfs = [];
60325
60621
  let offsetVaries = false;
60326
60622
  for (const kf of kfs) {
60327
- const t = (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0;
60328
- const arr = (_c = kf.value) != null ? _c : kf.v;
60329
- const sliced = (_d = arr == null ? void 0 : arr[stopIdx]) != null ? _d : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
60623
+ const t = kfTime(kf);
60624
+ const arr = kfValue(kf);
60625
+ const sliced = (_a2 = arr == null ? void 0 : arr[stopIdx]) != null ? _a2 : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
60330
60626
  if (!sliced) continue;
60331
- const easing = (_e = kf.easing) != null ? _e : kf.e;
60627
+ const easing = kfEasing(kf);
60332
60628
  const colorOut = { time: t, value: sliced.color };
60333
60629
  if (easing !== void 0) colorOut.easing = easing;
60334
60630
  colorKfs.push(colorOut);
@@ -60355,13 +60651,12 @@ ${codeFrame}` : message);
60355
60651
  return stop;
60356
60652
  }
60357
60653
  function prevDefinedStop(kfs, fromIdx, stopIdx) {
60358
- var _a, _b;
60359
60654
  for (let i = fromIdx; i >= 0; i--) {
60360
- const arr = (_a = kfs[i].value) != null ? _a : kfs[i].v;
60655
+ const arr = kfValue(kfs[i]);
60361
60656
  if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
60362
60657
  }
60363
60658
  for (let i = fromIdx + 1; i < kfs.length; i++) {
60364
- const arr = (_b = kfs[i].value) != null ? _b : kfs[i].v;
60659
+ const arr = kfValue(kfs[i]);
60365
60660
  if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
60366
60661
  }
60367
60662
  return void 0;
@@ -60371,10 +60666,10 @@ ${codeFrame}` : message);
60371
60666
  return pct + "%";
60372
60667
  }
60373
60668
  function applyClipPathEffect(node, fx, ctx) {
60374
- if (!(fx == null ? void 0 : fx.d)) return node;
60669
+ if (!(fx == null ? void 0 : fx.pathData)) return node;
60375
60670
  const clipId = genId(ctx, "clip");
60376
60671
  const pathChild = { type: "path" };
60377
- const read = readAnimatable(fx.d);
60672
+ const read = readAnimatable(fx.pathData);
60378
60673
  if (read.kind !== "absent") {
60379
60674
  if (read.kind === "static") {
60380
60675
  pathChild.d = pathString(read.value);
@@ -60389,14 +60684,14 @@ ${codeFrame}` : message);
60389
60684
  }
60390
60685
  function pathString(v) {
60391
60686
  if (typeof v === "string") return v;
60392
- if (v && typeof v === "object" && typeof v.path === "string") return v.path;
60687
+ if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
60393
60688
  return void 0;
60394
60689
  }
60395
60690
  function applyMaskedByEffect(node, fx, transformBy, ctx) {
60396
60691
  if (!fx) return node;
60397
- const sourceId = stripHash2(fx.sourceId);
60692
+ const sourceId = stripHash2(fx.source);
60398
60693
  if (!sourceId) {
60399
- ctx.errors.push("maskedBy.sourceId missing \u2014 cannot build mask");
60694
+ ctx.errors.push("maskedBy.source missing \u2014 cannot build mask");
60400
60695
  return node;
60401
60696
  }
60402
60697
  const maskId = genId(ctx, "mask");
@@ -60434,8 +60729,8 @@ ${codeFrame}` : message);
60434
60729
  }
60435
60730
  function wrapInversePart(inner, part, raw, origin, ctx) {
60436
60731
  if (raw === void 0) return inner;
60437
- const normalisedRaw = part === "scale" && Array.isArray(raw) ? [raw[0] / 100, raw[1] / 100] : raw;
60438
- const v = readAnimatable(normalisedRaw);
60732
+ const normalizedRaw = part === "scale" && Array.isArray(raw) ? [raw[0] / 100, raw[1] / 100] : raw;
60733
+ const v = readAnimatable(normalizedRaw);
60439
60734
  if (v.kind === "static") {
60440
60735
  return { type: "g", transform: { value: partsRecord(part, invertPartValue(part, v.value), origin) }, children: [inner] };
60441
60736
  }
@@ -60459,16 +60754,16 @@ ${codeFrame}` : message);
60459
60754
  return [1 / value[0], 1 / value[1]];
60460
60755
  }
60461
60756
  function negatedSpatialTangents(kf) {
60462
- var _a, _b;
60757
+ var _a2, _b;
60463
60758
  const out = {};
60464
- const to = (_a = kf.tangentOut) != null ? _a : kf.to;
60759
+ const to = (_a2 = kf.tangentOut) != null ? _a2 : kf.to;
60465
60760
  const ti = (_b = kf.tangentIn) != null ? _b : kf.ti;
60466
60761
  if (Array.isArray(to)) out.tangentOut = [-to[0], -to[1]];
60467
60762
  if (Array.isArray(ti)) out.tangentIn = [-ti[0], -ti[1]];
60468
60763
  return out;
60469
60764
  }
60470
60765
  function wrapInverseAnimatedBodyTransform(inner, node, _ctx) {
60471
- var _a;
60766
+ var _a2;
60472
60767
  const animate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
60473
60768
  const animTr = animate == null ? void 0 : animate.transform;
60474
60769
  const kfs = animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes) ? animTr.keyframes : void 0;
@@ -60477,7 +60772,7 @@ ${codeFrame}` : message);
60477
60772
  const rotateKfs = [];
60478
60773
  const scaleKfs = [];
60479
60774
  for (const kf of kfs) {
60480
- const v = ((_a = kf.value) != null ? _a : kf.v) || {};
60775
+ const v = ((_a2 = kf.value) != null ? _a2 : kf.v) || {};
60481
60776
  const baseKf = keyframeWith(kf, void 0);
60482
60777
  if (Array.isArray(v.translate)) {
60483
60778
  translateKfs.push(__spreadProps2(__spreadValues2(__spreadValues2({}, baseKf), negatedSpatialTangents(kf)), { value: { translate: [-v.translate[0], -v.translate[1]] } }));
@@ -60541,7 +60836,7 @@ ${codeFrame}` : message);
60541
60836
  return void 0;
60542
60837
  }
60543
60838
  function parseTransformStringToParts(s) {
60544
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
60839
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
60545
60840
  const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
60546
60841
  let m;
60547
60842
  const ops = [];
@@ -60555,7 +60850,7 @@ ${codeFrame}` : message);
60555
60850
  for (let j = ops.length - 2; j >= 0; j--) {
60556
60851
  const cand = ops[j];
60557
60852
  if (cand.name !== "translate") continue;
60558
- const ox = (_a = cand.args[0]) != null ? _a : 0;
60853
+ const ox = (_a2 = cand.args[0]) != null ? _a2 : 0;
60559
60854
  const oy = (_b = cand.args[1]) != null ? _b : 0;
60560
60855
  const lx = (_c = last.args[0]) != null ? _c : 0;
60561
60856
  const ly = (_d = last.args[1]) != null ? _d : 0;
@@ -60670,8 +60965,8 @@ ${codeFrame}` : message);
60670
60965
  function collectMaskAncestorChains(root, ctx) {
60671
60966
  const interestingNodes = /* @__PURE__ */ new Set();
60672
60967
  const collectInterestingNodes = (n) => {
60673
- var _a, _b;
60674
- const maskSourceId = stripHash2((_b = (_a = n.effects) == null ? void 0 : _a.maskedBy) == null ? void 0 : _b.sourceId);
60968
+ var _a2, _b;
60969
+ const maskSourceId = stripHash2((_b = (_a2 = n.effects) == null ? void 0 : _a2.maskedBy) == null ? void 0 : _b.source);
60675
60970
  if (typeof maskSourceId === "string") {
60676
60971
  interestingNodes.add(n);
60677
60972
  const sourceNode = ctx.idMap.get(maskSourceId);
@@ -60692,7 +60987,7 @@ ${codeFrame}` : message);
60692
60987
  walk(root, []);
60693
60988
  }
60694
60989
  function extractTranslateOnly(node, ctx) {
60695
- var _a, _b, _c;
60990
+ var _a2, _b, _c;
60696
60991
  const tr = node.transform;
60697
60992
  const animateBlock = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate.transform : void 0;
60698
60993
  if (tr === void 0 && !animateBlock) return void 0;
@@ -60700,7 +60995,7 @@ ${codeFrame}` : message);
60700
60995
  if (typeof tr === "string") {
60701
60996
  const parts = parseTranslateOnlyFromString(tr, ctx);
60702
60997
  if (parts) out.translate = parts;
60703
- } else if (tr && typeof tr === "object" && !tr.keyframes && !tr.kfs) {
60998
+ } else if (tr && typeof tr === "object" && !tr.keyframes) {
60704
60999
  const wrapped = tr.value;
60705
61000
  const value = wrapped && typeof wrapped === "object" ? wrapped : tr;
60706
61001
  if (value && typeof value === "object" && Array.isArray(value.translate)) {
@@ -60714,7 +61009,7 @@ ${codeFrame}` : message);
60714
61009
  const kfs = animateBlock.keyframes;
60715
61010
  const translateKfs = [];
60716
61011
  for (const kf of kfs) {
60717
- const v = (_a = kf.value) != null ? _a : kf.v;
61012
+ const v = (_a2 = kf.value) != null ? _a2 : kf.v;
60718
61013
  const t = (_c = (_b = kf.time) != null ? _b : kf.t) != null ? _c : 0;
60719
61014
  if (v && typeof v === "object" && Array.isArray(v.translate)) {
60720
61015
  translateKfs.push({ time: t, value: [v.translate[0] || 0, v.translate[1] || 0] });
@@ -60747,15 +61042,14 @@ ${codeFrame}` : message);
60747
61042
  if (droppedNonTranslate) ctx.warnings.push("maskedBy ancestor: non-translate transform in string ignored: " + s);
60748
61043
  return seen ? [x, y] : void 0;
60749
61044
  }
60750
- var CONTENT_SUBREF = "content";
60751
61045
  function applyRefHref(node, clone2, ctx) {
60752
61046
  if (!clone2) return;
60753
- const sourceId = stripHash2(clone2.sourceId);
61047
+ const sourceId = stripHash2(clone2.source);
60754
61048
  if (!sourceId) {
60755
- if (clone2.type === CONTENT_SUBREF) ctx.errors.push("clone: content ref missing sourceId");
61049
+ if (clone2.without === PxCloneWithout.translate) ctx.errors.push("clone: content ref missing `source`");
60756
61050
  return;
60757
61051
  }
60758
- const targetId = clone2.type === CONTENT_SUBREF ? ctx.contentRefInnerIds.get(sourceId) || sourceId : sourceId;
61052
+ const targetId = clone2.without === PxCloneWithout.translate ? ctx.contentRefInnerIds.get(sourceId) || sourceId : sourceId;
60759
61053
  node.href = "#" + targetId;
60760
61054
  }
60761
61055
  function applyRefAndTransformationEffect(node, clone2, transformBy, ctx) {
@@ -60763,9 +61057,9 @@ ${codeFrame}` : message);
60763
61057
  return applyTransformByEffect(node, transformBy, ctx);
60764
61058
  }
60765
61059
  function applyRepeaterEffect(node, fx, ctx) {
60766
- var _a, _b;
61060
+ var _a2, _b;
60767
61061
  if (!fx) return node;
60768
- const copies = (_a = fx.copies) != null ? _a : 1;
61062
+ const copies = (_a2 = fx.copies) != null ? _a2 : 1;
60769
61063
  if (copies < 1) {
60770
61064
  ctx.errors.push("repeater.copies invalid: " + fx.copies);
60771
61065
  return node;
@@ -60831,10 +61125,10 @@ ${codeFrame}` : message);
60831
61125
  const scalePower = (v) => [Math.pow(v[0], i), Math.pow(v[1], i)];
60832
61126
  return mapAnimatable(raw, scalePower, true);
60833
61127
  }
60834
- var RETIME_MATERIALISATION_MODE_INLINE_G = false;
61128
+ var RETIME_MATERIALIZATION_MODE_INLINE_G = false;
60835
61129
  function asRetime(r) {
60836
- var _a, _b;
60837
- return { start: (_a = r.start) != null ? _a : 0, stretch: (_b = r.stretch) != null ? _b : 1 };
61130
+ var _a2, _b;
61131
+ return { start: (_a2 = r.start) != null ? _a2 : 0, stretch: (_b = r.stretch) != null ? _b : 1 };
60838
61132
  }
60839
61133
  var CROP_EDGE_MS = 1;
60840
61134
  function applyTimeCrop(useNode, crop, ctx) {
@@ -60862,12 +61156,12 @@ ${codeFrame}` : message);
60862
61156
  };
60863
61157
  }
60864
61158
  function readCloneRetime(n) {
60865
- var _a, _b;
60866
- return (_b = (_a = n.effects) == null ? void 0 : _a.clone) == null ? void 0 : _b.retime;
61159
+ var _a2, _b;
61160
+ return (_b = (_a2 = n.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.retime;
60867
61161
  }
60868
61162
  function clearCloneRetime(n) {
60869
- var _a;
60870
- const clone2 = (_a = n.effects) == null ? void 0 : _a.clone;
61163
+ var _a2;
61164
+ const clone2 = (_a2 = n.effects) == null ? void 0 : _a2.clone;
60871
61165
  if (!clone2) return;
60872
61166
  delete clone2.retime;
60873
61167
  if (Object.keys(clone2).length === 0) delete n.effects.clone;
@@ -60878,9 +61172,9 @@ ${codeFrame}` : message);
60878
61172
  indexById(root, ctx.idMap);
60879
61173
  const sites = [];
60880
61174
  const collect = (n) => {
60881
- var _a;
61175
+ var _a2;
60882
61176
  if (readCloneRetime(n)) sites.push(n);
60883
- (_a = n.children) == null ? void 0 : _a.forEach(collect);
61177
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(collect);
60884
61178
  };
60885
61179
  collect(root);
60886
61180
  const reachCount = /* @__PURE__ */ new Map();
@@ -60888,7 +61182,7 @@ ${codeFrame}` : message);
60888
61182
  let count = 0;
60889
61183
  const visited = /* @__PURE__ */ new Set();
60890
61184
  const walk = (n) => {
60891
- var _a;
61185
+ var _a2;
60892
61186
  if (!n) return;
60893
61187
  if (n !== site && readCloneRetime(n)) count++;
60894
61188
  if (n.type === "use" && n.href) {
@@ -60898,7 +61192,7 @@ ${codeFrame}` : message);
60898
61192
  walk(ctx.idMap.get(id));
60899
61193
  }
60900
61194
  }
60901
- (_a = n.children) == null ? void 0 : _a.forEach(walk);
61195
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(walk);
60902
61196
  };
60903
61197
  const rootId = stripHash2(site.href);
60904
61198
  if (rootId) {
@@ -60908,19 +61202,19 @@ ${codeFrame}` : message);
60908
61202
  reachCount.set(site, count);
60909
61203
  }
60910
61204
  sites.sort((a, b) => {
60911
- var _a, _b;
60912
- return ((_a = reachCount.get(b)) != null ? _a : 0) - ((_b = reachCount.get(a)) != null ? _b : 0);
61205
+ var _a2, _b;
61206
+ return ((_a2 = reachCount.get(b)) != null ? _a2 : 0) - ((_b = reachCount.get(a)) != null ? _b : 0);
60913
61207
  });
60914
61208
  for (const useNode of sites) {
60915
61209
  const retime = readCloneRetime(useNode);
60916
61210
  if (!retime) continue;
60917
61211
  const crop = retime.timeCrop;
60918
61212
  clearCloneRetime(useNode);
60919
- materialiseRetime(useNode, asRetime(retime), ctx);
61213
+ materializeRetime(useNode, asRetime(retime), ctx);
60920
61214
  if (crop) applyTimeCrop(useNode, crop, ctx);
60921
61215
  }
60922
61216
  }
60923
- function materialiseRetime(useNode, retime, ctx) {
61217
+ function materializeRetime(useNode, retime, ctx) {
60924
61218
  const targetId = stripHash2(useNode.href);
60925
61219
  if (!targetId) {
60926
61220
  ctx.errors.push("retime: <use> has no href to follow");
@@ -60928,7 +61222,7 @@ ${codeFrame}` : message);
60928
61222
  }
60929
61223
  const chainRootId = buildChainClone(targetId, retime, ctx, /* @__PURE__ */ new Set());
60930
61224
  if (!chainRootId) return;
60931
- if (RETIME_MATERIALISATION_MODE_INLINE_G) {
61225
+ if (RETIME_MATERIALIZATION_MODE_INLINE_G) {
60932
61226
  const cloneNode = ctx.idMap.get(chainRootId);
60933
61227
  useNode.type = "g";
60934
61228
  delete useNode.href;
@@ -60968,15 +61262,15 @@ ${codeFrame}` : message);
60968
61262
  if (subId2) cloneNode.href = "#" + subId2;
60969
61263
  }
60970
61264
  } else {
60971
- materialiseNestedRetimeUses(cloneNode, accum, ctx, chain, targetId);
61265
+ materializeNestedRetimeUses(cloneNode, accum, ctx, chain, targetId);
60972
61266
  }
60973
61267
  ctx.defs.push(cloneNode);
60974
61268
  if (typeof cloneNode.id === "string") ctx.idMap.set(cloneNode.id, cloneNode);
60975
61269
  return typeof cloneNode.id === "string" ? cloneNode.id : void 0;
60976
61270
  }
60977
- function materialiseNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
61271
+ function materializeNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
60978
61272
  const visit = (n) => {
60979
- var _a;
61273
+ var _a2;
60980
61274
  const retime = readCloneRetime(n);
60981
61275
  if (n.type === "use" && retime && n.href) {
60982
61276
  const subId = stripHash2(n.href);
@@ -60989,14 +61283,14 @@ ${codeFrame}` : message);
60989
61283
  }
60990
61284
  clearCloneRetime(n);
60991
61285
  }
60992
- (_a = n.children) == null ? void 0 : _a.forEach(visit);
61286
+ (_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
60993
61287
  };
60994
61288
  visit(node);
60995
61289
  }
60996
61290
  function remapKeyframeTimes(node, start, stretch) {
60997
- var _a;
61291
+ var _a2;
60998
61292
  remapKeyframeTimesOnly(node, start, stretch);
60999
- (_a = node.children) == null ? void 0 : _a.forEach((c) => remapKeyframeTimes(c, start, stretch));
61293
+ (_a2 = node.children) == null ? void 0 : _a2.forEach((c) => remapKeyframeTimes(c, start, stretch));
61000
61294
  }
61001
61295
  function remapKeyframeTimesOnly(node, start, stretch) {
61002
61296
  const remap2 = (kfs) => {
@@ -61171,10 +61465,10 @@ ${codeFrame}` : message);
61171
61465
  function estimateTextAdvance(node) {
61172
61466
  let chars = 0, maxFont = 16;
61173
61467
  const walk = (el) => {
61174
- var _a, _b;
61175
- const fs = parseFloat(String((_a = el.fontSize) != null ? _a : "")) || 0;
61468
+ var _a2;
61469
+ const fs = parseFloat(String((_a2 = el.fontSize) != null ? _a2 : "")) || 0;
61176
61470
  if (fs) maxFont = Math.max(maxFont, fs);
61177
- const t = (_b = el.text) != null ? _b : el.textContent;
61471
+ const t = el.textContent;
61178
61472
  if (typeof t === "string") chars += t.length;
61179
61473
  if (el.children) for (const c of el.children) walk(c);
61180
61474
  };
@@ -61196,14 +61490,14 @@ ${codeFrame}` : message);
61196
61490
  return out;
61197
61491
  }
61198
61492
  function extendedPathForBrowser(pathD, opts) {
61199
- var _a;
61493
+ var _a2;
61200
61494
  if (opts.pathOverflow === "clip") return { d: pathD, startShift: 0 };
61201
61495
  const sampler = createPathSampler(pathD);
61202
61496
  if (!sampler || sampler.closed || sampler.totalLength <= 0) return { d: pathD, startShift: 0 };
61203
61497
  const L = sampler.totalLength;
61204
61498
  const margin = EXTEND_MARGIN_FRAC * L;
61205
61499
  const so = numRange(opts.startOffset);
61206
- const runWidth = numRange(opts.textLength).max || ((_a = opts.advance) != null ? _a : 0);
61500
+ const runWidth = numRange(opts.textLength).max || ((_a2 = opts.advance) != null ? _a2 : 0);
61207
61501
  const startOverflow = Math.max(0, -so.min);
61208
61502
  const endOverflow = Math.max(0, so.max + runWidth - L);
61209
61503
  const startExt = startOverflow > 0 ? startOverflow + margin : 0;
@@ -61224,10 +61518,10 @@ ${codeFrame}` : message);
61224
61518
  return { d, startShift: startExt };
61225
61519
  }
61226
61520
  function applyTextPathEffect(node, fx, ctx) {
61227
- var _a;
61228
- if (!fx || typeof fx.path !== "string" || !fx.path) return node;
61521
+ var _a2;
61522
+ if (!fx || typeof fx.pathData !== "string" || !fx.pathData) return node;
61229
61523
  const pathId = genId(ctx, "tpath");
61230
- const { d, startShift } = extendedPathForBrowser(fx.path, {
61524
+ const { d, startShift } = extendedPathForBrowser(fx.pathData, {
61231
61525
  pathOverflow: fx.pathOverflow,
61232
61526
  startOffset: fx.startOffset,
61233
61527
  textLength: fx.textLength,
@@ -61237,7 +61531,7 @@ ${codeFrame}` : message);
61237
61531
  const textPath = {
61238
61532
  type: "textPath",
61239
61533
  href: "#" + pathId,
61240
- children: (_a = node.children) != null ? _a : []
61534
+ children: (_a2 = node.children) != null ? _a2 : []
61241
61535
  };
61242
61536
  if (fx.lengthAdjust !== void 0) textPath.lengthAdjust = fx.lengthAdjust;
61243
61537
  if (fx.method !== void 0) textPath.method = fx.method;
@@ -61323,7 +61617,6 @@ ${codeFrame}` : message);
61323
61617
  "stroke",
61324
61618
  "strokeWidth",
61325
61619
  "effects",
61326
- TEXT_ATTR,
61327
61620
  TEXT_CONTENT_ATTR,
61328
61621
  "xml:space"
61329
61622
  ];
@@ -61361,15 +61654,15 @@ ${codeFrame}` : message);
61361
61654
  return out;
61362
61655
  }
61363
61656
  function resolveStyle2(node, parent) {
61364
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
61657
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
61365
61658
  const isTextRoot = node.type === "text";
61366
61659
  const nodeStyle = node.style;
61367
61660
  const own = (key) => {
61368
- var _a2;
61369
- return isTextRoot ? void 0 : (_a2 = node[key]) != null ? _a2 : nodeStyle == null ? void 0 : nodeStyle[key];
61661
+ var _a3;
61662
+ return isTextRoot ? void 0 : (_a3 = node[key]) != null ? _a3 : nodeStyle == null ? void 0 : nodeStyle[key];
61370
61663
  };
61371
61664
  const res = {
61372
- fontFamily: (_a = str(node.fontFamily)) != null ? _a : parent.fontFamily,
61665
+ fontFamily: (_a2 = str(node.fontFamily)) != null ? _a2 : parent.fontFamily,
61373
61666
  fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
61374
61667
  fill: (_c = node.fill) != null ? _c : parent.fill,
61375
61668
  stroke: (_d = node.stroke) != null ? _d : parent.stroke,
@@ -61386,10 +61679,10 @@ ${codeFrame}` : message);
61386
61679
  return res;
61387
61680
  }
61388
61681
  function rootStyleOf(node) {
61389
- var _a, _b, _c;
61682
+ var _a2, _b, _c;
61390
61683
  return {
61391
61684
  fontFamily: str(node.fontFamily),
61392
- fontSize: (_a = parseLen(node.fontSize)) != null ? _a : DEFAULT_FONT_SIZE,
61685
+ fontSize: (_a2 = parseLen(node.fontSize)) != null ? _a2 : DEFAULT_FONT_SIZE,
61393
61686
  fill: node.fill,
61394
61687
  stroke: node.stroke,
61395
61688
  strokeWidth: node.strokeWidth,
@@ -61410,9 +61703,9 @@ ${codeFrame}` : message);
61410
61703
  return p;
61411
61704
  }
61412
61705
  function glyphFontFor(s, glyphs, soleFont, warnings) {
61413
- var _a;
61706
+ var _a2;
61414
61707
  const gf = s.fontFamily ? glyphs[s.fontFamily] : soleFont;
61415
- if (!gf) warnings == null ? void 0 : warnings.push('textGlyphs: no glyphs for font "' + ((_a = s.fontFamily) != null ? _a : "") + '"');
61708
+ if (!gf) warnings == null ? void 0 : warnings.push('textGlyphs: no glyphs for font "' + ((_a2 = s.fontFamily) != null ? _a2 : "") + '"');
61416
61709
  return gf;
61417
61710
  }
61418
61711
  function soleFontOf(glyphs) {
@@ -61433,26 +61726,26 @@ ${codeFrame}` : message);
61433
61726
  const ix0 = x0 + t, ix1 = x1 - t, iyb = -t, iyt = y1 + t;
61434
61727
  return outer + "M" + ix0 + " " + iyb + "L" + ix0 + " " + iyt + "L" + ix1 + " " + iyt + "L" + ix1 + " " + iyb + "Z";
61435
61728
  }
61436
- function materialiseGlyphTextHorizontal(node, opts) {
61437
- var _a, _b, _c, _d;
61729
+ function materializeGlyphTextHorizontal(node, opts) {
61730
+ var _a2, _b, _c;
61438
61731
  const { glyphs, create = jsonElementFactory, warnings } = opts;
61439
61732
  const soleFont = soleFontOf(glyphs);
61440
- const pen = { x: (_a = parseLen(node.x)) != null ? _a : 0, y: (_b = parseLen(node.y)) != null ? _b : 0 };
61733
+ const pen = { x: (_a2 = parseLen(node.x)) != null ? _a2 : 0, y: (_b = parseLen(node.y)) != null ? _b : 0 };
61441
61734
  const placements = [];
61442
61735
  const lines = [{ start: pen.x, end: pen.x }];
61443
61736
  let line = 0;
61444
61737
  const renderChars = (content, s) => {
61445
- var _a2;
61738
+ var _a3;
61446
61739
  const gf = glyphFontFor(s, glyphs, soleFont, warnings);
61447
61740
  const upm = (gf == null ? void 0 : gf.unitsPerEm) || 1e3;
61448
61741
  const scale = s.fontSize / upm;
61449
- const ascentEm = (_a2 = gf == null ? void 0 : gf.ascent) != null ? _a2 : 0.9 * upm;
61742
+ const ascentEm = (_a3 = gf == null ? void 0 : gf.ascent) != null ? _a3 : 0.9 * upm;
61450
61743
  const paint = paintOf(s);
61451
61744
  for (let i = 0; i < content.length; i++) {
61452
61745
  const ch = content.charAt(i);
61453
61746
  const g = gf == null ? void 0 : gf.glyphs[ch];
61454
- if (g && g.d) {
61455
- placements.push({ glyphD: g.d, m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
61747
+ if (g && g.pathData) {
61748
+ placements.push({ glyphD: g.pathData, m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
61456
61749
  pen.x += g.width * scale;
61457
61750
  } else if (/\S/.test(ch)) {
61458
61751
  const advEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * upm;
@@ -61466,7 +61759,7 @@ ${codeFrame}` : message);
61466
61759
  }
61467
61760
  };
61468
61761
  const walk = (el, parentStyle) => {
61469
- var _a2, _b2, _c2, _d2;
61762
+ var _a3, _b2, _c2;
61470
61763
  const s = resolveStyle2(el, parentStyle);
61471
61764
  const x = parseLen(el.x);
61472
61765
  const y = parseLen(el.y);
@@ -61476,16 +61769,16 @@ ${codeFrame}` : message);
61476
61769
  lines.push({ start: pen.x, end: pen.x });
61477
61770
  }
61478
61771
  if (y !== void 0) pen.y = y;
61479
- pen.x += (_a2 = parseLen(el.dx)) != null ? _a2 : 0;
61772
+ pen.x += (_a3 = parseLen(el.dx)) != null ? _a3 : 0;
61480
61773
  pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
61481
- const content = (_c2 = str(el[TEXT_CONTENT_ATTR])) != null ? _c2 : str(el[TEXT_ATTR]);
61482
- if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
61774
+ const content = str(el[TEXT_CONTENT_ATTR]);
61775
+ if (content && !((_c2 = el.children) == null ? void 0 : _c2.length)) renderChars(content, s);
61483
61776
  if (el.children) for (const ch of el.children) walk(ch, s);
61484
61777
  };
61485
61778
  const rootStyle = rootStyleOf(node);
61486
61779
  if (node.children) for (const ch of node.children) walk(ch, rootStyle);
61487
- const rootContent = (_c = str(node[TEXT_CONTENT_ATTR])) != null ? _c : str(node[TEXT_ATTR]);
61488
- if (rootContent && !((_d = node.children) == null ? void 0 : _d.length)) renderChars(rootContent, rootStyle);
61780
+ const rootContent = str(node[TEXT_CONTENT_ATTR]);
61781
+ if (rootContent && !((_c = node.children) == null ? void 0 : _c.length)) renderChars(rootContent, rootStyle);
61489
61782
  const anchor = str(node.textAnchor);
61490
61783
  if (anchor === "middle" || anchor === "end") {
61491
61784
  for (const p of placements) {
@@ -61500,21 +61793,21 @@ ${codeFrame}` : message);
61500
61793
  const cells = [];
61501
61794
  let adv = 0;
61502
61795
  const walk = (el, parentStyle) => {
61503
- var _a, _b, _c;
61796
+ var _a2, _b;
61504
61797
  const s = resolveStyle2(el, parentStyle);
61505
- const content = (_a = str(el[TEXT_CONTENT_ATTR])) != null ? _a : str(el[TEXT_ATTR]);
61506
- if (content && !((_b = el.children) == null ? void 0 : _b.length)) {
61798
+ const content = str(el[TEXT_CONTENT_ATTR]);
61799
+ if (content && !((_a2 = el.children) == null ? void 0 : _a2.length)) {
61507
61800
  const gf = glyphFontFor(s, glyphs, soleFont, warnings);
61508
61801
  if (gf) {
61509
61802
  const scale = s.fontSize / gf.unitsPerEm;
61510
- const ascentEm = (_c = gf.ascent) != null ? _c : 0.9 * gf.unitsPerEm;
61803
+ const ascentEm = (_b = gf.ascent) != null ? _b : 0.9 * gf.unitsPerEm;
61511
61804
  const paint = paintOf(s);
61512
61805
  for (let i = 0; i < content.length; i++) {
61513
61806
  const ch = content.charAt(i);
61514
61807
  const g = gf.glyphs[ch];
61515
- if (g && g.d) {
61808
+ if (g && g.pathData) {
61516
61809
  const glyphAdv = g.width * scale;
61517
- cells.push({ glyphD: g.d, widthEm: g.width, scale, paint, midBase: adv + glyphAdv / 2 });
61810
+ cells.push({ glyphD: g.pathData, widthEm: g.width, scale, paint, midBase: adv + glyphAdv / 2 });
61518
61811
  adv += glyphAdv;
61519
61812
  } else if (/\S/.test(ch)) {
61520
61813
  const wEm = g && g.width > 0 ? g.width : MISSING_GLYPH_ADVANCE_EM * gf.unitsPerEm;
@@ -61539,13 +61832,13 @@ ${codeFrame}` : message);
61539
61832
  return [scale * cos, scale * sin, -scale * sin, scale * cos, x - scale * cos * hw - perp * sin, y - scale * sin * hw + perp * cos];
61540
61833
  }
61541
61834
  function alongPathNodeOffsets(node) {
61542
- var _a, _b, _c;
61835
+ var _a2, _b, _c;
61543
61836
  return {
61544
- along: ((_a = parseLen(node.x)) != null ? _a : 0) + ((_b = parseLen(node.dx)) != null ? _b : 0),
61837
+ along: ((_a2 = parseLen(node.x)) != null ? _a2 : 0) + ((_b = parseLen(node.dx)) != null ? _b : 0),
61545
61838
  perp: (_c = parseLen(node.dy)) != null ? _c : 0
61546
61839
  };
61547
61840
  }
61548
- function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLength, pathOverflow) {
61841
+ function materializeGlyphTextAlongPath(node, pathD, startOffset, opts, textLength, pathOverflow) {
61549
61842
  const { glyphs, create = jsonElementFactory, warnings } = opts;
61550
61843
  const sampler = pathD ? createPathSampler(pathD) : null;
61551
61844
  if (!sampler) {
@@ -61581,7 +61874,7 @@ ${codeFrame}` : message);
61581
61874
  return toGroup(node, buildPaths(placements, create, warnings), create);
61582
61875
  }
61583
61876
  function numTrackOf(raw) {
61584
- var _a;
61877
+ var _a2;
61585
61878
  const r = readAnimatable(raw);
61586
61879
  if (r.kind === "animated" && r.keyframes.length >= 2) {
61587
61880
  const kfs = [...r.keyframes].sort((k1, k2) => (Number(k1.time) || 0) - (Number(k2.time) || 0));
@@ -61604,7 +61897,7 @@ ${codeFrame}` : message);
61604
61897
  }
61605
61898
  };
61606
61899
  }
61607
- const v = r.kind === "animated" ? Number((_a = r.keyframes[0]) == null ? void 0 : _a.value) || 0 : r.kind === "static" ? Number(r.value) || 0 : 0;
61900
+ const v = r.kind === "animated" ? Number((_a2 = r.keyframes[0]) == null ? void 0 : _a2.value) || 0 : r.kind === "static" ? Number(r.value) || 0 : 0;
61608
61901
  return { animated: false, times: [], at: () => v };
61609
61902
  }
61610
61903
  function mergeTrackTimes(a, b) {
@@ -61624,8 +61917,8 @@ ${codeFrame}` : message);
61624
61917
  const onPath = (dist) => dist >= 0 && dist <= sampler.totalLength;
61625
61918
  const out = [];
61626
61919
  for (const c of cells) {
61627
- const centred = [c.scale, 0, 0, c.scale, -c.scale * (c.widthEm / 2), 0];
61628
- const d = transformPathData(c.glyphD, centred);
61920
+ const centered = [c.scale, 0, 0, c.scale, -c.scale * (c.widthEm / 2), 0];
61921
+ const d = transformPathData(c.glyphD, centered);
61629
61922
  const sampleKf = (dist, time) => {
61630
61923
  const { x, y, angle } = sampler.sampleAtDistance(dist);
61631
61924
  const cos = Math.cos(angle), sin = Math.sin(angle);
@@ -61686,7 +61979,7 @@ ${codeFrame}` : message);
61686
61979
  return p;
61687
61980
  }
61688
61981
  function missingGlyphProps(isMissing) {
61689
- return isMissing ? { class: MISSING_GLYPH_CLASS_NAME } : {};
61982
+ return isMissing ? { [CLASS_ATTR]: MISSING_GLYPH_CLASS_NAME } : {};
61690
61983
  }
61691
61984
  function buildPaths(placements, create, warnings) {
61692
61985
  if (!placements.length) {
@@ -61726,17 +62019,17 @@ ${codeFrame}` : message);
61726
62019
  function applyTextGlyphsEffect(node, fx, ctx) {
61727
62020
  if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
61728
62021
  if (!ctx.glyphs) {
61729
- ctx.warnings.push("textGlyphs: no definitions.glyphs \u2014 left as native <text>");
62022
+ ctx.warnings.push("textGlyphs: no definitions.fonts \u2014 left as native <text>");
61730
62023
  return node;
61731
62024
  }
61732
- return materialiseGlyphTextHorizontal(node, { glyphs: ctx.glyphs, warnings: ctx.warnings });
62025
+ return materializeGlyphTextHorizontal(node, { glyphs: ctx.glyphs, warnings: ctx.warnings });
61733
62026
  }
61734
62027
  function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pathOverflow) {
61735
62028
  if (!ctx.glyphs) {
61736
- ctx.warnings.push("textGlyphs: no definitions.glyphs");
62029
+ ctx.warnings.push("textGlyphs: no definitions.fonts");
61737
62030
  return null;
61738
62031
  }
61739
- return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
62032
+ return materializeGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
61740
62033
  }
61741
62034
  function applyStrokeTrimEffect(node, strokeTrim, ctx) {
61742
62035
  if (!strokeTrim) return node;
@@ -61873,12 +62166,11 @@ ${codeFrame}` : message);
61873
62166
  ];
61874
62167
  }
61875
62168
  function readScalarValues(r) {
61876
- var _a;
61877
62169
  if (r.kind === "absent") return [];
61878
62170
  if (r.kind === "static") return [r.value];
61879
62171
  const out = [];
61880
62172
  for (const kf of r.keyframes) {
61881
- const v = (_a = kf.value) != null ? _a : kf.v;
62173
+ const v = kfValue(kf);
61882
62174
  if (typeof v === "number") out.push(v);
61883
62175
  }
61884
62176
  return out;
@@ -61888,14 +62180,11 @@ ${codeFrame}` : message);
61888
62180
  if (read.kind === "static") return { kind: "static", value: map(read.value) };
61889
62181
  return {
61890
62182
  kind: "animated",
61891
- keyframes: read.keyframes.map((kf) => {
61892
- var _a, _b, _c, _d;
61893
- return {
61894
- time: (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0,
61895
- value: map((_c = kf.value) != null ? _c : kf.v),
61896
- easing: (_d = kf.easing) != null ? _d : kf.e
61897
- };
61898
- }),
62183
+ keyframes: read.keyframes.map((kf) => ({
62184
+ time: kfTime(kf),
62185
+ value: map(kfValue(kf)),
62186
+ easing: kfEasing(kf)
62187
+ })),
61899
62188
  loop: read.loop
61900
62189
  };
61901
62190
  }
@@ -61905,7 +62194,6 @@ ${codeFrame}` : message);
61905
62194
  }
61906
62195
  var OPACITY_STEP_MS = 10;
61907
62196
  function computeOpacityFromRange(rangeRead) {
61908
- var _a, _b, _c, _d, _e, _f;
61909
62197
  const hide = (v) => v[0] === v[1];
61910
62198
  if (rangeRead.kind === "absent") return void 0;
61911
62199
  if (rangeRead.kind === "static") return hide(rangeRead.value) ? { kind: "static", value: 0 } : void 0;
@@ -61913,7 +62201,7 @@ ${codeFrame}` : message);
61913
62201
  let anyHide = false;
61914
62202
  let allHide = true;
61915
62203
  for (const kf of kfs) {
61916
- if (hide((_a = kf.value) != null ? _a : kf.v)) anyHide = true;
62204
+ if (hide(kfValue(kf))) anyHide = true;
61917
62205
  else allHide = false;
61918
62206
  }
61919
62207
  if (!anyHide) return void 0;
@@ -61923,10 +62211,10 @@ ${codeFrame}` : message);
61923
62211
  const kf = kfs[i];
61924
62212
  const prevKf = i > 0 ? kfs[i - 1] : void 0;
61925
62213
  const nextKf = i < kfs.length - 1 ? kfs[i + 1] : void 0;
61926
- const t = (_c = (_b = kf.time) != null ? _b : kf.t) != null ? _c : 0;
61927
- const thisHide = hide((_d = kf.value) != null ? _d : kf.v);
61928
- const prevHide = prevKf ? thisHide && hide((_e = prevKf.value) != null ? _e : prevKf.v) : thisHide;
61929
- const nextHide = nextKf ? thisHide && hide((_f = nextKf.value) != null ? _f : nextKf.v) : thisHide;
62214
+ const t = kfTime(kf);
62215
+ const thisHide = hide(kfValue(kf));
62216
+ const prevHide = prevKf ? thisHide && hide(kfValue(prevKf)) : thisHide;
62217
+ const nextHide = nextKf ? thisHide && hide(kfValue(nextKf)) : thisHide;
61930
62218
  if (prevHide && !nextHide) {
61931
62219
  out.push({ time: t, value: 0 });
61932
62220
  out.push({ time: t + OPACITY_STEP_MS, value: 1 });
@@ -61941,14 +62229,11 @@ ${codeFrame}` : message);
61941
62229
  function readRangeWithCrossings(raw) {
61942
62230
  const r = readAnimatable(raw);
61943
62231
  if (r.kind !== "animated") return r;
61944
- const kfs = r.keyframes.map((kf) => {
61945
- var _a, _b, _c, _d;
61946
- return {
61947
- time: (_b = (_a = kf.time) != null ? _a : kf.t) != null ? _b : 0,
61948
- value: (_c = kf.value) != null ? _c : kf.v,
61949
- easing: (_d = kf.easing) != null ? _d : kf.e
61950
- };
61951
- });
62232
+ const kfs = r.keyframes.map((kf) => ({
62233
+ time: kfTime(kf),
62234
+ value: kfValue(kf),
62235
+ easing: kfEasing(kf)
62236
+ }));
61952
62237
  const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
61953
62238
  if (!hasReverse) {
61954
62239
  return {
@@ -62045,20 +62330,20 @@ ${codeFrame}` : message);
62045
62330
  return total;
62046
62331
  }
62047
62332
  function segmentLength(path, from, to) {
62048
- var _a, _b, _c, _d;
62333
+ var _a2, _b, _c, _d;
62049
62334
  const v = path.v;
62050
62335
  const p0 = v[from];
62051
62336
  const p3 = v[to];
62052
- const p1 = (_b = (_a = path.o) == null ? void 0 : _a[from]) != null ? _b : p0;
62337
+ const p1 = (_b = (_a2 = path.o) == null ? void 0 : _a2[from]) != null ? _b : p0;
62053
62338
  const p2 = (_d = (_c = path.i) == null ? void 0 : _c[to]) != null ? _d : p3;
62054
62339
  const lut = bezier2D_arcLengthLUT(p0, p1, p2, p3);
62055
62340
  return lut.ds[lut.ds.length - 1];
62056
62341
  }
62057
62342
  var ARC_KAPPA = 0.5522847498307936;
62058
62343
  function shapeToPathD(node) {
62059
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
62344
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
62060
62345
  if (node.type === "rect") {
62061
- const x = Number((_a = node.x) != null ? _a : 0), y = Number((_b = node.y) != null ? _b : 0);
62346
+ const x = Number((_a2 = node.x) != null ? _a2 : 0), y = Number((_b = node.y) != null ? _b : 0);
62062
62347
  const w = Number((_c = node.width) != null ? _c : 0), h3 = Number((_d = node.height) != null ? _d : 0);
62063
62348
  return "M" + (x + w) + "," + y + "L" + (x + w) + "," + (y + h3) + "L" + x + "," + (y + h3) + "L" + x + "," + y + "L" + (x + w) + "," + y + "z";
62064
62349
  }
@@ -62074,7 +62359,7 @@ ${codeFrame}` : message);
62074
62359
  return void 0;
62075
62360
  }
62076
62361
  function applyPlayerEffects(root) {
62077
- var _a, _b;
62362
+ var _a2, _b;
62078
62363
  const ctx = {
62079
62364
  defs: [],
62080
62365
  warnings: [],
@@ -62085,8 +62370,8 @@ ${codeFrame}` : message);
62085
62370
  maskAncestorChains: /* @__PURE__ */ new Map(),
62086
62371
  // Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
62087
62372
  // waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
62088
- engine: ((_a = getAnimatorConfig(root)) == null ? void 0 : _a.mode) === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.waapi,
62089
- glyphs: (_b = getDefs(root)) == null ? void 0 : _b.glyphs
62373
+ engine: resolveTimelineEngine((_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.engine),
62374
+ glyphs: (_b = getDefs(root)) == null ? void 0 : _b.fonts
62090
62375
  };
62091
62376
  const working = clone(root);
62092
62377
  indexById(working, ctx.idMap);
@@ -62109,7 +62394,7 @@ ${codeFrame}` : message);
62109
62394
  let consumedByGlyphs = false;
62110
62395
  if (text == null ? void 0 : text.useGlyphs) {
62111
62396
  if (textPath) {
62112
- const pathD = typeof textPath.path === "string" ? textPath.path : void 0;
62397
+ const pathD = typeof textPath.pathData === "string" ? textPath.pathData : void 0;
62113
62398
  const glyphed = applyTextGlyphsAlongPath(n, ctx, pathD, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
62114
62399
  if (glyphed) {
62115
62400
  n = glyphed;
@@ -62141,26 +62426,6 @@ ${codeFrame}` : message);
62141
62426
  applyAllRetimeEffects(node, ctx);
62142
62427
  return node;
62143
62428
  }
62144
- var kfTime = (kf) => {
62145
- var _a, _b;
62146
- return (_b = (_a = kf.t) != null ? _a : kf.time) != null ? _b : 0;
62147
- };
62148
- var kfValue = (kf) => {
62149
- var _a;
62150
- return (_a = kf.v) != null ? _a : kf.value;
62151
- };
62152
- var kfEasing = (kf) => {
62153
- var _a;
62154
- return (_a = kf.e) != null ? _a : kf.easing;
62155
- };
62156
- var kfTangentIn = (kf) => {
62157
- var _a;
62158
- return (_a = kf.tangentIn) != null ? _a : kf.ti;
62159
- };
62160
- var kfTangentOut = (kf) => {
62161
- var _a;
62162
- return (_a = kf.tangentOut) != null ? _a : kf.to;
62163
- };
62164
62429
  function cubicAt(p0, c1, c2, p1, t) {
62165
62430
  const u = 1 - t;
62166
62431
  const a = u * u * u, b = 3 * u * u * t, c = 3 * u * t * t, d = t * t * t;
@@ -62184,7 +62449,7 @@ ${codeFrame}` : message);
62184
62449
  return Object.is(r, -0) ? "0" : String(r);
62185
62450
  };
62186
62451
  function buildOffsetPath(propAnim) {
62187
- var _a, _b, _c;
62452
+ var _a2, _b, _c;
62188
62453
  if (propAnim.alongPathMode !== "offsetPath") return void 0;
62189
62454
  const kfs = propAnim.keyframes;
62190
62455
  if (!kfs || kfs.length < 2) return void 0;
@@ -62197,7 +62462,7 @@ ${codeFrame}` : message);
62197
62462
  if (!tr || tr.length < 2) return void 0;
62198
62463
  const parts = Object.keys(v);
62199
62464
  if (parts.some((p) => p !== "translate" && p !== "origin")) return void 0;
62200
- const o = (_a = v == null ? void 0 : v.origin) != null ? _a : [0, 0];
62465
+ const o = (_a2 = v == null ? void 0 : v.origin) != null ? _a2 : [0, 0];
62201
62466
  if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
62202
62467
  points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
62203
62468
  }
@@ -62226,9 +62491,9 @@ ${codeFrame}` : message);
62226
62491
  }
62227
62492
  return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor };
62228
62493
  }
62229
- function materialiseOffsetPathsInTree(root) {
62494
+ function materializeOffsetPathsInTree(root) {
62230
62495
  const walk = (node) => {
62231
- var _a;
62496
+ var _a2;
62232
62497
  let out = node;
62233
62498
  const anim = node.animate;
62234
62499
  const transform = anim == null ? void 0 : anim["transform"];
@@ -62236,16 +62501,16 @@ ${codeFrame}` : message);
62236
62501
  const built = buildOffsetPath(transform);
62237
62502
  if (built) {
62238
62503
  const newAnimate = __spreadValues2({}, anim);
62239
- delete newAnimate["transform"];
62504
+ delete newAnimate[TRANSFORM_ATTR];
62240
62505
  const distance = { keyframes: built.distanceKfs };
62241
62506
  if (transform.loop !== void 0) distance.loop = transform.loop;
62242
- newAnimate["offsetDistance"] = distance;
62507
+ newAnimate[OFFSET_DISTANCE_ATTR] = distance;
62243
62508
  const staticTr = node.transform;
62244
62509
  let newTransform = staticTr;
62245
62510
  if (staticTr && typeof staticTr === "object") {
62246
62511
  const t = __spreadValues2({}, staticTr);
62247
- delete t["translate"];
62248
- delete t["origin"];
62512
+ delete t[TRANSFORM_PART.translate];
62513
+ delete t[TRANSFORM_PART.origin];
62249
62514
  newTransform = Object.keys(t).length ? t : void 0;
62250
62515
  }
62251
62516
  out = __spreadProps2(__spreadValues2({}, node), {
@@ -62261,7 +62526,7 @@ ${codeFrame}` : message);
62261
62526
  else delete out.transform;
62262
62527
  }
62263
62528
  }
62264
- if ((_a = out.children) == null ? void 0 : _a.length) {
62529
+ if ((_a2 = out.children) == null ? void 0 : _a2.length) {
62265
62530
  const children = out.children.map(walk);
62266
62531
  if (children.some((c, i) => c !== out.children[i])) out = __spreadProps2(__spreadValues2({}, out), { children });
62267
62532
  }
@@ -62269,15 +62534,15 @@ ${codeFrame}` : message);
62269
62534
  };
62270
62535
  return walk(root);
62271
62536
  }
62272
- function materialiseAllInTree(doc, engine, opts) {
62273
- var _a, _b;
62537
+ function materializeAllInTree(doc, engine, opts) {
62538
+ var _a2, _b;
62274
62539
  let root = applyPlayerEffects(doc).root;
62275
- root = materialiseOffsetPathsInTree(root);
62276
- const duration = (_b = (_a = getAnimatorConfig(root)) == null ? void 0 : _a.duration) != null ? _b : DEFAULT_DURATION_MS;
62277
- root = materialiseInternalLoopsInTree(root, duration);
62278
- if (engine === PxAnimatorEngine.waapi) {
62279
- root = materialiseMotionPathsInTree(root, opts == null ? void 0 : opts.motionPath);
62280
- root = materialiseAnimatedUseInstances(root);
62540
+ root = materializeOffsetPathsInTree(root);
62541
+ const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b : DEFAULT_DURATION_MS;
62542
+ root = materializeInternalLoopsInTree(root, duration);
62543
+ if (engine === PxTimelineEngine.native) {
62544
+ root = materializeMotionPathsInTree(root, opts == null ? void 0 : opts.motionPath);
62545
+ root = materializeAnimatedUseInstances(root);
62281
62546
  root = pruneUnreferencedDefs(root);
62282
62547
  }
62283
62548
  return root;
@@ -62285,9 +62550,9 @@ ${codeFrame}` : message);
62285
62550
  function pruneUnreferencedDefs(root) {
62286
62551
  const stripHash3 = (h3) => h3.startsWith("#") ? h3.slice(1) : h3;
62287
62552
  const walk = (n, fn) => {
62288
- var _a;
62553
+ var _a2;
62289
62554
  fn(n);
62290
- (_a = n.children) == null ? void 0 : _a.forEach((c) => walk(c, fn));
62555
+ (_a2 = n.children) == null ? void 0 : _a2.forEach((c) => walk(c, fn));
62291
62556
  };
62292
62557
  let changed = true;
62293
62558
  while (changed) {
@@ -62311,6 +62576,38 @@ ${codeFrame}` : message);
62311
62576
  }
62312
62577
  return root;
62313
62578
  }
62579
+ var PX_RATE_REJECTED = "setPlaybackRate: rate must be finite and non-zero";
62580
+ function isValidPlaybackRate(rate) {
62581
+ return Number.isFinite(rate) && rate !== 0;
62582
+ }
62583
+ function seekCeilingMs(durationMs, iterations) {
62584
+ if (!(durationMs > 0)) return 0;
62585
+ if (iterations === Infinity) return Infinity;
62586
+ return durationMs * (iterations > 0 ? iterations : 1);
62587
+ }
62588
+ function progressSpanMs(durationMs, iterations) {
62589
+ if (!(durationMs > 0)) return 0;
62590
+ if (iterations === Infinity) return durationMs;
62591
+ return durationMs * (iterations > 0 ? iterations : 1);
62592
+ }
62593
+ function clampSeekMs(timeMs, ceilingMs) {
62594
+ if (Number.isNaN(timeMs) || timeMs < 0) return 0;
62595
+ if (Number.isFinite(ceilingMs)) return timeMs > ceilingMs ? ceilingMs : timeMs;
62596
+ return Number.isFinite(timeMs) ? timeMs : 0;
62597
+ }
62598
+ function timeToProgress(timeMs, durationMs, iterations) {
62599
+ const span = progressSpanMs(durationMs, iterations);
62600
+ if (!(span > 0) || !Number.isFinite(timeMs)) return 0;
62601
+ if (timeMs <= 0) return 0;
62602
+ if (iterations === Infinity) return timeMs % span / span;
62603
+ return timeMs >= span ? 1 : timeMs / span;
62604
+ }
62605
+ function progressToTimeMs(progress, durationMs, iterations) {
62606
+ const span = progressSpanMs(durationMs, iterations);
62607
+ if (!(span > 0) || !Number.isFinite(progress)) return 0;
62608
+ if (progress <= 0) return 0;
62609
+ return progress >= 1 ? span : progress * span;
62610
+ }
62314
62611
  function requestFrame(cb) {
62315
62612
  const g = globalThis;
62316
62613
  if (typeof g.requestAnimationFrame === "function") return g.requestAnimationFrame(cb);
@@ -62325,9 +62622,9 @@ ${codeFrame}` : message);
62325
62622
  g.clearTimeout(handle);
62326
62623
  }
62327
62624
  function createBasicFrameLoopAnimator(doc, adapter, callbacks) {
62328
- var _a;
62625
+ var _a2;
62329
62626
  const config = getAnimatorConfig(doc) || {};
62330
- const bindings = getNormalisedBindings(doc, PxAnimatorEngine.frames);
62627
+ const bindings = getNormalizedBindings(doc, PxTimelineEngine.js);
62331
62628
  const _iterations = config.iterations;
62332
62629
  let iterations = 1;
62333
62630
  if (typeof _iterations === "number") iterations = _iterations || 1;
@@ -62336,7 +62633,7 @@ ${codeFrame}` : message);
62336
62633
  const duration = +(config.duration || DEFAULT_DURATION_MS);
62337
62634
  const totalDuration = duration && iterations ? duration * (iterations === Infinity ? Infinity : iterations) : duration ? (iterations != null ? iterations : 1) * duration : 0;
62338
62635
  const direction = config.direction || "normal";
62339
- const fill = (_a = config.fill) != null ? _a : "forwards";
62636
+ const fill = (_a2 = config.fill) != null ? _a2 : "forwards";
62340
62637
  const fillsForwards = fill === "forwards" || fill === "both";
62341
62638
  const fillsBackwards = fill === "backwards" || fill === "both";
62342
62639
  let timerId = null;
@@ -62398,7 +62695,7 @@ ${codeFrame}` : message);
62398
62695
  }
62399
62696
  }
62400
62697
  const tick = () => {
62401
- var _a2, _b;
62698
+ var _a3, _b;
62402
62699
  if (!adapter.isConnected()) {
62403
62700
  pauseAnim();
62404
62701
  return;
@@ -62414,7 +62711,7 @@ ${codeFrame}` : message);
62414
62711
  renderFrame(0);
62415
62712
  if (!finishCalled) {
62416
62713
  finishCalled = true;
62417
- (_a2 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a2.call(callbacks);
62714
+ (_a3 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a3.call(callbacks);
62418
62715
  }
62419
62716
  return;
62420
62717
  }
@@ -62506,17 +62803,17 @@ ${codeFrame}` : message);
62506
62803
  }
62507
62804
  };
62508
62805
  const cancelAnim = () => {
62509
- var _a2;
62806
+ var _a3;
62510
62807
  pauseAnim();
62511
62808
  timeBeforeLastStartMs = 0;
62512
62809
  lastStartedTs = 0;
62513
62810
  playing = false;
62514
62811
  finishCalled = false;
62515
62812
  renderFrame(timeBeforeLastStartMs);
62516
- (_a2 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a2.call(callbacks);
62813
+ (_a3 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a3.call(callbacks);
62517
62814
  };
62518
62815
  const finishAnim = (callOnFinish = true) => {
62519
- var _a2;
62816
+ var _a3;
62520
62817
  if (Number.isFinite(totalDuration)) {
62521
62818
  timeBeforeLastStartMs = totalDuration;
62522
62819
  } else {
@@ -62531,7 +62828,7 @@ ${codeFrame}` : message);
62531
62828
  renderFrame(fillsForwards ? timeBeforeLastStartMs : 0);
62532
62829
  if (callOnFinish && !finishCalled) {
62533
62830
  finishCalled = true;
62534
- (_a2 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a2.call(callbacks);
62831
+ (_a3 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a3.call(callbacks);
62535
62832
  }
62536
62833
  };
62537
62834
  const api = {
@@ -62541,14 +62838,14 @@ ${codeFrame}` : message);
62541
62838
  return _isPlaying();
62542
62839
  },
62543
62840
  "play": () => {
62544
- var _a2;
62841
+ var _a3;
62545
62842
  startAnim();
62546
- (_a2 = callbacks == null ? void 0 : callbacks.onPlay) == null ? void 0 : _a2.call(callbacks);
62843
+ (_a3 = callbacks == null ? void 0 : callbacks.onPlay) == null ? void 0 : _a3.call(callbacks);
62547
62844
  },
62548
62845
  "pause": () => {
62549
- var _a2;
62846
+ var _a3;
62550
62847
  pauseAnim();
62551
- (_a2 = callbacks == null ? void 0 : callbacks.onPause) == null ? void 0 : _a2.call(callbacks);
62848
+ (_a3 = callbacks == null ? void 0 : callbacks.onPause) == null ? void 0 : _a3.call(callbacks);
62552
62849
  },
62553
62850
  "cancel": () => {
62554
62851
  cancelAnim();
@@ -62557,8 +62854,8 @@ ${codeFrame}` : message);
62557
62854
  finishAnim(true);
62558
62855
  },
62559
62856
  "setPlaybackRate": (rate) => {
62560
- if (!isFinite(rate) || rate === 0) {
62561
- console.warn("setPlaybackRate: rate must be finite and non-zero");
62857
+ if (!isValidPlaybackRate(rate)) {
62858
+ console.warn(PX_RATE_REJECTED);
62562
62859
  return;
62563
62860
  }
62564
62861
  let current = getRawAnimTime();
@@ -62572,27 +62869,262 @@ ${codeFrame}` : message);
62572
62869
  return getAnimCurrentTime();
62573
62870
  },
62574
62871
  "setCurrentTime": (newTime) => {
62575
- if (newTime < 0) newTime = 0;
62576
- if (Number.isFinite(totalDuration) && newTime > totalDuration) newTime = totalDuration;
62872
+ newTime = clampSeekMs(newTime, totalDuration);
62577
62873
  timeBeforeLastStartMs = newTime;
62578
62874
  if (playing) lastStartedTs = Date.now();
62579
62875
  if (!Number.isFinite(totalDuration) || newTime < totalDuration) finishCalled = false;
62580
62876
  renderFrame(getAnimCurrentTime());
62581
62877
  },
62878
+ "getCurrentProgress": () => timeToProgress(getAnimCurrentTime(), duration, iterations),
62879
+ "setCurrentProgress": (progress) => {
62880
+ api.setCurrentTime(progressToTimeMs(progress, duration, iterations));
62881
+ },
62582
62882
  "destroy": () => {
62583
- var _a2;
62883
+ var _a3;
62584
62884
  api.cancel();
62585
- (_a2 = callbacks == null ? void 0 : callbacks.onRemove) == null ? void 0 : _a2.call(callbacks);
62885
+ (_a3 = callbacks == null ? void 0 : callbacks.onRemove) == null ? void 0 : _a3.call(callbacks);
62586
62886
  }
62587
62887
  };
62588
62888
  return api;
62589
62889
  }
62590
- function setupAnimationTriggers(api, config) {
62591
- const { startOn, outAction = "continue", scrollIntoViewThreshold = 0 } = config;
62890
+ var PxDiagnosticKind = {
62891
+ /** The document is wrong — regenerate or repair the file. */
62892
+ document: "document",
62893
+ /** The page or app cannot provide what the document asks for — fix the mount. */
62894
+ host: "host",
62895
+ /** The platform cannot do it and the player degraded — usually nothing to fix. */
62896
+ platform: "platform",
62897
+ /** The call is wrong or self-contradictory — fix the options or props you passed. */
62898
+ usage: "usage",
62899
+ /** The player failed where it did not expect to — report it to us. */
62900
+ internal: "internal"
62901
+ };
62902
+ function asError(error) {
62903
+ return typeof error === "string" ? new Error(error) : error;
62904
+ }
62905
+ function isSilenced(silent, kind) {
62906
+ if (!silent) return false;
62907
+ return silent === true || silent.includes(kind);
62908
+ }
62909
+ function createDiagnostics(config, prefix) {
62910
+ const tag = prefix ? prefix + " " : "";
62911
+ return {
62912
+ warn: (kind, message, detail) => {
62913
+ if (config == null ? void 0 : config.onWarn) {
62914
+ config.onWarn({ kind, message, detail });
62915
+ return;
62916
+ }
62917
+ if (isSilenced(config == null ? void 0 : config.silent, kind)) return;
62918
+ const line = tag + kind + ": " + message;
62919
+ if (detail === void 0) console.warn(line);
62920
+ else console.warn(line, detail);
62921
+ },
62922
+ error: (kind, error) => {
62923
+ const err = asError(error);
62924
+ if (config == null ? void 0 : config.onError) {
62925
+ config.onError({ kind, message: err.message, error: err });
62926
+ return;
62927
+ }
62928
+ if (isSilenced(config == null ? void 0 : config.silent, kind)) return;
62929
+ console.error(tag + kind + ": " + err.message);
62930
+ }
62931
+ };
62932
+ }
62933
+ var FLAT_ONLY_KEYS = [
62934
+ "timelineSource",
62935
+ "scroll",
62936
+ "trigger",
62937
+ "delay",
62938
+ "iterations",
62939
+ "direction",
62940
+ "fill",
62941
+ "resetOnFinish",
62942
+ "duration",
62943
+ "mode",
62944
+ "frameRate"
62945
+ ];
62946
+ var CONTENT_KEYS = ["definitions", "animateById"];
62947
+ var isPlainObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
62948
+ var timelineTypeOf = (t) => isPlainObject(t) && typeof t.type === "string" ? t.type : "time";
62949
+ var isScrollish = (type) => type === "scroll" || type === "view";
62950
+ function mergePlain(base, patch) {
62951
+ const out = isPlainObject(base) ? __spreadValues2({}, base) : {};
62952
+ for (const key of Object.keys(patch)) {
62953
+ const value = patch[key];
62954
+ if (value === null) {
62955
+ delete out[key];
62956
+ continue;
62957
+ }
62958
+ if (isPlainObject(value)) {
62959
+ out[key] = mergePlain(out[key], value);
62960
+ continue;
62961
+ }
62962
+ out[key] = value;
62963
+ }
62964
+ return out;
62965
+ }
62966
+ function mergeTimeline(base, patch, warn2) {
62967
+ const baseType = timelineTypeOf(base);
62968
+ const patchNamesType = isPlainObject(patch) && typeof patch.type === "string";
62969
+ const patchType = patchNamesType ? String(patch.type) : baseType;
62970
+ let merged;
62971
+ if (patchType !== baseType) {
62972
+ const carried = {};
62973
+ if (isPlainObject(base)) {
62974
+ for (const k of PX_TIMELINE_SHARED_KEYS) {
62975
+ if (base[k] !== void 0) carried[k] = base[k];
62976
+ }
62977
+ }
62978
+ merged = mergePlain(carried, patch);
62979
+ } else {
62980
+ merged = mergePlain(base, patch);
62981
+ }
62982
+ if (isScrollish(patchType)) {
62983
+ for (const k of PX_TIME_ONLY_TIMELINE_KEYS) {
62984
+ if (merged[k] === void 0) continue;
62985
+ warn2("animator.timeline." + k + ": no slot on a '" + patchType + "' timeline \u2014 dropped");
62986
+ delete merged[k];
62987
+ }
62988
+ if (merged.iterations === "infinite") {
62989
+ warn2("animator.timeline.iterations: 'infinite' cannot map onto a scroll range \u2014 dropped");
62990
+ delete merged.iterations;
62991
+ }
62992
+ }
62993
+ return merged;
62994
+ }
62995
+ function foldTimelineOverride(timeline, shortcuts) {
62996
+ let base;
62997
+ if (typeof timeline === "string") {
62998
+ try {
62999
+ base = JSON.parse(timeline);
63000
+ } catch (e) {
63001
+ console.warn("timeline override: not valid JSON \u2014 ignored", e);
63002
+ base = void 0;
63003
+ }
63004
+ } else {
63005
+ base = timeline != null ? timeline : void 0;
63006
+ }
63007
+ const { duration, delay, iterations, startOn } = shortcuts;
63008
+ if (duration === void 0 && delay === void 0 && iterations === void 0 && startOn === void 0) {
63009
+ return base === void 0 ? void 0 : { timeline: base };
63010
+ }
63011
+ const out = isPlainObject(base) ? __spreadValues2({}, base) : {};
63012
+ if (duration !== void 0) out.duration = duration;
63013
+ if (delay !== void 0) out.delay = delay;
63014
+ if (iterations !== void 0) out.iterations = iterations;
63015
+ if (startOn !== void 0) {
63016
+ out.trigger = __spreadProps2(__spreadValues2({}, out.trigger), { startOn });
63017
+ }
63018
+ return { timeline: out };
63019
+ }
63020
+ function mergeAnimatorConfig(base, patch) {
63021
+ const warnings = [];
63022
+ const warn2 = (m) => warnings.push(m);
63023
+ if (patch === null) return { config: void 0, warnings };
63024
+ if (!isPlainObject(patch) || Object.keys(patch).length === 0) {
63025
+ return { config: base, warnings };
63026
+ }
63027
+ const flatInBase = isPlainObject(base) ? FLAT_ONLY_KEYS.filter((k) => base[k] !== void 0) : [];
63028
+ if (flatInBase.length) {
63029
+ warn2("animator: the base carries the flat runtime spelling (" + flatInBase.join(", ") + "); the patch merges the wire spelling only");
63030
+ }
63031
+ const out = isPlainObject(base) ? __spreadValues2({}, base) : {};
63032
+ for (const key of Object.keys(patch)) {
63033
+ const value = patch[key];
63034
+ if (value === null) {
63035
+ delete out[key];
63036
+ continue;
63037
+ }
63038
+ if (key === "timeline") {
63039
+ out.timeline = isPlainObject(value) ? mergeTimeline(out.timeline, value, warn2) : value;
63040
+ continue;
63041
+ }
63042
+ if (isPlainObject(value)) {
63043
+ out[key] = mergePlain(out[key], value);
63044
+ continue;
63045
+ }
63046
+ out[key] = value;
63047
+ }
63048
+ return { config: out, warnings };
63049
+ }
63050
+ function applyAnimatorConfig(doc, patch, opts) {
63051
+ var _a2, _b;
63052
+ const reset = !!(opts == null ? void 0 : opts.resetDefaults);
63053
+ if (!doc || (patch === void 0 || !reset && (patch === null || !isPlainObject(patch) || !Object.keys(patch).length))) {
63054
+ return { doc, warnings: [] };
63055
+ }
63056
+ const anyDoc = doc;
63057
+ const atRoot = isPlainObject(anyDoc.animator);
63058
+ const atMeta = !atRoot && isPlainObject((_a2 = anyDoc.meta) == null ? void 0 : _a2.animator);
63059
+ const current = atRoot ? anyDoc.animator : atMeta ? anyDoc.meta.animator : void 0;
63060
+ const warnings = [];
63061
+ if (atRoot && isPlainObject((_b = anyDoc.meta) == null ? void 0 : _b.animator)) {
63062
+ warnings.push("animator: doc.meta.animator is shadowed by doc.animator and was not patched");
63063
+ }
63064
+ let base = current;
63065
+ if (reset) {
63066
+ const kept = {};
63067
+ for (const k of CONTENT_KEYS) {
63068
+ if (isPlainObject(current) && current[k] !== void 0) kept[k] = current[k];
63069
+ }
63070
+ base = kept;
63071
+ }
63072
+ const merged = mergeAnimatorConfig(base, patch != null ? patch : {});
63073
+ warnings.push(...merged.warnings);
63074
+ if (merged.config === current) return { doc, warnings };
63075
+ if (atMeta) {
63076
+ return {
63077
+ doc: __spreadProps2(__spreadValues2({}, anyDoc), { meta: __spreadProps2(__spreadValues2({}, anyDoc.meta), { animator: merged.config }) }),
63078
+ warnings
63079
+ };
63080
+ }
63081
+ return { doc: __spreadProps2(__spreadValues2({}, anyDoc), { animator: merged.config }), warnings };
63082
+ }
63083
+ var MAX_REPORTED = 6;
63084
+ function diagnoseDocument(doc) {
63085
+ try {
63086
+ return { problems: validateDocument(doc) };
63087
+ } catch (e) {
63088
+ return { problems: [] };
63089
+ }
63090
+ }
63091
+ function reportDocumentDiagnostics(doc, where) {
63092
+ const { problems } = diagnoseDocument(doc);
63093
+ if (!problems.length) return;
63094
+ const shown = problems.slice(0, MAX_REPORTED);
63095
+ const more = problems.length - shown.length;
63096
+ console.warn(
63097
+ where + ": this document does not match the animation schema in " + problems.length + " place" + (problems.length === 1 ? "" : "s") + ".\n" + shown.map((p) => " - " + p).join("\n") + (more > 0 ? "\n \u2026 and " + more + " more" : "") + "\n\nIf you did not author these keys, the usual cause is a build that MANGLES PROPERTY NAMES. An animation document is data loaded at runtime, so renaming the property reads inside the player stops them matching the keys in the JSON, and the animation silently does nothing. Feed the published reserved-name list to your minifier \u2014 @pixodesk/svg-animator-web/mangle-reserved.json \u2014 see docs/library/minification.md."
63098
+ );
63099
+ }
63100
+ function toEngineCallbacks(inline) {
63101
+ const { onPlay, onPause, onCancel, onFinish, onRemove, onStop, onWarn, onError, silent } = inline != null ? inline : {};
63102
+ const withStop = (own) => own || onStop ? () => {
63103
+ own == null ? void 0 : own();
63104
+ onStop == null ? void 0 : onStop();
63105
+ } : void 0;
63106
+ return {
63107
+ onPlay,
63108
+ onPause: withStop(onPause),
63109
+ onCancel: withStop(onCancel),
63110
+ onFinish: withStop(onFinish),
63111
+ onRemove: withStop(onRemove),
63112
+ onWarn,
63113
+ onError,
63114
+ silent
63115
+ };
63116
+ }
63117
+ function setupAnimationTriggers(api, config, diag) {
63118
+ const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
63119
+ const cleanups = [];
63120
+ const dispose = () => {
63121
+ for (const undo of cleanups.splice(0)) undo();
63122
+ };
63123
+ const { startOn, outAction, scrollIntoViewThreshold } = resolveTrigger(config);
62592
63124
  const root = api.getRootElement();
62593
63125
  if (!root) {
62594
- console.warn("setupAnimationTriggers: No root element found for animation.");
62595
- return api;
63126
+ report.warn(PxDiagnosticKind.host, "setupAnimationTriggers: No root element found for animation.");
63127
+ return dispose;
62596
63128
  }
62597
63129
  let reversed = false;
62598
63130
  const start = () => {
@@ -62627,6 +63159,7 @@ ${codeFrame}` : message);
62627
63159
  startHandler();
62628
63160
  } else {
62629
63161
  window.addEventListener("load", startHandler, { once: true });
63162
+ cleanups.push(() => window.removeEventListener("load", startHandler));
62630
63163
  }
62631
63164
  break;
62632
63165
  }
@@ -62641,6 +63174,10 @@ ${codeFrame}` : message);
62641
63174
  };
62642
63175
  root.addEventListener("mouseenter", mouseOverHandler);
62643
63176
  root.addEventListener("mouseleave", mouseOutHandler);
63177
+ cleanups.push(() => {
63178
+ root.removeEventListener("mouseenter", mouseOverHandler);
63179
+ root.removeEventListener("mouseleave", mouseOutHandler);
63180
+ });
62644
63181
  break;
62645
63182
  }
62646
63183
  case "click": {
@@ -62652,16 +63189,17 @@ ${codeFrame}` : message);
62652
63189
  }
62653
63190
  };
62654
63191
  root.addEventListener("click", clickHandler);
63192
+ cleanups.push(() => root.removeEventListener("click", clickHandler));
62655
63193
  break;
62656
63194
  }
62657
63195
  case "scrollIntoView": {
62658
63196
  const effectiveRatio = (entry) => {
62659
- var _a, _b;
63197
+ var _a2, _b;
62660
63198
  const target = entry.boundingClientRect;
62661
63199
  const visible = entry.intersectionRect;
62662
63200
  if (!(target == null ? void 0 : target.height) || !visible) return entry.intersectionRatio;
62663
63201
  const live = typeof window !== "undefined" && window.innerHeight ? window.innerHeight : Infinity;
62664
- const declared = (_b = (_a = entry.rootBounds) == null ? void 0 : _a.height) != null ? _b : Infinity;
63202
+ const declared = (_b = (_a2 = entry.rootBounds) == null ? void 0 : _a2.height) != null ? _b : Infinity;
62665
63203
  const viewport = Math.min(live, declared);
62666
63204
  const denom = Math.min(target.height, Number.isFinite(viewport) ? viewport : target.height);
62667
63205
  return denom > 0 ? visible.height / denom : entry.intersectionRatio;
@@ -62683,46 +63221,53 @@ ${codeFrame}` : message);
62683
63221
  { threshold: thresholdSteps }
62684
63222
  );
62685
63223
  observer.observe(root);
63224
+ cleanups.push(() => observer.disconnect());
62686
63225
  break;
62687
63226
  }
62688
63227
  case "programmatic":
62689
63228
  break;
62690
63229
  }
62691
- return api;
63230
+ return dispose;
62692
63231
  }
62693
63232
  function getSelector(id) {
62694
63233
  return "#" + id;
62695
63234
  }
62696
63235
  function createFrameLoopAnimator(doc, adapter, callbacks, rootElement) {
63236
+ var _a2;
62697
63237
  const config = getAnimatorConfig(doc) || {};
63238
+ const diag = createDiagnostics(callbacks, "[PxAnimator]");
62698
63239
  if (!rootElement) {
62699
63240
  if (doc.id) {
62700
63241
  const rootSelector = getSelector(doc.id);
62701
63242
  rootElement = document.querySelector(rootSelector);
62702
- if (!rootElement) console.warn("createFrameLoopAnimator: No root element found for selector: ", rootSelector);
63243
+ if (!rootElement) diag.warn(PxDiagnosticKind.host, "createFrameLoopAnimator: No root element found for selector: " + rootSelector);
62703
63244
  } else {
62704
- console.warn("createFrameLoopAnimator: No root element provided");
63245
+ diag.warn(PxDiagnosticKind.host, "createFrameLoopAnimator: No root element provided");
62705
63246
  }
62706
63247
  }
62707
63248
  const basicApi = createBasicFrameLoopAnimator(
62708
63249
  doc,
62709
- adapter || createDomAdapter(rootElement),
63250
+ adapter || createDomAdapter(rootElement, diag),
62710
63251
  callbacks
62711
63252
  );
62712
63253
  const api = __spreadProps(__spreadValues({}, basicApi), {
62713
63254
  "getRootElement": () => rootElement || null
62714
63255
  });
62715
- if (config.trigger) {
62716
- if (isScrollTimeline(config)) {
62717
- console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
62718
- } else {
62719
- setupAnimationTriggers(api, config.trigger);
62720
- }
63256
+ if (isScrollTimeline(config)) {
63257
+ if (config.trigger) diag.warn(PxDiagnosticKind.usage, "scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
63258
+ } else {
63259
+ const detachTriggers = setupAnimationTriggers(api, (_a2 = config.trigger) != null ? _a2 : {}, diag);
63260
+ const destroyEngine = api.destroy.bind(api);
63261
+ api.destroy = () => {
63262
+ detachTriggers();
63263
+ destroyEngine();
63264
+ };
62721
63265
  }
62722
63266
  return api;
62723
63267
  }
62724
- function createDomAdapter(rootElement) {
63268
+ function createDomAdapter(rootElement, diag) {
62725
63269
  const warnedSelectors = /* @__PURE__ */ new Set();
63270
+ const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
62726
63271
  const adapter = {
62727
63272
  isConnected: () => {
62728
63273
  if (!rootElement) return true;
@@ -62734,7 +63279,7 @@ ${codeFrame}` : message);
62734
63279
  const elements = (rootElement == null ? void 0 : rootElement.querySelectorAll(selector)) || document.querySelectorAll(selector);
62735
63280
  if (elements.length === 0 && !warnedSelectors.has(selector)) {
62736
63281
  warnedSelectors.add(selector);
62737
- console.warn('setAttribute: No elements found for selector "' + selector + '"');
63282
+ report.warn(PxDiagnosticKind.host, 'setAttribute: No elements found for selector "' + selector + '"');
62738
63283
  }
62739
63284
  for (let i = 0; i < elements.length; i++) {
62740
63285
  const element = elements[i];
@@ -62749,16 +63294,15 @@ ${codeFrame}` : message);
62749
63294
  return adapter;
62750
63295
  }
62751
63296
  function createCssKf(kf, t, propName, unsupportedSet) {
62752
- var _a, _b;
62753
- let value = (_a = kf.v) != null ? _a : kf.value;
62754
- const e = (_b = kf.e) != null ? _b : kf.easing;
63297
+ let value = kfValue(kf);
63298
+ const e = kfEasing(kf);
62755
63299
  const cssKf = {
62756
63300
  offset: t,
62757
63301
  easing: e && Array.isArray(e) ? "cubic-bezier(" + e.join(",") + ")" : void 0
62758
63302
  };
62759
63303
  let cssValue;
62760
63304
  let cssKey = propName;
62761
- if (COLOUR_ATTR_NAMES.has(propName) && Array.isArray(value)) {
63305
+ if (COLOR_ATTR_NAMES.has(propName) && Array.isArray(value)) {
62762
63306
  cssValue = toRGBA(value);
62763
63307
  } else if (propName === "transform" && value !== null && typeof value === "object" && !Array.isArray(value)) {
62764
63308
  cssValue = composeTransformParts(value, { withUnits: true });
@@ -62785,11 +63329,11 @@ ${codeFrame}` : message);
62785
63329
  return cssKf;
62786
63330
  }
62787
63331
  function clipKeyframesToDuration(propName, keyframes, duration) {
62788
- var _a, _b, _c, _d, _e;
63332
+ var _a2, _b, _c, _d, _e;
62789
63333
  const result = [];
62790
63334
  for (let i = 0; i < keyframes.length; i++) {
62791
63335
  const kf = keyframes[i];
62792
- const t = (_a = kf.t) != null ? _a : 0;
63336
+ const t = (_a2 = kf.t) != null ? _a2 : 0;
62793
63337
  if (t < 0) {
62794
63338
  const next = keyframes[i + 1];
62795
63339
  if (next && ((_b = next.t) != null ? _b : 0) >= 0) {
@@ -62818,7 +63362,7 @@ ${codeFrame}` : message);
62818
63362
  return result;
62819
63363
  }
62820
63364
  function convertToWebApiKeyframes(animDef, unsupportedSet, config) {
62821
- var _a;
63365
+ var _a2;
62822
63366
  const result = /* @__PURE__ */ new Map();
62823
63367
  for (const [propName, propAnim] of Object.entries(animDef)) {
62824
63368
  const duration = config.duration || 1;
@@ -62826,7 +63370,7 @@ ${codeFrame}` : message);
62826
63370
  const cssKeyframes = [];
62827
63371
  for (let i = 0; i < clippedKeyframes.length; i++) {
62828
63372
  const kf = clippedKeyframes[i];
62829
- const t = clamp(((_a = kf.t) != null ? _a : 0) / duration, 0, 1);
63373
+ const t = clamp(((_a2 = kf.t) != null ? _a2 : 0) / duration, 0, 1);
62830
63374
  const cssKf = createCssKf(kf, t, propName, unsupportedSet);
62831
63375
  if (i === 0 && (cssKf.offset || 0) > 0) {
62832
63376
  cssKeyframes.push(__spreadProps(__spreadValues({}, cssKf), { offset: 0 }));
@@ -62845,18 +63389,19 @@ ${codeFrame}` : message);
62845
63389
  return result;
62846
63390
  }
62847
63391
  function createWebApiAnimator(doc, callbacks, rootElement, forceEvenIfHasUnsupportedAttrs, scrollTimeline) {
62848
- var _a;
63392
+ var _a2, _b;
62849
63393
  const config = getAnimatorConfig(doc) || {};
63394
+ const diag = createDiagnostics(callbacks, "[PxAnimator]");
62850
63395
  if (!rootElement) {
62851
63396
  if (doc.id) {
62852
63397
  const rootSelector = getSelector(doc.id);
62853
63398
  rootElement = document.querySelector(rootSelector);
62854
- if (!rootElement) console.warn("createFrameLoopAnimator: No root element found for selector: ", rootSelector);
63399
+ if (!rootElement) diag.warn(PxDiagnosticKind.host, "createWebApiAnimator: No root element found for selector: " + rootSelector);
62855
63400
  } else {
62856
- console.warn("createFrameLoopAnimator: No root element provided");
63401
+ diag.warn(PxDiagnosticKind.host, "createWebApiAnimator: No root element provided");
62857
63402
  }
62858
63403
  }
62859
- const bindings = getNormalisedBindings(doc, PxAnimatorEngine.waapi);
63404
+ const bindings = getNormalizedBindings(doc, PxTimelineEngine.native);
62860
63405
  const animations = [];
62861
63406
  const _iterations = config.iterations;
62862
63407
  let iterations;
@@ -62866,18 +63411,18 @@ ${codeFrame}` : message);
62866
63411
  let finishNotified = false;
62867
63412
  let removeCalled = false;
62868
63413
  if (!(bindings == null ? void 0 : bindings.length)) {
62869
- console.warn("createWebApiAnimator: No animation bindings defined");
63414
+ diag.warn(PxDiagnosticKind.document, "createWebApiAnimator: No animation bindings defined");
62870
63415
  }
62871
63416
  for (const binding of bindings || []) {
62872
63417
  const animDef = binding.animate;
62873
63418
  if (!animDef || typeof animDef !== "object" || Array.isArray(animDef)) {
62874
- console.warn("createWebApiAnimator: Empty or unresolved binding", binding);
63419
+ diag.warn(PxDiagnosticKind.document, "createWebApiAnimator: Empty or unresolved binding", binding);
62875
63420
  continue;
62876
63421
  }
62877
63422
  const selector = getSelector(binding.id);
62878
63423
  const elements = (rootElement == null ? void 0 : rootElement.querySelectorAll(selector)) || document.querySelectorAll(selector);
62879
63424
  if (elements.length === 0) {
62880
- console.warn('createWebApiAnimator: No elements found for selector "' + selector + '"');
63425
+ diag.warn(PxDiagnosticKind.host, 'createWebApiAnimator: No elements found for selector "' + selector + '"');
62881
63426
  }
62882
63427
  const keyframesMap = convertToWebApiKeyframes(animDef, unsupportedSet, config);
62883
63428
  const positiveDelay = config.delay && config.delay > 0 ? config.delay : void 0;
@@ -62893,7 +63438,7 @@ ${codeFrame}` : message);
62893
63438
  // animation ends — consistent with Lottie and other animation runtimes.
62894
63439
  // Without this, seeking to the last frame reverts elements to their
62895
63440
  // pre-animation state (the Web Animations API "after" phase with fill:'none').
62896
- fill: (_a = config.fill) != null ? _a : "forwards",
63441
+ fill: (_a2 = config.fill) != null ? _a2 : "forwards",
62897
63442
  direction: config.direction,
62898
63443
  iterations
62899
63444
  };
@@ -62910,61 +63455,61 @@ ${codeFrame}` : message);
62910
63455
  if (scrollTimeline.rangeEnd) a.rangeEnd = scrollTimeline.rangeEnd;
62911
63456
  }
62912
63457
  if (callbacks == null ? void 0 : callbacks.onFinish) anim.onfinish = () => {
62913
- var _a2;
63458
+ var _a3;
62914
63459
  if (finishNotified) return;
62915
63460
  finishNotified = true;
62916
- (_a2 = callbacks.onFinish) == null ? void 0 : _a2.call(callbacks);
63461
+ (_a3 = callbacks.onFinish) == null ? void 0 : _a3.call(callbacks);
62917
63462
  };
62918
63463
  if (callbacks == null ? void 0 : callbacks.onRemove) anim.onremove = () => {
62919
- var _a2;
63464
+ var _a3;
62920
63465
  if (removeCalled) return;
62921
63466
  removeCalled = true;
62922
- (_a2 = callbacks.onRemove) == null ? void 0 : _a2.call(callbacks);
63467
+ (_a3 = callbacks.onRemove) == null ? void 0 : _a3.call(callbacks);
62923
63468
  };
62924
63469
  if (seekPosition !== void 0) {
62925
63470
  anim.currentTime = seekPosition;
62926
63471
  }
62927
63472
  animations.push(anim);
62928
63473
  } catch (e) {
62929
- console.warn(e);
63474
+ diag.warn(PxDiagnosticKind.internal, "createWebApiAnimator: could not build the animation", e);
62930
63475
  }
62931
63476
  }
62932
63477
  }
62933
63478
  }
62934
63479
  }
62935
63480
  if (!forceEvenIfHasUnsupportedAttrs && unsupportedSet.size) {
62936
- console.warn("Unsupported CSS attrs: " + [...unsupportedSet].join(", "));
63481
+ diag.warn(PxDiagnosticKind.platform, "Unsupported CSS attrs: " + [...unsupportedSet].join(", "));
62937
63482
  return null;
62938
63483
  }
62939
63484
  const api = {
62940
63485
  "isReady": () => true,
62941
63486
  "getRootElement": () => rootElement || null,
62942
63487
  "isPlaying": () => {
62943
- var _a2;
62944
- return ((_a2 = animations[0]) == null ? void 0 : _a2.playState) === "running";
63488
+ var _a3;
63489
+ return ((_a3 = animations[0]) == null ? void 0 : _a3.playState) === "running";
62945
63490
  },
62946
63491
  "play": () => {
62947
- var _a2;
63492
+ var _a3;
62948
63493
  finishNotified = false;
62949
63494
  animations.forEach((a) => a.play());
62950
- (_a2 = callbacks == null ? void 0 : callbacks.onPlay) == null ? void 0 : _a2.call(callbacks);
63495
+ (_a3 = callbacks == null ? void 0 : callbacks.onPlay) == null ? void 0 : _a3.call(callbacks);
62951
63496
  },
62952
63497
  "pause": () => {
62953
- var _a2;
63498
+ var _a3;
62954
63499
  animations.forEach((a) => a.pause());
62955
- (_a2 = callbacks == null ? void 0 : callbacks.onPause) == null ? void 0 : _a2.call(callbacks);
63500
+ (_a3 = callbacks == null ? void 0 : callbacks.onPause) == null ? void 0 : _a3.call(callbacks);
62956
63501
  },
62957
63502
  "cancel": () => {
62958
- var _a2;
63503
+ var _a3;
62959
63504
  finishNotified = false;
62960
63505
  animations.forEach((a) => a.cancel());
62961
- (_a2 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a2.call(callbacks);
63506
+ (_a3 = callbacks == null ? void 0 : callbacks.onCancel) == null ? void 0 : _a3.call(callbacks);
62962
63507
  },
62963
63508
  "finish": () => {
62964
- var _a2;
63509
+ var _a3;
62965
63510
  for (const a of animations) {
62966
63511
  try {
62967
- if (((_a2 = a.effect) == null ? void 0 : _a2.getTiming().iterations) === Infinity) {
63512
+ if (((_a3 = a.effect) == null ? void 0 : _a3.getTiming().iterations) === Infinity) {
62968
63513
  a.effect.updateTiming({ iterations: 1 });
62969
63514
  a.finish();
62970
63515
  a.effect.updateTiming({ iterations: Infinity });
@@ -62977,36 +63522,55 @@ ${codeFrame}` : message);
62977
63522
  }
62978
63523
  },
62979
63524
  "setPlaybackRate": (rate) => {
63525
+ if (!isValidPlaybackRate(rate)) {
63526
+ diag.warn(PxDiagnosticKind.usage, PX_RATE_REJECTED);
63527
+ return api;
63528
+ }
62980
63529
  animations.forEach((a) => a.playbackRate = rate);
62981
63530
  return api;
62982
63531
  },
62983
63532
  "getCurrentTime": () => {
62984
- var _a2, _b;
62985
- const res = (_b = (_a2 = animations[0]) == null ? void 0 : _a2.currentTime) != null ? _b : null;
63533
+ var _a3, _b2;
63534
+ const res = (_b2 = (_a3 = animations[0]) == null ? void 0 : _a3.currentTime) != null ? _b2 : null;
62986
63535
  return res !== null ? +res : null;
62987
63536
  },
62988
63537
  "setCurrentTime": (time) => {
63538
+ var _a3;
63539
+ const ceiling = seekCeilingMs((_a3 = config.duration) != null ? _a3 : 0, iterations != null ? iterations : 1);
63540
+ const seek = ceiling > 0 ? clampSeekMs(time, ceiling) : Math.max(0, time);
62989
63541
  finishNotified = false;
62990
63542
  animations.forEach((a) => {
62991
- a.currentTime = time;
63543
+ a.currentTime = seek;
62992
63544
  });
62993
63545
  },
63546
+ "getCurrentProgress": () => {
63547
+ var _a3;
63548
+ const t = api.getCurrentTime();
63549
+ return t === null ? null : timeToProgress(t, (_a3 = config.duration) != null ? _a3 : 0, iterations != null ? iterations : 1);
63550
+ },
63551
+ "setCurrentProgress": (progress) => {
63552
+ var _a3;
63553
+ api.setCurrentTime(progressToTimeMs(progress, (_a3 = config.duration) != null ? _a3 : 0, iterations != null ? iterations : 1));
63554
+ },
62994
63555
  "destroy": () => {
62995
- var _a2;
63556
+ var _a3;
62996
63557
  api.cancel();
62997
63558
  animations.splice(0, animations.length);
62998
63559
  if (!removeCalled) {
62999
63560
  removeCalled = true;
63000
- (_a2 = callbacks == null ? void 0 : callbacks.onRemove) == null ? void 0 : _a2.call(callbacks);
63561
+ (_a3 = callbacks == null ? void 0 : callbacks.onRemove) == null ? void 0 : _a3.call(callbacks);
63001
63562
  }
63002
63563
  }
63003
63564
  };
63004
- if (config.trigger) {
63005
- if (config.timelineSource === "scroll") {
63006
- console.warn("scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
63007
- } else {
63008
- setupAnimationTriggers(api, config.trigger);
63009
- }
63565
+ if (config.timelineSource === "scroll") {
63566
+ if (config.trigger) diag.warn(PxDiagnosticKind.usage, "scroll timeline: `animator.trigger` is ignored (triggers do not apply to scroll-driven playback)");
63567
+ } else {
63568
+ const detachTriggers = setupAnimationTriggers(api, (_b = config.trigger) != null ? _b : {}, diag);
63569
+ const destroyEngine = api.destroy.bind(api);
63570
+ api.destroy = () => {
63571
+ detachTriggers();
63572
+ destroyEngine();
63573
+ };
63010
63574
  }
63011
63575
  if (scrollTimeline) {
63012
63576
  animations.forEach((a) => a.play());
@@ -63014,19 +63578,20 @@ ${codeFrame}` : message);
63014
63578
  return api;
63015
63579
  }
63016
63580
  function nativeRangeOffset(point, defaultFraction, view) {
63017
- var _a, _b, _c;
63581
+ var _a2, _b, _c;
63018
63582
  const fraction = typeof (point == null ? void 0 : point.fraction) === "number" ? point.fraction : defaultFraction;
63019
- const pct = (_b = (_a = globalThis.CSS) == null ? void 0 : _a.percent) == null ? void 0 : _b.call(_a, fraction * 100);
63583
+ const pct = (_b = (_a2 = globalThis.CSS) == null ? void 0 : _a2.percent) == null ? void 0 : _b.call(_a2, fraction * 100);
63020
63584
  if (pct === void 0) return void 0;
63021
63585
  return view ? { rangeName: (_c = point == null ? void 0 : point.phase) != null ? _c : "cover", offset: pct } : { offset: pct };
63022
63586
  }
63023
- function createNativeScrollTimeline(subject, config) {
63024
- var _a, _b, _c, _d;
63587
+ function createNativeScrollTimeline(subject, config, diag) {
63588
+ var _a2, _b, _c, _d;
63589
+ const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
63025
63590
  if (!config || !isScrollTimeline(config)) return null;
63026
63591
  const scroll = config.scroll || {};
63027
- const kind = (_a = scroll.kind) != null ? _a : "view";
63592
+ const kind = (_a2 = scroll.kind) != null ? _a2 : "view";
63028
63593
  if (scroll.smoothing) {
63029
- console.warn('scroll timeline: `smoothing` needs the built-in driver \u2014 ignoring `driver: "native"`');
63594
+ report.warn(PxDiagnosticKind.platform, "scroll timeline: `smoothing` needs the built-in driver \u2014 using the built-in driver instead of the browser timeline");
63030
63595
  return null;
63031
63596
  }
63032
63597
  const g = globalThis;
@@ -63037,13 +63602,13 @@ ${codeFrame}` : message);
63037
63602
  let timeline;
63038
63603
  try {
63039
63604
  if (view) {
63040
- timeline = new Ctor({ subject: resolveScrollSubject(subject, scroll.subject), axis });
63605
+ timeline = new Ctor({ subject: resolveScrollSubject(subject, scroll.subject, report), axis });
63041
63606
  } else {
63042
63607
  const source = scroll.source === "root" ? documentScroller() : findNearestScroller(subject, "y") || findNearestScroller(subject, "x") || documentScroller();
63043
63608
  timeline = new Ctor({ source, axis });
63044
63609
  }
63045
63610
  } catch (e) {
63046
- console.warn("scroll timeline: native timeline construction failed \u2014 falling back to the custom driver", e);
63611
+ report.warn(PxDiagnosticKind.platform, "scroll timeline: native timeline construction failed \u2014 falling back to the player measuring progress itself", e);
63047
63612
  return null;
63048
63613
  }
63049
63614
  return {
@@ -63070,8 +63635,9 @@ ${codeFrame}` : message);
63070
63635
  }
63071
63636
  var SUBJECT_PARENT = "parent";
63072
63637
  var SUBJECT_SCROLLER = "scroller";
63073
- function resolveScrollSubject(svgRoot, subject) {
63074
- var _a, _b;
63638
+ function resolveScrollSubject(svgRoot, subject, diag) {
63639
+ var _a2, _b;
63640
+ const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
63075
63641
  const spec = subject == null ? void 0 : subject.trim();
63076
63642
  if (!spec) return svgRoot;
63077
63643
  if (spec === SUBJECT_PARENT) {
@@ -63080,7 +63646,7 @@ ${codeFrame}` : message);
63080
63646
  const position = getComputedStyle(p).position;
63081
63647
  if (position === "sticky" || position === "fixed") outermostPinned = p;
63082
63648
  }
63083
- return (_b = (_a = outermostPinned == null ? void 0 : outermostPinned.parentElement) != null ? _a : svgRoot.parentElement) != null ? _b : svgRoot;
63649
+ return (_b = (_a2 = outermostPinned == null ? void 0 : outermostPinned.parentElement) != null ? _a2 : svgRoot.parentElement) != null ? _b : svgRoot;
63084
63650
  }
63085
63651
  if (spec === SUBJECT_SCROLLER) {
63086
63652
  return findNearestScroller(svgRoot, "y") || findNearestScroller(svgRoot, "x") || documentScroller();
@@ -63089,21 +63655,22 @@ ${codeFrame}` : message);
63089
63655
  try {
63090
63656
  found = document.querySelector(spec);
63091
63657
  } catch (e) {
63092
- console.warn('scroll timeline: subject "' + spec + '" is not a valid selector \u2014 measuring the SVG itself');
63658
+ report.warn(PxDiagnosticKind.document, 'scroll timeline: subject "' + spec + '" is not a valid selector \u2014 measuring the SVG itself');
63093
63659
  return svgRoot;
63094
63660
  }
63095
63661
  if (!found) {
63096
- console.warn('scroll timeline: subject "' + spec + '" matched no element \u2014 measuring the SVG itself');
63662
+ report.warn(PxDiagnosticKind.host, 'scroll timeline: subject "' + spec + '" matched no element \u2014 measuring the SVG itself');
63097
63663
  return svgRoot;
63098
63664
  }
63099
63665
  return found;
63100
63666
  }
63101
- function createScrollDriver(subject, config, onProgress) {
63102
- var _a, _b;
63667
+ function createScrollDriver(subject, config, onProgress, diag) {
63668
+ var _a2, _b;
63103
63669
  if (!config || !isScrollTimeline(config)) return null;
63670
+ const report = diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]");
63104
63671
  const scroll = config.scroll || {};
63105
- const kind = (_a = scroll.kind) != null ? _a : "view";
63106
- const measured = resolveScrollSubject(subject, scroll.subject);
63672
+ const kind = (_a2 = scroll.kind) != null ? _a2 : "view";
63673
+ const measured = resolveScrollSubject(subject, scroll.subject, report);
63107
63674
  const nearest = findNearestScroller(subject, "y") || findNearestScroller(subject, "x");
63108
63675
  const scroller = kind === "scroll" && scroll.source === "root" ? documentScroller() : nearest || documentScroller();
63109
63676
  const isRootScroller = scroller === documentScroller();
@@ -63221,8 +63788,8 @@ ${codeFrame}` : message);
63221
63788
  style.position = "sticky";
63222
63789
  const alignFactor = scroll.pinAlign === "center" ? 0.5 : scroll.pinAlign === "bottom" ? 1 : 0;
63223
63790
  const applyTop = () => {
63224
- var _a;
63225
- const extra = (_a = scroll.pinTop) != null ? _a : 0;
63791
+ var _a2;
63792
+ const extra = (_a2 = scroll.pinOffset) != null ? _a2 : 0;
63226
63793
  if (!alignFactor) {
63227
63794
  style.top = extra + "px";
63228
63795
  return;
@@ -63267,35 +63834,36 @@ ${codeFrame}` : message);
63267
63834
  if (animatorConfig.resetOnFinish) {
63268
63835
  effectiveCallbacks = __spreadProps(__spreadValues({}, callbacks), {
63269
63836
  onFinish: () => {
63270
- var _a;
63271
- (_a = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a.call(callbacks);
63837
+ var _a2;
63838
+ (_a2 = callbacks == null ? void 0 : callbacks.onFinish) == null ? void 0 : _a2.call(callbacks);
63272
63839
  apiRef == null ? void 0 : apiRef.cancel();
63273
63840
  }
63274
63841
  });
63275
63842
  }
63276
63843
  const res = make(effectiveCallbacks);
63277
63844
  apiRef = res;
63278
- if (animatorConfig.debugInstName) {
63279
- window[animatorConfig.debugInstName] = res;
63845
+ if (animatorConfig.debugGlobalName) {
63846
+ window[animatorConfig.debugGlobalName] = res;
63280
63847
  }
63281
63848
  return res;
63282
63849
  }
63283
63850
  function bindWithEngineChoice(doc, adapter, callbacks, rootElement) {
63284
63851
  const animatorConfig = getAnimatorConfig(doc) || {};
63852
+ const diag = createDiagnostics(callbacks, "[PxAnimator]");
63285
63853
  if (isScrollTimeline(animatorConfig)) {
63286
63854
  return finaliseAnimator(animatorConfig, callbacks, (cb) => {
63287
- var _a, _b;
63855
+ var _a2;
63288
63856
  let unpin = () => {
63289
63857
  };
63290
- if (animatorConfig.mode !== PxAnimatorMode.frames && ((_a = animatorConfig.scroll) == null ? void 0 : _a.driver) === "native" && rootElement) {
63858
+ if (mayUseNativeScrollTimeline(animatorConfig.engine) && rootElement) {
63291
63859
  unpin = applyScrollPin(rootElement, animatorConfig.scroll);
63292
- const native = createNativeScrollTimeline(rootElement, animatorConfig);
63860
+ const native = createNativeScrollTimeline(rootElement, animatorConfig, diag);
63293
63861
  if (native) {
63294
63862
  const api2 = createWebApiAnimator(
63295
63863
  doc,
63296
63864
  cb,
63297
63865
  rootElement,
63298
- animatorConfig.mode === PxAnimatorMode.waapi,
63866
+ isNativeForced(animatorConfig.engine),
63299
63867
  native
63300
63868
  );
63301
63869
  if (api2) {
@@ -63311,15 +63879,16 @@ ${codeFrame}` : message);
63311
63879
  unpin = () => {
63312
63880
  };
63313
63881
  }
63314
- const api = (animatorConfig.mode !== PxAnimatorMode.frames ? createWebApiAnimator(doc, cb, rootElement, animatorConfig.mode === PxAnimatorMode.waapi) : null) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
63315
- const subject = ((_b = api.getRootElement) == null ? void 0 : _b.call(api)) || rootElement;
63882
+ const api = (animatorConfig.engine !== PxTimelineEngineExtra.js ? createWebApiAnimator(doc, cb, rootElement, isNativeForced(animatorConfig.engine)) : null) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
63883
+ const subject = ((_a2 = api.getRootElement) == null ? void 0 : _a2.call(api)) || rootElement;
63316
63884
  if (subject) {
63317
63885
  unpin = applyScrollPin(subject, animatorConfig.scroll);
63318
63886
  const totalMs = scrollTotalDurationMs(animatorConfig);
63319
63887
  const driver = createScrollDriver(
63320
63888
  subject,
63321
63889
  animatorConfig,
63322
- (progress) => api.setCurrentTime(progress * totalMs)
63890
+ (progress) => api.setCurrentTime(progress * totalMs),
63891
+ diag
63323
63892
  );
63324
63893
  if (driver) {
63325
63894
  const destroy = api.destroy.bind(api);
@@ -63330,56 +63899,56 @@ ${codeFrame}` : message);
63330
63899
  };
63331
63900
  }
63332
63901
  } else {
63333
- console.warn("scroll timeline: no root element to observe \u2014 animation will stay at frame 0");
63902
+ diag.warn(PxDiagnosticKind.host, "scroll timeline: no root element to observe \u2014 animation will stay at frame 0");
63334
63903
  }
63335
63904
  return api;
63336
63905
  });
63337
63906
  }
63338
63907
  return finaliseAnimator(animatorConfig, callbacks, (cb) => {
63339
- if (animatorConfig.mode === PxAnimatorMode.frames) {
63908
+ if (animatorConfig.engine === PxTimelineEngineExtra.js) {
63340
63909
  return createFrameLoopAnimator(doc, adapter, cb, rootElement);
63341
63910
  }
63342
63911
  return createWebApiAnimator(
63343
63912
  doc,
63344
63913
  cb,
63345
63914
  rootElement,
63346
- animatorConfig.mode === PxAnimatorMode.waapi
63347
- // forcing waapi
63915
+ isNativeForced(animatorConfig.engine)
63348
63916
  ) || createFrameLoopAnimator(doc, adapter, cb, rootElement);
63349
63917
  });
63350
63918
  }
63351
63919
  var SVG_NS = "http://www.w3.org/2000/svg";
63352
- function createElement(tagName, normalisedProps, style, children, textContent) {
63920
+ function createElement(tagName, normalizedProps, style, children, textContent, diag) {
63353
63921
  if (DISALLOWED_SVG_TAGS_LOWER.has(tagName.toLowerCase())) {
63354
- console.warn("SVG tag blocked (dangerous): ", tagName);
63922
+ (diag != null ? diag : createDiagnostics(void 0, "[PxAnimator]")).warn(PxDiagnosticKind.document, "SVG tag blocked (dangerous): " + tagName);
63355
63923
  return null;
63356
63924
  }
63357
63925
  const element = document.createElementNS(SVG_NS, tagName);
63358
- for (const propName in normalisedProps) {
63359
- const sanitised = sanitiseAttributeValue(propName, normalisedProps[propName]);
63360
- if (sanitised === void 0) continue;
63926
+ for (const propName in normalizedProps) {
63927
+ const sanitized = sanitizeAttributeValue(propName, normalizedProps[propName]);
63928
+ if (sanitized === void 0) continue;
63361
63929
  if (CSS_ONLY_STYLE_PROPS.has(propName)) {
63362
- element.style[propName] = String(sanitised);
63930
+ element.style[propName] = String(sanitized);
63363
63931
  continue;
63364
63932
  }
63365
- element.setAttribute(camelCaseToKebabWordIfNeeded(propName), sanitised);
63933
+ element.setAttribute(camelCaseToKebabWordIfNeeded(propName), sanitized);
63366
63934
  }
63367
63935
  if (style) {
63368
63936
  for (const styleProp in style) {
63369
63937
  element.style[styleProp] = String(style[styleProp]);
63370
63938
  }
63371
63939
  }
63372
- if (children) {
63940
+ if (children == null ? void 0 : children.length) {
63373
63941
  for (const child of children) {
63374
63942
  element.appendChild(child);
63375
63943
  }
63944
+ } else if (textContent) {
63945
+ element.textContent = textContent;
63376
63946
  }
63377
- if (textContent) element.textContent = textContent;
63378
63947
  return element;
63379
63948
  }
63380
- function renderNode(node, defs) {
63949
+ function renderNode(node, defs, diag) {
63381
63950
  if (!node) return null;
63382
- const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
63951
+ const _a2 = node, { type, children, style } = _a2, props = __objRest(_a2, ["type", "children", "style"]);
63383
63952
  const domType = props.domType;
63384
63953
  if (domType !== void 0) delete props.domType;
63385
63954
  const nodeDefs = getDefs(node) || defs;
@@ -63387,7 +63956,7 @@ ${codeFrame}` : message);
63387
63956
  let childElements;
63388
63957
  if (children) {
63389
63958
  for (const ch of children) {
63390
- const child = renderNode(ch, nodeDefs);
63959
+ const child = renderNode(ch, nodeDefs, diag);
63391
63960
  if (child) {
63392
63961
  if (!childElements) childElements = [];
63393
63962
  childElements.push(child);
@@ -63399,7 +63968,8 @@ ${codeFrame}` : message);
63399
63968
  getNormalizedProps(props),
63400
63969
  resolvedStyle,
63401
63970
  childElements,
63402
- props[TEXT_CONTENT_ATTR] || props[TEXT_ATTR]
63971
+ props[TEXT_CONTENT_ATTR],
63972
+ diag
63403
63973
  );
63404
63974
  if (element && domType !== void 0) element.setAttribute("type", domType);
63405
63975
  return element;
@@ -63407,18 +63977,25 @@ ${codeFrame}` : message);
63407
63977
  function createAnimatorFromConfig(doc, adapter, callbacks, rootElement) {
63408
63978
  return bindWithEngineChoice(doc, adapter, callbacks, rootElement);
63409
63979
  }
63410
- function createAnimatorImpl(doc, adapter, callbacks, containerElement) {
63980
+ function createAnimatorImpl(doc, adapter, callbacks, containerElement, patch, resetTimeline) {
63981
+ const diag = createDiagnostics(callbacks, "[PxAnimator]");
63411
63982
  const effectsWarnings = validateNodeEffects(doc);
63412
- for (const w of effectsWarnings) console.warn("[PxAnimator] effects shape warning:", w);
63983
+ for (const w of effectsWarnings) diag.warn(PxDiagnosticKind.document, "effects shape: " + w);
63984
+ reportDocumentDiagnostics(doc, "[PxAnimator] createAnimator");
63985
+ if (patch !== void 0 || resetTimeline) {
63986
+ const patched = applyAnimatorConfig(doc, patch != null ? patch : {}, { resetDefaults: !!resetTimeline });
63987
+ for (const w of patched.warnings) diag.warn(PxDiagnosticKind.usage, "timeline override: " + w);
63988
+ doc = patched.doc;
63989
+ }
63413
63990
  const animatorConfig = getAnimatorConfig(doc) || {};
63414
- const engine = animatorConfig.mode === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.waapi;
63415
- doc = materialiseAllInTree(doc, engine);
63991
+ const engine = resolveTimelineEngine(animatorConfig.engine);
63992
+ doc = materializeAllInTree(doc, engine);
63416
63993
  let rootElement = null;
63417
63994
  if (containerElement) {
63418
63995
  doc = generateNewIds(doc);
63419
63996
  const containerEl = typeof containerElement === "string" ? document.querySelector(containerElement) : containerElement;
63420
63997
  if (containerEl) {
63421
- rootElement = renderNode(doc);
63998
+ rootElement = renderNode(doc, void 0, diag);
63422
63999
  if (rootElement) {
63423
64000
  containerEl.replaceChildren(rootElement);
63424
64001
  }
@@ -63435,16 +64012,22 @@ ${codeFrame}` : message);
63435
64012
  }
63436
64013
  return api;
63437
64014
  }
64015
+ function resolveTimelineOption(options) {
64016
+ const { timeline, duration, delay, iterations, startOn } = options;
64017
+ return foldTimelineOverride(timeline, { duration, delay, iterations, startOn });
64018
+ }
63438
64019
  function createAnimator(options) {
63439
- const { src, data, adapter, callbacks, container } = options;
63440
- if (data !== void 0 && src !== void 0) {
63441
- throw new Error("createAnimator: provide either `src` or `data`, not both");
64020
+ const { src, doc, adapter, container, resetTimeline } = options;
64021
+ const patch = resolveTimelineOption(options);
64022
+ const callbacks = toEngineCallbacks(options);
64023
+ if (doc !== void 0 && src !== void 0) {
64024
+ throw new Error("createAnimator: provide either `src` or `doc`, not both");
63442
64025
  }
63443
- if (data === void 0 && src === void 0) {
63444
- throw new Error("createAnimator: either `src` or `data` is required");
64026
+ if (doc === void 0 && src === void 0) {
64027
+ throw new Error("createAnimator: either `src` or `doc` is required");
63445
64028
  }
63446
- if (data !== void 0) {
63447
- return createAnimatorImpl(data, adapter, callbacks, container);
64029
+ if (doc !== void 0) {
64030
+ return createAnimatorImpl(doc, adapter, callbacks, container, patch, resetTimeline);
63448
64031
  }
63449
64032
  let animator = null;
63450
64033
  let pending = [];
@@ -63456,19 +64039,27 @@ ${codeFrame}` : message);
63456
64039
  pending.push(call);
63457
64040
  }
63458
64041
  };
64042
+ const loadDiag = createDiagnostics(callbacks, "[PxAnimator]");
63459
64043
  fetch(src).then((res) => res.json()).then((json) => {
63460
64044
  if (destroyed) return;
63461
64045
  if (isPxElementFileFormat(json)) {
63462
- animator = createAnimatorImpl(json, adapter, callbacks, container);
64046
+ animator = createAnimatorImpl(json, adapter, callbacks, container, patch, resetTimeline);
63463
64047
  const queued = pending;
63464
64048
  pending = null;
63465
64049
  queued == null ? void 0 : queued.forEach((call) => call(animator));
63466
64050
  } else {
63467
- console.error('createAnimator: invalid animation document format at "' + src + '"');
64051
+ loadDiag.error(
64052
+ PxDiagnosticKind.document,
64053
+ 'createAnimator: invalid animation document format at "' + src + '"'
64054
+ );
63468
64055
  }
63469
64056
  }).catch((err) => {
64057
+ var _a2;
63470
64058
  pending = null;
63471
- console.error('createAnimator: failed to load "' + src + '"', err);
64059
+ loadDiag.error(
64060
+ PxDiagnosticKind.host,
64061
+ 'createAnimator: failed to load "' + src + '" \u2014 ' + ((_a2 = err == null ? void 0 : err.message) != null ? _a2 : String(err))
64062
+ );
63472
64063
  });
63473
64064
  return {
63474
64065
  "isReady": () => !!animator,
@@ -63493,6 +64084,10 @@ ${codeFrame}` : message);
63493
64084
  "setCurrentTime": (time) => {
63494
64085
  enqueue((api) => api.setCurrentTime(time));
63495
64086
  },
64087
+ "getCurrentProgress": () => animator ? animator.getCurrentProgress() : null,
64088
+ "setCurrentProgress": (progress) => {
64089
+ enqueue((api) => api.setCurrentProgress(progress));
64090
+ },
63496
64091
  "destroy": () => {
63497
64092
  destroyed = true;
63498
64093
  pending = null;
@@ -63500,30 +64095,14 @@ ${codeFrame}` : message);
63500
64095
  }
63501
64096
  };
63502
64097
  }
63503
- function loadTagAnimators() {
63504
- const elements = document.querySelectorAll("[" + PX_ANIM_SRC_ATTR_NAME + "]");
63505
- for (let i = 0; i < elements.length; i++) {
63506
- const element = elements[i];
63507
- if (!element[PX_ANIM_ATTR_NAME]) {
63508
- const src = element.getAttribute(PX_ANIM_SRC_ATTR_NAME);
63509
- if (src) {
63510
- element[PX_ANIM_ATTR_NAME] = createAnimator({ src, container: element });
63511
- }
63512
- }
63513
- }
63514
- }
63515
- if (typeof window !== "undefined") {
63516
- window["loadTagAnimators"] = loadTagAnimators;
63517
- window["createAnimator"] = createAnimator;
63518
- window["setupAnimationTriggers"] = setupAnimationTriggers;
63519
- }
63520
64098
 
63521
64099
  // ../../node_modules/.pnpm/vue@3.5.28_typescript@5.9.3/node_modules/vue/index.mjs
63522
64100
  var vue_exports = {};
63523
64101
  __reExport(vue_exports, __toESM(require_vue(), 1));
63524
64102
 
63525
64103
  // src/PixodeskSvgAnimator.ts
63526
- function createVueAdapter(elementRefs) {
64104
+ var VUE_PROP = { ref: "ref" };
64105
+ function createVueAdapter(elementRefs, diag) {
63527
64106
  const warnedSelectors = /* @__PURE__ */ new Set();
63528
64107
  const adapter = {
63529
64108
  isConnected: () => true,
@@ -63532,7 +64111,7 @@ ${codeFrame}` : message);
63532
64111
  const element = elementRefs.get(id);
63533
64112
  if (!element && !warnedSelectors.has(id)) {
63534
64113
  warnedSelectors.add(id);
63535
- console.warn('setAttribute: No elements found for id "' + id + '"');
64114
+ diag.warn(PxDiagnosticKind.host, 'setAttribute: No elements found for id "' + id + '"');
63536
64115
  }
63537
64116
  if (element) {
63538
64117
  element.setAttribute(attrName, value);
@@ -63544,62 +64123,31 @@ ${codeFrame}` : message);
63544
64123
  };
63545
64124
  return adapter;
63546
64125
  }
63547
- function applyDocOverrides(doc, props, compMode) {
63548
- if (compMode !== "autoplay" /* autoplay */) {
63549
- const docStartOn = doc.animator?.trigger?.startOn;
63550
- if (docStartOn && docStartOn !== "programmatic") {
63551
- doc = {
63552
- ...doc,
63553
- animator: {
63554
- ...doc.animator,
63555
- trigger: { ...doc.animator?.trigger, startOn: "programmatic" }
63556
- }
63557
- };
63558
- }
63559
- }
63560
- const { mode, duration, delay, iterations, fill, direction, frameRate } = props;
63561
- if (mode !== void 0 || duration !== void 0 || delay !== void 0 || iterations !== void 0 || fill !== void 0 || direction !== void 0 || frameRate !== void 0) {
63562
- const animator = doc.animator || {};
63563
- doc = {
63564
- ...doc,
63565
- animator: {
63566
- ...animator,
63567
- mode: mode !== void 0 ? mode : animator.mode,
63568
- duration: duration !== void 0 ? duration : animator.duration,
63569
- delay: delay !== void 0 ? delay : animator.delay,
63570
- iterations: iterations !== void 0 ? iterations : animator.iterations,
63571
- fill: fill !== void 0 ? fill : animator.fill,
63572
- direction: direction !== void 0 ? direction : animator.direction,
63573
- frameRate: frameRate !== void 0 ? frameRate : animator.frameRate
63574
- }
63575
- };
63576
- }
63577
- const { startOn, outAction, scrollIntoViewThreshold } = props;
63578
- if (startOn !== void 0 || outAction !== void 0 || scrollIntoViewThreshold !== void 0) {
63579
- const trigger = doc.animator?.trigger || {};
63580
- doc = {
63581
- ...doc,
63582
- animator: {
63583
- ...doc.animator,
63584
- trigger: {
63585
- ...trigger,
63586
- startOn: startOn !== void 0 ? startOn : trigger.startOn,
63587
- outAction: outAction !== void 0 ? outAction : trigger.outAction,
63588
- scrollIntoViewThreshold: scrollIntoViewThreshold !== void 0 ? scrollIntoViewThreshold : trigger.scrollIntoViewThreshold
63589
- }
63590
- }
63591
- };
64126
+ function applyDocOverrides(doc, props, compMode, diag) {
64127
+ const { timeline, resetTimeline, duration, delay, iterations, startOn } = props;
64128
+ const patch = foldTimelineOverride(timeline, { duration, delay, iterations, startOn });
64129
+ const fullPatch = controlModeTakesOverTrigger(compMode) ? {
64130
+ ...patch ?? {},
64131
+ timeline: {
64132
+ ...patch?.timeline ?? {},
64133
+ trigger: { ...patch?.timeline?.trigger ?? {}, startOn: "programmatic" }
64134
+ }
64135
+ } : patch;
64136
+ if (fullPatch !== void 0 || resetTimeline) {
64137
+ const applied = applyAnimatorConfig(doc, fullPatch ?? {}, { resetDefaults: !!resetTimeline });
64138
+ for (const w of applied.warnings) diag.warn(PxDiagnosticKind.usage, "timeline override: " + w);
64139
+ doc = applied.doc;
63592
64140
  }
63593
64141
  return doc;
63594
64142
  }
63595
64143
  function calcSeekMs(doc, props) {
63596
64144
  let seekMs;
63597
- const animator = doc.animator || {};
64145
+ const animator = getAnimatorConfig(doc) || {};
63598
64146
  if (props.progress !== void 0) {
63599
64147
  const iterationsValue = props.iterations ?? animator.iterations;
63600
- const iterationsCount = typeof iterationsValue === "number" && iterationsValue >= 1 ? iterationsValue : 1;
63601
- const singleDuration = props.duration ?? animator.duration ?? 1e3;
63602
- seekMs = props.progress * singleDuration * iterationsCount;
64148
+ const iterationsCount = iterationsValue === "infinite" ? Infinity : typeof iterationsValue === "number" && iterationsValue >= 1 ? iterationsValue : 1;
64149
+ const singleDuration = props.duration ?? animator.duration ?? DEFAULT_DURATION_MS;
64150
+ seekMs = progressToTimeMs(props.progress, singleDuration, iterationsCount);
63603
64151
  }
63604
64152
  if (props.time !== void 0) seekMs = props.time;
63605
64153
  return seekMs;
@@ -63609,48 +64157,63 @@ ${codeFrame}` : message);
63609
64157
  props: {
63610
64158
  // -- Source
63611
64159
  doc: { type: Object, required: true },
63612
- // -- Rendering mode
63613
- mode: { type: String },
63614
- // -- Timing overrides
64160
+ // -- Playback override: the document's `timeline` block as a patch (or a JSON string),
64161
+ // plus the four shortcuts people reach for most. The same names as React / RN.
64162
+ timeline: { type: [Object, String] },
64163
+ resetTimeline: { type: Boolean, default: void 0 },
64164
+ duration: { type: Number },
63615
64165
  delay: { type: Number },
63616
- fill: { type: String },
63617
64166
  iterations: { type: [Number, String] },
63618
- duration: { type: Number },
63619
- direction: { type: String },
63620
- frameRate: { type: Number },
63621
- // -- Trigger overrides
63622
64167
  startOn: { type: String },
63623
- outAction: { type: String },
63624
- scrollIntoViewThreshold: { type: Number },
63625
64168
  // -- Declarative control
63626
64169
  autoplay: { type: Boolean, default: void 0 },
63627
64170
  play: { type: Boolean, default: void 0 },
63628
64171
  pause: { type: Boolean, default: void 0 },
63629
64172
  // -- Controlled time
63630
64173
  progress: { type: Number },
63631
- time: { type: Number }
64174
+ time: { type: Number },
64175
+ // -- Diagnostics (API review §5).
64176
+ // Function PROPS, not emits, on purpose: an emit handler always exists, so wiring
64177
+ // these to `emit` would permanently suppress the console fallback for anyone who
64178
+ // never listens. As props, "not given" really is undefined and the console still
64179
+ // speaks by default — the same contract as React and React Native.
64180
+ onWarn: { type: Function },
64181
+ onError: { type: Function },
64182
+ // `silent` takes `true` or just the kinds to quiet, so `platform` chatter can be
64183
+ // silenced while `document` problems still speak.
64184
+ silent: { type: [Boolean, Array], default: void 0 }
63632
64185
  },
63633
64186
  emits: ["play", "stop", "pause", "cancel", "finish", "remove"],
63634
64187
  setup(props, { expose, emit }) {
63635
64188
  const elementRefs = /* @__PURE__ */ new Map();
63636
64189
  const apiRef = (0, vue_exports.shallowRef)(null);
63637
- const compMode = (0, vue_exports.computed)(() => {
63638
- if (props.autoplay) return "autoplay" /* autoplay */;
63639
- if (props.progress !== void 0 || props.time !== void 0) return "fixedTime" /* fixedTime */;
63640
- if (props.play !== void 0 || props.pause !== void 0) return "play" /* play */;
63641
- return "static" /* static */;
63642
- });
64190
+ const makeDiag = () => createDiagnostics(
64191
+ { onWarn: props.onWarn, onError: props.onError, silent: props.silent },
64192
+ "[PixodeskSvgAnimator]"
64193
+ );
64194
+ const resolvedMode = (0, vue_exports.computed)(() => resolveControlMode({
64195
+ progress: props.progress,
64196
+ time: props.time,
64197
+ play: props.play,
64198
+ pause: props.pause,
64199
+ autoplay: props.autoplay
64200
+ }));
64201
+ const compMode = (0, vue_exports.computed)(() => resolvedMode.value.mode);
64202
+ (0, vue_exports.watch)(resolvedMode, (r) => {
64203
+ const diag = makeDiag();
64204
+ for (const w of r.warnings) diag.warn(PxDiagnosticKind.usage, w);
64205
+ }, { immediate: true });
63643
64206
  const resolvedDoc = (0, vue_exports.computed)(() => {
63644
64207
  let doc = generateNewIds(props.doc);
63645
- return applyDocOverrides(doc, props, compMode.value);
64208
+ return applyDocOverrides(doc, props, compMode.value, makeDiag());
63646
64209
  });
63647
64210
  function renderNode2(node) {
63648
64211
  if (!node) return null;
63649
64212
  const { type, animate, meta, children, ...attrs } = node;
63650
64213
  const normProps = getNormalizedProps(attrs);
63651
- if (node["id"]) {
63652
- const nodeId = node["id"];
63653
- normProps["ref"] = (el) => {
64214
+ if (node.id) {
64215
+ const nodeId = node.id;
64216
+ normProps[VUE_PROP.ref] = (el) => {
63654
64217
  if (el) {
63655
64218
  elementRefs.set(nodeId, el);
63656
64219
  } else {
@@ -63659,32 +64222,27 @@ ${codeFrame}` : message);
63659
64222
  };
63660
64223
  }
63661
64224
  const childVNodes = children?.map((child) => renderNode2(child)).filter(Boolean);
63662
- return (0, vue_exports.h)(type, normProps, childVNodes);
64225
+ const text = typeof node.textContent === "string" ? node.textContent : void 0;
64226
+ return (0, vue_exports.h)(type, normProps, childVNodes?.length ? childVNodes : text);
63663
64227
  }
63664
64228
  function createApi() {
63665
64229
  destroyApi();
63666
64230
  const doc = resolvedDoc.value;
63667
64231
  if (!doc) return;
63668
- const callbacks = {
64232
+ apiRef.value = createAnimator({
64233
+ doc,
64234
+ adapter: createVueAdapter(elementRefs, makeDiag()),
63669
64235
  onPlay: () => emit("play"),
63670
- onPause: () => {
63671
- emit("pause");
63672
- emit("stop");
63673
- },
63674
- onCancel: () => {
63675
- emit("cancel");
63676
- emit("stop");
63677
- },
63678
- onFinish: () => {
63679
- emit("finish");
63680
- emit("stop");
63681
- },
63682
- onRemove: () => {
63683
- emit("remove");
63684
- emit("stop");
63685
- }
63686
- };
63687
- apiRef.value = createAnimator({ data: doc, adapter: createVueAdapter(elementRefs), callbacks });
64236
+ onPause: () => emit("pause"),
64237
+ onCancel: () => emit("cancel"),
64238
+ onFinish: () => emit("finish"),
64239
+ onRemove: () => emit("remove"),
64240
+ onStop: () => emit("stop"),
64241
+ // The player's own diagnostics reach the same handlers as the component's.
64242
+ onWarn: props.onWarn,
64243
+ onError: props.onError,
64244
+ silent: props.silent
64245
+ });
63688
64246
  syncPlayState();
63689
64247
  applySeek();
63690
64248
  }
@@ -63693,19 +64251,19 @@ ${codeFrame}` : message);
63693
64251
  apiRef.value = null;
63694
64252
  }
63695
64253
  function syncPlayState() {
63696
- if (compMode.value !== "play" /* play */) return;
64254
+ if (compMode.value !== PxControlMode.play) return;
63697
64255
  if (props.play && !props.pause) {
63698
64256
  apiRef.value?.play();
63699
64257
  } else if (props.pause) {
63700
64258
  apiRef.value?.pause();
63701
64259
  } else if (props.play === false) {
63702
- apiRef.value?.finish();
64260
+ apiRef.value?.pause();
63703
64261
  } else {
63704
64262
  apiRef.value?.play();
63705
64263
  }
63706
64264
  }
63707
64265
  function applySeek() {
63708
- if (compMode.value !== "fixedTime" /* fixedTime */) return;
64266
+ if (compMode.value !== PxControlMode.fixedTime) return;
63709
64267
  const doc = resolvedDoc.value;
63710
64268
  if (!doc) return;
63711
64269
  const seekMs = calcSeekMs(doc, props);
@@ -63729,7 +64287,9 @@ ${codeFrame}` : message);
63729
64287
  finish: () => apiRef.value?.finish(),
63730
64288
  setPlaybackRate: (rate) => apiRef.value?.setPlaybackRate(rate),
63731
64289
  getCurrentTime: () => apiRef.value?.getCurrentTime() ?? null,
63732
- setCurrentTime: (time) => apiRef.value?.setCurrentTime(time)
64290
+ setCurrentTime: (time) => apiRef.value?.setCurrentTime(time),
64291
+ getCurrentProgress: () => apiRef.value?.getCurrentProgress() ?? null,
64292
+ setCurrentProgress: (progress) => apiRef.value?.setCurrentProgress(progress)
63733
64293
  };
63734
64294
  expose(publicApi);
63735
64295
  return () => {
@@ -63746,7 +64306,8 @@ ${codeFrame}` : message);
63746
64306
  inheritAttrs: false,
63747
64307
  props: {
63748
64308
  startOn: { type: String, default: "load" },
63749
- outAction: { type: String, default: "continue" }
64309
+ outAction: { type: String, default: "continue" },
64310
+ scrollIntoViewThreshold: { type: Number, default: PX_TRIGGER_DEFAULTS.scrollIntoViewThreshold }
63750
64311
  },
63751
64312
  setup(props, { slots }) {
63752
64313
  const attrs = (0, vue_exports.useAttrs)();
@@ -63761,11 +64322,13 @@ ${codeFrame}` : message);
63761
64322
  const el = divRef.value;
63762
64323
  if (!el) return;
63763
64324
  const outState = props.outAction === "reset" ? "idle" : props.outAction === "pause" ? "paused" : "playing";
64325
+ const threshold = props.scrollIntoViewThreshold;
64326
+ const visible = (entry) => threshold > 0 ? entry.intersectionRatio >= threshold : entry.isIntersecting;
63764
64327
  const observer = new IntersectionObserver(
63765
64328
  ([entry]) => {
63766
- state.value = entry.isIntersecting ? "playing" : outState;
64329
+ state.value = visible(entry) ? "playing" : outState;
63767
64330
  },
63768
- { threshold: 0.1 }
64331
+ { threshold }
63769
64332
  );
63770
64333
  observer.observe(el);
63771
64334
  observerCleanup = () => observer.disconnect();