@pixodesk/svg-animator-vue 1.0.16 → 1.0.18

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
@@ -39,9 +39,9 @@ var PixodeskAnimatorVue = (() => {
39
39
  "use strict";
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  // @__NO_SIDE_EFFECTS__
42
- function makeMap(str) {
42
+ function makeMap(str2) {
43
43
  const map = /* @__PURE__ */ Object.create(null);
44
- for (const key of str.split(",")) map[key] = 1;
44
+ for (const key of str2.split(",")) map[key] = 1;
45
45
  return (val) => val in map;
46
46
  }
47
47
  var EMPTY_OBJ = {};
@@ -89,27 +89,27 @@ var PixodeskAnimatorVue = (() => {
89
89
  );
90
90
  var cacheStringFunction = (fn) => {
91
91
  const cache = /* @__PURE__ */ Object.create(null);
92
- return ((str) => {
93
- const hit = cache[str];
94
- return hit || (cache[str] = fn(str));
92
+ return ((str2) => {
93
+ const hit = cache[str2];
94
+ return hit || (cache[str2] = fn(str2));
95
95
  });
96
96
  };
97
97
  var camelizeRE = /-\w/g;
98
98
  var camelize = cacheStringFunction(
99
- (str) => {
100
- return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
99
+ (str2) => {
100
+ return str2.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
101
101
  }
102
102
  );
103
103
  var hyphenateRE = /\B([A-Z])/g;
104
104
  var hyphenate = cacheStringFunction(
105
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
105
+ (str2) => str2.replace(hyphenateRE, "-$1").toLowerCase()
106
106
  );
107
- var capitalize = cacheStringFunction((str) => {
108
- return str.charAt(0).toUpperCase() + str.slice(1);
107
+ var capitalize = cacheStringFunction((str2) => {
108
+ return str2.charAt(0).toUpperCase() + str2.slice(1);
109
109
  });
110
110
  var toHandlerKey = cacheStringFunction(
111
- (str) => {
112
- const s = str ? `on${capitalize(str)}` : ``;
111
+ (str2) => {
112
+ const s = str2 ? `on${capitalize(str2)}` : ``;
113
113
  return s;
114
114
  }
115
115
  );
@@ -402,17 +402,17 @@ var PixodeskAnimatorVue = (() => {
402
402
  }
403
403
  var escapeRE = /["'&<>]/;
404
404
  function escapeHtml(string) {
405
- const str = "" + string;
406
- const match = escapeRE.exec(str);
405
+ const str2 = "" + string;
406
+ const match = escapeRE.exec(str2);
407
407
  if (!match) {
408
- return str;
408
+ return str2;
409
409
  }
410
410
  let html = "";
411
411
  let escaped;
412
412
  let index;
413
413
  let lastIndex = 0;
414
- for (index = match.index; index < str.length; index++) {
415
- switch (str.charCodeAt(index)) {
414
+ for (index = match.index; index < str2.length; index++) {
415
+ switch (str2.charCodeAt(index)) {
416
416
  case 34:
417
417
  escaped = "&quot;";
418
418
  break;
@@ -432,12 +432,12 @@ var PixodeskAnimatorVue = (() => {
432
432
  continue;
433
433
  }
434
434
  if (lastIndex !== index) {
435
- html += str.slice(lastIndex, index);
435
+ html += str2.slice(lastIndex, index);
436
436
  }
437
437
  lastIndex = index + 1;
438
438
  html += escaped;
439
439
  }
440
- return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
440
+ return lastIndex !== index ? html + str2.slice(lastIndex, index) : html;
441
441
  }
442
442
  var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
443
443
  function escapeHtmlComment(src) {
@@ -628,9 +628,9 @@ var PixodeskAnimatorVue = (() => {
628
628
  "use strict";
629
629
  Object.defineProperty(exports, "__esModule", { value: true });
630
630
  // @__NO_SIDE_EFFECTS__
631
- function makeMap(str) {
631
+ function makeMap(str2) {
632
632
  const map = /* @__PURE__ */ Object.create(null);
633
- for (const key of str.split(",")) map[key] = 1;
633
+ for (const key of str2.split(",")) map[key] = 1;
634
634
  return (val) => val in map;
635
635
  }
636
636
  var EMPTY_OBJ = Object.freeze({});
@@ -678,27 +678,27 @@ var PixodeskAnimatorVue = (() => {
678
678
  );
679
679
  var cacheStringFunction = (fn) => {
680
680
  const cache = /* @__PURE__ */ Object.create(null);
681
- return ((str) => {
682
- const hit = cache[str];
683
- return hit || (cache[str] = fn(str));
681
+ return ((str2) => {
682
+ const hit = cache[str2];
683
+ return hit || (cache[str2] = fn(str2));
684
684
  });
685
685
  };
686
686
  var camelizeRE = /-\w/g;
687
687
  var camelize = cacheStringFunction(
688
- (str) => {
689
- return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
688
+ (str2) => {
689
+ return str2.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
690
690
  }
691
691
  );
692
692
  var hyphenateRE = /\B([A-Z])/g;
693
693
  var hyphenate = cacheStringFunction(
694
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
694
+ (str2) => str2.replace(hyphenateRE, "-$1").toLowerCase()
695
695
  );
696
- var capitalize = cacheStringFunction((str) => {
697
- return str.charAt(0).toUpperCase() + str.slice(1);
696
+ var capitalize = cacheStringFunction((str2) => {
697
+ return str2.charAt(0).toUpperCase() + str2.slice(1);
698
698
  });
699
699
  var toHandlerKey = cacheStringFunction(
700
- (str) => {
701
- const s = str ? `on${capitalize(str)}` : ``;
700
+ (str2) => {
701
+ const s = str2 ? `on${capitalize(str2)}` : ``;
702
702
  return s;
703
703
  }
704
704
  );
@@ -991,17 +991,17 @@ var PixodeskAnimatorVue = (() => {
991
991
  }
992
992
  var escapeRE = /["'&<>]/;
993
993
  function escapeHtml(string) {
994
- const str = "" + string;
995
- const match = escapeRE.exec(str);
994
+ const str2 = "" + string;
995
+ const match = escapeRE.exec(str2);
996
996
  if (!match) {
997
- return str;
997
+ return str2;
998
998
  }
999
999
  let html = "";
1000
1000
  let escaped;
1001
1001
  let index;
1002
1002
  let lastIndex = 0;
1003
- for (index = match.index; index < str.length; index++) {
1004
- switch (str.charCodeAt(index)) {
1003
+ for (index = match.index; index < str2.length; index++) {
1004
+ switch (str2.charCodeAt(index)) {
1005
1005
  case 34:
1006
1006
  escaped = "&quot;";
1007
1007
  break;
@@ -1021,12 +1021,12 @@ var PixodeskAnimatorVue = (() => {
1021
1021
  continue;
1022
1022
  }
1023
1023
  if (lastIndex !== index) {
1024
- html += str.slice(lastIndex, index);
1024
+ html += str2.slice(lastIndex, index);
1025
1025
  }
1026
1026
  lastIndex = index + 1;
1027
1027
  html += escaped;
1028
1028
  }
1029
- return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
1029
+ return lastIndex !== index ? html + str2.slice(lastIndex, index) : html;
1030
1030
  }
1031
1031
  var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
1032
1032
  function escapeHtmlComment(src) {
@@ -8120,9 +8120,9 @@ var PixodeskAnimatorVue = (() => {
8120
8120
  });
8121
8121
  }
8122
8122
  finishOp(type, size) {
8123
- const str = this.input.slice(this.state.pos, this.state.pos + size);
8123
+ const str2 = this.input.slice(this.state.pos, this.state.pos + size);
8124
8124
  this.state.pos += size;
8125
- this.finishToken(type, str);
8125
+ this.finishToken(type, str2);
8126
8126
  }
8127
8127
  readRegexp() {
8128
8128
  const startLoc = this.state.startLoc;
@@ -8216,8 +8216,8 @@ var PixodeskAnimatorVue = (() => {
8216
8216
  throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
8217
8217
  }
8218
8218
  if (isBigInt) {
8219
- const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
8220
- this.finishToken(136, str);
8219
+ const str2 = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
8220
+ this.finishToken(136, str2);
8221
8221
  return;
8222
8222
  }
8223
8223
  this.finishToken(135, val);
@@ -8281,16 +8281,16 @@ var PixodeskAnimatorVue = (() => {
8281
8281
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
8282
8282
  throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
8283
8283
  }
8284
- const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
8284
+ const str2 = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
8285
8285
  if (isBigInt) {
8286
- this.finishToken(136, str);
8286
+ this.finishToken(136, str2);
8287
8287
  return;
8288
8288
  }
8289
8289
  if (isDecimal) {
8290
- this.finishToken(137, str);
8290
+ this.finishToken(137, str2);
8291
8291
  return;
8292
8292
  }
8293
- const val = isOctal ? parseInt(str, 8) : parseFloat(str);
8293
+ const val = isOctal ? parseInt(str2, 8) : parseFloat(str2);
8294
8294
  this.finishToken(135, val);
8295
8295
  }
8296
8296
  readCodePoint(throwOnInvalid) {
@@ -8303,7 +8303,7 @@ var PixodeskAnimatorVue = (() => {
8303
8303
  }
8304
8304
  readString(quote) {
8305
8305
  const {
8306
- str,
8306
+ str: str2,
8307
8307
  pos,
8308
8308
  curLine,
8309
8309
  lineStart
@@ -8311,7 +8311,7 @@ var PixodeskAnimatorVue = (() => {
8311
8311
  this.state.pos = pos + 1;
8312
8312
  this.state.lineStart = lineStart;
8313
8313
  this.state.curLine = curLine;
8314
- this.finishToken(134, str);
8314
+ this.finishToken(134, str2);
8315
8315
  }
8316
8316
  readTemplateContinuation() {
8317
8317
  if (!this.match(8)) {
@@ -8323,7 +8323,7 @@ var PixodeskAnimatorVue = (() => {
8323
8323
  readTemplateToken() {
8324
8324
  const opening = this.input[this.state.pos];
8325
8325
  const {
8326
- str,
8326
+ str: str2,
8327
8327
  firstInvalidLoc,
8328
8328
  pos,
8329
8329
  curLine,
@@ -8336,10 +8336,10 @@ var PixodeskAnimatorVue = (() => {
8336
8336
  this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
8337
8337
  }
8338
8338
  if (this.input.codePointAt(pos) === 96) {
8339
- this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
8339
+ this.finishToken(24, firstInvalidLoc ? null : opening + str2 + "`");
8340
8340
  } else {
8341
8341
  this.state.pos++;
8342
- this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
8342
+ this.finishToken(25, firstInvalidLoc ? null : opening + str2 + "${");
8343
8343
  }
8344
8344
  }
8345
8345
  recordStrictModeErrors(toParseError, at) {
@@ -17045,8 +17045,8 @@ var PixodeskAnimatorVue = (() => {
17045
17045
  return strcmp(mappingA.name, mappingB.name);
17046
17046
  }
17047
17047
  exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
17048
- function parseSourceMapInput(str) {
17049
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
17048
+ function parseSourceMapInput(str2) {
17049
+ return JSON.parse(str2.replace(/^\)]}'[^\n]*\n/, ""));
17050
17050
  }
17051
17051
  exports.parseSourceMapInput = parseSourceMapInput;
17052
17052
  function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
@@ -17865,7 +17865,7 @@ var PixodeskAnimatorVue = (() => {
17865
17865
  var temp = {};
17866
17866
  var originalMappings = [];
17867
17867
  var generatedMappings = [];
17868
- var mapping, str, segment, end, value;
17868
+ var mapping, str2, segment, end, value;
17869
17869
  let subarrayStart = 0;
17870
17870
  while (index < length) {
17871
17871
  if (aStr.charAt(index) === ";") {
@@ -17884,7 +17884,7 @@ var PixodeskAnimatorVue = (() => {
17884
17884
  break;
17885
17885
  }
17886
17886
  }
17887
- str = aStr.slice(index, end);
17887
+ str2 = aStr.slice(index, end);
17888
17888
  segment = [];
17889
17889
  while (index < end) {
17890
17890
  base64VLQ.decode(aStr, index, temp);
@@ -18417,11 +18417,11 @@ var PixodeskAnimatorVue = (() => {
18417
18417
  }
18418
18418
  };
18419
18419
  SourceNode.prototype.toString = function SourceNode_toString() {
18420
- var str = "";
18420
+ var str2 = "";
18421
18421
  this.walk(function(chunk) {
18422
- str += chunk;
18422
+ str2 += chunk;
18423
18423
  });
18424
- return str;
18424
+ return str2;
18425
18425
  };
18426
18426
  SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
18427
18427
  var generated = {
@@ -18928,10 +18928,10 @@ var PixodeskAnimatorVue = (() => {
18928
18928
  function isEndOfTagSection(c) {
18929
18929
  return c === 47 || c === 62 || isWhitespace(c);
18930
18930
  }
18931
- function toCharCodes(str) {
18932
- const ret = new Uint8Array(str.length);
18933
- for (let i = 0; i < str.length; i++) {
18934
- ret[i] = str.charCodeAt(i);
18931
+ function toCharCodes(str2) {
18932
+ const ret = new Uint8Array(str2.length);
18933
+ for (let i = 0; i < str2.length; i++) {
18934
+ ret[i] = str2.charCodeAt(i);
18935
18935
  }
18936
18936
  return ret;
18937
18937
  }
@@ -20770,9 +20770,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20770
20770
  }
20771
20771
  }
20772
20772
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
20773
- function isAllWhitespace(str) {
20774
- for (let i = 0; i < str.length; i++) {
20775
- if (!isWhitespace(str.charCodeAt(i))) {
20773
+ function isAllWhitespace(str2) {
20774
+ for (let i = 0; i < str2.length; i++) {
20775
+ if (!isWhitespace(str2.charCodeAt(i))) {
20776
20776
  return false;
20777
20777
  }
20778
20778
  }
@@ -21375,26 +21375,26 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
21375
21375
  }
21376
21376
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
21377
21377
  }
21378
- function hasNewlineChar(str) {
21379
- for (let i = 0; i < str.length; i++) {
21380
- const c = str.charCodeAt(i);
21378
+ function hasNewlineChar(str2) {
21379
+ for (let i = 0; i < str2.length; i++) {
21380
+ const c = str2.charCodeAt(i);
21381
21381
  if (c === 10 || c === 13) {
21382
21382
  return true;
21383
21383
  }
21384
21384
  }
21385
21385
  return false;
21386
21386
  }
21387
- function condense(str) {
21387
+ function condense(str2) {
21388
21388
  let ret = "";
21389
21389
  let prevCharIsWhitespace = false;
21390
- for (let i = 0; i < str.length; i++) {
21391
- if (isWhitespace(str.charCodeAt(i))) {
21390
+ for (let i = 0; i < str2.length; i++) {
21391
+ if (isWhitespace(str2.charCodeAt(i))) {
21392
21392
  if (!prevCharIsWhitespace) {
21393
21393
  ret += " ";
21394
21394
  prevCharIsWhitespace = true;
21395
21395
  }
21396
21396
  } else {
21397
- ret += str[i];
21397
+ ret += str2[i];
21398
21398
  prevCharIsWhitespace = false;
21399
21399
  }
21400
21400
  }
@@ -25695,10 +25695,10 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
25695
25695
  function isEndOfTagSection(c) {
25696
25696
  return c === 47 || c === 62 || isWhitespace(c);
25697
25697
  }
25698
- function toCharCodes(str) {
25699
- const ret = new Uint8Array(str.length);
25700
- for (let i = 0; i < str.length; i++) {
25701
- ret[i] = str.charCodeAt(i);
25698
+ function toCharCodes(str2) {
25699
+ const ret = new Uint8Array(str2.length);
25700
+ for (let i = 0; i < str2.length; i++) {
25701
+ ret[i] = str2.charCodeAt(i);
25702
25702
  }
25703
25703
  return ret;
25704
25704
  }
@@ -27541,9 +27541,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
27541
27541
  }
27542
27542
  }
27543
27543
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
27544
- function isAllWhitespace(str) {
27545
- for (let i = 0; i < str.length; i++) {
27546
- if (!isWhitespace(str.charCodeAt(i))) {
27544
+ function isAllWhitespace(str2) {
27545
+ for (let i = 0; i < str2.length; i++) {
27546
+ if (!isWhitespace(str2.charCodeAt(i))) {
27547
27547
  return false;
27548
27548
  }
27549
27549
  }
@@ -28176,26 +28176,26 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
28176
28176
  }
28177
28177
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
28178
28178
  }
28179
- function hasNewlineChar(str) {
28180
- for (let i = 0; i < str.length; i++) {
28181
- const c = str.charCodeAt(i);
28179
+ function hasNewlineChar(str2) {
28180
+ for (let i = 0; i < str2.length; i++) {
28181
+ const c = str2.charCodeAt(i);
28182
28182
  if (c === 10 || c === 13) {
28183
28183
  return true;
28184
28184
  }
28185
28185
  }
28186
28186
  return false;
28187
28187
  }
28188
- function condense(str) {
28188
+ function condense(str2) {
28189
28189
  let ret = "";
28190
28190
  let prevCharIsWhitespace = false;
28191
- for (let i = 0; i < str.length; i++) {
28192
- if (isWhitespace(str.charCodeAt(i))) {
28191
+ for (let i = 0; i < str2.length; i++) {
28192
+ if (isWhitespace(str2.charCodeAt(i))) {
28193
28193
  if (!prevCharIsWhitespace) {
28194
28194
  ret += " ";
28195
28195
  prevCharIsWhitespace = true;
28196
28196
  }
28197
28197
  } else {
28198
- ret += str[i];
28198
+ ret += str2[i];
28199
28199
  prevCharIsWhitespace = false;
28200
28200
  }
28201
28201
  }
@@ -34456,10 +34456,10 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34456
34456
  });
34457
34457
  },
34458
34458
  every(fn, thisArg) {
34459
- return apply(this, "every", fn, thisArg, void 0, arguments);
34459
+ return apply2(this, "every", fn, thisArg, void 0, arguments);
34460
34460
  },
34461
34461
  filter(fn, thisArg) {
34462
- return apply(
34462
+ return apply2(
34463
34463
  this,
34464
34464
  "filter",
34465
34465
  fn,
@@ -34469,7 +34469,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34469
34469
  );
34470
34470
  },
34471
34471
  find(fn, thisArg) {
34472
- return apply(
34472
+ return apply2(
34473
34473
  this,
34474
34474
  "find",
34475
34475
  fn,
@@ -34479,10 +34479,10 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34479
34479
  );
34480
34480
  },
34481
34481
  findIndex(fn, thisArg) {
34482
- return apply(this, "findIndex", fn, thisArg, void 0, arguments);
34482
+ return apply2(this, "findIndex", fn, thisArg, void 0, arguments);
34483
34483
  },
34484
34484
  findLast(fn, thisArg) {
34485
- return apply(
34485
+ return apply2(
34486
34486
  this,
34487
34487
  "findLast",
34488
34488
  fn,
@@ -34492,11 +34492,11 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34492
34492
  );
34493
34493
  },
34494
34494
  findLastIndex(fn, thisArg) {
34495
- return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
34495
+ return apply2(this, "findLastIndex", fn, thisArg, void 0, arguments);
34496
34496
  },
34497
34497
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
34498
34498
  forEach(fn, thisArg) {
34499
- return apply(this, "forEach", fn, thisArg, void 0, arguments);
34499
+ return apply2(this, "forEach", fn, thisArg, void 0, arguments);
34500
34500
  },
34501
34501
  includes(...args) {
34502
34502
  return searchProxy(this, "includes", args);
@@ -34512,7 +34512,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34512
34512
  return searchProxy(this, "lastIndexOf", args);
34513
34513
  },
34514
34514
  map(fn, thisArg) {
34515
- return apply(this, "map", fn, thisArg, void 0, arguments);
34515
+ return apply2(this, "map", fn, thisArg, void 0, arguments);
34516
34516
  },
34517
34517
  pop() {
34518
34518
  return noTracking(this, "pop");
@@ -34531,7 +34531,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34531
34531
  },
34532
34532
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
34533
34533
  some(fn, thisArg) {
34534
- return apply(this, "some", fn, thisArg, void 0, arguments);
34534
+ return apply2(this, "some", fn, thisArg, void 0, arguments);
34535
34535
  },
34536
34536
  splice(...args) {
34537
34537
  return noTracking(this, "splice", args);
@@ -34568,7 +34568,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
34568
34568
  return iter;
34569
34569
  }
34570
34570
  var arrayProto = Array.prototype;
34571
- function apply(self2, method, fn, thisArg, wrappedRetFn, args) {
34571
+ function apply2(self2, method, fn, thisArg, wrappedRetFn, args) {
34572
34572
  const arr = shallowReadArray(self2);
34573
34573
  const needsWrap = arr !== self2 && !/* @__PURE__ */ isShallow(self2);
34574
34574
  const methodFn = arr[method];
@@ -36306,10 +36306,10 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36306
36306
  });
36307
36307
  },
36308
36308
  every(fn, thisArg) {
36309
- return apply(this, "every", fn, thisArg, void 0, arguments);
36309
+ return apply2(this, "every", fn, thisArg, void 0, arguments);
36310
36310
  },
36311
36311
  filter(fn, thisArg) {
36312
- return apply(
36312
+ return apply2(
36313
36313
  this,
36314
36314
  "filter",
36315
36315
  fn,
@@ -36319,7 +36319,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36319
36319
  );
36320
36320
  },
36321
36321
  find(fn, thisArg) {
36322
- return apply(
36322
+ return apply2(
36323
36323
  this,
36324
36324
  "find",
36325
36325
  fn,
@@ -36329,10 +36329,10 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36329
36329
  );
36330
36330
  },
36331
36331
  findIndex(fn, thisArg) {
36332
- return apply(this, "findIndex", fn, thisArg, void 0, arguments);
36332
+ return apply2(this, "findIndex", fn, thisArg, void 0, arguments);
36333
36333
  },
36334
36334
  findLast(fn, thisArg) {
36335
- return apply(
36335
+ return apply2(
36336
36336
  this,
36337
36337
  "findLast",
36338
36338
  fn,
@@ -36342,11 +36342,11 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36342
36342
  );
36343
36343
  },
36344
36344
  findLastIndex(fn, thisArg) {
36345
- return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
36345
+ return apply2(this, "findLastIndex", fn, thisArg, void 0, arguments);
36346
36346
  },
36347
36347
  // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
36348
36348
  forEach(fn, thisArg) {
36349
- return apply(this, "forEach", fn, thisArg, void 0, arguments);
36349
+ return apply2(this, "forEach", fn, thisArg, void 0, arguments);
36350
36350
  },
36351
36351
  includes(...args) {
36352
36352
  return searchProxy(this, "includes", args);
@@ -36362,7 +36362,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36362
36362
  return searchProxy(this, "lastIndexOf", args);
36363
36363
  },
36364
36364
  map(fn, thisArg) {
36365
- return apply(this, "map", fn, thisArg, void 0, arguments);
36365
+ return apply2(this, "map", fn, thisArg, void 0, arguments);
36366
36366
  },
36367
36367
  pop() {
36368
36368
  return noTracking(this, "pop");
@@ -36381,7 +36381,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36381
36381
  },
36382
36382
  // slice could use ARRAY_ITERATE but also seems to beg for range tracking
36383
36383
  some(fn, thisArg) {
36384
- return apply(this, "some", fn, thisArg, void 0, arguments);
36384
+ return apply2(this, "some", fn, thisArg, void 0, arguments);
36385
36385
  },
36386
36386
  splice(...args) {
36387
36387
  return noTracking(this, "splice", args);
@@ -36418,7 +36418,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
36418
36418
  return iter;
36419
36419
  }
36420
36420
  var arrayProto = Array.prototype;
36421
- function apply(self2, method, fn, thisArg, wrappedRetFn, args) {
36421
+ function apply2(self2, method, fn, thisArg, wrappedRetFn, args) {
36422
36422
  const arr = shallowReadArray(self2);
36423
36423
  const needsWrap = arr !== self2 && !/* @__PURE__ */ isShallow(self2);
36424
36424
  const methodFn = arr[method];
@@ -46766,8 +46766,8 @@ Server rendered element contains fewer child nodes than client vdom.`
46766
46766
  }
46767
46767
  return false;
46768
46768
  }
46769
- function toClassSet(str) {
46770
- return new Set(str.trim().split(/\s+/));
46769
+ function toClassSet(str2) {
46770
+ return new Set(str2.trim().split(/\s+/));
46771
46771
  }
46772
46772
  function isSetEqual(a, b) {
46773
46773
  if (a.size !== b.size) {
@@ -46780,9 +46780,9 @@ Server rendered element contains fewer child nodes than client vdom.`
46780
46780
  }
46781
46781
  return true;
46782
46782
  }
46783
- function toStyleMap(str) {
46783
+ function toStyleMap(str2) {
46784
46784
  const styleMap = /* @__PURE__ */ new Map();
46785
- for (const item of str.split(";")) {
46785
+ for (const item of str2.split(";")) {
46786
46786
  let [key, value] = item.split(":");
46787
46787
  key = key.trim();
46788
46788
  value = value && value.trim();
@@ -52550,7 +52550,7 @@ Component that was made reactive: `,
52550
52550
  }
52551
52551
  }
52552
52552
  var classifyRE = /(?:^|[-_])\w/g;
52553
- var classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
52553
+ var classify = (str2) => str2.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
52554
52554
  function getComponentName(Component, includeInferred = true) {
52555
52555
  return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
52556
52556
  }
@@ -56768,6 +56768,7 @@ ${codeFrame}` : message);
56768
56768
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
56769
56769
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
56770
56770
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
56771
+ var __pow = Math.pow;
56771
56772
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
56772
56773
  var __spreadValues = (a, b) => {
56773
56774
  for (var prop in b || (b = {}))
@@ -56810,7 +56811,7 @@ ${codeFrame}` : message);
56810
56811
  if (typeof raw === "object") {
56811
56812
  const obj = raw;
56812
56813
  if (obj.keyframes) {
56813
- return { kind: "animated", keyframes: obj.keyframes, autoOrient: obj.autoOrient };
56814
+ return { kind: "animated", keyframes: obj.keyframes, autoOrient: obj.autoOrient, loop: obj.loop };
56814
56815
  }
56815
56816
  if (obj.value !== void 0) return { kind: "static", value: obj.value };
56816
56817
  }
@@ -56898,6 +56899,7 @@ ${codeFrame}` : message);
56898
56899
  if (v.kind === "animated") {
56899
56900
  const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, partsRecord(part, kf.value, void 0))) };
56900
56901
  if (v.autoOrient) animTr.autoOrient = true;
56902
+ if (v.loop !== void 0) animTr.loop = v.loop;
56901
56903
  return {
56902
56904
  type: "g",
56903
56905
  animate: { transform: animTr },
@@ -56916,9 +56918,11 @@ ${codeFrame}` : message);
56916
56918
  return { type: "g", transform: { value: { translate: sign(v.value) } }, children: [inner] };
56917
56919
  }
56918
56920
  if (v.kind === "animated") {
56921
+ const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, { translate: sign(kf.value) })) };
56922
+ if (v.loop !== void 0) animTr.loop = v.loop;
56919
56923
  return {
56920
56924
  type: "g",
56921
- animate: { transform: { keyframes: v.keyframes.map((kf) => keyframeWith(kf, { translate: sign(kf.value) })) } },
56925
+ animate: { transform: animTr },
56922
56926
  children: [inner]
56923
56927
  };
56924
56928
  }
@@ -56926,8 +56930,8 @@ ${codeFrame}` : message);
56926
56930
  }
56927
56931
  function identifyContentRefTargets(node, ctx, allocator) {
56928
56932
  var _a, _b, _c;
56929
- if (node.type === "use" && ((_b = (_a = node.effects) == null ? void 0 : _a.ref) == null ? void 0 : _b.type) === "content") {
56930
- const baseId = node.effects.ref.baseId;
56933
+ if (node.type === "use" && ((_b = (_a = node.effects) == null ? void 0 : _a.clone) == null ? void 0 : _b.type) === "content") {
56934
+ const baseId = node.effects.clone.baseId;
56931
56935
  if (typeof baseId === "string" && baseId && !ctx.contentRefInnerIds.has(baseId)) {
56932
56936
  ctx.contentRefInnerIds.set(baseId, allocator(baseId));
56933
56937
  }
@@ -56975,6 +56979,8 @@ ${codeFrame}` : message);
56975
56979
  });
56976
56980
  const outerAnimTr = { keyframes: outerKfs };
56977
56981
  if (animTr.autoOrient) outerAnimTr.autoOrient = true;
56982
+ const srcLoop = animTr.loop;
56983
+ if (srcLoop !== void 0) outerAnimTr.loop = srcLoop;
56978
56984
  out.animate = { transform: outerAnimTr };
56979
56985
  const innerHasPivotedPart = kfs.some((kf) => {
56980
56986
  const v = kf.value || {};
@@ -56996,7 +57002,9 @@ ${codeFrame}` : message);
56996
57002
  delete node.animate.transform;
56997
57003
  if (node.animate && Object.keys(node.animate).length === 0) delete node.animate;
56998
57004
  } else {
56999
- node.animate.transform = { keyframes: innerKfs };
57005
+ const innerAnimTr = { keyframes: innerKfs };
57006
+ if (srcLoop !== void 0) innerAnimTr.loop = srcLoop;
57007
+ node.animate.transform = innerAnimTr;
57000
57008
  }
57001
57009
  didLiftAnimate = true;
57002
57010
  }
@@ -57641,10 +57649,22 @@ ${codeFrame}` : message);
57641
57649
  outAction: px.enum(["continue", "pause", "reset", "reverse"]).optional(),
57642
57650
  scrollIntoViewThreshold: px.number().optional()
57643
57651
  }));
57652
+ var PxGlyphSchema = implementsInterface()(px.object({
57653
+ width: px.number(),
57654
+ d: px.string()
57655
+ }));
57656
+ var PxGlyphFontSchema = implementsInterface()(px.object({
57657
+ fFamily: px.string(),
57658
+ style: px.string(),
57659
+ ascent: px.number(),
57660
+ unitsPerEm: px.number(),
57661
+ glyphs: px.record(PxGlyphSchema)
57662
+ }));
57644
57663
  var PxDefsSchema = implementsInterface()(px.object({
57645
57664
  easings: px.record(px.tuple([px.number(), px.number(), px.number(), px.number()])).optional(),
57646
57665
  animations: px.record(PxAnimationDefinitionSchema).optional(),
57647
- styles: px.record(px.any()).optional()
57666
+ styles: px.record(px.any()).optional(),
57667
+ glyphs: px.record(PxGlyphFontSchema).optional()
57648
57668
  }));
57649
57669
  var PxAnimatorConfigSchema = implementsInterface()(px.object({
57650
57670
  mode: px.enum([PxAnimatorMode.auto, PxAnimatorMode.webapi, PxAnimatorMode.frames]).optional(),
@@ -57717,9 +57737,10 @@ ${codeFrame}` : message);
57717
57737
  stretch: px.number().optional(),
57718
57738
  timeCrop: px.tuple([px.number(), px.number()]).optional()
57719
57739
  }));
57720
- var PxRefEffectSchema = implementsInterface()(px.object({
57740
+ var PxCloneEffectSchema = implementsInterface()(px.object({
57741
+ type: px.string().optional(),
57721
57742
  baseId: px.string().optional(),
57722
- type: px.string().optional()
57743
+ retime: PxRetimeEffectSchema.optional()
57723
57744
  }));
57724
57745
  var PxGradientType = {
57725
57746
  linear: "linear",
@@ -57755,17 +57776,20 @@ ${codeFrame}` : message);
57755
57776
  startOffset: PxAnimatableNumberSchema.optional(),
57756
57777
  textLength: PxAnimatableNumberSchema.optional()
57757
57778
  }));
57779
+ var PxTextEffectSchema = implementsInterface()(px.object({
57780
+ useGlyphs: px.boolean().optional()
57781
+ }));
57758
57782
  var PxEffectsSchema = implementsInterface()(px.object({
57759
57783
  transformation: PxTransformationEffectSchema.optional(),
57760
57784
  repeater: PxRepeaterEffectSchema.optional(),
57761
57785
  maskedBy: PxMaskedByEffectSchema.optional(),
57762
57786
  trimPath: PxTrimPathEffectSchema.optional(),
57763
- retime: PxRetimeEffectSchema.optional(),
57787
+ clone: PxCloneEffectSchema.optional(),
57764
57788
  isCombinedShape: px.boolean().optional(),
57765
- ref: PxRefEffectSchema.optional(),
57766
57789
  fillGradient: PxFillGradientEffectSchema.optional(),
57767
57790
  strokeGradient: PxStrokeGradientEffectSchema.optional(),
57768
- textAlongPath: PxTextAlongPathEffectSchema.optional()
57791
+ textAlongPath: PxTextAlongPathEffectSchema.optional(),
57792
+ text: PxTextEffectSchema.optional()
57769
57793
  }));
57770
57794
  function validateNodeEffects(root, opts) {
57771
57795
  const warnings = [];
@@ -57977,6 +58001,7 @@ ${codeFrame}` : message);
57977
58001
  const animBlock = stops;
57978
58002
  const kfs = animBlock.keyframes;
57979
58003
  if (!Array.isArray(kfs) || !kfs.length) return [];
58004
+ const loopFromSource = animBlock.loop;
57980
58005
  let stopCount = 0;
57981
58006
  for (const kf of kfs) {
57982
58007
  const v = (_a = kf.value) != null ? _a : kf.v;
@@ -57989,7 +58014,7 @@ ${codeFrame}` : message);
57989
58014
  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" };
57990
58015
  baselineStops.push({ offset: s.offset, color: s.color });
57991
58016
  }
57992
- return baselineStops.map((bs, i) => animatedStopNode(bs, kfs, i, ctx));
58017
+ return baselineStops.map((bs, i) => animatedStopNode(bs, kfs, i, ctx, loopFromSource));
57993
58018
  }
57994
58019
  function staticStopNode(s) {
57995
58020
  return {
@@ -57998,7 +58023,7 @@ ${codeFrame}` : message);
57998
58023
  stopColor: s.color
57999
58024
  };
58000
58025
  }
58001
- function animatedStopNode(baseline, kfs, stopIdx, _ctx) {
58026
+ function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
58002
58027
  var _a, _b, _c, _d, _e;
58003
58028
  const colorKfs = [];
58004
58029
  const offsetKfs = [];
@@ -58023,8 +58048,14 @@ ${codeFrame}` : message);
58023
58048
  stopColor: baseline.color
58024
58049
  };
58025
58050
  const animate = {};
58026
- if (colorKfs.length) animate.stopColor = { keyframes: colorKfs };
58027
- if (offsetVaries && offsetKfs.length) animate.offset = { keyframes: offsetKfs };
58051
+ if (colorKfs.length) {
58052
+ animate.stopColor = { keyframes: colorKfs };
58053
+ if (loop !== void 0) animate.stopColor.loop = loop;
58054
+ }
58055
+ if (offsetVaries && offsetKfs.length) {
58056
+ animate.offset = { keyframes: offsetKfs };
58057
+ if (loop !== void 0) animate.offset.loop = loop;
58058
+ }
58028
58059
  if (Object.keys(animate).length) stop.animate = animate;
58029
58060
  return stop;
58030
58061
  }
@@ -58087,9 +58118,11 @@ ${codeFrame}` : message);
58087
58118
  return { type: "g", transform: { value: partsRecord(part, invertPartValue(part, v.value), origin) }, children: [inner] };
58088
58119
  }
58089
58120
  if (v.kind === "animated") {
58121
+ const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, partsRecord(part, invertPartValue(part, kf.value), origin))) };
58122
+ if (v.loop !== void 0) animTr.loop = v.loop;
58090
58123
  return {
58091
58124
  type: "g",
58092
- animate: { transform: { keyframes: v.keyframes.map((kf) => keyframeWith(kf, partsRecord(part, invertPartValue(part, kf.value), origin))) } },
58125
+ animate: { transform: animTr },
58093
58126
  children: [inner]
58094
58127
  };
58095
58128
  }
@@ -58126,10 +58159,16 @@ ${codeFrame}` : message);
58126
58159
  scaleKfs.push(__spreadProps(__spreadValues({}, baseKf), { value: rec }));
58127
58160
  }
58128
58161
  }
58162
+ const srcLoop = animTr == null ? void 0 : animTr.loop;
58163
+ const withLoop = (kfs2) => {
58164
+ const block = { keyframes: kfs2 };
58165
+ if (srcLoop !== void 0) block.loop = srcLoop;
58166
+ return block;
58167
+ };
58129
58168
  let n = inner;
58130
- if (translateKfs.length) n = { type: "g", animate: { transform: { keyframes: translateKfs } }, children: [n] };
58131
- if (rotateKfs.length) n = { type: "g", animate: { transform: { keyframes: rotateKfs } }, children: [n] };
58132
- if (scaleKfs.length) n = { type: "g", animate: { transform: { keyframes: scaleKfs } }, children: [n] };
58169
+ if (translateKfs.length) n = { type: "g", animate: { transform: withLoop(translateKfs) }, children: [n] };
58170
+ if (rotateKfs.length) n = { type: "g", animate: { transform: withLoop(rotateKfs) }, children: [n] };
58171
+ if (scaleKfs.length) n = { type: "g", animate: { transform: withLoop(scaleKfs) }, children: [n] };
58133
58172
  return n;
58134
58173
  }
58135
58174
  function nodeHasBodyTransform(node) {
@@ -58361,16 +58400,18 @@ ${codeFrame}` : message);
58361
58400
  return seen ? [x, y] : void 0;
58362
58401
  }
58363
58402
  var CONTENT_SUBREF = "content";
58364
- function applyRefAndTransformationEffect(node, ref3, transformation, ctx) {
58365
- if (ref3) {
58366
- const baseId = ref3.baseId;
58367
- if (!baseId) {
58368
- ctx.errors.push("ref: missing baseId");
58369
- } else {
58370
- const targetId = ref3.type === CONTENT_SUBREF ? ctx.contentRefInnerIds.get(baseId) || baseId : baseId;
58371
- node.href = "#" + targetId;
58372
- }
58403
+ function applyRefHref(node, clone2, ctx) {
58404
+ if (!clone2) return;
58405
+ const baseId = clone2.baseId;
58406
+ if (!baseId) {
58407
+ if (clone2.type === CONTENT_SUBREF) ctx.errors.push("clone: content ref missing baseId");
58408
+ return;
58373
58409
  }
58410
+ const targetId = clone2.type === CONTENT_SUBREF ? ctx.contentRefInnerIds.get(baseId) || baseId : baseId;
58411
+ node.href = "#" + targetId;
58412
+ }
58413
+ function applyRefAndTransformationEffect(node, clone2, transformation, ctx) {
58414
+ applyRefHref(node, clone2, ctx);
58374
58415
  return applyTransformationEffect(node, transformation, ctx);
58375
58416
  }
58376
58417
  function applyRepeaterEffect(node, fx, ctx) {
@@ -58477,22 +58518,32 @@ ${codeFrame}` : message);
58477
58518
  stretch: parent.stretch * child.stretch
58478
58519
  };
58479
58520
  }
58480
- function applyAllRetimeEffects(root, ctx) {
58521
+ function readCloneRetime(n) {
58522
+ var _a, _b;
58523
+ return (_b = (_a = n.effects) == null ? void 0 : _a.clone) == null ? void 0 : _b.retime;
58524
+ }
58525
+ function clearCloneRetime(n) {
58481
58526
  var _a;
58527
+ const clone2 = (_a = n.effects) == null ? void 0 : _a.clone;
58528
+ if (!clone2) return;
58529
+ delete clone2.retime;
58530
+ if (Object.keys(clone2).length === 0) delete n.effects.clone;
58531
+ if (n.effects && Object.keys(n.effects).length === 0) delete n.effects;
58532
+ }
58533
+ function applyAllRetimeEffects(root, ctx) {
58482
58534
  ctx.idMap.clear();
58483
58535
  indexById(root, ctx.idMap);
58484
58536
  const sites = [];
58485
58537
  const collect = (n) => {
58486
- var _a2, _b;
58487
- if ((_a2 = n.effects) == null ? void 0 : _a2.retime) sites.push(n);
58488
- (_b = n.children) == null ? void 0 : _b.forEach(collect);
58538
+ var _a;
58539
+ if (readCloneRetime(n)) sites.push(n);
58540
+ (_a = n.children) == null ? void 0 : _a.forEach(collect);
58489
58541
  };
58490
58542
  collect(root);
58491
58543
  for (const useNode of sites) {
58492
- const retime = (_a = useNode.effects) == null ? void 0 : _a.retime;
58544
+ const retime = readCloneRetime(useNode);
58493
58545
  if (!retime) continue;
58494
- delete useNode.effects.retime;
58495
- if (Object.keys(useNode.effects).length === 0) delete useNode.effects;
58546
+ clearCloneRetime(useNode);
58496
58547
  materialiseRetime(useNode, asRetime(retime), ctx);
58497
58548
  }
58498
58549
  }
@@ -58516,7 +58567,6 @@ ${codeFrame}` : message);
58516
58567
  }
58517
58568
  }
58518
58569
  function buildChainClone(targetId, accum, ctx, chain) {
58519
- var _a, _b;
58520
58570
  if (chain.has(targetId)) {
58521
58571
  ctx.errors.push('retime: loop via "' + targetId + '"');
58522
58572
  return void 0;
@@ -58533,25 +58583,43 @@ ${codeFrame}` : message);
58533
58583
  } else {
58534
58584
  remapKeyframeTimes(cloneNode, accum.start, accum.stretch);
58535
58585
  }
58536
- if ((_a = cloneNode.effects) == null ? void 0 : _a.retime) {
58537
- delete cloneNode.effects.retime;
58538
- if (Object.keys(cloneNode.effects).length === 0) delete cloneNode.effects;
58539
- }
58586
+ clearCloneRetime(cloneNode);
58540
58587
  if (target.type === "use" && target.href) {
58541
58588
  const subId = stripHash(target.href);
58542
58589
  if (subId) {
58543
- const innerRetime = (_b = target.effects) == null ? void 0 : _b.retime;
58590
+ const innerRetime = readCloneRetime(target);
58544
58591
  const subAccum = innerRetime ? concatRetime(asRetime(innerRetime), accum) : accum;
58545
58592
  const subChain = new Set(chain);
58546
58593
  subChain.add(targetId);
58547
58594
  const subId2 = buildChainClone(subId, subAccum, ctx, subChain);
58548
58595
  if (subId2) cloneNode.href = "#" + subId2;
58549
58596
  }
58597
+ } else {
58598
+ materialiseNestedRetimeUses(cloneNode, accum, ctx, chain, targetId);
58550
58599
  }
58551
58600
  ctx.defs.push(cloneNode);
58552
58601
  if (typeof cloneNode.id === "string") ctx.idMap.set(cloneNode.id, cloneNode);
58553
58602
  return typeof cloneNode.id === "string" ? cloneNode.id : void 0;
58554
58603
  }
58604
+ function materialiseNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
58605
+ const visit = (n) => {
58606
+ var _a;
58607
+ const retime = readCloneRetime(n);
58608
+ if (n.type === "use" && retime && n.href) {
58609
+ const subId = stripHash(n.href);
58610
+ if (subId) {
58611
+ const subAccum = concatRetime(asRetime(retime), accum);
58612
+ const subChain = new Set(chain);
58613
+ subChain.add(parentTargetId);
58614
+ const subId2 = buildChainClone(subId, subAccum, ctx, subChain);
58615
+ if (subId2) n.href = "#" + subId2;
58616
+ }
58617
+ clearCloneRetime(n);
58618
+ }
58619
+ (_a = n.children) == null ? void 0 : _a.forEach(visit);
58620
+ };
58621
+ visit(node);
58622
+ }
58555
58623
  function remapKeyframeTimes(node, start, stretch) {
58556
58624
  var _a;
58557
58625
  remapKeyframeTimesOnly(node, start, stretch);
@@ -58594,12 +58662,14 @@ ${codeFrame}` : message);
58594
58662
  node[attrName] = String(raw);
58595
58663
  return;
58596
58664
  }
58597
- if (typeof raw === "object") {
58665
+ if (typeof raw === "object" && raw !== null) {
58598
58666
  const obj = raw;
58599
58667
  if (Array.isArray(obj.keyframes)) {
58600
58668
  const prevAnimate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
58601
58669
  const animate = __spreadValues({}, prevAnimate || {});
58602
- animate[attrName] = { keyframes: obj.keyframes };
58670
+ const block = { keyframes: obj.keyframes };
58671
+ if (obj.loop !== void 0) block.loop = obj.loop;
58672
+ animate[attrName] = block;
58603
58673
  node.animate = animate;
58604
58674
  return;
58605
58675
  }
@@ -58609,6 +58679,57 @@ ${codeFrame}` : message);
58609
58679
  }
58610
58680
  }
58611
58681
  }
58682
+ var jsonElementFactory = (type, props, children) => {
58683
+ const node = { type };
58684
+ for (const k in props) if (props[k] !== void 0) node[k] = props[k];
58685
+ const arr = Array.isArray(children) ? children.filter((c) => c != null) : children != null ? [children] : [];
58686
+ if (arr.length) node.children = arr;
58687
+ return node;
58688
+ };
58689
+ function fmt(v, decimals) {
58690
+ return Math.round(v) === v ? "" + Math.round(v) : v.toFixed(decimals);
58691
+ }
58692
+ function pack(nums, decimals) {
58693
+ let s = "";
58694
+ for (let i = 0; i < nums.length; i++) {
58695
+ const str2 = fmt(nums[i], decimals);
58696
+ if (i > 0 && str2.charCodeAt(0) !== 45) s += " ";
58697
+ s += str2;
58698
+ }
58699
+ return s;
58700
+ }
58701
+ function apply(m, x, y) {
58702
+ return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
58703
+ }
58704
+ var TOKEN_RE = /([MLCQZ])|(-?\d*\.?\d+(?:e[-+]?\d+)?)/gi;
58705
+ function transformPathData(d, m, decimals = 2) {
58706
+ const tokens = [];
58707
+ let match;
58708
+ TOKEN_RE.lastIndex = 0;
58709
+ while ((match = TOKEN_RE.exec(d)) !== null) tokens.push(match[0]);
58710
+ let out = "";
58711
+ let i = 0;
58712
+ const num2 = () => parseFloat(tokens[i++]);
58713
+ while (i < tokens.length) {
58714
+ const cmd = tokens[i++];
58715
+ if (cmd === "M" || cmd === "L") {
58716
+ const [x, y] = apply(m, num2(), num2());
58717
+ out += cmd + pack([x, y], decimals);
58718
+ } else if (cmd === "C") {
58719
+ const [x1, y1] = apply(m, num2(), num2());
58720
+ const [x2, y2] = apply(m, num2(), num2());
58721
+ const [x, y] = apply(m, num2(), num2());
58722
+ out += "C" + pack([x1, y1, x2, y2, x, y], decimals);
58723
+ } else if (cmd === "Q") {
58724
+ const [x1, y1] = apply(m, num2(), num2());
58725
+ const [x, y] = apply(m, num2(), num2());
58726
+ out += "Q" + pack([x1, y1, x, y], decimals);
58727
+ } else if (cmd === "Z" || cmd === "z") {
58728
+ out += "Z";
58729
+ }
58730
+ }
58731
+ return out;
58732
+ }
58612
58733
  function bezierToSvgPath(path) {
58613
58734
  var _a, _b, _c, _d;
58614
58735
  const v = path.v;
@@ -58980,6 +59101,24 @@ ${codeFrame}` : message);
58980
59101
  }
58981
59102
  return { ts, ds };
58982
59103
  }
59104
+ function bezier2D_tForDistance(lut, distance) {
59105
+ const { ts, ds } = lut;
59106
+ const last = ds.length - 1;
59107
+ if (distance <= 0) return ts[0];
59108
+ if (distance >= ds[last]) return ts[last];
59109
+ let lo = 1;
59110
+ let hi = last;
59111
+ while (lo < hi) {
59112
+ const mid = lo + hi >>> 1;
59113
+ if (ds[mid] < distance) lo = mid + 1;
59114
+ else hi = mid;
59115
+ }
59116
+ const dPrev = ds[hi - 1];
59117
+ const dCur = ds[hi];
59118
+ const span = dCur - dPrev;
59119
+ const frac = span > 0 ? (distance - dPrev) / span : 0;
59120
+ return ts[hi - 1] + frac * (ts[hi] - ts[hi - 1]);
59121
+ }
58983
59122
  function bezier2D_arcAtT(lut, t) {
58984
59123
  const { ts, ds } = lut;
58985
59124
  const last = ts.length - 1;
@@ -59001,6 +59140,435 @@ ${codeFrame}` : message);
59001
59140
  const flipped = [easing[1], easing[0], easing[3], easing[2]];
59002
59141
  return cubicBezier(flipped);
59003
59142
  }
59143
+ var LUT_STEPS = 48;
59144
+ var CMD_RE = /[MmLlHhVvCcSsQqTtAaZz]/;
59145
+ function tokenize(d) {
59146
+ const tokens = [];
59147
+ const re = /([MmLlHhVvCcSsQqTtAaZz])|(-?\d*\.?\d+(?:[eE][-+]?\d+)?)/g;
59148
+ let m;
59149
+ while ((m = re.exec(d)) !== null) tokens.push(m[0]);
59150
+ return tokens;
59151
+ }
59152
+ function quadToCubic(P0, Qc, P3) {
59153
+ return {
59154
+ P1: [P0[0] + 2 / 3 * (Qc[0] - P0[0]), P0[1] + 2 / 3 * (Qc[1] - P0[1])],
59155
+ P2: [P3[0] + 2 / 3 * (Qc[0] - P3[0]), P3[1] + 2 / 3 * (Qc[1] - P3[1])]
59156
+ };
59157
+ }
59158
+ function parseCubics(d) {
59159
+ const tokens = tokenize(d);
59160
+ const segs = [];
59161
+ let i = 0;
59162
+ let cx = 0, cy = 0;
59163
+ let sx = 0, sy = 0;
59164
+ let pcx = 0, pcy = 0;
59165
+ let pqx = 0, pqy = 0;
59166
+ let prevCmd = "";
59167
+ const num2 = () => parseFloat(tokens[i++]);
59168
+ const push = (P1, P2, P3) => {
59169
+ const P0 = [cx, cy];
59170
+ const lut = bezier2D_arcLengthLUT(P0, P1, P2, P3, LUT_STEPS);
59171
+ segs.push({ P0, P1, P2, P3, lut, len: lut.ds[lut.ds.length - 1] });
59172
+ cx = P3[0];
59173
+ cy = P3[1];
59174
+ };
59175
+ const pushLine = (x, y) => {
59176
+ push(
59177
+ [cx + (x - cx) / 3, cy + (y - cy) / 3],
59178
+ [cx + 2 * (x - cx) / 3, cy + 2 * (y - cy) / 3],
59179
+ [x, y]
59180
+ );
59181
+ };
59182
+ while (i < tokens.length) {
59183
+ let cmd = tokens[i];
59184
+ if (CMD_RE.test(cmd)) i++;
59185
+ else cmd = prevCmd === "M" ? "L" : prevCmd === "m" ? "l" : prevCmd;
59186
+ const rel = cmd >= "a";
59187
+ const U = cmd.toUpperCase();
59188
+ if (U === "Z") {
59189
+ pushLine(sx, sy);
59190
+ cx = sx;
59191
+ cy = sy;
59192
+ prevCmd = cmd;
59193
+ continue;
59194
+ }
59195
+ if (U === "M") {
59196
+ const x = num2() + (rel ? cx : 0), y = num2() + (rel ? cy : 0);
59197
+ cx = x;
59198
+ cy = y;
59199
+ sx = x;
59200
+ sy = y;
59201
+ prevCmd = cmd;
59202
+ continue;
59203
+ }
59204
+ if (U === "L") {
59205
+ pushLine(num2() + (rel ? cx : 0), num2() + (rel ? cy : 0));
59206
+ } else if (U === "H") {
59207
+ pushLine(num2() + (rel ? cx : 0), cy);
59208
+ } else if (U === "V") {
59209
+ pushLine(cx, num2() + (rel ? cy : 0));
59210
+ } else if (U === "C") {
59211
+ const p1 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59212
+ const p2 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59213
+ const p3 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59214
+ pcx = p2[0];
59215
+ pcy = p2[1];
59216
+ push(p1, p2, p3);
59217
+ } else if (U === "S") {
59218
+ const smooth = prevCmd.toUpperCase() === "C" || prevCmd.toUpperCase() === "S";
59219
+ const p1 = smooth ? [2 * cx - pcx, 2 * cy - pcy] : [cx, cy];
59220
+ const p2 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59221
+ const p3 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59222
+ pcx = p2[0];
59223
+ pcy = p2[1];
59224
+ push(p1, p2, p3);
59225
+ } else if (U === "Q") {
59226
+ const qc = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59227
+ const p3 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59228
+ pqx = qc[0];
59229
+ pqy = qc[1];
59230
+ const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
59231
+ push(P1, P2, p3);
59232
+ } else if (U === "T") {
59233
+ const smooth = prevCmd.toUpperCase() === "Q" || prevCmd.toUpperCase() === "T";
59234
+ const qc = smooth ? [2 * cx - pqx, 2 * cy - pqy] : [cx, cy];
59235
+ const p3 = [num2() + (rel ? cx : 0), num2() + (rel ? cy : 0)];
59236
+ pqx = qc[0];
59237
+ pqy = qc[1];
59238
+ const { P1, P2 } = quadToCubic([cx, cy], qc, p3);
59239
+ push(P1, P2, p3);
59240
+ } else if (U === "A") {
59241
+ i += 5;
59242
+ pushLine(num2() + (rel ? cx : 0), num2() + (rel ? cy : 0));
59243
+ } else {
59244
+ i++;
59245
+ continue;
59246
+ }
59247
+ prevCmd = cmd;
59248
+ }
59249
+ return segs.length ? segs : null;
59250
+ }
59251
+ function clamp2(v, lo, hi) {
59252
+ return v < lo ? lo : v > hi ? hi : v;
59253
+ }
59254
+ function createPathSampler(d) {
59255
+ const segs = parseCubics(d);
59256
+ if (!segs) return null;
59257
+ const cum = new Float64Array(segs.length + 1);
59258
+ for (let k = 0; k < segs.length; k++) cum[k + 1] = cum[k] + segs[k].len;
59259
+ const totalLength = cum[segs.length];
59260
+ const start = segs[0].P0, end = segs[segs.length - 1].P3;
59261
+ const closed = Math.hypot(end[0] - start[0], end[1] - start[1]) < 1e-3;
59262
+ const sampleOn = (dist) => {
59263
+ let k = 0;
59264
+ while (k < segs.length - 1 && dist > cum[k + 1]) k++;
59265
+ const seg = segs[k];
59266
+ const local = dist - cum[k];
59267
+ const t = seg.len > 0 ? bezier2D_tForDistance(seg.lut, local) : 0;
59268
+ const [x, y] = bezier2D_pointAt(seg.P0, seg.P1, seg.P2, seg.P3, t);
59269
+ const [dx, dy] = bezier2D_derivativeAt(seg.P0, seg.P1, seg.P2, seg.P3, t);
59270
+ return { x, y, angle: Math.atan2(dy, dx) };
59271
+ };
59272
+ return {
59273
+ totalLength,
59274
+ sampleAtDistance(dist) {
59275
+ if (!closed && (dist < 0 || dist > totalLength)) {
59276
+ const edge = dist < 0 ? 0 : totalLength;
59277
+ const p = sampleOn(edge);
59278
+ const over = dist - edge;
59279
+ return { x: p.x + Math.cos(p.angle) * over, y: p.y + Math.sin(p.angle) * over, angle: p.angle };
59280
+ }
59281
+ return sampleOn(clamp2(dist, 0, totalLength));
59282
+ }
59283
+ };
59284
+ }
59285
+ var DEFAULT_FONT_SIZE = 16;
59286
+ var TEXT_ATTR_KEYS = [
59287
+ "fontFamily",
59288
+ "fontSize",
59289
+ "fontWeight",
59290
+ "fontStyle",
59291
+ "textAnchor",
59292
+ "letterSpacing",
59293
+ "wordSpacing",
59294
+ "textDecoration",
59295
+ "textTransform",
59296
+ "whiteSpace",
59297
+ "x",
59298
+ "y",
59299
+ "dx",
59300
+ "dy",
59301
+ "lengthAdjust",
59302
+ "fill",
59303
+ "stroke",
59304
+ "strokeWidth",
59305
+ "effects",
59306
+ TEXT_ATTR,
59307
+ TEXT_CONTENT_ATTR,
59308
+ "xml:space"
59309
+ ];
59310
+ function parseLen(v) {
59311
+ if (typeof v === "number") return v;
59312
+ if (typeof v === "string") {
59313
+ const n = parseFloat(v);
59314
+ return isNaN(n) ? void 0 : n;
59315
+ }
59316
+ return void 0;
59317
+ }
59318
+ function str(v) {
59319
+ return typeof v === "string" ? v : void 0;
59320
+ }
59321
+ function resolveStyle(node, parent) {
59322
+ var _a, _b, _c, _d, _e, _f, _g;
59323
+ return {
59324
+ fontFamily: (_a = str(node.fontFamily)) != null ? _a : parent.fontFamily,
59325
+ fontSize: (_b = parseLen(node.fontSize)) != null ? _b : parent.fontSize,
59326
+ fill: (_c = node.fill) != null ? _c : parent.fill,
59327
+ stroke: (_d = node.stroke) != null ? _d : parent.stroke,
59328
+ strokeWidth: (_e = node.strokeWidth) != null ? _e : parent.strokeWidth,
59329
+ letterSpacing: (_f = parseLen(node.letterSpacing)) != null ? _f : parent.letterSpacing,
59330
+ wordSpacing: (_g = parseLen(node.wordSpacing)) != null ? _g : parent.wordSpacing
59331
+ };
59332
+ }
59333
+ function rootStyleOf(node) {
59334
+ var _a, _b, _c;
59335
+ return {
59336
+ fontFamily: str(node.fontFamily),
59337
+ fontSize: (_a = parseLen(node.fontSize)) != null ? _a : DEFAULT_FONT_SIZE,
59338
+ fill: node.fill,
59339
+ stroke: node.stroke,
59340
+ strokeWidth: node.strokeWidth,
59341
+ letterSpacing: (_b = parseLen(node.letterSpacing)) != null ? _b : 0,
59342
+ wordSpacing: (_c = parseLen(node.wordSpacing)) != null ? _c : 0
59343
+ };
59344
+ }
59345
+ function paintOf(s) {
59346
+ const p = {};
59347
+ if (s.fill !== void 0) p.fill = s.fill;
59348
+ if (s.stroke !== void 0) p.stroke = s.stroke;
59349
+ if (s.strokeWidth !== void 0) p.strokeWidth = s.strokeWidth;
59350
+ return p;
59351
+ }
59352
+ function glyphFontFor(s, glyphs, soleFont, warnings) {
59353
+ var _a;
59354
+ const gf = s.fontFamily ? glyphs[s.fontFamily] : soleFont;
59355
+ if (!gf) warnings == null ? void 0 : warnings.push('textGlyphs: no glyphs for font "' + ((_a = s.fontFamily) != null ? _a : "") + '"');
59356
+ return gf;
59357
+ }
59358
+ function soleFontOf(glyphs) {
59359
+ const names = Object.keys(glyphs);
59360
+ return names.length === 1 ? glyphs[names[0]] : void 0;
59361
+ }
59362
+ function materialiseGlyphTextHorizontal(node, opts) {
59363
+ var _a, _b, _c, _d;
59364
+ const { glyphs, create = jsonElementFactory, warnings } = opts;
59365
+ const soleFont = soleFontOf(glyphs);
59366
+ const pen = { x: (_a = parseLen(node.x)) != null ? _a : 0, y: (_b = parseLen(node.y)) != null ? _b : 0 };
59367
+ const placements = [];
59368
+ const lines = [{ start: pen.x, end: pen.x }];
59369
+ let line = 0;
59370
+ const renderChars = (content, s) => {
59371
+ const gf = glyphFontFor(s, glyphs, soleFont, warnings);
59372
+ if (!gf) return;
59373
+ const scale = s.fontSize / gf.unitsPerEm;
59374
+ const paint = paintOf(s);
59375
+ for (let i = 0; i < content.length; i++) {
59376
+ const ch = content.charAt(i);
59377
+ const g = gf.glyphs[ch];
59378
+ if (g && g.d) placements.push({ glyphD: g.d, m: [scale, 0, 0, scale, pen.x, pen.y], paint, line, x: pen.x, y: pen.y, scale });
59379
+ pen.x += (g ? g.width : 0) * scale + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
59380
+ lines[line].end = pen.x;
59381
+ }
59382
+ };
59383
+ const walk = (el, parentStyle) => {
59384
+ var _a2, _b2, _c2, _d2;
59385
+ const s = resolveStyle(el, parentStyle);
59386
+ const x = parseLen(el.x);
59387
+ const y = parseLen(el.y);
59388
+ if (x !== void 0) {
59389
+ pen.x = x;
59390
+ line = lines.length;
59391
+ lines.push({ start: pen.x, end: pen.x });
59392
+ }
59393
+ if (y !== void 0) pen.y = y;
59394
+ pen.x += (_a2 = parseLen(el.dx)) != null ? _a2 : 0;
59395
+ pen.y += (_b2 = parseLen(el.dy)) != null ? _b2 : 0;
59396
+ const content = (_c2 = str(el[TEXT_ATTR])) != null ? _c2 : str(el[TEXT_CONTENT_ATTR]);
59397
+ if (content && !((_d2 = el.children) == null ? void 0 : _d2.length)) renderChars(content, s);
59398
+ if (el.children) for (const ch of el.children) walk(ch, s);
59399
+ };
59400
+ const rootStyle = rootStyleOf(node);
59401
+ if (node.children) for (const ch of node.children) walk(ch, rootStyle);
59402
+ const rootContent = (_c = str(node[TEXT_ATTR])) != null ? _c : str(node[TEXT_CONTENT_ATTR]);
59403
+ if (rootContent && !((_d = node.children) == null ? void 0 : _d.length)) renderChars(rootContent, rootStyle);
59404
+ const anchor = str(node.textAnchor);
59405
+ if (anchor === "middle" || anchor === "end") {
59406
+ for (const p of placements) {
59407
+ const w = lines[p.line].end - lines[p.line].start;
59408
+ const shift = anchor === "middle" ? -w / 2 : -w;
59409
+ p.m = [p.scale, 0, 0, p.scale, p.x + shift, p.y];
59410
+ }
59411
+ }
59412
+ return toGroup(node, buildPaths(placements, create, warnings), create);
59413
+ }
59414
+ function collectAlongPathCells(node, glyphs, soleFont, warnings) {
59415
+ const cells = [];
59416
+ let adv = 0;
59417
+ const walk = (el, parentStyle) => {
59418
+ var _a, _b;
59419
+ const s = resolveStyle(el, parentStyle);
59420
+ const content = (_a = str(el[TEXT_ATTR])) != null ? _a : str(el[TEXT_CONTENT_ATTR]);
59421
+ if (content && !((_b = el.children) == null ? void 0 : _b.length)) {
59422
+ const gf = glyphFontFor(s, glyphs, soleFont, warnings);
59423
+ if (gf) {
59424
+ const scale = s.fontSize / gf.unitsPerEm;
59425
+ const paint = paintOf(s);
59426
+ for (let i = 0; i < content.length; i++) {
59427
+ const ch = content.charAt(i);
59428
+ const g = gf.glyphs[ch];
59429
+ const glyphAdv = (g ? g.width : 0) * scale;
59430
+ if (g && g.d) cells.push({ glyphD: g.d, widthEm: g.width, scale, paint, midBase: adv + glyphAdv / 2 });
59431
+ adv += glyphAdv + s.letterSpacing + (ch === " " ? s.wordSpacing : 0);
59432
+ }
59433
+ }
59434
+ }
59435
+ if (el.children) for (const ch of el.children) walk(ch, s);
59436
+ };
59437
+ walk(node, rootStyleOf(node));
59438
+ return { cells, width: adv };
59439
+ }
59440
+ function alongAffine(sampler, dist, scale, widthEm) {
59441
+ const { x, y, angle } = sampler.sampleAtDistance(dist);
59442
+ const cos = Math.cos(angle), sin = Math.sin(angle), hw = widthEm / 2;
59443
+ return [scale * cos, scale * sin, -scale * sin, scale * cos, x - scale * cos * hw, y - scale * sin * hw];
59444
+ }
59445
+ function materialiseGlyphTextAlongPath(node, pathD, startOffset, opts, textLength) {
59446
+ var _a;
59447
+ const { glyphs, create = jsonElementFactory, warnings } = opts;
59448
+ const sampler = pathD ? createPathSampler(pathD) : null;
59449
+ if (!sampler) {
59450
+ warnings == null ? void 0 : warnings.push("textGlyphs: unparsable along-path geometry");
59451
+ return null;
59452
+ }
59453
+ const soleFont = soleFontOf(glyphs);
59454
+ const { cells, width } = collectAlongPathCells(node, glyphs, soleFont, warnings);
59455
+ if (!cells.length) return toGroup(node, [], create);
59456
+ if (textLength && textLength > 0 && width > 0) {
59457
+ const k = textLength / width;
59458
+ for (const c of cells) c.midBase *= k;
59459
+ }
59460
+ const so = readAnimatable(startOffset);
59461
+ if (so.kind === "animated" && so.keyframes.length >= 2) {
59462
+ return toGroup(node, buildAnimatedAlongPath(cells, sampler, so.keyframes, so.loop, create), create);
59463
+ }
59464
+ const base = so.kind === "animated" ? Number((_a = so.keyframes[0]) == null ? void 0 : _a.value) || 0 : so.kind === "static" ? Number(so.value) || 0 : 0;
59465
+ const placements = cells.map((c) => ({
59466
+ glyphD: c.glyphD,
59467
+ paint: c.paint,
59468
+ m: alongAffine(sampler, base + c.midBase, c.scale, c.widthEm)
59469
+ }));
59470
+ return toGroup(node, buildPaths(placements, create, warnings), create);
59471
+ }
59472
+ var ALONG_PATH_MAX_STEPS = 48;
59473
+ var ALONG_PATH_MAX_STEPS_PER_SEGMENT = 64;
59474
+ function roundN(v, n) {
59475
+ const f = __pow(10, n);
59476
+ return Math.round(v * f) / f;
59477
+ }
59478
+ function buildAnimatedAlongPath(cells, sampler, sokfs, loop, create) {
59479
+ const step = Math.max(sampler.totalLength / ALONG_PATH_MAX_STEPS, 0.5);
59480
+ const timeOf = (kf) => Number(kf.time) || 0;
59481
+ const offOf = (kf) => Number(kf.value) || 0;
59482
+ const out = [];
59483
+ for (const c of cells) {
59484
+ const centred = [c.scale, 0, 0, c.scale, -c.scale * (c.widthEm / 2), 0];
59485
+ const d = transformPathData(c.glyphD, centred);
59486
+ const sampleKf = (dist, time) => {
59487
+ const { x, y, angle } = sampler.sampleAtDistance(dist);
59488
+ return {
59489
+ time,
59490
+ value: {
59491
+ [
59492
+ "translate"
59493
+ /* Translate */
59494
+ ]: [roundN(x, 3), roundN(y, 3)],
59495
+ [
59496
+ "rotate"
59497
+ /* Rotate */
59498
+ ]: roundN(angle * 180 / Math.PI, 3)
59499
+ }
59500
+ };
59501
+ };
59502
+ const kfs = [sampleKf(offOf(sokfs[0]) + c.midBase, timeOf(sokfs[0]))];
59503
+ for (let k = 1; k < sokfs.length; k++) {
59504
+ const t0 = timeOf(sokfs[k - 1]), t1 = timeOf(sokfs[k]);
59505
+ const o0 = offOf(sokfs[k - 1]), o1 = offOf(sokfs[k]);
59506
+ const n = Math.min(ALONG_PATH_MAX_STEPS_PER_SEGMENT, Math.max(1, Math.ceil(Math.abs(o1 - o0) / step)));
59507
+ for (let s = 1; s <= n; s++) {
59508
+ const f = s / n;
59509
+ kfs.push(sampleKf(o0 + f * (o1 - o0) + c.midBase, t0 + f * (t1 - t0)));
59510
+ }
59511
+ }
59512
+ const transform = { keyframes: kfs };
59513
+ if (loop !== void 0) transform.loop = loop;
59514
+ out.push(create("path", __spreadProps(__spreadValues({ d }, paintProps(c.paint)), { animate: { transform } }), []));
59515
+ }
59516
+ return out;
59517
+ }
59518
+ function paintProps(paint) {
59519
+ const p = {};
59520
+ if (paint.fill !== void 0) p.fill = paint.fill;
59521
+ if (paint.stroke !== void 0) p.stroke = paint.stroke;
59522
+ if (paint.strokeWidth !== void 0) p.strokeWidth = paint.strokeWidth;
59523
+ return p;
59524
+ }
59525
+ function buildPaths(placements, create, warnings) {
59526
+ var _a, _b, _c;
59527
+ if (!placements.length) {
59528
+ warnings == null ? void 0 : warnings.push("textGlyphs: nothing to render");
59529
+ return [];
59530
+ }
59531
+ const byPaint = /* @__PURE__ */ new Map();
59532
+ for (const p of placements) {
59533
+ const key = JSON.stringify([(_a = p.paint.fill) != null ? _a : null, (_b = p.paint.stroke) != null ? _b : null, (_c = p.paint.strokeWidth) != null ? _c : null]);
59534
+ const baked = transformPathData(p.glyphD, p.m);
59535
+ const entry = byPaint.get(key);
59536
+ if (entry) entry.d += baked;
59537
+ else byPaint.set(key, { paint: p.paint, d: baked });
59538
+ }
59539
+ const out = [];
59540
+ for (const { paint, d } of byPaint.values()) out.push(create("path", __spreadValues({ d }, paintProps(paint)), []));
59541
+ return out;
59542
+ }
59543
+ function toGroup(node, children, create) {
59544
+ const gProps = {};
59545
+ for (const k of Object.keys(node)) {
59546
+ if (k === "type" || k === "children" || TEXT_ATTR_KEYS.indexOf(k) !== -1) continue;
59547
+ gProps[k] = node[k];
59548
+ }
59549
+ if (gProps.style && typeof gProps.style === "object") {
59550
+ const style = __spreadValues({}, gProps.style);
59551
+ delete style["white-space"];
59552
+ if (Object.keys(style).length) gProps.style = style;
59553
+ else delete gProps.style;
59554
+ }
59555
+ return create("g", gProps, children);
59556
+ }
59557
+ function applyTextGlyphsEffect(node, fx, ctx) {
59558
+ if (!(fx == null ? void 0 : fx.useGlyphs)) return node;
59559
+ if (!ctx.glyphs) {
59560
+ ctx.warnings.push("textGlyphs: no definitions.glyphs \u2014 left as native <text>");
59561
+ return node;
59562
+ }
59563
+ return materialiseGlyphTextHorizontal(node, { glyphs: ctx.glyphs, warnings: ctx.warnings });
59564
+ }
59565
+ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength) {
59566
+ if (!ctx.glyphs) {
59567
+ ctx.warnings.push("textGlyphs: no definitions.glyphs");
59568
+ return null;
59569
+ }
59570
+ return materialiseGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength);
59571
+ }
59004
59572
  function getKfTranslate(kf) {
59005
59573
  var _a;
59006
59574
  const v = (_a = kf.value) != null ? _a : kf.v;
@@ -59441,12 +60009,12 @@ ${codeFrame}` : message);
59441
60009
  }
59442
60010
  return res;
59443
60011
  }
59444
- function extractPathData(str) {
59445
- if (str.startsWith("path(") && str.endsWith(")")) {
59446
- return str.slice(5, -1);
60012
+ function extractPathData(str2) {
60013
+ if (str2.startsWith("path(") && str2.endsWith(")")) {
60014
+ return str2.slice(5, -1);
59447
60015
  }
59448
- if (/^[MmZzLlHhVvCcSsQqTtAa]/.test(str)) {
59449
- return str;
60016
+ if (/^[MmZzLlHhVvCcSsQqTtAa]/.test(str2)) {
60017
+ return str2;
59450
60018
  }
59451
60019
  return void 0;
59452
60020
  }
@@ -59656,16 +60224,67 @@ ${codeFrame}` : message);
59656
60224
  looped.push(pushed);
59657
60225
  }
59658
60226
  }
59659
- for (let rep = 0; rep < fullReps; rep++) {
59660
- const distFromBoundary = loop.before ? fullReps - 1 - rep : rep;
59661
- const isReversed = !!loop.alternate && distFromBoundary % 2 === 0;
59662
- const repStart = fillStart + rep * segDuration;
59663
- appendRep(repStart, isReversed);
60227
+ function appendRepTail(repStart, isReversed, tailFraction) {
60228
+ let entries;
60229
+ if (isReversed) {
60230
+ entries = [];
60231
+ for (let i = template.length - 1; i >= 0; i--) {
60232
+ entries.push({
60233
+ relT: 1 - template[i].relT,
60234
+ v: template[i].v,
60235
+ e: i > 0 ? reverseEasing(template[i - 1].e) : void 0,
60236
+ tangentIn: template[i].tangentOut,
60237
+ tangentOut: template[i].tangentIn
60238
+ });
60239
+ }
60240
+ } else {
60241
+ entries = template;
60242
+ }
60243
+ const startRelT = 1 - tailFraction;
60244
+ for (let i = 0; i < entries.length; i++) {
60245
+ const entry = entries[i];
60246
+ if (entry.relT < startRelT - 1e-9) continue;
60247
+ const prev = entries[i - 1];
60248
+ if (prev && prev.relT < startRelT - 1e-9 && entry.relT > startRelT + 1e-9) {
60249
+ const intervalSpan = entry.relT - prev.relT;
60250
+ const localFrac = (startRelT - prev.relT) / intervalSpan;
60251
+ const easedFrac = prev.e ? cubicBezier(prev.e)(localFrac) : localFrac;
60252
+ const startValue = interpolateValue(propName, prev.v, entry.v, easedFrac);
60253
+ const { right: rightEasing } = splitEasing(prev.e, localFrac);
60254
+ looped.push({ t: repStart, v: startValue, e: rightEasing });
60255
+ }
60256
+ const pushed = {
60257
+ t: repStart + (entry.relT - startRelT) * segDuration,
60258
+ v: entry.v,
60259
+ e: i < entries.length - 1 ? entry.e : void 0
60260
+ };
60261
+ if (entry.tangentIn) pushed.tangentIn = entry.tangentIn;
60262
+ if (entry.tangentOut) pushed.tangentOut = entry.tangentOut;
60263
+ looped.push(pushed);
60264
+ }
59664
60265
  }
59665
- if (partialFraction > 1e-9) {
59666
- const isReversed = !!loop.alternate && fullReps % 2 === 0;
59667
- const repStart = fillStart + fullReps * segDuration;
59668
- appendRep(repStart, isReversed, partialFraction);
60266
+ if (loop.before) {
60267
+ if (partialFraction > 1e-9) {
60268
+ const isReversed = !!loop.alternate && fullReps % 2 === 0;
60269
+ appendRepTail(fillStart, isReversed, partialFraction);
60270
+ }
60271
+ for (let rep = 0; rep < fullReps; rep++) {
60272
+ const distFromBoundary = fullReps - 1 - rep;
60273
+ const isReversed = !!loop.alternate && distFromBoundary % 2 === 0;
60274
+ const repStart = fillStart + remainder + rep * segDuration;
60275
+ appendRep(repStart, isReversed);
60276
+ }
60277
+ } else {
60278
+ for (let rep = 0; rep < fullReps; rep++) {
60279
+ const isReversed = !!loop.alternate && rep % 2 === 0;
60280
+ const repStart = fillStart + rep * segDuration;
60281
+ appendRep(repStart, isReversed);
60282
+ }
60283
+ if (partialFraction > 1e-9) {
60284
+ const isReversed = !!loop.alternate && fullReps % 2 === 0;
60285
+ const repStart = fillStart + fullReps * segDuration;
60286
+ appendRep(repStart, isReversed, partialFraction);
60287
+ }
59669
60288
  }
59670
60289
  if (loop.before) {
59671
60290
  return [...looped, ...keyframes];
@@ -59982,7 +60601,6 @@ ${codeFrame}` : message);
59982
60601
  if (!trimPath) return node;
59983
60602
  const trimAllAsOne = !!trimPath.trimAllAsOne;
59984
60603
  const leafEntries = [];
59985
- let acc = 0;
59986
60604
  const measure = (n) => {
59987
60605
  if (Array.isArray(n.children) && n.children.length > 0) {
59988
60606
  for (const ch of n.children) measure(ch);
@@ -59994,15 +60612,22 @@ ${codeFrame}` : message);
59994
60612
  if (!subpaths.length) return;
59995
60613
  const entry = { leaf: n, subpaths: [] };
59996
60614
  for (const sp of subpaths) {
59997
- if (!trimAllAsOne) acc = 0;
59998
60615
  const lengthPx = pxBezierPathLength(sp);
59999
- entry.subpaths.push({ subpath: sp, lengthPx, startOffsetPx: acc });
60000
- acc += lengthPx;
60616
+ entry.subpaths.push({ subpath: sp, lengthPx, startOffsetPx: 0 });
60001
60617
  }
60002
60618
  leafEntries.push(entry);
60003
60619
  };
60004
60620
  measure(node);
60005
60621
  if (!leafEntries.length) return node;
60622
+ let acc = 0;
60623
+ const iterOrder = trimAllAsOne ? [...leafEntries].reverse() : leafEntries;
60624
+ for (const entry of iterOrder) {
60625
+ for (const sp of entry.subpaths) {
60626
+ if (!trimAllAsOne) acc = 0;
60627
+ sp.startOffsetPx = acc;
60628
+ acc += sp.lengthPx;
60629
+ }
60630
+ }
60006
60631
  const chainLengthPx = acc;
60007
60632
  if (trimAllAsOne && chainLengthPx < 1e-3) return node;
60008
60633
  const offsetReadRaw = readAnimatable(trimPath.offset);
@@ -60129,10 +60754,12 @@ ${codeFrame}` : message);
60129
60754
  value: map((_c = kf.value) != null ? _c : kf.v),
60130
60755
  easing: (_d = kf.easing) != null ? _d : kf.e
60131
60756
  };
60132
- })
60757
+ }),
60758
+ loop: read.loop
60133
60759
  };
60134
60760
  }
60135
60761
  function applyAttr(node, attrName, attr) {
60762
+ var _a, _b;
60136
60763
  if (!attr) return;
60137
60764
  if (attr.kind === "static") {
60138
60765
  node[attrName] = attr.value;
@@ -60140,9 +60767,16 @@ ${codeFrame}` : message);
60140
60767
  }
60141
60768
  const prevAnimate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
60142
60769
  const animate = __spreadValues({}, prevAnimate || {});
60143
- animate[attrName] = { keyframes: attr.keyframes };
60770
+ const block = { keyframes: attr.keyframes };
60771
+ if (attr.loop !== void 0) block.loop = attr.loop;
60772
+ animate[attrName] = block;
60144
60773
  node.animate = animate;
60774
+ const firstKf = attr.keyframes[0];
60775
+ if (firstKf && ((_a = firstKf.value) != null ? _a : firstKf.v) !== void 0) {
60776
+ node[attrName] = (_b = firstKf.value) != null ? _b : firstKf.v;
60777
+ }
60145
60778
  }
60779
+ var OPACITY_STEP_MS = 10;
60146
60780
  function computeOpacityFromRange(rangeRead) {
60147
60781
  var _a, _b, _c, _d, _e, _f;
60148
60782
  const hide = (v) => v[0] === v[1];
@@ -60168,9 +60802,9 @@ ${codeFrame}` : message);
60168
60802
  const nextHide = nextKf ? thisHide && hide((_f = nextKf.value) != null ? _f : nextKf.v) : thisHide;
60169
60803
  if (prevHide && !nextHide) {
60170
60804
  out.push({ time: t, value: 0 });
60171
- out.push({ time: t + 1, value: 1 });
60805
+ out.push({ time: t + OPACITY_STEP_MS, value: 1 });
60172
60806
  } else if (!prevHide && nextHide) {
60173
- out.push({ time: t - 1, value: 1 });
60807
+ out.push({ time: t - OPACITY_STEP_MS, value: 1 });
60174
60808
  out.push({ time: t, value: 0 });
60175
60809
  }
60176
60810
  }
@@ -60301,6 +60935,7 @@ ${codeFrame}` : message);
60301
60935
  return "M" + (x + w) + "," + y + "L" + (x + w) + "," + (y + h3) + "L" + x + "," + (y + h3) + "L" + x + "," + y + "L" + (x + w) + "," + y + "z";
60302
60936
  }
60303
60937
  function applyPlayerEffects(root) {
60938
+ var _a, _b;
60304
60939
  const ctx = {
60305
60940
  defs: [],
60306
60941
  warnings: [],
@@ -60308,7 +60943,11 @@ ${codeFrame}` : message);
60308
60943
  idMap: /* @__PURE__ */ new Map(),
60309
60944
  nextId: 0,
60310
60945
  contentRefInnerIds: /* @__PURE__ */ new Map(),
60311
- maskAncestorChains: /* @__PURE__ */ new Map()
60946
+ maskAncestorChains: /* @__PURE__ */ new Map(),
60947
+ // Resolved engine: `frames` ONLY when explicitly set; auto/webapi/unset →
60948
+ // webapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
60949
+ engine: ((_a = getAnimatorConfig(root)) == null ? void 0 : _a.mode) === PxAnimatorMode.frames ? PxAnimatorEngine.frames : PxAnimatorEngine.webapi,
60950
+ glyphs: (_b = getDefs(root)) == null ? void 0 : _b.glyphs
60312
60951
  };
60313
60952
  const working = clone(root);
60314
60953
  indexById(working, ctx.idMap);
@@ -60320,27 +60959,46 @@ ${codeFrame}` : message);
60320
60959
  return { root: out, defs: ctx.defs, warnings: ctx.warnings, errors: ctx.errors };
60321
60960
  }
60322
60961
  function applyPlayerEffects_exceptRetime(node, ctx) {
60962
+ var _a;
60323
60963
  if (node.children) node.children = node.children.map((child) => applyPlayerEffects_exceptRetime(child, ctx));
60324
60964
  const fx = node.effects;
60325
60965
  const originalId = typeof node.id === "string" ? node.id : void 0;
60326
60966
  const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
60327
60967
  if (!fx && !innerIdForContentRef) return node;
60328
- const { transformation, repeater, maskedBy, trimPath, retime, ref: ref3, fillGradient, strokeGradient, textAlongPath } = fx != null ? fx : {};
60968
+ const { transformation, repeater, maskedBy, trimPath, clone: cloneFx, fillGradient, strokeGradient, textAlongPath, text } = fx != null ? fx : {};
60329
60969
  const isCombinedShape = fx == null ? void 0 : fx.isCombinedShape;
60330
60970
  if (fx) delete node.effects;
60331
60971
  let n = node;
60332
- n = applyTextAlongPathEffect(n, textAlongPath, ctx);
60972
+ let consumedByGlyphs = false;
60973
+ if (text == null ? void 0 : text.useGlyphs) {
60974
+ if (textAlongPath) {
60975
+ const pathNode = typeof textAlongPath.href === "string" ? ctx.idMap.get(textAlongPath.href) : void 0;
60976
+ const pathD = pathNode && typeof pathNode.d === "string" ? pathNode.d : void 0;
60977
+ const rawTL = textAlongPath.textLength;
60978
+ const textLength = typeof rawTL === "number" ? rawTL : rawTL && typeof rawTL === "object" ? typeof rawTL.value === "number" ? rawTL.value : Array.isArray(rawTL.keyframes) && rawTL.keyframes.length ? Number((_a = rawTL.keyframes[0]) == null ? void 0 : _a.value) : void 0 : void 0;
60979
+ const glyphed = applyTextGlyphsAlongPath(n, ctx, pathD, textAlongPath.startOffset, textLength);
60980
+ if (glyphed) {
60981
+ n = glyphed;
60982
+ consumedByGlyphs = true;
60983
+ }
60984
+ } else {
60985
+ n = applyTextGlyphsEffect(n, text, ctx);
60986
+ consumedByGlyphs = true;
60987
+ }
60988
+ }
60989
+ if (!consumedByGlyphs) n = applyTextAlongPathEffect(n, textAlongPath, ctx);
60333
60990
  n = applyFillGradientEffect(n, fillGradient, ctx);
60334
60991
  n = applyStrokeGradientEffect(n, strokeGradient, ctx);
60335
60992
  n = applyTrimPathEffect(n, trimPath, isCombinedShape, ctx);
60336
60993
  n = applyRepeaterEffect(n, repeater, ctx);
60337
60994
  n = applyMaskedByEffect(n, maskedBy, transformation, ctx);
60338
60995
  if (innerIdForContentRef) {
60996
+ applyRefHref(n, cloneFx, ctx);
60339
60997
  n = splitForContentRef(n, transformation, originalId, innerIdForContentRef, ctx);
60340
60998
  } else {
60341
- n = applyRefAndTransformationEffect(n, ref3, transformation, ctx);
60999
+ n = applyRefAndTransformationEffect(n, cloneFx, transformation, ctx);
60342
61000
  }
60343
- if (retime) node.effects = { retime };
61001
+ if (cloneFx == null ? void 0 : cloneFx.retime) node.effects = { clone: { retime: cloneFx.retime } };
60344
61002
  if (originalId) ctx.idMap.set(originalId, n);
60345
61003
  return n;
60346
61004
  }
@@ -60355,13 +61013,30 @@ ${codeFrame}` : message);
60355
61013
  if (animatedIds.size === 0) return root;
60356
61014
  let idCounter = 0;
60357
61015
  const genId3 = () => "_lw_use_mat_" + ++idCounter;
61016
+ const rootViewport = readRootViewport(root);
60358
61017
  const defsCollector = [];
60359
- const walked = walkAndMaterialise2(root, idMap, animatedIds, genId3, defsCollector);
61018
+ const walked = walkAndMaterialise2(root, idMap, animatedIds, genId3, defsCollector, rootViewport);
60360
61019
  if (defsCollector.length === 0) return walked;
60361
61020
  const defsNode = { type: "defs", children: defsCollector };
60362
61021
  const newChildren = [...(_a = walked.children) != null ? _a : [], defsNode];
60363
61022
  return __spreadProps(__spreadValues({}, walked), { children: newChildren });
60364
61023
  }
61024
+ function readRootViewport(root) {
61025
+ const vb = parseViewBox(root.viewBox);
61026
+ if (vb) return [vb[2], vb[3]];
61027
+ const w = numericAttr(root.width);
61028
+ const h3 = numericAttr(root.height);
61029
+ if (w !== void 0 && h3 !== void 0) return [w, h3];
61030
+ return [1, 1];
61031
+ }
61032
+ function numericAttr(v) {
61033
+ if (typeof v === "number") return v;
61034
+ if (typeof v === "string") {
61035
+ const n = parseFloat(v);
61036
+ return Number.isFinite(n) ? n : void 0;
61037
+ }
61038
+ return void 0;
61039
+ }
60365
61040
  function buildIdMap(root) {
60366
61041
  const map = /* @__PURE__ */ new Map();
60367
61042
  const visit = (n) => {
@@ -60413,16 +61088,22 @@ ${codeFrame}` : message);
60413
61088
  if (typeof href !== "string") return void 0;
60414
61089
  return href.startsWith("#") ? href.slice(1) : href;
60415
61090
  }
60416
- function materialiseOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector) {
61091
+ function materialiseOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector, rootViewport) {
61092
+ var _a, _b, _c, _d;
60417
61093
  const clone2 = deepClonePxNode(target);
60418
61094
  regenerateIdsAndRewriteRefs(clone2, genId3);
60419
- const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector) : clone2;
60420
- const materialisedClone = walkAndMaterialise2(rewrittenClone, idMap, animatedIds, genId3, defsCollector);
61095
+ const symbolViewBox = clone2.type === "symbol" ? parseViewBox(clone2.viewBox) : void 0;
61096
+ const useW = (_b = (_a = numericAttr(useNode.width)) != null ? _a : symbolViewBox == null ? void 0 : symbolViewBox[2]) != null ? _b : rootViewport[0];
61097
+ const useH = (_d = (_c = numericAttr(useNode.height)) != null ? _c : symbolViewBox == null ? void 0 : symbolViewBox[3]) != null ? _d : rootViewport[1];
61098
+ const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector, useW, useH) : clone2;
61099
+ const materialisedClone = walkAndMaterialise2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
60421
61100
  const newNode = __spreadProps(__spreadValues({}, useNode), { type: "g", children: [materialisedClone] });
60422
61101
  delete newNode.href;
61102
+ delete newNode.width;
61103
+ delete newNode.height;
60423
61104
  return applyUseOffsetToG(newNode);
60424
61105
  }
60425
- function rewriteSymbolRootToGroup(symbolNode, genId3, defsCollector) {
61106
+ function rewriteSymbolRootToGroup(symbolNode, genId3, defsCollector, useW, useH) {
60426
61107
  const viewBox = parseViewBox(symbolNode.viewBox);
60427
61108
  const g = __spreadProps(__spreadValues({}, symbolNode), { type: "g" });
60428
61109
  delete g.viewBox;
@@ -60431,9 +61112,14 @@ ${codeFrame}` : message);
60431
61112
  delete g.height;
60432
61113
  if (!viewBox) return g;
60433
61114
  const [vbX, vbY, vbW, vbH] = viewBox;
60434
- if (vbX !== 0 || vbY !== 0) {
60435
- g.transform = "translate(" + -vbX + "," + -vbY + ")";
60436
- }
61115
+ const scale = vbW > 0 && vbH > 0 ? Math.min(useW / vbW, useH / vbH) : 1;
61116
+ const xOff = (useW - vbW * scale) / 2;
61117
+ const yOff = (useH - vbH * scale) / 2;
61118
+ const parts = [];
61119
+ if (xOff !== 0 || yOff !== 0) parts.push("translate(" + xOff + "," + yOff + ")");
61120
+ if (scale !== 1) parts.push("scale(" + scale + ")");
61121
+ if (vbX !== 0 || vbY !== 0) parts.push("translate(" + -vbX + "," + -vbY + ")");
61122
+ if (parts.length) g.transform = parts.join("");
60437
61123
  const clipId = genId3();
60438
61124
  defsCollector.push({
60439
61125
  type: "clipPath",
@@ -60449,18 +61135,18 @@ ${codeFrame}` : message);
60449
61135
  if (parts.length < 4 || parts.some((n) => !Number.isFinite(n))) return void 0;
60450
61136
  return [parts[0], parts[1], parts[2], parts[3]];
60451
61137
  }
60452
- function walkAndMaterialise2(node, idMap, animatedIds, genId3, defsCollector) {
61138
+ function walkAndMaterialise2(node, idMap, animatedIds, genId3, defsCollector, rootViewport) {
60453
61139
  if (node.type === "use" && typeof node.href === "string") {
60454
61140
  const targetId = stripHash2(node.href);
60455
61141
  if (targetId && animatedIds.has(targetId)) {
60456
61142
  const target = idMap.get(targetId);
60457
- if (target) return materialiseOneUse(node, target, idMap, animatedIds, genId3, defsCollector);
61143
+ if (target) return materialiseOneUse(node, target, idMap, animatedIds, genId3, defsCollector, rootViewport);
60458
61144
  }
60459
61145
  }
60460
61146
  if (!node.children) return node;
60461
61147
  let changed = false;
60462
61148
  const newChildren = node.children.map((ch) => {
60463
- const m = walkAndMaterialise2(ch, idMap, animatedIds, genId3, defsCollector);
61149
+ const m = walkAndMaterialise2(ch, idMap, animatedIds, genId3, defsCollector, rootViewport);
60464
61150
  if (m !== ch) changed = true;
60465
61151
  return m;
60466
61152
  });
@@ -60474,6 +61160,36 @@ ${codeFrame}` : message);
60474
61160
  if (engine === PxAnimatorEngine.webapi) {
60475
61161
  root = materialiseMotionPathsInTree(root, opts == null ? void 0 : opts.motionPath);
60476
61162
  root = materialiseAnimatedUseInstances(root);
61163
+ root = pruneUnreferencedDefs(root);
61164
+ }
61165
+ return root;
61166
+ }
61167
+ function pruneUnreferencedDefs(root) {
61168
+ const stripHash3 = (h3) => h3.startsWith("#") ? h3.slice(1) : h3;
61169
+ const walk = (n, fn) => {
61170
+ var _a;
61171
+ fn(n);
61172
+ (_a = n.children) == null ? void 0 : _a.forEach((c) => walk(c, fn));
61173
+ };
61174
+ let changed = true;
61175
+ while (changed) {
61176
+ changed = false;
61177
+ const referenced = /* @__PURE__ */ new Set();
61178
+ walk(root, (n) => {
61179
+ if (n.type === "use" && typeof n.href === "string") referenced.add(stripHash3(n.href));
61180
+ });
61181
+ walk(root, (n) => {
61182
+ if (!n.children) return;
61183
+ let kept = n.children;
61184
+ if (n.type === "defs") {
61185
+ kept = kept.filter((c) => !((c.type === "g" || c.type === "symbol") && typeof c.id === "string" && !referenced.has(c.id)));
61186
+ }
61187
+ kept = kept.filter((c) => !(c.type === "defs" && (!c.children || c.children.length === 0)));
61188
+ if (kept.length !== n.children.length) {
61189
+ n.children = kept;
61190
+ changed = true;
61191
+ }
61192
+ });
60477
61193
  }
60478
61194
  return root;
60479
61195
  }
@@ -60504,6 +61220,13 @@ ${codeFrame}` : message);
60504
61220
  ]);
60505
61221
  var IMAGE_REF_ATTRS_LOWER = /* @__PURE__ */ new Set(["href", "xlink:href", "src"]);
60506
61222
  var DATA_RASTER_IMAGE_RE = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/i;
61223
+ var DATA_SVG_IMAGE_RE = /^data:image\/svg\+xml(?:;[^,]*)?,/i;
61224
+ var DATA_IMAGE_BASE64_PAYLOAD_RE = /^data:image\/[^;,]*;base64,([A-Za-z0-9+/]{8})/i;
61225
+ var BASE64_RASTER_MAGICS = ["iVBORw0K", "/9j/", "R0lGOD", "UklGR", "Qk"];
61226
+ function isContentSniffedRasterImage(str2) {
61227
+ const m = DATA_IMAGE_BASE64_PAYLOAD_RE.exec(str2);
61228
+ return !!m && BASE64_RASTER_MAGICS.some((magic) => m[1].startsWith(magic));
61229
+ }
60507
61230
  function isDangerousAttrName(nameLower) {
60508
61231
  if (nameLower.startsWith("on")) return true;
60509
61232
  return false;
@@ -60515,19 +61238,19 @@ ${codeFrame}` : message);
60515
61238
  return void 0;
60516
61239
  }
60517
61240
  if (nameLower === "fill" || nameLower === "stroke" || nameLower === "stopcolor") {
60518
- const str = String(value);
60519
- if (str.includes("url(") && !/^url\(#[^)]+\)$/.test(str)) {
61241
+ const str2 = String(value);
61242
+ if (str2.includes("url(") && !/^url\(#[^)]+\)$/.test(str2)) {
60520
61243
  console.warn('Attribute "' + nameLower + '" blocked: url() must be internal url(#id), got:', value);
60521
61244
  return void 0;
60522
61245
  }
60523
61246
  return value;
60524
61247
  }
60525
61248
  if (URL_VALUE_ATTRS_LOWER.has(nameLower)) {
60526
- const str = String(value);
60527
- if (str.startsWith("#")) return value;
60528
- if (/^url\(#[^)]+\)$/.test(str)) return value;
60529
- if (IMAGE_REF_ATTRS_LOWER.has(nameLower) && DATA_RASTER_IMAGE_RE.test(str)) return value;
60530
- console.warn('Attribute "' + nameLower + '" blocked: must be #id, url(#id), or base64 raster data: URI, got:', value);
61249
+ const str2 = String(value);
61250
+ if (str2.startsWith("#")) return value;
61251
+ if (/^url\(#[^)]+\)$/.test(str2)) return value;
61252
+ if (IMAGE_REF_ATTRS_LOWER.has(nameLower) && (DATA_RASTER_IMAGE_RE.test(str2) || DATA_SVG_IMAGE_RE.test(str2) || isContentSniffedRasterImage(str2))) return value;
61253
+ console.warn('Attribute "' + nameLower + '" blocked: must be #id, url(#id), or data:image/\u2026 URI, got:', value);
60531
61254
  return void 0;
60532
61255
  }
60533
61256
  return value;
@@ -60556,7 +61279,7 @@ ${codeFrame}` : message);
60556
61279
  if (textContent) element.textContent = textContent;
60557
61280
  return element;
60558
61281
  }
60559
- function resolveStyle(style, defs) {
61282
+ function resolveStyle2(style, defs) {
60560
61283
  var _a;
60561
61284
  if (!style) return void 0;
60562
61285
  if (typeof style === "string") {
@@ -60592,7 +61315,7 @@ ${codeFrame}` : message);
60592
61315
  if (!node) return null;
60593
61316
  const _a = node, { type, children, style } = _a, props = __objRest(_a, ["type", "children", "style"]);
60594
61317
  const nodeDefs = getDefs(node) || defs;
60595
- const resolvedStyle = resolveStyle(style, nodeDefs);
61318
+ const resolvedStyle = resolveStyle2(style, nodeDefs);
60596
61319
  let childElements;
60597
61320
  if (children) {
60598
61321
  for (const ch of children) {