@esotericsoftware/spine-core 4.1.15 → 4.1.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.
Files changed (67) hide show
  1. package/dist/Animation.d.ts +7 -7
  2. package/dist/Animation.js +8 -16
  3. package/dist/AnimationState.d.ts +18 -17
  4. package/dist/AnimationState.js +33 -26
  5. package/dist/AnimationStateData.js +1 -3
  6. package/dist/AssetManagerBase.js +10 -10
  7. package/dist/AtlasAttachmentLoader.js +7 -7
  8. package/dist/Bone.d.ts +2 -2
  9. package/dist/Bone.js +1 -5
  10. package/dist/BoneData.d.ts +2 -2
  11. package/dist/BoneData.js +1 -3
  12. package/dist/Event.d.ts +1 -1
  13. package/dist/Event.js +1 -2
  14. package/dist/EventData.d.ts +2 -2
  15. package/dist/EventData.js +1 -2
  16. package/dist/IkConstraint.js +15 -10
  17. package/dist/IkConstraintData.d.ts +3 -1
  18. package/dist/IkConstraintData.js +9 -2
  19. package/dist/PathConstraint.js +13 -12
  20. package/dist/PathConstraintData.d.ts +3 -1
  21. package/dist/PathConstraintData.js +12 -5
  22. package/dist/Skeleton.d.ts +9 -9
  23. package/dist/Skeleton.js +9 -18
  24. package/dist/SkeletonBinary.d.ts +2 -2
  25. package/dist/SkeletonBinary.js +55 -15
  26. package/dist/SkeletonBounds.d.ts +3 -3
  27. package/dist/SkeletonClipping.js +5 -3
  28. package/dist/SkeletonData.d.ts +14 -14
  29. package/dist/SkeletonData.js +1 -1
  30. package/dist/SkeletonJson.d.ts +2 -2
  31. package/dist/SkeletonJson.js +96 -23
  32. package/dist/Skin.d.ts +2 -2
  33. package/dist/Skin.js +3 -5
  34. package/dist/Slot.d.ts +4 -4
  35. package/dist/Slot.js +4 -8
  36. package/dist/SlotData.d.ts +2 -2
  37. package/dist/SlotData.js +2 -6
  38. package/dist/TextureAtlas.d.ts +6 -4
  39. package/dist/TextureAtlas.js +29 -33
  40. package/dist/TransformConstraint.js +11 -10
  41. package/dist/TransformConstraintData.d.ts +3 -1
  42. package/dist/TransformConstraintData.js +9 -2
  43. package/dist/Utils.d.ts +2 -2
  44. package/dist/Utils.js +1 -1
  45. package/dist/attachments/Attachment.d.ts +1 -1
  46. package/dist/attachments/Attachment.js +2 -4
  47. package/dist/attachments/AttachmentLoader.d.ts +2 -2
  48. package/dist/attachments/ClippingAttachment.d.ts +1 -1
  49. package/dist/attachments/ClippingAttachment.js +1 -1
  50. package/dist/attachments/HasTextureRegion.d.ts +2 -2
  51. package/dist/attachments/MeshAttachment.d.ts +4 -4
  52. package/dist/attachments/MeshAttachment.js +11 -12
  53. package/dist/attachments/PathAttachment.js +2 -2
  54. package/dist/attachments/RegionAttachment.d.ts +3 -3
  55. package/dist/attachments/RegionAttachment.js +6 -6
  56. package/dist/iife/spine-core.js +355 -252
  57. package/dist/iife/spine-core.js.map +3 -3
  58. package/dist/iife/spine-core.min.js +2 -2
  59. package/dist/index.d.ts +0 -3
  60. package/dist/index.js +1 -4
  61. package/package.json +1 -1
  62. package/dist/VertexEffect.d.ts +0 -35
  63. package/dist/VertexEffect.js +0 -30
  64. package/dist/vertexeffects/JitterEffect.d.ts +0 -39
  65. package/dist/vertexeffects/JitterEffect.js +0 -46
  66. package/dist/vertexeffects/SwirlEffect.d.ts +0 -44
  67. package/dist/vertexeffects/SwirlEffect.js +0 -61
