@galacean/engine-spine 0.0.0-experimental-6d3110b4d9-20240531

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 (121) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/dist/browser.js +1 -0
  4. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Animation.js +2 -0
  5. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Animation.js.map +1 -0
  6. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AnimationState.js +2 -0
  7. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AnimationState.js.map +1 -0
  8. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AnimationStateData.js +2 -0
  9. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AnimationStateData.js.map +1 -0
  10. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AssetManagerBase.js +2 -0
  11. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AssetManagerBase.js.map +1 -0
  12. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AtlasAttachmentLoader.js +2 -0
  13. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/AtlasAttachmentLoader.js.map +1 -0
  14. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Bone.js +2 -0
  15. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Bone.js.map +1 -0
  16. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/BoneData.js +2 -0
  17. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/BoneData.js.map +1 -0
  18. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/ConstraintData.js +2 -0
  19. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/ConstraintData.js.map +1 -0
  20. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Event.js +2 -0
  21. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Event.js.map +1 -0
  22. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/EventData.js +2 -0
  23. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/EventData.js.map +1 -0
  24. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/IkConstraint.js +2 -0
  25. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/IkConstraint.js.map +1 -0
  26. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/IkConstraintData.js +2 -0
  27. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/IkConstraintData.js.map +1 -0
  28. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PathConstraint.js +2 -0
  29. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PathConstraint.js.map +1 -0
  30. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PathConstraintData.js +2 -0
  31. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PathConstraintData.js.map +1 -0
  32. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PhysicsConstraint.js +2 -0
  33. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PhysicsConstraint.js.map +1 -0
  34. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PhysicsConstraintData.js +2 -0
  35. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/PhysicsConstraintData.js.map +1 -0
  36. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Skeleton.js +2 -0
  37. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Skeleton.js.map +1 -0
  38. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonBinary.js +2 -0
  39. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonBinary.js.map +1 -0
  40. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonBounds.js +2 -0
  41. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonBounds.js.map +1 -0
  42. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonClipping.js +2 -0
  43. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonClipping.js.map +1 -0
  44. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonData.js +2 -0
  45. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonData.js.map +1 -0
  46. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonJson.js +2 -0
  47. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SkeletonJson.js.map +1 -0
  48. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Skin.js +2 -0
  49. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Skin.js.map +1 -0
  50. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Slot.js +2 -0
  51. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Slot.js.map +1 -0
  52. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SlotData.js +2 -0
  53. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/SlotData.js.map +1 -0
  54. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Texture.js +2 -0
  55. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Texture.js.map +1 -0
  56. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TextureAtlas.js +2 -0
  57. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TextureAtlas.js.map +1 -0
  58. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TransformConstraint.js +2 -0
  59. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TransformConstraint.js.map +1 -0
  60. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TransformConstraintData.js +2 -0
  61. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/TransformConstraintData.js.map +1 -0
  62. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Triangulator.js +2 -0
  63. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Triangulator.js.map +1 -0
  64. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Utils.js +2 -0
  65. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/Utils.js.map +1 -0
  66. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/Attachment.js +2 -0
  67. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/Attachment.js.map +1 -0
  68. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/BoundingBoxAttachment.js +2 -0
  69. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/BoundingBoxAttachment.js.map +1 -0
  70. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/ClippingAttachment.js +2 -0
  71. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/ClippingAttachment.js.map +1 -0
  72. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/MeshAttachment.js +2 -0
  73. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/MeshAttachment.js.map +1 -0
  74. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/PathAttachment.js +2 -0
  75. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/PathAttachment.js.map +1 -0
  76. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/PointAttachment.js +2 -0
  77. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/PointAttachment.js.map +1 -0
  78. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/RegionAttachment.js +2 -0
  79. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/RegionAttachment.js.map +1 -0
  80. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/Sequence.js +2 -0
  81. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/attachments/Sequence.js.map +1 -0
  82. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/polyfills.js +2 -0
  83. package/dist/esm/node_modules/@esotericsoftware/spine-core/dist/polyfills.js.map +1 -0
  84. package/dist/esm/node_modules/tslib/tslib.es6.js +2 -0
  85. package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -0
  86. package/dist/esm/src/SpineAnimation.js +2 -0
  87. package/dist/esm/src/SpineAnimation.js.map +1 -0
  88. package/dist/esm/src/SpineMaterial.js +2 -0
  89. package/dist/esm/src/SpineMaterial.js.map +1 -0
  90. package/dist/esm/src/core/SpineGenerator.js +2 -0
  91. package/dist/esm/src/core/SpineGenerator.js.map +1 -0
  92. package/dist/esm/src/core/SpinePrimitive.js +2 -0
  93. package/dist/esm/src/core/SpinePrimitive.js.map +1 -0
  94. package/dist/esm/src/index.js +2 -0
  95. package/dist/esm/src/index.js.map +1 -0
  96. package/dist/esm/src/loader/EditorSkeletonDataLoader.js +2 -0
  97. package/dist/esm/src/loader/EditorSkeletonDataLoader.js.map +1 -0
  98. package/dist/esm/src/loader/EditorSpineAtlasLoader.js +2 -0
  99. package/dist/esm/src/loader/EditorSpineAtlasLoader.js.map +1 -0
  100. package/dist/esm/src/loader/LoaderUtils.js +2 -0
  101. package/dist/esm/src/loader/LoaderUtils.js.map +1 -0
  102. package/dist/esm/src/loader/SpineLoader.js +2 -0
  103. package/dist/esm/src/loader/SpineLoader.js.map +1 -0
  104. package/dist/main.js +2 -0
  105. package/dist/main.js.map +1 -0
  106. package/dist/module.js +2 -0
  107. package/dist/module.js.map +1 -0
  108. package/package.json +67 -0
  109. package/types/SpineAnimation.d.ts +64 -0
  110. package/types/SpineMaterial.d.ts +6 -0
  111. package/types/core/MeshGenerator.d.ts +43 -0
  112. package/types/core/SpineGenerator.d.ts +43 -0
  113. package/types/core/SpineMesh.d.ts +11 -0
  114. package/types/core/SpinePrimitive.d.ts +23 -0
  115. package/types/index.d.ts +7 -0
  116. package/types/loader/BufferReader.d.ts +9 -0
  117. package/types/loader/EditorSkeletonDataLoader.d.ts +6 -0
  118. package/types/loader/EditorSpineAtlasLoader.d.ts +6 -0
  119. package/types/loader/LoaderUtils.d.ts +16 -0
  120. package/types/loader/SpineLoader.d.ts +21 -0
  121. package/types/types.d.ts +4 -0
