simple-pixi-spine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/dist/simple-pixi-spine.js +37 -0
- package/dist/simple-pixi-spine.js.map +7 -0
- package/dist/simple-pixi-spine.mjs +37 -0
- package/dist/simple-pixi-spine.mjs.map +7 -0
- package/dist/types/build.d.mts +1 -0
- package/dist/types/bundles/pixi-spine/rollup.config.d.mts +2 -0
- package/dist/types/bundles/pixi-spine/src/index.d.ts +5 -0
- package/dist/types/packages/base/src/SpineBase.d.ts +167 -0
- package/dist/types/packages/base/src/SpineDebugRenderer.d.ts +60 -0
- package/dist/types/packages/base/src/core/AttachmentType.d.ts +12 -0
- package/dist/types/packages/base/src/core/BinaryInput.d.ts +18 -0
- package/dist/types/packages/base/src/core/IAnimation.d.ts +131 -0
- package/dist/types/packages/base/src/core/IConstraint.d.ts +93 -0
- package/dist/types/packages/base/src/core/ISkeleton.d.ts +237 -0
- package/dist/types/packages/base/src/core/SkeletonBoundsBase.d.ts +51 -0
- package/dist/types/packages/base/src/core/TextureAtlas.d.ts +41 -0
- package/dist/types/packages/base/src/core/TextureRegion.d.ts +55 -0
- package/dist/types/packages/base/src/core/Utils.d.ts +198 -0
- package/dist/types/packages/base/src/core/versions.d.ts +15 -0
- package/dist/types/packages/base/src/index.d.ts +14 -0
- package/dist/types/packages/base/src/settings.d.ts +19 -0
- package/dist/types/packages/loader-3.8/src/index.d.ts +2 -0
- package/dist/types/packages/loader-4.0/src/index.d.ts +2 -0
- package/dist/types/packages/loader-4.1/src/index.d.ts +2 -0
- package/dist/types/packages/loader-4.2/src/index.d.ts +2 -0
- package/dist/types/packages/loader-base/src/SpineLoaderAbstract.d.ts +36 -0
- package/dist/types/packages/loader-base/src/atlasLoader.d.ts +5 -0
- package/dist/types/packages/loader-base/src/index.d.ts +4 -0
- package/dist/types/packages/loader-uni/src/Spine.d.ts +15 -0
- package/dist/types/packages/loader-uni/src/SpineLoader.d.ts +10 -0
- package/dist/types/packages/loader-uni/src/index.d.ts +3 -0
- package/dist/types/packages/runtime-3.7/src/Spine.d.ts +11 -0
- package/dist/types/packages/runtime-3.7/src/core/Animation.d.ts +307 -0
- package/dist/types/packages/runtime-3.7/src/core/AnimationState.d.ts +175 -0
- package/dist/types/packages/runtime-3.7/src/core/AnimationStateData.d.ts +17 -0
- package/dist/types/packages/runtime-3.7/src/core/AtlasAttachmentLoader.d.ts +20 -0
- package/dist/types/packages/runtime-3.7/src/core/Bone.d.ts +58 -0
- package/dist/types/packages/runtime-3.7/src/core/BoneData.d.ts +19 -0
- package/dist/types/packages/runtime-3.7/src/core/Constraint.d.ts +7 -0
- package/dist/types/packages/runtime-3.7/src/core/Event.d.ts +15 -0
- package/dist/types/packages/runtime-3.7/src/core/EventData.d.ts +14 -0
- package/dist/types/packages/runtime-3.7/src/core/IkConstraint.d.ts +27 -0
- package/dist/types/packages/runtime-3.7/src/core/IkConstraintData.d.ts +16 -0
- package/dist/types/packages/runtime-3.7/src/core/PathConstraint.d.ts +36 -0
- package/dist/types/packages/runtime-3.7/src/core/PathConstraintData.d.ts +29 -0
- package/dist/types/packages/runtime-3.7/src/core/Skeleton.d.ts +88 -0
- package/dist/types/packages/runtime-3.7/src/core/SkeletonBounds.d.ts +8 -0
- package/dist/types/packages/runtime-3.7/src/core/SkeletonData.d.ts +41 -0
- package/dist/types/packages/runtime-3.7/src/core/SkeletonJson.d.ts +27 -0
- package/dist/types/packages/runtime-3.7/src/core/Skin.d.ts +16 -0
- package/dist/types/packages/runtime-3.7/src/core/Slot.d.ts +27 -0
- package/dist/types/packages/runtime-3.7/src/core/SlotData.d.ts +17 -0
- package/dist/types/packages/runtime-3.7/src/core/TransformConstraint.d.ts +26 -0
- package/dist/types/packages/runtime-3.7/src/core/TransformConstraintData.d.ts +23 -0
- package/dist/types/packages/runtime-3.7/src/core/Updatable.d.ts +6 -0
- package/dist/types/packages/runtime-3.7/src/core/VertexEffect.d.ts +10 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/Attachment.d.ts +30 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/AttachmentLoader.d.ts +24 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/BoundingBoxAttachment.d.ts +10 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/ClippingAttachment.d.ts +12 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/MeshAttachment.d.ts +23 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/PathAttachment.d.ts +13 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/PointAttachment.d.ts +16 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/RegionAttachment.d.ts +68 -0
- package/dist/types/packages/runtime-3.7/src/core/attachments/index.d.ts +8 -0
- package/dist/types/packages/runtime-3.7/src/core/vertexeffects/JitterEffect.d.ts +14 -0
- package/dist/types/packages/runtime-3.7/src/core/vertexeffects/SwirlEffect.d.ts +19 -0
- package/dist/types/packages/runtime-3.7/src/index.d.ts +28 -0
- package/dist/types/packages/runtime-3.8/src/Spine.d.ts +11 -0
- package/dist/types/packages/runtime-3.8/src/core/Animation.d.ts +400 -0
- package/dist/types/packages/runtime-3.8/src/core/AnimationState.d.ts +401 -0
- package/dist/types/packages/runtime-3.8/src/core/AnimationStateData.d.ts +17 -0
- package/dist/types/packages/runtime-3.8/src/core/AtlasAttachmentLoader.d.ts +20 -0
- package/dist/types/packages/runtime-3.8/src/core/Bone.d.ts +58 -0
- package/dist/types/packages/runtime-3.8/src/core/BoneData.d.ts +21 -0
- package/dist/types/packages/runtime-3.8/src/core/Constraint.d.ts +9 -0
- package/dist/types/packages/runtime-3.8/src/core/Event.d.ts +15 -0
- package/dist/types/packages/runtime-3.8/src/core/EventData.d.ts +14 -0
- package/dist/types/packages/runtime-3.8/src/core/IkConstraint.d.ts +30 -0
- package/dist/types/packages/runtime-3.8/src/core/IkConstraintData.d.ts +17 -0
- package/dist/types/packages/runtime-3.8/src/core/PathConstraint.d.ts +37 -0
- package/dist/types/packages/runtime-3.8/src/core/PathConstraintData.d.ts +28 -0
- package/dist/types/packages/runtime-3.8/src/core/Skeleton.d.ts +88 -0
- package/dist/types/packages/runtime-3.8/src/core/SkeletonBinary.d.ts +43 -0
- package/dist/types/packages/runtime-3.8/src/core/SkeletonBounds.d.ts +8 -0
- package/dist/types/packages/runtime-3.8/src/core/SkeletonData.d.ts +44 -0
- package/dist/types/packages/runtime-3.8/src/core/SkeletonJson.d.ts +27 -0
- package/dist/types/packages/runtime-3.8/src/core/Skin.d.ts +35 -0
- package/dist/types/packages/runtime-3.8/src/core/Slot.d.ts +28 -0
- package/dist/types/packages/runtime-3.8/src/core/SlotData.d.ts +17 -0
- package/dist/types/packages/runtime-3.8/src/core/TransformConstraint.d.ts +27 -0
- package/dist/types/packages/runtime-3.8/src/core/TransformConstraintData.d.ts +22 -0
- package/dist/types/packages/runtime-3.8/src/core/Updatable.d.ts +7 -0
- package/dist/types/packages/runtime-3.8/src/core/VertexEffect.d.ts +10 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/Attachment.d.ts +32 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/AttachmentLoader.d.ts +24 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/BoundingBoxAttachment.d.ts +11 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/ClippingAttachment.d.ts +13 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/MeshAttachment.d.ts +25 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/PathAttachment.d.ts +14 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/PointAttachment.d.ts +17 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/RegionAttachment.d.ts +69 -0
- package/dist/types/packages/runtime-3.8/src/core/attachments/index.d.ts +8 -0
- package/dist/types/packages/runtime-3.8/src/core/vertexeffects/JitterEffect.d.ts +14 -0
- package/dist/types/packages/runtime-3.8/src/core/vertexeffects/SwirlEffect.d.ts +19 -0
- package/dist/types/packages/runtime-3.8/src/index.d.ts +29 -0
- package/dist/types/packages/runtime-4.0/src/Spine.d.ts +11 -0
- package/dist/types/packages/runtime-4.0/src/core/Animation.d.ts +366 -0
- package/dist/types/packages/runtime-4.0/src/core/AnimationState.d.ts +369 -0
- package/dist/types/packages/runtime-4.0/src/core/AnimationStateData.d.ts +25 -0
- package/dist/types/packages/runtime-4.0/src/core/AtlasAttachmentLoader.d.ts +20 -0
- package/dist/types/packages/runtime-4.0/src/core/Bone.d.ts +104 -0
- package/dist/types/packages/runtime-4.0/src/core/BoneData.d.ts +38 -0
- package/dist/types/packages/runtime-4.0/src/core/ConstraintData.d.ts +9 -0
- package/dist/types/packages/runtime-4.0/src/core/Event.d.ts +19 -0
- package/dist/types/packages/runtime-4.0/src/core/EventData.d.ts +16 -0
- package/dist/types/packages/runtime-4.0/src/core/IkConstraint.d.ts +38 -0
- package/dist/types/packages/runtime-4.0/src/core/IkConstraintData.d.ts +28 -0
- package/dist/types/packages/runtime-4.0/src/core/PathConstraint.d.ts +45 -0
- package/dist/types/packages/runtime-4.0/src/core/PathConstraintData.d.ts +42 -0
- package/dist/types/packages/runtime-4.0/src/core/Skeleton.d.ts +149 -0
- package/dist/types/packages/runtime-4.0/src/core/SkeletonBinary.d.ts +28 -0
- package/dist/types/packages/runtime-4.0/src/core/SkeletonBounds.d.ts +8 -0
- package/dist/types/packages/runtime-4.0/src/core/SkeletonData.d.ts +94 -0
- package/dist/types/packages/runtime-4.0/src/core/SkeletonJson.d.ts +26 -0
- package/dist/types/packages/runtime-4.0/src/core/Skin.d.ts +47 -0
- package/dist/types/packages/runtime-4.0/src/core/Slot.d.ts +45 -0
- package/dist/types/packages/runtime-4.0/src/core/SlotData.d.ts +26 -0
- package/dist/types/packages/runtime-4.0/src/core/TransformConstraint.d.ts +34 -0
- package/dist/types/packages/runtime-4.0/src/core/TransformConstraintData.d.ts +34 -0
- package/dist/types/packages/runtime-4.0/src/core/Updatable.d.ts +11 -0
- package/dist/types/packages/runtime-4.0/src/core/VertexEffect.d.ts +10 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/Attachment.d.ts +52 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/AttachmentLoader.d.ts +24 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/BoundingBoxAttachment.d.ts +11 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/ClippingAttachment.d.ts +15 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/MeshAttachment.d.ts +38 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/PathAttachment.d.ts +20 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/PointAttachment.d.ts +19 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/RegionAttachment.d.ts +89 -0
- package/dist/types/packages/runtime-4.0/src/core/attachments/index.d.ts +8 -0
- package/dist/types/packages/runtime-4.0/src/core/vertexeffects/JitterEffect.d.ts +14 -0
- package/dist/types/packages/runtime-4.0/src/core/vertexeffects/SwirlEffect.d.ts +19 -0
- package/dist/types/packages/runtime-4.0/src/index.d.ts +29 -0
- package/dist/types/packages/runtime-4.1/src/Spine.d.ts +11 -0
- package/dist/types/packages/runtime-4.1/src/core/Animation.d.ts +386 -0
- package/dist/types/packages/runtime-4.1/src/core/AnimationState.d.ts +371 -0
- package/dist/types/packages/runtime-4.1/src/core/AnimationStateData.d.ts +25 -0
- package/dist/types/packages/runtime-4.1/src/core/AtlasAttachmentLoader.d.ts +17 -0
- package/dist/types/packages/runtime-4.1/src/core/Bone.d.ts +104 -0
- package/dist/types/packages/runtime-4.1/src/core/BoneData.d.ts +38 -0
- package/dist/types/packages/runtime-4.1/src/core/ConstraintData.d.ts +9 -0
- package/dist/types/packages/runtime-4.1/src/core/Event.d.ts +19 -0
- package/dist/types/packages/runtime-4.1/src/core/EventData.d.ts +16 -0
- package/dist/types/packages/runtime-4.1/src/core/IkConstraint.d.ts +38 -0
- package/dist/types/packages/runtime-4.1/src/core/IkConstraintData.d.ts +30 -0
- package/dist/types/packages/runtime-4.1/src/core/PathConstraint.d.ts +45 -0
- package/dist/types/packages/runtime-4.1/src/core/PathConstraintData.d.ts +44 -0
- package/dist/types/packages/runtime-4.1/src/core/Skeleton.d.ts +143 -0
- package/dist/types/packages/runtime-4.1/src/core/SkeletonBinary.d.ts +31 -0
- package/dist/types/packages/runtime-4.1/src/core/SkeletonBounds.d.ts +8 -0
- package/dist/types/packages/runtime-4.1/src/core/SkeletonData.d.ts +94 -0
- package/dist/types/packages/runtime-4.1/src/core/SkeletonJson.d.ts +28 -0
- package/dist/types/packages/runtime-4.1/src/core/Skin.d.ts +47 -0
- package/dist/types/packages/runtime-4.1/src/core/Slot.d.ts +44 -0
- package/dist/types/packages/runtime-4.1/src/core/SlotData.d.ts +26 -0
- package/dist/types/packages/runtime-4.1/src/core/TransformConstraint.d.ts +34 -0
- package/dist/types/packages/runtime-4.1/src/core/TransformConstraintData.d.ts +36 -0
- package/dist/types/packages/runtime-4.1/src/core/Updatable.d.ts +11 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/Attachment.d.ts +53 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/AttachmentLoader.d.ts +25 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/BoundingBoxAttachment.d.ts +11 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/ClippingAttachment.d.ts +17 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/MeshAttachment.d.ts +42 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/PathAttachment.d.ts +20 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/PointAttachment.d.ts +19 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/RegionAttachment.d.ts +82 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/Sequence.d.ts +35 -0
- package/dist/types/packages/runtime-4.1/src/core/attachments/index.d.ts +9 -0
- package/dist/types/packages/runtime-4.1/src/index.d.ts +26 -0
- package/dist/types/packages/runtime-4.2/src/Spine.d.ts +11 -0
- package/dist/types/packages/runtime-4.2/src/core/Animation.d.ts +544 -0
- package/dist/types/packages/runtime-4.2/src/core/AnimationState.d.ts +405 -0
- package/dist/types/packages/runtime-4.2/src/core/AnimationStateData.d.ts +25 -0
- package/dist/types/packages/runtime-4.2/src/core/AtlasAttachmentLoader.d.ts +20 -0
- package/dist/types/packages/runtime-4.2/src/core/Bone.d.ts +117 -0
- package/dist/types/packages/runtime-4.2/src/core/BoneData.d.ts +42 -0
- package/dist/types/packages/runtime-4.2/src/core/ConstraintData.d.ts +9 -0
- package/dist/types/packages/runtime-4.2/src/core/Event.d.ts +18 -0
- package/dist/types/packages/runtime-4.2/src/core/EventData.d.ts +15 -0
- package/dist/types/packages/runtime-4.2/src/core/IkConstraint.d.ts +40 -0
- package/dist/types/packages/runtime-4.2/src/core/IkConstraintData.d.ts +30 -0
- package/dist/types/packages/runtime-4.2/src/core/PathConstraint.d.ts +47 -0
- package/dist/types/packages/runtime-4.2/src/core/PathConstraintData.d.ts +62 -0
- package/dist/types/packages/runtime-4.2/src/core/PhysicsConstraint.d.ts +54 -0
- package/dist/types/packages/runtime-4.2/src/core/PhysicsConstraintData.d.ts +35 -0
- package/dist/types/packages/runtime-4.2/src/core/Skeleton.d.ts +160 -0
- package/dist/types/packages/runtime-4.2/src/core/SkeletonBinary.d.ts +43 -0
- package/dist/types/packages/runtime-4.2/src/core/SkeletonBounds.d.ts +51 -0
- package/dist/types/packages/runtime-4.2/src/core/SkeletonClipping.d.ts +38 -0
- package/dist/types/packages/runtime-4.2/src/core/SkeletonData.d.ts +101 -0
- package/dist/types/packages/runtime-4.2/src/core/SkeletonJson.d.ts +23 -0
- package/dist/types/packages/runtime-4.2/src/core/Skin.d.ts +49 -0
- package/dist/types/packages/runtime-4.2/src/core/Slot.d.ts +44 -0
- package/dist/types/packages/runtime-4.2/src/core/SlotData.d.ts +28 -0
- package/dist/types/packages/runtime-4.2/src/core/TransformConstraint.d.ts +33 -0
- package/dist/types/packages/runtime-4.2/src/core/TransformConstraintData.d.ts +34 -0
- package/dist/types/packages/runtime-4.2/src/core/Triangulator.d.ts +18 -0
- package/dist/types/packages/runtime-4.2/src/core/Updatable.d.ts +16 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/Attachment.d.ts +49 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/AttachmentLoader.d.ts +27 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/BoundingBoxAttachment.d.ts +12 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/ClippingAttachment.d.ts +16 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/MeshAttachment.d.ts +46 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/PathAttachment.d.ts +19 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/PointAttachment.d.ts +20 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/RegionAttachment.d.ts +80 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/Sequence.d.ts +35 -0
- package/dist/types/packages/runtime-4.2/src/core/attachments/index.d.ts +9 -0
- package/dist/types/packages/runtime-4.2/src/core/index.d.ts +29 -0
- package/dist/types/packages/runtime-4.2/src/core/polyfills.d.ts +1 -0
- package/dist/types/packages/runtime-4.2/src/index.d.ts +3 -0
- package/dist/types/src/BinaryInput.d.ts +84 -0
- package/dist/types/src/SkelToJson.d.ts +15 -0
- package/dist/types/src/SkelToJson21.d.ts +10 -0
- package/dist/types/src/SkelToJson34And35.d.ts +10 -0
- package/dist/types/src/SkelToJson36And37.d.ts +10 -0
- package/dist/types/src/SkelToJsonCommon.d.ts +24 -0
- package/dist/types/src/TextureHelper.d.ts +29 -0
- package/dist/types/src/VersionDetector.d.ts +28 -0
- package/dist/types/src/index.d.ts +80 -0
- package/dist/types/src/types.d.ts +161 -0
- package/package.json +29 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* simple-pixi-spine - v4.0.4
|
|
3
|
+
* Compiled Sat, 25 Jul 2026 10:51:45 UTC
|
|
4
|
+
*
|
|
5
|
+
* Integrated spine-pixi runtime with SimplePixiSpine wrapper.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
"use strict";var SimplePixiSpine=(()=>{var Hd=Object.create;var Ro=Object.defineProperty;var Gd=Object.getOwnPropertyDescriptor;var jd=Object.getOwnPropertyNames;var Zd=Object.getPrototypeOf,Kd=Object.prototype.hasOwnProperty;var Jd=(A,t,e)=>t in A?Ro(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e;var Qd=(A,t)=>()=>(t||A((t={exports:{}}).exports,t),t.exports),As=(A,t)=>{for(var e in t)Ro(A,e,{get:t[e],enumerable:!0})},ed=(A,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jd(t))!Kd.call(A,r)&&r!==e&&Ro(A,r,{get:()=>t[r],enumerable:!(n=Gd(t,r))||n.enumerable});return A};var ye=(A,t,e)=>(e=A!=null?Hd(Zd(A)):{},ed(t||!A||!A.__esModule?Ro(e,"default",{value:A,enumerable:!0}):e,A)),_d=A=>ed(Ro({},"__esModule",{value:!0}),A);var m=(A,t,e)=>(Jd(A,typeof t!="symbol"?t+"":t,e),e);var ge=Qd((cp,rd)=>{var nd=new Proxy({},{get(A,t){if(t==="__esModule")return!0;let e=typeof window<"u"&&window.PIXI||typeof global<"u"&&global.PIXI;return t==="default"?e||nd:e?e[t]:void 0},ownKeys(A){let t=typeof window<"u"&&window.PIXI||typeof global<"u"&&global.PIXI;return t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(A,t){let e=typeof window<"u"&&window.PIXI||typeof global<"u"&&global.PIXI;if(e&&t in e)return{enumerable:!0,configurable:!0,writable:!0,value:e[t]};if(t==="__esModule")return{enumerable:!0,configurable:!0,writable:!0,value:!0}}});rd.exports=nd});var Zf={};As(Zf,{default:()=>jf,detectSpineVersion:()=>kc,getFileDirectory:()=>Qm,getPIXI:()=>Ic,getSpineSrc:()=>Od,getTextureAtlasInfo:()=>td,isVersion:()=>Ch,load:()=>qd,loadFile:()=>Th,normalizeTo38:()=>Ac,prepareTextureData:()=>_m,processSpineData:()=>Wd,readSkeletonData21:()=>kh,readSkeletonData34And35:()=>Ih,readSkeletonData36And37:()=>Mh,readSpineSpineData:()=>Ud,registerPIXI:()=>Nd,spine:()=>$d,spine36To38:()=>Rd,versionMap:()=>vh});var Sh={};As(Sh,{AttachmentType:()=>Ft,BLEND_MODES:()=>Un,BinaryInput:()=>ln,Color:()=>$,DebugUtils:()=>Bh,IntSet:()=>ks,Interpolation:()=>vc,MathUtils:()=>B,MixBlend:()=>Nn,MixDirection:()=>On,Physics:()=>Mc,Pool:()=>qe,PositionMode:()=>Ie,Pow:()=>Cc,PowOut:()=>mr,RotateMode:()=>Ye,SPINE_VERSION:()=>Xo,SkeletonBounds:()=>Nl,SkeletonBoundsBase:()=>$e,Spine:()=>wh,SpineBase:()=>Ee,SpineDebugRenderer:()=>Xh,SpineMesh:()=>Bc,SpineSprite:()=>Tc,StringSet:()=>vn,TextureAtlas:()=>Gr,TextureAtlasPage:()=>Po,TextureAtlasRegion:()=>Yo,TextureFilter:()=>Vh,TextureRegion:()=>Hr,TextureWrap:()=>Rh,TimeKeeper:()=>Fh,TransformMode:()=>me,Utils:()=>Y,Vector2:()=>Ae,WindowedMean:()=>Dh,detectSpineVersion:()=>dr,filterFromString:()=>Ec,settings:()=>Dt,spine38:()=>lo,spine40:()=>Sc,spine41:()=>bo,spine42:()=>hc,wrapFromString:()=>tu});var Ft=(l=>(l[l.Region=0]="Region",l[l.BoundingBox=1]="BoundingBox",l[l.Mesh=2]="Mesh",l[l.LinkedMesh=3]="LinkedMesh",l[l.Path=4]="Path",l[l.Point=5]="Point",l[l.Clipping=6]="Clipping",l))(Ft||{});var ln=class{constructor(t,e=new Array,n=0,r=new DataView(t.buffer)){this.strings=e;this.index=n;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(),n=e&127;return e&128&&(e=this.readByte(),n|=(e&127)<<7,e&128&&(e=this.readByte(),n|=(e&127)<<14,e&128&&(e=this.readByte(),n|=(e&127)<<21,e&128&&(e=this.readByte(),n|=(e&127)<<28)))),t?n:n>>>1^-(n&1)}readStringRef(){let t=this.readInt(!0);return t==0?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 n=0;n<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),n+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}};var Nn=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(Nn||{}),On=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(On||{});var Ie=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ie||{}),Ye=(n=>(n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale",n))(Ye||{});var Un=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r))(Un||{}),me=(s=>(s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",s))(me||{}),Mc=(r=>(r[r.none=0]="none",r[r.reset=1]="reset",r[r.update=2]="update",r[r.pose=3]="pose",r))(Mc||{});var ks=class{constructor(){m(this,"array",new Array)}add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},vn=class{constructor(){m(this,"entries",{});m(this,"size",0)}add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(let n=0,r=t.length;n<r;n++)this.add(t[n]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},We=class We{constructor(t=0,e=0,n=0,r=0){this.r=t;this.g=e;this.b=n;this.a=r}set(t,e,n,r){return this.r=t,this.g=e,this.b=n,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=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,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=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}static fromString(t){return new We().setFromString(t)}};m(We,"WHITE",new We(1,1,1,1)),m(We,"RED",new We(1,0,0,1)),m(We,"GREEN",new We(0,1,0,1)),m(We,"BLUE",new We(0,0,1,1)),m(We,"MAGENTA",new We(1,0,1,1));var $=We,pe=class pe{static clamp(t,e,n){return t<e?e:t>n?n:t}static cosDeg(t){return Math.cos(t*pe.degRad)}static sinDeg(t){return Math.sin(t*pe.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*pe.degRad}static signum(t){return Math.sign(t)}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return pe.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,n){let r=Math.random(),s=e-t;return r<=(n-t)/s?t+Math.sqrt(r*s*(n-t)):e-Math.sqrt((1-r)*s*(e-n))}static isPowerOfTwo(t){return t&&(t&t-1)===0}};m(pe,"PI",3.1415927),m(pe,"PI2",pe.PI*2),m(pe,"invPI2",1/pe.PI2),m(pe,"radiansToDegrees",180/pe.PI),m(pe,"radDeg",pe.radiansToDegrees),m(pe,"degreesToRadians",pe.PI/180),m(pe,"degRad",pe.degreesToRadians);var B=pe,vc=class{apply(t,e,n){return t+(e-t)*this.applyInternal(n)}},Cc=class extends vc{constructor(e){super();m(this,"power",2);this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},mr=class extends Cc{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},zr=class zr{static arrayCopy(t,e,n,r,s){for(let o=e,l=r;o<e+s;o++,l++)n[l]=t[o]}static arrayFill(t,e,n,r){for(let s=e;s<n;s++)t[s]=r}static setArraySize(t,e,n=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let s=r;s<e;s++)t[s]=n;return t}static ensureArrayCapacity(t,e,n=0){return t.length>=e?t:zr.setArraySize(t,e,n)}static newArray(t,e){let n=new Array(t);for(let r=0;r<t;r++)n[r]=e;return n}static newFloatArray(t){if(zr.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);let e=new Array(t);for(let n=0;n<e.length;n++)e[n]=0;return e}static newShortArray(t){if(zr.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);let e=new Array(t);for(let n=0;n<e.length;n++)e[n]=0;return e}static toFloatArray(t){return zr.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return zr.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,n=!0){for(let 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)]}};m(zr,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Y=zr,Bh=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let n=t.bones[e],r=n.matrix;console.log(`${n.data.name}, ${r.a}, ${r.b}, ${r.c}, ${r.d}, ${r.tx}, ${r.ty}`)}}},qe=class{constructor(t){m(this,"items",new Array);m(this,"instantiator");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}},Ae=class{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 t!=0&&(this.x/=t,this.y/=t),this}},Fh=class{constructor(){m(this,"maxDelta",.064);m(this,"framesPerSecond",0);m(this,"delta",0);m(this,"totalTime",0);m(this,"lastTime",Date.now()/1e3);m(this,"frameCount",0);m(this,"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)}},Dh=class{constructor(t=32){m(this,"values");m(this,"addedValues",0);m(this,"lastValue",0);m(this,"mean",0);m(this,"dirty",!0);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}};var $e=class{constructor(){m(this,"minX",0);m(this,"minY",0);m(this,"maxX",0);m(this,"maxY",0);m(this,"boundingBoxes",new Array);m(this,"polygons",new Array);m(this,"polygonPool",new qe(()=>Y.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let n=this.boundingBoxes,r=this.polygons,s=this.polygonPool,o=t.slots,l=o.length;n.length=0,s.freeAll(r),r.length=0;for(let c=0;c<l;c++){let a=o[c];if(!a.bone.active)continue;let i=a.getAttachment();if(i!=null&&i.type===1){let h=i;n.push(h);let d=s.obtain();d.length!=h.worldVerticesLength&&(d=Y.newFloatArray(h.worldVerticesLength)),r.push(d),h.computeWorldVertices(a,0,h.worldVerticesLength,d,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,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=this.polygons;for(let o=0,l=s.length;o<l;o++){let c=s[o],a=c;for(let i=0,h=c.length;i<h;i+=2){let d=a[i],u=a[i+1];t=Math.min(t,d),e=Math.min(e,u),n=Math.max(n,d),r=Math.max(r,u)}}this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,n,r){let s=this.minX,o=this.minY,l=this.maxX,c=this.maxY;if(t<=s&&n<=s||e<=o&&r<=o||t>=l&&n>=l||e>=c&&r>=c)return!1;let a=(r-e)/(n-t),i=a*(s-t)+e;if(i>o&&i<c||(i=a*(l-t)+e,i>o&&i<c))return!0;let h=(o-e)/a+t;return h>s&&h<l||(h=(c-e)/a+t,h>s&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let n=this.polygons;for(let r=0,s=n.length;r<s;r++)if(this.containsPointPolygon(n[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,n){let r=t,s=t.length,o=s-2,l=!1;for(let c=0;c<s;c+=2){let a=r[c+1],i=r[o+1];if(a<n&&i>=n||i<n&&a>=n){let h=r[c];h+(n-a)/(i-a)*(r[o]-h)<e&&(l=!l)}o=c}return l}intersectsSegment(t,e,n,r){let s=this.polygons;for(let o=0,l=s.length;o<l;o++)if(this.intersectsSegmentPolygon(s[o],t,e,n,r))return this.boundingBoxes[o];return null}intersectsSegmentPolygon(t,e,n,r,s){let o=t,l=t.length,c=e-r,a=n-s,i=e*s-n*r,h=o[l-2],d=o[l-1];for(let u=0;u<l;u+=2){let p=o[u],f=o[u+1],g=h*f-d*p,b=h-p,x=d-f,y=c*x-a*b,w=(i*b-c*g)/y;if((w>=h&&w<=p||w>=p&&w<=h)&&(w>=e&&w<=r||w>=r&&w<=e)){let k=(i*x-a*g)/y;if((k>=d&&k<=f||k>=f&&k<=d)&&(k>=n&&k<=s||k>=s&&k<=n))return!0}h=p,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}};var Ji=ye(ge());function Ec(A){switch(A.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;case"mipmaplinearlinear":return 9987;default:throw new Error(`Unknown texture filter ${A}`)}}function tu(A){switch(A.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error(`Unknown texture wrap ${A}`)}}var Vh=(l=>(l[l.Nearest=9728]="Nearest",l[l.Linear=9729]="Linear",l[l.MipMap=9987]="MipMap",l[l.MipMapNearestNearest=9984]="MipMapNearestNearest",l[l.MipMapLinearNearest=9985]="MipMapLinearNearest",l[l.MipMapNearestLinear=9986]="MipMapNearestLinear",l[l.MipMapLinearLinear=9987]="MipMapLinearLinear",l))(Vh||{}),Rh=(n=>(n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat",n))(Rh||{}),Hr=class{constructor(){m(this,"texture");m(this,"size",null);m(this,"names",null);m(this,"values",null);m(this,"renderObject",null)}get width(){let t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){let t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture.uvs?.x0??0}get v(){return this.texture.uvs?.y0??0}get u2(){return this.texture.uvs?.x2??0}get v2(){return this.texture.uvs?.y2??0}get offsetX(){let t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){let t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){let t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}};var Ph=class{constructor(){m(this,"x",0);m(this,"y",0);m(this,"width",0);m(this,"height",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"originalWidth",0);m(this,"originalHeight",0);m(this,"rotate",0);m(this,"index",0)}},Gr=class{constructor(t,e,n){m(this,"pages",new Array);m(this,"regions",new Array);t&&this.addSpineAtlas(t,e,n)}addTexture(t,e){let n=this.pages,r=null;for(let o=0;o<n.length;o++)if(n[o].baseTexture===e.source){r=n[o];break}if(r===null){r=new Po,r.name="texturePage";let o=e.source;r.width=o.width,r.height=o.height,r.baseTexture=o,r.minFilter=r.magFilter=9728,r.uWrap=33071,r.vWrap=33071,n.push(r)}let s=new Yo;return s.name=t,s.page=r,s.texture=e,s.index=-1,this.regions.push(s),s}addTextureHash(t,e){for(let n in t)t.hasOwnProperty(n)&&this.addTexture(e&&n.indexOf(".")!==-1?n.substr(0,n.lastIndexOf(".")):n,t[n])}addSpineAtlas(t,e,n){return this.load(t,e,n)}load(t,e,n){if(e==null)throw new Error("textureLoader cannot be null.");let r=new Yh(t),s=new Array(4),o=null,l={},c=null;l.size=()=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},l.format=()=>{},l.filter=()=>{o.minFilter=Ec(s[1]),o.magFilter=Ec(s[2])},l.repeat=()=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},l.pma=()=>{o.pma=s[1]=="true"};let a={};a.xy=()=>{c.x=parseInt(s[1]),c.y=parseInt(s[2])},a.size=()=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},a.bounds=()=>{c.x=parseInt(s[1]),c.y=parseInt(s[2]),c.width=parseInt(s[3]),c.height=parseInt(s[4])},a.offset=()=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2])},a.orig=()=>{c.originalWidth=parseInt(s[1]),c.originalHeight=parseInt(s[2])},a.offsets=()=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2]),c.originalWidth=parseInt(s[3]),c.originalHeight=parseInt(s[4])},a.rotate=()=>{let d=s[1],u=0;d.toLocaleLowerCase()=="true"?u=6:d.toLocaleLowerCase()=="false"?u=0:u=(720-parseFloat(d))%360/45,c.rotate=u},a.index=()=>{c.index=parseInt(s[1])};let i=r.readLine();for(;i!=null&&i.trim().length==0;)i=r.readLine();for(;!(i==null||i.trim().length==0||r.readEntry(s,i)==0);)i=r.readLine();let h=()=>{for(;;){if(i==null)return n&&n(this);if(i.trim().length==0)o=null,i=r.readLine();else if(o===null){for(o=new Po,o.name=i.trim();r.readEntry(s,i=r.readLine())!=0;){let d=l[s[0]];d&&d()}this.pages.push(o),e(o.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(o),1),n&&n(null);let u=d.source||d;o.baseTexture=u,o.pma&&(u.alphaMode="premultiplied-alpha"),d.valid||u.resize(o.width,o.height),o.setFilters(),(!o.width||!o.height)&&(o.width=u.width,o.height=u.height,(!o.width||!o.height)&&console.log(`ERROR spine atlas page ${o.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),h()});break}else{c=new Ph;let d=new Yo;d.name=i,d.page=o;let u=null,p=null;for(;;){let w=r.readEntry(s,i=r.readLine());if(w==0)break;let k=a[s[0]];if(k)k();else{u==null&&(u=[],p=[]),u.push(s[0]);let S=[];for(let I=0;I<w;I++)S.push(parseInt(s[I+1]));p.push(S)}}c.originalWidth==0&&c.originalHeight==0&&(c.originalWidth=c.width,c.originalHeight=c.height);let f=o.baseTexture.resolution;c.x/=f,c.y/=f,c.width/=f,c.height/=f,c.originalWidth/=f,c.originalHeight/=f,c.offsetX/=f,c.offsetY/=f;let g=c.rotate%4!==0,b=new Ji.Rectangle(c.x,c.y,g?c.height:c.width,g?c.width:c.height),x=new Ji.Rectangle(0,0,c.originalWidth,c.originalHeight),y=new Ji.Rectangle(c.offsetX,c.originalHeight-c.height-c.offsetY,c.width,c.height);d.texture=new Ji.Texture({source:d.page.baseTexture,frame:b,orig:x,trim:y,rotate:c.rotate}),d.index=c.index,d.texture.updateUvs(),this.regions.push(d)}}};h()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.destroy()}},Yh=class{constructor(t){m(this,"lines");m(this,"index",0);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==null||(e=e.trim(),e.length==0))return 0;let n=e.indexOf(":");if(n==-1)return 0;t[0]=e.substr(0,n).trim();for(let r=1,s=n+1;;r++){let o=e.indexOf(",",s);if(o==-1)return t[r]=e.substr(s).trim(),r;if(t[r]=e.substr(s,o-s).trim(),s=o+1,r==4)return 4}}},Po=class{constructor(){m(this,"name");m(this,"minFilter",9728);m(this,"magFilter",9728);m(this,"uWrap",33071);m(this,"vWrap",33071);m(this,"baseTexture");m(this,"width");m(this,"height");m(this,"pma")}setFilters(){let t=this.baseTexture,e=this.minFilter;e==9729?t.scaleMode="linear":this.minFilter==9728?t.scaleMode="nearest":(t.autoGenerateMipmaps=!0,e==9984?t.scaleMode="nearest":t.scaleMode="linear")}},Yo=class extends Hr{constructor(){super(...arguments);m(this,"page");m(this,"name");m(this,"index")}};var Xo=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.VER37=37]="VER37",o[o.VER38=38]="VER38",o[o.VER40=40]="VER40",o[o.VER41=41]="VER41",o[o.VER42=42]="VER42",o))(Xo||{});function dr(A){let t=A.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:t==="4.2"||t==="4.3"?42:e<37?37:0}var Dt={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0};var oe=ye(ge());var jr=[0,0,0],Tc=class extends oe.Sprite{constructor(){super(...arguments);m(this,"region",null);m(this,"attachment",null)}},Bc=class extends oe.MeshSimple{constructor(e,n,r,s,o){super({texture:e,vertices:n,uvs:r,indices:s?new Uint32Array(s):void 0,topology:"triangle-list"});m(this,"region",null);m(this,"attachment",null)}},Ee=class extends oe.Container{constructor(e){super();m(this,"tintRgb");m(this,"spineData");m(this,"skeleton");m(this,"stateData");m(this,"state");m(this,"slotContainers");m(this,"tempClipContainers");m(this,"localDelayLimit");m(this,"_autoUpdate");m(this,"_visible");m(this,"_debug");m(this,"tempVertices",null);if(!e)throw new Error("The spineData param is required.");if(typeof e=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=e,this.createSkeleton(e),this.slotContainers=[],this.tempClipContainers=[];for(let n=0,r=this.skeleton.slots.length;n<r;n++){let s=this.skeleton.slots[n],o=s.getAttachment(),l=this.newContainer();if(this.slotContainers.push(l),this.addChild(l),this.tempClipContainers.push(null),!!o)if(o.type===0){let c=o.name,a=this.createSprite(s,o,c);s.currentSprite=a,s.currentSpriteName=c,l.addChild(a)}else if(o.type===2){let c=this.createMesh(s,o);s.currentMesh=c,s.currentMeshId=o.id,s.currentMeshName=o.name,l.addChild(c)}else o.type===6&&(this.createGraphics(s,o),l.addChild(s.clippingContainer),l.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(e){e!=this._debug&&(this._debug?.unregisterSpine(this),e?.registerSpine(this),this._debug=e)}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,e?oe.Ticker.shared.add(this.autoUpdateTransform,this):oe.Ticker.shared.remove(this.autoUpdateTransform,this))}get tint(){return new oe.Color(this.tintRgb).toNumber()}set tint(e){this.tintRgb=new oe.Color(e).toRgbArray()}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:Dt.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(e){let n=this.delayLimit,r=dr(this.spineData.version||this.spineData.spine.version);if(e>n&&(e=n),this.state.update(e),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform(r===42&&2);let s=this.skeleton.slots,o=this.color,l=null,c=null;o?(l=o.light,c=o.dark):l=this.tintRgb;for(let d=0,u=s.length;d<u;d++){let p=s[d],f=p.getAttachment(),g=this.slotContainers[d];if(!f){g.visible=!1;continue}let b=null;f.sequence&&f.sequence.apply(p,f);let x=f.region,y=f.color;switch(f!=null&&f.type){case 0:if(g.setFromMatrix(p.bone.matrix),x=f.region,p.currentMesh&&(p.currentMesh.visible=!1,p.currentMesh=null,p.currentMeshId=void 0,p.currentMeshName=void 0),!x){p.currentSprite&&(p.currentSprite.renderable=!1);break}if(!p.currentSpriteName||p.currentSpriteName!==f.name){let k=f.name;if(p.currentSprite&&(p.currentSprite.visible=!1),p.sprites=p.sprites||{},p.sprites[k]!==void 0)p.sprites[k].visible=!0;else{let S=this.createSprite(p,f,k);g.addChild(S)}p.currentSprite=p.sprites[k],p.currentSpriteName=k}p.currentSprite.renderable=!0,p.hackRegion||this.setSpriteRegion(f,p.currentSprite,x),p.currentSprite.color?b=p.currentSprite.color:(jr[0]=l[0]*p.color.r*y.r,jr[1]=l[1]*p.color.g*y.g,jr[2]=l[2]*p.color.b*y.b,p.currentSprite.tint=new oe.Color(jr).toNumber()),p.currentSprite.blendMode=p.blendMode;break;case 2:if(g.setFromMatrix(oe.Matrix.IDENTITY),p.currentSprite&&(p.currentSprite.visible=!1,p.currentSprite=null,p.currentSpriteName=void 0),!x){p.currentMesh&&(p.currentMesh.renderable=!1);break}let w=f.id;if(p.currentMeshId===void 0||p.currentMeshId!==w){let k=w;if(p.currentMesh&&(p.currentMesh.visible=!1),p.meshes=p.meshes||{},p.meshes[k]!==void 0)p.meshes[k].visible=!0;else{let S=this.createMesh(p,f);g.addChild(S)}p.currentMesh=p.meshes[k],p.currentMeshName=f.name,p.currentMeshId=k}p.currentMesh.renderable=!0,f.computeWorldVerticesOld(p,p.currentMesh.vertices),p.currentMesh.color?b=p.currentMesh.color:(jr[0]=l[0]*p.color.r*y.r,jr[1]=l[1]*p.color.g*y.g,jr[2]=l[2]*p.color.b*y.b,p.currentMesh.tint=new oe.Color(jr).toNumber()),p.currentMesh.blendMode=p.blendMode,p.hackRegion||this.setMeshRegion(f,p.currentMesh,x);break;case 6:p.currentGraphics||(this.createGraphics(p,f),g.addChild(p.clippingContainer),g.addChild(p.currentGraphics)),this.updateGraphics(p,f),g.alpha=1,g.visible=!0;continue;default:g.visible=!1;continue}if(g.visible=!0,b){let w=p.color.r*y.r,k=p.color.g*y.g,S=p.color.b*y.b;b.setLight(l[0]*w+c[0]*(1-w),l[1]*k+c[1]*(1-k),l[2]*S+c[2]*(1-S)),p.darkColor?(w=p.darkColor.r,k=p.darkColor.g,S=p.darkColor.b):(w=0,k=0,S=0),b.setDark(l[0]*w+c[0]*(1-w),l[1]*k+c[1]*(1-k),l[2]*S+c[2]*(1-S))}g.alpha=p.color.a}let a=this.skeleton.drawOrder,i=null,h=null;for(let d=0,u=a.length;d<u;d++){let p=s[a[d].data.index],f=this.slotContainers[a[d].data.index];if(h||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),p.currentGraphics&&p.getAttachment())h=p.clippingContainer,i=p.getAttachment(),h.children.length=0,this.children[d]=f,i.endSlot===p.data&&(i.endSlot=null);else if(h){let g=this.tempClipContainers[d];g||(g=this.tempClipContainers[d]=this.newContainer(),g.visible=!1),this.children[d]=g,f.parent=null,h.addChild(f),i.endSlot==p.data&&(h.renderable=!0,h=null,i=null)}else this.children[d]=f}this._debug?.renderDebug(this)}setSpriteRegion(e,n,r){n.attachment===e&&n.region===r||(n.region=r,n.attachment=e,n.texture=r.texture,n.rotation=e.rotation*B.degRad,n.position.x=e.x,n.position.y=e.y,n.alpha=e.color.a,r.size?(n.scale.x=r.size.width/r.originalWidth,n.scale.y=-r.size.height/r.originalHeight):(n.scale.x=e.scaleX*e.width/r.originalWidth,n.scale.y=-e.scaleY*e.height/r.originalHeight))}setMeshRegion(e,n,r){if(n.attachment===e&&n.region===r)return;n.region=r,n.attachment=e,n.texture=r.texture,r.texture.updateUvs();let s=n.geometry.getBuffer("aUV");s.data=e.regionUVs,s.update()}autoUpdateTransform(e){if(this.visible&&Dt.GLOBAL_AUTO_UPDATE){let n=e.elapsedMS*.001;this.update(n)}}createSprite(e,n,r){let s=n.region;e.hackAttachment===n&&(s=e.hackRegion);let o=s?s.texture:null,l=this.newSprite(o);return l.anchor.set(.5),s&&this.setSpriteRegion(n,l,n.region),e.sprites=e.sprites||{},e.sprites[r]=l,l}createMesh(e,n){let r=n.region;e.hackAttachment===n&&(r=e.hackRegion,e.hackAttachment=null,e.hackRegion=null);let s=this.newMesh(r?r.texture:null,new Float32Array(n.regionUVs.length),n.regionUVs,new Uint16Array(n.triangles));return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=n.color.a,s.region=n.region,r&&this.setMeshRegion(n,s,r),e.meshes=e.meshes||{},e.meshes[n.id]=s,s}createGraphics(e,n){let r=this.newGraphics(),s=new oe.Polygon([]);return r.clear(),r.poly(s).fill({color:16777215,alpha:1}),r.renderable=!1,e.currentGraphics=r,e.clippingContainer=this.newContainer(),e.clippingContainer.mask=e.currentGraphics,r}updateGraphics(e,n){let r=e.currentGraphics,s=n.worldVerticesLength;(!this.tempVertices||this.tempVertices.length<s)&&(this.tempVertices=new Float32Array(s)),n.computeWorldVertices(e,0,s,this.tempVertices,0,2);let o=Array.from(this.tempVertices.subarray(0,s));r.clear(),r.poly(o,!0).fill({color:16777215,alpha:1})}hackTextureBySlotIndex(e,n=null,r=null){let s=this.skeleton.slots[e];if(!s)return!1;let o=s.getAttachment(),l=o.region;return n?(l=new Hr,l.texture=n,l.size=r,s.hackRegion=l,s.hackAttachment=o):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(o,s.currentSprite,l):s.currentMesh&&this.setMeshRegion(o,s.currentMesh,l),!0}hackTextureBySlotName(e,n=null,r=null){let s=this.skeleton.findSlotIndex(e);return s==-1?!1:this.hackTextureBySlotIndex(s,n,r)}hackTextureAttachment(e,n,r,s=null){let o=this.skeleton.findSlotIndex(e),l=this.skeleton.getAttachmentByName(e,n);l.region.texture=r;let c=this.skeleton.slots[o];if(!c)return!1;let a=c.getAttachment();if(n===a.name){let i=l.region;return r?(i=new Hr,i.texture=r,i.size=s,c.hackRegion=i,c.hackAttachment=a):(c.hackRegion=null,c.hackAttachment=null),c.currentSprite&&c.currentSprite.region!=i?(this.setSpriteRegion(a,c.currentSprite,i),c.currentSprite.region=i):c.currentMesh&&c.currentMesh.region!=i&&this.setMeshRegion(a,c.currentMesh,i),!0}return!1}newContainer(){return new oe.Container}newSprite(e){return new Tc(e)}newGraphics(){return new oe.Graphics}newMesh(e,n,r,s,o){return new Bc(e,n,r,s,o)}transformHack(){return 1}hackAttachmentGroups(e,n,r){if(!e)return;let s=[],o=[];for(let l=0,c=this.skeleton.slots.length;l<c;l++){let a=this.skeleton.slots[l],i=a.currentSpriteName||a.currentMeshName||"",h=a.currentSprite||a.currentMesh;i.endsWith(e)?(h.parentGroup=n,o.push(h)):r&&h&&(h.parentGroup=r,s.push(h))}return[s,o]}destroy(e){this.autoUpdate=!1,this.debug=null;for(let n=0,r=this.skeleton.slots.length;n<r;n++){let s=this.skeleton.slots[n];for(let o in s.meshes)s.meshes[o].destroy(e);s.meshes=null;for(let o in s.sprites)s.sprites[o].destroy(e);s.sprites=null}for(let n=0,r=this.slotContainers.length;n<r;n++)this.slotContainers[n].destroy(e);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(e)}};m(Ee,"clippingPolygon",[]);Object.defineProperty(Ee.prototype,"visible",{get(){return this._visible},set(A){A!==this._visible&&(this._visible=A,A&&(this.lastTime=0))}});var Te=ye(ge());var Xh=class{constructor(){m(this,"registeredSpines",new Map);m(this,"drawDebug",!0);m(this,"drawMeshHull",!0);m(this,"drawMeshTriangles",!0);m(this,"drawBones",!0);m(this,"drawPaths",!0);m(this,"drawBoundingBoxes",!0);m(this,"drawClipping",!0);m(this,"drawRegionAttachments",!0);m(this,"lineWidth",1);m(this,"regionAttachmentsColor",30975);m(this,"meshHullColor",30975);m(this,"meshTrianglesColor",16763904);m(this,"clippingPolygonColor",16711935);m(this,"boundingBoxesRectColor",65280);m(this,"boundingBoxesPolygonColor",65280);m(this,"boundingBoxesCircleColor",65280);m(this,"pathsCurveColor",16711680);m(this,"pathsLineColor",16711935);m(this,"skeletonXYColor",16711680);m(this,"bonesColor",61132)}registerSpine(t){this.registeredSpines.has(t)&&console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);let e={parentDebugContainer:new Te.Container,bones:new Te.Container,skeletonXY:new Te.Graphics,regionAttachmentsShape:new Te.Graphics,meshTrianglesLine:new Te.Graphics,meshHullLine:new Te.Graphics,clippingPolygon:new Te.Graphics,boundingBoxesRect:new Te.Graphics,boundingBoxesCircle:new Te.Graphics,boundingBoxesPolygon:new Te.Graphics,pathsCurve:new Te.Graphics,pathsLine:new Te.Graphics};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),t.addChild(e.parentDebugContainer),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);let e=this.registeredSpines.get(t);e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let s=e.bones.children.length;s>0;s--)e.bones.children[s-1].destroy({children:!0,texture:!0});let n=t.scale.x||t.scale.y||1,r=this.lineWidth/n;this.drawBones&&this.drawBonesFunc(t,e,r,n),this.drawPaths&&this.drawPathsFunc(t,e,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,r),this.drawClipping&&this.drawClippingFunc(t,e,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,r)}drawBonesFunc(t,e,n,r){let s=t.skeleton,o=s.x,l=s.y,c=s.bones;for(let i=0,h=c.length;i<h;i++){let d=c[i],u=d.data.length,p=o+d.matrix.tx,f=l+d.matrix.ty,g=o+u*d.matrix.a+d.matrix.tx,b=l+u*d.matrix.b+d.matrix.ty;if(d.data.name==="root"||d.data.parent===null)continue;let x=Math.abs(p-g),y=Math.abs(f-b),w=Math.pow(x,2),k=y,S=Math.pow(y,2),I=Math.sqrt(w+S),M=Math.pow(I,2),v=Math.PI/180,E=Math.acos((M+S-w)/(2*k*I))||0;if(I===0)continue;let C=new Te.Graphics;e.bones.addChild(C);let T=I/50/r;C.poly([0,0,0-T,I-T*3,0,I-T,0+T,I-T*3]).fill({color:this.bonesColor,alpha:1}),C.x=p,C.y=f,C.pivot.y=I;let F=0;p<g&&f<b?F=-E+180*v:p>g&&f<b?F=180*v+E:p>g&&f>b?F=-E:p<g&&f>b?F=E:f===b&&p<g?F=90*v:f===b&&p>g?F=-90*v:p===g&&f<b?F=180*v:p===g&&f>b&&(F=0),C.rotation=F,C.circle(0,I,T*1.2).fill({color:0,alpha:.6}).stroke({width:n+T/2.4,color:this.bonesColor,alpha:1})}let a=n*3;e.skeletonXY.moveTo(o-a,l-a).lineTo(o+a,l+a).moveTo(o+a,l-a).lineTo(o-a,l+a).stroke({width:n,color:this.skeletonXYColor,alpha:1})}drawRegionAttachmentsFunc(t,e,n){let s=t.skeleton.slots,o=!1;for(let l=0,c=s.length;l<c;l++){let a=s[l],i=a.getAttachment();if(i==null||i.type!==0)continue;let h=i,d=new Float32Array(8);h.updateOffset&&h.updateOffset(),h.computeWorldVertices(a,d,0,2),e.regionAttachmentsShape.poly(Array.from(d.slice(0,8)),!0),o=!0}o&&e.regionAttachmentsShape.stroke({width:n,color:this.regionAttachmentsColor,alpha:1})}drawMeshHullAndMeshTriangles(t,e,n){let s=t.skeleton.slots,o=!1,l=!1;for(let c=0,a=s.length;c<a;c++){let i=s[c];if(!i.bone.active)continue;let h=i.getAttachment();if(h==null||h.type!==2)continue;let d=h,u=new Float32Array(d.worldVerticesLength),p=d.triangles,f=d.hullLength;if(d.computeWorldVertices(i,0,d.worldVerticesLength,u,0,2),this.drawMeshTriangles){l=!0;for(let g=0,b=p.length;g<b;g+=3){let x=p[g]*2,y=p[g+1]*2,w=p[g+2]*2;e.meshTrianglesLine.moveTo(u[x],u[x+1]),e.meshTrianglesLine.lineTo(u[y],u[y+1]),e.meshTrianglesLine.lineTo(u[w],u[w+1])}}if(this.drawMeshHull&&f>0){o=!0,f=(f>>1)*2;let g=u[f-2],b=u[f-1];for(let x=0,y=f;x<y;x+=2){let w=u[x],k=u[x+1];e.meshHullLine.moveTo(w,k),e.meshHullLine.lineTo(g,b),g=w,b=k}}}l&&e.meshTrianglesLine.stroke({width:n,color:this.meshTrianglesColor,alpha:1}),o&&e.meshHullLine.stroke({width:n,color:this.meshHullColor,alpha:1})}drawClippingFunc(t,e,n){let s=t.skeleton.slots,o=!1;for(let l=0,c=s.length;l<c;l++){let a=s[l];if(!a.bone.active)continue;let i=a.getAttachment();if(i==null||i.type!==6)continue;let h=i,d=h.worldVerticesLength,u=new Float32Array(d);h.computeWorldVertices(a,0,d,u,0,2),e.clippingPolygon.poly(Array.from(u),!0),o=!0}o&&e.clippingPolygon.stroke({width:n,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,n){let r=new $e;r.update(t.skeleton,!0),e.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:n,color:this.boundingBoxesRectColor,alpha:1});let s=r.polygons,o=(l,c,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");let i=[],h=n*2;for(let d=0,u=l.length;d<u;d+=2){let p=l[d],f=l[d+1];e.boundingBoxesCircle.circle(p,f,h).fill({color:this.boundingBoxesCircleColor}),i.push(p,f)}e.boundingBoxesPolygon.poly(i,!0).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:n,color:this.boundingBoxesPolygonColor})};for(let l=0,c=s.length;l<c;l++){let a=s[l];o(a,0,a.length)}}drawPathsFunc(t,e,n){let s=t.skeleton.slots,o=!1,l=!1;for(let c=0,a=s.length;c<a;c++){let i=s[c];if(!i.bone.active)continue;let h=i.getAttachment();if(h==null||h.type!==4)continue;let d=h,u=d.worldVerticesLength,p=new Float32Array(u);d.computeWorldVertices(i,0,u,p,0,2);let f=p[2],g=p[3],b=0,x=0;if(d.closed){let y=p[0],w=p[1],k=p[u-2],S=p[u-1];b=p[u-4],x=p[u-3],e.pathsCurve.moveTo(f,g),e.pathsCurve.bezierCurveTo(y,w,k,S,b,x),o=!0,e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(y,w),e.pathsLine.moveTo(b,x),e.pathsLine.lineTo(k,S),l=!0}u-=4;for(let y=4;y<u;y+=6){let w=p[y],k=p[y+1],S=p[y+2],I=p[y+3];b=p[y+4],x=p[y+5],e.pathsCurve.moveTo(f,g),e.pathsCurve.bezierCurveTo(w,k,S,I,b,x),o=!0,e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(w,k),e.pathsLine.moveTo(b,x),e.pathsLine.lineTo(S,I),l=!0,f=b,g=x}}o&&e.pathsCurve.stroke({width:n,color:this.pathsCurveColor,alpha:1}),l&&e.pathsLine.stroke({width:n,color:this.pathsLineColor,alpha:1})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t),this.registeredSpines.get(t).parentDebugContainer.destroy({children:!0,texture:!0}),this.registeredSpines.delete(t)}};var ur=ye(ge()),eu={extension:{type:ur.ExtensionType.LoadParser,priority:ur.LoaderParserPriority.Normal,name:"spine-atlas-loader"},test(A){return A.split("?")[0].split("#")[0].endsWith(".atlas")},async load(A){return await(await fetch(A)).text()},testParse(A,t){let e=t.src&&t.src.split("?")[0].split("#")[0].endsWith(".atlas"),n=typeof A=="string";return Promise.resolve(e&&n)},async parse(A,t,e){let n=t.data||{},r=ur.path.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let s=null,o=null,l=new Promise((i,h)=>{s=i,o=h}),c,a=i=>{i||o(`Something went terribly wrong loading a spine .atlas file
|
|
9
|
+
Most likely your texture failed to load.`),s(c)};if(n.image||n.images){let i=Object.assign(n.image?{default:n.image}:{},n.images);c=new Gr(A,(h,d)=>{let u=i[h]||i.default;u&&u.source?d(u.source):d(u)},a)}else c=new Gr(A,Lh(e,r,n.imageMetadata),a);return await l},unload(A){A.dispose()}},Lh=(A,t,e)=>async(n,r)=>{let s=ur.path.normalize([...t.split("/"),n].join("/")),o=await A.load({src:s,data:e});r(o.source||o)};ur.extensions.add(eu);var Wn=ye(ge());function sd(A){return A.hasOwnProperty("bones")}function nu(A){return A instanceof ArrayBuffer}var Fc=(A,t)=>A&&A.split("?")[0].split("#")[0].endsWith(t),Dc=class{constructor(){}installLoader(){console.log("installLoader");let t=this,e={extension:{type:Wn.ExtensionType.LoadParser,priority:Wn.LoaderParserPriority.Normal,name:"spine-loader"},test(n){return Fc(n,".skel")},async load(n){return await(await fetch(n)).arrayBuffer()},testParse(n,r){let s=Fc(r.src,".json")&&sd(n),o=Fc(r.src,".skel")&&nu(n),l=r.data?.spineAtlas===!1;return Promise.resolve(s&&!l||o)},async parse(n,r,s){let o=Wn.path.extname(r.src).toLowerCase(),l=Wn.path.basename(r.src,o),c=Wn.path.dirname(r.src);c&&c.lastIndexOf("/")!==c.length-1&&(c+="/");let a=Fc(r.src,".json")&&sd(n),i=null,h=n;a?i=t.createJsonParser():(i=t.createBinaryParser(),h=new Uint8Array(n));let d=r.data||{},u=d?.spineSkeletonScale??null;u&&(i.scale=u);let p=d.spineAtlas;if(p&&p.pages)return t.parseData(i,p,h);let f=d.atlasRawData;if(f){let x=null,y=null,w=new Promise((I,M)=>{x=I,y=M}),k=new Gr(f,Lh(s,c,d.imageMetadata),I=>{I||y(`Something went terribly wrong loading a spine .atlas file
|
|
10
|
+
Most likely your texture failed to load.`),x(k)}),S=await w;return t.parseData(i,S,h)}let g=d.spineAtlasFile;g||(g=`${c+l}.atlas`);let b=await s.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(i,b,h)}};return Wn.extensions.add(e),e}};var Lc={};As(Lc,{Animation:()=>Qt,AnimationState:()=>Go,AnimationStateAdapter2:()=>Uh,AnimationStateData:()=>Zo,AtlasAttachmentLoader:()=>Ko,Attachment:()=>Qi,AttachmentTimeline:()=>Kr,Bone:()=>so,BoneData:()=>Jo,BoundingBoxAttachment:()=>Lo,ClippingAttachment:()=>No,ColorTimeline:()=>_i,CurveTimeline:()=>cn,DeformTimeline:()=>qo,DrawOrderTimeline:()=>Jr,Event:()=>Qo,EventData:()=>_o,EventQueue:()=>Yc,EventTimeline:()=>$o,EventType:()=>od,IkConstraint:()=>tl,IkConstraintData:()=>el,IkConstraintTimeline:()=>eo,JitterEffect:()=>Nh,MeshAttachment:()=>Is,PathAttachment:()=>qn,PathConstraint:()=>rl,PathConstraintData:()=>nl,PathConstraintMixTimeline:()=>ro,PathConstraintPositionTimeline:()=>Cs,PathConstraintSpacingTimeline:()=>zo,PointAttachment:()=>Oo,RegionAttachment:()=>vs,RotateTimeline:()=>Fe,ScaleTimeline:()=>Uo,ShearTimeline:()=>Wo,Skeleton:()=>al,SkeletonBounds:()=>Wh,SkeletonData:()=>il,SkeletonJson:()=>hl,Skin:()=>cl,Slot:()=>Ms,SlotData:()=>ol,SpacingMode:()=>Xc,Spine:()=>$h,SwirlEffect:()=>Oh,TimelineType:()=>id,TrackEntry:()=>Pc,TransformConstraint:()=>sl,TransformConstraintData:()=>ll,TransformConstraintTimeline:()=>no,TranslateTimeline:()=>Zr,TwoColorTimeline:()=>to,VertexAttachment:()=>Be});var Qi=class{constructor(t){m(this,"name");m(this,"type");if(t==null)throw new Error("name cannot be null.");this.name=t}},Vc=class Vc extends Qi{constructor(e){super(e);m(this,"id",(Vc.nextID++&65535)<<11);m(this,"bones");m(this,"vertices");m(this,"worldVerticesLength",0)}computeWorldVerticesOld(e,n){this.computeWorldVertices(e,0,this.worldVerticesLength,n,0,2)}computeWorldVertices(e,n,r,s,o,l){r=o+(r>>1)*l;let c=e.bone.skeleton,a=e.attachmentVertices,i=this.vertices,h=this.bones;if(h==null){a.length>0&&(i=a);let f=e.bone.matrix,g=f.tx,b=f.ty,x=f.a,y=f.c,w=f.b,k=f.d;for(let S=n,I=o;I<r;S+=2,I+=l){let M=i[S],v=i[S+1];s[I]=M*x+v*y+g,s[I+1]=M*w+v*k+b}return}let d=0,u=0;for(let f=0;f<n;f+=2){let g=h[d];d+=g+1,u+=g}let p=c.bones;if(a.length==0)for(let f=o,g=u*3;f<r;f+=l){let b=0,x=0,y=h[d++];for(y+=d;d<y;d++,g+=3){let w=p[h[d]].matrix,k=i[g],S=i[g+1],I=i[g+2];b+=(k*w.a+S*w.c+w.tx)*I,x+=(k*w.b+S*w.d+w.ty)*I}s[f]=b,s[f+1]=x}else{let f=a;for(let g=o,b=u*3,x=u<<1;g<r;g+=l){let y=0,w=0,k=h[d++];for(k+=d;d<k;d++,b+=3,x+=2){let S=p[h[d]].matrix,I=i[b]+f[x],M=i[b+1]+f[x+1],v=i[b+2];y+=(I*S.a+M*S.c+S.tx)*v,w+=(I*S.b+M*S.d+S.ty)*v}s[g]=y,s[g+1]=w}}}applyDeform(e){return this==e}};m(Vc,"nextID",0);var Be=Vc;var Lo=class extends Be{constructor(e){super(e);m(this,"type",1);m(this,"color",new $(1,1,1,1))}};var No=class extends Be{constructor(e){super(e);m(this,"type",6);m(this,"endSlot");m(this,"color",new $(.2275,.2275,.8078,1))}};var Is=class extends Be{constructor(e){super(e);m(this,"type",2);m(this,"region");m(this,"path");m(this,"regionUVs");m(this,"uvs");m(this,"triangles");m(this,"color",new $(1,1,1,1));m(this,"hullLength");m(this,"parentMesh");m(this,"inheritDeform",!1);m(this,"tempColor",new $(0,0,0,0))}applyDeform(e){return this==e||this.inheritDeform&&this.parentMesh==e}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e!=null&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}};var qn=class extends Be{constructor(e){super(e);m(this,"type",4);m(this,"lengths");m(this,"closed",!1);m(this,"constantSpeed",!1);m(this,"color",new $(1,1,1,1))}};var Oo=class extends Be{constructor(e){super(e);m(this,"type",5);m(this,"x");m(this,"y");m(this,"rotation");m(this,"color",new $(.38,.94,0,1))}computeWorldPosition(e,n){let r=e.matrix;return n.x=this.x*r.a+this.y*r.c+e.worldX,n.y=this.x*r.b+this.y*r.d+e.worldY,n}computeWorldRotation(e){let n=e.matrix,r=B.cosDeg(this.rotation),s=B.sinDeg(this.rotation),o=r*n.a+s*n.c,l=r*n.b+s*n.d;return Math.atan2(l,o)*B.radDeg}};var Ms=class{constructor(t,e){m(this,"blendMode");m(this,"data");m(this,"bone");m(this,"color");m(this,"darkColor");m(this,"attachment");m(this,"attachmentTime");m(this,"attachmentVertices",new Array);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new $,this.darkColor=t.darkColor==null?null:new $,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};var at=class at extends Qi{constructor(e){super(e);m(this,"type",0);m(this,"x",0);m(this,"y",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"rotation",0);m(this,"width",0);m(this,"height",0);m(this,"color",new $(1,1,1,1));m(this,"path");m(this,"rendererObject");m(this,"region");m(this,"offset",Y.newFloatArray(8));m(this,"uvs",Y.newFloatArray(8));m(this,"tempColor",new $(1,1,1,1))}updateOffset(){let e=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*e,s=-this.height/2*this.scaleY+this.region.offsetY*n,o=r+this.region.width*e,l=s+this.region.height*n,c=this.rotation*Math.PI/180,a=Math.cos(c),i=Math.sin(c),h=r*a+this.x,d=r*i,u=s*a+this.y,p=s*i,f=o*a+this.x,g=o*i,b=l*a+this.y,x=l*i,y=this.offset;y[at.OX1]=h-p,y[at.OY1]=u+d,y[at.OX2]=h-x,y[at.OY2]=b+d,y[at.OX3]=f-x,y[at.OY3]=b+g,y[at.OX4]=f-p,y[at.OY4]=u+g}setRegion(e){this.region=e;let n=this.uvs;e.rotate?(n[2]=e.u,n[3]=e.v2,n[4]=e.u,n[5]=e.v,n[6]=e.u2,n[7]=e.v,n[0]=e.u2,n[1]=e.v2):(n[0]=e.u,n[1]=e.v2,n[2]=e.u,n[3]=e.v,n[4]=e.u2,n[5]=e.v,n[6]=e.u2,n[7]=e.v2)}computeWorldVertices(e,n,r,s){let o=this.offset,l=e instanceof Ms?e.bone.matrix:e.matrix,c=l.tx,a=l.ty,i=l.a,h=l.c,d=l.b,u=l.d,p=0,f=0;p=o[at.OX1],f=o[at.OY1],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[at.OX2],f=o[at.OY2],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[at.OX3],f=o[at.OY3],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[at.OX4],f=o[at.OY4],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a}};m(at,"OX1",0),m(at,"OY1",1),m(at,"OX2",2),m(at,"OY2",3),m(at,"OX3",4),m(at,"OY3",5),m(at,"OX4",6),m(at,"OY4",7),m(at,"X1",0),m(at,"Y1",1),m(at,"C1R",2),m(at,"C1G",3),m(at,"C1B",4),m(at,"C1A",5),m(at,"U1",6),m(at,"V1",7),m(at,"X2",8),m(at,"Y2",9),m(at,"C2R",10),m(at,"C2G",11),m(at,"C2B",12),m(at,"C2A",13),m(at,"U2",14),m(at,"V2",15),m(at,"X3",16),m(at,"Y3",17),m(at,"C3R",18),m(at,"C3G",19),m(at,"C3B",20),m(at,"C3A",21),m(at,"U3",22),m(at,"V3",23),m(at,"X4",24),m(at,"Y4",25),m(at,"C4R",26),m(at,"C4G",27),m(at,"C4B",28),m(at,"C4A",29),m(at,"U4",30),m(at,"V4",31);var vs=at;var Nh=class{constructor(t,e){m(this,"jitterX",0);m(this,"jitterY",0);this.jitterX=t,this.jitterY=e}begin(t){}transform(t,e,n,r){t.x+=B.randomTriangular(-this.jitterX,this.jitterY),t.y+=B.randomTriangular(-this.jitterX,this.jitterY)}end(){}};var Rc=class Rc{constructor(t){m(this,"centerX",0);m(this,"centerY",0);m(this,"radius",0);m(this,"angle",0);m(this,"worldX",0);m(this,"worldY",0);this.radius=t}begin(t){this.worldX=t.x+this.centerX,this.worldY=t.y+this.centerY}transform(t,e,n,r){let s=this.angle*B.degreesToRadians,o=t.x-this.worldX,l=t.y-this.worldY,c=Math.sqrt(o*o+l*l);if(c<this.radius){let a=Rc.interpolation.apply(0,s,(this.radius-c)/this.radius),i=Math.cos(a),h=Math.sin(a);t.x=i*o-h*l+this.worldX,t.y=h*o+i*l+this.worldY}}end(){}};m(Rc,"interpolation",new mr(2));var Oh=Rc;var Qt=class{constructor(t,e,n){m(this,"name");m(this,"timelines");m(this,"duration");if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=n}apply(t,e,n,r,s,o,l,c){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(n%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let i=0,h=a.length;i<h;i++)a[i].apply(t,e,n,s,o,l,c)}static binarySearch(t,e,n=1){let r=0,s=t.length/n-2;if(s==0)return n;let o=s>>>1;for(;;){if(t[(o+1)*n]<=e?r=o+1:s=o,r==s)return(r+1)*n;o=r+s>>>1}}static linearSearch(t,e,n){for(let r=0,s=t.length-n;r<=s;r+=n)if(t[r]>e)return r;return-1}},id=(f=>(f[f.rotate=0]="rotate",f[f.translate=1]="translate",f[f.scale=2]="scale",f[f.shear=3]="shear",f[f.attachment=4]="attachment",f[f.color=5]="color",f[f.deform=6]="deform",f[f.event=7]="event",f[f.drawOrder=8]="drawOrder",f[f.ikConstraint=9]="ikConstraint",f[f.transformConstraint=10]="transformConstraint",f[f.pathConstraintPosition=11]="pathConstraintPosition",f[f.pathConstraintSpacing=12]="pathConstraintSpacing",f[f.pathConstraintMix=13]="pathConstraintMix",f[f.twoColor=14]="twoColor",f))(id||{}),qt=class qt{constructor(t){m(this,"curves");if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=Y.newFloatArray((t-1)*qt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/qt.BEZIER_SIZE+1}setLinear(t){this.curves[t*qt.BEZIER_SIZE]=qt.LINEAR}setStepped(t){this.curves[t*qt.BEZIER_SIZE]=qt.STEPPED}getCurveType(t){let e=t*qt.BEZIER_SIZE;if(e==this.curves.length)return qt.LINEAR;let n=this.curves[e];return n==qt.LINEAR?qt.LINEAR:n==qt.STEPPED?qt.STEPPED:qt.BEZIER}setCurve(t,e,n,r,s){let o=(-e*2+r)*.03,l=(-n*2+s)*.03,c=((e-r)*3+1)*.006,a=((n-s)*3+1)*.006,i=o*2+c,h=l*2+a,d=e*.3+o+c*.16666667,u=n*.3+l+a*.16666667,p=t*qt.BEZIER_SIZE,f=this.curves;f[p++]=qt.BEZIER;let g=d,b=u;for(let x=p+qt.BEZIER_SIZE-1;p<x;p+=2)f[p]=g,f[p+1]=b,d+=i,u+=h,i+=c,h+=a,g+=d,b+=u}getCurvePercent(t,e){e=B.clamp(e,0,1);let n=this.curves,r=t*qt.BEZIER_SIZE,s=n[r];if(s==qt.LINEAR)return e;if(s==qt.STEPPED)return 0;r++;let o=0;for(let c=r,a=r+qt.BEZIER_SIZE-1;r<a;r+=2)if(o=n[r],o>=e){let i,h;return r==c?(i=0,h=0):(i=n[r-2],h=n[r-1]),h+(n[r+1]-h)*(e-i)/(o-i)}let l=n[r-1];return l+(1-l)*(e-o)/(1-o)}};m(qt,"LINEAR",0),m(qt,"STEPPED",1),m(qt,"BEZIER",2),m(qt,"BEZIER_SIZE",10*2-1);var cn=qt,ze=class ze extends cn{constructor(e){super(e);m(this,"boneIndex");m(this,"frames");this.frames=Y.newFloatArray(e<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(e,n,r){e<<=1,this.frames[e]=n,this.frames[e+ze.ROTATION]=r}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.bones[this.boneIndex];if(r<a[0]){switch(l){case 0:i.rotation=i.data.rotation;return;case 1:let g=i.data.rotation-i.rotation;i.rotation+=(g-(16384-(16384.499999999996-g/360|0))*360)*o}return}if(r>=a[a.length-ze.ENTRIES]){let g=a[a.length+ze.PREV_ROTATION];switch(l){case 0:i.rotation=i.data.rotation+g*o;break;case 1:case 2:g+=i.data.rotation-i.rotation,g-=(16384-(16384.499999999996-g/360|0))*360;case 3:i.rotation+=g*o}return}let h=Qt.binarySearch(a,r,ze.ENTRIES),d=a[h+ze.PREV_ROTATION],u=a[h],p=this.getCurvePercent((h>>1)-1,1-(r-u)/(a[h+ze.PREV_TIME]-u)),f=a[h+ze.ROTATION]-d;switch(f=d+(f-(16384-(16384.499999999996-f/360|0))*360)*p,l){case 0:i.rotation=i.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*o;break;case 1:case 2:f+=i.data.rotation-i.rotation;case 3:i.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*o}}};m(ze,"ENTRIES",2),m(ze,"PREV_TIME",-2),m(ze,"PREV_ROTATION",-1),m(ze,"ROTATION",1);var Fe=ze,ne=class ne extends cn{constructor(e){super(e);m(this,"boneIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ne.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(e,n,r,s){e*=ne.ENTRIES,this.frames[e]=n,this.frames[e+ne.X]=r,this.frames[e+ne.Y]=s}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.bones[this.boneIndex];if(r<a[0]){switch(l){case 0:i.x=i.data.x,i.y=i.data.y;return;case 1:i.x+=(i.data.x-i.x)*o,i.y+=(i.data.y-i.y)*o}return}let h=0,d=0;if(r>=a[a.length-ne.ENTRIES])h=a[a.length+ne.PREV_X],d=a[a.length+ne.PREV_Y];else{let u=Qt.binarySearch(a,r,ne.ENTRIES);h=a[u+ne.PREV_X],d=a[u+ne.PREV_Y];let p=a[u],f=this.getCurvePercent(u/ne.ENTRIES-1,1-(r-p)/(a[u+ne.PREV_TIME]-p));h+=(a[u+ne.X]-h)*f,d+=(a[u+ne.Y]-d)*f}switch(l){case 0:i.x=i.data.x+h*o,i.y=i.data.y+d*o;break;case 1:case 2:i.x+=(i.data.x+h-i.x)*o,i.y+=(i.data.y+d-i.y)*o;break;case 3:i.x+=h*o,i.y+=d*o}}};m(ne,"ENTRIES",3),m(ne,"PREV_TIME",-3),m(ne,"PREV_X",-2),m(ne,"PREV_Y",-1),m(ne,"X",1),m(ne,"Y",2);var Zr=ne,Uo=class A extends Zr{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.bones[this.boneIndex];if(n<c[0]){switch(o){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*s,a.scaleY+=(a.data.scaleY-a.scaleY)*s}return}let i=0,h=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_X]*a.data.scaleX,h=c[c.length+A.PREV_Y]*a.data.scaleY;else{let d=Qt.binarySearch(c,n,A.ENTRIES);i=c[d+A.PREV_X],h=c[d+A.PREV_Y];let u=c[d],p=this.getCurvePercent(d/A.ENTRIES-1,1-(n-u)/(c[d+A.PREV_TIME]-u));i=(i+(c[d+A.X]-i)*p)*a.data.scaleX,h=(h+(c[d+A.Y]-h)*p)*a.data.scaleY}if(s==1)o==3?(a.scaleX+=i-a.data.scaleX,a.scaleY+=h-a.data.scaleY):(a.scaleX=i,a.scaleY=h);else{let d=0,u=0;if(l==1)switch(o){case 0:d=a.data.scaleX,u=a.data.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-d)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-u)*s;break;case 1:case 2:d=a.scaleX,u=a.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-d)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-u)*s;break;case 3:d=a.scaleX,u=a.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-a.data.scaleX)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-a.data.scaleY)*s}else switch(o){case 0:d=Math.abs(a.data.scaleX)*B.signum(i),u=Math.abs(a.data.scaleY)*B.signum(h),a.scaleX=d+(i-d)*s,a.scaleY=u+(h-u)*s;break;case 1:case 2:d=Math.abs(a.scaleX)*B.signum(i),u=Math.abs(a.scaleY)*B.signum(h),a.scaleX=d+(i-d)*s,a.scaleY=u+(h-u)*s;break;case 3:d=B.signum(i),u=B.signum(h),a.scaleX=Math.abs(a.scaleX)*d+(i-Math.abs(a.data.scaleX)*d)*s,a.scaleY=Math.abs(a.scaleY)*u+(h-Math.abs(a.data.scaleY)*u)*s}}}},Wo=class A extends Zr{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.bones[this.boneIndex];if(n<c[0]){switch(o){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*s,a.shearY+=(a.data.shearY-a.shearY)*s}return}let i=0,h=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_X],h=c[c.length+A.PREV_Y];else{let d=Qt.binarySearch(c,n,A.ENTRIES);i=c[d+A.PREV_X],h=c[d+A.PREV_Y];let u=c[d],p=this.getCurvePercent(d/A.ENTRIES-1,1-(n-u)/(c[d+A.PREV_TIME]-u));i=i+(c[d+A.X]-i)*p,h=h+(c[d+A.Y]-h)*p}switch(o){case 0:a.shearX=a.data.shearX+i*s,a.shearY=a.data.shearY+h*s;break;case 1:case 2:a.shearX+=(a.data.shearX+i-a.shearX)*s,a.shearY+=(a.data.shearY+h-a.shearY)*s;break;case 3:a.shearX+=i*s,a.shearY+=h*s}}},vt=class vt extends cn{constructor(e){super(e);m(this,"slotIndex");m(this,"frames");this.frames=Y.newFloatArray(e*vt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(e,n,r,s,o,l){e*=vt.ENTRIES,this.frames[e]=n,this.frames[e+vt.R]=r,this.frames[e+vt.G]=s,this.frames[e+vt.B]=o,this.frames[e+vt.A]=l}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex],i=this.frames;if(r<i[0]){switch(l){case 0:a.color.setFromColor(a.data.color);return;case 1:let f=a.color,g=a.data.color;f.add((g.r-f.r)*o,(g.g-f.g)*o,(g.b-f.b)*o,(g.a-f.a)*o)}return}let h=0,d=0,u=0,p=0;if(r>=i[i.length-vt.ENTRIES]){let f=i.length;h=i[f+vt.PREV_R],d=i[f+vt.PREV_G],u=i[f+vt.PREV_B],p=i[f+vt.PREV_A]}else{let f=Qt.binarySearch(i,r,vt.ENTRIES);h=i[f+vt.PREV_R],d=i[f+vt.PREV_G],u=i[f+vt.PREV_B],p=i[f+vt.PREV_A];let g=i[f],b=this.getCurvePercent(f/vt.ENTRIES-1,1-(r-g)/(i[f+vt.PREV_TIME]-g));h+=(i[f+vt.R]-h)*b,d+=(i[f+vt.G]-d)*b,u+=(i[f+vt.B]-u)*b,p+=(i[f+vt.A]-p)*b}if(o==1)a.color.set(h,d,u,p);else{let f=a.color;l==0&&f.setFromColor(a.data.color),f.add((h-f.r)*o,(d-f.g)*o,(u-f.b)*o,(p-f.a)*o)}}};m(vt,"ENTRIES",5),m(vt,"PREV_TIME",-5),m(vt,"PREV_R",-4),m(vt,"PREV_G",-3),m(vt,"PREV_B",-2),m(vt,"PREV_A",-1),m(vt,"R",1),m(vt,"G",2),m(vt,"B",3),m(vt,"A",4);var _i=vt,ot=class ot extends cn{constructor(e){super(e);m(this,"slotIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(e,n,r,s,o,l,c,a,i){e*=ot.ENTRIES,this.frames[e]=n,this.frames[e+ot.R]=r,this.frames[e+ot.G]=s,this.frames[e+ot.B]=o,this.frames[e+ot.A]=l,this.frames[e+ot.R2]=c,this.frames[e+ot.G2]=a,this.frames[e+ot.B2]=i}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex],i=this.frames;if(r<i[0]){switch(l){case 0:a.color.setFromColor(a.data.color),a.darkColor.setFromColor(a.data.darkColor);return;case 1:let x=a.color,y=a.darkColor,w=a.data.color,k=a.data.darkColor;x.add((w.r-x.r)*o,(w.g-x.g)*o,(w.b-x.b)*o,(w.a-x.a)*o),y.add((k.r-y.r)*o,(k.g-y.g)*o,(k.b-y.b)*o,0)}return}let h=0,d=0,u=0,p=0,f=0,g=0,b=0;if(r>=i[i.length-ot.ENTRIES]){let x=i.length;h=i[x+ot.PREV_R],d=i[x+ot.PREV_G],u=i[x+ot.PREV_B],p=i[x+ot.PREV_A],f=i[x+ot.PREV_R2],g=i[x+ot.PREV_G2],b=i[x+ot.PREV_B2]}else{let x=Qt.binarySearch(i,r,ot.ENTRIES);h=i[x+ot.PREV_R],d=i[x+ot.PREV_G],u=i[x+ot.PREV_B],p=i[x+ot.PREV_A],f=i[x+ot.PREV_R2],g=i[x+ot.PREV_G2],b=i[x+ot.PREV_B2];let y=i[x],w=this.getCurvePercent(x/ot.ENTRIES-1,1-(r-y)/(i[x+ot.PREV_TIME]-y));h+=(i[x+ot.R]-h)*w,d+=(i[x+ot.G]-d)*w,u+=(i[x+ot.B]-u)*w,p+=(i[x+ot.A]-p)*w,f+=(i[x+ot.R2]-f)*w,g+=(i[x+ot.G2]-g)*w,b+=(i[x+ot.B2]-b)*w}if(o==1)a.color.set(h,d,u,p),a.darkColor.set(f,g,b,1);else{let x=a.color,y=a.darkColor;l==0&&(x.setFromColor(a.data.color),y.setFromColor(a.data.darkColor)),x.add((h-x.r)*o,(d-x.g)*o,(u-x.b)*o,(p-x.a)*o),y.add((f-y.r)*o,(g-y.g)*o,(b-y.b)*o,0)}}};m(ot,"ENTRIES",8),m(ot,"PREV_TIME",-8),m(ot,"PREV_R",-7),m(ot,"PREV_G",-6),m(ot,"PREV_B",-5),m(ot,"PREV_A",-4),m(ot,"PREV_R2",-3),m(ot,"PREV_G2",-2),m(ot,"PREV_B2",-1),m(ot,"R",1),m(ot,"G",2),m(ot,"B",3),m(ot,"A",4),m(ot,"R2",5),m(ot,"G2",6),m(ot,"B2",7);var to=ot,Kr=class{constructor(t){m(this,"slotIndex");m(this,"frames");m(this,"attachmentNames");this.frames=Y.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n}apply(t,e,n,r,s,o,l){let c=t.slots[this.slotIndex];if(l==1&&o==0){let d=c.data.attachmentName;c.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}let a=this.frames;if(n<a[0]){if(o==0||o==1){let d=c.data.attachmentName;c.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let i=0;n>=a[a.length-1]?i=a.length-1:i=Qt.binarySearch(a,n,1)-1;let h=this.attachmentNames[i];t.slots[this.slotIndex].setAttachment(h==null?null:t.getAttachment(this.slotIndex,h))}},ad=null,qo=class extends cn{constructor(e){super(e);m(this,"slotIndex");m(this,"attachment");m(this,"frames");m(this,"frameVertices");this.frames=Y.newFloatArray(e),this.frameVertices=new Array(e),ad==null&&(ad=Y.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(e,n,r){this.frames[e]=n,this.frameVertices[e]=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex],i=a.getAttachment();if(!(i instanceof Be)||!i.applyDeform(this.attachment))return;let h=a.attachmentVertices;h.length==0&&(l=0);let d=this.frameVertices,u=d[0].length,p=this.frames;if(r<p[0]){let k=i;switch(l){case 0:h.length=0;return;case 1:if(o==1){h.length=0;break}let S=Y.setArraySize(h,u);if(k.bones==null){let I=k.vertices;for(let M=0;M<u;M++)S[M]+=(I[M]-S[M])*o}else{o=1-o;for(let I=0;I<u;I++)S[I]*=o}}return}let f=Y.setArraySize(h,u);if(r>=p[p.length-1]){let k=d[p.length-1];if(o==1)if(l==3){let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++)f[M]+=k[M]-I[M]}else for(let I=0;I<u;I++)f[I]+=k[I]}else Y.arrayCopy(k,0,f,0,u);else switch(l){case 0:{let I=i;if(I.bones==null){let M=I.vertices;for(let v=0;v<u;v++){let E=M[v];f[v]=E+(k[v]-E)*o}}else for(let M=0;M<u;M++)f[M]=k[M]*o;break}case 1:case 2:for(let I=0;I<u;I++)f[I]+=(k[I]-f[I])*o;case 3:let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++)f[M]+=(k[M]-I[M])*o}else for(let I=0;I<u;I++)f[I]+=k[I]*o}return}let g=Qt.binarySearch(p,r),b=d[g-1],x=d[g],y=p[g],w=this.getCurvePercent(g-1,1-(r-y)/(p[g-1]-y));if(o==1)if(l==3){let k=i;if(k.bones==null){let S=k.vertices;for(let I=0;I<u;I++){let M=b[I];f[I]+=M+(x[I]-M)*w-S[I]}}else for(let S=0;S<u;S++){let I=b[S];f[S]+=I+(x[S]-I)*w}}else for(let k=0;k<u;k++){let S=b[k];f[k]=S+(x[k]-S)*w}else switch(l){case 0:{let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++){let v=b[M],E=I[M];f[M]=E+(v+(x[M]-v)*w-E)*o}}else for(let I=0;I<u;I++){let M=b[I];f[I]=(M+(x[I]-M)*w)*o}break}case 1:case 2:for(let S=0;S<u;S++){let I=b[S];f[S]+=(I+(x[S]-I)*w-f[S])*o}break;case 3:let k=i;if(k.bones==null){let S=k.vertices;for(let I=0;I<u;I++){let M=b[I];f[I]+=(M+(x[I]-M)*w-S[I])*o}}else for(let S=0;S<u;S++){let I=b[S];f[S]+=(I+(x[S]-I)*w)*o}}}},$o=class{constructor(t){m(this,"frames");m(this,"events");this.frames=Y.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,n,r,s,o,l){if(r==null)return;let c=this.frames,a=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,s,o,l),e=-1;else if(e>=c[a-1])return;if(n<c[0])return;let i=0;if(e<c[0])i=0;else{i=Qt.binarySearch(c,e);let h=c[i];for(;i>0&&c[i-1]==h;)i--}for(;i<a&&n>=c[i];i++)r.push(this.events[i])}},Jr=class{constructor(t){m(this,"frames");m(this,"drawOrders");this.frames=Y.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}apply(t,e,n,r,s,o,l){let c=t.drawOrder,a=t.slots;if(l==1&&o==0){Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let i=this.frames;if(n<i[0]){(o==0||o==1)&&Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let h=0;n>=i[i.length-1]?h=i.length-1:h=Qt.binarySearch(i,n)-1;let d=this.drawOrders[h];if(d==null)Y.arrayCopy(a,0,c,0,a.length);else for(let u=0,p=d.length;u<p;u++)c[u]=a[d[u]]}},ft=class ft extends cn{constructor(e){super(e);m(this,"ikConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ft.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(e,n,r,s,o,l){e*=ft.ENTRIES,this.frames[e]=n,this.frames[e+ft.MIX]=r,this.frames[e+ft.BEND_DIRECTION]=s,this.frames[e+ft.COMPRESS]=o?1:0,this.frames[e+ft.STRETCH]=l?1:0}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.ikConstraints[this.ikConstraintIndex];if(r<a[0]){switch(l){case 0:i.mix=i.data.mix,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch;return;case 1:i.mix+=(i.data.mix-i.mix)*o,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch}return}if(r>=a[a.length-ft.ENTRIES]){l==0?(i.mix=i.data.mix+(a[a.length+ft.PREV_MIX]-i.data.mix)*o,c==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=a[a.length+ft.PREV_BEND_DIRECTION],i.compress=a[a.length+ft.PREV_COMPRESS]!=0,i.stretch=a[a.length+ft.PREV_STRETCH]!=0)):(i.mix+=(a[a.length+ft.PREV_MIX]-i.mix)*o,c==0&&(i.bendDirection=a[a.length+ft.PREV_BEND_DIRECTION],i.compress=a[a.length+ft.PREV_COMPRESS]!=0,i.stretch=a[a.length+ft.PREV_STRETCH]!=0));return}let h=Qt.binarySearch(a,r,ft.ENTRIES),d=a[h+ft.PREV_MIX],u=a[h],p=this.getCurvePercent(h/ft.ENTRIES-1,1-(r-u)/(a[h+ft.PREV_TIME]-u));l==0?(i.mix=i.data.mix+(d+(a[h+ft.MIX]-d)*p-i.data.mix)*o,c==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=a[h+ft.PREV_BEND_DIRECTION],i.compress=a[h+ft.PREV_COMPRESS]!=0,i.stretch=a[h+ft.PREV_STRETCH]!=0)):(i.mix+=(d+(a[h+ft.MIX]-d)*p-i.mix)*o,c==0&&(i.bendDirection=a[h+ft.PREV_BEND_DIRECTION],i.compress=a[h+ft.PREV_COMPRESS]!=0,i.stretch=a[h+ft.PREV_STRETCH]!=0))}};m(ft,"ENTRIES",5),m(ft,"PREV_TIME",-5),m(ft,"PREV_MIX",-4),m(ft,"PREV_BEND_DIRECTION",-3),m(ft,"PREV_COMPRESS",-2),m(ft,"PREV_STRETCH",-1),m(ft,"MIX",1),m(ft,"BEND_DIRECTION",2),m(ft,"COMPRESS",3),m(ft,"STRETCH",4);var eo=ft,Ct=class Ct extends cn{constructor(e){super(e);m(this,"transformConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*Ct.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(e,n,r,s,o,l){e*=Ct.ENTRIES,this.frames[e]=n,this.frames[e+Ct.ROTATE]=r,this.frames[e+Ct.TRANSLATE]=s,this.frames[e+Ct.SCALE]=o,this.frames[e+Ct.SHEAR]=l}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.transformConstraints[this.transformConstraintIndex];if(r<a[0]){let f=i.data;switch(l){case 0:i.rotateMix=f.rotateMix,i.translateMix=f.translateMix,i.scaleMix=f.scaleMix,i.shearMix=f.shearMix;return;case 1:i.rotateMix+=(f.rotateMix-i.rotateMix)*o,i.translateMix+=(f.translateMix-i.translateMix)*o,i.scaleMix+=(f.scaleMix-i.scaleMix)*o,i.shearMix+=(f.shearMix-i.shearMix)*o}return}let h=0,d=0,u=0,p=0;if(r>=a[a.length-Ct.ENTRIES]){let f=a.length;h=a[f+Ct.PREV_ROTATE],d=a[f+Ct.PREV_TRANSLATE],u=a[f+Ct.PREV_SCALE],p=a[f+Ct.PREV_SHEAR]}else{let f=Qt.binarySearch(a,r,Ct.ENTRIES);h=a[f+Ct.PREV_ROTATE],d=a[f+Ct.PREV_TRANSLATE],u=a[f+Ct.PREV_SCALE],p=a[f+Ct.PREV_SHEAR];let g=a[f],b=this.getCurvePercent(f/Ct.ENTRIES-1,1-(r-g)/(a[f+Ct.PREV_TIME]-g));h+=(a[f+Ct.ROTATE]-h)*b,d+=(a[f+Ct.TRANSLATE]-d)*b,u+=(a[f+Ct.SCALE]-u)*b,p+=(a[f+Ct.SHEAR]-p)*b}if(l==0){let f=i.data;i.rotateMix=f.rotateMix+(h-f.rotateMix)*o,i.translateMix=f.translateMix+(d-f.translateMix)*o,i.scaleMix=f.scaleMix+(u-f.scaleMix)*o,i.shearMix=f.shearMix+(p-f.shearMix)*o}else i.rotateMix+=(h-i.rotateMix)*o,i.translateMix+=(d-i.translateMix)*o,i.scaleMix+=(u-i.scaleMix)*o,i.shearMix+=(p-i.shearMix)*o}};m(Ct,"ENTRIES",5),m(Ct,"PREV_TIME",-5),m(Ct,"PREV_ROTATE",-4),m(Ct,"PREV_TRANSLATE",-3),m(Ct,"PREV_SCALE",-2),m(Ct,"PREV_SHEAR",-1),m(Ct,"ROTATE",1),m(Ct,"TRANSLATE",2),m(Ct,"SCALE",3),m(Ct,"SHEAR",4);var no=Ct,Me=class Me extends cn{constructor(e){super(e);m(this,"pathConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*Me.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(e,n,r){e*=Me.ENTRIES,this.frames[e]=n,this.frames[e+Me.VALUE]=r}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.pathConstraints[this.pathConstraintIndex];if(r<a[0]){switch(l){case 0:i.position=i.data.position;return;case 1:i.position+=(i.data.position-i.position)*o}return}let h=0;if(r>=a[a.length-Me.ENTRIES])h=a[a.length+Me.PREV_VALUE];else{let d=Qt.binarySearch(a,r,Me.ENTRIES);h=a[d+Me.PREV_VALUE];let u=a[d],p=this.getCurvePercent(d/Me.ENTRIES-1,1-(r-u)/(a[d+Me.PREV_TIME]-u));h+=(a[d+Me.VALUE]-h)*p}l==0?i.position=i.data.position+(h-i.data.position)*o:i.position+=(h-i.position)*o}};m(Me,"ENTRIES",2),m(Me,"PREV_TIME",-2),m(Me,"PREV_VALUE",-1),m(Me,"VALUE",1);var Cs=Me,zo=class A extends Cs{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(n<c[0]){switch(o){case 0:a.spacing=a.data.spacing;return;case 1:a.spacing+=(a.data.spacing-a.spacing)*s}return}let i=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_VALUE];else{let h=Qt.binarySearch(c,n,A.ENTRIES);i=c[h+A.PREV_VALUE];let d=c[h],u=this.getCurvePercent(h/A.ENTRIES-1,1-(n-d)/(c[h+A.PREV_TIME]-d));i+=(c[h+A.VALUE]-i)*u}o==0?a.spacing=a.data.spacing+(i-a.data.spacing)*s:a.spacing+=(i-a.spacing)*s}},re=class re extends cn{constructor(e){super(e);m(this,"pathConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*re.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(e,n,r,s){e*=re.ENTRIES,this.frames[e]=n,this.frames[e+re.ROTATE]=r,this.frames[e+re.TRANSLATE]=s}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.pathConstraints[this.pathConstraintIndex];if(r<a[0]){switch(l){case 0:i.rotateMix=i.data.rotateMix,i.translateMix=i.data.translateMix;return;case 1:i.rotateMix+=(i.data.rotateMix-i.rotateMix)*o,i.translateMix+=(i.data.translateMix-i.translateMix)*o}return}let h=0,d=0;if(r>=a[a.length-re.ENTRIES])h=a[a.length+re.PREV_ROTATE],d=a[a.length+re.PREV_TRANSLATE];else{let u=Qt.binarySearch(a,r,re.ENTRIES);h=a[u+re.PREV_ROTATE],d=a[u+re.PREV_TRANSLATE];let p=a[u],f=this.getCurvePercent(u/re.ENTRIES-1,1-(r-p)/(a[u+re.PREV_TIME]-p));h+=(a[u+re.ROTATE]-h)*f,d+=(a[u+re.TRANSLATE]-d)*f}l==0?(i.rotateMix=i.data.rotateMix+(h-i.data.rotateMix)*o,i.translateMix=i.data.translateMix+(d-i.data.translateMix)*o):(i.rotateMix+=(h-i.rotateMix)*o,i.translateMix+=(d-i.translateMix)*o)}};m(re,"ENTRIES",3),m(re,"PREV_TIME",-3),m(re,"PREV_ROTATE",-2),m(re,"PREV_TRANSLATE",-1),m(re,"ROTATE",1),m(re,"TRANSLATE",2);var ro=re;var Nt=class Nt{constructor(t){m(this,"data");m(this,"tracks",new Array);m(this,"events",new Array);m(this,"listeners",new Array);m(this,"queue",new Yc(this));m(this,"propertyIDs",new ks);m(this,"animationsChanged",!1);m(this,"timeScale",1);m(this,"trackEntryPool",new qe(()=>new Pc));m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd");this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s==null)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let o=t*s.timeScale;if(s.delay>0){if(s.delay-=o,s.delay>0)continue;o=-s.delay,s.delay=0}let l=s.next;if(l!=null){let c=s.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime=s.timeScale==0?0:(c/s.timeScale+t)*l.timeScale,s.trackTime+=o,this.setCurrent(n,l,!0);l.mixingFrom!=null;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&s.mixingFrom==null){e[n]=null,this.queue.end(s),this.disposeNext(s);continue}if(s.mixingFrom!=null&&this.updateMixingFrom(s,t)){let c=s.mixingFrom;for(s.mixingFrom=null,c!=null&&(c.mixingTo=null);c!=null;)this.queue.end(c),c=c.mixingFrom}s.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let n=t.mixingFrom;if(n==null)return!0;let r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((n.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}apply(t){if(t==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,n=this.tracks,r=!1;for(let s=0,o=n.length;s<o;s++){let l=n[s];if(l==null||l.delay>0)continue;r=!0;let c=s==0?1:l.mixBlend,a=l.alpha;l.mixingFrom!=null?a*=this.applyMixingFrom(l,t,c):l.trackTime>=l.trackEnd&&l.next==null&&(a=0);let i=l.animationLast,h=l.getAnimationTime(),d=l.animation.timelines.length,u=l.animation.timelines;if(s==0&&a==1||c==3)for(let p=0;p<d;p++)Y.webkit602BugfixHelper(a,c),u[p].apply(t,i,h,e,a,c,0);else{let p=l.timelineMode,f=l.timelinesRotation.length==0;f&&Y.setArraySize(l.timelinesRotation,d<<1,null);let g=l.timelinesRotation;for(let b=0;b<d;b++){let x=u[b],y=p[b]==Nt.SUBSEQUENT?c:0;x instanceof Fe?this.applyRotateTimeline(x,t,h,a,y,g,b<<1,f):(Y.webkit602BugfixHelper(a,c),x.apply(t,i,h,e,a,y,0))}}this.queueEvents(l,h),e.length=0,l.nextAnimationLast=h,l.nextTrackLast=l.trackTime}return this.queue.drain(),r}applyMixingFrom(t,e,n){let r=t.mixingFrom;r.mixingFrom!=null&&this.applyMixingFrom(r,e,n);let s=0;t.mixDuration==0?(s=1,n==1&&(n=0)):(s=t.mixTime/t.mixDuration,s>1&&(s=1),n!=1&&(n=r.mixBlend));let o=s<r.eventThreshold?this.events:null,l=s<r.attachmentThreshold,c=s<r.drawOrderThreshold,a=r.animationLast,i=r.getAnimationTime(),h=r.animation.timelines.length,d=r.animation.timelines,u=r.alpha*t.interruptAlpha,p=u*(1-s);if(n==3)for(let f=0;f<h;f++)d[f].apply(e,a,i,o,p,n,1);else{let f=r.timelineMode,g=r.timelineHoldMix,b=r.timelinesRotation.length==0;b&&Y.setArraySize(r.timelinesRotation,h<<1,null);let x=r.timelinesRotation;r.totalAlpha=0;for(let y=0;y<h;y++){let w=d[y],k=1,S,I=0;switch(f[y]){case Nt.SUBSEQUENT:if(!l&&w instanceof Kr||!c&&w instanceof Jr)continue;S=n,I=p;break;case Nt.FIRST:S=0,I=p;break;case Nt.HOLD:S=0,I=u;break;default:S=0;let M=g[y];I=u*Math.max(0,1-M.mixTime/M.mixDuration);break}r.totalAlpha+=I,w instanceof Fe?this.applyRotateTimeline(w,e,i,I,S,x,y<<1,b):(Y.webkit602BugfixHelper(I,n),S==0&&(w instanceof Kr?l&&(k=1):w instanceof Jr&&c&&(k=1)),w.apply(e,a,i,o,I,S,k))}}return t.mixDuration>0&&this.queueEvents(r,i),this.events.length=0,r.nextAnimationLast=i,r.nextTrackLast=r.trackTime,s}applyRotateTimeline(t,e,n,r,s,o,l,c){if(c&&(o[l]=0),r==1){t.apply(e,0,n,null,1,s,0);return}let a=t,i=a.frames,h=e.bones[a.boneIndex],d=0,u=0;if(n<i[0])switch(s){case 0:h.rotation=h.data.rotation;default:return;case 1:d=h.rotation,u=h.data.rotation}else if(d=s==0?h.data.rotation:h.rotation,n>=i[i.length-Fe.ENTRIES])u=h.data.rotation+i[i.length+Fe.PREV_ROTATION];else{let g=Qt.binarySearch(i,n,Fe.ENTRIES),b=i[g+Fe.PREV_ROTATION],x=i[g],y=a.getCurvePercent((g>>1)-1,1-(n-x)/(i[g+Fe.PREV_TIME]-x));u=i[g+Fe.ROTATION]-b,u-=(16384-(16384.499999999996-u/360|0))*360,u=b+u*y+h.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let p=0,f=u-d;if(f-=(16384-(16384.499999999996-f/360|0))*360,f==0)p=o[l];else{let g=0,b=0;c?(g=0,b=f):(g=o[l],b=o[l+1]);let x=f>0,y=g>=0;B.signum(b)!=B.signum(f)&&Math.abs(b)<=90&&(Math.abs(g)>180&&(g+=360*B.signum(g)),y=x),p=f+g-g%360,y!=x&&(p+=360*B.signum(g)),o[l]=p}o[l+1]=f,d+=p*r,h.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(t,e){let n=t.animationStart,r=t.animationEnd,s=r-n,o=t.trackLast%s,l=this.events,c=0,a=l.length;for(;c<a;c++){let h=l[c];if(h.time<o)break;h.time>r||this.queue.event(t,h)}let i=!1;for(t.loop?i=s==0||o>t.trackTime%s:i=e>=r&&t.animationLast<r,i&&this.queue.complete(t);c<a;c++)l[c].time<n||this.queue.event(t,l[c])}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);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==null)return;this.queue.end(e),this.disposeNext(e);let n=e;for(;;){let r=n.mixingFrom;if(r==null)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){let r=this.expandToIndex(t);this.tracks[t]=e,r!=null&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom!=null&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n){let r=this.data.skeletonData.findAnimation(e);if(r==null)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,n)}setAnimationWith(t,e,n){if(e==null)throw new Error("animation cannot be null.");let r=!0,s=this.expandToIndex(t);s!=null&&(s.nextTrackLast==-1?(this.tracks[t]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.disposeNext(s),s=s.mixingFrom,r=!1):this.disposeNext(s));let o=this.trackEntry(t,e,n,s);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,e,n,r){let s=this.data.skeletonData.findAnimation(e);if(s==null)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,s,n,r)}addAnimationWith(t,e,n,r){if(e==null)throw new Error("animation cannot be null.");let s=this.expandToIndex(t);if(s!=null)for(;s.next!=null;)s=s.next;let o=this.trackEntry(t,e,n,s);if(s==null)this.setCurrent(t,o,!0),this.queue.drain();else if(s.next=o,r<=0){let l=s.animationEnd-s.animationStart;l!=0?(s.loop?r+=l*(1+(s.trackTime/l|0)):r+=Math.max(l,s.trackTime),r-=this.data.getMix(s.animation,e)):r=s.trackTime}return o.delay=r,o}setEmptyAnimation(t,e){let n=this.setAnimationWith(t,Nt.emptyAnimation,!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e,n){n<=0&&(n-=e);let r=this.addAnimationWith(t,Nt.emptyAnimation,!1,n);return r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,r=this.tracks.length;n<r;n++){let s=this.tracks[n];s!=null&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(Y.ensureArrayCapacity(this.tracks,t-this.tracks.length+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,n,r){let s=this.trackEntryPool.obtain();return s.trackIndex=t,s.animation=e,s.loop=n,s.holdPrevious=!1,s.eventThreshold=0,s.attachmentThreshold=0,s.drawOrderThreshold=0,s.animationStart=0,s.animationEnd=e.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.interruptAlpha=1,s.mixTime=0,s.mixDuration=r==null?0:this.data.getMix(r.animation,e),s}disposeNext(t){let e=t.next;for(;e!=null;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let t=0,e=this.tracks.length;t<e;t++){let n=this.tracks[t];if(n!=null){for(;n.mixingFrom!=null;)n=n.mixingFrom;do(n.mixingFrom==null||n.mixBlend!=3)&&this.setTimelineModes(n),n=n.mixingTo;while(n!=null)}}}setTimelineModes(t){let e=t.mixingTo,n=t.animation.timelines,r=t.animation.timelines.length,s=Y.setArraySize(t.timelineMode,r);t.timelineHoldMix.length=0;let o=Y.setArraySize(t.timelineHoldMix,r),l=this.propertyIDs;if(e!=null&&e.holdPrevious){for(let c=0;c<r;c++)l.add(n[c].getPropertyId()),s[c]=Nt.HOLD;return}t:for(let c=0;c<r;c++){let a=n[c].getPropertyId();if(!l.add(a))s[c]=Nt.SUBSEQUENT;else if(e==null||!this.hasTimeline(e,a))s[c]=Nt.FIRST;else{for(let i=e.mixingTo;i!=null;i=i.mixingTo)if(!this.hasTimeline(i,a)){if(t.mixDuration>0){s[c]=Nt.HOLD_MIX,o[c]=i;continue t}break}s[c]=Nt.HOLD}}}hasTimeline(t,e){let n=t.animation.timelines;for(let r=0,s=n.length;r<s;r++)if(n[r].getPropertyId()==e)return!0;return!1}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(t==null)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()}setAnimationByName(t,e,n){Nt.deprecatedWarning1||(Nt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,r){Nt.deprecatedWarning2||(Nt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,r)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return Nt.deprecatedWarning3||(Nt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};m(Nt,"emptyAnimation",new Qt("<empty>",[],0)),m(Nt,"SUBSEQUENT",0),m(Nt,"FIRST",1),m(Nt,"HOLD",2),m(Nt,"HOLD_MIX",3),m(Nt,"deprecatedWarning1",!1),m(Nt,"deprecatedWarning2",!1),m(Nt,"deprecatedWarning3",!1);var Go=Nt,hn=class hn{constructor(){m(this,"animation");m(this,"next");m(this,"mixingFrom");m(this,"mixingTo");m(this,"listener");m(this,"trackIndex");m(this,"loop");m(this,"holdPrevious");m(this,"eventThreshold");m(this,"attachmentThreshold");m(this,"drawOrderThreshold");m(this,"animationStart");m(this,"animationEnd");m(this,"animationLast");m(this,"nextAnimationLast");m(this,"delay");m(this,"trackTime");m(this,"trackLast");m(this,"nextTrackLast");m(this,"trackEnd");m(this,"timeScale");m(this,"alpha");m(this,"mixTime");m(this,"mixDuration");m(this,"interruptAlpha");m(this,"totalAlpha");m(this,"mixBlend",2);m(this,"timelineMode",new Array);m(this,"timelineHoldMix",new Array);m(this,"timelinesRotation",new Array);m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd")}reset(){this.next=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 t==0?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}get time(){return hn.deprecatedWarning1||(hn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){hn.deprecatedWarning1||(hn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return hn.deprecatedWarning2||(hn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){hn.deprecatedWarning2||(hn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};m(hn,"deprecatedWarning1",!1),m(hn,"deprecatedWarning2",!1);var Pc=hn,Ho=class Ho{constructor(t){m(this,"objects",[]);m(this,"drainDisabled",!1);m(this,"animState");this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return Ho.deprecatedWarning1||(Ho.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let n=0;n<t.length;n+=2){let r=t[n],s=t[n+1];switch(r){case 0:s.listener!=null&&s.listener.start&&s.listener.start(s);for(let c=0;c<e.length;c++)e[c].start&&e[c].start(s);s.onStart&&this.deprecateStuff()&&s.onStart(s.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(s.trackIndex);break;case 1:s.listener!=null&&s.listener.interrupt&&s.listener.interrupt(s);for(let c=0;c<e.length;c++)e[c].interrupt&&e[c].interrupt(s);break;case 2:s.listener!=null&&s.listener.end&&s.listener.end(s);for(let c=0;c<e.length;c++)e[c].end&&e[c].end(s);s.onEnd&&this.deprecateStuff()&&s.onEnd(s.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(s.trackIndex);case 3:s.listener!=null&&s.listener.dispose&&s.listener.dispose(s);for(let c=0;c<e.length;c++)e[c].dispose&&e[c].dispose(s);this.animState.trackEntryPool.free(s);break;case 4:s.listener!=null&&s.listener.complete&&s.listener.complete(s);for(let c=0;c<e.length;c++)e[c].complete&&e[c].complete(s);let o=B.toInt(s.loopsCount());s.onComplete&&this.deprecateStuff()&&s.onComplete(s.trackIndex,o),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(s.trackIndex,o);break;case 5:let l=t[n+++2];s.listener!=null&&s.listener.event&&s.listener.event(s,l);for(let c=0;c<e.length;c++)e[c].event&&e[c].event(s,l);s.onEvent&&this.deprecateStuff()&&s.onEvent(s.trackIndex,l),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(s.trackIndex,l);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};m(Ho,"deprecatedWarning1",!1);var Yc=Ho,od=(o=>(o[o.start=0]="start",o[o.interrupt=1]="interrupt",o[o.end=2]="end",o[o.dispose=3]="dispose",o[o.complete=4]="complete",o[o.event=5]="event",o))(od||{}),Uh=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}};var jo=class jo{constructor(t){m(this,"skeletonData");m(this,"animationToMixTime",{});m(this,"defaultMix",0);if(t==null)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){let r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);let s=this.skeletonData.findAnimation(e);if(s==null)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,s,n)}setMixByName(t,e,n){jo.deprecatedWarning1||(jo.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,n)}setMixWith(t,e,n){if(t==null)throw new Error("from cannot be null.");if(e==null)throw new Error("to cannot be null.");let r=`${t.name}.${e.name}`;this.animationToMixTime[r]=n}getMix(t,e){let n=`${t.name}.${e.name}`,r=this.animationToMixTime[n];return r===void 0?this.defaultMix:r}};m(jo,"deprecatedWarning1",!1);var Zo=jo;var Ko=class{constructor(t){m(this,"atlas");this.atlas=t}newRegionAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);let s=new vs(e);return s.region=r,s}newMeshAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);let s=new Is(e);return s.region=r,s}newBoundingBoxAttachment(t,e){return new Lo(e)}newPathAttachment(t,e){return new qn(e)}newPointAttachment(t,e){return new Oo(e)}newClippingAttachment(t,e){return new No(e)}};var ld=ye(ge());var so=class{constructor(t,e,n){m(this,"matrix",new ld.Matrix);m(this,"data");m(this,"skeleton");m(this,"parent");m(this,"children",new Array);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",0);m(this,"scaleY",0);m(this,"shearX",0);m(this,"shearY",0);m(this,"ax",0);m(this,"ay",0);m(this,"arotation",0);m(this,"ascaleX",0);m(this,"ascaleY",0);m(this,"ashearX",0);m(this,"ashearY",0);m(this,"appliedValid",!1);m(this,"sorted",!1);m(this,"active",!0);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,n,r,s,o,l){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=o,this.ashearY=l,this.appliedValid=!0;let c=this.parent,a=this.matrix,i=this.skeleton.scaleX,h=Dt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(c==null){let g=this.skeleton,b=n+90+l;a.a=B.cosDeg(n+o)*r*i,a.c=B.cosDeg(b)*s*i,a.b=B.sinDeg(n+o)*r*h,a.d=B.sinDeg(b)*s*h,a.tx=t*i+g.x,a.ty=e*h+g.y;return}let d=c.matrix.a,u=c.matrix.c,p=c.matrix.b,f=c.matrix.d;switch(a.tx=d*t+u*e+c.matrix.tx,a.ty=p*t+f*e+c.matrix.ty,this.data.transformMode){case 0:{let g=n+90+l,b=B.cosDeg(n+o)*r,x=B.cosDeg(g)*s,y=B.sinDeg(n+o)*r,w=B.sinDeg(g)*s;a.a=d*b+u*y,a.c=d*x+u*w,a.b=p*b+f*y,a.d=p*x+f*w;return}case 1:{let g=n+90+l;a.a=B.cosDeg(n+o)*r,a.c=B.cosDeg(g)*s,a.b=B.sinDeg(n+o)*r,a.d=B.sinDeg(g)*s;break}case 2:{let g=d*d+p*p,b=0;g>1e-4?(g=Math.abs(d*f-u*p)/g,u=p*g,f=d*g,b=Math.atan2(p,d)*B.radDeg):(d=0,p=0,b=90-Math.atan2(f,u)*B.radDeg);let x=n+o-b,y=n+l-b+90,w=B.cosDeg(x)*r,k=B.cosDeg(y)*s,S=B.sinDeg(x)*r,I=B.sinDeg(y)*s;a.a=d*w-u*S,a.c=d*k-u*I,a.b=p*w+f*S,a.d=p*k+f*I;break}case 3:case 4:{let g=B.cosDeg(n),b=B.sinDeg(n),x=(d*g+u*b)/i,y=(p*g+f*b)/h,w=Math.sqrt(x*x+y*y);w>1e-5&&(w=1/w),x*=w,y*=w,w=Math.sqrt(x*x+y*y),this.data.transformMode==3&&d*f-u*p<0!=(Dt.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w);let k=Math.PI/2+Math.atan2(y,x),S=Math.cos(k)*w,I=Math.sin(k)*w,M=B.cosDeg(o)*r,v=B.cosDeg(90+l)*s,E=B.sinDeg(o)*r,C=B.sinDeg(90+l)*s;a.a=x*M+S*E,a.c=x*v+S*C,a.b=y*M+I*E,a.d=y*v+I*C;break}}a.a*=i,a.c*=i,a.b*=h,a.d*=h}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}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*B.radDeg}getWorldScaleX(){let t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){let t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;let t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*B.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*B.radDeg;return}let n=t.matrix,r=1/(n.a*n.d-n.b*n.c),s=e.tx-n.tx,o=e.ty-n.ty;this.ax=s*n.d*r-o*n.c*r,this.ay=o*n.a*r-s*n.b*r;let l=r*n.d,c=r*n.a,a=r*n.c,i=r*n.b,h=l*e.a-a*e.b,d=l*e.c-a*e.d,u=c*e.b-i*e.a,p=c*e.d-i*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(h*h+u*u),this.ascaleX>1e-4){let f=h*p-d*u;this.ascaleY=f/this.ascaleX,this.ashearY=Math.atan2(h*d+u*p,f)*B.radDeg,this.arotation=Math.atan2(u,h)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*B.radDeg}worldToLocal(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=1/(n*o-r*s),c=t.x-e.tx,a=t.y-e.ty;return t.x=c*o*l-a*r*l,t.y=a*n*l-c*s*l,t}localToWorld(t){let e=this.matrix,n=t.x,r=t.y;return t.x=n*e.a+r*e.c+e.tx,t.y=n*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*n,r.d*n-r.c*e)*B.radDeg}localToWorldRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(n*r.b+e*r.d,n*r.a+e*r.c)*B.radDeg}rotateWorld(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=B.cosDeg(t),c=B.sinDeg(t);e.a=l*n-c*s,e.c=l*r-c*o,e.b=c*n+l*s,e.d=c*r+l*o,this.appliedValid=!1}};var Jo=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"parent");m(this,"length");m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"shearX",0);m(this,"shearY",0);m(this,"transformMode",0);if(t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=n}};var Qo=class{constructor(t,e){m(this,"data");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"time");m(this,"volume");m(this,"balance");if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}};var _o=class{constructor(t){m(this,"name");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"audioPath");m(this,"volume");m(this,"balance");this.name=t}};var tl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"bendDirection",0);m(this,"compress",!1);m(this,"stretch",!1);m(this,"mix",1);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}getOrder(){return this.data.order}apply(){this.update()}update(){let t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.mix);break}}apply1(t,e,n,r,s,o,l){t.appliedValid||t.updateAppliedTransform();let c=t.parent.matrix,a=1/(c.a*c.d-c.b*c.c),i=e-c.tx,h=n-c.ty,d=(i*c.d-h*c.c)*a-t.ax,u=(h*c.a-i*c.b)*a-t.ay,p=Math.atan2(u,d)*B.radDeg-t.ashearX-t.arotation;t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);let f=t.ascaleX,g=t.ascaleY;if(r||s){let b=t.data.length*f,x=Math.sqrt(d*d+u*u);if(r&&x<b||s&&x>b&&b>1e-4){let y=(x/b-1)*l+1;f*=y,o&&(g*=y)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*l,f,g,t.ashearX,t.ashearY)}apply2(t,e,n,r,s,o,l){if(l==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();let c=t.ax,a=t.ay,i=t.ascaleX,h=i,d=t.ascaleY,u=e.ascaleX,p=t.matrix,f=0,g=0,b=0;i<0?(i=-i,f=180,b=-1):(f=0,b=1),d<0&&(d=-d,b=-b),u<0?(u=-u,g=180):g=0;let x=e.ax,y=0,w=0,k=0,S=p.a,I=p.c,M=p.b,v=p.d,E=Math.abs(i-d)<=1e-4;E?(y=e.ay,w=S*x+I*y+p.tx,k=M*x+v*y+p.ty):(y=0,w=S*x+p.tx,k=M*x+p.ty);let C=t.parent.matrix;S=C.a,I=C.c,M=C.b,v=C.d;let T=1/(S*v-I*M),F=n-C.tx,D=r-C.ty,V=(F*v-D*I)*T-c,X=(D*S-F*M)*T-a,N=V*V+X*X;F=w-C.tx,D=k-C.ty;let q=(F*v-D*I)*T-c,L=(D*S-F*M)*T-a,R=Math.sqrt(q*q+L*L),P=e.data.length*u,H=0,U=0;t:if(E){P*=i;let Z=(N-R*R-P*P)/(2*R*P);Z<-1?Z=-1:Z>1&&(Z=1,o&&R+P>1e-4&&(h*=(Math.sqrt(N)/(R+P)-1)*l+1)),U=Math.acos(Z)*s,S=R+P*Z,I=P*Math.sin(U),H=Math.atan2(X*S-V*I,V*S+X*I)}else{S=i*P,I=d*P;let Z=S*S,K=I*I,it=Math.atan2(X,V);M=K*R*R+Z*N-Z*K;let et=-2*K*R,st=K-Z;if(v=et*et-4*st*M,v>=0){let Lt=Math.sqrt(v);et<0&&(Lt=-Lt),Lt=-(et+Lt)/2;let Kt=Lt/st,ke=M/Lt,Jt=Math.abs(Kt)<Math.abs(ke)?Kt:ke;if(Jt*Jt<=N){D=Math.sqrt(N-Jt*Jt)*s,H=it-Math.atan2(D,Jt),U=Math.atan2(D/d,(Jt-R)/i);break t}}let dt=B.PI,Mt=R-S,Bt=Mt*Mt,jt=0,Rt=0,Xt=R+S,Wt=Xt*Xt,Zt=0;M=-S*R/(Z-K),M>=-1&&M<=1&&(M=Math.acos(M),F=S*Math.cos(M)+R,D=I*Math.sin(M),v=F*F+D*D,v<Bt&&(dt=M,Bt=v,Mt=F,jt=D),v>Wt&&(Rt=M,Wt=v,Xt=F,Zt=D)),N<=(Bt+Wt)/2?(H=it-Math.atan2(jt*s,Mt),U=dt*s):(H=it-Math.atan2(Zt*s,Xt),U=Rt*s)}let z=Math.atan2(y,x)*b,O=t.arotation;H=(H-z)*B.radDeg+f-O,H>180?H-=360:H<-180&&(H+=360),t.updateWorldTransformWith(c,a,O+H*l,h,t.ascaleY,0,0),O=e.arotation,U=((U+z)*B.radDeg-e.ashearX)*b+g-O,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(x,y,O+U*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};var el=class{constructor(t){m(this,"name");m(this,"order",0);m(this,"bones",new Array);m(this,"target");m(this,"bendDirection",1);m(this,"compress",!1);m(this,"stretch",!1);m(this,"uniform",!1);m(this,"mix",1);this.name=t}};var nl=class{constructor(t){m(this,"name");m(this,"order",0);m(this,"bones",new Array);m(this,"target");m(this,"positionMode");m(this,"spacingMode");m(this,"rotateMode");m(this,"offsetRotation");m(this,"position");m(this,"spacing");m(this,"rotateMix");m(this,"translateMix");this.name=t}},Xc=(n=>(n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n))(Xc||{});var mn=class mn{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"position",0);m(this,"spacing",0);m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"spaces",new Array);m(this,"positions",new Array);m(this,"world",new Array);m(this,"curves",new Array);m(this,"lengths",new Array);m(this,"segments",new Array);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}apply(){this.update()}update(){let t=this.target.getAttachment();if(!(t instanceof qn))return;let e=this.rotateMix,n=this.translateMix,r=n>0,s=e>0;if(!r&&!s)return;let o=this.data,l=o.spacingMode,c=l==0,a=o.rotateMode,i=a==0,h=a==2,d=this.bones.length,u=i?d:d+1,p=this.bones,f=Y.setArraySize(this.spaces,u),g=null,b=this.spacing;if(h||c){h&&(g=Y.setArraySize(this.lengths,d));for(let I=0,M=u-1;I<M;){let v=p[I],E=v.data.length;if(E<mn.epsilon)h&&(g[I]=0),f[++I]=0;else{let C=E*v.matrix.a,T=E*v.matrix.b,F=Math.sqrt(C*C+T*T);h&&(g[I]=F),f[++I]=(c?E+b:b)*F/E}}}else for(let I=1;I<u;I++)f[I]=b;let x=this.computeWorldPositions(t,u,i,o.positionMode==1,l==2),y=x[0],w=x[1],k=o.offsetRotation,S=!1;if(k==0)S=a==1;else{S=!1;let I=this.target.bone.matrix;k*=I.a*I.d-I.b*I.c>0?B.degRad:-B.degRad}for(let I=0,M=3;I<d;I++,M+=3){let v=p[I],E=v.matrix;E.tx+=(y-E.tx)*n,E.ty+=(w-E.ty)*n;let C=x[M],T=x[M+1],F=C-y,D=T-w;if(h){let V=g[I];if(V!=0){let X=(Math.sqrt(F*F+D*D)/V-1)*e+1;E.a*=X,E.b*=X}}if(y=C,w=T,s){let V=E.a,X=E.c,N=E.b,q=E.d,L=0,R=0,P=0;if(i&&(i?L=x[M-1]:f[I+1]==0?L=x[M+2]:L=Math.atan2(D,F)),L-=Math.atan2(N,V),S){R=Math.cos(L),P=Math.sin(L);let H=v.data.length;y+=(H*(R*V-P*N)-F)*e,w+=(H*(P*V+R*N)-D)*e}else L+=k;L>B.PI?L-=B.PI2:L<-B.PI&&(L+=B.PI2),L*=e,R=Math.cos(L),P=Math.sin(L),E.a=R*V-P*N,E.c=R*X-P*q,E.b=P*V+R*N,E.d=P*X+R*q}v.appliedValid=!1}}computeWorldPositions(t,e,n,r,s){let o=this.target,l=this.position,c=this.spaces,a=Y.setArraySize(this.positions,e*3+2),i=null,h=t.closed,d=t.worldVerticesLength,u=d/6,p=mn.NONE;if(!t.constantSpeed){let L=t.lengths;u-=h?1:2;let R=L[u];if(r&&(l*=R),s)for(let P=0;P<e;P++)c[P]*=R;i=Y.setArraySize(this.world,8);for(let P=0,H=0,U=0;P<e;P++,H+=3){let z=c[P];l+=z;let O=l;if(h)O%=R,O<0&&(O+=R),U=0;else if(O<0){p!=mn.BEFORE&&(p=mn.BEFORE,t.computeWorldVertices(o,2,4,i,0,2)),this.addBeforePosition(O,i,0,a,H);continue}else if(O>R){p!=mn.AFTER&&(p=mn.AFTER,t.computeWorldVertices(o,d-6,4,i,0,2)),this.addAfterPosition(O-R,i,0,a,H);continue}for(;;U++){let Z=L[U];if(!(O>Z)){if(U==0)O/=Z;else{let K=L[U-1];O=(O-K)/(Z-K)}break}}U!=p&&(p=U,h&&U==u?(t.computeWorldVertices(o,d-4,4,i,0,2),t.computeWorldVertices(o,0,4,i,4,2)):t.computeWorldVertices(o,U*6+2,8,i,0,2)),this.addCurvePosition(O,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],a,H,n||P>0&&z==0)}return a}h?(d+=2,i=Y.setArraySize(this.world,d),t.computeWorldVertices(o,2,d-4,i,0,2),t.computeWorldVertices(o,0,2,i,d-4,2),i[d-2]=i[0],i[d-1]=i[1]):(u--,d-=4,i=Y.setArraySize(this.world,d),t.computeWorldVertices(o,2,d,i,0,2));let f=Y.setArraySize(this.curves,u),g=0,b=i[0],x=i[1],y=0,w=0,k=0,S=0,I=0,M=0,v=0,E=0,C=0,T=0,F=0,D=0,V=0,X=0;for(let L=0,R=2;L<u;L++,R+=6)y=i[R],w=i[R+1],k=i[R+2],S=i[R+3],I=i[R+4],M=i[R+5],v=(b-y*2+k)*.1875,E=(x-w*2+S)*.1875,C=((y-k)*3-b+I)*.09375,T=((w-S)*3-x+M)*.09375,F=v*2+C,D=E*2+T,V=(y-b)*.75+v+C*.16666667,X=(w-x)*.75+E+T*.16666667,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,F+=C,D+=T,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,g+=Math.sqrt(V*V+X*X),V+=F+C,X+=D+T,g+=Math.sqrt(V*V+X*X),f[L]=g,b=I,x=M;if(r&&(l*=g),s)for(let L=0;L<e;L++)c[L]*=g;let N=this.segments,q=0;for(let L=0,R=0,P=0,H=0;L<e;L++,R+=3){let U=c[L];l+=U;let z=l;if(h)z%=g,z<0&&(z+=g),P=0;else if(z<0){this.addBeforePosition(z,i,0,a,R);continue}else if(z>g){this.addAfterPosition(z-g,i,d-4,a,R);continue}for(;;P++){let O=f[P];if(!(z>O)){if(P==0)z/=O;else{let Z=f[P-1];z=(z-Z)/(O-Z)}break}}if(P!=p){p=P;let O=P*6;for(b=i[O],x=i[O+1],y=i[O+2],w=i[O+3],k=i[O+4],S=i[O+5],I=i[O+6],M=i[O+7],v=(b-y*2+k)*.03,E=(x-w*2+S)*.03,C=((y-k)*3-b+I)*.006,T=((w-S)*3-x+M)*.006,F=v*2+C,D=E*2+T,V=(y-b)*.3+v+C*.16666667,X=(w-x)*.3+E+T*.16666667,q=Math.sqrt(V*V+X*X),N[0]=q,O=1;O<8;O++)V+=F,X+=D,F+=C,D+=T,q+=Math.sqrt(V*V+X*X),N[O]=q;V+=F,X+=D,q+=Math.sqrt(V*V+X*X),N[8]=q,V+=F+C,X+=D+T,q+=Math.sqrt(V*V+X*X),N[9]=q,H=0}for(z*=q;;H++){let O=N[H];if(!(z>O)){if(H==0)z/=O;else{let Z=N[H-1];z=H+(z-Z)/(O-Z)}break}}this.addCurvePosition(z*.1,b,x,y,w,k,S,I,M,a,R,n||L>0&&U==0)}return a}addBeforePosition(t,e,n,r,s){let o=e[n],l=e[n+1],c=e[n+2]-o,a=e[n+3]-l,i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addAfterPosition(t,e,n,r,s){let o=e[n+2],l=e[n+3],c=o-e[n],a=l-e[n+1],i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addCurvePosition(t,e,n,r,s,o,l,c,a,i,h,d){(t==0||isNaN(t))&&(t=1e-4);let u=t*t,p=u*t,f=1-t,g=f*f,b=g*f,x=f*t,y=x*3,w=f*y,k=y*t,S=e*b+r*w+o*k+c*p,I=n*b+s*w+l*k+a*p;i[h]=S,i[h+1]=I,d&&(i[h+2]=Math.atan2(I-(n*g+s*x*2+l*u),S-(e*g+r*x*2+o*u)))}getOrder(){return this.data.order}};m(mn,"NONE",-1),m(mn,"BEFORE",-2),m(mn,"AFTER",-3),m(mn,"epsilon",1e-5);var rl=mn;var sl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"scaleMix",0);m(this,"shearMix",0);m(this,"temp",new Ae);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,o=s.matrix,l=o.a,c=o.c,a=o.b,i=o.d,h=l*i-c*a>0?B.degRad:-B.degRad,d=this.data.offsetRotation*h,u=this.data.offsetShearY*h,p=this.bones;for(let f=0,g=p.length;f<g;f++){let b=p[f],x=!1,y=b.matrix;if(t!=0){let w=y.a,k=y.c,S=y.b,I=y.d,M=Math.atan2(a,l)-Math.atan2(S,w)+d;M>B.PI?M-=B.PI2:M<-B.PI&&(M+=B.PI2),M*=t;let v=Math.cos(M),E=Math.sin(M);y.a=v*w-E*S,y.c=v*k-E*I,y.b=E*w+v*S,y.d=E*k+v*I,x=!0}if(e!=0){let w=this.temp;s.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.tx+=(w.x-y.tx)*e,y.ty+=(w.y-y.ty)*e,x=!0}if(n>0){let w=Math.sqrt(y.a*y.a+y.b*y.b),k=Math.sqrt(l*l+a*a);w>1e-5&&(w=(w+(k-w+this.data.offsetScaleX)*n)/w),y.a*=w,y.b*=w,w=Math.sqrt(y.c*y.c+y.d*y.d),k=Math.sqrt(c*c+i*i),w>1e-5&&(w=(w+(k-w+this.data.offsetScaleY)*n)/w),y.c*=w,y.d*=w,x=!0}if(r>0){let w=y.c,k=y.d,S=Math.atan2(k,w),I=Math.atan2(i,c)-Math.atan2(a,l)-(S-Math.atan2(y.b,y.a));I>B.PI?I-=B.PI2:I<-B.PI&&(I+=B.PI2),I=S+(I+u)*r;let M=Math.sqrt(w*w+k*k);y.c=Math.cos(I)*M,y.d=Math.sin(I)*M,x=!0}x&&(b.appliedValid=!1)}}applyRelativeWorld(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,o=s.matrix,l=o.a,c=o.c,a=o.b,i=o.d,h=l*i-c*a>0?B.degRad:-B.degRad,d=this.data.offsetRotation*h,u=this.data.offsetShearY*h,p=this.bones;for(let f=0,g=p.length;f<g;f++){let b=p[f],x=!1,y=b.matrix;if(t!=0){let w=y.a,k=y.c,S=y.b,I=y.d,M=Math.atan2(a,l)+d;M>B.PI?M-=B.PI2:M<-B.PI&&(M+=B.PI2),M*=t;let v=Math.cos(M),E=Math.sin(M);y.a=v*w-E*S,y.c=v*k-E*I,y.b=E*w+v*S,y.d=E*k+v*I,x=!0}if(e!=0){let w=this.temp;s.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.tx+=w.x*e,y.ty+=w.y*e,x=!0}if(n>0){let w=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*n+1;y.a*=w,y.b*=w,w=(Math.sqrt(c*c+i*i)-1+this.data.offsetScaleY)*n+1,y.c*=w,y.d*=w,x=!0}if(r>0){let w=Math.atan2(i,c)-Math.atan2(a,l);w>B.PI?w-=B.PI2:w<-B.PI&&(w+=B.PI2);let k=y.c,S=y.d;w=Math.atan2(S,k)+(w-B.PI/2+u)*r;let I=Math.sqrt(k*k+S*S);y.c=Math.cos(w)*I,y.d=Math.sin(w)*I,x=!0}x&&(b.appliedValid=!1)}}applyAbsoluteLocal(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target;s.appliedValid||s.updateAppliedTransform();let o=this.bones;for(let l=0,c=o.length;l<c;l++){let a=o[l];a.appliedValid||a.updateAppliedTransform();let i=a.arotation;if(t!=0){let g=s.arotation-i+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,i+=g*t}let h=a.ax,d=a.ay;e!=0&&(h+=(s.ax-h+this.data.offsetX)*e,d+=(s.ay-d+this.data.offsetY)*e);let u=a.ascaleX,p=a.ascaleY;n>0&&(u>1e-5&&(u=(u+(s.ascaleX-u+this.data.offsetScaleX)*n)/u),p>1e-5&&(p=(p+(s.ascaleY-p+this.data.offsetScaleY)*n)/p));let f=a.ashearY;if(r>0){let g=s.ashearY-f+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,a.shearY+=g*r}a.updateWorldTransformWith(h,d,i,u,p,a.ashearX,f)}}applyRelativeLocal(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target;s.appliedValid||s.updateAppliedTransform();let o=this.bones;for(let l=0,c=o.length;l<c;l++){let a=o[l];a.appliedValid||a.updateAppliedTransform();let i=a.arotation;t!=0&&(i+=(s.arotation+this.data.offsetRotation)*t);let h=a.ax,d=a.ay;e!=0&&(h+=(s.ax+this.data.offsetX)*e,d+=(s.ay+this.data.offsetY)*e);let u=a.ascaleX,p=a.ascaleY;n>0&&(u>1e-5&&(u*=(s.ascaleX-1+this.data.offsetScaleX)*n+1),p>1e-5&&(p*=(s.ascaleY-1+this.data.offsetScaleY)*n+1));let f=a.ashearY;r>0&&(f+=(s.ashearY+this.data.offsetShearY)*r),a.updateWorldTransformWith(h,d,i,u,p,a.ashearX,f)}}getOrder(){return this.data.order}};var Es=class Es{constructor(t){m(this,"data");m(this,"bones");m(this,"slots");m(this,"drawOrder");m(this,"ikConstraints");m(this,"transformConstraints");m(this,"pathConstraints");m(this,"_updateCache",new Array);m(this,"updateCacheReset",new Array);m(this,"skin");m(this,"color");m(this,"time",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"x",0);m(this,"y",0);if(t==null)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let n=t.bones[e],r;if(n.parent==null)r=new so(n,this,null);else{let s=this.bones[n.parent.index];r=new so(n,this,s),s.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let n=t.slots[e],r=this.bones[n.boneData.index],s=new Ms(n,r);this.slots.push(s),this.drawOrder.push(s)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let n=t.ikConstraints[e];this.ikConstraints.push(new tl(n,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let n=t.transformConstraints[e];this.transformConstraints.push(new sl(n,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let n=t.pathConstraints[e];this.pathConstraints.push(new rl(n,this))}this.color=new $(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0,this.updateCacheReset.length=0;let e=this.bones;for(let i=0,h=e.length;i<h;i++)e[i].sorted=!1;let n=this.ikConstraints,r=this.transformConstraints,s=this.pathConstraints,o=n.length,l=r.length,c=s.length,a=o+l+c;t:for(let i=0;i<a;i++){for(let h=0;h<o;h++){let d=n[h];if(d.data.order==i){this.sortIkConstraint(d);continue t}}for(let h=0;h<l;h++){let d=r[h];if(d.data.order==i){this.sortTransformConstraint(d);continue t}}for(let h=0;h<c;h++){let d=s[h];if(d.data.order==i){this.sortPathConstraint(d);continue t}}}for(let i=0,h=e.length;i<h;i++)this.sortBone(e[i])}sortIkConstraint(t){let e=t.target;this.sortBone(e);let n=t.bones,r=n[0];if(this.sortBone(r),n.length>1){let s=n[n.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0}sortPathConstraint(t){let e=t.target,n=e.data.index,r=e.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,n,r),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(let c=0,a=this.data.skins.length;c<a;c++)this.sortPathConstraintAttachment(this.data.skins[c],n,r);let s=e.getAttachment();s instanceof qn&&this.sortPathConstraintAttachmentWith(s,r);let o=t.bones,l=o.length;for(let c=0;c<l;c++)this.sortBone(o[c]);this._updateCache.push(t);for(let c=0;c<l;c++)this.sortReset(o[c].children);for(let c=0;c<l;c++)o[c].sorted=!0}sortTransformConstraint(t){this.sortBone(t.target);let e=t.bones,n=e.length;if(t.data.local)for(let r=0;r<n;r++){let s=e[r];this.sortBone(s.parent),this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}else for(let r=0;r<n;r++)this.sortBone(e[r]);this._updateCache.push(t);for(let r=0;r<n;r++)this.sortReset(e[r].children);for(let r=0;r<n;r++)e[r].sorted=!0}sortPathConstraintAttachment(t,e,n){let r=t.attachments[e];if(r)for(let s in r)this.sortPathConstraintAttachmentWith(r[s],n)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof qn))return;let n=t.bones;if(n==null)this.sortBone(e);else{let r=this.bones,s=0;for(;s<n.length;){let o=n[s++];for(let l=s+o;s<l;s++){let c=n[s];this.sortBone(r[c])}}}}sortBone(t){if(t.sorted)return;let e=t.parent;e!=null&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,n=t.length;e<n;e++){let r=t[e];r.sorted&&this.sortReset(r.children),r.sorted=!1}}updateWorldTransform(){let t=this.updateCacheReset;for(let n=0,r=t.length;n<r;n++){let s=t[n];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,s.appliedValid=!0}let e=this._updateCache;for(let n=0,r=e.length;n<r;n++)e[n].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let t=this.bones;for(let s=0,o=t.length;s<o;s++)t[s].setToSetupPose();let e=this.ikConstraints;for(let s=0,o=e.length;s<o;s++){let l=e[s];l.bendDirection=l.data.bendDirection,l.mix=l.data.mix}let n=this.transformConstraints;for(let s=0,o=n.length;s<o;s++){let l=n[s],c=l.data;l.rotateMix=c.rotateMix,l.translateMix=c.translateMix,l.scaleMix=c.scaleMix,l.shearMix=c.shearMix}let r=this.pathConstraints;for(let s=0,o=r.length;s<o;s++){let l=r[s],c=l.data;l.position=c.position,l.spacing=c.spacing,l.rotateMix=c.rotateMix,l.translateMix=c.translateMix}}setSlotsToSetupPose(){let t=this.slots;Y.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,n=t.length;e<n;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}setSkinByName(t){let e=this.data.findSkin(t);if(e==null)throw new Error(`Skin not found: ${t}`);this.setSkin(e)}setSkin(t){if(t!=null)if(this.skin!=null)t.attachAll(this,this.skin);else{let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n],o=s.data.attachmentName;if(o!=null){let l=t.getAttachment(n,o);l!=null&&s.setAttachment(l)}}}this.skin=t}getAttachmentByName(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)}getAttachment(t,e){if(e==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){let n=this.skin.getAttachment(t,e);if(n!=null)return n}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(t==null)throw new Error("slotName cannot be null.");let n=this.slots;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(o.data.name==t){let l=null;if(e!=null&&(l=this.getAttachment(r,e),l==null))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);o.setAttachment(l);return}}throw new Error(`Slot not found: ${t}`)}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}getBounds(t,e,n){if(t==null)throw new Error("offset cannot be null.");if(e==null)throw new Error("size cannot be null.");let r=this.drawOrder,s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let a=0,i=r.length;a<i;a++){let h=r[a],d=0,u=null,p=h.getAttachment();if(p instanceof vs)d=8,u=Y.setArraySize(n,d,0),p.computeWorldVertices(h.bone,u,0,2);else if(p instanceof Is){let f=p;d=f.worldVerticesLength,u=Y.setArraySize(n,d,0),f.computeWorldVertices(h,0,d,u,0,2)}if(u!=null)for(let f=0,g=u.length;f<g;f+=2){let b=u[f],x=u[f+1];s=Math.min(s,b),o=Math.min(o,x),l=Math.max(l,b),c=Math.max(c,x)}}t.set(s,o),e.set(l-s,c-o)}update(t){this.time+=t}get flipX(){return this.scaleX==-1}set flipX(t){Es.deprecatedWarning1||(Es.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=t?1:-1}get flipY(){return this.scaleY==-1}set flipY(t){Es.deprecatedWarning1||(Es.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=t?1:-1}};m(Es,"deprecatedWarning1",!1);var al=Es;var Wh=class extends $e{};var il=class{constructor(){m(this,"name");m(this,"bones",new Array);m(this,"slots",new Array);m(this,"skins",new Array);m(this,"defaultSkin");m(this,"events",new Array);m(this,"animations",new Array);m(this,"ikConstraints",new Array);m(this,"transformConstraints",new Array);m(this,"pathConstraints",new Array);m(this,"width");m(this,"height");m(this,"version");m(this,"hash");m(this,"fps",0);m(this,"imagesPath")}findBone(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");let e=this.skins;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");let e=this.events;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");let e=this.animations;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}};var ol=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"boneData");m(this,"color",new $(1,1,1,1));m(this,"darkColor");m(this,"attachmentName");m(this,"blendMode");if(t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(n==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}};var ll=class{constructor(t){m(this,"name");m(this,"order",0);m(this,"bones",new Array);m(this,"target");m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"scaleMix",0);m(this,"shearMix",0);m(this,"offsetRotation",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"offsetScaleX",0);m(this,"offsetScaleY",0);m(this,"offsetShearY",0);m(this,"relative",!1);m(this,"local",!1);if(t==null)throw new Error("name cannot be null.");this.name=t}};var cl=class{constructor(t){m(this,"name");m(this,"attachments",new Array);if(t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,n){if(n==null)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]=n}getAttachment(t,e){let n=this.attachments[t];return n?n[e]:null}attachAll(t,e){let n=0;for(let r=0;r<t.slots.length;r++){let s=t.slots[r],o=s.getAttachment();if(o&&n<e.attachments.length){let l=e.attachments[n];for(let c in l){let a=l[c];if(o==a){let i=this.getAttachment(n,c);i!=null&&s.setAttachment(i);break}}}n++}}};var hl=class A{constructor(t){m(this,"attachmentLoader");m(this,"scale",1);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new il,r=typeof t=="string"?JSON.parse(t):t,s=r.skeleton;if(s!=null&&(n.hash=s.hash,n.version=s.spine,n.width=s.width,n.height=s.height,n.fps=s.fps,n.imagesPath=s.images),r.bones)for(let o=0;o<r.bones.length;o++){let l=r.bones[o],c=null,a=this.getValue(l,"parent",null);if(a!=null&&(c=n.findBone(a),c==null))throw new Error(`Parent bone not found: ${a}`);let i=new Jo(n.bones.length,l.name,c);i.length=this.getValue(l,"length",0)*e,i.x=this.getValue(l,"x",0)*e,i.y=this.getValue(l,"y",0)*e,i.rotation=this.getValue(l,"rotation",0),i.scaleX=this.getValue(l,"scaleX",1),i.scaleY=this.getValue(l,"scaleY",1),i.shearX=this.getValue(l,"shearX",0),i.shearY=this.getValue(l,"shearY",0),i.transformMode=A.transformModeFromString(this.getValue(l,"transform","normal")),n.bones.push(i)}if(r.slots)for(let o=0;o<r.slots.length;o++){let l=r.slots[o],c=l.name,a=l.bone,i=n.findBone(a);if(i==null)throw new Error(`Slot bone not found: ${a}`);let h=new ol(n.slots.length,c,i),d=this.getValue(l,"color",null);d!=null&&h.color.setFromString(d);let u=this.getValue(l,"dark",null);u!=null&&(h.darkColor=new $(1,1,1,1),h.darkColor.setFromString(u)),h.attachmentName=this.getValue(l,"attachment",null),h.blendMode=A.blendModeFromString(this.getValue(l,"blend","normal")),n.slots.push(h)}if(r.ik)for(let o=0;o<r.ik.length;o++){let l=r.ik[o],c=new el(l.name);c.order=this.getValue(l,"order",0);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`IK bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findBone(a),c.target==null)throw new Error(`IK target bone not found: ${a}`);c.bendDirection=this.getValue(l,"bendPositive",!0)?1:-1,c.mix=this.getValue(l,"mix",1),n.ikConstraints.push(c)}if(r.transform)for(let o=0;o<r.transform.length;o++){let l=r.transform[o],c=new ll(l.name);c.order=this.getValue(l,"order",0);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findBone(a),c.target==null)throw new Error(`Transform constraint target bone not found: ${a}`);c.local=this.getValue(l,"local",!1),c.relative=this.getValue(l,"relative",!1),c.offsetRotation=this.getValue(l,"rotation",0),c.offsetX=this.getValue(l,"x",0)*e,c.offsetY=this.getValue(l,"y",0)*e,c.offsetScaleX=this.getValue(l,"scaleX",0),c.offsetScaleY=this.getValue(l,"scaleY",0),c.offsetShearY=this.getValue(l,"shearY",0),c.rotateMix=this.getValue(l,"rotateMix",1),c.translateMix=this.getValue(l,"translateMix",1),c.scaleMix=this.getValue(l,"scaleMix",1),c.shearMix=this.getValue(l,"shearMix",1),n.transformConstraints.push(c)}if(r.path)for(let o=0;o<r.path.length;o++){let l=r.path[o],c=new nl(l.name);c.order=this.getValue(l,"order",0);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findSlot(a),c.target==null)throw new Error(`Path target slot not found: ${a}`);c.positionMode=A.positionModeFromString(this.getValue(l,"positionMode","percent")),c.spacingMode=A.spacingModeFromString(this.getValue(l,"spacingMode","length")),c.rotateMode=A.rotateModeFromString(this.getValue(l,"rotateMode","tangent")),c.offsetRotation=this.getValue(l,"rotation",0),c.position=this.getValue(l,"position",0),c.positionMode==0&&(c.position*=e),c.spacing=this.getValue(l,"spacing",0),(c.spacingMode==0||c.spacingMode==1)&&(c.spacing*=e),c.rotateMix=this.getValue(l,"rotateMix",1),c.translateMix=this.getValue(l,"translateMix",1),n.pathConstraints.push(c)}if(r.skins)for(let o in r.skins){let l=r.skins[o],c=new cl(o);for(let a in l){let i=n.findSlotIndex(a);if(i==-1)throw new Error(`Slot not found: ${a}`);let h=l[a];for(let d in h){let u=this.readAttachment(h[d],c,i,d,n);u!=null&&c.addAttachment(i,d,u)}}n.skins.push(c),c.name=="default"&&(n.defaultSkin=c)}for(let o=0,l=this.linkedMeshes.length;o<l;o++){let c=this.linkedMeshes[o],a=c.skin==null?n.defaultSkin:n.findSkin(c.skin);if(a==null)throw new Error(`Skin not found: ${c.skin}`);let i=a.getAttachment(c.slotIndex,c.parent);if(i==null)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.setParentMesh(i)}if(this.linkedMeshes.length=0,r.events)for(let o in r.events){let l=r.events[o],c=new _o(o);c.intValue=this.getValue(l,"int",0),c.floatValue=this.getValue(l,"float",0),c.stringValue=this.getValue(l,"string",""),c.audioPath=this.getValue(l,"audio",null),c.audioPath!=null&&(c.volume=this.getValue(l,"volume",1),c.balance=this.getValue(l,"balance",0)),n.events.push(c)}if(r.animations)for(let o in r.animations){let l=r.animations[o];this.readAnimation(l,o,n)}return n}readAttachment(t,e,n,r,s){let o=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{let c=this.getValue(t,"path",r),a=this.attachmentLoader.newRegionAttachment(e,r,c);if(a==null)return null;a.path=c,a.x=this.getValue(t,"x",0)*o,a.y=this.getValue(t,"y",0)*o,a.scaleX=this.getValue(t,"scaleX",1),a.scaleY=this.getValue(t,"scaleY",1),a.rotation=this.getValue(t,"rotation",0),a.width=t.width*o,a.height=t.height*o;let i=this.getValue(t,"color",null);return i!=null&&a.color.setFromString(i),a}case"boundingbox":{let c=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(c==null)return null;this.readVertices(t,c,t.vertexCount<<1);let a=this.getValue(t,"color",null);return a!=null&&c.color.setFromString(a),c}case"mesh":case"linkedmesh":{let c=this.getValue(t,"path",r),a=this.attachmentLoader.newMeshAttachment(e,r,c);if(a==null)return null;a.path=c;let i=this.getValue(t,"color",null);i!=null&&a.color.setFromString(i);let h=this.getValue(t,"parent",null);if(h!=null)return a.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new qh(a,this.getValue(t,"skin",null),n,h)),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=new Float32Array(d),a.hullLength=this.getValue(t,"hull",0)*2,a}case"path":{let c=this.attachmentLoader.newPathAttachment(e,r);if(c==null)return null;c.closed=this.getValue(t,"closed",!1),c.constantSpeed=this.getValue(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,c,a<<1);let i=Y.newArray(a/3,0);for(let d=0;d<t.lengths.length;d++)i[d]=t.lengths[d]*o;c.lengths=i;let h=this.getValue(t,"color",null);return h!=null&&c.color.setFromString(h),c}case"point":{let c=this.attachmentLoader.newPointAttachment(e,r);if(c==null)return null;c.x=this.getValue(t,"x",0)*o,c.y=this.getValue(t,"y",0)*o,c.rotation=this.getValue(t,"rotation",0);let a=this.getValue(t,"color",null);return a!=null&&c.color.setFromString(a),c}case"clipping":{let c=this.attachmentLoader.newClippingAttachment(e,r);if(c==null)return null;let a=this.getValue(t,"end",null);if(a!=null){let d=s.findSlot(a);if(d==null)throw new Error(`Clipping end slot not found: ${a}`);c.endSlot=d}let i=t.vertexCount;this.readVertices(t,c,i<<1);let h=this.getValue(t,"color",null);return h!=null&&c.color.setFromString(h),c}}return null}readVertices(t,e,n){let r=this.scale;e.worldVerticesLength=n;let s=t.vertices;if(n==s.length){let c=Y.toFloatArray(s);if(r!=1)for(let a=0,i=s.length;a<i;a++)c[a]*=r;e.vertices=c;return}let o=new Array,l=new Array;for(let c=0,a=s.length;c<a;){let i=s[c++];l.push(i);for(let h=c+i*4;c<h;c+=4)l.push(s[c]),o.push(s[c+1]*r),o.push(s[c+2]*r),o.push(s[c+3])}e.bones=l,e.vertices=Y.toFloatArray(o)}readAnimation(t,e,n){let r=this.scale,s=new Array,o=0;if(t.slots)for(let c in t.slots){let a=t.slots[c],i=n.findSlotIndex(c);if(i==-1)throw new Error(`Slot not found: ${c}`);for(let h in a){let d=a[h];if(h=="attachment"){let u=new Kr(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f];u.setFrame(p++,g.time,g.name)}s.push(u),o=Math.max(o,u.frames[u.getFrameCount()-1])}else if(h=="color"){let u=new _i(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f],b=new $;b.setFromString(g.color||"ffffffff"),u.setFrame(p,g.time,b.r,b.g,b.b,b.a),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*_i.ENTRIES])}else if(h=="twoColor"){let u=new to(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f],b=new $,x=new $;b.setFromString(g.light),x.setFromString(g.dark),u.setFrame(p,g.time,b.r,b.g,b.b,b.a,x.r,x.g,x.b),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*to.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${h} (${c})`)}}if(t.bones)for(let c in t.bones){let a=t.bones[c],i=n.findBoneIndex(c);if(i==-1)throw new Error(`Bone not found: ${c}`);for(let h in a){let d=a[h];if(h==="rotate"){let u=new Fe(d.length);u.boneIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f];u.setFrame(p,g.time,g.angle),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*Fe.ENTRIES])}else if(h==="translate"||h==="scale"||h==="shear"){let u=null,p=1;h==="scale"?u=new Uo(d.length):h==="shear"?u=new Wo(d.length):(u=new Zr(d.length),p=r),u.boneIndex=i;let f=0;for(let g=0;g<d.length;g++){let b=d[g],x=this.getValue(b,"x",0),y=this.getValue(b,"y",0);u.setFrame(f,b.time,x*p,y*p),this.readCurve(b,u,f),f++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*Zr.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${h} (${c})`)}}if(t.ik)for(let c in t.ik){let a=t.ik[c],i=n.findIkConstraint(c),h=new eo(a.length);h.ikConstraintIndex=n.ikConstraints.indexOf(i);let d=0;for(let u=0;u<a.length;u++){let p=a[u];h.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,h,d),d++}s.push(h),o=Math.max(o,h.frames[(h.getFrameCount()-1)*eo.ENTRIES])}if(t.transform)for(let c in t.transform){let a=t.transform[c],i=n.findTransformConstraint(c),h=new no(a.length);h.transformConstraintIndex=n.transformConstraints.indexOf(i);let d=0;for(let u=0;u<a.length;u++){let p=a[u];h.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,h,d),d++}s.push(h),o=Math.max(o,h.frames[(h.getFrameCount()-1)*no.ENTRIES])}if(t.paths)for(let c in t.paths){let a=t.paths[c],i=n.findPathConstraintIndex(c);if(i==-1)throw new Error(`Path constraint not found: ${c}`);let h=n.pathConstraints[i];for(let d in a){let u=a[d];if(d==="position"||d==="spacing"){let p=null,f=1;d==="spacing"?(p=new zo(u.length),(h.spacingMode==0||h.spacingMode==1)&&(f=r)):(p=new Cs(u.length),h.positionMode==0&&(f=r)),p.pathConstraintIndex=i;let g=0;for(let b=0;b<u.length;b++){let x=u[b];p.setFrame(g,x.time,this.getValue(x,d,0)*f),this.readCurve(x,p,g),g++}s.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*Cs.ENTRIES])}else if(d==="mix"){let p=new ro(u.length);p.pathConstraintIndex=i;let f=0;for(let g=0;g<u.length;g++){let b=u[g];p.setFrame(f,b.time,this.getValue(b,"rotateMix",1),this.getValue(b,"translateMix",1)),this.readCurve(b,p,f),f++}s.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*ro.ENTRIES])}}}if(t.deform)for(let c in t.deform){let a=t.deform[c],i=n.findSkin(c);if(i==null){if(Dt.FAIL_ON_NON_EXISTING_SKIN)throw new Error(`Skin not found: ${c}`);continue}for(let h in a){let d=a[h],u=n.findSlotIndex(h);if(u==-1)throw new Error(`Slot not found: ${d.name}`);for(let p in d){let f=d[p],g=i.getAttachment(u,p);if(g==null)throw new Error(`Deform attachment not found: ${f.name}`);let b=g.bones!=null,x=g.vertices,y=b?x.length/3*2:x.length,w=new qo(f.length);w.slotIndex=u,w.attachment=g;let k=0;for(let S=0;S<f.length;S++){let I=f[S],M,v=this.getValue(I,"vertices",null);if(v==null)M=b?Y.newFloatArray(y):x;else{M=Y.newFloatArray(y);let E=this.getValue(I,"offset",0);if(Y.arrayCopy(v,0,M,E,v.length),r!=1)for(let C=E,T=C+v.length;C<T;C++)M[C]*=r;if(!b)for(let C=0;C<y;C++)M[C]+=x[C]}w.setFrame(k,I.time,M),this.readCurve(I,w,k),k++}s.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}}}let l=t.drawOrder;if(l==null&&(l=t.draworder),l!=null){let c=new Jr(l.length),a=n.slots.length,i=0;for(let h=0;h<l.length;h++){let d=l[h],u=null,p=this.getValue(d,"offsets",null);if(p!=null){u=Y.newArray(a,-1);let f=Y.newArray(a-p.length,0),g=0,b=0;for(let x=0;x<p.length;x++){let y=p[x],w=n.findSlotIndex(y.slot);if(w==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=w;)f[b++]=g++;u[g+y.offset]=g++}for(;g<a;)f[b++]=g++;for(let x=a-1;x>=0;x--)u[x]==-1&&(u[x]=f[--b])}c.setFrame(i++,d.time,u)}s.push(c),o=Math.max(o,c.frames[c.getFrameCount()-1])}if(t.events){let c=new $o(t.events.length),a=0;for(let i=0;i<t.events.length;i++){let h=t.events[i],d=n.findEvent(h.name);if(d==null)throw new Error(`Event not found: ${h.name}`);let u=new Qo(Y.toSinglePrecision(h.time),d);u.intValue=this.getValue(h,"int",d.intValue),u.floatValue=this.getValue(h,"float",d.floatValue),u.stringValue=this.getValue(h,"string",d.stringValue),u.data.audioPath!=null&&(u.volume=this.getValue(h,"volume",1),u.balance=this.getValue(h,"balance",0)),c.setFrame(a++,u)}s.push(c),o=Math.max(o,c.frames[c.getFrameCount()-1])}if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new Qt(e,s,o))}readCurve(t,e,n){if(t.curve){if(t.curve==="stepped")e.setStepped(n);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){let r=t.curve;e.setCurve(n,r[0],r[1],r[2],r[3])}}}getValue(t,e,n){return t[e]!==void 0?t[e]:n}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="additive")return 1;if(t=="multiply")return 2;if(t=="screen")return 3;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return 0;if(t=="percent")return 1;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return 0;if(t=="fixed")return 1;if(t=="percent")return 2;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return 0;if(t=="chain")return 1;if(t=="chainscale")return 2;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="onlytranslation")return 1;if(t=="norotationorreflection")return 2;if(t=="noscale")return 3;if(t=="noscaleorreflection")return 4;throw new Error(`Unknown transform mode: ${t}`)}},qh=class{constructor(t,e,n,r){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r}};var $h=class extends Ee{createSkeleton(t){this.skeleton=new al(t),this.skeleton.updateWorldTransform(),this.stateData=new Zo(t),this.state=new Go(this.stateData)}};var lo={};As(lo,{Animation:()=>zt,AnimationState:()=>pl,AnimationStateAdapter:()=>Gh,AnimationStateData:()=>bl,AtlasAttachmentLoader:()=>io,Attachment:()=>ao,AttachmentTimeline:()=>un,Bone:()=>oo,BoneData:()=>Ps,BoundingBoxAttachment:()=>ml,ClippingAttachment:()=>dl,ColorTimeline:()=>pr,ConstraintData:()=>Sr,CurveTimeline:()=>dn,DeformTimeline:()=>Vs,DrawOrderTimeline:()=>En,Event:()=>Ys,EventData:()=>Xs,EventQueue:()=>Wc,EventTimeline:()=>br,EventType:()=>md,IkConstraint:()=>xl,IkConstraintData:()=>Ls,IkConstraintTimeline:()=>xr,JitterEffect:()=>zh,MeshAttachment:()=>fr,PathAttachment:()=>$n,PathConstraint:()=>wl,PathConstraintData:()=>Ns,PathConstraintMixTimeline:()=>wr,PathConstraintPositionTimeline:()=>zn,PathConstraintSpacingTimeline:()=>Rs,PointAttachment:()=>ul,RegionAttachment:()=>Bs,RotateTimeline:()=>we,ScaleTimeline:()=>Fs,ShearTimeline:()=>Ds,Skeleton:()=>Al,SkeletonBinary:()=>Il,SkeletonBounds:()=>Kh,SkeletonData:()=>Us,SkeletonJson:()=>Ml,Skin:()=>Qr,SkinEntry:()=>kl,Slot:()=>Ts,SlotData:()=>Ws,SpacingMode:()=>yl,Spine:()=>Qh,SwirlEffect:()=>Hh,TimelineType:()=>hd,TrackEntry:()=>Uc,TransformConstraint:()=>Sl,TransformConstraintData:()=>qs,TransformConstraintTimeline:()=>yr,TranslateTimeline:()=>Cn,TwoColorTimeline:()=>gr,VertexAttachment:()=>De});var ao=class{constructor(t){m(this,"name");m(this,"type");if(t==null)throw new Error("name cannot be null.");this.name=t}},Nc=class Nc extends ao{constructor(e){super(e);m(this,"id",(Nc.nextID++&65535)<<11);m(this,"bones");m(this,"vertices");m(this,"worldVerticesLength",0);m(this,"deformAttachment",this)}computeWorldVerticesOld(e,n){this.computeWorldVertices(e,0,this.worldVerticesLength,n,0,2)}computeWorldVertices(e,n,r,s,o,l){r=o+(r>>1)*l;let c=e.bone.skeleton,a=e.deform,i=this.vertices,h=this.bones;if(h==null){a.length>0&&(i=a);let f=e.bone.matrix,g=f.tx,b=f.ty,x=f.a,y=f.c,w=f.b,k=f.d;for(let S=n,I=o;I<r;S+=2,I+=l){let M=i[S],v=i[S+1];s[I]=M*x+v*y+g,s[I+1]=M*w+v*k+b}return}let d=0,u=0;for(let f=0;f<n;f+=2){let g=h[d];d+=g+1,u+=g}let p=c.bones;if(a.length==0)for(let f=o,g=u*3;f<r;f+=l){let b=0,x=0,y=h[d++];for(y+=d;d<y;d++,g+=3){let w=p[h[d]].matrix,k=i[g],S=i[g+1],I=i[g+2];b+=(k*w.a+S*w.c+w.tx)*I,x+=(k*w.b+S*w.d+w.ty)*I}s[f]=b,s[f+1]=x}else{let f=a;for(let g=o,b=u*3,x=u<<1;g<r;g+=l){let y=0,w=0,k=h[d++];for(k+=d;d<k;d++,b+=3,x+=2){let S=p[h[d]].matrix,I=i[b]+f[x],M=i[b+1]+f[x+1],v=i[b+2];y+=(I*S.a+M*S.c+S.tx)*v,w+=(I*S.b+M*S.d+S.ty)*v}s[g]=y,s[g+1]=w}}}copyTo(e){this.bones!=null?(e.bones=new Array(this.bones.length),Y.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices!=null?(e.vertices=Y.newFloatArray(this.vertices.length),Y.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)):e.vertices=null,e.worldVerticesLength=this.worldVerticesLength,e.deformAttachment=this.deformAttachment}};m(Nc,"nextID",0);var De=Nc;var ml=class A extends De{constructor(e){super(e);m(this,"type",1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}};var dl=class A extends De{constructor(e){super(e);m(this,"type",6);m(this,"endSlot");m(this,"color",new $(.2275,.2275,.8078,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}};var fr=class A extends De{constructor(e){super(e);m(this,"type",2);m(this,"region");m(this,"path");m(this,"regionUVs");m(this,"triangles");m(this,"color",new $(1,1,1,1));m(this,"width");m(this,"height");m(this,"hullLength");m(this,"edges");m(this,"parentMesh");m(this,"tempColor",new $(0,0,0,0))}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e!=null&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();let e=new A(this.name);return e.region=this.region,e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Float32Array(this.regionUVs.length),Y.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=new Array(this.triangles.length),Y.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges!=null&&(e.edges=new Array(this.edges.length),Y.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}newLinkedMesh(){let e=new A(this.name);return e.region=this.region,e.path=this.path,e.color.setFromColor(this.color),e.deformAttachment=this.deformAttachment,e.setParentMesh(this.parentMesh!=null?this.parentMesh:this),e}};var $n=class A extends De{constructor(e){super(e);m(this,"type",4);m(this,"lengths");m(this,"closed",!1);m(this,"constantSpeed",!1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),Y.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}};var ul=class A extends De{constructor(e){super(e);m(this,"type",5);m(this,"x");m(this,"y");m(this,"rotation");m(this,"color",new $(.38,.94,0,1))}computeWorldPosition(e,n){let r=e.matrix;return n.x=this.x*r.a+this.y*r.c+e.worldX,n.y=this.x*r.b+this.y*r.d+e.worldY,n}computeWorldRotation(e){let n=e.matrix,r=B.cosDeg(this.rotation),s=B.sinDeg(this.rotation),o=r*n.a+s*n.c,l=r*n.b+s*n.d;return Math.atan2(l,o)*B.radDeg}copy(){let e=new A(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}};var Ts=class{constructor(t,e){m(this,"blendMode");m(this,"data");m(this,"bone");m(this,"color");m(this,"darkColor");m(this,"attachment");m(this,"attachmentTime");m(this,"attachmentState");m(this,"deform",new Array);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new $,this.darkColor=t.darkColor==null?null:new $,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};var nt=class nt extends ao{constructor(e){super(e);m(this,"type",0);m(this,"x",0);m(this,"y",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"rotation",0);m(this,"width",0);m(this,"height",0);m(this,"color",new $(1,1,1,1));m(this,"path");m(this,"rendererObject");m(this,"region");m(this,"offset",Y.newFloatArray(8));m(this,"uvs",Y.newFloatArray(8));m(this,"tempColor",new $(1,1,1,1))}updateOffset(){let e=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*e,s=-this.height/2*this.scaleY+this.region.offsetY*n,o=r+this.region.width*e,l=s+this.region.height*n,c=this.rotation*Math.PI/180,a=Math.cos(c),i=Math.sin(c),h=r*a+this.x,d=r*i,u=s*a+this.y,p=s*i,f=o*a+this.x,g=o*i,b=l*a+this.y,x=l*i,y=this.offset;y[nt.OX1]=h-p,y[nt.OY1]=u+d,y[nt.OX2]=h-x,y[nt.OY2]=b+d,y[nt.OX3]=f-x,y[nt.OY3]=b+g,y[nt.OX4]=f-p,y[nt.OY4]=u+g}setRegion(e){this.region=e;let n=this.uvs;e.rotate?(n[2]=e.u,n[3]=e.v2,n[4]=e.u,n[5]=e.v,n[6]=e.u2,n[7]=e.v,n[0]=e.u2,n[1]=e.v2):(n[0]=e.u,n[1]=e.v2,n[2]=e.u,n[3]=e.v,n[4]=e.u2,n[5]=e.v,n[6]=e.u2,n[7]=e.v2)}computeWorldVertices(e,n,r,s){let o=this.offset,l=e instanceof Ts?e.bone.matrix:e.matrix,c=l.tx,a=l.ty,i=l.a,h=l.c,d=l.b,u=l.d,p=0,f=0;p=o[nt.OX1],f=o[nt.OY1],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[nt.OX2],f=o[nt.OY2],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[nt.OX3],f=o[nt.OY3],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[nt.OX4],f=o[nt.OY4],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a}copy(){let e=new nt(this.name);return e.region=this.region,e.rendererObject=this.rendererObject,e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,Y.arrayCopy(this.uvs,0,e.uvs,0,8),Y.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e}};m(nt,"OX1",0),m(nt,"OY1",1),m(nt,"OX2",2),m(nt,"OY2",3),m(nt,"OX3",4),m(nt,"OY3",5),m(nt,"OX4",6),m(nt,"OY4",7),m(nt,"X1",0),m(nt,"Y1",1),m(nt,"C1R",2),m(nt,"C1G",3),m(nt,"C1B",4),m(nt,"C1A",5),m(nt,"U1",6),m(nt,"V1",7),m(nt,"X2",8),m(nt,"Y2",9),m(nt,"C2R",10),m(nt,"C2G",11),m(nt,"C2B",12),m(nt,"C2A",13),m(nt,"U2",14),m(nt,"V2",15),m(nt,"X3",16),m(nt,"Y3",17),m(nt,"C3R",18),m(nt,"C3G",19),m(nt,"C3B",20),m(nt,"C3A",21),m(nt,"U3",22),m(nt,"V3",23),m(nt,"X4",24),m(nt,"Y4",25),m(nt,"C4R",26),m(nt,"C4G",27),m(nt,"C4B",28),m(nt,"C4A",29),m(nt,"U4",30),m(nt,"V4",31);var Bs=nt;var zh=class{constructor(t,e){m(this,"jitterX",0);m(this,"jitterY",0);this.jitterX=t,this.jitterY=e}begin(t){}transform(t,e,n,r){t.x+=B.randomTriangular(-this.jitterX,this.jitterY),t.y+=B.randomTriangular(-this.jitterX,this.jitterY)}end(){}};var Oc=class Oc{constructor(t){m(this,"centerX",0);m(this,"centerY",0);m(this,"radius",0);m(this,"angle",0);m(this,"worldX",0);m(this,"worldY",0);this.radius=t}begin(t){this.worldX=t.x+this.centerX,this.worldY=t.y+this.centerY}transform(t,e,n,r){let s=this.angle*B.degreesToRadians,o=t.x-this.worldX,l=t.y-this.worldY,c=Math.sqrt(o*o+l*l);if(c<this.radius){let a=Oc.interpolation.apply(0,s,(this.radius-c)/this.radius),i=Math.cos(a),h=Math.sin(a);t.x=i*o-h*l+this.worldX,t.y=h*o+i*l+this.worldY}}end(){}};m(Oc,"interpolation",new mr(2));var Hh=Oc;var zt=class{constructor(t,e,n){m(this,"name");m(this,"timelines");m(this,"timelineIds");m(this,"duration");if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=n}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,n,r,s,o,l,c){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(n%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let i=0,h=a.length;i<h;i++)a[i].apply(t,e,n,s,o,l,c)}static binarySearch(t,e,n=1){let r=0,s=t.length/n-2;if(s==0)return n;let o=s>>>1;for(;;){if(t[(o+1)*n]<=e?r=o+1:s=o,r==s)return(r+1)*n;o=r+s>>>1}}static linearSearch(t,e,n){for(let r=0,s=t.length-n;r<=s;r+=n)if(t[r]>e)return r;return-1}},hd=(f=>(f[f.rotate=0]="rotate",f[f.translate=1]="translate",f[f.scale=2]="scale",f[f.shear=3]="shear",f[f.attachment=4]="attachment",f[f.color=5]="color",f[f.deform=6]="deform",f[f.event=7]="event",f[f.drawOrder=8]="drawOrder",f[f.ikConstraint=9]="ikConstraint",f[f.transformConstraint=10]="transformConstraint",f[f.pathConstraintPosition=11]="pathConstraintPosition",f[f.pathConstraintSpacing=12]="pathConstraintSpacing",f[f.pathConstraintMix=13]="pathConstraintMix",f[f.twoColor=14]="twoColor",f))(hd||{}),$t=class $t{constructor(t){m(this,"curves");if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=Y.newFloatArray((t-1)*$t.BEZIER_SIZE)}getFrameCount(){return this.curves.length/$t.BEZIER_SIZE+1}setLinear(t){this.curves[t*$t.BEZIER_SIZE]=$t.LINEAR}setStepped(t){this.curves[t*$t.BEZIER_SIZE]=$t.STEPPED}getCurveType(t){let e=t*$t.BEZIER_SIZE;if(e==this.curves.length)return $t.LINEAR;let n=this.curves[e];return n==$t.LINEAR?$t.LINEAR:n==$t.STEPPED?$t.STEPPED:$t.BEZIER}setCurve(t,e,n,r,s){let o=(-e*2+r)*.03,l=(-n*2+s)*.03,c=((e-r)*3+1)*.006,a=((n-s)*3+1)*.006,i=o*2+c,h=l*2+a,d=e*.3+o+c*.16666667,u=n*.3+l+a*.16666667,p=t*$t.BEZIER_SIZE,f=this.curves;f[p++]=$t.BEZIER;let g=d,b=u;for(let x=p+$t.BEZIER_SIZE-1;p<x;p+=2)f[p]=g,f[p+1]=b,d+=i,u+=h,i+=c,h+=a,g+=d,b+=u}getCurvePercent(t,e){e=B.clamp(e,0,1);let n=this.curves,r=t*$t.BEZIER_SIZE,s=n[r];if(s==$t.LINEAR)return e;if(s==$t.STEPPED)return 0;r++;let o=0;for(let c=r,a=r+$t.BEZIER_SIZE-1;r<a;r+=2)if(o=n[r],o>=e){let i,h;return r==c?(i=0,h=0):(i=n[r-2],h=n[r-1]),h+(n[r+1]-h)*(e-i)/(o-i)}let l=n[r-1];return l+(1-l)*(e-o)/(1-o)}};m($t,"LINEAR",0),m($t,"STEPPED",1),m($t,"BEZIER",2),m($t,"BEZIER_SIZE",10*2-1);var dn=$t,He=class He extends dn{constructor(e){super(e);m(this,"boneIndex");m(this,"frames");this.frames=Y.newFloatArray(e<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(e,n,r){e<<=1,this.frames[e]=n,this.frames[e+He.ROTATION]=r}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.bones[this.boneIndex];if(!i.active)return;if(r<a[0]){switch(l){case 0:i.rotation=i.data.rotation;return;case 1:let g=i.data.rotation-i.rotation;i.rotation+=(g-(16384-(16384.499999999996-g/360|0))*360)*o}return}if(r>=a[a.length-He.ENTRIES]){let g=a[a.length+He.PREV_ROTATION];switch(l){case 0:i.rotation=i.data.rotation+g*o;break;case 1:case 2:g+=i.data.rotation-i.rotation,g-=(16384-(16384.499999999996-g/360|0))*360;case 3:i.rotation+=g*o}return}let h=zt.binarySearch(a,r,He.ENTRIES),d=a[h+He.PREV_ROTATION],u=a[h],p=this.getCurvePercent((h>>1)-1,1-(r-u)/(a[h+He.PREV_TIME]-u)),f=a[h+He.ROTATION]-d;switch(f=d+(f-(16384-(16384.499999999996-f/360|0))*360)*p,l){case 0:i.rotation=i.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*o;break;case 1:case 2:f+=i.data.rotation-i.rotation;case 3:i.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*o}}};m(He,"ENTRIES",2),m(He,"PREV_TIME",-2),m(He,"PREV_ROTATION",-1),m(He,"ROTATION",1);var we=He,se=class se extends dn{constructor(e){super(e);m(this,"boneIndex");m(this,"frames");this.frames=Y.newFloatArray(e*se.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(e,n,r,s){e*=se.ENTRIES,this.frames[e]=n,this.frames[e+se.X]=r,this.frames[e+se.Y]=s}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.bones[this.boneIndex];if(!i.active)return;if(r<a[0]){switch(l){case 0:i.x=i.data.x,i.y=i.data.y;return;case 1:i.x+=(i.data.x-i.x)*o,i.y+=(i.data.y-i.y)*o}return}let h=0,d=0;if(r>=a[a.length-se.ENTRIES])h=a[a.length+se.PREV_X],d=a[a.length+se.PREV_Y];else{let u=zt.binarySearch(a,r,se.ENTRIES);h=a[u+se.PREV_X],d=a[u+se.PREV_Y];let p=a[u],f=this.getCurvePercent(u/se.ENTRIES-1,1-(r-p)/(a[u+se.PREV_TIME]-p));h+=(a[u+se.X]-h)*f,d+=(a[u+se.Y]-d)*f}switch(l){case 0:i.x=i.data.x+h*o,i.y=i.data.y+d*o;break;case 1:case 2:i.x+=(i.data.x+h-i.x)*o,i.y+=(i.data.y+d-i.y)*o;break;case 3:i.x+=h*o,i.y+=d*o}}};m(se,"ENTRIES",3),m(se,"PREV_TIME",-3),m(se,"PREV_X",-2),m(se,"PREV_Y",-1),m(se,"X",1),m(se,"Y",2);var Cn=se,Fs=class A extends Cn{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(n<c[0]){switch(o){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*s,a.scaleY+=(a.data.scaleY-a.scaleY)*s}return}let i=0,h=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_X]*a.data.scaleX,h=c[c.length+A.PREV_Y]*a.data.scaleY;else{let d=zt.binarySearch(c,n,A.ENTRIES);i=c[d+A.PREV_X],h=c[d+A.PREV_Y];let u=c[d],p=this.getCurvePercent(d/A.ENTRIES-1,1-(n-u)/(c[d+A.PREV_TIME]-u));i=(i+(c[d+A.X]-i)*p)*a.data.scaleX,h=(h+(c[d+A.Y]-h)*p)*a.data.scaleY}if(s==1)o==3?(a.scaleX+=i-a.data.scaleX,a.scaleY+=h-a.data.scaleY):(a.scaleX=i,a.scaleY=h);else{let d=0,u=0;if(l==1)switch(o){case 0:d=a.data.scaleX,u=a.data.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-d)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-u)*s;break;case 1:case 2:d=a.scaleX,u=a.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-d)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-u)*s;break;case 3:d=a.scaleX,u=a.scaleY,a.scaleX=d+(Math.abs(i)*B.signum(d)-a.data.scaleX)*s,a.scaleY=u+(Math.abs(h)*B.signum(u)-a.data.scaleY)*s}else switch(o){case 0:d=Math.abs(a.data.scaleX)*B.signum(i),u=Math.abs(a.data.scaleY)*B.signum(h),a.scaleX=d+(i-d)*s,a.scaleY=u+(h-u)*s;break;case 1:case 2:d=Math.abs(a.scaleX)*B.signum(i),u=Math.abs(a.scaleY)*B.signum(h),a.scaleX=d+(i-d)*s,a.scaleY=u+(h-u)*s;break;case 3:d=B.signum(i),u=B.signum(h),a.scaleX=Math.abs(a.scaleX)*d+(i-Math.abs(a.data.scaleX)*d)*s,a.scaleY=Math.abs(a.scaleY)*u+(h-Math.abs(a.data.scaleY)*u)*s}}}},Ds=class A extends Cn{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(n<c[0]){switch(o){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*s,a.shearY+=(a.data.shearY-a.shearY)*s}return}let i=0,h=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_X],h=c[c.length+A.PREV_Y];else{let d=zt.binarySearch(c,n,A.ENTRIES);i=c[d+A.PREV_X],h=c[d+A.PREV_Y];let u=c[d],p=this.getCurvePercent(d/A.ENTRIES-1,1-(n-u)/(c[d+A.PREV_TIME]-u));i=i+(c[d+A.X]-i)*p,h=h+(c[d+A.Y]-h)*p}switch(o){case 0:a.shearX=a.data.shearX+i*s,a.shearY=a.data.shearY+h*s;break;case 1:case 2:a.shearX+=(a.data.shearX+i-a.shearX)*s,a.shearY+=(a.data.shearY+h-a.shearY)*s;break;case 3:a.shearX+=i*s,a.shearY+=h*s}}},Et=class Et extends dn{constructor(e){super(e);m(this,"slotIndex");m(this,"frames");this.frames=Y.newFloatArray(e*Et.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(e,n,r,s,o,l){e*=Et.ENTRIES,this.frames[e]=n,this.frames[e+Et.R]=r,this.frames[e+Et.G]=s,this.frames[e+Et.B]=o,this.frames[e+Et.A]=l}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.color.setFromColor(a.data.color);return;case 1:let f=a.color,g=a.data.color;f.add((g.r-f.r)*o,(g.g-f.g)*o,(g.b-f.b)*o,(g.a-f.a)*o)}return}let h=0,d=0,u=0,p=0;if(r>=i[i.length-Et.ENTRIES]){let f=i.length;h=i[f+Et.PREV_R],d=i[f+Et.PREV_G],u=i[f+Et.PREV_B],p=i[f+Et.PREV_A]}else{let f=zt.binarySearch(i,r,Et.ENTRIES);h=i[f+Et.PREV_R],d=i[f+Et.PREV_G],u=i[f+Et.PREV_B],p=i[f+Et.PREV_A];let g=i[f],b=this.getCurvePercent(f/Et.ENTRIES-1,1-(r-g)/(i[f+Et.PREV_TIME]-g));h+=(i[f+Et.R]-h)*b,d+=(i[f+Et.G]-d)*b,u+=(i[f+Et.B]-u)*b,p+=(i[f+Et.A]-p)*b}if(o==1)a.color.set(h,d,u,p);else{let f=a.color;l==0&&f.setFromColor(a.data.color),f.add((h-f.r)*o,(d-f.g)*o,(u-f.b)*o,(p-f.a)*o)}}};m(Et,"ENTRIES",5),m(Et,"PREV_TIME",-5),m(Et,"PREV_R",-4),m(Et,"PREV_G",-3),m(Et,"PREV_B",-2),m(Et,"PREV_A",-1),m(Et,"R",1),m(Et,"G",2),m(Et,"B",3),m(Et,"A",4);var pr=Et,lt=class lt extends dn{constructor(e){super(e);m(this,"slotIndex");m(this,"frames");this.frames=Y.newFloatArray(e*lt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(e,n,r,s,o,l,c,a,i){e*=lt.ENTRIES,this.frames[e]=n,this.frames[e+lt.R]=r,this.frames[e+lt.G]=s,this.frames[e+lt.B]=o,this.frames[e+lt.A]=l,this.frames[e+lt.R2]=c,this.frames[e+lt.G2]=a,this.frames[e+lt.B2]=i}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.color.setFromColor(a.data.color),a.darkColor.setFromColor(a.data.darkColor);return;case 1:let x=a.color,y=a.darkColor,w=a.data.color,k=a.data.darkColor;x.add((w.r-x.r)*o,(w.g-x.g)*o,(w.b-x.b)*o,(w.a-x.a)*o),y.add((k.r-y.r)*o,(k.g-y.g)*o,(k.b-y.b)*o,0)}return}let h=0,d=0,u=0,p=0,f=0,g=0,b=0;if(r>=i[i.length-lt.ENTRIES]){let x=i.length;h=i[x+lt.PREV_R],d=i[x+lt.PREV_G],u=i[x+lt.PREV_B],p=i[x+lt.PREV_A],f=i[x+lt.PREV_R2],g=i[x+lt.PREV_G2],b=i[x+lt.PREV_B2]}else{let x=zt.binarySearch(i,r,lt.ENTRIES);h=i[x+lt.PREV_R],d=i[x+lt.PREV_G],u=i[x+lt.PREV_B],p=i[x+lt.PREV_A],f=i[x+lt.PREV_R2],g=i[x+lt.PREV_G2],b=i[x+lt.PREV_B2];let y=i[x],w=this.getCurvePercent(x/lt.ENTRIES-1,1-(r-y)/(i[x+lt.PREV_TIME]-y));h+=(i[x+lt.R]-h)*w,d+=(i[x+lt.G]-d)*w,u+=(i[x+lt.B]-u)*w,p+=(i[x+lt.A]-p)*w,f+=(i[x+lt.R2]-f)*w,g+=(i[x+lt.G2]-g)*w,b+=(i[x+lt.B2]-b)*w}if(o==1)a.color.set(h,d,u,p),a.darkColor.set(f,g,b,1);else{let x=a.color,y=a.darkColor;l==0&&(x.setFromColor(a.data.color),y.setFromColor(a.data.darkColor)),x.add((h-x.r)*o,(d-x.g)*o,(u-x.b)*o,(p-x.a)*o),y.add((f-y.r)*o,(g-y.g)*o,(b-y.b)*o,0)}}};m(lt,"ENTRIES",8),m(lt,"PREV_TIME",-8),m(lt,"PREV_R",-7),m(lt,"PREV_G",-6),m(lt,"PREV_B",-5),m(lt,"PREV_A",-4),m(lt,"PREV_R2",-3),m(lt,"PREV_G2",-2),m(lt,"PREV_B2",-1),m(lt,"R",1),m(lt,"G",2),m(lt,"B",3),m(lt,"A",4),m(lt,"R2",5),m(lt,"G2",6),m(lt,"B2",7);var gr=lt,un=class{constructor(t){m(this,"slotIndex");m(this,"frames");m(this,"attachmentNames");this.frames=Y.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n}apply(t,e,n,r,s,o,l){let c=t.slots[this.slotIndex];if(!c.bone.active)return;if(l==1){o==0&&this.setAttachment(t,c,c.data.attachmentName);return}let a=this.frames;if(n<a[0]){(o==0||o==1)&&this.setAttachment(t,c,c.data.attachmentName);return}let i=0;n>=a[a.length-1]?i=a.length-1:i=zt.binarySearch(a,n,1)-1;let h=this.attachmentNames[i];t.slots[this.slotIndex].setAttachment(h==null?null:t.getAttachment(this.slotIndex,h))}setAttachment(t,e,n){e.setAttachment(n==null?null:t.getAttachment(this.slotIndex,n))}},cd=null,Vs=class extends dn{constructor(e){super(e);m(this,"slotIndex");m(this,"attachment");m(this,"frames");m(this,"frameVertices");this.frames=Y.newFloatArray(e),this.frameVertices=new Array(e),cd==null&&(cd=Y.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(e,n,r){this.frames[e]=n,this.frameVertices[e]=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.getAttachment();if(!(i instanceof De)||i.deformAttachment!=this.attachment)return;let h=a.deform;h.length==0&&(l=0);let d=this.frameVertices,u=d[0].length,p=this.frames;if(r<p[0]){let k=i;switch(l){case 0:h.length=0;return;case 1:if(o==1){h.length=0;break}let S=Y.setArraySize(h,u);if(k.bones==null){let I=k.vertices;for(let M=0;M<u;M++)S[M]+=(I[M]-S[M])*o}else{o=1-o;for(let I=0;I<u;I++)S[I]*=o}}return}let f=Y.setArraySize(h,u);if(r>=p[p.length-1]){let k=d[p.length-1];if(o==1)if(l==3){let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++)f[M]+=k[M]-I[M]}else for(let I=0;I<u;I++)f[I]+=k[I]}else Y.arrayCopy(k,0,f,0,u);else switch(l){case 0:{let I=i;if(I.bones==null){let M=I.vertices;for(let v=0;v<u;v++){let E=M[v];f[v]=E+(k[v]-E)*o}}else for(let M=0;M<u;M++)f[M]=k[M]*o;break}case 1:case 2:for(let I=0;I<u;I++)f[I]+=(k[I]-f[I])*o;break;case 3:let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++)f[M]+=(k[M]-I[M])*o}else for(let I=0;I<u;I++)f[I]+=k[I]*o}return}let g=zt.binarySearch(p,r),b=d[g-1],x=d[g],y=p[g],w=this.getCurvePercent(g-1,1-(r-y)/(p[g-1]-y));if(o==1)if(l==3){let k=i;if(k.bones==null){let S=k.vertices;for(let I=0;I<u;I++){let M=b[I];f[I]+=M+(x[I]-M)*w-S[I]}}else for(let S=0;S<u;S++){let I=b[S];f[S]+=I+(x[S]-I)*w}}else for(let k=0;k<u;k++){let S=b[k];f[k]=S+(x[k]-S)*w}else switch(l){case 0:{let S=i;if(S.bones==null){let I=S.vertices;for(let M=0;M<u;M++){let v=b[M],E=I[M];f[M]=E+(v+(x[M]-v)*w-E)*o}}else for(let I=0;I<u;I++){let M=b[I];f[I]=(M+(x[I]-M)*w)*o}break}case 1:case 2:for(let S=0;S<u;S++){let I=b[S];f[S]+=(I+(x[S]-I)*w-f[S])*o}break;case 3:let k=i;if(k.bones==null){let S=k.vertices;for(let I=0;I<u;I++){let M=b[I];f[I]+=(M+(x[I]-M)*w-S[I])*o}}else for(let S=0;S<u;S++){let I=b[S];f[S]+=(I+(x[S]-I)*w)*o}}}},br=class{constructor(t){m(this,"frames");m(this,"events");this.frames=Y.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,n,r,s,o,l){if(r==null)return;let c=this.frames,a=this.frames.length;if(e>n)this.apply(t,e,Number.MAX_VALUE,r,s,o,l),e=-1;else if(e>=c[a-1])return;if(n<c[0])return;let i=0;if(e<c[0])i=0;else{i=zt.binarySearch(c,e);let h=c[i];for(;i>0&&c[i-1]==h;)i--}for(;i<a&&n>=c[i];i++)r.push(this.events[i])}},En=class{constructor(t){m(this,"frames");m(this,"drawOrders");this.frames=Y.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}apply(t,e,n,r,s,o,l){let c=t.drawOrder,a=t.slots;if(l==1&&o==0){Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let i=this.frames;if(n<i[0]){(o==0||o==1)&&Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let h=0;n>=i[i.length-1]?h=i.length-1:h=zt.binarySearch(i,n)-1;let d=this.drawOrders[h];if(d==null)Y.arrayCopy(a,0,c,0,a.length);else for(let u=0,p=d.length;u<p;u++)c[u]=a[d[u]]}},ht=class ht extends dn{constructor(e){super(e);m(this,"ikConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(e,n,r,s,o,l,c){e*=ht.ENTRIES,this.frames[e]=n,this.frames[e+ht.MIX]=r,this.frames[e+ht.SOFTNESS]=s,this.frames[e+ht.BEND_DIRECTION]=o,this.frames[e+ht.COMPRESS]=l?1:0,this.frames[e+ht.STRETCH]=c?1:0}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.ikConstraints[this.ikConstraintIndex];if(!i.active)return;if(r<a[0]){switch(l){case 0:i.mix=i.data.mix,i.softness=i.data.softness,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch;return;case 1:i.mix+=(i.data.mix-i.mix)*o,i.softness+=(i.data.softness-i.softness)*o,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch}return}if(r>=a[a.length-ht.ENTRIES]){l==0?(i.mix=i.data.mix+(a[a.length+ht.PREV_MIX]-i.data.mix)*o,i.softness=i.data.softness+(a[a.length+ht.PREV_SOFTNESS]-i.data.softness)*o,c==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=a[a.length+ht.PREV_BEND_DIRECTION],i.compress=a[a.length+ht.PREV_COMPRESS]!=0,i.stretch=a[a.length+ht.PREV_STRETCH]!=0)):(i.mix+=(a[a.length+ht.PREV_MIX]-i.mix)*o,i.softness+=(a[a.length+ht.PREV_SOFTNESS]-i.softness)*o,c==0&&(i.bendDirection=a[a.length+ht.PREV_BEND_DIRECTION],i.compress=a[a.length+ht.PREV_COMPRESS]!=0,i.stretch=a[a.length+ht.PREV_STRETCH]!=0));return}let h=zt.binarySearch(a,r,ht.ENTRIES),d=a[h+ht.PREV_MIX],u=a[h+ht.PREV_SOFTNESS],p=a[h],f=this.getCurvePercent(h/ht.ENTRIES-1,1-(r-p)/(a[h+ht.PREV_TIME]-p));l==0?(i.mix=i.data.mix+(d+(a[h+ht.MIX]-d)*f-i.data.mix)*o,i.softness=i.data.softness+(u+(a[h+ht.SOFTNESS]-u)*f-i.data.softness)*o,c==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=a[h+ht.PREV_BEND_DIRECTION],i.compress=a[h+ht.PREV_COMPRESS]!=0,i.stretch=a[h+ht.PREV_STRETCH]!=0)):(i.mix+=(d+(a[h+ht.MIX]-d)*f-i.mix)*o,i.softness+=(u+(a[h+ht.SOFTNESS]-u)*f-i.softness)*o,c==0&&(i.bendDirection=a[h+ht.PREV_BEND_DIRECTION],i.compress=a[h+ht.PREV_COMPRESS]!=0,i.stretch=a[h+ht.PREV_STRETCH]!=0))}};m(ht,"ENTRIES",6),m(ht,"PREV_TIME",-6),m(ht,"PREV_MIX",-5),m(ht,"PREV_SOFTNESS",-4),m(ht,"PREV_BEND_DIRECTION",-3),m(ht,"PREV_COMPRESS",-2),m(ht,"PREV_STRETCH",-1),m(ht,"MIX",1),m(ht,"SOFTNESS",2),m(ht,"BEND_DIRECTION",3),m(ht,"COMPRESS",4),m(ht,"STRETCH",5);var xr=ht,Tt=class Tt extends dn{constructor(e){super(e);m(this,"transformConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*Tt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(e,n,r,s,o,l){e*=Tt.ENTRIES,this.frames[e]=n,this.frames[e+Tt.ROTATE]=r,this.frames[e+Tt.TRANSLATE]=s,this.frames[e+Tt.SCALE]=o,this.frames[e+Tt.SHEAR]=l}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.transformConstraints[this.transformConstraintIndex];if(!i.active)return;if(r<a[0]){let f=i.data;switch(l){case 0:i.rotateMix=f.rotateMix,i.translateMix=f.translateMix,i.scaleMix=f.scaleMix,i.shearMix=f.shearMix;return;case 1:i.rotateMix+=(f.rotateMix-i.rotateMix)*o,i.translateMix+=(f.translateMix-i.translateMix)*o,i.scaleMix+=(f.scaleMix-i.scaleMix)*o,i.shearMix+=(f.shearMix-i.shearMix)*o}return}let h=0,d=0,u=0,p=0;if(r>=a[a.length-Tt.ENTRIES]){let f=a.length;h=a[f+Tt.PREV_ROTATE],d=a[f+Tt.PREV_TRANSLATE],u=a[f+Tt.PREV_SCALE],p=a[f+Tt.PREV_SHEAR]}else{let f=zt.binarySearch(a,r,Tt.ENTRIES);h=a[f+Tt.PREV_ROTATE],d=a[f+Tt.PREV_TRANSLATE],u=a[f+Tt.PREV_SCALE],p=a[f+Tt.PREV_SHEAR];let g=a[f],b=this.getCurvePercent(f/Tt.ENTRIES-1,1-(r-g)/(a[f+Tt.PREV_TIME]-g));h+=(a[f+Tt.ROTATE]-h)*b,d+=(a[f+Tt.TRANSLATE]-d)*b,u+=(a[f+Tt.SCALE]-u)*b,p+=(a[f+Tt.SHEAR]-p)*b}if(l==0){let f=i.data;i.rotateMix=f.rotateMix+(h-f.rotateMix)*o,i.translateMix=f.translateMix+(d-f.translateMix)*o,i.scaleMix=f.scaleMix+(u-f.scaleMix)*o,i.shearMix=f.shearMix+(p-f.shearMix)*o}else i.rotateMix+=(h-i.rotateMix)*o,i.translateMix+=(d-i.translateMix)*o,i.scaleMix+=(u-i.scaleMix)*o,i.shearMix+=(p-i.shearMix)*o}};m(Tt,"ENTRIES",5),m(Tt,"PREV_TIME",-5),m(Tt,"PREV_ROTATE",-4),m(Tt,"PREV_TRANSLATE",-3),m(Tt,"PREV_SCALE",-2),m(Tt,"PREV_SHEAR",-1),m(Tt,"ROTATE",1),m(Tt,"TRANSLATE",2),m(Tt,"SCALE",3),m(Tt,"SHEAR",4);var yr=Tt,ve=class ve extends dn{constructor(e){super(e);m(this,"pathConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ve.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(e,n,r){e*=ve.ENTRIES,this.frames[e]=n,this.frames[e+ve.VALUE]=r}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.pathConstraints[this.pathConstraintIndex];if(!i.active)return;if(r<a[0]){switch(l){case 0:i.position=i.data.position;return;case 1:i.position+=(i.data.position-i.position)*o}return}let h=0;if(r>=a[a.length-ve.ENTRIES])h=a[a.length+ve.PREV_VALUE];else{let d=zt.binarySearch(a,r,ve.ENTRIES);h=a[d+ve.PREV_VALUE];let u=a[d],p=this.getCurvePercent(d/ve.ENTRIES-1,1-(r-u)/(a[d+ve.PREV_TIME]-u));h+=(a[d+ve.VALUE]-h)*p}l==0?i.position=i.data.position+(h-i.data.position)*o:i.position+=(h-i.position)*o}};m(ve,"ENTRIES",2),m(ve,"PREV_TIME",-2),m(ve,"PREV_VALUE",-1),m(ve,"VALUE",1);var zn=ve,Rs=class A extends zn{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,n,r,s,o,l){let c=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(n<c[0]){switch(o){case 0:a.spacing=a.data.spacing;return;case 1:a.spacing+=(a.data.spacing-a.spacing)*s}return}let i=0;if(n>=c[c.length-A.ENTRIES])i=c[c.length+A.PREV_VALUE];else{let h=zt.binarySearch(c,n,A.ENTRIES);i=c[h+A.PREV_VALUE];let d=c[h],u=this.getCurvePercent(h/A.ENTRIES-1,1-(n-d)/(c[h+A.PREV_TIME]-d));i+=(c[h+A.VALUE]-i)*u}o==0?a.spacing=a.data.spacing+(i-a.data.spacing)*s:a.spacing+=(i-a.spacing)*s}},ae=class ae extends dn{constructor(e){super(e);m(this,"pathConstraintIndex");m(this,"frames");this.frames=Y.newFloatArray(e*ae.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(e,n,r,s){e*=ae.ENTRIES,this.frames[e]=n,this.frames[e+ae.ROTATE]=r,this.frames[e+ae.TRANSLATE]=s}apply(e,n,r,s,o,l,c){let a=this.frames,i=e.pathConstraints[this.pathConstraintIndex];if(!i.active)return;if(r<a[0]){switch(l){case 0:i.rotateMix=i.data.rotateMix,i.translateMix=i.data.translateMix;return;case 1:i.rotateMix+=(i.data.rotateMix-i.rotateMix)*o,i.translateMix+=(i.data.translateMix-i.translateMix)*o}return}let h=0,d=0;if(r>=a[a.length-ae.ENTRIES])h=a[a.length+ae.PREV_ROTATE],d=a[a.length+ae.PREV_TRANSLATE];else{let u=zt.binarySearch(a,r,ae.ENTRIES);h=a[u+ae.PREV_ROTATE],d=a[u+ae.PREV_TRANSLATE];let p=a[u],f=this.getCurvePercent(u/ae.ENTRIES-1,1-(r-p)/(a[u+ae.PREV_TIME]-p));h+=(a[u+ae.ROTATE]-h)*f,d+=(a[u+ae.TRANSLATE]-d)*f}l==0?(i.rotateMix=i.data.rotateMix+(h-i.data.rotateMix)*o,i.translateMix=i.data.translateMix+(d-i.data.translateMix)*o):(i.rotateMix+=(h-i.rotateMix)*o,i.translateMix+=(d-i.translateMix)*o)}};m(ae,"ENTRIES",3),m(ae,"PREV_TIME",-3),m(ae,"PREV_ROTATE",-2),m(ae,"PREV_TRANSLATE",-1),m(ae,"ROTATE",1),m(ae,"TRANSLATE",2);var wr=ae;var yt=class yt{constructor(t){m(this,"data");m(this,"tracks",new Array);m(this,"timeScale",1);m(this,"unkeyedState",0);m(this,"events",new Array);m(this,"listeners",new Array);m(this,"queue",new Wc(this));m(this,"propertyIDs",new ks);m(this,"animationsChanged",!1);m(this,"trackEntryPool",new qe(()=>new Uc));m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd");this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s==null)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let o=t*s.timeScale;if(s.delay>0){if(s.delay-=o,s.delay>0)continue;o=-s.delay,s.delay=0}let l=s.next;if(l!=null){let c=s.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime+=s.timeScale==0?0:(c/s.timeScale+t)*l.timeScale,s.trackTime+=o,this.setCurrent(n,l,!0);l.mixingFrom!=null;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&s.mixingFrom==null){e[n]=null,this.queue.end(s),this.disposeNext(s);continue}if(s.mixingFrom!=null&&this.updateMixingFrom(s,t)){let c=s.mixingFrom;for(s.mixingFrom=null,c!=null&&(c.mixingTo=null);c!=null;)this.queue.end(c),c=c.mixingFrom}s.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let n=t.mixingFrom;if(n==null)return!0;let r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((n.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}apply(t){if(t==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,n=this.tracks,r=!1;for(let l=0,c=n.length;l<c;l++){let a=n[l];if(a==null||a.delay>0)continue;r=!0;let i=l==0?1:a.mixBlend,h=a.alpha;a.mixingFrom!=null?h*=this.applyMixingFrom(a,t,i):a.trackTime>=a.trackEnd&&a.next==null&&(h=0);let d=a.animationLast,u=a.getAnimationTime(),p=a.animation.timelines.length,f=a.animation.timelines;if(l==0&&h==1||i==3)for(let g=0;g<p;g++){Y.webkit602BugfixHelper(h,i);let b=f[g];b instanceof un?this.applyAttachmentTimeline(b,t,u,i,!0):b.apply(t,d,u,e,h,i,0)}else{let g=a.timelineMode,b=a.timelinesRotation.length==0;b&&Y.setArraySize(a.timelinesRotation,p<<1,null);let x=a.timelinesRotation;for(let y=0;y<p;y++){let w=f[y],k=g[y]==yt.SUBSEQUENT?i:0;w instanceof we?this.applyRotateTimeline(w,t,u,h,k,x,y<<1,b):w instanceof un?this.applyAttachmentTimeline(w,t,u,i,!0):(Y.webkit602BugfixHelper(h,i),w.apply(t,d,u,e,h,k,0))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}let s=this.unkeyedState+yt.SETUP,o=t.slots;for(let l=0,c=t.slots.length;l<c;l++){let a=o[l];if(a.attachmentState==s){let i=a.data.attachmentName;a.setAttachment(i==null?null:t.getAttachment(a.data.index,i))}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,n){let r=t.mixingFrom;r.mixingFrom!=null&&this.applyMixingFrom(r,e,n);let s=0;t.mixDuration==0?(s=1,n==1&&(n=0)):(s=t.mixTime/t.mixDuration,s>1&&(s=1),n!=1&&(n=r.mixBlend));let o=s<r.eventThreshold?this.events:null,l=s<r.attachmentThreshold,c=s<r.drawOrderThreshold,a=r.animationLast,i=r.getAnimationTime(),h=r.animation.timelines.length,d=r.animation.timelines,u=r.alpha*t.interruptAlpha,p=u*(1-s);if(n==3)for(let f=0;f<h;f++)d[f].apply(e,a,i,o,p,n,1);else{let f=r.timelineMode,g=r.timelineHoldMix,b=r.timelinesRotation.length==0;b&&Y.setArraySize(r.timelinesRotation,h<<1,null);let x=r.timelinesRotation;r.totalAlpha=0;for(let y=0;y<h;y++){let w=d[y],k=1,S,I=0;switch(f[y]){case yt.SUBSEQUENT:if(!c&&w instanceof En)continue;S=n,I=p;break;case yt.FIRST:S=0,I=p;break;case yt.HOLD_SUBSEQUENT:S=n,I=u;break;case yt.HOLD_FIRST:S=0,I=u;break;default:S=0;let M=g[y];I=u*Math.max(0,1-M.mixTime/M.mixDuration);break}r.totalAlpha+=I,w instanceof we?this.applyRotateTimeline(w,e,i,I,S,x,y<<1,b):w instanceof un?this.applyAttachmentTimeline(w,e,i,S,l):(Y.webkit602BugfixHelper(I,n),c&&w instanceof En&&S==0&&(k=0),w.apply(e,a,i,o,I,S,k))}}return t.mixDuration>0&&this.queueEvents(r,i),this.events.length=0,r.nextAnimationLast=i,r.nextTrackLast=r.trackTime,s}applyAttachmentTimeline(t,e,n,r,s){let o=e.slots[t.slotIndex];if(!o.bone.active)return;let l=t.frames;if(n<l[0])(r==0||r==1)&&this.setAttachment(e,o,o.data.attachmentName,s);else{let c;n>=l[l.length-1]?c=l.length-1:c=zt.binarySearch(l,n)-1,this.setAttachment(e,o,t.attachmentNames[c],s)}o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+yt.SETUP)}setAttachment(t,e,n,r){e.setAttachment(n==null?null:t.getAttachment(e.data.index,n)),r&&(e.attachmentState=this.unkeyedState+yt.CURRENT)}applyRotateTimeline(t,e,n,r,s,o,l,c){if(c&&(o[l]=0),r==1){t.apply(e,0,n,null,1,s,0);return}let a=t,i=a.frames,h=e.bones[a.boneIndex];if(!h.active)return;let d=0,u=0;if(n<i[0])switch(s){case 0:h.rotation=h.data.rotation;default:return;case 1:d=h.rotation,u=h.data.rotation}else if(d=s==0?h.data.rotation:h.rotation,n>=i[i.length-we.ENTRIES])u=h.data.rotation+i[i.length+we.PREV_ROTATION];else{let g=zt.binarySearch(i,n,we.ENTRIES),b=i[g+we.PREV_ROTATION],x=i[g],y=a.getCurvePercent((g>>1)-1,1-(n-x)/(i[g+we.PREV_TIME]-x));u=i[g+we.ROTATION]-b,u-=(16384-(16384.499999999996-u/360|0))*360,u=b+u*y+h.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let p=0,f=u-d;if(f-=(16384-(16384.499999999996-f/360|0))*360,f==0)p=o[l];else{let g=0,b=0;c?(g=0,b=f):(g=o[l],b=o[l+1]);let x=f>0,y=g>=0;B.signum(b)!=B.signum(f)&&Math.abs(b)<=90&&(Math.abs(g)>180&&(g+=360*B.signum(g)),y=x),p=f+g-g%360,y!=x&&(p+=360*B.signum(g)),o[l]=p}o[l+1]=f,d+=p*r,h.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(t,e){let n=t.animationStart,r=t.animationEnd,s=r-n,o=t.trackLast%s,l=this.events,c=0,a=l.length;for(;c<a;c++){let h=l[c];if(h.time<o)break;h.time>r||this.queue.event(t,h)}let i=!1;for(t.loop?i=s==0||o>t.trackTime%s:i=e>=r&&t.animationLast<r,i&&this.queue.complete(t);c<a;c++)l[c].time<n||this.queue.event(t,l[c])}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);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==null)return;this.queue.end(e),this.disposeNext(e);let n=e;for(;;){let r=n.mixingFrom;if(r==null)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){let r=this.expandToIndex(t);this.tracks[t]=e,r!=null&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom!=null&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n){let r=this.data.skeletonData.findAnimation(e);if(r==null)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,n)}setAnimationWith(t,e,n){if(e==null)throw new Error("animation cannot be null.");let r=!0,s=this.expandToIndex(t);s!=null&&(s.nextTrackLast==-1?(this.tracks[t]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.disposeNext(s),s=s.mixingFrom,r=!1):this.disposeNext(s));let o=this.trackEntry(t,e,n,s);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,e,n,r){let s=this.data.skeletonData.findAnimation(e);if(s==null)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,s,n,r)}addAnimationWith(t,e,n,r){if(e==null)throw new Error("animation cannot be null.");let s=this.expandToIndex(t);if(s!=null)for(;s.next!=null;)s=s.next;let o=this.trackEntry(t,e,n,s);if(s==null)this.setCurrent(t,o,!0),this.queue.drain();else if(s.next=o,r<=0){let l=s.animationEnd-s.animationStart;l!=0?(s.loop?r+=l*(1+(s.trackTime/l|0)):r+=Math.max(l,s.trackTime),r-=this.data.getMix(s.animation,e)):r=s.trackTime}return o.delay=r,o}setEmptyAnimation(t,e){let n=this.setAnimationWith(t,yt.emptyAnimation,!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e,n){n<=0&&(n-=e);let r=this.addAnimationWith(t,yt.emptyAnimation,!1,n);return r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,r=this.tracks.length;n<r;n++){let s=this.tracks[n];s!=null&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(Y.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,n,r){let s=this.trackEntryPool.obtain();return s.trackIndex=t,s.animation=e,s.loop=n,s.holdPrevious=!1,s.eventThreshold=0,s.attachmentThreshold=0,s.drawOrderThreshold=0,s.animationStart=0,s.animationEnd=e.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.interruptAlpha=1,s.mixTime=0,s.mixDuration=r==null?0:this.data.getMix(r.animation,e),s.mixBlend=2,s}disposeNext(t){let e=t.next;for(;e!=null;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let t=0,e=this.tracks.length;t<e;t++){let n=this.tracks[t];if(n!=null){for(;n.mixingFrom!=null;)n=n.mixingFrom;do(n.mixingFrom==null||n.mixBlend!=3)&&this.computeHold(n),n=n.mixingTo;while(n!=null)}}}computeHold(t){let e=t.mixingTo,n=t.animation.timelines,r=t.animation.timelines.length,s=Y.setArraySize(t.timelineMode,r);t.timelineHoldMix.length=0;let o=Y.setArraySize(t.timelineHoldMix,r),l=this.propertyIDs;if(e!=null&&e.holdPrevious){for(let c=0;c<r;c++)s[c]=l.add(n[c].getPropertyId())?yt.HOLD_FIRST:yt.HOLD_SUBSEQUENT;return}t:for(let c=0;c<r;c++){let a=n[c],i=a.getPropertyId();if(!l.add(i))s[c]=yt.SUBSEQUENT;else if(e==null||a instanceof un||a instanceof En||a instanceof br||!e.animation.hasTimeline(i))s[c]=yt.FIRST;else{for(let h=e.mixingTo;h!=null;h=h.mixingTo)if(!h.animation.hasTimeline(i)){if(t.mixDuration>0){s[c]=yt.HOLD_MIX,o[c]=h;continue t}break}s[c]=yt.HOLD_FIRST}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(t==null)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()}setAnimationByName(t,e,n){yt.deprecatedWarning1||(yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,r){yt.deprecatedWarning2||(yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,r)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return yt.deprecatedWarning3||(yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};m(yt,"emptyAnimation",new zt("<empty>",[],0)),m(yt,"SUBSEQUENT",0),m(yt,"FIRST",1),m(yt,"HOLD_SUBSEQUENT",2),m(yt,"HOLD_FIRST",3),m(yt,"HOLD_MIX",4),m(yt,"SETUP",1),m(yt,"CURRENT",2),m(yt,"deprecatedWarning1",!1),m(yt,"deprecatedWarning2",!1),m(yt,"deprecatedWarning3",!1);var pl=yt,fn=class fn{constructor(){m(this,"animation");m(this,"next");m(this,"mixingFrom");m(this,"mixingTo");m(this,"listener");m(this,"trackIndex");m(this,"loop");m(this,"holdPrevious");m(this,"eventThreshold");m(this,"attachmentThreshold");m(this,"drawOrderThreshold");m(this,"animationStart");m(this,"animationEnd");m(this,"animationLast");m(this,"nextAnimationLast");m(this,"delay");m(this,"trackTime");m(this,"trackLast");m(this,"nextTrackLast");m(this,"trackEnd");m(this,"timeScale");m(this,"alpha");m(this,"mixTime");m(this,"mixDuration");m(this,"interruptAlpha");m(this,"totalAlpha");m(this,"mixBlend",2);m(this,"timelineMode",new Array);m(this,"timelineHoldMix",new Array);m(this,"timelinesRotation",new Array);m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd")}reset(){this.next=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 t==0?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}get time(){return fn.deprecatedWarning1||(fn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){fn.deprecatedWarning1||(fn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return fn.deprecatedWarning2||(fn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){fn.deprecatedWarning2||(fn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};m(fn,"deprecatedWarning1",!1),m(fn,"deprecatedWarning2",!1);var Uc=fn,fl=class fl{constructor(t){m(this,"objects",[]);m(this,"drainDisabled",!1);m(this,"animState");this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return fl.deprecatedWarning1||(fl.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let n=0;n<t.length;n+=2){let r=t[n],s=t[n+1];switch(r){case 0:s.listener!=null&&s.listener.start&&s.listener.start(s);for(let c=0;c<e.length;c++)e[c].start&&e[c].start(s);s.onStart&&this.deprecateStuff()&&s.onStart(s.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(s.trackIndex);break;case 1:s.listener!=null&&s.listener.interrupt&&s.listener.interrupt(s);for(let c=0;c<e.length;c++)e[c].interrupt&&e[c].interrupt(s);break;case 2:s.listener!=null&&s.listener.end&&s.listener.end(s);for(let c=0;c<e.length;c++)e[c].end&&e[c].end(s);s.onEnd&&this.deprecateStuff()&&s.onEnd(s.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(s.trackIndex);case 3:s.listener!=null&&s.listener.dispose&&s.listener.dispose(s);for(let c=0;c<e.length;c++)e[c].dispose&&e[c].dispose(s);this.animState.trackEntryPool.free(s);break;case 4:s.listener!=null&&s.listener.complete&&s.listener.complete(s);for(let c=0;c<e.length;c++)e[c].complete&&e[c].complete(s);let o=B.toInt(s.loopsCount());s.onComplete&&this.deprecateStuff()&&s.onComplete(s.trackIndex,o),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(s.trackIndex,o);break;case 5:let l=t[n+++2];s.listener!=null&&s.listener.event&&s.listener.event(s,l);for(let c=0;c<e.length;c++)e[c].event&&e[c].event(s,l);s.onEvent&&this.deprecateStuff()&&s.onEvent(s.trackIndex,l),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(s.trackIndex,l);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};m(fl,"deprecatedWarning1",!1);var Wc=fl,md=(o=>(o[o.start=0]="start",o[o.interrupt=1]="interrupt",o[o.end=2]="end",o[o.dispose=3]="dispose",o[o.complete=4]="complete",o[o.event=5]="event",o))(md||{}),Gh=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}};var gl=class gl{constructor(t){m(this,"skeletonData");m(this,"animationToMixTime",{});m(this,"defaultMix",0);if(t==null)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){let r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);let s=this.skeletonData.findAnimation(e);if(s==null)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,s,n)}setMixByName(t,e,n){gl.deprecatedWarning1||(gl.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,n)}setMixWith(t,e,n){if(t==null)throw new Error("from cannot be null.");if(e==null)throw new Error("to cannot be null.");let r=`${t.name}.${e.name}`;this.animationToMixTime[r]=n}getMix(t,e){let n=`${t.name}.${e.name}`,r=this.animationToMixTime[n];return r===void 0?this.defaultMix:r}};m(gl,"deprecatedWarning1",!1);var bl=gl;var io=class{constructor(t){m(this,"atlas");this.atlas=t}newRegionAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);let s=new Bs(e);return s.region=r,s}newMeshAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);let s=new fr(e);return s.region=r,s}newBoundingBoxAttachment(t,e){return new ml(e)}newPathAttachment(t,e){return new $n(e)}newPointAttachment(t,e){return new ul(e)}newClippingAttachment(t,e){return new dl(e)}};var dd=ye(ge());var oo=class{constructor(t,e,n){m(this,"matrix",new dd.Matrix);m(this,"data");m(this,"skeleton");m(this,"parent");m(this,"children",new Array);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",0);m(this,"scaleY",0);m(this,"shearX",0);m(this,"shearY",0);m(this,"ax",0);m(this,"ay",0);m(this,"arotation",0);m(this,"ascaleX",0);m(this,"ascaleY",0);m(this,"ashearX",0);m(this,"ashearY",0);m(this,"appliedValid",!1);m(this,"sorted",!1);m(this,"active",!1);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=n,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,n,r,s,o,l){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=o,this.ashearY=l,this.appliedValid=!0;let c=this.parent,a=this.matrix,i=this.skeleton.scaleX,h=Dt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(c==null){let g=this.skeleton,b=n+90+l;a.a=B.cosDeg(n+o)*r*i,a.c=B.cosDeg(b)*s*i,a.b=B.sinDeg(n+o)*r*h,a.d=B.sinDeg(b)*s*h,a.tx=t*i+g.x,a.ty=e*h+g.y;return}let d=c.matrix.a,u=c.matrix.c,p=c.matrix.b,f=c.matrix.d;switch(a.tx=d*t+u*e+c.matrix.tx,a.ty=p*t+f*e+c.matrix.ty,this.data.transformMode){case 0:{let g=n+90+l,b=B.cosDeg(n+o)*r,x=B.cosDeg(g)*s,y=B.sinDeg(n+o)*r,w=B.sinDeg(g)*s;a.a=d*b+u*y,a.c=d*x+u*w,a.b=p*b+f*y,a.d=p*x+f*w;return}case 1:{let g=n+90+l;a.a=B.cosDeg(n+o)*r,a.c=B.cosDeg(g)*s,a.b=B.sinDeg(n+o)*r,a.d=B.sinDeg(g)*s;break}case 2:{let g=d*d+p*p,b=0;g>1e-4?(g=Math.abs(d*f-u*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,u=p*g,f=d*g,b=Math.atan2(p,d)*B.radDeg):(d=0,p=0,b=90-Math.atan2(f,u)*B.radDeg);let x=n+o-b,y=n+l-b+90,w=B.cosDeg(x)*r,k=B.cosDeg(y)*s,S=B.sinDeg(x)*r,I=B.sinDeg(y)*s;a.a=d*w-u*S,a.c=d*k-u*I,a.b=p*w+f*S,a.d=p*k+f*I;break}case 3:case 4:{let g=B.cosDeg(n),b=B.sinDeg(n),x=(d*g+u*b)/i,y=(p*g+f*b)/h,w=Math.sqrt(x*x+y*y);w>1e-5&&(w=1/w),x*=w,y*=w,w=Math.sqrt(x*x+y*y),this.data.transformMode==3&&d*f-u*p<0!=(Dt.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w);let k=Math.PI/2+Math.atan2(y,x),S=Math.cos(k)*w,I=Math.sin(k)*w,M=B.cosDeg(o)*r,v=B.cosDeg(90+l)*s,E=B.sinDeg(o)*r,C=B.sinDeg(90+l)*s;a.a=x*M+S*E,a.c=x*v+S*C,a.b=y*M+I*E,a.d=y*v+I*C;break}}a.a*=i,a.c*=i,a.b*=h,a.d*=h}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}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*B.radDeg}getWorldScaleX(){let t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){let t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;let t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*B.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*B.radDeg;return}let n=t.matrix,r=1/(n.a*n.d-n.b*n.c),s=e.tx-n.tx,o=e.ty-n.ty;this.ax=s*n.d*r-o*n.c*r,this.ay=o*n.a*r-s*n.b*r;let l=r*n.d,c=r*n.a,a=r*n.c,i=r*n.b,h=l*e.a-a*e.b,d=l*e.c-a*e.d,u=c*e.b-i*e.a,p=c*e.d-i*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(h*h+u*u),this.ascaleX>1e-4){let f=h*p-d*u;this.ascaleY=f/this.ascaleX,this.ashearY=Math.atan2(h*d+u*p,f)*B.radDeg,this.arotation=Math.atan2(u,h)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*B.radDeg}worldToLocal(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=1/(n*o-r*s),c=t.x-e.tx,a=t.y-e.ty;return t.x=c*o*l-a*r*l,t.y=a*n*l-c*s*l,t}localToWorld(t){let e=this.matrix,n=t.x,r=t.y;return t.x=n*e.a+r*e.c+e.tx,t.y=n*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*n,r.d*n-r.c*e)*B.radDeg}localToWorldRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(n*r.b+e*r.d,n*r.a+e*r.c)*B.radDeg}rotateWorld(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=B.cosDeg(t),c=B.sinDeg(t);e.a=l*n-c*s,e.c=l*r-c*o,e.b=c*n+l*s,e.d=c*r+l*o,this.appliedValid=!1}};var Ps=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"parent");m(this,"length");m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"shearX",0);m(this,"shearY",0);m(this,"transformMode",0);m(this,"skinRequired",!1);m(this,"color",new $);if(t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=n}};var Sr=class{constructor(t,e,n){this.name=t;this.order=e;this.skinRequired=n}};var Ys=class{constructor(t,e){m(this,"data");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"time");m(this,"volume");m(this,"balance");if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}};var Xs=class{constructor(t){m(this,"name");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"audioPath");m(this,"volume");m(this,"balance");this.name=t}};var xl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"bendDirection",0);m(this,"compress",!1);m(this,"stretch",!1);m(this,"mix",1);m(this,"softness",0);m(this,"active",!1);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){let t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,n,r,s,o,l){t.appliedValid||t.updateAppliedTransform();let c=t.parent.matrix,a=c.a,i=c.c,h=c.b,d=c.d,u=-t.ashearX-t.arotation,p=0,f=0;switch(t.data.transformMode){case 1:p=e-t.worldX,f=n-t.worldY;break;case 2:let x=Math.abs(a*d-i*h)/(a*a+h*h),y=a/t.skeleton.scaleX,w=h/t.skeleton.scaleY;i=-w*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,u+=Math.atan2(w,y)*B.radDeg;default:let k=e-c.tx,S=n-c.ty,I=a*d-i*h;p=(k*d-S*i)/I-t.ax,f=(S*a-k*h)/I-t.ay}u+=Math.atan2(f,p)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,b=t.ascaleY;if(r||s){switch(t.data.transformMode){case 3:case 4:p=e-t.worldX,f=n-t.worldY}let x=t.data.length*g,y=Math.sqrt(p*p+f*f);if(r&&y<x||s&&y>x&&x>1e-4){let w=(y/x-1)*l+1;g*=w,o&&(b*=w)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,g,b,t.ashearX,t.ashearY)}apply2(t,e,n,r,s,o,l,c){if(c==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();let a=t.ax,i=t.ay,h=t.ascaleX,d=h,u=t.ascaleY,p=e.ascaleX,f=t.matrix,g=0,b=0,x=0;h<0?(h=-h,g=180,x=-1):(g=0,x=1),u<0&&(u=-u,x=-x),p<0?(p=-p,b=180):b=0;let y=e.ax,w=0,k=0,S=0,I=f.a,M=f.c,v=f.b,E=f.d,C=Math.abs(h-u)<=1e-4;C?(w=e.ay,k=I*y+M*w+f.tx,S=v*y+E*w+f.ty):(w=0,k=I*y+f.tx,S=v*y+f.ty);let T=t.parent.matrix;I=T.a,M=T.c,v=T.b,E=T.d;let F=1/(I*E-M*v),D=k-T.tx,V=S-T.ty,X=(D*E-V*M)*F-a,N=(V*I-D*v)*F-i,q=Math.sqrt(X*X+N*N),L=e.data.length*p,R,P;if(q<1e-4){this.apply1(t,n,r,!1,o,!1,c),e.updateWorldTransformWith(y,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}D=n-T.tx,V=r-T.ty;let H=(D*E-V*M)*F-a,U=(V*I-D*v)*F-i,z=H*H+U*U;if(l!=0){l*=h*(p+1)/2;let K=Math.sqrt(z),it=K-q-L*h+l;if(it>0){let et=Math.min(1,it/(l*2))-1;et=(it-l*(1-et*et))/K,H-=et*H,U-=et*U,z=H*H+U*U}}t:if(C){L*=h;let K=(z-q*q-L*L)/(2*q*L);K<-1?K=-1:K>1&&(K=1,o&&(d*=(Math.sqrt(z)/(q+L)-1)*c+1)),P=Math.acos(K)*s,I=q+L*K,M=L*Math.sin(P),R=Math.atan2(U*I-H*M,H*I+U*M)}else{I=h*L,M=u*L;let K=I*I,it=M*M,et=Math.atan2(U,H);v=it*q*q+K*z-K*it;let st=-2*it*q,dt=it-K;if(E=st*st-4*dt*v,E>=0){let Kt=Math.sqrt(E);st<0&&(Kt=-Kt),Kt=-(st+Kt)/2;let ke=Kt/dt,Jt=v/Kt,on=Math.abs(ke)<Math.abs(Jt)?ke:Jt;if(on*on<=z){V=Math.sqrt(z-on*on)*s,R=et-Math.atan2(V,on),P=Math.atan2(V/u,(on-q)/h);break t}}let Mt=B.PI,Bt=q-I,jt=Bt*Bt,Rt=0,Xt=0,Wt=q+I,Zt=Wt*Wt,Lt=0;v=-I*q/(K-it),v>=-1&&v<=1&&(v=Math.acos(v),D=I*Math.cos(v)+q,V=M*Math.sin(v),E=D*D+V*V,E<jt&&(Mt=v,jt=E,Bt=D,Rt=V),E>Zt&&(Xt=v,Zt=E,Wt=D,Lt=V)),z<=(jt+Zt)/2?(R=et-Math.atan2(Rt*s,Bt),P=Mt*s):(R=et-Math.atan2(Lt*s,Wt),P=Xt*s)}let O=Math.atan2(w,y)*x,Z=t.arotation;R=(R-O)*B.radDeg+g-Z,R>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(a,i,Z+R*c,d,t.ascaleY,0,0),Z=e.arotation,P=((P+O)*B.radDeg-e.ashearX)*x+b-Z,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(y,w,Z+P*c,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};var Ls=class extends Sr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"bendDirection",1);m(this,"compress",!1);m(this,"stretch",!1);m(this,"uniform",!1);m(this,"mix",1);m(this,"softness",0)}};var Ns=class extends Sr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"positionMode");m(this,"spacingMode");m(this,"rotateMode");m(this,"offsetRotation");m(this,"position");m(this,"spacing");m(this,"rotateMix");m(this,"translateMix")}},yl=(n=>(n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n))(yl||{});var pn=class pn{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"position",0);m(this,"spacing",0);m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"spaces",new Array);m(this,"positions",new Array);m(this,"world",new Array);m(this,"curves",new Array);m(this,"lengths",new Array);m(this,"segments",new Array);m(this,"active",!1);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}isActive(){return this.active}apply(){this.update()}update(){let t=this.target.getAttachment();if(!(t instanceof $n))return;let e=this.rotateMix,n=this.translateMix,r=n>0,s=e>0;if(!r&&!s)return;let o=this.data,l=o.spacingMode,c=l==0,a=o.rotateMode,i=a==0,h=a==2,d=this.bones.length,u=i?d:d+1,p=this.bones,f=Y.setArraySize(this.spaces,u),g=null,b=this.spacing;if(h||c){h&&(g=Y.setArraySize(this.lengths,d));for(let I=0,M=u-1;I<M;){let v=p[I],E=v.data.length;if(E<pn.epsilon)h&&(g[I]=0),f[++I]=0;else{let C=E*v.matrix.a,T=E*v.matrix.b,F=Math.sqrt(C*C+T*T);h&&(g[I]=F),f[++I]=(c?E+b:b)*F/E}}}else for(let I=1;I<u;I++)f[I]=b;let x=this.computeWorldPositions(t,u,i,o.positionMode==1,l==2),y=x[0],w=x[1],k=o.offsetRotation,S=!1;if(k==0)S=a==1;else{S=!1;let I=this.target.bone.matrix;k*=I.a*I.d-I.b*I.c>0?B.degRad:-B.degRad}for(let I=0,M=3;I<d;I++,M+=3){let v=p[I],E=v.matrix;E.tx+=(y-E.tx)*n,E.ty+=(w-E.ty)*n;let C=x[M],T=x[M+1],F=C-y,D=T-w;if(h){let V=g[I];if(V!=0){let X=(Math.sqrt(F*F+D*D)/V-1)*e+1;E.a*=X,E.b*=X}}if(y=C,w=T,s){let V=E.a,X=E.c,N=E.b,q=E.d,L=0,R=0,P=0;if(i?L=x[M-1]:f[I+1]==0?L=x[M+2]:L=Math.atan2(D,F),L-=Math.atan2(N,V),S){R=Math.cos(L),P=Math.sin(L);let H=v.data.length;y+=(H*(R*V-P*N)-F)*e,w+=(H*(P*V+R*N)-D)*e}else L+=k;L>B.PI?L-=B.PI2:L<-B.PI&&(L+=B.PI2),L*=e,R=Math.cos(L),P=Math.sin(L),E.a=R*V-P*N,E.c=R*X-P*q,E.b=P*V+R*N,E.d=P*X+R*q}v.appliedValid=!1}}computeWorldPositions(t,e,n,r,s){let o=this.target,l=this.position,c=this.spaces,a=Y.setArraySize(this.positions,e*3+2),i=null,h=t.closed,d=t.worldVerticesLength,u=d/6,p=pn.NONE;if(!t.constantSpeed){let L=t.lengths;u-=h?1:2;let R=L[u];if(r&&(l*=R),s)for(let P=0;P<e;P++)c[P]*=R;i=Y.setArraySize(this.world,8);for(let P=0,H=0,U=0;P<e;P++,H+=3){let z=c[P];l+=z;let O=l;if(h)O%=R,O<0&&(O+=R),U=0;else if(O<0){p!=pn.BEFORE&&(p=pn.BEFORE,t.computeWorldVertices(o,2,4,i,0,2)),this.addBeforePosition(O,i,0,a,H);continue}else if(O>R){p!=pn.AFTER&&(p=pn.AFTER,t.computeWorldVertices(o,d-6,4,i,0,2)),this.addAfterPosition(O-R,i,0,a,H);continue}for(;;U++){let Z=L[U];if(!(O>Z)){if(U==0)O/=Z;else{let K=L[U-1];O=(O-K)/(Z-K)}break}}U!=p&&(p=U,h&&U==u?(t.computeWorldVertices(o,d-4,4,i,0,2),t.computeWorldVertices(o,0,4,i,4,2)):t.computeWorldVertices(o,U*6+2,8,i,0,2)),this.addCurvePosition(O,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],a,H,n||P>0&&z==0)}return a}h?(d+=2,i=Y.setArraySize(this.world,d),t.computeWorldVertices(o,2,d-4,i,0,2),t.computeWorldVertices(o,0,2,i,d-4,2),i[d-2]=i[0],i[d-1]=i[1]):(u--,d-=4,i=Y.setArraySize(this.world,d),t.computeWorldVertices(o,2,d,i,0,2));let f=Y.setArraySize(this.curves,u),g=0,b=i[0],x=i[1],y=0,w=0,k=0,S=0,I=0,M=0,v=0,E=0,C=0,T=0,F=0,D=0,V=0,X=0;for(let L=0,R=2;L<u;L++,R+=6)y=i[R],w=i[R+1],k=i[R+2],S=i[R+3],I=i[R+4],M=i[R+5],v=(b-y*2+k)*.1875,E=(x-w*2+S)*.1875,C=((y-k)*3-b+I)*.09375,T=((w-S)*3-x+M)*.09375,F=v*2+C,D=E*2+T,V=(y-b)*.75+v+C*.16666667,X=(w-x)*.75+E+T*.16666667,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,F+=C,D+=T,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,g+=Math.sqrt(V*V+X*X),V+=F+C,X+=D+T,g+=Math.sqrt(V*V+X*X),f[L]=g,b=I,x=M;if(r&&(l*=g),s)for(let L=0;L<e;L++)c[L]*=g;let N=this.segments,q=0;for(let L=0,R=0,P=0,H=0;L<e;L++,R+=3){let U=c[L];l+=U;let z=l;if(h)z%=g,z<0&&(z+=g),P=0;else if(z<0){this.addBeforePosition(z,i,0,a,R);continue}else if(z>g){this.addAfterPosition(z-g,i,d-4,a,R);continue}for(;;P++){let O=f[P];if(!(z>O)){if(P==0)z/=O;else{let Z=f[P-1];z=(z-Z)/(O-Z)}break}}if(P!=p){p=P;let O=P*6;for(b=i[O],x=i[O+1],y=i[O+2],w=i[O+3],k=i[O+4],S=i[O+5],I=i[O+6],M=i[O+7],v=(b-y*2+k)*.03,E=(x-w*2+S)*.03,C=((y-k)*3-b+I)*.006,T=((w-S)*3-x+M)*.006,F=v*2+C,D=E*2+T,V=(y-b)*.3+v+C*.16666667,X=(w-x)*.3+E+T*.16666667,q=Math.sqrt(V*V+X*X),N[0]=q,O=1;O<8;O++)V+=F,X+=D,F+=C,D+=T,q+=Math.sqrt(V*V+X*X),N[O]=q;V+=F,X+=D,q+=Math.sqrt(V*V+X*X),N[8]=q,V+=F+C,X+=D+T,q+=Math.sqrt(V*V+X*X),N[9]=q,H=0}for(z*=q;;H++){let O=N[H];if(!(z>O)){if(H==0)z/=O;else{let Z=N[H-1];z=H+(z-Z)/(O-Z)}break}}this.addCurvePosition(z*.1,b,x,y,w,k,S,I,M,a,R,n||L>0&&U==0)}return a}addBeforePosition(t,e,n,r,s){let o=e[n],l=e[n+1],c=e[n+2]-o,a=e[n+3]-l,i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addAfterPosition(t,e,n,r,s){let o=e[n+2],l=e[n+3],c=o-e[n],a=l-e[n+1],i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addCurvePosition(t,e,n,r,s,o,l,c,a,i,h,d){(t==0||isNaN(t))&&(t=1e-4);let u=t*t,p=u*t,f=1-t,g=f*f,b=g*f,x=f*t,y=x*3,w=f*y,k=y*t,S=e*b+r*w+o*k+c*p,I=n*b+s*w+l*k+a*p;i[h]=S,i[h+1]=I,d&&(i[h+2]=Math.atan2(I-(n*g+s*x*2+l*u),S-(e*g+r*x*2+o*u)))}};m(pn,"NONE",-1),m(pn,"BEFORE",-2),m(pn,"AFTER",-3),m(pn,"epsilon",1e-5);var wl=pn;var Sl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"scaleMix",0);m(this,"shearMix",0);m(this,"temp",new Ae);m(this,"active",!1);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,o=s.matrix,l=o.a,c=o.c,a=o.b,i=o.d,h=l*i-c*a>0?B.degRad:-B.degRad,d=this.data.offsetRotation*h,u=this.data.offsetShearY*h,p=this.bones;for(let f=0,g=p.length;f<g;f++){let b=p[f],x=!1,y=b.matrix;if(t!=0){let w=y.a,k=y.c,S=y.b,I=y.d,M=Math.atan2(a,l)-Math.atan2(S,w)+d;M>B.PI?M-=B.PI2:M<-B.PI&&(M+=B.PI2),M*=t;let v=Math.cos(M),E=Math.sin(M);y.a=v*w-E*S,y.c=v*k-E*I,y.b=E*w+v*S,y.d=E*k+v*I,x=!0}if(e!=0){let w=this.temp;s.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.tx+=(w.x-y.tx)*e,y.ty+=(w.y-y.ty)*e,x=!0}if(n>0){let w=Math.sqrt(y.a*y.a+y.b*y.b),k=Math.sqrt(l*l+a*a);w>1e-5&&(w=(w+(k-w+this.data.offsetScaleX)*n)/w),y.a*=w,y.b*=w,w=Math.sqrt(y.c*y.c+y.d*y.d),k=Math.sqrt(c*c+i*i),w>1e-5&&(w=(w+(k-w+this.data.offsetScaleY)*n)/w),y.c*=w,y.d*=w,x=!0}if(r>0){let w=y.c,k=y.d,S=Math.atan2(k,w),I=Math.atan2(i,c)-Math.atan2(a,l)-(S-Math.atan2(y.b,y.a));I>B.PI?I-=B.PI2:I<-B.PI&&(I+=B.PI2),I=S+(I+u)*r;let M=Math.sqrt(w*w+k*k);y.c=Math.cos(I)*M,y.d=Math.sin(I)*M,x=!0}x&&(b.appliedValid=!1)}}applyRelativeWorld(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,o=s.matrix,l=o.a,c=o.c,a=o.b,i=o.d,h=l*i-c*a>0?B.degRad:-B.degRad,d=this.data.offsetRotation*h,u=this.data.offsetShearY*h,p=this.bones;for(let f=0,g=p.length;f<g;f++){let b=p[f],x=!1,y=b.matrix;if(t!=0){let w=y.a,k=y.c,S=y.b,I=y.d,M=Math.atan2(a,l)+d;M>B.PI?M-=B.PI2:M<-B.PI&&(M+=B.PI2),M*=t;let v=Math.cos(M),E=Math.sin(M);y.a=v*w-E*S,y.c=v*k-E*I,y.b=E*w+v*S,y.d=E*k+v*I,x=!0}if(e!=0){let w=this.temp;s.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.tx+=w.x*e,y.ty+=w.y*e,x=!0}if(n>0){let w=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*n+1;y.a*=w,y.b*=w,w=(Math.sqrt(c*c+i*i)-1+this.data.offsetScaleY)*n+1,y.c*=w,y.d*=w,x=!0}if(r>0){let w=Math.atan2(i,c)-Math.atan2(a,l);w>B.PI?w-=B.PI2:w<-B.PI&&(w+=B.PI2);let k=y.c,S=y.d;w=Math.atan2(S,k)+(w-B.PI/2+u)*r;let I=Math.sqrt(k*k+S*S);y.c=Math.cos(w)*I,y.d=Math.sin(w)*I,x=!0}x&&(b.appliedValid=!1)}}applyAbsoluteLocal(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target;s.appliedValid||s.updateAppliedTransform();let o=this.bones;for(let l=0,c=o.length;l<c;l++){let a=o[l];a.appliedValid||a.updateAppliedTransform();let i=a.arotation;if(t!=0){let g=s.arotation-i+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,i+=g*t}let h=a.ax,d=a.ay;e!=0&&(h+=(s.ax-h+this.data.offsetX)*e,d+=(s.ay-d+this.data.offsetY)*e);let u=a.ascaleX,p=a.ascaleY;n>0&&(u>1e-5&&(u=(u+(s.ascaleX-u+this.data.offsetScaleX)*n)/u),p>1e-5&&(p=(p+(s.ascaleY-p+this.data.offsetScaleY)*n)/p));let f=a.ashearY;if(r>0){let g=s.ashearY-f+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,a.shearY+=g*r}a.updateWorldTransformWith(h,d,i,u,p,a.ashearX,f)}}applyRelativeLocal(){let t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target;s.appliedValid||s.updateAppliedTransform();let o=this.bones;for(let l=0,c=o.length;l<c;l++){let a=o[l];a.appliedValid||a.updateAppliedTransform();let i=a.arotation;t!=0&&(i+=(s.arotation+this.data.offsetRotation)*t);let h=a.ax,d=a.ay;e!=0&&(h+=(s.ax+this.data.offsetX)*e,d+=(s.ay+this.data.offsetY)*e);let u=a.ascaleX,p=a.ascaleY;n>0&&(u>1e-5&&(u*=(s.ascaleX-1+this.data.offsetScaleX)*n+1),p>1e-5&&(p*=(s.ascaleY-1+this.data.offsetScaleY)*n+1));let f=a.ashearY;r>0&&(f+=(s.ashearY+this.data.offsetShearY)*r),a.updateWorldTransformWith(h,d,i,u,p,a.ashearX,f)}}};var Os=class Os{constructor(t){m(this,"data");m(this,"bones");m(this,"slots");m(this,"drawOrder");m(this,"ikConstraints");m(this,"transformConstraints");m(this,"pathConstraints");m(this,"_updateCache",new Array);m(this,"updateCacheReset",new Array);m(this,"skin");m(this,"color");m(this,"time",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"x",0);m(this,"y",0);if(t==null)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let n=t.bones[e],r;if(n.parent==null)r=new oo(n,this,null);else{let s=this.bones[n.parent.index];r=new oo(n,this,s),s.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let n=t.slots[e],r=this.bones[n.boneData.index],s=new Ts(n,r);this.slots.push(s),this.drawOrder.push(s)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let n=t.ikConstraints[e];this.ikConstraints.push(new xl(n,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let n=t.transformConstraints[e];this.transformConstraints.push(new Sl(n,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let n=t.pathConstraints[e];this.pathConstraints.push(new wl(n,this))}this.color=new $(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0,this.updateCacheReset.length=0;let e=this.bones;for(let i=0,h=e.length;i<h;i++){let d=e[i];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin!=null){let i=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let u=this.bones[i[h].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u!=null)}}let n=this.ikConstraints,r=this.transformConstraints,s=this.pathConstraints,o=n.length,l=r.length,c=s.length,a=o+l+c;t:for(let i=0;i<a;i++){for(let h=0;h<o;h++){let d=n[h];if(d.data.order==i){this.sortIkConstraint(d);continue t}}for(let h=0;h<l;h++){let d=r[h];if(d.data.order==i){this.sortTransformConstraint(d);continue t}}for(let h=0;h<c;h++){let d=s[h];if(d.data.order==i){this.sortPathConstraint(d);continue t}}}for(let i=0,h=e.length;i<h;i++)this.sortBone(e[i])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin!=null&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let n=t.bones,r=n[0];if(this.sortBone(r),n.length>1){let s=n[n.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin!=null&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,n=e.data.index,r=e.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,n,r),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(let c=0,a=this.data.skins.length;c<a;c++)this.sortPathConstraintAttachment(this.data.skins[c],n,r);let s=e.getAttachment();s instanceof $n&&this.sortPathConstraintAttachmentWith(s,r);let o=t.bones,l=o.length;for(let c=0;c<l;c++)this.sortBone(o[c]);this._updateCache.push(t);for(let c=0;c<l;c++)this.sortReset(o[c].children);for(let c=0;c<l;c++)o[c].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin!=null&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,n=e.length;if(t.data.local)for(let r=0;r<n;r++){let s=e[r];this.sortBone(s.parent),this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}else for(let r=0;r<n;r++)this.sortBone(e[r]);this._updateCache.push(t);for(let r=0;r<n;r++)this.sortReset(e[r].children);for(let r=0;r<n;r++)e[r].sorted=!0}sortPathConstraintAttachment(t,e,n){let r=t.attachments[e];if(r)for(let s in r)this.sortPathConstraintAttachmentWith(r[s],n)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof $n))return;let n=t.bones;if(n==null)this.sortBone(e);else{let r=this.bones,s=0;for(;s<n.length;){let o=n[s++];for(let l=s+o;s<l;s++){let c=n[s];this.sortBone(r[c])}}}}sortBone(t){if(t.sorted)return;let e=t.parent;e!=null&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,n=t.length;e<n;e++){let r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(){let t=this.updateCacheReset;for(let n=0,r=t.length;n<r;n++){let s=t[n];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,s.appliedValid=!0}let e=this._updateCache;for(let n=0,r=e.length;n<r;n++)e[n].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let t=this.bones;for(let s=0,o=t.length;s<o;s++)t[s].setToSetupPose();let e=this.ikConstraints;for(let s=0,o=e.length;s<o;s++){let l=e[s];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let n=this.transformConstraints;for(let s=0,o=n.length;s<o;s++){let l=n[s],c=l.data;l.rotateMix=c.rotateMix,l.translateMix=c.translateMix,l.scaleMix=c.scaleMix,l.shearMix=c.shearMix}let r=this.pathConstraints;for(let s=0,o=r.length;s<o;s++){let l=r[s],c=l.data;l.position=c.position,l.spacing=c.spacing,l.rotateMix=c.rotateMix,l.translateMix=c.translateMix}}setSlotsToSetupPose(){let t=this.slots;Y.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,n=t.length;e<n;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}setSkinByName(t){let e=this.data.findSkin(t);if(e==null)throw new Error(`Skin not found: ${t}`);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t!=null)if(this.skin!=null)t.attachAll(this,this.skin);else{let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n],o=s.data.attachmentName;if(o!=null){let l=t.getAttachment(n,o);l!=null&&s.setAttachment(l)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)}getAttachment(t,e){if(e==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){let n=this.skin.getAttachment(t,e);if(n!=null)return n}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(t==null)throw new Error("slotName cannot be null.");let n=this.slots;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(o.data.name==t){let l=null;if(e!=null&&(l=this.getAttachment(r,e),l==null))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);o.setAttachment(l);return}}throw new Error(`Slot not found: ${t}`)}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}getBounds(t,e,n=new Array(2)){if(t==null)throw new Error("offset cannot be null.");if(e==null)throw new Error("size cannot be null.");let r=this.drawOrder,s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let a=0,i=r.length;a<i;a++){let h=r[a];if(!h.bone.active)continue;let d=0,u=null,p=h.getAttachment();if(p instanceof Bs)d=8,u=Y.setArraySize(n,d,0),p.computeWorldVertices(h.bone,u,0,2);else if(p instanceof fr){let f=p;d=f.worldVerticesLength,u=Y.setArraySize(n,d,0),f.computeWorldVertices(h,0,d,u,0,2)}if(u!=null)for(let f=0,g=u.length;f<g;f+=2){let b=u[f],x=u[f+1];s=Math.min(s,b),o=Math.min(o,x),l=Math.max(l,b),c=Math.max(c,x)}}t.set(s,o),e.set(l-s,c-o)}update(t){this.time+=t}get flipX(){return this.scaleX==-1}set flipX(t){Os.deprecatedWarning1||(Os.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=t?1:-1}get flipY(){return this.scaleY==-1}set flipY(t){Os.deprecatedWarning1||(Os.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=t?1:-1}};m(Os,"deprecatedWarning1",!1);var Al=Os;var Us=class{constructor(){m(this,"name");m(this,"bones",new Array);m(this,"slots",new Array);m(this,"skins",new Array);m(this,"defaultSkin");m(this,"events",new Array);m(this,"animations",new Array);m(this,"ikConstraints",new Array);m(this,"transformConstraints",new Array);m(this,"pathConstraints",new Array);m(this,"x");m(this,"y");m(this,"width");m(this,"height");m(this,"version");m(this,"hash");m(this,"fps",0);m(this,"imagesPath");m(this,"audioPath")}findBone(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");let e=this.skins;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");let e=this.events;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");let e=this.animations;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}};var Ws=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"boneData");m(this,"color",new $(1,1,1,1));m(this,"darkColor");m(this,"attachmentName");m(this,"blendMode");if(t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(n==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}};var qs=class extends Sr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"rotateMix",0);m(this,"translateMix",0);m(this,"scaleMix",0);m(this,"shearMix",0);m(this,"offsetRotation",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"offsetScaleX",0);m(this,"offsetScaleY",0);m(this,"offsetShearY",0);m(this,"relative",!1);m(this,"local",!1)}};var kl=class{constructor(t,e,n){this.slotIndex=t;this.name=e;this.attachment=n}},Qr=class{constructor(t){m(this,"name");m(this,"attachments",new Array);m(this,"bones",Array());m(this,"constraints",new Array);if(t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,n){if(n==null)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]=n}addSkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];r.attachment!=null&&(r.attachment instanceof fr?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){let n=this.attachments[t];return n?n[e]:null}removeAttachment(t,e){let n=this.attachments[t];n&&(n[e]=null)}getAttachments(){let t=new Array;for(let e=0;e<this.attachments.length;e++){let n=this.attachments[e];if(n)for(let r in n){let s=n[r];s&&t.push(new kl(e,r,s))}}return t}getAttachmentsForSlot(t,e){let n=this.attachments[t];if(n)for(let r in n){let s=n[r];s&&e.push(new kl(t,r,s))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let n=0;for(let r=0;r<t.slots.length;r++){let s=t.slots[r],o=s.getAttachment();if(o&&n<e.attachments.length){let l=e.attachments[n];for(let c in l){let a=l[c];if(o==a){let i=this.getAttachment(n,c);i!=null&&s.setAttachment(i);break}}}n++}}};var ut=class ut{constructor(t){m(this,"attachmentLoader");m(this,"scale",1);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Us;n.name="";let r=new ln(t);n.hash=r.readString(),n.version=r.readString(),n.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat();let s=r.readBoolean();s&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());let o=0;o=r.readInt(!0);for(let c=0;c<o;c++)r.strings.push(r.readString());o=r.readInt(!0);for(let c=0;c<o;c++){let a=r.readString(),i=c==0?null:n.bones[r.readInt(!0)],h=new Ps(c,a,i);h.rotation=r.readFloat(),h.x=r.readFloat()*e,h.y=r.readFloat()*e,h.scaleX=r.readFloat(),h.scaleY=r.readFloat(),h.shearX=r.readFloat(),h.shearY=r.readFloat(),h.length=r.readFloat()*e,h.transformMode=ut.TransformModeValues[r.readInt(!0)],h.skinRequired=r.readBoolean(),s&&$.rgba8888ToColor(h.color,r.readInt32()),n.bones.push(h)}o=r.readInt(!0);for(let c=0;c<o;c++){let a=r.readString(),i=n.bones[r.readInt(!0)],h=new Ws(c,a,i);$.rgba8888ToColor(h.color,r.readInt32());let d=r.readInt32();d!=-1&&$.rgb888ToColor(h.darkColor=new $,d),h.attachmentName=r.readStringRef(),h.blendMode=ut.BlendModeValues[r.readInt(!0)],n.slots.push(h)}o=r.readInt(!0);for(let c=0,a;c<o;c++){let i=new Ls(r.readString());i.order=r.readInt(!0),i.skinRequired=r.readBoolean(),a=r.readInt(!0);for(let h=0;h<a;h++)i.bones.push(n.bones[r.readInt(!0)]);i.target=n.bones[r.readInt(!0)],i.mix=r.readFloat(),i.softness=r.readFloat()*e,i.bendDirection=r.readByte(),i.compress=r.readBoolean(),i.stretch=r.readBoolean(),i.uniform=r.readBoolean(),n.ikConstraints.push(i)}o=r.readInt(!0);for(let c=0,a;c<o;c++){let i=new qs(r.readString());i.order=r.readInt(!0),i.skinRequired=r.readBoolean(),a=r.readInt(!0);for(let h=0;h<a;h++)i.bones.push(n.bones[r.readInt(!0)]);i.target=n.bones[r.readInt(!0)],i.local=r.readBoolean(),i.relative=r.readBoolean(),i.offsetRotation=r.readFloat(),i.offsetX=r.readFloat()*e,i.offsetY=r.readFloat()*e,i.offsetScaleX=r.readFloat(),i.offsetScaleY=r.readFloat(),i.offsetShearY=r.readFloat(),i.rotateMix=r.readFloat(),i.translateMix=r.readFloat(),i.scaleMix=r.readFloat(),i.shearMix=r.readFloat(),n.transformConstraints.push(i)}o=r.readInt(!0);for(let c=0,a;c<o;c++){let i=new Ns(r.readString());i.order=r.readInt(!0),i.skinRequired=r.readBoolean(),a=r.readInt(!0);for(let h=0;h<a;h++)i.bones.push(n.bones[r.readInt(!0)]);i.target=n.slots[r.readInt(!0)],i.positionMode=ut.PositionModeValues[r.readInt(!0)],i.spacingMode=ut.SpacingModeValues[r.readInt(!0)],i.rotateMode=ut.RotateModeValues[r.readInt(!0)],i.offsetRotation=r.readFloat(),i.position=r.readFloat(),i.positionMode==0&&(i.position*=e),i.spacing=r.readFloat(),(i.spacingMode==0||i.spacingMode==1)&&(i.spacing*=e),i.rotateMix=r.readFloat(),i.translateMix=r.readFloat(),n.pathConstraints.push(i)}let l=this.readSkin(r,n,!0,s);l!=null&&(n.defaultSkin=l,n.skins.push(l));{let c=n.skins.length;for(Y.setArraySize(n.skins,o=c+r.readInt(!0));c<o;c++)n.skins[c]=this.readSkin(r,n,!1,s)}o=this.linkedMeshes.length;for(let c=0;c<o;c++){let a=this.linkedMeshes[c],i=a.skin==null?n.defaultSkin:n.findSkin(a.skin);if(i==null)throw new Error(`Skin not found: ${a.skin}`);let h=i.getAttachment(a.slotIndex,a.parent);if(h==null)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.deformAttachment=a.inheritDeform?h:a.mesh,a.mesh.setParentMesh(h)}this.linkedMeshes.length=0,o=r.readInt(!0);for(let c=0;c<o;c++){let a=new Xs(r.readStringRef());a.intValue=r.readInt(!1),a.floatValue=r.readFloat(),a.stringValue=r.readString(),a.audioPath=r.readString(),a.audioPath!=null&&(a.volume=r.readFloat(),a.balance=r.readFloat()),n.events.push(a)}o=r.readInt(!0);for(let c=0;c<o;c++)n.animations.push(this.readAnimation(r,r.readString(),n));return n}readSkin(t,e,n,r){let s=null,o=0;if(n){if(o=t.readInt(!0),o==0)return null;s=new Qr("default")}else{s=new Qr(t.readStringRef()),s.bones.length=t.readInt(!0);for(let l=0,c=s.bones.length;l<c;l++)s.bones[l]=e.bones[t.readInt(!0)];for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.pathConstraints[t.readInt(!0)]);o=t.readInt(!0)}for(let l=0;l<o;l++){let c=t.readInt(!0);for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readStringRef(),d=this.readAttachment(t,e,s,c,h,r);d!=null&&s.setAttachment(c,h,d)}}return s}readAttachment(t,e,n,r,s,o){let l=this.scale,c=t.readStringRef();c==null&&(c=s);let a=t.readByte();switch(ut.AttachmentTypeValues[a]){case 0:{let h=t.readStringRef(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),f=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readInt32();h==null&&(h=c);let w=this.attachmentLoader.newRegionAttachment(n,c,h);return w==null?null:(w.path=h,w.x=u*l,w.y=p*l,w.scaleX=f,w.scaleY=g,w.rotation=d,w.width=b*l,w.height=x*l,$.rgba8888ToColor(w.color,y),w)}case 1:{let h=t.readInt(!0),d=this.readVertices(t,h),u=o?t.readInt32():0,p=this.attachmentLoader.newBoundingBoxAttachment(n,c);return p==null?null:(p.worldVerticesLength=h<<1,p.vertices=d.vertices,p.bones=d.bones,o&&$.rgba8888ToColor(p.color,u),p)}case 2:{let h=t.readStringRef(),d=t.readInt32(),u=t.readInt(!0),p=this.readFloatArray(t,u<<1,1),f=this.readShortArray(t),g=this.readVertices(t,u),b=t.readInt(!0),x=null,y=0,w=0;o&&(x=this.readShortArray(t),y=t.readFloat(),w=t.readFloat()),h==null&&(h=c);let k=this.attachmentLoader.newMeshAttachment(n,c,h);return k==null?null:(k.path=h,$.rgba8888ToColor(k.color,d),k.bones=g.bones,k.vertices=g.vertices,k.worldVerticesLength=u<<1,k.triangles=f,k.regionUVs=new Float32Array(p),k.hullLength=b<<1,o&&(k.edges=x,k.width=y*l,k.height=w*l),k)}case 3:{let h=t.readStringRef(),d=t.readInt32(),u=t.readStringRef(),p=t.readStringRef(),f=t.readBoolean(),g=0,b=0;o&&(g=t.readFloat(),b=t.readFloat()),h==null&&(h=c);let x=this.attachmentLoader.newMeshAttachment(n,c,h);return x==null?null:(x.path=h,$.rgba8888ToColor(x.color,d),o&&(x.width=g*l,x.height=b*l),this.linkedMeshes.push(new jh(x,u,r,p,f)),x)}case 4:{let h=t.readBoolean(),d=t.readBoolean(),u=t.readInt(!0),p=this.readVertices(t,u),f=Y.newArray(u/3,0);for(let x=0,y=f.length;x<y;x++)f[x]=t.readFloat()*l;let g=o?t.readInt32():0,b=this.attachmentLoader.newPathAttachment(n,c);return b==null?null:(b.closed=h,b.constantSpeed=d,b.worldVerticesLength=u<<1,b.vertices=p.vertices,b.bones=p.bones,b.lengths=f,o&&$.rgba8888ToColor(b.color,g),b)}case 5:{let h=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=o?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(n,c);return f==null?null:(f.x=d*l,f.y=u*l,f.rotation=h,o&&$.rgba8888ToColor(f.color,p),f)}case 6:{let h=t.readInt(!0),d=t.readInt(!0),u=this.readVertices(t,d),p=o?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(n,c);return f==null?null:(f.endSlot=e.slots[h],f.worldVerticesLength=d<<1,f.vertices=u.vertices,f.bones=u.bones,o&&$.rgba8888ToColor(f.color,p),f)}}return null}readVertices(t,e){let n=e<<1,r=new Zh,s=this.scale;if(!t.readBoolean())return r.vertices=this.readFloatArray(t,n,s),r;let o=new Array,l=new Array;for(let c=0;c<e;c++){let a=t.readInt(!0);l.push(a);for(let i=0;i<a;i++)l.push(t.readInt(!0)),o.push(t.readFloat()*s),o.push(t.readFloat()*s),o.push(t.readFloat())}return r.vertices=Y.toFloatArray(o),r.bones=l,r}readFloatArray(t,e,n){let r=new Array(e);if(n==1)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let s=0;s<e;s++)r[s]=t.readFloat()*n;return r}readShortArray(t){let e=t.readInt(!0),n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readShort();return n}readAnimation(t,e,n){let r=new Array,s=this.scale,o=0,l=new $,c=new $;for(let h=0,d=t.readInt(!0);h<d;h++){let u=t.readInt(!0);for(let p=0,f=t.readInt(!0);p<f;p++){let g=t.readByte(),b=t.readInt(!0);switch(g){case ut.SLOT_ATTACHMENT:{let x=new un(b);x.slotIndex=u;for(let y=0;y<b;y++)x.setFrame(y,t.readFloat(),t.readStringRef());r.push(x),o=Math.max(o,x.frames[b-1]);break}case ut.SLOT_COLOR:{let x=new pr(b);x.slotIndex=u;for(let y=0;y<b;y++){let w=t.readFloat();$.rgba8888ToColor(l,t.readInt32()),x.setFrame(y,w,l.r,l.g,l.b,l.a),y<b-1&&this.readCurve(t,y,x)}r.push(x),o=Math.max(o,x.frames[(b-1)*pr.ENTRIES]);break}case ut.SLOT_TWO_COLOR:{let x=new gr(b);x.slotIndex=u;for(let y=0;y<b;y++){let w=t.readFloat();$.rgba8888ToColor(l,t.readInt32()),$.rgb888ToColor(c,t.readInt32()),x.setFrame(y,w,l.r,l.g,l.b,l.a,c.r,c.g,c.b),y<b-1&&this.readCurve(t,y,x)}r.push(x),o=Math.max(o,x.frames[(b-1)*gr.ENTRIES]);break}}}}for(let h=0,d=t.readInt(!0);h<d;h++){let u=t.readInt(!0);for(let p=0,f=t.readInt(!0);p<f;p++){let g=t.readByte(),b=t.readInt(!0);switch(g){case ut.BONE_ROTATE:{let x=new we(b);x.boneIndex=u;for(let y=0;y<b;y++)x.setFrame(y,t.readFloat(),t.readFloat()),y<b-1&&this.readCurve(t,y,x);r.push(x),o=Math.max(o,x.frames[(b-1)*we.ENTRIES]);break}case ut.BONE_TRANSLATE:case ut.BONE_SCALE:case ut.BONE_SHEAR:{let x,y=1;g==ut.BONE_SCALE?x=new Fs(b):g==ut.BONE_SHEAR?x=new Ds(b):(x=new Cn(b),y=s),x.boneIndex=u;for(let w=0;w<b;w++)x.setFrame(w,t.readFloat(),t.readFloat()*y,t.readFloat()*y),w<b-1&&this.readCurve(t,w,x);r.push(x),o=Math.max(o,x.frames[(b-1)*Cn.ENTRIES]);break}}}}for(let h=0,d=t.readInt(!0);h<d;h++){let u=t.readInt(!0),p=t.readInt(!0),f=new xr(p);f.ikConstraintIndex=u;for(let g=0;g<p;g++)f.setFrame(g,t.readFloat(),t.readFloat(),t.readFloat()*s,t.readByte(),t.readBoolean(),t.readBoolean()),g<p-1&&this.readCurve(t,g,f);r.push(f),o=Math.max(o,f.frames[(p-1)*xr.ENTRIES])}for(let h=0,d=t.readInt(!0);h<d;h++){let u=t.readInt(!0),p=t.readInt(!0),f=new yr(p);f.transformConstraintIndex=u;for(let g=0;g<p;g++)f.setFrame(g,t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat()),g<p-1&&this.readCurve(t,g,f);r.push(f),o=Math.max(o,f.frames[(p-1)*yr.ENTRIES])}for(let h=0,d=t.readInt(!0);h<d;h++){let u=t.readInt(!0),p=n.pathConstraints[u];for(let f=0,g=t.readInt(!0);f<g;f++){let b=t.readByte(),x=t.readInt(!0);switch(b){case ut.PATH_POSITION:case ut.PATH_SPACING:{let y,w=1;b==ut.PATH_SPACING?(y=new Rs(x),(p.spacingMode==0||p.spacingMode==1)&&(w=s)):(y=new zn(x),p.positionMode==0&&(w=s)),y.pathConstraintIndex=u;for(let k=0;k<x;k++)y.setFrame(k,t.readFloat(),t.readFloat()*w),k<x-1&&this.readCurve(t,k,y);r.push(y),o=Math.max(o,y.frames[(x-1)*zn.ENTRIES]);break}case ut.PATH_MIX:{let y=new wr(x);y.pathConstraintIndex=u;for(let w=0;w<x;w++)y.setFrame(w,t.readFloat(),t.readFloat(),t.readFloat()),w<x-1&&this.readCurve(t,w,y);r.push(y),o=Math.max(o,y.frames[(x-1)*wr.ENTRIES]);break}}}}for(let h=0,d=t.readInt(!0);h<d;h++){let u=n.skins[t.readInt(!0)];for(let p=0,f=t.readInt(!0);p<f;p++){let g=t.readInt(!0);for(let b=0,x=t.readInt(!0);b<x;b++){let y=u.getAttachment(g,t.readStringRef()),w=y.bones!=null,k=y.vertices,S=w?k.length/3*2:k.length,I=t.readInt(!0),M=new Vs(I);M.slotIndex=g,M.attachment=y;for(let v=0;v<I;v++){let E=t.readFloat(),C,T=t.readInt(!0);if(T==0)C=w?Y.newFloatArray(S):k;else{C=Y.newFloatArray(S);let F=t.readInt(!0);if(T+=F,s==1)for(let D=F;D<T;D++)C[D]=t.readFloat();else for(let D=F;D<T;D++)C[D]=t.readFloat()*s;if(!w)for(let D=0,V=C.length;D<V;D++)C[D]+=k[D]}M.setFrame(v,E,C),v<I-1&&this.readCurve(t,v,M)}r.push(M),o=Math.max(o,M.frames[I-1])}}}let a=t.readInt(!0);if(a>0){let h=new En(a),d=n.slots.length;for(let u=0;u<a;u++){let p=t.readFloat(),f=t.readInt(!0),g=Y.newArray(d,0);for(let w=d-1;w>=0;w--)g[w]=-1;let b=Y.newArray(d-f,0),x=0,y=0;for(let w=0;w<f;w++){let k=t.readInt(!0);for(;x!=k;)b[y++]=x++;g[x+t.readInt(!0)]=x++}for(;x<d;)b[y++]=x++;for(let w=d-1;w>=0;w--)g[w]==-1&&(g[w]=b[--y]);h.setFrame(u,p,g)}r.push(h),o=Math.max(o,h.frames[a-1])}let i=t.readInt(!0);if(i>0){let h=new br(i);for(let d=0;d<i;d++){let u=t.readFloat(),p=n.events[t.readInt(!0)],f=new Ys(u,p);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():p.stringValue,f.data.audioPath!=null&&(f.volume=t.readFloat(),f.balance=t.readFloat()),h.setFrame(d,f)}r.push(h),o=Math.max(o,h.frames[i-1])}return new zt(e,r,o)}readCurve(t,e,n){switch(t.readByte()){case ut.CURVE_STEPPED:n.setStepped(e);break;case ut.CURVE_BEZIER:this.setCurve(n,e,t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat());break}}setCurve(t,e,n,r,s,o){t.setCurve(e,n,r,s,o)}};m(ut,"AttachmentTypeValues",[0,1,2,3,4,5,6]),m(ut,"TransformModeValues",[0,1,2,3,4]),m(ut,"PositionModeValues",[0,1]),m(ut,"SpacingModeValues",[0,1,2]),m(ut,"RotateModeValues",[0,1,2]),m(ut,"BlendModeValues",[0,1,2,3]),m(ut,"BONE_ROTATE",0),m(ut,"BONE_TRANSLATE",1),m(ut,"BONE_SCALE",2),m(ut,"BONE_SHEAR",3),m(ut,"SLOT_ATTACHMENT",0),m(ut,"SLOT_COLOR",1),m(ut,"SLOT_TWO_COLOR",2),m(ut,"PATH_POSITION",0),m(ut,"PATH_SPACING",1),m(ut,"PATH_MIX",2),m(ut,"CURVE_LINEAR",0),m(ut,"CURVE_STEPPED",1),m(ut,"CURVE_BEZIER",2);var Il=ut,jh=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritDeform");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=s}},Zh=class{constructor(t=null,e=null){this.bones=t;this.vertices=e}};var Kh=class extends $e{};var Ml=class A{constructor(t){m(this,"attachmentLoader");m(this,"scale",1);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Us,r=typeof t=="string"?JSON.parse(t):t,s=r.skeleton;if(s!=null){if(n.hash=s.hash,n.version=s.spine,n.version.substr(0,3)!=="3.8"){let o=`Spine 3.8 loader cant load version ${s.spine}. Please configure your pixi-spine bundle`;console.error(o)}n.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),n.x=s.x,n.y=s.y,n.width=s.width,n.height=s.height,n.fps=s.fps,n.imagesPath=s.images}if(r.bones)for(let o=0;o<r.bones.length;o++){let l=r.bones[o],c=null,a=this.getValue(l,"parent",null);if(a!=null&&(c=n.findBone(a),c==null))throw new Error(`Parent bone not found: ${a}`);let i=new Ps(n.bones.length,l.name,c);i.length=this.getValue(l,"length",0)*e,i.x=this.getValue(l,"x",0)*e,i.y=this.getValue(l,"y",0)*e,i.rotation=this.getValue(l,"rotation",0),i.scaleX=this.getValue(l,"scaleX",1),i.scaleY=this.getValue(l,"scaleY",1),i.shearX=this.getValue(l,"shearX",0),i.shearY=this.getValue(l,"shearY",0),i.transformMode=A.transformModeFromString(this.getValue(l,"transform","normal")),i.skinRequired=this.getValue(l,"skin",!1),n.bones.push(i)}if(r.slots)for(let o=0;o<r.slots.length;o++){let l=r.slots[o],c=l.name,a=l.bone,i=n.findBone(a);if(i==null)throw new Error(`Slot bone not found: ${a}`);let h=new Ws(n.slots.length,c,i),d=this.getValue(l,"color",null);d!=null&&h.color.setFromString(d);let u=this.getValue(l,"dark",null);u!=null&&(h.darkColor=new $(1,1,1,1),h.darkColor.setFromString(u)),h.attachmentName=this.getValue(l,"attachment",null),h.blendMode=A.blendModeFromString(this.getValue(l,"blend","normal")),n.slots.push(h)}if(r.ik)for(let o=0;o<r.ik.length;o++){let l=r.ik[o],c=new Ls(l.name);c.order=this.getValue(l,"order",0),c.skinRequired=this.getValue(l,"skin",!1);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`IK bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findBone(a),c.target==null)throw new Error(`IK target bone not found: ${a}`);c.mix=this.getValue(l,"mix",1),c.softness=this.getValue(l,"softness",0)*e,c.bendDirection=this.getValue(l,"bendPositive",!0)?1:-1,c.compress=this.getValue(l,"compress",!1),c.stretch=this.getValue(l,"stretch",!1),c.uniform=this.getValue(l,"uniform",!1),n.ikConstraints.push(c)}if(r.transform)for(let o=0;o<r.transform.length;o++){let l=r.transform[o],c=new qs(l.name);c.order=this.getValue(l,"order",0),c.skinRequired=this.getValue(l,"skin",!1);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findBone(a),c.target==null)throw new Error(`Transform constraint target bone not found: ${a}`);c.local=this.getValue(l,"local",!1),c.relative=this.getValue(l,"relative",!1),c.offsetRotation=this.getValue(l,"rotation",0),c.offsetX=this.getValue(l,"x",0)*e,c.offsetY=this.getValue(l,"y",0)*e,c.offsetScaleX=this.getValue(l,"scaleX",0),c.offsetScaleY=this.getValue(l,"scaleY",0),c.offsetShearY=this.getValue(l,"shearY",0),c.rotateMix=this.getValue(l,"rotateMix",1),c.translateMix=this.getValue(l,"translateMix",1),c.scaleMix=this.getValue(l,"scaleMix",1),c.shearMix=this.getValue(l,"shearMix",1),n.transformConstraints.push(c)}if(r.path)for(let o=0;o<r.path.length;o++){let l=r.path[o],c=new Ns(l.name);c.order=this.getValue(l,"order",0),c.skinRequired=this.getValue(l,"skin",!1);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findSlot(a),c.target==null)throw new Error(`Path target slot not found: ${a}`);c.positionMode=A.positionModeFromString(this.getValue(l,"positionMode","percent")),c.spacingMode=A.spacingModeFromString(this.getValue(l,"spacingMode","length")),c.rotateMode=A.rotateModeFromString(this.getValue(l,"rotateMode","tangent")),c.offsetRotation=this.getValue(l,"rotation",0),c.position=this.getValue(l,"position",0),c.positionMode==0&&(c.position*=e),c.spacing=this.getValue(l,"spacing",0),(c.spacingMode==0||c.spacingMode==1)&&(c.spacing*=e),c.rotateMix=this.getValue(l,"rotateMix",1),c.translateMix=this.getValue(l,"translateMix",1),n.pathConstraints.push(c)}if(r.skins)for(let o=0;o<r.skins.length;o++){let l=r.skins[o],c=new Qr(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let i=n.findBone(l.bones[a]);if(i==null)throw new Error(`Skin bone not found: ${l.bones[o]}`);c.bones.push(i)}if(l.ik)for(let a=0;a<l.ik.length;a++){let i=n.findIkConstraint(l.ik[a]);if(i==null)throw new Error(`Skin IK constraint not found: ${l.ik[o]}`);c.constraints.push(i)}if(l.transform)for(let a=0;a<l.transform.length;a++){let i=n.findTransformConstraint(l.transform[a]);if(i==null)throw new Error(`Skin transform constraint not found: ${l.transform[o]}`);c.constraints.push(i)}if(l.path)for(let a=0;a<l.path.length;a++){let i=n.findPathConstraint(l.path[a]);if(i==null)throw new Error(`Skin path constraint not found: ${l.path[o]}`);c.constraints.push(i)}for(let a in l.attachments){let i=n.findSlot(a);if(i==null)throw new Error(`Slot not found: ${a}`);let h=l.attachments[a];for(let d in h){let u=this.readAttachment(h[d],c,i.index,d,n);u!=null&&c.setAttachment(i.index,d,u)}}n.skins.push(c),c.name=="default"&&(n.defaultSkin=c)}for(let o=0,l=this.linkedMeshes.length;o<l;o++){let c=this.linkedMeshes[o],a=c.skin==null?n.defaultSkin:n.findSkin(c.skin);if(a==null)throw new Error(`Skin not found: ${c.skin}`);let i=a.getAttachment(c.slotIndex,c.parent);if(i==null)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.deformAttachment=c.inheritDeform?i:c.mesh,c.mesh.setParentMesh(i)}if(this.linkedMeshes.length=0,r.events)for(let o in r.events){let l=r.events[o],c=new Xs(o);c.intValue=this.getValue(l,"int",0),c.floatValue=this.getValue(l,"float",0),c.stringValue=this.getValue(l,"string",""),c.audioPath=this.getValue(l,"audio",null),c.audioPath!=null&&(c.volume=this.getValue(l,"volume",1),c.balance=this.getValue(l,"balance",0)),n.events.push(c)}if(r.animations)for(let o in r.animations){let l=r.animations[o];this.readAnimation(l,o,n)}return n}readAttachment(t,e,n,r,s){let o=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{let c=this.getValue(t,"path",r),a=this.attachmentLoader.newRegionAttachment(e,r,c);if(a==null)return null;a.path=c,a.x=this.getValue(t,"x",0)*o,a.y=this.getValue(t,"y",0)*o,a.scaleX=this.getValue(t,"scaleX",1),a.scaleY=this.getValue(t,"scaleY",1),a.rotation=this.getValue(t,"rotation",0),a.width=t.width*o,a.height=t.height*o;let i=this.getValue(t,"color",null);return i!=null&&a.color.setFromString(i),a}case"boundingbox":{let c=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(c==null)return null;this.readVertices(t,c,t.vertexCount<<1);let a=this.getValue(t,"color",null);return a!=null&&c.color.setFromString(a),c}case"mesh":case"linkedmesh":{let c=this.getValue(t,"path",r),a=this.attachmentLoader.newMeshAttachment(e,r,c);if(a==null)return null;a.path=c;let i=this.getValue(t,"color",null);i!=null&&a.color.setFromString(i),a.width=this.getValue(t,"width",0)*o,a.height=this.getValue(t,"height",0)*o;let h=this.getValue(t,"parent",null);if(h!=null)return this.linkedMeshes.push(new Jh(a,this.getValue(t,"skin",null),n,h,this.getValue(t,"deform",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=new Float32Array(d),a.edges=this.getValue(t,"edges",null),a.hullLength=this.getValue(t,"hull",0)*2,a}case"path":{let c=this.attachmentLoader.newPathAttachment(e,r);if(c==null)return null;c.closed=this.getValue(t,"closed",!1),c.constantSpeed=this.getValue(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,c,a<<1);let i=Y.newArray(a/3,0);for(let d=0;d<t.lengths.length;d++)i[d]=t.lengths[d]*o;c.lengths=i;let h=this.getValue(t,"color",null);return h!=null&&c.color.setFromString(h),c}case"point":{let c=this.attachmentLoader.newPointAttachment(e,r);if(c==null)return null;c.x=this.getValue(t,"x",0)*o,c.y=this.getValue(t,"y",0)*o,c.rotation=this.getValue(t,"rotation",0);let a=this.getValue(t,"color",null);return a!=null&&c.color.setFromString(a),c}case"clipping":{let c=this.attachmentLoader.newClippingAttachment(e,r);if(c==null)return null;let a=this.getValue(t,"end",null);if(a!=null){let d=s.findSlot(a);if(d==null)throw new Error(`Clipping end slot not found: ${a}`);c.endSlot=d}let i=t.vertexCount;this.readVertices(t,c,i<<1);let h=this.getValue(t,"color",null);return h!=null&&c.color.setFromString(h),c}}return null}readVertices(t,e,n){let r=this.scale;e.worldVerticesLength=n;let s=t.vertices;if(n==s.length){let c=Y.toFloatArray(s);if(r!=1)for(let a=0,i=s.length;a<i;a++)c[a]*=r;e.vertices=c;return}let o=new Array,l=new Array;for(let c=0,a=s.length;c<a;){let i=s[c++];l.push(i);for(let h=c+i*4;c<h;c+=4)l.push(s[c]),o.push(s[c+1]*r),o.push(s[c+2]*r),o.push(s[c+3])}e.bones=l,e.vertices=Y.toFloatArray(o)}readAnimation(t,e,n){let r=this.scale,s=new Array,o=0;if(t.slots)for(let c in t.slots){let a=t.slots[c],i=n.findSlotIndex(c);if(i==-1)throw new Error(`Slot not found: ${c}`);for(let h in a){let d=a[h];if(h=="attachment"){let u=new un(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f];u.setFrame(p++,this.getValue(g,"time",0),g.name)}s.push(u),o=Math.max(o,u.frames[u.getFrameCount()-1])}else if(h=="color"){let u=new pr(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f],b=new $;b.setFromString(g.color||"ffffffff"),u.setFrame(p,this.getValue(g,"time",0),b.r,b.g,b.b,b.a),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*pr.ENTRIES])}else if(h=="twoColor"){let u=new gr(d.length);u.slotIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f],b=new $,x=new $;b.setFromString(g.light),x.setFromString(g.dark),u.setFrame(p,this.getValue(g,"time",0),b.r,b.g,b.b,b.a,x.r,x.g,x.b),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*gr.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${h} (${c})`)}}if(t.bones)for(let c in t.bones){let a=t.bones[c],i=n.findBoneIndex(c);if(i==-1)throw new Error(`Bone not found: ${c}`);for(let h in a){let d=a[h];if(h==="rotate"){let u=new we(d.length);u.boneIndex=i;let p=0;for(let f=0;f<d.length;f++){let g=d[f];u.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,u,p),p++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*we.ENTRIES])}else if(h==="translate"||h==="scale"||h==="shear"){let u=null,p=1,f=0;h==="scale"?(u=new Fs(d.length),f=1):h==="shear"?u=new Ds(d.length):(u=new Cn(d.length),p=r),u.boneIndex=i;let g=0;for(let b=0;b<d.length;b++){let x=d[b],y=this.getValue(x,"x",f),w=this.getValue(x,"y",f);u.setFrame(g,this.getValue(x,"time",0),y*p,w*p),this.readCurve(x,u,g),g++}s.push(u),o=Math.max(o,u.frames[(u.getFrameCount()-1)*Cn.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${h} (${c})`)}}if(t.ik)for(let c in t.ik){let a=t.ik[c],i=n.findIkConstraint(c),h=new xr(a.length);h.ikConstraintIndex=n.ikConstraints.indexOf(i);let d=0;for(let u=0;u<a.length;u++){let p=a[u];h.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,h,d),d++}s.push(h),o=Math.max(o,h.frames[(h.getFrameCount()-1)*xr.ENTRIES])}if(t.transform)for(let c in t.transform){let a=t.transform[c],i=n.findTransformConstraint(c),h=new yr(a.length);h.transformConstraintIndex=n.transformConstraints.indexOf(i);let d=0;for(let u=0;u<a.length;u++){let p=a[u];h.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,h,d),d++}s.push(h),o=Math.max(o,h.frames[(h.getFrameCount()-1)*yr.ENTRIES])}if(t.path)for(let c in t.path){let a=t.path[c],i=n.findPathConstraintIndex(c);if(i==-1)throw new Error(`Path constraint not found: ${c}`);let h=n.pathConstraints[i];for(let d in a){let u=a[d];if(d==="position"||d==="spacing"){let p=null,f=1;d==="spacing"?(p=new Rs(u.length),(h.spacingMode==0||h.spacingMode==1)&&(f=r)):(p=new zn(u.length),h.positionMode==0&&(f=r)),p.pathConstraintIndex=i;let g=0;for(let b=0;b<u.length;b++){let x=u[b];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*f),this.readCurve(x,p,g),g++}s.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*zn.ENTRIES])}else if(d==="mix"){let p=new wr(u.length);p.pathConstraintIndex=i;let f=0;for(let g=0;g<u.length;g++){let b=u[g];p.setFrame(f,this.getValue(b,"time",0),this.getValue(b,"rotateMix",1),this.getValue(b,"translateMix",1)),this.readCurve(b,p,f),f++}s.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*wr.ENTRIES])}}}if(t.deform)for(let c in t.deform){let a=t.deform[c],i=n.findSkin(c);if(i==null){if(Dt.FAIL_ON_NON_EXISTING_SKIN)throw new Error(`Skin not found: ${c}`);continue}for(let h in a){let d=a[h],u=n.findSlotIndex(h);if(u==-1)throw new Error(`Slot not found: ${d.name}`);for(let p in d){let f=d[p],g=i.getAttachment(u,p);if(g==null)throw new Error(`Deform attachment not found: ${f.name}`);let b=g.bones!=null,x=g.vertices,y=b?x.length/3*2:x.length,w=new Vs(f.length);w.slotIndex=u,w.attachment=g;let k=0;for(let S=0;S<f.length;S++){let I=f[S],M,v=this.getValue(I,"vertices",null);if(v==null)M=b?Y.newFloatArray(y):x;else{M=Y.newFloatArray(y);let E=this.getValue(I,"offset",0);if(Y.arrayCopy(v,0,M,E,v.length),r!=1)for(let C=E,T=C+v.length;C<T;C++)M[C]*=r;if(!b)for(let C=0;C<y;C++)M[C]+=x[C]}w.setFrame(k,this.getValue(I,"time",0),M),this.readCurve(I,w,k),k++}s.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}}}let l=t.drawOrder;if(l==null&&(l=t.draworder),l!=null){let c=new En(l.length),a=n.slots.length,i=0;for(let h=0;h<l.length;h++){let d=l[h],u=null,p=this.getValue(d,"offsets",null);if(p!=null){u=Y.newArray(a,-1);let f=Y.newArray(a-p.length,0),g=0,b=0;for(let x=0;x<p.length;x++){let y=p[x],w=n.findSlotIndex(y.slot);if(w==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=w;)f[b++]=g++;u[g+y.offset]=g++}for(;g<a;)f[b++]=g++;for(let x=a-1;x>=0;x--)u[x]==-1&&(u[x]=f[--b])}c.setFrame(i++,this.getValue(d,"time",0),u)}s.push(c),o=Math.max(o,c.frames[c.getFrameCount()-1])}if(t.events){let c=new br(t.events.length),a=0;for(let i=0;i<t.events.length;i++){let h=t.events[i],d=n.findEvent(h.name);if(d==null)throw new Error(`Event not found: ${h.name}`);let u=new Ys(Y.toSinglePrecision(this.getValue(h,"time",0)),d);u.intValue=this.getValue(h,"int",d.intValue),u.floatValue=this.getValue(h,"float",d.floatValue),u.stringValue=this.getValue(h,"string",d.stringValue),u.data.audioPath!=null&&(u.volume=this.getValue(h,"volume",1),u.balance=this.getValue(h,"balance",0)),c.setFrame(a++,u)}s.push(c),o=Math.max(o,c.frames[c.getFrameCount()-1])}if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new zt(e,s,o))}readCurve(t,e,n){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(n);else{let r=t.curve;e.setCurve(n,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,n){return t[e]!==void 0?t[e]:n}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="additive")return 1;if(t=="multiply")return 2;if(t=="screen")return 3;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return 0;if(t=="percent")return 1;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return 0;if(t=="fixed")return 1;if(t=="percent")return 2;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return 0;if(t=="chain")return 1;if(t=="chainscale")return 2;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="onlytranslation")return 1;if(t=="norotationorreflection")return 2;if(t=="noscale")return 3;if(t=="noscaleorreflection")return 4;throw new Error(`Unknown transform mode: ${t}`)}},Jh=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritDeform");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=s}};var Qh=class extends Ee{createSkeleton(t){this.skeleton=new Al(t),this.skeleton.updateWorldTransform(),this.stateData=new bl(t),this.state=new pl(this.stateData)}};var bo={};As(bo,{AlphaTimeline:()=>ra,Animation:()=>kr,AnimationState:()=>Fl,AnimationStateAdapter:()=>em,AnimationStateData:()=>Dl,AtlasAttachmentLoader:()=>uo,Attachment:()=>co,AttachmentTimeline:()=>bn,Bone:()=>fo,BoneData:()=>ua,BoundingBoxAttachment:()=>vl,ClippingAttachment:()=>Cl,ConstraintData:()=>Mr,CurveTimeline:()=>Ge,CurveTimeline1:()=>je,CurveTimeline2:()=>mo,DeformTimeline:()=>ia,DrawOrderTimeline:()=>Tn,Event:()=>fa,EventData:()=>pa,EventQueue:()=>Gc,EventTimeline:()=>Ir,EventType:()=>gd,IkConstraint:()=>Vl,IkConstraintData:()=>ga,IkConstraintTimeline:()=>oa,MeshAttachment:()=>Ar,PathAttachment:()=>Hn,PathConstraint:()=>Rl,PathConstraintData:()=>ba,PathConstraintMixTimeline:()=>ma,PathConstraintPositionTimeline:()=>ca,PathConstraintSpacingTimeline:()=>ha,PointAttachment:()=>El,RGB2Timeline:()=>aa,RGBA2Timeline:()=>sa,RGBATimeline:()=>ea,RGBTimeline:()=>na,RegionAttachment:()=>$s,RotateTimeline:()=>Gn,ScaleTimeline:()=>Zs,ScaleXTimeline:()=>Ks,ScaleYTimeline:()=>Js,Sequence:()=>zs,SequenceMode:()=>Tl,SequenceModeValues:()=>Bl,SequenceTimeline:()=>da,ShearTimeline:()=>Qs,ShearXTimeline:()=>_s,ShearYTimeline:()=>ta,Skeleton:()=>Xl,SkeletonBinary:()=>go,SkeletonBounds:()=>Nl,SkeletonData:()=>ya,SkeletonJson:()=>Ol,Skin:()=>_r,SkinEntry:()=>Ll,Slot:()=>Pl,SlotData:()=>wa,SpacingMode:()=>po,Spine:()=>om,Timeline:()=>Ht,TrackEntry:()=>Hc,TransformConstraint:()=>Yl,TransformConstraintData:()=>Sa,TransformConstraintTimeline:()=>la,TranslateTimeline:()=>Hs,TranslateXTimeline:()=>Gs,TranslateYTimeline:()=>js,VertexAttachment:()=>be});var co=class{constructor(t){m(this,"name");m(this,"type");if(!t)throw new Error("name cannot be null.");this.name=t}},qc=class qc extends co{constructor(e){super(e);m(this,"id",qc.nextID++);m(this,"bones",null);m(this,"vertices",[]);m(this,"worldVerticesLength",0);m(this,"timelineAttachment",this)}computeWorldVerticesOld(e,n){this.computeWorldVertices(e,0,this.worldVerticesLength,n,0,2)}computeWorldVertices(e,n,r,s,o,l){r=o+(r>>1)*l;let c=e.bone.skeleton,a=e.deform,i=this.vertices,h=this.bones;if(!h){a.length>0&&(i=a);let f=e.bone.matrix,g=f.tx,b=f.ty,x=f.a,y=f.c,w=f.b,k=f.d;for(let S=n,I=o;I<r;S+=2,I+=l){let M=i[S],v=i[S+1];s[I]=M*x+v*y+g,s[I+1]=M*w+v*k+b}return}let d=0,u=0;for(let f=0;f<n;f+=2){let g=h[d];d+=g+1,u+=g}let p=c.bones;if(a.length==0)for(let f=o,g=u*3;f<r;f+=l){let b=0,x=0,y=h[d++];for(y+=d;d<y;d++,g+=3){let w=p[h[d]].matrix,k=i[g],S=i[g+1],I=i[g+2];b+=(k*w.a+S*w.c+w.tx)*I,x+=(k*w.b+S*w.d+w.ty)*I}s[f]=b,s[f+1]=x}else{let f=a;for(let g=o,b=u*3,x=u<<1;g<r;g+=l){let y=0,w=0,k=h[d++];for(k+=d;d<k;d++,b+=3,x+=2){let S=p[h[d]].matrix,I=i[b]+f[x],M=i[b+1]+f[x+1],v=i[b+2];y+=(I*S.a+M*S.c+S.tx)*v,w+=(I*S.b+M*S.d+S.ty)*v}s[g]=y,s[g+1]=w}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),Y.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=Y.newFloatArray(this.vertices.length),Y.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}};m(qc,"nextID",0);var be=qc;var vl=class A extends be{constructor(e){super(e);m(this,"type",1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}};var Cl=class A extends be{constructor(e){super(e);m(this,"type",6);m(this,"endSlot",null);m(this,"color",new $(.2275,.2275,.8078,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}};var Ar=class A extends be{constructor(e,n){super(e);m(this,"type",2);m(this,"region",null);m(this,"path");m(this,"regionUVs");m(this,"triangles",[]);m(this,"color",new $(1,1,1,1));m(this,"width",0);m(this,"height",0);m(this,"hullLength",0);m(this,"edges",[]);m(this,"parentMesh",null);m(this,"sequence",null);m(this,"tempColor",new $(0,0,0,0));this.path=n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new A(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Float32Array(this.regionUVs.length),Y.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=new Array(this.triangles.length),Y.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),Y.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,n,r,s,o,l){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,n,r,s,o,l)}newLinkedMesh(){let e=new A(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e}};var Hn=class A extends be{constructor(e){super(e);m(this,"type",4);m(this,"lengths",[]);m(this,"closed",!1);m(this,"constantSpeed",!1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),Y.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}};var El=class A extends be{constructor(e){super(e);m(this,"type",5);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"color",new $(.38,.94,0,1))}computeWorldPosition(e,n){let r=e.matrix;return n.x=this.x*r.a+this.y*r.c+e.worldX,n.y=this.x*r.b+this.y*r.d+e.worldY,n}computeWorldRotation(e){let n=e.matrix,r=B.cosDeg(this.rotation),s=B.sinDeg(this.rotation),o=r*n.a+s*n.c,l=r*n.b+s*n.d;return Math.atan2(l,o)*B.radDeg}copy(){let e=new A(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}};var wt=class wt extends co{constructor(e,n){super(e);m(this,"type",0);m(this,"x",0);m(this,"y",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"rotation",0);m(this,"width",0);m(this,"height",0);m(this,"color",new $(1,1,1,1));m(this,"path");m(this,"rendererObject",null);m(this,"region",null);m(this,"sequence",null);m(this,"offset",Y.newFloatArray(8));m(this,"uvs",Y.newFloatArray(8));m(this,"tempColor",new $(1,1,1,1));this.path=n}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,n=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*n,o=-this.height/2*this.scaleY+this.region.offsetY*r,l=s+this.region.width*n,c=o+this.region.height*r,a=this.rotation*Math.PI/180,i=Math.cos(a),h=Math.sin(a),d=this.x,u=this.y,p=s*i+d,f=s*h,g=o*i+u,b=o*h,x=l*i+d,y=l*h,w=c*i+u,k=c*h,S=this.offset;S[0]=p-b,S[1]=g+f,S[2]=p-k,S[3]=w+f,S[4]=x-k,S[5]=w+y,S[6]=x-b,S[7]=g+y;let I=this.uvs;e.degrees==90?(I[2]=e.u,I[3]=e.v2,I[4]=e.u,I[5]=e.v,I[6]=e.u2,I[7]=e.v,I[0]=e.u2,I[1]=e.v2):(I[0]=e.u,I[1]=e.v2,I[2]=e.u,I[3]=e.v,I[4]=e.u2,I[5]=e.v,I[6]=e.u2,I[7]=e.v2)}computeWorldVertices(e,n,r,s){this.sequence!=null&&this.sequence.apply(e,this);let o=e.bone,l=this.offset,c=o.matrix,a=c.tx,i=c.ty,h=c.a,d=c.c,u=c.b,p=c.d,f=0,g=0;f=l[0],g=l[1],n[r]=f*h+g*d+a,n[r+1]=f*u+g*p+i,r+=s,f=l[2],g=l[3],n[r]=f*h+g*d+a,n[r+1]=f*u+g*p+i,r+=s,f=l[4],g=l[5],n[r]=f*h+g*d+a,n[r+1]=f*u+g*p+i,r+=s,f=l[6],g=l[7],n[r]=f*h+g*d+a,n[r+1]=f*u+g*p+i}copy(){let e=new wt(this.name,this.path);return e.region=this.region,e.rendererObject=this.rendererObject,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,Y.arrayCopy(this.uvs,0,e.uvs,0,8),Y.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}};m(wt,"X1",0),m(wt,"Y1",1),m(wt,"C1R",2),m(wt,"C1G",3),m(wt,"C1B",4),m(wt,"C1A",5),m(wt,"U1",6),m(wt,"V1",7),m(wt,"X2",8),m(wt,"Y2",9),m(wt,"C2R",10),m(wt,"C2G",11),m(wt,"C2B",12),m(wt,"C2A",13),m(wt,"U2",14),m(wt,"V2",15),m(wt,"X3",16),m(wt,"Y3",17),m(wt,"C3R",18),m(wt,"C3G",19),m(wt,"C3B",20),m(wt,"C3A",21),m(wt,"U3",22),m(wt,"V3",23),m(wt,"X4",24),m(wt,"Y4",25),m(wt,"C4R",26),m(wt,"C4G",27),m(wt,"C4B",28),m(wt,"C4A",29),m(wt,"U4",30),m(wt,"V4",31);var $s=wt;var ho=class ho{constructor(t){m(this,"id",ho.nextID());m(this,"regions");m(this,"start",0);m(this,"digits",0);m(this,"setupIndex",0);this.regions=new Array(t)}copy(){let t=new ho(this.regions.length);return Y.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 n=t.sequenceIndex;n==-1&&(n=this.setupIndex),n>=this.regions.length&&(n=this.regions.length-1);let r=this.regions[n];e.region!=r&&(e.region=r)}getPath(t,e){let n=t,r=(this.start+e).toString();for(let s=this.digits-r.length;s>0;s--)n+="0";return n+=r,n}static nextID(){return ho._nextID++}};m(ho,"_nextID",0);var zs=ho,Tl=(l=>(l[l.hold=0]="hold",l[l.once=1]="once",l[l.loop=2]="loop",l[l.pingpong=3]="pingpong",l[l.onceReverse=4]="onceReverse",l[l.loopReverse=5]="loopReverse",l[l.pingpongReverse=6]="pingpongReverse",l))(Tl||{}),Bl=[0,1,2,3,4,5,6];var kr=class{constructor(t,e,n){m(this,"name");m(this,"timelines",[]);m(this,"timelineIds",new vn);m(this,"duration");if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=n}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let 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,n,r,s,o,l,c){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(n%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let i=0,h=a.length;i<h;i++)a[i].apply(t,e,n,s,o,l,c)}},Vt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19},Ht=class{constructor(t,e){m(this,"propertyIds");m(this,"frames");this.propertyIds=e,this.frames=Y.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 n=t.length;for(let r=1;r<n;r++)if(t[r]>e)return r-1;return n-1}static search(t,e,n){let r=t.length;for(let s=n;s<r;s+=n)if(t[s]>e)return s-n;return r-n}},Ge=class extends Ht{constructor(e,n,r){super(e,r);m(this,"curves");this.curves=Y.newFloatArray(e+n*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let n=this.getFrameCount()+e*18;if(this.curves.length>n){let r=Y.newFloatArray(n);Y.arrayCopy(this.curves,0,r,0,n),this.curves=r}}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r==0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=(o-c*2+i)*.03,b=((l-a)*3-s+h)*.006,x=((c-i)*3-o+d)*.006,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=(c-o)*.3+g+x*.16666667,I=s+k,M=o+S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getBezierValue(e,n,r,s){let o=this.curves;if(o[s]>e){let i=this.frames[n],h=this.frames[n+r];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}let l=s+18;for(s+=2;s<l;s+=2)if(o[s]>=e){let i=o[s-2],h=o[s-1];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}n+=this.getFrameEntries();let c=o[l-2],a=o[l-1];return a+(e-c)/(this.frames[n]-c)*(this.frames[n+r]-a)}},je=class extends Ge{constructor(t,e,n){super(t,e,[n])}getFrameEntries(){return 2}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}getCurveValue(t){let e=this.frames,n=e.length-2;for(let s=2;s<=n;s+=2)if(e[s]>t){n=s-2;break}let r=this.curves[n>>1];switch(r){case 0:let s=e[n],o=e[n+1];return o+(t-s)/(e[n+2]-s)*(e[n+2+1]-o);case 1:return e[n+1]}return this.getBezierValue(t,n,1,r-2)}},mo=class extends Ge{constructor(t,e,n,r){super(t,e,[n,r])}getFrameEntries(){return 3}setFrame(t,e,n,r){t*=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r}},Gn=class extends je{constructor(e,n,r){super(e,n,`${Vt.rotate}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.rotation=a.data.rotation;return;case 1:a.rotation+=(a.data.rotation-a.rotation)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.rotation=a.data.rotation+h*o;break;case 1:case 2:h+=a.data.rotation-a.rotation;case 3:a.rotation+=h*o}}},Hs=class extends mo{constructor(e,n,r){super(e,n,`${Vt.x}|${r}`,`${Vt.y}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*o,a.y+=(a.data.y-a.y)*o}return}let h=0,d=0,u=Ht.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}switch(l){case 0:a.x=a.data.x+h*o,a.y=a.data.y+d*o;break;case 1:case 2:a.x+=(a.data.x+h-a.x)*o,a.y+=(a.data.y+d-a.y)*o;break;case 3:a.x+=h*o,a.y+=d*o}}},Gs=class extends je{constructor(e,n,r){super(e,n,`${Vt.x}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.x=a.data.x;return;case 1:a.x+=(a.data.x-a.x)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.x=a.data.x+h*o;break;case 1:case 2:a.x+=(a.data.x+h-a.x)*o;break;case 3:a.x+=h*o}}},js=class extends je{constructor(e,n,r){super(e,n,`${Vt.y}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.y=a.data.y;return;case 1:a.y+=(a.data.y-a.y)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.y=a.data.y+h*o;break;case 1:case 2:a.y+=(a.data.y+h-a.y)*o;break;case 3:a.y+=h*o}}},Zs=class extends mo{constructor(e,n,r){super(e,n,`${Vt.scaleX}|${r}`,`${Vt.scaleY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*o,a.scaleY+=(a.data.scaleY-a.scaleY)*o}return}let h,d,u=Ht.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}if(h*=a.data.scaleX,d*=a.data.scaleY,o==1)l==3?(a.scaleX+=h-a.data.scaleX,a.scaleY+=d-a.data.scaleY):(a.scaleX=h,a.scaleY=d);else{let f=0,g=0;if(c==1)switch(l){case 0:f=a.data.scaleX,g=a.data.scaleY,a.scaleX=f+(Math.abs(h)*B.signum(f)-f)*o,a.scaleY=g+(Math.abs(d)*B.signum(g)-g)*o;break;case 1:case 2:f=a.scaleX,g=a.scaleY,a.scaleX=f+(Math.abs(h)*B.signum(f)-f)*o,a.scaleY=g+(Math.abs(d)*B.signum(g)-g)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o,a.scaleY+=(d-a.data.scaleY)*o}else switch(l){case 0:f=Math.abs(a.data.scaleX)*B.signum(h),g=Math.abs(a.data.scaleY)*B.signum(d),a.scaleX=f+(h-f)*o,a.scaleY=g+(d-g)*o;break;case 1:case 2:f=Math.abs(a.scaleX)*B.signum(h),g=Math.abs(a.scaleY)*B.signum(d),a.scaleX=f+(h-f)*o,a.scaleY=g+(d-g)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o,a.scaleY+=(d-a.data.scaleY)*o}}}},Ks=class extends je{constructor(e,n,r){super(e,n,`${Vt.scaleX}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleX=a.data.scaleX;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*o}return}let h=this.getCurveValue(r)*a.data.scaleX;if(o==1)l==3?a.scaleX+=h-a.data.scaleX:a.scaleX=h;else{let d=0;if(c==1)switch(l){case 0:d=a.data.scaleX,a.scaleX=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 1:case 2:d=a.scaleX,a.scaleX=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o}else switch(l){case 0:d=Math.abs(a.data.scaleX)*B.signum(h),a.scaleX=d+(h-d)*o;break;case 1:case 2:d=Math.abs(a.scaleX)*B.signum(h),a.scaleX=d+(h-d)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o}}}},Js=class extends je{constructor(e,n,r){super(e,n,`${Vt.scaleY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleY=a.data.scaleY;return;case 1:a.scaleY+=(a.data.scaleY-a.scaleY)*o}return}let h=this.getCurveValue(r)*a.data.scaleY;if(o==1)l==3?a.scaleY+=h-a.data.scaleY:a.scaleY=h;else{let d=0;if(c==1)switch(l){case 0:d=a.data.scaleY,a.scaleY=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 1:case 2:d=a.scaleY,a.scaleY=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 3:a.scaleY+=(h-a.data.scaleY)*o}else switch(l){case 0:d=Math.abs(a.data.scaleY)*B.signum(h),a.scaleY=d+(h-d)*o;break;case 1:case 2:d=Math.abs(a.scaleY)*B.signum(h),a.scaleY=d+(h-d)*o;break;case 3:a.scaleY+=(h-a.data.scaleY)*o}}}},Qs=class extends mo{constructor(e,n,r){super(e,n,`${Vt.shearX}|${r}`,`${Vt.shearY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*o,a.shearY+=(a.data.shearY-a.shearY)*o}return}let h=0,d=0,u=Ht.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}switch(l){case 0:a.shearX=a.data.shearX+h*o,a.shearY=a.data.shearY+d*o;break;case 1:case 2:a.shearX+=(a.data.shearX+h-a.shearX)*o,a.shearY+=(a.data.shearY+d-a.shearY)*o;break;case 3:a.shearX+=h*o,a.shearY+=d*o}}},_s=class extends je{constructor(e,n,r){super(e,n,`${Vt.shearX}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearX=a.data.shearX;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.shearX=a.data.shearX+h*o;break;case 1:case 2:a.shearX+=(a.data.shearX+h-a.shearX)*o;break;case 3:a.shearX+=h*o}}},ta=class extends je{constructor(e,n,r){super(e,n,`${Vt.shearY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearY=a.data.shearY;return;case 1:a.shearY+=(a.data.shearY-a.shearY)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.shearY=a.data.shearY+h*o;break;case 1:case 2:a.shearY+=(a.data.shearY+h-a.shearY)*o;break;case 3:a.shearY+=h*o}}},ea=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.rgb}|${r}`,`${Vt.alpha}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 5}setFrame(e,n,r,s,o,l){e*=5,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color;if(r<i[0]){let x=a.data.color;switch(l){case 0:h.setFromColor(x);return;case 1:h.add((x.r-h.r)*o,(x.g-h.g)*o,(x.b-h.b)*o,(x.a-h.a)*o)}return}let d=0,u=0,p=0,f=0,g=Ht.search(i,r,5),b=this.curves[g/5];switch(b){case 0:let x=i[g];d=i[g+1],u=i[g+2],p=i[g+3],f=i[g+4];let y=(r-x)/(i[g+5]-x);d+=(i[g+5+1]-d)*y,u+=(i[g+5+2]-u)*y,p+=(i[g+5+3]-p)*y,f+=(i[g+5+4]-f)*y;break;case 1:d=i[g+1],u=i[g+2],p=i[g+3],f=i[g+4];break;default:d=this.getBezierValue(r,g,1,b-2),u=this.getBezierValue(r,g,2,b+18-2),p=this.getBezierValue(r,g,3,b+18*2-2),f=this.getBezierValue(r,g,4,b+18*3-2)}o==1?h.set(d,u,p,f):(l==0&&h.setFromColor(a.data.color),h.add((d-h.r)*o,(u-h.g)*o,(p-h.b)*o,(f-h.a)*o))}},na=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.rgb}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 4}setFrame(e,n,r,s,o){e<<=2,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color;if(r<i[0]){let b=a.data.color;switch(l){case 0:h.r=b.r,h.g=b.g,h.b=b.b;return;case 1:h.r+=(b.r-h.r)*o,h.g+=(b.g-h.g)*o,h.b+=(b.b-h.b)*o}return}let d=0,u=0,p=0,f=Ht.search(i,r,4),g=this.curves[f>>2];switch(g){case 0:let b=i[f];d=i[f+1],u=i[f+2],p=i[f+3];let x=(r-b)/(i[f+4]-b);d+=(i[f+4+1]-d)*x,u+=(i[f+4+2]-u)*x,p+=(i[f+4+3]-p)*x;break;case 1:d=i[f+1],u=i[f+2],p=i[f+3];break;default:d=this.getBezierValue(r,f,1,g-2),u=this.getBezierValue(r,f,2,g+18-2),p=this.getBezierValue(r,f,3,g+18*2-2)}if(o==1)h.r=d,h.g=u,h.b=p;else{if(l==0){let b=a.data.color;h.r=b.r,h.g=b.g,h.b=b.b}h.r+=(d-h.r)*o,h.g+=(u-h.g)*o,h.b+=(p-h.b)*o}}},ra=class extends je{constructor(e,n,r){super(e,n,`${Vt.alpha}|${r}`);m(this,"slotIndex",0);this.slotIndex=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.color;if(r<this.frames[0]){let d=a.data.color;switch(l){case 0:i.a=d.a;return;case 1:i.a+=(d.a-i.a)*o}return}let h=this.getCurveValue(r);o==1?i.a=h:(l==0&&(i.a=a.data.color.a),i.a+=(h-i.a)*o)}},sa=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.rgb}|${r}`,`${Vt.alpha}|${r}`,`${Vt.rgb2}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 8}setFrame(e,n,r,s,o,l,c,a,i){e<<=3,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l,this.frames[e+5]=c,this.frames[e+6]=a,this.frames[e+7]=i}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color,d=a.darkColor;if(r<i[0]){let S=a.data.color,I=a.data.darkColor;switch(l){case 0:h.setFromColor(S),d.r=I.r,d.g=I.g,d.b=I.b;return;case 1:h.add((S.r-h.r)*o,(S.g-h.g)*o,(S.b-h.b)*o,(S.a-h.a)*o),d.r+=(I.r-d.r)*o,d.g+=(I.g-d.g)*o,d.b+=(I.b-d.b)*o}return}let u=0,p=0,f=0,g=0,b=0,x=0,y=0,w=Ht.search(i,r,8),k=this.curves[w>>3];switch(k){case 0:let S=i[w];u=i[w+1],p=i[w+2],f=i[w+3],g=i[w+4],b=i[w+5],x=i[w+6],y=i[w+7];let I=(r-S)/(i[w+8]-S);u+=(i[w+8+1]-u)*I,p+=(i[w+8+2]-p)*I,f+=(i[w+8+3]-f)*I,g+=(i[w+8+4]-g)*I,b+=(i[w+8+5]-b)*I,x+=(i[w+8+6]-x)*I,y+=(i[w+8+7]-y)*I;break;case 1:u=i[w+1],p=i[w+2],f=i[w+3],g=i[w+4],b=i[w+5],x=i[w+6],y=i[w+7];break;default:u=this.getBezierValue(r,w,1,k-2),p=this.getBezierValue(r,w,2,k+18-2),f=this.getBezierValue(r,w,3,k+18*2-2),g=this.getBezierValue(r,w,4,k+18*3-2),b=this.getBezierValue(r,w,5,k+18*4-2),x=this.getBezierValue(r,w,6,k+18*5-2),y=this.getBezierValue(r,w,7,k+18*6-2)}if(o==1)h.set(u,p,f,g),d.r=b,d.g=x,d.b=y;else{if(l==0){h.setFromColor(a.data.color);let S=a.data.darkColor;d.r=S.r,d.g=S.g,d.b=S.b}h.add((u-h.r)*o,(p-h.g)*o,(f-h.b)*o,(g-h.a)*o),d.r+=(b-d.r)*o,d.g+=(x-d.g)*o,d.b+=(y-d.b)*o}}},aa=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.rgb}|${r}`,`${Vt.rgb2}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 7}setFrame(e,n,r,s,o,l,c,a){e*=7,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l,this.frames[e+5]=c,this.frames[e+6]=a}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color,d=a.darkColor;if(r<i[0]){let k=a.data.color,S=a.data.darkColor;switch(l){case 0:h.r=k.r,h.g=k.g,h.b=k.b,d.r=S.r,d.g=S.g,d.b=S.b;return;case 1:h.r+=(k.r-h.r)*o,h.g+=(k.g-h.g)*o,h.b+=(k.b-h.b)*o,d.r+=(S.r-d.r)*o,d.g+=(S.g-d.g)*o,d.b+=(S.b-d.b)*o}return}let u=0,p=0,f=0,g=0,b=0,x=0,y=Ht.search(i,r,7),w=this.curves[y/7];switch(w){case 0:let k=i[y];u=i[y+1],p=i[y+2],f=i[y+3],g=i[y+4],b=i[y+5],x=i[y+6];let S=(r-k)/(i[y+7]-k);u+=(i[y+7+1]-u)*S,p+=(i[y+7+2]-p)*S,f+=(i[y+7+3]-f)*S,g+=(i[y+7+4]-g)*S,b+=(i[y+7+5]-b)*S,x+=(i[y+7+6]-x)*S;break;case 1:u=i[y+1],p=i[y+2],f=i[y+3],g=i[y+4],b=i[y+5],x=i[y+6];break;default:u=this.getBezierValue(r,y,1,w-2),p=this.getBezierValue(r,y,2,w+18-2),f=this.getBezierValue(r,y,3,w+18*2-2),g=this.getBezierValue(r,y,4,w+18*3-2),b=this.getBezierValue(r,y,5,w+18*4-2),x=this.getBezierValue(r,y,6,w+18*5-2)}if(o==1)h.r=u,h.g=p,h.b=f,d.r=g,d.g=b,d.b=x;else{if(l==0){let k=a.data.color,S=a.data.darkColor;h.r=k.r,h.g=k.g,h.b=k.b,d.r=S.r,d.g=S.g,d.b=S.b}h.r+=(u-h.r)*o,h.g+=(p-h.g)*o,h.b+=(f-h.b)*o,d.r+=(g-d.r)*o,d.g+=(b-d.g)*o,d.b+=(x-d.b)*o}}},bn=class extends Ht{constructor(e,n){super(e,[`${Vt.attachment}|${n}`]);m(this,"slotIndex",0);m(this,"attachmentNames");this.slotIndex=n,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.attachmentNames[e]=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(a.bone.active){if(c==1){l==0&&this.setAttachment(e,a,a.data.attachmentName);return}if(r<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,a,a.data.attachmentName);return}this.setAttachment(e,a,this.attachmentNames[Ht.search1(this.frames,r)])}}setAttachment(e,n,r){n.setAttachment(r?e.getAttachment(this.slotIndex,r):null)}},ia=class extends Ge{constructor(e,n,r,s){super(e,n,[`${Vt.deform}|${r}|${s.id}`]);m(this,"slotIndex",0);m(this,"attachment");m(this,"vertices");this.slotIndex=r,this.attachment=s,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.vertices[e]=r}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r==0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=i*.03-c*.06,b=((l-a)*3-s+h)*.006,x=(c-i+.33333333)*.018,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=c*.3+g+x*.16666667,I=s+k,M=S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getCurvePercent(e,n){let r=this.curves,s=r[n];switch(s){case 0:let a=this.frames[n];return(e-a)/(this.frames[n+this.getFrameEntries()]-a);case 1:return 0}if(s-=2,r[s]>e){let a=this.frames[n];return r[s+1]*(e-a)/(r[s]-a)}let o=s+18;for(s+=2;s<o;s+=2)if(r[s]>=e){let a=r[s-2],i=r[s-1];return i+(e-a)/(r[s]-a)*(r[s+1]-i)}let l=r[o-2],c=r[o-1];return c+(1-c)*(e-l)/(this.frames[n+this.getFrameEntries()]-l)}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.getAttachment();if(!i||!(i instanceof be)||i.timelineAttachment!=this.attachment)return;let h=a.deform;h.length==0&&(l=0);let d=this.vertices,u=d[0].length,p=this.frames;if(r<p[0]){switch(l){case 0:h.length=0;return;case 1:if(o==1){h.length=0;return}h.length=u;let y=i;if(y.bones){o=1-o;for(let w=0;w<u;w++)h[w]*=o}else{let w=y.vertices;for(let k=0;k<u;k++)h[k]+=(w[k]-h[k])*o}}return}if(h.length=u,r>=p[p.length-1]){let y=d[p.length-1];if(o==1)if(l==3){let w=i;if(w.bones)for(let k=0;k<u;k++)h[k]+=y[k];else{let k=w.vertices;for(let S=0;S<u;S++)h[S]+=y[S]-k[S]}}else Y.arrayCopy(y,0,h,0,u);else switch(l){case 0:{let k=i;if(k.bones)for(let S=0;S<u;S++)h[S]=y[S]*o;else{let S=k.vertices;for(let I=0;I<u;I++){let M=S[I];h[I]=M+(y[I]-M)*o}}break}case 1:case 2:for(let k=0;k<u;k++)h[k]+=(y[k]-h[k])*o;break;case 3:let w=i;if(w.bones)for(let k=0;k<u;k++)h[k]+=y[k]*o;else{let k=w.vertices;for(let S=0;S<u;S++)h[S]+=(y[S]-k[S])*o}}return}let f=Ht.search1(p,r),g=this.getCurvePercent(r,f),b=d[f],x=d[f+1];if(o==1)if(l==3){let y=i;if(y.bones)for(let w=0;w<u;w++){let k=b[w];h[w]+=k+(x[w]-k)*g}else{let w=y.vertices;for(let k=0;k<u;k++){let S=b[k];h[k]+=S+(x[k]-S)*g-w[k]}}}else for(let y=0;y<u;y++){let w=b[y];h[y]=w+(x[y]-w)*g}else switch(l){case 0:{let w=i;if(w.bones)for(let k=0;k<u;k++){let S=b[k];h[k]=(S+(x[k]-S)*g)*o}else{let k=w.vertices;for(let S=0;S<u;S++){let I=b[S],M=k[S];h[S]=M+(I+(x[S]-I)*g-M)*o}}break}case 1:case 2:for(let w=0;w<u;w++){let k=b[w];h[w]+=(k+(x[w]-k)*g-h[w])*o}break;case 3:let y=i;if(y.bones)for(let w=0;w<u;w++){let k=b[w];h[w]+=(k+(x[w]-k)*g)*o}else{let w=y.vertices;for(let k=0;k<u;k++){let S=b[k];h[k]+=(S+(x[k]-S)*g-w[k])*o}}}}},$c=class $c extends Ht{constructor(e){super(e,$c.propertyIds);m(this,"events");this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n){this.frames[e]=n.time,this.events[e]=n}apply(e,n,r,s,o,l,c){if(!s)return;let a=this.frames,i=this.frames.length;if(n>r)this.apply(e,n,Number.MAX_VALUE,s,o,l,c),n=-1;else if(n>=a[i-1])return;if(r<a[0])return;let h=0;if(n<a[0])h=0;else{h=Ht.search1(a,n)+1;let d=a[h];for(;h>0&&a[h-1]==d;)h--}for(;h<i&&r>=a[h];h++)s.push(this.events[h])}};m($c,"propertyIds",[`${Vt.event}`]);var Ir=$c,zc=class zc extends Ht{constructor(e){super(e,zc.propertyIds);m(this,"drawOrders");this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.drawOrders[e]=r}apply(e,n,r,s,o,l,c){if(c==1){l==0&&Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(l==0||l==1)&&Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=Ht.search1(this.frames,r),i=this.drawOrders[a];if(!i)Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let h=e.drawOrder,d=e.slots;for(let u=0,p=i.length;u<p;u++)h[u]=d[i[u]]}}};m(zc,"propertyIds",[`${Vt.drawOrder}`]);var Tn=zc,oa=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.ikConstraint}|${r}`]);m(this,"ikConstraintIndex",0);this.ikConstraintIndex=r}getFrameEntries(){return 6}setFrame(e,n,r,s,o,l,c){e*=6,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l?1:0,this.frames[e+5]=c?1:0}apply(e,n,r,s,o,l,c){let a=e.ikConstraints[this.ikConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*o,a.softness+=(a.data.softness-a.softness)*o,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let h=0,d=0,u=Ht.search(i,r,6),p=this.curves[u/6];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+6]-f);h+=(i[u+6+1]-h)*g,d+=(i[u+6+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}l==0?(a.mix=a.data.mix+(h-a.data.mix)*o,a.softness=a.data.softness+(d-a.data.softness)*o,c==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=i[u+3],a.compress=i[u+4]!=0,a.stretch=i[u+5]!=0)):(a.mix+=(h-a.mix)*o,a.softness+=(d-a.softness)*o,c==0&&(a.bendDirection=i[u+3],a.compress=i[u+4]!=0,a.stretch=i[u+5]!=0))}},la=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.transformConstraint}|${r}`]);m(this,"transformConstraintIndex",0);this.transformConstraintIndex=r}getFrameEntries(){return 7}setFrame(e,n,r,s,o,l,c,a){let i=this.frames;e*=7,i[e]=n,i[e+1]=r,i[e+2]=s,i[e+3]=o,i[e+4]=l,i[e+5]=c,i[e+6]=a}apply(e,n,r,s,o,l,c){let a=e.transformConstraints[this.transformConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){let y=a.data;switch(l){case 0:a.mixRotate=y.mixRotate,a.mixX=y.mixX,a.mixY=y.mixY,a.mixScaleX=y.mixScaleX,a.mixScaleY=y.mixScaleY,a.mixShearY=y.mixShearY;return;case 1:a.mixRotate+=(y.mixRotate-a.mixRotate)*o,a.mixX+=(y.mixX-a.mixX)*o,a.mixY+=(y.mixY-a.mixY)*o,a.mixScaleX+=(y.mixScaleX-a.mixScaleX)*o,a.mixScaleY+=(y.mixScaleY-a.mixScaleY)*o,a.mixShearY+=(y.mixShearY-a.mixShearY)*o}return}let h,d,u,p,f,g,b=Ht.search(i,r,7),x=this.curves[b/7];switch(x){case 0:let y=i[b];h=i[b+1],d=i[b+2],u=i[b+3],p=i[b+4],f=i[b+5],g=i[b+6];let w=(r-y)/(i[b+7]-y);h+=(i[b+7+1]-h)*w,d+=(i[b+7+2]-d)*w,u+=(i[b+7+3]-u)*w,p+=(i[b+7+4]-p)*w,f+=(i[b+7+5]-f)*w,g+=(i[b+7+6]-g)*w;break;case 1:h=i[b+1],d=i[b+2],u=i[b+3],p=i[b+4],f=i[b+5],g=i[b+6];break;default:h=this.getBezierValue(r,b,1,x-2),d=this.getBezierValue(r,b,2,x+18-2),u=this.getBezierValue(r,b,3,x+18*2-2),p=this.getBezierValue(r,b,4,x+18*3-2),f=this.getBezierValue(r,b,5,x+18*4-2),g=this.getBezierValue(r,b,6,x+18*5-2)}if(l==0){let y=a.data;a.mixRotate=y.mixRotate+(h-y.mixRotate)*o,a.mixX=y.mixX+(d-y.mixX)*o,a.mixY=y.mixY+(u-y.mixY)*o,a.mixScaleX=y.mixScaleX+(p-y.mixScaleX)*o,a.mixScaleY=y.mixScaleY+(f-y.mixScaleY)*o,a.mixShearY=y.mixShearY+(g-y.mixShearY)*o}else a.mixRotate+=(h-a.mixRotate)*o,a.mixX+=(d-a.mixX)*o,a.mixY+=(u-a.mixY)*o,a.mixScaleX+=(p-a.mixScaleX)*o,a.mixScaleY+=(f-a.mixScaleY)*o,a.mixShearY+=(g-a.mixShearY)*o}},ca=class extends je{constructor(e,n,r){super(e,n,`${Vt.pathConstraintPosition}|${r}`);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.position=a.data.position;return;case 1:a.position+=(a.data.position-a.position)*o}return}let h=this.getCurveValue(r);l==0?a.position=a.data.position+(h-a.data.position)*o:a.position+=(h-a.position)*o}},ha=class extends je{constructor(e,n,r){super(e,n,`${Vt.pathConstraintSpacing}|${r}`);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.spacing=a.data.spacing;return;case 1:a.spacing+=(a.data.spacing-a.spacing)*o}return}let h=this.getCurveValue(r);l==0?a.spacing=a.data.spacing+(h-a.data.spacing)*o:a.spacing+=(h-a.spacing)*o}},ma=class extends Ge{constructor(e,n,r){super(e,n,[`${Vt.pathConstraintMix}|${r}`]);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}getFrameEntries(){return 4}setFrame(e,n,r,s,o){let l=this.frames;e<<=2,l[e]=n,l[e+1]=r,l[e+2]=s,l[e+3]=o}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*o,a.mixX+=(a.data.mixX-a.mixX)*o,a.mixY+=(a.data.mixY-a.mixY)*o}return}let h,d,u,p=Ht.search(i,r,4),f=this.curves[p>>2];switch(f){case 0:let g=i[p];h=i[p+1],d=i[p+2],u=i[p+3];let b=(r-g)/(i[p+4]-g);h+=(i[p+4+1]-h)*b,d+=(i[p+4+2]-d)*b,u+=(i[p+4+3]-u)*b;break;case 1:h=i[p+1],d=i[p+2],u=i[p+3];break;default:h=this.getBezierValue(r,p,1,f-2),d=this.getBezierValue(r,p,2,f+18-2),u=this.getBezierValue(r,p,3,f+18*2-2)}if(l==0){let g=a.data;a.mixRotate=g.mixRotate+(h-g.mixRotate)*o,a.mixX=g.mixX+(d-g.mixX)*o,a.mixY=g.mixY+(u-g.mixY)*o}else a.mixRotate+=(h-a.mixRotate)*o,a.mixX+=(d-a.mixX)*o,a.mixY+=(u-a.mixY)*o}},gn=class gn extends Ht{constructor(e,n,r){super(e,[`${Vt.sequence}|${n}|${r.sequence.id}`]);m(this,"slotIndex");m(this,"attachment");this.slotIndex=n,this.attachment=r}getFrameEntries(){return gn.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,n,r,s,o){let l=this.frames;e*=gn.ENTRIES,l[e]=n,l[e+gn.MODE]=r|s<<4,l[e+gn.DELAY]=o}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.attachment,h=this.attachment;if(i!=h&&(!(i instanceof be)||i.timelineAttachment!=h))return;let d=this.frames;if(r<d[0]){(l==0||l==1)&&(a.sequenceIndex=-1);return}let u=Ht.search(d,r,gn.ENTRIES),p=d[u],f=d[u+gn.MODE],g=d[u+gn.DELAY];if(!this.attachment.sequence)return;let b=f>>4,x=this.attachment.sequence.regions.length,y=Bl[f&15];if(y!=0)switch(b+=(r-p)/g+1e-5|0,y){case 1:b=Math.min(x-1,b);break;case 2:b%=x;break;case 3:{let w=(x<<1)-2;b=w==0?0:b%w,b>=x&&(b=w-b);break}case 4:b=Math.max(x-1-b,0);break;case 5:b=x-1-b%x;break;case 6:{let w=(x<<1)-2;b=w==0?0:(b+x-1)%w,b>=x&&(b=w-b)}}a.sequenceIndex=b}};m(gn,"ENTRIES",3),m(gn,"MODE",1),m(gn,"DELAY",2);var da=gn;var Ve=class Ve{constructor(t){m(this,"data");m(this,"tracks",new Array);m(this,"timeScale",1);m(this,"unkeyedState",0);m(this,"events",new Array);m(this,"listeners",new Array);m(this,"queue",new Gc(this));m(this,"propertyIDs",new vn);m(this,"animationsChanged",!1);m(this,"trackEntryPool",new qe(()=>new Hc));m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd");this.data=t}static emptyAnimation(){return Ve._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let o=t*s.timeScale;if(s.delay>0){if(s.delay-=o,s.delay>0)continue;o=-s.delay,s.delay=0}let l=s.next;if(l){let c=s.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime+=s.timeScale==0?0:(c/s.timeScale+t)*l.timeScale,s.trackTime+=o,this.setCurrent(n,l,!0);l.mixingFrom;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&!s.mixingFrom){e[n]=null,this.queue.end(s),this.clearNext(s);continue}if(s.mixingFrom&&this.updateMixingFrom(s,t)){let c=s.mixingFrom;for(s.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}s.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let n=t.mixingFrom;if(!n)return!0;let r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((n.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,n=this.tracks,r=!1;for(let l=0,c=n.length;l<c;l++){let a=n[l];if(!a||a.delay>0)continue;r=!0;let i=l==0?1:a.mixBlend,h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,i):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,u=a.getAnimationTime(),p=u,f=e;a.reverse&&(p=a.animation.duration-p,f=null);let g=a.animation.timelines,b=g.length;if(l==0&&h==1||i==3)for(let x=0;x<b;x++){Y.webkit602BugfixHelper(h,i);let y=g[x];y instanceof bn?this.applyAttachmentTimeline(y,t,p,i,!0):y.apply(t,d,p,f,h,i,0)}else{let x=a.timelineMode,y=a.shortestRotation,w=!y&&a.timelinesRotation.length!=b<<1;w&&(a.timelinesRotation.length=b<<1);for(let k=0;k<b;k++){let S=g[k],I=x[k]==_h?i:0;!y&&S instanceof Gn?this.applyRotateTimeline(S,t,p,h,I,a.timelinesRotation,k<<1,w):S instanceof bn?this.applyAttachmentTimeline(S,t,p,i,!0):(Y.webkit602BugfixHelper(h,i),S.apply(t,d,p,f,h,I,0))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}let s=this.unkeyedState+pd,o=t.slots;for(let l=0,c=t.slots.length;l<c;l++){let a=o[l];if(a.attachmentState==s){let i=a.data.attachmentName;a.setAttachment(i?t.getAttachment(a.data.index,i):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,n){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,n);let s=0;t.mixDuration==0?(s=1,n==1&&(n=0)):(s=t.mixTime/t.mixDuration,s>1&&(s=1),n!=1&&(n=r.mixBlend));let o=s<r.attachmentThreshold,l=s<r.drawOrderThreshold,c=r.animation.timelines,a=c.length,i=r.alpha*t.interruptAlpha,h=i*(1-s),d=r.animationLast,u=r.getAnimationTime(),p=u,f=null;if(r.reverse?p=r.animation.duration-p:s<r.eventThreshold&&(f=this.events),n==3)for(let g=0;g<a;g++)c[g].apply(e,d,p,f,h,n,1);else{let g=r.timelineMode,b=r.timelineHoldMix,x=r.shortestRotation,y=!x&&r.timelinesRotation.length!=a<<1;y&&(r.timelinesRotation.length=a<<1),r.totalAlpha=0;for(let w=0;w<a;w++){let k=c[w],S=1,I,M=0;switch(g[w]){case _h:if(!l&&k instanceof Tn)continue;I=n,M=h;break;case ud:I=0,M=h;break;case fd:I=n,M=i;break;case tm:I=0,M=i;break;default:I=0;let v=b[w];M=i*Math.max(0,1-v.mixTime/v.mixDuration);break}r.totalAlpha+=M,!x&&k instanceof Gn?this.applyRotateTimeline(k,e,p,M,I,r.timelinesRotation,w<<1,y):k instanceof bn?this.applyAttachmentTimeline(k,e,p,I,o):(Y.webkit602BugfixHelper(M,n),l&&k instanceof Tn&&I==0&&(S=0),k.apply(e,d,p,f,M,I,S))}}return t.mixDuration>0&&this.queueEvents(r,u),this.events.length=0,r.nextAnimationLast=u,r.nextTrackLast=r.trackTime,s}applyAttachmentTimeline(t,e,n,r,s){let o=e.slots[t.slotIndex];o.bone.active&&(n<t.frames[0]?(r==0||r==1)&&this.setAttachment(e,o,o.data.attachmentName,s):this.setAttachment(e,o,t.attachmentNames[Ht.search1(t.frames,n)],s),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+pd))}setAttachment(t,e,n,r){e.setAttachment(n?t.getAttachment(e.data.index,n):null),r&&(e.attachmentState=this.unkeyedState+su)}applyRotateTimeline(t,e,n,r,s,o,l,c){if(c&&(o[l]=0),r==1){t.apply(e,0,n,null,1,s,0);return}let a=e.bones[t.boneIndex];if(!a.active)return;let i=t.frames,h=0,d=0;if(n<i[0])switch(s){case 0:a.rotation=a.data.rotation;default:return;case 1:h=a.rotation,d=a.data.rotation}else h=s==0?a.data.rotation:a.rotation,d=a.data.rotation+t.getCurveValue(n);let u=0,p=d-h;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)u=o[l];else{let f=0,g=0;c?(f=0,g=p):(f=o[l],g=o[l+1]);let b=p>0,x=f>=0;B.signum(g)!=B.signum(p)&&Math.abs(g)<=90&&(Math.abs(f)>180&&(f+=360*B.signum(f)),x=b),u=p+f-f%360,x!=b&&(u+=360*B.signum(f)),o[l]=u}o[l+1]=p,a.rotation=h+u*r}queueEvents(t,e){let n=t.animationStart,r=t.animationEnd,s=r-n,o=t.trackLast%s,l=this.events,c=0,a=l.length;for(;c<a;c++){let h=l[c];if(h.time<o)break;h.time>r||this.queue.event(t,h)}let i=!1;for(t.loop?i=s==0||o>t.trackTime%s:i=e>=r&&t.animationLast<r,i&&this.queue.complete(t);c<a;c++){let h=l[c];h.time<n||this.queue.event(t,h)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);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 n=e;for(;;){let r=n.mixingFrom;if(!r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(n&&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,n=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,n)}setAnimationWith(t,e,n=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,s=this.expandToIndex(t);s&&(s.nextTrackLast==-1?(this.tracks[t]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.clearNext(s),s=s.mixingFrom,r=!1):this.clearNext(s));let o=this.trackEntry(t,e,n,s);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,e,n=!1,r=0){let s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,s,n,r)}addAnimationWith(t,e,n=!1,r=0){if(!e)throw new Error("animation cannot be null.");let s=this.expandToIndex(t);if(s)for(;s.next;)s=s.next;let o=this.trackEntry(t,e,n,s);return s?(s.next=o,o.previous=s,r<=0&&(r+=s.getTrackComplete()-o.mixDuration)):(this.setCurrent(t,o,!0),this.queue.drain()),o.delay=r,o}setEmptyAnimation(t,e=0){let n=this.setAnimationWith(t,Ve.emptyAnimation(),!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e=0,n=0){let r=this.addAnimationWith(t,Ve.emptyAnimation(),!1,n);return n<=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 n=0,r=this.tracks.length;n<r;n++){let s=this.tracks[n];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(Y.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,n,r){let s=this.trackEntryPool.obtain();return s.reset(),s.trackIndex=t,s.animation=e,s.loop=n,s.holdPrevious=!1,s.reverse=!1,s.shortestRotation=!1,s.eventThreshold=0,s.attachmentThreshold=0,s.drawOrderThreshold=0,s.animationStart=0,s.animationEnd=e.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.mixTime=0,s.mixDuration=r?this.data.getMix(r.animation,e):0,s.interruptAlpha=1,s.totalAlpha=0,s.mixBlend=2,s}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,n=t.length;e<n;e++){let r=t[e];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let e=t.mixingTo,n=t.animation.timelines,r=t.animation.timelines.length,s=t.timelineMode;s.length=r;let o=t.timelineHoldMix;o.length=0;let l=this.propertyIDs;if(e&&e.holdPrevious){for(let c=0;c<r;c++)s[c]=l.addAll(n[c].getPropertyIds())?tm:fd;return}t:for(let c=0;c<r;c++){let a=n[c],i=a.getPropertyIds();if(!l.addAll(i))s[c]=_h;else if(!e||a instanceof bn||a instanceof Tn||a instanceof Ir||!e.animation.hasTimeline(i))s[c]=ud;else{for(let h=e.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(i)){if(t.mixDuration>0){s[c]=ru,o[c]=h;continue t}break}s[c]=tm}}}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()}setAnimationByName(t,e,n){Ve.deprecatedWarning1||(Ve.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,r){Ve.deprecatedWarning2||(Ve.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,r)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return Ve.deprecatedWarning3||(Ve.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};m(Ve,"_emptyAnimation",new kr("<empty>",[],0)),m(Ve,"deprecatedWarning1",!1),m(Ve,"deprecatedWarning2",!1),m(Ve,"deprecatedWarning3",!1);var Fl=Ve,xn=class xn{constructor(){m(this,"animation",null);m(this,"previous",null);m(this,"next",null);m(this,"mixingFrom",null);m(this,"mixingTo",null);m(this,"listener",null);m(this,"trackIndex",0);m(this,"loop",!1);m(this,"holdPrevious",!1);m(this,"reverse",!1);m(this,"shortestRotation",!1);m(this,"eventThreshold",0);m(this,"attachmentThreshold",0);m(this,"drawOrderThreshold",0);m(this,"animationStart",0);m(this,"animationEnd",0);m(this,"animationLast",0);m(this,"nextAnimationLast",0);m(this,"delay",0);m(this,"trackTime",0);m(this,"trackLast",0);m(this,"nextTrackLast",0);m(this,"trackEnd",0);m(this,"timeScale",0);m(this,"alpha",0);m(this,"mixTime",0);m(this,"mixDuration",0);m(this,"interruptAlpha",0);m(this,"totalAlpha",0);m(this,"mixBlend",2);m(this,"timelineMode",new Array);m(this,"timelineHoldMix",new Array);m(this,"timelinesRotation",new Array);m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd")}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 t==0?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(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}get time(){return xn.deprecatedWarning1||(xn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){xn.deprecatedWarning1||(xn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return xn.deprecatedWarning2||(xn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){xn.deprecatedWarning2||(xn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};m(xn,"deprecatedWarning1",!1),m(xn,"deprecatedWarning2",!1);var Hc=xn,Gc=class{constructor(t){m(this,"objects",[]);m(this,"drainDisabled",!1);m(this,"animState");this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),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 n=0;n<t.length;n+=2){let r=t[n],s=t[n+1];switch(r){case 0:s.listener&&s.listener.start&&s.listener.start(s);for(let l=0;l<e.length;l++){let c=e[l];c.start&&c.start(s)}break;case 1:s.listener&&s.listener.interrupt&&s.listener.interrupt(s);for(let l=0;l<e.length;l++){let c=e[l];c.interrupt&&c.interrupt(s)}break;case 2:s.listener&&s.listener.end&&s.listener.end(s);for(let l=0;l<e.length;l++){let c=e[l];c.end&&c.end(s)}case 3:s.listener&&s.listener.dispose&&s.listener.dispose(s);for(let l=0;l<e.length;l++){let c=e[l];c.dispose&&c.dispose(s)}this.animState.trackEntryPool.free(s);break;case 4:s.listener&&s.listener.complete&&s.listener.complete(s);for(let l=0;l<e.length;l++){let c=e[l];c.complete&&c.complete(s)}break;case 5:let o=t[n+++2];s.listener&&s.listener.event&&s.listener.event(s,o);for(let l=0;l<e.length;l++){let c=e[l];c.event&&c.event(s,o)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},gd=(o=>(o[o.start=0]="start",o[o.interrupt=1]="interrupt",o[o.end=2]="end",o[o.dispose=3]="dispose",o[o.complete=4]="complete",o[o.event=5]="event",o))(gd||{}),em=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},_h=0,ud=1,fd=2,tm=3,ru=4,pd=1,su=2;var Dl=class{constructor(t){m(this,"skeletonData");m(this,"animationToMixTime",{});m(this,"defaultMix",0);if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);let s=this.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,s,n)}setMixWith(t,e,n){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]=n}getMix(t,e){let n=`${t.name}.${e.name}`,r=this.animationToMixTime[n];return r===void 0?this.defaultMix:r}};var uo=class{constructor(t){m(this,"atlas");this.atlas=t}loadSequence(t,e,n){let r=n.regions;for(let s=0,o=r.length;s<o;s++){let l=n.getPath(e,s),c=this.atlas.findRegion(l);if(c==null)throw new Error(`Region not found in atlas: ${l} (sequence: ${t})`);r[s]=c,r[s].renderObject=r[s]}}newRegionAttachment(t,e,n,r){let s=new $s(e,n);if(r!=null)this.loadSequence(e,n,r);else{let o=this.atlas.findRegion(n);if(!o)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);o.renderObject=o,s.region=o}return s}newMeshAttachment(t,e,n,r){let s=new Ar(e,n);if(r!=null)this.loadSequence(e,n,r);else{let o=this.atlas.findRegion(n);if(!o)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);o.renderObject=o,s.region=o}return s}newBoundingBoxAttachment(t,e){return new vl(e)}newPathAttachment(t,e){return new Hn(e)}newPointAttachment(t,e){return new El(e)}newClippingAttachment(t,e){return new Cl(e)}};var bd=ye(ge());var fo=class{constructor(t,e,n){m(this,"matrix",new bd.Matrix);m(this,"data");m(this,"skeleton");m(this,"parent",null);m(this,"children",new Array);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",0);m(this,"scaleY",0);m(this,"shearX",0);m(this,"shearY",0);m(this,"ax",0);m(this,"ay",0);m(this,"arotation",0);m(this,"ascaleX",0);m(this,"ascaleY",0);m(this,"ashearX",0);m(this,"ashearY",0);m(this,"sorted",!1);m(this,"active",!1);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=n,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){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,n,r,s,o,l){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=o,this.ashearY=l;let c=this.parent,a=this.matrix,i=this.skeleton.scaleX,h=Dt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(!c){let g=this.skeleton,b=n+90+l;a.a=B.cosDeg(n+o)*r*i,a.c=B.cosDeg(b)*s*i,a.b=B.sinDeg(n+o)*r*h,a.d=B.sinDeg(b)*s*h,a.tx=t*i+g.x,a.ty=e*h+g.y;return}let d=c.matrix.a,u=c.matrix.c,p=c.matrix.b,f=c.matrix.d;switch(a.tx=d*t+u*e+c.matrix.tx,a.ty=p*t+f*e+c.matrix.ty,this.data.transformMode){case 0:{let g=n+90+l,b=B.cosDeg(n+o)*r,x=B.cosDeg(g)*s,y=B.sinDeg(n+o)*r,w=B.sinDeg(g)*s;a.a=d*b+u*y,a.c=d*x+u*w,a.b=p*b+f*y,a.d=p*x+f*w;return}case 1:{let g=n+90+l;a.a=B.cosDeg(n+o)*r,a.c=B.cosDeg(g)*s,a.b=B.sinDeg(n+o)*r,a.d=B.sinDeg(g)*s;break}case 2:{let g=d*d+p*p,b=0;g>1e-4?(g=Math.abs(d*f-u*p)/g,d/=i,p/=h,u=p*g,f=d*g,b=Math.atan2(p,d)*B.radDeg):(d=0,p=0,b=90-Math.atan2(f,u)*B.radDeg);let x=n+o-b,y=n+l-b+90,w=B.cosDeg(x)*r,k=B.cosDeg(y)*s,S=B.sinDeg(x)*r,I=B.sinDeg(y)*s;a.a=d*w-u*S,a.c=d*k-u*I,a.b=p*w+f*S,a.d=p*k+f*I;break}case 3:case 4:{let g=B.cosDeg(n),b=B.sinDeg(n),x=(d*g+u*b)/i,y=(p*g+f*b)/h,w=Math.sqrt(x*x+y*y);w>1e-5&&(w=1/w),x*=w,y*=w,w=Math.sqrt(x*x+y*y),this.data.transformMode==3&&d*f-u*p<0!=(i<0!=h<0)&&(w=-w);let k=Math.PI/2+Math.atan2(y,x),S=Math.cos(k)*w,I=Math.sin(k)*w,M=B.cosDeg(o)*r,v=B.cosDeg(90+l)*s,E=B.sinDeg(o)*r,C=B.sinDeg(90+l)*s;a.a=x*M+S*E,a.c=x*v+S*C,a.b=y*M+I*E,a.d=y*v+I*C;break}}a.a*=i,a.c*=i,a.b*=h,a.d*=h}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}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*B.radDeg}getWorldScaleX(){let t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){let t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){let t=this.parent,e=this.matrix;if(!t){this.ax=e.tx-this.skeleton.x,this.ay=e.ty-this.skeleton.y,this.arotation=Math.atan2(e.b,e.a)*B.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*B.radDeg;return}let n=t.matrix,r=1/(n.a*n.d-n.b*n.c),s=e.tx-n.tx,o=e.ty-n.ty;this.ax=s*n.d*r-o*n.c*r,this.ay=o*n.a*r-s*n.b*r;let l=r*n.d,c=r*n.a,a=r*n.c,i=r*n.b,h=l*e.a-a*e.b,d=l*e.c-a*e.d,u=c*e.b-i*e.a,p=c*e.d-i*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(h*h+u*u),this.ascaleX>1e-4){let f=h*p-d*u;this.ascaleY=f/this.ascaleX,this.ashearY=Math.atan2(h*d+u*p,f)*B.radDeg,this.arotation=Math.atan2(u,h)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*B.radDeg}worldToLocal(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=1/(n*o-r*s),c=t.x-e.tx,a=t.y-e.ty;return t.x=c*o*l-a*r*l,t.y=a*n*l-c*s*l,t}localToWorld(t){let e=this.matrix,n=t.x,r=t.y;return t.x=n*e.a+r*e.c+e.tx,t.y=n*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*n,r.d*n-r.c*e)*B.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(n*r.b+e*r.d,n*r.a+e*r.c)*B.radDeg}rotateWorld(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=B.cosDeg(t),c=B.sinDeg(t);e.a=l*n-c*s,e.c=l*r-c*o,e.b=c*n+l*s,e.d=c*r+l*o}};var ua=class{constructor(t,e,n){m(this,"index",0);m(this,"name");m(this,"parent",null);m(this,"length",0);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"shearX",0);m(this,"shearY",0);m(this,"transformMode",0);m(this,"skinRequired",!1);m(this,"color",new $);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=n}};var Mr=class{constructor(t,e,n){this.name=t;this.order=e;this.skinRequired=n}};var fa=class{constructor(t,e){m(this,"data");m(this,"intValue",0);m(this,"floatValue",0);m(this,"stringValue",null);m(this,"time",0);m(this,"volume",0);m(this,"balance",0);if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};var pa=class{constructor(t){m(this,"name");m(this,"intValue",0);m(this,"floatValue",0);m(this,"stringValue",null);m(this,"audioPath",null);m(this,"volume",0);m(this,"balance",0);this.name=t}};var Vl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"bendDirection",0);m(this,"compress",!1);m(this,"stretch",!1);m(this,"mix",1);m(this,"softness",0);m(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let s=e.findBone(t.bones[r].name);if(!s)throw new Error(`Couldn't find bone ${t.bones[r].name}`);this.bones.push(s)}let n=e.findBone(t.target.name);if(!n)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=n}isActive(){return this.active}update(){if(this.mix==0)return;let t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,n,r,s,o,l){let c=t.parent.matrix;if(!c)throw new Error("IK bone must have parent.");let a=c.a,i=c.c,h=c.b,d=c.d,u=-t.ashearX-t.arotation,p=0,f=0,g=t.skeleton.scaleX,b=Dt.yDown?-t.skeleton.scaleY:t.skeleton.scaleY;switch(t.data.transformMode){case 1:p=e-t.worldX,f=n-t.worldY,Dt.yDown&&(f=-f);break;case 2:let w=Math.abs(a*d-i*h)/(a*a+h*h),k=a/g,S=h/b;i=-S*w*g,d=k*w*b,u+=Math.atan2(S,k)*B.radDeg;default:let I=e-c.tx,M=n-c.ty,v=a*d-i*h;p=(I*d-M*i)/v-t.ax,f=(M*a-I*h)/v-t.ay}u+=Math.atan2(f,p)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let x=t.ascaleX,y=t.ascaleY;if(r||s){switch(t.data.transformMode){case 3:case 4:p=e-t.worldX,f=n-t.worldY}let w=t.data.length*x,k=Math.sqrt(p*p+f*f);if(r&&k<w||s&&k>w&&w>1e-4){let S=(k/w-1)*l+1;x*=S,o&&(y*=S)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,x,y,t.ashearX,t.ashearY)}apply2(t,e,n,r,s,o,l,c,a){let i=t.ax,h=t.ay,d=t.ascaleX,u=t.ascaleY,p=d,f=u,g=e.ascaleX,b=t.matrix,x=0,y=0,w=0;d<0?(d=-d,x=180,w=-1):(x=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,y=180):y=0;let k=e.ax,S=0,I=0,M=0,v=b.a,E=b.c,C=b.b,T=b.d,F=Math.abs(d-u)<=1e-4;!F||o?(S=0,I=v*k+b.tx,M=C*k+b.ty):(S=e.ay,I=v*k+E*S+b.tx,M=C*k+T*S+b.ty);let D=t.parent.matrix;if(!D)throw new Error("IK parent must itself have a parent.");v=D.a,E=D.c,C=D.b,T=D.d;let V=1/(v*T-E*C),X=I-D.tx,N=M-D.ty,q=(X*T-N*E)*V-i,L=(N*v-X*C)*V-h,R=Math.sqrt(q*q+L*L),P=e.data.length*g,H,U;if(R<1e-4){this.apply1(t,n,r,!1,o,!1,a),e.updateWorldTransformWith(k,S,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}X=n-D.tx,N=r-D.ty;let z=(X*T-N*E)*V-i,O=(N*v-X*C)*V-h,Z=z*z+O*O;if(c!=0){c*=d*(g+1)*.5;let et=Math.sqrt(Z),st=et-R-P*d+c;if(st>0){let dt=Math.min(1,st/(c*2))-1;dt=(st-c*(1-dt*dt))/et,z-=dt*z,O-=dt*O,Z=z*z+O*O}}t:if(F){P*=d;let et=(Z-R*R-P*P)/(2*R*P);et<-1?(et=-1,U=Math.PI*s):et>1?(et=1,U=0,o&&(v=(Math.sqrt(Z)/(R+P)-1)*a+1,p*=v,l&&(f*=v))):U=Math.acos(et)*s,v=R+P*et,E=P*Math.sin(U),H=Math.atan2(O*v-z*E,z*v+O*E)}else{v=d*P,E=u*P;let et=v*v,st=E*E,dt=Math.atan2(O,z);C=st*R*R+et*Z-et*st;let Mt=-2*st*R,Bt=st-et;if(T=Mt*Mt-4*Bt*C,T>=0){let Jt=Math.sqrt(T);Mt<0&&(Jt=-Jt),Jt=-(Mt+Jt)*.5;let on=Jt/Bt,Vo=C/Jt,Ue=Math.abs(on)<Math.abs(Vo)?on:Vo;if(Ue*Ue<=Z){N=Math.sqrt(Z-Ue*Ue)*s,H=dt-Math.atan2(N,Ue),U=Math.atan2(N/u,(Ue-R)/d);break t}}let jt=B.PI,Rt=R-v,Xt=Rt*Rt,Wt=0,Zt=0,Lt=R+v,Kt=Lt*Lt,ke=0;C=-v*R/(et-st),C>=-1&&C<=1&&(C=Math.acos(C),X=v*Math.cos(C)+R,N=E*Math.sin(C),T=X*X+N*N,T<Xt&&(jt=C,Xt=T,Rt=X,Wt=N),T>Kt&&(Zt=C,Kt=T,Lt=X,ke=N)),Z<=(Xt+Kt)*.5?(H=dt-Math.atan2(Wt*s,Rt),U=jt*s):(H=dt-Math.atan2(ke*s,Lt),U=Zt*s)}let K=Math.atan2(S,k)*w,it=t.arotation;H=(H-K)*B.radDeg+x-it,H>180?H-=360:H<-180&&(H+=360),t.updateWorldTransformWith(i,h,it+H*a,p,f,0,0),it=e.arotation,U=((U+K)*B.radDeg-e.ashearX)*w+y-it,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(k,S,it+U*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};var ga=class extends Mr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"_target",null);m(this,"bendDirection",1);m(this,"compress",!1);m(this,"stretch",!1);m(this,"uniform",!1);m(this,"mix",1);m(this,"softness",0)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}};var ba=class extends Mr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"_target",null);m(this,"positionMode",0);m(this,"spacingMode",1);m(this,"rotateMode",1);m(this,"offsetRotation",0);m(this,"position",0);m(this,"spacing",0);m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},po=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(po||{});var Xe=class Xe{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"position",0);m(this,"spacing",0);m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"spaces",new Array);m(this,"positions",new Array);m(this,"world",new Array);m(this,"curves",new Array);m(this,"lengths",new Array);m(this,"segments",new Array);m(this,"active",!1);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 r=0,s=t.bones.length;r<s;r++){let o=e.findBone(t.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(o)}let n=e.findSlot(t.target.name);if(!n)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=n,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}update(){let t=this.target.getAttachment();if(!(t instanceof Hn))return;let e=this.mixRotate,n=this.mixX,r=this.mixY;if(e==0&&n==0&&r==0)return;let s=this.data,o=s.rotateMode==0,l=s.rotateMode==2,c=this.bones,a=c.length,i=o?a:a+1,h=Y.setArraySize(this.spaces,i),d=l?this.lengths=Y.setArraySize(this.lengths,a):[],u=this.spacing;switch(s.spacingMode){case 2:if(l)for(let k=0,S=i-1;k<S;k++){let I=c[k],M=I.data.length;if(M<Xe.epsilon)d[k]=0;else{let v=M*I.matrix.a,E=M*I.matrix.b;d[k]=Math.sqrt(v*v+E*E)}}Y.arrayFill(h,1,i,u);break;case 3:let y=0;for(let k=0,S=i-1;k<S;){let I=c[k],M=I.data.length;if(M<Xe.epsilon)l&&(d[k]=0),h[++k]=u;else{let v=M*I.matrix.a,E=M*I.matrix.b,C=Math.sqrt(v*v+E*E);l&&(d[k]=C),h[++k]=C,y+=C}}if(y>0){y=i/y*u;for(let k=1;k<i;k++)h[k]*=y}break;default:let w=s.spacingMode==0;for(let k=0,S=i-1;k<S;){let I=c[k],M=I.data.length;if(M<Xe.epsilon)l&&(d[k]=0),h[++k]=u;else{let v=M*I.matrix.a,E=M*I.matrix.b,C=Math.sqrt(v*v+E*E);l&&(d[k]=C),h[++k]=(w?M+u:u)*C/M}}}let p=this.computeWorldPositions(t,i,o),f=p[0],g=p[1],b=s.offsetRotation,x=!1;if(b==0)x=s.rotateMode==1;else{x=!1;let y=this.target.bone.matrix;b*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,w=3;y<a;y++,w+=3){let k=c[y],S=k.matrix;S.tx+=(f-S.tx)*n,S.ty+=(g-S.ty)*r;let I=p[w],M=p[w+1],v=I-f,E=M-g;if(l){let C=d[y];if(C!=0){let T=(Math.sqrt(v*v+E*E)/C-1)*e+1;S.a*=T,S.b*=T}}if(f=I,g=M,e>0){let C=S.a,T=S.c,F=S.b,D=S.d,V=0,X=0,N=0;if(o?V=p[w-1]:h[y+1]==0?V=p[w+2]:V=Math.atan2(E,v),V-=Math.atan2(F,C),x){X=Math.cos(V),N=Math.sin(V);let q=k.data.length;f+=(q*(X*C-N*F)-v)*e,g+=(q*(N*C+X*F)-E)*e}else V+=b;V>B.PI?V-=B.PI2:V<-B.PI&&(V+=B.PI2),V*=e,X=Math.cos(V),N=Math.sin(V),S.a=X*C-N*F,S.c=X*T-N*D,S.b=N*C+X*F,S.d=N*T+X*D}k.updateAppliedTransform()}}computeWorldPositions(t,e,n){let r=this.target,s=this.position,o=this.spaces,l=Y.setArraySize(this.positions,e*3+2),c=this.world,a=t.closed,i=t.worldVerticesLength,h=i/6,d=Xe.NONE;if(!t.constantSpeed){let q=t.lengths;h-=a?1:2;let L=q[h];this.data.positionMode==1&&(s*=L);let R;switch(this.data.spacingMode){case 2:R=L;break;case 3:R=L/e;break;default:R=1}c=Y.setArraySize(this.world,8);for(let P=0,H=0,U=0;P<e;P++,H+=3){let z=o[P]*R;s+=z;let O=s;if(a)O%=L,O<0&&(O+=L),U=0;else if(O<0){d!=Xe.BEFORE&&(d=Xe.BEFORE,t.computeWorldVertices(r,2,4,c,0,2)),this.addBeforePosition(O,c,0,l,H);continue}else if(O>L){d!=Xe.AFTER&&(d=Xe.AFTER,t.computeWorldVertices(r,i-6,4,c,0,2)),this.addAfterPosition(O-L,c,0,l,H);continue}for(;;U++){let Z=q[U];if(!(O>Z)){if(U==0)O/=Z;else{let K=q[U-1];O=(O-K)/(Z-K)}break}}U!=d&&(d=U,a&&U==h?(t.computeWorldVertices(r,i-4,4,c,0,2),t.computeWorldVertices(r,0,4,c,4,2)):t.computeWorldVertices(r,U*6+2,8,c,0,2)),this.addCurvePosition(O,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,H,n||P>0&&z==0)}return l}a?(i+=2,c=Y.setArraySize(this.world,i),t.computeWorldVertices(r,2,i-4,c,0,2),t.computeWorldVertices(r,0,2,c,i-4,2),c[i-2]=c[0],c[i-1]=c[1]):(h--,i-=4,c=Y.setArraySize(this.world,i),t.computeWorldVertices(r,2,i,c,0,2));let u=Y.setArraySize(this.curves,h),p=0,f=c[0],g=c[1],b=0,x=0,y=0,w=0,k=0,S=0,I=0,M=0,v=0,E=0,C=0,T=0,F=0,D=0;for(let q=0,L=2;q<h;q++,L+=6)b=c[L],x=c[L+1],y=c[L+2],w=c[L+3],k=c[L+4],S=c[L+5],I=(f-b*2+y)*.1875,M=(g-x*2+w)*.1875,v=((b-y)*3-f+k)*.09375,E=((x-w)*3-g+S)*.09375,C=I*2+v,T=M*2+E,F=(b-f)*.75+I+v*.16666667,D=(x-g)*.75+M+E*.16666667,p+=Math.sqrt(F*F+D*D),F+=C,D+=T,C+=v,T+=E,p+=Math.sqrt(F*F+D*D),F+=C,D+=T,p+=Math.sqrt(F*F+D*D),F+=C+v,D+=T+E,p+=Math.sqrt(F*F+D*D),u[q]=p,f=k,g=S;this.data.positionMode==1&&(s*=p);let V;switch(this.data.spacingMode){case 2:V=p;break;case 3:V=p/e;break;default:V=1}let X=this.segments,N=0;for(let q=0,L=0,R=0,P=0;q<e;q++,L+=3){let H=o[q]*V;s+=H;let U=s;if(a)U%=p,U<0&&(U+=p),R=0;else if(U<0){this.addBeforePosition(U,c,0,l,L);continue}else if(U>p){this.addAfterPosition(U-p,c,i-4,l,L);continue}for(;;R++){let z=u[R];if(!(U>z)){if(R==0)U/=z;else{let O=u[R-1];U=(U-O)/(z-O)}break}}if(R!=d){d=R;let z=R*6;for(f=c[z],g=c[z+1],b=c[z+2],x=c[z+3],y=c[z+4],w=c[z+5],k=c[z+6],S=c[z+7],I=(f-b*2+y)*.03,M=(g-x*2+w)*.03,v=((b-y)*3-f+k)*.006,E=((x-w)*3-g+S)*.006,C=I*2+v,T=M*2+E,F=(b-f)*.3+I+v*.16666667,D=(x-g)*.3+M+E*.16666667,N=Math.sqrt(F*F+D*D),X[0]=N,z=1;z<8;z++)F+=C,D+=T,C+=v,T+=E,N+=Math.sqrt(F*F+D*D),X[z]=N;F+=C,D+=T,N+=Math.sqrt(F*F+D*D),X[8]=N,F+=C+v,D+=T+E,N+=Math.sqrt(F*F+D*D),X[9]=N,P=0}for(U*=N;;P++){let z=X[P];if(!(U>z)){if(P==0)U/=z;else{let O=X[P-1];U=P+(U-O)/(z-O)}break}}this.addCurvePosition(U*.1,f,g,b,x,y,w,k,S,l,L,n||q>0&&H==0)}return l}addBeforePosition(t,e,n,r,s){let o=e[n],l=e[n+1],c=e[n+2]-o,a=e[n+3]-l,i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addAfterPosition(t,e,n,r,s){let o=e[n+2],l=e[n+3],c=o-e[n],a=l-e[n+1],i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addCurvePosition(t,e,n,r,s,o,l,c,a,i,h,d){if(t==0||isNaN(t)){i[h]=e,i[h+1]=n,i[h+2]=Math.atan2(s-n,r-e);return}let u=t*t,p=u*t,f=1-t,g=f*f,b=g*f,x=f*t,y=x*3,w=f*y,k=y*t,S=e*b+r*w+o*k+c*p,I=n*b+s*w+l*k+a*p;i[h]=S,i[h+1]=I,d&&(t<.001?i[h+2]=Math.atan2(s-n,r-e):i[h+2]=Math.atan2(I-(n*g+s*x*2+l*u),S-(e*g+r*x*2+o*u)))}};m(Xe,"NONE",-1),m(Xe,"BEFORE",-2),m(Xe,"AFTER",-3),m(Xe,"epsilon",1e-5);var Rl=Xe;var Pl=class{constructor(t,e){m(this,"blendMode");m(this,"data");m(this,"bone");m(this,"color");m(this,"darkColor",null);m(this,"attachment",null);m(this,"attachmentState",0);m(this,"sequenceIndex",-1);m(this,"deform",new Array);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 $,this.darkColor=t.darkColor?new $:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof be)||!(this.attachment instanceof be)||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}};var Yl=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"mixScaleX",0);m(this,"mixScaleY",0);m(this,"mixShearY",0);m(this,"temp",new Ae);m(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let s=e.findBone(t.bones[r].name);if(!s)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(s)}let n=e.findBone(t.target.name);if(!n)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=n}isActive(){return this.active}update(){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleX==0&&this.mixShearY==0||(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,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=e!=0||n!=0,c=this.target,a=c.matrix,i=a.a,h=a.c,d=a.b,u=a.d,p=i*u-h*d>0?B.degRad:-B.degRad,f=this.data.offsetRotation*p,g=this.data.offsetShearY*p,b=this.bones;for(let x=0,y=b.length;x<y;x++){let w=b[x],k=w.matrix;if(t!=0){let S=k.a,I=k.c,M=k.b,v=k.d,E=Math.atan2(d,i)-Math.atan2(M,S)+f;E>B.PI?E-=B.PI2:E<-B.PI&&(E+=B.PI2),E*=t;let C=Math.cos(E),T=Math.sin(E);k.a=C*S-T*M,k.c=C*I-T*v,k.b=T*S+C*M,k.d=T*I+C*v}if(l){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),k.tx+=(S.x-k.tx)*e,k.ty+=(S.y-k.ty)*n}if(r!=0){let S=Math.sqrt(k.a*k.a+k.b*k.b);S!=0&&(S=(S+(Math.sqrt(i*i+d*d)-S+this.data.offsetScaleX)*r)/S),k.a*=S,k.b*=S}if(s!=0){let S=Math.sqrt(k.c*k.c+k.d*k.d);S!=0&&(S=(S+(Math.sqrt(h*h+u*u)-S+this.data.offsetScaleY)*s)/S),k.c*=S,k.d*=S}if(o>0){let S=k.c,I=k.d,M=Math.atan2(I,S),v=Math.atan2(u,h)-Math.atan2(d,i)-(M-Math.atan2(k.b,k.a));v>B.PI?v-=B.PI2:v<-B.PI&&(v+=B.PI2),v=M+(v+g)*o;let E=Math.sqrt(S*S+I*I);k.c=Math.cos(v)*E,k.d=Math.sin(v)*E}w.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=e!=0||n!=0,c=this.target,a=c.matrix,i=a.a,h=a.c,d=a.b,u=a.d,p=i*u-h*d>0?B.degRad:-B.degRad,f=this.data.offsetRotation*p,g=this.data.offsetShearY*p,b=this.bones;for(let x=0,y=b.length;x<y;x++){let w=b[x],k=w.matrix;if(t!=0){let S=k.a,I=k.c,M=k.b,v=k.d,E=Math.atan2(d,i)+f;E>B.PI?E-=B.PI2:E<-B.PI&&(E+=B.PI2),E*=t;let C=Math.cos(E),T=Math.sin(E);k.a=C*S-T*M,k.c=C*I-T*v,k.b=T*S+C*M,k.d=T*I+C*v}if(l){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),k.tx+=S.x*e,k.ty+=S.y*n}if(r!=0){let S=(Math.sqrt(i*i+d*d)-1+this.data.offsetScaleX)*r+1;k.a*=S,k.b*=S}if(s!=0){let S=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleY)*s+1;k.c*=S,k.d*=S}if(o>0){let S=Math.atan2(u,h)-Math.atan2(d,i);S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2);let I=k.c,M=k.d;S=Math.atan2(M,I)+(S-B.PI/2+g)*o;let v=Math.sqrt(I*I+M*M);k.c=Math.cos(S)*v,k.d=Math.sin(S)*v}w.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=this.target,c=this.bones;for(let a=0,i=c.length;a<i;a++){let h=c[a],d=h.arotation;if(t!=0){let x=l.arotation-d+this.data.offsetRotation;x-=(16384-(16384.499999999996-x/360|0))*360,d+=x*t}let u=h.ax,p=h.ay;u+=(l.ax-u+this.data.offsetX)*e,p+=(l.ay-p+this.data.offsetY)*n;let f=h.ascaleX,g=h.ascaleY;r!=0&&f!=0&&(f=(f+(l.ascaleX-f+this.data.offsetScaleX)*r)/f),s!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*s)/g);let b=h.ashearY;if(o!=0){let x=l.ashearY-b+this.data.offsetShearY;x-=(16384-(16384.499999999996-x/360|0))*360,b+=x*o}h.updateWorldTransformWith(u,p,d,f,g,h.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=this.target,c=this.bones;for(let a=0,i=c.length;a<i;a++){let h=c[a],d=h.arotation+(l.arotation+this.data.offsetRotation)*t,u=h.ax+(l.ax+this.data.offsetX)*e,p=h.ay+(l.ay+this.data.offsetY)*n,f=h.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*r+1),g=h.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*s+1),b=h.ashearY+(l.ashearY+this.data.offsetShearY)*o;h.updateWorldTransformWith(u,p,d,f,g,h.ashearX,b)}}};var xa=class xa{constructor(t){m(this,"data");m(this,"bones");m(this,"slots");m(this,"drawOrder");m(this,"ikConstraints");m(this,"transformConstraints");m(this,"pathConstraints");m(this,"_updateCache",new Array);m(this,"skin",null);m(this,"color");m(this,"scaleX",1);m(this,"scaleY",1);m(this,"x",0);m(this,"y",0);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 n=t.bones[e],r;if(!n.parent)r=new fo(n,this,null);else{let s=this.bones[n.parent.index];r=new fo(n,this,s),s.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let n=t.slots[e],r=this.bones[n.boneData.index],s=new Pl(n,r);this.slots.push(s),this.drawOrder.push(s)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let n=t.ikConstraints[e];this.ikConstraints.push(new Vl(n,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let n=t.transformConstraints[e];this.transformConstraints.push(new Yl(n,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let n=t.pathConstraints[e];this.pathConstraints.push(new Rl(n,this))}this.color=new $(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let i=0,h=e.length;i<h;i++){let d=e[i];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let i=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let u=this.bones[i[h].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u)}}let n=this.ikConstraints,r=this.transformConstraints,s=this.pathConstraints,o=n.length,l=r.length,c=s.length,a=o+l+c;t:for(let i=0;i<a;i++){for(let h=0;h<o;h++){let d=n[h];if(d.data.order==i){this.sortIkConstraint(d);continue t}}for(let h=0;h<l;h++){let d=r[h];if(d.data.order==i){this.sortTransformConstraint(d);continue t}}for(let h=0;h<c;h++){let d=s[h];if(d.data.order==i){this.sortPathConstraint(d);continue t}}}for(let i=0,h=e.length;i<h;i++)this.sortBone(e[i])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let n=t.bones,r=n[0];if(this.sortBone(r),n.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let s=n[n.length-1];this.sortBone(s),this._updateCache.push(t),this.sortReset(r.children),s.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,n=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(let c=0,a=this.data.skins.length;c<a;c++)this.sortPathConstraintAttachment(this.data.skins[c],n,r);let s=e.getAttachment();s instanceof Hn&&this.sortPathConstraintAttachmentWith(s,r);let o=t.bones,l=o.length;for(let c=0;c<l;c++)this.sortBone(o[c]);this._updateCache.push(t);for(let c=0;c<l;c++)this.sortReset(o[c].children);for(let c=0;c<l;c++)o[c].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,n=e.length;if(t.data.local)for(let r=0;r<n;r++){let s=e[r];this.sortBone(s.parent),this.sortBone(s)}else for(let r=0;r<n;r++)this.sortBone(e[r]);this._updateCache.push(t);for(let r=0;r<n;r++)this.sortReset(e[r].children);for(let r=0;r<n;r++)e[r].sorted=!0}sortPathConstraintAttachment(t,e,n){let r=t.attachments[e];if(r)for(let s in r)this.sortPathConstraintAttachmentWith(r[s],n)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Hn))return;let n=t.bones;if(!n)this.sortBone(e);else{let r=this.bones;for(let s=0,o=n.length;s<o;){let l=n[s++];for(l+=s;s<l;)this.sortBone(r[n[s++]])}}}sortBone(t){if(!t||t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,n=t.length;e<n;e++){let r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(){let t=this.bones;for(let n=0,r=t.length;n<r;n++){let s=t[n];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 e=this._updateCache;for(let n=0,r=e.length;n<r;n++)e[n].update()}updateWorldTransformWith(t){let e=this.getRootBone(),n=t.matrix.a,r=t.matrix.c,s=t.matrix.b,o=t.matrix.d;e.matrix.tx=n*this.x+r*this.y+t.worldX,e.matrix.ty=s*this.x+o*this.y+t.worldY;let l=e.rotation+90+e.shearY,c=B.cosDeg(e.rotation+e.shearX)*e.scaleX,a=B.cosDeg(l)*e.scaleY,i=B.sinDeg(e.rotation+e.shearX)*e.scaleX,h=B.sinDeg(l)*e.scaleY,d=this.scaleX,u=Dt.yDown?-this.scaleY:this.scaleY;e.matrix.a=(n*c+r*i)*d,e.matrix.c=(n*a+r*h)*d,e.matrix.b=(s*c+o*i)*u,e.matrix.d=(s*a+o*h)*u;let p=this._updateCache;for(let f=0,g=p.length;f<g;f++){let b=p[f];b!=e&&b.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let t=this.bones;for(let s=0,o=t.length;s<o;s++)t[s].setToSetupPose();let e=this.ikConstraints;for(let s=0,o=e.length;s<o;s++){let l=e[s];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let n=this.transformConstraints;for(let s=0,o=n.length;s<o;s++){let l=n[s],c=l.data;l.mixRotate=c.mixRotate,l.mixX=c.mixX,l.mixY=c.mixY,l.mixScaleX=c.mixScaleX,l.mixScaleY=c.mixScaleY,l.mixShearY=c.mixShearY}let r=this.pathConstraints;for(let s=0,o=r.length;s<o;s++){let l=r[s],c=l.data;l.position=c.position,l.spacing=c.spacing,l.mixRotate=c.mixRotate,l.mixX=c.mixX,l.mixY=c.mixY}}setSlotsToSetupPose(){let t=this.slots;Y.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,n=t.length;e<n;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}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 n=0,r=e.length;n<r;n++){let s=e[n],o=s.data.attachmentName;if(o){let l=t.getAttachment(n,o);l&&s.setAttachment(l)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let n=this.data.findSlot(t);if(!n)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(n.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let n=this.skin.getAttachment(t,e);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let n=this.slots;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(o.data.name==t){let l=null;if(e&&(l=this.getAttachment(r,e),!l))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);o.setAttachment(l);return}}throw new Error(`Slot not found: ${t}`)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}getBoundsRect(){let t=new Ae,e=new Ae;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,n=new Array(2)){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let r=this.drawOrder,s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let a=0,i=r.length;a<i;a++){let h=r[a];if(!h.bone.active)continue;let d=0,u=null,p=h.getAttachment();if(p instanceof $s)d=8,u=Y.setArraySize(n,d,0),p.computeWorldVertices(h,u,0,2);else if(p instanceof Ar){let f=p;d=f.worldVerticesLength,u=Y.setArraySize(n,d,0),f.computeWorldVertices(h,0,d,u,0,2)}if(u)for(let f=0,g=u.length;f<g;f+=2){let b=u[f],x=u[f+1];s=Math.min(s,b),o=Math.min(o,x),l=Math.max(l,b),c=Math.max(c,x)}}t.set(s,o),e.set(l-s,c-o)}get flipX(){return this.scaleX==-1}set flipX(t){xa.deprecatedWarning1||(xa.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=t?1:-1}get flipY(){return this.scaleY==-1}set flipY(t){xa.deprecatedWarning1||(xa.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=t?1:-1}};m(xa,"deprecatedWarning1",!1);var Xl=xa;var ya=class{constructor(){m(this,"name",null);m(this,"bones",new Array);m(this,"slots",new Array);m(this,"skins",new Array);m(this,"defaultSkin",null);m(this,"events",new Array);m(this,"animations",new Array);m(this,"ikConstraints",new Array);m(this,"transformConstraints",new Array);m(this,"pathConstraints",new Array);m(this,"x",0);m(this,"y",0);m(this,"width",0);m(this,"height",0);m(this,"version",null);m(this,"hash",null);m(this,"fps",0);m(this,"imagesPath",null);m(this,"audioPath",null)}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}};var wa=class{constructor(t,e,n){m(this,"index",0);m(this,"name");m(this,"boneData");m(this,"color",new $(1,1,1,1));m(this,"darkColor",null);m(this,"attachmentName",null);m(this,"blendMode",0);if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}};var Sa=class extends Mr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"_target",null);m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"mixScaleX",0);m(this,"mixScaleY",0);m(this,"mixShearY",0);m(this,"offsetRotation",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"offsetScaleX",0);m(this,"offsetScaleY",0);m(this,"offsetShearY",0);m(this,"relative",!1);m(this,"local",!1)}set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}};var Ll=class{constructor(t,e,n){this.slotIndex=t;this.name=e;this.attachment=n}},_r=class{constructor(t){m(this,"name");m(this,"attachments",new Array);m(this,"bones",Array());m(this,"constraints",new Array);if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,n){if(!n)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]=n}addSkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];r.attachment&&(r.attachment instanceof Ar?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){let n=this.attachments[t];return n?n[e]:null}removeAttachment(t,e){let n=this.attachments[t];n&&delete n[e]}getAttachments(){let t=new Array;for(let e=0;e<this.attachments.length;e++){let n=this.attachments[e];if(n)for(let r in n){let s=n[r];s&&t.push(new Ll(e,r,s))}}return t}getAttachmentsForSlot(t,e){let n=this.attachments[t];if(n)for(let r in n){let s=n[r];s&&e.push(new Ll(t,r,s))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let n=0;for(let r=0;r<t.slots.length;r++){let s=t.slots[r],o=s.getAttachment();if(o&&n<e.attachments.length){let l=e.attachments[n];for(let c in l){let a=l[c];if(o==a){let i=this.getAttachment(n,c);i&&s.setAttachment(i);break}}}n++}}};var go=class{constructor(t){m(this,"ver40",!1);m(this,"scale",1);m(this,"attachmentLoader");m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new ya;n.name="";let r=new ln(t),s=r.readInt32(),o=r.readInt32();n.hash=o==0&&s==0?null:o.toString(16)+s.toString(16),n.version=r.readString();let l=n.version.substr(0,3);if(l!=="4.0"&&l!=="4.1"){let h=`Spine 4.1 loader cant load version ${n.version}. Please configure your pixi-spine bundle`;console.error(h)}this.ver40=l==="4.0",n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat();let c=r.readBoolean();c&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let h=0;h<a;h++){let d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}a=r.readInt(!0);for(let h=0;h<a;h++){let d=r.readString();if(!d)throw new Error("Bone name must not be null.");let u=h==0?null:n.bones[r.readInt(!0)],p=new ua(h,d,u);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),c&&$.rgba8888ToColor(p.color,r.readInt32()),n.bones.push(p)}a=r.readInt(!0);for(let h=0;h<a;h++){let d=r.readString();if(!d)throw new Error("Slot name must not be null.");let u=n.bones[r.readInt(!0)],p=new wa(h,d,u);$.rgba8888ToColor(p.color,r.readInt32());let f=r.readInt32();f!=-1&&$.rgb888ToColor(p.darkColor=new $,f),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),n.slots.push(p)}a=r.readInt(!0);for(let h=0,d;h<a;h++){let u=r.readString();if(!u)throw new Error("IK constraint data name must not be null.");let p=new ga(u);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let f=0;f<d;f++)p.bones.push(n.bones[r.readInt(!0)]);p.target=n.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),n.ikConstraints.push(p)}a=r.readInt(!0);for(let h=0,d;h<a;h++){let u=r.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let p=new Sa(u);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let f=0;f<d;f++)p.bones.push(n.bones[r.readInt(!0)]);p.target=n.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),n.transformConstraints.push(p)}a=r.readInt(!0);for(let h=0,d;h<a;h++){let u=r.readString();if(!u)throw new Error("Path constraint data name must not be null.");let p=new ba(u);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let f=0;f<d;f++)p.bones.push(n.bones[r.readInt(!0)]);p.target=n.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==0&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==0||p.spacingMode==1)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),n.pathConstraints.push(p)}let i=this.readSkin(r,n,!0,c);i&&(n.defaultSkin=i,n.skins.push(i));{let h=n.skins.length;for(Y.setArraySize(n.skins,a=h+r.readInt(!0));h<a;h++){let d=this.readSkin(r,n,!1,c);if(!d)throw new Error("readSkin() should not have returned null.");n.skins[h]=d}}a=this.linkedMeshes.length;for(let h=0;h<a;h++){let d=this.linkedMeshes[h],u=d.skin?n.findSkin(d.skin):n.defaultSkin;if(!u)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");let p=u.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,a=r.readInt(!0);for(let h=0;h<a;h++){let d=r.readStringRef();if(!d)throw new Error;let u=new pa(d);u.intValue=r.readInt(!1),u.floatValue=r.readFloat(),u.stringValue=r.readString(),u.audioPath=r.readString(),u.audioPath&&(u.volume=r.readFloat(),u.balance=r.readFloat()),n.events.push(u)}a=r.readInt(!0);for(let h=0;h<a;h++){let d=r.readString();if(!d)throw new Error("Animatio name must not be null.");n.animations.push(this.readAnimation(r,d,n))}return n}readSkin(t,e,n,r){let s=null,o=0;if(n){if(o=t.readInt(!0),o==0)return null;s=new _r("default")}else{let l=t.readStringRef();if(!l)throw new Error("Skin name must not be null.");s=new _r(l),s.bones.length=t.readInt(!0);for(let c=0,a=s.bones.length;c<a;c++)s.bones[c]=e.bones[t.readInt(!0)];for(let c=0,a=t.readInt(!0);c<a;c++)s.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let c=0,a=t.readInt(!0);c<a;c++)s.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let c=0,a=t.readInt(!0);c<a;c++)s.constraints.push(e.pathConstraints[t.readInt(!0)]);o=t.readInt(!0)}for(let l=0;l<o;l++){let c=t.readInt(!0);for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,s,c,h,r);d&&s.setAttachment(c,h,d)}}return s}readAttachment(t,e,n,r,s,o){let l=this.scale,c=t.readStringRef();switch(c||(c=s),t.readByte()){case 0:{let a=t.readStringRef(),i=t.readFloat(),h=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),f=t.readFloat(),g=t.readFloat(),b=t.readInt32(),x=this.readSequence(t);a||(a=c);let y=this.attachmentLoader.newRegionAttachment(n,c,a,x);return y?(y.path=a,y.x=h*l,y.y=d*l,y.scaleX=u,y.scaleY=p,y.rotation=i,y.width=f*l,y.height=g*l,$.rgba8888ToColor(y.color,b),y.sequence=x,x==null&&y.updateRegion(),y):null}case 1:{let a=t.readInt(!0),i=this.readVertices(t,a),h=o?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(n,c);return d?(d.worldVerticesLength=a<<1,d.vertices=i.vertices,d.bones=i.bones,o&&$.rgba8888ToColor(d.color,h),d):null}case 2:{let a=t.readStringRef(),i=t.readInt32(),h=t.readInt(!0),d=this.readFloatArray(t,h<<1,1),u=this.readShortArray(t),p=this.readVertices(t,h),f=t.readInt(!0),g=this.readSequence(t),b=[],x=0,y=0;o&&(b=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),a||(a=c);let w=this.attachmentLoader.newMeshAttachment(n,c,a,g);return w?(w.path=a,$.rgba8888ToColor(w.color,i),w.bones=p.bones,w.vertices=p.vertices,w.worldVerticesLength=h<<1,w.triangles=u,w.regionUVs=new Float32Array(d),w.hullLength=f<<1,w.sequence=g,o&&(w.edges=b,w.width=x*l,w.height=y*l),w):null}case 3:{let a=t.readStringRef(),i=t.readInt32(),h=t.readStringRef(),d=t.readStringRef(),u=t.readBoolean(),p=this.readSequence(t),f=0,g=0;o&&(f=t.readFloat(),g=t.readFloat()),a||(a=c);let b=this.attachmentLoader.newMeshAttachment(n,c,a,p);return b?(b.path=a,$.rgba8888ToColor(b.color,i),b.sequence=p,o&&(b.width=f*l,b.height=g*l),this.linkedMeshes.push(new rm(b,h,r,d,u)),b):null}case 4:{let a=t.readBoolean(),i=t.readBoolean(),h=t.readInt(!0),d=this.readVertices(t,h),u=Y.newArray(h/3,0);for(let g=0,b=u.length;g<b;g++)u[g]=t.readFloat()*l;let p=o?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(n,c);return f?(f.closed=a,f.constantSpeed=i,f.worldVerticesLength=h<<1,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,o&&$.rgba8888ToColor(f.color,p),f):null}case 5:{let a=t.readFloat(),i=t.readFloat(),h=t.readFloat(),d=o?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(n,c);return u?(u.x=i*l,u.y=h*l,u.rotation=a,o&&$.rgba8888ToColor(u.color,d),u):null}case 6:{let a=t.readInt(!0),i=t.readInt(!0),h=this.readVertices(t,i),d=o?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(n,c);return u?(u.endSlot=e.slots[a],u.worldVerticesLength=i<<1,u.vertices=h.vertices,u.bones=h.bones,o&&$.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;let e=new zs(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?xd:t.readByte()}readVertices(t,e){let n=this.scale,r=e<<1,s=new sm;if(!t.readBoolean())return s.vertices=this.readFloatArray(t,r,n),s;let o=new Array,l=new Array;for(let c=0;c<e;c++){let a=t.readInt(!0);l.push(a);for(let i=0;i<a;i++)l.push(t.readInt(!0)),o.push(t.readFloat()*n),o.push(t.readFloat()*n),o.push(t.readFloat())}return s.vertices=Y.toFloatArray(o),s.bones=l,s}readFloatArray(t,e,n){let r=new Array(e);if(n==1)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let s=0;s<e;s++)r[s]=t.readFloat()*n;return r}readShortArray(t){let e=t.readInt(!0),n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readShort();return n}readAnimation(t,e,n){t.readInt(!0);let r=new Array,s=this.scale;for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readByte(),f=t.readInt(!0),g=f-1;switch(p){case pu:{let b=new bn(f,h);for(let x=0;x<f;x++)b.setFrame(x,t.readFloat(),t.readStringRef());r.push(b);break}case gu:{let b=t.readInt(!0),x=new ea(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,v=0;x.setFrame(M,y,w,k,S,I),M!=g;M++){let E=t.readFloat(),C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case Bn:x.setStepped(M);break;case Fn:pt(t,x,v++,M,0,y,E,w,C,1),pt(t,x,v++,M,1,y,E,k,T,1),pt(t,x,v++,M,2,y,E,S,F,1),pt(t,x,v++,M,3,y,E,I,D,1)}y=E,w=C,k=T,S=F,I=D}r.push(x);break}case bu:{let b=t.readInt(!0),x=new na(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,w,k,S),I!=g;I++){let v=t.readFloat(),E=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;switch(t.readByte()){case Bn:x.setStepped(I);break;case Fn:pt(t,x,M++,I,0,y,v,w,E,1),pt(t,x,M++,I,1,y,v,k,C,1),pt(t,x,M++,I,2,y,v,S,T,1)}y=v,w=E,k=C,S=T}r.push(x);break}case xu:{let b=t.readInt(!0),x=new sa(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let C=0,T=0;x.setFrame(C,y,w,k,S,I,M,v,E),C!=g;C++){let F=t.readFloat(),D=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Bn:x.setStepped(C);break;case Fn:pt(t,x,T++,C,0,y,F,w,D,1),pt(t,x,T++,C,1,y,F,k,V,1),pt(t,x,T++,C,2,y,F,S,X,1),pt(t,x,T++,C,3,y,F,I,N,1),pt(t,x,T++,C,4,y,F,M,q,1),pt(t,x,T++,C,5,y,F,v,L,1),pt(t,x,T++,C,6,y,F,E,R,1)}y=F,w=D,k=V,S=X,I=N,M=q,v=L,E=R}r.push(x);break}case yu:{let b=t.readInt(!0),x=new aa(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let E=0,C=0;x.setFrame(E,y,w,k,S,I,M,v),E!=g;E++){let T=t.readFloat(),F=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case Bn:x.setStepped(E);break;case Fn:pt(t,x,C++,E,0,y,T,w,F,1),pt(t,x,C++,E,1,y,T,k,D,1),pt(t,x,C++,E,2,y,T,S,V,1),pt(t,x,C++,E,3,y,T,I,X,1),pt(t,x,C++,E,4,y,T,M,N,1),pt(t,x,C++,E,5,y,T,v,q,1)}y=T,w=F,k=D,S=V,I=X,M=N,v=q}r.push(x);break}case wu:{let b=new ra(f,t.readInt(!0),h),x=t.readFloat(),y=t.readUnsignedByte()/255;for(let w=0,k=0;b.setFrame(w,x,y),w!=g;w++){let S=t.readFloat(),I=t.readUnsignedByte()/255;switch(t.readByte()){case Bn:b.setStepped(w);break;case Fn:pt(t,b,k++,w,0,x,S,y,I,1)}x=S,y=I}r.push(b)}}}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readByte(),f=t.readInt(!0),g=t.readInt(!0);switch(p){case au:r.push(vr(t,new Gn(f,g,h),1));break;case iu:r.push(nm(t,new Hs(f,g,h),s));break;case ou:r.push(vr(t,new Gs(f,g,h),s));break;case lu:r.push(vr(t,new js(f,g,h),s));break;case cu:r.push(nm(t,new Zs(f,g,h),1));break;case hu:r.push(vr(t,new Ks(f,g,h),1));break;case mu:r.push(vr(t,new Js(f,g,h),1));break;case du:r.push(nm(t,new Qs(f,g,h),1));break;case uu:r.push(vr(t,new _s(f,g,h),1));break;case fu:r.push(vr(t,new ta(f,g,h),1))}}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=t.readInt(!0),u=d-1,p=new oa(d,t.readInt(!0),h),f=t.readFloat(),g=t.readFloat(),b=t.readFloat()*s;for(let x=0,y=0;p.setFrame(x,f,g,b,t.readByte(),t.readBoolean(),t.readBoolean()),x!=u;x++){let w=t.readFloat(),k=t.readFloat(),S=t.readFloat()*s;switch(t.readByte()){case Bn:p.setStepped(x);break;case Fn:pt(t,p,y++,x,0,f,w,g,k,1),pt(t,p,y++,x,1,f,w,b,S,s)}f=w,g=k,b=S}r.push(p)}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=t.readInt(!0),u=d-1,p=new la(d,t.readInt(!0),h),f=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readFloat(),w=t.readFloat(),k=t.readFloat();for(let S=0,I=0;p.setFrame(S,f,g,b,x,y,w,k),S!=u;S++){let M=t.readFloat(),v=t.readFloat(),E=t.readFloat(),C=t.readFloat(),T=t.readFloat(),F=t.readFloat(),D=t.readFloat();switch(t.readByte()){case Bn:p.setStepped(S);break;case Fn:pt(t,p,I++,S,0,f,M,g,v,1),pt(t,p,I++,S,1,f,M,b,E,1),pt(t,p,I++,S,2,f,M,x,C,1),pt(t,p,I++,S,3,f,M,y,T,1),pt(t,p,I++,S,4,f,M,w,F,1),pt(t,p,I++,S,5,f,M,k,D,1)}f=M,g=v,b=E,x=C,y=T,w=F,k=D}r.push(p)}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=n.pathConstraints[h];for(let u=0,p=t.readInt(!0);u<p;u++)switch(t.readByte()){case Au:r.push(vr(t,new ca(t.readInt(!0),t.readInt(!0),h),d.positionMode==0?s:1));break;case ku:r.push(vr(t,new ha(t.readInt(!0),t.readInt(!0),h),d.spacingMode==0||d.spacingMode==1?s:1));break;case Iu:let f=new ma(t.readInt(!0),t.readInt(!0),h),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let w=0,k=0,S=f.getFrameCount()-1;f.setFrame(w,g,b,x,y),w!=S;w++){let I=t.readFloat(),M=t.readFloat(),v=t.readFloat(),E=t.readFloat();switch(t.readByte()){case Bn:f.setStepped(w);break;case Fn:pt(t,f,k++,w,0,g,I,b,M,1),pt(t,f,k++,w,1,g,I,x,v,1),pt(t,f,k++,w,2,g,I,y,E,1)}g=I,b=M,x=v,y=E}r.push(f)}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=n.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let x=h.getAttachment(p,b),y=this.readDeformTimelineType(t),w=t.readInt(!0),k=w-1;switch(y){case xd:{let S=x,I=S.bones,M=S.vertices,v=I?M.length/3*2:M.length,E=t.readInt(!0),C=new ia(w,E,p,S),T=t.readFloat();for(let F=0,D=0;;F++){let V,X=t.readInt(!0);if(X==0)V=I?Y.newFloatArray(v):M;else{V=Y.newFloatArray(v);let q=t.readInt(!0);if(X+=q,s==1)for(let L=q;L<X;L++)V[L]=t.readFloat();else for(let L=q;L<X;L++)V[L]=t.readFloat()*s;if(!I)for(let L=0,R=V.length;L<R;L++)V[L]+=M[L]}if(C.setFrame(F,T,V),F==k)break;let N=t.readFloat();switch(t.readByte()){case Bn:C.setStepped(F);break;case Fn:pt(t,C,D++,F,0,T,N,0,1,1)}T=N}r.push(C);break}case Su:{let S=new da(w,p,x);for(let I=0;I<w;I++){let M=t.readFloat(),v=t.readInt32();S.setFrame(I,M,Bl[v&15],v>>4,t.readFloat())}r.push(S);break}}}}}let o=t.readInt(!0);if(o>0){let a=new Tn(o),i=n.slots.length;for(let h=0;h<o;h++){let d=t.readFloat(),u=t.readInt(!0),p=Y.newArray(i,0);for(let x=i-1;x>=0;x--)p[x]=-1;let f=Y.newArray(i-u,0),g=0,b=0;for(let x=0;x<u;x++){let y=t.readInt(!0);for(;g!=y;)f[b++]=g++;p[g+t.readInt(!0)]=g++}for(;g<i;)f[b++]=g++;for(let x=i-1;x>=0;x--)p[x]==-1&&(p[x]=f[--b]);a.setFrame(h,d,p)}r.push(a)}let l=t.readInt(!0);if(l>0){let a=new Ir(l);for(let i=0;i<l;i++){let h=t.readFloat(),d=n.events[t.readInt(!0)],u=new fa(h,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readBoolean()?t.readString():d.stringValue,u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(i,u)}r.push(a)}let c=0;for(let a=0,i=r.length;a<i;a++)c=Math.max(c,r[a].getDuration());return new kr(e,r,c)}};m(go,"BlendModeValues",[0,1,2,3]);var rm=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritTimeline");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritTimeline=s}},sm=class{constructor(t=null,e=null){this.bones=t;this.vertices=e}};function vr(A,t,e){let n=A.readFloat(),r=A.readFloat()*e;for(let s=0,o=0,l=t.getFrameCount()-1;t.setFrame(s,n,r),s!=l;s++){let c=A.readFloat(),a=A.readFloat()*e;switch(A.readByte()){case Bn:t.setStepped(s);break;case Fn:pt(A,t,o++,s,0,n,c,r,a,e)}n=c,r=a}return t}function nm(A,t,e){let n=A.readFloat(),r=A.readFloat()*e,s=A.readFloat()*e;for(let o=0,l=0,c=t.getFrameCount()-1;t.setFrame(o,n,r,s),o!=c;o++){let a=A.readFloat(),i=A.readFloat()*e,h=A.readFloat()*e;switch(A.readByte()){case Bn:t.setStepped(o);break;case Fn:pt(A,t,l++,o,0,n,a,r,i,e),pt(A,t,l++,o,1,n,a,s,h,e)}n=a,r=i,s=h}return t}function pt(A,t,e,n,r,s,o,l,c,a){t.setBezier(e,n,r,s,l,A.readFloat(),A.readFloat()*a,A.readFloat(),A.readFloat()*a,o,c)}var au=0,iu=1,ou=2,lu=3,cu=4,hu=5,mu=6,du=7,uu=8,fu=9,pu=0,gu=1,bu=2,xu=3,yu=4,wu=5,xd=0,Su=1,Au=0,ku=1,Iu=2,Bn=1,Fn=2;var Nl=class extends $e{};var Ol=class A{constructor(t){m(this,"attachmentLoader");m(this,"scale",1);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new ya,r=typeof t=="string"?JSON.parse(t):t,s=r.skeleton;if(s){n.hash=s.hash,n.version=s.spine;let o=n.version.substr(0,3);if(o!=="4.0"&&o!=="4.1"){let l=`Spine 4.1 loader cant load version ${s.spine}. Please configure your pixi-spine bundle`;console.error(l)}n.x=s.x,n.y=s.y,n.width=s.width,n.height=s.height,n.fps=s.fps,n.imagesPath=s.images}if(r.bones)for(let o=0;o<r.bones.length;o++){let l=r.bones[o],c=null,a=G(l,"parent",null);if(a!=null&&(c=n.findBone(a),c==null))throw new Error(`Parent bone not found: ${a}`);let i=new ua(n.bones.length,l.name,c);i.length=G(l,"length",0)*e,i.x=G(l,"x",0)*e,i.y=G(l,"y",0)*e,i.rotation=G(l,"rotation",0),i.scaleX=G(l,"scaleX",1),i.scaleY=G(l,"scaleY",1),i.shearX=G(l,"shearX",0),i.shearY=G(l,"shearY",0),i.transformMode=Y.enumValue(me,G(l,"transform","Normal")),i.skinRequired=G(l,"skin",!1);let h=G(l,"color",null);h&&i.color.setFromString(h),n.bones.push(i)}if(r.slots)for(let o=0;o<r.slots.length;o++){let l=r.slots[o],c=n.findBone(l.bone);if(!c)throw new Error(`Couldn't find bone ${l.bone} for slot ${l.name}`);let a=new wa(n.slots.length,l.name,c),i=G(l,"color",null);i&&a.color.setFromString(i);let h=G(l,"dark",null);h&&(a.darkColor=$.fromString(h)),a.attachmentName=G(l,"attachment",null),a.blendMode=A.blendModeFromString(G(l,"blend","normal")),n.slots.push(a)}if(r.ik)for(let o=0;o<r.ik.length;o++){let l=r.ik[o],c=new ga(l.name);c.order=G(l,"order",0),c.skinRequired=G(l,"skin",!1);for(let a=0;a<l.bones.length;a++){let i=l.bones[a],h=n.findBone(i);if(h==null)throw new Error(`IK bone not found: ${i}`);c.bones.push(h)}c.target=n.findBone(l.target),c.mix=G(l,"mix",1),c.softness=G(l,"softness",0)*e,c.bendDirection=G(l,"bendPositive",!0)?1:-1,c.compress=G(l,"compress",!1),c.stretch=G(l,"stretch",!1),c.uniform=G(l,"uniform",!1),n.ikConstraints.push(c)}if(r.transform)for(let o=0;o<r.transform.length;o++){let l=r.transform[o],c=new Sa(l.name);c.order=G(l,"order",0),c.skinRequired=G(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],u=n.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);c.bones.push(u)}let a=l.target,i=n.findBone(a);if(!i)throw new Error(`Couldn't find target bone ${a} for transform constraint ${l.name}.`);c.target=i,c.local=G(l,"local",!1),c.relative=G(l,"relative",!1),c.offsetRotation=G(l,"rotation",0),c.offsetX=G(l,"x",0)*e,c.offsetY=G(l,"y",0)*e,c.offsetScaleX=G(l,"scaleX",0),c.offsetScaleY=G(l,"scaleY",0),c.offsetShearY=G(l,"shearY",0),c.mixRotate=G(l,"mixRotate",1),c.mixX=G(l,"mixX",1),c.mixY=G(l,"mixY",c.mixX),c.mixScaleX=G(l,"mixScaleX",1),c.mixScaleY=G(l,"mixScaleY",c.mixScaleX),c.mixShearY=G(l,"mixShearY",1),n.transformConstraints.push(c)}if(r.path)for(let o=0;o<r.path.length;o++){let l=r.path[o],c=new ba(l.name);c.order=G(l,"order",0),c.skinRequired=G(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],u=n.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);c.bones.push(u)}let a=l.target,i=n.findSlot(a);if(!i)throw new Error(`Couldn't find target slot ${a} for path constraint ${l.name}.`);c.target=i,c.positionMode=Y.enumValue(Ie,G(l,"positionMode","Percent")),c.spacingMode=Y.enumValue(po,G(l,"spacingMode","Length")),c.rotateMode=Y.enumValue(Ye,G(l,"rotateMode","Tangent")),c.offsetRotation=G(l,"rotation",0),c.position=G(l,"position",0),c.positionMode==0&&(c.position*=e),c.spacing=G(l,"spacing",0),(c.spacingMode==0||c.spacingMode==1)&&(c.spacing*=e),c.mixRotate=G(l,"mixRotate",1),c.mixX=G(l,"mixX",1),c.mixY=G(l,"mixY",c.mixX),n.pathConstraints.push(c)}if(r.skins)for(let o=0;o<r.skins.length;o++){let l=r.skins[o],c=new _r(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let i=l.bones[a],h=n.findBone(i);if(!h)throw new Error(`Couldn't find bone ${i} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let a=0;a<l.ik.length;a++){let i=l.ik[a],h=n.findIkConstraint(i);if(!h)throw new Error(`Couldn't find IK constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let a=0;a<l.transform.length;a++){let i=l.transform[a],h=n.findTransformConstraint(i);if(!h)throw new Error(`Couldn't find transform constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let a=0;a<l.path.length;a++){let i=l.path[a],h=n.findPathConstraint(i);if(!h)throw new Error(`Couldn't find path constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}for(let a in l.attachments){let i=n.findSlot(a);if(!i)throw new Error(`Couldn't find slot ${a} for skin ${l.name}.`);let h=l.attachments[a];for(let d in h){let u=this.readAttachment(h[d],c,i.index,d,n);u&&c.setAttachment(i.index,d,u)}}n.skins.push(c),c.name=="default"&&(n.defaultSkin=c)}for(let o=0,l=this.linkedMeshes.length;o<l;o++){let c=this.linkedMeshes[o],a=c.skin?n.findSkin(c.skin):n.defaultSkin;if(!a)throw new Error(`Skin not found: ${c.skin}`);let i=a.getAttachment(c.slotIndex,c.parent);if(!i)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?i:c.mesh,c.mesh.setParentMesh(i)}if(this.linkedMeshes.length=0,r.events)for(let o in r.events){let l=r.events[o],c=new pa(o);c.intValue=G(l,"int",0),c.floatValue=G(l,"float",0),c.stringValue=G(l,"string",""),c.audioPath=G(l,"audio",null),c.audioPath&&(c.volume=G(l,"volume",1),c.balance=G(l,"balance",0)),n.events.push(c)}if(r.animations)for(let o in r.animations){let l=r.animations[o];this.readAnimation(l,o,n)}return n}readAttachment(t,e,n,r,s){let o=this.scale;switch(r=G(t,"name",r),G(t,"type","region")){case"region":{let l=G(t,"path",r),c=this.readSequence(G(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,l,c);if(!a)return null;a.path=l,a.x=G(t,"x",0)*o,a.y=G(t,"y",0)*o,a.scaleX=G(t,"scaleX",1),a.scaleY=G(t,"scaleY",1),a.rotation=G(t,"rotation",0),a.width=t.width*o,a.height=t.height*o,a.sequence=c;let i=G(t,"color",null);return i&&a.color.setFromString(i),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let c=G(t,"color",null);return c&&l.color.setFromString(c),l}case"mesh":case"linkedmesh":{let l=G(t,"path",r),c=this.readSequence(G(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,r,l,c);if(!a)return null;a.path=l;let i=G(t,"color",null);i&&a.color.setFromString(i),a.width=G(t,"width",0)*o,a.height=G(t,"height",0)*o,a.sequence=c;let h=G(t,"parent",null);if(h)return this.linkedMeshes.push(new im(a,G(t,"skin",null),n,h,G(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=new Float32Array(d),a.edges=G(t,"edges",null),a.hullLength=G(t,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(e,r);if(!l)return null;l.closed=G(t,"closed",!1),l.constantSpeed=G(t,"constantSpeed",!0);let c=t.vertexCount;this.readVertices(t,l,c<<1);let a=Y.newArray(c/3,0);for(let h=0;h<t.lengths.length;h++)a[h]=t.lengths[h]*o;l.lengths=a;let i=G(t,"color",null);return i&&l.color.setFromString(i),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,r);if(!l)return null;l.x=G(t,"x",0)*o,l.y=G(t,"y",0)*o,l.rotation=G(t,"rotation",0);let c=G(t,"color",null);return c&&l.color.setFromString(c),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,r);if(!l)return null;let c=G(t,"end",null);if(c!=null){let h=s.findSlot(c);if(h==null)throw new Error(`Clipping end slot not found: ${c}`);l.endSlot=h}let a=t.vertexCount;this.readVertices(t,l,a<<1);let i=G(t,"color",null);return i&&l.color.setFromString(i),l}}return null}readSequence(t){if(t==null)return null;let e=new zs(G(t,"count",0));return e.start=G(t,"start",1),e.digits=G(t,"digits",0),e.setupIndex=G(t,"setup",0),e}readVertices(t,e,n){let r=this.scale;e.worldVerticesLength=n;let s=t.vertices;if(n==s.length){let c=Y.toFloatArray(s);if(r!=1)for(let a=0,i=s.length;a<i;a++)c[a]*=r;e.vertices=c;return}let o=new Array,l=new Array;for(let c=0,a=s.length;c<a;){let i=s[c++];l.push(i);for(let h=c+i*4;c<h;c+=4)l.push(s[c]),o.push(s[c+1]*r),o.push(s[c+2]*r),o.push(s[c+3])}e.bones=l,e.vertices=Y.toFloatArray(o)}readAnimation(t,e,n){let r=this.scale,s=new Array;if(t.slots)for(let l in t.slots){let c=t.slots[l],a=n.findSlot(l);if(!a)throw new Error(`Slot not found: ${l}`);let i=a.index;for(let h in c){let d=c[h];if(!d)continue;let u=d.length;if(h=="attachment"){let p=new bn(u,i);for(let f=0;f<u;f++){let g=d[f];p.setFrame(f,G(g,"time",0),G(g,"name",null))}s.push(p)}else if(h=="rgba"){let p=new ea(u,u<<2,i),f=d[0],g=G(f,"time",0),b=$.fromString(f.color);for(let x=0,y=0;;x++){p.setFrame(x,g,b.r,b.g,b.b,b.a);let w=d[x+1];if(!w){p.shrink(y);break}let k=G(w,"time",0),S=$.fromString(w.color),I=f.curve;I&&(y=St(I,p,y,x,0,g,k,b.r,S.r,1),y=St(I,p,y,x,1,g,k,b.g,S.g,1),y=St(I,p,y,x,2,g,k,b.b,S.b,1),y=St(I,p,y,x,3,g,k,b.a,S.a,1)),g=k,b=S,f=w}s.push(p)}else if(h=="rgb"){let p=new na(u,u*3,i),f=d[0],g=G(f,"time",0),b=$.fromString(f.color);for(let x=0,y=0;;x++){p.setFrame(x,g,b.r,b.g,b.b);let w=d[x+1];if(!w){p.shrink(y);break}let k=G(w,"time",0),S=$.fromString(w.color),I=f.curve;I&&(y=St(I,p,y,x,0,g,k,b.r,S.r,1),y=St(I,p,y,x,1,g,k,b.g,S.g,1),y=St(I,p,y,x,2,g,k,b.b,S.b,1)),g=k,b=S,f=w}s.push(p)}else if(h=="alpha")s.push(jn(d,new ra(u,u,i),0,1));else if(h=="rgba2"){let p=new sa(u,u*7,i),f=d[0],g=G(f,"time",0),b=$.fromString(f.light),x=$.fromString(f.dark);for(let y=0,w=0;;y++){p.setFrame(y,g,b.r,b.g,b.b,b.a,x.r,x.g,x.b);let k=d[y+1];if(!k){p.shrink(w);break}let S=G(k,"time",0),I=$.fromString(k.light),M=$.fromString(k.dark),v=f.curve;v&&(w=St(v,p,w,y,0,g,S,b.r,I.r,1),w=St(v,p,w,y,1,g,S,b.g,I.g,1),w=St(v,p,w,y,2,g,S,b.b,I.b,1),w=St(v,p,w,y,3,g,S,b.a,I.a,1),w=St(v,p,w,y,4,g,S,x.r,M.r,1),w=St(v,p,w,y,5,g,S,x.g,M.g,1),w=St(v,p,w,y,6,g,S,x.b,M.b,1)),g=S,b=I,x=M,f=k}s.push(p)}else if(h=="rgb2"){let p=new aa(u,u*6,i),f=d[0],g=G(f,"time",0),b=$.fromString(f.light),x=$.fromString(f.dark);for(let y=0,w=0;;y++){p.setFrame(y,g,b.r,b.g,b.b,x.r,x.g,x.b);let k=d[y+1];if(!k){p.shrink(w);break}let S=G(k,"time",0),I=$.fromString(k.light),M=$.fromString(k.dark),v=f.curve;v&&(w=St(v,p,w,y,0,g,S,b.r,I.r,1),w=St(v,p,w,y,1,g,S,b.g,I.g,1),w=St(v,p,w,y,2,g,S,b.b,I.b,1),w=St(v,p,w,y,3,g,S,x.r,M.r,1),w=St(v,p,w,y,4,g,S,x.g,M.g,1),w=St(v,p,w,y,5,g,S,x.b,M.b,1)),g=S,b=I,x=M,f=k}s.push(p)}}}if(t.bones)for(let l in t.bones){let c=t.bones[l],a=n.findBone(l);if(!a)throw new Error(`Bone not found: ${l}`);let i=a.index;for(let h in c){let d=c[h],u=d.length;if(u!=0){if(h==="rotate")s.push(jn(d,new Gn(u,u,i),0,1));else if(h==="translate"){let p=new Hs(u,u<<1,i);s.push(am(d,p,"x","y",0,r))}else if(h==="translatex"){let p=new Gs(u,u,i);s.push(jn(d,p,0,r))}else if(h==="translatey"){let p=new js(u,u,i);s.push(jn(d,p,0,r))}else if(h==="scale"){let p=new Zs(u,u<<1,i);s.push(am(d,p,"x","y",1,1))}else if(h==="scalex"){let p=new Ks(u,u,i);s.push(jn(d,p,1,1))}else if(h==="scaley"){let p=new Js(u,u,i);s.push(jn(d,p,1,1))}else if(h==="shear"){let p=new Qs(u,u<<1,i);s.push(am(d,p,"x","y",0,1))}else if(h==="shearx"){let p=new _s(u,u,i);s.push(jn(d,p,0,1))}else if(h==="sheary"){let p=new ta(u,u,i);s.push(jn(d,p,0,1))}}}}if(t.ik)for(let l in t.ik){let c=t.ik[l],a=c[0];if(!a)continue;let i=n.findIkConstraint(l);if(!i)throw new Error(`IK Constraint not found: ${l}`);let h=n.ikConstraints.indexOf(i),d=new oa(c.length,c.length<<1,h),u=G(a,"time",0),p=G(a,"mix",1),f=G(a,"softness",0)*r;for(let g=0,b=0;;g++){d.setFrame(g,u,p,f,G(a,"bendPositive",!0)?1:-1,G(a,"compress",!1),G(a,"stretch",!1));let x=c[g+1];if(!x){d.shrink(b);break}let y=G(x,"time",0),w=G(x,"mix",1),k=G(x,"softness",0)*r,S=a.curve;S&&(b=St(S,d,b,g,0,u,y,p,w,1),b=St(S,d,b,g,1,u,y,f,k,r)),u=y,p=w,f=k,a=x}s.push(d)}if(t.transform)for(let l in t.transform){let c=t.transform[l],a=c[0];if(!a)continue;let i=n.findTransformConstraint(l);if(!i)throw new Error(`Transform constraint not found: ${l}`);let h=n.transformConstraints.indexOf(i),d=new la(c.length,c.length*6,h),u=G(a,"time",0),p=G(a,"mixRotate",1),f=G(a,"mixX",1),g=G(a,"mixY",f),b=G(a,"mixScaleX",1),x=G(a,"mixScaleY",b),y=G(a,"mixShearY",1);for(let w=0,k=0;;w++){d.setFrame(w,u,p,f,g,b,x,y);let S=c[w+1];if(!S){d.shrink(k);break}let I=G(S,"time",0),M=G(S,"mixRotate",1),v=G(S,"mixX",1),E=G(S,"mixY",v),C=G(S,"mixScaleX",1),T=G(S,"mixScaleY",C),F=G(S,"mixShearY",1),D=a.curve;D&&(k=St(D,d,k,w,0,u,I,p,M,1),k=St(D,d,k,w,1,u,I,f,v,1),k=St(D,d,k,w,2,u,I,g,E,1),k=St(D,d,k,w,3,u,I,b,C,1),k=St(D,d,k,w,4,u,I,x,T,1),k=St(D,d,k,w,5,u,I,y,F,1)),u=I,p=M,f=v,g=E,b=C,x=T,b=C,a=S}s.push(d)}if(t.path)for(let l in t.path){let c=t.path[l],a=n.findPathConstraint(l);if(!a)throw new Error(`Path constraint not found: ${l}`);let i=n.pathConstraints.indexOf(a);for(let h in c){let d=c[h],u=d[0];if(!u)continue;let p=d.length;if(h==="position"){let f=new ca(p,p,i);s.push(jn(d,f,0,a.positionMode==0?r:1))}else if(h==="spacing"){let f=new ha(p,p,i);s.push(jn(d,f,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(h==="mix"){let f=new ma(p,p*3,i),g=G(u,"time",0),b=G(u,"mixRotate",1),x=G(u,"mixX",1),y=G(u,"mixY",x);for(let w=0,k=0;;w++){f.setFrame(w,g,b,x,y);let S=d[w+1];if(!S){f.shrink(k);break}let I=G(S,"time",0),M=G(S,"mixRotate",1),v=G(S,"mixX",1),E=G(S,"mixY",v),C=u.curve;C&&(k=St(C,f,k,w,0,g,I,b,M,1),k=St(C,f,k,w,1,g,I,x,v,1),k=St(C,f,k,w,2,g,I,y,E,1)),g=I,b=M,x=v,y=E,u=S}s.push(f)}}}if(t.deform){t.attachments={};for(let l in t.deform){let c=t.deform[l],a=t.attachments[l]={};for(let i in c){let h=c[i],d=a[i]={};for(let u in h)d[u]={deform:h[u]}}}}if(t.attachments)for(let l in t.attachments){let c=t.attachments[l],a=n.findSkin(l);if(a==null){if(Dt.FAIL_ON_NON_EXISTING_SKIN)throw new Error(`Skin not found: ${l}`);continue}for(let i in c){let h=c[i],d=n.findSlot(i);if(!d)throw new Error(`Slot not found: ${i}`);let u=d.index;for(let p in h){let f=h[p],g=a.getAttachment(u,p);for(let b in f){let x=f[b],y=x[0];if(y){if(b=="deform"){let w=g.bones,k=g.vertices,S=w?k.length/3*2:k.length,I=new ia(x.length,x.length,u,g),M=G(y,"time",0);for(let v=0,E=0;;v++){let C,T=G(y,"vertices",null);if(!T)C=w?Y.newFloatArray(S):k;else{C=Y.newFloatArray(S);let X=G(y,"offset",0);if(Y.arrayCopy(T,0,C,X,T.length),r!=1)for(let N=X,q=N+T.length;N<q;N++)C[N]*=r;if(!w)for(let N=0;N<S;N++)C[N]+=k[N]}I.setFrame(v,M,C);let F=x[v+1];if(!F){I.shrink(E);break}let D=G(F,"time",0),V=y.curve;V&&(E=St(V,I,E,v,0,M,D,0,1,1)),M=D,y=F}s.push(I)}else if(b=="sequence"){let w=new da(x.length,u,g),k=0;for(let S=0;S<x.length;S++){let I=G(y,"delay",k),M=G(y,"time",0),v=Tl[G(y,"mode","hold")],E=G(y,"index",0);w.setFrame(S,M,v,E,I),k=I,y=x[S+1]}s.push(w)}}}}}}if(t.drawOrder){let l=new Tn(t.drawOrder.length),c=n.slots.length,a=0;for(let i=0;i<t.drawOrder.length;i++,a++){let h=t.drawOrder[i],d=null,u=G(h,"offsets",null);if(u){d=Y.newArray(c,-1);let p=Y.newArray(c-u.length,0),f=0,g=0;for(let b=0;b<u.length;b++){let x=u[b],y=n.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);let w=y.index;for(;f!=w;)p[g++]=f++;d[f+x.offset]=f++}for(;f<c;)p[g++]=f++;for(let b=c-1;b>=0;b--)d[b]==-1&&(d[b]=p[--g])}l.setFrame(a,G(h,"time",0),d)}s.push(l)}if(t.events){let l=new Ir(t.events.length),c=0;for(let a=0;a<t.events.length;a++,c++){let i=t.events[a],h=n.findEvent(i.name);if(!h)throw new Error(`Event not found: ${i.name}`);let d=new fa(Y.toSinglePrecision(G(i,"time",0)),h);d.intValue=G(i,"int",h.intValue),d.floatValue=G(i,"float",h.floatValue),d.stringValue=G(i,"string",h.stringValue),d.data.audioPath&&(d.volume=G(i,"volume",1),d.balance=G(i,"balance",0)),l.setFrame(c,d)}s.push(l)}let o=0;for(let l=0,c=s.length;l<c;l++)o=Math.max(o,s[l].getDuration());if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new kr(e,s,o))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="additive")return 1;if(t=="multiply")return 2;if(t=="screen")return 3;throw new Error(`Unknown blend mode: ${t}`)}},im=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritTimeline");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritTimeline=s}};function jn(A,t,e,n){let r=A[0],s=G(r,"time",0),o=G(r,"value",e)*n,l=0;for(let c=0;;c++){t.setFrame(c,s,o);let a=A[c+1];if(!a)return t.shrink(l),t;let i=G(a,"time",0),h=G(a,"value",e)*n;r.curve&&(l=St(r.curve,t,l,c,0,s,i,o,h,n)),s=i,o=h,r=a}}function am(A,t,e,n,r,s){let o=A[0],l=G(o,"time",0),c=G(o,e,r)*s,a=G(o,n,r)*s,i=0;for(let h=0;;h++){t.setFrame(h,l,c,a);let d=A[h+1];if(!d)return t.shrink(i),t;let u=G(d,"time",0),p=G(d,e,r)*s,f=G(d,n,r)*s,g=o.curve;g&&(i=St(g,t,i,h,0,l,u,c,p,s),i=St(g,t,i,h,1,l,u,a,f,s)),l=u,c=p,a=f,o=d}}function St(A,t,e,n,r,s,o,l,c,a){if(A=="stepped")return t.setStepped(n),e;let i=r<<2,h=A[i],d=A[i+1]*a,u=A[i+2],p=A[i+3]*a;return t.setBezier(e,n,r,s,l,h,d,u,p,o,c),e+1}function G(A,t,e){return A[t]!==void 0?A[t]:e}var om=class extends Ee{createSkeleton(t){this.skeleton=new Xl(t),this.skeleton.updateWorldTransform(),this.stateData=new Dl(t),this.state=new Fl(this.stateData)}};var lm=class{constructor(){m(this,"scale",1)}readSkeletonData(t,e){let n=null,r=this.readVersionOldFormat(e),s=dr(r);if(s===38&&(n=new Il(new io(t))),r=this.readVersionNewFormat(e),s=dr(r),(s===40||s===41)&&(n=new go(new uo(t))),!n){let o=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(o)}return n.scale=this.scale,n.readSkeletonData(e)}readVersionOldFormat(t){let e=new ln(t),n;try{e.readString(),n=e.readString()}catch{n=""}return n||""}readVersionNewFormat(t){let e=new ln(t);e.readInt32(),e.readInt32();let n;try{n=e.readString()}catch{n=""}return n||""}},cm=class{constructor(){m(this,"scale",1)}readSkeletonData(t,e){let n=e.skeleton.spine,r=dr(n),s=null;if(r===37&&(s=new hl(new Ko(t))),r===38&&(s=new Ml(new io(t))),(r===40||r===41)&&(s=new Ol(new uo(t))),!s){let o=`Unsupported version of spine model ${n}, please update pixi-spine`;console.error(o)}return s.scale=this.scale,s.readSkeletonData(e)}},jc=class extends Dc{createBinaryParser(){return new lm}createJsonParser(){return new cm}parseData(t,e,n){return{spineData:t.readSkeletonData(e,n),spineAtlas:e}}};var hc={};As(hc,{AABBRectangleBoundsProvider:()=>Fm,ATTACH_RETAIN:()=>Im,ATTACH_SETUP:()=>km,AlphaTimeline:()=>Ya,Animation:()=>Er,AnimationState:()=>ko,AnimationStateAdapter:()=>ym,AnimationStateData:()=>Gl,AssetCache:()=>sh,AssetManagerBase:()=>rh,AtlasAttachmentLoader:()=>Kl,Attachment:()=>yo,AttachmentTimeline:()=>Dn,BinaryInput:()=>ah,BlendMode:()=>tn,Bone:()=>ii,BoneData:()=>ri,BonePose:()=>is,BoneTimeline1:()=>Kn,BoneTimeline2:()=>Ao,BoundingBoxAttachment:()=>ni,CURRENT:()=>wm,ClippingAttachment:()=>xe,Color:()=>_,Constraint:()=>Je,ConstraintData:()=>Qe,ConstraintTimeline1:()=>as,CurveTimeline:()=>Zn,CurveTimeline1:()=>ss,DebugUtils:()=>dm,DeformTimeline:()=>Na,Downloader:()=>jl,DrawOrder:()=>Jl,DrawOrderFolderTimeline:()=>Vn,DrawOrderTimeline:()=>Ke,Event:()=>Fr,EventData:()=>oi,EventQueue:()=>nh,EventTimeline:()=>Tr,EventType:()=>Re,FIRST:()=>Sm,FakeTexture:()=>pm,FromProperty:()=>Yr,FromRotate:()=>us,FromScaleX:()=>gs,FromScaleY:()=>bs,FromShearY:()=>xs,FromX:()=>fs,FromY:()=>ps,HOLD:()=>zl,IkConstraint:()=>Ql,IkConstraintData:()=>Dr,IkConstraintPose:()=>os,IkConstraintTimeline:()=>Ua,Inherit:()=>Ut,InheritTimeline:()=>Da,IntSet:()=>hm,Interpolation:()=>es,MODE:()=>Am,MathUtils:()=>Q,MeshAttachment:()=>Ot,MixFrom:()=>tt,PathAttachment:()=>Qn,PathConstraint:()=>_l,PathConstraintData:()=>Vr,PathConstraintMixTimeline:()=>za,PathConstraintPose:()=>ls,PathConstraintPositionTimeline:()=>qa,PathConstraintSpacingTimeline:()=>$a,Physics:()=>Ne,PhysicsConstraint:()=>ci,PhysicsConstraintDampingTimeline:()=>ja,PhysicsConstraintData:()=>Rr,PhysicsConstraintGravityTimeline:()=>Ja,PhysicsConstraintInertiaTimeline:()=>Ha,PhysicsConstraintMassTimeline:()=>Za,PhysicsConstraintMixTimeline:()=>Qa,PhysicsConstraintPose:()=>cs,PhysicsConstraintResetTimeline:()=>_a,PhysicsConstraintStrengthTimeline:()=>Ga,PhysicsConstraintTimeline:()=>kn,PhysicsConstraintWindTimeline:()=>Ka,PointAttachment:()=>Zl,Pool:()=>wn,Posed:()=>si,PosedActive:()=>ai,PosedData:()=>Br,PositionMode:()=>Le,Pow:()=>Zc,PowOut:()=>mm,Property:()=>mt,RGB2Timeline:()=>La,RGBA2Timeline:()=>Xa,RGBATimeline:()=>Ra,RGBTimeline:()=>Pa,RegionAttachment:()=>ct,RotateMode:()=>_n,RotateTimeline:()=>Jn,SETUP:()=>wd,ScaleTimeline:()=>va,ScaleXTimeline:()=>Ca,ScaleYMode:()=>ie,ScaleYTimeline:()=>Ea,Sequence:()=>Cr,SequenceMode:()=>de,SequenceModeValues:()=>ql,SequenceTimeline:()=>Oa,SetupPoseBoundsProvider:()=>Dm,ShearTimeline:()=>Ta,ShearXTimeline:()=>Ba,ShearYTimeline:()=>Fa,Skeleton:()=>tr,SkeletonBinary:()=>ac,SkeletonBounds:()=>bi,SkeletonClipping:()=>Nr,SkeletonData:()=>Pr,SkeletonJson:()=>oc,SkeletonPhysicsMovement:()=>lc,SkeletonRendererCore:()=>Em,Skin:()=>er,SkinEntry:()=>rc,SkinsAndAnimationBoundsProvider:()=>Vm,Slider:()=>nc,SliderData:()=>_e,SliderMixTimeline:()=>ei,SliderPose:()=>ms,SliderTimeline:()=>ti,Slot:()=>tc,SlotCurveTimeline:()=>Va,SlotData:()=>hi,SlotPose:()=>hs,SpacingMode:()=>te,Spine:()=>Rm,SpineDebugRenderer:()=>Pm,SpinePipe:()=>cc,SpineTexture:()=>Mo,StringSet:()=>Ul,Texture:()=>Aa,TextureAtlas:()=>rs,TextureAtlasPage:()=>Kc,TextureAtlasRegion:()=>xo,TextureFilter:()=>le,TextureRegion:()=>Wl,TextureWrap:()=>Sn,TimeKeeper:()=>um,Timeline:()=>Pt,ToProperty:()=>Xr,ToRotate:()=>mi,ToScaleX:()=>fi,ToScaleY:()=>pi,ToShearY:()=>gi,ToX:()=>di,ToY:()=>ui,TrackEntry:()=>eh,TransformConstraint:()=>sc,TransformConstraintData:()=>gt,TransformConstraintPose:()=>ds,TransformConstraintTimeline:()=>Wa,TranslateTimeline:()=>ka,TranslateXTimeline:()=>Ia,TranslateYTimeline:()=>Ma,Triangulator:()=>ic,Utils:()=>J,Vector2:()=>ns,VertexAttachment:()=>Ce,WindowedMean:()=>fm,isBoneTimeline:()=>yd,isConstraintTimeline:()=>xm,isSlotTimeline:()=>bm});if(typeof window<"u"&&window.PIXI){let A=window.require;window.require=t=>{if(A)return A(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}var hm=class{constructor(){m(this,"array",[])}add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ul=class{constructor(){m(this,"entries",{});m(this,"size",0)}add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(let n=0,r=t.length;n<r;n++)this.add(t[n]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},Ze=class Ze{constructor(t=0,e=0,n=0,r=0){m(this,"r");m(this,"g");m(this,"b");m(this,"a");this.r=t,this.g=e,this.b=n,this.a=r}set(t,e,n,r){return this.r=t,this.g=e,this.b=n,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=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,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=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){let t=e=>`0${(e*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,e=new Ze){return e.setFromString(t)}};m(Ze,"WHITE",new Ze(1,1,1,1)),m(Ze,"RED",new Ze(1,0,0,1)),m(Ze,"GREEN",new Ze(0,1,0,1)),m(Ze,"BLUE",new Ze(0,0,1,1)),m(Ze,"MAGENTA",new Ze(1,0,1,1));var _=Ze,_t=class _t{static clamp(t,e,n){return t<e?e:t>n?n:t}static cosDeg(t){return Math.cos(t*_t.degRad)}static sinDeg(t){return Math.sin(t*_t.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*_t.radDeg}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),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return _t.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,n){let r=Math.random(),s=e-t;return r<=(n-t)/s?t+Math.sqrt(r*s*(n-t)):e-Math.sqrt((1-r)*s*(e-n))}static isPowerOfTwo(t){return t&&(t&t-1)===0}};m(_t,"epsilon",1e-5),m(_t,"epsilon2",_t.epsilon*_t.epsilon),m(_t,"PI",3.1415927),m(_t,"PI2",_t.PI*2),m(_t,"invPI2",1/_t.PI2),m(_t,"radiansToDegrees",180/_t.PI),m(_t,"radDeg",_t.radiansToDegrees),m(_t,"degreesToRadians",_t.PI/180),m(_t,"degRad",_t.degreesToRadians);var Q=_t,yn=class yn{apply(t,e,n){return e===void 0||n===void 0?this.applyInternal(t):t+(e-t)*this.applyInternal(n)}};m(yn,"linear",new class extends yn{applyInternal(t){return t}}),m(yn,"smooth",new class extends yn{applyInternal(t){return t*t*(3-2*t)}}),m(yn,"slowFast",new class extends yn{applyInternal(t){return t*t}}),m(yn,"fastSlow",new class extends yn{applyInternal(t){return(t-1)*(t-1)*-1+1}}),m(yn,"circle",new class extends yn{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}});var es=yn,Zc=class extends es{constructor(e){super();m(this,"power",2);this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},mm=class extends Zc{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},ts=class ts{static arrayCopy(t,e,n,r,s){for(let o=e,l=r;o<e+s;o++,l++)n[l]=t[o]}static arrayFill(t,e,n,r){for(let s=e;s<n;s++)t[s]=r}static setArraySize(t,e,n=0){let r=t.length;if(r===e)return t;if(t.length=e,r<e)for(let s=r;s<e;s++)t[s]=n;return t}static ensureArrayCapacity(t,e,n=0){return t.length>=e?t:ts.setArraySize(t,e,n)}static newArray(t,e){let n=[];for(let r=0;r<t;r++)n[r]=e;return n}static newFloatArray(t){if(ts.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=[];for(let n=0;n<e.length;n++)e[n]=0;return e}}static newShortArray(t){if(ts.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=[];for(let n=0;n<e.length;n++)e[n]=0;return e}}static toFloatArray(t){return ts.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return ts.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,e,n=!0){for(let 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)]}};m(ts,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var J=ts,dm=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let n=t.bones[e].appliedPose;console.log(`${n.bone.data.name}, ${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.worldX}, ${n.worldY}`)}}},wn=class{constructor(t){m(this,"items",[]);m(this,"instantiator");this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){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}},ns=class{constructor(t=0,e=0){m(this,"x");m(this,"y");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 t!==0&&(this.x/=t,this.y/=t),this}},um=class{constructor(){m(this,"maxDelta",.064);m(this,"framesPerSecond",0);m(this,"delta",0);m(this,"totalTime",0);m(this,"lastTime",Date.now()/1e3);m(this,"frameCount",0);m(this,"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)}},fm=class{constructor(t=32){m(this,"values");m(this,"addedValues",0);m(this,"lastValue",0);m(this,"mean",0);m(this,"dirty",!0);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}};var Aa=class{constructor(t){m(this,"_image");this._image=t}getImage(){return this._image}},le;(function(A){A[A.Nearest=9728]="Nearest",A[A.Linear=9729]="Linear",A[A.MipMap=9987]="MipMap",A[A.MipMapNearestNearest=9984]="MipMapNearestNearest",A[A.MipMapLinearNearest=9985]="MipMapLinearNearest",A[A.MipMapNearestLinear=9986]="MipMapNearestLinear",A[A.MipMapLinearLinear=9987]="MipMapLinearLinear"})(le||(le={}));var Sn;(function(A){A[A.MirroredRepeat=33648]="MirroredRepeat",A[A.ClampToEdge=33071]="ClampToEdge",A[A.Repeat=10497]="Repeat"})(Sn||(Sn={}));var Wl=class{constructor(){m(this,"texture");m(this,"u",0);m(this,"v",0);m(this,"u2",0);m(this,"v2",0);m(this,"width",0);m(this,"height",0);m(this,"degrees",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"originalWidth",0);m(this,"originalHeight",0)}},pm=class extends Aa{setFilters(t,e){}setWraps(t,e){}dispose(){}};var rs=class{constructor(t){m(this,"pages",[]);m(this,"regions",[]);let e=new gm(t),n=new Array(4),r={};r.size=i=>{i.width=parseInt(n[1]),i.height=parseInt(n[2])},r.format=()=>{},r.filter=i=>{i.minFilter=J.enumValue(le,n[1]),i.magFilter=J.enumValue(le,n[2])},r.repeat=i=>{n[1].indexOf("x")!==-1&&(i.uWrap=Sn.Repeat),n[1].indexOf("y")!==-1&&(i.vWrap=Sn.Repeat)},r.pma=i=>{i.pma=n[1]==="true"};var s={};s.xy=i=>{i.x=parseInt(n[1]),i.y=parseInt(n[2])},s.size=i=>{i.width=parseInt(n[1]),i.height=parseInt(n[2])},s.bounds=i=>{i.x=parseInt(n[1]),i.y=parseInt(n[2]),i.width=parseInt(n[3]),i.height=parseInt(n[4])},s.offset=i=>{i.offsetX=parseInt(n[1]),i.offsetY=parseInt(n[2])},s.orig=i=>{i.originalWidth=parseInt(n[1]),i.originalHeight=parseInt(n[2])},s.offsets=i=>{i.offsetX=parseInt(n[1]),i.offsetY=parseInt(n[2]),i.originalWidth=parseInt(n[3]),i.originalHeight=parseInt(n[4])},s.rotate=i=>{let h=n[1];h==="true"?i.degrees=90:h!=="false"&&(i.degrees=parseInt(h))},s.index=i=>{i.index=parseInt(n[1])};let o=e.readLine();for(;o&&o.trim().length===0;)o=e.readLine();for(;!(!o||o.trim().length===0||e.readEntry(n,o)===0);)o=e.readLine();let l=null,c=null,a=null;for(;o!==null;)if(o.trim().length===0)l=null,o=e.readLine();else if(l){let i=new xo(l,o);for(;;){let h=e.readEntry(n,o=e.readLine());if(h===0)break;let d=s[n[0]];if(d)d(i);else{c||(c=[]),a||(a=[]),c.push(n[0]);let u=[];for(let p=0;p<h;p++)u.push(parseInt(n[p+1]));a.push(u)}}i.originalWidth===0&&i.originalHeight===0&&(i.originalWidth=i.width,i.originalHeight=i.height),c&&c.length>0&&a&&a.length>0&&(i.names=c,i.values=a,c=null,a=null),i.u=i.x/l.width,i.v=i.y/l.height,i.degrees===90?(i.u2=(i.x+i.height)/l.width,i.v2=(i.y+i.width)/l.height):(i.u2=(i.x+i.width)/l.width,i.v2=(i.y+i.height)/l.height),this.regions.push(i)}else{for(l=new Kc(o.trim());e.readEntry(n,o=e.readLine())!==0;){let i=r[n[0]];i&&i(l)}this.pages.push(l)}}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 n of this.pages)n.setTexture(t.get(e+n.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},gm=class{constructor(t){m(this,"lines");m(this,"index",0);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||(e=e.trim(),e.length===0))return 0;let n=e.indexOf(":");if(n===-1)return 0;t[0]=e.substr(0,n).trim();for(let r=1,s=n+1;;r++){let o=e.indexOf(",",s);if(o===-1)return t[r]=e.substr(s).trim(),r;if(t[r]=e.substr(s,o-s).trim(),s=o+1,r===4)return 4}}},Kc=class{constructor(t){m(this,"name");m(this,"minFilter",le.Nearest);m(this,"magFilter",le.Nearest);m(this,"uWrap",Sn.ClampToEdge);m(this,"vWrap",Sn.ClampToEdge);m(this,"texture",null);m(this,"width",0);m(this,"height",0);m(this,"pma",!1);m(this,"regions",[]);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}},xo=class extends Wl{constructor(e,n){super();m(this,"page");m(this,"name");m(this,"x",0);m(this,"y",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"originalWidth",0);m(this,"originalHeight",0);m(this,"index",0);m(this,"degrees",0);m(this,"names",null);m(this,"values",null);this.page=e,this.name=n,e.regions.push(this)}};var Jc=class Jc{constructor(t){m(this,"name");m(this,"timelineAttachment");m(this,"timelineSlots",Jc.empty);if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,e,n){let r=t[e];if(r.bone.isActive()){let s=(n?r.getAppliedPose():r.getPose()).getAttachment();if(s!=null&&s.timelineAttachment===this)return!0}for(let s=0,o=this.timelineSlots.length;s<o;s++){if(r=t[this.timelineSlots[s]],!r.bone.isActive())continue;let l=(n?r.getAppliedPose():r.getPose()).getAttachment();if(l!=null&&l.timelineAttachment===this)return!0}return!1}};m(Jc,"empty",[]);var yo=Jc,Qc=class Qc extends yo{constructor(e){super(e);m(this,"id",Qc.nextID++);m(this,"bones",null);m(this,"vertices",[]);m(this,"worldVerticesLength",0)}computeWorldVertices(e,n,r,s,o,l,c){s=l+(s>>1)*c;let a=n.appliedPose.deform,i=this.vertices,h=this.bones;if(!h){a.length>0&&(i=a);let f=n.bone.appliedPose,g=f.worldX,b=f.worldY,x=f.a,y=f.b,w=f.c,k=f.d;for(let S=r,I=l;I<s;S+=2,I+=c){let M=i[S],v=i[S+1];o[I]=M*x+v*y+g,o[I+1]=M*w+v*k+b}return}let d=0,u=0;for(let f=0;f<r;f+=2){let g=h[d];d+=g+1,u+=g}let p=e.bones;if(a.length===0)for(let f=l,g=u*3;f<s;f+=c){let b=0,x=0,y=h[d++];for(y+=d;d<y;d++,g+=3){let w=p[h[d]].appliedPose,k=i[g],S=i[g+1],I=i[g+2];b+=(k*w.a+S*w.b+w.worldX)*I,x+=(k*w.c+S*w.d+w.worldY)*I}o[f]=b,o[f+1]=x}else{let f=a;for(let g=l,b=u*3,x=u<<1;g<s;g+=c){let y=0,w=0,k=h[d++];for(k+=d;d<k;d++,b+=3,x+=2){let S=p[h[d]].appliedPose,I=i[b]+f[x],M=i[b+1]+f[x+1],v=i[b+2];y+=(I*S.a+M*S.b+S.worldX)*v,w+=(I*S.c+M*S.d+S.worldY)*v}o[g]=y,o[g+1]=w}}}copyTo(e){this.bones?(e.bones=[],J.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=J.newFloatArray(this.vertices.length),J.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}};m(Qc,"nextID",0);var Ce=Qc;var Ot=class A extends Ce{constructor(e,n){super(e);m(this,"sequence");m(this,"regionUVs",[]);m(this,"triangles",[]);m(this,"hullLength",0);m(this,"path");m(this,"color",new _(1,1,1,1));m(this,"sourceMesh",null);m(this,"edges",[]);m(this,"width",0);m(this,"height",0);m(this,"tempColor",new _(0,0,0,0));this.sequence=n}copy(){if(this.sourceMesh)return this.newLinkedMesh();let e=new A(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],J.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],J.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],J.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){let e=new A(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,n,r){if(!e)throw new Error("Region not set.");let s=r.length,o=e.u,l=e.v,c=0,a=0;if(e instanceof xo){let i=e.page,h=i.width,d=i.height;switch(e.degrees){case 90:o-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,a=e.originalWidth/d;for(let u=0;u<s;u+=2)r[u]=o+n[u+1]*c,r[u+1]=l+(1-n[u])*a;return;case 180:o-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,a=e.originalHeight/d;for(let u=0;u<s;u+=2)r[u]=o+(1-n[u])*c,r[u+1]=l+(1-n[u+1])*a;return;case 270:o-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,a=e.originalWidth/d;for(let u=0;u<s;u+=2)r[u]=o+(1-n[u+1])*c,r[u+1]=l+n[u]*a;return;default:o-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,a=e.originalHeight/d}}else e?(c=e.u2-o,a=e.v2-l):(o=l=0,c=a=1);for(let i=0;i<s;i+=2)r[i]=o+n[i]*c,r[i+1]=l+n[i+1]*a}};var At=class At extends yo{constructor(e,n){super(e);m(this,"sequence");m(this,"x",0);m(this,"y",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"rotation",0);m(this,"width",0);m(this,"height",0);m(this,"path");m(this,"color",new _(1,1,1,1));m(this,"tempColor",new _(1,1,1,1));this.sequence=n}copy(){let e=new At(this.name,this.sequence.copy());return e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,e.color.setFromColor(this.color),e}computeWorldVertices(e,n,r,s,o){let l=e.bone.appliedPose,c=l.worldX,a=l.worldY,i=l.a,h=l.b,d=l.c,u=l.d,p=n[0],f=n[1];r[s]=p*i+f*h+c,r[s+1]=p*d+f*u+a,s+=o,p=n[2],f=n[3],r[s]=p*i+f*h+c,r[s+1]=p*d+f*u+a,s+=o,p=n[4],f=n[5],r[s]=p*i+f*h+c,r[s+1]=p*d+f*u+a,s+=o,p=n[6],f=n[7],r[s]=p*i+f*h+c,r[s+1]=p*d+f*u+a}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,n,r,s,o,l,c,a,i,h){if(!e)throw new Error("Region not set.");let d=c/e.originalWidth*s,u=a/e.originalHeight*o,p=-c/2*s+e.offsetX*d,f=-a/2*o+e.offsetY*u,g=p+e.width*d,b=f+e.height*u,x=l*Q.degRad,y=Math.cos(x),w=Math.sin(x),k=p*y+n,S=p*w,I=f*y+r,M=f*w,v=g*y+n,E=g*w,C=b*y+r,T=b*w;i[0]=k-M,i[1]=I+S,i[2]=k-T,i[3]=C+S,i[4]=v-T,i[5]=C+E,i[6]=v-M,i[7]=I+E,e==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.v2))}};m(At,"X1",0),m(At,"Y1",1),m(At,"C1R",2),m(At,"C1G",3),m(At,"C1B",4),m(At,"C1A",5),m(At,"U1",6),m(At,"V1",7),m(At,"X2",8),m(At,"Y2",9),m(At,"C2R",10),m(At,"C2G",11),m(At,"C2B",12),m(At,"C2A",13),m(At,"U2",14),m(At,"V2",15),m(At,"X3",16),m(At,"Y3",17),m(At,"C3R",18),m(At,"C3G",19),m(At,"C3B",20),m(At,"C3A",21),m(At,"U3",22),m(At,"V3",23),m(At,"X4",24),m(At,"Y4",25),m(At,"C4R",26),m(At,"C4G",27),m(At,"C4B",28),m(At,"C4A",29),m(At,"U4",30),m(At,"V4",31);var ct=At;var wo=class wo{constructor(t,e){m(this,"id",wo.nextID());m(this,"regions");m(this,"pathSuffix");m(this,"uvs");m(this,"offsets");m(this,"start",0);m(this,"digits",0);m(this,"setupIndex",0);this.regions=new Array(t),this.pathSuffix=e}copy(){let t=this.regions.length,e=new wo(t,this.pathSuffix);if(J.arrayCopy(this.regions,0,e.regions,0,t),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,this.uvs!=null){let n=this.uvs[0].length;e.uvs=[];for(let r=0;r<t;r++)e.uvs[r]=J.newFloatArray(n),J.arrayCopy(this.uvs[r],0,e.uvs[r],0,n)}if(this.offsets!=null){e.offsets=[];for(let n=0;n<t;n++)e.offsets[n]=[],J.arrayCopy(this.offsets[n],0,e.offsets[n],0,8)}return e}update(t){let e=this.regions.length;if(t instanceof ct){this.uvs=[],this.offsets=[];for(let n=0;n<e;n++)this.uvs[n]=J.newFloatArray(8),this.offsets[n]=[],ct.computeUVs(this.regions[n],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[n],this.uvs[n])}else if(t instanceof Ot){let n=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let r=0;r<e;r++)this.uvs[r]=J.newFloatArray(n.length),Ot.computeUVs(this.regions[r],n,this.uvs[r])}}resolveIndex(t){let e=t.sequenceIndex;return e===-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1),e}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,e){if(!this.pathSuffix)return t;let n=t,r=(this.start+e).toString();for(let s=this.digits-r.length;s>0;s--)n+="0";return n+=r,n}static nextID(){return wo._nextID++}};m(wo,"_nextID",0);var Cr=wo,de;(function(A){A[A.hold=0]="hold",A[A.once=1]="once",A[A.loop=2]="loop",A[A.pingpong=3]="pingpong",A[A.onceReverse=4]="onceReverse",A[A.loopReverse=5]="loopReverse",A[A.pingpongReverse=6]="pingpongReverse"})(de||(de={}));var ql=[de.hold,de.once,de.loop,de.pingpong,de.onceReverse,de.loopReverse,de.pingpongReverse];var Er=class{constructor(t,e,n){m(this,"name");m(this,"timelines",[]);m(this,"timelineIds");m(this,"bones");m(this,"color",new _(1,1,1,1));m(this,"duration");if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=n,this.timelineIds=new Ul,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;let e=t.length;this.timelineIds.clear(),this.bones.length=0;let n=new Set,r=t;for(let s=0;s<e;s++){let o=r[s];this.timelineIds.addAll(o.propertyIds),yd(o)&&n.add(o.boneIndex)&&this.bones.push(o.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,n,r,s,o,l,c,a,i){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!==0&&(n%=this.duration,e>0&&(e%=this.duration));let h=this.timelines;for(let d=0,u=h.length;d<u;d++)h[d].apply(t,e,n,s,o,l,c,a,i)}},tt;(function(A){A[A.current=0]="current",A[A.setup=1]="setup",A[A.first=2]="first"})(tt||(tt={}));var mt;(function(A){A[A.rotate=0]="rotate",A[A.x=1]="x",A[A.y=2]="y",A[A.scaleX=3]="scaleX",A[A.scaleY=4]="scaleY",A[A.shearX=5]="shearX",A[A.shearY=6]="shearY",A[A.inherit=7]="inherit",A[A.rgb=8]="rgb",A[A.alpha=9]="alpha",A[A.rgb2=10]="rgb2",A[A.attachment=11]="attachment",A[A.deform=12]="deform",A[A.event=13]="event",A[A.drawOrder=14]="drawOrder",A[A.drawOrderFolder=15]="drawOrderFolder",A[A.ikConstraint=16]="ikConstraint",A[A.transformConstraint=17]="transformConstraint",A[A.pathConstraintPosition=18]="pathConstraintPosition",A[A.pathConstraintSpacing=19]="pathConstraintSpacing",A[A.pathConstraintMix=20]="pathConstraintMix",A[A.physicsConstraintInertia=21]="physicsConstraintInertia",A[A.physicsConstraintStrength=22]="physicsConstraintStrength",A[A.physicsConstraintDamping=23]="physicsConstraintDamping",A[A.physicsConstraintMass=24]="physicsConstraintMass",A[A.physicsConstraintWind=25]="physicsConstraintWind",A[A.physicsConstraintGravity=26]="physicsConstraintGravity",A[A.physicsConstraintMix=27]="physicsConstraintMix",A[A.physicsConstraintReset=28]="physicsConstraintReset",A[A.sequence=29]="sequence",A[A.sliderTime=30]="sliderTime",A[A.sliderMix=31]="sliderMix"})(mt||(mt={}));var Pt=class{constructor(t,...e){m(this,"propertyIds");m(this,"frames");m(this,"additive",!1);m(this,"instant",!1);this.propertyIds=e,this.frames=J.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 search(t,e,n=1){let r=t.length;for(let s=n;s<r;s+=n)if(t[s]>e)return s-n;return r-n}};function bm(A){return typeof A=="object"&&A!==null&&typeof A.slotIndex=="number"}var Zn=class extends Pt{constructor(e,n,...r){super(e,...r);m(this,"curves");this.curves=J.newFloatArray(e+n*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let n=this.getFrameCount()+e*18;if(this.curves.length>n){let r=J.newFloatArray(n);J.arrayCopy(this.curves,0,r,0,n),this.curves=r}}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r===0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=(o-c*2+i)*.03,b=((l-a)*3-s+h)*.006,x=((c-i)*3-o+d)*.006,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=(c-o)*.3+g+x*.16666667,I=s+k,M=o+S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getBezierValue(e,n,r,s){let o=this.curves;if(o[s]>e){let i=this.frames[n],h=this.frames[n+r];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}let l=s+18;for(s+=2;s<l;s+=2)if(o[s]>=e){let i=o[s-2],h=o[s-1];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}n+=this.getFrameEntries();let c=o[l-2],a=o[l-1];return a+(e-c)/(this.frames[n]-c)*(this.frames[n+r]-a)}},ss=class A extends Zn{constructor(t,e,n){super(t,e,n)}getFrameEntries(){return 2}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}getCurveValue(t){let e=this.frames,n=e.length-2;for(let s=2;s<=n;s+=2)if(e[s]>t){n=s-2;break}let r=this.curves[n>>1];switch(r){case 0:{let s=e[n],o=e[n+1];return o+(t-s)/(e[n+2]-s)*(e[n+2+1]-o)}case 1:return e[n+1]}return this.getBezierValue(t,n,1,r-2)}getRelativeValue(t,e,n,r,s,o){if(t<this.frames[0])return A.beforeFirstKey(n,e,s,o);let l=this.getCurveValue(t);return n===tt.setup?o+l*e:s+(r?l:l+o-s)*e}getAbsoluteValue(t,e,n,r,s,o,l){return l===void 0?this.getAbsoluteValue1(t,e,n,r,s,o):this.getAbsoluteValue2(t,e,n,r,s,o,l)}getAbsoluteValue1(t,e,n,r,s,o){if(t<this.frames[0])return A.beforeFirstKey(n,e,s,o);let l=this.getCurveValue(t);return n===tt.setup?o+(r?l:l-o)*e:s+(r?l:l-s)*e}getAbsoluteValue2(t,e,n,r,s,o,l){return t<this.frames[0]?A.beforeFirstKey(n,e,s,o):n===tt.setup?o+(r?l:l-o)*e:s+(r?l:l-s)*e}getScaleValue(t,e,n,r,s,o,l){if(t<this.frames[0])return A.beforeFirstKey(n,e,o,l);let c=this.getCurveValue(t)*l;if(e===1&&!r)return c;let a=n===tt.setup?l:o;return r?a+(c-l)*e:s?a+(Math.abs(c)*Math.sign(a)-a)*e:(a=Math.abs(a)*Math.sign(c),a+(c-a)*e)}static beforeFirstKey(t,e,n,r){switch(t){case tt.setup:return r;case tt.first:return n+(r-n)*e;case tt.current:return n}}};function yd(A){return typeof A=="object"&&A!==null&&typeof A.boneIndex=="number"}var Kn=class extends ss{constructor(e,n,r,s){super(e,n,`${s}|${r}`);m(this,"boneIndex");this.boneIndex=r,this.additive=!0}apply(e,n,r,s,o,l,c,a,i){let h=e.bones[this.boneIndex];h.active&&this.apply1(i?h.appliedPose:h.pose,h.data.setupPose,r,o,l,c,a)}},Ao=class extends Zn{constructor(e,n,r,s,o){super(e,n,`${s}|${r}`,`${o}|${r}`);m(this,"boneIndex");this.boneIndex=r,this.additive=!0}getFrameEntries(){return 3}setFrame(e,n,r,s){e*=3,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s}apply(e,n,r,s,o,l,c,a,i){let h=e.bones[this.boneIndex];h.active&&this.apply1(i?h.appliedPose:h.pose,h.data.setupPose,r,o,l,c,a)}},Jn=class extends Kn{constructor(t,e,n){super(t,e,n,mt.rotate)}apply1(t,e,n,r,s,o,l){t.rotation=this.getRelativeValue(n,r,s,o,t.rotation,e.rotation)}},ka=class extends Ao{constructor(t,e,n){super(t,e,n,mt.x,mt.y)}apply1(t,e,n,r,s,o,l){let c=this.frames;if(n<c[0]){switch(s){case tt.setup:t.x=e.x,t.y=e.y;break;case tt.first:t.x+=(e.x-t.x)*r,t.y+=(e.y-t.y)*r;break}return}let a=0,i=0,h=Pt.search(c,n,3),d=this.curves[h/3];switch(d){case 0:{let u=c[h];a=c[h+1],i=c[h+2];let p=(n-u)/(c[h+3]-u);a+=(c[h+3+1]-a)*p,i+=(c[h+3+2]-i)*p;break}case 1:a=c[h+1],i=c[h+2];break;default:a=this.getBezierValue(n,h,1,d-2),i=this.getBezierValue(n,h,2,d+18-2)}s===tt.setup?(t.x=e.x+a*r,t.y=e.y+i*r):o?(t.x+=a*r,t.y+=i*r):(t.x+=(e.x+a-t.x)*r,t.y+=(e.y+i-t.y)*r)}},Ia=class extends Kn{constructor(t,e,n){super(t,e,n,mt.x)}apply1(t,e,n,r,s,o,l){t.x=this.getRelativeValue(n,r,s,o,t.x,e.x)}},Ma=class extends Kn{constructor(t,e,n){super(t,e,n,mt.y)}apply1(t,e,n,r,s,o,l){t.y=this.getRelativeValue(n,r,s,o,t.y,e.y)}},va=class extends Ao{constructor(t,e,n){super(t,e,n,mt.scaleX,mt.scaleY)}apply1(t,e,n,r,s,o,l){let c=this.frames;if(n<c[0]){switch(s){case tt.setup:t.scaleX=e.scaleX,t.scaleY=e.scaleY;break;case tt.first:t.scaleX+=(e.scaleX-t.scaleX)*r,t.scaleY+=(e.scaleY-t.scaleY)*r;break}return}let a,i,h=Pt.search(c,n,3),d=this.curves[h/3];switch(d){case 0:{let u=c[h];a=c[h+1],i=c[h+2];let p=(n-u)/(c[h+3]-u);a+=(c[h+3+1]-a)*p,i+=(c[h+3+2]-i)*p;break}case 1:a=c[h+1],i=c[h+2];break;default:a=this.getBezierValue(n,h,1,d-2),i=this.getBezierValue(n,h,2,d+18-2)}if(a*=e.scaleX,i*=e.scaleY,r===1&&!o)t.scaleX=a,t.scaleY=i;else{let u=0,p=0;s===tt.setup?(u=e.scaleX,p=e.scaleY):(u=t.scaleX,p=t.scaleY),o?(t.scaleX=u+(a-e.scaleX)*r,t.scaleY=p+(i-e.scaleY)*r):l?(t.scaleX=u+(Math.abs(a)*Math.sign(u)-u)*r,t.scaleY=p+(Math.abs(i)*Math.sign(p)-p)*r):(u=Math.abs(u)*Math.sign(a),p=Math.abs(p)*Math.sign(i),t.scaleX=u+(a-u)*r,t.scaleY=p+(i-p)*r)}}},Ca=class extends Kn{constructor(t,e,n){super(t,e,n,mt.scaleX)}apply1(t,e,n,r,s,o,l){t.scaleX=this.getScaleValue(n,r,s,o,l,t.scaleX,e.scaleX)}},Ea=class extends Kn{constructor(t,e,n){super(t,e,n,mt.scaleY)}apply1(t,e,n,r,s,o,l){t.scaleY=this.getScaleValue(n,r,s,o,l,t.scaleY,e.scaleY)}},Ta=class extends Ao{constructor(t,e,n){super(t,e,n,mt.shearX,mt.shearY)}apply1(t,e,n,r,s,o,l){let c=this.frames;if(n<c[0]){switch(s){case tt.setup:t.shearX=e.shearX,t.shearY=e.shearY;break;case tt.first:t.shearX+=(e.shearX-t.shearX)*r,t.shearY+=(e.shearY-t.shearY)*r;break}return}let a=0,i=0,h=Pt.search(c,n,3),d=this.curves[h/3];switch(d){case 0:{let u=c[h];a=c[h+1],i=c[h+2];let p=(n-u)/(c[h+3]-u);a+=(c[h+3+1]-a)*p,i+=(c[h+3+2]-i)*p;break}case 1:a=c[h+1],i=c[h+2];break;default:a=this.getBezierValue(n,h,1,d-2),i=this.getBezierValue(n,h,2,d+18-2)}s===tt.setup?(t.shearX=e.shearX+a*r,t.shearY=e.shearY+i*r):o?(t.shearX+=a*r,t.shearY+=i*r):(t.shearX+=(e.shearX+a-t.shearX)*r,t.shearY+=(e.shearY+i-t.shearY)*r)}},Ba=class extends Kn{constructor(t,e,n){super(t,e,n,mt.shearX)}apply1(t,e,n,r,s,o,l){t.shearX=this.getRelativeValue(n,r,s,o,t.shearX,e.shearX)}},Fa=class extends Kn{constructor(t,e,n){super(t,e,n,mt.shearY)}apply1(t,e,n,r,s,o,l){t.shearY=this.getRelativeValue(n,r,s,o,t.shearY,e.shearY)}},Da=class extends Pt{constructor(e,n){super(e,`${mt.inherit}|${n}`);m(this,"boneIndex");this.boneIndex=n,this.instant=!0}getFrameEntries(){return 2}setFrame(e,n,r){e*=2,this.frames[e]=n,this.frames[e+1]=r}apply(e,n,r,s,o,l,c,a,i){let h=e.bones[this.boneIndex];if(!h.active)return;let d=i?h.appliedPose:h.pose;if(a)l!==tt.current&&(d.inherit=h.data.setupPose.inherit);else{let u=this.frames;r<u[0]?l!==tt.current&&(d.inherit=h.data.setupPose.inherit):d.inherit=this.frames[Pt.search(u,r,2)+1]}}},Va=class extends Zn{constructor(e,n,r,...s){super(e,n,...s);m(this,"slotIndex");this.slotIndex=r}apply(e,n,r,s,o,l,c,a,i){let h=e.slots[this.slotIndex];h.bone.active&&this.apply1(h,i?h.appliedPose:h.pose,r,o,l,c)}},Ra=class extends Va{constructor(t,e,n){super(t,e,n,`${mt.rgb}|${n}`,`${mt.alpha}|${n}`)}getFrameEntries(){return 5}setFrame(t,e,n,r,s,o){t*=5,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=s,this.frames[t+4]=o}apply1(t,e,n,r,s,o){let l=e.color,c=this.frames;if(n<c[0]){let f=t.data.setupPose.color;switch(s){case tt.setup:l.setFromColor(f);break;case tt.first:l.add((f.r-l.r)*r,(f.g-l.g)*r,(f.b-l.b)*r,(f.a-l.a)*r);break}return}let a=0,i=0,h=0,d=0,u=Pt.search(c,n,5),p=this.curves[u/5];switch(p){case 0:{let f=c[u];a=c[u+1],i=c[u+2],h=c[u+3],d=c[u+4];let g=(n-f)/(c[u+5]-f);a+=(c[u+5+1]-a)*g,i+=(c[u+5+2]-i)*g,h+=(c[u+5+3]-h)*g,d+=(c[u+5+4]-d)*g;break}case 1:a=c[u+1],i=c[u+2],h=c[u+3],d=c[u+4];break;default:a=this.getBezierValue(n,u,1,p-2),i=this.getBezierValue(n,u,2,p+18-2),h=this.getBezierValue(n,u,3,p+18*2-2),d=this.getBezierValue(n,u,4,p+18*3-2)}if(r===1)l.set(a,i,h,d);else if(s===tt.setup){let f=t.data.setupPose.color;l.set(f.r+(a-f.r)*r,f.g+(i-f.g)*r,f.b+(h-f.b)*r,f.a+(d-f.a)*r)}else l.add((a-l.r)*r,(i-l.g)*r,(h-l.b)*r,(d-l.a)*r)}},Pa=class extends Va{constructor(t,e,n){super(t,e,n,`${mt.rgb}|${n}`)}getFrameEntries(){return 4}setFrame(t,e,n,r,s){t<<=2,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=s}apply1(t,e,n,r,s,o){let l=e.color,c=0,a=0,i=0,h=this.frames;if(n<h[0]){let p=t.data.setupPose.color;switch(s){case tt.setup:{l.r=p.r,l.g=p.g,l.b=p.b;break}case tt.first:{l.r+=(p.r-l.r)*r,l.g+=(p.g-l.g)*r,l.b+=(p.b-l.b)*r;break}}return}let d=Pt.search(h,n,4),u=this.curves[d>>2];switch(u){case 0:{let p=h[d];c=h[d+1],a=h[d+2],i=h[d+3];let f=(n-p)/(h[d+4]-p);c+=(h[d+4+1]-c)*f,a+=(h[d+4+2]-a)*f,i+=(h[d+4+3]-i)*f;break}case 1:c=h[d+1],a=h[d+2],i=h[d+3];break;default:c=this.getBezierValue(n,d,1,u-2),a=this.getBezierValue(n,d,2,u+18-2),i=this.getBezierValue(n,d,3,u+18*2-2)}if(r!==1)if(s===tt.setup){let p=t.data.setupPose.color;c=p.r+(c-p.r)*r,a=p.g+(a-p.g)*r,i=p.b+(i-p.b)*r}else c=l.r+(c-l.r)*r,a=l.g+(a-l.g)*r,i=l.b+(i-l.b)*r;l.r=c<0?0:c>1?1:c,l.g=a<0?0:a>1?1:a,l.b=i<0?0:i>1?1:i}},Ya=class extends ss{constructor(e,n,r){super(e,n,`${mt.alpha}|${r}`);m(this,"slotIndex",0);this.slotIndex=r}apply(e,n,r,s,o,l,c,a,i){let h=e.slots[this.slotIndex];if(!h.bone.active)return;let d=(i?h.appliedPose:h.pose).color,u=0,p=this.frames;if(r<p[0]){let f=h.data.setupPose.color.a;switch(l){case tt.setup:d.a=f;break;case tt.first:d.a+=(f-d.a)*o;break}return}if(u=this.getCurveValue(r),o!==1)if(l===tt.setup){let f=h.data.setupPose.color;u=f.a+(u-f.a)*o}else u=d.a+(u-d.a)*o;d.a=u<0?0:u>1?1:u}},Xa=class extends Va{constructor(t,e,n){super(t,e,n,`${mt.rgb}|${n}`,`${mt.alpha}|${n}`,`${mt.rgb2}|${n}`)}getFrameEntries(){return 8}setFrame(t,e,n,r,s,o,l,c,a){t<<=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=s,this.frames[t+4]=o,this.frames[t+5]=l,this.frames[t+6]=c,this.frames[t+7]=a}apply1(t,e,n,r,s,o){let l=e.color,c=e.darkColor,a=0,i=0,h=0,d=this.frames;if(n<d[0]){let y=t.data.setupPose,w=y.color,k=y.darkColor;switch(s){case tt.setup:{l.setFromColor(w),c.r=k.r,c.g=k.g,c.b=k.b;break}case tt.first:{l.add((w.r-l.r)*r,(w.g-l.g)*r,(w.b-l.b)*r,(w.a-l.a)*r),c.r+=(k.r-c.r)*r,c.g+=(k.g-c.g)*r,c.b+=(k.b-c.b)*r;break}}return}let u=0,p=0,f=0,g=0,b=Pt.search(d,n,8),x=this.curves[b>>3];switch(x){case 0:{let y=d[b];u=d[b+1],p=d[b+2],f=d[b+3],g=d[b+4],a=d[b+5],i=d[b+6],h=d[b+7];let w=(n-y)/(d[b+8]-y);u+=(d[b+8+1]-u)*w,p+=(d[b+8+2]-p)*w,f+=(d[b+8+3]-f)*w,g+=(d[b+8+4]-g)*w,a+=(d[b+8+5]-a)*w,i+=(d[b+8+6]-i)*w,h+=(d[b+8+7]-h)*w;break}case 1:u=d[b+1],p=d[b+2],f=d[b+3],g=d[b+4],a=d[b+5],i=d[b+6],h=d[b+7];break;default:u=this.getBezierValue(n,b,1,x-2),p=this.getBezierValue(n,b,2,x+18-2),f=this.getBezierValue(n,b,3,x+18*2-2),g=this.getBezierValue(n,b,4,x+18*3-2),a=this.getBezierValue(n,b,5,x+18*4-2),i=this.getBezierValue(n,b,6,x+18*5-2),h=this.getBezierValue(n,b,7,x+18*6-2)}if(r===1)l.set(u,p,f,g);else if(s===tt.setup){let y=t.data.setupPose,w=y.color;l.set(w.r+(u-w.r)*r,w.g+(p-w.g)*r,w.b+(f-w.b)*r,w.a+(g-w.a)*r),w=y.darkColor,a=w.r+(a-w.r)*r,i=w.g+(i-w.g)*r,h=w.b+(h-w.b)*r}else l.add((u-l.r)*r,(p-l.g)*r,(f-l.b)*r,(g-l.a)*r),a=c.r+(a-c.r)*r,i=c.g+(i-c.g)*r,h=c.b+(h-c.b)*r;c.r=a<0?0:a>1?1:a,c.g=i<0?0:i>1?1:i,c.b=h<0?0:h>1?1:h}},La=class extends Va{constructor(t,e,n){super(t,e,n,`${mt.rgb}|${n}`,`${mt.rgb2}|${n}`)}getFrameEntries(){return 7}setFrame(t,e,n,r,s,o,l,c){t*=7,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=s,this.frames[t+4]=o,this.frames[t+5]=l,this.frames[t+6]=c}apply1(t,e,n,r,s,o){let l=e.color,c=e.darkColor,a=0,i=0,h=0,d=0,u=0,p=0,f=this.frames;if(n<f[0]){let x=t.data.setupPose,y=x.color,w=x.darkColor;switch(s){case tt.setup:l.r=y.r,l.g=y.g,l.b=y.b,c.r=w.r,c.g=w.g,c.b=w.b;break;case tt.first:l.r+=(y.r-l.r)*r,l.g+=(y.g-l.g)*r,l.b+=(y.b-l.b)*r,c.r+=(w.r-c.r)*r,c.g+=(w.g-c.g)*r,c.b+=(w.b-c.b)*r;break}return}let g=Pt.search(f,n,7),b=this.curves[g/7];switch(b){case 0:{let x=f[g];a=f[g+1],i=f[g+2],h=f[g+3],d=f[g+4],u=f[g+5],p=f[g+6];let y=(n-x)/(f[g+7]-x);a+=(f[g+7+1]-a)*y,i+=(f[g+7+2]-i)*y,h+=(f[g+7+3]-h)*y,d+=(f[g+7+4]-d)*y,u+=(f[g+7+5]-u)*y,p+=(f[g+7+6]-p)*y;break}case 1:a=f[g+1],i=f[g+2],h=f[g+3],d=f[g+4],u=f[g+5],p=f[g+6];break;default:a=this.getBezierValue(n,g,1,b-2),i=this.getBezierValue(n,g,2,b+18-2),h=this.getBezierValue(n,g,3,b+18*2-2),d=this.getBezierValue(n,g,4,b+18*3-2),u=this.getBezierValue(n,g,5,b+18*4-2),p=this.getBezierValue(n,g,6,b+18*5-2)}if(r!==1)if(s===tt.setup){let x=t.data.setupPose,y=x.color;a=y.r+(a-y.r)*r,i=y.g+(i-y.g)*r,h=y.b+(h-y.b)*r,y=x.darkColor,d=y.r+(d-y.r)*r,u=y.g+(u-y.g)*r,p=y.b+(p-y.b)*r}else a=l.r+(a-l.r)*r,i=l.g+(i-l.g)*r,h=l.b+(h-l.b)*r,d=c.r+(d-c.r)*r,u=c.g+(u-c.g)*r,p=c.b+(p-c.b)*r;l.r=a<0?0:a>1?1:a,l.g=i<0?0:i>1?1:i,l.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=u<0?0:u>1?1:u,c.b=p<0?0:p>1?1:p}},Dn=class extends Pt{constructor(e,n){super(e,`${mt.attachment}|${n}`);m(this,"slotIndex",0);m(this,"attachmentNames");this.slotIndex=n,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.attachmentNames[e]=r}apply(e,n,r,s,o,l,c,a,i){let h=e.slots[this.slotIndex];if(!h.bone.active)return;let d=i?h.appliedPose:h.pose;a||r<this.frames[0]?l!==tt.current&&this.setAttachment(e,d,h.data.attachmentName):this.setAttachment(e,d,this.attachmentNames[Pt.search(this.frames,r)])}setAttachment(e,n,r){n.setAttachment(r?e.getAttachment(this.slotIndex,r):null)}},Na=class extends Zn{constructor(e,n,r,s){super(e,n,`${mt.deform}|${r}|${s.id}`);m(this,"slotIndex");m(this,"attachment");m(this,"vertices");this.slotIndex=r,this.attachment=s,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.vertices[e]=r}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r===0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=i*.03-c*.06,b=((l-a)*3-s+h)*.006,x=(c-i+.33333333)*.018,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=c*.3+g+x*.16666667,I=s+k,M=S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getCurvePercent(e,n){let r=this.curves,s=r[n];switch(s){case 0:{let a=this.frames[n];return(e-a)/(this.frames[n+this.getFrameEntries()]-a)}case 1:return 0}if(s-=2,r[s]>e){let a=this.frames[n];return r[s+1]*(e-a)/(r[s]-a)}let o=s+18;for(s+=2;s<o;s+=2)if(r[s]>=e){let a=r[s-2],i=r[s-1];return i+(e-a)/(r[s]-a)*(r[s+1]-i)}let l=r[o-2],c=r[o-1];return c+(1-c)*(e-l)/(this.frames[n+this.getFrameEntries()]-l)}apply(e,n,r,s,o,l,c,a,i){let h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,i))return;let d=this.attachment.timelineSlots,u=this.frames;if(r<u[0]){this.applyBeforeFirst(h[this.slotIndex],i,o,l);for(let x of d)this.applyBeforeFirst(h[x],i,o,l);return}let p,f,g;if(r>=u[u.length-1])g=0,p=this.vertices[u.length-1],f=null;else{let x=Pt.search(u,r);g=this.getCurvePercent(r,x),p=this.vertices[x],f=this.vertices[x+1]}let b=this.vertices[0].length;this.applyToSlot(h[this.slotIndex],i,p,f,g,b,o,l,c);for(let x of d)this.applyToSlot(h[x],i,p,f,g,b,o,l,c)}applyBeforeFirst(e,n,r,s){if(!e.bone.active)return;let o=n?e.appliedPose:e.pose;if(o.attachment==null||o.attachment.timelineAttachment!==this.attachment)return;let l=o.deform;switch(l.length===0&&(s=tt.setup),s){case tt.setup:l.length=0;break;case tt.first:{if(r===1){l.length=0;return}let c=this.vertices[0].length;l.length=c;let a=l,i=o.attachment;if(i.bones===null){let h=i.vertices;for(let d=0;d<c;d++)a[d]+=(h[d]-a[d])*r}else{r=1-r;for(let h=0;h<c;h++)a[h]*=r}}}}applyToSlot(e,n,r,s,o,l,c,a,i){if(!e.bone.active)return;let h=n?e.appliedPose:e.pose;if(h.attachment===null||h.attachment.timelineAttachment!==this.attachment)return;let d=h.attachment,u=h.deform;u.length===0&&(a=tt.setup);let p=a===tt.setup;if(u.length=l,s===null)if(c===1)if(i&&!p)if(d.bones)for(let f=0;f<l;f++)u[f]+=r[f];else{let f=d.vertices;for(let g=0;g<l;g++)u[g]+=r[g]-f[g]}else J.arrayCopy(r,0,u,0,l);else if(p)if(d.bones)for(let f=0;f<l;f++)u[f]=r[f]*c;else{let f=d.vertices;for(let g=0;g<l;g++){let b=f[g];u[g]=b+(r[g]-b)*c}}else if(i)if(d.bones)for(let f=0;f<l;f++)u[f]+=r[f]*c;else{let f=d.vertices;for(let g=0;g<l;g++)u[g]+=(r[g]-f[g])*c}else for(let f=0;f<l;f++)u[f]+=(r[f]-u[f])*c;else if(c===1)if(i&&!p)if(d.bones)for(let f=0;f<l;f++){let g=r[f];u[f]+=g+(s[f]-g)*o}else{let f=d.vertices;for(let g=0;g<l;g++){let b=r[g];u[g]+=b+(s[g]-b)*o-f[g]}}else if(o===0)J.arrayCopy(r,0,u,0,l);else for(let f=0;f<l;f++){let g=r[f];u[f]=g+(s[f]-g)*o}else if(p)if(d.bones)for(let f=0;f<l;f++){let g=r[f];u[f]=(g+(s[f]-g)*o)*c}else{let f=d.vertices;for(let g=0;g<l;g++){let b=r[g],x=f[g];u[g]=x+(b+(s[g]-b)*o-x)*c}}else if(i)if(d.bones)for(let f=0;f<l;f++){let g=r[f];u[f]+=(g+(s[f]-g)*o)*c}else{let f=d.vertices;for(let g=0;g<l;g++){let b=r[g];u[g]+=(b+(s[g]-b)*o-f[g])*c}}else for(let f=0;f<l;f++){let g=r[f];u[f]+=(g+(s[f]-g)*o-u[f])*c}}},An=class An extends Pt{constructor(e,n,r){super(e,`${mt.sequence}|${n}|${r.sequence.id}`);m(this,"slotIndex");m(this,"attachment");this.slotIndex=n,this.attachment=r,this.instant=!0}getFrameEntries(){return An.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,n,r,s,o){let l=this.frames;e*=An.ENTRIES,l[e]=n,l[e+An.MODE]=r|s<<4,l[e+An.DELAY]=o}apply(e,n,r,s,o,l,c,a,i){let h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,i))return;let d=this.attachment.timelineSlots,u=this.frames;if(a||r<u[0]){if(l!==tt.current){this.setupPose(h[this.slotIndex],i);for(let x of d)this.setupPose(h[x],i)}return}let p=Pt.search(u,r,An.ENTRIES),f=u[p],g=u[p+An.MODE],b=u[p+An.DELAY];this.applyToSlot(h[this.slotIndex],i,r,f,g,b);for(let x of d)this.applyToSlot(h[x],i,r,f,g,b)}setupPose(e,n){if(!e.bone.active)return;let r=n?e.appliedPose:e.pose;r.attachment===null||r.attachment.timelineAttachment!==this.attachment||(r.sequenceIndex=-1)}applyToSlot(e,n,r,s,o,l){if(!e.bone.active)return;let c=n?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let a=o>>4,i=c.attachment.sequence.regions.length,h=ql[o&15];if(h!==de.hold)switch(a+=(r-s)/l+1e-5|0,h){case de.once:a=Math.min(i-1,a);break;case de.loop:a%=i;break;case de.pingpong:{let d=(i<<1)-2;a=d===0?0:a%d,a>=i&&(a=d-a);break}case de.onceReverse:a=Math.max(i-1-a,0);break;case de.loopReverse:a=i-1-a%i;break;case de.pingpongReverse:{let d=(i<<1)-2;a=d===0?0:(a+i-1)%d,a>=i&&(a=d-a)}}c.sequenceIndex=a}};m(An,"ENTRIES",3),m(An,"MODE",1),m(An,"DELAY",2);var Oa=An,_c=class _c extends Pt{constructor(e){super(e,..._c.propertyIds);m(this,"events");this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,n){this.frames[e]=n.time,this.events[e]=n}apply(e,n,r,s,o,l,c,a,i){if(!s)return;let h=this.frames,d=this.frames.length;if(n>r)this.apply(null,n,Number.MAX_VALUE,s,0,l,!1,!1,!1),n=-1;else if(n>=h[d-1])return;if(r<h[0])return;let u=0;if(n<h[0])u=0;else{u=Pt.search(h,n)+1;let p=h[u];for(;u>0&&h[u-1]===p;)u--}for(;u<d&&r>=h[u];u++)s.push(this.events[u])}};m(_c,"propertyIds",[`${mt.event}`]);var Tr=_c,So=class So extends Pt{constructor(e){super(e,...So.propertyIds);m(this,"drawOrders");this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.drawOrders[e]=r}apply(e,n,r,s,o,l,c,a,i){let h=i?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(a||r<this.frames[0]){l!==tt.current&&J.arrayCopy(d,0,h,0,e.slots.length);return}let u=this.drawOrders[Pt.search(this.frames,r)];if(!u)J.arrayCopy(d,0,h,0,e.slots.length);else for(let p=0,f=u.length;p<f;p++)h[p]=d[u[p]]}};m(So,"propertyID",`${mt.drawOrder}`),m(So,"propertyIds",[So.propertyID]);var Ke=So,$l=class $l extends Pt{constructor(e,n,r){super(e,...$l.propertyIds(n));m(this,"slots");m(this,"inFolder");m(this,"drawOrders");this.slots=n,this.drawOrders=new Array(e),this.inFolder=new Array(r);for(let s of n)this.inFolder[s]=!0;this.instant=!0}static propertyIds(e){let n=e.length,r=new Array(n);for(let s=0;s<n;s++)r[s]=`${$l.propertyID}|${e[s]}`;return r}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,n,r){this.frames[e]=n,this.drawOrders[e]=r}apply(e,n,r,s,o,l,c,a,i){let h=i?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(a||r<this.frames[0])l!==tt.current&&this.setup(h,d);else{let u=this.drawOrders[Pt.search(this.frames,r)];if(!u)this.setup(h,d);else{let p=this.inFolder,f=this.slots;for(let g=0,b=0,x=f.length;!(p[h[g].data.index]&&(h[g]=d[f[u[b]]],++b===x));g++);}}}setup(e,n){let{inFolder:r,slots:s}=this;for(let o=0,l=0,c=s.length;!(r[e[o].data.index]&&(e[o]=n[s[l]],++l===c));o++);}};m($l,"propertyID",`${mt.drawOrderFolder}`);var Vn=$l;function xm(A){return typeof A=="object"&&A!==null&&typeof A.constraintIndex=="number"}var Ua=class extends Zn{constructor(e,n,r){super(e,n,`${mt.ikConstraint}|${r}`);m(this,"constraintIndex",0);this.constraintIndex=r}getFrameEntries(){return 6}setFrame(e,n,r,s,o,l,c){e*=6,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l?1:0,this.frames[e+5]=c?1:0}apply(e,n,r,s,o,l,c,a,i){let h=e.constraints[this.constraintIndex];if(!h.active)return;let d=i?h.appliedPose:h.pose,u=this.frames;if(r<u[0]){let y=h.data.setupPose;switch(l){case tt.setup:{d.mix=y.mix,d.softness=y.softness,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}case tt.first:{d.mix+=(y.mix-d.mix)*o,d.softness+=(y.softness-d.softness)*o,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}}return}let p=0,f=0,g=Pt.search(u,r,6),b=this.curves[g/6];switch(b){case 0:{let y=u[g];p=u[g+1],f=u[g+2];let w=(r-y)/(u[g+6]-y);p+=(u[g+6+1]-p)*w,f+=(u[g+6+2]-f)*w;break}case 1:p=u[g+1],f=u[g+2];break;default:p=this.getBezierValue(r,g,1,b-2),f=this.getBezierValue(r,g,2,b+18-2)}let x=l===tt.setup?h.data.setupPose:d;d.mix=x.mix+(p-x.mix)*o,d.softness=x.softness+(f-x.softness)*o,a?l===tt.setup&&(d.bendDirection=x.bendDirection,d.compress=x.compress,d.stretch=x.stretch):(d.bendDirection=u[g+3],d.compress=u[g+4]!==0,d.stretch=u[g+5]!==0)}},Wa=class extends Zn{constructor(e,n,r){super(e,n,`${mt.transformConstraint}|${r}`);m(this,"constraintIndex",0);this.constraintIndex=r,this.additive=!0}getFrameEntries(){return 7}setFrame(e,n,r,s,o,l,c,a){let i=this.frames;e*=7,i[e]=n,i[e+1]=r,i[e+2]=s,i[e+3]=o,i[e+4]=l,i[e+5]=c,i[e+6]=a}apply(e,n,r,s,o,l,c,a,i){let h=e.constraints[this.constraintIndex];if(!h.active)return;let d=i?h.appliedPose:h.pose,u=this.frames;if(r<u[0]){let I=h.data.setupPose;switch(l){case tt.setup:{d.mixRotate=I.mixRotate,d.mixX=I.mixX,d.mixY=I.mixY,d.mixScaleX=I.mixScaleX,d.mixScaleY=I.mixScaleY,d.mixShearY=I.mixShearY;break}case tt.first:{d.mixRotate+=(I.mixRotate-d.mixRotate)*o,d.mixX+=(I.mixX-d.mixX)*o,d.mixY+=(I.mixY-d.mixY)*o,d.mixScaleX+=(I.mixScaleX-d.mixScaleX)*o,d.mixScaleY+=(I.mixScaleY-d.mixScaleY)*o,d.mixShearY+=(I.mixShearY-d.mixShearY)*o;break}}return}let p,f,g,b,x,y,w=Pt.search(u,r,7),k=this.curves[w/7];switch(k){case 0:{let I=u[w];p=u[w+1],f=u[w+2],g=u[w+3],b=u[w+4],x=u[w+5],y=u[w+6];let M=(r-I)/(u[w+7]-I);p+=(u[w+7+1]-p)*M,f+=(u[w+7+2]-f)*M,g+=(u[w+7+3]-g)*M,b+=(u[w+7+4]-b)*M,x+=(u[w+7+5]-x)*M,y+=(u[w+7+6]-y)*M;break}case 1:p=u[w+1],f=u[w+2],g=u[w+3],b=u[w+4],x=u[w+5],y=u[w+6];break;default:p=this.getBezierValue(r,w,1,k-2),f=this.getBezierValue(r,w,2,k+18-2),g=this.getBezierValue(r,w,3,k+18*2-2),b=this.getBezierValue(r,w,4,k+18*3-2),x=this.getBezierValue(r,w,5,k+18*4-2),y=this.getBezierValue(r,w,6,k+18*5-2)}let S=l===tt.setup?h.data.setupPose:d;c?(d.mixRotate=S.mixRotate+p*o,d.mixX=S.mixX+f*o,d.mixY=S.mixY+g*o,d.mixScaleX=S.mixScaleX+b*o,d.mixScaleY=S.mixScaleY+x*o,d.mixShearY=S.mixShearY+y*o):(d.mixRotate=S.mixRotate+(p-S.mixRotate)*o,d.mixX=S.mixX+(f-S.mixX)*o,d.mixY=S.mixY+(g-S.mixY)*o,d.mixScaleX=S.mixScaleX+(b-S.mixScaleX)*o,d.mixScaleY=S.mixScaleY+(x-S.mixScaleY)*o,d.mixShearY=S.mixShearY+(y-S.mixShearY)*o)}},as=class extends ss{constructor(e,n,r,s){super(e,n,`${s}|${r}`);m(this,"constraintIndex");this.constraintIndex=r}},qa=class extends as{constructor(t,e,n){super(t,e,n,mt.pathConstraintPosition),this.additive=!0}apply(t,e,n,r,s,o,l,c,a){let i=t.constraints[this.constraintIndex];if(i.active){let h=a?i.appliedPose:i.pose;h.position=this.getAbsoluteValue(n,s,o,l,h.position,i.data.setupPose.position)}}},$a=class extends as{constructor(t,e,n){super(t,e,n,mt.pathConstraintSpacing)}apply(t,e,n,r,s,o,l,c,a){let i=t.constraints[this.constraintIndex];if(i.active){let h=a?i.appliedPose:i.pose;h.spacing=this.getAbsoluteValue(n,s,o,!1,h.spacing,i.data.setupPose.spacing)}}},za=class extends Zn{constructor(e,n,r){super(e,n,`${mt.pathConstraintMix}|${r}`);m(this,"constraintIndex");this.constraintIndex=r}getFrameEntries(){return 4}setFrame(e,n,r,s,o){let l=this.frames;e<<=2,l[e]=n,l[e+1]=r,l[e+2]=s,l[e+3]=o}apply(e,n,r,s,o,l,c,a,i){let h=e.constraints[this.constraintIndex];if(!h.active)return;let d=i?h.appliedPose:h.pose,u=this.frames;if(r<u[0]){let w=h.data.setupPose;switch(l){case tt.setup:{d.mixRotate=w.mixRotate,d.mixX=w.mixX,d.mixY=w.mixY;break}case tt.first:{d.mixRotate+=(w.mixRotate-d.mixRotate)*o,d.mixX+=(w.mixX-d.mixX)*o,d.mixY+=(w.mixY-d.mixY)*o;break}}return}let p,f,g,b=Pt.search(u,r,4),x=this.curves[b>>2];switch(x){case 0:{let w=u[b];p=u[b+1],f=u[b+2],g=u[b+3];let k=(r-w)/(u[b+4]-w);p+=(u[b+4+1]-p)*k,f+=(u[b+4+2]-f)*k,g+=(u[b+4+3]-g)*k;break}case 1:p=u[b+1],f=u[b+2],g=u[b+3];break;default:p=this.getBezierValue(r,b,1,x-2),f=this.getBezierValue(r,b,2,x+18-2),g=this.getBezierValue(r,b,3,x+18*2-2)}let y=l===tt.setup?h.data.setupPose:d;c?(d.mixRotate=y.mixRotate+p*o,d.mixX=y.mixX+f*o,d.mixY=y.mixY+g*o):(d.mixRotate=y.mixRotate+(p-y.mixRotate)*o,d.mixX=y.mixX+(f-y.mixX)*o,d.mixY=y.mixY+(g-y.mixY)*o)}},kn=class extends as{constructor(t,e,n,r){super(t,e,n,r)}apply(t,e,n,r,s,o,l,c,a){if(l&&!this.additive&&(l=!1),this.constraintIndex===-1){let i=n>=this.frames[0]?this.getCurveValue(n):0,h=t.physics;for(let d of h)if(d.active&&this.global(d.data)){let u=a?d.appliedPose:d.pose;this.set(u,this.getAbsoluteValue(n,s,o,l,this.get(u),this.get(d.data.setupPose),i))}}else{let i=t.constraints[this.constraintIndex];if(i.active){let h=a?i.appliedPose:i.pose;this.set(h,this.getAbsoluteValue(n,s,o,l,this.get(h),this.get(i.data.setupPose)))}}}},Ha=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintInertia)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Ga=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintStrength)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ja=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintDamping)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},Za=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintMass)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},Ka=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintWind),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},Ja=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintGravity),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Qa=class extends kn{constructor(t,e,n){super(t,e,n,mt.physicsConstraintMix)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},th=class th extends Pt{constructor(e,n){super(e,...th.propertyIds);m(this,"constraintIndex");this.constraintIndex=n,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,n){this.frames[e]=n}apply(e,n,r,s,o,l,c,a,i){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;let d=this.frames;if(n>r)this.apply(e,n,Number.MAX_VALUE,[],o,l,!1,!1,!1),n=-1;else if(n>=d[d.length-1])return;if(!(r<d[0])&&(n<d[0]||r>=d[Pt.search(d,n)+1]))if(h!=null)h.reset(e);else for(let u of e.physics)u.active&&u.reset(e)}};m(th,"propertyIds",[mt.physicsConstraintReset.toString()]);var _a=th,ti=class extends as{constructor(t,e,n){super(t,e,n,mt.sliderTime)}apply(t,e,n,r,s,o,l,c,a){let i=t.constraints[this.constraintIndex];if(i.active){let h=a?i.appliedPose:i.pose;h.time=this.getAbsoluteValue(n,s,o,l,h.time,i.data.setupPose.time)}}},ei=class extends as{constructor(t,e,n){super(t,e,n,mt.sliderMix),this.additive=!0}apply(t,e,n,r,s,o,l,c,a){let i=t.constraints[this.constraintIndex];if(i.active){let h=a?i.appliedPose:i.pose;h.mix=this.getAbsoluteValue(n,s,o,l,h.mix,i.data.setupPose.mix)}}};var Hl=class Hl{constructor(t){m(this,"data");m(this,"tracks",[]);m(this,"timeScale",1);m(this,"unkeyedState",0);m(this,"events",[]);m(this,"listeners",[]);m(this,"queue",new nh(this));m(this,"propertyIds",new Map);m(this,"animationsChanged",!1);m(this,"trackEntryPool",new wn(()=>new eh));this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let o=t*s.timeScale;if(s.delay>0){if(s.delay-=o,s.delay>0)continue;o=-s.delay,s.delay=0}let l=s.next;if(l){let c=s.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime+=s.timeScale===0?0:(c/s.timeScale+t)*l.timeScale,s.trackTime+=o,this.setTrack(n,l,!0);l.mixingFrom;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&!s.mixingFrom){e[n]=null,this.queue.end(s),this.clearNext(s);continue}if(s.mixingFrom&&this.updateMixingFrom(s,t)){let c=s.mixingFrom;for(s.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}s.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let n=t.mixingFrom;if(!n)return!0;let r=this.updateMixingFrom(n,e);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(n.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),n.totalAlpha===0)for(let s=t;s.mixingTo!=null;s=s.mixingTo)s.keepHold=!0;this.queue.end(n)}return r}return n.trackTime+=e*n.timeScale,t.mixTime+=e,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,n=this.tracks,r=!1;for(let l=0,c=n.length;l<c;l++){let a=n[l];if(!a||a.delay>0)continue;r=!0;let i=a.alpha;a.mixingFrom?i*=this.applyMixingFrom(a,t):a.trackTime>=a.trackEnd&&!a.next&&(i=0);let h=a.animationLast,d=a.getAnimationTime(),u=d,p=e;a.reverse&&(u=a.animation.duration-u,p=null);let f=a.animation.timelines,g=f.length;if(l===0&&i===1)for(let b=0;b<g;b++){J.webkit602BugfixHelper(i);let x=f[b];x instanceof Dn?this.applyAttachmentTimeline(x,t,u,tt.setup,!0):x.apply(t,h,u,p,i,tt.setup,!1,!1,!1)}else{let b=a.timelineMode,x=i>=a.alphaAttachmentThreshold,y=a.additive,w=y||a.shortestRotation,k=!w&&a.timelinesRotation.length!==g<<1;k&&(a.timelinesRotation.length=g<<1);for(let S=0;S<g;S++){let I=f[S],M=b[S]&Am;!w&&I instanceof Jn?this.applyRotateTimeline(I,t,u,i,M,a.timelinesRotation,S<<1,k):I instanceof Dn?this.applyAttachmentTimeline(I,t,u,M,x):(J.webkit602BugfixHelper(i),I.apply(t,h,u,p,i,M,y,!1,!1))}}a.reverse&&this.eventsReverse(a,h,d),this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}let s=this.unkeyedState+km,o=t.slots;for(let l=0,c=t.slots.length;l<c;l++){let a=o[l];if(a.attachmentState===s){let i=a.data.attachmentName;a.pose.setAttachment(i?t.getAttachment(a.data.index,i):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e){let n=t.mixingFrom,r=n.mixingFrom!==null?this.applyMixingFrom(n,e):1,s=t.mix(),o=n.alpha*r,l=1-s*t.alpha,c=o*(1-s),a=l>0?c/l:o,i=n.animation.timelines,h=i.length,d=n.timelineMode,u=n.timelineHoldMix,p=s<n.mixAttachmentThreshold,f=s<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==h<<1;x&&(n.timelinesRotation.length=h<<1);let y=n.timelinesRotation,w=n.animationLast,k=n.getAnimationTime(),S=k,I=null;n.reverse?S=n.animation.duration-S:s<n.eventThreshold&&(I=this.events),n.totalAlpha=0;for(let M=0;M<h;M++){let v=i[M],E=d[M],C=E&Am,T=0;if(E&zl){let F=u[M];T=F==null?a:a*(1-F.mix())}else{if(!f&&v instanceof Ke&&C===tt.current)continue;T=c}if(n.totalAlpha+=T,!b&&v instanceof Jn)this.applyRotateTimeline(v,e,S,T,C,y,M<<1,x);else if(v instanceof Dn)this.applyAttachmentTimeline(v,e,S,C,p&&T>=n.alphaAttachmentThreshold);else{let F=!f||!(v instanceof Ke)||C===tt.current;v.apply(e,w,S,I,T,C,g,F,!1)}}return n.reverse&&s<n.eventThreshold&&this.eventsReverse(n,w,k),t.mixDuration>0&&this.queueEvents(n,k),this.events.length=0,n.nextAnimationLast=k,n.nextTrackLast=n.trackTime,s}applyAttachmentTimeline(t,e,n,r,s){let o=e.slots[t.slotIndex];if(!o.bone.active||!s&&o.attachmentState===this.unkeyedState+Im)return;let l=n<t.frames[0],c=null;if(l||(c=t.attachmentNames[Pt.search(t.frames,n)],l=!s&&c==null),l){if(r===tt.current)return;c=o.data.attachmentName}o.pose.setAttachment(c==null?null:e.getAttachment(o.data.index,c)),s?o.attachmentState=this.unkeyedState+Im:l||(o.attachmentState=this.unkeyedState+km)}applyRotateTimeline(t,e,n,r,s,o,l,c){if(c&&(o[l]=0),r===1){t.apply(e,0,n,null,1,s,!1,!1,!1);return}let a=e.bones[t.boneIndex];if(!a.active)return;let i=a.pose,h=a.data.setupPose,d=t.frames,u,p;if(n<d[0]){switch(s){case tt.setup:{i.rotation=h.rotation;return}case tt.current:return}u=i.rotation,p=h.rotation}else u=s===tt.setup?h.rotation:i.rotation,p=h.rotation+t.getCurveValue(n);let f=0,g=p-u;if(g-=Math.ceil(g/360-.5)*360,g===0)f=o[l];else{let b=0,x=0;c?(b=0,x=g):(b=o[l],x=o[l+1]);let y=b-b%360;f=g+y;let w=g>=0,k=b>=0;Math.abs(x)<=90&&Q.signum(x)!==Q.signum(g)&&(Math.abs(b-y)>180?(f+=360*Q.signum(b),k=w):y!==0?f-=360*Q.signum(b):k=w),k!==w&&(f+=360*Q.signum(b)),o[l]=f}o[l+1]=g,i.rotation=u+f*r}queueEvents(t,e){let n=t.animationStart,r=t.animationEnd,s=r-n,o=t.reverse,l=t.trackLast%s;o&&(l=s-l);let c=this.events,a=0,i=c.length;for(;a<i;a++){let d=c[a];if(d.time<l!==o)break;d.time>=n&&d.time<=r&&this.queue.event(t,d)}let h=!1;if(t.loop)if(s===0)h=!0;else{let d=Math.floor(t.trackTime/s);h=d>0&&d>Math.floor(t.trackLast/s)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);a<i;a++){let d=c[a];d.time>=n&&d.time<=r&&this.queue.event(t,d)}}eventsReverse(t,e,n){let r=t.animation.duration,s=r-e,o=r-n,l=t.animation.timelines;for(let c=0,a=t.animation.timelines.length;c<a;c++){let i=l[c];if(!(i instanceof Tr))continue;let h=i.events,d=i.frames,u=d.length;if(s>=o){for(let p=0;p<u;p++)if(!(d[p]<o)){if(d[p]>=s)break;this.events.push(h[p])}}else{for(let f=0;f<u&&!(d[f]>=s);f++)this.events.push(h[f]);let p=0;for(;p<u&&!(d[p]>=o);p++);for(;p<u;p++)this.events.push(h[p])}}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let n=e;for(;;){let r=n.mixingFrom;if(!r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}setTrack(t,e,n){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(r.next=null,n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n=!1){return typeof e=="string"?this.setAnimation1(t,e,n):this.setAnimation2(t,e,n)}setAnimation1(t,e,n=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);return this.setAnimation2(t,r,n)}setAnimation2(t,e,n=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!e)throw new Error("animation cannot be null.");let r=!0,s=this.expandToIndex(t);s&&(s.nextTrackLast===-1&&s.animation===e?(this.tracks[t]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.clearNext(s),s=s.mixingFrom,r=!1):this.clearNext(s));let o=this.trackEntry(t,e,n,s);return this.setTrack(t,o,r),this.queue.drain(),o}addAnimation(t,e,n=!1,r=0){return typeof e=="string"?this.addAnimation1(t,e,n,r):this.addAnimation2(t,e,n,r)}addAnimation1(t,e,n=!1,r=0){let s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);return this.addAnimation2(t,s,n,r)}addAnimation2(t,e,n=!1,r=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!e)throw new Error("animation cannot be null.");let s=this.expandToIndex(t);if(s)for(;s.next;)s=s.next;let o=this.trackEntry(t,e,n,s);return s?(s.next=o,o.previous=s,r<=0&&(r=Math.max(r+s.getTrackComplete()-o.mixDuration,0))):(this.setTrack(t,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(t,e=0){let n=this.setAnimation(t,Hl.emptyAnimation,!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e=0,n=0){let r=this.addAnimation(t,Hl.emptyAnimation,!1,n);return n<=0&&(r.delay=Math.max(r.delay+r.mixDuration-e,0)),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,r=this.tracks.length;n<r;n++){let s=this.tracks[n];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(J.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,n,r){let s=this.trackEntryPool.obtain();return s.reset(),s.trackIndex=t,s.animation=e,s.loop=n,s.additive=!1,s.reverse=!1,s.shortestRotation=!1,s.eventThreshold=0,s.alphaAttachmentThreshold=0,s.mixAttachmentThreshold=0,s.mixDrawOrderThreshold=0,s.animationStart=0,s.animationEnd=e.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.mixTime=0,s.mixDuration=r?this.data.getMix(r.animation,e):0,s.totalAlpha=0,s.keepHold=!1,s}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;let t=this.tracks;for(let e=0,n=t.length;e<n;e++){let r=t[e];if(!r)continue;let s=r;for(;s.mixingFrom;)s=s.mixingFrom;do this.computeHold(s,r),s=s.mixingTo;while(s)}this.propertyIds.clear()}computeHold(t,e){let n=t.animation.timelines,r=t.animation.timelines.length,s=t.timelineMode;s.length=r;let o=t.timelineHoldMix;o.length=0;let l=t.additive,c=t.keepHold,a=t.mixingTo;for(let i=0;i<r;i++){let h=n[i],d=h.propertyIds,u=this.from(e,h,d);if(l&&h.additive){s[i]=u;continue}let p;if(a===null||h.instant||a.additive&&h.additive||!a.animation?.hasTimeline(d))p=u;else{p=u|zl;for(let f=a.mixingTo;f!=null;f=f.mixingTo)if(f.additive&&h.additive||!f.animation?.hasTimeline(d)){f.mixDuration>0&&(o[i]=f);break}}c&&(p=p&~zl|s[i]&zl),s[i]=p}}from(t,e,n){let r=this.propertyIds,s=wd;for(let o=0,l=n.length;o<l;o++){let c=r.get(n[o]);if(c===void 0)r.set(n[o],t);else{if(c!==t){for(;++o<l;)r.has(n[o])||r.set(n[o],t);return wm}s=Sm}}if(e instanceof Vn){let o=r.get(Ke.propertyID);if(o!=null)return o!==t?wm:Sm}return s}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");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()}};m(Hl,"emptyAnimation",new Er("<empty>",[],0));var ko=Hl,eh=class{constructor(){m(this,"animation",null);m(this,"previous",null);m(this,"next",null);m(this,"mixingFrom",null);m(this,"mixingTo",null);m(this,"listener",null);m(this,"trackIndex",0);m(this,"loop",!1);m(this,"additive",!1);m(this,"reverse",!1);m(this,"shortestRotation",!1);m(this,"keepHold",!1);m(this,"eventThreshold",0);m(this,"mixAttachmentThreshold",0);m(this,"alphaAttachmentThreshold",0);m(this,"mixDrawOrderThreshold",0);m(this,"animationStart",0);m(this,"animationEnd",0);m(this,"animationLast",0);m(this,"nextAnimationLast",0);m(this,"delay",0);m(this,"trackTime",0);m(this,"trackLast",0);m(this,"nextTrackLast",0);m(this,"trackEnd",0);m(this,"timeScale",0);m(this,"alpha",0);m(this,"mixTime",0);m(this,"mixDuration",0);m(this,"totalAlpha",0);m(this,"mixInterpolation",es.linear);m(this,"timelineMode",[]);m(this,"timelineHoldMix",[]);m(this,"timelinesRotation",[])}setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===es.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=es.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);let t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}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(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},nh=class{constructor(t){m(this,"objects",[]);m(this,"drainDisabled",!1);m(this,"animState");this.animState=t}start(t){this.objects.push(Re.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Re.interrupt),this.objects.push(t)}end(t){this.objects.push(Re.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Re.dispose),this.objects.push(t)}complete(t){this.objects.push(Re.complete),this.objects.push(t)}event(t,e){this.objects.push(Re.event),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){let e=this.objects,n=e[t],r=e[t+1],s=this.animState.listeners.slice();switch(n){case Re.start:r.listener?.start&&r.listener.start(r);for(let o=0;o<s.length;o++){let l=s[o];l.start&&l.start(r)}break;case Re.interrupt:r.listener?.interrupt&&r.listener.interrupt(r);for(let o=0;o<s.length;o++){let l=s[o];l.interrupt&&l.interrupt(r)}break;case Re.end:r.listener?.end&&r.listener.end(r);for(let o=0;o<s.length;o++){let l=s[o];l.end&&l.end(r)}case Re.dispose:r.listener?.dispose&&r.listener.dispose(r);for(let o=0;o<s.length;o++){let l=s[o];l.dispose&&l.dispose(r)}this.animState.trackEntryPool.free(r);break;case Re.complete:r.listener?.complete&&r.listener.complete(r);for(let o=0;o<s.length;o++){let l=s[o];l.complete&&l.complete(r)}break;case Re.event:{let o=e[t+++2];r.listener?.event&&r.listener.event(r,o);for(let l=0;l<s.length;l++){let c=s[l];c.event&&c.event(r,o)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Re;(function(A){A[A.start=0]="start",A[A.interrupt=1]="interrupt",A[A.end=2]="end",A[A.dispose=3]="dispose",A[A.complete=4]="complete",A[A.event=5]="event"})(Re||(Re={}));var ym=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},wm=0,wd=1,Sm=2,Am=3,zl=4,km=1,Im=2;var Gl=class{constructor(t){m(this,"skeletonData");m(this,"animationToMixTime",{});m(this,"defaultMix",0);if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){return typeof t=="string"?this.setMix1(t,e,n):this.setMix2(t,e,n)}setMix1(t,e,n){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);let s=this.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);this.setMix2(r,s,n)}setMix2(t,e,n){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]=n}getMix(t,e){let n=`${t.name}.${e.name}`,r=this.animationToMixTime[n];return r===void 0?this.defaultMix:r}};var rh=class{constructor(t,e="",n=new jl,r=new sh){m(this,"textureLoader");m(this,"pathPrefix");m(this,"downloader");m(this,"cache");m(this,"errors",{});m(this,"toLoad",0);m(this,"loaded",0);m(this,"texturePmaInfo",{});this.textureLoader=t,this.pathPrefix=e,this.downloader=n,this.cache=r}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,n){this.toLoad--,this.loaded++,this.cache.assets[e]=n,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,n)}error(t,e,n){this.toLoad--,this.loaded++,this.errors[e]=n,t&&t(e,n)}loadAll(){return new Promise((e,n)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?n(this.errors):e(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},n=()=>{}){t=this.start(t),!this.reuseAssets(t,e,n)&&(this.cache.assetsLoaded[t]=new Promise((r,s)=>{this.downloader.downloadBinary(t,o=>{this.success(e,t,o),r(o)},(o,l)=>{let c=`Couldn't load binary ${t}: status ${o}, ${l}`;this.error(n,t,c),s(c)})}))}loadText(t,e=()=>{},n=()=>{}){t=this.start(t),this.downloader.downloadText(t,r=>{this.success(e,t,r)},(r,s)=>{this.error(n,t,`Couldn't load text ${t}: status ${r}, ${s}`)})}loadJson(t,e=()=>{},n=()=>{}){t=this.start(t),!this.reuseAssets(t,e,n)&&(this.cache.assetsLoaded[t]=new Promise((r,s)=>{this.downloader.downloadJson(t,o=>{this.success(e,t,o),r(o)},(o,l)=>{let c=`Couldn't load JSON ${t}: status ${o}, ${l}`;this.error(n,t,c),s(c)})}))}reuseAssets(t,e=()=>{},n=()=>{}){let r=this.cache.getAsset(t),s=r!==void 0;return s&&(this.cache.assetsLoaded[t]=r.then(o=>(o=o instanceof Image||o instanceof ImageBitmap?this.textureLoader(o):o,this.success(e,t,o),o)).catch(o=>{this.error(n,t,o)})),s}loadTexture(t,e=()=>{},n=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,n))return;let r=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((s,o)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();let i=`Couldn't load image: ${t}`;this.error(n,t,`Couldn't load image: ${t}`),o(i)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){let i=this.createTexture(t,r,a);this.success(e,t,i),s(i)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{let i=this.createTexture(t,r,a);this.success(e,t,i),s(i)},a.onerror=()=>{let i=`Couldn't load image: ${t}`;this.error(n,t,i),o(i)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}})}loadTextureAtlas(t,e=()=>{},n=()=>{},r){let s=t.lastIndexOf("/"),o=s>=0?t.substring(0,s+1):"";t=this.start(t),!this.reuseAssets(t,e,n)&&(this.cache.assetsLoaded[t]=new Promise((l,c)=>{this.downloader.downloadText(t,a=>{try{let i=this.createTextureAtlas(a,o,t,r),h=i.pages.length,d=!1;if(h===0){this.success(e,t,i),l(i);return}for(let u of i.pages)this.loadTexture(this.texturePath(o,u.name,r),(p,f)=>{d||(u.setTexture(f),--h===0&&(this.success(e,t,i),l(i)))},(p,f)=>{if(!d){let g=`Couldn't load texture ${t} page image: ${p}`;this.error(n,t,g),c(g)}d=!0})}catch(i){let h=`Couldn't parse texture atlas ${t}: ${i.message}`;this.error(n,t,h),c(h)}},(a,i)=>{let h=`Couldn't load texture atlas ${t}: status ${a}, ${i}`;this.error(n,t,h),c(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},n=()=>{}){let r=t.lastIndexOf("/"),s=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,n)&&(this.cache.assetsLoaded[t]=new Promise((o,l)=>{this.downloader.downloadText(t,c=>{try{let a=this.createTextureAtlas(c,s,t);this.success(e,t,a),o(a)}catch(a){let i=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(n,t,i),l(i)}},(c,a)=>{let i=`Couldn't load texture atlas ${t}: status ${c}, ${a}`;this.error(n,t,i),l(i)})}))}async loadBinaryAsync(t){return new Promise((e,n)=>{this.loadBinary(t,(r,s)=>e(s),(r,s)=>n(s))})}async loadJsonAsync(t){return new Promise((e,n)=>{this.loadJson(t,(r,s)=>e(s),(r,s)=>n(s))})}async loadTextureAsync(t){return new Promise((e,n)=>{this.loadTexture(t,(r,s)=>e(s),(r,s)=>n(s))})}async loadTextureAtlasAsync(t){return new Promise((e,n)=>{this.loadTextureAtlas(t,(r,s)=>e(s),(r,s)=>n(s))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,n)=>{this.loadTextureAtlasButNoTextures(t,(r,s)=>e(s),(r,s)=>n(s))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let n=this.errors[t];throw Error(`Asset not found: ${t}${n?`
|
|
11
|
+
${n}`:""}`)}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){let e=this.cache.assets[t];if(e instanceof rs){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,n,r){let s=new rs(t);s.dispose=()=>{if(!(this.cache.assetsRefCount[n]<=0)){this.disposeAssetInternal(n);for(let o of s.pages)o.texture?.dispose()}};for(let o of s.pages){let l=this.texturePath(e,o.name,r);this.texturePmaInfo[this.pathPrefix+l]=o.pma}return s}createTexture(t,e,n){let r=this.textureLoader(n,e),s=r.dispose.bind(r);return r.dispose=()=>{this.disposeAssetInternal(t)&&s()},r}texturePath(t,e,n){return n?n[e]:t+e}},Io=class Io{constructor(){m(this,"assets",{});m(this,"assetsRefCount",{});m(this,"assetsLoaded",{})}static getCache(t){let e=Io.AVAILABLE_CACHES.get(t);if(e)return e;let n=new Io;return Io.AVAILABLE_CACHES.set(t,n),n}async addAsset(t,e){return this.assetsLoaded[t]=Promise.resolve(e),this.assets[t]=e,e}getAsset(t){return this.assetsLoaded[t]}};m(Io,"AVAILABLE_CACHES",new Map);var sh=Io,jl=class{constructor(){m(this,"callbacks",{});m(this,"rawDataUris",{})}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.charCodeAt(s);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e===-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,n){if(this.start(t,e,n))return;let r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToString(r))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let s=new XMLHttpRequest;s.overrideMimeType("text/html"),s.open("GET",r||t,!0);let o=()=>{this.finish(t,s.status,s.responseText)};s.onload=o,s.onerror=o,s.send()}downloadJson(t,e,n){this.downloadText(t,r=>{e(JSON.parse(r))},n)}downloadBinary(t,e,n){if(this.start(t,e,n))return;let r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(r))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let s=new XMLHttpRequest;s.open("GET",r||t,!0),s.responseType="arraybuffer";let o=()=>{this.finish(t,s.status,s.response)};s.onload=()=>{s.status===200||s.status===0?this.finish(t,200,new Uint8Array(s.response)):o()},s.onerror=o,s.send()}start(t,e,n){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,n)}}finish(t,e,n){let r=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let s=0,o=r.length;s<o;s+=2)r[s](n);else for(let s=1,o=r.length;s<o;s+=2)r[s](e,n)}};var ni=class A extends Ce{constructor(e){super(e);m(this,"color",new _(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}};var xe=class A extends Ce{constructor(e){super(e);m(this,"endSlot",null);m(this,"convex",!1);m(this,"inverse",!1);m(this,"color",new _(.2275,.2275,.8078,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}};var Qn=class A extends Ce{constructor(e){super(e);m(this,"lengths",[]);m(this,"closed",!1);m(this,"constantSpeed",!1);m(this,"color",new _(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.lengths=[],J.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}};var Zl=class A extends Ce{constructor(e){super(e);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"color",new _(.38,.94,0,1))}computeWorldPosition(e,n){return n.x=this.x*e.a+this.y*e.b+e.worldX,n.y=this.x*e.c+this.y*e.d+e.worldY,n}computeWorldRotation(e){let n=this.rotation*Q.degRad,r=Math.cos(n),s=Math.sin(n),o=r*e.a+s*e.b,l=r*e.c+s*e.d;return Q.atan2Deg(l,o)}copy(){let e=new A(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}};var Kl=class{constructor(t,e=!1){m(this,"atlas");m(this,"allowMissingRegions");this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,n){let r=n.regions;for(let s=0,o=r.length;s<o;s++)r[s]=this.findRegion(t,n.getPath(e,s))}findRegion(t,e){let n=this.atlas.findRegion(e);if(!n&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return n}newRegionAttachment(t,e,n,r,s){return this.findRegions(n,r,s),new ct(n,s)}newMeshAttachment(t,e,n,r,s){return this.findRegions(n,r,s),new Ot(n,s)}newBoundingBoxAttachment(t,e,n){return new ni(n)}newPathAttachment(t,e,n){return new Qn(n)}newPointAttachment(t,e,n){return new Zl(n)}newClippingAttachment(t,e,n){return new xe(n)}};var Br=class{constructor(t,e){m(this,"name");m(this,"setupPose");m(this,"skinRequired",!1);if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}};var ri=class A extends Br{constructor(e,n,r){super(n,new is);m(this,"index",0);m(this,"parent",null);m(this,"length",0);m(this,"color",new _);m(this,"icon");m(this,"iconSize",1);m(this,"iconRotation",0);m(this,"visible",!1);if(e<0)throw new Error("index must be >= 0.");if(!n)throw new Error("name cannot be null.");this.index=e,this.parent=r}copy(e){let n=new A(this.index,this.name,e);return n.length=this.length,n.setupPose.set(this.setupPose),n}},Ut;(function(A){A[A.Normal=0]="Normal",A[A.OnlyTranslation=1]="OnlyTranslation",A[A.NoRotationOrReflection=2]="NoRotationOrReflection",A[A.NoScale=3]="NoScale",A[A.NoScaleOrReflection=4]="NoScaleOrReflection"})(Ut||(Ut={}));var is=class{constructor(){m(this,"bone");m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",0);m(this,"scaleY",0);m(this,"shearX",0);m(this,"shearY",0);m(this,"inherit",Ut.Normal);m(this,"a",0);m(this,"b",0);m(this,"c",0);m(this,"d",0);m(this,"worldY",0);m(this,"worldX",0);m(this,"world",0);m(this,"local",0)}set(t){if(t==null)throw new Error("pose cannot be null.");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}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;let e=this.rotation,n=this.scaleX,r=this.scaleY,s=this.shearX,o=this.shearY;if(!this.bone.parent){let d=t.scaleX,u=t.scaleY,p=(e+s)*Q.degRad,f=(e+90+o)*Q.degRad;this.a=Math.cos(p)*n*d,this.b=Math.cos(f)*r*d,this.c=Math.sin(p)*n*u,this.d=Math.sin(f)*r*u,this.worldX=this.x*d+t.x,this.worldY=this.y*u+t.y;return}let l=this.bone.parent.appliedPose,c=l.a,a=l.b,i=l.c,h=l.d;switch(this.worldX=c*this.x+a*this.y+l.worldX,this.worldY=i*this.x+h*this.y+l.worldY,this.inherit){case Ut.Normal:{let d=(e+s)*Q.degRad,u=(e+90+o)*Q.degRad,p=Math.cos(d)*n,f=Math.cos(u)*r,g=Math.sin(d)*n,b=Math.sin(u)*r;this.a=c*p+a*g,this.b=c*f+a*b,this.c=i*p+h*g,this.d=i*f+h*b;return}case Ut.OnlyTranslation:{let d=t.scaleX,u=t.scaleY,p=(e+s)*Q.degRad,f=(e+90+o)*Q.degRad;this.a=Math.cos(p)*n*d,this.b=Math.cos(f)*r*d,this.c=Math.sin(p)*n*u,this.d=Math.sin(f)*r*u;break}case Ut.NoRotationOrReflection:{let d=t.scaleX,u=t.scaleY,p=1/d,f=1/u;c*=p,i*=f;let g=c*c+i*i,b=0;g>Q.epsilon2?(g=Math.abs(c*h*f-a*p*i)/g,a=i*g,h=c*g,b=e-Q.atan2Deg(i,c)):(c=0,i=0,b=e-90+Q.atan2Deg(h,a));let x=(b+s)*Q.degRad,y=(b+o+90)*Q.degRad,w=Math.cos(x)*n,k=Math.cos(y)*r,S=Math.sin(x)*n,I=Math.sin(y)*r;this.a=(c*w-a*S)*d,this.b=(c*k-a*I)*d,this.c=(i*w+h*S)*u,this.d=(i*k+h*I)*u;break}case Ut.NoScale:case Ut.NoScaleOrReflection:{let d=t.scaleX,u=t.scaleY,p=1/d,f=1/u,g=e*Q.degRad,b=Math.cos(g),x=Math.sin(g),y=(c*b+a*x)*p,w=(i*b+h*x)*f,k=1/Math.sqrt(y*y+w*w);y*=k,w*=k;let S=-w,I=y;this.inherit===Ut.NoScale&&c*h-a*i<0!=(d<0!=u<0)&&(S=-S,I=-I);let M=s*Q.degRad,v=(90+o)*Q.degRad,E=Math.cos(M)*n,C=Math.cos(v)*r,T=Math.sin(M)*n,F=Math.sin(v)*r;this.a=(y*E+S*T)*d,this.b=(y*C+S*F)*d,this.c=(w*E+I*T)*u,this.d=(w*C+I*F)*u;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;let e=t.scaleX,n=t.scaleY;if(!this.bone.parent){let b=1/e,x=1/n;this.x=(this.worldX-t.x)*b,this.y=(this.worldY-t.y)*x,this.set5(this.a*b,this.b*b,this.c*x,this.d*x,0);return}let r=this.bone.parent.appliedPose,s=r.a,o=r.b,l=r.c,c=r.d,a=s*c-o*l,i=1/(s*c-o*l),h=c*i,d=o*i,u=l*i,p=s*i,f=this.worldX-r.worldX,g=this.worldY-r.worldY;switch(this.x=f*h-g*d,this.y=g*p-f*u,this.inherit){case Ut.Normal:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,p*this.c-u*this.a,p*this.d-u*this.b,0);break;case Ut.OnlyTranslation:{let b=1/e,x=1/n;this.set5(this.a*b,this.b*b,this.c*x,this.d*x,0);break}case Ut.NoRotationOrReflection:{let b=1/e,x=1/n;s*=b,l*=x;let y=this.a*b,w=this.b*b,k=this.c*x,S=this.d*x,I=1/(s*s+l*l),M=1/Math.abs(a*b*x);this.set5((s*y+l*k)*I,(s*w+l*S)*I,(s*k-l*y)*M,(s*S-l*w)*M,Q.atan2Deg(l,s));break}case Ut.NoScale:case Ut.NoScaleOrReflection:{let b=1/e,x=1/n,y=this.a*b,w=this.b*b,k=this.c*x,S=this.d*x,I=c*this.a-o*this.c,M=s*this.c-l*this.a;a<0&&(I=-I,M=-M);let v=Q.atan2Deg(M,I);this.rotation=v,v*=Q.degRad;let E=Math.cos(v),C=Math.sin(v),T=(s*E+o*C)*b,F=(l*E+c*C)*x,D=1/Math.sqrt(T*T+F*F);T*=D,F*=D;let V=this.inherit===Ut.NoScale&&a<0!=(e<0!=n<0)?-1:1;this.set4(T*y+F*k,T*w+F*S,(T*k-F*y)*V,(T*S-F*w)*V)}}}set4(t,e,n,r){let s=t*t+n*n,o=e*e+r*r;s>Q.epsilon2?(this.shearX=Q.atan2Deg(n,t),this.scaleX=Math.sqrt(s)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(o),o>Q.epsilon2?(this.shearY=Q.atan2Deg(r,e),t*r-e*n<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,n,r,s){this.shearX=0;let o=t*t+n*n,l=e*e+r*r;if(o>Q.epsilon2){let c=Q.atan2Deg(n,t);this.rotation=c+s,this.scaleX=Math.sqrt(o),this.scaleY=Math.sqrt(l),l>Q.epsilon2?(this.shearY=Q.atan2Deg(r,e),t*r-e*n<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(l),this.shearY=0,this.rotation=l>Q.epsilon2?Q.atan2Deg(r,e)-90+s:s}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t,t._update)}modifyWorld(t){let e=t._update;this.local=e,this.world=e,this.resetWorld(t,e)}resetWorld(t,e){let n=this.bone.children;for(let r=0,s=n.length;r<s;r++){let o=n[r].appliedPose;o.world===e&&(o.local===e&&o.updateLocalTransform(t),o.world=0,o.resetWorld(t,e))}}getWorldRotationX(){return Q.atan2Deg(this.c,this.a)}getWorldRotationY(){return Q.atan2Deg(this.d,this.b)}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){if(t==null)throw new Error("world cannot be null.");let e=this.a*this.d-this.b*this.c,n=t.x-this.worldX,r=t.y-this.worldY;return t.x=(n*this.d-r*this.b)/e,t.y=(r*this.a-n*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");let e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=Q.degRad;let e=Math.sin(t),n=Math.cos(t);return Q.atan2Deg(this.a*e-this.c*n,this.d*n-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*Q.degRad;let e=Math.sin(t),n=Math.cos(t);return Q.atan2Deg(n*this.c+e*this.d,n*this.a+e*this.b)}rotateWorld(t){t*=Q.degRad;let e=Math.sin(t),n=Math.cos(t),r=this.a,s=this.b;this.a=n*r-e*this.c,this.b=n*s-e*this.d,this.c=e*r+n*this.c,this.d=e*s+n*this.d}};var si=class{constructor(t,e,n){m(this,"data");m(this,"pose");m(this,"constrainedPose");m(this,"appliedPose");if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=n,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}};var ai=class extends si{constructor(e,n,r){super(e,n,r);m(this,"active",!1);this.setupPose()}isActive(){return this.active}};var ii=class A extends ai{constructor(e,n){super(e,new is,new is);m(this,"parent",null);m(this,"children",[]);m(this,"sorted",!1);this.parent=n,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){let n=new A(this.data,e);return n.pose.set(this.pose),n}};var Je=class extends ai{constructor(t,e,n){super(t,e,n)}isSourceActive(){return!0}};var Jl=class{constructor(t){m(this,"_setupPose");m(this,"pose");m(this,"constrainedPose");m(this,"appliedPose");this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,J.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,J.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}};var Qe=class extends Br{constructor(t,e){super(t,e)}},ie;(function(A){A[A.None=0]="None",A[A.Uniform=1]="Uniform",A[A.Volume=2]="Volume"})(ie||(ie={}));var Fr=class{constructor(t,e){m(this,"time",0);m(this,"data");m(this,"intValue",0);m(this,"floatValue",0);m(this,"stringValue",null);m(this,"volume",0);m(this,"balance",0);if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};var oi=class{constructor(t){m(this,"name");m(this,"_audioPath",null);m(this,"setupPose",new Fr(-1,this));this.name=t}get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}};var os=class{constructor(){m(this,"bendDirection",0);m(this,"compress",!1);m(this,"stretch",!1);m(this,"mix",0);m(this,"softness",0)}set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}};var Ql=class A extends Je{constructor(e,n){super(e,new os,new os);m(this,"bones");m(this,"target");if(!n)throw new Error("skeleton cannot be null.");this.bones=[];for(let r of e.bones)this.bones.push(n.bones[r.index].constrainedPose);this.target=n.bones[e.target.index]}copy(e){var n=new A(this.data,e);return n.pose.set(this.pose),n}update(e,n){let r=this.appliedPose;if(r.mix===0)return;let s=this.target.appliedPose,o=this.bones;switch(o.length){case 1:A.apply(e,o[0],s.worldX,s.worldY,r.compress,r.stretch,this.data.scaleYMode,r.mix);break;case 2:A.apply(e,o[0],o[1],s.worldX,s.worldY,r.bendDirection,r.stretch,this.data.scaleYMode,r.softness,r.mix);break}}sort(e){e.sortBone(this.target);let n=this.bones[0].bone;e.sortBone(n),e._updateCache.push(this),n.sorted=!1,e.sortReset(n.children),e.constrained(n),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,n,r,s,o,l,c,a,i,h){typeof r=="number"?A.apply1(e,n,r,s,o,l,c,a):A.apply2(e,n,r,s,o,l,c,a,i,h)}static apply1(e,n,r,s,o,l,c,a){n.modifyLocal(e);let i=n.bone.parent.appliedPose,h=i.a,d=i.b,u=i.c,p=i.d,f=-n.shearX-n.rotation,g=0,b=0;switch(n.inherit){case Ut.OnlyTranslation:g=(r-n.worldX)*Q.signum(e.scaleX),b=(s-n.worldY)*Q.signum(e.scaleY);break;case Ut.NoRotationOrReflection:{let x=Math.abs(h*p-d*u)/Math.max(Q.epsilon,h*h+u*u),y=h/e.scaleX,w=u/e.scaleY;d=-w*x*e.scaleX,p=y*x*e.scaleY,f+=Q.atan2Deg(w,y)}default:{let x=r-i.worldX,y=s-i.worldY,w=h*p-d*u;Math.abs(w)<=Q.epsilon?(g=0,b=0):(g=(x*p-y*d)/w-n.x,b=(y*h-x*u)/w-n.y)}}if(f+=Q.atan2Deg(b,g),n.scaleX<0&&(f+=180),f>180?f-=360:f<=-180&&(f+=360),n.rotation+=f*a,o||l){switch(n.inherit){case Ut.NoScale:case Ut.NoScaleOrReflection:g=r-n.worldX,b=s-n.worldY}let x=n.bone.data.length*n.scaleX;if(x>Q.epsilon){let y=g*g+b*b;if(o&&y<x*x||l&&y>x*x){let w=(Math.sqrt(y)/x-1)*a+1;switch(n.scaleX*=w,c){case ie.Uniform:n.scaleY*=w;break;case ie.Volume:n.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,n,r,s,o,l,c,a,i,h){if(n.inherit!==Ut.Normal||r.inherit!==Ut.Normal)return;n.modifyLocal(e),r.modifyLocal(e);let d=n.x,u=n.y,p=n.scaleX,f=n.scaleY,g=r.scaleX,b=0,x=0,y=0;p<0?(p=-p,b=180,y=-1):(b=0,y=1),f<0&&(f=-f,y=-y),g<0?(g=-g,x=180):x=0;let w=0,k=0,S=n.a,I=n.b,M=n.c,v=n.d,E=Math.abs(p-f)<=Q.epsilon;!E||c?(r.y=0,w=S*r.x+n.worldX,k=M*r.x+n.worldY):(w=S*r.x+I*r.y+n.worldX,k=M*r.x+v*r.y+n.worldY);let C=n.bone.parent.appliedPose;S=C.a,I=C.b,M=C.c,v=C.d;let T=S*v-I*M,F=w-C.worldX,D=k-C.worldY;T=Math.abs(T)<=Q.epsilon?0:1/T;let V=(F*v-D*I)*T-d,X=(D*S-F*M)*T-u,N=Math.sqrt(V*V+X*X),q=r.bone.data.length*g,L,R;if(N<Q.epsilon){A.apply(e,n,s,o,!1,c,ie.None,h),r.rotation=0;return}F=s-C.worldX,D=o-C.worldY;let P=(F*v-D*I)*T-d,H=(D*S-F*M)*T-u,U=P*P+H*H;if(i!==0){i*=p*(g+1)*.5;let O=Math.sqrt(U),Z=O-N-q*p+i;if(Z>0){let K=Math.min(1,Z/(i*2))-1;K=(Z-i*(1-K*K))/O,P-=K*P,H-=K*H,U=P*P+H*H}}t:if(E){q*=p;let O=(U-N*N-q*q)/(2*N*q);if(O<-1)O=-1,R=Math.PI*l;else if(O>1){if(O=1,R=0,c)switch(S=(Math.sqrt(U)/(N+q)-1)*h+1,n.scaleX*=S,a){case ie.Uniform:n.scaleY*=S;break;case ie.Volume:n.scaleY/=S<.7?.25+.642857*S:S}}else R=Math.acos(O)*l;S=N+q*O,I=q*Math.sin(R),L=Math.atan2(H*S-P*I,P*S+H*I)}else{S=p*q,I=f*q;let O=S*S,Z=I*I,K=Math.atan2(H,P);M=Z*N*N+O*U-O*Z;let it=-2*Z*N,et=Z-O;if(v=it*it-4*et*M,v>=0){let Zt=Math.sqrt(v);it<0&&(Zt=-Zt),Zt=-(it+Zt)*.5;let Lt=Zt/et,Kt=M/Zt,ke=Math.abs(Lt)<Math.abs(Kt)?Lt:Kt;if(Lt=U-ke*ke,Lt>=0){D=Math.sqrt(Lt)*l,L=K-Math.atan2(D,ke),R=Math.atan2(D/f,(ke-N)/p);break t}}let st=Q.PI,dt=N-S,Mt=dt*dt,Bt=0,jt=0,Rt=N+S,Xt=Rt*Rt,Wt=0;M=-S*N/(O-Z),M>=-1&&M<=1&&(M=Math.acos(M),F=S*Math.cos(M)+N,D=I*Math.sin(M),v=F*F+D*D,v<Mt&&(st=M,Mt=v,dt=F,Bt=D),v>Xt&&(jt=M,Xt=v,Rt=F,Wt=D)),U<=(Mt+Xt)*.5?(L=K-Math.atan2(Bt*l,dt),R=st*l):(L=K-Math.atan2(Wt*l,Rt),R=jt*l)}let z=Math.atan2(r.y,r.x)*y;L=(L-z)*Q.radDeg+b-n.rotation,L>180?L-=360:L<=-180&&(L+=360),n.rotation+=L*h,R=((R+z)*Q.radDeg-r.shearX)*y+x-r.rotation,R>180?R-=360:R<=-180&&(R+=360),r.rotation+=R*h}};var Dr=class extends Qe{constructor(e){super(e,new os);m(this,"bones",[]);m(this,"_target",null);m(this,"_scaleYMode",ie.None)}set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}create(e){return new Ql(this,e)}};var ls=class{constructor(){m(this,"position",0);m(this,"spacing",0);m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0)}set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}};var Vr=class extends Qe{constructor(e){super(e,new ls);m(this,"bones",[]);m(this,"_slot",null);m(this,"positionMode",Le.Fixed);m(this,"spacingMode",te.Fixed);m(this,"rotateMode",_n.Chain);m(this,"offsetRotation",0)}set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}create(e){return new _l(this,e)}},Le;(function(A){A[A.Fixed=0]="Fixed",A[A.Percent=1]="Percent"})(Le||(Le={}));var te;(function(A){A[A.Length=0]="Length",A[A.Fixed=1]="Fixed",A[A.Percent=2]="Percent",A[A.Proportional=3]="Proportional"})(te||(te={}));var _n;(function(A){A[A.Tangent=0]="Tangent",A[A.Chain=1]="Chain",A[A.ChainScale=2]="ChainScale"})(_n||(_n={}));var Rn=class Rn extends Je{constructor(e,n){super(e,new ls,new ls);m(this,"data");m(this,"bones");m(this,"slot");m(this,"spaces",[]);m(this,"positions",[]);m(this,"world",[]);m(this,"curves",[]);m(this,"lengths",[]);m(this,"segments",[]);if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(let r of this.data.bones)this.bones.push(n.bones[r.index].constrainedPose);this.slot=n.slots[e.slot.index]}copy(e){var n=new Rn(this.data,e);return n.pose.set(this.pose),n}update(e,n){let r=this.slot.appliedPose.attachment;if(!(r instanceof Qn))return;let s=this.appliedPose,o=s.mixRotate,l=s.mixX,c=s.mixY;if(o===0&&l===0&&c===0)return;let a=this.data,i=a.rotateMode===_n.Tangent,h=a.rotateMode===_n.ChainScale,d=this.bones,u=d.length,p=i?u:u+1,f=J.setArraySize(this.spaces,p),g=h?this.lengths=J.setArraySize(this.lengths,u):[],b=s.spacing;switch(a.spacingMode){case te.Percent:if(h)for(let I=0,M=p-1;I<M;I++){let v=d[I],E=v.bone.data.length,C=E*v.a,T=E*v.c;g[I]=Math.sqrt(C*C+T*T)}J.arrayFill(f,1,p,b);break;case te.Proportional:{let I=0;for(let M=0,v=p-1;M<v;){let E=d[M],C=E.bone.data.length;if(C<Q.epsilon)h&&(g[M]=0),f[++M]=b;else{let T=C*E.a,F=C*E.c,D=Math.sqrt(T*T+F*F);h&&(g[M]=D),f[++M]=D,I+=D}}if(I>0){I=p/I*b;for(let M=1;M<p;M++)f[M]*=I}break}default:{let I=a.spacingMode===te.Length;for(let M=0,v=p-1;M<v;){let E=d[M],C=E.bone.data.length;if(C<Q.epsilon)h&&(g[M]=0),f[++M]=b;else{let T=C*E.a,F=C*E.c,D=Math.sqrt(T*T+F*F);h&&(g[M]=D),f[++M]=(I?Math.max(0,C+b):b)*D/C}}}}let x=this.computeWorldPositions(e,r,p,i),y=x[0],w=x[1],k=a.offsetRotation,S=!1;if(k===0)S=a.rotateMode===_n.Chain;else{S=!1;let I=this.slot.bone.appliedPose;k*=I.a*I.d-I.b*I.c>0?Q.degRad:-Q.degRad}for(let I=0,M=3;I<u;I++,M+=3){let v=d[I];v.modifyWorld(e),v.worldX+=(y-v.worldX)*l,v.worldY+=(w-v.worldY)*c;let E=x[M],C=x[M+1],T=E-y,F=C-w;if(h){let D=g[I];if(D!==0){let V=(Math.sqrt(T*T+F*F)/D-1)*o+1;v.a*=V,v.c*=V}}if(y=E,w=C,o>0){let D=v.a,V=v.b,X=v.c,N=v.d,q=0,L=0,R=0;if(i?q=x[M-1]:f[I+1]===0?q=x[M+2]:q=Math.atan2(F,T),q-=Math.atan2(X,D),S){L=Math.cos(q),R=Math.sin(q);let P=v.bone.data.length;y+=(P*(L*D-R*X)-T)*o,w+=(P*(R*D+L*X)-F)*o}else q+=k;q>Q.PI?q-=Q.PI2:q<-Q.PI&&(q+=Q.PI2),q*=o,L=Math.cos(q),R=Math.sin(q),v.a=L*D-R*X,v.b=L*V-R*N,v.c=R*D+L*X,v.d=R*V+L*N}}}computeWorldPositions(e,n,r,s){let o=this.slot,l=this.appliedPose.position,c=this.spaces,a=J.setArraySize(this.positions,r*3+2),i=this.world,h=n.closed,d=n.worldVerticesLength,u=d/6,p=Rn.NONE;if(!n.constantSpeed){let R=n.lengths;u-=h?1:2;let P=R[u];this.data.positionMode===Le.Percent&&(l*=P);let H;switch(this.data.spacingMode){case te.Percent:H=P;break;case te.Proportional:H=P/r;break;default:H=1}i=J.setArraySize(this.world,8);for(let U=0,z=0,O=0;U<r;U++,z+=3){let Z=c[U]*H;l+=Z;let K=l;if(h)K%=P,K<0&&(K+=P),O=0;else if(K<0){p!==Rn.BEFORE&&(p=Rn.BEFORE,n.computeWorldVertices(e,o,2,4,i,0,2)),this.addBeforePosition(K,i,0,a,z);continue}else if(K>P){p!==Rn.AFTER&&(p=Rn.AFTER,n.computeWorldVertices(e,o,d-6,4,i,0,2)),this.addAfterPosition(K-P,i,0,a,z);continue}for(;;O++){let it=R[O];if(!(K>it)){if(O===0)K/=it;else{let et=R[O-1];K=(K-et)/(it-et)}break}}O!==p&&(p=O,h&&O===u?(n.computeWorldVertices(e,o,d-4,4,i,0,2),n.computeWorldVertices(e,o,0,4,i,4,2)):n.computeWorldVertices(e,o,O*6+2,8,i,0,2)),this.addCurvePosition(K,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],a,z,s||U>0&&Z===0)}return a}h?(d+=2,i=J.setArraySize(this.world,d),n.computeWorldVertices(e,o,2,d-4,i,0,2),n.computeWorldVertices(e,o,0,2,i,d-4,2),i[d-2]=i[0],i[d-1]=i[1]):(u--,d-=4,i=J.setArraySize(this.world,d),n.computeWorldVertices(e,o,2,d,i,0,2));let f=J.setArraySize(this.curves,u),g=0,b=i[0],x=i[1],y=0,w=0,k=0,S=0,I=0,M=0,v=0,E=0,C=0,T=0,F=0,D=0,V=0,X=0;for(let R=0,P=2;R<u;R++,P+=6)y=i[P],w=i[P+1],k=i[P+2],S=i[P+3],I=i[P+4],M=i[P+5],v=(b-y*2+k)*.1875,E=(x-w*2+S)*.1875,C=((y-k)*3-b+I)*.09375,T=((w-S)*3-x+M)*.09375,F=v*2+C,D=E*2+T,V=(y-b)*.75+v+C*.16666667,X=(w-x)*.75+E+T*.16666667,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,F+=C,D+=T,g+=Math.sqrt(V*V+X*X),V+=F,X+=D,g+=Math.sqrt(V*V+X*X),V+=F+C,X+=D+T,g+=Math.sqrt(V*V+X*X),f[R]=g,b=I,x=M;this.data.positionMode===Le.Percent&&(l*=g);let N;switch(this.data.spacingMode){case te.Percent:N=g;break;case te.Proportional:N=g/r;break;default:N=1}let q=this.segments,L=0;for(let R=0,P=0,H=0,U=0;R<r;R++,P+=3){let z=c[R]*N;l+=z;let O=l;if(h)O%=g,O<0&&(O+=g),H=0,U=0;else if(O<0){this.addBeforePosition(O,i,0,a,P);continue}else if(O>g){this.addAfterPosition(O-g,i,d-4,a,P);continue}for(;;H++){let Z=f[H];if(!(O>Z)){if(H===0)O/=Z;else{let K=f[H-1];O=(O-K)/(Z-K)}break}}if(H!==p){p=H;let Z=H*6;for(b=i[Z],x=i[Z+1],y=i[Z+2],w=i[Z+3],k=i[Z+4],S=i[Z+5],I=i[Z+6],M=i[Z+7],v=(b-y*2+k)*.03,E=(x-w*2+S)*.03,C=((y-k)*3-b+I)*.006,T=((w-S)*3-x+M)*.006,F=v*2+C,D=E*2+T,V=(y-b)*.3+v+C*.16666667,X=(w-x)*.3+E+T*.16666667,L=Math.sqrt(V*V+X*X),q[0]=L,Z=1;Z<8;Z++)V+=F,X+=D,F+=C,D+=T,L+=Math.sqrt(V*V+X*X),q[Z]=L;V+=F,X+=D,L+=Math.sqrt(V*V+X*X),q[8]=L,V+=F+C,X+=D+T,L+=Math.sqrt(V*V+X*X),q[9]=L,U=0}for(O*=L;;U++){let Z=q[U];if(!(O>Z)){if(U===0)O/=Z;else{let K=q[U-1];O=U+(O-K)/(Z-K)}break}}this.addCurvePosition(O*.1,b,x,y,w,k,S,I,M,a,P,s||R>0&&z===0)}return a}addBeforePosition(e,n,r,s,o){let l=n[r],c=n[r+1],a=n[r+2]-l,i=n[r+3]-c,h=Math.atan2(i,a);s[o]=l+e*Math.cos(h),s[o+1]=c+e*Math.sin(h),s[o+2]=h}addAfterPosition(e,n,r,s,o){let l=n[r+2],c=n[r+3],a=l-n[r],i=c-n[r+1],h=Math.atan2(i,a);s[o]=l+e*Math.cos(h),s[o+1]=c+e*Math.sin(h),s[o+2]=h}addCurvePosition(e,n,r,s,o,l,c,a,i,h,d,u){if(e===0||Number.isNaN(e)){h[d]=n,h[d+1]=r,h[d+2]=Math.atan2(o-r,s-n);return}let p=e*e,f=p*e,g=1-e,b=g*g,x=b*g,y=g*e,w=y*3,k=g*w,S=w*e,I=n*x+s*k+l*S+a*f,M=r*x+o*k+c*S+i*f;h[d]=I,h[d+1]=M,u&&(e<.001?h[d+2]=Math.atan2(o-r,s-n):h[d+2]=Math.atan2(M-(r*b+o*y*2+c*p),I-(n*b+s*y*2+l*p)))}sort(e){let n=this.slot.data.index,r=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,n,r),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,n,r),this.sortPath(e,this.slot.pose.attachment,r);let s=this.bones,o=this.bones.length;for(let l=0;l<o;l++){let c=s[l].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let l=0;l<o;l++)e.sortReset(s[l].bone.children);for(let l=0;l<o;l++)s[l].bone.sorted=!0}sortPathSlot(e,n,r,s){let o=n.getAttachments();for(let l=0,c=o.length;l<c;l++){let a=o[l];a.slotIndex===r&&this.sortPath(e,a.attachment,s)}}sortPath(e,n,r){if(!(n instanceof Qn))return;let s=n.bones;if(s==null)e.sortBone(r);else{let o=e.bones;for(let l=0,c=s.length;l<c;){let a=s[l++];for(a+=l;l<a;)e.sortBone(o[s[l++]])}}}isSourceActive(){return this.slot.bone.active}};m(Rn,"NONE",-1),m(Rn,"BEFORE",-2),m(Rn,"AFTER",-3);var _l=Rn;var Ne;(function(A){A[A.none=0]="none",A[A.reset=1]="reset",A[A.update=2]="update",A[A.pose=3]="pose"})(Ne||(Ne={}));var cs=class{constructor(){m(this,"inertia",0);m(this,"strength",0);m(this,"damping",0);m(this,"massInverse",0);m(this,"wind",0);m(this,"gravity",0);m(this,"mix",0)}set(t){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}};var hs=class{constructor(){m(this,"color",new _(1,1,1,1));m(this,"darkColor",null);m(this,"attachment",null);m(this,"sequenceIndex",0);m(this,"deform",[])}SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof Ce)||!(this.attachment instanceof Ce)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}};var tc=class A extends si{constructor(e,n){super(e,new hs,new hs);m(this,"skeleton");m(this,"bone");m(this,"attachmentState",0);if(!n)throw new Error("skeleton cannot be null.");this.skeleton=n,this.bone=n.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new _,this.constrainedPose.darkColor=new _),this.setupPose()}copy(e,n,r){let s=new A(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(s.pose.darkColor=new _,s.constrainedPose.darkColor=new _),s.pose.set(e.pose),s}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}};var li=class li{constructor(t){m(this,"data");m(this,"bones");m(this,"slots");m(this,"drawOrder");m(this,"constraints");m(this,"physics");m(this,"_updateCache",[]);m(this,"resetCache",[]);m(this,"skin",null);m(this,"color");m(this,"scaleX",1);m(this,"_scaleY",1);m(this,"x",0);m(this,"y",0);m(this,"time",0);m(this,"windX",1);m(this,"windY",0);m(this,"gravityX",0);m(this,"gravityY",1);m(this,"_update",0);if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let e=0;e<t.bones.length;e++){let n=t.bones[e],r;if(!n.parent)r=new ii(n,null);else{let s=this.bones[n.parent.index];r=new ii(n,s),s.children.push(r)}this.bones.push(r)}this.slots=[];for(let e of this.data.slots)this.slots.push(new tc(e,this));this.drawOrder=new Jl(this.slots),this.physics=[],this.constraints=[];for(let e of this.data.constraints){let n=e.create(this);n instanceof ci&&this.physics.push(n),this.constraints.push(n)}this.color=new _(1,1,1,1),this.updateCache()}static get yDir(){return li.yDown?-1:1}get scaleY(){return this._scaleY*li.yDir}set scaleY(t){this._scaleY=t}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();let t=this.slots;for(let o=0,l=t.length;o<l;o++)t[o].unconstrained();let e=this.bones,n=e.length;for(let o=0,l=n;o<l;o++){let c=e[o];c.sorted=c.data.skinRequired,c.active=!c.sorted,c.unconstrained()}if(this.skin){let o=this.skin.bones;for(let l=0,c=this.skin.bones.length;l<c;l++){let a=this.bones[o[l].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}let r=this.constraints,s=this.constraints.length;for(let o=0;o<s;o++)r[o].unconstrained();for(let o=0;o<s;o++){let l=r[o];l.active=l.isSourceActive()&&(!l.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(l.data)),l.active&&l.sort(this)}for(let o=0;o<n;o++)this.sortBone(e[o]);s=this._updateCache.length;for(let o=0;o<s;o++){let l=this._updateCache[o];l instanceof ii&&(this._updateCache[o]=l.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,n=t.length;e<n;e++){let r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();let e=this.resetCache;for(let r=0,s=this.resetCache.length;r<s;r++)e[r].resetConstrained();let n=this._updateCache;for(let r=0,s=this._updateCache.length;r<s;r++)n[r].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){let t=this.bones;for(let n=0,r=t.length;n<r;n++)t[n].setupPose();let e=this.constraints;for(let n=0,r=e.length;n<r;n++)e[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();let t=this.slots;for(let e=0,n=t.length;e<n;e++)t[e].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name===t)return e[n];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name===t)return e[n];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error(`Skin not found: ${t}`);this.setSkin(e)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n],o=s.data.attachmentName;if(o){let l=t.getAttachment(n,o);l&&s.pose.setAttachment(l)}}}this.skin=t,this.updateCache()}}getAttachment(t,e){return typeof t=="string"?this.getAttachmentByName(t,e):this.getAttachmentByIndex(t,e)}getAttachmentByName(t,e){let n=this.data.findSlot(t);if(!n)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(n.index,e)}getAttachmentByIndex(t,e){if(!e)throw new Error("placeholder cannot be null.");if(this.skin){let n=this.skin.getAttachment(t,e);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let n=this.findSlot(t);if(!n)throw new Error(`Slot not found: ${t}`);let r=null;if(e&&(r=this.getAttachment(n.data.index,e),!r))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);n.pose.setAttachment(r)}findConstraint(t,e){if(t==null)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");let n=this.constraints;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(o instanceof e&&o.data.name===t)return o}return null}getBoundsRect(t){let e=new ns,n=new ns;return this.getBounds(e,n,void 0,t),{x:e.x,y:e.y,width:n.x,height:n.y}}getBounds(t,e,n=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let s=this.drawOrder.appliedPose,o=s,l=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(let h=0,d=s.length;h<d;h++){let u=o[h];if(!u.bone.active)continue;let p=0,f=null,g=null,b=u.appliedPose.attachment;if(b){if(b instanceof ct)p=8,f=J.setArraySize(n,p,0),b.computeWorldVertices(u,b.getOffsets(u.appliedPose),f,0,2),g=li.quadTriangles;else if(b instanceof Ot)p=b.worldVerticesLength,f=J.setArraySize(n,p,0),b.computeWorldVertices(this,u,0,p,f,0,2),g=b.triangles;else if(b instanceof xe&&r){r.clipEnd(u),r.clipStart(this,u,b);continue}if(f&&g){r?.isClipping()&&r.clipTriangles(f,g,g.length)&&(f=r.clippedVertices,p=r.clippedVertices.length);for(let x=0,y=f.length;x<y;x+=2){let w=f[x],k=f[x+1];l=Math.min(l,w),c=Math.min(c,k),a=Math.max(a,w),i=Math.max(i,k)}}}r&&r.clipEnd(u)}r&&r.clipEnd(),t.set(l,c),e.set(a-l,i-c)}setScale(t,e){this.scaleX=t,this.scaleY=e}setPosition(t,e){this.x=t,this.y=e}update(t){this.time+=t}physicsTranslate(t,e){let n=this.physics;for(let r=0,s=n.length;r<s;r++)n[r].translate(t,e)}physicsRotate(t,e,n){let r=this.physics;for(let s=0,o=r.length;s<o;s++)r[s].rotate(t,e,n)}};m(li,"quadTriangles",[0,1,2,2,3,0]),m(li,"yDown",!1);var tr=li;var ci=class A extends Je{constructor(e,n){super(e,new cs,new cs);m(this,"bone");m(this,"_reset",!0);m(this,"ux",0);m(this,"uy",0);m(this,"cx",0);m(this,"cy",0);m(this,"tx",0);m(this,"ty",0);m(this,"xOffset",0);m(this,"xLag",0);m(this,"xVelocity",0);m(this,"yOffset",0);m(this,"yLag",0);m(this,"yVelocity",0);m(this,"rotateOffset",0);m(this,"rotateLag",0);m(this,"rotateVelocity",0);m(this,"scaleOffset",0);m(this,"scaleLag",0);m(this,"scaleVelocity",0);m(this,"remaining",0);m(this,"lastTime",0);if(n==null)throw new Error("skeleton cannot be null.");this.bone=n.bones[e.bone.index].constrainedPose}copy(e){var n=new A(this.data,e);return n.pose.set(this.pose),n}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,n){this.ux-=e,this.uy-=n,this.cx-=e,this.cy-=n}rotate(e,n,r){let s=r*Q.degRad,o=Math.cos(s),l=Math.sin(s),c=this.cx-e,a=this.cy-n;this.translate(c*o-a*l-c,c*l+a*o-a)}update(e,n){let r=this.appliedPose,s=r.mix;if(s===0)return;let o=this.data.x>0,l=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,i=this.bone,h=i.bone.data.length,d=this.data.step,u=0;if(n!==Ne.none){switch(i.modifyWorld(e),n){case Ne.reset:this.reset(e);case Ne.update:{let p=Math.max(e.time-this.lastTime,0),f=this.remaining;this.remaining+=p,this.lastTime=e.time;let g=i.worldX,b=i.worldY;if(this._reset)this._reset=!1,this.ux=g,this.uy=b;else{let x=this.remaining,y=r.inertia,w=e.data.referenceScale,k=-1,S=0,I=0,M=this.data.limit*p,v=M*Math.abs(e.scaleY);if(M*=Math.abs(e.scaleX),o||l){if(o){let E=(this.ux-g)*y;this.xOffset+=E>M?M:E<-M?-M:E,this.ux=g}if(l){let E=(this.uy-b)*y;this.yOffset+=E>v?v:E<-v?-v:E,this.uy=b}if(x>=d){let E=this.xOffset,C=this.yOffset;k=r.damping**(60*d),S=d*r.massInverse,I=r.strength;let T=w*r.wind,F=w*r.gravity,D=(T*e.windX+F*e.gravityX)*e.scaleX,V=(T*e.windY+F*e.gravityY)*e.scaleY;do o&&(this.xVelocity+=(D-this.xOffset*I)*S,this.xOffset+=this.xVelocity*d,this.xVelocity*=k),l&&(this.yVelocity-=(V+this.yOffset*I)*S,this.yOffset+=this.yVelocity*d,this.yVelocity*=k),x-=d;while(x>=d);this.xLag=this.xOffset-E,this.yLag=this.yOffset-C}u=Math.max(0,1-x/d),o&&(i.worldX+=(this.xOffset-this.xLag*u)*s*this.data.x),l&&(i.worldY+=(this.yOffset-this.yLag*u)*s*this.data.y)}if(c||a){let E=Math.atan2(i.c,i.a),C=0,T=0,F=0,D=this.cx-i.worldX,V=this.cy-i.worldY;if(D>M?D=M:D<-M&&(D=-M),V>v?V=v:V<-v&&(V=-v),x=this.remaining,c){F=(this.data.rotate+this.data.shearX)*s,u=this.rotateLag*Math.max(0,1-f/d);let X=Math.atan2(V+this.ty,D+this.tx)-E-(this.rotateOffset-u)*F;this.rotateOffset+=(X-Math.ceil(X*Q.invPI2-.5)*Q.PI2)*y,X=(this.rotateOffset-u)*F+E,C=Math.cos(X),T=Math.sin(X),a&&(X=h*i.getWorldScaleX(),X>0&&(this.scaleOffset+=(D*C+V*T)*y/X))}else{C=Math.cos(E),T=Math.sin(E);let X=h*i.getWorldScaleX()-this.scaleLag*Math.max(0,1-f/d);X>0&&(this.scaleOffset+=(D*C+V*T)*y/X)}if(x>=d){k===-1&&(k=r.damping**(60*d),S=d*r.massInverse,I=r.strength);let X=r.wind*e.windX+r.gravity*e.gravityX,N=(r.wind*e.windY+r.gravity*e.gravityY)*tr.yDir,q=this.rotateOffset,L=this.scaleOffset,R=h/w;for(;;)if(x-=d,a&&(this.scaleVelocity+=(X*C-N*T-this.scaleOffset*I)*S,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=k),c){if(this.rotateVelocity-=((X*T+N*C)*R+this.rotateOffset*I)*S,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=k,x<d)break;let P=this.rotateOffset*F+E;C=Math.cos(P),T=Math.sin(P)}else if(x<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-L}u=Math.max(0,1-x/d)}this.remaining=x}this.cx=i.worldX,this.cy=i.worldY;break}case Ne.pose:u=Math.max(0,1-this.remaining/d),o&&(i.worldX+=(this.xOffset-this.xLag*u)*s*this.data.x),l&&(i.worldY+=(this.yOffset-this.yLag*u)*s*this.data.y)}if(c){let p=(this.rotateOffset-this.rotateLag*u)*s,f=0,g=0,b=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=p*this.data.rotate,f=Math.sin(x),g=Math.cos(x),b=i.b,i.b=g*b-f*i.d,i.d=f*b+g*i.d),x+=p*this.data.shearX,f=Math.sin(x),g=Math.cos(x),b=i.a,i.a=g*b-f*i.c,i.c=f*b+g*i.c}else p*=this.data.rotate,f=Math.sin(p),g=Math.cos(p),b=i.a,i.a=g*b-f*i.c,i.c=f*b+g*i.c,b=i.b,i.b=g*b-f*i.d,i.d=f*b+g*i.d}if(a){let p=1+(this.scaleOffset-this.scaleLag*u)*s*this.data.scaleX;switch(i.a*=p,i.c*=p,this.data.scaleYMode){case ie.Uniform:i.b*=p,i.d*=p;break;case ie.Volume:p=Math.abs(p),p=p>=.7?1/p:4-3.67347*p,i.b*=p,i.d*=p}}n!==Ne.pose&&(this.tx=h*i.a,this.ty=h*i.c)}}sort(e){let n=this.bone.bone;e.sortBone(n),e._updateCache.push(this),e.sortReset(n.children),e.constrained(n)}isSourceActive(){return this.bone.bone.active}};var Rr=class extends Qe{constructor(e){super(e,new cs);m(this,"_bone",null);m(this,"x",0);m(this,"y",0);m(this,"rotate",0);m(this,"scaleX",0);m(this,"shearX",0);m(this,"limit",0);m(this,"step",0);m(this,"inertiaGlobal",!1);m(this,"strengthGlobal",!1);m(this,"dampingGlobal",!1);m(this,"massGlobal",!1);m(this,"windGlobal",!1);m(this,"gravityGlobal",!1);m(this,"mixGlobal",!1);m(this,"_scaleYMode",ie.None)}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}create(e){return new ci(this,e)}};typeof Math.fround>"u"&&(Math.fround=(A=>t=>(A[0]=t,A[0]))(new Float32Array(1)));var ms=class{constructor(){m(this,"time",0);m(this,"mix",0)}set(t){this.time=t.time,this.mix=t.mix}};var ec=class ec extends Je{constructor(e,n){super(e,new ms,new ms);m(this,"bone",null);if(!n)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=n.bones[e.bone.index])}copy(e){var n=new ec(this.data,e);return n.pose.set(this.pose),n}update(e,n){let r=this.appliedPose;if(r.mix===0)return;let s=this.data,o=s.animation,l=this.bone;if(l!==null){if(!l.active)return;s.local&&l.appliedPose.validateLocalTransform(e),r.time=s.offset+(s.property.value(e,l.appliedPose,s.local,ec.offsets)-s.property.offset)*s.scale,s.loop?r.time=o.duration+r.time%o.duration:r.time=Math.max(0,r.time)}let c=e.bones,a=o.bones;for(let i=0,h=o.bones.length;i<h;i++)c[a[i]].appliedPose.modifyLocal(e);o.apply(e,r.time,r.time,s.loop,null,r.mix,tt.current,s.additive,!1,!0)}sort(e){let n=this.bone,r=this.data;n&&!r.local&&e.sortBone(n),e._updateCache.push(this);let s=e.bones,o=r.animation.bones;for(let d=0,u=r.animation.bones.length;d<u;d++){let p=s[o[d]];p.sorted=!1,e.sortReset(p.children),e.constrained(p)}let l=r.animation.timelines,c=e.slots,a=e.constraints,i=e.physics,h=e.physics.length;for(let d=0,u=r.animation.timelines.length;d<u;d++){let p=l[d];if(bm(p))e.constrained(c[p.slotIndex]);else if(p instanceof Ke||p instanceof Vn)e.drawOrder.constrained();else if(p instanceof kn)if(p.constraintIndex===-1)for(let f=0;f<h;f++)e.constrained(i[f]);else e.constrained(a[p.constraintIndex]);else if(xm(p)){let f=p.constraintIndex;f!==-1&&e.constrained(a[f])}}}};m(ec,"offsets",[0,0,0,0,0,0]);var nc=ec;var _e=class extends Qe{constructor(e){super(e,new ms);m(this,"animation");m(this,"additive",!1);m(this,"loop",!1);m(this,"bone",null);m(this,"property");m(this,"scale",0);m(this,"offset",0);m(this,"local",!1);m(this,"max",0)}create(e){return new nc(this,e)}};var Pr=class{constructor(){m(this,"name",null);m(this,"bones",[]);m(this,"slots",[]);m(this,"skins",[]);m(this,"defaultSkin",null);m(this,"events",[]);m(this,"animations",[]);m(this,"constraints",[]);m(this,"x",0);m(this,"y",0);m(this,"width",0);m(this,"height",0);m(this,"referenceScale",100);m(this,"version",null);m(this,"hash",null);m(this,"fps",30);m(this,"imagesPath",null);m(this,"audioPath",null)}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].name===t)return e[n];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].name===t)return e[n];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let n=0,r=e.length;n<r;n++)if(e[n].name===t)return e[n];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let n=0,r=e.length;n<r;n++)if(e[n].name===t)return e[n];return null}findSliderAnimations(t){let e=this.constraints;for(let n=0,r=this.constraints.length;n<r;n++){let s=e[n];s instanceof _e&&s.animation!=null&&t.push(s.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let n=0,r=e.length;n<r;n++)if(e[n].name===t)return e[n];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");let n=this.constraints;for(let r=0,s=this.constraints.length;r<s;r++){let o=n[r];if(o instanceof e&&o.name===t)return o}return null}};var rc=class{constructor(t=0,e,n){m(this,"slotIndex",0);m(this,"placeholder");m(this,"attachment");this.slotIndex=t,this.placeholder=e,this.attachment=n}},er=class{constructor(t){m(this,"name");m(this,"attachments",[]);m(this,"bones",[]);m(this,"constraints",[]);m(this,"color",new _(.99607843,.61960787,.30980393,1));if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,n){if(!n)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]=n}addSkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];this.setAttachment(r.slotIndex,r.placeholder,r.attachment)}}copySkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];r.attachment&&(r.attachment instanceof Ot?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.placeholder,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.placeholder,r.attachment)))}}getAttachment(t,e){let n=this.attachments[t];return n?n[e]:null}removeAttachment(t,e){let n=this.attachments[t];n&&delete n[e]}getAttachments(){let t=[];for(let e=0;e<this.attachments.length;e++){let n=this.attachments[e];if(n)for(let r in n){let s=n[r];s&&t.push(new rc(e,r,s))}}return t}getAttachmentsForSlot(t,e){let n=this.attachments[t];if(n)for(let r in n){let s=n[r];s&&e.push(new rc(t,r,s))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let n=0;for(let r=0;r<t.slots.length;r++){let s=t.slots[r],o=s.pose.getAttachment();if(o&&n<e.attachments.length){let l=e.attachments[n];for(let c in l){let a=l[c];if(o===a){let i=this.getAttachment(n,c);i&&s.pose.setAttachment(i);break}}}n++}}};var hi=class extends Br{constructor(e,n,r){super(n,new hs);m(this,"index",0);m(this,"boneData");m(this,"attachmentName",null);m(this,"blendMode",tn.Normal);m(this,"visible",!0);if(e<0)throw new Error("index must be >= 0.");if(!r)throw new Error("boneData cannot be null.");this.index=e,this.boneData=r}},tn;(function(A){A[A.Normal=0]="Normal",A[A.Additive=1]="Additive",A[A.Multiply=2]="Multiply",A[A.Screen=3]="Screen"})(tn||(tn={}));var ds=class{constructor(){m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"mixScaleX",0);m(this,"mixScaleY",0);m(this,"mixShearY",0)}set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}};var sc=class A extends Je{constructor(e,n){super(e,new ds,new ds);m(this,"bones");m(this,"source");if(!n)throw new Error("skeleton cannot be null.");this.bones=[];for(let s of e.bones)this.bones.push(n.bones[s.index].constrainedPose);let r=n.bones[e.source.index];if(r==null)throw new Error("source cannot be null.");this.source=r}copy(e){var n=new A(this.data,e);return n.pose.set(this.pose),n}update(e,n){let r=this.appliedPose;if(r.mixRotate===0&&r.mixX===0&&r.mixY===0&&r.mixScaleX===0&&r.mixScaleY===0&&r.mixShearY===0)return;let s=this.data,o=s.localSource,l=s.localTarget,c=s.additive,a=s.clamp,i=s.offsets,h=this.source.appliedPose;o&&h.validateLocalTransform(e);let d=s.properties,u=s.properties.length,p=this.bones;for(let f=0,g=this.bones.length;f<g;f++){let b=p[f];l?b.modifyLocal(e):b.modifyWorld(e);for(let x=0;x<u;x++){let y=d[x],w=y.value(e,h,o,i)-y.offset,k=y.to;for(let S=0,I=y.to.length;S<I;S++){let M=k[S];if(M.mix(r)!==0){let v=M.offset+w*M.scale;a&&(M.offset<M.max?v=Q.clamp(v,M.offset,M.max):v=Q.clamp(v,M.max,M.offset)),M.apply(e,r,b,v,l,c)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);let n=this.bones,r=this.bones.length,s=!this.data.localTarget;if(s)for(let o=0;o<r;o++)e.sortBone(n[o].bone);e._updateCache.push(this);for(let o=0;o<r;o++){let l=n[o].bone;e.sortReset(l.children),e.constrained(l)}for(let o=0;o<r;o++)n[o].bone.sorted=s}isSourceActive(){return this.source.active}};var ue=class ue extends Qe{constructor(e){super(e,new ds);m(this,"bones",[]);m(this,"_source",null);m(this,"offsets",[0,0,0,0,0,0]);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"localSource",!1);m(this,"localTarget",!1);m(this,"additive",!1);m(this,"clamp",!1);m(this,"properties",[])}set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}create(e){return new sc(this,e)}getOffsetRotation(){return this.offsets[ue.ROTATION]}setOffsetRotation(e){this.offsets[ue.ROTATION]=e}getOffsetX(){return this.offsets[ue.X]}setOffsetX(e){this.offsets[ue.X]=e}getOffsetY(){return this.offsets[ue.Y]}setOffsetY(e){this.offsets[ue.Y]=e}getOffsetScaleX(){return this.offsets[ue.SCALEX]}setOffsetScaleX(e){this.offsets[ue.SCALEX]=e}getOffsetScaleY(){return this.offsets[ue.SCALEY]}setOffsetScaleY(e){this.offsets[ue.SCALEY]=e}getOffsetShearY(){return this.offsets[ue.SHEARY]}setOffsetShearY(e){this.offsets[ue.SHEARY]=e}};m(ue,"ROTATION",0),m(ue,"X",1),m(ue,"Y",2),m(ue,"SCALEX",3),m(ue,"SCALEY",4),m(ue,"SHEARY",5);var gt=ue,Yr=class{constructor(){m(this,"offset",0);m(this,"to",[])}},Xr=class{constructor(){m(this,"offset",0);m(this,"max",0);m(this,"scale",0)}},us=class extends Yr{value(t,e,n,r){if(n)return e.rotation+r[gt.ROTATION];let s=t.scaleX,o=t.scaleY,l=Math.atan2(e.c/o,e.a/s)*Q.radDeg+((e.a*e.d-e.b*e.c)*s*o>0?r[gt.ROTATION]:-r[gt.ROTATION]);return l<0&&(l+=360),l}},mi=class extends Xr{mix(t){return t.mixRotate}apply(t,e,n,r,s,o){if(s)n.rotation+=(o?r:r-n.rotation)*e.mixRotate;else{let l=t.scaleX,c=t.scaleY,a=1/l,i=1/c,h=n.a*a,d=n.b*a,u=n.c*i,p=n.d*i;r*=Q.degRad,o||(r-=Math.atan2(u,h)),r>Q.PI?r-=Q.PI2:r<-Q.PI&&(r+=Q.PI2),r*=e.mixRotate;let f=Math.cos(r),g=Math.sin(r);n.a=(f*h-g*u)*l,n.b=(f*d-g*p)*l,n.c=(g*h+f*u)*c,n.d=(g*d+f*p)*c}}},fs=class extends Yr{value(t,e,n,r){return n?e.x+r[gt.X]:(r[gt.X]*e.a+r[gt.Y]*e.b+e.worldX)/t.scaleX}},di=class extends Xr{mix(t){return t.mixX}apply(t,e,n,r,s,o){s?n.x+=(o?r:r-n.x)*e.mixX:(o||(r-=n.worldX/t.scaleX),n.worldX+=r*e.mixX*t.scaleX)}},ps=class extends Yr{value(t,e,n,r){return n?e.y+r[gt.Y]:(r[gt.X]*e.c+r[gt.Y]*e.d+e.worldY)/t.scaleY}},ui=class extends Xr{mix(t){return t.mixY}apply(t,e,n,r,s,o){s?n.y+=(o?r:r-n.y)*e.mixY:(o||(r-=n.worldY/t.scaleY),n.worldY+=r*e.mixY*t.scaleY)}},gs=class extends Yr{value(t,e,n,r){if(n)return e.scaleX+r[gt.SCALEX];let s=e.a/t.scaleX,o=e.c/t.scaleY;return Math.sqrt(s*s+o*o)+r[gt.SCALEX]}},fi=class extends Xr{mix(t){return t.mixScaleX}apply(t,e,n,r,s,o){if(s)o?n.scaleX*=1+(r-1)*e.mixScaleX:n.scaleX!==0&&(n.scaleX+=(r-n.scaleX)*e.mixScaleX);else if(o){let l=1+(r-1)*e.mixScaleX;n.a*=l,n.c*=l}else{let l=n.a/t.scaleX,c=n.c/t.scaleY,a=Math.sqrt(l*l+c*c);a!==0&&(a=1+(r-a)*e.mixScaleX/a,n.a*=a,n.c*=a)}}},bs=class extends Yr{value(t,e,n,r){if(n)return e.scaleY+r[gt.SCALEY];let s=e.b/t.scaleX,o=e.d/t.scaleY;return Math.sqrt(s*s+o*o)+r[gt.SCALEY]}},pi=class extends Xr{mix(t){return t.mixScaleY}apply(t,e,n,r,s,o){if(s)o?n.scaleY*=1+(r-1)*e.mixScaleY:n.scaleY!==0&&(n.scaleY+=(r-n.scaleY)*e.mixScaleY);else if(o){let l=1+(r-1)*e.mixScaleY;n.b*=l,n.d*=l}else{let l=n.b/t.scaleX,c=n.d/t.scaleY,a=Math.sqrt(l*l+c*c);a!==0&&(a=1+(r-a)*e.mixScaleY/a,n.b*=a,n.d*=a)}}},xs=class extends Yr{value(t,e,n,r){if(n)return e.shearY+r[gt.SHEARY];let s=1/t.scaleX,o=1/t.scaleY;return(Math.atan2(e.d*o,e.b*s)-Math.atan2(e.c*o,e.a*s))*Q.radDeg-90+r[gt.SHEARY]}},gi=class extends Xr{mix(t){return t.mixShearY}apply(t,e,n,r,s,o){if(s)o||(r-=n.shearY),n.shearY+=r*e.mixShearY;else{let l=t.scaleX,c=t.scaleY,a=n.b/l,i=n.d/c,h=Math.atan2(i,a);r=(r+90)*Q.degRad,o?r-=Q.PI/2:(r-=h-Math.atan2(n.c/c,n.a/l),r>Q.PI?r-=Q.PI2:r<-Q.PI&&(r+=Q.PI2)),r=h+r*e.mixShearY;let d=Math.sqrt(a*a+i*i);n.b=Math.cos(r)*d*l,n.d=Math.sin(r)*d*c}}};var ac=class{constructor(t){m(this,"scale",1);m(this,"attachmentLoader");m(this,"linkedMeshes",[]);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Pr;n.name="";let r=new ah(t),s=r.readInt32(),o=r.readInt32();n.hash=o===0&&s===0?null:o.toString(16)+s.toString(16),n.version=r.readString(),n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat(),n.referenceScale=r.readFloat()*e;let l=r.readBoolean();l&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());let c=0;c=r.readInt(!0);for(let p=0;p<c;p++){let f=r.readString();if(!f)throw new Error("String in string table must not be null.");r.strings.push(f)}let a=n.bones;c=r.readInt(!0);for(let p=0;p<c;p++){let f=r.readString();if(!f)throw new Error("Bone name must not be null.");let g=p===0?null:a[r.readInt(!0)],b=new ri(p,f,g),x=b.setupPose;x.rotation=r.readFloat(),x.x=r.readFloat()*e,x.y=r.readFloat()*e,x.scaleX=r.readFloat(),x.scaleY=r.readFloat(),x.shearX=r.readFloat(),x.shearY=r.readFloat(),x.inherit=r.readByte(),b.length=r.readFloat()*e,b.skinRequired=r.readBoolean(),l&&(_.rgba8888ToColor(b.color,r.readInt32()),b.icon=r.readString()??void 0,b.iconSize=r.readFloat(),b.iconRotation=r.readFloat(),b.visible=r.readBoolean()),a.push(b)}c=r.readInt(!0);for(let p=0;p<c;p++){let f=r.readString();if(!f)throw new Error("Slot name must not be null.");let g=a[r.readInt(!0)],b=new hi(p,f,g);_.rgba8888ToColor(b.setupPose.color,r.readInt32());let x=r.readInt32();x!==-1&&_.rgb888ToColor(b.setupPose.darkColor=new _,x),b.attachmentName=r.readStringRef(),b.blendMode=r.readInt(!0),l&&(b.visible=r.readBoolean()),n.slots.push(b)}let i=n.constraints,h=r.readInt(!0);for(let p=0;p<h;p++){let f=r.readString();if(!f)throw new Error("Constraint data name must not be null.");let g;switch(r.readByte()){case $u:{let b=new Dr(f);g=r.readInt(!0);for(let w=0;w<g;w++)b.bones.push(a[r.readInt(!0)]);b.target=a[r.readInt(!0)];let x=r.readByte();b.skinRequired=(x&1)!==0,x&2&&(b.scaleYMode=r.readUnsignedByte());let y=b.setupPose;y.bendDirection=x&4?-1:1,y.compress=(x&8)!==0,y.stretch=(x&16)!==0,x&32&&(y.mix=x&64?r.readFloat():1),x&128&&(y.softness=r.readFloat()*e),i.push(b);break}case Hu:{let b=new gt(f);g=r.readInt(!0);for(let w=0;w<g;w++)b.bones.push(a[r.readInt(!0)]);b.source=a[r.readInt(!0)];let x=r.readUnsignedByte();b.skinRequired=(x&1)!==0,b.localSource=(x&2)!==0,b.localTarget=(x&4)!==0,b.additive=(x&8)!==0,b.clamp=(x&16)!==0,g=x>>5;for(let w=0,k;w<g;w++){let S=1,I;switch(r.readByte()){case 0:I=new us;break;case 1:{S=e,I=new fs;break}case 2:{S=e,I=new ps;break}case 3:I=new gs;break;case 4:I=new bs;break;case 5:I=new xs;break;default:I=null}if(I){I.offset=r.readFloat()*S,k=r.readByte();for(let M=0;M<k;M++){let v=1,E;switch(r.readByte()){case 0:E=new mi;break;case 1:{v=e,E=new di;break}case 2:{v=e,E=new ui;break}case 3:E=new fi;break;case 4:E=new pi;break;case 5:E=new gi;break;default:E=null}E&&(E.offset=r.readFloat()*v,E.max=r.readFloat()*v,E.scale=r.readFloat()*v/S,I.to[M]=E)}b.properties[w]=I}}x=r.readByte(),x&1&&(b.offsets[gt.ROTATION]=r.readFloat()),x&2&&(b.offsets[gt.X]=r.readFloat()*e),x&4&&(b.offsets[gt.Y]=r.readFloat()*e),x&8&&(b.offsets[gt.SCALEX]=r.readFloat()),x&16&&(b.offsets[gt.SCALEY]=r.readFloat()),x&32&&(b.offsets[gt.SHEARY]=r.readFloat()),x=r.readByte();let y=b.setupPose;x&1&&(y.mixRotate=r.readFloat()),x&2&&(y.mixX=r.readFloat()),x&4&&(y.mixY=r.readFloat()),x&8&&(y.mixScaleX=r.readFloat()),x&16&&(y.mixScaleY=r.readFloat()),x&32&&(y.mixShearY=r.readFloat()),i.push(b);break}case zu:{let b=new Vr(f);g=r.readInt(!0);for(let w=0;w<g;w++)b.bones.push(a[r.readInt(!0)]);b.slot=n.slots[r.readInt(!0)];let x=r.readByte();b.skinRequired=(x&1)!==0,b.positionMode=x>>1&1,b.spacingMode=x>>2&3,b.rotateMode=x>>4&3,x&128&&(b.offsetRotation=r.readFloat());let y=b.setupPose;y.position=r.readFloat(),b.positionMode===Le.Fixed&&(y.position*=e),y.spacing=r.readFloat(),(b.spacingMode===te.Length||b.spacingMode===te.Fixed)&&(y.spacing*=e),y.mixRotate=r.readFloat(),y.mixX=r.readFloat(),y.mixY=r.readFloat(),i.push(b);break}case Gu:{let b=new Rr(f);b.bone=a[r.readInt(!0)];let x=r.readByte();if(b.skinRequired=(x&1)!==0,x&2&&(b.x=r.readFloat()),x&4&&(b.y=r.readFloat()),x&8&&(b.rotate=r.readFloat()),x&16){let w=r.readFloat();w<-2?(b.scaleYMode=ie.Volume,w=-2-w):w<0&&(b.scaleYMode=ie.Uniform,w=-1-w),b.scaleX=w}x&32&&(b.shearX=r.readFloat()),b.limit=(x&64?r.readFloat():5e3)*e,b.step=1/r.readUnsignedByte();let y=b.setupPose;y.inertia=r.readFloat(),y.strength=r.readFloat(),y.damping=r.readFloat(),y.massInverse=x&128?r.readFloat():1,y.wind=r.readFloat(),y.gravity=r.readFloat(),x=r.readByte(),x&1&&(b.inertiaGlobal=!0),x&2&&(b.strengthGlobal=!0),x&4&&(b.dampingGlobal=!0),x&8&&(b.massGlobal=!0),x&16&&(b.windGlobal=!0),x&32&&(b.gravityGlobal=!0),x&64&&(b.mixGlobal=!0),y.mix=x&128?r.readFloat():1,i.push(b);break}case ju:{let b=new _e(f),x=r.readByte();if(b.skinRequired=(x&1)!==0,b.loop=(x&2)!==0,b.additive=(x&4)!==0,x&8){let y=r.readFloat();l&&x&64?b.max=y:b.setupPose.time=y}if(x&16&&(b.setupPose.mix=x&32?r.readFloat():1),x&64){b.local=(x&128)!==0,b.bone=a[r.readInt(!0)];let y=r.readFloat(),w=1;switch(r.readByte()){case 0:b.property=new us;break;case 1:{w=e,b.property=new fs;break}case 2:{w=e,b.property=new ps;break}case 3:b.property=new gs;break;case 4:b.property=new bs;break;case 5:b.property=new xs;break;default:continue}b.property.offset=y*w,b.offset=r.readFloat(),b.scale=r.readFloat()/w}i.push(b);break}}}let d=this.readSkin(r,n,!0,l);d&&(n.defaultSkin=d,n.skins.push(d));{let p=n.skins.length;for(J.setArraySize(n.skins,c=p+r.readInt(!0));p<c;p++){let f=this.readSkin(r,n,!1,l);if(!f)throw new Error("readSkin() should not have returned null.");n.skins[p]=f}}c=this.linkedMeshes.length;for(let p=0;p<c;p++){let f=this.linkedMeshes[p],g=n.skins[f.skinIndex];if(!f.source)throw new Error("Linked mesh parent must not be null");let b=g.getAttachment(f.sourceIndex,f.source);if(!b)throw new Error(`Source mesh not found: ${f.source}`);f.mesh.timelineAttachment=f.inheritTimelines?b:f.mesh,f.mesh.setSourceMesh(b),f.mesh.updateSequence()}this.linkedMeshes.length=0,c=r.readInt(!0);for(let p=0;p<c;p++){let f=r.readString();if(!f)throw new Error("Event data name must not be null");let g=new oi(f),b=g.setupPose;b.intValue=r.readInt(!1),b.floatValue=r.readFloat(),b.stringValue=r.readString(),g._audioPath=r.readString(),g.audioPath&&(b.volume=r.readFloat(),b.balance=r.readFloat()),n.events.push(g)}let u=n.animations;c=r.readInt(!0);for(let p=0;p<c;p++){let f=r.readString();if(!f)throw new Error("Animation name must not be null.");u.push(this.readAnimation(r,f,n,l))}for(let p=0;p<h;p++){let f=i[p];f instanceof _e&&(f.animation=u[r.readInt(!0)])}return n}readSkin(t,e,n,r){let s=null,o=0;if(n){if(o=t.readInt(!0),o===0)return null;s=new er("default")}else{let l=t.readString();if(!l)throw new Error("Skin name must not be null.");s=new er(l),r&&_.rgba8888ToColor(s.color,t.readInt32());let c=t.readInt(!0),a=e.bones,i=s.bones;for(let h=0;h<c;h++)i[h]=a[t.readInt(!0)];c=t.readInt(!0),a=e.constraints,i=s.constraints;for(let h=0;h<c;h++)i[h]=a[t.readInt(!0)];o=t.readInt(!0)}for(let l=0;l<o;l++){let c=t.readInt(!0);for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,s,c,h,r);d&&s.setAttachment(c,h,d)}}return s}readAttachment(t,e,n,r,s,o){let l=this.scale,c=t.readByte(),a=c&8?t.readStringRef():s;if(!a)throw new Error("Attachment name must not be null");switch(c&7){case Lr.Region:{let i=c&16?t.readStringRef():null,h=c&32?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),u=c&128?t.readFloat():0,p=t.readFloat(),f=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readFloat();i||(i=a);let w=this.attachmentLoader.newRegionAttachment(n,s,a,i,d);return w?(w.path=i,w.x=p*l,w.y=f*l,w.scaleX=g,w.scaleY=b,w.rotation=u,w.width=x*l,w.height=y*l,_.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case Lr.BoundingBox:{let i=this.readVertices(t,(c&16)!==0),h=o?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(n,s,a);return d?(d.worldVerticesLength=i.length,d.vertices=i.vertices,d.bones=i.bones,o&&_.rgba8888ToColor(d.color,h),d):null}case Lr.Mesh:{let i=c&16?t.readStringRef():a,h=c&32?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),u=t.readInt(!0),p=this.readVertices(t,(c&128)!==0),f=this.readFloatArray(t,p.length,1),g=this.readShortArray(t,(p.length-u-2)*3),b=t.readInt(!0),x=null;if(b>0){x=[];for(let I=0;I<b;I++)x[I]=t.readInt(!0)}let y=[],w=0,k=0;o&&(y=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),k=t.readFloat()),i||(i=a);let S=this.attachmentLoader.newMeshAttachment(n,s,a,i,d);return S?(S.path=i,_.rgba8888ToColor(S.color,h),S.hullLength=u<<1,S.bones=p.bones,S.vertices=p.vertices,S.worldVerticesLength=p.length,S.regionUVs=f,S.triangles=g,x&&(S.timelineSlots=x),o&&(S.edges=y,S.width=w*l,S.height=k*l),S.updateSequence(),S):null}case Lr.LinkedMesh:{let i=c&16?t.readStringRef():a;if(i==null)throw new Error("Path of linked mesh must not be null");let h=c&32?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),u=(c&128)!==0,p=t.readInt(!0),f=t.readInt(!0),g=t.readStringRef(),b=0,x=0;o&&(b=t.readFloat(),x=t.readFloat());let y=this.attachmentLoader.newMeshAttachment(n,s,a,i,d);return y?(y.path=i,_.rgba8888ToColor(y.color,h),o&&(y.width=b*l,y.height=x*l),this.linkedMeshes.push(new Mm(y,f,r,p,g,u)),y):null}case Lr.Path:{let i=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),u=this.readFloatArray(t,d.length/6,l),p=o?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(n,s,a);return f?(f.closed=i,f.constantSpeed=h,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,o&&_.rgba8888ToColor(f.color,p),f):null}case Lr.Point:{let i=t.readFloat(),h=t.readFloat(),d=t.readFloat(),u=o?t.readInt32():0,p=this.attachmentLoader.newPointAttachment(n,s,a);return p?(p.x=h*l,p.y=d*l,p.rotation=i,o&&_.rgba8888ToColor(p.color,u),p):null}case Lr.Clipping:{let i=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=o?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(n,s,a);return u?(u.endSlot=e.slots[i],u.convex=(c&32)!==0,u.inverse=(c&64)!==0,u.worldVerticesLength=h.length,u.vertices=h.vertices,u.bones=h.bones,o&&_.rgba8888ToColor(u.color,d),u):null}}}readSequence(t,e){if(!e)return new Cr(1,!1);let n=new Cr(t.readInt(!0),!0);return n.start=t.readInt(!0),n.digits=t.readInt(!0),n.setupIndex=t.readInt(!0),n}readVertices(t,e){let n=this.scale,s=t.readInt(!0)<<1;if(!e)return new ih(null,this.readFloatArray(t,s,n),s);let o=t.readInt(!0),l=[],c=[];for(let a=0,i=0;a<o;){let h=t.readInt(!0);l[a++]=h;for(let d=0;d<h;d++,i+=3)l[a++]=t.readInt(!0),c[i]=t.readFloat()*n,c[i+1]=t.readFloat()*n,c[i+2]=t.readFloat()}return new ih(l,J.toFloatArray(c),s)}readFloatArray(t,e,n){let r=[];if(n===1)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let s=0;s<e;s++)r[s]=t.readFloat()*n;return r}readShortArray(t,e){let n=[];for(let r=0;r<e;r++)n[r]=t.readInt(!0);return n}readAnimation(t,e,n,r){t.readInt(!0);let s=[],o=this.scale;for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0);for(let g=0,b=t.readInt(!0);g<b;g++){let x=t.readByte(),y=t.readInt(!0),w=y-1;switch(x){case Lu:{let k=new Dn(y,f);for(let S=0;S<y;S++)k.setFrame(S,t.readFloat(),t.readStringRef());s.push(k);break}case Nu:{let k=t.readInt(!0),S=new Ra(y,k,f),I=t.readFloat(),M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let T=0,F=0;S.setFrame(T,I,M,v,E,C),T!==w;T++){let D=t.readFloat(),V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case nr:S.setStepped(T);break;case rr:bt(t,S,F++,T,0,I,D,M,V,1),bt(t,S,F++,T,1,I,D,v,X,1),bt(t,S,F++,T,2,I,D,E,N,1),bt(t,S,F++,T,3,I,D,C,q,1)}I=D,M=V,v=X,E=N,C=q}s.push(S);break}case Ou:{let k=t.readInt(!0),S=new Pa(y,k,f),I=t.readFloat(),M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let C=0,T=0;S.setFrame(C,I,M,v,E),C!==w;C++){let F=t.readFloat(),D=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255;switch(t.readByte()){case nr:S.setStepped(C);break;case rr:bt(t,S,T++,C,0,I,F,M,D,1),bt(t,S,T++,C,1,I,F,v,V,1),bt(t,S,T++,C,2,I,F,E,X,1)}I=F,M=D,v=V,E=X}s.push(S);break}case Uu:{let k=t.readInt(!0),S=new Xa(y,k,f),I=t.readFloat(),M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;for(let V=0,X=0;S.setFrame(V,I,M,v,E,C,T,F,D),V!==w;V++){let N=t.readFloat(),q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,H=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,z=t.readUnsignedByte()/255;switch(t.readByte()){case nr:S.setStepped(V);break;case rr:bt(t,S,X++,V,0,I,N,M,q,1),bt(t,S,X++,V,1,I,N,v,L,1),bt(t,S,X++,V,2,I,N,E,R,1),bt(t,S,X++,V,3,I,N,C,P,1),bt(t,S,X++,V,4,I,N,T,H,1),bt(t,S,X++,V,5,I,N,F,U,1),bt(t,S,X++,V,6,I,N,D,z,1)}I=N,M=q,v=L,E=R,C=P,T=H,F=U,D=z}s.push(S);break}case Wu:{let k=t.readInt(!0),S=new La(y,k,f),I=t.readFloat(),M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;for(let D=0,V=0;S.setFrame(D,I,M,v,E,C,T,F),D!==w;D++){let X=t.readFloat(),N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,H=t.readUnsignedByte()/255;switch(t.readByte()){case nr:S.setStepped(D);break;case rr:bt(t,S,V++,D,0,I,X,M,N,1),bt(t,S,V++,D,1,I,X,v,q,1),bt(t,S,V++,D,2,I,X,E,L,1),bt(t,S,V++,D,3,I,X,C,R,1),bt(t,S,V++,D,4,I,X,T,P,1),bt(t,S,V++,D,5,I,X,F,H,1)}I=X,M=N,v=q,E=L,C=R,T=P,F=H}s.push(S);break}case qu:{let k=new Ya(y,t.readInt(!0),f),S=t.readFloat(),I=t.readUnsignedByte()/255;for(let M=0,v=0;k.setFrame(M,S,I),M!==w;M++){let E=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case nr:k.setStepped(M);break;case rr:bt(t,k,v++,M,0,S,E,I,C,1)}S=E,I=C}s.push(k)}}}}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0);for(let g=0,b=t.readInt(!0);g<b;g++){let x=t.readByte(),y=t.readInt(!0);if(x===Xu){let k=new Da(y,f);for(let S=0;S<y;S++)k.setFrame(S,t.readFloat(),t.readByte());s.push(k);continue}let w=t.readInt(!0);switch(x){case Cu:ce(t,s,new Jn(y,w,f),1);break;case Eu:ce(t,s,new ka(y,w,f),o);break;case Tu:ce(t,s,new Ia(y,w,f),o);break;case Bu:ce(t,s,new Ma(y,w,f),o);break;case Fu:ce(t,s,new va(y,w,f),1);break;case Du:ce(t,s,new Ca(y,w,f),1);break;case Vu:ce(t,s,new Ea(y,w,f),1);break;case Ru:ce(t,s,new Ta(y,w,f),1);break;case Pu:ce(t,s,new Ba(y,w,f),1);break;case Yu:ce(t,s,new Fa(y,w,f),1);break}}}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0),g=t.readInt(!0),b=g-1,x=new Ua(g,t.readInt(!0),f),y=t.readByte(),w=t.readFloat(),k=y&1?y&2?t.readFloat():1:0,S=y&4?t.readFloat()*o:0;for(let I=0,M=0;x.setFrame(I,w,k,S,y&8?1:-1,(y&16)!==0,(y&32)!==0),I!==b;I++){y=t.readByte();let v=t.readFloat(),E=y&1?y&2?t.readFloat():1:0,C=y&4?t.readFloat()*o:0;y&64?x.setStepped(I):y&128&&(bt(t,x,M++,I,0,w,v,k,E,1),bt(t,x,M++,I,1,w,v,S,C,o)),w=v,k=E,S=C}s.push(x)}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0),g=t.readInt(!0),b=g-1,x=new Wa(g,t.readInt(!0),f),y=t.readFloat(),w=t.readFloat(),k=t.readFloat(),S=t.readFloat(),I=t.readFloat(),M=t.readFloat(),v=t.readFloat();for(let E=0,C=0;x.setFrame(E,y,w,k,S,I,M,v),E!==b;E++){let T=t.readFloat(),F=t.readFloat(),D=t.readFloat(),V=t.readFloat(),X=t.readFloat(),N=t.readFloat(),q=t.readFloat();switch(t.readByte()){case nr:x.setStepped(E);break;case rr:bt(t,x,C++,E,0,y,T,w,F,1),bt(t,x,C++,E,1,y,T,k,D,1),bt(t,x,C++,E,2,y,T,S,V,1),bt(t,x,C++,E,3,y,T,I,X,1),bt(t,x,C++,E,4,y,T,M,N,1),bt(t,x,C++,E,5,y,T,v,q,1)}y=T,w=F,k=D,S=V,I=X,M=N,v=q}s.push(x)}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0),g=n.constraints[f];for(let b=0,x=t.readInt(!0);b<x;b++){let y=t.readByte(),w=t.readInt(!0),k=t.readInt(!0);switch(y){case Ju:ce(t,s,new qa(w,k,f),g.positionMode===Le.Fixed?o:1);break;case Qu:ce(t,s,new $a(w,k,f),g.spacingMode===te.Length||g.spacingMode===te.Fixed?o:1);break;case _u:{let S=new za(w,k,f),I=t.readFloat(),M=t.readFloat(),v=t.readFloat(),E=t.readFloat();for(let C=0,T=0,F=S.getFrameCount()-1;S.setFrame(C,I,M,v,E),C!==F;C++){let D=t.readFloat(),V=t.readFloat(),X=t.readFloat(),N=t.readFloat();switch(t.readByte()){case nr:S.setStepped(C);break;case rr:bt(t,S,T++,C,0,I,D,M,V,1),bt(t,S,T++,C,1,I,D,v,X,1),bt(t,S,T++,C,2,I,D,E,N,1)}I=D,M=V,v=X,E=N}s.push(S)}}}}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0)-1;for(let g=0,b=t.readInt(!0);g<b;g++){let x=t.readByte(),y=t.readInt(!0);if(x===lf){let k=new _a(y,f);for(let S=0;S<y;S++)k.setFrame(S,t.readFloat());s.push(k);continue}let w=t.readInt(!0);switch(x){case tf:ce(t,s,new Ha(y,w,f),1);break;case ef:ce(t,s,new Ga(y,w,f),1);break;case nf:ce(t,s,new ja(y,w,f),1);break;case rf:ce(t,s,new Za(y,w,f),1);break;case sf:ce(t,s,new Ka(y,w,f),1);break;case af:ce(t,s,new Ja(y,w,f),1);break;case of:ce(t,s,new Qa(y,w,f),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let u=0,p=t.readInt(!0);u<p;u++){let f=t.readInt(!0);for(let g=0,b=t.readInt(!0);g<b;g++){let x=t.readByte(),y=t.readInt(!0),w=t.readInt(!0);switch(x){case cf:ce(t,s,new ti(y,w,f),1);break;case hf:ce(t,s,new ei(y,w,f),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let u=0,p=t.readInt(!0);u<p;u++){let f=n.skins[t.readInt(!0)];for(let g=0,b=t.readInt(!0);g<b;g++){let x=t.readInt(!0);for(let y=0,w=t.readInt(!0);y<w;y++){let k=t.readStringRef();if(!k)throw new Error("attachmentName must not be null.");let S=f.getAttachment(x,k),I=t.readByte(),M=t.readInt(!0),v=M-1;switch(I){case Zu:{let E=S,C=E.bones,T=E.vertices,F=C?T.length/3*2:T.length,D=t.readInt(!0),V=new Na(M,D,x,E),X=t.readFloat();for(let N=0,q=0;;N++){let L,R=t.readInt(!0);if(R===0)L=C?J.newFloatArray(F):T;else{L=J.newFloatArray(F);let H=t.readInt(!0);if(R+=H,o===1)for(let U=H;U<R;U++)L[U]=t.readFloat();else for(let U=H;U<R;U++)L[U]=t.readFloat()*o;if(!C)for(let U=0,z=L.length;U<z;U++)L[U]+=T[U]}if(V.setFrame(N,X,L),N===v)break;let P=t.readFloat();switch(t.readByte()){case nr:V.setStepped(N);break;case rr:bt(t,V,q++,N,0,X,P,0,1,1)}X=P}s.push(V);break}case Ku:{let E=new Oa(M,x,S);for(let C=0;C<M;C++){let T=t.readFloat(),F=t.readInt32();E.setFrame(C,T,ql[F&15],F>>4,t.readFloat())}s.push(E);break}}}}}let l=n.slots.length,c=t.readInt(!0);if(c>0){let u=new Ke(c);for(let p=0;p<c;p++)u.setFrame(p,t.readFloat(),Sd(t,l));s.push(u)}let a=t.readInt(!0);for(let u=0;u<a;u++){let p=t.readInt(!0),f=new Array(p);for(let x=0;x<p;x++)f[x]=t.readInt(!0);let g=t.readInt(!0),b=new Vn(g,f,l);for(let x=0;x<g;x++)b.setFrame(x,t.readFloat(),Sd(t,p));s.push(b)}let i=t.readInt(!0);if(i>0){let u=new Tr(i);for(let p=0;p<i;p++){let f=t.readFloat(),g=n.events[t.readInt(!0)],b=new Fr(f,g);b.intValue=t.readInt(!1),b.floatValue=t.readFloat(),b.stringValue=t.readString(),b.stringValue==null&&(b.stringValue=g.setupPose.stringValue),b.data.audioPath&&(b.volume=t.readFloat(),b.balance=t.readFloat()),u.setFrame(p,b)}s.push(u)}let h=0;for(let u=0,p=s.length;u<p;u++)h=Math.max(h,s[u].getDuration());let d=new Er(e,s,h);return r&&_.rgba8888ToColor(d.color,t.readInt32()),d}},ah=class{constructor(t,e=[],n=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){m(this,"strings");m(this,"index");m(this,"buffer");this.strings=e,this.index=n,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(),n=e&127;return e&128&&(e=this.readByte(),n|=(e&127)<<7,e&128&&(e=this.readByte(),n|=(e&127)<<14,e&128&&(e=this.readByte(),n|=(e&127)<<21,e&128&&(e=this.readByte(),n|=(e&127)<<28)))),t?n:n>>>1^-(n&1)}readStringRef(){let t=this.readInt(!0);return t===0?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 n=0;n<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),n+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Mm=class{constructor(t,e,n,r,s,o){m(this,"source");m(this,"skinIndex");m(this,"slotIndex");m(this,"sourceIndex");m(this,"mesh");m(this,"inheritTimelines");this.mesh=t,this.skinIndex=e,this.slotIndex=n,this.sourceIndex=r,this.source=s,this.inheritTimelines=o}},ih=class{constructor(t=null,e,n=0){m(this,"bones");m(this,"vertices");m(this,"length");this.bones=t,this.vertices=e,this.length=n}},Lr;(function(A){A[A.Region=0]="Region",A[A.BoundingBox=1]="BoundingBox",A[A.Mesh=2]="Mesh",A[A.LinkedMesh=3]="LinkedMesh",A[A.Path=4]="Path",A[A.Point=5]="Point",A[A.Clipping=6]="Clipping"})(Lr||(Lr={}));function ce(A,t,e,n){e instanceof ss?Mu(A,t,e,n):vu(A,t,e,n)}function Mu(A,t,e,n){let r=A.readFloat(),s=A.readFloat()*n;for(let o=0,l=0,c=e.getFrameCount()-1;e.setFrame(o,r,s),o!==c;o++){let a=A.readFloat(),i=A.readFloat()*n;switch(A.readByte()){case nr:e.setStepped(o);break;case rr:bt(A,e,l++,o,0,r,a,s,i,n)}r=a,s=i}t.push(e)}function vu(A,t,e,n){let r=A.readFloat(),s=A.readFloat()*n,o=A.readFloat()*n;for(let l=0,c=0,a=e.getFrameCount()-1;e.setFrame(l,r,s,o),l!==a;l++){let i=A.readFloat(),h=A.readFloat()*n,d=A.readFloat()*n;switch(A.readByte()){case nr:e.setStepped(l);break;case rr:bt(A,e,c++,l,0,r,i,s,h,n),bt(A,e,c++,l,1,r,i,o,d,n)}r=i,s=h,o=d}t.push(e)}function Sd(A,t){let e=A.readInt(!0);if(e===0)return null;let n=new Array(t).fill(-1),r=new Array(t-e),s=0,o=0;for(let l=0;l<e;l++){let c=A.readInt(!0);for(;s!==c;)r[o++]=s++;n[s+A.readInt(!0)]=s++}for(;s<t;)r[o++]=s++;for(let l=t-1;l>=0;l--)n[l]===-1&&(n[l]=r[--o]);return n}function bt(A,t,e,n,r,s,o,l,c,a){t.setBezier(e,n,r,s,l,A.readFloat(),A.readFloat()*a,A.readFloat(),A.readFloat()*a,o,c)}var Cu=0,Eu=1,Tu=2,Bu=3,Fu=4,Du=5,Vu=6,Ru=7,Pu=8,Yu=9,Xu=10,Lu=0,Nu=1,Ou=2,Uu=3,Wu=4,qu=5,$u=0,zu=1,Hu=2,Gu=3,ju=4,Zu=0,Ku=1,Ju=0,Qu=1,_u=2,tf=0,ef=1,nf=2,rf=4,sf=5,af=6,of=7,lf=8,cf=0,hf=1;var nr=1,rr=2;var bi=class{constructor(){m(this,"minX",0);m(this,"minY",0);m(this,"maxX",0);m(this,"maxY",0);m(this,"boundingBoxes",[]);m(this,"polygons",[]);m(this,"polygonPool",new wn(()=>J.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let n=this.boundingBoxes,r=this.polygons,s=this.polygonPool,o=t.slots,l=o.length;n.length=0,s.freeAll(r),r.length=0;for(let c=0;c<l;c++){let a=o[c];if(!a.bone.active)continue;let i=a.appliedPose.attachment;if(i instanceof ni){n.push(i);let h=s.obtain();h.length!==i.worldVerticesLength&&(h=J.newFloatArray(i.worldVerticesLength)),r.push(h),i.computeWorldVertices(t,a,0,i.worldVerticesLength,h,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,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=this.polygons;for(let o=0,l=s.length;o<l;o++){let c=s[o],a=c;for(let i=0,h=c.length;i<h;i+=2){let d=a[i],u=a[i+1];t=Math.min(t,d),e=Math.min(e,u),n=Math.max(n,d),r=Math.max(r,u)}}this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,n,r){let s=this.minX,o=this.minY,l=this.maxX,c=this.maxY;if(t<=s&&n<=s||e<=o&&r<=o||t>=l&&n>=l||e>=c&&r>=c)return!1;let a=(r-e)/(n-t),i=a*(s-t)+e;if(i>o&&i<c||(i=a*(l-t)+e,i>o&&i<c))return!0;let h=(o-e)/a+t;return h>s&&h<l||(h=(c-e)/a+t,h>s&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let n=this.polygons;for(let r=0,s=n.length;r<s;r++)if(this.containsPointPolygon(n[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,n){let r=t,s=t.length,o=s-2,l=!1;for(let c=0;c<s;c+=2){let a=r[c+1],i=r[o+1];if(a<n&&i>=n||i<n&&a>=n){let h=r[c];h+(n-a)/(i-a)*(r[o]-h)<e&&(l=!l)}o=c}return l}intersectsSegment(t,e,n,r){let s=this.polygons;for(let o=0,l=s.length;o<l;o++)if(this.intersectsSegmentPolygon(s[o],t,e,n,r))return this.boundingBoxes[o];return null}intersectsSegmentPolygon(t,e,n,r,s){let o=t,l=t.length,c=e-r,a=n-s,i=e*s-n*r,h=o[l-2],d=o[l-1];for(let u=0;u<l;u+=2){let p=o[u],f=o[u+1],g=h*f-d*p,b=h-p,x=d-f,y=c*x-a*b,w=(i*b-c*g)/y;if((w>=h&&w<=p||w>=p&&w<=h)&&(w>=e&&w<=r||w>=r&&w<=e)){let k=(i*x-a*g)/y;if((k>=d&&k<=f||k>=f&&k<=d)&&(k>=n&&k<=s||k>=s&&k<=n))return!0}h=p,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}};var ic=class A{constructor(){m(this,"convexPolygons",[]);m(this,"convexPolygonsIndices",[]);m(this,"indicesArray",[]);m(this,"isConcaveArray",[]);m(this,"triangles",[]);m(this,"polygonPool",new wn(()=>[]));m(this,"polygonIndicesPool",new wn(()=>[]))}triangulate(t){let e=t,n=t.length>>1,r=this.indicesArray;r.length=0;for(let l=0;l<n;l++)r[l]=l;let s=this.isConcaveArray;s.length=0;for(let l=0;l<n;l++)s[l]=A.isConcave(l,n,e,r);let o=this.triangles;for(o.length=0;n>3;){let l=n-1,c=0,a=1;for(;;){t:if(!s[c]){let d=r[l]<<1,u=r[c]<<1,p=r[a]<<1,f=e[d],g=e[d+1],b=e[u],x=e[u+1],y=e[p],w=e[p+1];for(let k=a+1<n?a+1:0;k!==l;){if(s[k]){let S=r[k]<<1,I=e[S],M=e[S+1];if(A.positiveArea(y,w,f,g,I,M)&&A.positiveArea(f,g,b,x,I,M)&&A.positiveArea(b,x,y,w,I,M))break t}++k===n&&(k=0)}break}if(a===0){do{if(!s[c])break;c--}while(c>0);l=c>0?c-1:n-1,a=c+1<n?c+1:0;break}l=c,c=a,++a===n&&(a=0)}o.push(r[l],r[c],r[a]),r.splice(c,1),s.splice(c,1),n--;let i=c>0?c-1:n-1,h=c<n?c:0;s[i]=A.isConcave(i,n,e,r),s[h]=A.isConcave(h,n,e,r)}return n===3&&o.push(r[2],r[0],r[1]),o}decompose(t,e){let n=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let s=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(s),s.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let l=this.polygonPool.obtain();l.length=0;let c=-1,a=0;for(let i=0,h=e.length;i<h;i+=3){let d=e[i]<<1,u=e[i+1]<<1,p=e[i+2]<<1,f=n[d],g=n[d+1],b=n[u],x=n[u+1],y=n[p],w=n[p+1];if(c===d){let k=l.length-4;if(A.winding(l[k],l[k+1],l[k+2],l[k+3],y,w)===a&&A.winding(y,w,l[0],l[1],l[2],l[3])===a){l.push(y,w),o.push(p);continue}}l.length>0&&(r.push(l),s.push(o),l=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),l.length=0,l.push(f,g,b,x),l.push(y,w),o.length=0,o.push(d,u,p),a=A.winding(f,g,b,x,y,w),c=d}l.length>0&&(r.push(l),s.push(o));for(let i=0,h=r.length;i<h;i++){if(o=s[i],o.length===0)continue;let d=o[0],u=o[o.length-1];l=r[i];let p=l.length-4,f=l[p],g=l[p+1],b=l[p+2],x=l[p+3],y=l[0],w=l[1],k=l[2],S=l[3],I=A.winding(f,g,b,x,y,w);for(let M=0;M<h;M++){if(M===i)continue;let v=s[M];if(v.length!==3)continue;let E=v[0],C=v[1],T=v[2],F=r[M],D=F[F.length-2],V=F[F.length-1];E!==d||C!==u||A.winding(f,g,b,x,D,V)===I&&A.winding(D,V,y,w,k,S)===I&&(F.length=0,v.length=0,l.push(D,V),o.push(T),u=T,f=b,g=x,b=D,x=V,M=-1)}}for(let i=r.length-1;i>=0;i--)l=r[i],l.length===0?(r.splice(i,1),this.polygonPool.free(l),o=s[i],s.splice(i,1),this.polygonIndicesPool.free(o)):l.push(l[0],l[1]);return r}static isConcave(t,e,n,r){let s=r[t>0?t-1:e-1]<<1,o=r[t]<<1,l=r[t+1<e?t+1:0]<<1;return!A.positiveArea(n[s],n[s+1],n[o],n[o+1],n[l],n[l+1])}static positiveArea(t,e,n,r,s,o){return t*(o-r)+n*(e-o)+s*(r-e)>=0}static winding(t,e,n,r,s,o){return t*(o-r)+n*(e-o)+s*(r-e)>=0?1:-1}};var Nr=class{constructor(){m(this,"triangulator",null);m(this,"clippingPolygon",[]);m(this,"clippingPolygons",[]);m(this,"clipOutput",[]);m(this,"clippedVertices",[]);m(this,"clippedUVs",[]);m(this,"clippedTriangles",[]);m(this,"inverseVertices",[]);m(this,"_clippedVerticesTyped",new Float32Array(1024));m(this,"_clippedUVsTyped",new Float32Array(1024));m(this,"_clippedTrianglesTyped",new Uint16Array(1024));m(this,"clippedVerticesTyped",new Float32Array(0));m(this,"clippedUVsTyped",new Float32Array(0));m(this,"clippedTrianglesTyped",new Uint16Array(0));m(this,"clippedVerticesLength",0);m(this,"clippedUVsLength",0);m(this,"clippedTrianglesLength",0);m(this,"scratch",[]);m(this,"inverse",!1);m(this,"clipAttachment",null)}clipStart(t,e,n){if(this.clipAttachment)return;let r=n.worldVerticesLength;this.clipAttachment=n,this.inverse=n.inverse;let s=J.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(t,e,0,r,s,0,2);let o=this.clippingPolygon,l=this.makeClockwise(o);l||this.inverse||n.convex?(l||this.makeConvex(o),this.clippingPolygon.push(o[0],o[1]),this.clippingPolygons.push(o)):(this.triangulator===null&&(this.triangulator=new ic),this.clippingPolygons.push(...this.triangulator.decompose(o,this.triangulator.triangulate(o))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,n,r,s,o,l,c){return r&&s&&o&&typeof l=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,n,r,s,o,l,c):this.clipTrianglesNoRender(t,e,n)}clipTrianglesNoRender(t,e,n){let r=this.clippedVertices;r.length=0;let s=this.clippedTriangles;s.length=0;let o=0;if(this.inverse){let h=this.clippingPolygons[0];for(let d=0;d<n;d+=3){let u=e[d]<<1,p=t[u],f=t[u+1];u=e[d+1]<<1;let g=t[u],b=t[u+1];u=e[d+2]<<1;let x=t[u],y=t[u+1];this.clipInverse(p,f,g,b,x,y,h);let w=this.inverseVertices;for(let k=0,S=this.inverseVertices.length;k<S;){let I=w[k++],M=I>>1,v=r.length,E=J.setArraySize(r,v+I);J.arrayCopy(w,k,E,v,I),v=s.length;let C=J.setArraySize(s,v+3*(M-2));for(let T=1;T<M-1;T++,v+=3)C[v]=o,C[v+1]=o+T,C[v+2]=o+T+1;o+=M,k+=I}}return!0}let l=this.clipOutput,c=this.clippingPolygons,a=c.length,i=null;for(let h=0;h<n;h+=3){let d=e[h]<<1,u=t[d],p=t[d+1];d=e[h+1]<<1;let f=t[d],g=t[d+1];d=e[h+2]<<1;let b=t[d],x=t[d+1];for(let y=0;y<a;y++){let w=r.length;if(this.clip(u,p,f,g,b,x,c[y])){i=this.clipOutput;let k=l.length;if(k===0)continue;let S=k>>1,I=J.setArraySize(r,w+k);J.arrayCopy(i,0,I,w,k),w=s.length;let M=J.setArraySize(s,w+3*(S-2));S--;for(let v=1;v<S;v++,w+=3)M[w]=o,M[w+1]=o+v,M[w+2]=o+v+1;o+=S}else{let k=J.setArraySize(r,w+6);k[w]=u,k[w+1]=p,k[w+2]=f,k[w+3]=g,k[w+4]=b,k[w+5]=x,w=s.length;let S=J.setArraySize(s,w+3);S[w]=o,S[w+1]=o+1,S[w+2]=o+2,o+=3;break}}}return i!=null}clipTrianglesRender(t,e,n,r,s,o,l,c){let a=this.clippedVertices;a.length=0;let i=this.clippedTriangles;i.length=0;let h=0;if(this.inverse){let g=this.clippingPolygons[0];for(let b=0;b<n;b+=3){let x=e[b],y=e[b+1],w=e[b+2],k=t[x*c],S=t[x*c+1],I=t[y*c],M=t[y*c+1],v=t[w*c],E=t[w*c+1];this.clipInverse(k,S,I,M,v,E,g);let C=this.inverseVertices.length;if(C===0)continue;let T=r[x<<=1],F=r[x+1],D=r[y<<=1],V=r[y+1],X=r[w<<=1],N=r[w+1],q=M-E,L=v-I,R=k-v,P=E-S,H=1/(q*R+L*(S-E)),U=this.inverseVertices;for(let z=0;z<C;){let O=U[z++],Z=O>>1,K=a.length,it=J.setArraySize(a,K+Z*c);for(let st=0;st<O;st+=2,K+=c){let dt=U[z+st],Mt=U[z+st+1];it[K]=dt,it[K+1]=Mt,it[K+2]=s.r,it[K+3]=s.g,it[K+4]=s.b,it[K+5]=s.a;let Bt=dt-v,jt=Mt-E,Rt=(q*Bt+L*jt)*H,Xt=(P*Bt+R*jt)*H,Wt=1-Rt-Xt;it[K+6]=T*Rt+D*Xt+X*Wt,it[K+7]=F*Rt+V*Xt+N*Wt,l&&(it[K+8]=o.r,it[K+9]=o.g,it[K+10]=o.b,it[K+11]=o.a)}K=i.length;let et=J.setArraySize(i,K+3*(Z-2));for(let st=1;st<Z-1;st++,K+=3)et[K]=h,et[K+1]=h+st,et[K+2]=h+st+1;h+=Z,z+=O}}return!0}let d=this.clipOutput,u=this.clippingPolygons,p=this.clippingPolygons.length,f=null;for(let g=0;g<n;g+=3){let b=e[g],x=t[b*c],y=t[b*c+1],w=r[b<<1],k=r[(b<<1)+1];b=e[g+1];let S=t[b*c],I=t[b*c+1],M=r[b<<1],v=r[(b<<1)+1];b=e[g+2];let E=t[b*c],C=t[b*c+1],T=r[b<<1],F=r[(b<<1)+1],D=0,V=0,X=0,N=0,q=0;for(let L=0;L<p;L++){let R=a.length;if(this.clip(x,y,S,I,E,C,u[L])){f=this.clipOutput;let P=d.length;if(P===0)continue;let H=P>>1;q===0&&(D=I-C,V=E-S,X=x-E,N=C-y,q=1/(D*X-V*N));let U=J.setArraySize(a,R+H*c);for(let O=0;O<P;O+=2,R+=c){let Z=f[O],K=f[O+1];U[R]=Z,U[R+1]=K,U[R+2]=s.r,U[R+3]=s.g,U[R+4]=s.b,U[R+5]=s.a;let it=Z-E,et=K-C,st=(D*it+V*et)*q,dt=(N*it+X*et)*q,Mt=1-st-dt;U[R+6]=w*st+M*dt+T*Mt,U[R+7]=k*st+v*dt+F*Mt,l&&(U[R+8]=o.r,U[R+9]=o.g,U[R+10]=o.b,U[R+11]=o.a)}R=i.length;let z=J.setArraySize(i,R+3*(H-2));H--;for(let O=1;O<H;O++,R+=3)z[R]=h,z[R+1]=h+O,z[R+2]=h+O+1;h+=H+1}else{let P=J.setArraySize(a,R+3*c);P[R]=x,P[R+1]=y,P[R+2]=s.r,P[R+3]=s.g,P[R+4]=s.b,P[R+5]=s.a,l?(P[R+6]=w,P[R+7]=k,P[R+8]=o.r,P[R+9]=o.g,P[R+10]=o.b,P[R+11]=o.a,P[R+12]=S,P[R+13]=I,P[R+14]=s.r,P[R+15]=s.g,P[R+16]=s.b,P[R+17]=s.a,P[R+18]=M,P[R+19]=v,P[R+20]=o.r,P[R+21]=o.g,P[R+22]=o.b,P[R+23]=o.a,P[R+24]=E,P[R+25]=C,P[R+26]=s.r,P[R+27]=s.g,P[R+28]=s.b,P[R+29]=s.a,P[R+30]=T,P[R+31]=F,P[R+32]=o.r,P[R+33]=o.g,P[R+34]=o.b,P[R+35]=o.a):(P[R+6]=w,P[R+7]=k,P[R+8]=S,P[R+9]=I,P[R+10]=s.r,P[R+11]=s.g,P[R+12]=s.b,P[R+13]=s.a,P[R+14]=M,P[R+15]=v,P[R+16]=E,P[R+17]=C,P[R+18]=s.r,P[R+19]=s.g,P[R+20]=s.b,P[R+21]=s.a,P[R+22]=T,P[R+23]=F),R=i.length;let H=J.setArraySize(i,R+3);H[R]=h,H[R+1]=h+1,H[R+2]=h+2,h+=3;break}}}return f!=null}clipTrianglesUnpacked(t,e,n,r,s,o=2){let l=this._clippedVerticesTyped,c=this._clippedUVsTyped,a=this._clippedTrianglesTyped,i=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){let f=this.clippingPolygons[0];for(let g=0;g<r;g+=3){let b=n[g]*o,x=t[e+b],y=t[e+b+1],w=n[g]<<1,k=s[w],S=s[w+1];b=n[g+1]*o;let I=t[e+b],M=t[e+b+1];w=n[g+1]<<1;let v=s[w],E=s[w+1];b=n[g+2]*o;let C=t[e+b],T=t[e+b+1];w=n[g+2]<<1;let F=s[w],D=s[w+1];this.clipInverse(x,y,I,M,C,T,f);let V=this.inverseVertices.length;if(V===0)continue;let X=M-T,N=C-I,q=x-C,L=T-y,R=1/(X*q+N*(y-T)),P=this.inverseVertices;for(let H=0;H<V;){let U=P[H++],z=U>>1,O=this.clippedVerticesLength,Z=O+z*o,K=this.clippedUVsLength+z*2;l.length<Z&&(this._clippedVerticesTyped=new Float32Array(Z*2),this._clippedVerticesTyped.set(l.subarray(0,O)),l=this._clippedVerticesTyped),c.length<K&&(this._clippedUVsTyped=new Float32Array(K*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=Z,this.clippedUVsLength=K;let it=this._clippedVerticesTyped,et=this._clippedUVsTyped,st=K-z*2;for(let Bt=0;Bt<U;Bt+=2,O+=o,st+=2){let jt=P[H+Bt],Rt=P[H+Bt+1];it[O]=jt,it[O+1]=Rt;let Xt=jt-C,Wt=Rt-T,Zt=(X*Xt+N*Wt)*R,Lt=(L*Xt+q*Wt)*R,Kt=1-Zt-Lt;et[st]=k*Zt+v*Lt+F*Kt,et[st+1]=S*Zt+E*Lt+D*Kt}O=this.clippedTrianglesLength;let dt=O+3*(z-2);a.length<dt&&(this._clippedTrianglesTyped=new Uint16Array(dt*2),this._clippedTrianglesTyped.set(a.subarray(0,O)),a=this._clippedTrianglesTyped),this.clippedTrianglesLength=dt;let Mt=a;for(let Bt=1;Bt<z-1;Bt++,O+=3)Mt[O]=i,Mt[O+1]=i+Bt,Mt[O+2]=i+Bt+1;i+=z,H+=U}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}let h=this.clipOutput,d=this.clippingPolygons,u=this.clippingPolygons.length,p=null;for(let f=0;f<r;f+=3){let g=n[f],b=g*o,x=t[e+b],y=t[e+b+1],w=g<<1,k=s[w],S=s[w+1];g=n[f+1],b=g*o;let I=t[e+b],M=t[e+b+1];w=g<<1;let v=s[w],E=s[w+1];g=n[f+2],b=g*o;let C=t[e+b],T=t[e+b+1];w=g<<1;let F=s[w],D=s[w+1],V=0,X=0,N=0,q=0,L=0;for(let R=0;R<u;R++){let P=this.clippedVerticesLength;if(this.clip(x,y,I,M,C,T,d[R])){p=h;let H=h.length;if(H===0)continue;let U=H>>1;L===0&&(V=M-T,X=C-I,N=x-C,q=T-y,L=1/(V*N-X*q));let z=P+U*o;l.length<z&&(this._clippedVerticesTyped=new Float32Array(z*2),this._clippedVerticesTyped.set(l.subarray(0,P)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+U*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),l=this._clippedVerticesTyped,c=this._clippedUVsTyped);let O=l,Z=c;this.clippedVerticesLength=z;let K=this.clippedUVsLength;this.clippedUVsLength=K+U*2;for(let st=0;st<H;st+=2,P+=o,K+=2){let dt=p[st],Mt=p[st+1];O[P]=dt,O[P+1]=Mt;let Bt=dt-C,jt=Mt-T,Rt=(V*Bt+X*jt)*L,Xt=(q*Bt+N*jt)*L,Wt=1-Rt-Xt;Z[K]=k*Rt+v*Xt+F*Wt,Z[K+1]=S*Rt+E*Xt+D*Wt}P=this.clippedTrianglesLength;let it=P+3*(U-2);a.length<it&&(this._clippedTrianglesTyped=new Uint16Array(it*2),this._clippedTrianglesTyped.set(a.subarray(0,P)),a=this._clippedTrianglesTyped),this.clippedTrianglesLength=it;let et=a;U--;for(let st=1;st<U;st++,P+=3)et[P]=i,et[P+1]=i+st,et[P+2]=i+st+1;i+=U+1}else{let H=P+3*o;l.length<H&&(this._clippedVerticesTyped=new Float32Array(H*2),this._clippedVerticesTyped.set(l.subarray(0,P)),l=this._clippedVerticesTyped),l[P]=x,l[P+1]=y,l[P+o]=I,l[P+o+1]=M,l[P+o*2]=C,l[P+o*2+1]=T;let U=this.clippedUVsLength+3*2;c.length<U&&(this._clippedUVsTyped=new Float32Array(U*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);let z=this.clippedUVsLength;c[z]=k,c[z+1]=S,c[z+2]=v,c[z+3]=E,c[z+4]=F,c[z+5]=D,this.clippedVerticesLength=H,this.clippedUVsLength=U,P=this.clippedTrianglesLength,H=P+3,a.length<H&&(this._clippedTrianglesTyped=new Uint16Array(H*2),this._clippedTrianglesTyped.set(a.subarray(0,P)),a=this._clippedTrianglesTyped);let O=a;O[P]=i,O[P+1]=i+1,O[P+2]=i+2,i+=3,this.clippedTrianglesLength=H;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),p!==null}clip(t,e,n,r,s,o,l){let c=this.clipOutput,a=!1,i,h;l.length%4>=2?(i=this.clipOutput,h=this.scratch):(i=this.scratch,h=this.clipOutput);let d=l;i.length=8;let u=i;u[0]=t,u[1]=e,u[2]=n,u[3]=r,u[4]=s,u[5]=o,u[6]=t,u[7]=e,h.length=0;let p=l.length-4;for(let f=0;;f+=2){let g=d[f],b=d[f+1],x=g-d[f+2],y=b-d[f+3],w=h.length,k=i;t=k[0],e=k[1];let S=y*(g-t)-x*(b-e);for(let M=2,v=i.length-2;M<=v;M+=2){n=k[M],r=k[M+1];let E=y*(g-n)-x*(b-r);if(S>0)if(E>0)h.push(n,r);else{let C=n-t,T=r-e,F=S/(C*y-T*x);F>=0&&F<=1?(h.push(t+C*F,e+T*F),a=!0):h.push(n,r)}else if(E>0){let C=n-t,T=r-e,F=S/(C*y-T*x);F>=0&&F<=1?(h.push(t+C*F,e+T*F,n,r),a=!0):h.push(n,r)}else a=!0;t=n,e=r,S=E}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),f===p)break;let I=h;h=i,h.length=0,i=I}if(c!==h){c.length=0;for(let f=0,g=h.length-2;f<g;f++)c[f]=h[f]}else c.length=c.length-2;return a}clipInverse(t,e,n,r,s,o,l){this.inverseVertices.length=0;let c=l.length-4,a,i;l.length%4>=2?(a=this.clipOutput,i=this.scratch):(a=this.scratch,i=this.clipOutput),a.length=8;let h=l,d=a;d[0]=t,d[1]=e,d[2]=n,d[3]=r,d[4]=s,d[5]=o,d[6]=t,d[7]=e,i.length=0;for(let u=0;;u+=2){let p=h[u],f=h[u+1],g=p-h[u+2],b=f-h[u+3],x=i.length,y=this.inverseVertices.length;this.inverseVertices.push(0),d=a,t=d[0],e=d[1];let w=b*(p-t)-g*(f-e);for(let I=2,M=a.length-2;I<=M;I+=2){n=d[I],r=d[I+1];let v=b*(p-n)-g*(f-r);if(w>0)if(v>0)i.push(n,r);else{let E=n-t,C=r-e,T=w/(E*b-C*g);if(T>=0&&T<=1){let F=t+E*T,D=e+C*T;i.push(F,D),this.inverseVertices.push(F,D,n,r)}else i.push(n,r)}else if(v>0){let E=n-t,C=r-e,T=w/(E*b-C*g);if(T>=0&&T<=1){let F=t+E*T,D=e+C*T;this.inverseVertices.push(F,D),i.push(F,D,n,r)}else i.push(n,r)}else this.inverseVertices.push(n,r);t=n,e=r,w=v}let k=this.inverseVertices.length-y-1;if(k>=6?this.inverseVertices[y]=k:this.inverseVertices.length=y,x===i.length||(i.push(i[0],i[1]),u===c))break;let S=i;i=a,i.length=0,a=S}}makeClockwise(t){let e=t,n=t.length,r=!0,s=!0,o=0,l=e[n-2],c=e[n-1],a=e[0],i=e[1];for(let d=2;d<n;d+=2){let u=e[d],p=e[d+1];o+=a*p-u*i;let f=(a-l)*(p-i)-(i-c)*(u-a);s=s&&f<=0,r=r&&f>=0,l=a,c=i,a=u,i=p}o+=a*e[1]-e[0]*i;let h=(a-l)*(e[1]-i)-(i-c)*(e[0]-a);if(s=s&&h<=0,r=r&&h>=0,o>=0){for(let d=0,u=n-2,p=n>>1;d<p;d+=2){let f=e[d],g=e[d+1],b=u-d;e[d]=e[b],e[d+1]=e[b+1],e[b]=f,e[b+1]=g}return r}return s}makeConvex(t){let e=t.length,n=t;this.clipOutput.length=e;let r=this.clipOutput;r[0]=n[0],r[1]=n[1];for(let l=2;l<e;l+=2){let c=n[l],a=n[l+1],i=l-2;for(;i>=0&&(r[i]>c||r[i]===c&&r[i+1]>a);i-=2)r[i+2]=r[i],r[i+3]=r[i+1];r[i+2]=c,r[i+3]=a}n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3];let s=4;for(let l=4;l<e;l+=2,s+=2){let c=r[l],a=r[l+1];for(;(n[s-2]-n[s-4])*(a-n[s-3])-(n[s-1]-n[s-3])*(c-n[s-4])>=0&&(s-=2,s!==2););n[s]=c,n[s+1]=a}n[s]=r[e-4],n[s+1]=r[e-3];let o=s;s+=2;for(let l=e-6;l>=0;l-=2,s+=2){let c=r[l],a=r[l+1];for(;(n[s-2]-n[s-4])*(a-n[s-3])-(n[s-1]-n[s-3])*(c-n[s-4])>=0&&(s-=2,s!==o););n[s]=c,n[s+1]=a}t.length=s-2}};var oc=class{constructor(t){m(this,"attachmentLoader");m(this,"scale",1);m(this,"linkedMeshes",[]);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Pr,r=typeof t=="string"?JSON.parse(t):t,s=r.skeleton;if(s&&(n.hash=s.hash,n.version=s.spine,n.x=s.x,n.y=s.y,n.width=s.width,n.height=s.height,n.referenceScale=W(s,"referenceScale",100)*e,n.fps=s.fps,n.imagesPath=s.images??null,n.audioPath=s.audio??null),r.bones)for(let o=0;o<r.bones.length;o++){let l=r.bones[o],c=null,a=W(l,"parent",null);a&&(c=n.findBone(a));let i=new ri(n.bones.length,l.name,c);i.length=W(l,"length",0)*e;let h=i.setupPose;h.x=W(l,"x",0)*e,h.y=W(l,"y",0)*e,h.rotation=W(l,"rotation",0),h.scaleX=W(l,"scaleX",1),h.scaleY=W(l,"scaleY",1),h.shearX=W(l,"shearX",0),h.shearY=W(l,"shearY",0),h.inherit=J.enumValue(Ut,W(l,"inherit","Normal")),i.skinRequired=W(l,"skin",!1);let d=W(l,"color",null);d&&i.color.setFromString(d),i.icon=W(l,"icon",void 0),i.iconSize=W(l,"iconSize",1),i.iconRotation=W(l,"iconRotation",0),n.bones.push(i)}if(r.slots)for(let o=0;o<r.slots.length;o++){let l=r.slots[o],c=l.name,a=n.findBone(l.bone);if(!a)throw new Error(`Couldn't find bone ${l.bone} for slot ${c}`);let i=new hi(n.slots.length,c,a),h=W(l,"color",null);h&&i.setupPose.color.setFromString(h);let d=W(l,"dark",null);d&&(i.setupPose.darkColor=_.fromString(d)),i.attachmentName=W(l,"attachment",null),i.blendMode=J.enumValue(tn,W(l,"blend","normal")),i.visible=W(l,"visible",!0),n.slots.push(i)}if(r.constraints)for(let o of r.constraints){let l=o.name,c=W(o,"skin",!1);switch(W(o,"type",!1)){case"ik":{let a=new Dr(l);a.skinRequired=c;for(let p=0;p<o.bones.length;p++){let f=n.findBone(o.bones[p]);if(!f)throw new Error(`Couldn't find bone ${o.bones[p]} for IK constraint ${l}.`);a.bones.push(f)}let i=o.target,h=n.findBone(i);if(!h)throw new Error(`Couldn't find target bone ${i} for IK constraint ${l}.`);a.target=h;let d=W(o,"scaleY",null);d!=null&&(a.scaleYMode=J.enumValue(ie,d));let u=a.setupPose;u.mix=W(o,"mix",1),u.softness=W(o,"softness",0)*e,u.bendDirection=W(o,"bendPositive",!0)?1:-1,u.compress=W(o,"compress",!1),u.stretch=W(o,"stretch",!1),n.constraints.push(a);break}case"transform":{let a=new gt(l);a.skinRequired=c;for(let w=0;w<o.bones.length;w++){let k=o.bones[w],S=n.findBone(k);if(!S)throw new Error(`Couldn't find bone ${k} for transform constraint ${o.name}.`);a.bones.push(S)}let i=o.source,h=n.findBone(i);if(!h)throw new Error(`Couldn't find source bone ${i} for transform constraint ${o.name}.`);a.source=h,a.localSource=W(o,"localSource",!1),a.localTarget=W(o,"localTarget",!1),a.additive=W(o,"additive",!1),a.clamp=W(o,"clamp",!1);let d=!1,u=!1,p=!1,f=!1,g=!1,b=!1,x=Object.entries(W(o,"properties",{}));for(let[w,k]of x){let S=this.fromProperty(w),I=this.propertyScale(w,e);S.offset=W(k,"offset",0)*I;let M=Object.entries(W(k,"to",{}));for(let[v,E]of M){let C=1,T;switch(v){case"rotate":{d=!0,T=new mi;break}case"x":{u=!0,T=new di,C=e;break}case"y":{p=!0,T=new ui,C=e;break}case"scaleX":{f=!0,T=new fi;break}case"scaleY":{g=!0,T=new pi;break}case"shearY":{b=!0,T=new gi;break}default:throw new Error(`Invalid transform constraint to property: ${v}`)}T.offset=W(E,"offset",0)*C,T.max=W(E,"max",1)*C,T.scale=W(E,"scale",1)*C/I,S.to.push(T)}S.to.length>0&&a.properties.push(S)}a.offsets[gt.ROTATION]=W(o,"rotation",0),a.offsets[gt.X]=W(o,"x",0)*e,a.offsets[gt.Y]=W(o,"y",0)*e,a.offsets[gt.SCALEX]=W(o,"scaleX",0),a.offsets[gt.SCALEY]=W(o,"scaleY",0),a.offsets[gt.SHEARY]=W(o,"shearY",0);let y=a.setupPose;d&&(y.mixRotate=W(o,"mixRotate",1)),u&&(y.mixX=W(o,"mixX",1)),p&&(y.mixY=W(o,"mixY",y.mixX)),f&&(y.mixScaleX=W(o,"mixScaleX",1)),g&&(y.mixScaleY=W(o,"mixScaleY",y.mixScaleX)),b&&(y.mixShearY=W(o,"mixShearY",1)),n.constraints.push(a);break}case"path":{let a=new Vr(l);a.skinRequired=c;for(let u=0;u<o.bones.length;u++){let p=o.bones[u],f=n.findBone(p);if(!f)throw new Error(`Couldn't find bone ${p} for path constraint ${o.name}.`);a.bones.push(f)}let i=o.slot,h=n.findSlot(i);if(!h)throw new Error(`Couldn't find slot ${i} for path constraint ${o.name}.`);a.slot=h,a.positionMode=J.enumValue(Le,W(o,"positionMode","Percent")),a.spacingMode=J.enumValue(te,W(o,"spacingMode","Length")),a.rotateMode=J.enumValue(_n,W(o,"rotateMode","Tangent")),a.offsetRotation=W(o,"rotation",0);let d=a.setupPose;d.position=W(o,"position",0),a.positionMode===Le.Fixed&&(d.position*=e),d.spacing=W(o,"spacing",0),(a.spacingMode===te.Length||a.spacingMode===te.Fixed)&&(d.spacing*=e),d.mixRotate=W(o,"mixRotate",1),d.mixX=W(o,"mixX",1),d.mixY=W(o,"mixY",d.mixX),n.constraints.push(a);break}case"physics":{let a=new Rr(l);a.skinRequired=c;let i=o.bone,h=n.findBone(i);if(h==null)throw new Error(`Physics bone not found: ${i}`);a.bone=h,a.x=W(o,"x",0),a.y=W(o,"y",0),a.rotate=W(o,"rotate",0),a.scaleX=W(o,"scaleX",0);let d=W(o,"scaleY",null);d!=null&&(a.scaleYMode=J.enumValue(ie,d)),a.shearX=W(o,"shearX",0),a.limit=W(o,"limit",5e3)*e,a.step=1/W(o,"fps",60);let u=a.setupPose;u.inertia=W(o,"inertia",.5),u.strength=W(o,"strength",100),u.damping=W(o,"damping",.85),u.massInverse=1/W(o,"mass",1),u.wind=W(o,"wind",0),u.gravity=W(o,"gravity",0),u.mix=W(o,"mix",1),a.inertiaGlobal=W(o,"inertiaGlobal",!1),a.strengthGlobal=W(o,"strengthGlobal",!1),a.dampingGlobal=W(o,"dampingGlobal",!1),a.massGlobal=W(o,"massGlobal",!1),a.windGlobal=W(o,"windGlobal",!1),a.gravityGlobal=W(o,"gravityGlobal",!1),a.mixGlobal=W(o,"mixGlobal",!1),n.constraints.push(a);break}case"slider":{let a=new _e(l);a.skinRequired=c,a.additive=W(o,"additive",!1),a.loop=W(o,"loop",!1),a.setupPose.mix=W(o,"mix",1);let i=o.bone;if(i){if(a.bone=n.findBone(i),!a.bone)throw new Error(`Slider bone not found: ${i}`);let h=o.property;a.property=this.fromProperty(h);let d=this.propertyScale(h,e);a.property.offset=W(o,"from",0)*d,a.offset=W(o,"to",0),a.scale=W(o,"scale",1)/d,a.max=W(o,"max",0),a.local=W(o,"local",!1)}else a.setupPose.time=W(o,"time",0);n.constraints.push(a);break}}}if(r.skins)for(let o=0;o<r.skins.length;o++){let l=r.skins[o],c=new er(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let i=l.bones[a],h=n.findBone(i);if(!h)throw new Error(`Couldn't find bone ${i} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let a=0;a<l.ik.length;a++){let i=l.ik[a],h=n.findConstraint(i,Dr);if(!h)throw new Error(`Couldn't find IK constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let a=0;a<l.transform.length;a++){let i=l.transform[a],h=n.findConstraint(i,gt);if(!h)throw new Error(`Couldn't find transform constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let a=0;a<l.path.length;a++){let i=l.path[a],h=n.findConstraint(i,Vr);if(!h)throw new Error(`Couldn't find path constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.physics)for(let a=0;a<l.physics.length;a++){let i=l.physics[a],h=n.findConstraint(i,Rr);if(!h)throw new Error(`Couldn't find physics constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}if(l.slider)for(let a=0;a<l.slider.length;a++){let i=l.slider[a],h=n.findConstraint(i,_e);if(!h)throw new Error(`Couldn't find slider constraint ${i} for skin ${l.name}.`);c.constraints.push(h)}for(let a in l.attachments){let i=n.findSlot(a);if(!i)throw new Error(`Couldn't find skin slot ${a} for skin ${l.name}.`);let h=l.attachments[a];for(let d in h){let u=this.readAttachment(h[d],c,i.index,d,n);u&&c.setAttachment(i.index,d,u)}}n.skins.push(c),c.name==="default"&&(n.defaultSkin=c)}for(let o=0,l=this.linkedMeshes.length;o<l;o++){let c=this.linkedMeshes[o],a=c.skin?n.findSkin(c.skin):n.defaultSkin;if(!a)throw new Error(`Skin not found: ${c.skin}`);let i=a.getAttachment(c.sourceIndex,c.source);if(!i)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?i:c.mesh,c.mesh.setSourceMesh(i),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){let h=i.timelineSlots;for(let u of h)if(u===c.slotIndex)break t;let d=[...h];d[h.length]=c.slotIndex,i.timelineSlots=d}}if(this.linkedMeshes.length=0,r.events)for(let o in r.events){let l=r.events[o],c=new oi(o),a=c.setupPose;a.intValue=W(l,"int",0),a.floatValue=W(l,"float",0),a.stringValue=W(l,"string",""),c._audioPath=W(l,"audio",null),c.audioPath&&(a.volume=W(l,"volume",a.volume),a.balance=W(l,"balance",a.balance)),n.events.push(c)}if(r.animations)for(let o in r.animations){let l=r.animations[o];this.readAnimation(l,o,n)}if(r.constraints)for(let o in r.constraints){let l=r.constraints[o];if(l.type==="slider"){let c=n.findConstraint(l.name,_e),a=l.animation,i=n.findAnimation(a);if(!i)throw new Error(`Slider animation not found: ${a}`);c.animation=i}}return n}fromProperty(t){let e;switch(t){case"rotate":e=new us;break;case"x":e=new fs;break;case"y":e=new ps;break;case"scaleX":e=new gs;break;case"scaleY":e=new bs;break;case"shearY":e=new xs;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,n,r,s){let o=this.scale,l=W(t,"name",r);switch(W(t,"type","region")){case"region":{let c=W(t,"path",l),a=this.readSequence(W(t,"sequence",null)),i=this.attachmentLoader.newRegionAttachment(e,r,l,c,a);if(!i)return null;i.path=c,i.x=W(t,"x",0)*o,i.y=W(t,"y",0)*o,i.scaleX=W(t,"scaleX",1),i.scaleY=W(t,"scaleY",1),i.rotation=W(t,"rotation",0),i.width=t.width*o,i.height=t.height*o;let h=W(t,"color",null);return h&&i.color.setFromString(h),i.updateSequence(),i}case"boundingbox":{let c=this.attachmentLoader.newBoundingBoxAttachment(e,r,l);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);let a=W(t,"color",null);return a&&c.color.setFromString(a),c}case"mesh":case"linkedmesh":{let c=W(t,"path",l),a=this.readSequence(W(t,"sequence",null)),i=this.attachmentLoader.newMeshAttachment(e,r,l,c,a);if(!i)return null;i.path=c;let h=W(t,"color",null);h&&i.color.setFromString(h),i.width=W(t,"width",0)*o,i.height=W(t,"height",0)*o;let d=W(t,"source",null);if(d){let p=n,f=W(t,"slot",null);if(f){let g=s.findSlot(f);if(!g)throw new Error(`Source mesh slot not found: ${f}`);p=g.index}return this.linkedMeshes.push(new Cm(i,W(t,"skin",null),n,p,d,W(t,"timelines",!0))),i}let u=t.uvs;return this.readVertices(t,i,u.length),i.triangles=t.triangles,i.regionUVs=u,i.edges=W(t,"edges",null),i.hullLength=W(t,"hull",0)*2,i.updateSequence(),i}case"path":{let c=this.attachmentLoader.newPathAttachment(e,r,l);if(!c)return null;c.closed=W(t,"closed",!1),c.constantSpeed=W(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,c,a<<1);let i=J.newArray(a/3,0);for(let d=0;d<t.lengths.length;d++)i[d]=t.lengths[d]*o;c.lengths=i;let h=W(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{let c=this.attachmentLoader.newPointAttachment(e,r,l);if(!c)return null;c.x=W(t,"x",0)*o,c.y=W(t,"y",0)*o,c.rotation=W(t,"rotation",0);let a=W(t,"color",null);return a&&c.color.setFromString(a),c}case"clipping":{let c=this.attachmentLoader.newClippingAttachment(e,r,l);if(!c)return null;let a=W(t,"end",null);a&&(c.endSlot=s.findSlot(a)),c.convex=W(t,"convex",!1),c.inverse=W(t,"inverse",!1);let i=t.vertexCount;this.readVertices(t,c,i<<1);let h=W(t,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(t){if(t==null)return new Cr(1,!1);let e=new Cr(W(t,"count",0),!0);return e.start=W(t,"start",1),e.digits=W(t,"digits",0),e.setupIndex=W(t,"setup",0),e}readVertices(t,e,n){let r=this.scale;e.worldVerticesLength=n;let s=t.vertices;if(n===s.length){let c=J.toFloatArray(s);if(r!==1)for(let a=0,i=s.length;a<i;a++)c[a]*=r;e.vertices=c;return}let o=[],l=[];for(let c=0,a=s.length;c<a;){let i=s[c++];l.push(i);for(let h=c+i*4;c<h;c+=4)l.push(s[c]),o.push(s[c+1]*r),o.push(s[c+2]*r),o.push(s[c+3])}e.bones=l,e.vertices=J.toFloatArray(o)}readAnimation(t,e,n){let r=this.scale,s=[];if(t.slots)for(let a in t.slots){let i=t.slots[a],h=n.findSlot(a);if(!h)throw new Error(`Slot not found: ${a}`);let d=h.index;for(let u in i){let p=i[u];if(!p)continue;let f=p.length;switch(u){case"attachment":{let g=new Dn(f,d);for(let b=0;b<f;b++){let x=p[b];g.setFrame(b,W(x,"time",0),W(x,"name",null))}s.push(g);break}case"rgba":{let g=new Ra(f,f<<2,d),b=p[0],x=W(b,"time",0),y=_.fromString(b.color);for(let w=0,k=0;;w++){g.setFrame(w,x,y.r,y.g,y.b,y.a);let S=p[w+1];if(!S){g.shrink(k);break}let I=W(S,"time",0),M=_.fromString(S.color),v=b.curve;v&&(k=kt(v,g,k,w,0,x,I,y.r,M.r,1),k=kt(v,g,k,w,1,x,I,y.g,M.g,1),k=kt(v,g,k,w,2,x,I,y.b,M.b,1),k=kt(v,g,k,w,3,x,I,y.a,M.a,1)),x=I,y=M,b=S}s.push(g);break}case"rgb":{let g=new Pa(f,f*3,d),b=p[0],x=W(b,"time",0),y=_.fromString(b.color);for(let w=0,k=0;;w++){g.setFrame(w,x,y.r,y.g,y.b);let S=p[w+1];if(!S){g.shrink(k);break}let I=W(S,"time",0),M=_.fromString(S.color),v=b.curve;v&&(k=kt(v,g,k,w,0,x,I,y.r,M.r,1),k=kt(v,g,k,w,1,x,I,y.g,M.g,1),k=kt(v,g,k,w,2,x,I,y.b,M.b,1)),x=I,y=M,b=S}s.push(g);break}case"alpha":{en(s,p,new Ya(f,f,d),0,1);break}case"rgba2":{let g=new Xa(f,f*7,d),b=p[0],x=W(b,"time",0),y=_.fromString(b.light),w=_.fromString(b.dark);for(let k=0,S=0;;k++){g.setFrame(k,x,y.r,y.g,y.b,y.a,w.r,w.g,w.b);let I=p[k+1];if(!I){g.shrink(S);break}let M=W(I,"time",0),v=_.fromString(I.light),E=_.fromString(I.dark),C=b.curve;C&&(S=kt(C,g,S,k,0,x,M,y.r,v.r,1),S=kt(C,g,S,k,1,x,M,y.g,v.g,1),S=kt(C,g,S,k,2,x,M,y.b,v.b,1),S=kt(C,g,S,k,3,x,M,y.a,v.a,1),S=kt(C,g,S,k,4,x,M,w.r,E.r,1),S=kt(C,g,S,k,5,x,M,w.g,E.g,1),S=kt(C,g,S,k,6,x,M,w.b,E.b,1)),x=M,y=v,w=E,b=I}s.push(g);break}case"rgb2":{let g=new La(f,f*6,d),b=p[0],x=W(b,"time",0),y=_.fromString(b.light),w=_.fromString(b.dark);for(let k=0,S=0;;k++){g.setFrame(k,x,y.r,y.g,y.b,w.r,w.g,w.b);let I=p[k+1];if(!I){g.shrink(S);break}let M=W(I,"time",0),v=_.fromString(I.light),E=_.fromString(I.dark),C=b.curve;C&&(S=kt(C,g,S,k,0,x,M,y.r,v.r,1),S=kt(C,g,S,k,1,x,M,y.g,v.g,1),S=kt(C,g,S,k,2,x,M,y.b,v.b,1),S=kt(C,g,S,k,3,x,M,w.r,E.r,1),S=kt(C,g,S,k,4,x,M,w.g,E.g,1),S=kt(C,g,S,k,5,x,M,w.b,E.b,1)),x=M,y=v,w=E,b=I}s.push(g);break}default:throw new Error(`Invalid timeline type for a slot: ${p.name} (${i.name})`)}}}if(t.bones)for(let a in t.bones){let i=t.bones[a],h=n.findBone(a);if(!h)throw new Error(`Bone not found: ${a}`);let d=h.index;for(let u in i){let p=i[u],f=p.length;if(f!==0)switch(u){case"rotate":en(s,p,new Jn(f,f,d),0,1);break;case"translate":vm(s,p,new ka(f,f<<1,d),"x","y",0,r);break;case"translatex":en(s,p,new Ia(f,f,d),0,r);break;case"translatey":en(s,p,new Ma(f,f,d),0,r);break;case"scale":vm(s,p,new va(f,f<<1,d),"x","y",1,1);break;case"scalex":en(s,p,new Ca(f,f,d),1,1);break;case"scaley":en(s,p,new Ea(f,f,d),1,1);break;case"shear":vm(s,p,new Ta(f,f<<1,d),"x","y",0,1);break;case"shearx":en(s,p,new Ba(f,f,d),0,1);break;case"sheary":en(s,p,new Fa(f,f,d),0,1);break;case"inherit":{let g=new Da(f,h.index);for(let b=0;b<p.length;b++){let x=p[b];g.setFrame(b,W(x,"time",0),J.enumValue(Ut,W(x,"inherit","Normal")))}s.push(g);break}default:throw new Error(`Invalid timeline type for a bone: ${p.name} (${i.name})`)}}}if(t.ik)for(let a in t.ik){let i=t.ik[a],h=i[0];if(!h)continue;let d=n.findConstraint(a,Dr);if(!d)throw new Error(`IK Constraint not found: ${a}`);let u=new Ua(i.length,i.length<<1,n.constraints.indexOf(d)),p=W(h,"time",0),f=W(h,"mix",1),g=W(h,"softness",0)*r;for(let b=0,x=0;;b++){u.setFrame(b,p,f,g,W(h,"bendPositive",!0)?1:-1,W(h,"compress",!1),W(h,"stretch",!1));let y=i[b+1];if(!y){u.shrink(x);break}let w=W(y,"time",0),k=W(y,"mix",1),S=W(y,"softness",0)*r,I=h.curve;I&&(x=kt(I,u,x,b,0,p,w,f,k,1),x=kt(I,u,x,b,1,p,w,g,S,r)),p=w,f=k,g=S,h=y}s.push(u)}if(t.transform)for(let a in t.transform){let i=t.transform[a],h=i[0];if(!h)continue;let d=n.findConstraint(a,gt);if(!d)throw new Error(`Transform constraint not found: ${a}`);let u=new Wa(i.length,i.length*6,n.constraints.indexOf(d)),p=W(h,"time",0),f=W(h,"mixRotate",1),g=W(h,"mixX",1),b=W(h,"mixY",g),x=W(h,"mixScaleX",1),y=W(h,"mixScaleY",1),w=W(h,"mixShearY",1);for(let k=0,S=0;;k++){u.setFrame(k,p,f,g,b,x,y,w);let I=i[k+1];if(!I){u.shrink(S);break}let M=W(I,"time",0),v=W(I,"mixRotate",1),E=W(I,"mixX",1),C=W(I,"mixY",E),T=W(I,"mixScaleX",1),F=W(I,"mixScaleY",1),D=W(I,"mixShearY",1),V=h.curve;V&&(S=kt(V,u,S,k,0,p,M,f,v,1),S=kt(V,u,S,k,1,p,M,g,E,1),S=kt(V,u,S,k,2,p,M,b,C,1),S=kt(V,u,S,k,3,p,M,x,T,1),S=kt(V,u,S,k,4,p,M,y,F,1),S=kt(V,u,S,k,5,p,M,w,D,1)),p=M,f=v,g=E,b=C,x=T,y=F,w=D,h=I}s.push(u)}if(t.path)for(let a in t.path){let i=t.path[a],h=n.findConstraint(a,Vr);if(!h)throw new Error(`Path constraint not found: ${a}`);let d=n.constraints.indexOf(h);for(let u in i){let p=i[u],f=p[0];if(!f)continue;let g=p.length;switch(u){case"position":{let b=new qa(g,g,d);en(s,p,b,0,h.positionMode===Le.Fixed?r:1);break}case"spacing":{let b=new $a(g,g,d);en(s,p,b,0,h.spacingMode===te.Length||h.spacingMode===te.Fixed?r:1);break}case"mix":{let b=new za(g,g*3,d),x=W(f,"time",0),y=W(f,"mixRotate",1),w=W(f,"mixX",1),k=W(f,"mixY",w);for(let S=0,I=0;;S++){b.setFrame(S,x,y,w,k);let M=p[S+1];if(!M){b.shrink(I);break}let v=W(M,"time",0),E=W(M,"mixRotate",1),C=W(M,"mixX",1),T=W(M,"mixY",C),F=f.curve;F&&(I=kt(F,b,I,S,0,x,v,y,E,1),I=kt(F,b,I,S,1,x,v,w,C,1),I=kt(F,b,I,S,2,x,v,k,T,1)),x=v,y=E,w=C,k=T,f=M}s.push(b);break}}}}if(t.physics)for(let a in t.physics){let i=t.physics[a],h=-1;if(a.length>0){let d=n.findConstraint(a,Rr);if(!d)throw new Error(`Physics constraint not found: ${a}`);h=n.constraints.indexOf(d)}for(let d in i){let u=i[d],p=u[0];if(!p)continue;let f=u.length,g,b=0;if(d==="reset"){let x=new _a(f,h);for(let y=0;p!=null;p=u[y+1],y++)x.setFrame(y,W(p,"time",0));s.push(x);continue}switch(d){case"inertia":g=new Ha(f,f,h);break;case"strength":g=new Ga(f,f,h);break;case"damping":g=new ja(f,f,h);break;case"mass":g=new Za(f,f,h);break;case"wind":g=new Ka(f,f,h);break;case"gravity":g=new Ja(f,f,h);break;case"mix":{b=1,g=new Qa(f,f,h);break}default:continue}en(s,u,g,b,1)}}if(t.slider)for(let a in t.slider){let i=t.slider[a],h=n.findConstraint(a,_e);if(!h)throw new Error(`Slider not found: ${a}`);let d=n.constraints.indexOf(h);for(let u in i){let p=i[u];if(!p[0])continue;let g=p.length;switch(u){case"time":en(s,p,new ti(g,g,d),1,1);break;case"mix":en(s,p,new ei(g,g,d),1,1);break}}}if(t.attachments)for(let a in t.attachments){let i=t.attachments[a],h=n.findSkin(a);if(!h)throw new Error(`Skin not found: ${a}`);for(let d in i){let u=i[d],p=n.findSlot(d);if(!p)throw new Error(`Attachment slot not found: ${d}`);let f=p.index;for(let g in u){let b=u[g],x=h.getAttachment(f,g);if(!x)throw new Error(`Timeline attachment not found: ${g}`);for(let y in b){let w=b[y],k=w[0];if(k){if(y==="deform"){let S=x.bones,I=x.vertices,M=S?I.length/3*2:I.length,v=new Na(w.length,w.length,f,x),E=W(k,"time",0);for(let C=0,T=0;;C++){let F,D=W(k,"vertices",null);if(!D)F=S?J.newFloatArray(M):I;else{F=J.newFloatArray(M);let q=W(k,"offset",0);if(J.arrayCopy(D,0,F,q,D.length),r!==1)for(let L=q,R=L+D.length;L<R;L++)F[L]*=r;if(!S)for(let L=0;L<M;L++)F[L]+=I[L]}v.setFrame(C,E,F);let V=w[C+1];if(!V){v.shrink(T);break}let X=W(V,"time",0),N=k.curve;N&&(T=kt(N,v,T,C,0,E,X,0,1,1)),E=X,k=V}s.push(v)}else if(y==="sequence"){let S=new Oa(w.length,f,x),I=0;for(let M=0;M<w.length;M++){let v=W(k,"delay",I),E=W(k,"time",0),C=de[W(k,"mode","hold")],T=W(k,"index",0);S.setFrame(M,E,C,T,v),I=v,k=w[M+1]}s.push(S)}}}}}}if(t.drawOrder){let a=new Ke(t.drawOrder.length),i=n.slots.length,h=0;for(let d of t.drawOrder)a.setFrame(h++,W(d,"time",0),Ad(n,d,i,null));s.push(a)}if(t.drawOrderFolder)for(let a of t.drawOrderFolder){let i=W(a,"slots",[]),h=new Array(i.length),d=0;for(let g of i){let b=n.findSlot(g);if(!b)throw new Error(`Draw order folder slot not found: ${g}`);h[d++]=b.index}let u=W(a,"keys",[]),p=new Vn(u.length,h,n.slots.length),f=0;for(let g of u)p.setFrame(f++,W(g,"time",0),Ad(n,g,h.length,h));s.push(p)}if(t.events){let a=new Tr(t.events.length),i=0;for(let h=0;h<t.events.length;h++,i++){let d=t.events[h],u=n.findEvent(d.name);if(!u)throw new Error(`Event not found: ${d.name}`);let p=u.setupPose,f=new Fr(J.toSinglePrecision(W(d,"time",0)),u);f.intValue=W(d,"int",p.intValue),f.floatValue=W(d,"float",p.floatValue),f.stringValue=W(d,"string",p.stringValue),f.data.audioPath&&(f.volume=W(d,"volume",p.volume),f.balance=W(d,"balance",p.volume)),a.setFrame(i,f)}s.push(a)}let o=0;for(let a=0,i=s.length;a<i;a++)o=Math.max(o,s[a].getDuration());let l=new Er(e,s,o),c=W(t,"color",null);c!==null&&l.color.setFromString(c),n.animations.push(l)}},Cm=class{constructor(t,e,n,r,s,o){m(this,"source");m(this,"skin");m(this,"slotIndex");m(this,"sourceIndex");m(this,"mesh");m(this,"inheritTimelines");this.mesh=t,this.skin=e,this.slotIndex=n,this.sourceIndex=r,this.source=s,this.inheritTimelines=o}};function en(A,t,e,n,r){let s=t[0],o=s.time??0,l=(s.value??n)*r,c=0;for(let a=0;;a++){e.setFrame(a,o,l);let i=t[a+1];if(!i){e.shrink(c),A.push(e);return}let h=i.time??0,d=(i.value??n)*r;s.curve&&(c=kt(s.curve,e,c,a,0,o,h,l,d,r)),o=h,l=d,s=i}}function vm(A,t,e,n,r,s,o){let l=t[0],c=l.time??0,a=(l[n]??s)*o,i=(l[r]??s)*o,h=0;for(let d=0;;d++){e.setFrame(d,c,a,i);let u=t[d+1];if(!u){e.shrink(h),A.push(e);return}let p=u.time??0,f=(u[n]??s)*o,g=(u[r]??s)*o,b=l.curve;b&&(h=kt(b,e,h,d,0,c,p,a,f,o),h=kt(b,e,h,d,1,c,p,i,g,o)),c=p,a=f,i=g,l=u}}function Ad(A,t,e,n){let r=t.offsets;if(!r)return null;let s=new Array(e).fill(-1),o=new Array(e-r.length),l=0,c=0;for(let a of r){let i=A.findSlot(a.slot);if(i==null)throw new Error(`Draw order slot not found: ${a.slot}`);let h=0;if(!n)h=i.index;else{h=-1;for(let d=0;d<e;d++)if(n[d]===i.index){h=d;break}if(h===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;l!==h;)o[c++]=l++;s[l+a.offset]=l++}for(;l<e;)o[c++]=l++;for(let a=e-1;a>=0;a--)s[a]===-1&&(s[a]=o[--c]);return s}function kt(A,t,e,n,r,s,o,l,c,a){if(A==="stepped")return t.setStepped(n),e;let i=r<<2,h=A[i],d=A[i+1]*a,u=A[i+2],p=A[i+3]*a;return t.setBezier(e,n,r,s,l,h,d,u,p,o,c),e+1}function W(A,t,e){return A[t]!==void 0?A[t]:e}var lc=class{constructor(t,e,n={}){m(this,"skeleton");m(this,"adapter");m(this,"positionInheritanceFactorX",0);m(this,"positionInheritanceFactorY",0);m(this,"rotationInheritanceFactor",0);m(this,"hasLastTransform",!1);m(this,"lastX",0);m(this,"lastY",0);m(this,"lastZ",0);m(this,"lastRotation",0);m(this,"currentTransform",{x:0,y:0,z:0,rotation:0});m(this,"currentPosition",{x:0,y:0,z:0});m(this,"lastPosition",{x:0,y:0,z:0});this.skeleton=t,this.adapter=e,this.positionInheritanceFactorX=n.positionInheritanceX??0,this.positionInheritanceFactorY=n.positionInheritanceY??0,this.rotationInheritanceFactor=n.rotationInheritance??0}get positionInheritanceX(){return this.positionInheritanceFactorX}get positionInheritanceY(){return this.positionInheritanceFactorY}setPositionInheritance(t,e){let n=this.positionInheritanceFactorX===0&&this.positionInheritanceFactorY===0,r=t!==0||e!==0;this.positionInheritanceFactorX=t,this.positionInheritanceFactorY=e,n&&r&&this.resetPosition()}get rotationInheritance(){return this.rotationInheritanceFactor}set rotationInheritance(t){let e=this.rotationInheritanceFactor===0;this.rotationInheritanceFactor=t,e&&t!==0&&this.resetRotation()}resetPosition(){let t=this.currentTransform,e=!this.hasLastTransform&&this.rotationInheritanceFactor!==0;this.adapter.readTransform(t,e),this.lastX=t.x,this.lastY=t.y,this.lastZ=t.z,e&&(this.lastRotation=t.rotation),this.hasLastTransform=!0}resetRotation(){let t=this.currentTransform;this.adapter.readTransform(t,!0),this.lastRotation=t.rotation,this.hasLastTransform||(this.lastX=t.x,this.lastY=t.y,this.lastZ=t.z),this.hasLastTransform=!0}resetTransform(){let t=this.currentTransform;this.adapter.readTransform(t,!0),this.setLastTransform(t.x,t.y,t.z,t.rotation)}applyTransformMovement(){let t=this.positionInheritanceFactorX!==0||this.positionInheritanceFactorY!==0,e=this.rotationInheritanceFactor!==0;if(!t&&!e)return;let n=this.currentTransform;this.adapter.readTransform(n,e);let{x:r,y:s,z:o}=n,l=e?n.rotation:this.lastRotation,c=r!==this.lastX||s!==this.lastY||o!==this.lastZ;if(this.hasLastTransform){if(!c&&l===this.lastRotation)return;t&&c&&this.applyPositionMovement(r,s,o),e&&l!==this.lastRotation&&this.applyRotationMovement(l)}this.setLastTransform(r,s,o,l)}applyPositionMovement(t,e,n){let r=this.currentPosition;r.x=t,r.y=e,r.z=n,this.adapter.worldToSkeleton(r);let s=this.lastPosition;s.x=this.lastX,s.y=this.lastY,s.z=this.lastZ,this.adapter.worldToSkeleton(s),this.skeleton.physicsTranslate((r.x-s.x)*this.positionInheritanceFactorX,(r.y-s.y)*this.positionInheritanceFactorY)}applyRotationMovement(t){let e=this.rotationInheritanceFactor;e!==0&&this.skeleton.physicsRotate(0,0,this.getRotationDelta(t,this.lastRotation)*e)}setLastTransform(t,e,n,r){this.lastX=t,this.lastY=e,this.lastZ=n,this.lastRotation=r,this.hasLastTransform=!0}getRotationDelta(t,e){let n=t-e;return n=(n+180)%360-180,n<-180?n+360:n}};var Em=class{constructor(){m(this,"commandPool",new Tm);m(this,"worldVertices",new Float32Array(12*1024));m(this,"quadIndices",new Uint16Array([0,1,2,2,3,0]));m(this,"clipping",new Nr);m(this,"renderCommands",[])}render(t,e=!1,n,r=2,s=0){this.commandPool.reset(),this.renderCommands.length=0;let o=this.clipping,l=0,c=t.drawOrder.appliedPose;for(let a=0,i=c.length;a<i;a++){let h=c[a];if(!h.bone.active){o.clipEnd(h);continue}let d=h.appliedPose,u=d.attachment;if(!u){o.clipEnd(h);continue}let p=d.color;if(p.a===0&&!(u instanceof xe)){o.clipEnd(h);continue}let g,b,x,y,w,k,S;if(u instanceof ct){if(k=u.color,k.a===0){o.clipEnd(h);continue}let C=u.sequence,T=C.resolveIndex(d);u.computeWorldVertices(h,u.getOffsets(d),this.worldVertices,0,r),g=this.worldVertices,b=4,x=C.getUVs(T),y=this.quadIndices,w=6,S=C.regions[T]?.texture}else if(u instanceof Ot){if(k=u.color,k.a===0){o.clipEnd(h);continue}this.worldVertices.length<u.worldVerticesLength&&(this.worldVertices=new Float32Array(u.worldVerticesLength)),u.computeWorldVertices(t,h,0,u.worldVerticesLength,this.worldVertices,0,r),g=this.worldVertices,b=u.worldVerticesLength>>1;let C=u.sequence,T=C.resolveIndex(d);x=C.getUVs(T),y=u.triangles,w=y.length,S=C.regions[T]?.texture}else if(u instanceof xe){o.clipEnd(h),o.clipStart(t,h,u);continue}else{o.clipEnd(h);continue}if(!S){o.clipEnd(h);continue}let I=t.color,M,v;if(e){let C;if(n){C=Math.floor(n[3]*I.a*p.a*k.a*255);let T=Math.floor(C*n[0]*I.r*p.r*k.r),F=Math.floor(C*n[1]*I.g*p.g*k.g),D=Math.floor(C*n[2]*I.b*p.b*k.b);M=C<<24|T<<16|F<<8|D}else{C=Math.floor(I.a*p.a*k.a*255);let T=Math.floor(C*I.r*p.r*k.r),F=Math.floor(C*I.g*p.g*k.g),D=Math.floor(C*I.b*p.b*k.b);M=C<<24|T<<16|F<<8|D}if(v=4278190080,d.darkColor){let{r:T,g:F,b:D}=d.darkColor;v=4278190080|Math.floor(T*C)<<16|Math.floor(F*C)<<8|Math.floor(D*C)}}else{if(n){let C=Math.floor(n[3]*I.a*p.a*k.a*255),T=Math.floor(n[0]*I.r*p.r*k.r*255),F=Math.floor(n[1]*I.g*p.g*k.g*255),D=Math.floor(n[2]*I.b*p.b*k.b*255);M=C<<24|T<<16|F<<8|D}else{let C=Math.floor(I.a*p.a*k.a*255),T=Math.floor(I.r*p.r*k.r*255),F=Math.floor(I.g*p.g*k.g*255),D=Math.floor(I.b*p.b*k.b*255);M=C<<24|T<<16|F<<8|D}if(v=0,d.darkColor){let{r:C,g:T,b:F}=d.darkColor;v=Math.floor(C*255)<<16|Math.floor(T*255)<<8|Math.floor(F*255)}}o.isClipping()&&(o.clipTrianglesUnpacked(g,0,y,w,x,r),g=o.clippedVerticesTyped,b=o.clippedVerticesLength/r,x=o.clippedUVsTyped,y=o.clippedTrianglesTyped,w=o.clippedTrianglesLength);let E=this.commandPool.getCommand(b,w,r);if(E.blendMode=h.data.blendMode,E.texture=S,E.positions.set(g.subarray(0,b*r)),r>=3)for(let C=2,T=b*r;C<T;C+=r)E.positions[C]=l;E.uvs.set(x.subarray(0,b<<1));for(let C=0;C<b;C++)E.colors[C]=M,E.darkColors[C]=v;y instanceof Uint16Array?E.indices.set(y.subarray(0,w)):E.indices.set(y.slice(0,w)),this.renderCommands.push(E),l+=s,o.clipEnd(h)}return o.clipEnd(),this.batchCommands(r)}batchSubCommands(t,e,n,r,s,o){let l=t[e],c=this.commandPool.getCommand(r,s,o);c.blendMode=l.blendMode,c.texture=l.texture;let a=0,i=0,h=0,d=0,u=0;for(let p=e;p<=n;p++){let f=t[p];c.positions.set(f.positions,a),a+=f.numVertices*o,c.uvs.set(f.uvs,i),i+=f.numVertices<<1,c.colors.set(f.colors,h),c.darkColors.set(f.darkColors,h),h+=f.numVertices;for(let g=0;g<f.numIndices;g++)c.indices[d+g]=f.indices[g]+u;d+=f.numIndices,u+=f.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,n,r=this.renderCommands[0],s=0,o=1,l=r.numVertices,c=r.numIndices;for(;o<=this.renderCommands.length;){let a=o<this.renderCommands.length?this.renderCommands[o]:null;if(a&&a.numVertices===0&&a.numIndices===0){o++;continue}if(a!==null&&a.texture===r.texture&&a.blendMode===r.blendMode&&a.colors[0]===r.colors[0]&&a.darkColors[0]===r.darkColors[0]&&c+a.numIndices<65535)l+=a.numVertices,c+=a.numIndices;else{let h=this.batchSubCommands(this.renderCommands,s,o-1,l,c,t);if(n?(n.next=h,n=h):e=n=h,o===this.renderCommands.length)break;r=this.renderCommands[o],s=o,l=r.numVertices,c=r.numIndices}o++}return e}},Tm=class{constructor(){m(this,"pool",[]);m(this,"inUse",[])}getCommand(t,e,n){let r;for(let s of this.pool)if(s._positions.length>=t*n&&s._indices.length>=e){r=s;break}if(r)this.pool.splice(this.pool.indexOf(r),1),r.next=void 0,r.numVertices=t,r.numIndices=e,r.positions=r._positions.subarray(0,t*n),r.uvs=r._uvs.subarray(0,t<<1),r.colors=r._colors.subarray(0,t),r.darkColors=r._darkColors.subarray(0,t),r.indices=r._indices.subarray(0,e);else{let s=new Float32Array(t*n),o=new Float32Array(t<<1),l=new Uint32Array(t),c=new Uint32Array(t),a=new Uint16Array(e);r={positions:s,uvs:o,colors:l,darkColors:c,indices:a,_positions:s,_uvs:o,_colors:l,_darkColors:c,_indices:a,numVertices:t,numIndices:e,blendMode:tn.Normal,texture:null}}return this.inUse.push(r),r}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};var Gt=ye(ge(),1);var kd=ye(ge(),1);var Pn=class Pn extends Aa{constructor(e){super(e.resource);m(this,"texture");this.texture=kd.Texture.from(e)}static from(e){return Pn.textureMap.has(e)?Pn.textureMap.get(e):new Pn(e)}setFilters(e,n){let r=this.texture.source.style;r.minFilter=Pn.toPixiTextureFilter(e),r.magFilter=Pn.toPixiTextureFilter(n),this.texture.source.autoGenerateMipmaps=Pn.toPixiMipMap(e),this.texture.source.updateMipmaps()}setWraps(e,n){let r=this.texture.source.style;r.addressModeU=Pn.toPixiTextureWrap(e),r.addressModeV=Pn.toPixiTextureWrap(n)}dispose(){this.texture.destroy()}static toPixiMipMap(e){switch(e){case le.Nearest:case le.Linear:return!1;case le.MipMapNearestLinear:case le.MipMapNearestNearest:case le.MipMapLinearLinear:case le.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureFilter(e){switch(e){case le.Nearest:case le.MipMapNearestLinear:case le.MipMapNearestNearest:return"nearest";case le.Linear:case le.MipMapLinearLinear:case le.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case Sn.ClampToEdge:return"clamp-to-edge";case Sn.MirroredRepeat:return"mirror-repeat";case Sn.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case tn.Normal:return"normal";case tn.Additive:return"add";case tn.Multiply:return"multiply";case tn.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(e)}`)}}};m(Pn,"textureMap",new Map);var Mo=Pn;var vo="spineTextureAtlasLoader",mf={extension:Gt.ExtensionType.Asset,resolver:{test:A=>(0,Gt.checkExtension)(A,".atlas"),parse:A=>{let t=A.split(".");return{resolution:parseFloat(Gt.Resolver.RETINA_PREFIX?.exec(A)?.[1]??"1"),format:t[t.length-2],src:A}}},loader:{id:vo,name:vo,extension:{type:Gt.ExtensionType.LoadParser,priority:Gt.LoaderParserPriority.Normal,name:vo},test(A){return(0,Gt.checkExtension)(A,".atlas")},async load(A){let t=await Gt.DOMAdapter.get().fetch(A);if(!t.ok)throw new Error(`[${vo}] Failed to fetch ${A}: ${t.status} ${t.statusText}`);return await t.text()},testParse(A,t){let e=(0,Gt.checkExtension)(t.src,".atlas"),n=typeof A=="string",r=t.parser===vo||t.loadParser===vo;return Promise.resolve((e||r)&&n)},unload(A){A.dispose()},async parse(A,t,e){let n=t.data||{},r=Gt.path.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let s=new rs(A);if(n.images instanceof Gt.TextureSource||typeof n.images=="string"){let l=n.images;n.images={},n.images[s.pages[0].name]=l}let o=[];for(let l of s.pages){let c=l.name,a=n?.images?n.images[c]:void 0;if(a instanceof Gt.TextureSource)l.setTexture(Mo.from(a));else{let i=a??Gt.path.normalize([...r.split(Gt.path.sep),c].join(Gt.path.sep)),h={src:(0,Gt.copySearchParams)(i,t.src),data:{...n.imageMetadata,alphaMode:l.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=e.load(h).then(u=>{l.setTexture(Mo.from(u.source))});o.push(d)}}return await Promise.all(o),s}}};Gt.extensions.add(mf);var nn=ye(ge(),1),Co="spineSkeletonLoader";function df(A){return Object.prototype.hasOwnProperty.call(A,"bones")}function uf(A){return A instanceof Uint8Array}var ff={extension:nn.ExtensionType.Asset,loader:{id:Co,name:Co,extension:{type:nn.ExtensionType.LoadParser,priority:nn.LoaderParserPriority.Normal,name:Co},test(A){return(0,nn.checkExtension)(A,".skel")},async load(A){let t=await nn.DOMAdapter.get().fetch(A);if(!t.ok)throw new Error(`[${Co}] Failed to fetch ${A}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(A,t){let e=(0,nn.checkExtension)(t.src,".json")&&df(A),n=(0,nn.checkExtension)(t.src,".skel")&&uf(A),r=t.parser===Co||t.loadParser===Co;return Promise.resolve(e||n||r)}}};nn.extensions.add(ff);var ys=ye(ge(),1);var sr=ye(ge(),1),pf=new Float32Array(1),gf=new Uint32Array(1),oh=class extends sr.Geometry{constructor(){let e=new sr.Buffer({data:pf,label:"attribute-batch-buffer",usage:sr.BufferUsage.VERTEX|sr.BufferUsage.COPY_DST,shrinkToFit:!1}),n=new sr.Buffer({data:gf,label:"index-batch-buffer",usage:sr.BufferUsage.INDEX|sr.BufferUsage.COPY_DST,shrinkToFit:!1}),r=7*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:4*4},aDarkColor:{buffer:e,format:"unorm8x4",stride:r,offset:5*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:6*4}},indexBuffer:n})}};var fe=ye(ge(),1);var Id={name:"color-bit",vertex:{header:`
|
|
12
|
+
@in aDarkColor: vec4<f32>;
|
|
13
|
+
@out vDarkColor: vec4<f32>;
|
|
14
|
+
`,main:`
|
|
15
|
+
vDarkColor = aDarkColor;
|
|
16
|
+
`},fragment:{header:`
|
|
17
|
+
@in vDarkColor: vec4<f32>;
|
|
18
|
+
`,end:`
|
|
19
|
+
|
|
20
|
+
let alpha = outColor.a * vColor.a;
|
|
21
|
+
let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
22
|
+
|
|
23
|
+
finalColor = vec4<f32>(rgb, alpha);
|
|
24
|
+
|
|
25
|
+
`}},Md={name:"color-bit",vertex:{header:`
|
|
26
|
+
in vec4 aDarkColor;
|
|
27
|
+
out vec4 vDarkColor;
|
|
28
|
+
`,main:`
|
|
29
|
+
vDarkColor = aDarkColor;
|
|
30
|
+
`},fragment:{header:`
|
|
31
|
+
in vec4 vDarkColor;
|
|
32
|
+
`,end:`
|
|
33
|
+
|
|
34
|
+
finalColor.a = outColor.a * vColor.a;
|
|
35
|
+
finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
36
|
+
`}};var lh=class extends fe.Shader{constructor(t){let e=(0,fe.compileHighShaderGlProgram)({name:"dark-tint-batch",bits:[fe.colorBitGl,Md,(0,fe.generateTextureBatchBitGl)(t),fe.roundPixelsBitGl]}),n=(0,fe.compileHighShaderGpuProgram)({name:"dark-tint-batch",bits:[fe.colorBit,Id,(0,fe.generateTextureBatchBit)(t),fe.roundPixelsBit]});super({glProgram:e,gpuProgram:n,resources:{batchSamplers:(0,fe.getBatchSamplersUniformGroup)(t)}})}};var vd=null,ch=class ch extends ys.Batcher{constructor(){super(...arguments);m(this,"geometry",new oh);m(this,"shader",vd||(vd=new lh(this.maxTextures)));m(this,"name",ch.extension.name);m(this,"vertexSize",7)}packAttributes(e,n,r,s,o){let l=o<<16|e.roundPixels&65535,c=e.transform,a=c.a,i=c.b,h=c.c,d=c.d,u=c.tx,p=c.ty,{positions:f,uvs:g}=e,b=e.color,x=(b>>24&255)/255,y=ys.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=e.attributeOffset,k=w+e.attributeSize;for(let S=w;S<k;S++){let I=S*2,M=f[I],v=f[I+1];n[s++]=a*M+h*v+u,n[s++]=d*v+i*M+p,n[s++]=g[I],n[s++]=g[I+1],r[s++]=b,r[s++]=y,r[s++]=l}}packQuadAttributes(e,n,r,s,o){let l=e.texture,c=e.transform,a=c.a,i=c.b,h=c.c,d=c.d,u=c.tx,p=c.ty,f=e.bounds,g=f.maxX,b=f.minX,x=f.maxY,y=f.minY,w=l.uvs,k=e.color,S=e.darkColor,I=o<<16|e.roundPixels&65535;n[s+0]=a*b+h*y+u,n[s+1]=d*y+i*b+p,n[s+2]=w.x0,n[s+3]=w.y0,r[s+4]=k,r[s+5]=S,r[s+6]=I,n[s+7]=a*g+h*y+u,n[s+8]=d*y+i*g+p,n[s+9]=w.x1,n[s+10]=w.y1,r[s+11]=k,r[s+12]=S,r[s+13]=I,n[s+14]=a*g+h*x+u,n[s+15]=d*x+i*g+p,n[s+16]=w.x2,n[s+17]=w.y2,r[s+18]=k,r[s+19]=S,r[s+20]=I,n[s+21]=a*b+h*x+u,n[s+22]=d*x+i*b+p,n[s+23]=w.x3,n[s+24]=w.y3,r[s+25]=k,r[s+26]=S,r[s+27]=I}};m(ch,"extension",{type:[ys.ExtensionType.Batcher],name:"darkTint"});var Bm=ch;ys.extensions.add(Bm);var bf=J.newFloatArray(8),xi=class xi{constructor(t){m(this,"ctx");m(this,"triangleRendering",!1);m(this,"debugRendering",!1);m(this,"vertices",J.newFloatArray(8*1024));m(this,"tempColor",new _);this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){let e=this.ctx,n=this.tempColor,r=t.color,s=t.drawOrder.appliedPose;this.debugRendering&&(e.strokeStyle="green");for(let o=0,l=s.length;o<l;o++){let c=s[o],a=c.bone;if(!a.active)continue;let i=c.appliedPose,h=i.attachment;if(!(h instanceof ct))continue;let d=h.sequence,u=d.resolveIndex(i);h.computeWorldVertices(c,h.getOffsets(i),bf,0,2);let p=d.regions[u],f=p.texture.getImage(),g=i.color,b=h.color;n.set(r.r*g.r*b.r,r.g*g.g*b.g,r.b*g.b*b.b,r.a*g.a*b.a),e.save();let x=a.appliedPose;e.transform(x.a,x.c,x.b,x.d,x.worldX,x.worldY);let y=h.getOffsets(i);e.translate(y[0],y[1]),e.rotate(h.rotation*Math.PI/180);let w=h.width/p.originalWidth;e.scale(w*h.scaleX,w*h.scaleY);let k=p.width,S=p.height;if(e.translate(k/2,S/2),p.degrees===90){let I=k;k=S,S=I,e.rotate(-Math.PI/2)}e.scale(1,-1),e.translate(-k/2,-S/2),e.globalAlpha=n.a,e.drawImage(f,f.width*p.u,f.height*p.v,k,S,0,0,k,S),this.debugRendering&&e.strokeRect(0,0,k,S),e.restore()}}drawTriangles(t){let e=this.ctx,n=this.tempColor,r=t.color,s=t.drawOrder.appliedPose,o=null,l=this.vertices,c=null;for(let a=0,i=s.length;a<i;a++){let h=s[a],d=h.appliedPose,u=d.attachment,p;if(u instanceof ct){let f=u.sequence,g=f.resolveIndex(d),b=f.getUVs(g),x=u.getOffsets(d);l=this.computeRegionVertices(h,u,x,b,!1),c=xi.QUAD_TRIANGLES,p=(f.regions[g]?.texture).getImage()}else if(u instanceof Ot){let f=u.sequence,g=f.resolveIndex(d),b=f.getUVs(g);l=this.computeMeshVertices(h,u,b,!1),c=u.triangles,p=(f.regions[g]?.texture).getImage()}else continue;if(p){h.data.blendMode!==o&&(o=h.data.blendMode);let f=d.color,g=u.color;n.set(r.r*f.r*g.r,r.g*f.g*g.g,r.b*f.b*g.b,r.a*f.a*g.a),e.globalAlpha=n.a;for(let b=0;b<c.length;b+=3){let x=c[b]*8,y=c[b+1]*8,w=c[b+2]*8,k=l[x],S=l[x+1],I=l[x+6],M=l[x+7],v=l[y],E=l[y+1],C=l[y+6],T=l[y+7],F=l[w],D=l[w+1],V=l[w+6],X=l[w+7];this.drawTriangle(p,k,S,I,M,v,E,C,T,F,D,V,X),this.debugRendering&&(e.strokeStyle="green",e.beginPath(),e.moveTo(k,S),e.lineTo(v,E),e.lineTo(F,D),e.lineTo(k,S),e.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,e,n,r,s,o,l,c,a,i,h,d,u){let p=this.ctx,f=t.width-1,g=t.height-1;r*=f,s*=g,c*=f,a*=g,d*=f,u*=g,p.beginPath(),p.moveTo(e,n),p.lineTo(o,l),p.lineTo(i,h),p.closePath(),o-=e,l-=n,i-=e,h-=n,c-=r,a-=s,d-=r,u-=s;let b=c*u-d*a;if(b===0)return;b=1/b;let x=(u*o-a*i)*b,y=(u*l-a*h)*b,w=(c*i-d*o)*b,k=(c*h-d*l)*b,S=e-x*r-w*s,I=n-y*r-k*s;p.save(),p.transform(x,y,w,k,S,I),p.clip(),p.drawImage(t,0,0),p.restore()}computeRegionVertices(t,e,n,r,s){let o=t.skeleton.color,l=t.appliedPose.color,c=e.color,a=o.a*l.a*c.a,i=s?a:1,h=this.tempColor;h.set(o.r*l.r*c.r*i,o.g*l.g*c.g*i,o.b*l.b*c.b*i,a),e.computeWorldVertices(t,n,this.vertices,0,xi.VERTEX_SIZE);let d=this.vertices;return d[ct.C1R]=h.r,d[ct.C1G]=h.g,d[ct.C1B]=h.b,d[ct.C1A]=h.a,d[ct.U1]=r[0],d[ct.V1]=r[1],d[ct.C2R]=h.r,d[ct.C2G]=h.g,d[ct.C2B]=h.b,d[ct.C2A]=h.a,d[ct.U2]=r[2],d[ct.V2]=r[3],d[ct.C3R]=h.r,d[ct.C3G]=h.g,d[ct.C3B]=h.b,d[ct.C3A]=h.a,d[ct.U3]=r[4],d[ct.V3]=r[5],d[ct.C4R]=h.r,d[ct.C4G]=h.g,d[ct.C4B]=h.b,d[ct.C4A]=h.a,d[ct.U4]=r[6],d[ct.V4]=r[7],d}computeMeshVertices(t,e,n,r){let s=t.skeleton,o=s.color,l=t.appliedPose.color,c=e.color,a=o.a*l.a*c.a,i=r?a:1,h=this.tempColor;h.set(o.r*l.r*c.r*i,o.g*l.g*c.g*i,o.b*l.b*c.b*i,a);let d=e.worldVerticesLength/2,u=this.vertices;u.length<e.worldVerticesLength&&(this.vertices=u=J.newFloatArray(e.worldVerticesLength)),e.computeWorldVertices(s,t,0,e.worldVerticesLength,u,0,xi.VERTEX_SIZE);for(let p=0,f=0,g=2;p<d;p++)u[g++]=h.r,u[g++]=h.g,u[g++]=h.b,u[g++]=h.a,u[g++]=n[f++],u[g++]=n[f++],g+=2;return u}};m(xi,"QUAD_TRIANGLES",[0,1,2,2,3,0]),m(xi,"VERTEX_SIZE",8);var hh=xi;var ar=ye(ge(),1);var mh=class{constructor(){m(this,"indexOffset",0);m(this,"attributeOffset",0);m(this,"indexSize");m(this,"attributeSize");m(this,"batcherName","darkTint");m(this,"topology","triangle-list");m(this,"packAsQuad",!1);m(this,"renderable");m(this,"positions");m(this,"indices");m(this,"uvs");m(this,"roundPixels");m(this,"data");m(this,"blendMode");m(this,"darkTint");m(this,"texture");m(this,"transform");m(this,"_textureId");m(this,"_attributeStart");m(this,"_indexStart");m(this,"_batcher");m(this,"_batch")}get color(){let t=this.data.color,e=this.renderable.groupColor,n=this.renderable.groupAlpha,r,s=t.a*n*255;if(e!==16777215){let o=e>>16&255,l=e>>8&255,c=e&255,a=t.r*c,i=t.g*l,h=t.b*o;r=s<<24|h<<16|i<<8|a}else r=s<<24|t.b*255<<16|t.g*255<<8|t.r*255;return r}get darkColor(){let t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}get groupTransform(){return this.renderable.groupTransform}setData(t,e,n,r){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){let s=e.clippedData;this.indexSize=s.indicesCount,this.attributeSize=s.vertexCount,this.positions=s.vertices,this.indices=s.indices,this.uvs=s.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=r,this.blendMode=n,this.batcherName=e.darkTint?"darkTint":"default"}};var xf={0:"normal",1:"add",2:"multiply",3:"screen"},cc=class{constructor(t){m(this,"renderer");m(this,"canvasSkeletonRenderer");m(this,"gpuSpineData",{});m(this,"_destroyRenderableBound",this.destroyRenderable.bind(this));this.renderer=t}validateRenderable(t){if(this.renderer.type===ar.RendererType.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){let e=t.skeleton.drawOrder.appliedPose,n=this.gpuSpineData[t.uid];if(!n)return!1;for(let r=0,s=e.length;r<s;r++){let o=e[r];if(!o.bone.active)continue;let l=o.appliedPose.attachment;if(l instanceof ct||l instanceof Ot){let c=t._getCachedData(o,l),a=n.slotBatches[c.id],i=c.texture;if(i!==a?.texture&&!a?._batcher.checkAndUpdateTexture(a,i))return!0}}}return!1}execute(t){if(this.renderer.type===ar.RendererType.CANVAS){let e=this.renderer,n=(t.groupColorAlpha>>>24&255)/255,r=e.canvasContext,s=r.activeContext;s.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new hh(s),this.canvasSkeletonRenderer.triangleRendering=!0),r.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);let o=t.skeleton.color.a;t.skeleton.color.a*=n,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=o,s.restore()}}addRenderable(t,e){var l,c;if(this.renderer.type===ar.RendererType.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}let n=this._getSpineData(t),r=this.renderer.renderPipes.batch,s=t.skeleton.drawOrder.appliedPose,o=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let a=0,i=s.length;a<i;a++){let h=s[a];if(!h.bone.active)continue;let d=h.appliedPose.attachment,u=xf[h.data.blendMode],p=!1;if(d instanceof ct||d instanceof Ot){let g=t._getCachedData(h,d),b=(l=n.slotBatches)[c=g.id]||(l[c]=new mh);b.setData(t,g,u,o),p=g.skipRender,p||r.addToBatch(b,e)}let f=t._slotsObject[h.data.name];if(f?.wasRenderable){let g=f.container;g.includeInBuild=!0,g.collectRenderables(e,this.renderer,null),g.includeInBuild=!1}}}updateRenderable(t){let e=this.gpuSpineData[t.uid];if(!e)return;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;let n=t.skeleton.drawOrder.appliedPose;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(!o.bone.active)continue;let l=o.appliedPose.attachment;if(l instanceof ct||l instanceof Ot){let c=t._getCachedData(o,l);if(!c.skipRender){let a=e.slotBatches[c.id];a&&(a.uvs=c.clipped?c.clippedData.uvs:c.uvs,a._batcher?.updateElement(a))}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};m(cc,"extension",{type:[ar.ExtensionType.WebGLPipes,ar.ExtensionType.WebGPUPipes,ar.ExtensionType.CanvasPipes],name:"spine"});ar.extensions.add(cc);var he=ye(ge(),1);var dh=new ns;tr.yDown=!0;var ir=new Nr,Fm=class{constructor(t,e,n,r){m(this,"x");m(this,"y");m(this,"width");m(this,"height");this.x=t,this.y=e,this.width=n,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Dm=class{constructor(t=!1){m(this,"clipping");this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};let e=new tr(t.skeleton.data);e.setupPose(),e.updateWorldTransform(Ne.update);let n=e.getBoundsRect(this.clipping?new Nr:void 0);return n.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:n}},Vm=class{constructor(t,e=[],n=.05,r=!1){m(this,"animation");m(this,"skins");m(this,"timeStep");m(this,"clipping");this.animation=t,this.skins=e,this.timeStep=n,this.clipping=r}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};let e=new ko(t.state.data),n=new tr(t.skeleton.data),r=this.clipping?new Nr:void 0,s=n.data;if(this.skins.length>0){let l=new er("custom-skin");for(let c of this.skins){let a=s.findSkin(c);a!=null&&l.addSkin(a)}n.setSkin(l)}n.setupPose();let o=this.animation!=null?s.findAnimation(this.animation):null;if(o==null){n.updateWorldTransform(Ne.update);let l=n.getBoundsRect(r);return l.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:l}else{let l=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimation(0,o,!1);let h=Math.max(o.duration/this.timeStep,1);for(let u=0;u<h;u++){let p=u>0?this.timeStep:0;e.update(p),e.apply(n),n.update(p),n.updateWorldTransform(Ne.update);let f=n.getBoundsRect(r);l=Math.min(l,f.x),c=Math.min(c,f.y),a=Math.max(a,f.x+f.width),i=Math.max(i,f.y+f.height)}let d={x:l,y:c,width:a-l,height:i-c};return d.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Cd=new wn(()=>new he.Graphics),or=class or extends he.ViewContainer{constructor(e){super({});m(this,"batched",!0);m(this,"buildId",0);m(this,"renderPipeId","spine");m(this,"_didSpineUpdate",!1);m(this,"beforeUpdateWorldTransforms",()=>{});m(this,"afterUpdateWorldTransforms",()=>{});m(this,"skeleton");m(this,"state");m(this,"skeletonPhysics");m(this,"skeletonBounds");m(this,"darkTint",!1);m(this,"_debug");m(this,"_slotsObject",Object.create(null));m(this,"clippingSlotToPixiMasks",Object.create(null));m(this,"spineAttachmentsDirty",!0);m(this,"spineTexturesDirty",!0);m(this,"_lastAttachments",[]);m(this,"_lastRenderableCacheIds",[]);m(this,"_lastClippingAttachmentIds",[]);m(this,"_stateChanged",!0);m(this,"attachmentCacheData",[]);m(this,"_autoUpdate",!1);m(this,"_ticker",he.Ticker.shared);m(this,"_boundsProvider");m(this,"hasNeverUpdated",!0);m(this,"currentClippingSlot");e instanceof Pr?e={skeletonData:e}:"skeleton"in e&&(e=new.target.createOptions(e)),this.allowChildren=!0;let{autoUpdate:n,boundsProvider:r,darkTint:s,skeletonData:o,ticker:l}=e;this.skeleton=new tr(o),this.skeletonPhysics=new lc(this.skeleton,{readTransform:(a,i)=>this.readPhysicsTransform(a,i),worldToSkeleton:a=>this.pixiWorldCoordinatesToSkeleton(a)}),this.state=new ko(new Gl(o)),l&&(this._ticker=l),this.autoUpdate=n??!0,this._boundsProvider=r,this.darkTint=s===void 0?this.skeleton.slots.some(a=>!!a.data.setupPose.darkColor):s;let c=this.skeleton.slots;for(let a=0;a<c.length;a++)this.attachmentCacheData[a]=Object.create(null)}getSlotFromRef(e){let n;if(typeof e=="number"?n=this.skeleton.slots[e]:typeof e=="string"?n=this.skeleton.findSlot(e):n=e,!n)throw new Error(`No slot found with the given slot reference: ${e}`);return n}get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){e=e??he.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}get boundsProvider(){return this._boundsProvider}set boundsProvider(e){this._boundsProvider=e,e&&(this._boundsDirty=!1),this.updateBounds()}update(e){this.internalUpdate(void 0,e)}internalUpdate(e,n){this._updateAndApplyState(n??this._ticker.deltaMS/1e3)}readPhysicsTransform(e,n){let r=this.worldTransform;if(e.x=r.tx,e.y=r.ty,e.z=0,!n)return;let s=0;for(let o=this;o;o=o.parent)s+=o.rotation+(o.skew.y-o.skew.x)/2;e.rotation=s*180/Math.PI}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,n){let r=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(r)} not found`);dh.set(n.x,n.y);let s=e.appliedPose;if(e.parent){let o=e.parent.appliedPose.worldToLocal(dh);s.x=o.x,s.y=-o.y}else s.x=dh.x,s.y=dh.y}getBonePosition(e,n){let r=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(n||(n={x:0,y:0}),n.x=e.appliedPose.worldX,n.y=e.appliedPose.worldY,n):(console.error(`Cant set bone position! Bone ${String(r)} not found`),n)}_updateAndApplyState(e){this.hasNeverUpdated=!1,this.state.update(e),this.skeleton.update(e);let{skeleton:n}=this;this.state.apply(n),this.skeletonPhysics.applyTransformMovement(),this.beforeUpdateWorldTransforms(this),n.updateWorldTransform(Ne.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){let e=this.skeleton.drawOrder.appliedPose,n=this._lastAttachments,r=this._lastRenderableCacheIds,s=this._lastClippingAttachmentIds,o=0,l=0,c=0,a=!1;for(let i=0;i<e.length;i++){let h=e[i];if(!h.bone.active)continue;let d=h.appliedPose.attachment;if(d&&(d!==n[o]&&(a=!0,n[o]=d),o++),d instanceof ct||d instanceof Ot){let u=this.getRenderableCacheId(h,d);u!==r[l]&&(a=!0,r[l]=u),l++}else if(d instanceof xe){let u=`${h.data.index}-${d.name}-${d.endSlot?.index??-1}`;u!==s[c]&&(a=!0,s[c]=u),c++}}o!==n.length&&(a=!0,n.length=o),l!==r.length&&(a=!0,r.length=l),c!==s.length&&(a=!0,s.length=c),this.spineAttachmentsDirty||(this.spineAttachmentsDirty=a)}updateAndSetPixiMask(e){var l,c;let r=e.appliedPose.attachment,s=this._slotsObject[e.data.name],o=this.currentClippingSlot;if(o&&e.bone.active&&s?.wasRenderable){let a=o.slot,i=a.appliedPose.attachment;if(a.bone.active&&i instanceof xe){let h=o.mask;if(h||(h=Cd.obtain(),o.mask=h,this.addChild(h)),!o.maskComputed){o.maskComputed=!0;let d=i.worldVerticesLength,u=o.vertices;i.computeWorldVertices(this.skeleton,a,0,d,u,0,2),h.clear().poly(u).stroke({width:0}).fill({alpha:.25})}s.container.mask=h}}else s?.container.mask&&(s.container.mask=null);if(this.closeCurrentPixiMaskIfEndingAt(e),!!e.bone.active&&r instanceof xe){let a=(l=this.clippingSlotToPixiMasks)[c=e.data.name]||(l[c]={slot:e,vertices:[]});a.slot=e,a.maskComputed=!1,this.currentClippingSlot=a}}closeCurrentPixiMaskIfEndingAt(e){let n=this.currentClippingSlot,r=n?.slot.appliedPose.attachment;n&&r instanceof xe&&r.endSlot===e.data&&(this.currentClippingSlot=void 0)}cleanupPixiMasks(){for(let e in this.clippingSlotToPixiMasks){let n=this.clippingSlotToPixiMasks[e];(!n.slot.bone.active||!(n.slot.appliedPose.attachment instanceof xe)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),Cd.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}transformAttachments(){let e=this.skeleton.drawOrder.appliedPose,n=this.skeleton;for(let r=0;r<e.length;r++){let s=e[r],o=s.appliedPose,l=o.attachment;if(this.updateAndSetPixiMask(s),!s.bone.active){this.markSlotAttachmentSkipped(s,l),ir.clipEnd(s);continue}if(l){if(l instanceof Ot||l instanceof ct){let c=this._getCachedData(s,l),a=l.sequence,i=a.resolveIndex(o);l instanceof ct?l.computeWorldVertices(s,l.getOffsets(o),c.vertices,0,2):l.computeWorldVertices(n,s,0,l.worldVerticesLength,c.vertices,0,2),c.uvs=a.getUVs(i);let h=n.color,d=o.color,u=l.color,p=h.a*d.a*u.a;if(this.alpha===0||p===0)c.skipRender||(this.spineAttachmentsDirty=!0),c.skipRender=!0,c.clipped=!1;else{c.skipRender&&(this.spineAttachmentsDirty=!0),c.skipRender=c.clipped=!1,c.color.set(h.r*d.r*u.r,h.g*d.g*u.g,h.b*d.b*u.b,p),o.darkColor&&c.darkColor.setFromColor(o.darkColor);let f=a.regions[i]?.texture?.texture||he.Texture.EMPTY;c.texture!==f&&(c.texture=f,this.spineTexturesDirty=!0),ir.isClipping()&&this.updateClippingData(c)}}else if(l instanceof xe){ir.clipEnd(s),ir.clipStart(n,s,l);continue}}ir.clipEnd(s)}ir.clipEnd(),this.cleanupPixiMasks()}updateClippingData(e){e.clipped=!0,ir.clipTrianglesUnpacked(e.vertices,0,e.indices,e.indices.length,e.uvs);let{clippedVerticesTyped:n,clippedUVsTyped:r,clippedTrianglesTyped:s}=ir,o=ir.clippedVerticesLength/2,l=ir.clippedTrianglesLength;e.clippedData||(e.clippedData={vertices:new Float32Array(o*2),uvs:new Float32Array(o*2),vertexCount:o,indices:new Uint16Array(l),indicesCount:l},this.spineAttachmentsDirty=!0);let c=e.clippedData,a=c.vertexCount!==o||l!==c.indicesCount;e.skipRender=o===0,a&&(this.spineAttachmentsDirty=!0,c.vertexCount<o&&(c.vertices=new Float32Array(o*2),c.uvs=new Float32Array(o*2)),c.indices.length<l&&(c.indices=new Uint16Array(l)));let{vertices:i,uvs:h,indices:d}=c;i.set(n),h.set(r);for(let u=0;u<l;u++){let p=s[u];d[u]!==p&&(this.spineAttachmentsDirty=!0),d[u]=p}c.vertexCount=o,c.indicesCount=l}updateSlotObjects(){for(let e in this._slotsObject){let n=this._slotsObject[e];n&&this.updateSlotObject(n)}}updateSlotObject(e){let{slot:n,container:r}=e,s=n.appliedPose,o=this.skeleton.color.a*s.color.a,l=this.isSlotObjectRenderable(e,o);if(e.wasRenderable!==l&&(this.spineAttachmentsDirty=!0,e.wasRenderable=l),r.visible=l,l){let c=n.bone.appliedPose,a=r.localTransform;a.a=c.a,a.b=c.c,a.c=-c.b,a.d=-c.d,a.tx=c.worldX,a.ty=c.worldY,r.setFromMatrix(a),r.alpha=o,e.followSlotColor&&(r.tint=255*this.skeleton.color.r*s.color.r<<16|255*this.skeleton.color.g*s.color.g<<8|255*this.skeleton.color.b*s.color.b)}else r.mask&&(r.mask=null)}isSlotObjectRenderable(e,n=this.skeleton.color.a*e.slot.appliedPose.color.a){let{slot:r}=e,s=e.followAttachmentTimeline?!!r.appliedPose.attachment:!0;return this.skeleton.drawOrder.appliedPose.includes(r)&&r.bone.active&&s&&this.alpha>0&&n>0}getRenderableCacheId(e,n){return`${e.data.index}-${n.name}`}getExistingCachedData(e,n){return this.attachmentCacheData[e.data.index]?.[n.name]}markSlotAttachmentSkipped(e,n){if(!(n instanceof ct||n instanceof Ot))return;let r=this.getExistingCachedData(e,n);r&&(r.skipRender||(this.spineAttachmentsDirty=!0),r.skipRender=!0,r.clipped=!1)}_getCachedData(e,n){return this.getExistingCachedData(e,n)||this.initCachedData(e,n)}initCachedData(e,n){let r;if(this.spineAttachmentsDirty=!0,n instanceof ct){r=new Float32Array(8);let s=n.sequence;this.attachmentCacheData[e.data.index][n.name]={id:this.getRenderableCacheId(e,n),vertices:r,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.getUVs(0).length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.regions[0]?.texture?.texture}}else{r=new Float32Array(n.worldVerticesLength);let s=n.sequence;this.attachmentCacheData[e.data.index][n.name]={id:this.getRenderableCacheId(e,n),vertices:r,clipped:!1,indices:n.triangles,uvs:new Float32Array(s.getUVs(0).length),color:new _(1,1,1,1),darkColor:new _(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.regions[0]?.texture?.texture}}return this.attachmentCacheData[e.data.index][n.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,n,r){e=this.getSlotFromRef(e);for(let o in this._slotsObject)this._slotsObject[o]?.container===n&&this.removeSlotObject(this._slotsObject[o].slot);this.removeSlotObject(e),n.mask=null,n.includeInBuild=!1,this.addChild(n);let s={container:n,slot:e,followAttachmentTimeline:r?.followAttachmentTimeline||!1,followSlotColor:r?.followSlotColor||!1,wasRenderable:!1};this._slotsObject[e.data.name]=s,this.spineAttachmentsDirty=!0,this.updateSlotObject(s)}removeSlotObject(e){let n;if(e instanceof he.Container){for(let r in this._slotsObject)if(this._slotsObject[r]?.container===e){this._slotsObject[r]=null,n=e;break}}else{let r=this.getSlotFromRef(e);n=this._slotsObject[r.data.name]?.container,this._slotsObject[r.data.name]=null}n&&(this.removeChild(n),n.mask=null,n.includeInBuild=!0,this.spineAttachmentsDirty=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([e,n])=>{n&&(n.container.removeFromParent(),n.container.mask=null,n.container.includeInBuild=!0),delete this._slotsObject[e]}),this.spineAttachmentsDirty=!0}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||(this.skeletonBounds=new bi);let e=this.skeletonBounds;if(e.update(this.skeleton,!0),this._boundsProvider){let n=this._boundsProvider.calculateBounds(this),r=this._bounds;r.clear(),r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height}else if(e.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();let n=this.skeleton.drawOrder.appliedPose,r=this._bounds;r.clear();for(let s=0;s<n.length;s++){let o=n[s];if(!o.bone.active)continue;let l=o.appliedPose.attachment;if(l&&(l instanceof ct||l instanceof Ot)){let c=this._getCachedData(o,l);r.addVertexData(c.vertices,0,c.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this.attachmentCacheData=null,this._lastAttachments.length=0,this._lastRenderableCacheIds.length=0,this._lastClippingAttachmentIds.length=0}unloadFromCache(){let e=this.skeleton?.data;if(!e)return!1;let n=or.skeletonDataCacheKeys.get(e);return!n||!he.Cache.has(n)||he.Cache.get(n)!==e?!1:(he.Cache.remove(n),or.skeletonDataCacheKeys.delete(e),!0)}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,n){this.pixiWorldCoordinatesToSkeleton(e),n.parent?n.parent.appliedPose.worldToLocal(e):n.appliedPose.worldToLocal(e)}static createOptions({skeleton:e,atlas:n,scale:r=1,darkTint:s,autoUpdate:o=!0,boundsProvider:l,allowMissingRegions:c=!1,ticker:a}){let i=or.getSkeletonCacheKey({skeleton:e,atlas:n,scale:r});if(he.Cache.has(i)){let g=he.Cache.get(i);return or.skeletonDataCacheKeys.set(g,i),{skeletonData:g,darkTint:s,autoUpdate:o,boundsProvider:l,ticker:a}}let h=he.Assets.get(n),d=new Kl(h,c),u=he.Assets.get(e),p=u instanceof Uint8Array?new ac(d):new oc(d);p.scale=r;let f=p.readSkeletonData(u);return he.Cache.set(i,f),or.skeletonDataCacheKeys.set(f,i),{skeletonData:f,darkTint:s,autoUpdate:o,boundsProvider:l,ticker:a}}static getSkeletonCacheKey({skeleton:e,atlas:n,scale:r=1}){return`${e}-${n}-${r}`}static from(e){return new or(or.createOptions(e))}};m(or,"skeletonDataCacheKeys",new WeakMap);var Rm=or;var Se=ye(ge(),1);var Pm=class{constructor(){m(this,"registeredSpines",new Map);m(this,"drawMeshHull",!0);m(this,"drawMeshTriangles",!0);m(this,"drawBones",!0);m(this,"drawPaths",!0);m(this,"drawBoundingBoxes",!0);m(this,"drawClipping",!0);m(this,"drawRegionAttachments",!0);m(this,"drawEvents",!0);m(this,"lineWidth",1);m(this,"regionAttachmentsColor",30975);m(this,"meshHullColor",30975);m(this,"meshTrianglesColor",16763904);m(this,"clippingPolygonColor",16711935);m(this,"boundingBoxesRectColor",65280);m(this,"boundingBoxesPolygonColor",65280);m(this,"boundingBoxesCircleColor",65280);m(this,"pathsCurveColor",16711680);m(this,"pathsLineColor",16711935);m(this,"skeletonXYColor",16711680);m(this,"bonesColor",61132);m(this,"eventFontSize",24);m(this,"eventFontColor",0)}registerSpine(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}let e={parentDebugContainer:new Se.Container,bones:new Se.Container,skeletonXY:new Se.Graphics,regionAttachmentsShape:new Se.Graphics,meshTrianglesLine:new Se.Graphics,meshHullLine:new Se.Graphics,clippingPolygon:new Se.Graphics,boundingBoxesRect:new Se.Graphics,boundingBoxesCircle:new Se.Graphics,boundingBoxesPolygon:new Se.Graphics,pathsCurve:new Se.Graphics,pathsLine:new Se.Graphics,eventText:new Se.Container,eventCallback:{event:(n,r)=>{if(this.drawEvents){let s=Math.abs(t.scale.x||t.scale.y||1),o=new Se.Text({text:r.data.name,style:{fontSize:this.eventFontSize/s,fill:this.eventFontColor,fontFamily:"monospace"}});o.scale.x=Math.sign(t.scale.x),o.anchor.set(.5),e.eventText.addChild(o),setTimeout(()=>{o.destroyed||o.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);let e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let s=e.bones.children.length;s>0;s--)e.bones.children[s-1].destroy({children:!0,texture:!0,textureSource:!0});let n=Math.abs(t.scale.x||t.scale.y||1),r=this.lineWidth/n;if(this.drawBones&&this.drawBonesFunc(t,e,r,n),this.drawPaths&&this.drawPathsFunc(t,e,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,r),this.drawClipping&&this.drawClippingFunc(t,e,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,r),this.drawEvents)for(let s of e.eventText.children)s.alpha-=.05,s.y-=2}drawBonesFunc(t,e,n,r){let s=t.skeleton,o=s.x,l=s.y,c=s.bones;e.skeletonXY.strokeStyle={width:n,color:this.skeletonXYColor};for(let i=0,h=c.length;i<h;i++){let d=c[i],u=d.data.length,p=d.appliedPose,f=o+p.worldX,g=l+p.worldY,b=o+u*p.a+p.worldX,x=l+u*p.b+p.worldY;if(d.data.name==="root"||d.data.parent===null)continue;let y=Math.abs(f-b),w=Math.abs(g-x),k=Math.pow(y,2),S=w,I=Math.pow(w,2),M=Math.sqrt(k+I),v=Math.pow(M,2),E=Math.PI/180,C=Math.acos((v+I-k)/(2*S*M))||0;if(M===0)continue;let T=new Se.Graphics;e.bones.addChild(T);let F=M/50/r;T.context.poly([0,0,0-F,M-F*3,0,M-F,0+F,M-F*3]).fill(this.bonesColor),T.x=f,T.y=g,T.pivot.y=M;let D=0;f<b&&g<x?D=-C+180*E:f>b&&g<x?D=180*E+C:f>b&&g>x?D=-C:f<b&&g>x?D=C:g===x&&f<b?D=90*E:g===x&&f>b?D=-90*E:f===b&&g<x?D=180*E:f===b&&g>x&&(D=0),T.rotation=D,T.circle(0,M,F*1.2).fill({color:0,alpha:.6}).stroke({width:n+F/2.4,color:this.bonesColor})}let a=n*3;e.skeletonXY.context.moveTo(o-a,l-a).lineTo(o+a,l+a).moveTo(o+a,l-a).lineTo(o-a,l+a).stroke()}drawRegionAttachmentsFunc(t,e,n){let s=t.skeleton.slots;for(let o=0,l=s.length;o<l;o++){let c=s[o];if(!c.bone.active)continue;let a=c.appliedPose.attachment;if(a===null||!(a instanceof ct))continue;let i=new Float32Array(8);a.computeWorldVertices(c,a.getOffsets(c.appliedPose),i,0,2),e.regionAttachmentsShape.poly(Array.from(i.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:n})}drawMeshHullAndMeshTriangles(t,e,n){let r=t.skeleton,s=r.slots;for(let o=0,l=s.length;o<l;o++){let c=s[o];if(!c.bone.active)continue;let a=c.appliedPose.attachment;if(a===null||!(a instanceof Ot))continue;let i=a,h=new Float32Array(i.worldVerticesLength),d=i.triangles,u=i.hullLength;if(i.computeWorldVertices(r,c,0,i.worldVerticesLength,h,0,2),this.drawMeshTriangles)for(let p=0,f=d.length;p<f;p+=3){let g=d[p]*2,b=d[p+1]*2,x=d[p+2]*2;e.meshTrianglesLine.context.moveTo(h[g],h[g+1]).lineTo(h[b],h[b+1]).lineTo(h[x],h[x+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let p=h[u-2],f=h[u-1];for(let g=0,b=u;g<b;g+=2){let x=h[g],y=h[g+1];e.meshHullLine.context.moveTo(x,y).lineTo(p,f),p=x,f=y}}}e.meshHullLine.stroke({width:n,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:n,color:this.meshTrianglesColor})}drawClippingFunc(t,e,n){let r=t.skeleton,s=r.slots;for(let o=0,l=s.length;o<l;o++){let c=s[o];if(!c.bone.active)continue;let a=c.appliedPose.attachment;if(a===null||!(a instanceof xe))continue;let i=a,h=i.worldVerticesLength,d=new Float32Array(h);i.computeWorldVertices(r,c,0,h,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:n,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,n){let r=new bi;r.update(t.skeleton,!0),r.minX!==1/0&&e.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:n,color:this.boundingBoxesRectColor});let s=r.polygons,o=(l,c,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");let i=[],h=n*2;for(let d=0,u=l.length;d<u;d+=2){let p=l[d],f=l[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(p,f,h),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(p,f,h).fill({color:this.boundingBoxesCircleColor}),i.push(p,f)}e.boundingBoxesPolygon.poly(i).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:n,color:this.boundingBoxesPolygonColor})};for(let l=0,c=s.length;l<c;l++){let a=s[l];o(a,0,a.length)}}drawPathsFunc(t,e,n){let r=t.skeleton,s=r.slots;for(let o=0,l=s.length;o<l;o++){let c=s[o];if(!c.bone.active)continue;let a=c.appliedPose.attachment;if(a===null||!(a instanceof Qn))continue;let i=a,h=i.worldVerticesLength,d=new Float32Array(h);i.computeWorldVertices(r,c,0,h,d,0,2);let u=d[2],p=d[3],f=0,g=0;if(i.closed){let b=d[0],x=d[1],y=d[h-2],w=d[h-1];f=d[h-4],g=d[h-3],e.pathsCurve.moveTo(u,p),e.pathsCurve.bezierCurveTo(b,x,y,w,f,g),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(b,x),e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(y,w)}h-=4;for(let b=4;b<h;b+=6){let x=d[b],y=d[b+1],w=d[b+2],k=d[b+3];f=d[b+4],g=d[b+5],e.pathsCurve.moveTo(u,p),e.pathsCurve.bezierCurveTo(x,y,w,k,f,g),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(x,y),e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(w,k),u=f,p=g}}e.pathsCurve.stroke({width:n,color:this.pathsCurveColor}),e.pathsLine.stroke({width:n,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);let e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}};var Sc={};As(Sc,{AlphaTimeline:()=>Di,Animation:()=>Ur,AnimationState:()=>fc,AnimationStateAdapter:()=>Um,AnimationStateData:()=>pc,AtlasAttachmentLoader:()=>Wm,Attachment:()=>Eo,AttachmentTimeline:()=>In,Bone:()=>Bo,BoneData:()=>Ui,BoundingBoxAttachment:()=>mc,ClippingAttachment:()=>dc,ConstraintData:()=>qr,CurveTimeline:()=>rn,CurveTimeline1:()=>sn,CurveTimeline2:()=>To,DeformTimeline:()=>Pi,DrawOrderTimeline:()=>Yn,Event:()=>Wi,EventData:()=>qi,EventQueue:()=>xh,EventTimeline:()=>Wr,EventType:()=>Fd,IkConstraint:()=>gc,IkConstraintData:()=>$i,IkConstraintTimeline:()=>Yi,JitterEffect:()=>Ym,MeshAttachment:()=>Or,PathAttachment:()=>lr,PathConstraint:()=>bc,PathConstraintData:()=>zi,PathConstraintMixTimeline:()=>Oi,PathConstraintPositionTimeline:()=>Li,PathConstraintSpacingTimeline:()=>Ni,PointAttachment:()=>uc,RGB2Timeline:()=>Ri,RGBA2Timeline:()=>Vi,RGBATimeline:()=>Bi,RGBTimeline:()=>Fi,RegionAttachment:()=>wi,RotateTimeline:()=>cr,ScaleTimeline:()=>Ii,ScaleXTimeline:()=>Mi,ScaleYTimeline:()=>vi,ShearTimeline:()=>Ci,ShearXTimeline:()=>Ei,ShearYTimeline:()=>Ti,Skeleton:()=>yc,SkeletonBinary:()=>$m,SkeletonBounds:()=>Gm,SkeletonData:()=>Gi,SkeletonJson:()=>Zm,Skin:()=>ws,SkinEntry:()=>wc,Slot:()=>yi,SlotData:()=>ji,SpacingMode:()=>Fo,Spine:()=>Jm,SwirlEffect:()=>Xm,Timeline:()=>ee,TrackEntry:()=>bh,TransformConstraint:()=>xc,TransformConstraintData:()=>Zi,TransformConstraintTimeline:()=>Xi,TranslateTimeline:()=>Si,TranslateXTimeline:()=>Ai,TranslateYTimeline:()=>ki,VertexAttachment:()=>Pe});var Eo=class{constructor(t){m(this,"name");m(this,"type");if(!t)throw new Error("name cannot be null.");this.name=t}},uh=class uh extends Eo{constructor(e){super(e);m(this,"id",uh.nextID++);m(this,"bones");m(this,"vertices");m(this,"worldVerticesLength",0);m(this,"deformAttachment",this)}computeWorldVerticesOld(e,n){this.computeWorldVertices(e,0,this.worldVerticesLength,n,0,2)}computeWorldVertices(e,n,r,s,o,l){r=o+(r>>1)*l;let c=e.bone.skeleton,a=e.deform,i=this.vertices,h=this.bones;if(!h){a.length>0&&(i=a);let f=e.bone.matrix,g=f.tx,b=f.ty,x=f.a,y=f.c,w=f.b,k=f.d;for(let S=n,I=o;I<r;S+=2,I+=l){let M=i[S],v=i[S+1];s[I]=M*x+v*y+g,s[I+1]=M*w+v*k+b}return}let d=0,u=0;for(let f=0;f<n;f+=2){let g=h[d];d+=g+1,u+=g}let p=c.bones;if(a.length==0)for(let f=o,g=u*3;f<r;f+=l){let b=0,x=0,y=h[d++];for(y+=d;d<y;d++,g+=3){let w=p[h[d]].matrix,k=i[g],S=i[g+1],I=i[g+2];b+=(k*w.a+S*w.c+w.tx)*I,x+=(k*w.b+S*w.d+w.ty)*I}s[f]=b,s[f+1]=x}else{let f=a;for(let g=o,b=u*3,x=u<<1;g<r;g+=l){let y=0,w=0,k=h[d++];for(k+=d;d<k;d++,b+=3,x+=2){let S=p[h[d]].matrix,I=i[b]+f[x],M=i[b+1]+f[x+1],v=i[b+2];y+=(I*S.a+M*S.c+S.tx)*v,w+=(I*S.b+M*S.d+S.ty)*v}s[g]=y,s[g+1]=w}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),Y.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices?(e.vertices=Y.newFloatArray(this.vertices.length),Y.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)):e.vertices=null,e.worldVerticesLength=this.worldVerticesLength,e.deformAttachment=this.deformAttachment}};m(uh,"nextID",0);var Pe=uh;var mc=class A extends Pe{constructor(e){super(e);m(this,"type",1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}};var dc=class A extends Pe{constructor(e){super(e);m(this,"type",6);m(this,"endSlot");m(this,"color",new $(.2275,.2275,.8078,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}};var Or=class A extends Pe{constructor(e){super(e);m(this,"type",2);m(this,"region");m(this,"path");m(this,"regionUVs");m(this,"triangles");m(this,"color",new $(1,1,1,1));m(this,"width");m(this,"height");m(this,"hullLength");m(this,"edges");m(this,"parentMesh");m(this,"tempColor",new $(0,0,0,0))}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new A(this.name);return e.region=this.region,e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Float32Array(this.regionUVs.length),Y.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=new Array(this.triangles.length),Y.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=new Array(this.edges.length),Y.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}newLinkedMesh(){let e=new A(this.name);return e.region=this.region,e.path=this.path,e.color.setFromColor(this.color),e.deformAttachment=this.deformAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e}};var lr=class A extends Pe{constructor(e){super(e);m(this,"type",4);m(this,"lengths");m(this,"closed",!1);m(this,"constantSpeed",!1);m(this,"color",new $(1,1,1,1))}copy(){let e=new A(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),Y.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}};var uc=class A extends Pe{constructor(e){super(e);m(this,"type",5);m(this,"x");m(this,"y");m(this,"rotation");m(this,"color",new $(.38,.94,0,1))}computeWorldPosition(e,n){let r=e.matrix;return n.x=this.x*r.a+this.y*r.c+e.worldX,n.y=this.x*r.b+this.y*r.d+e.worldY,n}computeWorldRotation(e){let n=e.matrix,r=B.cosDeg(this.rotation),s=B.sinDeg(this.rotation),o=r*n.a+s*n.c,l=r*n.b+s*n.d;return Math.atan2(l,o)*B.radDeg}copy(){let e=new A(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}};var yi=class{constructor(t,e){m(this,"blendMode");m(this,"data");m(this,"bone");m(this,"color");m(this,"darkColor");m(this,"attachment");m(this,"attachmentTime");m(this,"attachmentState");m(this,"deform",new Array);if(t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new $,this.darkColor=t.darkColor==null?null:new $,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};var rt=class rt extends Eo{constructor(e){super(e);m(this,"type",0);m(this,"x",0);m(this,"y",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"rotation",0);m(this,"width",0);m(this,"height",0);m(this,"color",new $(1,1,1,1));m(this,"path");m(this,"rendererObject");m(this,"region");m(this,"offset",Y.newFloatArray(8));m(this,"uvs",Y.newFloatArray(8));m(this,"tempColor",new $(1,1,1,1))}updateOffset(){let e=this.width/this.region.originalWidth*this.scaleX,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*e,s=-this.height/2*this.scaleY+this.region.offsetY*n,o=r+this.region.width*e,l=s+this.region.height*n,c=this.rotation*Math.PI/180,a=Math.cos(c),i=Math.sin(c),h=r*a+this.x,d=r*i,u=s*a+this.y,p=s*i,f=o*a+this.x,g=o*i,b=l*a+this.y,x=l*i,y=this.offset;y[rt.OX1]=h-p,y[rt.OY1]=u+d,y[rt.OX2]=h-x,y[rt.OY2]=b+d,y[rt.OX3]=f-x,y[rt.OY3]=b+g,y[rt.OX4]=f-p,y[rt.OY4]=u+g}setRegion(e){this.region=e;let n=this.uvs;e.degrees==90?(n[2]=e.u,n[3]=e.v2,n[4]=e.u,n[5]=e.v,n[6]=e.u2,n[7]=e.v,n[0]=e.u2,n[1]=e.v2):(n[0]=e.u,n[1]=e.v2,n[2]=e.u,n[3]=e.v,n[4]=e.u2,n[5]=e.v,n[6]=e.u2,n[7]=e.v2)}computeWorldVertices(e,n,r,s){let o=this.offset,l=e instanceof yi?e.bone.matrix:e.matrix,c=l.tx,a=l.ty,i=l.a,h=l.c,d=l.b,u=l.d,p=0,f=0;p=o[rt.OX1],f=o[rt.OY1],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[rt.OX2],f=o[rt.OY2],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[rt.OX3],f=o[rt.OY3],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a,r+=s,p=o[rt.OX4],f=o[rt.OY4],n[r]=p*i+f*h+c,n[r+1]=p*d+f*u+a}copy(){let e=new rt(this.name);return e.region=this.region,e.rendererObject=this.rendererObject,e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,Y.arrayCopy(this.uvs,0,e.uvs,0,8),Y.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e}};m(rt,"OX1",0),m(rt,"OY1",1),m(rt,"OX2",2),m(rt,"OY2",3),m(rt,"OX3",4),m(rt,"OY3",5),m(rt,"OX4",6),m(rt,"OY4",7),m(rt,"X1",0),m(rt,"Y1",1),m(rt,"C1R",2),m(rt,"C1G",3),m(rt,"C1B",4),m(rt,"C1A",5),m(rt,"U1",6),m(rt,"V1",7),m(rt,"X2",8),m(rt,"Y2",9),m(rt,"C2R",10),m(rt,"C2G",11),m(rt,"C2B",12),m(rt,"C2A",13),m(rt,"U2",14),m(rt,"V2",15),m(rt,"X3",16),m(rt,"Y3",17),m(rt,"C3R",18),m(rt,"C3G",19),m(rt,"C3B",20),m(rt,"C3A",21),m(rt,"U3",22),m(rt,"V3",23),m(rt,"X4",24),m(rt,"Y4",25),m(rt,"C4R",26),m(rt,"C4G",27),m(rt,"C4B",28),m(rt,"C4A",29),m(rt,"U4",30),m(rt,"V4",31);var wi=rt;var Ym=class{constructor(t,e){m(this,"jitterX",0);m(this,"jitterY",0);this.jitterX=t,this.jitterY=e}begin(t){}transform(t,e,n,r){t.x+=B.randomTriangular(-this.jitterX,this.jitterY),t.y+=B.randomTriangular(-this.jitterX,this.jitterY)}end(){}};var fh=class fh{constructor(t){m(this,"centerX",0);m(this,"centerY",0);m(this,"radius",0);m(this,"angle",0);m(this,"worldX",0);m(this,"worldY",0);this.radius=t}begin(t){this.worldX=t.x+this.centerX,this.worldY=t.y+this.centerY}transform(t,e,n,r){let s=this.angle*B.degreesToRadians,o=t.x-this.worldX,l=t.y-this.worldY,c=Math.sqrt(o*o+l*l);if(c<this.radius){let a=fh.interpolation.apply(0,s,(this.radius-c)/this.radius),i=Math.cos(a),h=Math.sin(a);t.x=i*o-h*l+this.worldX,t.y=h*o+i*l+this.worldY}}end(){}};m(fh,"interpolation",new mr(2));var Xm=fh;var Ur=class{constructor(t,e,n){m(this,"name");m(this,"timelines",null);m(this,"timelineIds",null);m(this,"duration");if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=n}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds=new vn;for(let 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,n,r,s,o,l,c){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(n%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let i=0,h=a.length;i<h;i++)a[i].apply(t,e,n,s,o,l,c)}},Yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18},ee=class{constructor(t,e){m(this,"propertyIds",null);m(this,"frames",null);this.propertyIds=e,this.frames=Y.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 n=t.length;for(let r=1;r<n;r++)if(t[r]>e)return r-1;return n-1}static search(t,e,n){let r=t.length;for(let s=n;s<r;s+=n)if(t[s]>e)return s-n;return r-n}},rn=class extends ee{constructor(e,n,r){super(e,r);m(this,"curves",null);this.curves=Y.newFloatArray(e+n*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let n=this.getFrameCount()+e*18;if(this.curves.length>n){let r=Y.newFloatArray(n);Y.arrayCopy(this.curves,0,r,0,n),this.curves=r}}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r==0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=(o-c*2+i)*.03,b=((l-a)*3-s+h)*.006,x=((c-i)*3-o+d)*.006,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=(c-o)*.3+g+x*.16666667,I=s+k,M=o+S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getBezierValue(e,n,r,s){let o=this.curves;if(o[s]>e){let i=this.frames[n],h=this.frames[n+r];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}let l=s+18;for(s+=2;s<l;s+=2)if(o[s]>=e){let i=o[s-2],h=o[s-1];return h+(e-i)/(o[s]-i)*(o[s+1]-h)}n+=this.getFrameEntries();let c=o[l-2],a=o[l-1];return a+(e-c)/(this.frames[n]-c)*(this.frames[n+r]-a)}},sn=class extends rn{constructor(t,e,n){super(t,e,[n])}getFrameEntries(){return 2}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}getCurveValue(t){let e=this.frames,n=e.length-2;for(let s=2;s<=n;s+=2)if(e[s]>t){n=s-2;break}let r=this.curves[n>>1];switch(r){case 0:let s=e[n],o=e[n+1];return o+(t-s)/(e[n+2]-s)*(e[n+2+1]-o);case 1:return e[n+1]}return this.getBezierValue(t,n,1,r-2)}},To=class extends rn{constructor(t,e,n,r){super(t,e,[n,r])}getFrameEntries(){return 3}setFrame(t,e,n,r){t*=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r}},cr=class extends sn{constructor(e,n,r){super(e,n,`${Yt.rotate}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.rotation=a.data.rotation;return;case 1:a.rotation+=(a.data.rotation-a.rotation)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.rotation=a.data.rotation+h*o;break;case 1:case 2:h+=a.data.rotation-a.rotation;case 3:a.rotation+=h*o}}},Si=class extends To{constructor(e,n,r){super(e,n,`${Yt.x}|${r}`,`${Yt.y}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*o,a.y+=(a.data.y-a.y)*o}return}let h=0,d=0,u=ee.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}switch(l){case 0:a.x=a.data.x+h*o,a.y=a.data.y+d*o;break;case 1:case 2:a.x+=(a.data.x+h-a.x)*o,a.y+=(a.data.y+d-a.y)*o;break;case 3:a.x+=h*o,a.y+=d*o}}},Ai=class extends sn{constructor(e,n,r){super(e,n,`${Yt.x}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.x=a.data.x;return;case 1:a.x+=(a.data.x-a.x)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.x=a.data.x+h*o;break;case 1:case 2:a.x+=(a.data.x+h-a.x)*o;break;case 3:a.x+=h*o}}},ki=class extends sn{constructor(e,n,r){super(e,n,`${Yt.y}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.y=a.data.y;return;case 1:a.y+=(a.data.y-a.y)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.y=a.data.y+h*o;break;case 1:case 2:a.y+=(a.data.y+h-a.y)*o;break;case 3:a.y+=h*o}}},Ii=class extends To{constructor(e,n,r){super(e,n,`${Yt.scaleX}|${r}`,`${Yt.scaleY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*o,a.scaleY+=(a.data.scaleY-a.scaleY)*o}return}let h,d,u=ee.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}if(h*=a.data.scaleX,d*=a.data.scaleY,o==1)l==3?(a.scaleX+=h-a.data.scaleX,a.scaleY+=d-a.data.scaleY):(a.scaleX=h,a.scaleY=d);else{let f=0,g=0;if(c==1)switch(l){case 0:f=a.data.scaleX,g=a.data.scaleY,a.scaleX=f+(Math.abs(h)*B.signum(f)-f)*o,a.scaleY=g+(Math.abs(d)*B.signum(g)-g)*o;break;case 1:case 2:f=a.scaleX,g=a.scaleY,a.scaleX=f+(Math.abs(h)*B.signum(f)-f)*o,a.scaleY=g+(Math.abs(d)*B.signum(g)-g)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o,a.scaleY+=(d-a.data.scaleY)*o}else switch(l){case 0:f=Math.abs(a.data.scaleX)*B.signum(h),g=Math.abs(a.data.scaleY)*B.signum(d),a.scaleX=f+(h-f)*o,a.scaleY=g+(d-g)*o;break;case 1:case 2:f=Math.abs(a.scaleX)*B.signum(h),g=Math.abs(a.scaleY)*B.signum(d),a.scaleX=f+(h-f)*o,a.scaleY=g+(d-g)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o,a.scaleY+=(d-a.data.scaleY)*o}}}},Mi=class extends sn{constructor(e,n,r){super(e,n,`${Yt.scaleX}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleX=a.data.scaleX;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*o}return}let h=this.getCurveValue(r)*a.data.scaleX;if(o==1)l==3?a.scaleX+=h-a.data.scaleX:a.scaleX=h;else{let d=0;if(c==1)switch(l){case 0:d=a.data.scaleX,a.scaleX=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 1:case 2:d=a.scaleX,a.scaleX=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o}else switch(l){case 0:d=Math.abs(a.data.scaleX)*B.signum(h),a.scaleX=d+(h-d)*o;break;case 1:case 2:d=Math.abs(a.scaleX)*B.signum(h),a.scaleX=d+(h-d)*o;break;case 3:a.scaleX+=(h-a.data.scaleX)*o}}}},vi=class extends sn{constructor(e,n,r){super(e,n,`${Yt.scaleY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.scaleY=a.data.scaleY;return;case 1:a.scaleY+=(a.data.scaleY-a.scaleY)*o}return}let h=this.getCurveValue(r)*a.data.scaleY;if(o==1)l==3?a.scaleY+=h-a.data.scaleY:a.scaleY=h;else{let d=0;if(c==1)switch(l){case 0:d=a.data.scaleY,a.scaleY=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 1:case 2:d=a.scaleY,a.scaleY=d+(Math.abs(h)*B.signum(d)-d)*o;break;case 3:a.scaleY+=(h-a.data.scaleY)*o}else switch(l){case 0:d=Math.abs(a.data.scaleY)*B.signum(h),a.scaleY=d+(h-d)*o;break;case 1:case 2:d=Math.abs(a.scaleY)*B.signum(h),a.scaleY=d+(h-d)*o;break;case 3:a.scaleY+=(h-a.data.scaleY)*o}}}},Ci=class extends To{constructor(e,n,r){super(e,n,`${Yt.shearX}|${r}`,`${Yt.shearY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*o,a.shearY+=(a.data.shearY-a.shearY)*o}return}let h=0,d=0,u=ee.search(i,r,3),p=this.curves[u/3];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+3]-f);h+=(i[u+3+1]-h)*g,d+=(i[u+3+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}switch(l){case 0:a.shearX=a.data.shearX+h*o,a.shearY=a.data.shearY+d*o;break;case 1:case 2:a.shearX+=(a.data.shearX+h-a.shearX)*o,a.shearY+=(a.data.shearY+d-a.shearY)*o;break;case 3:a.shearX+=h*o,a.shearY+=d*o}}},Ei=class extends sn{constructor(e,n,r){super(e,n,`${Yt.shearX}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearX=a.data.shearX;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.shearX=a.data.shearX+h*o;break;case 1:case 2:a.shearX+=(a.data.shearX+h-a.shearX)*o;break;case 3:a.shearX+=h*o}}},Ti=class extends sn{constructor(e,n,r){super(e,n,`${Yt.shearY}|${r}`);m(this,"boneIndex",0);this.boneIndex=r}apply(e,n,r,s,o,l,c){let a=e.bones[this.boneIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.shearY=a.data.shearY;return;case 1:a.shearY+=(a.data.shearY-a.shearY)*o}return}let h=this.getCurveValue(r);switch(l){case 0:a.shearY=a.data.shearY+h*o;break;case 1:case 2:a.shearY+=(a.data.shearY+h-a.shearY)*o;break;case 3:a.shearY+=h*o}}},Bi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.rgb}|${r}`,`${Yt.alpha}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 5}setFrame(e,n,r,s,o,l){e*=5,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color;if(r<i[0]){let x=a.data.color;switch(l){case 0:h.setFromColor(x);return;case 1:h.add((x.r-h.r)*o,(x.g-h.g)*o,(x.b-h.b)*o,(x.a-h.a)*o)}return}let d=0,u=0,p=0,f=0,g=ee.search(i,r,5),b=this.curves[g/5];switch(b){case 0:let x=i[g];d=i[g+1],u=i[g+2],p=i[g+3],f=i[g+4];let y=(r-x)/(i[g+5]-x);d+=(i[g+5+1]-d)*y,u+=(i[g+5+2]-u)*y,p+=(i[g+5+3]-p)*y,f+=(i[g+5+4]-f)*y;break;case 1:d=i[g+1],u=i[g+2],p=i[g+3],f=i[g+4];break;default:d=this.getBezierValue(r,g,1,b-2),u=this.getBezierValue(r,g,2,b+18-2),p=this.getBezierValue(r,g,3,b+18*2-2),f=this.getBezierValue(r,g,4,b+18*3-2)}o==1?h.set(d,u,p,f):(l==0&&h.setFromColor(a.data.color),h.add((d-h.r)*o,(u-h.g)*o,(p-h.b)*o,(f-h.a)*o))}},Fi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.rgb}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 4}setFrame(e,n,r,s,o){e<<=2,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color;if(r<i[0]){let b=a.data.color;switch(l){case 0:h.r=b.r,h.g=b.g,h.b=b.b;return;case 1:h.r+=(b.r-h.r)*o,h.g+=(b.g-h.g)*o,h.b+=(b.b-h.b)*o}return}let d=0,u=0,p=0,f=ee.search(i,r,4),g=this.curves[f>>2];switch(g){case 0:let b=i[f];d=i[f+1],u=i[f+2],p=i[f+3];let x=(r-b)/(i[f+4]-b);d+=(i[f+4+1]-d)*x,u+=(i[f+4+2]-u)*x,p+=(i[f+4+3]-p)*x;break;case 1:d=i[f+1],u=i[f+2],p=i[f+3];break;default:d=this.getBezierValue(r,f,1,g-2),u=this.getBezierValue(r,f,2,g+18-2),p=this.getBezierValue(r,f,3,g+18*2-2)}if(o==1)h.r=d,h.g=u,h.b=p;else{if(l==0){let b=a.data.color;h.r=b.r,h.g=b.g,h.b=b.b}h.r+=(d-h.r)*o,h.g+=(u-h.g)*o,h.b+=(p-h.b)*o}}},Di=class extends sn{constructor(e,n,r){super(e,n,`${Yt.alpha}|${r}`);m(this,"slotIndex",0);this.slotIndex=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.color;if(r<this.frames[0]){let d=a.data.color;switch(l){case 0:i.a=d.a;return;case 1:i.a+=(d.a-i.a)*o}return}let h=this.getCurveValue(r);o==1?i.a=h:(l==0&&(i.a=a.data.color.a),i.a+=(h-i.a)*o)}},Vi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.rgb}|${r}`,`${Yt.alpha}|${r}`,`${Yt.rgb2}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 8}setFrame(e,n,r,s,o,l,c,a,i){e<<=3,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l,this.frames[e+5]=c,this.frames[e+6]=a,this.frames[e+7]=i}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color,d=a.darkColor;if(r<i[0]){let S=a.data.color,I=a.data.darkColor;switch(l){case 0:h.setFromColor(S),d.r=I.r,d.g=I.g,d.b=I.b;return;case 1:h.add((S.r-h.r)*o,(S.g-h.g)*o,(S.b-h.b)*o,(S.a-h.a)*o),d.r+=(I.r-d.r)*o,d.g+=(I.g-d.g)*o,d.b+=(I.b-d.b)*o}return}let u=0,p=0,f=0,g=0,b=0,x=0,y=0,w=ee.search(i,r,8),k=this.curves[w>>3];switch(k){case 0:let S=i[w];u=i[w+1],p=i[w+2],f=i[w+3],g=i[w+4],b=i[w+5],x=i[w+6],y=i[w+7];let I=(r-S)/(i[w+8]-S);u+=(i[w+8+1]-u)*I,p+=(i[w+8+2]-p)*I,f+=(i[w+8+3]-f)*I,g+=(i[w+8+4]-g)*I,b+=(i[w+8+5]-b)*I,x+=(i[w+8+6]-x)*I,y+=(i[w+8+7]-y)*I;break;case 1:u=i[w+1],p=i[w+2],f=i[w+3],g=i[w+4],b=i[w+5],x=i[w+6],y=i[w+7];break;default:u=this.getBezierValue(r,w,1,k-2),p=this.getBezierValue(r,w,2,k+18-2),f=this.getBezierValue(r,w,3,k+18*2-2),g=this.getBezierValue(r,w,4,k+18*3-2),b=this.getBezierValue(r,w,5,k+18*4-2),x=this.getBezierValue(r,w,6,k+18*5-2),y=this.getBezierValue(r,w,7,k+18*6-2)}if(o==1)h.set(u,p,f,g),d.r=b,d.g=x,d.b=y;else{if(l==0){h.setFromColor(a.data.color);let S=a.data.darkColor;d.r=S.r,d.g=S.g,d.b=S.b}h.add((u-h.r)*o,(p-h.g)*o,(f-h.b)*o,(g-h.a)*o),d.r+=(b-d.r)*o,d.g+=(x-d.g)*o,d.b+=(y-d.b)*o}}},Ri=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.rgb}|${r}`,`${Yt.rgb2}|${r}`]);m(this,"slotIndex",0);this.slotIndex=r}getFrameEntries(){return 7}setFrame(e,n,r,s,o,l,c,a){e*=7,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l,this.frames[e+5]=c,this.frames[e+6]=a}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=this.frames,h=a.color,d=a.darkColor;if(r<i[0]){let k=a.data.color,S=a.data.darkColor;switch(l){case 0:h.r=k.r,h.g=k.g,h.b=k.b,d.r=S.r,d.g=S.g,d.b=S.b;return;case 1:h.r+=(k.r-h.r)*o,h.g+=(k.g-h.g)*o,h.b+=(k.b-h.b)*o,d.r+=(S.r-d.r)*o,d.g+=(S.g-d.g)*o,d.b+=(S.b-d.b)*o}return}let u=0,p=0,f=0,g=0,b=0,x=0,y=ee.search(i,r,7),w=this.curves[y/7];switch(w){case 0:let k=i[y];u=i[y+1],p=i[y+2],f=i[y+3],g=i[y+4],b=i[y+5],x=i[y+6];let S=(r-k)/(i[y+7]-k);u+=(i[y+7+1]-u)*S,p+=(i[y+7+2]-p)*S,f+=(i[y+7+3]-f)*S,g+=(i[y+7+4]-g)*S,b+=(i[y+7+5]-b)*S,x+=(i[y+7+6]-x)*S;break;case 1:u=i[y+1],p=i[y+2],f=i[y+3],g=i[y+4],b=i[y+5],x=i[y+6];break;default:u=this.getBezierValue(r,y,1,w-2),p=this.getBezierValue(r,y,2,w+18-2),f=this.getBezierValue(r,y,3,w+18*2-2),g=this.getBezierValue(r,y,4,w+18*3-2),b=this.getBezierValue(r,y,5,w+18*4-2),x=this.getBezierValue(r,y,6,w+18*5-2)}if(o==1)h.r=u,h.g=p,h.b=f,d.r=g,d.g=b,d.b=x;else{if(l==0){let k=a.data.color,S=a.data.darkColor;h.r=k.r,h.g=k.g,h.b=k.b,d.r=S.r,d.g=S.g,d.b=S.b}h.r+=(u-h.r)*o,h.g+=(p-h.g)*o,h.b+=(f-h.b)*o,d.r+=(g-d.r)*o,d.g+=(b-d.g)*o,d.b+=(x-d.b)*o}}},In=class extends ee{constructor(e,n){super(e,[`${Yt.attachment}|${n}`]);m(this,"slotIndex",0);m(this,"attachmentNames");this.slotIndex=n,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.attachmentNames[e]=r}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(a.bone.active){if(c==1){l==0&&this.setAttachment(e,a,a.data.attachmentName);return}if(r<this.frames[0]){(l==0||l==1)&&this.setAttachment(e,a,a.data.attachmentName);return}this.setAttachment(e,a,this.attachmentNames[ee.search1(this.frames,r)])}}setAttachment(e,n,r){n.setAttachment(r?e.getAttachment(this.slotIndex,r):null)}},Pi=class extends rn{constructor(e,n,r,s){super(e,n,[`${Yt.deform}|${r}|${s.id}`]);m(this,"slotIndex",0);m(this,"attachment",null);m(this,"vertices",null);this.slotIndex=r,this.attachment=s,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.vertices[e]=r}setBezier(e,n,r,s,o,l,c,a,i,h,d){let u=this.curves,p=this.getFrameCount()+e*18;r==0&&(u[n]=2+p);let f=(s-l*2+a)*.03,g=i*.03-c*.06,b=((l-a)*3-s+h)*.006,x=(c-i+.33333333)*.018,y=f*2+b,w=g*2+x,k=(l-s)*.3+f+b*.16666667,S=c*.3+g+x*.16666667,I=s+k,M=S;for(let v=p+18;p<v;p+=2)u[p]=I,u[p+1]=M,k+=y,S+=w,y+=b,w+=x,I+=k,M+=S}getCurvePercent(e,n){let r=this.curves,s=r[n];switch(s){case 0:let a=this.frames[n];return(e-a)/(this.frames[n+this.getFrameEntries()]-a);case 1:return 0}if(s-=2,r[s]>e){let a=this.frames[n];return r[s+1]*(e-a)/(r[s]-a)}let o=s+18;for(s+=2;s<o;s+=2)if(r[s]>=e){let a=r[s-2],i=r[s-1];return i+(e-a)/(r[s]-a)*(r[s+1]-i)}let l=r[o-2],c=r[o-1];return c+(1-c)*(e-l)/(this.frames[n+this.getFrameEntries()]-l)}apply(e,n,r,s,o,l,c){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let i=a.getAttachment();if(!(i instanceof Pe)||i.deformAttachment!=this.attachment)return;let h=a.deform;h.length==0&&(l=0);let d=this.vertices,u=d[0].length,p=this.frames;if(r<p[0]){let y=i;switch(l){case 0:h.length=0;return;case 1:if(o==1){h.length=0;return}if(h.length=u,y.bones){o=1-o;for(let w=0;w<u;w++)h[w]*=o}else{let w=y.vertices;for(let k=0;k<u;k++)h[k]+=(w[k]-h[k])*o}}return}if(h.length=u,r>=p[p.length-1]){let y=d[p.length-1];if(o==1)if(l==3){let w=i;if(w.bones)for(let k=0;k<u;k++)h[k]+=y[k];else{let k=w.vertices;for(let S=0;S<u;S++)h[S]+=y[S]-k[S]}}else Y.arrayCopy(y,0,h,0,u);else switch(l){case 0:{let k=i;if(k.bones)for(let S=0;S<u;S++)h[S]=y[S]*o;else{let S=k.vertices;for(let I=0;I<u;I++){let M=S[I];h[I]=M+(y[I]-M)*o}}break}case 1:case 2:for(let k=0;k<u;k++)h[k]+=(y[k]-h[k])*o;break;case 3:let w=i;if(w.bones)for(let k=0;k<u;k++)h[k]+=y[k]*o;else{let k=w.vertices;for(let S=0;S<u;S++)h[S]+=(y[S]-k[S])*o}}return}let f=ee.search1(p,r),g=this.getCurvePercent(r,f),b=d[f],x=d[f+1];if(o==1)if(l==3){let y=i;if(y.bones)for(let w=0;w<u;w++){let k=b[w];h[w]+=k+(x[w]-k)*g}else{let w=y.vertices;for(let k=0;k<u;k++){let S=b[k];h[k]+=S+(x[k]-S)*g-w[k]}}}else for(let y=0;y<u;y++){let w=b[y];h[y]=w+(x[y]-w)*g}else switch(l){case 0:{let w=i;if(w.bones)for(let k=0;k<u;k++){let S=b[k];h[k]=(S+(x[k]-S)*g)*o}else{let k=w.vertices;for(let S=0;S<u;S++){let I=b[S],M=k[S];h[S]=M+(I+(x[S]-I)*g-M)*o}}break}case 1:case 2:for(let w=0;w<u;w++){let k=b[w];h[w]+=(k+(x[w]-k)*g-h[w])*o}break;case 3:let y=i;if(y.bones)for(let w=0;w<u;w++){let k=b[w];h[w]+=(k+(x[w]-k)*g)*o}else{let w=y.vertices;for(let k=0;k<u;k++){let S=b[k];h[k]+=(S+(x[k]-S)*g-w[k])*o}}}}},ph=class ph extends ee{constructor(e){super(e,ph.propertyIds);m(this,"events",null);this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n){this.frames[e]=n.time,this.events[e]=n}apply(e,n,r,s,o,l,c){if(!s)return;let a=this.frames,i=this.frames.length;if(n>r)this.apply(e,n,Number.MAX_VALUE,s,o,l,c),n=-1;else if(n>=a[i-1])return;if(r<a[0])return;let h=0;if(n<a[0])h=0;else{h=ee.search1(a,n)+1;let d=a[h];for(;h>0&&a[h-1]==d;)h--}for(;h<i&&r>=a[h];h++)s.push(this.events[h])}};m(ph,"propertyIds",[`${Yt.event}`]);var Wr=ph,gh=class gh extends ee{constructor(e){super(e,gh.propertyIds);m(this,"drawOrders",null);this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,n,r){this.frames[e]=n,this.drawOrders[e]=r}apply(e,n,r,s,o,l,c){if(c==1){l==0&&Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(l==0||l==1)&&Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=this.drawOrders[ee.search1(this.frames,r)];if(!a)Y.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let i=e.drawOrder,h=e.slots;for(let d=0,u=a.length;d<u;d++)i[d]=h[a[d]]}}};m(gh,"propertyIds",[`${Yt.drawOrder}`]);var Yn=gh,Yi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.ikConstraint}|${r}`]);m(this,"ikConstraintIndex",0);this.ikConstraintIndex=r}getFrameEntries(){return 6}setFrame(e,n,r,s,o,l,c){e*=6,this.frames[e]=n,this.frames[e+1]=r,this.frames[e+2]=s,this.frames[e+3]=o,this.frames[e+4]=l?1:0,this.frames[e+5]=c?1:0}apply(e,n,r,s,o,l,c){let a=e.ikConstraints[this.ikConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*o,a.softness+=(a.data.softness-a.softness)*o,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let h=0,d=0,u=ee.search(i,r,6),p=this.curves[u/6];switch(p){case 0:let f=i[u];h=i[u+1],d=i[u+2];let g=(r-f)/(i[u+6]-f);h+=(i[u+6+1]-h)*g,d+=(i[u+6+2]-d)*g;break;case 1:h=i[u+1],d=i[u+2];break;default:h=this.getBezierValue(r,u,1,p-2),d=this.getBezierValue(r,u,2,p+18-2)}l==0?(a.mix=a.data.mix+(h-a.data.mix)*o,a.softness=a.data.softness+(d-a.data.softness)*o,c==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=i[u+3],a.compress=i[u+4]!=0,a.stretch=i[u+5]!=0)):(a.mix+=(h-a.mix)*o,a.softness+=(d-a.softness)*o,c==0&&(a.bendDirection=i[u+3],a.compress=i[u+4]!=0,a.stretch=i[u+5]!=0))}},Xi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.transformConstraint}|${r}`]);m(this,"transformConstraintIndex",0);this.transformConstraintIndex=r}getFrameEntries(){return 7}setFrame(e,n,r,s,o,l,c,a){let i=this.frames;e*=7,i[e]=n,i[e+1]=r,i[e+2]=s,i[e+3]=o,i[e+4]=l,i[e+5]=c,i[e+6]=a}apply(e,n,r,s,o,l,c){let a=e.transformConstraints[this.transformConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){let y=a.data;switch(l){case 0:a.mixRotate=y.mixRotate,a.mixX=y.mixX,a.mixY=y.mixY,a.mixScaleX=y.mixScaleX,a.mixScaleY=y.mixScaleY,a.mixShearY=y.mixShearY;return;case 1:a.mixRotate+=(y.mixRotate-a.mixRotate)*o,a.mixX+=(y.mixX-a.mixX)*o,a.mixY+=(y.mixY-a.mixY)*o,a.mixScaleX+=(y.mixScaleX-a.mixScaleX)*o,a.mixScaleY+=(y.mixScaleY-a.mixScaleY)*o,a.mixShearY+=(y.mixShearY-a.mixShearY)*o}return}let h,d,u,p,f,g,b=ee.search(i,r,7),x=this.curves[b/7];switch(x){case 0:let y=i[b];h=i[b+1],d=i[b+2],u=i[b+3],p=i[b+4],f=i[b+5],g=i[b+6];let w=(r-y)/(i[b+7]-y);h+=(i[b+7+1]-h)*w,d+=(i[b+7+2]-d)*w,u+=(i[b+7+3]-u)*w,p+=(i[b+7+4]-p)*w,f+=(i[b+7+5]-f)*w,g+=(i[b+7+6]-g)*w;break;case 1:h=i[b+1],d=i[b+2],u=i[b+3],p=i[b+4],f=i[b+5],g=i[b+6];break;default:h=this.getBezierValue(r,b,1,x-2),d=this.getBezierValue(r,b,2,x+18-2),u=this.getBezierValue(r,b,3,x+18*2-2),p=this.getBezierValue(r,b,4,x+18*3-2),f=this.getBezierValue(r,b,5,x+18*4-2),g=this.getBezierValue(r,b,6,x+18*5-2)}if(l==0){let y=a.data;a.mixRotate=y.mixRotate+(h-y.mixRotate)*o,a.mixX=y.mixX+(d-y.mixX)*o,a.mixY=y.mixY+(u-y.mixY)*o,a.mixScaleX=y.mixScaleX+(p-y.mixScaleX)*o,a.mixScaleY=y.mixScaleY+(f-y.mixScaleY)*o,a.mixShearY=y.mixShearY+(g-y.mixShearY)*o}else a.mixRotate+=(h-a.mixRotate)*o,a.mixX+=(d-a.mixX)*o,a.mixY+=(u-a.mixY)*o,a.mixScaleX+=(p-a.mixScaleX)*o,a.mixScaleY+=(f-a.mixScaleY)*o,a.mixShearY+=(g-a.mixShearY)*o}},Li=class extends sn{constructor(e,n,r){super(e,n,`${Yt.pathConstraintPosition}|${r}`);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.position=a.data.position;return;case 1:a.position+=(a.data.position-a.position)*o}return}let h=this.getCurveValue(r);l==0?a.position=a.data.position+(h-a.data.position)*o:a.position+=(h-a.position)*o}},Ni=class extends sn{constructor(e,n,r){super(e,n,`${Yt.pathConstraintSpacing}|${r}`);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.spacing=a.data.spacing;return;case 1:a.spacing+=(a.data.spacing-a.spacing)*o}return}let h=this.getCurveValue(r);l==0?a.spacing=a.data.spacing+(h-a.data.spacing)*o:a.spacing+=(h-a.spacing)*o}},Oi=class extends rn{constructor(e,n,r){super(e,n,[`${Yt.pathConstraintMix}|${r}`]);m(this,"pathConstraintIndex",0);this.pathConstraintIndex=r}getFrameEntries(){return 4}setFrame(e,n,r,s,o){let l=this.frames;e<<=2,l[e]=n,l[e+1]=r,l[e+2]=s,l[e+3]=o}apply(e,n,r,s,o,l,c){let a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;let i=this.frames;if(r<i[0]){switch(l){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*o,a.mixX+=(a.data.mixX-a.mixX)*o,a.mixY+=(a.data.mixY-a.mixY)*o}return}let h,d,u,p=ee.search(i,r,4),f=this.curves[p>>2];switch(f){case 0:let g=i[p];h=i[p+1],d=i[p+2],u=i[p+3];let b=(r-g)/(i[p+4]-g);h+=(i[p+4+1]-h)*b,d+=(i[p+4+2]-d)*b,u+=(i[p+4+3]-u)*b;break;case 1:h=i[p+1],d=i[p+2],u=i[p+3];break;default:h=this.getBezierValue(r,p,1,f-2),d=this.getBezierValue(r,p,2,f+18-2),u=this.getBezierValue(r,p,3,f+18*2-2)}if(l==0){let g=a.data;a.mixRotate=g.mixRotate+(h-g.mixRotate)*o,a.mixX=g.mixX+(d-g.mixX)*o,a.mixY=g.mixY+(u-g.mixY)*o}else a.mixRotate+=(h-a.mixRotate)*o,a.mixX+=(d-a.mixX)*o,a.mixY+=(u-a.mixY)*o}};var an=class an{constructor(t){m(this,"data",null);m(this,"tracks",new Array);m(this,"timeScale",1);m(this,"unkeyedState",0);m(this,"events",new Array);m(this,"listeners",new Array);m(this,"queue",new xh(this));m(this,"propertyIDs",new vn);m(this,"animationsChanged",!1);m(this,"trackEntryPool",new qe(()=>new bh));m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd");this.data=t}static emptyAnimation(){return Om||(Om=new Ur("<empty>",[],0)),Om}update(t){t*=this.timeScale;let e=this.tracks;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let o=t*s.timeScale;if(s.delay>0){if(s.delay-=o,s.delay>0)continue;o=-s.delay,s.delay=0}let l=s.next;if(l){let c=s.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime+=s.timeScale==0?0:(c/s.timeScale+t)*l.timeScale,s.trackTime+=o,this.setCurrent(n,l,!0);l.mixingFrom;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&!s.mixingFrom){e[n]=null,this.queue.end(s),this.clearNext(s);continue}if(s.mixingFrom&&this.updateMixingFrom(s,t)){let c=s.mixingFrom;for(s.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}s.trackTime+=o}this.queue.drain()}updateMixingFrom(t,e){let n=t.mixingFrom;if(!n)return!0;let r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((n.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,n=this.tracks,r=!1;for(let l=0,c=n.length;l<c;l++){let a=n[l];if(!a||a.delay>0)continue;r=!0;let i=l==0?1:a.mixBlend,h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,i):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,u=a.getAnimationTime(),p=u,f=e;a.reverse&&(p=a.animation.duration-p,f=null);let g=a.animation.timelines,b=g.length;if(l==0&&h==1||i==3)for(let x=0;x<b;x++){Y.webkit602BugfixHelper(h,i);let y=g[x];y instanceof In?this.applyAttachmentTimeline(y,t,p,i,!0):y.apply(t,d,p,f,h,i,0)}else{let x=a.timelineMode,y=a.timelinesRotation.length!=b<<1;y&&(a.timelinesRotation.length=b<<1);for(let w=0;w<b;w++){let k=g[w],S=x[w]==Lm?i:0;k instanceof cr?this.applyRotateTimeline(k,t,p,h,S,a.timelinesRotation,w<<1,y):k instanceof In?this.applyAttachmentTimeline(k,t,p,i,!0):(Y.webkit602BugfixHelper(h,i),k.apply(t,d,p,f,h,S,0))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}let s=this.unkeyedState+Bd,o=t.slots;for(let l=0,c=t.slots.length;l<c;l++){let a=o[l];if(a.attachmentState==s){let i=a.data.attachmentName;a.setAttachment(i?t.getAttachment(a.data.index,i):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,n){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,n);let s=0;t.mixDuration==0?(s=1,n==1&&(n=0)):(s=t.mixTime/t.mixDuration,s>1&&(s=1),n!=1&&(n=r.mixBlend));let o=s<r.attachmentThreshold,l=s<r.drawOrderThreshold,c=r.animation.timelines,a=c.length,i=r.alpha*t.interruptAlpha,h=i*(1-s),d=r.animationLast,u=r.getAnimationTime(),p=u,f=null;if(r.reverse?p=r.animation.duration-p:s<r.eventThreshold&&(f=this.events),n==3)for(let g=0;g<a;g++)c[g].apply(e,d,p,f,h,n,1);else{let g=r.timelineMode,b=r.timelineHoldMix,x=r.timelinesRotation.length!=a<<1;x&&(r.timelinesRotation.length=a<<1),r.totalAlpha=0;for(let y=0;y<a;y++){let w=c[y],k=1,S,I=0;switch(g[y]){case Lm:if(!l&&w instanceof Yn)continue;S=n,I=h;break;case Ed:S=0,I=h;break;case Td:S=n,I=i;break;case Nm:S=0,I=i;break;default:S=0;let M=b[y];I=i*Math.max(0,1-M.mixTime/M.mixDuration);break}r.totalAlpha+=I,w instanceof cr?this.applyRotateTimeline(w,e,p,I,S,r.timelinesRotation,y<<1,x):w instanceof In?this.applyAttachmentTimeline(w,e,p,S,o):(Y.webkit602BugfixHelper(I,n),l&&w instanceof Yn&&S==0&&(k=0),w.apply(e,d,p,f,I,S,k))}}return t.mixDuration>0&&this.queueEvents(r,u),this.events.length=0,r.nextAnimationLast=u,r.nextTrackLast=r.trackTime,s}applyAttachmentTimeline(t,e,n,r,s){let o=e.slots[t.slotIndex];o.bone.active&&(n<t.frames[0]?(r==0||r==1)&&this.setAttachment(e,o,o.data.attachmentName,s):this.setAttachment(e,o,t.attachmentNames[ee.search1(t.frames,n)],s),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Bd))}setAttachment(t,e,n,r){e.setAttachment(n?t.getAttachment(e.data.index,n):null),r&&(e.attachmentState=this.unkeyedState+wf)}applyRotateTimeline(t,e,n,r,s,o,l,c){if(c&&(o[l]=0),r==1){t.apply(e,0,n,null,1,s,0);return}let a=e.bones[t.boneIndex];if(!a.active)return;let i=t.frames,h=0,d=0;if(n<i[0])switch(s){case 0:a.rotation=a.data.rotation;default:return;case 1:h=a.rotation,d=a.data.rotation}else h=s==0?a.data.rotation:a.rotation,d=a.data.rotation+t.getCurveValue(n);let u=0,p=d-h;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)u=o[l];else{let f=0,g=0;c?(f=0,g=p):(f=o[l],g=o[l+1]);let b=p>0,x=f>=0;B.signum(g)!=B.signum(p)&&Math.abs(g)<=90&&(Math.abs(f)>180&&(f+=360*B.signum(f)),x=b),u=p+f-f%360,x!=b&&(u+=360*B.signum(f)),o[l]=u}o[l+1]=p,a.rotation=h+u*r}queueEvents(t,e){let n=t.animationStart,r=t.animationEnd,s=r-n,o=t.trackLast%s,l=this.events,c=0,a=l.length;for(;c<a;c++){let h=l[c];if(h.time<o)break;h.time>r||this.queue.event(t,h)}let i=!1;for(t.loop?i=s==0||o>t.trackTime%s:i=e>=r&&t.animationLast<r,i&&this.queue.complete(t);c<a;c++){let h=l[c];h.time<n||this.queue.event(t,h)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e<n;e++)this.clearTrack(e);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 n=e;for(;;){let r=n.mixingFrom;if(!r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(n&&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,n=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,r,n)}setAnimationWith(t,e,n=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,s=this.expandToIndex(t);s&&(s.nextTrackLast==-1?(this.tracks[t]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.clearNext(s),s=s.mixingFrom,r=!1):this.clearNext(s));let o=this.trackEntry(t,e,n,s);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,e,n=!1,r=0){let s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,s,n,r)}addAnimationWith(t,e,n=!1,r=0){if(!e)throw new Error("animation cannot be null.");let s=this.expandToIndex(t);if(s)for(;s.next;)s=s.next;let o=this.trackEntry(t,e,n,s);return s?(s.next=o,o.previous=s,r<=0&&(r+=s.getTrackComplete()-o.mixDuration)):(this.setCurrent(t,o,!0),this.queue.drain()),o.delay=r,o}setEmptyAnimation(t,e=0){let n=this.setAnimationWith(t,an.emptyAnimation(),!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e=0,n=0){let r=this.addAnimationWith(t,an.emptyAnimation(),!1,n);return n<=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 n=0,r=this.tracks.length;n<r;n++){let s=this.tracks[n];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(Y.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,n,r){let s=this.trackEntryPool.obtain();return s.reset(),s.trackIndex=t,s.animation=e,s.loop=n,s.holdPrevious=!1,s.eventThreshold=0,s.attachmentThreshold=0,s.drawOrderThreshold=0,s.animationStart=0,s.animationEnd=e.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.interruptAlpha=1,s.mixTime=0,s.mixDuration=r?this.data.getMix(r.animation,e):0,s.mixBlend=2,s}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,n=t.length;e<n;e++){let r=t[e];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let e=t.mixingTo,n=t.animation.timelines,r=t.animation.timelines.length,s=t.timelineMode;s.length=r;let o=t.timelineHoldMix;o.length=0;let l=this.propertyIDs;if(e&&e.holdPrevious){for(let c=0;c<r;c++)s[c]=l.addAll(n[c].getPropertyIds())?Nm:Td;return}t:for(let c=0;c<r;c++){let a=n[c],i=a.getPropertyIds();if(!l.addAll(i))s[c]=Lm;else if(!e||a instanceof In||a instanceof Yn||a instanceof Wr||!e.animation.hasTimeline(i))s[c]=Ed;else{for(let h=e.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(i)){if(t.mixDuration>0){s[c]=yf,o[c]=h;continue t}break}s[c]=Nm}}}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()}setAnimationByName(t,e,n){an.deprecatedWarning1||(an.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,r){an.deprecatedWarning2||(an.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,r)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return an.deprecatedWarning3||(an.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};m(an,"deprecatedWarning1",!1),m(an,"deprecatedWarning2",!1),m(an,"deprecatedWarning3",!1);var fc=an,Mn=class Mn{constructor(){m(this,"animation",null);m(this,"previous",null);m(this,"next",null);m(this,"mixingFrom",null);m(this,"mixingTo",null);m(this,"listener",null);m(this,"trackIndex",0);m(this,"loop",!1);m(this,"holdPrevious",!1);m(this,"reverse",!1);m(this,"eventThreshold",0);m(this,"attachmentThreshold",0);m(this,"drawOrderThreshold",0);m(this,"animationStart",0);m(this,"animationEnd",0);m(this,"animationLast",0);m(this,"nextAnimationLast",0);m(this,"delay",0);m(this,"trackTime",0);m(this,"trackLast",0);m(this,"nextTrackLast",0);m(this,"trackEnd",0);m(this,"timeScale",0);m(this,"alpha",0);m(this,"mixTime",0);m(this,"mixDuration",0);m(this,"interruptAlpha",0);m(this,"totalAlpha",0);m(this,"mixBlend",2);m(this,"timelineMode",new Array);m(this,"timelineHoldMix",new Array);m(this,"timelinesRotation",new Array);m(this,"onComplete");m(this,"onEvent");m(this,"onStart");m(this,"onEnd")}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 t==0?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(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}get time(){return Mn.deprecatedWarning1||(Mn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){Mn.deprecatedWarning1||(Mn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return Mn.deprecatedWarning2||(Mn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){Mn.deprecatedWarning2||(Mn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};m(Mn,"deprecatedWarning1",!1),m(Mn,"deprecatedWarning2",!1);var bh=Mn,xh=class{constructor(t){m(this,"objects",[]);m(this,"drainDisabled",!1);m(this,"animState",null);this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),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 n=0;n<t.length;n+=2){let r=t[n],s=t[n+1];switch(r){case 0:s.listener&&s.listener.start&&s.listener.start(s);for(let l=0;l<e.length;l++)e[l].start&&e[l].start(s);break;case 1:s.listener&&s.listener.interrupt&&s.listener.interrupt(s);for(let l=0;l<e.length;l++)e[l].interrupt&&e[l].interrupt(s);break;case 2:s.listener&&s.listener.end&&s.listener.end(s);for(let l=0;l<e.length;l++)e[l].end&&e[l].end(s);case 3:s.listener&&s.listener.dispose&&s.listener.dispose(s);for(let l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(s);this.animState.trackEntryPool.free(s);break;case 4:s.listener&&s.listener.complete&&s.listener.complete(s);for(let l=0;l<e.length;l++)e[l].complete&&e[l].complete(s);break;case 5:let o=t[n+++2];s.listener&&s.listener.event&&s.listener.event(s,o);for(let l=0;l<e.length;l++)e[l].event&&e[l].event(s,o);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Fd=(o=>(o[o.start=0]="start",o[o.interrupt=1]="interrupt",o[o.end=2]="end",o[o.dispose=3]="dispose",o[o.complete=4]="complete",o[o.event=5]="event",o))(Fd||{}),Um=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Lm=0,Ed=1,Td=2,Nm=3,yf=4,Bd=1,wf=2,Om=null;var pc=class{constructor(t){m(this,"skeletonData");m(this,"animationToMixTime",{});m(this,"defaultMix",0);if(t==null)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){let r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);let s=this.skeletonData.findAnimation(e);if(s==null)throw new Error(`Animation not found: ${e}`);this.setMixWith(r,s,n)}setMixWith(t,e,n){if(t==null)throw new Error("from cannot be null.");if(e==null)throw new Error("to cannot be null.");let r=`${t.name}.${e.name}`;this.animationToMixTime[r]=n}getMix(t,e){let n=`${t.name}.${e.name}`,r=this.animationToMixTime[n];return r===void 0?this.defaultMix:r}};var Wm=class{constructor(t){m(this,"atlas");this.atlas=t}newRegionAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);let s=new wi(e);return s.region=r,s}newMeshAttachment(t,e,n){let r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);let s=new Or(e);return s.region=r,s}newBoundingBoxAttachment(t,e){return new mc(e)}newPathAttachment(t,e){return new lr(e)}newPointAttachment(t,e){return new uc(e)}newClippingAttachment(t,e){return new dc(e)}};var Dd=ye(ge());var Bo=class{constructor(t,e,n){m(this,"matrix",new Dd.Matrix);m(this,"data",null);m(this,"skeleton",null);m(this,"parent",null);m(this,"children",new Array);m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",0);m(this,"scaleY",0);m(this,"shearX",0);m(this,"shearY",0);m(this,"ax",0);m(this,"ay",0);m(this,"arotation",0);m(this,"ascaleX",0);m(this,"ascaleY",0);m(this,"ashearX",0);m(this,"ashearY",0);m(this,"sorted",!1);m(this,"active",!1);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=n,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){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,n,r,s,o,l){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=o,this.ashearY=l;let c=this.parent,a=this.matrix,i=this.skeleton.scaleX,h=Dt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(!c){let g=this.skeleton,b=n+90+l;a.a=B.cosDeg(n+o)*r*i,a.c=B.cosDeg(b)*s*i,a.b=B.sinDeg(n+o)*r*h,a.d=B.sinDeg(b)*s*h,a.tx=t*i+g.x,a.ty=e*h+g.y;return}let d=c.matrix.a,u=c.matrix.c,p=c.matrix.b,f=c.matrix.d;switch(a.tx=d*t+u*e+c.matrix.tx,a.ty=p*t+f*e+c.matrix.ty,this.data.transformMode){case 0:{let g=n+90+l,b=B.cosDeg(n+o)*r,x=B.cosDeg(g)*s,y=B.sinDeg(n+o)*r,w=B.sinDeg(g)*s;a.a=d*b+u*y,a.c=d*x+u*w,a.b=p*b+f*y,a.d=p*x+f*w;return}case 1:{let g=n+90+l;a.a=B.cosDeg(n+o)*r,a.c=B.cosDeg(g)*s,a.b=B.sinDeg(n+o)*r,a.d=B.sinDeg(g)*s;break}case 2:{let g=d*d+p*p,b=0;g>1e-4?(g=Math.abs(d*f-u*p)/g,d/=i,p/=h,u=p*g,f=d*g,b=Math.atan2(p,d)*B.radDeg):(d=0,p=0,b=90-Math.atan2(f,u)*B.radDeg);let x=n+o-b,y=n+l-b+90,w=B.cosDeg(x)*r,k=B.cosDeg(y)*s,S=B.sinDeg(x)*r,I=B.sinDeg(y)*s;a.a=d*w-u*S,a.c=d*k-u*I,a.b=p*w+f*S,a.d=p*k+f*I;break}case 3:case 4:{let g=B.cosDeg(n),b=B.sinDeg(n),x=(d*g+u*b)/i,y=(p*g+f*b)/h,w=Math.sqrt(x*x+y*y);w>1e-5&&(w=1/w),x*=w,y*=w,w=Math.sqrt(x*x+y*y),this.data.transformMode==3&&d*f-u*p<0!=(i<0!=h<0)&&(w=-w);let k=Math.PI/2+Math.atan2(y,x),S=Math.cos(k)*w,I=Math.sin(k)*w,M=B.cosDeg(o)*r,v=B.cosDeg(90+l)*s,E=B.sinDeg(o)*r,C=B.sinDeg(90+l)*s;a.a=x*M+S*E,a.c=x*v+S*C,a.b=y*M+I*E,a.d=y*v+I*C;break}}a.a*=i,a.c*=i,a.b*=h,a.d*=h}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}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*B.radDeg}getWorldScaleX(){let t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){let t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){let t=this.parent,e=this.matrix;if(!t){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*B.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*B.radDeg;return}let n=t.matrix,r=1/(n.a*n.d-n.b*n.c),s=e.tx-n.tx,o=e.ty-n.ty;this.ax=s*n.d*r-o*n.c*r,this.ay=o*n.a*r-s*n.b*r;let l=r*n.d,c=r*n.a,a=r*n.c,i=r*n.b,h=l*e.a-a*e.b,d=l*e.c-a*e.d,u=c*e.b-i*e.a,p=c*e.d-i*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(h*h+u*u),this.ascaleX>1e-4){let f=h*p-d*u;this.ascaleY=f/this.ascaleX,this.ashearY=Math.atan2(h*d+u*p,f)*B.radDeg,this.arotation=Math.atan2(u,h)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*B.radDeg}worldToLocal(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=1/(n*o-r*s),c=t.x-e.tx,a=t.y-e.ty;return t.x=c*o*l-a*r*l,t.y=a*n*l-c*s*l,t}localToWorld(t){let e=this.matrix,n=t.x,r=t.y;return t.x=n*e.a+r*e.c+e.tx,t.y=n*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*n,r.d*n-r.c*e)*B.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),n=B.cosDeg(t),r=this.matrix;return Math.atan2(n*r.b+e*r.d,n*r.a+e*r.c)*B.radDeg}rotateWorld(t){let e=this.matrix,n=e.a,r=e.c,s=e.b,o=e.d,l=B.cosDeg(t),c=B.sinDeg(t);e.a=l*n-c*s,e.c=l*r-c*o,e.b=c*n+l*s,e.d=c*r+l*o}};var Ui=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"parent");m(this,"length");m(this,"x",0);m(this,"y",0);m(this,"rotation",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"shearX",0);m(this,"shearY",0);m(this,"transformMode",0);m(this,"skinRequired",!1);m(this,"color",new $);if(t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=n}};var qr=class{constructor(t,e,n){this.name=t;this.order=e;this.skinRequired=n}};var Wi=class{constructor(t,e){m(this,"data");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"time");m(this,"volume");m(this,"balance");if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}};var qi=class{constructor(t){m(this,"name");m(this,"intValue");m(this,"floatValue");m(this,"stringValue");m(this,"audioPath");m(this,"volume");m(this,"balance");this.name=t}};var gc=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"bendDirection",0);m(this,"compress",!1);m(this,"stretch",!1);m(this,"mix",1);m(this,"softness",0);m(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}update(){if(this.mix==0)return;let t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,n,r,s,o,l){let c=t.parent.matrix,a=c.a,i=c.c,h=c.b,d=c.d,u=-t.ashearX-t.arotation,p=0,f=0,g=t.skeleton.scaleX,b=Dt.yDown?-t.skeleton.scaleY:t.skeleton.scaleY;switch(t.data.transformMode){case 1:p=e-t.worldX,f=n-t.worldY,Dt.yDown&&(f=-f);break;case 2:let w=Math.abs(a*d-i*h)/(a*a+h*h),k=a/g,S=h/b;i=-S*w*g,d=k*w*b,u+=Math.atan2(S,k)*B.radDeg;default:let I=e-c.tx,M=n-c.ty,v=a*d-i*h;p=(I*d-M*i)/v-t.ax,f=(M*a-I*h)/v-t.ay}u+=Math.atan2(f,p)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let x=t.ascaleX,y=t.ascaleY;if(r||s){switch(t.data.transformMode){case 3:case 4:p=e-t.worldX,f=n-t.worldY}let w=t.data.length*x,k=Math.sqrt(p*p+f*f);if(r&&k<w||s&&k>w&&w>1e-4){let S=(k/w-1)*l+1;x*=S,o&&(y*=S)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,x,y,t.ashearX,t.ashearY)}apply2(t,e,n,r,s,o,l,c,a){let i=t.ax,h=t.ay,d=t.ascaleX,u=t.ascaleY,p=d,f=u,g=e.ascaleX,b=t.matrix,x=0,y=0,w=0;d<0?(d=-d,x=180,w=-1):(x=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,y=180):y=0;let k=e.ax,S=0,I=0,M=0,v=b.a,E=b.c,C=b.b,T=b.d,F=Math.abs(d-u)<=1e-4;!F||o?(S=0,I=v*k+b.tx,M=C*k+b.ty):(S=e.ay,I=v*k+E*S+b.tx,M=C*k+T*S+b.ty);let D=t.parent.matrix;v=D.a,E=D.c,C=D.b,T=D.d;let V=1/(v*T-E*C),X=I-D.tx,N=M-D.ty,q=(X*T-N*E)*V-i,L=(N*v-X*C)*V-h,R=Math.sqrt(q*q+L*L),P=e.data.length*g,H,U;if(R<1e-4){this.apply1(t,n,r,!1,o,!1,a),e.updateWorldTransformWith(k,S,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}X=n-D.tx,N=r-D.ty;let z=(X*T-N*E)*V-i,O=(N*v-X*C)*V-h,Z=z*z+O*O;if(c!=0){c*=d*(g+1)*.5;let et=Math.sqrt(Z),st=et-R-P*d+c;if(st>0){let dt=Math.min(1,st/(c*2))-1;dt=(st-c*(1-dt*dt))/et,z-=dt*z,O-=dt*O,Z=z*z+O*O}}t:if(F){P*=d;let et=(Z-R*R-P*P)/(2*R*P);et<-1?(et=-1,U=Math.PI*s):et>1?(et=1,U=0,o&&(v=(Math.sqrt(Z)/(R+P)-1)*a+1,p*=v,l&&(f*=v))):U=Math.acos(et)*s,v=R+P*et,E=P*Math.sin(U),H=Math.atan2(O*v-z*E,z*v+O*E)}else{v=d*P,E=u*P;let et=v*v,st=E*E,dt=Math.atan2(O,z);C=st*R*R+et*Z-et*st;let Mt=-2*st*R,Bt=st-et;if(T=Mt*Mt-4*Bt*C,T>=0){let Jt=Math.sqrt(T);Mt<0&&(Jt=-Jt),Jt=-(Mt+Jt)*.5;let on=Jt/Bt,Vo=C/Jt,Ue=Math.abs(on)<Math.abs(Vo)?on:Vo;if(Ue*Ue<=Z){N=Math.sqrt(Z-Ue*Ue)*s,H=dt-Math.atan2(N,Ue),U=Math.atan2(N/u,(Ue-R)/d);break t}}let jt=B.PI,Rt=R-v,Xt=Rt*Rt,Wt=0,Zt=0,Lt=R+v,Kt=Lt*Lt,ke=0;C=-v*R/(et-st),C>=-1&&C<=1&&(C=Math.acos(C),X=v*Math.cos(C)+R,N=E*Math.sin(C),T=X*X+N*N,T<Xt&&(jt=C,Xt=T,Rt=X,Wt=N),T>Kt&&(Zt=C,Kt=T,Lt=X,ke=N)),Z<=(Xt+Kt)*.5?(H=dt-Math.atan2(Wt*s,Rt),U=jt*s):(H=dt-Math.atan2(ke*s,Lt),U=Zt*s)}let K=Math.atan2(S,k)*w,it=t.arotation;H=(H-K)*B.radDeg+x-it,H>180?H-=360:H<-180&&(H+=360),t.updateWorldTransformWith(i,h,it+H*a,p,f,0,0),it=e.arotation,U=((U+K)*B.radDeg-e.ashearX)*w+y-it,U>180?U-=360:U<-180&&(U+=360),e.updateWorldTransformWith(k,S,it+U*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};var $i=class extends qr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"bendDirection",1);m(this,"compress",!1);m(this,"stretch",!1);m(this,"uniform",!1);m(this,"mix",1);m(this,"softness",0)}};var zi=class extends qr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"positionMode");m(this,"spacingMode");m(this,"rotateMode");m(this,"offsetRotation");m(this,"position");m(this,"spacing");m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0)}},Fo=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(Fo||{});var Oe=class Oe{constructor(t,e){m(this,"data",null);m(this,"bones",null);m(this,"target",null);m(this,"position",0);m(this,"spacing",0);m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"spaces",new Array);m(this,"positions",new Array);m(this,"world",new Array);m(this,"curves",new Array);m(this,"lengths",new Array);m(this,"segments",new Array);m(this,"active",!1);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 n=0,r=t.bones.length;n<r;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}update(){let t=this.target.getAttachment();if(!(t instanceof lr))return;let e=this.mixRotate,n=this.mixX,r=this.mixY;if(e==0&&n==0&&r==0)return;let s=this.data,o=s.rotateMode==0,l=s.rotateMode==2,c=this.bones,a=c.length,i=o?a:a+1,h=Y.setArraySize(this.spaces,i),d=l?this.lengths=Y.setArraySize(this.lengths,a):null,u=this.spacing;switch(s.spacingMode){case 2:if(l)for(let k=0,S=i-1;k<S;k++){let I=c[k],M=I.data.length;if(M<Oe.epsilon)d[k]=0;else{let v=M*I.matrix.a,E=M*I.matrix.b;d[k]=Math.sqrt(v*v+E*E)}}Y.arrayFill(h,1,i,u);break;case 3:let y=0;for(let k=0,S=i-1;k<S;){let I=c[k],M=I.data.length;if(M<Oe.epsilon)l&&(d[k]=0),h[++k]=u;else{let v=M*I.matrix.a,E=M*I.matrix.b,C=Math.sqrt(v*v+E*E);l&&(d[k]=C),h[++k]=C,y+=C}}if(y>0){y=i/y*u;for(let k=1;k<i;k++)h[k]*=y}break;default:let w=s.spacingMode==0;for(let k=0,S=i-1;k<S;){let I=c[k],M=I.data.length;if(M<Oe.epsilon)l&&(d[k]=0),h[++k]=u;else{let v=M*I.matrix.a,E=M*I.matrix.b,C=Math.sqrt(v*v+E*E);l&&(d[k]=C),h[++k]=(w?M+u:u)*C/M}}}let p=this.computeWorldPositions(t,i,o),f=p[0],g=p[1],b=s.offsetRotation,x=!1;if(b==0)x=s.rotateMode==1;else{x=!1;let y=this.target.bone.matrix;b*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,w=3;y<a;y++,w+=3){let k=c[y],S=k.matrix;S.tx+=(f-S.tx)*n,S.ty+=(g-S.ty)*r;let I=p[w],M=p[w+1],v=I-f,E=M-g;if(l){let C=d[y];if(C!=0){let T=(Math.sqrt(v*v+E*E)/C-1)*e+1;S.a*=T,S.b*=T}}if(f=I,g=M,e>0){let C=S.a,T=S.c,F=S.b,D=S.d,V=0,X=0,N=0;if(o?V=p[w-1]:h[y+1]==0?V=p[w+2]:V=Math.atan2(E,v),V-=Math.atan2(F,C),x){X=Math.cos(V),N=Math.sin(V);let q=k.data.length;f+=(q*(X*C-N*F)-v)*e,g+=(q*(N*C+X*F)-E)*e}else V+=b;V>B.PI?V-=B.PI2:V<-B.PI&&(V+=B.PI2),V*=e,X=Math.cos(V),N=Math.sin(V),S.a=X*C-N*F,S.c=X*T-N*D,S.b=N*C+X*F,S.d=N*T+X*D}k.updateAppliedTransform()}}computeWorldPositions(t,e,n){let r=this.target,s=this.position,o=this.spaces,l=Y.setArraySize(this.positions,e*3+2),c=null,a=t.closed,i=t.worldVerticesLength,h=i/6,d=Oe.NONE;if(!t.constantSpeed){let q=t.lengths;h-=a?1:2;let L=q[h];this.data.positionMode==1&&(s*=L);let R;switch(this.data.spacingMode){case 2:R=L;break;case 3:R=L/e;break;default:R=1}c=Y.setArraySize(this.world,8);for(let P=0,H=0,U=0;P<e;P++,H+=3){let z=o[P]*R;s+=z;let O=s;if(a)O%=L,O<0&&(O+=L),U=0;else if(O<0){d!=Oe.BEFORE&&(d=Oe.BEFORE,t.computeWorldVertices(r,2,4,c,0,2)),this.addBeforePosition(O,c,0,l,H);continue}else if(O>L){d!=Oe.AFTER&&(d=Oe.AFTER,t.computeWorldVertices(r,i-6,4,c,0,2)),this.addAfterPosition(O-L,c,0,l,H);continue}for(;;U++){let Z=q[U];if(!(O>Z)){if(U==0)O/=Z;else{let K=q[U-1];O=(O-K)/(Z-K)}break}}U!=d&&(d=U,a&&U==h?(t.computeWorldVertices(r,i-4,4,c,0,2),t.computeWorldVertices(r,0,4,c,4,2)):t.computeWorldVertices(r,U*6+2,8,c,0,2)),this.addCurvePosition(O,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,H,n||P>0&&z==0)}return l}a?(i+=2,c=Y.setArraySize(this.world,i),t.computeWorldVertices(r,2,i-4,c,0,2),t.computeWorldVertices(r,0,2,c,i-4,2),c[i-2]=c[0],c[i-1]=c[1]):(h--,i-=4,c=Y.setArraySize(this.world,i),t.computeWorldVertices(r,2,i,c,0,2));let u=Y.setArraySize(this.curves,h),p=0,f=c[0],g=c[1],b=0,x=0,y=0,w=0,k=0,S=0,I=0,M=0,v=0,E=0,C=0,T=0,F=0,D=0;for(let q=0,L=2;q<h;q++,L+=6)b=c[L],x=c[L+1],y=c[L+2],w=c[L+3],k=c[L+4],S=c[L+5],I=(f-b*2+y)*.1875,M=(g-x*2+w)*.1875,v=((b-y)*3-f+k)*.09375,E=((x-w)*3-g+S)*.09375,C=I*2+v,T=M*2+E,F=(b-f)*.75+I+v*.16666667,D=(x-g)*.75+M+E*.16666667,p+=Math.sqrt(F*F+D*D),F+=C,D+=T,C+=v,T+=E,p+=Math.sqrt(F*F+D*D),F+=C,D+=T,p+=Math.sqrt(F*F+D*D),F+=C+v,D+=T+E,p+=Math.sqrt(F*F+D*D),u[q]=p,f=k,g=S;this.data.positionMode==1&&(s*=p);let V;switch(this.data.spacingMode){case 2:V=p;break;case 3:V=p/e;break;default:V=1}let X=this.segments,N=0;for(let q=0,L=0,R=0,P=0;q<e;q++,L+=3){let H=o[q]*V;s+=H;let U=s;if(a)U%=p,U<0&&(U+=p),R=0;else if(U<0){this.addBeforePosition(U,c,0,l,L);continue}else if(U>p){this.addAfterPosition(U-p,c,i-4,l,L);continue}for(;;R++){let z=u[R];if(!(U>z)){if(R==0)U/=z;else{let O=u[R-1];U=(U-O)/(z-O)}break}}if(R!=d){d=R;let z=R*6;for(f=c[z],g=c[z+1],b=c[z+2],x=c[z+3],y=c[z+4],w=c[z+5],k=c[z+6],S=c[z+7],I=(f-b*2+y)*.03,M=(g-x*2+w)*.03,v=((b-y)*3-f+k)*.006,E=((x-w)*3-g+S)*.006,C=I*2+v,T=M*2+E,F=(b-f)*.3+I+v*.16666667,D=(x-g)*.3+M+E*.16666667,N=Math.sqrt(F*F+D*D),X[0]=N,z=1;z<8;z++)F+=C,D+=T,C+=v,T+=E,N+=Math.sqrt(F*F+D*D),X[z]=N;F+=C,D+=T,N+=Math.sqrt(F*F+D*D),X[8]=N,F+=C+v,D+=T+E,N+=Math.sqrt(F*F+D*D),X[9]=N,P=0}for(U*=N;;P++){let z=X[P];if(!(U>z)){if(P==0)U/=z;else{let O=X[P-1];U=P+(U-O)/(z-O)}break}}this.addCurvePosition(U*.1,f,g,b,x,y,w,k,S,l,L,n||q>0&&H==0)}return l}addBeforePosition(t,e,n,r,s){let o=e[n],l=e[n+1],c=e[n+2]-o,a=e[n+3]-l,i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addAfterPosition(t,e,n,r,s){let o=e[n+2],l=e[n+3],c=o-e[n],a=l-e[n+1],i=Math.atan2(a,c);r[s]=o+t*Math.cos(i),r[s+1]=l+t*Math.sin(i),r[s+2]=i}addCurvePosition(t,e,n,r,s,o,l,c,a,i,h,d){if(t==0||isNaN(t)){i[h]=e,i[h+1]=n,i[h+2]=Math.atan2(s-n,r-e);return}let u=t*t,p=u*t,f=1-t,g=f*f,b=g*f,x=f*t,y=x*3,w=f*y,k=y*t,S=e*b+r*w+o*k+c*p,I=n*b+s*w+l*k+a*p;i[h]=S,i[h+1]=I,d&&(t<.001?i[h+2]=Math.atan2(s-n,r-e):i[h+2]=Math.atan2(I-(n*g+s*x*2+l*u),S-(e*g+r*x*2+o*u)))}};m(Oe,"NONE",-1),m(Oe,"BEFORE",-2),m(Oe,"AFTER",-3),m(Oe,"epsilon",1e-5);var bc=Oe;var xc=class{constructor(t,e){m(this,"data");m(this,"bones");m(this,"target");m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"mixScaleX",0);m(this,"mixScaleY",0);m(this,"mixShearY",0);m(this,"temp",new Ae);m(this,"active",!1);if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let n=0;n<t.bones.length;n++)this.bones.push(e.findBone(t.bones[n].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}update(){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(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,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=e!=0||n!=0,c=this.target,a=c.matrix,i=a.a,h=a.c,d=a.b,u=a.d,p=i*u-h*d>0?B.degRad:-B.degRad,f=this.data.offsetRotation*p,g=this.data.offsetShearY*p,b=this.bones;for(let x=0,y=b.length;x<y;x++){let w=b[x],k=w.matrix;if(t!=0){let S=k.a,I=k.c,M=k.b,v=k.d,E=Math.atan2(d,i)-Math.atan2(M,S)+f;E>B.PI?E-=B.PI2:E<-B.PI&&(E+=B.PI2),E*=t;let C=Math.cos(E),T=Math.sin(E);k.a=C*S-T*M,k.c=C*I-T*v,k.b=T*S+C*M,k.d=T*I+C*v}if(l){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),k.tx+=(S.x-k.tx)*e,k.ty+=(S.y-k.ty)*n}if(r!=0){let S=Math.sqrt(k.a*k.a+k.b*k.b);S!=0&&(S=(S+(Math.sqrt(i*i+d*d)-S+this.data.offsetScaleX)*r)/S),k.a*=S,k.b*=S}if(s!=0){let S=Math.sqrt(k.c*k.c+k.d*k.d);S!=0&&(S=(S+(Math.sqrt(h*h+u*u)-S+this.data.offsetScaleY)*s)/S),k.c*=S,k.d*=S}if(o>0){let S=k.c,I=k.d,M=Math.atan2(I,S),v=Math.atan2(u,h)-Math.atan2(d,i)-(M-Math.atan2(k.b,k.a));v>B.PI?v-=B.PI2:v<-B.PI&&(v+=B.PI2),v=M+(v+g)*o;let E=Math.sqrt(S*S+I*I);k.c=Math.cos(v)*E,k.d=Math.sin(v)*E}w.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=e!=0||n!=0,c=this.target,a=c.matrix,i=a.a,h=a.c,d=a.b,u=a.d,p=i*u-h*d>0?B.degRad:-B.degRad,f=this.data.offsetRotation*p,g=this.data.offsetShearY*p,b=this.bones;for(let x=0,y=b.length;x<y;x++){let w=b[x],k=w.matrix;if(t!=0){let S=k.a,I=k.c,M=k.b,v=k.d,E=Math.atan2(d,i)+f;E>B.PI?E-=B.PI2:E<-B.PI&&(E+=B.PI2),E*=t;let C=Math.cos(E),T=Math.sin(E);k.a=C*S-T*M,k.c=C*I-T*v,k.b=T*S+C*M,k.d=T*I+C*v}if(l){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),k.tx+=S.x*e,k.ty+=S.y*n}if(r!=0){let S=(Math.sqrt(i*i+d*d)-1+this.data.offsetScaleX)*r+1;k.a*=S,k.b*=S}if(s!=0){let S=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleY)*s+1;k.c*=S,k.d*=S}if(o>0){let S=Math.atan2(u,h)-Math.atan2(d,i);S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2);let I=k.c,M=k.d;S=Math.atan2(M,I)+(S-B.PI/2+g)*o;let v=Math.sqrt(I*I+M*M);k.c=Math.cos(S)*v,k.d=Math.sin(S)*v}w.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=this.target,c=this.bones;for(let a=0,i=c.length;a<i;a++){let h=c[a],d=h.arotation;if(t!=0){let x=l.arotation-d+this.data.offsetRotation;x-=(16384-(16384.499999999996-x/360|0))*360,d+=x*t}let u=h.ax,p=h.ay;u+=(l.ax-u+this.data.offsetX)*e,p+=(l.ay-p+this.data.offsetY)*n;let f=h.ascaleX,g=h.ascaleY;r!=0&&f!=0&&(f=(f+(l.ascaleX-f+this.data.offsetScaleX)*r)/f),s!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*s)/g);let b=h.ashearY;if(o!=0){let x=l.ashearY-b+this.data.offsetShearY;x-=(16384-(16384.499999999996-x/360|0))*360,b+=x*o}h.updateWorldTransformWith(u,p,d,f,g,h.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,s=this.mixScaleY,o=this.mixShearY,l=this.target,c=this.bones;for(let a=0,i=c.length;a<i;a++){let h=c[a],d=h.arotation+(l.arotation+this.data.offsetRotation)*t,u=h.ax+(l.ax+this.data.offsetX)*e,p=h.ay+(l.ay+this.data.offsetY)*n,f=h.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*r+1),g=h.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*s+1),b=h.ashearY+(l.ashearY+this.data.offsetShearY)*o;h.updateWorldTransformWith(u,p,d,f,g,h.ashearX,b)}}};var Hi=class Hi{constructor(t){m(this,"data",null);m(this,"bones",null);m(this,"slots",null);m(this,"drawOrder",null);m(this,"ikConstraints",null);m(this,"transformConstraints",null);m(this,"pathConstraints",null);m(this,"_updateCache",new Array);m(this,"skin",null);m(this,"color",null);m(this,"time",0);m(this,"scaleX",1);m(this,"scaleY",1);m(this,"x",0);m(this,"y",0);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 n=t.bones[e],r;if(!n.parent)r=new Bo(n,this,null);else{let s=this.bones[n.parent.index];r=new Bo(n,this,s),s.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let n=t.slots[e],r=this.bones[n.boneData.index],s=new yi(n,r);this.slots.push(s),this.drawOrder.push(s)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let n=t.ikConstraints[e];this.ikConstraints.push(new gc(n,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let n=t.transformConstraints[e];this.transformConstraints.push(new xc(n,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let n=t.pathConstraints[e];this.pathConstraints.push(new bc(n,this))}this.color=new $(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let i=0,h=e.length;i<h;i++){let d=e[i];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let i=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let u=this.bones[i[h].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u)}}let n=this.ikConstraints,r=this.transformConstraints,s=this.pathConstraints,o=n.length,l=r.length,c=s.length,a=o+l+c;t:for(let i=0;i<a;i++){for(let h=0;h<o;h++){let d=n[h];if(d.data.order==i){this.sortIkConstraint(d);continue t}}for(let h=0;h<l;h++){let d=r[h];if(d.data.order==i){this.sortTransformConstraint(d);continue t}}for(let h=0;h<c;h++){let d=s[h];if(d.data.order==i){this.sortPathConstraint(d);continue t}}}for(let i=0,h=e.length;i<h;i++)this.sortBone(e[i])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let n=t.bones,r=n[0];if(this.sortBone(r),n.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let s=n[n.length-1];this.sortBone(s),this._updateCache.push(t),this.sortReset(r.children),s.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,n=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(let c=0,a=this.data.skins.length;c<a;c++)this.sortPathConstraintAttachment(this.data.skins[c],n,r);let s=e.getAttachment();s instanceof lr&&this.sortPathConstraintAttachmentWith(s,r);let o=t.bones,l=o.length;for(let c=0;c<l;c++)this.sortBone(o[c]);this._updateCache.push(t);for(let c=0;c<l;c++)this.sortReset(o[c].children);for(let c=0;c<l;c++)o[c].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,n=e.length;if(t.data.local)for(let r=0;r<n;r++){let s=e[r];this.sortBone(s.parent),this.sortBone(s)}else for(let r=0;r<n;r++)this.sortBone(e[r]);this._updateCache.push(t);for(let r=0;r<n;r++)this.sortReset(e[r].children);for(let r=0;r<n;r++)e[r].sorted=!0}sortPathConstraintAttachment(t,e,n){let r=t.attachments[e];if(r)for(let s in r)this.sortPathConstraintAttachmentWith(r[s],n)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof lr))return;let n=t.bones;if(!n)this.sortBone(e);else{let r=this.bones;for(let s=0,o=n.length;s<o;){let l=n[s++];for(l+=s;s<l;)this.sortBone(r[n[s++]])}}}sortBone(t){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,n=t.length;e<n;e++){let r=t[e];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(){let t=this.bones;for(let n=0,r=t.length;n<r;n++){let s=t[n];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 e=this._updateCache;for(let n=0,r=e.length;n<r;n++)e[n].update()}updateWorldTransformWith(t){let e=this.getRootBone(),n=t.matrix.a,r=t.matrix.c,s=t.matrix.b,o=t.matrix.d;e.matrix.tx=n*this.x+r*this.y+t.worldX,e.matrix.ty=s*this.x+o*this.y+t.worldY;let l=e.rotation+90+e.shearY,c=B.cosDeg(e.rotation+e.shearX)*e.scaleX,a=B.cosDeg(l)*e.scaleY,i=B.sinDeg(e.rotation+e.shearX)*e.scaleX,h=B.sinDeg(l)*e.scaleY,d=this.scaleX,u=Dt.yDown?-this.scaleY:this.scaleY;e.matrix.a=(n*c+r*i)*d,e.matrix.c=(n*a+r*h)*d,e.matrix.b=(s*c+o*i)*u,e.matrix.d=(s*a+o*h)*u;let p=this._updateCache;for(let f=0,g=p.length;f<g;f++){let b=p[f];b!=e&&b.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let t=this.bones;for(let s=0,o=t.length;s<o;s++)t[s].setToSetupPose();let e=this.ikConstraints;for(let s=0,o=e.length;s<o;s++){let l=e[s];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let n=this.transformConstraints;for(let s=0,o=n.length;s<o;s++){let l=n[s],c=l.data;l.mixRotate=c.mixRotate,l.mixX=c.mixX,l.mixY=c.mixY,l.mixScaleX=c.mixScaleX,l.mixScaleY=c.mixScaleY,l.mixShearY=c.mixShearY}let r=this.pathConstraints;for(let s=0,o=r.length;s<o;s++){let l=r[s],c=l.data;l.position=c.position,l.spacing=c.spacing,l.mixRotate=c.mixRotate,l.mixX=c.mixX,l.mixY=c.mixY}}setSlotsToSetupPose(){let t=this.slots;Y.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,n=t.length;e<n;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].data.name==t)return n;return-1}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 n=0,r=e.length;n<r;n++){let s=e[n],o=s.data.attachmentName;if(o){let l=t.getAttachment(n,o);l&&s.setAttachment(l)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){return this.getAttachment(this.data.findSlot(t).index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let n=this.skin.getAttachment(t,e);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let n=this.slots;for(let r=0,s=n.length;r<s;r++){let o=n[r];if(o.data.name==t){let l=null;if(e&&(l=this.getAttachment(r,e),!l))throw new Error(`Attachment not found: ${e}, for slot: ${t}`);o.setAttachment(l);return}}throw new Error(`Slot not found: ${t}`)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.data.name==t)return s}return null}getBoundsRect(){let t=new Ae,e=new Ae;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,n=new Array(2)){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let r=this.drawOrder,s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let a=0,i=r.length;a<i;a++){let h=r[a];if(!h.bone.active)continue;let d=0,u=null,p=h.getAttachment();if(p instanceof wi)d=8,u=Y.setArraySize(n,d,0),p.computeWorldVertices(h.bone,u,0,2);else if(p instanceof Or){let f=p;d=f.worldVerticesLength,u=Y.setArraySize(n,d,0),f.computeWorldVertices(h,0,d,u,0,2)}if(u)for(let f=0,g=u.length;f<g;f+=2){let b=u[f],x=u[f+1];s=Math.min(s,b),o=Math.min(o,x),l=Math.max(l,b),c=Math.max(c,x)}}t.set(s,o),e.set(l-s,c-o)}update(t){this.time+=t}get flipX(){return this.scaleX==-1}set flipX(t){Hi.deprecatedWarning1||(Hi.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=t?1:-1}get flipY(){return this.scaleY==-1}set flipY(t){Hi.deprecatedWarning1||(Hi.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=t?1:-1}};m(Hi,"deprecatedWarning1",!1);var yc=Hi;var Gi=class{constructor(){m(this,"name",null);m(this,"bones",new Array);m(this,"slots",new Array);m(this,"skins",new Array);m(this,"defaultSkin",null);m(this,"events",new Array);m(this,"animations",new Array);m(this,"ikConstraints",new Array);m(this,"transformConstraints",new Array);m(this,"pathConstraints",new Array);m(this,"x",0);m(this,"y",0);m(this,"width",0);m(this,"height",0);m(this,"version",null);m(this,"hash",null);m(this,"fps",0);m(this,"imagesPath",null);m(this,"audioPath",null)}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s.name==t)return s}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");let e=this.pathConstraints;for(let n=0,r=e.length;n<r;n++)if(e[n].name==t)return n;return-1}};var ji=class{constructor(t,e,n){m(this,"index");m(this,"name");m(this,"boneData");m(this,"color",new $(1,1,1,1));m(this,"darkColor");m(this,"attachmentName");m(this,"blendMode");if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}};var Zi=class extends qr{constructor(e){super(e,0,!1);m(this,"bones",new Array);m(this,"target");m(this,"mixRotate",0);m(this,"mixX",0);m(this,"mixY",0);m(this,"mixScaleX",0);m(this,"mixScaleY",0);m(this,"mixShearY",0);m(this,"offsetRotation",0);m(this,"offsetX",0);m(this,"offsetY",0);m(this,"offsetScaleX",0);m(this,"offsetScaleY",0);m(this,"offsetShearY",0);m(this,"relative",!1);m(this,"local",!1)}};var wc=class{constructor(t,e,n){this.slotIndex=t;this.name=e;this.attachment=n}},ws=class{constructor(t){m(this,"name");m(this,"attachments",new Array);m(this,"bones",Array());m(this,"constraints",new Array);if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,n){if(!n)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]=n}addSkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let n=0;n<t.bones.length;n++){let r=t.bones[n],s=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){s=!0;break}s||this.bones.push(r)}for(let n=0;n<t.constraints.length;n++){let r=t.constraints[n],s=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){s=!0;break}s||this.constraints.push(r)}let e=t.getAttachments();for(let n=0;n<e.length;n++){let r=e[n];r.attachment&&(r.attachment instanceof Or?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){let n=this.attachments[t];return n?n[e]:null}removeAttachment(t,e){let n=this.attachments[t];n&&(n[e]=null)}getAttachments(){let t=new Array;for(let e=0;e<this.attachments.length;e++){let n=this.attachments[e];if(n)for(let r in n){let s=n[r];s&&t.push(new wc(e,r,s))}}return t}getAttachmentsForSlot(t,e){let n=this.attachments[t];if(n)for(let r in n){let s=n[r];s&&e.push(new wc(t,r,s))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let n=0;for(let r=0;r<t.slots.length;r++){let s=t.slots[r],o=s.getAttachment();if(o&&n<e.attachments.length){let l=e.attachments[n];for(let c in l){let a=l[c];if(o==a){let i=this.getAttachment(n,c);i&&s.setAttachment(i);break}}}n++}}};var yh=class yh{constructor(t){m(this,"scale",1);m(this,"attachmentLoader",null);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Gi;n.name="";let r=new ln(t),s=r.readInt32(),o=r.readInt32();if(n.hash=o==0&&s==0?null:o.toString(16)+s.toString(16),n.version=r.readString(),n.version.substr(0,3)!=="4.0"){let i=`Spine 4.0 loader cant load version ${n.version}. Please configure your pixi-spine bundle`;console.error(i)}n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat();let l=r.readBoolean();l&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());let c=0;c=r.readInt(!0);for(let i=0;i<c;i++)r.strings.push(r.readString());c=r.readInt(!0);for(let i=0;i<c;i++){let h=r.readString(),d=i==0?null:n.bones[r.readInt(!0)],u=new Ui(i,h,d);u.rotation=r.readFloat(),u.x=r.readFloat()*e,u.y=r.readFloat()*e,u.scaleX=r.readFloat(),u.scaleY=r.readFloat(),u.shearX=r.readFloat(),u.shearY=r.readFloat(),u.length=r.readFloat()*e,u.transformMode=r.readInt(!0),u.skinRequired=r.readBoolean(),l&&$.rgba8888ToColor(u.color,r.readInt32()),n.bones.push(u)}c=r.readInt(!0);for(let i=0;i<c;i++){let h=r.readString(),d=n.bones[r.readInt(!0)],u=new ji(i,h,d);$.rgba8888ToColor(u.color,r.readInt32());let p=r.readInt32();p!=-1&&$.rgb888ToColor(u.darkColor=new $,p),u.attachmentName=r.readStringRef(),u.blendMode=yh.BlendModeValues[r.readInt(!0)],n.slots.push(u)}c=r.readInt(!0);for(let i=0,h;i<c;i++){let d=new $i(r.readString());d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),h=r.readInt(!0);for(let u=0;u<h;u++)d.bones.push(n.bones[r.readInt(!0)]);d.target=n.bones[r.readInt(!0)],d.mix=r.readFloat(),d.softness=r.readFloat()*e,d.bendDirection=r.readByte(),d.compress=r.readBoolean(),d.stretch=r.readBoolean(),d.uniform=r.readBoolean(),n.ikConstraints.push(d)}c=r.readInt(!0);for(let i=0,h;i<c;i++){let d=new Zi(r.readString());d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),h=r.readInt(!0);for(let u=0;u<h;u++)d.bones.push(n.bones[r.readInt(!0)]);d.target=n.bones[r.readInt(!0)],d.local=r.readBoolean(),d.relative=r.readBoolean(),d.offsetRotation=r.readFloat(),d.offsetX=r.readFloat()*e,d.offsetY=r.readFloat()*e,d.offsetScaleX=r.readFloat(),d.offsetScaleY=r.readFloat(),d.offsetShearY=r.readFloat(),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),d.mixScaleX=r.readFloat(),d.mixScaleY=r.readFloat(),d.mixShearY=r.readFloat(),n.transformConstraints.push(d)}c=r.readInt(!0);for(let i=0,h;i<c;i++){let d=new zi(r.readString());d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),h=r.readInt(!0);for(let u=0;u<h;u++)d.bones.push(n.bones[r.readInt(!0)]);d.target=n.slots[r.readInt(!0)],d.positionMode=r.readInt(!0),d.spacingMode=r.readInt(!0),d.rotateMode=r.readInt(!0),d.offsetRotation=r.readFloat(),d.position=r.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),n.pathConstraints.push(d)}let a=this.readSkin(r,n,!0,l);a&&(n.defaultSkin=a,n.skins.push(a));{let i=n.skins.length;for(Y.setArraySize(n.skins,c=i+r.readInt(!0));i<c;i++)n.skins[i]=this.readSkin(r,n,!1,l)}c=this.linkedMeshes.length;for(let i=0;i<c;i++){let h=this.linkedMeshes[i],u=(h.skin?n.findSkin(h.skin):n.defaultSkin).getAttachment(h.slotIndex,h.parent);h.mesh.deformAttachment=h.inheritDeform?u:h.mesh,h.mesh.setParentMesh(u)}this.linkedMeshes.length=0,c=r.readInt(!0);for(let i=0;i<c;i++){let h=new qi(r.readStringRef());h.intValue=r.readInt(!1),h.floatValue=r.readFloat(),h.stringValue=r.readString(),h.audioPath=r.readString(),h.audioPath&&(h.volume=r.readFloat(),h.balance=r.readFloat()),n.events.push(h)}c=r.readInt(!0);for(let i=0;i<c;i++)n.animations.push(this.readAnimation(r,r.readString(),n));return n}readSkin(t,e,n,r){let s=null,o=0;if(n){if(o=t.readInt(!0),o==0)return null;s=new ws("default")}else{s=new ws(t.readStringRef()),s.bones.length=t.readInt(!0);for(let l=0,c=s.bones.length;l<c;l++)s.bones[l]=e.bones[t.readInt(!0)];for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let l=0,c=t.readInt(!0);l<c;l++)s.constraints.push(e.pathConstraints[t.readInt(!0)]);o=t.readInt(!0)}for(let l=0;l<o;l++){let c=t.readInt(!0);for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readStringRef(),d=this.readAttachment(t,e,s,c,h,r);d&&s.setAttachment(c,h,d)}}return s}readAttachment(t,e,n,r,s,o){let l=this.scale,c=t.readStringRef();switch(c||(c=s),t.readByte()){case 0:{let a=t.readStringRef(),i=t.readFloat(),h=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),f=t.readFloat(),g=t.readFloat(),b=t.readInt32();a||(a=c);let x=this.attachmentLoader.newRegionAttachment(n,c,a);return x?(x.path=a,x.x=h*l,x.y=d*l,x.scaleX=u,x.scaleY=p,x.rotation=i,x.width=f*l,x.height=g*l,$.rgba8888ToColor(x.color,b),x):null}case 1:{let a=t.readInt(!0),i=this.readVertices(t,a),h=o?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(n,c);return d?(d.worldVerticesLength=a<<1,d.vertices=i.vertices,d.bones=i.bones,o&&$.rgba8888ToColor(d.color,h),d):null}case 2:{let a=t.readStringRef(),i=t.readInt32(),h=t.readInt(!0),d=this.readFloatArray(t,h<<1,1),u=this.readShortArray(t),p=this.readVertices(t,h),f=t.readInt(!0),g=null,b=0,x=0;o&&(g=this.readShortArray(t),b=t.readFloat(),x=t.readFloat()),a||(a=c);let y=this.attachmentLoader.newMeshAttachment(n,c,a);return y?(y.path=a,$.rgba8888ToColor(y.color,i),y.bones=p.bones,y.vertices=p.vertices,y.worldVerticesLength=h<<1,y.triangles=u,y.regionUVs=new Float32Array(d),y.hullLength=f<<1,o&&(y.edges=g,y.width=b*l,y.height=x*l),y):null}case 3:{let a=t.readStringRef(),i=t.readInt32(),h=t.readStringRef(),d=t.readStringRef(),u=t.readBoolean(),p=0,f=0;o&&(p=t.readFloat(),f=t.readFloat()),a||(a=c);let g=this.attachmentLoader.newMeshAttachment(n,c,a);return g?(g.path=a,$.rgba8888ToColor(g.color,i),o&&(g.width=p*l,g.height=f*l),this.linkedMeshes.push(new zm(g,h,r,d,u)),g):null}case 4:{let a=t.readBoolean(),i=t.readBoolean(),h=t.readInt(!0),d=this.readVertices(t,h),u=Y.newArray(h/3,0);for(let g=0,b=u.length;g<b;g++)u[g]=t.readFloat()*l;let p=o?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(n,c);return f?(f.closed=a,f.constantSpeed=i,f.worldVerticesLength=h<<1,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,o&&$.rgba8888ToColor(f.color,p),f):null}case 5:{let a=t.readFloat(),i=t.readFloat(),h=t.readFloat(),d=o?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(n,c);return u?(u.x=i*l,u.y=h*l,u.rotation=a,o&&$.rgba8888ToColor(u.color,d),u):null}case 6:{let a=t.readInt(!0),i=t.readInt(!0),h=this.readVertices(t,i),d=o?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(n,c);return u?(u.endSlot=e.slots[a],u.worldVerticesLength=i<<1,u.vertices=h.vertices,u.bones=h.bones,o&&$.rgba8888ToColor(u.color,d),u):null}}return null}readVertices(t,e){let n=this.scale,r=e<<1,s=new Hm;if(!t.readBoolean())return s.vertices=this.readFloatArray(t,r,n),s;let o=new Array,l=new Array;for(let c=0;c<e;c++){let a=t.readInt(!0);l.push(a);for(let i=0;i<a;i++)l.push(t.readInt(!0)),o.push(t.readFloat()*n),o.push(t.readFloat()*n),o.push(t.readFloat())}return s.vertices=Y.toFloatArray(o),s.bones=l,s}readFloatArray(t,e,n){let r=new Array(e);if(n==1)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let s=0;s<e;s++)r[s]=t.readFloat()*n;return r}readShortArray(t){let e=t.readInt(!0),n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readShort();return n}readAnimation(t,e,n){t.readInt(!0);let r=new Array,s=this.scale;for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readByte(),f=t.readInt(!0),g=f-1;switch(p){case Ff:{let b=new In(f,h);for(let x=0;x<f;x++)b.setFrame(x,t.readFloat(),t.readStringRef());r.push(b);break}case Df:{let b=t.readInt(!0),x=new Bi(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,v=0;x.setFrame(M,y,w,k,S,I),M!=g;M++){let E=t.readFloat(),C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case Xn:x.setStepped(M);break;case Ln:xt(t,x,v++,M,0,y,E,w,C,1),xt(t,x,v++,M,1,y,E,k,T,1),xt(t,x,v++,M,2,y,E,S,F,1),xt(t,x,v++,M,3,y,E,I,D,1)}y=E,w=C,k=T,S=F,I=D}r.push(x);break}case Vf:{let b=t.readInt(!0),x=new Fi(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,w,k,S),I!=g;I++){let v=t.readFloat(),E=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;switch(t.readByte()){case Xn:x.setStepped(I);break;case Ln:xt(t,x,M++,I,0,y,v,w,E,1),xt(t,x,M++,I,1,y,v,k,C,1),xt(t,x,M++,I,2,y,v,S,T,1)}y=v,w=E,k=C,S=T}r.push(x);break}case Rf:{let b=t.readInt(!0),x=new Vi(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let C=0,T=0;x.setFrame(C,y,w,k,S,I,M,v,E),C!=g;C++){let F=t.readFloat(),D=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Xn:x.setStepped(C);break;case Ln:xt(t,x,T++,C,0,y,F,w,D,1),xt(t,x,T++,C,1,y,F,k,V,1),xt(t,x,T++,C,2,y,F,S,X,1),xt(t,x,T++,C,3,y,F,I,N,1),xt(t,x,T++,C,4,y,F,M,q,1),xt(t,x,T++,C,5,y,F,v,L,1),xt(t,x,T++,C,6,y,F,E,R,1)}y=F,w=D,k=V,S=X,I=N,M=q,v=L,E=R}r.push(x);break}case Pf:{let b=t.readInt(!0),x=new Ri(f,b,h),y=t.readFloat(),w=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let E=0,C=0;x.setFrame(E,y,w,k,S,I,M,v),E!=g;E++){let T=t.readFloat(),F=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case Xn:x.setStepped(E);break;case Ln:xt(t,x,C++,E,0,y,T,w,F,1),xt(t,x,C++,E,1,y,T,k,D,1),xt(t,x,C++,E,2,y,T,S,V,1),xt(t,x,C++,E,3,y,T,I,X,1),xt(t,x,C++,E,4,y,T,M,N,1),xt(t,x,C++,E,5,y,T,v,q,1)}y=T,w=F,k=D,S=V,I=X,M=N,v=q}r.push(x);break}case Yf:{let b=new Di(f,t.readInt(!0),h),x=t.readFloat(),y=t.readUnsignedByte()/255;for(let w=0,k=0;b.setFrame(w,x,y),w!=g;w++){let S=t.readFloat(),I=t.readUnsignedByte()/255;switch(t.readByte()){case Xn:b.setStepped(w);break;case Ln:xt(t,b,k++,w,0,x,S,y,I,1)}x=S,y=I}r.push(b);break}}}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readByte(),f=t.readInt(!0),g=t.readInt(!0);switch(p){case Sf:r.push($r(t,new cr(f,g,h),1));break;case Af:r.push(qm(t,new Si(f,g,h),s));break;case kf:r.push($r(t,new Ai(f,g,h),s));break;case If:r.push($r(t,new ki(f,g,h),s));break;case Mf:r.push(qm(t,new Ii(f,g,h),1));break;case vf:r.push($r(t,new Mi(f,g,h),1));break;case Cf:r.push($r(t,new vi(f,g,h),1));break;case Ef:r.push(qm(t,new Ci(f,g,h),1));break;case Tf:r.push($r(t,new Ei(f,g,h),1));break;case Bf:r.push($r(t,new Ti(f,g,h),1))}}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=t.readInt(!0),u=d-1,p=new Yi(d,t.readInt(!0),h),f=t.readFloat(),g=t.readFloat(),b=t.readFloat()*s;for(let x=0,y=0;p.setFrame(x,f,g,b,t.readByte(),t.readBoolean(),t.readBoolean()),x!=u;x++){let w=t.readFloat(),k=t.readFloat(),S=t.readFloat()*s;switch(t.readByte()){case Xn:p.setStepped(x);break;case Ln:xt(t,p,y++,x,0,f,w,g,k,1),xt(t,p,y++,x,1,f,w,b,S,s)}f=w,g=k,b=S}r.push(p)}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=t.readInt(!0),u=d-1,p=new Xi(d,t.readInt(!0),h),f=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readFloat(),w=t.readFloat(),k=t.readFloat();for(let S=0,I=0;p.setFrame(S,f,g,b,x,y,w,k),S!=u;S++){let M=t.readFloat(),v=t.readFloat(),E=t.readFloat(),C=t.readFloat(),T=t.readFloat(),F=t.readFloat(),D=t.readFloat();switch(t.readByte()){case Xn:p.setStepped(S);break;case Ln:xt(t,p,I++,S,0,f,M,g,v,1),xt(t,p,I++,S,1,f,M,b,E,1),xt(t,p,I++,S,2,f,M,x,C,1),xt(t,p,I++,S,3,f,M,y,T,1),xt(t,p,I++,S,4,f,M,w,F,1),xt(t,p,I++,S,5,f,M,k,D,1)}f=M,g=v,b=E,x=C,y=T,w=F,k=D}r.push(p)}for(let a=0,i=t.readInt(!0);a<i;a++){let h=t.readInt(!0),d=n.pathConstraints[h];for(let u=0,p=t.readInt(!0);u<p;u++)switch(t.readByte()){case Xf:r.push($r(t,new Li(t.readInt(!0),t.readInt(!0),h),d.positionMode==0?s:1));break;case Lf:r.push($r(t,new Ni(t.readInt(!0),t.readInt(!0),h),d.spacingMode==0||d.spacingMode==1?s:1));break;case Nf:let f=new Oi(t.readInt(!0),t.readInt(!0),h),g=t.readFloat(),b=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let w=0,k=0,S=f.getFrameCount()-1;f.setFrame(w,g,b,x,y),w!=S;w++){let I=t.readFloat(),M=t.readFloat(),v=t.readFloat(),E=t.readFloat();switch(t.readByte()){case Xn:f.setStepped(w);break;case Ln:xt(t,f,k++,w,0,g,I,b,M,1),xt(t,f,k++,w,1,g,I,x,v,1),xt(t,f,k++,w,2,g,I,y,E,1)}g=I,b=M,x=v,y=E}r.push(f)}}for(let a=0,i=t.readInt(!0);a<i;a++){let h=n.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let p=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let b=t.readStringRef(),x=h.getAttachment(p,b),y=x.bones,w=x.vertices,k=y?w.length/3*2:w.length,S=t.readInt(!0),I=S-1,M=t.readInt(!0),v=new Pi(S,M,p,x),E=t.readFloat();for(let C=0,T=0;;C++){let F,D=t.readInt(!0);if(D==0)F=y?Y.newFloatArray(k):w;else{F=Y.newFloatArray(k);let X=t.readInt(!0);if(D+=X,s==1)for(let N=X;N<D;N++)F[N]=t.readFloat();else for(let N=X;N<D;N++)F[N]=t.readFloat()*s;if(!y)for(let N=0,q=F.length;N<q;N++)F[N]+=w[N]}if(v.setFrame(C,E,F),C==I)break;let V=t.readFloat();switch(t.readByte()){case Xn:v.setStepped(C);break;case Ln:xt(t,v,T++,C,0,E,V,0,1,1)}E=V}r.push(v)}}}let o=t.readInt(!0);if(o>0){let a=new Yn(o),i=n.slots.length;for(let h=0;h<o;h++){let d=t.readFloat(),u=t.readInt(!0),p=Y.newArray(i,0);for(let x=i-1;x>=0;x--)p[x]=-1;let f=Y.newArray(i-u,0),g=0,b=0;for(let x=0;x<u;x++){let y=t.readInt(!0);for(;g!=y;)f[b++]=g++;p[g+t.readInt(!0)]=g++}for(;g<i;)f[b++]=g++;for(let x=i-1;x>=0;x--)p[x]==-1&&(p[x]=f[--b]);a.setFrame(h,d,p)}r.push(a)}let l=t.readInt(!0);if(l>0){let a=new Wr(l);for(let i=0;i<l;i++){let h=t.readFloat(),d=n.events[t.readInt(!0)],u=new Wi(h,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readBoolean()?t.readString():d.stringValue,u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(i,u)}r.push(a)}let c=0;for(let a=0,i=r.length;a<i;a++)c=Math.max(c,r[a].getDuration());return new Ur(e,r,c)}};m(yh,"BlendModeValues",[0,1,2,3]);var $m=yh,zm=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritDeform");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=s}},Hm=class{constructor(t=null,e=null){this.bones=t;this.vertices=e}};function $r(A,t,e){let n=A.readFloat(),r=A.readFloat()*e;for(let s=0,o=0,l=t.getFrameCount()-1;t.setFrame(s,n,r),s!=l;s++){let c=A.readFloat(),a=A.readFloat()*e;switch(A.readByte()){case Xn:t.setStepped(s);break;case Ln:xt(A,t,o++,s,0,n,c,r,a,e)}n=c,r=a}return t}function qm(A,t,e){let n=A.readFloat(),r=A.readFloat()*e,s=A.readFloat()*e;for(let o=0,l=0,c=t.getFrameCount()-1;t.setFrame(o,n,r,s),o!=c;o++){let a=A.readFloat(),i=A.readFloat()*e,h=A.readFloat()*e;switch(A.readByte()){case Xn:t.setStepped(o);break;case Ln:xt(A,t,l++,o,0,n,a,r,i,e),xt(A,t,l++,o,1,n,a,s,h,e)}n=a,r=i,s=h}return t}function xt(A,t,e,n,r,s,o,l,c,a){t.setBezier(e,n,r,s,l,A.readFloat(),A.readFloat()*a,A.readFloat(),A.readFloat()*a,o,c)}var Sf=0,Af=1,kf=2,If=3,Mf=4,vf=5,Cf=6,Ef=7,Tf=8,Bf=9,Ff=0,Df=1,Vf=2,Rf=3,Pf=4,Yf=5,Xf=0,Lf=1,Nf=2;var Xn=1,Ln=2;var Gm=class extends $e{};var Zm=class A{constructor(t){m(this,"attachmentLoader",null);m(this,"scale",1);m(this,"linkedMeshes",new Array);this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,n=new Gi,r=typeof t=="string"?JSON.parse(t):t,s=r.skeleton;if(s){if(n.hash=s.hash,n.version=s.spine,n.version.substr(0,3)!=="4.0"){let o=`Spine 4.0 loader cant load version ${s.spine}. Please configure your pixi-spine bundle`;console.error(o)}n.x=s.x,n.y=s.y,n.width=s.width,n.height=s.height,n.fps=s.fps,n.imagesPath=s.images}if(r.bones)for(let o=0;o<r.bones.length;o++){let l=r.bones[o],c=null,a=j(l,"parent",null);if(a!=null&&(c=n.findBone(a),c==null))throw new Error(`Parent bone not found: ${a}`);let i=new Ui(n.bones.length,l.name,c);i.length=j(l,"length",0)*e,i.x=j(l,"x",0)*e,i.y=j(l,"y",0)*e,i.rotation=j(l,"rotation",0),i.scaleX=j(l,"scaleX",1),i.scaleY=j(l,"scaleY",1),i.shearX=j(l,"shearX",0),i.shearY=j(l,"shearY",0),i.transformMode=Y.enumValue(me,j(l,"transform","Normal")),i.skinRequired=j(l,"skin",!1);let h=j(l,"color",null);h&&i.color.setFromString(h),n.bones.push(i)}if(r.slots)for(let o=0;o<r.slots.length;o++){let l=r.slots[o],c=n.findBone(l.bone),a=new ji(n.slots.length,l.name,c),i=j(l,"color",null);i&&a.color.setFromString(i);let h=j(l,"dark",null);h&&(a.darkColor=$.fromString(h)),a.attachmentName=j(l,"attachment",null),a.blendMode=A.blendModeFromString(j(l,"blend","normal")),n.slots.push(a)}if(r.ik)for(let o=0;o<r.ik.length;o++){let l=r.ik[o],c=new $i(l.name);c.order=j(l,"order",0),c.skinRequired=j(l,"skin",!1);for(let a=0;a<l.bones.length;a++){let i=l.bones[a],h=n.findBone(i);if(h==null)throw new Error(`IK bone not found: ${i}`);c.bones.push(h)}c.target=n.findBone(l.target),c.mix=j(l,"mix",1),c.softness=j(l,"softness",0)*e,c.bendDirection=j(l,"bendPositive",!0)?1:-1,c.compress=j(l,"compress",!1),c.stretch=j(l,"stretch",!1),c.uniform=j(l,"uniform",!1),n.ikConstraints.push(c)}if(r.transform)for(let o=0;o<r.transform.length;o++){let l=r.transform[o],c=new Zi(l.name);c.order=j(l,"order",0),c.skinRequired=j(l,"skin",!1);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findBone(a),c.target==null)throw new Error(`Transform constraint target bone not found: ${a}`);c.local=j(l,"local",!1),c.relative=j(l,"relative",!1),c.offsetRotation=j(l,"rotation",0),c.offsetX=j(l,"x",0)*e,c.offsetY=j(l,"y",0)*e,c.offsetScaleX=j(l,"scaleX",0),c.offsetScaleY=j(l,"scaleY",0),c.offsetShearY=j(l,"shearY",0),c.mixRotate=j(l,"mixRotate",1),c.mixX=j(l,"mixX",1),c.mixY=j(l,"mixY",c.mixX),c.mixScaleX=j(l,"mixScaleX",1),c.mixScaleY=j(l,"mixScaleY",c.mixScaleX),c.mixShearY=j(l,"mixShearY",1),n.transformConstraints.push(c)}if(r.path)for(let o=0;o<r.path.length;o++){let l=r.path[o],c=new zi(l.name);c.order=j(l,"order",0),c.skinRequired=j(l,"skin",!1);for(let i=0;i<l.bones.length;i++){let h=l.bones[i],d=n.findBone(h);if(d==null)throw new Error(`Transform constraint bone not found: ${h}`);c.bones.push(d)}let a=l.target;if(c.target=n.findSlot(a),c.target==null)throw new Error(`Path target slot not found: ${a}`);c.positionMode=Y.enumValue(Ie,j(l,"positionMode","Percent")),c.spacingMode=Y.enumValue(Fo,j(l,"spacingMode","Length")),c.rotateMode=Y.enumValue(Ye,j(l,"rotateMode","Tangent")),c.offsetRotation=j(l,"rotation",0),c.position=j(l,"position",0),c.positionMode==0&&(c.position*=e),c.spacing=j(l,"spacing",0),(c.spacingMode==0||c.spacingMode==1)&&(c.spacing*=e),c.mixRotate=j(l,"mixRotate",1),c.mixX=j(l,"mixX",1),c.mixY=j(l,"mixY",c.mixX),n.pathConstraints.push(c)}if(r.skins)for(let o=0;o<r.skins.length;o++){let l=r.skins[o],c=new ws(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let i=n.findBone(l.bones[a]);if(i==null)throw new Error(`Skin bone not found: ${l.bones[o]}`);c.bones.push(i)}if(l.ik)for(let a=0;a<l.ik.length;a++){let i=n.findIkConstraint(l.ik[a]);if(i==null)throw new Error(`Skin IK constraint not found: ${l.ik[o]}`);c.constraints.push(i)}if(l.transform)for(let a=0;a<l.transform.length;a++){let i=n.findTransformConstraint(l.transform[a]);if(i==null)throw new Error(`Skin transform constraint not found: ${l.transform[o]}`);c.constraints.push(i)}if(l.path)for(let a=0;a<l.path.length;a++){let i=n.findPathConstraint(l.path[a]);if(i==null)throw new Error(`Skin path constraint not found: ${l.path[o]}`);c.constraints.push(i)}for(let a in l.attachments){let i=n.findSlot(a);if(i==null)throw new Error(`Slot not found: ${a}`);let h=l.attachments[a];for(let d in h){let u=this.readAttachment(h[d],c,i.index,d,n);u&&c.setAttachment(i.index,d,u)}}n.skins.push(c),c.name=="default"&&(n.defaultSkin=c)}for(let o=0,l=this.linkedMeshes.length;o<l;o++){let c=this.linkedMeshes[o],i=(c.skin?n.findSkin(c.skin):n.defaultSkin).getAttachment(c.slotIndex,c.parent);c.mesh.deformAttachment=c.inheritDeform?i:c.mesh,c.mesh.setParentMesh(i)}if(this.linkedMeshes.length=0,r.events)for(let o in r.events){let l=r.events[o],c=new qi(o);c.intValue=j(l,"int",0),c.floatValue=j(l,"float",0),c.stringValue=j(l,"string",""),c.audioPath=j(l,"audio",null),c.audioPath&&(c.volume=j(l,"volume",1),c.balance=j(l,"balance",0)),n.events.push(c)}if(r.animations)for(let o in r.animations){let l=r.animations[o];this.readAnimation(l,o,n)}return n}readAttachment(t,e,n,r,s){let o=this.scale;switch(r=j(t,"name",r),j(t,"type","region")){case"region":{let l=j(t,"path",r),c=this.attachmentLoader.newRegionAttachment(e,r,l);if(!c)return null;c.path=l,c.x=j(t,"x",0)*o,c.y=j(t,"y",0)*o,c.scaleX=j(t,"scaleX",1),c.scaleY=j(t,"scaleY",1),c.rotation=j(t,"rotation",0),c.width=t.width*o,c.height=t.height*o;let a=j(t,"color",null);return a&&c.color.setFromString(a),c}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let c=j(t,"color",null);return c&&l.color.setFromString(c),l}case"mesh":case"linkedmesh":{let l=j(t,"path",r),c=this.attachmentLoader.newMeshAttachment(e,r,l);if(!c)return null;c.path=l;let a=j(t,"color",null);a&&c.color.setFromString(a),c.width=j(t,"width",0)*o,c.height=j(t,"height",0)*o;let i=j(t,"parent",null);if(i)return this.linkedMeshes.push(new Km(c,j(t,"skin",null),n,i,j(t,"deform",!0))),c;let h=t.uvs;return this.readVertices(t,c,h.length),c.triangles=t.triangles,c.regionUVs=new Float32Array(h),c.edges=j(t,"edges",null),c.hullLength=j(t,"hull",0)*2,c}case"path":{let l=this.attachmentLoader.newPathAttachment(e,r);if(!l)return null;l.closed=j(t,"closed",!1),l.constantSpeed=j(t,"constantSpeed",!0);let c=t.vertexCount;this.readVertices(t,l,c<<1);let a=Y.newArray(c/3,0);for(let h=0;h<t.lengths.length;h++)a[h]=t.lengths[h]*o;l.lengths=a;let i=j(t,"color",null);return i&&l.color.setFromString(i),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,r);if(!l)return null;l.x=j(t,"x",0)*o,l.y=j(t,"y",0)*o,l.rotation=j(t,"rotation",0);let c=j(t,"color",null);return c&&l.color.setFromString(c),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,r);if(!l)return null;let c=j(t,"end",null);if(c!=null){let h=s.findSlot(c);if(h==null)throw new Error(`Clipping end slot not found: ${c}`);l.endSlot=h}let a=t.vertexCount;this.readVertices(t,l,a<<1);let i=j(t,"color",null);return i&&l.color.setFromString(i),l}}return null}readVertices(t,e,n){let r=this.scale;e.worldVerticesLength=n;let s=t.vertices;if(n==s.length){let c=Y.toFloatArray(s);if(r!=1)for(let a=0,i=s.length;a<i;a++)c[a]*=r;e.vertices=c;return}let o=new Array,l=new Array;for(let c=0,a=s.length;c<a;){let i=s[c++];l.push(i);for(let h=c+i*4;c<h;c+=4)l.push(s[c]),o.push(s[c+1]*r),o.push(s[c+2]*r),o.push(s[c+3])}e.bones=l,e.vertices=Y.toFloatArray(o)}readAnimation(t,e,n){let r=this.scale,s=new Array;if(t.slots)for(let l in t.slots){let c=t.slots[l],a=n.findSlot(l).index;if(a==-1)throw new Error(`Slot not found: ${l}`);for(let i in c){let h=c[i];if(!h)continue;let d=h.length;if(i=="attachment"){let u=new In(d,a);for(let p=0;p<d;p++){let f=h[p];u.setFrame(p,j(f,"time",0),f.name)}s.push(u)}else if(i=="rgba"){let u=new Bi(d,d<<2,a),p=h[0],f=j(p,"time",0),g=$.fromString(p.color);for(let b=0,x=0;;b++){u.setFrame(b,f,g.r,g.g,g.b,g.a);let y=h[b+1];if(!y){u.shrink(x);break}let w=j(y,"time",0),k=$.fromString(y.color),S=p.curve;S&&(x=It(S,u,x,b,0,f,w,g.r,k.r,1),x=It(S,u,x,b,1,f,w,g.g,k.g,1),x=It(S,u,x,b,2,f,w,g.b,k.b,1),x=It(S,u,x,b,3,f,w,g.a,k.a,1)),f=w,g=k,p=y}s.push(u)}else if(i=="rgb"){let u=new Fi(d,d*3,a),p=h[0],f=j(p,"time",0),g=$.fromString(p.color);for(let b=0,x=0;;b++){u.setFrame(b,f,g.r,g.g,g.b);let y=h[b+1];if(!y){u.shrink(x);break}let w=j(y,"time",0),k=$.fromString(y.color),S=p.curve;S&&(x=It(S,u,x,b,0,f,w,g.r,k.r,1),x=It(S,u,x,b,1,f,w,g.g,k.g,1),x=It(S,u,x,b,2,f,w,g.b,k.b,1)),f=w,g=k,p=y}s.push(u)}else if(i=="alpha")s.push(hr(h,new Di(d,d,a),0,1));else if(i=="rgba2"){let u=new Vi(d,d*7,a),p=h[0],f=j(p,"time",0),g=$.fromString(p.light),b=$.fromString(p.dark);for(let x=0,y=0;;x++){u.setFrame(x,f,g.r,g.g,g.b,g.a,b.r,b.g,b.b);let w=h[x+1];if(!w){u.shrink(y);break}let k=j(w,"time",0),S=$.fromString(w.light),I=$.fromString(w.dark),M=p.curve;M&&(y=It(M,u,y,x,0,f,k,g.r,S.r,1),y=It(M,u,y,x,1,f,k,g.g,S.g,1),y=It(M,u,y,x,2,f,k,g.b,S.b,1),y=It(M,u,y,x,3,f,k,g.a,S.a,1),y=It(M,u,y,x,4,f,k,b.r,I.r,1),y=It(M,u,y,x,5,f,k,b.g,I.g,1),y=It(M,u,y,x,6,f,k,b.b,I.b,1)),f=k,g=S,b=I,p=w}s.push(u)}else if(i=="rgb2"){let u=new Ri(d,d*6,a),p=h[0],f=j(p,"time",0),g=$.fromString(p.light),b=$.fromString(p.dark);for(let x=0,y=0;;x++){u.setFrame(x,f,g.r,g.g,g.b,b.r,b.g,b.b);let w=h[x+1];if(!w){u.shrink(y);break}let k=j(w,"time",0),S=$.fromString(w.light),I=$.fromString(w.dark),M=p.curve;M&&(y=It(M,u,y,x,0,f,k,g.r,S.r,1),y=It(M,u,y,x,1,f,k,g.g,S.g,1),y=It(M,u,y,x,2,f,k,g.b,S.b,1),y=It(M,u,y,x,3,f,k,b.r,I.r,1),y=It(M,u,y,x,4,f,k,b.g,I.g,1),y=It(M,u,y,x,5,f,k,b.b,I.b,1)),f=k,g=S,b=I,p=w}s.push(u)}else throw new Error(`Invalid timeline type for a slot: ${i} (${l})`)}}if(t.bones)for(let l in t.bones){let c=t.bones[l],a=n.findBone(l).index;if(a==-1)throw new Error(`Bone not found: ${l}`);for(let i in c){let h=c[i],d=h.length;if(d!=0){if(i==="rotate")s.push(hr(h,new cr(d,d,a),0,1));else if(i==="translate"){let u=new Si(d,d<<1,a);s.push(jm(h,u,"x","y",0,r))}else if(i==="translatex"){let u=new Ai(d,d,a);s.push(hr(h,u,0,r))}else if(i==="translatey"){let u=new ki(d,d,a);s.push(hr(h,u,0,r))}else if(i==="scale"){let u=new Ii(d,d<<1,a);s.push(jm(h,u,"x","y",1,1))}else if(i==="scalex"){let u=new Mi(d,d,a);s.push(hr(h,u,1,1))}else if(i==="scaley"){let u=new vi(d,d,a);s.push(hr(h,u,1,1))}else if(i==="shear"){let u=new Ci(d,d<<1,a);s.push(jm(h,u,"x","y",0,1))}else if(i==="shearx"){let u=new Ei(d,d,a);s.push(hr(h,u,0,1))}else if(i==="sheary"){let u=new Ti(d,d,a);s.push(hr(h,u,0,1))}}}}if(t.ik)for(let l in t.ik){let c=t.ik[l],a=c[0];if(!a)continue;let i=n.findIkConstraint(l),h=n.ikConstraints.indexOf(i),d=new Yi(c.length,c.length<<1,h),u=j(a,"time",0),p=j(a,"mix",1),f=j(a,"softness",0)*r;for(let g=0,b=0;;g++){d.setFrame(g,u,p,f,j(a,"bendPositive",!0)?1:-1,j(a,"compress",!1),j(a,"stretch",!1));let x=c[g+1];if(!x){d.shrink(b);break}let y=j(x,"time",0),w=j(x,"mix",1),k=j(x,"softness",0)*r,S=a.curve;S&&(b=It(S,d,b,g,0,u,y,p,w,1),b=It(S,d,b,g,1,u,y,f,k,r)),u=y,p=w,f=k,a=x}s.push(d)}if(t.transform)for(let l in t.transform){let c=t.transform[l],a=c[0];if(!a)continue;let i=n.findTransformConstraint(l),h=n.transformConstraints.indexOf(i),d=new Xi(c.length,c.length*6,h),u=j(a,"time",0),p=j(a,"mixRotate",1),f=j(a,"mixX",1),g=j(a,"mixY",f),b=j(a,"mixScaleX",1),x=j(a,"mixScaleY",b),y=j(a,"mixShearY",1);for(let w=0,k=0;;w++){d.setFrame(w,u,p,f,g,b,x,y);let S=c[w+1];if(!S){d.shrink(k);break}let I=j(S,"time",0),M=j(S,"mixRotate",1),v=j(S,"mixX",1),E=j(S,"mixY",v),C=j(S,"mixScaleX",1),T=j(S,"mixScaleY",C),F=j(S,"mixShearY",1),D=a.curve;D&&(k=It(D,d,k,w,0,u,I,p,M,1),k=It(D,d,k,w,1,u,I,f,v,1),k=It(D,d,k,w,2,u,I,g,E,1),k=It(D,d,k,w,3,u,I,b,C,1),k=It(D,d,k,w,4,u,I,x,T,1),k=It(D,d,k,w,5,u,I,y,F,1)),u=I,p=M,f=v,g=E,b=C,x=T,b=C,a=S}s.push(d)}if(t.path)for(let l in t.path){let c=t.path[l],a=n.findPathConstraintIndex(l);if(a==-1)throw new Error(`Path constraint not found: ${l}`);let i=n.pathConstraints[a];for(let h in c){let d=c[h],u=d[0];if(!u)continue;let p=d.length;if(h==="position"){let f=new Li(p,p,a);s.push(hr(d,f,0,i.positionMode==0?r:1))}else if(h==="spacing"){let f=new Ni(p,p,a);s.push(hr(d,f,0,i.spacingMode==0||i.spacingMode==1?r:1))}else if(h==="mix"){let f=new Oi(p,p*3,a),g=j(u,"time",0),b=j(u,"mixRotate",1),x=j(u,"mixX",1),y=j(u,"mixY",x);for(let w=0,k=0;;w++){f.setFrame(w,g,b,x,y);let S=d[w+1];if(!S){f.shrink(k);break}let I=j(S,"time",0),M=j(S,"mixRotate",1),v=j(S,"mixX",1),E=j(S,"mixY",v),C=u.curve;C&&(k=It(C,f,k,w,0,g,I,b,M,1),k=It(C,f,k,w,1,g,I,x,v,1),k=It(C,f,k,w,2,g,I,y,E,1)),g=I,b=M,x=v,y=E,u=S}s.push(f)}}}if(t.deform)for(let l in t.deform){let c=t.deform[l],a=n.findSkin(l);if(a==null){if(Dt.FAIL_ON_NON_EXISTING_SKIN)throw new Error(`Skin not found: ${l}`);continue}for(let i in c){let h=c[i],d=n.findSlot(i).index;for(let u in h){let p=h[u],f=p[0];if(!f)continue;let g=a.getAttachment(d,u),b=g.bones,x=g.vertices,y=b?x.length/3*2:x.length,w=new Pi(p.length,p.length,d,g),k=j(f,"time",0);for(let S=0,I=0;;S++){let M,v=j(f,"vertices",null);if(!v)M=b?Y.newFloatArray(y):x;else{M=Y.newFloatArray(y);let F=j(f,"offset",0);if(Y.arrayCopy(v,0,M,F,v.length),r!=1)for(let D=F,V=D+v.length;D<V;D++)M[D]*=r;if(!b)for(let D=0;D<y;D++)M[D]+=x[D]}w.setFrame(S,k,M);let E=p[S+1];if(!E){w.shrink(I);break}let C=j(E,"time",0),T=f.curve;T&&(I=It(T,w,I,S,0,k,C,0,1,1)),k=C,f=E}s.push(w)}}}if(t.drawOrder){let l=new Yn(t.drawOrder.length),c=n.slots.length,a=0;for(let i=0;i<t.drawOrder.length;i++,a++){let h=t.drawOrder[i],d=null,u=j(h,"offsets",null);if(u){d=Y.newArray(c,-1);let p=Y.newArray(c-u.length,0),f=0,g=0;for(let b=0;b<u.length;b++){let x=u[b],y=n.findSlot(x.slot).index;for(;f!=y;)p[g++]=f++;d[f+x.offset]=f++}for(;f<c;)p[g++]=f++;for(let b=c-1;b>=0;b--)d[b]==-1&&(d[b]=p[--g])}l.setFrame(a,j(h,"time",0),d)}s.push(l)}if(t.events){let l=new Wr(t.events.length),c=0;for(let a=0;a<t.events.length;a++,c++){let i=t.events[a],h=n.findEvent(i.name),d=new Wi(Y.toSinglePrecision(j(i,"time",0)),h);d.intValue=j(i,"int",h.intValue),d.floatValue=j(i,"float",h.floatValue),d.stringValue=j(i,"string",h.stringValue),d.data.audioPath&&(d.volume=j(i,"volume",1),d.balance=j(i,"balance",0)),l.setFrame(c,d)}s.push(l)}let o=0;for(let l=0,c=s.length;l<c;l++)o=Math.max(o,s[l].getDuration());if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");n.animations.push(new Ur(e,s,o))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return 0;if(t=="additive")return 1;if(t=="multiply")return 2;if(t=="screen")return 3;throw new Error(`Unknown blend mode: ${t}`)}},Km=class{constructor(t,e,n,r,s){m(this,"parent");m(this,"skin");m(this,"slotIndex");m(this,"mesh");m(this,"inheritDeform");this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=s}};function hr(A,t,e,n){let r=A[0],s=j(r,"time",0),o=j(r,"value",e)*n,l=0;for(let c=0;;c++){t.setFrame(c,s,o);let a=A[c+1];if(!a)return t.shrink(l),t;let i=j(a,"time",0),h=j(a,"value",e)*n;r.curve&&(l=It(r.curve,t,l,c,0,s,i,o,h,n)),s=i,o=h,r=a}}function jm(A,t,e,n,r,s){let o=A[0],l=j(o,"time",0),c=j(o,e,r)*s,a=j(o,n,r)*s,i=0;for(let h=0;;h++){t.setFrame(h,l,c,a);let d=A[h+1];if(!d)return t.shrink(i),t;let u=j(d,"time",0),p=j(d,e,r)*s,f=j(d,n,r)*s,g=o.curve;g&&(i=It(g,t,i,h,0,l,u,c,p,s),i=It(g,t,i,h,1,l,u,a,f,s)),l=u,c=p,a=f,o=d}}function It(A,t,e,n,r,s,o,l,c,a){if(A=="stepped")return t.setStepped(n),e;let i=r<<2,h=A[i],d=A[i+1]*a,u=A[i+2],p=A[i+3]*a;return t.setBezier(e,n,r,s,l,h,d,u,p,o,c),e+1}function j(A,t,e){return A[t]!==void 0?A[t]:e}var Jm=class extends Ee{createSkeleton(t){this.skeleton=new yc(t),this.skeleton.updateWorldTransform(),this.stateData=new pc(t),this.state=new fc(this.stateData)}};var wh=class extends Ee{createSkeleton(t){let e=dr(t.version||t.spine.version),n=null;if(e===37&&(n=Lc),e===38&&(n=lo),e===40&&(n=Sc),e===41&&(n=bo),e===42&&(n=hc),!n){let r=`Cant detect version of spine model ${t.version}`;console.error(r)}this.skeleton=new n.Skeleton(t),this.skeleton.updateWorldTransform(e===42&&2),this.stateData=new n.AnimationStateData(t),this.state=new n.AnimationState(this.stateData),this.skeleton.setToSetupPose()}};new jc().installLoader();var Ss=class{constructor(t){m(this,"index");m(this,"buffer");m(this,"strings");this.index=0,this.buffer=new DataView(t),this.strings=[]}readByte(){return this.buffer.getUint8(this.index++)}readSByte(){return this.readByte()}readShort(){let t=this.buffer.getInt16(this.index,!1);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index,!1);return this.index+=4,t}readVarint(t){let e=0,n=0,r;do r=this.readByte(),e|=(r&127)<<n,n+=7;while(r&128&&n<35);return t?e:e>>>1^-(e&1)}readColor(){return{r:this.readByte(),g:this.readByte(),b:this.readByte(),a:this.readByte()}}readColorHex(){let t=this.readColor(),e=n=>{let r=n.toString(16);return r.length===2?r:"0"+r};return e(t.r)+e(t.g)+e(t.b)+e(t.a)}readStringRef(){let t=this.readVarint(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readVarint(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let n=0;n<t;){let r=this.readByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),n+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index,!1);return this.index+=4,t}readFloat21(){return(this.readByte()<<24)+(this.readByte()<<16)+(this.readByte()<<8)+(this.readByte()<<0)}readBoolean(){return this.readByte()!==0}readIntArray(){let t=this.readVarint(!0),e=new Array(t);for(let n=0;n<t;n++)e[n]=this.readVarint(!0);return e}readCurve(){switch(this.readByte()){case 1:return"stepped";case 2:let t=this.readFloat(),e=this.readFloat(),n=this.readFloat(),r=this.readFloat();return[t,e,n,r];default:return}}readFloatArray(t){let e=t!==void 0?t:this.readVarint(!0),n=new Array(e);for(let r=0;r<e;r++)n[r]=this.readFloat();return n}readShortArray(){let t=this.readVarint(!0),e=new Array(t);for(let n=0;n<t;++n){let r=this.readByte()<<8;r|=this.readByte(),e[n]=r}return e}};function Ki(A,t,e){let n=e*2,r=[];if(!A.readBoolean()){t.verticesCount=n,t.vertices=A.readFloatArray(n),t.bonesCount=0;return}for(let s=0;s<e;++s){let o=A.readVarint(!0);r.push(o);for(let l=0;l<o;++l)r.push(A.readVarint(!0)),r.push(A.readFloat()),r.push(A.readFloat()),r.push(A.readFloat())}t.vertices=r}function Of(A,t,e,n){let r=A.readString();r||(r=t);let s=A.readByte(),o=["region","boundingbox","mesh","linkedmesh","path","point","clipping"],l={};switch(s){case 0:{let c=A.readString();c||(c=r),l.path=c,l.rotation=A.readFloat(),l.x=A.readFloat(),l.y=A.readFloat(),l.scaleX=A.readFloat(),l.scaleY=A.readFloat(),l.width=A.readFloat(),l.height=A.readFloat(),l.color=A.readColorHex();break}case 1:{let c=A.readVarint(!0);l.vertexCount=c,Ki(A,l,c),n&&(l.color=A.readColorHex());break}case 2:{let c=A.readString();c||(c=r),l.path=c,l.color=A.readColorHex(),l.vertexCount=A.readVarint(!0),l.uvs=A.readFloatArray(l.vertexCount*2),l.triangles=A.readShortArray(),Ki(A,l,l.vertexCount),l.hull=A.readVarint(!0),n&&(l.edges=A.readShortArray(),l.width=A.readFloat(),l.height=A.readFloat());break}case 3:{let c=A.readString();c||(c=r),l.path=c,l.color=A.readColorHex(),l.skin=A.readString()||void 0,l.parent=A.readString()||void 0,l.inheritDeform=A.readBoolean(),n&&(l.width=A.readFloat(),l.height=A.readFloat());break}case 4:{l.closed=A.readBoolean(),l.constantSpeed=A.readBoolean();let c=A.readVarint(!0);l.vertexCount=c,Ki(A,l,c);let a=c/3;l.lengths=new Array(a);for(let i=0;i<a;++i)l.lengths[i]=A.readFloat();n&&(l.color=A.readColorHex());break}case 5:{l.rotation=A.readFloat(),l.x=A.readFloat(),l.y=A.readFloat(),n&&(l.color=A.readColorHex());break}case 6:{let c=A.readVarint(!0),a=A.readVarint(!0);l.vertexCount=a,Ki(A,l,a),n&&(l.color=A.readColorHex()),e.slots&&e.slots[c]&&(l.end=e.slots[c].name);break}}return l.type=o[s],l.name||(l.name=t),l}function Do(A,t,e){let n=A.readVarint(!0);if(n===0)return null;let r={};for(let s=0;s<n;++s){let o=A.readVarint(!0),l=A.readVarint(!0),c={};for(let a=0;a<l;++a){let i=A.readString();if(i){let h=Of(A,i,t,e);h&&(c[i]=h)}}t.slots&&t.slots[o]&&(r[t.slots[o].name]=c)}return r}function Ah(A,t,e,n=36){let r={},s=0,o={},l=A.readVarint(!0);for(let S=0;S<l;++S){let I=A.readVarint(!0),M={},v=A.readVarint(!0);for(let E=0;E<v;++E){let C=A.readByte(),T=A.readVarint(!0);switch(C){case 0:{let F=[];for(let D=0;D<T;++D){let V={time:A.readFloat(),name:A.readString()};F.push(V)}M.attachment=F,F[T-1]&&(s=Math.max(s,F[T-1].time));break}case 1:{let F=[];for(let D=0;D<T;++D){let V={time:A.readFloat(),color:A.readColorHex()};if(D<T-1){let X=A.readCurve();X!==void 0&&(V.curve=X)}F.push(V)}M.color=F,F[T-1]&&(s=Math.max(s,F[T-1].time));break}case 2:{let F=[];for(let D=0;D<T;++D){let V={time:A.readFloat(),light:A.readColorHex(),dark:A.readColorHex()};if(D<T-1){let X=A.readCurve();X!==void 0&&(V.curve=X)}F.push(V)}M.twoColor=F,F[T-1]&&(s=Math.max(s,F[T-1].time));break}default:return null}}t.slots&&t.slots[I]&&(o[t.slots[I].name]=M)}r.slots=o;let c={},a=A.readVarint(!0);for(let S=0;S<a;S++){let I=A.readVarint(!0),M={},v=A.readVarint(!0);for(let E=0;E<v;E++){let C=A.readByte(),T=A.readVarint(!0),F=D=>{let V=[];for(let X=0;X<T;X++){let N=D();if(X<T-1){let q=A.readCurve();q&&(N.curve=q)}V.push(N)}return V};switch(C){case 0:{let D=F(()=>({time:A.readFloat(),angle:A.readFloat()}));M.rotate=D,D[T-1]&&(s=Math.max(s,D[T-1].time));break}case 1:case 2:case 3:{let D=["","translate","scale","shear"],V=F(()=>({time:A.readFloat(),x:A.readFloat(),y:A.readFloat()}));M[D[C]]=V;break}default:return null}}t.bones&&t.bones[I]&&(c[t.bones[I].name]=M)}r.bones=c;let i={},h=A.readVarint(!0);for(let S=0;S<h;++S){let I=A.readVarint(!0),M=A.readVarint(!0),v=[];for(let E=0;E<M;++E){let C={time:A.readFloat(),mix:A.readFloat(),bendPositive:A.readByte()!==255};if(n===37&&(C.compress=A.readBoolean(),C.stretch=A.readBoolean()),E<M-1){let T=A.readCurve();T&&(C.curve=T)}v.push(C)}t.ik&&t.ik[I]&&(i[t.ik[I].name]=v)}r.ik=i;let d={},u=A.readVarint(!0);for(let S=0;S<u;++S){let I=A.readVarint(!0),M=A.readVarint(!0),v=[];for(let E=0;E<M;++E){let C={time:A.readFloat(),rotateMix:A.readFloat(),translateMix:A.readFloat(),scaleMix:A.readFloat(),shearMix:A.readFloat()};if(E<M-1){let T=A.readCurve();T!==void 0&&(C.curve=T)}v.push(C)}t.transform&&t.transform[I]&&(d[t.transform[I].name]=v)}r.transform=d;let p={},f=A.readVarint(!0);for(let S=0;S<f;S++){let I=A.readVarint(!0),M=A.readVarint(!0);if(t.path&&t.path[I]){let v=t.path[I].name;p[v]={};for(let E=0;E<M;E++){let C=A.readByte(),T=A.readVarint(!0),D=["position","spacing","mix"][C],V=N=>{let q=[];for(let L=0;L<T;L++){let R=N();if(L<T-1){let P=A.readCurve();P&&(R.curve=P)}q.push(R)}return q},X;switch(C){case 0:case 1:X=V(()=>({time:A.readFloat(),position:A.readFloat()}));break;case 2:X=V(()=>({time:A.readFloat(),rotateMix:A.readFloat(),translateMix:A.readFloat()}));break;default:return null}p[v][D]=X,X[T-1]&&(s=Math.max(s,X[T-1].time))}}}r.paths=p;let g={},b=S=>{let I=[];for(let M=0;M<S;M++){let v={time:A.readFloat()},E=A.readVarint(!0);if(E>0){let C=A.readVarint(!0),T=Array.from({length:E},()=>A.readFloat());v.vertices=T,v.offset=C}if(M<S-1){let C=A.readCurve();C!==void 0&&(v.curve=C)}I.push(v)}return I},x=(S,I)=>{for(let M in S)if(S[M].name===I)return S[M];return null},y=A.readVarint(!0);for(let S=0;S<y;S++){let I=A.readVarint(!0),M=e[I].data;if(M){let v={},E=A.readVarint(!0);for(let C=0;C<E;C++){let T=A.readVarint(!0);if(t.slots&&t.slots[T]){let F=t.slots[T].name,D={},V=A.readVarint(!0);for(let X=0;X<V;X++){let N=A.readString();if(N){let q=M[F],L=x(q,N);if(!L&&I!==0&&e[0].data&&(q=e[0].data[F],L=x(q,N)),!L)throw new Error("\u5339\u914Ddeform\u4E2D\u7684attachment\u5931\u8D25");let R=A.readVarint(!0),P=b(R);D[N]=P,P[R-1]&&(s=Math.max(s,P[R-1].time))}}v[F]=D}}g[e[I].name]=v}}r.deform=g;let w=A.readVarint(!0);if(w){let S=[];for(let I=0;I<w;++I){let M={},v=A.readFloat(),E=A.readVarint(!0),C=[];for(let T=0;T<E;++T){let F=A.readVarint(!0);if(t.slots&&t.slots[F]){let D={slot:t.slots[F].name,offset:A.readVarint(!0)};C.push(D)}}M.offsets=C,M.time=v,S.push(M)}S[w-1]&&(s=Math.max(s,S[w-1].time)),r.drawOrder=S}let k=A.readVarint(!0);if(k&&t.events){let S=[],I=Object.keys(t.events);for(let M=0;M<k;++M){let v=A.readFloat(),E=I[A.readVarint(!0)],C=t.events[E],T={int:A.readVarint(!1),float:A.readFloat(),string:A.readBoolean()?A.readString():C?C.stringValue:"",time:v,name:E};S.push(T)}r.events=S,S[k-1]&&(s=Math.max(s,S[k-1].time))}return Object.keys(r).forEach(S=>{Object.keys(r[S]).length===0&&delete r[S]}),r}function kh(A){let t={},e=new Ss(A),n={hash:e.readString()||"",spine:e.readString()||"",width:e.readFloat(),height:e.readFloat(),images:void 0},r=e.readBoolean();r&&(n.images=e.readString()||void 0),t.skeleton=n;let s=e.readVarint(!0);t.bones=[];for(let u=0;u<s;u++){let p={name:e.readString()||"",parent:null},f=e.readVarint(!0)-1;f!==-1&&t.bones[f]&&(p.parent=t.bones[f].name),p.x=e.readFloat(),p.y=e.readFloat(),p.scaleX=e.readFloat(),p.scaleY=e.readFloat(),p.rotation=e.readFloat(),p.length=e.readFloat(),p.flipX=e.readBoolean(),p.flipY=e.readBoolean(),p.inheritScale=e.readBoolean(),p.inheritRotation=e.readBoolean(),["rotation","x","y","length","flipX","flipY"].forEach(x=>{p[x]===0&&delete p[x]}),["scaleX","scaleY"].forEach(x=>{p[x]===1&&delete p[x]}),r&&(p.color=e.readColorHex()),t.bones.push(p)}let o=e.readVarint(!0);t.ik=new Array(o);for(let u=0;u<o;++u){let p={name:e.readString()||"",bones:[],target:"",mix:0,bendPositive:!1},f=e.readVarint(!0);p.bones=new Array(f);for(let g=0;g<f;++g)t.bones&&(p.bones[g]=t.bones[e.readVarint(!0)].name);t.bones&&(p.target=t.bones[e.readVarint(!0)].name),p.mix=e.readFloat(),p.bendPositive=e.readByte()!==255,t.ik[u]=p}t.slots=[];let l=e.readVarint(!0);for(let u=0;u<l;++u){let p=e.readString()||"",f=e.readVarint(!0),g=t.bones[f],b={name:p,bone:g?g.name:""},x=e.readColorHex();x!=="ffffffff"&&(b.color=x),b.attachment=e.readString()||void 0,b.blend=["normal","additive","multiply","screen"][e.readVarint(!0)],t.slots[u]=b}t.skins={};let c=[],a=Vd(e,t,r);t.skins.default=a,c.push({name:"default",data:a});let i=e.readVarint(!0);t.defaultSkin&&i++,t.defaultSkin&&(t.skins.default=t.defaultSkin);for(let u=t.defaultSkin?1:0;u<i;++u){let p=e.readString()||"",f=Vd(e,t,r);t.skins[p]=f,c.push({name:p,data:f})}let h=e.readVarint(!0);t.events={};for(let u=0;u<h;++u){let p=e.readString()||"",f={intValue:e.readVarint(!1),floatValue:e.readFloat(),stringValue:e.readString()||void 0};t.events[p]=f}let d=e.readVarint(!0);t.animations={};for(let u=0;u<d;++u){let p=e.readString()||"",f=qf(e,t,c);if(!f)throw new Error("\u8BFB\u53D6\u52A8\u753B\u5217\u8868\u65F6\u51FA\u73B0\u9519\u8BEF");t.animations[p]=f}return t}function Vd(A,t,e){let n=A.readVarint(!0);if(n===0)return null;let r={};for(let s=0;s<n;++s){let o=A.readVarint(!0),l=A.readVarint(!0),c={};for(let a=0;a<l;++a){let i=A.readString();if(i){let h=Uf(A,i,t,e);h&&(c[i]=h)}}t.slots&&t.slots[o]&&(r[t.slots[o].name]=c)}return r}function Uf(A,t,e,n){let r=["region","boundingbox","mesh","linkedmesh","path","point","clipping"],s=A.readString()||t,o=A.readByte();if(o>=r.length)return console.warn(`Invalid attachment type: ${o}`),null;let l={name:s,type:r[o],path:o<=3?A.readString()||s:void 0};switch(o){case 0:Object.assign(l,{x:A.readFloat(),y:A.readFloat(),scaleX:A.readFloat(),scaleY:A.readFloat(),rotation:A.readFloat(),width:A.readFloat(),height:A.readFloat(),color:A.readColorHex()});break;case 1:l.vertices=A.readFloatArray();break;case 2:Object.assign(l,{uvs:A.readFloatArray(),triangles:A.readShortArray(),vertices:A.readFloatArray(),color:A.readColorHex(),hull:A.readVarint(!0),...n&&{edges:A.readIntArray(),width:A.readFloat(),height:A.readFloat()}});break;case 3:l.uvs=A.readFloatArray(),l.triangles=A.readShortArray(),l.vertices=Wf(A),l.color=A.readColorHex(),l.hull=A.readVarint(!0),n&&(l.edges=A.readIntArray(),l.size={width:A.readFloat(),height:A.readFloat()});break;case 4:{l.closed=A.readBoolean(),l.constantSpeed=A.readBoolean();let c=A.readVarint(!0);Ki(A,l,c),l.vertices&&(l.lengths=A.readFloatArray(Math.ceil(l.vertices.length/3))),n&&(l.color=A.readColorHex());break}case 6:{let c=A.readVarint(!0),a=A.readVarint(!0);Ki(A,l,a),e.slots&&e.slots[c]&&(l.end=e.slots[c].name),n&&(l.color=A.readColorHex());break}}return l}function Wf(A){let t=[],e=A.readVarint(!0);for(let n=0;n<e;){let r=Math.floor(A.readFloat());t[n++]=r;for(let s=n+r*4;n<s;n+=4)t[n]=Math.floor(A.readFloat()),t[n+1]=A.readFloat(),t[n+2]=A.readFloat(),t[n+3]=A.readFloat()}return t}function qf(A,t,e){let r={},s=0,o={},l=A.readVarint(!0);for(let g=0;g<l;g++){let b=A.readVarint(!0),x={},y=A.readVarint(!0);for(let w=0;w<y;w++){let k=A.readByte(),S=A.readVarint(!0),I=new Array(S);for(let M=0;M<S;M++){let v=A.readFloat();switch(I[M]={time:v},k){case 3:I[M].name=A.readString();break;case 4:I[M].color=A.readColorHex(),M<S-1&&A.readCurve();break;default:return t.slots&&t.slots[b]&&console.error(`Invalid timeline type ${k} for slot: ${t.slots[b].name}`),null}}x[k===3?"attachment":"color"]=I,s=Math.max(s,I[S-1].time)}t.slots&&t.slots[b]&&(o[t.slots[b].name]=x)}r.slots=o;let c={},a=A.readVarint(!0);for(let g=0;g<a;g++){let b=A.readVarint(!0),x={},y=A.readVarint(!0);for(let w=0;w<y;w++){let k=A.readByte(),S=A.readVarint(!0),I=new Array(S);for(let M=0;M<S;M++){let v={time:A.readFloat()};switch(k){case 1:v.angle=A.readFloat();break;case 2:case 0:v.x=A.readFloat(),v.y=A.readFloat();break;case 5:case 6:v[k===5?"x":"y"]=A.readBoolean();break;default:return t.bones&&t.bones[b]&&console.error(`Invalid bone timeline type ${k} for: ${t.bones[b].name}`),null}if(M<S-1){let E=A.readCurve();E&&(v.curve=E)}I[M]=v,s=Math.max(s,v.time)}x[k===1?"rotate":k===0?"scale":k===2?"translate":k===5?"flipX":"flipY"]=I}t.bones&&t.bones[b]&&(c[t.bones[b].name]=x)}r.bones=c;let i={},h=A.readVarint(!0);for(let g=0;g<h;g++){let b=A.readVarint(!0),x=A.readVarint(!0),y=new Array(x);for(let w=0;w<x;w++){let k={time:A.readFloat(),mix:A.readFloat(),bendPositive:A.readByte()!==255};if(w<x-1){let S=A.readCurve();S&&(k.curve=S)}y[w]=k}t.ik&&t.ik[b]?i[t.ik[b].name]=y:console.warn(`Missing IK constraint index: ${b}`)}let d={},u=A.readVarint(!0);for(let g=0;g<u;g++){let b=A.readVarint(!0),x={},y=A.readVarint(!0);for(let w=0;w<y;w++){let k=A.readVarint(!0),S={},I=A.readVarint(!0);for(let M=0;M<I;M++){let v=A.readString();if(v){let E=A.readVarint(!0),C,F=t.skins[e[b].name][t.slots[k].name];for(let V in F)F[V].name===v&&(C=F[V]);C||console.log("FFD attachment not found: "+v);let D=new Array(E);for(let V=0;V<E;V++){let X=A.readFloat(),N;C.type==="mesh"?N=C.vertices.length:N=C.uvs.length*3*3;let q=new Array(N);for(let P=0;P<N;P++)q[P]=0;let L=.1,R=A.readVarint(!0);if(R===0){if(C.type==="mesh")for(let P=0;P<N;P++)q[P]+=C.vertices[P]*L}else{let P=A.readVarint(!0);R+=P;for(let H=P;H<R;H++)q[H]=A.readFloat()*1;if(C.type==="mesh"){let H=C.vertices;for(let U=0,z=q.length;U<z;U++)q[U]+=H[U]*L}}D[V]={time:X,vertices:q},V<E-1&&A.readCurve()}S[v]=D,s=Math.max(s,D[E-1].time)}}t.slots&&t.slots[k]&&(x[t.slots[k].name]=S)}d[e[b].name]=x}r.ffd=d;let p=A.readVarint(!0);if(p){let g=[];for(let b=0;b<p;++b){let x={},y=A.readVarint(!0),w=[];for(let S=0;S<y;++S){let I=A.readVarint(!0);if(t.slots&&t.slots[I]){let M={slot:t.slots[I].name,offset:A.readVarint(!0)};w.push(M)}}x.offsets=w;let k=A.readFloat();x.time=k,g.push(x)}s=Math.max(s,g[p-1].time),r.drawOrder=g}let f=A.readVarint(!0);if(f&&t.events){let g=[],b=Object.keys(t.events);for(let x=0;x<f;++x){let y=A.readFloat(),w=b[A.readVarint(!0)],k={int:A.readVarint(!1),float:A.readFloat(),string:A.readBoolean()?A.readString():w,time:y,name:w};g.push(k)}r.events=g,s=Math.max(s,g[f-1].time)}return Object.keys(r).forEach(g=>{Object.keys(r[g]).length===0&&delete r[g]}),r}function Ih(A){let t={},e=new Ss(A),n={hash:e.readString()||"",spine:e.readString()||"",width:e.readFloat(),height:e.readFloat(),fps:void 0,images:void 0},r=n.spine.startsWith("3.5"),s=e.readBoolean();s&&(r&&(n.fps=e.readFloat()),n.images=e.readString()||void 0),t.skeleton=n;let o=e.readVarint(!0);t.bones=[];for(let g=0;g<o;g++){let b={name:e.readString()||"",parent:null},x=g===0?null:e.readVarint(!0);if(x!==null&&t.bones[x]&&(b.parent=t.bones[x].name),b.rotation=e.readFloat(),b.x=e.readFloat(),b.y=e.readFloat(),b.scaleX=e.readFloat(),b.scaleY=e.readFloat(),b.shearX=e.readFloat(),b.shearY=e.readFloat(),b.length=e.readFloat(),["rotation","x","y","shearX","shearY","length"].forEach(k=>{b[k]===0&&delete b[k]}),["scaleX","scaleY"].forEach(k=>{b[k]===1&&delete b[k]}),r){let k=["normal","onlytranslation","norotationorreflection","noscale","noscaleorreflection"];b.transform=k[e.readVarint(!0)]}else b.inheritRotation=e.readBoolean(),b.inheritScale=e.readBoolean();s&&(b.color=e.readColorHex()),t.bones.push(b)}t.slots=[];let l=e.readVarint(!0);for(let g=0;g<l;++g){let b=e.readString()||"",x=e.readVarint(!0),y=t.bones[x],w={name:b,bone:y?y.name:""},k=e.readColorHex();k!=="ffffffff"&&(w.color=k),w.attachment=e.readString()||void 0,w.blend=["normal","additive","multiply","screen"][e.readVarint(!0)],t.slots[g]=w}let c=e.readVarint(!0);t.ik=new Array(c);for(let g=0;g<c;++g){let b={name:e.readString()||"",bones:[],target:"",mix:0,bendPositive:!1};r&&(b.order=e.readVarint(!0));let x=e.readVarint(!0);b.bones=new Array(x);for(let y=0;y<x;++y)t.bones&&(b.bones[y]=t.bones[e.readVarint(!0)].name);t.bones&&(b.target=t.bones[e.readVarint(!0)].name),b.mix=e.readFloat(),b.bendPositive=e.readByte()!==255,t.ik[g]=b}let a=e.readVarint(!0);t.transform=new Array(a);for(let g=0;g<a;++g){let b={name:e.readString()||"",bones:[],target:"",rotation:0,x:0,y:0,scaleX:0,scaleY:0,shearY:0,rotateMix:0,translateMix:0,scaleMix:0,shearMix:0};r&&(b.order=e.readVarint(!0));let x=e.readVarint(!0);b.bones=new Array(x);for(let y=0;y<x;++y)t.bones&&(b.bones[y]=t.bones[e.readVarint(!0)].name);t.bones&&(b.target=t.bones[e.readVarint(!0)].name),b.rotation=e.readFloat(),b.x=e.readFloat(),b.y=e.readFloat(),b.x||delete b.x,b.y||delete b.y,b.scaleX=e.readFloat(),b.scaleY=e.readFloat(),b.shearY=e.readFloat(),b.rotateMix=e.readFloat(),b.translateMix=e.readFloat(),b.scaleMix=e.readFloat(),b.shearMix=e.readFloat(),t.transform[g]=b}let i=e.readVarint(!0);t.path=new Array(i);for(let g=0;g<i;++g){let x={name:e.readString()||"",bones:[],target:"",positionMode:"fixed",spacingMode:"length",rotateMode:"tangent",rotation:0,position:0,spacing:0,rotateMix:0,translateMix:0};r&&(x.order=e.readVarint(!0));let y=e.readVarint(!0);x.bones=new Array(y);for(let w=0;w<y;++w)t.bones&&(x.bones[w]=t.bones[e.readVarint(!0)].name);t.slots&&(x.target=t.slots[e.readVarint(!0)].name),x.positionMode=["fixed","percent"][e.readVarint(!0)],x.spacingMode=["length","fixed","percent"][e.readVarint(!0)],x.rotateMode=["tangent","chain","chainScale"][e.readVarint(!0)],x.rotation=e.readFloat(),x.position=e.readFloat(),x.spacing=e.readFloat(),x.rotateMix=e.readFloat(),x.translateMix=e.readFloat(),t.path[g]=x,Object.keys(x).forEach(w=>{x[w]===0&&delete x[w]})}t.skins={};let h=[],d=Do(e,t,s);t.skins.default=d,h.push({name:"default",data:d});let u=e.readVarint(!0);t.defaultSkin&&u++,t.defaultSkin&&(t.skins.default=t.defaultSkin);for(let g=t.defaultSkin?1:0;g<u;++g){let b=e.readString()||"",x=Do(e,t,s);t.skins[b]=x,h.push({name:b,data:x})}let p=e.readVarint(!0);t.events={};for(let g=0;g<p;++g){let b=e.readString()||"",x={intValue:e.readVarint(!1),floatValue:e.readFloat(),stringValue:e.readString()||void 0};t.events[b]=x}let f=e.readVarint(!0);t.animations={};for(let g=0;g<f;++g){let b=e.readString()||"",x=Ah(e,t,h);if(!x)throw new Error("\u8BFB\u53D6\u52A8\u753B\u5217\u8868\u65F6\u51FA\u73B0\u9519\u8BEF");t.animations[b]=x}return t}function Mh(A){let t={},e=new Ss(A),n={hash:e.readString()||"",spine:e.readString()||"",width:e.readFloat(),height:e.readFloat(),fps:void 0,images:void 0},r=n.spine.startsWith("3.7")?37:36,s=e.readBoolean();s&&(n.fps=e.readFloat(),n.images=e.readString()||void 0,r===37&&e.readString()),t.skeleton=n;let o=e.readVarint(!0);t.bones=[];for(let g=0;g<o;g++){let b={name:e.readString()||"",parent:null},x=g===0?null:e.readVarint(!0);x!==null&&t.bones[x]&&(b.parent=t.bones[x].name),b.rotation=e.readFloat(),b.x=e.readFloat(),b.y=e.readFloat(),b.scaleX=e.readFloat(),b.scaleY=e.readFloat(),b.shearX=e.readFloat(),b.shearY=e.readFloat(),b.length=e.readFloat(),["rotation","x","y","shearX","shearY","length"].forEach(S=>{b[S]===0&&delete b[S]}),["scaleX","scaleY"].forEach(S=>{b[S]===1&&delete b[S]});let k=["normal","onlytranslation","norotationorreflection","noscale","noscaleorreflection"];b.transform=k[e.readVarint(!0)],s&&(b.color=e.readColorHex()),t.bones.push(b)}t.slots=[];let l=e.readVarint(!0);for(let g=0;g<l;++g){let b=e.readString()||"",x=e.readVarint(!0),y=t.bones[x],w={name:b,bone:y?y.name:""},k=e.readColorHex();k!=="ffffffff"&&(w.color=k);let S=e.readColorHex();S!=="ffffffff"&&(w.dark=S),w.attachment=e.readString()||void 0,w.blend=["normal","additive","multiply","screen"][e.readVarint(!0)],t.slots[g]=w}let c=e.readVarint(!0);t.ik=new Array(c);for(let g=0;g<c;++g){let b={name:e.readString()||"",bones:[],target:"",mix:0,bendPositive:!1};b.order=e.readVarint(!0);let x=e.readVarint(!0);b.bones=new Array(x);for(let y=0;y<x;++y)t.bones&&(b.bones[y]=t.bones[e.readVarint(!0)].name);t.bones&&(b.target=t.bones[e.readVarint(!0)].name),b.mix=e.readFloat(),b.bendPositive=e.readByte()!==255,t.skeleton.spine.startsWith("3.7")&&(b.compress=e.readBoolean(),b.stretch=e.readBoolean(),b.uniform=e.readBoolean()),t.ik[g]=b}let a=e.readVarint(!0);t.transform=new Array(a);for(let g=0;g<a;++g){let b={name:e.readString()||"",bones:[],target:"",rotation:0,x:0,y:0,scaleX:0,scaleY:0,shearY:0,rotateMix:0,translateMix:0,scaleMix:0,shearMix:0};b.order=e.readVarint(!0);let x=e.readVarint(!0);b.bones=new Array(x);for(let y=0;y<x;++y)t.bones&&(b.bones[y]=t.bones[e.readVarint(!0)].name);t.bones&&(b.target=t.bones[e.readVarint(!0)].name),b.local=e.readBoolean(),b.relative=e.readBoolean(),b.rotation=e.readFloat(),b.x=e.readFloat(),b.y=e.readFloat(),b.x||delete b.x,b.y||delete b.y,b.scaleX=e.readFloat(),b.scaleY=e.readFloat(),b.shearY=e.readFloat(),b.rotateMix=e.readFloat(),b.translateMix=e.readFloat(),b.scaleMix=e.readFloat(),b.shearMix=e.readFloat(),t.transform[g]=b}let i=e.readVarint(!0);t.path=new Array(i);for(let g=0;g<i;++g){let x={name:e.readString()||"",bones:[],target:"",positionMode:"fixed",spacingMode:"length",rotateMode:"tangent",rotation:0,position:0,spacing:0,rotateMix:0,translateMix:0};x.order=e.readVarint(!0);let y=e.readVarint(!0);x.bones=new Array(y);for(let w=0;w<y;++w)t.bones&&(x.bones[w]=t.bones[e.readVarint(!0)].name);t.slots&&(x.target=t.slots[e.readVarint(!0)].name),x.positionMode=["fixed","percent"][e.readVarint(!0)],x.spacingMode=["length","fixed","percent"][e.readVarint(!0)],x.rotateMode=["tangent","chain","chainScale"][e.readVarint(!0)],x.rotation=e.readFloat(),x.position=e.readFloat(),x.spacing=e.readFloat(),x.rotateMix=e.readFloat(),x.translateMix=e.readFloat(),t.path[g]=x}t.skins={};let h=[],d=Do(e,t,s);t.skins.default=d,h.push({name:"default",data:d});let u=e.readVarint(!0);for(let g=0;g<u;++g){let b=e.readString()||"",x=Do(e,t,s);t.skins[b]=x,h.push({name:b,data:x})}let p=e.readVarint(!0);t.events={};for(let g=0;g<p;++g){let b=e.readString()||"",x={intValue:e.readVarint(!1),floatValue:e.readFloat(),stringValue:e.readString()||void 0};r===37&&(x.audioPath=e.readString()||void 0,x.audioPath&&(x.volume=e.readFloat(),x.balance=e.readFloat())),t.events[b]=x}let f=e.readVarint(!0);t.animations={};for(let g=0;g<f;++g){let b=e.readString()||"",x=Ah(e,t,h,r);if(!x)throw new Error("\u8BFB\u53D6\u52A8\u753B\u5217\u8868\u65F6\u51FA\u73B0\u9519\u8BEF");t.animations[b]=x}return t}function Ac(A){let t=JSON.parse(JSON.stringify(A));t.skeleton=t.skeleton||{hash:"",spine:"",width:0,height:0},t.skeleton.spine="3.8.95",t.skins&&!Array.isArray(t.skins)&&(t.skins=Object.entries(t.skins).map(([s,o])=>{for(let l in o)for(let c in o[l]){let a=o[l][c];a&&a.type==="skinnedmesh"&&(a.type="mesh")}return{name:s,attachments:o}})),t.bones&&t.bones.forEach(s=>{s.transform=s.transform||"normal",delete s.inheritScale,delete s.inheritRotation});let e=s=>(s%360+360)%360,n=(s,o)=>{if(!(!s||typeof s!="object"))for(let[l,c]of Object.entries(s))if(Array.isArray(c)){if(c.forEach(a=>{if(Array.isArray(a.curve)){let[i,h,d,u]=a.curve;a.curve=i??0,h!==void 0&&(a.c2=h),d!==void 0&&(a.c3=d),u!==void 0&&(a.c4=u)}}),l==="flipX"||l==="flipY"){if(c.length>0){let a=l==="flipX";if(s.scale&&s.scale.forEach(i=>{a?i.x=(i.x||1)*-1:i.y=(i.y||1)*-1}),s.rotate){let h=(t.bones?t.bones.find(d=>d.name===o):null)?.rotation||0;s.rotate.forEach(d=>{d.angle_old=d.angle;let u=-(d.angle+h*2)+180;d.angle=e(u)})}}delete s[l]}}else n(c,l)};t.animations&&(n(t.animations),Object.values(t.animations).forEach(s=>{s.paths&&(s.path=s.paths,delete s.paths)}));let r=(s,o=0)=>{Array.isArray(s)&&s.forEach((l,c)=>{l.order===void 0&&(l.order=o==="index"?c:o)})};return r(t.ik,"index"),r(t.path,2),t}function Rd(A){return Ac(A)}var vh={20:{target:"38",handler:"readSkeletonData21"},21:{target:"38",handler:"readSkeletonData21"},34:{target:"38",handler:"readSkeletonData34And35"},35:{target:"38",handler:"readSkeletonData34And35"},36:{target:"38",handler:"readSkeletonData36And37"},37:{target:"38",handler:"readSkeletonData36And37"},38:{target:"38",handler:null},40:{target:"40",handler:null},41:{target:"41",handler:null},42:{target:"42",handler:null},43:{target:"42",handler:null}};function $f(A,t="ascii"){return new TextDecoder(t).decode(A)}function Ch(A){if(!A)return null;if(typeof A=="object"){if(A.skeleton&&A.skeleton.spine){let t=A.skeleton.spine;return t.length<=3?t.replace(".",""):t.slice(0,3).replace(".","")}return null}if(typeof A=="string"){let t=[[9,"4.0"],[9,"4.1"],[9,"4.2"],[9,"4.3"],[29,"3.8"],[29,"3.7"],[29,"3.6"],[29,"3.5"],[29,"3.4"],[29,"2.1"]];for(let e=0;e<t.length;e++){let[n,r]=t[e],o=A.slice(n,n+6).match(/\d\.\d\.\d\d/g);if(o&&o[0].startsWith(r))return o[0].slice(0,3).replace(".","")}}return null}function kc({data:A,type:t,fallbackVersion:e}){let n="";if(t==="skel")n=$f(new Uint8Array(A).slice(0,40));else try{n=typeof A=="string"?JSON.parse(A):A}catch{}return Ch(n)||e||null}var zf=(()=>{let A=new Float32Array(256);for(let t=1;t<256;t++)A[t]=255/t;return A[0]=0,A})();function Eh(A,t=10){if(!A)return!1;for(let e=0;e<A.length;e+=4){let n=A[e],r=A[e+1],s=A[e+2],o=A[e+3]+t;if(n>o||r>o||s>o)return!1}return!0}function Pd(A){if(!A)return!1;let t=Array.isArray(A)?A[0]:A;t.texture&&(t=t.texture);let e=t.resource;if(!e)return!1;if(e.source){let n=document.createElement("canvas"),r=n.getContext("2d",{premultiplyAlpha:"none"});if(!r)return!1;n.width=t.width,n.height=t.height,r.drawImage(e.source,0,0);let s=r.getImageData(0,0,n.width,n.height);return Eh(s.data,20)}else if(e.data)return Eh(e.data,20);return!1}function Yd(A,t,e,n,r){let s=new Uint8Array(n*r*4);for(let o=0;o<r;o++)for(let l=0;l<n;l++){let c=Math.floor(l*(t/n)),i=(Math.floor(o*(e/r))*t+c)*4,h=(o*n+l)*4;s.set(A.subarray(i,i+4),h)}return s}function Xd(A){let t=A.length,e=new Uint8ClampedArray(t);e.set(A);for(let n=0;n<t;n+=4){let r=A[n+3];if(r>0&&r<255){let s=zf[r];e[n]=A[n]*s,e[n+1]=A[n+1]*s,e[n+2]=A[n+2]*s}}return new Uint8Array(e.buffer)}var Ld=null;function Nd(A){if(Ld=A,typeof window<"u"){let t=window;t.PIXI=t.PIXI||A,t.PIXI.spine=t.PIXI.spine||{},Object.assign(t.PIXI.spine,Sh)}}function Ic(){return Ld||(typeof window<"u"?window.PIXI:null)}if(typeof window<"u"){let A=window;A.PIXI=A.PIXI||{},A.PIXI.spine=A.PIXI.spine||{},Object.assign(A.PIXI.spine,Sh)}var Hf={readSkeletonData21:kh,readSkeletonData34And35:Ih,readSkeletonData36And37:Mh};function Qm(A){if(typeof A!="string"||!A)return"";let t=A.replace(/\\/g,"/"),e=t.lastIndexOf("/");return e===-1?"":t.substring(0,e+1)}function td(A){let t=A.split(/\r?\n/),e=[];for(let n=0;n<t.length;n++){let r=t[n].trim(),s=r.toLowerCase();if(s.endsWith(".png")||s.endsWith(".jpg")||s.endsWith(".jpeg")||s.endsWith(".webp")||s.includes("blob:")){let l=(t[n+1]||"").match(/size\s*:\s*(\d+)\s*,\s*(\d+)/);e.push({name:r,width:l?parseInt(l[1]):0,height:l?parseInt(l[2]):0})}}return e}function Od(A,t={}){if(!A)throw new Error("\u5730\u5740\u4E0D\u5B58\u5728");if(typeof A=="string"){let e=A.endsWith(".skel");if(!e&&!A.endsWith(".json"))throw new Error(`\u683C\u5F0F\u4E0D\u652F\u6301: ${A}`);return{type:e?"skel":"json",path:[A,t.atlasPath||A.replace(/\.(skel|json)$/,".atlas"),t.texturePath||Qm(A)],atlasPath:t.atlasPath,texturePath:t.texturePath}}return{...A,atlasPath:t.atlasPath||A.atlasPath||A.path[1],texturePath:t.texturePath||A.texturePath||A.path[2]||Qm(A.path[0])}}function _m(A,t){return td(A).map(e=>{let n=e.name;return!e.name.startsWith("blob:")&&!e.name.startsWith("http:")&&!e.name.startsWith("https:")&&!e.name.startsWith("data:")&&(n=t+e.name),{name:e.name,src:n}})}async function Gf(A){let t=Ic();if(!t)throw new Error("PIXI \u5B9E\u4F8B\u4E0D\u5B58\u5728\uFF0C\u8BF7\u786E\u4FDD\u5DF2\u52A0\u8F7D PixiJS \u6216\u901A\u8FC7 registerPIXI() \u6CE8\u518C");return await t.Assets.load(A)}function Th(A,t="text",e={}){return new Promise((n,r)=>{let s=new XMLHttpRequest;s.open("GET",A,!0),s.responseType=t,s.onload=()=>{s.status>=200&&s.status<300||s.status===0?n({data:s.response,status:s.status}):r(new Error(`HTTP ${s.status} : ${A}`))},e.onProgress&&(s.onprogress=o=>{o.lengthComputable&&e.onProgress(Math.round(o.loaded/o.total*100))}),s.onerror=()=>r(new Error("\u7F51\u7EDC\u8BF7\u6C42\u9519\u8BEF")),s.send()})}async function Ud(A){let{version:t,type:e,skeletonData:n,atlasData:r,textureData:s,originalSpine:o}=A,l=Ic();if(!l||!l.spine)throw new Error("\u672A\u52A0\u8F7D PIXI.spine \u63D2\u4EF6\u6216\u672A\u901A\u8FC7 registerPIXI() \u6CE8\u518C");let c=l.spine[`spine${t}`]||l.spine,a=td(r),i=new Map(a.map(g=>[g.name,g]));await Promise.all(s.map(async g=>{g.name.includes(".")||(g.name+=".png");let b=i.get(g.name);if(b){if(g.src)g.texture=await Gf(g.src);else if(g.data){let x=g.data;(g.width!==b.width||g.height!==b.height)&&(Eh(x)&&(g.texture.isPremultipliedToStraight=!0,x=Xd(x)),x=Yd(x,g.width,g.height,b.width,b.height));let y=new l.TextureSource({resource:x,width:b.width,height:b.height});g.texture=new l.Texture({source:y})}g.texture&&(g.texture.width!==b.width||g.texture.height!==b.height)&&(g.texture.frame.width=b.width,g.texture.frame.height=b.height,g.texture.update())}}));let h;if(parseInt(t,10)<42)h=new l.spine.TextureAtlas(r,(g,b)=>{let x=s.find(y=>y.name===g);b(x?x.texture:null)});else{h=new c.TextureAtlas(r);for(let g of h.pages){let b=s.find(x=>x.name===g.name);b&&g.setTexture(c.SpineTexture.from(b.texture.source))}}let d=new c.AtlasAttachmentLoader(h),u,p=n;return e==="skel"?(u=new c.SkeletonBinary(d),p=new Uint8Array(n)):(u=new c.SkeletonJson(d),typeof n=="string"&&(p=JSON.parse(n))),{spine:u.readSkeletonData?u.readSkeletonData(p):u.SkeletonData(p),atlas:d,texture:s.map(g=>g.texture).filter(Boolean),originalSpine:o,version:t,setPremultiplied:function(g){let b=g||Pd(this.texture[0]);this.texture.forEach(x=>{x.isPremultipliedToStraight||(x.isPremultipliedToStraight=!0,x.source.alphaMode=b?l.ALPHA_MODES.PREMULTIPLIED_ALPHA:l.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA)})}}}async function Wd(A){let{version:t,skelData:e,atlasData:n,textureData:r}=A,s=vh[t];if(!s)throw new Error(`\u4E0D\u53D7\u652F\u6301\u7684spine\u7248\u672C: ${t}`);let o=e,l=null,c=a=>a instanceof ArrayBuffer?"skel":typeof a=="string"?"json":"obj";if(s.handler){let a=c(o);if(a==="skel"){let i=Hf[s.handler];i&&(o=i(e))}a=c(o),a==="json"&&(o=JSON.parse(o)),c(o)==="obj"&&(l=o,o=Ac(o))}return Ud({version:s.target,type:c(o),skeletonData:o,atlasData:n,textureData:Array.isArray(r)?r:[r],originalSpine:l})}async function qd(A,t={}){let e=A&&typeof A=="object"&&("skeletonData"in A||"atlasData"in A);try{let n,r,s,o,l,c=null;if(e){let i=A;n=i.skeletonData,r=i.atlasData||"",o=n instanceof ArrayBuffer||n instanceof Uint8Array?"skel":"json";let h=i.texturePath||t.texturePath||"";s=i.textureData||_m(r,h),l=i.version||t.version||kc({data:n,type:o,fallbackVersion:t.version}),c={type:o,path:i.path||[],atlasPath:i.atlasPath||"",texturePath:h,version:l}}else{let i=Od(A,t),h=i.type==="skel"?"arraybuffer":"text";o=i.type,c=i;let[d,u]=await Promise.all([Th(i.path[0],h,{onProgress:t.onProgress}),Th(i.atlasPath||i.path[1],"text")]);n=d.data,r=u.data,s=_m(r,i.texturePath||i.path[2]),l=kc({data:n,type:o,fallbackVersion:i.version})}if(!l)throw new Error("\u672A\u77E5\u7248\u672C\u53F7\u6216\u8005\u975Espine\u6587\u4EF6");return{...await Wd({version:l,skelData:n,atlasData:r,textureData:s,fileType:o}),info:c}}catch(n){throw console.error("\u52A0\u8F7DSpine\u8D44\u6E90\u5931\u8D25:",n),n}}function $d(A){let t=Ic();if(!t||!t.spine)throw new Error("\u672A\u52A0\u8F7D PIXI.spine \u63D2\u4EF6\u6216\u672A\u901A\u8FC7 registerPIXI() \u6CE8\u518C");let n=A.version==="42"||A.version===42||A.version==="43"||A.version===43?t.spine.spine42:t.spine,r=new n.Spine(A.spine),s=new n.SpineDebugRenderer;return{spine:r,debug:s,setDebug:function(){this.spine.debug=this.debug}}}var zd={load:qd,spine:$d,loadFile:Th,detectSpineVersion:kc,isVersion:Ch,versionMap:vh,registerPIXI:Nd,getPIXI:Ic,normalizeTo38:Ac};if(typeof window<"u"){let A=window;A.SimplePixiSpine=A.SimplePixiSpine||zd}var jf=zd;return _d(Zf);})();
|
|
37
|
+
//# sourceMappingURL=simple-pixi-spine.js.map
|