@@ -50,7 +50,6 @@ var spine = (() => {
50
50
  IkConstraintTimeline: () => IkConstraintTimeline,
51
51
  IntSet: () => IntSet,
52
52
  Interpolation: () => Interpolation,
53
- JitterEffect: () => JitterEffect,
54
53
  MathUtils: () => MathUtils,
55
54
  MeshAttachment: () => MeshAttachment,
56
55
  MixBlend: () => MixBlend,
@@ -94,7 +93,6 @@ var spine = (() => {
94
93
  SlotData: () => SlotData,
95
94
  SpacingMode: () => SpacingMode,
96
95
  StringSet: () => StringSet,
97
- SwirlEffect: () => SwirlEffect,
98
96
  Texture: () => Texture,
99
97
  TextureAtlas: () => TextureAtlas,
100
98
  TextureAtlasPage: () => TextureAtlasPage,
@@ -511,7 +509,7 @@ var spine = (() => {
511
509
  super(name);
512
510
  this.id = _VertexAttachment.nextID++;
513
511
  this.bones = null;
514
- this.vertices = null;
512
+ this.vertices = [];
515
513
  this.worldVerticesLength = 0;
516
514
  this.timelineAttahment = this;
517
515
  }
@@ -582,8 +580,7 @@ var spine = (() => {
582
580
  if (this.vertices) {
583
581
  attachment.vertices = Utils.newFloatArray(this.vertices.length);
584
582
  Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
585
- } else
586
- attachment.vertices = null;
583
+ }
587
584
  attachment.worldVerticesLength = this.worldVerticesLength;
588
585
  attachment.timelineAttahment = this.timelineAttahment;
589
586
  }
@@ -657,8 +654,8 @@ var spine = (() => {
657
654
  // spine-core/src/Animation.ts
658
655
  var Animation = class {
659
656
  constructor(name, timelines, duration) {
660
- this.timelines = null;
661
- this.timelineIds = null;
657
+ this.timelines = [];
658
+ this.timelineIds = new StringSet();
662
659
  if (!name)
663
660
  throw new Error("name cannot be null.");
664
661
  this.name = name;
@@ -669,7 +666,7 @@ var spine = (() => {
669
666
  if (!timelines)
670
667
  throw new Error("timelines cannot be null.");
671
668
  this.timelines = timelines;
672
- this.timelineIds = new StringSet();
669
+ this.timelineIds.clear();
673
670
  for (var i = 0; i < timelines.length; i++)
674
671
  this.timelineIds.addAll(timelines[i].getPropertyIds());
675
672
  }
@@ -728,8 +725,6 @@ var spine = (() => {
728
725
  };
729
726
  var Timeline = class {
730
727
  constructor(frameCount, propertyIds) {
731
- this.propertyIds = null;
732
- this.frames = null;
733
728
  this.propertyIds = propertyIds;
734
729
  this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
735
730
  }
@@ -763,7 +758,6 @@ var spine = (() => {
763
758
  var CurveTimeline = class extends Timeline {
764
759
  constructor(frameCount, bezierCount, propertyIds) {
765
760
  super(frameCount, propertyIds);
766
- this.curves = null;
767
761
  this.curves = Utils.newFloatArray(frameCount + bezierCount * 18);
768
762
  this.curves[frameCount - 1] = 1;
769
763
  }
@@ -1823,8 +1817,6 @@ var spine = (() => {
1823
1817
  Property.deform + "|" + slotIndex + "|" + attachment.id
1824
1818
  ]);
1825
1819
  this.slotIndex = 0;
1826
- this.attachment = null;
1827
- this.vertices = null;
1828
1820
  this.slotIndex = slotIndex;
1829
1821
  this.attachment = attachment;
1830
1822
  this.vertices = new Array(frameCount);
@@ -1887,6 +1879,8 @@ var spine = (() => {
1887
1879
  if (!slot.bone.active)
1888
1880
  return;
1889
1881
  let slotAttachment = slot.getAttachment();
1882
+ if (!slotAttachment)
1883
+ return;
1890
1884
  if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttahment != this.attachment)
1891
1885
  return;
1892
1886
  let deform = slot.deform;
@@ -2041,7 +2035,6 @@ var spine = (() => {
2041
2035
  var _EventTimeline = class extends Timeline {
2042
2036
  constructor(frameCount) {
2043
2037
  super(frameCount, _EventTimeline.propertyIds);
2044
- this.events = null;
2045
2038
  this.events = new Array(frameCount);
2046
2039
  }
2047
2040
  getFrameCount() {
@@ -2084,7 +2077,6 @@ var spine = (() => {
2084
2077
  var _DrawOrderTimeline = class extends Timeline {
2085
2078
  constructor(frameCount) {
2086
2079
  super(frameCount, _DrawOrderTimeline.propertyIds);
2087
- this.drawOrders = null;
2088
2080
  this.drawOrders = new Array(frameCount);
2089
2081
  }
2090
2082
  getFrameCount() {
@@ -2105,7 +2097,8 @@ var spine = (() => {
2105
2097
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2106
2098
  return;
2107
2099
  }
2108
- let drawOrderToSetupIndex = this.drawOrders[Timeline.search1(this.frames, time)];
2100
+ let idx = Timeline.search1(this.frames, time);
2101
+ let drawOrderToSetupIndex = this.drawOrders[idx];
2109
2102
  if (!drawOrderToSetupIndex)
2110
2103
  Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
2111
2104
  else {
@@ -2521,9 +2514,8 @@ var spine = (() => {
2521
2514
  SequenceTimeline.DELAY = 2;
2522
2515
 
2523
2516
  // spine-core/src/AnimationState.ts
2524
- var AnimationState = class {
2517
+ var _AnimationState = class {
2525
2518
  constructor(data) {
2526
- this.data = null;
2527
2519
  this.tracks = new Array();
2528
2520
  this.timeScale = 1;
2529
2521
  this.unkeyedState = 0;
@@ -2536,9 +2528,7 @@ var spine = (() => {
2536
2528
  this.data = data;
2537
2529
  }
2538
2530
  static emptyAnimation() {
2539
- if (!_emptyAnimation)
2540
- _emptyAnimation = new Animation("<empty>", [], 0);
2541
- return _emptyAnimation;
2531
+ return _AnimationState._emptyAnimation;
2542
2532
  }
2543
2533
  update(delta) {
2544
2534
  delta *= this.timeScale;
@@ -2971,13 +2961,13 @@ var spine = (() => {
2971
2961
  return entry;
2972
2962
  }
2973
2963
  setEmptyAnimation(trackIndex, mixDuration = 0) {
2974
- let entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation(), false);
2964
+ let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
2975
2965
  entry.mixDuration = mixDuration;
2976
2966
  entry.trackEnd = mixDuration;
2977
2967
  return entry;
2978
2968
  }
2979
2969
  addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
2980
- let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay);
2970
+ let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
2981
2971
  if (delay <= 0)
2982
2972
  entry.delay += entry.mixDuration - mixDuration;
2983
2973
  entry.mixDuration = mixDuration;
@@ -3116,6 +3106,8 @@ var spine = (() => {
3116
3106
  this.queue.clear();
3117
3107
  }
3118
3108
  };
3109
+ var AnimationState = _AnimationState;
3110
+ AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
3119
3111
  var TrackEntry = class {
3120
3112
  constructor() {
3121
3113
  this.animation = null;
@@ -3197,7 +3189,6 @@ var spine = (() => {
3197
3189
  constructor(animState) {
3198
3190
  this.objects = [];
3199
3191
  this.drainDisabled = false;
3200
- this.animState = null;
3201
3192
  this.animState = animState;
3202
3193
  }
3203
3194
  start(entry) {
@@ -3240,45 +3231,57 @@ var spine = (() => {
3240
3231
  case EventType.start:
3241
3232
  if (entry.listener && entry.listener.start)
3242
3233
  entry.listener.start(entry);
3243
- for (let ii = 0; ii < listeners.length; ii++)
3244
- if (listeners[ii].start)
3245
- listeners[ii].start(entry);
3234
+ for (let ii = 0; ii < listeners.length; ii++) {
3235
+ let listener = listeners[ii];
3236
+ if (listener.start)
3237
+ listener.start(entry);
3238
+ }
3246
3239
  break;
3247
3240
  case EventType.interrupt:
3248
3241
  if (entry.listener && entry.listener.interrupt)
3249
3242
  entry.listener.interrupt(entry);
3250
- for (let ii = 0; ii < listeners.length; ii++)
3251
- if (listeners[ii].interrupt)
3252
- listeners[ii].interrupt(entry);
3243
+ for (let ii = 0; ii < listeners.length; ii++) {
3244
+ let listener = listeners[ii];
3245
+ if (listener.interrupt)
3246
+ listener.interrupt(entry);
3247
+ }
3253
3248
  break;
3254
3249
  case EventType.end:
3255
3250
  if (entry.listener && entry.listener.end)
3256
3251
  entry.listener.end(entry);
3257
- for (let ii = 0; ii < listeners.length; ii++)
3258
- if (listeners[ii].end)
3259
- listeners[ii].end(entry);
3252
+ for (let ii = 0; ii < listeners.length; ii++) {
3253
+ let listener = listeners[ii];
3254
+ if (listener.end)
3255
+ listener.end(entry);
3256
+ }
3260
3257
  case EventType.dispose:
3261
3258
  if (entry.listener && entry.listener.dispose)
3262
3259
  entry.listener.dispose(entry);
3263
- for (let ii = 0; ii < listeners.length; ii++)
3264
- if (listeners[ii].dispose)
3265
- listeners[ii].dispose(entry);
3260
+ for (let ii = 0; ii < listeners.length; ii++) {
3261
+ let listener = listeners[ii];
3262
+ if (listener.dispose)
3263
+ listener.dispose(entry);
3264
+ }
3266
3265
  this.animState.trackEntryPool.free(entry);
3267
3266
  break;
3268
3267
  case EventType.complete:
3269
3268
  if (entry.listener && entry.listener.complete)
3270
3269
  entry.listener.complete(entry);
3271
- for (let ii = 0; ii < listeners.length; ii++)
3272
- if (listeners[ii].complete)
3273
- listeners[ii].complete(entry);
3270
+ for (let ii = 0; ii < listeners.length; ii++) {
3271
+ let listener = listeners[ii];
3272
+ if (listener.complete)
3273
+ listener.complete(entry);
3274
+ }
3274
3275
  break;
3275
3276
  case EventType.event:
3276
3277
  let event = objects[i++ + 2];
3277
3278
  if (entry.listener && entry.listener.event)
3278
3279
  entry.listener.event(entry, event);
3279
- for (let ii = 0; ii < listeners.length; ii++)
3280
- if (listeners[ii].event)
3281
- listeners[ii].event(entry, event);
3280
+ for (let ii = 0; ii < listeners.length; ii++) {
3281
+ let listener = listeners[ii];
3282
+ if (listener.event)
3283
+ listener.event(entry, event);
3284
+ }
3282
3285
  break;
3283
3286
  }
3284
3287
  }
@@ -3319,12 +3322,10 @@ var spine = (() => {
3319
3322
  var HOLD_MIX = 4;
3320
3323
  var SETUP = 1;
3321
3324
  var CURRENT = 2;
3322
- var _emptyAnimation = null;
3323
3325
 
3324
3326
  // spine-core/src/AnimationStateData.ts
3325
3327
  var AnimationStateData = class {
3326
3328
  constructor(skeletonData) {
3327
- this.skeletonData = null;
3328
3329
  this.animationToMixTime = {};
3329
3330
  this.defaultMix = 0;
3330
3331
  if (!skeletonData)
@@ -3441,65 +3442,63 @@ var spine = (() => {
3441
3442
  this.regions = new Array();
3442
3443
  let reader = new TextureAtlasReader(atlasText);
3443
3444
  let entry = new Array(4);
3444
- let page = null;
3445
- let region = null;
3446
3445
  let pageFields = {};
3447
- pageFields["size"] = () => {
3448
- page.width = parseInt(entry[1]);
3449
- page.height = parseInt(entry[2]);
3446
+ pageFields["size"] = (page2) => {
3447
+ page2.width = parseInt(entry[1]);
3448
+ page2.height = parseInt(entry[2]);
3450
3449
  };
3451
3450
  pageFields["format"] = () => {
3452
3451
  };
3453
- pageFields["filter"] = () => {
3454
- page.minFilter = Utils.enumValue(TextureFilter, entry[1]);
3455
- page.magFilter = Utils.enumValue(TextureFilter, entry[2]);
3452
+ pageFields["filter"] = (page2) => {
3453
+ page2.minFilter = Utils.enumValue(TextureFilter, entry[1]);
3454
+ page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
3456
3455
  };
3457
- pageFields["repeat"] = () => {
3456
+ pageFields["repeat"] = (page2) => {
3458
3457
  if (entry[1].indexOf("x") != -1)
3459
- page.uWrap = TextureWrap.Repeat;
3458
+ page2.uWrap = TextureWrap.Repeat;
3460
3459
  if (entry[1].indexOf("y") != -1)
3461
- page.vWrap = TextureWrap.Repeat;
3460
+ page2.vWrap = TextureWrap.Repeat;
3462
3461
  };
3463
- pageFields["pma"] = () => {
3464
- page.pma = entry[1] == "true";
3462
+ pageFields["pma"] = (page2) => {
3463
+ page2.pma = entry[1] == "true";
3465
3464
  };
3466
3465
  var regionFields = {};
3467
- regionFields["xy"] = () => {
3466
+ regionFields["xy"] = (region) => {
3468
3467
  region.x = parseInt(entry[1]);
3469
3468
  region.y = parseInt(entry[2]);
3470
3469
  };
3471
- regionFields["size"] = () => {
3470
+ regionFields["size"] = (region) => {
3472
3471
  region.width = parseInt(entry[1]);
3473
3472
  region.height = parseInt(entry[2]);
3474
3473
  };
3475
- regionFields["bounds"] = () => {
3474
+ regionFields["bounds"] = (region) => {
3476
3475
  region.x = parseInt(entry[1]);
3477
3476
  region.y = parseInt(entry[2]);
3478
3477
  region.width = parseInt(entry[3]);
3479
3478
  region.height = parseInt(entry[4]);
3480
3479
  };
3481
- regionFields["offset"] = () => {
3480
+ regionFields["offset"] = (region) => {
3482
3481
  region.offsetX = parseInt(entry[1]);
3483
3482
  region.offsetY = parseInt(entry[2]);
3484
3483
  };
3485
- regionFields["orig"] = () => {
3484
+ regionFields["orig"] = (region) => {
3486
3485
  region.originalWidth = parseInt(entry[1]);
3487
3486
  region.originalHeight = parseInt(entry[2]);
3488
3487
  };
3489
- regionFields["offsets"] = () => {
3488
+ regionFields["offsets"] = (region) => {
3490
3489
  region.offsetX = parseInt(entry[1]);
3491
3490
  region.offsetY = parseInt(entry[2]);
3492
3491
  region.originalWidth = parseInt(entry[3]);
3493
3492
  region.originalHeight = parseInt(entry[4]);
3494
3493
  };
3495
- regionFields["rotate"] = () => {
3494
+ regionFields["rotate"] = (region) => {
3496
3495
  let value = entry[1];
3497
3496
  if (value == "true")
3498
3497
  region.degrees = 90;
3499
3498
  else if (value != "false")
3500
3499
  region.degrees = parseInt(value);
3501
3500
  };
3502
- regionFields["index"] = () => {
3501
+ regionFields["index"] = (region) => {
3503
3502
  region.index = parseInt(entry[1]);
3504
3503
  };
3505
3504
  let line = reader.readLine();
@@ -3512,6 +3511,7 @@ var spine = (() => {
3512
3511
  break;
3513
3512
  line = reader.readLine();
3514
3513
  }
3514
+ let page = null;
3515
3515
  let names = null;
3516
3516
  let values = null;
3517
3517
  while (true) {
@@ -3521,32 +3521,29 @@ var spine = (() => {
3521
3521
  page = null;
3522
3522
  line = reader.readLine();
3523
3523
  } else if (!page) {
3524
- page = new TextureAtlasPage();
3525
- page.name = line.trim();
3524
+ page = new TextureAtlasPage(line.trim());
3526
3525
  while (true) {
3527
3526
  if (reader.readEntry(entry, line = reader.readLine()) == 0)
3528
3527
  break;
3529
3528
  let field = pageFields[entry[0]];
3530
3529
  if (field)
3531
- field();
3530
+ field(page);
3532
3531
  }
3533
3532
  this.pages.push(page);
3534
3533
  } else {
3535
- region = new TextureAtlasRegion();
3536
- region.page = page;
3537
- region.name = line;
3534
+ let region = new TextureAtlasRegion(page, line);
3538
3535
  while (true) {
3539
3536
  let count = reader.readEntry(entry, line = reader.readLine());
3540
3537
  if (count == 0)
3541
3538
  break;
3542
3539
  let field = regionFields[entry[0]];
3543
3540
  if (field)
3544
- field();
3541
+ field(region);
3545
3542
  else {
3546
- if (!names) {
3543
+ if (!names)
3547
3544
  names = [];
3545
+ if (!values)
3548
3546
  values = [];
3549
- }
3550
3547
  names.push(entry[0]);
3551
3548
  let entryValues = [];
3552
3549
  for (let i = 0; i < count; i++)
@@ -3558,7 +3555,7 @@ var spine = (() => {
3558
3555
  region.originalWidth = region.width;
3559
3556
  region.originalHeight = region.height;
3560
3557
  }
3561
- if (names && names.length > 0) {
3558
+ if (names && names.length > 0 && values && values.length > 0) {
3562
3559
  region.names = names;
3563
3560
  region.values = values;
3564
3561
  names = null;
@@ -3590,14 +3587,14 @@ var spine = (() => {
3590
3587
  page.setTexture(assetManager.get(pathPrefix + page.name));
3591
3588
  }
3592
3589
  dispose() {
3590
+ var _a;
3593
3591
  for (let i = 0; i < this.pages.length; i++) {
3594
- this.pages[i].texture.dispose();
3592
+ (_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
3595
3593
  }
3596
3594
  }
3597
3595
  };
3598
3596
  var TextureAtlasReader = class {
3599
3597
  constructor(text) {
3600
- this.lines = null;
3601
3598
  this.index = 0;
3602
3599
  this.lines = text.split(/\r\n|\r|\n/);
3603
3600
  }
@@ -3630,8 +3627,7 @@ var spine = (() => {
3630
3627
  }
3631
3628
  };
3632
3629
  var TextureAtlasPage = class {
3633
- constructor() {
3634
- this.name = null;
3630
+ constructor(name) {
3635
3631
  this.minFilter = TextureFilter.Nearest;
3636
3632
  this.magFilter = TextureFilter.Nearest;
3637
3633
  this.uWrap = TextureWrap.ClampToEdge;
@@ -3640,6 +3636,7 @@ var spine = (() => {
3640
3636
  this.width = 0;
3641
3637
  this.height = 0;
3642
3638
  this.pma = false;
3639
+ this.name = name;
3643
3640
  }
3644
3641
  setTexture(texture) {
3645
3642
  this.texture = texture;
@@ -3648,10 +3645,8 @@ var spine = (() => {
3648
3645
  }
3649
3646
  };
3650
3647
  var TextureAtlasRegion = class extends TextureRegion {
3651
- constructor() {
3652
- super(...arguments);
3653
- this.page = null;
3654
- this.name = null;
3648
+ constructor(page, name) {
3649
+ super();
3655
3650
  this.x = 0;
3656
3651
  this.y = 0;
3657
3652
  this.offsetX = 0;
@@ -3662,28 +3657,32 @@ var spine = (() => {
3662
3657
  this.degrees = 0;
3663
3658
  this.names = null;
3664
3659
  this.values = null;
3660
+ this.page = page;
3661
+ this.name = name;
3665
3662
  }
3666
3663
  };
3667
3664
 
3668
3665
  // spine-core/src/attachments/MeshAttachment.ts
3669
3666
  var MeshAttachment = class extends VertexAttachment {
3670
- constructor(name) {
3667
+ constructor(name, path) {
3671
3668
  super(name);
3672
3669
  this.region = null;
3673
- this.path = null;
3674
- this.regionUVs = null;
3675
- this.uvs = null;
3676
- this.triangles = null;
3670
+ this.regionUVs = [];
3671
+ this.uvs = [];
3672
+ this.triangles = [];
3677
3673
  this.color = new Color(1, 1, 1, 1);
3678
3674
  this.width = 0;
3679
3675
  this.height = 0;
3680
3676
  this.hullLength = 0;
3681
- this.edges = null;
3677
+ this.edges = [];
3682
3678
  this.parentMesh = null;
3683
3679
  this.sequence = null;
3684
3680
  this.tempColor = new Color(0, 0, 0, 0);
3681
+ this.path = path;
3685
3682
  }
3686
3683
  updateRegion() {
3684
+ if (!this.region)
3685
+ throw new Error("Region not set.");
3687
3686
  let regionUVs = this.regionUVs;
3688
3687
  if (!this.uvs || this.uvs.length != regionUVs.length)
3689
3688
  this.uvs = Utils.newFloatArray(regionUVs.length);
@@ -3759,9 +3758,8 @@ var spine = (() => {
3759
3758
  copy() {
3760
3759
  if (this.parentMesh)
3761
3760
  return this.newLinkedMesh();
3762
- let copy = new MeshAttachment(this.name);
3761
+ let copy = new MeshAttachment(this.name, this.path);
3763
3762
  copy.region = this.region;
3764
- copy.path = this.path;
3765
3763
  copy.color.setFromColor(this.color);
3766
3764
  this.copyTo(copy);
3767
3765
  copy.regionUVs = new Array(this.regionUVs.length);
@@ -3786,9 +3784,8 @@ var spine = (() => {
3786
3784
  super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
3787
3785
  }
3788
3786
  newLinkedMesh() {
3789
- let copy = new MeshAttachment(this.name);
3787
+ let copy = new MeshAttachment(this.name, this.path);
3790
3788
  copy.region = this.region;
3791
- copy.path = this.path;
3792
3789
  copy.color.setFromColor(this.color);
3793
3790
  copy.timelineAttahment = this.timelineAttahment;
3794
3791
  copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
@@ -3802,7 +3799,7 @@ var spine = (() => {
3802
3799
  var PathAttachment = class extends VertexAttachment {
3803
3800
  constructor(name) {
3804
3801
  super(name);
3805
- this.lengths = null;
3802
+ this.lengths = [];
3806
3803
  this.closed = false;
3807
3804
  this.constantSpeed = false;
3808
3805
  this.color = new Color(1, 1, 1, 1);
@@ -3851,7 +3848,7 @@ var spine = (() => {
3851
3848
 
3852
3849
  // spine-core/src/attachments/RegionAttachment.ts
3853
3850
  var _RegionAttachment = class extends Attachment {
3854
- constructor(name) {
3851
+ constructor(name, path) {
3855
3852
  super(name);
3856
3853
  this.x = 0;
3857
3854
  this.y = 0;
@@ -3861,15 +3858,17 @@ var spine = (() => {
3861
3858
  this.width = 0;
3862
3859
  this.height = 0;
3863
3860
  this.color = new Color(1, 1, 1, 1);
3864
- this.path = null;
3865
3861
  this.rendererObject = null;
3866
3862
  this.region = null;
3867
3863
  this.sequence = null;
3868
3864
  this.offset = Utils.newFloatArray(8);
3869
3865
  this.uvs = Utils.newFloatArray(8);
3870
3866
  this.tempColor = new Color(1, 1, 1, 1);
3867
+ this.path = path;
3871
3868
  }
3872
3869
  updateRegion() {
3870
+ if (!this.region)
3871
+ throw new Error("Region not set.");
3873
3872
  let region = this.region;
3874
3873
  let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
3875
3874
  let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
@@ -3948,10 +3947,9 @@ var spine = (() => {
3948
3947
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
3949
3948
  }
3950
3949
  copy() {
3951
- let copy = new _RegionAttachment(this.name);
3950
+ let copy = new _RegionAttachment(this.name, this.path);
3952
3951
  copy.region = this.region;
3953
3952
  copy.rendererObject = this.rendererObject;
3954
- copy.path = this.path;
3955
3953
  copy.x = this.x;
3956
3954
  copy.y = this.y;
3957
3955
  copy.scaleX = this.scaleX;
@@ -4003,21 +4001,21 @@ var spine = (() => {
4003
4001
  // spine-core/src/AtlasAttachmentLoader.ts
4004
4002
  var AtlasAttachmentLoader = class {
4005
4003
  constructor(atlas) {
4006
- this.atlas = null;
4007
4004
  this.atlas = atlas;
4008
4005
  }
4009
4006
  loadSequence(name, basePath, sequence) {
4010
4007
  let regions = sequence.regions;
4011
4008
  for (let i = 0, n = regions.length; i < n; i++) {
4012
4009
  let path = sequence.getPath(basePath, i);
4013
- regions[i] = this.atlas.findRegion(path);
4014
- regions[i].renderObject = regions[i];
4015
- if (regions[i] == null)
4010
+ let region = this.atlas.findRegion(path);
4011
+ if (region == null)
4016
4012
  throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
4013
+ regions[i] = region;
4014
+ regions[i].renderObject = regions[i];
4017
4015
  }
4018
4016
  }
4019
4017
  newRegionAttachment(skin, name, path, sequence) {
4020
- let attachment = new RegionAttachment(name);
4018
+ let attachment = new RegionAttachment(name, path);
4021
4019
  if (sequence != null) {
4022
4020
  this.loadSequence(name, path, sequence);
4023
4021
  } else {
@@ -4030,7 +4028,7 @@ var spine = (() => {
4030
4028
  return attachment;
4031
4029
  }
4032
4030
  newMeshAttachment(skin, name, path, sequence) {
4033
- let attachment = new MeshAttachment(name);
4031
+ let attachment = new MeshAttachment(name, path);
4034
4032
  if (sequence != null) {
4035
4033
  this.loadSequence(name, path, sequence);
4036
4034
  } else {
@@ -4060,7 +4058,6 @@ var spine = (() => {
4060
4058
  var BoneData = class {
4061
4059
  constructor(index, name, parent) {
4062
4060
  this.index = 0;
4063
- this.name = null;
4064
4061
  this.parent = null;
4065
4062
  this.length = 0;
4066
4063
  this.x = 0;
@@ -4094,8 +4091,6 @@ var spine = (() => {
4094
4091
  // spine-core/src/Bone.ts
4095
4092
  var Bone = class {
4096
4093
  constructor(data, skeleton, parent) {
4097
- this.data = null;
4098
- this.skeleton = null;
4099
4094
  this.parent = null;
4100
4095
  this.children = new Array();
4101
4096
  this.x = 0;
@@ -4348,15 +4343,15 @@ var spine = (() => {
4348
4343
 
4349
4344
  // spine-core/src/AssetManagerBase.ts
4350
4345
  var AssetManagerBase = class {
4351
- constructor(textureLoader, pathPrefix = "", downloader = null) {
4352
- this.pathPrefix = null;
4346
+ constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
4347
+ this.pathPrefix = "";
4353
4348
  this.assets = {};
4354
4349
  this.errors = {};
4355
4350
  this.toLoad = 0;
4356
4351
  this.loaded = 0;
4357
4352
  this.textureLoader = textureLoader;
4358
4353
  this.pathPrefix = pathPrefix;
4359
- this.downloader = downloader || new Downloader();
4354
+ this.downloader = downloader;
4360
4355
  }
4361
4356
  start(path) {
4362
4357
  this.toLoad++;
@@ -4395,7 +4390,9 @@ var spine = (() => {
4395
4390
  setRawDataURI(path, data) {
4396
4391
  this.downloader.rawDataUris[this.pathPrefix + path] = data;
4397
4392
  }
4398
- loadBinary(path, success = null, error = null) {
4393
+ loadBinary(path, success = () => {
4394
+ }, error = () => {
4395
+ }) {
4399
4396
  path = this.start(path);
4400
4397
  this.downloader.downloadBinary(path, (data) => {
4401
4398
  this.success(success, path, data);
@@ -4403,7 +4400,9 @@ var spine = (() => {
4403
4400
  this.error(error, path, `Couldn't load binary ${path}: status ${status}, ${responseText}`);
4404
4401
  });
4405
4402
  }
4406
- loadText(path, success = null, error = null) {
4403
+ loadText(path, success = () => {
4404
+ }, error = () => {
4405
+ }) {
4407
4406
  path = this.start(path);
4408
4407
  this.downloader.downloadText(path, (data) => {
4409
4408
  this.success(success, path, data);
@@ -4411,7 +4410,9 @@ var spine = (() => {
4411
4410
  this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
4412
4411
  });
4413
4412
  }
4414
- loadJson(path, success = null, error = null) {
4413
+ loadJson(path, success = () => {
4414
+ }, error = () => {
4415
+ }) {
4415
4416
  path = this.start(path);
4416
4417
  this.downloader.downloadJson(path, (data) => {
4417
4418
  this.success(success, path, data);
@@ -4419,7 +4420,9 @@ var spine = (() => {
4419
4420
  this.error(error, path, `Couldn't load JSON ${path}: status ${status}, ${responseText}`);
4420
4421
  });
4421
4422
  }
4422
- loadTexture(path, success = null, error = null) {
4423
+ loadTexture(path, success = () => {
4424
+ }, error = () => {
4425
+ }) {
4423
4426
  path = this.start(path);
4424
4427
  let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
4425
4428
  let isWebWorker = !isBrowser;
@@ -4449,7 +4452,9 @@ var spine = (() => {
4449
4452
  image.src = path;
4450
4453
  }
4451
4454
  }
4452
- loadTextureAtlas(path, success = null, error = null, fileAlias = null) {
4455
+ loadTextureAtlas(path, success = () => {
4456
+ }, error = () => {
4457
+ }, fileAlias) {
4453
4458
  let index = path.lastIndexOf("/");
4454
4459
  let parent = index >= 0 ? path.substring(0, index + 1) : "";
4455
4460
  path = this.start(path);
@@ -4458,7 +4463,7 @@ var spine = (() => {
4458
4463
  let atlas = new TextureAtlas(atlasText);
4459
4464
  let toLoad = atlas.pages.length, abort = false;
4460
4465
  for (let page of atlas.pages) {
4461
- this.loadTexture(fileAlias == null ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4466
+ this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
4462
4467
  if (!abort) {
4463
4468
  page.setTexture(texture);
4464
4469
  if (--toLoad == 0)
@@ -4635,7 +4640,6 @@ var spine = (() => {
4635
4640
  // spine-core/src/Event.ts
4636
4641
  var Event = class {
4637
4642
  constructor(time, data) {
4638
- this.data = null;
4639
4643
  this.intValue = 0;
4640
4644
  this.floatValue = 0;
4641
4645
  this.stringValue = null;
@@ -4652,7 +4656,6 @@ var spine = (() => {
4652
4656
  // spine-core/src/EventData.ts
4653
4657
  var EventData = class {
4654
4658
  constructor(name) {
4655
- this.name = null;
4656
4659
  this.intValue = 0;
4657
4660
  this.floatValue = 0;
4658
4661
  this.stringValue = null;
@@ -4666,9 +4669,6 @@ var spine = (() => {
4666
4669
  // spine-core/src/IkConstraint.ts
4667
4670
  var IkConstraint = class {
4668
4671
  constructor(data, skeleton) {
4669
- this.data = null;
4670
- this.bones = null;
4671
- this.target = null;
4672
4672
  this.bendDirection = 0;
4673
4673
  this.compress = false;
4674
4674
  this.stretch = false;
@@ -4686,9 +4686,16 @@ var spine = (() => {
4686
4686
  this.compress = data.compress;
4687
4687
  this.stretch = data.stretch;
4688
4688
  this.bones = new Array();
4689
- for (let i = 0; i < data.bones.length; i++)
4690
- this.bones.push(skeleton.findBone(data.bones[i].name));
4691
- this.target = skeleton.findBone(data.target.name);
4689
+ for (let i = 0; i < data.bones.length; i++) {
4690
+ let bone = skeleton.findBone(data.bones[i].name);
4691
+ if (!bone)
4692
+ throw new Error(`Couldn't find bone ${data.bones[i].name}`);
4693
+ this.bones.push(bone);
4694
+ }
4695
+ let target = skeleton.findBone(data.target.name);
4696
+ if (!target)
4697
+ throw new Error(`Couldn't find bone ${data.target.name}`);
4698
+ this.target = target;
4692
4699
  }
4693
4700
  isActive() {
4694
4701
  return this.active;
@@ -4709,6 +4716,8 @@ var spine = (() => {
4709
4716
  }
4710
4717
  apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
4711
4718
  let p = bone.parent;
4719
+ if (!p)
4720
+ throw new Error("IK bone must have parent.");
4712
4721
  let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
4713
4722
  let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
4714
4723
  switch (bone.data.transformMode) {
@@ -4786,6 +4795,8 @@ var spine = (() => {
4786
4795
  cwy = c * cx + d * cy + parent.worldY;
4787
4796
  }
4788
4797
  let pp = parent.parent;
4798
+ if (!pp)
4799
+ throw new Error("IK parent must itself have a parent.");
4789
4800
  a = pp.a;
4790
4801
  b = pp.b;
4791
4802
  c = pp.c;
@@ -4907,7 +4918,7 @@ var spine = (() => {
4907
4918
  constructor(name) {
4908
4919
  super(name, 0, false);
4909
4920
  this.bones = new Array();
4910
- this.target = null;
4921
+ this._target = null;
4911
4922
  this.bendDirection = 1;
4912
4923
  this.compress = false;
4913
4924
  this.stretch = false;
@@ -4915,6 +4926,15 @@ var spine = (() => {
4915
4926
  this.mix = 1;
4916
4927
  this.softness = 0;
4917
4928
  }
4929
+ set target(boneData) {
4930
+ this._target = boneData;
4931
+ }
4932
+ get target() {
4933
+ if (!this._target)
4934
+ throw new Error("BoneData not set.");
4935
+ else
4936
+ return this._target;
4937
+ }
4918
4938
  };
4919
4939
 
4920
4940
  // spine-core/src/PathConstraintData.ts
@@ -4922,10 +4942,10 @@ var spine = (() => {
4922
4942
  constructor(name) {
4923
4943
  super(name, 0, false);
4924
4944
  this.bones = new Array();
4925
- this.target = null;
4926
- this.positionMode = null;
4927
- this.spacingMode = null;
4928
- this.rotateMode = null;
4945
+ this._target = null;
4946
+ this.positionMode = PositionMode.Fixed;
4947
+ this.spacingMode = SpacingMode.Fixed;
4948
+ this.rotateMode = RotateMode.Chain;
4929
4949
  this.offsetRotation = 0;
4930
4950
  this.position = 0;
4931
4951
  this.spacing = 0;
@@ -4933,6 +4953,15 @@ var spine = (() => {
4933
4953
  this.mixX = 0;
4934
4954
  this.mixY = 0;
4935
4955
  }
4956
+ set target(slotData) {
4957
+ this._target = slotData;
4958
+ }
4959
+ get target() {
4960
+ if (!this._target)
4961
+ throw new Error("SlotData not set.");
4962
+ else
4963
+ return this._target;
4964
+ }
4936
4965
  };
4937
4966
  var PositionMode;
4938
4967
  (function(PositionMode2) {
@@ -4956,9 +4985,6 @@ var spine = (() => {
4956
4985
  // spine-core/src/PathConstraint.ts
4957
4986
  var _PathConstraint = class {
4958
4987
  constructor(data, skeleton) {
4959
- this.data = null;
4960
- this.bones = null;
4961
- this.target = null;
4962
4988
  this.position = 0;
4963
4989
  this.spacing = 0;
4964
4990
  this.mixRotate = 0;
@@ -4977,9 +5003,16 @@ var spine = (() => {
4977
5003
  throw new Error("skeleton cannot be null.");
4978
5004
  this.data = data;
4979
5005
  this.bones = new Array();
4980
- for (let i = 0, n = data.bones.length; i < n; i++)
4981
- this.bones.push(skeleton.findBone(data.bones[i].name));
4982
- this.target = skeleton.findSlot(data.target.name);
5006
+ for (let i = 0, n = data.bones.length; i < n; i++) {
5007
+ let bone = skeleton.findBone(data.bones[i].name);
5008
+ if (!bone)
5009
+ throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
5010
+ this.bones.push(bone);
5011
+ }
5012
+ let target = skeleton.findSlot(data.target.name);
5013
+ if (!target)
5014
+ throw new Error(`Couldn't find target bone ${data.target.name}`);
5015
+ this.target = target;
4983
5016
  this.position = data.position;
4984
5017
  this.spacing = data.spacing;
4985
5018
  this.mixRotate = data.mixRotate;
@@ -5000,7 +5033,7 @@ var spine = (() => {
5000
5033
  let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
5001
5034
  let bones = this.bones;
5002
5035
  let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
5003
- let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : null;
5036
+ let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
5004
5037
  let spacing = this.spacing;
5005
5038
  switch (data.spacingMode) {
5006
5039
  case SpacingMode.Percent:
@@ -5121,7 +5154,7 @@ var spine = (() => {
5121
5154
  computeWorldPositions(path, spacesCount, tangents) {
5122
5155
  let target = this.target;
5123
5156
  let position = this.position;
5124
- let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = null;
5157
+ let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
5125
5158
  let closed2 = path.closed;
5126
5159
  let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = _PathConstraint.NONE;
5127
5160
  if (!path.constantSpeed) {
@@ -5378,12 +5411,10 @@ var spine = (() => {
5378
5411
  // spine-core/src/Slot.ts
5379
5412
  var Slot = class {
5380
5413
  constructor(data, bone) {
5381
- this.data = null;
5382
- this.bone = null;
5383
- this.color = null;
5384
5414
  this.darkColor = null;
5385
5415
  this.attachment = null;
5386
5416
  this.attachmentState = 0;
5417
+ this.sequenceIndex = -1;
5387
5418
  this.deform = new Array();
5388
5419
  if (!data)
5389
5420
  throw new Error("data cannot be null.");
@@ -5426,9 +5457,6 @@ var spine = (() => {
5426
5457
  // spine-core/src/TransformConstraint.ts
5427
5458
  var TransformConstraint = class {
5428
5459
  constructor(data, skeleton) {
5429
- this.data = null;
5430
- this.bones = null;
5431
- this.target = null;
5432
5460
  this.mixRotate = 0;
5433
5461
  this.mixX = 0;
5434
5462
  this.mixY = 0;
@@ -5449,9 +5477,16 @@ var spine = (() => {
5449
5477
  this.mixScaleY = data.mixScaleY;
5450
5478
  this.mixShearY = data.mixShearY;
5451
5479
  this.bones = new Array();
5452
- for (let i = 0; i < data.bones.length; i++)
5453
- this.bones.push(skeleton.findBone(data.bones[i].name));
5454
- this.target = skeleton.findBone(data.target.name);
5480
+ for (let i = 0; i < data.bones.length; i++) {
5481
+ let bone = skeleton.findBone(data.bones[i].name);
5482
+ if (!bone)
5483
+ throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
5484
+ this.bones.push(bone);
5485
+ }
5486
+ let target = skeleton.findBone(data.target.name);
5487
+ if (!target)
5488
+ throw new Error(`Couldn't find target bone ${data.target.name}.`);
5489
+ this.target = target;
5455
5490
  }
5456
5491
  isActive() {
5457
5492
  return this.active;
@@ -5636,16 +5671,8 @@ var spine = (() => {
5636
5671
  // spine-core/src/Skeleton.ts
5637
5672
  var Skeleton = class {
5638
5673
  constructor(data) {
5639
- this.data = null;
5640
- this.bones = null;
5641
- this.slots = null;
5642
- this.drawOrder = null;
5643
- this.ikConstraints = null;
5644
- this.transformConstraints = null;
5645
- this.pathConstraints = null;
5646
5674
  this._updateCache = new Array();
5647
5675
  this.skin = null;
5648
- this.color = null;
5649
5676
  this.scaleX = 1;
5650
5677
  this.scaleY = 1;
5651
5678
  this.x = 0;
@@ -5840,6 +5867,8 @@ var spine = (() => {
5840
5867
  }
5841
5868
  }
5842
5869
  sortBone(bone) {
5870
+ if (!bone)
5871
+ return;
5843
5872
  if (bone.sorted)
5844
5873
  return;
5845
5874
  let parent = bone.parent;
@@ -5876,6 +5905,8 @@ var spine = (() => {
5876
5905
  }
5877
5906
  updateWorldTransformWith(parent) {
5878
5907
  let rootBone = this.getRootBone();
5908
+ if (!rootBone)
5909
+ throw new Error("Root bone must not be null.");
5879
5910
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
5880
5911
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
5881
5912
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
@@ -5996,7 +6027,10 @@ var spine = (() => {
5996
6027
  this.updateCache();
5997
6028
  }
5998
6029
  getAttachmentByName(slotName, attachmentName) {
5999
- return this.getAttachment(this.data.findSlot(slotName).index, attachmentName);
6030
+ let slot = this.data.findSlot(slotName);
6031
+ if (!slot)
6032
+ throw new Error(`Can't find slot with name ${slotName}`);
6033
+ return this.getAttachment(slot.index, attachmentName);
6000
6034
  }
6001
6035
  getAttachment(slotIndex, attachmentName) {
6002
6036
  if (!attachmentName)
@@ -6222,7 +6256,7 @@ var spine = (() => {
6222
6256
 
6223
6257
  // spine-core/src/Skin.ts
6224
6258
  var SkinEntry = class {
6225
- constructor(slotIndex = 0, name = null, attachment = null) {
6259
+ constructor(slotIndex = 0, name, attachment) {
6226
6260
  this.slotIndex = slotIndex;
6227
6261
  this.name = name;
6228
6262
  this.attachment = attachment;
@@ -6230,7 +6264,6 @@ var spine = (() => {
6230
6264
  };
6231
6265
  var Skin = class {
6232
6266
  constructor(name) {
6233
- this.name = null;
6234
6267
  this.attachments = new Array();
6235
6268
  this.bones = Array();
6236
6269
  this.constraints = new Array();
@@ -6325,7 +6358,7 @@ var spine = (() => {
6325
6358
  removeAttachment(slotIndex, name) {
6326
6359
  let dictionary = this.attachments[slotIndex];
6327
6360
  if (dictionary)
6328
- dictionary[name] = null;
6361
+ delete dictionary[name];
6329
6362
  }
6330
6363
  getAttachments() {
6331
6364
  let entries = new Array();
@@ -6382,12 +6415,10 @@ var spine = (() => {
6382
6415
  var SlotData = class {
6383
6416
  constructor(index, name, boneData) {
6384
6417
  this.index = 0;
6385
- this.name = null;
6386
- this.boneData = null;
6387
6418
  this.color = new Color(1, 1, 1, 1);
6388
6419
  this.darkColor = null;
6389
6420
  this.attachmentName = null;
6390
- this.blendMode = null;
6421
+ this.blendMode = BlendMode.Normal;
6391
6422
  if (index < 0)
6392
6423
  throw new Error("index must be >= 0.");
6393
6424
  if (!name)
@@ -6412,7 +6443,7 @@ var spine = (() => {
6412
6443
  constructor(name) {
6413
6444
  super(name, 0, false);
6414
6445
  this.bones = new Array();
6415
- this.target = null;
6446
+ this._target = null;
6416
6447
  this.mixRotate = 0;
6417
6448
  this.mixX = 0;
6418
6449
  this.mixY = 0;
@@ -6428,13 +6459,21 @@ var spine = (() => {
6428
6459
  this.relative = false;
6429
6460
  this.local = false;
6430
6461
  }
6462
+ set target(boneData) {
6463
+ this._target = boneData;
6464
+ }
6465
+ get target() {
6466
+ if (!this._target)
6467
+ throw new Error("BoneData not set.");
6468
+ else
6469
+ return this._target;
6470
+ }
6431
6471
  };
6432
6472
 
6433
6473
  // spine-core/src/SkeletonBinary.ts
6434
6474
  var SkeletonBinary = class {
6435
6475
  constructor(attachmentLoader) {
6436
6476
  this.scale = 1;
6437
- this.attachmentLoader = null;
6438
6477
  this.linkedMeshes = new Array();
6439
6478
  this.attachmentLoader = attachmentLoader;
6440
6479
  }
@@ -6459,11 +6498,17 @@ var spine = (() => {
6459
6498
  }
6460
6499
  let n = 0;
6461
6500
  n = input.readInt(true);
6462
- for (let i = 0; i < n; i++)
6463
- input.strings.push(input.readString());
6501
+ for (let i = 0; i < n; i++) {
6502
+ let str = input.readString();
6503
+ if (!str)
6504
+ throw new Error("String in string table must not be null.");
6505
+ input.strings.push(str);
6506
+ }
6464
6507
  n = input.readInt(true);
6465
6508
  for (let i = 0; i < n; i++) {
6466
6509
  let name = input.readString();
6510
+ if (!name)
6511
+ throw new Error("Bone name must not be null.");
6467
6512
  let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
6468
6513
  let data = new BoneData(i, name, parent);
6469
6514
  data.rotation = input.readFloat();
@@ -6483,6 +6528,8 @@ var spine = (() => {
6483
6528
  n = input.readInt(true);
6484
6529
  for (let i = 0; i < n; i++) {
6485
6530
  let slotName = input.readString();
6531
+ if (!slotName)
6532
+ throw new Error("Slot name must not be null.");
6486
6533
  let boneData = skeletonData.bones[input.readInt(true)];
6487
6534
  let data = new SlotData(i, slotName, boneData);
6488
6535
  Color.rgba8888ToColor(data.color, input.readInt32());
@@ -6495,7 +6542,10 @@ var spine = (() => {
6495
6542
  }
6496
6543
  n = input.readInt(true);
6497
6544
  for (let i = 0, nn; i < n; i++) {
6498
- let data = new IkConstraintData(input.readString());
6545
+ let name = input.readString();
6546
+ if (!name)
6547
+ throw new Error("IK constraint data name must not be null.");
6548
+ let data = new IkConstraintData(name);
6499
6549
  data.order = input.readInt(true);
6500
6550
  data.skinRequired = input.readBoolean();
6501
6551
  nn = input.readInt(true);
@@ -6512,7 +6562,10 @@ var spine = (() => {
6512
6562
  }
6513
6563
  n = input.readInt(true);
6514
6564
  for (let i = 0, nn; i < n; i++) {
6515
- let data = new TransformConstraintData(input.readString());
6565
+ let name = input.readString();
6566
+ if (!name)
6567
+ throw new Error("Transform constraint data name must not be null.");
6568
+ let data = new TransformConstraintData(name);
6516
6569
  data.order = input.readInt(true);
6517
6570
  data.skinRequired = input.readBoolean();
6518
6571
  nn = input.readInt(true);
@@ -6537,7 +6590,10 @@ var spine = (() => {
6537
6590
  }
6538
6591
  n = input.readInt(true);
6539
6592
  for (let i = 0, nn; i < n; i++) {
6540
- let data = new PathConstraintData(input.readString());
6593
+ let name = input.readString();
6594
+ if (!name)
6595
+ throw new Error("Path constraint data name must not be null.");
6596
+ let data = new PathConstraintData(name);
6541
6597
  data.order = input.readInt(true);
6542
6598
  data.skinRequired = input.readBoolean();
6543
6599
  nn = input.readInt(true);
@@ -6567,14 +6623,24 @@ var spine = (() => {
6567
6623
  {
6568
6624
  let i = skeletonData.skins.length;
6569
6625
  Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
6570
- for (; i < n; i++)
6571
- skeletonData.skins[i] = this.readSkin(input, skeletonData, false, nonessential);
6626
+ for (; i < n; i++) {
6627
+ let skin = this.readSkin(input, skeletonData, false, nonessential);
6628
+ if (!skin)
6629
+ throw new Error("readSkin() should not have returned null.");
6630
+ skeletonData.skins[i] = skin;
6631
+ }
6572
6632
  }
6573
6633
  n = this.linkedMeshes.length;
6574
6634
  for (let i = 0; i < n; i++) {
6575
6635
  let linkedMesh = this.linkedMeshes[i];
6576
6636
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
6637
+ if (!skin)
6638
+ throw new Error("Not skin found for linked mesh.");
6639
+ if (!linkedMesh.parent)
6640
+ throw new Error("Linked mesh parent must not be null");
6577
6641
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
6642
+ if (!parent)
6643
+ throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
6578
6644
  linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
6579
6645
  linkedMesh.mesh.setParentMesh(parent);
6580
6646
  if (linkedMesh.mesh.region != null)
@@ -6583,7 +6649,10 @@ var spine = (() => {
6583
6649
  this.linkedMeshes.length = 0;
6584
6650
  n = input.readInt(true);
6585
6651
  for (let i = 0; i < n; i++) {
6586
- let data = new EventData(input.readStringRef());
6652
+ let eventName = input.readStringRef();
6653
+ if (!eventName)
6654
+ throw new Error();
6655
+ let data = new EventData(eventName);
6587
6656
  data.intValue = input.readInt(false);
6588
6657
  data.floatValue = input.readFloat();
6589
6658
  data.stringValue = input.readString();
@@ -6595,8 +6664,12 @@ var spine = (() => {
6595
6664
  skeletonData.events.push(data);
6596
6665
  }
6597
6666
  n = input.readInt(true);
6598
- for (let i = 0; i < n; i++)
6599
- skeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData));
6667
+ for (let i = 0; i < n; i++) {
6668
+ let animationName = input.readString();
6669
+ if (!animationName)
6670
+ throw new Error("Animatio name must not be null.");
6671
+ skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
6672
+ }
6600
6673
  return skeletonData;
6601
6674
  }
6602
6675
  readSkin(input, skeletonData, defaultSkin, nonessential) {
@@ -6608,7 +6681,10 @@ var spine = (() => {
6608
6681
  return null;
6609
6682
  skin = new Skin("default");
6610
6683
  } else {
6611
- skin = new Skin(input.readStringRef());
6684
+ let skinName = input.readStringRef();
6685
+ if (!skinName)
6686
+ throw new Error("Skin name must not be null.");
6687
+ skin = new Skin(skinName);
6612
6688
  skin.bones.length = input.readInt(true);
6613
6689
  for (let i = 0, n = skin.bones.length; i < n; i++)
6614
6690
  skin.bones[i] = skeletonData.bones[input.readInt(true)];
@@ -6624,6 +6700,8 @@ var spine = (() => {
6624
6700
  let slotIndex = input.readInt(true);
6625
6701
  for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
6626
6702
  let name = input.readStringRef();
6703
+ if (!name)
6704
+ throw new Error("Attachment name must not be null");
6627
6705
  let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
6628
6706
  if (attachment)
6629
6707
  skin.setAttachment(slotIndex, name, attachment);
@@ -6690,7 +6768,7 @@ var spine = (() => {
6690
6768
  let vertices = this.readVertices(input, vertexCount);
6691
6769
  let hullLength = input.readInt(true);
6692
6770
  let sequence = this.readSequence(input);
6693
- let edges = null;
6771
+ let edges = [];
6694
6772
  let width = 0, height = 0;
6695
6773
  if (nonessential) {
6696
6774
  edges = this.readShortArray(input);
@@ -7192,6 +7270,8 @@ var spine = (() => {
7192
7270
  let slotIndex = input.readInt(true);
7193
7271
  for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
7194
7272
  let attachmentName = input.readStringRef();
7273
+ if (!attachmentName)
7274
+ throw new Error("attachmentName must not be null.");
7195
7275
  let attachment = skin.getAttachment(slotIndex, attachmentName);
7196
7276
  let timelineType = input.readByte();
7197
7277
  let frameCount = input.readInt(true);
@@ -7366,7 +7446,7 @@ var spine = (() => {
7366
7446
  let chars = "";
7367
7447
  let charCount = 0;
7368
7448
  for (let i = 0; i < byteCount; ) {
7369
- let b = this.readByte();
7449
+ let b = this.readUnsignedByte();
7370
7450
  switch (b >> 4) {
7371
7451
  case 12:
7372
7452
  case 13:
@@ -7867,6 +7947,8 @@ var spine = (() => {
7867
7947
  this.clippedVertices = new Array();
7868
7948
  this.clippedTriangles = new Array();
7869
7949
  this.scratch = new Array();
7950
+ this.clipAttachment = null;
7951
+ this.clippingPolygons = null;
7870
7952
  }
7871
7953
  clipStart(slot, clip) {
7872
7954
  if (this.clipAttachment)
@@ -7906,7 +7988,7 @@ var spine = (() => {
7906
7988
  let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
7907
7989
  let clippedTriangles = this.clippedTriangles;
7908
7990
  let polygons = this.clippingPolygons;
7909
- let polygonsCount = this.clippingPolygons.length;
7991
+ let polygonsCount = polygons.length;
7910
7992
  let vertexSize = twoColor ? 12 : 8;
7911
7993
  let index = 0;
7912
7994
  clippedVertices.length = 0;
@@ -8038,7 +8120,7 @@ var spine = (() => {
8038
8120
  clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
8039
8121
  let originalOutput = output;
8040
8122
  let clipped = false;
8041
- let input = null;
8123
+ let input;
8042
8124
  if (clippingArea.length % 4 >= 2) {
8043
8125
  input = output;
8044
8126
  output = this.scratch;
@@ -8146,7 +8228,6 @@ var spine = (() => {
8146
8228
  // spine-core/src/SkeletonJson.ts
8147
8229
  var SkeletonJson = class {
8148
8230
  constructor(attachmentLoader) {
8149
- this.attachmentLoader = null;
8150
8231
  this.scale = 1;
8151
8232
  this.linkedMeshes = new Array();
8152
8233
  this.attachmentLoader = attachmentLoader;
@@ -8194,6 +8275,8 @@ var spine = (() => {
8194
8275
  for (let i = 0; i < root.slots.length; i++) {
8195
8276
  let slotMap = root.slots[i];
8196
8277
  let boneData = skeletonData.findBone(slotMap.bone);
8278
+ if (!boneData)
8279
+ throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotMap.name}`);
8197
8280
  let data = new SlotData(skeletonData.slots.length, slotMap.name, boneData);
8198
8281
  let color = getValue(slotMap, "color", null);
8199
8282
  if (color)
@@ -8212,9 +8295,17 @@ var spine = (() => {
8212
8295
  let data = new IkConstraintData(constraintMap.name);
8213
8296
  data.order = getValue(constraintMap, "order", 0);
8214
8297
  data.skinRequired = getValue(constraintMap, "skin", false);
8215
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8216
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8217
- data.target = skeletonData.findBone(constraintMap.target);
8298
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8299
+ let bone = skeletonData.findBone(constraintMap.bones[ii]);
8300
+ if (!bone)
8301
+ throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
8302
+ data.bones.push(bone);
8303
+ }
8304
+ let target = skeletonData.findBone(constraintMap.target);
8305
+ ;
8306
+ if (!target)
8307
+ throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
8308
+ data.target = target;
8218
8309
  data.mix = getValue(constraintMap, "mix", 1);
8219
8310
  data.softness = getValue(constraintMap, "softness", 0) * scale;
8220
8311
  data.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1;
@@ -8230,10 +8321,18 @@ var spine = (() => {
8230
8321
  let data = new TransformConstraintData(constraintMap.name);
8231
8322
  data.order = getValue(constraintMap, "order", 0);
8232
8323
  data.skinRequired = getValue(constraintMap, "skin", false);
8233
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8234
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8324
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8325
+ let boneName = constraintMap.bones[ii];
8326
+ let bone = skeletonData.findBone(boneName);
8327
+ if (!bone)
8328
+ throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
8329
+ data.bones.push(bone);
8330
+ }
8235
8331
  let targetName = constraintMap.target;
8236
- data.target = skeletonData.findBone(targetName);
8332
+ let target = skeletonData.findBone(targetName);
8333
+ if (!target)
8334
+ throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
8335
+ data.target = target;
8237
8336
  data.local = getValue(constraintMap, "local", false);
8238
8337
  data.relative = getValue(constraintMap, "relative", false);
8239
8338
  data.offsetRotation = getValue(constraintMap, "rotation", 0);
@@ -8257,10 +8356,18 @@ var spine = (() => {
8257
8356
  let data = new PathConstraintData(constraintMap.name);
8258
8357
  data.order = getValue(constraintMap, "order", 0);
8259
8358
  data.skinRequired = getValue(constraintMap, "skin", false);
8260
- for (let ii = 0; ii < constraintMap.bones.length; ii++)
8261
- data.bones.push(skeletonData.findBone(constraintMap.bones[ii]));
8359
+ for (let ii = 0; ii < constraintMap.bones.length; ii++) {
8360
+ let boneName = constraintMap.bones[ii];
8361
+ let bone = skeletonData.findBone(boneName);
8362
+ if (!bone)
8363
+ throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
8364
+ data.bones.push(bone);
8365
+ }
8262
8366
  let targetName = constraintMap.target;
8263
- data.target = skeletonData.findSlot(targetName);
8367
+ let target = skeletonData.findSlot(targetName);
8368
+ if (!target)
8369
+ throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
8370
+ data.target = target;
8264
8371
  data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
8265
8372
  data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
8266
8373
  data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
@@ -8282,23 +8389,45 @@ var spine = (() => {
8282
8389
  let skinMap = root.skins[i];
8283
8390
  let skin = new Skin(skinMap.name);
8284
8391
  if (skinMap.bones) {
8285
- for (let ii = 0; ii < skinMap.bones.length; ii++)
8286
- skin.bones.push(skeletonData.findBone(skinMap.bones[ii]));
8392
+ for (let ii = 0; ii < skinMap.bones.length; ii++) {
8393
+ let boneName = skinMap.bones[ii];
8394
+ let bone = skeletonData.findBone(boneName);
8395
+ if (!bone)
8396
+ throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
8397
+ skin.bones.push(bone);
8398
+ }
8287
8399
  }
8288
8400
  if (skinMap.ik) {
8289
- for (let ii = 0; ii < skinMap.ik.length; ii++)
8290
- skin.constraints.push(skeletonData.findIkConstraint(skinMap.ik[ii]));
8401
+ for (let ii = 0; ii < skinMap.ik.length; ii++) {
8402
+ let constraintName = skinMap.ik[ii];
8403
+ let constraint = skeletonData.findIkConstraint(constraintName);
8404
+ if (!constraint)
8405
+ throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
8406
+ skin.constraints.push(constraint);
8407
+ }
8291
8408
  }
8292
8409
  if (skinMap.transform) {
8293
- for (let ii = 0; ii < skinMap.transform.length; ii++)
8294
- skin.constraints.push(skeletonData.findTransformConstraint(skinMap.transform[ii]));
8410
+ for (let ii = 0; ii < skinMap.transform.length; ii++) {
8411
+ let constraintName = skinMap.transform[ii];
8412
+ let constraint = skeletonData.findTransformConstraint(constraintName);
8413
+ if (!constraint)
8414
+ throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
8415
+ skin.constraints.push(constraint);
8416
+ }
8295
8417
  }
8296
8418
  if (skinMap.path) {
8297
- for (let ii = 0; ii < skinMap.path.length; ii++)
8298
- skin.constraints.push(skeletonData.findPathConstraint(skinMap.path[ii]));
8419
+ for (let ii = 0; ii < skinMap.path.length; ii++) {
8420
+ let constraintName = skinMap.path[ii];
8421
+ let constraint = skeletonData.findPathConstraint(constraintName);
8422
+ if (!constraint)
8423
+ throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
8424
+ skin.constraints.push(constraint);
8425
+ }
8299
8426
  }
8300
8427
  for (let slotName in skinMap.attachments) {
8301
8428
  let slot = skeletonData.findSlot(slotName);
8429
+ if (!slot)
8430
+ throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
8302
8431
  let slotMap = skinMap.attachments[slotName];
8303
8432
  for (let entryName in slotMap) {
8304
8433
  let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
@@ -8314,7 +8443,11 @@ var spine = (() => {
8314
8443
  for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
8315
8444
  let linkedMesh = this.linkedMeshes[i];
8316
8445
  let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
8446
+ if (!skin)
8447
+ throw new Error(`Skin not found: ${linkedMesh.skin}`);
8317
8448
  let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
8449
+ if (!parent)
8450
+ throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
8318
8451
  linkedMesh.mesh.timelineAttahment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
8319
8452
  linkedMesh.mesh.setParentMesh(parent);
8320
8453
  if (linkedMesh.mesh.region != null)
@@ -8498,7 +8631,10 @@ var spine = (() => {
8498
8631
  if (map.slots) {
8499
8632
  for (let slotName in map.slots) {
8500
8633
  let slotMap = map.slots[slotName];
8501
- let slotIndex = skeletonData.findSlot(slotName).index;
8634
+ let slot = skeletonData.findSlot(slotName);
8635
+ if (!slot)
8636
+ throw new Error("Slot not found: " + slotName);
8637
+ let slotIndex = slot.index;
8502
8638
  for (let timelineName in slotMap) {
8503
8639
  let timelineMap = slotMap[timelineName];
8504
8640
  if (!timelineMap)
@@ -8634,7 +8770,10 @@ var spine = (() => {
8634
8770
  if (map.bones) {
8635
8771
  for (let boneName in map.bones) {
8636
8772
  let boneMap = map.bones[boneName];
8637
- let boneIndex = skeletonData.findBone(boneName).index;
8773
+ let bone = skeletonData.findBone(boneName);
8774
+ if (!bone)
8775
+ throw new Error("Bone not found: " + boneName);
8776
+ let boneIndex = bone.index;
8638
8777
  for (let timelineName in boneMap) {
8639
8778
  let timelineMap = boneMap[timelineName];
8640
8779
  let frames = timelineMap.length;
@@ -8680,6 +8819,8 @@ var spine = (() => {
8680
8819
  if (!keyMap)
8681
8820
  continue;
8682
8821
  let constraint = skeletonData.findIkConstraint(constraintName);
8822
+ if (!constraint)
8823
+ throw new Error("IK Constraint not found: " + constraintName);
8683
8824
  let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
8684
8825
  let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
8685
8826
  let time = getValue(keyMap, "time", 0);
@@ -8715,6 +8856,8 @@ var spine = (() => {
8715
8856
  if (!keyMap)
8716
8857
  continue;
8717
8858
  let constraint = skeletonData.findTransformConstraint(constraintName);
8859
+ if (!constraint)
8860
+ throw new Error("Transform constraint not found: " + constraintName);
8718
8861
  let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
8719
8862
  let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
8720
8863
  let time = getValue(keyMap, "time", 0);
@@ -8763,6 +8906,8 @@ var spine = (() => {
8763
8906
  for (let constraintName in map.path) {
8764
8907
  let constraintMap = map.path[constraintName];
8765
8908
  let constraint = skeletonData.findPathConstraint(constraintName);
8909
+ if (!constraint)
8910
+ throw new Error("Path constraint not found: " + constraintName);
8766
8911
  let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
8767
8912
  for (let timelineName in constraintMap) {
8768
8913
  let timelineMap = constraintMap[timelineName];
@@ -8814,9 +8959,14 @@ var spine = (() => {
8814
8959
  for (let attachmentsName in map.attachments) {
8815
8960
  let attachmentsMap = map.attachments[attachmentsName];
8816
8961
  let skin = skeletonData.findSkin(attachmentsName);
8962
+ if (!skin)
8963
+ throw new Error("Skin not found: " + attachmentsName);
8817
8964
  for (let slotMapName in attachmentsMap) {
8818
8965
  let slotMap = attachmentsMap[slotMapName];
8819
- let slotIndex = skeletonData.findSlot(slotMapName).index;
8966
+ let slot = skeletonData.findSlot(slotMapName);
8967
+ if (!slot)
8968
+ throw new Error("Slot not found: " + slotMapName);
8969
+ let slotIndex = slot.index;
8820
8970
  for (let attachmentMapName in slotMap) {
8821
8971
  let attachmentMap = slotMap[attachmentMapName];
8822
8972
  let attachment = skin.getAttachment(slotIndex, attachmentMapName);
@@ -8896,7 +9046,10 @@ var spine = (() => {
8896
9046
  let originalIndex = 0, unchangedIndex = 0;
8897
9047
  for (let ii = 0; ii < offsets.length; ii++) {
8898
9048
  let offsetMap = offsets[ii];
8899
- let slotIndex = skeletonData.findSlot(offsetMap.slot).index;
9049
+ let slot = skeletonData.findSlot(offsetMap.slot);
9050
+ if (!slot)
9051
+ throw new Error("Slot not found: " + slot);
9052
+ let slotIndex = slot.index;
8900
9053
  while (originalIndex != slotIndex)
8901
9054
  unchanged[unchangedIndex++] = originalIndex++;
8902
9055
  drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
@@ -8917,6 +9070,8 @@ var spine = (() => {
8917
9070
  for (let i = 0; i < map.events.length; i++, frame++) {
8918
9071
  let eventMap = map.events[i];
8919
9072
  let eventData = skeletonData.findEvent(eventMap.name);
9073
+ if (!eventData)
9074
+ throw new Error("Event not found: " + eventMap.name);
8920
9075
  let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
8921
9076
  event.intValue = getValue(eventMap, "int", eventData.intValue);
8922
9077
  event.floatValue = getValue(eventMap, "float", eventData.floatValue);
@@ -9019,58 +9174,6 @@ var spine = (() => {
9019
9174
  }(new Float32Array(1));
9020
9175
  }
9021
9176
  })();
9022
-
9023
- // spine-core/src/vertexeffects/JitterEffect.ts
9024
- var JitterEffect = class {
9025
- constructor(jitterX, jitterY) {
9026
- this.jitterX = 0;
9027
- this.jitterY = 0;
9028
- this.jitterX = jitterX;
9029
- this.jitterY = jitterY;
9030
- }
9031
- begin(skeleton) {
9032
- }
9033
- transform(position, uv, light, dark) {
9034
- position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
9035
- position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
9036
- }
9037
- end() {
9038
- }
9039
- };
9040
-
9041
- // spine-core/src/vertexeffects/SwirlEffect.ts
9042
- var _SwirlEffect = class {
9043
- constructor(radius) {
9044
- this.centerX = 0;
9045
- this.centerY = 0;
9046
- this.radius = 0;
9047
- this.angle = 0;
9048
- this.worldX = 0;
9049
- this.worldY = 0;
9050
- this.radius = radius;
9051
- }
9052
- begin(skeleton) {
9053
- this.worldX = skeleton.x + this.centerX;
9054
- this.worldY = skeleton.y + this.centerY;
9055
- }
9056
- transform(position, uv, light, dark) {
9057
- let radAngle = this.angle * MathUtils.degreesToRadians;
9058
- let x = position.x - this.worldX;
9059
- let y = position.y - this.worldY;
9060
- let dist = Math.sqrt(x * x + y * y);
9061
- if (dist < this.radius) {
9062
- let theta = _SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
9063
- let cos = Math.cos(theta);
9064
- let sin = Math.sin(theta);
9065
- position.x = cos * x - sin * y + this.worldX;
9066
- position.y = sin * x + cos * y + this.worldY;
9067
- }
9068
- }
9069
- end() {
9070
- }
9071
- };
9072
- var SwirlEffect = _SwirlEffect;
9073
- SwirlEffect.interpolation = new PowOut(2);
9074
9177
  return src_exports;
9075
9178
  })();
9076
9179
  //# sourceMappingURL=spine-core.js.map