package/dist/module.js ADDED
@@ -0,0 +1,2 @@
1
+ import{AssetType as t,AssetPromise as e,request as s,TextureFilterMode as r,TextureWrapMode as i,Loader as a,resourceLoader as n,MeshTopology as o,Primitive as l,VertexElement as h,VertexElementFormat as c,Buffer as d,BufferBindFlag as u,BufferUsage as f,VertexBufferBinding as m,IndexBufferBinding as g,IndexFormat as p,BlendFactor as x,BlendOperation as w,Material as b,Shader as y,CullMode as v,RenderQueueType as k,Renderer as S,ShaderMacro as I,BoundingBox as A,ignoreClone as M}from"@galacean/engine";function C(t,e,s,r){var i,a=arguments.length,n=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(n=(a<3?i(n):a>3?i(e,s,n):i(e,s))||n);return a>3&&n&&Object.defineProperty(e,s,n),n}"function"==typeof SuppressedError&&SuppressedError;class F{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class T{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class Y{r;g;b;a;static WHITE=new Y(1,1,1,1);static RED=new Y(1,0,0,1);static GREEN=new Y(0,1,0,1);static BLUE=new Y(0,0,1,1);static MAGENTA=new Y(1,0,1,1);constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new Y).setFromString(t)}}class E{static PI=3.1415927;static PI2=2*E.PI;static invPI2=1/E.PI2;static radiansToDegrees=180/E.PI;static radDeg=E.radiansToDegrees;static degreesToRadians=E.PI/180;static degRad=E.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*E.degRad)}static sinDeg(t){return Math.sin(t*E.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*E.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return E.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),i=e-t;return r<=(s-t)/i?t+Math.sqrt(r*i*(s-t)):e-Math.sqrt((1-r)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class R{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class X extends R{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class B extends X{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class P{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,r,i){for(let a=e,n=r;a<e+i;a++,n++)s[n]=t[a]}static arrayFill(t,e,s,r){for(let i=e;i<s;i++)t[i]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let i=r;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:P.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(P.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(P.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return P.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return P.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class _{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class V{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class D{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}class O{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class N{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class L{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class q extends L{static nextID=0;id=q.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,i,a){s=i+(s>>1)*a;let n=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let n=t.bone,h=n.worldX,c=n.worldY,d=n.a,u=n.b,f=n.c,m=n.d;for(let t=e,n=i;n<s;t+=2,n+=a){let e=l[t],s=l[t+1];r[n]=e*d+s*u+h,r[n+1]=e*f+s*m+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=n.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=a){let s=0,i=0,a=h[c++];for(a+=c;c<a;c++,e+=3){let t=u[h[c]],r=l[e],a=l[e+1],n=l[e+2];s+=(r*t.a+a*t.b+t.worldX)*n,i+=(r*t.c+a*t.d+t.worldY)*n}r[t]=s,r[t+1]=i}else{let t=o;for(let e=i,n=3*d,o=d<<1;e<s;e+=a){let s=0,i=0,a=h[c++];for(a+=c;c<a;c++,n+=3,o+=2){let e=u[h[c]],r=l[n]+t[o],a=l[n+1]+t[o+1],d=l[n+2];s+=(r*e.a+a*e.b+e.worldX)*d,i+=(r*e.c+a*e.d+e.worldY)*d}r[e]=s,r[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class U{static _nextID=0;id=U.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new U(this.regions.length);return P.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return U._nextID++}}var W;!function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(W||(W={}));const z=[W.hold,W.once,W.loop,W.pingpong,W.onceReverse,W.loopReverse,W.pingpongReverse];class G{name;timelines=[];timelineIds=new T;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,a,n,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,i,a,n,o)}}var $,j;!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}($||($={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(j||(j={}));const H={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class J{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}}class Z extends J{curves;constructor(t,e,s){super(t,s),this.curves=P.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=P.newFloatArray(e);P.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,i,a,n,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let f=.03*(r-2*a+o),m=.03*(i-2*n+l),g=.006*(3*(a-o)-r+h),p=.006*(3*(n-l)-i+c),x=2*f+g,w=2*m+p,b=.3*(a-r)+f+.16666667*g,y=.3*(n-i)+m+.16666667*p,v=r+b,k=i+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,b+=x,y+=w,x+=g,w+=p,v+=b,k+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let a=this.frames[e],n=this.frames[e+s];return n+(t-a)/(i[r]-a)*(i[r+1]-n)}let a=r+18;for(r+=2;r<a;r+=2)if(i[r]>=t){let e=i[r-2],s=i[r-1];return s+(t-e)/(i[r]-e)*(i[r+1]-s)}e+=this.getFrameEntries();let n=i[a-2],o=i[a-1];return o+(t-n)/(this.frames[e]-n)*(this.frames[e+s]-o)}}class K extends Z{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let r=this.curves[s>>1];switch(r){case 0:let r=e[s],i=e[s+1];return i+(t-r)/(e[s+2]-r)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case $.setup:return i;case $.first:return r+(i-r)*e}return r}let a=this.getCurveValue(t);switch(s){case $.setup:return i+a*e;case $.first:case $.replace:a+=i-r}return r+a*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case $.setup:return i;case $.first:return r+(i-r)*e}return r}let a=this.getCurveValue(t);return s==$.setup?i+(a-i)*e:r+(a-r)*e}getAbsoluteValue2(t,e,s,r,i,a){if(t<this.frames[0]){switch(s){case $.setup:return i;case $.first:return r+(i-r)*e}return r}return s==$.setup?i+(a-i)*e:r+(a-r)*e}getScaleValue(t,e,s,r,i,a){if(t<this.frames[0]){switch(s){case $.setup:return a;case $.first:return i+(a-i)*e}return i}let n=this.getCurveValue(t)*a;if(1==e)return s==$.add?i+n-a:n;if(r==j.mixOut)switch(s){case $.setup:return a+(Math.abs(n)*E.signum(a)-a)*e;case $.first:case $.replace:return i+(Math.abs(n)*E.signum(i)-i)*e}else{let t=0;switch(s){case $.setup:return t=Math.abs(a)*E.signum(n),t+(n-t)*e;case $.first:case $.replace:return t=Math.abs(i)*E.signum(n),t+(n-t)*e}}return i+(n-a)*e}}class Q extends Z{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class tt extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,a,o.rotation,o.data.rotation))}}class et extends Q{boneIndex=0;constructor(t,e,s){super(t,e,H.x+"|"+s,H.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case $.setup:return o.x=o.data.x,void(o.y=o.data.y);case $.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=J.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(a){case $.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case $.first:case $.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case $.add:o.x+=h*i,o.y+=c*i}}}class st extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,a,o.x,o.data.x))}}class rt extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,a,o.y,o.data.y))}}class it extends Q{boneIndex=0;constructor(t,e,s){super(t,e,H.scaleX+"|"+s,H.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(a){case $.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case $.first:o.scaleX+=(o.data.scaleX-o.scaleX)*i,o.scaleY+=(o.data.scaleY-o.scaleY)*i}return}let d=J.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==i)a==$.add?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(n==j.mixOut)switch(a){case $.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*E.signum(t)-t)*i,o.scaleY=e+(Math.abs(h)*E.signum(e)-e)*i;break;case $.first:case $.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*E.signum(t)-t)*i,o.scaleY=e+(Math.abs(h)*E.signum(e)-e)*i;break;case $.add:o.scaleX+=(l-o.data.scaleX)*i,o.scaleY+=(h-o.data.scaleY)*i}else switch(a){case $.setup:t=Math.abs(o.data.scaleX)*E.signum(l),e=Math.abs(o.data.scaleY)*E.signum(h),o.scaleX=t+(l-t)*i,o.scaleY=e+(h-e)*i;break;case $.first:case $.replace:t=Math.abs(o.scaleX)*E.signum(l),e=Math.abs(o.scaleY)*E.signum(h),o.scaleX=t+(l-t)*i,o.scaleY=e+(h-e)*i;break;case $.add:o.scaleX+=(l-o.data.scaleX)*i,o.scaleY+=(h-o.data.scaleY)*i}}}}class at extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,a,n,o.scaleX,o.data.scaleX))}}class nt extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,a,n,o.scaleY,o.data.scaleY))}}class ot extends Q{boneIndex=0;constructor(t,e,s){super(t,e,H.shearX+"|"+s,H.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case $.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case $.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=J.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(a){case $.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case $.first:case $.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case $.add:o.shearX+=h*i,o.shearY+=c*i}}}class lt extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,a,o.shearX,o.data.shearX))}}class ht extends K{boneIndex=0;constructor(t,e,s){super(t,e,H.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,a,o.shearY,o.data.shearY))}}class ct extends J{boneIndex=0;constructor(t,e){super(t,[H.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,a,n){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;s<l[0]?a!=$.setup&&a!=$.first||(o.inherit=o.data.inherit):o.inherit=this.frames[J.search(l,s,2)+1]}}class dt extends Z{slotIndex=0;constructor(t,e,s){super(t,e,[H.rgb+"|"+s,H.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=a}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(a){case $.setup:return void h.setFromColor(t);case $.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,f=0,m=J.search(l,s,5),g=this.curves[m/5];switch(g){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3],f=l[m+4];let e=(s-t)/(l[m+5]-t);c+=(l[m+5+1]-c)*e,d+=(l[m+5+2]-d)*e,u+=(l[m+5+3]-u)*e,f+=(l[m+5+4]-f)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3],f=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),u=this.getBezierValue(s,m,3,g+36-2),f=this.getBezierValue(s,m,4,g+54-2)}1==i?h.set(c,d,u,f):(a==$.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(f-h.a)*i))}}class ut extends Z{slotIndex=0;constructor(t,e,s){super(t,e,[H.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(a){case $.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case $.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,f=J.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3];let e=(s-t)/(l[f+4]-t);c+=(l[f+4+1]-c)*e,d+=(l[f+4+2]-d)*e,u+=(l[f+4+3]-u)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),d=this.getBezierValue(s,f,2,m+18-2),u=this.getBezierValue(s,f,3,m+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(a==$.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class ft extends K{slotIndex=0;constructor(t,e,s){super(t,e,H.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(a){case $.setup:return void(l.a=t.a);case $.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(a==$.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class mt extends Z{slotIndex=0;constructor(t,e,s){super(t,e,[H.rgb+"|"+s,H.alpha+"|"+s,H.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,a,n,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=a,this.frames[t+5]=n,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(a){case $.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case $.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,f=0,m=0,g=0,p=0,x=0,w=J.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],f=l[w+3],m=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,f+=(l[w+8+3]-f)*e,m+=(l[w+8+4]-m)*e,g+=(l[w+8+5]-g)*e,p+=(l[w+8+6]-p)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],f=l[w+3],m=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),f=this.getBezierValue(s,w,3,b+36-2),m=this.getBezierValue(s,w,4,b+54-2),g=this.getBezierValue(s,w,5,b+72-2),p=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==i)h.set(d,u,f,m),c.r=g,c.g=p,c.b=x;else{if(a==$.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*i,(u-h.g)*i,(f-h.b)*i,(m-h.a)*i),c.r+=(g-c.r)*i,c.g+=(p-c.g)*i,c.b+=(x-c.b)*i}}}class gt extends Z{slotIndex=0;constructor(t,e,s){super(t,e,[H.rgb+"|"+s,H.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,a,n,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=a,this.frames[t+5]=n,this.frames[t+6]=o}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(a){case $.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case $.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,f=0,m=0,g=0,p=0,x=J.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],f=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,f+=(l[x+7+3]-f)*e,m+=(l[x+7+4]-m)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],f=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),f=this.getBezierValue(s,x,3,w+36-2),m=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),p=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=f,c.r=m,c.g=g,c.b=p;else{if(a==$.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*i,h.g+=(u-h.g)*i,h.b+=(f-h.b)*i,c.r+=(m-c.r)*i,c.g+=(g-c.g)*i,c.b+=(p-c.b)*i}}}class pt extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[H.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];o.bone.active&&(n!=j.mixOut?s<this.frames[0]?a!=$.setup&&a!=$.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[J.search1(this.frames,s)]):a==$.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class xt extends Z{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[H.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,i,a,n,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let f=.03*(r-2*a+o),m=.03*l-.06*n,g=.006*(3*(a-o)-r+h),p=.018*(n-l+.33333333),x=2*f+g,w=2*m+p,b=.3*(a-r)+f+.16666667*g,y=.3*n+m+.16666667*p,v=r+b,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,b+=x,y+=w,x+=g,w+=p,v+=b,k+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let i=this.frames[e];return s[r+1]*(t-i)/(s[r]-i)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let e=s[r-2],i=s[r-1];return i+(t-e)/(s[r]-e)*(s[r+1]-i)}let a=s[i-2],n=s[i-1];return n+(1-n)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof q)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(a=$.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(a){case $.setup:return void(h.length=0);case $.first:if(1==i)return void(h.length=0);h.length=d;let t=l;if(t.bones){i=1-i;for(f=0;f<d;f++)h[f]*=i}else{let e=t.vertices;for(var f=0;f<d;f++)h[f]+=(e[f]-h[f])*i}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==i)if(a==$.add){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else P.arrayCopy(t,0,h,0,d);else switch(a){case $.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<d;e++){let r=s[e];h[e]=r+(t[e]-r)*i}}break}case $.first:case $.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*i;break;case $.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*i}}return}let m=J.search1(u,s),g=this.getCurvePercent(s,m),p=c[m],x=c[m+1];if(1==i)if(a==$.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=e+(x[t]-e)*g}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=s+(x[t]-s)*g-e[t]}}}else for(let t=0;t<d;t++){let e=p[t];h[t]=e+(x[t]-e)*g}else switch(a){case $.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]=(e+(x[t]-e)*g)*i}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t],r=e[t];h[t]=r+(s+(x[t]-s)*g-r)*i}}break}case $.first:case $.replace:for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g-h[t])*i}break;case $.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g)*i}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=(s+(x[t]-s)*g-e[t])*i}}}}}class wt extends J{static propertyIds=[""+H.event];events;constructor(t){super(t,wt.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,i,a,n){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,i,a,n),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=J.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}}class bt extends J{static propertyIds=[""+H.drawOrder];drawOrders;constructor(t){super(t,bt.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,i,a,n){if(n==j.mixOut)return void(a==$.setup&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(a!=$.setup&&a!=$.first||P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=J.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,r=l.length;t<r;t++)e[t]=s[l[t]]}else P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class yt extends Z{constraintIndex=0;constructor(t,e,s){super(t,e,[H.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,a,n){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=a?1:0,this.frames[t+5]=n?1:0}apply(t,e,s,r,i,a,n){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case $.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case $.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=J.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}a==$.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,n==j.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*i,o.softness+=(c-o.softness)*i,n==j.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class vt extends Z{constraintIndex=0;constructor(t,e,s){super(t,e,[H.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,a,n,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=i,l[t+4]=a,l[t+5]=n,l[t+6]=o}apply(t,e,s,r,i,a,n){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,f,m=this.frames;if(s<m[0]){let t=o.data;switch(a){case $.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case $.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let g=J.search(m,s,7),p=this.curves[g/7];switch(p){case 0:let t=m[g];l=m[g+1],h=m[g+2],c=m[g+3],d=m[g+4],u=m[g+5],f=m[g+6];let e=(s-t)/(m[g+7]-t);l+=(m[g+7+1]-l)*e,h+=(m[g+7+2]-h)*e,c+=(m[g+7+3]-c)*e,d+=(m[g+7+4]-d)*e,u+=(m[g+7+5]-u)*e,f+=(m[g+7+6]-f)*e;break;case 1:l=m[g+1],h=m[g+2],c=m[g+3],d=m[g+4],u=m[g+5],f=m[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),f=this.getBezierValue(s,g,6,p+90-2)}if(a==$.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(f-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(f-o.mixShearY)*i}}class kt extends K{constraintIndex=0;constructor(t,e,s){super(t,e,H.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,a,n){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,a,o.position,o.data.position))}}class St extends K{constraintIndex=0;constructor(t,e,s){super(t,e,H.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,a,n){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,a,o.spacing,o.data.spacing))}}class It extends Z{constraintIndex=0;constructor(t,e,s){super(t,e,[H.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let a=this.frames;a[t<<=2]=e,a[t+1]=s,a[t+2]=r,a[t+3]=i}apply(t,e,s,r,i,a,n){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(a){case $.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case $.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=J.search(d,s,4),f=this.curves[u>>2];switch(f){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,f-2),h=this.getBezierValue(s,u,2,f+18-2),c=this.getBezierValue(s,u,3,f+36-2)}if(a==$.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class At extends K{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,a,n){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,i,a,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,a,this.get(o),this.setup(o)))}}class Mt extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class Ct extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Ft extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Tt extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class Yt extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Et extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class Rt extends At{constructor(t,e,s){super(t,e,s,H.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Xt extends J{static propertyIds=[H.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,Xt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,i,a,n){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],i,a,n),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[J.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class Bt extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[H.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Bt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,i){let a=this.frames;a[t*=Bt.ENTRIES]=e,a[t+Bt.MODE]=s|r<<4,a[t+Bt.DELAY]=i}apply(t,e,s,r,i,a,n){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof q&&l.timelineAttachment==h))return;let c=this.frames;if(s<c[0])return void(a!=$.setup&&a!=$.first||(o.sequenceIndex=-1));let d=J.search(c,s,Bt.ENTRIES),u=c[d],f=c[d+Bt.MODE],m=c[d+Bt.DELAY];if(!this.attachment.sequence)return;let g=f>>4,p=this.attachment.sequence.regions.length,x=z[15&f];if(x!=W.hold)switch(g+=(s-u)/m+1e-5|0,x){case W.once:g=Math.min(p-1,g);break;case W.loop:g%=p;break;case W.pingpong:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case W.onceReverse:g=Math.max(p-1-g,0);break;case W.loopReverse:g=p-1-g%p;break;case W.pingpongReverse:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}}class Pt{static _emptyAnimation=new G("<empty>",[],0);static emptyAnimation(){return Pt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Vt(this);propertyIDs=new T;animationsChanged=!1;trackEntryPool=new V((()=>new _t));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let i=t*r.timeScale;if(r.delay>0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}let a=r.next;if(a){let e=r.trackLast-a.delay;if(e>=0){for(a.delay=0,a.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*a.timeScale,r.trackTime+=i,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,r=!1;for(let a=0,n=s.length;a<n;a++){let n=s[a];if(!n||n.delay>0)continue;r=!0;let o=0==a?$.first:n.mixBlend,l=n.alpha;n.mixingFrom?l*=this.applyMixingFrom(n,t,o):n.trackTime>=n.trackEnd&&!n.next&&(l=0);let h=l>=n.alphaAttachmentThreshold,c=n.animationLast,d=n.getAnimationTime(),u=d,f=e;n.reverse&&(u=n.animation.duration-u,f=null);let m=n.animation.timelines,g=m.length;if(0==a&&1==l||o==$.add){0==a&&(h=!0);for(let e=0;e<g;e++){P.webkit602BugfixHelper(l,o);var i=m[e];i instanceof pt?this.applyAttachmentTimeline(i,t,u,o,h):i.apply(t,c,u,f,l,o,j.mixIn)}}else{let e=n.timelineMode,s=n.shortestRotation,r=!s&&n.timelinesRotation.length!=g<<1;r&&(n.timelinesRotation.length=g<<1);for(let i=0;i<g;i++){let a=m[i],d=e[i]==Nt?o:$.setup;!s&&a instanceof tt?this.applyRotateTimeline(a,t,u,l,d,n.timelinesRotation,i<<1,r):a instanceof pt?this.applyAttachmentTimeline(a,t,u,o,h):(P.webkit602BugfixHelper(l,o),a.apply(t,c,u,f,l,d,j.mixIn))}}this.queueEvents(n,d),e.length=0,n.nextAnimationLast=d,n.nextTrackLast=n.trackTime}for(var a=this.unkeyedState+zt,n=t.slots,o=0,l=t.slots.length;o<l;o++){var h=n[o];if(h.attachmentState==a){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let i=0;0==t.mixDuration?(i=1,s==$.first&&(s=$.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=$.first&&(s=r.mixBlend));let a=i<r.mixAttachmentThreshold,n=i<r.mixDrawOrderThreshold,o=r.animation.timelines,l=o.length,h=r.alpha*t.interruptAlpha,c=h*(1-i),d=r.animationLast,u=r.getAnimationTime(),f=u,m=null;if(r.reverse?f=r.animation.duration-f:i<r.eventThreshold&&(m=this.events),s==$.add)for(let t=0;t<l;t++)o[t].apply(e,d,f,m,c,s,j.mixOut);else{let t=r.timelineMode,i=r.timelineHoldMix,u=r.shortestRotation,g=!u&&r.timelinesRotation.length!=l<<1;g&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let p=0;p<l;p++){let l,x=o[p],w=j.mixOut,b=0;switch(t[p]){case Nt:if(!n&&x instanceof bt)continue;l=s,b=c;break;case Lt:l=$.setup,b=c;break;case qt:l=s,b=h;break;case Ut:l=$.setup,b=h;break;default:l=$.setup;let t=i[p];b=h*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=b,!u&&x instanceof tt?this.applyRotateTimeline(x,e,f,b,l,r.timelinesRotation,p<<1,g):x instanceof pt?this.applyAttachmentTimeline(x,e,f,l,a&&b>=r.alphaAttachmentThreshold):(P.webkit602BugfixHelper(b,s),n&&x instanceof bt&&l==$.setup&&(w=j.mixIn),x.apply(e,d,f,m,b,l,w))}}return t.mixDuration>0&&this.queueEvents(r,u),this.events.length=0,r.nextAnimationLast=u,r.nextTrackLast=r.trackTime,i}applyAttachmentTimeline(t,e,s,r,i){var a=e.slots[t.slotIndex];a.bone.active&&(s<t.frames[0]?r!=$.setup&&r!=$.first||this.setAttachment(e,a,a.data.attachmentName,i):this.setAttachment(e,a,t.attachmentNames[J.search1(t.frames,s)],i),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+zt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+Gt)}applyRotateTimeline(t,e,s,r,i,a,n,o){if(o&&(a[n]=0),1==r)return void t.apply(e,0,s,null,1,i,j.mixIn);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(i){case $.setup:l.rotation=l.data.rotation;default:return;case $.first:h=l.rotation,c=l.data.rotation}else h=i==$.setup?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=a[n];else{let t=0,e=0;o?(t=0,e=u):(t=a[n],e=a[n+1]);let s=t-t%360;d=u+s;let r=u>=0,i=t>=0;Math.abs(e)<=90&&E.signum(e)!=E.signum(u)&&(Math.abs(t-s)>180?(d+=360*E.signum(t),i=r):0!=s?d-=360*E.signum(t):i=r),i!=r&&(d+=360*E.signum(t)),a[n]=d}a[n+1]=u,l.rotation=h+d*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,i=r-s,a=t.trackLast%i,n=this.events,o=0,l=n.length;for(;o<l;o++){let e=n[o];if(e.time<a)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=n[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,r=!1):this.clearNext(i));let a=this.trackEntry(t,e,s,i);return this.setCurrent(t,a,r),this.queue.drain(),a}addAnimation(t,e,s=!1,r=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let a=this.trackEntry(t,e,s,i);return i?(i.next=a,a.previous=i,r<=0&&(r+=i.getTrackComplete()-a.mixDuration)):(this.setCurrent(t,a,!0),this.queue.drain()),a.delay=r,a}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Pt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,Pt.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(P.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=r?this.data.getMix(r.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=$.replace,i}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==$.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,i=t.timelineMode;i.length=r;let a=t.timelineHoldMix;a.length=0;let n=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)i[t]=n.addAll(s[t].getPropertyIds())?Ut:qt;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(n.addAll(l))if(!e||r instanceof pt||r instanceof bt||r instanceof wt||!e.animation.hasTimeline(l))i[o]=Lt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=Wt,a[o]=s;continue t}break}i[o]=Ut}else i[o]=Nt}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class _t{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=$.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class Vt{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(Dt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Dt.interrupt),this.objects.push(t)}end(t){this.objects.push(Dt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Dt.dispose),this.objects.push(t)}complete(t){this.objects.push(Dt.complete),this.objects.push(t)}event(t,e){this.objects.push(Dt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case Dt.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case Dt.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case Dt.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case Dt.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case Dt.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case Dt.event:let r=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var Dt;!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Dt||(Dt={}));class Ot{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Nt=0,Lt=1,qt=2,Ut=3,Wt=4,zt=1,Gt=2;class $t{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class jt extends q{color=new Y(1,1,1,1);constructor(t){super(t)}copy(){let t=new jt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Ht extends q{endSlot=null;color=new Y(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ht(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Jt{_image;constructor(t){this._image=t}getImage(){return this._image}}var Zt,Kt,Qt,te,ee,se,re,ie,ae;!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(Zt||(Zt={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(Kt||(Kt={}));class ne{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class oe extends Jt{setFilters(t,e){}setWraps(t,e){}dispose(){}}class le{pages=new Array;regions=new Array;constructor(t){let e=new he(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=P.enumValue(Zt,s[1]),t.magFilter=P.enumValue(Zt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=Kt.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=Kt.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let a=e.readLine();for(;a&&0==a.trim().length;)a=e.readLine();for(;a&&0!=a.trim().length&&0!=e.readEntry(s,a);)a=e.readLine();let n=null,o=null,l=null;for(;null!==a;)if(0==a.trim().length)n=null,a=e.readLine();else if(n){let t=new de(n,a);for(;;){let r=e.readEntry(s,a=e.readLine());if(0==r)break;let n=i[s[0]];if(n)n(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<r;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/n.width,t.v=t.y/n.height,90==t.degrees?(t.u2=(t.x+t.height)/n.width,t.v2=(t.y+t.width)/n.height):(t.u2=(t.x+t.width)/n.width,t.v2=(t.y+t.height)/n.height),this.regions.push(t)}else{for(n=new ce(a.trim());0!=e.readEntry(s,a=e.readLine());){let t=r[s[0]];t&&t(n)}this.pages.push(n)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class he{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let s=e.indexOf(",",i);if(-1==s)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,s-i).trim(),i=s+1,4==r)return 4}}}class ce{name;minFilter=Zt.Nearest;magFilter=Zt.Nearest;uWrap=Kt.ClampToEdge;vWrap=Kt.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class de extends ne{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class ue extends q{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new Y(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new Y(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=P.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,i=this.region.v,a=0,n=0;if(this.region instanceof de){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,a=o.originalHeight/h,n=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*a,e[o+1]=i+(1-t[o])*n;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,a=o.originalWidth/h,n=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*a,e[o+1]=i+(1-t[o+1])*n;return;case 270:r-=o.offsetY/h,i-=o.offsetX/c,a=o.originalHeight/h,n=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*a,e[o+1]=i+t[o]*n;return}r-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,a=o.originalWidth/h,n=o.originalHeight/c}else this.region?(a=this.region.u2-r,n=this.region.v2-i):(r=i=0,a=n=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*a,e[o+1]=i+t[o+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new ue(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,i,a){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,i,a)}newLinkedMesh(){let t=new ue(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class fe extends q{lengths=[];closed=!1;constantSpeed=!1;color=new Y(1,1,1,1);constructor(t){super(t)}copy(){let t=new fe(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class me extends q{x=0;y=0;rotation=0;color=new Y(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*E.degRad,s=Math.cos(e),r=Math.sin(e),i=s*t.a+r*t.b,a=s*t.c+r*t.d;return E.atan2Deg(a,i)}copy(){let t=new me(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class ge extends L{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new Y(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new Y(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,a=-this.height/2*this.scaleY+this.region.offsetY*r,n=i+this.region.width*s,o=a+this.region.height*r,l=this.rotation*E.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,f=i*h+d,m=i*c,g=a*h+u,p=a*c,x=n*h+d,w=n*c,b=o*h+u,y=o*c,v=this.offset;v[0]=f-p,v[1]=g+m,v[2]=f-y,v[3]=b+m,v[4]=x-y,v[5]=b+w,v[6]=x-p,v[7]=g+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,a=this.offset,n=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,f=0;u=a[0],f=a[1],e[s]=u*l+f*h+n,e[s+1]=u*c+f*d+o,s+=r,u=a[2],f=a[3],e[s]=u*l+f*h+n,e[s+1]=u*c+f*d+o,s+=r,u=a[4],f=a[5],e[s]=u*l+f*h+n,e[s+1]=u*c+f*d+o,s+=r,u=a[6],f=a[7],e[s]=u*l+f*h+n,e[s+1]=u*c+f*d+o}copy(){let t=new ge(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class pe{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,a=r.length;i<a;i++){let a=s.getPath(e,i),n=this.atlas.findRegion(a);if(null==n)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");r[i]=n}}newRegionAttachment(t,e,s,r){let i=new ge(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,r){let i=new ue(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new jt(e)}newPathAttachment(t,e){return new fe(e)}newPointAttachment(t,e){return new me(e)}newClippingAttachment(t,e){return new Ht(e)}}class xe{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Qt.Normal;skinRequired=!1;color=new Y;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(Qt||(Qt={}));class we{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=Qt.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,a,n){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=a,this.ashearY=n;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+a)*E.degRad,d=(s+90+n)*E.degRad;return this.a=Math.cos(c)*r*l,this.b=Math.cos(d)*i*l,this.c=Math.sin(c)*r*h,this.d=Math.sin(d)*i*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case Qt.Normal:{const t=(s+a)*E.degRad,e=(s+90+n)*E.degRad,o=Math.cos(t)*r,u=Math.cos(e)*i,f=Math.sin(t)*r,m=Math.sin(e)*i;return this.a=l*o+h*f,this.b=l*u+h*m,this.c=c*o+d*f,void(this.d=c*u+d*m)}case Qt.OnlyTranslation:{const t=(s+a)*E.degRad,e=(s+90+n)*E.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*i,this.c=Math.sin(t)*r,this.d=Math.sin(e)*i;break}case Qt.NoRotationOrReflection:{let t=l*l+c*c,e=0;t>1e-4?(t=Math.abs(l*d-h*c)/t,l/=this.skeleton.scaleX,c/=this.skeleton.scaleY,h=c*t,d=l*t,e=Math.atan2(c,l)*E.radDeg):(l=0,c=0,e=90-Math.atan2(d,h)*E.radDeg);const o=(s+a-e)*E.degRad,u=(s+n-e+90)*E.degRad,f=Math.cos(o)*r,m=Math.cos(u)*i,g=Math.sin(o)*r,p=Math.sin(u)*i;this.a=l*f-h*g,this.b=l*m-h*p,this.c=c*f+d*g,this.d=c*m+d*p;break}case Qt.NoScale:case Qt.NoScaleOrReflection:{s*=E.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,f=Math.sqrt(o*o+u*u);f>1e-5&&(f=1/f),o*=f,u*=f,f=Math.sqrt(o*o+u*u),this.inherit==Qt.NoScale&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(f=-f),s=Math.PI/2+Math.atan2(u,o);const m=Math.cos(s)*f,g=Math.sin(s)*f;a*=E.degRad,n=(90+n)*E.degRad;const p=Math.cos(a)*r,x=Math.cos(n)*i,w=Math.sin(a)*r,b=Math.sin(n)*i;this.a=o*p+m*w,this.b=o*x+m*b,this.c=u*p+g*w,this.d=u*x+g*b;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg);let e,s,r,i,a=t.a,n=t.b,o=t.c,l=t.d,h=1/(a*l-n*o),c=l*h,d=n*h,u=o*h,f=a*h,m=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=m*c-g*d,this.ay=g*f-m*u,this.inherit==Qt.OnlyTranslation)e=this.a,s=this.b,r=this.c,i=this.d;else{switch(this.inherit){case Qt.NoRotationOrReflection:{let t=Math.abs(a*l-n*o)/(a*a+o*o),e=a/this.skeleton.scaleX;n=-(o/this.skeleton.scaleY)*t*this.skeleton.scaleX,l=e*t*this.skeleton.scaleY,h=1/(a*l-n*o),c=l*h,d=n*h;break}case Qt.NoScale:case Qt.NoScaleOrReflection:let t=E.cosDeg(this.rotation),e=E.sinDeg(this.rotation);a=(a*t+n*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(a*a+o*o);s>1e-5&&(s=1/s),a*=s,o*=s,s=Math.sqrt(a*a+o*o),this.inherit==Qt.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=E.PI/2+Math.atan2(o,a);n=Math.cos(r)*s,l=Math.sin(r)*s,h=1/(a*l-n*o),c=l*h,d=n*h,u=o*h,f=a*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,r=f*this.c-u*this.a,i=f*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*i-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*i,t)*E.radDeg,this.arotation=Math.atan2(r,e)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*E.radDeg}rotateWorld(t){t*=E.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}}class be{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ye{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new ve){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=(()=>{}),s=(()=>{})){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=(()=>{}),s=(()=>{})){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=(()=>{}),s=(()=>{})){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}loadTexture(t,e=(()=>{}),s=(()=>{})){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=(()=>{}),s=(()=>{}),r){let i=t.lastIndexOf("/"),a=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let n=new le(i),o=n.pages.length,l=!1;for(let i of n.pages)this.loadTexture(r?r[i.name]:a+i.name,((s,r)=>{l||(i.setTexture(r),0==--o&&this.success(e,t,n))}),((e,r)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}}class ve{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let i=()=>{this.finish(t,r.status,r.responseText)};r.onload=i,r.onerror=i,r.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let i=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):i()},r.onerror=i,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=r.length;t<e;t+=2)r[t].apply(null,i)}}class ke{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Se{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Ie{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,r,i,a,n){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,f=0,m=0;switch(t.inherit){case Qt.OnlyTranslation:f=(e-t.worldX)*E.signum(t.skeleton.scaleX),m=(s-t.worldY)*E.signum(t.skeleton.scaleY);break;case Qt.NoRotationOrReflection:let r=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),i=l/t.skeleton.scaleX,a=c/t.skeleton.scaleY;h=-a*r*t.skeleton.scaleX,d=i*r*t.skeleton.scaleY,u+=Math.atan2(a,i)*E.radDeg;default:let n=e-o.worldX,g=s-o.worldY,p=l*d-h*c;Math.abs(p)<=1e-4?(f=0,m=0):(f=(n*d-g*h)/p-t.ax,m=(g*l-n*c)/p-t.ay)}u+=Math.atan2(m,f)*E.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,p=t.ascaleY;if(r||i){switch(t.inherit){case Qt.NoScale:case Qt.NoScaleOrReflection:f=e-t.worldX,m=s-t.worldY}const o=t.data.length*g;if(o>1e-4){const t=f*f+m*m;if(r&&t<o*o||i&&t>o*o){const e=(Math.sqrt(t)/o-1)*n+1;g*=e,a&&(p*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*n,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,a,n,o,l){if(t.inherit!=Qt.Normal||e.inherit!=Qt.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,f=d,m=u,g=e.ascaleX,p=0,x=0,w=0;d<0?(d=-d,p=180,w=-1):(p=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,x=180):x=0;let b=e.ax,y=0,v=0,k=0,S=t.a,I=t.b,A=t.c,M=t.d,C=Math.abs(d-u)<=1e-4;!C||a?(y=0,v=S*b+t.worldX,k=A*b+t.worldY):(y=e.ay,v=S*b+I*y+t.worldX,k=A*b+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,I=F.b,A=F.c,M=F.d;let T=S*M-I*A,Y=v-F.worldX,R=k-F.worldY;T=Math.abs(T)<=1e-4?0:1/T;let X,B,P=(Y*M-R*I)*T-h,_=(R*S-Y*A)*T-c,V=Math.sqrt(P*P+_*_),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,r,!1,a,!1,l),void e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);Y=s-F.worldX,R=r-F.worldY;let O=(Y*M-R*I)*T-h,N=(R*S-Y*A)*T-c,L=O*O+N*N;if(0!=o){o*=d*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(C){D*=d;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,B=Math.PI*i):t>1?(t=1,B=0,a&&(S=(Math.sqrt(L)/(V+D)-1)*l+1,f*=S,n&&(m*=S))):B=Math.acos(t)*i,S=V+D*t,I=D*Math.sin(B),X=Math.atan2(N*S-O*I,O*S+N*I)}else{S=d*D,I=u*D;let t=S*S,e=I*I,s=Math.atan2(N,O);A=e*V*V+t*L-t*e;let r=-2*e*V,a=e-t;if(M=r*r-4*a*A,M>=0){let t=Math.sqrt(M);r<0&&(t=-t),t=.5*-(r+t);let e=t/a,n=A/t,o=Math.abs(e)<Math.abs(n)?e:n;if(o*o<=L){R=Math.sqrt(L-o*o)*i,X=s-Math.atan2(R,o),B=Math.atan2(R/u,(o-V)/d);break t}}let n=E.PI,o=V-S,l=o*o,h=0,c=0,f=V+S,m=f*f,g=0;A=-S*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),Y=S*Math.cos(A)+V,R=I*Math.sin(A),M=Y*Y+R*R,M<l&&(n=A,l=M,o=Y,h=R),M>m&&(c=A,m=M,f=Y,g=R)),L<=.5*(l+m)?(X=s-Math.atan2(h*i,o),B=n*i):(X=s-Math.atan2(g*i,f),B=c*i)}let q=Math.atan2(y,b)*w,U=t.arotation;X=(X-q)*E.radDeg+p-U,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(h,c,U+X*l,f,m,0,0),U=e.arotation,B=((B+q)*E.radDeg-e.ashearX)*w+x-U,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(b,y,U+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Ae extends be{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class Me extends be{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=te.Fixed;spacingMode=ee.Fixed;rotateMode=se.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(te||(te={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(ee||(ee={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(se||(se={}));class Ce{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof fe))return;let s=this.mixRotate,r=this.mixX,i=this.mixY;if(0==s&&0==r&&0==i)return;let a=this.data,n=a.rotateMode==se.Tangent,o=a.rotateMode==se.ChainScale,l=this.bones,h=l.length,c=n?h:h+1,d=P.setArraySize(this.spaces,c),u=o?this.lengths=P.setArraySize(this.lengths,h):[],f=this.spacing;switch(a.spacingMode){case ee.Percent:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,r=s*e.a,i=s*e.c;u[t]=Math.sqrt(r*r+i*i)}P.arrayFill(d,1,c,f);break;case ee.Proportional:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],r=s.data.length;if(r<Ce.epsilon)o&&(u[e]=0),d[++e]=f;else{let i=r*s.a,a=r*s.c,n=Math.sqrt(i*i+a*a);o&&(u[e]=n),d[++e]=n,t+=n}}if(t>0){t=c/t*f;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=a.spacingMode==ee.Length;for(let t=0,s=c-1;t<s;){let s=l[t],r=s.data.length;if(r<Ce.epsilon)o&&(u[t]=0),d[++t]=f;else{let i=r*s.a,a=r*s.c,n=Math.sqrt(i*i+a*a);o&&(u[t]=n),d[++t]=(e?r+f:f)*n/r}}}let m=this.computeWorldPositions(e,c,n),g=m[0],p=m[1],x=a.offsetRotation,w=!1;if(0==x)w=a.rotateMode==se.Chain;else{w=!1;let t=this.target.bone;x*=t.a*t.d-t.b*t.c>0?E.degRad:-E.degRad}for(let t=0,e=3;t<h;t++,e+=3){let a=l[t];a.worldX+=(g-a.worldX)*r,a.worldY+=(p-a.worldY)*i;let h=m[e],c=m[e+1],f=h-g,b=c-p;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(f*f+b*b)/e-1)*s+1;a.a*=t,a.c*=t}}if(g=h,p=c,s>0){let r=a.a,i=a.b,o=a.c,l=a.d,h=0,c=0,u=0;if(h=n?m[e-1]:0==d[t+1]?m[e+2]:Math.atan2(b,f),h-=Math.atan2(o,r),w){c=Math.cos(h),u=Math.sin(h);let t=a.data.length;g+=(t*(c*r-u*o)-f)*s,p+=(t*(u*r+c*o)-b)*s}else h+=x;h>E.PI?h-=E.PI2:h<-E.PI&&(h+=E.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),a.a=c*r-u*o,a.b=c*i-u*l,a.c=u*r+c*o,a.d=u*i+c*l}a.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,i=this.position,a=this.spaces,n=P.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=Ce.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let f,m=u[c];switch(this.data.positionMode==te.Percent&&(i*=m),this.data.spacingMode){case ee.Percent:f=m;break;case ee.Proportional:f=m/e;break;default:f=1}o=P.setArraySize(this.world,8);for(let g=0,p=0,x=0;g<e;g++,p+=3){let e=a[g]*f;i+=e;let w=i;if(l)w%=m,w<0&&(w+=m),x=0;else{if(w<0){d!=Ce.BEFORE&&(d=Ce.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(w,o,0,n,p);continue}if(w>m){d!=Ce.AFTER&&(d=Ce.AFTER,t.computeWorldVertices(r,h-6,4,o,0,2)),this.addAfterPosition(w-m,o,0,n,p);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(r,h-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],n,p,s||g>0&&0==e)}return n}l?(h+=2,o=P.setArraySize(this.world,h),t.computeWorldVertices(r,2,h-4,o,0,2),t.computeWorldVertices(r,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=P.setArraySize(this.world,h),t.computeWorldVertices(r,2,h,o,0,2));let u,f=P.setArraySize(this.curves,c),m=0,g=o[0],p=o[1],x=0,w=0,b=0,y=0,v=0,k=0,S=0,I=0,A=0,M=0,C=0,F=0,T=0,Y=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],b=o[e+2],y=o[e+3],v=o[e+4],k=o[e+5],S=.1875*(g-2*x+b),I=.1875*(p-2*w+y),A=.09375*(3*(x-b)-g+v),M=.09375*(3*(w-y)-p+k),C=2*S+A,F=2*I+M,T=.75*(x-g)+S+.16666667*A,Y=.75*(w-p)+I+.16666667*M,m+=Math.sqrt(T*T+Y*Y),T+=C,Y+=F,C+=A,F+=M,m+=Math.sqrt(T*T+Y*Y),T+=C,Y+=F,m+=Math.sqrt(T*T+Y*Y),T+=C+A,Y+=F+M,m+=Math.sqrt(T*T+Y*Y),f[t]=m,g=v,p=k;switch(this.data.positionMode==te.Percent&&(i*=m),this.data.spacingMode){case ee.Percent:u=m;break;case ee.Proportional:u=m/e;break;default:u=1}let E=this.segments,R=0;for(let t=0,r=0,c=0,X=0;t<e;t++,r+=3){let e=a[t]*u;i+=e;let B=i;if(l)B%=m,B<0&&(B+=m),c=0;else{if(B<0){this.addBeforePosition(B,o,0,n,r);continue}if(B>m){this.addAfterPosition(B-m,o,h-4,n,r);continue}}for(;;c++){let t=f[c];if(!(B>t)){if(0==c)B/=t;else{let e=f[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(g=o[t],p=o[t+1],x=o[t+2],w=o[t+3],b=o[t+4],y=o[t+5],v=o[t+6],k=o[t+7],S=.03*(g-2*x+b),I=.03*(p-2*w+y),A=.006*(3*(x-b)-g+v),M=.006*(3*(w-y)-p+k),C=2*S+A,F=2*I+M,T=.3*(x-g)+S+.16666667*A,Y=.3*(w-p)+I+.16666667*M,R=Math.sqrt(T*T+Y*Y),E[0]=R,t=1;t<8;t++)T+=C,Y+=F,C+=A,F+=M,R+=Math.sqrt(T*T+Y*Y),E[t]=R;T+=C,Y+=F,R+=Math.sqrt(T*T+Y*Y),E[8]=R,T+=C+A,Y+=F+M,R+=Math.sqrt(T*T+Y*Y),E[9]=R,X=0}for(B*=R;;X++){let t=E[X];if(!(B>t)){if(0==X)B/=t;else{let e=E[X-1];B=X+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,g,p,x,w,b,y,v,k,n,r,s||t>0&&0==e)}return n}addBeforePosition(t,e,s,r,i){let a=e[s],n=e[s+1],o=e[s+2]-a,l=e[s+3]-n,h=Math.atan2(l,o);r[i]=a+t*Math.cos(h),r[i+1]=n+t*Math.sin(h),r[i+2]=h}addAfterPosition(t,e,s,r,i){let a=e[s+2],n=e[s+3],o=a-e[s],l=n-e[s+1],h=Math.atan2(l,o);r[i]=a+t*Math.cos(h),r[i+1]=n+t*Math.sin(h),r[i+2]=h}addCurvePosition(t,e,s,r,i,a,n,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,r-e));let u=t*t,f=u*t,m=1-t,g=m*m,p=g*m,x=m*t,w=3*x,b=m*w,y=w*t,v=e*p+r*b+a*y+o*f,k=s*p+i*b+n*y+l*f;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(i-s,r-e):Math.atan2(k-(s*g+i*x*2+n*u),v-(e*g+r*x*2+a*u)))}}class Fe{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,n=this.bone,o=n.data.length;switch(t){case re.none:return;case re.reset:this.reset();case re.update:const t=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=t,this.lastTime=this.skeleton.time;const l=n.worldX,h=n.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=h;else{let c=this.remaining,d=this.inertia,u=this.data.limit*t,f=this.data.step,m=this.skeleton.data.referenceScale,g=-1;if(s||r){if(s){const t=(this.ux-l)*d;this.xOffset+=t>u?u:t<-u?-u:t,this.ux=l}if(r){const t=(this.uy-h)*d;this.yOffset+=t>u?u:t<-u?-u:t,this.uy=h}if(c>=f){g=Math.pow(this.damping,60*f);const t=this.massInverse*f,e=this.strength,i=this.wind*m,a=(Ee.yDown?-this.gravity:this.gravity)*m;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*f,this.xVelocity*=g),r&&(this.yVelocity-=(a+this.yOffset*e)*t,this.yOffset+=this.yVelocity*f,this.yVelocity*=g),c-=f}while(c>=f)}s&&(n.worldX+=this.xOffset*e*this.data.x),r&&(n.worldY+=this.yOffset*e*this.data.y)}if(i||a){let t=Math.atan2(n.c,n.a),s=0,r=0,l=0,h=this.cx-n.worldX,p=this.cy-n.worldY;if(h>u?h=u:h<-u&&(h=-u),p>u?p=u:p<-u&&(p=-u),i){l=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(p+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(i-Math.ceil(i*E.invPI2-.5)*E.PI2)*d,i=this.rotateOffset*l+t,s=Math.cos(i),r=Math.sin(i),a&&(i=o*n.getWorldScaleX(),i>0&&(this.scaleOffset+=(h*s+p*r)*d/i))}else{s=Math.cos(t),r=Math.sin(t);const e=o*n.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+p*r)*d/e)}if(c=this.remaining,c>=f){-1==g&&(g=Math.pow(this.damping,60*f));const e=this.massInverse*f,n=this.strength,h=this.wind,d=Ee.yDown?-this.gravity:this.gravity,u=o/m;for(;;)if(c-=f,a&&(this.scaleVelocity+=(h*s-d*r-this.scaleOffset*n)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=g),i){if(this.rotateVelocity-=((h*r+d*s)*u+this.rotateOffset*n)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=g,c<f)break;const i=this.rotateOffset*l+t;s=Math.cos(i),r=Math.sin(i)}else if(c<f)break}}this.remaining=c}this.cx=n.worldX,this.cy=n.worldY;break;case re.pose:s&&(n.worldX+=this.xOffset*e*this.data.x),r&&(n.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,r=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),i=n.b,n.b=r*i-s*n.d,n.d=s*i+r*n.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),i=n.a,n.a=r*i-s*n.c,n.c=s*i+r*n.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),i=n.a,n.a=r*i-s*n.c,n.c=s*i+r*n.c,i=n.b,n.b=r*i-s*n.d,n.d=s*i+r*n.d}if(a){const t=1+this.scaleOffset*e*this.data.scaleX;n.a*=t,n.c*=t}t!=re.pose&&(this.tx=o*n.a,this.ty=o*n.c),n.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*E.degRad,i=Math.cos(r),a=Math.sin(r),n=this.cx-t,o=this.cy-e;this.translate(n*i-o*a-n,n*a+o*i-o)}}class Te{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new Y,this.darkColor=t.darkColor?new Y:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof q&&this.attachment instanceof q&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class Ye{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new D;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,n=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?E.degRad:-E.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,r=p.c,i=p.d,a=Math.atan2(c,l)-Math.atan2(r,e)+f;a>E.PI?a-=E.PI2:a<-E.PI&&(a+=E.PI2),a*=t;let n=Math.cos(a),o=Math.sin(a);p.a=n*e-o*r,p.b=n*s-o*i,p.c=o*e+n*r,p.d=o*s+n*i}if(n){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(t.x-p.worldX)*e,p.worldY+=(t.y-p.worldY)*s}if(0!=r){let t=Math.sqrt(p.a*p.a+p.c*p.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*r)/t),p.a*=t,p.c*=t}if(0!=i){let t=Math.sqrt(p.b*p.b+p.d*p.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*i)/t),p.b*=t,p.d*=t}if(a>0){let t=p.b,e=p.d,s=Math.atan2(e,t),r=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(p.c,p.a));r>E.PI?r-=E.PI2:r<-E.PI&&(r+=E.PI2),r=s+(r+m)*a;let i=Math.sqrt(t*t+e*e);p.b=Math.cos(r)*i,p.d=Math.sin(r)*i}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,n=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?E.degRad:-E.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,r=p.c,i=p.d,a=Math.atan2(c,l)+f;a>E.PI?a-=E.PI2:a<-E.PI&&(a+=E.PI2),a*=t;let n=Math.cos(a),o=Math.sin(a);p.a=n*e-o*r,p.b=n*s-o*i,p.c=o*e+n*r,p.d=o*s+n*i}if(n){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=t.x*e,p.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*r+1;p.a*=t,p.c*=t}if(0!=i){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*i+1;p.b*=t,p.d*=t}if(a>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>E.PI?t-=E.PI2:t<-E.PI&&(t+=E.PI2);let e=p.b,s=p.d;t=Math.atan2(s,e)+(t-E.PI/2+m)*a;let r=Math.sqrt(e*e+s*s);p.b=Math.cos(t)*r,p.d=Math.sin(t)*r}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,n=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(n.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(n.ax-d+this.data.offsetX)*e,u+=(n.ay-u+this.data.offsetY)*s;let f=h.ascaleX,m=h.ascaleY;0!=r&&0!=f&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*r)/f),0!=i&&0!=m&&(m=(m+(n.ascaleY-m+this.data.offsetScaleY)*i)/m);let g=h.ashearY;0!=a&&(g+=(n.ashearY-g+this.data.offsetShearY)*a),h.updateWorldTransformWith(d,u,c,f,m,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,n=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(n.arotation+this.data.offsetRotation)*t,d=h.ax+(n.ax+this.data.offsetX)*e,u=h.ay+(n.ay+this.data.offsetY)*s,f=h.ascaleX*((n.ascaleX-1+this.data.offsetScaleX)*r+1),m=h.ascaleY*((n.ascaleY-1+this.data.offsetScaleY)*i+1),g=h.ashearY+(n.ashearY+this.data.offsetShearY)*a;h.updateWorldTransformWith(d,u,c,f,m,h.ashearX,g)}}}class Ee{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ee.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new we(r,this,t),t.children.push(s)}else s=new we(r,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],r=this.bones[s.boneData.index],i=new Te(s,r);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Ie(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Ye(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Ce(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Fe(s,this))}this.color=new Y(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,i=this.physicsConstraints,a=e.length,n=s.length,o=r.length,l=this.physicsConstraints.length,h=a+n+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<a;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<n;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let i=e.getAttachment();i instanceof fe&&this.sortPathConstraintAttachmentWith(i,r);let a=t.bones,n=a.length;for(let t=0;t<n;t++)this.sortBone(a[t]);this._updateCache.push(t);for(let t=0;t<n;t++)this.sortReset(a[t].children);for(let t=0;t<n;t++)a[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof fe))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&P.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=e.a,i=e.b,a=e.c,n=e.d;s.worldX=r*this.x+i*this.y+e.worldX,s.worldY=a*this.x+n*this.y+e.worldY;const o=(s.rotation+s.shearX)*E.degRad,l=(s.rotation+90+s.shearY)*E.degRad,h=Math.cos(o)*s.scaleX,c=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(r*h+i*d)*this.scaleX,s.b=(r*c+i*u)*this.scaleX,s.c=(a*h+n*d)*this.scaleY,s.d=(a*c+n*u)*this.scaleY;let f=this._updateCache;for(let e=0,r=f.length;e<r;e++){let r=f[e];r!=s&&r.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;P.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s],i=r.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&r.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let i=s[r];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new D,e=new D;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,a=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof ge)h=8,c=P.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Ee.quadTriangles;else if(u instanceof ue){let t=u;h=t.worldVerticesLength,c=P.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Ht&&null!=r){r.clipStart(e,u);continue}if(c&&d){null!=r&&r.isClipping()&&(r.clipTriangles(c,d,d.length),c=r.clippedVertices,h=r.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];a=Math.min(a,e),n=Math.min(n,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(a,n),e.set(o-a,l-n)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,i=s.length;r<i;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let i=0,a=r.length;i<a;i++)r[i].rotate(t,e,s)}}!function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"}(re||(re={}));class Re extends be{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class Xe{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}}class Be{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class Pe{name;attachments=new Array;bones=Array();constraints=new Array;color=new Y(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof ue?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new Be(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new Be(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],a=i.getAttachment();if(a&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(a==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}}class _e{index=0;name;boneData;color=new Y(1,1,1,1);darkColor=null;attachmentName=null;blendMode=ie.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(ie||(ie={}));class Ve extends be{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class De{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Xe;s.name="";let r=new Oe(t),i=r.readInt32(),a=r.readInt32();s.hash=0==a&&0==i?null:a.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let n=r.readBoolean();n&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let o=0;o=r.readInt(!0);for(let t=0;t<o;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}o=r.readInt(!0);for(let t=0;t<o;t++){let i=r.readString();if(!i)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[r.readInt(!0)],o=new xe(t,i,a);o.rotation=r.readFloat(),o.x=r.readFloat()*e,o.y=r.readFloat()*e,o.scaleX=r.readFloat(),o.scaleY=r.readFloat(),o.shearX=r.readFloat(),o.shearY=r.readFloat(),o.length=r.readFloat()*e,o.inherit=r.readByte(),o.skinRequired=r.readBoolean(),n&&(Y.rgba8888ToColor(o.color,r.readInt32()),o.icon=r.readString()??void 0,o.visible=r.readBoolean()),s.bones.push(o)}o=r.readInt(!0);for(let t=0;t<o;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let i=s.bones[r.readInt(!0)],a=new _e(t,e,i);Y.rgba8888ToColor(a.color,r.readInt32());let o=r.readInt32();-1!=o&&Y.rgb888ToColor(a.darkColor=new Y,o),a.attachmentName=r.readStringRef(),a.blendMode=r.readInt(!0),n&&(a.visible=r.readBoolean()),s.slots.push(a)}o=r.readInt(!0);for(let t,i=0;i<o;i++){let i=r.readString();if(!i)throw new Error("IK constraint data name must not be null.");let a=new Ae(i);a.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[r.readInt(!0)]);a.target=s.bones[r.readInt(!0)];let n=r.readByte();a.skinRequired=!!(1&n),a.bendDirection=2&n?1:-1,a.compress=!!(4&n),a.stretch=!!(8&n),a.uniform=!!(16&n),32&n&&(a.mix=64&n?r.readFloat():1),128&n&&(a.softness=r.readFloat()*e),s.ikConstraints.push(a)}o=r.readInt(!0);for(let t,i=0;i<o;i++){let i=r.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let a=new Ve(i);a.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[r.readInt(!0)]);a.target=s.bones[r.readInt(!0)];let n=r.readByte();a.skinRequired=!!(1&n),a.local=!!(2&n),a.relative=!!(4&n),8&n&&(a.offsetRotation=r.readFloat()),16&n&&(a.offsetX=r.readFloat()*e),32&n&&(a.offsetY=r.readFloat()*e),64&n&&(a.offsetScaleX=r.readFloat()),128&n&&(a.offsetScaleY=r.readFloat()),n=r.readByte(),1&n&&(a.offsetShearY=r.readFloat()),2&n&&(a.mixRotate=r.readFloat()),4&n&&(a.mixX=r.readFloat()),8&n&&(a.mixY=r.readFloat()),16&n&&(a.mixScaleX=r.readFloat()),32&n&&(a.mixScaleY=r.readFloat()),64&n&&(a.mixShearY=r.readFloat()),s.transformConstraints.push(a)}o=r.readInt(!0);for(let t,i=0;i<o;i++){let i=r.readString();if(!i)throw new Error("Path constraint data name must not be null.");let a=new Me(i);a.order=r.readInt(!0),a.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[r.readInt(!0)]);a.target=s.slots[r.readInt(!0)];const n=r.readByte();a.positionMode=1&n,a.spacingMode=n>>1&3,a.rotateMode=n>>3&3,128&n&&(a.offsetRotation=r.readFloat()),a.position=r.readFloat(),a.positionMode==te.Fixed&&(a.position*=e),a.spacing=r.readFloat(),a.spacingMode!=ee.Length&&a.spacingMode!=ee.Fixed||(a.spacing*=e),a.mixRotate=r.readFloat(),a.mixX=r.readFloat(),a.mixY=r.readFloat(),s.pathConstraints.push(a)}o=r.readInt(!0);for(let t=0;t<o;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Re(t);i.order=r.readInt(!0),i.bone=s.bones[r.readInt(!0)];let a=r.readByte();i.skinRequired=!!(1&a),2&a&&(i.x=r.readFloat()),4&a&&(i.y=r.readFloat()),8&a&&(i.rotate=r.readFloat()),16&a&&(i.scaleX=r.readFloat()),32&a&&(i.shearX=r.readFloat()),i.limit=(64&a?r.readFloat():5e3)*e,i.step=1/r.readUnsignedByte(),i.inertia=r.readFloat(),i.strength=r.readFloat(),i.damping=r.readFloat(),i.massInverse=128&a?r.readFloat():1,i.wind=r.readFloat(),i.gravity=r.readFloat(),a=r.readByte(),1&a&&(i.inertiaGlobal=!0),2&a&&(i.strengthGlobal=!0),4&a&&(i.dampingGlobal=!0),8&a&&(i.massGlobal=!0),16&a&&(i.windGlobal=!0),32&a&&(i.gravityGlobal=!0),64&a&&(i.mixGlobal=!0),i.mix=128&a?r.readFloat():1,s.physicsConstraints.push(i)}let l=this.readSkin(r,s,!0,n);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(P.setArraySize(s.skins,o=t+r.readInt(!0));t<o;t++){let e=this.readSkin(r,s,!1,n);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=r.readInt(!0);for(let t=0;t<o;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new Se(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}o=r.readInt(!0);for(let t=0;t<o;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let i=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;i=new Pe("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");i=new Pe(s),r&&Y.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let s=0,r=i.bones.length;s<r;s++)i.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let s=0;s<a;s++){let s=t.readInt(!0);for(let a=0,n=t.readInt(!0);a<n;a++){let a=t.readStringRef();if(!a)throw new Error("Attachment name must not be null");let n=this.readAttachment(t,e,i,s,a,r);n&&i.setAttachment(s,a,n)}}return i}readAttachment(t,e,s,r,i,a){let n=this.scale,o=t.readByte();const l=8&o?t.readStringRef():i;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case ae.Region:{let e=16&o?t.readStringRef():null;const r=32&o?t.readInt32():4294967295,i=64&o?this.readSequence(t):null;let a=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),f=t.readFloat(),m=t.readFloat();e||(e=l);let g=this.attachmentLoader.newRegionAttachment(s,l,e,i);return g?(g.path=e,g.x=h*n,g.y=c*n,g.scaleX=d,g.scaleY=u,g.rotation=a,g.width=f*n,g.height=m*n,Y.rgba8888ToColor(g.color,r),g.sequence=i,null==i&&g.updateRegion(),g):null}case ae.BoundingBox:{let e=this.readVertices(t,!!(16&o)),r=a?t.readInt32():0,i=this.attachmentLoader.newBoundingBoxAttachment(s,l);return i?(i.worldVerticesLength=e.length,i.vertices=e.vertices,i.bones=e.bones,a&&Y.rgba8888ToColor(i.color,r),i):null}case ae.Mesh:{let e=16&o?t.readStringRef():l;const r=32&o?t.readInt32():4294967295,i=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let f=[],m=0,g=0;a&&(f=this.readShortArray(t,t.readInt(!0)),m=t.readFloat(),g=t.readFloat()),e||(e=l);let p=this.attachmentLoader.newMeshAttachment(s,l,e,i);return p?(p.path=e,Y.rgba8888ToColor(p.color,r),p.bones=c.bones,p.vertices=c.vertices,p.worldVerticesLength=c.length,p.triangles=u,p.regionUVs=d,null==i&&p.updateRegion(),p.hullLength=h<<1,p.sequence=i,a&&(p.edges=f,p.width=m*n,p.height=g*n),p):null}case ae.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const i=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let f=0,m=0;a&&(f=t.readFloat(),m=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,l,e,h);return g?(g.path=e,Y.rgba8888ToColor(g.color,i),g.sequence=h,a&&(g.width=f*n,g.height=m*n),this.linkedMeshes.push(new Ne(g,d,r,u,c)),g):null}case ae.Path:{const e=!!(16&o),r=!!(32&o),i=this.readVertices(t,!!(64&o)),h=P.newArray(i.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*n;const c=a?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=r,d.worldVerticesLength=i.length,d.vertices=i.vertices,d.bones=i.bones,d.lengths=h,a&&Y.rgba8888ToColor(d.color,c),d):null}case ae.Point:{const e=t.readFloat(),r=t.readFloat(),i=t.readFloat(),o=a?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=r*n,h.y=i*n,h.rotation=e,a&&Y.rgba8888ToColor(h.color,o),h):null}case ae.Clipping:{const r=t.readInt(!0),i=this.readVertices(t,!!(16&o));let n=a?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[r],h.worldVerticesLength=i.length,h.vertices=i.vertices,h.bones=i.bones,a&&Y.rgba8888ToColor(h.color,n),h):null}}return null}readSequence(t){let e=new U(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new Le;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let a=new Array,n=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);n.push(e);for(let r=0;r<e;r++)n.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return i.vertices=P.toFloatArray(a),i.bones=n,i}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),a=i-1;switch(s){case ss:{let s=new pt(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case rs:{let s=t.readInt(!0),n=new dt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;n.setFrame(e,o,l,h,c,d),e!=a;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;switch(t.readByte()){case vs:n.setStepped(e);break;case ks:We(t,n,s++,e,0,o,r,l,i,1),We(t,n,s++,e,1,o,r,h,a,1),We(t,n,s++,e,2,o,r,c,u,1),We(t,n,s++,e,3,o,r,d,f,1)}o=r,l=i,h=a,c=u,d=f}r.push(n);break}case is:{let s=t.readInt(!0),n=new ut(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;n.setFrame(e,o,l,h,c),e!=a;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case vs:n.setStepped(e);break;case ks:We(t,n,s++,e,0,o,r,l,i,1),We(t,n,s++,e,1,o,r,h,a,1),We(t,n,s++,e,2,o,r,c,d,1)}o=r,l=i,h=a,c=d}r.push(n);break}case as:{let s=t.readInt(!0),n=new mt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;n.setFrame(e,o,l,h,c,d,u,f,m),e!=a;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case vs:n.setStepped(e);break;case ks:We(t,n,s++,e,0,o,r,l,i,1),We(t,n,s++,e,1,o,r,h,a,1),We(t,n,s++,e,2,o,r,c,g,1),We(t,n,s++,e,3,o,r,d,p,1),We(t,n,s++,e,4,o,r,u,x,1),We(t,n,s++,e,5,o,r,f,w,1),We(t,n,s++,e,6,o,r,m,b,1)}o=r,l=i,h=a,c=g,d=p,u=x,f=w,m=b}r.push(n);break}case ns:{let s=t.readInt(!0),n=new gt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;n.setFrame(e,o,l,h,c,d,u,f),e!=a;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case vs:n.setStepped(e);break;case ks:We(t,n,s++,e,0,o,r,l,i,1),We(t,n,s++,e,1,o,r,h,a,1),We(t,n,s++,e,2,o,r,c,m,1),We(t,n,s++,e,3,o,r,d,g,1),We(t,n,s++,e,4,o,r,u,p,1),We(t,n,s++,e,5,o,r,f,x,1)}o=r,l=i,h=a,c=m,d=g,u=p,f=x}r.push(n);break}case os:{let s=new ft(i,t.readInt(!0),e),n=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,n,o),e!=a;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255;switch(t.readByte()){case vs:s.setStepped(e);break;case ks:We(t,s,r++,e,0,n,i,o,a,1)}n=i,o=a}r.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readByte(),a=t.readInt(!0);if(s==es){let s=new ct(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let n=t.readInt(!0);switch(s){case ze:r.push(qe(t,new tt(a,n,e),1));break;case Ge:r.push(Ue(t,new et(a,n,e),i));break;case $e:r.push(qe(t,new st(a,n,e),i));break;case je:r.push(qe(t,new rt(a,n,e),i));break;case He:r.push(Ue(t,new it(a,n,e),1));break;case Je:r.push(qe(t,new at(a,n,e),1));break;case Ze:r.push(qe(t,new nt(a,n,e),1));break;case Ke:r.push(Ue(t,new ot(a,n,e),1));break;case Qe:r.push(qe(t,new lt(a,n,e),1));break;case ts:r.push(qe(t,new ht(a,n,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),a=s-1,n=new yt(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*i:0;for(let e=0,s=0;n.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=a;e++){o=t.readByte();const r=t.readFloat(),a=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?n.setStepped(e):128&o&&(We(t,n,s++,e,0,l,r,h,a,1),We(t,n,s++,e,1,l,r,c,d,i)),l=r,h=a,c=d}r.push(n)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,a=new vt(s,t.readInt(!0),e),n=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;a.setFrame(e,n,o,l,h,c,d,u),e!=i;e++){let r=t.readFloat(),i=t.readFloat(),f=t.readFloat(),m=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case vs:a.setStepped(e);break;case ks:We(t,a,s++,e,0,n,r,o,i,1),We(t,a,s++,e,1,n,r,l,f,1),We(t,a,s++,e,2,n,r,h,m,1),We(t,a,s++,e,3,n,r,c,g,1),We(t,a,s++,e,4,n,r,d,p,1),We(t,a,s++,e,5,n,r,u,x,1)}n=r,o=i,l=f,h=m,c=g,d=p,u=x}r.push(a)}for(let e=0,a=t.readInt(!0);e<a;e++){let e=t.readInt(!0),a=s.pathConstraints[e];for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0),o=t.readInt(!0);switch(s){case cs:r.push(qe(t,new kt(n,o,e),a.positionMode==te.Fixed?i:1));break;case ds:r.push(qe(t,new St(n,o,e),a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?i:1));break;case us:let s=new It(n,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),a=t.readFloat(),n=t.readFloat(),o=t.readFloat();switch(t.readByte()){case vs:s.setStepped(e);break;case ks:We(t,s,r++,e,0,l,i,h,a,1),We(t,s,r++,e,1,l,i,c,n,1),We(t,s,r++,e,2,l,i,d,o,1)}l=i,h=a,c=n,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==ys){const s=new Xt(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const a=t.readInt(!0);switch(s){case fs:r.push(qe(t,new Mt(i,a,e),1));break;case ms:r.push(qe(t,new Ct(i,a,e),1));break;case gs:r.push(qe(t,new Ft(i,a,e),1));break;case ps:r.push(qe(t,new Tt(i,a,e),1));break;case xs:r.push(qe(t,new Yt(i,a,e),1));break;case ws:r.push(qe(t,new Et(i,a,e),1));break;case bs:r.push(qe(t,new Rt(i,a,e),1))}}}for(let e=0,a=t.readInt(!0);e<a;e++){let e=s.skins[t.readInt(!0)];for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readInt(!0);for(let a=0,n=t.readInt(!0);a<n;a++){let a=t.readStringRef();if(!a)throw new Error("attachmentName must not be null.");let n=e.getAttachment(s,a),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case ls:{let e=n,a=e.bones,o=e.vertices,c=a?o.length/3*2:o.length,d=t.readInt(!0),u=new xt(l,d,s,e),f=t.readFloat();for(let e=0,s=0;;e++){let r,n=t.readInt(!0);if(0==n)r=a?P.newFloatArray(c):o;else{r=P.newFloatArray(c);let e=t.readInt(!0);if(n+=e,1==i)for(let s=e;s<n;s++)r[s]=t.readFloat();else for(let s=e;s<n;s++)r[s]=t.readFloat()*i;if(!a)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(u.setFrame(e,f,r),e==h)break;let l=t.readFloat();switch(t.readByte()){case vs:u.setStepped(e);break;case ks:We(t,u,s++,e,0,f,l,0,1,1)}f=l}r.push(u);break}case hs:{let e=new Bt(l,s,n);for(let s=0;s<l;s++){let r=t.readFloat(),i=t.readInt32();e.setFrame(s,r,z[15&i],i>>4,t.readFloat())}r.push(e);break}}}}}let a=t.readInt(!0);if(a>0){let e=new bt(a),i=s.slots.length;for(let s=0;s<a;s++){let r=t.readFloat(),a=t.readInt(!0),n=P.newArray(i,0);for(let t=i-1;t>=0;t--)n[t]=-1;let o=P.newArray(i-a,0),l=0,h=0;for(let e=0;e<a;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;n[l+t.readInt(!0)]=l++}for(;l<i;)o[h++]=l++;for(let t=i-1;t>=0;t--)-1==n[t]&&(n[t]=o[--h]);e.setFrame(s,r,n)}r.push(e)}let n=t.readInt(!0);if(n>0){let e=new wt(n);for(let r=0;r<n;r++){let i=t.readFloat(),a=s.events[t.readInt(!0)],n=new ke(i,a);n.intValue=t.readInt(!1),n.floatValue=t.readFloat(),n.stringValue=t.readString(),null==n.stringValue&&(n.stringValue=a.stringValue),n.data.audioPath&&(n.volume=t.readFloat(),n.balance=t.readFloat()),e.setFrame(r,n)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new G(e,r,o)}}class Oe{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class Ne{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}class Le{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function qe(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let a=0,n=0,o=e.getFrameCount()-1;e.setFrame(a,r,i),a!=o;a++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case vs:e.setStepped(a);break;case ks:We(t,e,n++,a,0,r,o,i,l,s)}r=o,i=l}return e}function Ue(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,a=t.readFloat()*s;for(let n=0,o=0,l=e.getFrameCount()-1;e.setFrame(n,r,i,a),n!=l;n++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case vs:e.setStepped(n);break;case ks:We(t,e,o++,n,0,r,l,i,h,s),We(t,e,o++,n,1,r,l,a,c,s)}r=l,i=h,a=c}return e}function We(t,e,s,r,i,a,n,o,l,h){e.setBezier(s,r,i,a,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,n,l)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(ae||(ae={}));const ze=0,Ge=1,$e=2,je=3,He=4,Je=5,Ze=6,Ke=7,Qe=8,ts=9,es=10,ss=0,rs=1,is=2,as=3,ns=4,os=5,ls=0,hs=1,cs=0,ds=1,us=2,fs=0,ms=1,gs=2,ps=4,xs=5,ws=6,bs=7,ys=8,vs=1,ks=2;class Ss{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new V((()=>P.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,a=t.slots,n=a.length;s.length=0,i.freeAll(r),r.length=0;for(let t=0;t<n;t++){let e=a[t];if(!e.bone.active)continue;let n=e.getAttachment();if(n instanceof jt){let t=n;s.push(t);let a=i.obtain();a.length!=t.worldVerticesLength&&(a=P.newFloatArray(t.worldVerticesLength)),r.push(a),t.computeWorldVertices(e,0,t.worldVerticesLength,a,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let a=0,n=i.length;a<n;a++){let n=i[a],o=n;for(let i=0,a=n.length;i<a;i+=2){let a=o[i],n=o[i+1];t=Math.min(t,a),e=Math.min(e,n),s=Math.max(s,a),r=Math.max(r,n)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,a=this.minY,n=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=a&&r<=a||t>=n&&s>=n||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(i-t)+e;if(h>a&&h<o)return!0;if(h=l*(n-t)+e,h>a&&h<o)return!0;let c=(a-e)/l+t;return c>i&&c<n||(c=(o-e)/l+t,c>i&&c<n)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,a=i-2,n=!1;for(let t=0;t<i;t+=2){let i=r[t+1],o=r[a+1];if(i<s&&o>=s||o<s&&i>=s){let l=r[t];l+(s-i)/(o-i)*(r[a]-l)<e&&(n=!n)}a=t}return n}intersectsSegment(t,e,s,r){let i=this.polygons;for(let a=0,n=i.length;a<n;a++)if(this.intersectsSegmentPolygon(i[a],t,e,s,r))return this.boundingBoxes[a];return null}intersectsSegmentPolygon(t,e,s,r,i){let a=t,n=t.length,o=e-r,l=s-i,h=e*i-s*r,c=a[n-2],d=a[n-1];for(let t=0;t<n;t+=2){let n=a[t],u=a[t+1],f=c*u-d*n,m=c-n,g=d-u,p=o*g-l*m,x=(h*m-o*f)/p;if((x>=c&&x<=n||x>=n&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*g-l*f)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=n,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class Is{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new V((()=>new Array));polygonIndicesPool=new V((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,a=s;t<a;++t)i[t]=Is.isConcave(t,s,e,r);let a=this.triangles;for(a.length=0;s>3;){let t=s-1,n=0,o=1;for(;;){t:if(!i[n]){let a=r[t]<<1,l=r[n]<<1,h=r[o]<<1,c=e[a],d=e[a+1],u=e[l],f=e[l+1],m=e[h],g=e[h+1];for(let a=(o+1)%s;a!=t;a=(a+1)%s){if(!i[a])continue;let t=r[a]<<1,s=e[t],n=e[t+1];if(Is.positiveArea(m,g,c,d,s,n)&&Is.positiveArea(c,d,u,f,s,n)&&Is.positiveArea(u,f,m,g,s,n))break t}break}if(0==o){do{if(!i[n])break;n--}while(n>0);break}t=n,n=o,o=(o+1)%s}a.push(r[(s+n-1)%s]),a.push(r[n]),a.push(r[(n+1)%s]),r.splice(n,1),i.splice(n,1),s--;let l=(s+n-1)%s,h=n==s?0:n;i[l]=Is.isConcave(l,s,e,r),i[h]=Is.isConcave(h,s,e,r)}return 3==s&&(a.push(r[2]),a.push(r[0]),a.push(r[1])),a}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let n=this.polygonPool.obtain();n.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],f=s[h+1],m=s[c],g=s[c+1],p=s[d],x=s[d+1],w=!1;if(o==h){let t=n.length-4,e=Is.winding(n[t],n[t+1],n[t+2],n[t+3],p,x),s=Is.winding(p,x,n[0],n[1],n[2],n[3]);e==l&&s==l&&(n.push(p),n.push(x),a.push(d),w=!0)}w||(n.length>0?(r.push(n),i.push(a)):(this.polygonPool.free(n),this.polygonIndicesPool.free(a)),n=this.polygonPool.obtain(),n.length=0,n.push(u),n.push(f),n.push(m),n.push(g),n.push(p),n.push(x),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(h),a.push(c),a.push(d),l=Is.winding(u,f,m,g,p,x),o=h)}n.length>0&&(r.push(n),i.push(a));for(let t=0,e=r.length;t<e;t++){if(a=i[t],0==a.length)continue;let s=a[0],o=a[a.length-1];n=r[t];let l=n.length-4,h=n[l],c=n[l+1],d=n[l+2],u=n[l+3],f=n[0],m=n[1],g=n[2],p=n[3],x=Is.winding(h,c,d,u,f,m);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],v=r[l],k=v[v.length-2],S=v[v.length-1];if(w!=s||b!=o)continue;let I=Is.winding(h,c,d,u,k,S),A=Is.winding(k,S,f,m,g,p);I==x&&A==x&&(v.length=0,e.length=0,n.push(k),n.push(S),a.push(y),h=d,c=u,d=k,u=S,l=0)}}for(let t=r.length-1;t>=0;t--)n=r[t],0==n.length&&(r.splice(t,1),this.polygonPool.free(n),a=i[t],i.splice(t,1),this.polygonIndicesPool.free(a));return r}static isConcave(t,e,s,r){let i=r[(e+t-1)%e]<<1,a=r[t]<<1,n=r[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[a],s[a+1],s[n],s[n+1])}static positiveArea(t,e,s,r,i,a){return t*(a-r)+s*(e-a)+i*(r-e)>=0}static winding(t,e,s,r,i,a){let n=s-t,o=r-e;return i*o-a*n+n*e-t*o>=0?1:-1}}class As{triangulator=new Is;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,r=P.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let i=this.clippingPolygon;As.makeClockwise(i);let a=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=a.length;t<e;t++){let e=a[t];As.makeClockwise(e),e.push(e[0]),e.push(e[1])}return a.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,r,i,a,n){r&&i&&a&&"boolean"==typeof n?this.clipTrianglesRender(t,e,s,r,i,a,n):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){let r=this.clipOutput,i=this.clippedVertices,a=this.clippedTriangles,n=this.clippingPolygons,o=n.length,l=0;i.length=0,a.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],f=t[s+1];s=e[h+2]<<1;let m=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(c,d,u,f,m,g,n[t],r)){let t=P.setArraySize(i,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=f,t[e+4]=m,t[e+5]=g,e=a.length;let s=P.setArraySize(a,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,n=this.clipOutput,o=P.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=n[s],r=n[s+1];o[e]=t,o[e+1]=r}e=a.length;let h=P.setArraySize(a,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,r,i,a,n){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=n?12:8,f=0;l.length=0,h.length=0;for(let m=0;m<s;m+=3){let s=e[m]<<1,g=t[s],p=t[s+1],x=r[s],w=r[s+1];s=e[m+1]<<1;let b=t[s],y=t[s+1],v=r[s],k=r[s+1];s=e[m+2]<<1;let S=t[s],I=t[s+1],A=r[s],M=r[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(g,p,b,y,S,I,c[t],o)){let t=P.setArraySize(l,e+3*u);t[e]=g,t[e+1]=p,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,n?(t[e+6]=x,t[e+7]=w,t[e+8]=a.r,t[e+9]=a.g,t[e+10]=a.b,t[e+11]=a.a,t[e+12]=b,t[e+13]=y,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=v,t[e+19]=k,t[e+20]=a.r,t[e+21]=a.g,t[e+22]=a.b,t[e+23]=a.a,t[e+24]=S,t[e+25]=I,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=A,t[e+31]=M,t[e+32]=a.r,t[e+33]=a.g,t[e+34]=a.b,t[e+35]=a.a):(t[e+6]=x,t[e+7]=w,t[e+8]=b,t[e+9]=y,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=v,t[e+15]=k,t[e+16]=S,t[e+17]=I,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=A,t[e+23]=M),e=h.length;let s=P.setArraySize(h,e+3);s[e]=f,s[e+1]=f+1,s[e+2]=f+2,f+=3;break}{let t=o.length;if(0==t)continue;let s=y-I,r=S-b,c=g-S,d=I-p,m=1/(s*c+r*(p-I)),C=t>>1,F=this.clipOutput,T=P.setArraySize(l,e+C*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];T[e]=t,T[e+1]=l,T[e+2]=i.r,T[e+3]=i.g,T[e+4]=i.b,T[e+5]=i.a;let h=t-S,u=l-I,f=(s*h+r*u)*m,g=(d*h+c*u)*m,p=1-f-g;T[e+6]=x*f+v*g+A*p,T[e+7]=w*f+k*g+M*p,n&&(T[e+8]=a.r,T[e+9]=a.g,T[e+10]=a.b,T[e+11]=a.a)}e=h.length;let Y=P.setArraySize(h,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)Y[e]=f,Y[e+1]=f+t,Y[e+2]=f+t+1;f+=C+1}}}}clip(t,e,s,r,i,a,n,o){let l,h=o,c=!1;n.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(r),l.push(i),l.push(a),l.push(t),l.push(e),o.length=0;let d=n.length-4,u=n;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],i=s-u[t+3],a=o.length,n=l;for(let t=0,a=l.length-2;t<a;){let a=n[t],l=n[t+1];t+=2;let h=n[t],d=n[t+1],u=i*(e-h)>r*(s-d),f=i*(e-a)-r*(s-l);if(f>0){if(u){o.push(h),o.push(d);continue}let t=h-a,e=d-l,s=f/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s)}else if(u){let t=h-a,e=d-l,s=f/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(a==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let f=o;(o=l).length=0,l=f}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,r=e[s-2]*e[1]-e[0]*e[s-1],i=0,a=0,n=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],a=e[t+1],n=e[t+2],o=e[t+3],r+=i*o-n*a;if(!(r<0))for(let t=0,r=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],a=r-t;e[t]=e[a],e[t+1]=e[a+1],e[a]=s,e[a+1]=i}}}class Ms{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Xe,r="string"==typeof t?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=Es(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let i=r.bones[t],a=null,n=Es(i,"parent",null);n&&(a=s.findBone(n));let o=new xe(s.bones.length,i.name,a);o.length=Es(i,"length",0)*e,o.x=Es(i,"x",0)*e,o.y=Es(i,"y",0)*e,o.rotation=Es(i,"rotation",0),o.scaleX=Es(i,"scaleX",1),o.scaleY=Es(i,"scaleY",1),o.shearX=Es(i,"shearX",0),o.shearY=Es(i,"shearY",0),o.inherit=P.enumValue(Qt,Es(i,"inherit","Normal")),o.skinRequired=Es(i,"skin",!1);let l=Es(i,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],i=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${i}`);let n=new _e(s.slots.length,i,a),o=Es(e,"color",null);o&&n.color.setFromString(o);let l=Es(e,"dark",null);l&&(n.darkColor=Y.fromString(l)),n.attachmentName=Es(e,"attachment",null),n.blendMode=P.enumValue(ie,Es(e,"blend","normal")),n.visible=Es(e,"visible",!0),s.slots.push(n)}if(r.ik)for(let t=0;t<r.ik.length;t++){let i=r.ik[t],a=new Ae(i.name);a.order=Es(i,"order",0),a.skinRequired=Es(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);a.bones.push(e)}let n=s.findBone(i.target);if(!n)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);a.target=n,a.mix=Es(i,"mix",1),a.softness=Es(i,"softness",0)*e,a.bendDirection=Es(i,"bendPositive",!0)?1:-1,a.compress=Es(i,"compress",!1),a.stretch=Es(i,"stretch",!1),a.uniform=Es(i,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let t=0;t<r.transform.length;t++){let i=r.transform[t],a=new Ve(i.name);a.order=Es(i,"order",0),a.skinRequired=Es(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);a.bones.push(r)}let n=i.target,o=s.findBone(n);if(!o)throw new Error(`Couldn't find target bone ${n} for transform constraint ${i.name}.`);a.target=o,a.local=Es(i,"local",!1),a.relative=Es(i,"relative",!1),a.offsetRotation=Es(i,"rotation",0),a.offsetX=Es(i,"x",0)*e,a.offsetY=Es(i,"y",0)*e,a.offsetScaleX=Es(i,"scaleX",0),a.offsetScaleY=Es(i,"scaleY",0),a.offsetShearY=Es(i,"shearY",0),a.mixRotate=Es(i,"mixRotate",1),a.mixX=Es(i,"mixX",1),a.mixY=Es(i,"mixY",a.mixX),a.mixScaleX=Es(i,"mixScaleX",1),a.mixScaleY=Es(i,"mixScaleY",a.mixScaleX),a.mixShearY=Es(i,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let t=0;t<r.path.length;t++){let i=r.path[t],a=new Me(i.name);a.order=Es(i,"order",0),a.skinRequired=Es(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);a.bones.push(r)}let n=i.target,o=s.findSlot(n);if(!o)throw new Error(`Couldn't find target slot ${n} for path constraint ${i.name}.`);a.target=o,a.positionMode=P.enumValue(te,Es(i,"positionMode","Percent")),a.spacingMode=P.enumValue(ee,Es(i,"spacingMode","Length")),a.rotateMode=P.enumValue(se,Es(i,"rotateMode","Tangent")),a.offsetRotation=Es(i,"rotation",0),a.position=Es(i,"position",0),a.positionMode==te.Fixed&&(a.position*=e),a.spacing=Es(i,"spacing",0),a.spacingMode!=ee.Length&&a.spacingMode!=ee.Fixed||(a.spacing*=e),a.mixRotate=Es(i,"mixRotate",1),a.mixX=Es(i,"mixX",1),a.mixY=Es(i,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let t=0;t<r.physics.length;t++){const i=r.physics[t],a=new Re(i.name);a.order=Es(i,"order",0),a.skinRequired=Es(i,"skin",!1);const n=i.bone,o=s.findBone(n);if(null==o)throw new Error("Physics bone not found: "+n);a.bone=o,a.x=Es(i,"x",0),a.y=Es(i,"y",0),a.rotate=Es(i,"rotate",0),a.scaleX=Es(i,"scaleX",0),a.shearX=Es(i,"shearX",0),a.limit=Es(i,"limit",5e3)*e,a.step=1/Es(i,"fps",60),a.inertia=Es(i,"inertia",1),a.strength=Es(i,"strength",100),a.damping=Es(i,"damping",1),a.massInverse=1/Es(i,"mass",1),a.wind=Es(i,"wind",0),a.gravity=Es(i,"gravity",0),a.mix=Es(i,"mix",1),a.inertiaGlobal=Es(i,"inertiaGlobal",!1),a.strengthGlobal=Es(i,"strengthGlobal",!1),a.dampingGlobal=Es(i,"dampingGlobal",!1),a.massGlobal=Es(i,"massGlobal",!1),a.windGlobal=Es(i,"windGlobal",!1),a.gravityGlobal=Es(i,"gravityGlobal",!1),a.mixGlobal=Es(i,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],i=new Pe(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],a=s.findBone(r);if(!a)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);i.bones.push(a)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],a=s.findIkConstraint(r);if(!a)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);i.constraints.push(a)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],a=s.findTransformConstraint(r);if(!a)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);i.constraints.push(a)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],a=s.findPathConstraint(r);if(!a)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);i.constraints.push(a)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],a=s.findPhysicsConstraint(r);if(!a)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);i.constraints.push(a)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let a=e.attachments[t];for(let t in a){let e=this.readAttachment(a[t],i,r.index,t,s);e&&i.setAttachment(r.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],i=new Se(t);i.intValue=Es(e,"int",0),i.floatValue=Es(e,"float",0),i.stringValue=Es(e,"string",""),i.audioPath=Es(e,"audio",null),i.audioPath&&(i.volume=Es(e,"volume",1),i.balance=Es(e,"balance",0)),s.events.push(i)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,i){let a=this.scale;switch(r=Es(t,"name",r),Es(t,"type","region")){case"region":{let s=Es(t,"path",r),i=this.readSequence(Es(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,r,s,i);if(!n)return null;n.path=s,n.x=Es(t,"x",0)*a,n.y=Es(t,"y",0)*a,n.scaleX=Es(t,"scaleX",1),n.scaleY=Es(t,"scaleY",1),n.rotation=Es(t,"rotation",0),n.width=t.width*a,n.height=t.height*a,n.sequence=i;let o=Es(t,"color",null);return o&&n.color.setFromString(o),null!=n.region&&n.updateRegion(),n}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Es(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Es(t,"path",r),n=this.readSequence(Es(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,i,n);if(!o)return null;o.path=i;let l=Es(t,"color",null);l&&o.color.setFromString(l),o.width=Es(t,"width",0)*a,o.height=Es(t,"height",0)*a,o.sequence=n;let h=Es(t,"parent",null);if(h)return this.linkedMeshes.push(new Cs(o,Es(t,"skin",null),s,h,Es(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Es(t,"edges",null),o.hullLength=2*Es(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Es(t,"closed",!1),s.constantSpeed=Es(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let n=P.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)n[e]=t.lengths[e]*a;s.lengths=n;let o=Es(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Es(t,"x",0)*a,s.y=Es(t,"y",0)*a,s.rotation=Es(t,"rotation",0);let i=Es(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let a=Es(t,"end",null);a&&(s.endSlot=i.findSlot(a));let n=t.vertexCount;this.readVertices(t,s,n<<1);let o=Es(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new U(Es(t,"count",0));return e.start=Es(t,"start",1),e.digits=Es(t,"digits",0),e.setupIndex=Es(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=P.toFloatArray(i);if(1!=r)for(let e=0,s=i.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let a=new Array,n=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];n.push(e);for(let s=t+4*e;t<s;t+=4)n.push(i[t]),a.push(i[t+1]*r),a.push(i[t+2]*r),a.push(i[t+3])}e.bones=n,e.vertices=P.toFloatArray(a)}readAnimation(t,e,s){let r=this.scale,i=new Array;if(t.slots)for(let e in t.slots){let r=t.slots[e],a=s.findSlot(e);if(!a)throw new Error("Slot not found: "+e);let n=a.index;for(let t in r){let e=r[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new pt(s,n);for(let r=0;r<s;r++){let s=e[r];t.setFrame(r,Es(s,"time",0),Es(s,"name",null))}i.push(t)}else if("rgba"==t){let t=new dt(s,s<<2,n),r=e[0],a=Es(r,"time",0),o=Y.fromString(r.color);for(let s=0,i=0;;s++){t.setFrame(s,a,o.r,o.g,o.b,o.a);let n=e[s+1];if(!n){t.shrink(i);break}let l=Es(n,"time",0),h=Y.fromString(n.color),c=r.curve;c&&(i=Ys(c,t,i,s,0,a,l,o.r,h.r,1),i=Ys(c,t,i,s,1,a,l,o.g,h.g,1),i=Ys(c,t,i,s,2,a,l,o.b,h.b,1),i=Ys(c,t,i,s,3,a,l,o.a,h.a,1)),a=l,o=h,r=n}i.push(t)}else if("rgb"==t){let t=new ut(s,3*s,n),r=e[0],a=Es(r,"time",0),o=Y.fromString(r.color);for(let s=0,i=0;;s++){t.setFrame(s,a,o.r,o.g,o.b);let n=e[s+1];if(!n){t.shrink(i);break}let l=Es(n,"time",0),h=Y.fromString(n.color),c=r.curve;c&&(i=Ys(c,t,i,s,0,a,l,o.r,h.r,1),i=Ys(c,t,i,s,1,a,l,o.g,h.g,1),i=Ys(c,t,i,s,2,a,l,o.b,h.b,1)),a=l,o=h,r=n}i.push(t)}else if("alpha"==t)i.push(Fs(e,new ft(s,s,n),0,1));else if("rgba2"==t){let t=new mt(s,7*s,n),r=e[0],a=Es(r,"time",0),o=Y.fromString(r.light),l=Y.fromString(r.dark);for(let s=0,i=0;;s++){t.setFrame(s,a,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let n=e[s+1];if(!n){t.shrink(i);break}let h=Es(n,"time",0),c=Y.fromString(n.light),d=Y.fromString(n.dark),u=r.curve;u&&(i=Ys(u,t,i,s,0,a,h,o.r,c.r,1),i=Ys(u,t,i,s,1,a,h,o.g,c.g,1),i=Ys(u,t,i,s,2,a,h,o.b,c.b,1),i=Ys(u,t,i,s,3,a,h,o.a,c.a,1),i=Ys(u,t,i,s,4,a,h,l.r,d.r,1),i=Ys(u,t,i,s,5,a,h,l.g,d.g,1),i=Ys(u,t,i,s,6,a,h,l.b,d.b,1)),a=h,o=c,l=d,r=n}i.push(t)}else if("rgb2"==t){let t=new gt(s,6*s,n),r=e[0],a=Es(r,"time",0),o=Y.fromString(r.light),l=Y.fromString(r.dark);for(let s=0,i=0;;s++){t.setFrame(s,a,o.r,o.g,o.b,l.r,l.g,l.b);let n=e[s+1];if(!n){t.shrink(i);break}let h=Es(n,"time",0),c=Y.fromString(n.light),d=Y.fromString(n.dark),u=r.curve;u&&(i=Ys(u,t,i,s,0,a,h,o.r,c.r,1),i=Ys(u,t,i,s,1,a,h,o.g,c.g,1),i=Ys(u,t,i,s,2,a,h,o.b,c.b,1),i=Ys(u,t,i,s,3,a,h,l.r,d.r,1),i=Ys(u,t,i,s,4,a,h,l.g,d.g,1),i=Ys(u,t,i,s,5,a,h,l.b,d.b,1)),a=h,o=c,l=d,r=n}i.push(t)}}}if(t.bones)for(let e in t.bones){let a=t.bones[e],n=s.findBone(e);if(!n)throw new Error("Bone not found: "+e);let o=n.index;for(let t in a){let e=a[t],s=e.length;if(0!=s)if("rotate"===t)i.push(Fs(e,new tt(s,s,o),0,1));else if("translate"===t){let t=new et(s,s<<1,o);i.push(Ts(e,t,"x","y",0,r))}else if("translatex"===t){let t=new st(s,s,o);i.push(Fs(e,t,0,r))}else if("translatey"===t){let t=new rt(s,s,o);i.push(Fs(e,t,0,r))}else if("scale"===t){let t=new it(s,s<<1,o);i.push(Ts(e,t,"x","y",1,1))}else if("scalex"===t){let t=new at(s,s,o);i.push(Fs(e,t,1,1))}else if("scaley"===t){let t=new nt(s,s,o);i.push(Fs(e,t,1,1))}else if("shear"===t){let t=new ot(s,s<<1,o);i.push(Ts(e,t,"x","y",0,1))}else if("shearx"===t){let t=new lt(s,s,o);i.push(Fs(e,t,0,1))}else if("sheary"===t){let t=new ht(s,s,o);i.push(Fs(e,t,0,1))}else if("inherit"===t){let t=new ct(s,n.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Es(r,"time",0),P.enumValue(Qt,Es(r,"inherit","Normal")))}i.push(t)}}}if(t.ik)for(let e in t.ik){let a=t.ik[e],n=a[0];if(!n)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new yt(a.length,a.length<<1,l),c=Es(n,"time",0),d=Es(n,"mix",1),u=Es(n,"softness",0)*r;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Es(n,"bendPositive",!0)?1:-1,Es(n,"compress",!1),Es(n,"stretch",!1));let s=a[t+1];if(!s){h.shrink(e);break}let i=Es(s,"time",0),o=Es(s,"mix",1),l=Es(s,"softness",0)*r,f=n.curve;f&&(e=Ys(f,h,e,t,0,c,i,d,o,1),e=Ys(f,h,e,t,1,c,i,u,l,r)),c=i,d=o,u=l,n=s}i.push(h)}if(t.transform)for(let e in t.transform){let r=t.transform[e],a=r[0];if(!a)continue;let n=s.findTransformConstraint(e);if(!n)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(n),l=new vt(r.length,6*r.length,o),h=Es(a,"time",0),c=Es(a,"mixRotate",1),d=Es(a,"mixX",1),u=Es(a,"mixY",d),f=Es(a,"mixScaleX",1),m=Es(a,"mixScaleY",f),g=Es(a,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,f,m,g);let s=r[t+1];if(!s){l.shrink(e);break}let i=Es(s,"time",0),n=Es(s,"mixRotate",1),o=Es(s,"mixX",1),p=Es(s,"mixY",o),x=Es(s,"mixScaleX",1),w=Es(s,"mixScaleY",x),b=Es(s,"mixShearY",1),y=a.curve;y&&(e=Ys(y,l,e,t,0,h,i,c,n,1),e=Ys(y,l,e,t,1,h,i,d,o,1),e=Ys(y,l,e,t,2,h,i,u,p,1),e=Ys(y,l,e,t,3,h,i,f,x,1),e=Ys(y,l,e,t,4,h,i,m,w,1),e=Ys(y,l,e,t,5,h,i,g,b,1)),h=i,c=n,d=o,u=p,f=x,m=w,f=x,a=s}i.push(l)}if(t.path)for(let e in t.path){let a=t.path[e],n=s.findPathConstraint(e);if(!n)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(n);for(let t in a){let e=a[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new kt(l,l,o);i.push(Fs(e,t,0,n.positionMode==te.Fixed?r:1))}else if("spacing"===t){let t=new St(l,l,o);i.push(Fs(e,t,0,n.spacingMode==ee.Length||n.spacingMode==ee.Fixed?r:1))}else if("mix"===t){let t=new It(l,3*l,o),r=Es(s,"time",0),a=Es(s,"mixRotate",1),n=Es(s,"mixX",1),h=Es(s,"mixY",n);for(let i=0,o=0;;i++){t.setFrame(i,r,a,n,h);let l=e[i+1];if(!l){t.shrink(o);break}let c=Es(l,"time",0),d=Es(l,"mixRotate",1),u=Es(l,"mixX",1),f=Es(l,"mixY",u),m=s.curve;m&&(o=Ys(m,t,o,i,0,r,c,a,d,1),o=Ys(m,t,o,i,1,r,c,n,u,1),o=Ys(m,t,o,i,2,r,c,h,f,1)),r=c,a=d,n=u,h=f,s=l}i.push(t)}}}if(t.physics)for(let e in t.physics){let r=t.physics[e],a=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);a=s.physicsConstraints.indexOf(t)}for(let t in r){let e=r[t],s=e[0];if(!s)continue;let n,o=e.length;if("reset"!=t){if("inertia"==t)n=new Mt(o,o,a);else if("strength"==t)n=new Ct(o,o,a);else if("damping"==t)n=new Ft(o,o,a);else if("mass"==t)n=new Tt(o,o,a);else if("wind"==t)n=new Yt(o,o,a);else if("gravity"==t)n=new Et(o,o,a);else{if("mix"!=t)continue;n=new Rt(o,o,a)}i.push(Fs(e,n,0,1))}else{const t=new Xt(o,a);for(let r=0;null!=s;s=e[r+1],r++)t.setFrame(r,Es(s,"time",0));i.push(t)}}}if(t.attachments)for(let e in t.attachments){let a=t.attachments[e],n=s.findSkin(e);if(!n)throw new Error("Skin not found: "+e);for(let t in a){let e=a[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],a=n.getAttachment(l,t);for(let t in s){let e=s[t],n=e[0];if(n)if("deform"==t){let t=a.bones,s=a.vertices,o=t?s.length/3*2:s.length,h=new xt(e.length,e.length,l,a),c=Es(n,"time",0);for(let i=0,a=0;;i++){let l,d=Es(n,"vertices",null);if(d){l=P.newFloatArray(o);let e=Es(n,"offset",0);if(P.arrayCopy(d,0,l,e,d.length),1!=r)for(let t=e,s=t+d.length;t<s;t++)l[t]*=r;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?P.newFloatArray(o):s;h.setFrame(i,c,l);let u=e[i+1];if(!u){h.shrink(a);break}let f=Es(u,"time",0),m=n.curve;m&&(a=Ys(m,h,a,i,0,c,f,0,1,1)),c=f,n=u}i.push(h)}else if("sequence"==t){let t=new Bt(e.length,l,a),s=0;for(let r=0;r<e.length;r++){let i=Es(n,"delay",s),a=Es(n,"time",0),o=W[Es(n,"mode","hold")],l=Es(n,"index",0);t.setFrame(r,a,o,l,i),s=i,n=e[r+1]}i.push(t)}}}}}if(t.drawOrder){let e=new bt(t.drawOrder.length),r=s.slots.length,a=0;for(let i=0;i<t.drawOrder.length;i++,a++){let n=t.drawOrder[i],o=null,l=Es(n,"offsets",null);if(l){o=P.newArray(r,-1);let t=P.newArray(r-l.length,0),e=0,i=0;for(let r=0;r<l.length;r++){let a=l[r],n=s.findSlot(a.slot);if(!n)throw new Error("Slot not found: "+n);let h=n.index;for(;e!=h;)t[i++]=e++;o[e+a.offset]=e++}for(;e<r;)t[i++]=e++;for(let e=r-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}e.setFrame(a,Es(n,"time",0),o)}i.push(e)}if(t.events){let e=new wt(t.events.length),r=0;for(let i=0;i<t.events.length;i++,r++){let a=t.events[i],n=s.findEvent(a.name);if(!n)throw new Error("Event not found: "+a.name);let o=new ke(P.toSinglePrecision(Es(a,"time",0)),n);o.intValue=Es(a,"int",n.intValue),o.floatValue=Es(a,"float",n.floatValue),o.stringValue=Es(a,"string",n.stringValue),o.data.audioPath&&(o.volume=Es(a,"volume",1),o.balance=Es(a,"balance",0)),e.setFrame(r,o)}i.push(e)}let a=0;for(let t=0,e=i.length;t<e;t++)a=Math.max(a,i[t].getDuration());s.animations.push(new G(e,i,a))}}class Cs{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}function Fs(t,e,s,r){let i=t[0],a=Es(i,"time",0),n=Es(i,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,a,n);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Es(h,"time",0),d=Es(h,"value",s)*r;i.curve&&(o=Ys(i.curve,e,o,l,0,a,c,n,d,r)),a=c,n=d,i=h}}function Ts(t,e,s,r,i,a){let n=t[0],o=Es(n,"time",0),l=Es(n,s,i)*a,h=Es(n,r,i)*a,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let f=Es(u,"time",0),m=Es(u,s,i)*a,g=Es(u,r,i)*a,p=n.curve;p&&(c=Ys(p,e,c,d,0,o,f,l,m,a),c=Ys(p,e,c,d,1,o,f,h,g,a)),o=f,l=m,h=g,n=u}}function Ys(t,e,s,r,i,a,n,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=i<<2,d=t[c],u=t[c+1]*h,f=t[c+2],m=t[c+3]*h;return e.setBezier(s,r,i,a,o,d,u,f,m,n,l),s+1}function Es(t,e,s){return void 0!==t[e]?t[e]:s}var Rs,Xs;function Bs(t){return s(t,{type:"text"})}function Ps(t){return s(t,{type:"arraybuffer"})}function _s(e,s,r=t.Texture2D){return s.resourceManager.load({url:e,type:r})}async function Vs(t,e){const s=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let r,i;const a={};try{r=await Bs(t)}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}const n=new le(r),o=[];for(let t of n.pages){const r=s+t.name;o.push(_s(r,e))}try{i=await Promise.all(o)}catch(e){throw new Error(`Spine Texture: ${t} load error: ${e}`)}for(let t=0;t<i.length;t+=1){const e=i[t];a[s+e.name]=e}for(let t of n.pages){const e=Os(a[s+t.name]);t.setTexture(e)}return n}function Ds(t,e){const s=new le(t);for(let t of s.pages){const s=Os(e[t.name]);t.setTexture(s)}return s}function Os(t){return new Ns(new Image,t)}void 0===Math.fround&&(Math.fround=(Rs=new Float32Array(1),function(t){return Rs[0]=t,Rs[0]}));class Ns extends Jt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,e){t===Zt.Nearest?this.texture.filterMode=r.Point:e===Zt.MipMapLinearLinear?this.texture.filterMode=r.Trilinear:this.texture.filterMode=r.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case Kt.ClampToEdge:return i.Clamp;case Kt.Repeat:return i.Repeat;case Kt.MirroredRepeat:return i.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}function Ls(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}class qs extends a{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}load(s,r){return new e(((i,a)=>{let n={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]},{fileExtensions:o}=s.params||{};if(s.urls){o=Ws(o,!0);for(let t=0;t<s.urls.length;t+=1){Us(s.urls[t],o&&o[t]||null,n)}}else{const t=Ws(o,!1);!function(t,e,s){const r=Ls(t,e);if(!r)return;s.skeletonPath=t,s.skeletonExtension=r;const i=/(\.(json|bin|skel))$/;let a;i.test(t)&&(a=t.replace(i,""));if(a){const t=a+".atlas";s.atlasPath=t}}(s.url,t,n)}const{skeletonPath:l,atlasPath:h}=n;l&&h?async function(s,r){const{skeletonPath:i,atlasPath:a,imagePaths:n,skeletonExtension:o,imageExtensions:l}=s,h="json"===o?Bs:Ps;let c,d;if(n.length>0){let s,o;const u=[h(i),Bs(a)],f=n.map(((e,s)=>{const i=l[s];let a=t.Texture2D;return"ktx"===i&&(a=t.KTX),"ktx2"===i&&(a=t.KTX2),_s(e,r,a)}));u.push(e.all(f));try{[c,s,o]=await Promise.all(u),d=new le(s);let t=0;for(let e of d.pages)if(o[t]){const s=Os(o[t]);e.setTexture(s),t++}}catch(t){throw t}}else try{[c,d]=await Promise.all([h(i),Vs(a,r)])}catch(t){throw t}const u=new pe(d);return"json"===o?new Ms(u).readSkeletonData(c):new De(u).readSkeletonData(new Uint8Array(c))}(n,r.engine).then((t=>{i(t)})).catch((t=>{a(t)})):a("Failed to load spine assets. Please check the file path and ensure the file extension is included.")}))}}function Us(t,e,s){const r=qs.imageExtensions,i=qs.skeletonExtensions,a=Ls(t,e);a&&(i.includes(a)&&(s.skeletonPath=t,s.skeletonExtension=a),"atlas"===a&&(s.atlasPath=t),r.includes(a)&&(s.imagePaths.push(t),s.imageExtensions.push(a)))}function Ws(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}qs=C([n("spine",["json","bin","skel"])],qs);class zs{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,r=t.length;s<r;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}}console.log("regist EditorSkeletonData loader");class Gs extends a{load(t,s){return new e((async e=>{let r,i;const a=await this.request(t.url,{type:"arraybuffer"}),n=new zs(new Uint8Array(a)),o=n.nextStr();if(o.startsWith("data")){const t=new TextDecoder("utf-8").decode(new Uint8Array(a)),{data:e,atlas:s}=JSON.parse(t);i=s.refId,r=e}else i=o,r=n.nextImageData();const l=await s.getResourceByRef({refId:i}),h=new pe(l);let c;c="string"==typeof r?new Ms(h).readSkeletonData(r):new De(h).readSkeletonData(new Uint8Array(r)),e(c)}))}}Gs=C([n("EditorSkeletonData",["json","skel"])],Gs),console.log("regist EditorSpineAtlas loader");class $s extends a{load(t,s){return new e((async e=>{const r=await this.request(t.url,{type:"text"}),{data:i,textures:a}=JSON.parse(r),n={},o=a.map((t=>s.getResourceByRef({refId:t.refId})));(await Promise.all(o)).forEach((t=>{n[t.name]=t}));e(Ds(i,n))}))}}$s=C([n("EditorSpineAtlas",["atlas"])],$s);class js{constructor(){this.topology=o.Triangles}}class Hs{get primitive(){return this._primitive}get subPrimitive(){return this._subPrimitive}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}initialize(t,e){const s=new l(t);this._primitive=s,s.addVertexElement(new h("POSITION",0,c.Vector3,0)),s.addVertexElement(new h("COLOR_0",12,c.Vector4,0)),s.addVertexElement(new h("TEXCOORD_0",28,c.Vector2,0));const r=4*Js.VERTEX_STRIDE,i=r*e,a=new d(t,u.VertexBuffer,i,f.Dynamic),n=new d(t,u.IndexBuffer,2*e,f.Dynamic);this._indexBuffer=n,this._vertexBuffer=a;const o=new m(a,r);s.setVertexBufferBinding(0,o);const x=new g(n,p.UInt16);s.setIndexBufferBinding(x);const w=new js;w.start=0,w.count=e,this.addSubPrimitive(w)}addSubPrimitive(t){this._subPrimitive.push(t)}clearSubPrimitive(){this._subPrimitive.length=0}changeBuffer(t,e){const s=4*Js.VERTEX_STRIDE,r=s*e,i=new d(t,u.VertexBuffer,r,f.Dynamic),a=new d(t,u.IndexBuffer,2*e,f.Dynamic),n=this._primitive;this._indexBuffer=a,this._vertexBuffer=i;const o=new m(i,s);n.setVertexBufferBinding(0,o);const l=new g(a,p.UInt16);n.setIndexBufferBinding(l)}constructor(){this._subPrimitive=[]}}class Js{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempColor=new Y}static{this.tempDark=new Y}static{this.tempBlendMode=null}static{this.tempTexture=null}get subRenderItems(){return this._subRenderItems}constructor(t,e){this._clipper=new As,this._spinePrimitive=new Hs,this._needResize=!1,this._subRenderItems=[],this.separateSlots=[],this.separateSlotTextureMap=new Map,this._engine=t,this._renderer=e}initialize(t,e){e&&(this._setting=e);const{defaultSkin:{attachments:s}}=t;let r=0;const i=Js.QUAD_TRIANGLES.length;for(let t=0,e=s.length;t<e;t++){const e=s[t];for(let t in e){const s=e[t];if(s)if(s instanceof ge)r+=i;else{if(!(s instanceof ue))continue;r+=s.triangles.length}}}this._vertexCount=r,this._prepareBufferData(this._vertexCount);const{_spinePrimitive:a}=this;a.initialize(this._engine,this._vertexCount),this._renderer._primitive=a.primitive}buildPrimitive(t){const{useClipping:e=!0,zSpacing:s=.01}=this._setting||{};let r=0,i=0;const a=t.drawOrder,n=a.length,{_clipper:o,_spinePrimitive:l}=this,h=this._subRenderItems;h.length=0;let c,d,u=this._vertices,f=0,m=0,g=ie.Normal,p=null;Js.tempBlendMode=null,Js.tempTexture=null;for(let t=0;t<n;++t){const n=a[t];if(!n.bone.active){o.clipEndWithSlot(n);continue}const l=n.getAttachment();let x=null;const w=s*t;let b=0;const y=o.isClipping();let v=y?2:Js.VERTEX_SIZE;if(l instanceof ge){let t=l;x=t.color,b=4*v,t.computeWorldVertices(n,u,0,v),c=Js.QUAD_TRIANGLES,d=t.uvs,p=t.region.texture}else if(l instanceof ue){let t=l;x=t.color,b=(t.worldVerticesLength>>1)*v,b>u.length&&(u=this._vertices=new Float32Array(b)),t.computeWorldVertices(n,0,t.worldVerticesLength,u,0,v),c=t.triangles,d=t.uvs,p=t.region.texture}else if(l instanceof Ht){if(e){let t=l;o.clipStart(n,t);continue}}else if(e){o.clipEndWithSlot(n);continue}if(null!=p){let t,e,s,a,l=n.bone.skeleton.color,k=n.color,S=l.a*k.a*x.a,I=Js.tempColor,A=Js.tempDark;if(I.set(l.r*k.r*x.r,l.g*k.g*x.g,l.b*k.b*x.b,S),y){o.clipTriangles(u,c,c.length,d,I,A,!1);let r=o.clippedVertices,i=o.clippedTriangles;t=r,e=r.length,s=i,a=i.length}else{let r=u;const{r:i,g:n,b:o,a:l}=I;for(let t=2,e=0,s=b;t<s;t+=v,e+=2)r[t]=i,r[t+1]=n,r[t+2]=o,r[t+3]=l,r[t+4]=d[e],r[t+5]=d[e+1];t=u,e=b,s=c,a=c.length}if(0==e||0==a){o.clipEndWithSlot(n);continue}let M=r/Js.VERTEX_STRIDE,C=this._verticesWithZ,F=r,T=0;for(;T<e;)C[F++]=t[T++],C[F++]=t[T++],C[F++]=w,C[F++]=t[T++],C[F++]=t[T++],C[F++]=t[T++],C[F++]=t[T++],C[F++]=t[T++],C[F++]=t[T++];r=F;let Y=this._indices;for(F=i,T=0;T<a;F++,T++)Y[F]=s[T]+M;i+=a;const E=n.data,R=E.name;g=E.blendMode;const X=null!==Js.tempBlendMode&&Js.tempBlendMode!==E.blendMode,B=null!==Js.tempTexture&&Js.tempTexture!==p,P=this.separateSlots.includes(R);if(P||X||B){if(m>0){const t=new js;t.start=f,t.count=m,h.push({subPrimitive:t,texture:Js.tempTexture,blendMode:Js.tempBlendMode}),f+=m,m=0}if(P){const t=this.separateSlotTextureMap.get(R);if(t){const e=p.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=new js;e.start=f,e.count=a,h.push({blendMode:g,subPrimitive:e,texture:p,slotName:R}),f+=a,m=0}else m+=a}else m+=a;Js.tempBlendMode=g,Js.tempTexture=p}o.clipEndWithSlot(n)}if(m>0){const t=new js;t.start=f,t.count=m,h.push({blendMode:g,subPrimitive:t,texture:p}),m=0}if(o.clipEnd(),h.sort(((t,e)=>t.subPrimitive.start-e.subPrimitive.start)),i>0&&i!==this._vertexCount&&i>this._vertexCount)return this._vertexCount=i,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);l.clearSubPrimitive();const x=this._renderer;for(let t=0,e=h.length;t<e;++t){const e=h[t],{slotName:s,blendMode:r,texture:i}=e;l.addSubPrimitive(e.subPrimitive);let a=x.getMaterial(t);a||(a=Ks.getDefaultMaterial(this._engine));let n=i.texture;this.separateSlotTextureMap.has(s)&&(n=this.separateSlotTextureMap.get(s)),a.shaderData.setTexture("material_SpineTexture",n),this.setBlendMode(a,r),x.setMaterial(t,a)}this._renderer._subPrimitives=l.subPrimitive,this._needResize&&(l.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),l.vertexBuffer.setData(this._verticesWithZ),l.indexBuffer.setData(this._indices)}addSeparateSlot(t){this.separateSlots.push(t)}addSeparateSlotTexture(t,e){this.separateSlotTextureMap.set(t,e)}_prepareBufferData(t){this._vertices=new Float32Array(t*Js.VERTEX_SIZE),this._verticesWithZ=new Float32Array(t*Js.VERTEX_STRIDE),this._indices=new Uint16Array(t)}setBlendMode(t,e){const s=t.renderState.blendState.targetBlendState;switch(e){case ie.Additive:s.sourceColorBlendFactor=x.SourceAlpha,s.destinationColorBlendFactor=x.One,s.sourceAlphaBlendFactor=x.One,s.destinationAlphaBlendFactor=x.One,s.colorBlendOperation=s.alphaBlendOperation=w.Add;break;case ie.Multiply:s.sourceColorBlendFactor=x.DestinationColor,s.destinationColorBlendFactor=x.Zero,s.sourceAlphaBlendFactor=x.One,s.destinationAlphaBlendFactor=x.Zero,s.colorBlendOperation=s.alphaBlendOperation=w.Add;break;case ie.Screen:s.sourceColorBlendFactor=x.One,s.destinationColorBlendFactor=x.OneMinusSourceColor,s.sourceAlphaBlendFactor=x.One,s.destinationAlphaBlendFactor=x.OneMinusSourceColor,s.colorBlendOperation=s.alphaBlendOperation=w.Add;break;default:s.sourceColorBlendFactor=x.SourceAlpha,s.destinationColorBlendFactor=x.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=x.One,s.destinationAlphaBlendFactor=x.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=w.Add}}}class Zs extends b{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,y.find("galacean-spine-shader")||y.create("galacean-spine-shader",Zs._spineVS,Zs._spineFS));const e=this.renderState,s=e.blendState.targetBlendState;s.enabled=!0,s.sourceColorBlendFactor=x.SourceAlpha,s.destinationColorBlendFactor=x.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=x.One,s.destinationAlphaBlendFactor=x.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=w.Add,e.depthState.writeEnabled=!1,e.rasterState.cullMode=v.Off,e.renderQueueType=k.Transparent}}class Ks extends S{static{this._uvMacro=I.getByName("RENDERER_HAS_UV")}static{this._enableVertexColorMacro=I.getByName("RENDERER_ENABLE_VERTEXCOLOR")}static{this._tempOffset=new D}static{this._tempSize=new D}static{this._tempArray=[0,0]}static getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new Zs(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}set skeletonData(t){if(!t)return this._skeleton=null,this._state=null,void(this._spineGenerator=null);this._skeleton=new Ee(t);const e=new $t(t);this._state=new Pt(e),this._spineGenerator.initialize(t,this.setting)}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.initialState={scale:1,loop:!1,animationName:null,skinName:"default"},this._spineGenerator=new Js(this.engine,this)}_onAwake(){console.log("on awake");const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:r,loop:i,scale:a}=this.initialState;t.scaleX=a,t.scaleY=a,"default"!==r&&(t.setSkinByName(r),t.setToSetupPose(),e.apply(t)),s&&e.setAnimation(0,s,i)}}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?this._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}update(t){if(!this._skeleton||!this._state)return;const e=this._state,s=this._skeleton;e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(re.update)}_updateRendererShaderData(t){super._updateRendererShaderData(t),this._skeleton&&this._spineGenerator.buildPrimitive(this._skeleton)}_render(t){const e=this._primitive,s=this._subPrimitives;if(2&this._dirtyUpdateFlag){const t=this.shaderData,s=e.vertexElements;t.disableMacro(Ks._uvMacro),t.disableMacro(Ks._enableVertexColorMacro);for(let e=0,r=s.length;e<r;e++)switch(s[e].attribute){case"TEXCOORD_0":t.enableMacro(Ks._uvMacro);break;case"COLOR_0":t.enableMacro(Ks._enableVertexColorMacro)}this._dirtyUpdateFlag&=-3}const{_materials:r,_engine:i}=this,a=i._renderElementPool.get();a.set(this.priority,this._distanceForSort);const n=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=r[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=n.get();o.set(this,i,e,s[t]),a.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,a)}}_updateBounds(t){const e=t,s=Ks._tempOffset,r=Ks._tempSize,i=Ks._tempArray,a=this.setting?.zSpacing||.01,n=this._skeleton;n.getBounds(s,r,i);const{x:o,y:l}=s;e.min.set(o,l,0),e.max.set(o+r.x,l+r.y,n.drawOrder.length*a),A.transform(e,this.entity.transform.worldMatrix,e)}_cloneTo(t,e,s){super._cloneTo(t,e,s),t.skeletonData=this.skeletonData;const r={...this.setting};t.setting=r}_onDestroy(){const t=this._primitive,e=this._subPrimitives;t&&(t.destroyed||this._addResourceReferCount(t,-1),this._primitive=null),e&&(this._subPrimitives.length=0),this.skeletonData=null,this._skeleton=null,this._spineGenerator=null,this.setting=null,super._onDestroy()}}C([M],Ks.prototype,"setting",void 0),C([M],Ks.prototype,"initialState",void 0),C([M],Ks.prototype,"_primitive",void 0),C([M],Ks.prototype,"_subPrimitives",void 0),C([M],Ks.prototype,"_skeleton",void 0),C([M],Ks.prototype,"_state",void 0),C([M],Ks.prototype,"_spineGenerator",void 0),function(t){t[t.VertexElementMacro=2]="VertexElementMacro"}(Xs||(Xs={}));const Qs="0.0.0-experimental-6d3110b4d9-20240531";console.log(`Galacean spine version: ${Qs}`);export{ft as AlphaTimeline,G as Animation,Pt as AnimationState,Ot as AnimationStateAdapter,$t as AnimationStateData,ye as AssetManagerBase,pe as AtlasAttachmentLoader,L as Attachment,pt as AttachmentTimeline,Oe as BinaryInput,ie as BlendMode,we as Bone,xe as BoneData,jt as BoundingBoxAttachment,Gt as CURRENT,Ht as ClippingAttachment,Y as Color,be as ConstraintData,Z as CurveTimeline,K as CurveTimeline1,Q as CurveTimeline2,_ as DebugUtils,xt as DeformTimeline,ve as Downloader,bt as DrawOrderTimeline,ke as Event,Se as EventData,Vt as EventQueue,wt as EventTimeline,Dt as EventType,Lt as FIRST,oe as FakeTexture,Ut as HOLD_FIRST,Wt as HOLD_MIX,qt as HOLD_SUBSEQUENT,Ie as IkConstraint,Ae as IkConstraintData,yt as IkConstraintTimeline,Qt as Inherit,ct as InheritTimeline,F as IntSet,R as Interpolation,E as MathUtils,ue as MeshAttachment,$ as MixBlend,j as MixDirection,fe as PathAttachment,Ce as PathConstraint,Me as PathConstraintData,It as PathConstraintMixTimeline,kt as PathConstraintPositionTimeline,St as PathConstraintSpacingTimeline,re as Physics,Ft as PhysicsConstraintDampingTimeline,Et as PhysicsConstraintGravityTimeline,Mt as PhysicsConstraintInertiaTimeline,Tt as PhysicsConstraintMassTimeline,Rt as PhysicsConstraintMixTimeline,Xt as PhysicsConstraintResetTimeline,Ct as PhysicsConstraintStrengthTimeline,At as PhysicsConstraintTimeline,Yt as PhysicsConstraintWindTimeline,me as PointAttachment,V as Pool,te as PositionMode,X as Pow,B as PowOut,gt as RGB2Timeline,mt as RGBA2Timeline,dt as RGBATimeline,ut as RGBTimeline,ge as RegionAttachment,se as RotateMode,tt as RotateTimeline,zt as SETUP,Nt as SUBSEQUENT,it as ScaleTimeline,at as ScaleXTimeline,nt as ScaleYTimeline,Bt as SequenceTimeline,ot as ShearTimeline,lt as ShearXTimeline,ht as ShearYTimeline,Ee as Skeleton,De as SkeletonBinary,Ss as SkeletonBounds,As as SkeletonClipping,Xe as SkeletonData,Ms as SkeletonJson,Pe as Skin,Be as SkinEntry,Te as Slot,_e as SlotData,ee as SpacingMode,Ks as SpineAnimation,T as StringSet,Jt as Texture,le as TextureAtlas,ce as TextureAtlasPage,de as TextureAtlasRegion,Zt as TextureFilter,ne as TextureRegion,Kt as TextureWrap,O as TimeKeeper,J as Timeline,_t as TrackEntry,Ye as TransformConstraint,Ve as TransformConstraintData,vt as TransformConstraintTimeline,et as TranslateTimeline,st as TranslateXTimeline,rt as TranslateYTimeline,Is as Triangulator,P as Utils,D as Vector2,q as VertexAttachment,N as WindowedMean,Ds as generateTextureAtlas,Qs as version};
2
+ //# sourceMappingURL=module.js.map